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

Fix NPE in BasicRestProjectGenerator when a resource is missing #3480

Merged
merged 1 commit into from
Aug 12, 2019

Conversation

ia3andy
Copy link
Contributor

@ia3andy ia3andy commented Aug 12, 2019

Throw a dedicated IOException instead.
Closes #3331

Copy link
Contributor

@geoand geoand 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 👍

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.*;
Copy link
Member

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);
Copy link
Member

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?

@ia3andy
Copy link
Contributor Author

ia3andy commented Aug 12, 2019

@gsmet how does that sound now?

Copy link
Member

@gsmet gsmet left a 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.

@gsmet gsmet added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Aug 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage/waiting-for-ci Ready to merge when CI successfully finishes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NPE when using io.quarkus.cli.commands.CreateProject.doCreateProject() on native image
3 participants