[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:21:02 EDT 2015


     [ https://issues.jboss.org/browse/DROOLS-271?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Petr Široký resolved DROOLS-271.
--------------------------------
    Fix Version/s: 6.1.0.Final
       Resolution: Done


> 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
>             Fix For: 6.1.0.Final
>
>
> 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