Skip to content

fixes error with text encodinf of Manifest #10

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

Merged
merged 1 commit into from
Feb 17, 2016

Conversation

lordofthejars
Copy link
Contributor

@reviewbybees

@ghost
Copy link

ghost commented Feb 17, 2016

This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation.

@oleg-nenashev
Copy link
Member

Would be great if you clarify what was the problem

@lordofthejars
Copy link
Contributor Author

@oleg-nenashev the readManifest logic reads the content of MANIFEST.MF and passes to Manifest class in form of StringInputStream. The problem is that depending on the encodings of where you are running the logic, you get an invalid header exception. To fix this you need to pass the string to byte array using UTF-8 encoding and then pass the result to Manifest

@oleg-nenashev
Copy link
Member

OK, 🐝

@@ -74,7 +75,7 @@ protected SimpleManifest run() throws Exception {
}

private SimpleManifest parseText(String text) throws IOException {
Manifest manifest = new Manifest(new StringInputStream(text));
Manifest manifest = new Manifest(new ByteArrayInputStream(text.getBytes("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.

Manifest files should always be encoded as UTF-8, so this is good

@stephenc
Copy link
Member

🐝

rsandell added a commit that referenced this pull request Feb 17, 2016
fixes error with text encoding of Manifest
@rsandell rsandell merged commit 1c17ac5 into jenkinsci:master Feb 17, 2016
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.

4 participants