@@ -52,7 +52,7 @@ public abstract class ResolutionStrategy extends AbstractResolutionStrategy {
5252 public final Path processingRootPath ;
5353 public final Model aspectModel ;
5454
55- public ResolutionStrategy ( final String aspectModel , final Path processingRootPath ) throws RiotException {
55+ public ResolutionStrategy ( final String aspectModel , final Path processingRootPath ) {
5656 this .processingRootPath = processingRootPath ;
5757 this .aspectModel = loadTurtleFromString ( aspectModel );
5858 }
@@ -95,8 +95,15 @@ private Try<Model> tryOnFailure( final AspectModelUrn aspectModelUrn ) {
9595 protected Model loadTurtleFromString ( final String aspectModel ) {
9696 try ( ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream (
9797 aspectModel .getBytes ( StandardCharsets .UTF_8 ) ) ) {
98- return TurtleLoader .loadTurtle ( byteArrayInputStream ).getOrElseThrow (
99- error -> new RiotException ( error .getCause ().getMessage (), error .getCause () ) );
98+ Try <Model > resultTry = TurtleLoader .loadTurtle ( byteArrayInputStream );
99+
100+ if ( resultTry .isFailure () ) {
101+ Throwable cause = resultTry .getCause ();
102+ String errorMessage = cause != null ? cause .getMessage () : "Unknown Error" ;
103+ throw new RiotException ( errorMessage , cause );
104+ }
105+
106+ return resultTry .get ();
100107 } catch ( IOException e ) {
101108 LOG .error ( "Cannot read file." );
102109 throw new FileReadException ( "Error reading the Aspect Model file." , e );
0 commit comments