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 string Injections safer. Fix #199 #237

Merged
merged 2 commits into from
Jan 25, 2016
Merged

Conversation

johnynek
Copy link
Collaborator

close #199

?r @ianoc

Will you humor me on the atomics? :)

@@ -32,9 +33,22 @@ trait StringInjections extends NumericInjections {

def withEncoding(encoding: String): Injection[String, Array[Byte]] =
new AbstractInjection[String, Array[Byte]] {
private[this] val decRef = {
val cs = Charset.forName(encoding)
new AtomicSharedState(() => cs.newDecoder.onUnmappableCharacter(CodingErrorAction.REPORT))
Copy link
Collaborator

Choose a reason for hiding this comment

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

is the charset threadsafe itself?

Maybe we should have more like a () => {
val cs = Char...
})
? if threadsafe though doesn't seem like any reason to ofc

@ianoc
Copy link
Collaborator

ianoc commented Jan 22, 2016

I've no problem with atomics :)

@ianoc
Copy link
Collaborator

ianoc commented Jan 22, 2016

LGTM

ianoc added a commit that referenced this pull request Jan 25, 2016
@ianoc ianoc merged commit c108950 into develop Jan 25, 2016
@ianoc ianoc deleted the oscar/safer-stringinj branch January 25, 2016 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants