forked from rackerlabs/wadl-tools
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request rackerlabs#140 from RackerWilliams/s9.7
Move to Saxon 9.7.x
- Loading branch information
Showing
6 changed files
with
91 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.rackspace.cloud.api.wadl.util | ||
|
||
import org.xml.sax.SAXParseException | ||
import scala.annotation.tailrec | ||
|
||
trait XSLErrorDispatcher { | ||
// | ||
// The error listener may send a SAXParseException, but newer | ||
// versions of Saxon hide this in a RunTimeException, this call | ||
// captures the error...traverses the cause and rethrows the | ||
// SAXParseException. | ||
// | ||
def handleXSLException (f : => Any) : Unit = { | ||
try { | ||
f | ||
} catch { | ||
case e : RuntimeException => handleRTException(e) | ||
case t : Throwable => throw t | ||
} | ||
} | ||
|
||
@tailrec | ||
private def handleRTException(first : RuntimeException, e : Option[RuntimeException]=None) : Unit = | ||
e.getOrElse(first).getCause() match { | ||
case se : SAXParseException => throw se | ||
case rt : RuntimeException => handleRTException(first, Some(rt)) | ||
case _ => throw first | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters