...
Code Block | ||
---|---|---|
| ||
package trusted;
import untrusted.RetValue;
public class MixMatch {
private void privilegedMethod() throws IOException {
try {
AccessController.doPrivileged(
new PrivilegedExceptionAction<FileInputStream>() {
public FileInputStream run() throws FileNotFoundException {
final FileInputStream fis = new FileInputStream("file.txt");
try {
RetValue rt = new RetValue();
if (rt.getValue() == 1) {
// do something with sensitive file
}
} finally {
fis.close();
}
??????return fis;
}
}
);
} catch (PrivilegedActionException e) {
// forward to handler and log
}
}
public static void main(String[] args) throws IOException {
MixMatch mm = new MixMatch();
mm.privilegedMethod();
}
}
// In another JAR file:
package untrusted;
class RetValue {
public int getValue() {
return 1;
}
}
|
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="2b8a47c6a4d3d4f6-7cf19829-4fde468c-8dc38bc4-fe28537004e663d3e2cf9d21"><ac:plain-text-body><![CDATA[ | [[EMA 2011 | AA. References#EMA 2011]] | Optional Package Sealing | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="0cff55309e3e7c0a-d6616915-4750471f-b18dab2b-5af89b24b5a4c6b7c8ab749b"><ac:plain-text-body><![CDATA[ | [[McGraw 1999 | AA. References#Ware 99]] | Rule 7, If you must sign your code, put it all in one archive file | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="5ab0b112cbeb1cc2-072d2008-473545b7-bc1a9868-9f541ac0df60bc95736f46d7"><ac:plain-text-body><![CDATA[ | [[Ware 2008 | AA. References#Ware 08]] |
| ]]></ac:plain-text-body></ac:structured-macro> |
...