Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#FFcccc
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="263f30590ad76a7e-08b4efe7-412d4805-8cf7b348-2ab412f68a0242b9e5d6038c"><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="e7afc1fd8e9029cd-048834ad-41f24195-8db887bc-c39348a931a0bc97fda3ef54"><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="a8b0f897ca5ba514-2656e043-45df4acc-af4f9451-0689444da9b02c59212794de"><ac:plain-text-body><![CDATA[

[[Ware 2008

AA. References#Ware 08]]

 

]]></ac:plain-text-body></ac:structured-macro>

...