Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unclosed streams #18

Open
batzorigt opened this issue Aug 22, 2019 · 3 comments
Open

Unclosed streams #18

batzorigt opened this issue Aug 22, 2019 · 3 comments

Comments

@batzorigt
Copy link
Contributor

batzorigt commented Aug 22, 2019

There are unclosed streams everywhere!
For example:
`

  public byte[] getDirectoryData() throws IOException {
        WoffOutputStream writer = new WoffOutputStream();

        writer.writeString(tag);
        writer.writeInt(offset);
        writer.writeInt(getCompressedData().length - paddingAdded);
        writer.writeInt(tableData.length);
        writer.writeUnsignedInt((int) checksum);

        return writer.toByteArray();
    }

`

It should be like

`

                WoffOutputStream writer = new WoffOutputStream();
		
		try {
			writer.writeString(tag);
			writer.writeInt(offset);
			writer.writeInt(getCompressedData().length - paddingAdded);
			writer.writeInt(tableData.length);
			writer.writeUnsignedInt((int) checksum);
			return writer.toByteArray();
		} finally {
			IOUtils.closeQuietly(writer);
		}

`

@batzorigt
Copy link
Contributor Author

batzorigt commented Aug 22, 2019

or it should be like
`

public byte[] getDirectoryData() throws IOException {
    try (WoffOutputStream writer = new WoffOutputStream()) {
        writer.writeString(tag);
        writer.writeInt(offset);
        writer.writeInt(getCompressedData().length - paddingAdded);
        writer.writeInt(tableData.length);
        writer.writeUnsignedInt((int) checksum);
        return writer.toByteArray();
    }
}
`

batzorigt pushed a commit to batzorigt/FontVerter that referenced this issue Aug 22, 2019
batzorigt pushed a commit to batzorigt/FontVerter that referenced this issue Aug 22, 2019
batzorigt pushed a commit to batzorigt/FontVerter that referenced this issue Aug 22, 2019
batzorigt added a commit to batzorigt/FontVerter that referenced this issue Aug 22, 2019
batzorigt pushed a commit to batzorigt/FontVerter that referenced this issue Aug 22, 2019
batzorigt pushed a commit to batzorigt/FontVerter that referenced this issue Aug 22, 2019
batzorigt pushed a commit to batzorigt/FontVerter that referenced this issue Aug 22, 2019
batzorigt pushed a commit to batzorigt/FontVerter that referenced this issue Aug 22, 2019
batzorigt pushed a commit to batzorigt/FontVerter that referenced this issue Aug 22, 2019
batzorigt pushed a commit to batzorigt/FontVerter that referenced this issue Aug 22, 2019
batzorigt pushed a commit to batzorigt/FontVerter that referenced this issue Aug 22, 2019
batzorigt pushed a commit to batzorigt/FontVerter that referenced this issue Aug 22, 2019
batzorigt pushed a commit to batzorigt/FontVerter that referenced this issue Aug 22, 2019
batzorigt pushed a commit to batzorigt/FontVerter that referenced this issue Aug 22, 2019
batzorigt pushed a commit to batzorigt/FontVerter that referenced this issue Aug 22, 2019
batzorigt pushed a commit to batzorigt/FontVerter that referenced this issue Aug 22, 2019
batzorigt pushed a commit to batzorigt/FontVerter that referenced this issue Aug 22, 2019
batzorigt pushed a commit to batzorigt/FontVerter that referenced this issue Aug 22, 2019
batzorigt pushed a commit to batzorigt/FontVerter that referenced this issue Aug 22, 2019
@batzorigt
Copy link
Contributor Author

I eliminated all warnings of "resource is never closed"

@batzorigt
Copy link
Contributor Author

I eliminated all warnings of "resource is never closed"

This changes are made in my fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant