All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.samples.java.ex.WEM_Sample Maven / Gradle / Ivy

Go to download

An auxiliary findbugs.sourceforge.net plugin for java bug detectors that fall outside the narrow scope of detectors to be packaged with the product itself.

The newest version!
package ex;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

public class WEM_Sample {
    public void badException(String s) {
        if (s.length() == 1) {
            throw new IllegalArgumentException("You stink");
        }
    }

    public void goodException(String s) {
        if (s.length() == 1) {
            throw new IllegalArgumentException("You stink -->" + s);
        }
    }

    public static void ok() {
        throw new RuntimeException("Wow");
    }

    public static void wrappingWithException() throws Exception {
        InputStream is = null;
        try {
            is = new FileInputStream("who dat");

        } catch (IOException ioe) {
            throw new Exception(ioe);
        }
    }

    public void fpunimpled() {
        throw new UnsupportedOperationException("fpunimpled is unimpled");
    }

    static {
        try (InputStream is = WEM_Sample.class.getResourceAsStream("/foo/bar")) {
            if (is == null) {
                throw new Error("Couldn't open foo/bar");
            }
        } catch (IOException e) {
            throw new Error("Couldn't open foo/bar", e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy