-
Notifications
You must be signed in to change notification settings - Fork 30
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
Conversation
This usually cuases the implementation to auto-detect the encoding.
1a6487a
to
f547a16
Compare
default parameters on overrides are not correct, and changing default values is a breaking API change.
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.
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 = |
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.
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) { |
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.
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, |
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.
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 = |
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.
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( |
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.
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 = |
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.
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) { |
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.
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( |
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.
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 = |
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.
Not in a sourceset.
This has been implemented with an alternate implementation. |
This usually cuases the implementation to auto-detect the encoding.