Skip to content

Commit

Permalink
FOP-3174: Allow sections which need security permissions to be run wh…
Browse files Browse the repository at this point in the history
…en AllPermission denied in caller code
  • Loading branch information
simonsteiner1984 committed Apr 2, 2024
1 parent de9d1b1 commit 64846a5
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions fop-core/src/main/java/org/apache/fop/apps/FopFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,26 @@ public FopFactory run() {
* @throws SAXException
* @throws IOException
*/
public static FopFactory newInstance(URI baseURI, InputStream confStream) throws SAXException,
public static FopFactory newInstance(final URI baseURI, final InputStream confStream) throws SAXException,
IOException {
return new FopConfParser(confStream, baseURI).getFopFactoryBuilder().build();
Object action = AccessController.doPrivileged(
new PrivilegedAction<Object>() {
public Object run() {
try {
return new FopConfParser(confStream, baseURI).getFopFactoryBuilder().build();
} catch (SAXException | IOException e) {
return e;
}
}
}
);
if (action instanceof SAXException) {
throw (SAXException) action;
}
if (action instanceof IOException) {
throw (IOException) action;
}
return (FopFactory) action;
}

/**
Expand Down

0 comments on commit 64846a5

Please sign in to comment.