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

Jetty 12 : XmlAppendable use Charset, not String #8609

Merged
merged 3 commits into from
Sep 22, 2022

Conversation

joakime
Copy link
Contributor

@joakime joakime commented Sep 22, 2022

Change to have XmlAppendable use Charset not String to create outputstream and whatnot.

Taken from PR #8597

@joakime joakime requested a review from sbordet September 22, 2022 11:13
@joakime joakime self-assigned this Sep 22, 2022
Copy link
Contributor Author

@joakime joakime left a comment

Choose a reason for hiding this comment

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

I'm going to collapse these constructors into 1

}

public XmlAppendable(Appendable out) throws IOException
{
this(out, 2);
}

public XmlAppendable(Appendable out, String encoding) throws IOException
public XmlAppendable(Appendable out, Charset charset) throws IOException
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This constructor is not used outside of this class, can probably be removed.

{
this(out, 2, encoding);
this(out, 2, charset);
}

public XmlAppendable(Appendable out, int indent) throws IOException
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This constructor is not used outside of this class, can probably be removed.

}

public XmlAppendable(Appendable out, int indent, String encoding) throws IOException
public XmlAppendable(Appendable out, int indent, Charset charset) throws IOException
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This constructor is not used outside of this class, can probably be removed/collapsed into the constructors that are used.

@@ -30,31 +33,31 @@
private final Stack<String> _tags = new Stack<>();
private String _space = "";

public XmlAppendable(OutputStream out, String encoding) throws IOException
public XmlAppendable(OutputStream out, Charset charset) throws IOException
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This constructor is never used with a Charset that isn't UTF-8, should probably just remove this constructor too and have only 1 constructor that has only 1 parameter OutputStream.

Copy link
Contributor

@sbordet sbordet left a comment

Choose a reason for hiding this comment

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

LGTM apart the possibly 2 unnecessary imports.

@@ -16,6 +16,7 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessary import?

@@ -16,6 +16,7 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessary import?

@joakime joakime merged commit b75896c into jetty-12.0.x Sep 22, 2022
@joakime joakime deleted the fix/jetty-12-xmlappendable-charset branch September 22, 2022 20:06
Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

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

retrospective +1

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.

3 participants