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

remove usage of IOUtil.close #149

Merged
merged 1 commit into from
Feb 21, 2024
Merged

Conversation

ebarboni
Copy link
Contributor

remove deprecation and use try with resources to get rid of this old code

@ebarboni ebarboni requested a review from mbien February 21, 2024 09:13
Copy link
Member

@mbien mbien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good.

I think it would be ok to use regular formatting for updated code sections if you want. This would make the formatting patch in future smaller.

InputStream instream = null;
OutputStream output = null;
try
try (InputStream instream = getClass().getClassLoader().getResourceAsStream( path ); OutputStream output = new BufferedOutputStream( new FileOutputStream( destSh ) ))
Copy link
Member

@mbien mbien Feb 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

split in two lines maybe?

       try (InputStream instream = getClass().getClassLoader().getResourceAsStream(path);
            OutputStream output = new BufferedOutputStream(new FileOutputStream(destSh))) {

Comment on lines 649 to 650
try ( Reader source = new BufferedReader( new InputStreamReader( instream, "UTF-8" ) ); Writer destination = new OutputStreamWriter( outstream, "UTF-8" ); )
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

        try (Reader source = new BufferedReader(new InputStreamReader(instream, "UTF-8")); 
             Writer destination = new OutputStreamWriter(outstream, "UTF-8"))  {

@ebarboni
Copy link
Contributor Author

ebarboni commented Feb 21, 2024

I will do on two line. I think I will have nervous breakdown and autoformat all and do a no op push to have in native NetBeans format like nb-pakage.
But I think NetBeans do it one line for the try with resources.

@mbien
Copy link
Member

mbien commented Feb 21, 2024

NB can format code sections. You select something and format.

@ebarboni
Copy link
Contributor Author

Yep but changing for new code will make the source a patchwork

@ebarboni ebarboni merged commit 0752ada into apache:master Feb 21, 2024
4 checks passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants