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>PrivilegedExceptionAction<Void>() {
          public FileInputStreamVoid run() throws IOException, 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;         return null; // nothing to return.
          }
        }
      );
    } 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="bc93c776c490ac66-a36c9185-4b8b4979-b41696b9-ad8f6c9a45c4ee2fc7d05104"><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="39176a58eb403fb9-527f3384-40344ad0-adfab0ac-d55fca3903a439bb9ea25ad9"><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="e9b282336649252e-c1a7a4e8-4b654e11-81e7b100-5f1048c4dd1f86c2f0ef3269"><ac:plain-text-body><![CDATA[

[[Ware 2008

AA. References#Ware 08]]

 

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

...