Audit - Rules - UI Specific (SWT)DescriptionThis group contains audit rules that look for possible errors or problems related to the use of user interface elements (Swing, AWT, SWT, JFace). |
Rules: |
Summary
You should invoke the dispose()
method for objects which are types or subtypes of classes that are situated in org.eclipse.swt.graphics
package.
Description
This rule looks for places where such objects are created and then checks that dispose()
was invoked.
Security Implications
An SWT resource that is not properly closed is a reasource leak. When created, an SWT object takes system resources that will not be freed if dispose() is not called. Sooner or later this will cause denial in creation of new SWT objects resulting in a runtime exception. This could be used to create a potential denial-of-service state or reveal security-sensitive parts of an application's design through the stack trace.
Example
The following creation of an object would be marked as a violation because the dispose()
method is not invoked:
public class Sample {
public void sampleMeth( Display display ) {
ImageData imageData = new ImageData("filename");
Image image = new Image(display, imageData);
}
}