From e12d9869a77559acbc47b92a2873aaf64802367b Mon Sep 17 00:00:00 2001 From: daidai_is_here Date: Tue, 21 Jan 2020 15:13:02 +0800 Subject: [PATCH] modify spec --- java-base64-2.3.8-elasticsearch.patch | 148 -------------------------- java-base64.spec | 9 +- 2 files changed, 7 insertions(+), 150 deletions(-) delete mode 100644 java-base64-2.3.8-elasticsearch.patch diff --git a/java-base64-2.3.8-elasticsearch.patch b/java-base64-2.3.8-elasticsearch.patch deleted file mode 100644 index 79b70ca..0000000 --- a/java-base64-2.3.8-elasticsearch.patch +++ /dev/null @@ -1,148 +0,0 @@ ---- base64/src/main/java/net/iharder/Base64.java 2010-03-29 20:54:45.000000000 +0200 -+++ base64/src/main/java/net/iharder/Base64.java.elasticsearch 2015-02-18 23:43:01.174030315 +0100 -@@ -1,5 +1,8 @@ - package net.iharder; - -+import java.nio.charset.Charset; -+import java.util.Locale; -+ - /** - *

Encodes and decodes to and from Base64 notation.

- *

Homepage: http://iharder.net/base64.

-@@ -208,7 +211,7 @@ - - - /** Preferred encoding. */ -- private final static String PREFERRED_ENCODING = "US-ASCII"; -+ public final static Charset PREFERRED_ENCODING = Charset.forName("US-ASCII"); - - - private final static byte WHITE_SPACE_ENC = -5; // Indicates white space in encoding -@@ -690,13 +693,7 @@ - } // end finally - - // Return value according to relevant encoding. -- try { -- return new String( baos.toByteArray(), PREFERRED_ENCODING ); -- } // end try -- catch (java.io.UnsupportedEncodingException uue){ -- // Fall back to some Java default -- return new String( baos.toByteArray() ); -- } // end catch -+ return new String(baos.toByteArray(), PREFERRED_ENCODING); - - } // end encode - -@@ -831,12 +828,7 @@ - byte[] encoded = encodeBytesToBytes( source, off, len, options ); - - // Return value according to relevant encoding. -- try { -- return new String( encoded, PREFERRED_ENCODING ); -- } // end try -- catch (java.io.UnsupportedEncodingException uue) { -- return new String( encoded ); -- } // end catch -+ return new String(encoded, PREFERRED_ENCODING); - - } // end encodeBytes - -@@ -899,7 +891,7 @@ - - if( off + len > source.length ){ - throw new IllegalArgumentException( -- String.format( "Cannot have offset of %d and length of %d with array of length %d", off,len,source.length)); -+ String.format(Locale.ROOT, "Cannot have offset of %d and length of %d with array of length %d", off, len, source.length)); - } // end if: off < 0 - - -@@ -1039,12 +1031,12 @@ - throw new NullPointerException( "Destination array was null." ); - } // end if - if( srcOffset < 0 || srcOffset + 3 >= source.length ){ -- throw new IllegalArgumentException( String.format( -- "Source array with length %d cannot have offset of %d and still process four bytes.", source.length, srcOffset ) ); -+ throw new IllegalArgumentException(String.format(Locale.ROOT, -+ "Source array with length %d cannot have offset of %d and still process four bytes.", source.length, srcOffset)); - } // end if - if( destOffset < 0 || destOffset +2 >= destination.length ){ -- throw new IllegalArgumentException( String.format( -- "Destination array with length %d cannot have offset of %d and still store three bytes.", destination.length, destOffset ) ); -+ throw new IllegalArgumentException(String.format(Locale.ROOT, -+ "Destination array with length %d cannot have offset of %d and still store three bytes.", destination.length, destOffset)); - } // end if - - -@@ -1153,8 +1145,8 @@ - throw new NullPointerException( "Cannot decode null source array." ); - } // end if - if( off < 0 || off + len > source.length ){ -- throw new IllegalArgumentException( String.format( -- "Source array with length %d cannot have offset of %d and process %d bytes.", source.length, off, len ) ); -+ throw new IllegalArgumentException(String.format(Locale.ROOT, -+ "Source array with length %d cannot have offset of %d and process %d bytes.", source.length, off, len)); - } // end if - - if( len == 0 ){ -@@ -1191,15 +1183,26 @@ - - // If that was the equals sign, break out of 'for' loop - if( source[i] == EQUALS_SIGN ) { -+ // check if the equals sign is somewhere in between -+ if (i + 1 < len + off) { -+ throw new java.io.IOException(String.format(Locale.ROOT, -+ "Found equals sign at position %d of the base64 string, not at the end", i)); -+ } - break; - } // end if: equals sign - } // end if: quartet built -+ else { -+ if (source[i] == EQUALS_SIGN && len + off > i && source[i + 1] != EQUALS_SIGN) { -+ throw new java.io.IOException(String.format(Locale.ROOT, -+ "Found equals sign at position %d of the base64 string, not at the end", i)); -+ } // enf if: equals sign and next character not as well -+ } // end else: - } // end if: equals sign or better - } // end if: white space, equals sign or better - else { - // There's a bad input character in the Base64 stream. -- throw new java.io.IOException( String.format( -- "Bad Base64 input character decimal %d in array position %d", ((int)source[i])&0xFF, i ) ); -+ throw new java.io.IOException(String.format(Locale.ROOT, -+ "Bad Base64 input character decimal %d in array position %d", ((int) source[i]) & 0xFF, i)); - } // end else: - } // each input character - -@@ -1243,13 +1246,7 @@ - throw new NullPointerException( "Input string was null." ); - } // end if - -- byte[] bytes; -- try { -- bytes = s.getBytes( PREFERRED_ENCODING ); -- } // end try -- catch( java.io.UnsupportedEncodingException uee ) { -- bytes = s.getBytes(); -- } // end catch -+ byte[] bytes = s.getBytes(PREFERRED_ENCODING); - // - - // Decode -@@ -1282,7 +1279,7 @@ - - } // end try - catch( java.io.IOException e ) { -- e.printStackTrace(); -+ // e.printStackTrace(); - // Just return originally-decoded bytes - } // end catch - finally { -@@ -1359,7 +1356,7 @@ - @Override - public Class resolveClass(java.io.ObjectStreamClass streamClass) - throws java.io.IOException, ClassNotFoundException { -- Class c = Class.forName(streamClass.getName(), false, loader); -+ Class c = Class.forName(streamClass.getName(), false, loader); - if( c == null ){ - return super.resolveClass(streamClass); - } else { diff --git a/java-base64.spec b/java-base64.spec index b606c2c..22ce28b 100644 --- a/java-base64.spec +++ b/java-base64.spec @@ -1,11 +1,10 @@ Name: java-base64 Version: 2.3.8 -Release: 15 +Release: 16 Summary: A Java class providing Base64 encoding and decoding License: Public Domain URL: http://iharder.net/base64/ Source0: https://github.com/omalley/base64/archive/release-%{version}.tar.gz -Patch0: %{name}-2.3.8-elasticsearch.patch BuildArch: noarch BuildRequires: junit maven-local @@ -56,5 +55,11 @@ sed -i "s|2.3.9-SNAPSHOT|%{version}|" pom. %{_javadocdir}/base64 %changelog +* Tue Jan 21 2020 daiqianwen - 2.3.8-16 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC: modify spec + * Sat Dec 14 2019 Jiangping Hu - 2.3.8-15 - Package init