-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Fix NPE in BasicRestProjectGenerator when a resource is missing #3480
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
import java.io.ByteArrayInputStream; | ||
import java.io.IOException; | ||
import java.io.InputStreamReader; | ||
import java.io.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't do star imports, could you change that?
@@ -111,8 +108,12 @@ private void generate(final String templateName, final Map<String, Object> conte | |||
throws IOException { | |||
if (!writer.exists(outputFilePath)) { | |||
String path = templateName.startsWith("/") ? templateName : "/" + templateName; | |||
InputStream resourceStream = getClass().getResourceAsStream(path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if we should have a try with resources here and properly close the stream?
@gsmet how does that sound now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's wait for CI.
Throw a dedicated IOException instead. Closes quarkusio#3331
Throw a dedicated IOException instead.
Closes #3331