[ https://issues.apache.org/jira/browse/LUCENE-4332?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13443449#comment-13443449 ]
Greg Bowyer edited comment on LUCENE-4332 at 8/29/12 6:48 AM: -------------------------------------------------------------- Following up it turns out to be *very* simple to do the security manager trick {code:java} import java.io.File; public class Test { public static void main(String... args) { System.setSecurityManager(new SecurityManager() { public void checkDelete(String file) throws SecurityException { File fp = new File(file); String path = fp.getAbsolutePath(); if (!path.startsWith("/tmp")) { throw new SecurityException("Bang!"); } } }); new File("/home/greg/test").delete(); } } {code} {code} Exception in thread "main" java.lang.SecurityException: Bang! at Test$1.checkDelete(Test.java:12) at java.io.File.delete(File.java:971) at Test.main(Test.java:17) {code} There is a lot of scope here if you want to abuse checking for all sorts of things (files, sockets, threads etc) was (Author: gbow...@fastmail.co.uk): Following up it turns out to be *very* simple to do the security manager trick {code:java} import java.io.File; public class Test { public static void main(String... args) { System.setSecurityManager(new SecurityManager() { public void checkDelete(String file) throws SecurityException { File fp = new File(file); String path = fp.getAbsolutePath(); if (!path.startsWith("/tmp")) { throw new SecurityException("Bang!"); } } }); new File("/home/greg/test").delete(); } } {code} {code} Exception in thread "main" java.lang.SecurityException: Bang! at Test$1.checkDelete(Test.java:12) at java.io.File.delete(File.java:971) at Test.main(Test.java:17) {code} > Integrate PiTest mutation coverage tool into build > -------------------------------------------------- > > Key: LUCENE-4332 > URL: https://issues.apache.org/jira/browse/LUCENE-4332 > Project: Lucene - Core > Issue Type: Improvement > Affects Versions: 4.1, 5.0 > Reporter: Greg Bowyer > Assignee: Greg Bowyer > Labels: build > Attachments: > LUCENE-4332-Integrate-PiTest-mutation-coverage-tool-into-build.patch, > LUCENE-4332-Integrate-PiTest-mutation-coverage-tool-into-build.patch > > > As discussed briefly on the mailing list, this patch is an attempt to > integrate the PiTest mutation coverage tool into the lucene build -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org