SecurityManager Support

Pnuts . evalDepth()

The static method evalDepth() returns how many interpreters are nested. That is, the initial value is zero and load(), eval(), and loadFile() increment the number. PnutsFunction.call() and PnutsFunction::call() also increment the number.

class PnutsSecurityManager extends SecurityManager {
    public void checkWrite(String file) {
    	if (Pnuts.evalDepth() > 0){
	    throw new SecurityException();
	}
    }
    ...
}
...

  System.setSecurityManager(new PnutsSecurityManager());
  ...

Back