[jboss-jira] [JBoss JIRA] (DROOLS-271) Overriden encoding taken from InputStreamReader in ReaderResource constructor

Petr Široký (JIRA) issues at jboss.org
Sat Jul 25 07:20:03 EDT 2015


    [ https://issues.jboss.org/browse/DROOLS-271?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13092908#comment-13092908 ] 

Petr Široký commented on DROOLS-271:
------------------------------------

This has been fixed some time ago by https://github.com/droolsjbpm/drools/commit/51fa6f54ca99b4a6b30d23cec0a37f696a065abd. 

> Overriden encoding taken from InputStreamReader in ReaderResource constructor
> -----------------------------------------------------------------------------
>
>                 Key: DROOLS-271
>                 URL: https://issues.jboss.org/browse/DROOLS-271
>             Project: Drools
>          Issue Type: Bug
>    Affects Versions:  6.0.0.CR3
>         Environment: All platforms.
>            Reporter: Jacek Walkowiak
>            Assignee: Petr Široký
>            Priority: Minor
>              Labels: encoding, read-resource
>
> If encoding of resource is passes as null and reader is InputStreamReader encoding taken from reader is overriden to null.
> "this.encoding = encoding;" should be in else block in my opinion.
> public ReaderResource(Reader reader, String encoding, ResourceType type ) {
>         if ( reader == null ) {
>             throw new IllegalArgumentException( "reader cannot be null" );
>         }
>         if ( encoding == null && reader instanceof InputStreamReader ) {
>             this.encoding = ((InputStreamReader)reader).getEncoding();  <== encoding assigned here
>         }
>         this.reader = reader;
>         this.encoding = encoding; <== encoding assigned to null
>         
>         setResourceType( type );
>         
>         this.timestamp = System.currentTimeMillis();
>         this.lastRead = this.timestamp;
>     } 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)



More information about the jboss-jira mailing list