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

Jacek Walkowiak (JIRA) jira-events at lists.jboss.org
Tue Sep 24 03:33:45 EDT 2013


Jacek Walkowiak created DROOLS-271:
--------------------------------------

             Summary: Overriden encoding taken from InputStreamReader in ReaderResource constructor
                 Key: DROOLS-271
                 URL: https://issues.jboss.org/browse/DROOLS-271
             Project: Drools
          Issue Type: Bug
      Security Level: Public (Everyone can see)
    Affects Versions:  6.0.0.CR3
         Environment: All platforms.
            Reporter: Jacek Walkowiak
            Assignee: Mark Proctor
            Priority: Minor


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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list