Skip to content

[MRESOLVER-672] Use try with resources #1346

Open
@jira-importer

Description

@jira-importer

Elliotte Rusty Harold opened MRESOLVER-672 and commented

Various opportunities including TestFileProcessor

 

    public void write(File target, InputStream source) throws IOException {
        mkdirs(target.getAbsoluteFile().getParentFile());

        OutputStream fos = null;
        try {
            fos = new BufferedOutputStream(new FileOutputStream(target));

            copy(fos, source, null);

            fos.close();
            fos = null;
        } finally {
            try {
                if (fos != null) {
                    fos.close();
                }
            } catch (final IOException e) {
                // Suppressed due to an exception already thrown in the try block.
            }
        }
    }


No further details from MRESOLVER-672

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority:minorMinor loss of function, or other problem where easy workaround is present

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions