[jira] [Commented] (CODEC-263) Base64.decodeBase64 throw exception

2019-11-06 Thread xie tao (Jira)


[ 
https://issues.apache.org/jira/browse/CODEC-263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16968837#comment-16968837
 ] 

xie tao commented on CODEC-263:
---

Codec version < 1.13,  it will not throw exception. And in version 1.13  
'Base64.isBase64("publishMessage")' return true. 
So I think method Base64.decodeBase64() and  Base64.isBase64() must has 
consistent result。 code as below

{code:java}
// test result is true
if(Base64.isBase64("publishMessage")){
  // throw exception
  Base64.decodeBase64("publishMessage");
}
{code}

therefore, Base64.isBase64() and Base64.decodeBase64() inconsistent method 
behavior.





> Base64.decodeBase64 throw exception
> ---
>
> Key: CODEC-263
> URL: https://issues.apache.org/jira/browse/CODEC-263
> Project: Commons Codec
>  Issue Type: Bug
>Affects Versions: 1.13
> Environment: JDK 7/JDK 8 
> commons-codec 1.13
>Reporter: xie tao
>Priority: Critical
>
> Codec upgrade to 1.13, code  throw exception as follows:
> {code:java}
>   @Test
>   public  void test(){
> Base64.decodeBase64("publishMessage");
>   }
> {code}
> exception like:
> {code:java}
> java.lang.IllegalArgumentException: Last encoded character (before the 
> paddings if any) is a valid base 64 alphabet but not a possible value
>   at 
> org.apache.commons.codec.binary.Base64.validateCharacter(Base64.java:798)
>   at org.apache.commons.codec.binary.Base64.decode(Base64.java:472)
>   at 
> org.apache.commons.codec.binary.BaseNCodec.decode(BaseNCodec.java:412)
>   at 
> org.apache.commons.codec.binary.BaseNCodec.decode(BaseNCodec.java:395)
>   at org.apache.commons.codec.binary.Base64.decodeBase64(Base64.java:694)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Created] (CODEC-263) Base64.decodeBase64 throw exception

2019-09-26 Thread xie tao (Jira)
xie tao created CODEC-263:
-

 Summary: Base64.decodeBase64 throw exception
 Key: CODEC-263
 URL: https://issues.apache.org/jira/browse/CODEC-263
 Project: Commons Codec
  Issue Type: Bug
Affects Versions: 1.13
 Environment: JDK 7/JDK 8 

commons-codec 1.13
Reporter: xie tao


Codec upgrade to 1.13, code  throw exception as follows:

{code:java}
  @Test
  public  void test(){
Base64.decodeBase64("publishMessage");
  }
{code}

exception like:

{code:java}
java.lang.IllegalArgumentException: Last encoded character (before the paddings 
if any) is a valid base 64 alphabet but not a possible value

at 
org.apache.commons.codec.binary.Base64.validateCharacter(Base64.java:798)
at org.apache.commons.codec.binary.Base64.decode(Base64.java:472)
at 
org.apache.commons.codec.binary.BaseNCodec.decode(BaseNCodec.java:412)
at 
org.apache.commons.codec.binary.BaseNCodec.decode(BaseNCodec.java:395)
at org.apache.commons.codec.binary.Base64.decodeBase64(Base64.java:694)
{code}





--
This message was sent by Atlassian Jira
(v8.3.4#803005)