Tracematches Properties

From FSL
Jump to: navigation, search

Back to JavaMOPCFG

Contents

HashMap

 package tracematches;
 import java.util.*;
 
 public aspect HashMap {
   tracematch(HashMap s, Object o, int hashCode) {
   
     sym add before : call(* HashMap.put(Object,*)) && target(s) && args(o,*) && let(hashCode, o.hashCode())
       && !within(dacapo..*) && !within(tests..*)&& !within (java..* ) && !within (org.apache.commons..* ) && !within (com.sun..* )
       && !within (sun..* ) && !within (sunw..* );
     sym remove before : call(* HashMap.remove(Object)) && target(s) && args(o) && !within(dacapo..*) && !within(tests..*) 
       && !within (org.apache.commons..* ) && !within (com.sun..* ) && !within (sun..* ) && !within (sunw..* );
     sym cont before: call(* HashMap.containsKey(..)) && target(s) && args(o) && !within(dacapo..*) && !within(tests..*) 
       && !within (org.apache.commons..* ) && !within (com.sun..* ) && !within (sun..* ) && !within (sunw..* );
   
     add cont* remove | add cont {
       if(hashCode!=o.hashCode()) {    
         if(System.getProperty("TMTEST_ACTIVE")!=null) {
           System.out.println("HashCode changed for Object "+o+" while being in a HashSet.");
         }
       } 
     }
   }
 }

HasNext

 import java.util.*;
 
 public aspect HasNext {
 
   tracematch(Iterator i) {
     sym hasNext before:( call(* java.util.Iterator+.hasNext()) && target(i)) && !within(dacapo..*) && !within(tests..*) 
       && !within (org.apache.commons..* ) && !within (com.sun..* ) && !within (sun..* ) && !within (sunw..* );
     sym next before:( call(* java.util.Iterator+.next()) && target(i)) && !within(dacapo..*) && !within(tests..*)
       && !within (org.apache.commons..* ) && !within (com.sun..* ) && !within (sun..* ) && !within (sunw..* );
 
     next next
     {
       System.err.println("! hasNext() has not been called before calling next() for an iterator");
     }
   }
 }

Safe_Iterator

 import java.util.*;
 
 public aspect FailSafeIter {
   pointcut collection_update(Collection c) :
     ( call(* java.util.Collection+.add*(..)) ||
       call(* java.util.Collection+.clear()) ||
       call(* java.util.Collection+.remove*(..)) ) && target(c);
 
   tracematch(Collection c, Iterator i) {
     sym newDaCapoRun before: call(* dacapo.Benchmark.run(..));
     sym create_iter after returning(i) :( call(* java.util.Collection+.iterator()) && target(c)) && !within(dacapo..*) 
       && !within(tests..*) && !within (java..* ) && !within (org.apache.commons..* ) && !within (com.sun..* ) 
       && !within (sun..* ) && !within (sunw..* );
     sym call_next before:( call(* java.util.Iterator+.next()) && target(i)) && !within(dacapo..*) && !within(tests..*) 
       && !within (java..* ) && !within (org.apache.commons..* ) && !within (com.sun..* ) && !within (sun..* ) 
       && !within (sunw..* );
     sym update_source before :(  collection_update(c)) && !within(dacapo..*) && !within(tests..*) && !within (java..* ) 
       && !within (org.apache.commons..* ) && !within (com.sun..* ) && !within (sun..* ) && !within (sunw..* );
 
     create_iter call_next* update_source+ call_next
     {
       System.err.println("the collection is changed during iterating!");
     }
   }
 }

SafeFileInputStream

 package tracematches;
 
 import java.util.*;
 import java.io.*;
 
 public class SafeFileInputStream {
   static aspect SafeFileInputStreamCheck{
     pointcut anyfunc() : (
       execution(* org.apache.fop.fonts.apps.PFMReader.loadPFM(..)) ||
       execution(* org.apache.xerces.impl.xs.XMLSchemaLoader.xsdToXMLInputSource(..)) ||
       execution(* org.eclipse.osgi.framework.internal.core.DefaultPermissionStorage.deserializeConditionalPermissionInfos(..)) ||
       execution(* org.apache.xml.dtm.DTMManager.findFactory(..)) ||
       execution(* org.apache.lucene.demo.HTMLDocument.Document(..)) ||
       execution(* org.eclipse.osgi.framework.internal.reliablefile.ReliableFile.getInputStream(..)) ||
       execution(* com.lowagie.text.pdf.hyphenation.PatternInternalParser.parse(..)) ||
       execution(* org.hsqldb.util.SqlToolSprayer.getUrlsFromPropFile(..)) ||
       execution(* org.python.core.CachedJarsPackageManager.addJarToPackages(..)) ||
       execution(* org.python.core.CachedJarsPackageManager.inOpenIndex(..)) ||
       execution(* org.python.core.CachedJarsPackageManager.inOpenCacheFile(..)) ||
       execution(* org.eclipse.osgi.framework.adaptor.core.AbstractFrameworkAdaptor.loadProperties(..)) ||
       execution(* org.eclipse.osgi.framework.adaptor.core.AbstractFrameworkAdaptor.copyDir(..)) ||
       execution(* javax.xml.validation.SecuritySupport$3.run(..)) ||
       execution(* javax.xml.parsers.SecuritySupport$3.run(..)) ||
       execution(* com.lowagie.text.pdf.hyphenation.Hyphenator.getUserHyphenationTree(..)) ||
       execution(* javax.xml.xpath.SecuritySupport$3.run(..)) ||
       execution(* org.eclipse.core.runtime.internal.adaptor.PluginConverterImpl.upToDate(..)) ||
       execution(* org.apache.xml.serialize.ObjectFactory.createObject(..)) ||
       execution(* org.eclipse.osgi.framework.util.SecureAction.getFileInputStream(..)) ||
       execution(* net.sourceforge.pmd.ant.PMDTask.execute(..)) ||
       execution(* org.python.core.PyFile$RFileWrapper.__tojava__(..)) ||
       execution(* org.apache.xerces.impl.dv.SecuritySupport$5.run(..)) ||
       execution(* org.eclipse.core.runtime.adaptor.LocationManager.computeDefaultUserAreaLocation(..)) ||
       execution(* org.apache.xerces.parsers.SecuritySupport$5.run(..)) ||
       execution(* javax.xml.transform.SecuritySupport$3.run(..)) ||
       execution(* org.apache.batik.util.ClassFileUtilities.getClassDependencies(..)) ||
       execution(* org.apache.batik.util.ClassFileUtilities.computeClassDependencies(..)) ||
       execution(* org.apache.xerces.dom.ObjectFactory.createObject(..)) ||
       execution(* org.eclipse.osgi.framework.util.SecureAction$4.run(..)) ||
       execution(* org.hsqldb.WebServerConnection.processGet(..)) ||
       execution(* org.hsqldb.test.ExecHarness.exec(..)) ||
       execution(* org.apache.fop.tools.anttasks.Compare.compareBytes(..)) ||
       execution(* org.apache.html.dom.SecuritySupport$5.run(..)) ||
       execution(* org.apache.lucene.store.FSDirectory.renameFile(..)) ||
       execution(* org.python.core.__builtin__.execfile_flags(..)) ||
       execution(* org.apache.fop.fonts.FontFileReader._flags*(..)) ||
       execution(* org.eclipse.core.runtime.internal.stats.ClassloaderStats.initializeTraceOptions(..)) ||
       execution(* org.hsqldb.util.TransferCommon.loadPrefs(..)) ||
       execution(* com.lowagie.text.pdf.PdfFileSpecification.fileEmbedded(..)) ||
       execution(* org.apache.xerces.xinclude.ObjectFactory.createObject(..)) ||
       execution(* org.apache.xerces.impl.dv.ObjectFactory.createObject(..)) ||
       execution(* org.apache.lucene.demo.html.Test.parse(..)) ||
       execution(* org.apache.batik.util.PreferenceManager.load(..)) ||
       execution(* org.hsqldb.util.ConnectionDialogCommon.loadRecentConnectionSettings(..)) ||
       execution(* org.jfree.chart.servlet.ServletUtilities.sendTempFile(..)) ||
       execution(* org.apache.xml.serialize.SecuritySupport$5.run(..)) ||
       execution(* org.apache.batik.ext.awt.image.codec.tiff.TIFFImageEncoder.encode(..)) ||
       execution(* jxxload_help.PathVFS$DirVFS.open(..)) ||
       execution(* org.python.core.imp.makeStream(..)) ||
       execution(* net.sourceforge.pmd.util.ResourceLoader.loadResourceAsStream(..)) ||
       execution(* junit.runner.TestCaseClassLoader.getClassData(..)) ||
       execution(* org.hsqldb.util.DatabaseManagerSwing$DBMPrefs.load(..)) ||
       execution(* org.apache.xerces.dom.SecuritySupport$5.run(..)) ||
       execution(* net.sourceforge.pmd.FileDataSource.getInputStream(..)) ||
       execution(* org.apache.fop.layout.hyphenation.HyphenationTree.main(..)) ||
       execution(* org.apache.xerces.xinclude.SecuritySupport$5.run(..)) ||
       execution(* org.python.modules.imp.newFile(..)) ||
       execution(* org.hsqldb.lib.FileUtil.openInputStreamElement(..)) ||
       execution(* org.hsqldb.util.SqlFile.execute(..)) ||
       execution(* org.hsqldb.util.SqlFile.load(..)) ||
       execution(* org.hsqldb.util.SqlFile.importCsv(..)) ||
       execution(* org.jfree.data.xml.DatasetReader.readPieDatasetFromXML(..)) ||
       execution(* org.jfree.data.xml.DatasetReader.readCategoryDatasetFromXML(..)) ||
       execution(* org.hsqldb.persist.LockFile.readHeartbeat(..)) ||
       execution(* org.hsqldb.persist.LockFile.isLocked(..)) ||
       execution(* org.apache.xerces.parsers.ObjectFactory.createObject(..)) ||
       execution(* org.apache.fop.tools.TestConverter.compareFiles(..)) ||
       execution(* org.eclipse.core.runtime.adaptor.StreamManager.getInputStream(..)) ||
       execution(* junit.runner.BaseTestRunner.readPreferences(..)) ||
       execution(* org.apache.html.dom.ObjectFactory.createObject(..)) ||
       execution(* org.xml.sax.helpers.SecuritySupport12$3.run(..)) ||
       execution(* org.apache.lucene.analysis.PorterStemmer.main(..)) ||
       execution(* org.apache.fop.fonts.type1.PFBParser.parsePFB(..)) ||
       execution(* org.eclipse.core.runtime.adaptor.EclipseBundleData.basicCheckManifest(..)) ||
       execution(* org.eclipse.osgi.framework.internal.defaultadaptor.MetaData.load(..)) ||
       execution(* org.python.core.PathPackageManager.doDir(..)) ||
       execution(* EDU.purdue.cs.bloat.file.ClassFileLoader.loadClassFromFile(..)) ||
       execution(* EDU.purdue.cs.bloat.file.ClassFileLoader.loadClass(..)) ||
       execution(* org.python.core.SyspathJavaLoader.getResourceAsStream(..)) ||
       execution(* org.python.core.SyspathJavaLoader.open(..)) ||
       execution(* org.apache.fop.layout.hyphenation.Hyphenator.getUserHyphenationTree(..)) ||
       execution(* javax.xml.datatype.SecuritySupport$3.run(..)) ||
       execution(* org.xml.sax.helpers.SecuritySupport.getFileInputStream(..)) ||
       execution(* org.hsqldb.test.SqlToolHarness$Metadata.getHarnessMetaBlock(..)) ||
       execution(* org.python.core.PySystemState.addRegistryFile(..)) ||
       execution(* javax.rmi.CORBA.GetORBPropertiesFileAction.getPropertiesFromFile(..)) ||
       execution(* javax.rmi.GetORBPropertiesFileAction.getPropertiesFromFile(..)) ||
       execution(* javax.sql.rowset.spi.SyncFactory.initMapIfNecessary(..)) ||
       execution(* org.omg.CORBA.ORB$2.getFileProperties(..)) ||
       execution(* javax.swing.UIManager$1.run(..))
     ) && !within(dacapo..*) && !within(tests..*) && !within(java..*) && !within(org.apache.commons..*) 
     && !within(com.sun..*) && !within(sun..*) && !within(sunw..*);
     pointcut open() : call(FileInputStream.new(..)) && !within(dacapo..*) && !within(tests..*) && !within (java..* ) 
       && !within (org.apache.commons..* ) && !within (com.sun..* ) && !within (sun..* ) && !within (sunw..* );
     pointcut close(FileInputStream fi) : call(* FileInputStream.close(..)) && target(fi) && !within(dacapo..*) 
       && !within(tests..*) && !within (java..* ) && !within (org.apache.commons..* ) && !within (com.sun..* ) 
       && !within (sun..* ) && !within (sunw..* );
 
     perthread tracematch(FileInputStream fi, int i)
     {
       sym beforefunc before : anyfunc() && cflowdepth(i, anyfunc());
       sym afterfunc after : anyfunc() && cflowdepth(i, anyfunc());
       sym open2 after returning(fi) : open() && cflowdepth(i, anyfunc());
       sym close2 after : close(fi) && cflowbelowdepth(i, anyfunc());
 
       beforefunc open2 afterfunc {
         System.err.println("Unmatched open/close");
       }
     }
   }
 }
Personal tools
Namespaces

Variants
Actions
Navigation