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

Make null the default encoding in various places #206

Closed
wants to merge 1 commit into from

Conversation

sschuberth
Copy link
Contributor

This usually cuases the implementation to auto-detect the encoding.

This usually cuases the implementation to auto-detect the encoding.
pdvrieze added a commit that referenced this pull request May 3, 2024
default parameters on overrides are not correct, and changing default
values is a breaking API change.
Copy link
Owner

@pdvrieze pdvrieze left a comment

Choose a reason for hiding this comment

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

Thanks for the pull request. Due to the need to maintain API compatibility I have changed some ways in which this works (with a new interface method rather than having a default argument for newReader. There were also various bits of code that I should have deleted, but hadn't yet (they were no longer in the sourceset). As such it was easier to just do the changes directly.

@@ -136,7 +136,7 @@ public actual object XmlStreaming : XmlStreamingJavaCommon(), IXmlStreaming {
public fun newGenericReader(input: String): XmlReader =
newGenericReader(StringReader(input))

public fun newGenericReader(inputStream: InputStream, encoding: String?): XmlReader =
public fun newGenericReader(inputStream: InputStream, encoding: String? = null): XmlReader =
Copy link
Owner

Choose a reason for hiding this comment

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

This is no longer part of any sourceSet, and should have been removed.

@@ -327,7 +327,7 @@ public class BetterXmlSerializer : XmlSerializer {
}

@Throws(IOException::class)
override fun setOutput(os: OutputStream?, encoding: String?) {
override fun setOutput(os: OutputStream?, encoding: String? = null) {
Copy link
Owner

Choose a reason for hiding this comment

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

This class is deprecated/unused. This function overrides a Java type, so shouldn't really have default parameter.

@@ -29,7 +29,7 @@ import kotlin.jvm.JvmInline
@ExperimentalXmlUtilApi
public class KtXmlReader internal constructor(
private val reader: Reader,
encoding: String?,
encoding: String? = null,
Copy link
Owner

Choose a reason for hiding this comment

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

This has been updated (but was internal anyway)

@@ -188,7 +188,7 @@ public actual object XmlStreaming : XmlStreamingJavaCommon(), IXmlStreaming {
public fun newGenericReader(input: String): XmlReader =
newGenericReader(StringReader(input))

public fun newGenericReader(inputStream: InputStream, encoding: String?): XmlReader =
public fun newGenericReader(inputStream: InputStream, encoding: String? = null): XmlReader =
Copy link
Owner

Choose a reason for hiding this comment

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

Not an override, so has been added.

@@ -46,7 +46,7 @@ public class StAXReader(private val delegate: XMLStreamReader) : XmlReader {
public constructor(reader: Reader) : this(safeInputFactory().createXMLStreamReader(reader))

@Throws(XMLStreamException::class)
public constructor(inputStream: InputStream, encoding: String?) : this(
public constructor(inputStream: InputStream, encoding: String? = null) : this(
Copy link
Owner

Choose a reason for hiding this comment

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

Also done.

@@ -157,7 +157,7 @@ public actual object XmlStreaming : XmlStreamingJavaCommon(), IXmlStreaming {
public fun newGenericReader(input: String): XmlReader =
newGenericReader(StringReader(input))

public fun newGenericReader(inputStream: InputStream, encoding: String?): XmlReader =
public fun newGenericReader(inputStream: InputStream, encoding: String? = null): XmlReader =
Copy link
Owner

Choose a reason for hiding this comment

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

This code is not actually in a sourceset (but forgot to delete it)

@@ -336,7 +336,7 @@ public class BetterXmlSerializer : XmlSerializer {
}

@Throws(IOException::class)
override fun setOutput(os: OutputStream?, encoding: String?) {
override fun setOutput(os: OutputStream?, encoding: String? = null) {
Copy link
Owner

Choose a reason for hiding this comment

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

Dead code

@@ -47,7 +47,7 @@ public class StAXReader(private val delegate: XMLStreamReader) : XmlReader {
public constructor(reader: Reader) : this(safeInputFactory().createXMLStreamReader(reader))

@Throws(XMLStreamException::class)
public constructor(inputStream: InputStream, encoding: String?) : this(
public constructor(inputStream: InputStream, encoding: String? = null) : this(
Copy link
Owner

Choose a reason for hiding this comment

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

This is not in a sourceset

@@ -191,7 +191,7 @@ public actual object XmlStreaming : XmlStreamingJavaCommon(), IXmlStreaming {
public fun newGenericReader(input: String): XmlReader =
newGenericReader(StringReader(input))

public fun newGenericReader(inputStream: InputStream, encoding: String?): XmlReader =
public fun newGenericReader(inputStream: InputStream, encoding: String? = null): XmlReader =
Copy link
Owner

Choose a reason for hiding this comment

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

Not in a sourceset.

@pdvrieze
Copy link
Owner

pdvrieze commented May 3, 2024

This has been implemented with an alternate implementation.

@pdvrieze pdvrieze closed this May 3, 2024
@sschuberth sschuberth deleted the default-null-encoding branch May 3, 2024 10:24
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