Sync from SUSE:SLFO:Main snakeyaml revision 7e4931cd62555340cf52a13c050a1ec1

This commit is contained in:
Adrian Schröter 2024-05-04 00:42:12 +02:00
commit 0edc19413c
8 changed files with 1267 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,434 @@
From cdee7ec34fb56a84ae4dc6ccb21d5f07c2392df1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch>
Date: Wed, 12 Oct 2022 10:54:38 +0200
Subject: [PATCH 1/3] replace bundled base64coder with java.util.Base64
---
.../constructor/SafeConstructor.java | 4 +-
.../external/biz/base64Coder/Base64Coder.java | 281 ------------------
.../representer/SafeRepresenter.java | 10 +-
.../base64Coder/Base64CoderTest.java | 16 +-
4 files changed, 14 insertions(+), 297 deletions(-)
delete mode 100644 src/main/java/org/yaml/snakeyaml/external/biz/base64Coder/Base64Coder.java
diff --git a/src/main/java/org/yaml/snakeyaml/constructor/SafeConstructor.java b/src/main/java/org/yaml/snakeyaml/constructor/SafeConstructor.java
index e124489e..9ec73ccd 100644
--- a/src/main/java/org/yaml/snakeyaml/constructor/SafeConstructor.java
+++ b/src/main/java/org/yaml/snakeyaml/constructor/SafeConstructor.java
@@ -15,6 +15,7 @@ package org.yaml.snakeyaml.constructor;
import java.math.BigInteger;
import java.util.ArrayList;
+import java.util.Base64;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Iterator;
@@ -28,7 +29,6 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.error.YAMLException;
-import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
import org.yaml.snakeyaml.nodes.MappingNode;
import org.yaml.snakeyaml.nodes.Node;
import org.yaml.snakeyaml.nodes.NodeId;
@@ -389,7 +389,7 @@ public class SafeConstructor extends BaseConstructor {
public Object construct(Node node) {
// Ignore white spaces for base64 encoded scalar
String noWhiteSpaces = constructScalar((ScalarNode) node).replaceAll("\\s", "");
- byte[] decoded = Base64Coder.decode(noWhiteSpaces.toCharArray());
+ byte[] decoded = Base64.getDecoder().decode(noWhiteSpaces);
return decoded;
}
}
diff --git a/src/main/java/org/yaml/snakeyaml/external/biz/base64Coder/Base64Coder.java b/src/main/java/org/yaml/snakeyaml/external/biz/base64Coder/Base64Coder.java
deleted file mode 100644
index db43b474..00000000
--- a/src/main/java/org/yaml/snakeyaml/external/biz/base64Coder/Base64Coder.java
+++ /dev/null
@@ -1,281 +0,0 @@
-// Copyright 2003-2010 Christian d'Heureuse, Inventec Informatik AG, Zurich, Switzerland
-// www.source-code.biz, www.inventec.ch/chdh
-//
-// This module is multi-licensed and may be used under the terms
-// of any of the following licenses:
-//
-// EPL, Eclipse Public License, V1.0 or later, http://www.eclipse.org/legal
-// LGPL, GNU Lesser General Public License, V2.1 or later, http://www.gnu.org/licenses/lgpl.html
-// GPL, GNU General Public License, V2 or later, http://www.gnu.org/licenses/gpl.html
-// AL, Apache License, V2.0 or later, http://www.apache.org/licenses
-// BSD, BSD License, http://www.opensource.org/licenses/bsd-license.php
-//
-// Please contact the author if you need another license.
-// This module is provided "as is", without warranties of any kind.
-
-package org.yaml.snakeyaml.external.biz.base64Coder;
-
-/**
- * A Base64 encoder/decoder.
- *
- * <p>
- * This class is used to encode and decode data in Base64 format as described in RFC 1521.
- *
- * <p>
- * Project home page: <a href="http://www.source-code.biz/base64coder/java/">www.
- * source-code.biz/base64coder/java</a><br>
- * Author: Christian d'Heureuse, Inventec Informatik AG, Zurich, Switzerland<br>
- * Multi-licensed: EPL / LGPL / GPL / AL / BSD.
- */
-public class Base64Coder {
-
- // The line separator string of the operating system.
- private static final String systemLineSeparator = System.getProperty("line.separator");
-
- // Mapping table from 6-bit nibbles to Base64 characters.
- private static final char[] map1 = new char[64];
-
- static {
- int i = 0;
- for (char c = 'A'; c <= 'Z'; c++) {
- map1[i++] = c;
- }
- for (char c = 'a'; c <= 'z'; c++) {
- map1[i++] = c;
- }
- for (char c = '0'; c <= '9'; c++) {
- map1[i++] = c;
- }
- map1[i++] = '+';
- map1[i++] = '/';
- }
-
- // Mapping table from Base64 characters to 6-bit nibbles.
- private static final byte[] map2 = new byte[128];
-
- static {
- for (int i = 0; i < map2.length; i++) {
- map2[i] = -1;
- }
- for (int i = 0; i < 64; i++) {
- map2[map1[i]] = (byte) i;
- }
- }
-
- /**
- * Encodes a string into Base64 format. No blanks or line breaks are inserted.
- *
- * @param s A String to be encoded.
- * @return A String containing the Base64 encoded data.
- */
- public static String encodeString(String s) {
- return new String(encode(s.getBytes()));
- }
-
- /**
- * Encodes a byte array into Base 64 format and breaks the output into lines of 76 characters.
- * This method is compatible with <code>sun.misc.BASE64Encoder.encodeBuffer(byte[])</code>.
- *
- * @param in An array containing the data bytes to be encoded.
- * @return A String containing the Base64 encoded data, broken into lines.
- */
- public static String encodeLines(byte[] in) {
- return encodeLines(in, 0, in.length, 76, systemLineSeparator);
- }
-
- /**
- * Encodes a byte array into Base 64 format and breaks the output into lines.
- *
- * @param in An array containing the data bytes to be encoded.
- * @param iOff Offset of the first byte in <code>in</code> to be processed.
- * @param iLen Number of bytes to be processed in <code>in</code>, starting at <code>iOff</code>.
- * @param lineLen Line length for the output data. Should be a multiple of 4.
- * @param lineSeparator The line separator to be used to separate the output lines.
- * @return A String containing the Base64 encoded data, broken into lines.
- */
- public static String encodeLines(byte[] in, int iOff, int iLen, int lineLen,
- String lineSeparator) {
- int blockLen = (lineLen * 3) / 4;
- if (blockLen <= 0) {
- throw new IllegalArgumentException();
- }
- int lines = (iLen + blockLen - 1) / blockLen;
- int bufLen = ((iLen + 2) / 3) * 4 + lines * lineSeparator.length();
- StringBuilder buf = new StringBuilder(bufLen);
- int ip = 0;
- while (ip < iLen) {
- int l = Math.min(iLen - ip, blockLen);
- buf.append(encode(in, iOff + ip, l));
- buf.append(lineSeparator);
- ip += l;
- }
- return buf.toString();
- }
-
- /**
- * Encodes a byte array into Base64 format. No blanks or line breaks are inserted in the output.
- *
- * @param in An array containing the data bytes to be encoded.
- * @return A character array containing the Base64 encoded data.
- */
- public static char[] encode(byte[] in) {
- return encode(in, 0, in.length);
- }
-
- /**
- * Encodes a byte array into Base64 format. No blanks or line breaks are inserted in the output.
- *
- * @param in An array containing the data bytes to be encoded.
- * @param iLen Number of bytes to process in <code>in</code>.
- * @return A character array containing the Base64 encoded data.
- */
- public static char[] encode(byte[] in, int iLen) {
- return encode(in, 0, iLen);
- }
-
- /**
- * Encodes a byte array into Base64 format. No blanks or line breaks are inserted in the output.
- *
- * @param in An array containing the data bytes to be encoded.
- * @param iOff Offset of the first byte in <code>in</code> to be processed.
- * @param iLen Number of bytes to process in <code>in</code>, starting at <code>iOff</code>.
- * @return A character array containing the Base64 encoded data.
- */
- public static char[] encode(byte[] in, int iOff, int iLen) {
- int oDataLen = (iLen * 4 + 2) / 3; // output length without padding
- int oLen = ((iLen + 2) / 3) * 4; // output length including padding
- char[] out = new char[oLen];
- int ip = iOff;
- int iEnd = iOff + iLen;
- int op = 0;
- while (ip < iEnd) {
- int i0 = in[ip++] & 0xff;
- int i1 = ip < iEnd ? in[ip++] & 0xff : 0;
- int i2 = ip < iEnd ? in[ip++] & 0xff : 0;
- int o0 = i0 >>> 2;
- int o1 = ((i0 & 3) << 4) | (i1 >>> 4);
- int o2 = ((i1 & 0xf) << 2) | (i2 >>> 6);
- int o3 = i2 & 0x3F;
- out[op++] = map1[o0];
- out[op++] = map1[o1];
- out[op] = op < oDataLen ? map1[o2] : '=';
- op++;
- out[op] = op < oDataLen ? map1[o3] : '=';
- op++;
- }
- return out;
- }
-
- /**
- * Decodes a string from Base64 format. No blanks or line breaks are allowed within the Base64
- * encoded input data.
- *
- * @param s A Base64 String to be decoded.
- * @return A String containing the decoded data.
- * @throws IllegalArgumentException If the input is not valid Base64 encoded data.
- */
- public static String decodeString(String s) {
- return new String(decode(s));
- }
-
- /**
- * Decodes a byte array from Base64 format and ignores line separators, tabs and blanks. CR, LF,
- * Tab and Space characters are ignored in the input data. This method is compatible with
- * <code>sun.misc.BASE64Decoder.decodeBuffer(String)</code>.
- *
- * @param s A Base64 String to be decoded.
- * @return An array containing the decoded data bytes.
- * @throws IllegalArgumentException If the input is not valid Base64 encoded data.
- */
- public static byte[] decodeLines(String s) {
- char[] buf = new char[s.length()];
- int p = 0;
- for (int ip = 0; ip < s.length(); ip++) {
- char c = s.charAt(ip);
- if (c != ' ' && c != '\r' && c != '\n' && c != '\t') {
- buf[p++] = c;
- }
- }
- return decode(buf, 0, p);
- }
-
- /**
- * Decodes a byte array from Base64 format. No blanks or line breaks are allowed within the Base64
- * encoded input data.
- *
- * @param s A Base64 String to be decoded.
- * @return An array containing the decoded data bytes.
- * @throws IllegalArgumentException If the input is not valid Base64 encoded data.
- */
- public static byte[] decode(String s) {
- return decode(s.toCharArray());
- }
-
- /**
- * Decodes a byte array from Base64 format. No blanks or line breaks are allowed within the Base64
- * encoded input data.
- *
- * @param in A character array containing the Base64 encoded data.
- * @return An array containing the decoded data bytes.
- * @throws IllegalArgumentException If the input is not valid Base64 encoded data.
- */
- public static byte[] decode(char[] in) {
- return decode(in, 0, in.length);
- }
-
- /**
- * Decodes a byte array from Base64 format. No blanks or line breaks are allowed within the Base64
- * encoded input data.
- *
- * @param in A character array containing the Base64 encoded data.
- * @param iOff Offset of the first character in <code>in</code> to be processed.
- * @param iLen Number of characters to process in <code>in</code>, starting at <code>iOff</code>.
- * @return An array containing the decoded data bytes.
- * @throws IllegalArgumentException If the input is not valid Base64 encoded data.
- */
- public static byte[] decode(char[] in, int iOff, int iLen) {
- if (iLen % 4 != 0) {
- throw new IllegalArgumentException(
- "Length of Base64 encoded input string is not a multiple of 4.");
- }
- while (iLen > 0 && in[iOff + iLen - 1] == '=') {
- iLen--;
- }
- int oLen = (iLen * 3) / 4;
- byte[] out = new byte[oLen];
- int ip = iOff;
- int iEnd = iOff + iLen;
- int op = 0;
- while (ip < iEnd) {
- int i0 = in[ip++];
- int i1 = in[ip++];
- int i2 = ip < iEnd ? in[ip++] : 'A';
- int i3 = ip < iEnd ? in[ip++] : 'A';
- if (i0 > 127 || i1 > 127 || i2 > 127 || i3 > 127) {
- throw new IllegalArgumentException("Illegal character in Base64 encoded data.");
- }
- int b0 = map2[i0];
- int b1 = map2[i1];
- int b2 = map2[i2];
- int b3 = map2[i3];
- if (b0 < 0 || b1 < 0 || b2 < 0 || b3 < 0) {
- throw new IllegalArgumentException("Illegal character in Base64 encoded data.");
- }
- int o0 = (b0 << 2) | (b1 >>> 4);
- int o1 = ((b1 & 0xf) << 4) | (b2 >>> 2);
- int o2 = ((b2 & 3) << 6) | b3;
- out[op++] = (byte) o0;
- if (op < oLen) {
- out[op++] = (byte) o1;
- }
- if (op < oLen) {
- out[op++] = (byte) o2;
- }
- }
- return out;
- }
-
- // Dummy constructor.
- private Base64Coder() {}
-
-} // end class Base64Coder
diff --git a/src/main/java/org/yaml/snakeyaml/representer/SafeRepresenter.java b/src/main/java/org/yaml/snakeyaml/representer/SafeRepresenter.java
index f0951fb4..fdb5fb8c 100644
--- a/src/main/java/org/yaml/snakeyaml/representer/SafeRepresenter.java
+++ b/src/main/java/org/yaml/snakeyaml/representer/SafeRepresenter.java
@@ -17,6 +17,7 @@ import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Base64;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
@@ -30,7 +31,6 @@ import java.util.UUID;
import java.util.regex.Pattern;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.error.YAMLException;
-import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
import org.yaml.snakeyaml.nodes.Node;
import org.yaml.snakeyaml.nodes.Tag;
import org.yaml.snakeyaml.reader.StreamReader;
@@ -124,7 +124,6 @@ class SafeRepresenter extends BaseRepresenter {
if (nonPrintableStyle == DumperOptions.NonPrintableStyle.BINARY
&& !StreamReader.isPrintable(value)) {
tag = Tag.BINARY;
- char[] binary;
final byte[] bytes = value.getBytes(StandardCharsets.UTF_8);
// sometimes above will just silently fail - it will return incomplete data
// it happens when String has invalid code points
@@ -133,8 +132,7 @@ class SafeRepresenter extends BaseRepresenter {
if (!checkValue.equals(value)) {
throw new YAMLException("invalid string value has occurred");
}
- binary = Base64Coder.encode(bytes);
- value = String.valueOf(binary);
+ value = Base64.getEncoder().encodeToString(bytes);
style = DumperOptions.ScalarStyle.LITERAL;
}
// if no other scalar style is explicitly set, use literal style for
@@ -455,8 +453,8 @@ class SafeRepresenter extends BaseRepresenter {
protected class RepresentByteArray implements Represent {
public Node representData(Object data) {
- char[] binary = Base64Coder.encode((byte[]) data);
- return representScalar(Tag.BINARY, String.valueOf(binary), DumperOptions.ScalarStyle.LITERAL);
+ String binary = Base64.getEncoder().encodeToString((byte[]) data);
+ return representScalar(Tag.BINARY, binary, DumperOptions.ScalarStyle.LITERAL);
}
}
diff --git a/src/test/java/biz/source_code/base64Coder/Base64CoderTest.java b/src/test/java/biz/source_code/base64Coder/Base64CoderTest.java
index 295eb729..dbe814bf 100644
--- a/src/test/java/biz/source_code/base64Coder/Base64CoderTest.java
+++ b/src/test/java/biz/source_code/base64Coder/Base64CoderTest.java
@@ -13,10 +13,10 @@
*/
package biz.source_code.base64Coder;
+import java.util.Base64;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import junit.framework.TestCase;
-import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
public class Base64CoderTest extends TestCase {
@@ -30,10 +30,10 @@ public class Base64CoderTest extends TestCase {
public void testFailure1() throws UnsupportedEncodingException {
try {
- Base64Coder.decode("YQ=".toCharArray());
+ Base64.getDecoder().decode("YQ=".getBytes(StandardCharsets.UTF_8));
fail();
} catch (Exception e) {
- assertEquals("Length of Base64 encoded input string is not a multiple of 4.", e.getMessage());
+ assertEquals("Input byte array has wrong 4-byte ending unit", e.getMessage());
}
}
@@ -51,18 +51,18 @@ public class Base64CoderTest extends TestCase {
private void checkInvalid(String encoded) {
try {
- Base64Coder.decode(encoded.toCharArray());
+ Base64.getDecoder().decode(encoded.getBytes(StandardCharsets.UTF_8));
fail("Illegal chanracter.");
} catch (Exception e) {
- assertEquals("Illegal character in Base64 encoded data.", e.getMessage());
+ assertTrue(e.getMessage().startsWith("Illegal base64 character"));
}
}
private void check(String text, String encoded) throws UnsupportedEncodingException {
- char[] s1 = Base64Coder.encode(text.getBytes(StandardCharsets.UTF_8));
- String t1 = new String(s1);
+ byte[] s1 = Base64.getEncoder().encode(text.getBytes(StandardCharsets.UTF_8));
+ String t1 = new String(s1, StandardCharsets.UTF_8);
assertEquals(encoded, t1);
- byte[] s2 = Base64Coder.decode(encoded.toCharArray());
+ byte[] s2 = Base64.getDecoder().decode(encoded.getBytes(StandardCharsets.UTF_8));
String t2 = new String(s2, StandardCharsets.UTF_8);
assertEquals(text, t2);
}
--
2.37.3

View File

@ -0,0 +1,73 @@
From fe0ce4764ce3839f8019a2b0ecfc1d41c87595c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch>
Date: Wed, 12 Oct 2022 10:58:47 +0200
Subject: [PATCH 2/3] Replace bundled gdata-java-client classes with
commons-codec
---
.../org/yaml/snakeyaml/util/UriEncoder.java | 37 +++++++++++++++----
1 file changed, 29 insertions(+), 8 deletions(-)
diff --git a/src/main/java/org/yaml/snakeyaml/util/UriEncoder.java b/src/main/java/org/yaml/snakeyaml/util/UriEncoder.java
index 02c3e434..f6b5a639 100644
--- a/src/main/java/org/yaml/snakeyaml/util/UriEncoder.java
+++ b/src/main/java/org/yaml/snakeyaml/util/UriEncoder.java
@@ -22,18 +22,33 @@ import java.nio.charset.CharsetDecoder;
import java.nio.charset.CodingErrorAction;
import java.nio.charset.StandardCharsets;
import org.yaml.snakeyaml.error.YAMLException;
-import org.yaml.snakeyaml.external.com.google.gdata.util.common.base.Escaper;
-import org.yaml.snakeyaml.external.com.google.gdata.util.common.base.PercentEscaper;
+import java.util.BitSet;
+
+import org.apache.commons.codec.net.URLCodec;
public abstract class UriEncoder {
+ // default safe characters which can appear within URI and shouldn't be escaped
+ private static final BitSet allowedCharacters = new BitSet(256);
+
+ static {
+ for (int i = 'a'; i <= 'z'; i++) {
+ allowedCharacters.set(i);
+ }
+ for (int i = 'A'; i <= 'Z'; i++) {
+ allowedCharacters.set(i);
+ }
+ for (int i = '0'; i <= '9'; i++) {
+ allowedCharacters.set(i);
+ }
+ // http://yaml.org/spec/1.1/#escaping%20in%20URI/
+ for (char c : "-_.!~*'()@:$&,;=/[]".toCharArray()) {
+ allowedCharacters.set(c);
+ }
+ }
+
private static final CharsetDecoder UTF8Decoder =
StandardCharsets.UTF_8.newDecoder().onMalformedInput(CodingErrorAction.REPORT);
- // Include the [] chars to the SAFEPATHCHARS_URLENCODER to avoid
- // its escape as required by spec. See
- // http://yaml.org/spec/1.1/#escaping%20in%20URI/
- private static final String SAFE_CHARS = PercentEscaper.SAFEPATHCHARS_URLENCODER + "[]/";
- private static final Escaper escaper = new PercentEscaper(SAFE_CHARS, false);
/**
* Escape special characters with '%'
@@ -42,7 +57,13 @@ public abstract class UriEncoder {
* @return encoded URI
*/
public static String encode(String uri) {
- return escaper.escape(uri);
+ try {
+ byte[] rawdata = URLCodec.encodeUrl(allowedCharacters,
+ uri.getBytes("UTF-8"));
+ return new String(rawdata, 0, rawdata.length, "US-ASCII");
+ } catch (UnsupportedEncodingException e) {
+ throw new YAMLException(e);
+ }
}
/**
--
2.37.3

View File

@ -0,0 +1,58 @@
From 6690e47dfc0d46b4923a5b2c55279782b95a335a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch>
Date: Wed, 12 Oct 2022 11:05:10 +0200
Subject: [PATCH 3/3] Fix ReaderBomTest
---
.../yaml/snakeyaml/reader/ReaderBomTest.java | 37 -------------------
1 file changed, 37 deletions(-)
diff --git a/src/test/java/org/yaml/snakeyaml/reader/ReaderBomTest.java b/src/test/java/org/yaml/snakeyaml/reader/ReaderBomTest.java
index c7396c2c..375bb756 100644
--- a/src/test/java/org/yaml/snakeyaml/reader/ReaderBomTest.java
+++ b/src/test/java/org/yaml/snakeyaml/reader/ReaderBomTest.java
@@ -77,41 +77,4 @@ public class ReaderBomTest extends TestCase {
input.close();
}
- public void testUnicodeLeBom() throws IOException {
- File file = new File("src/test/resources/reader/unicode-16le.txt");
- assertTrue("Test file not found: " + file.getAbsolutePath(), file.exists());
- InputStream input = new FileInputStream(file);
- UnicodeReader unicodeReader = new UnicodeReader(input);
- StreamReader reader = new StreamReader(unicodeReader);
- assertEquals('t', reader.peek());
- reader.forward(1);
- assertEquals('e', reader.peek());
- reader.forward(1);
- assertEquals('s', reader.peek());
- reader.forward(1);
- assertEquals('t', reader.peek());
- reader.forward(1);
- assertEquals('\u0000', reader.peek());
- assertEquals(StandardCharsets.UTF_16LE, Charset.forName(unicodeReader.getEncoding()));
- input.close();
- }
-
- public void testUnicodeBeBom() throws IOException {
- File file = new File("src/test/resources/reader/unicode-16be.txt");
- assertTrue("Test file not found: " + file.getAbsolutePath(), file.exists());
- InputStream input = new FileInputStream(file);
- UnicodeReader unicodeReader = new UnicodeReader(input);
- StreamReader reader = new StreamReader(unicodeReader);
- assertEquals('t', reader.peek());
- reader.forward(1);
- assertEquals('e', reader.peek());
- reader.forward(1);
- assertEquals('s', reader.peek());
- reader.forward(1);
- assertEquals('t', reader.peek());
- reader.forward(1);
- assertEquals('\u0000', reader.peek());
- assertEquals(StandardCharsets.UTF_16BE, Charset.forName(unicodeReader.getEncoding()));
- input.close();
- }
}
--
2.37.3

BIN
snakeyaml-1.33.tar.bz2 (Stored with Git LFS) Normal file

Binary file not shown.

246
snakeyaml-build.xml Normal file
View File

@ -0,0 +1,246 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="snakeyaml" default="package" basedir=".">
<!-- ====================================================================== -->
<!-- Build environment properties -->
<!-- ====================================================================== -->
<property file="build.properties"/>
<property name="project.name" value="SnakeYAML"/>
<property name="project.description" value="YAML 1.1 parser and emitter for Java"/>
<property name="project.groupId" value="org.yaml"/>
<property name="project.artifactId" value="snakeyaml"/>
<property name="project.version" value="1.33"/>
<property name="bundle.version" value="${project.version}.0"/>
<property name="compiler.source" value="1.8"/>
<property name="compiler.target" value="${compiler.source}"/>
<property name="build.finalName" value="${project.artifactId}-${project.version}"/>
<property name="build.dir" value="target"/>
<property name="build.outputDir" value="${build.dir}/classes"/>
<property name="build.srcDir" value="src/main/java"/>
<property name="build.resourceDir" value="src/main/resources"/>
<property name="build.testOutputDir" value="${build.dir}/test-classes"/>
<property name="build.testDir" value="src/test/java"/>
<property name="build.testResourceDir" value="src/test/resources"/>
<property name="test.reports" value="${build.dir}/test-reports"/>
<property name="reporting.outputDirectory" value="${build.dir}/site"/>
<!-- ====================================================================== -->
<!-- Defining classpaths -->
<!-- ====================================================================== -->
<path id="build.classpath">
<fileset dir="lib">
<!-- base64coder commons-codec -->
<include name="**/*"/>
</fileset>
</path>
<path id="build.test.classpath">
<!-- base64coder commons-codec junit hamcrest-core velocity
commons-collections commons-lang oro joda-time -->
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- ====================================================================== -->
<!-- Cleaning up target -->
<!-- ====================================================================== -->
<target name="clean" description="Clean the output directory">
<delete dir="${build.dir}"/>
</target>
<!-- ====================================================================== -->
<!-- Compilation target -->
<!-- ====================================================================== -->
<target name="compile" description="Compile the code">
<mkdir dir="${build.outputDir}"/>
<javac destdir="${build.outputDir}"
encoding="UTF-8"
nowarn="false"
debug="true"
optimize="false"
deprecation="true"
target="${compiler.target}"
verbose="false"
fork="false"
source="${compiler.source}">
<src>
<pathelement location="${build.srcDir}"/>
</src>
<classpath refid="build.classpath"/>
</javac>
</target>
<!-- ====================================================================== -->
<!-- Test-compilation target -->
<!-- ====================================================================== -->
<target name="compile-tests"
depends="compile"
description="Compile the test code"
unless="test.skip">
<mkdir dir="${build.testOutputDir}"/>
<javac destdir="${build.testOutputDir}"
encoding="UTF-8"
nowarn="false"
debug="true"
optimize="false"
deprecation="true"
target="${compiler.target}"
verbose="false"
fork="false"
source="${compiler.source}">
<src>
<pathelement location="${build.testDir}"/>
</src>
<classpath>
<path refid="build.test.classpath"/>
<pathelement location="${build.outputDir}"/>
</classpath>
</javac>
<copy todir="${build.testOutputDir}">
<fileset dir="${build.testResourceDir}"/>
</copy>
</target>
<!-- ====================================================================== -->
<!-- Run all tests -->
<!-- ====================================================================== -->
<target name="test"
depends="compile-tests, junit-missing"
unless="junit.skipped"
description="Run the test cases">
<mkdir dir="${test.reports}"/>
<junit printSummary="yes" haltonerror="true" haltonfailure="true" fork="true" dir=".">
<sysproperty key="basedir" value="."/>
<env key="EnvironmentKey1" value="EnvironmentValue1"/>
<env key="EnvironmentEmpty" value=""/>
<formatter type="xml"/>
<formatter type="plain" usefile="false"/>
<classpath>
<path refid="build.test.classpath"/>
<pathelement location="${build.outputDir}"/>
<pathelement location="${build.testOutputDir}"/>
</classpath>
<batchtest todir="${test.reports}" unless="test">
<fileset dir="${build.testDir}">
<include name="**/*Test.java"/>
<exclude name="**/StressTest.java"/>
<exclude name="**/ParallelTest.java"/>
<exclude name="**/PyImportTest.java"/>
<exclude name="**/AbstractTest.java"/>
</fileset>
</batchtest>
<batchtest todir="${test.reports}" if="test">
<fileset dir="${build.testDir}">
<include name="**/${test}.java"/>
<exclude name="**/StressTest.java"/>
<exclude name="**/ParallelTest.java"/>
<exclude name="**/PyImportTest.java"/>
<exclude name="**/AbstractTest.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="test-junit-present">
<available classname="junit.framework.Test" property="junit.present" classpathref="build.test.classpath"/>
</target>
<target name="test-junit-status"
depends="test-junit-present">
<condition property="junit.missing">
<and>
<isfalse value="${junit.present}"/>
<isfalse value="${test.skip}"/>
</and>
</condition>
<condition property="junit.skipped">
<or>
<isfalse value="${junit.present}"/>
<istrue value="${test.skip}"/>
</or>
</condition>
</target>
<target name="junit-missing"
depends="test-junit-status"
if="junit.missing">
<echo>=================================== WARNING ===================================</echo>
<echo> JUnit is not present in the test classpath or your $ANT_HOME/lib directory. Tests not executed.</echo>
<echo>===============================================================================</echo>
</target>
<!-- ====================================================================== -->
<!-- Javadoc target -->
<!-- ====================================================================== -->
<target name="javadoc" description="Generates the Javadoc of the application">
<javadoc sourcepath="${build.srcDir}"
packagenames="*"
destdir="${reporting.outputDirectory}/apidocs"
access="protected"
encoding="UTF-8"
source="${compiler.source}"
verbose="false"
version="true"
use="true"
author="true"
splitindex="false"
nodeprecated="false"
nodeprecatedlist="false"
notree="false"
noindex="false"
nohelp="false"
nonavbar="false"
serialwarn="false"
charset="UTF-8"
linksource="false"
breakiterator="false">
<classpath refid="build.classpath"/>
</javadoc>
</target>
<!-- ====================================================================== -->
<!-- Package target -->
<!-- ====================================================================== -->
<target name="package" depends="compile,test" description="Package the application">
<jar jarfile="${build.dir}/${build.finalName}.jar"
compress="true"
index="false"
basedir="${build.outputDir}"
excludes="**/package.html">
<manifest>
<attribute name="Bundle-Description" value="${project.description}"/>
<attribute name="Bundle-License" value="http://www.apache.org/licenses/LICENSE-2.0.txt"/>
<attribute name="Bundle-ManifestVersion" value="2"/>
<attribute name="Bundle-Name" value="${project.name}"/>
<attribute name="Bundle-RequiredExecutionEnvironment" value="J2SE-1.5"/>
<attribute name="Bundle-SymbolicName" value="${project.groupId}.${project.artifactId}"/>
<attribute name="Bundle-Version" value="${bundle.version}"/>
<attribute name="Export-Package" value="org.yaml.snakeyaml;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.composer;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.constructor;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.emitter;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.error;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.events;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.extensions.compactnotation;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.introspector;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.nodes;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.parser;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.reader;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.representer;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.resolver;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.scanner;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.serializer;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.tokens;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.util;version=&quot;${project.version}&quot;"/>
<attribute name="Import-Package" value="biz.source_code.base64Coder;version=&quot;[1.0,2)&quot;,org.apache.commons.codec.net;version=&quot;[1.11,2)&quot;,org.yaml.snakeyaml;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.composer;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.constructor;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.emitter;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.error;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.events;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.introspector;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.nodes;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.parser;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.reader;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.representer;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.resolver;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.scanner;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.serializer;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.tokens;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.util;version=&quot;[${project.version},2)&quot;"/>
<attribute name="JavaPackages-ArtifactId" value="${project.artifactId}"/>
<attribute name="JavaPackages-GroupId" value="${project.groupId}"/>
<attribute name="JavaPackages-Version" value="${project.version}"/>
<attribute name="Require-Capability" value="osgi.ee;filter:=&quot;(&amp;(osgi.ee=JavaSE)(version=${compiler.target}))&quot;"/>
</manifest>
</jar>
</target>
<!-- ====================================================================== -->
<!-- A dummy target for the package named after the type it creates -->
<!-- ====================================================================== -->
<target name="jar" depends="package" description="Builds the jar for the application"/>
</project>

255
snakeyaml.changes Normal file
View File

@ -0,0 +1,255 @@
-------------------------------------------------------------------
Tue Oct 18 07:17:01 UTC 2022 - Fridrich Strba <fstrba@suse.com>
- Fix --with tests build
-------------------------------------------------------------------
Mon Oct 17 17:05:58 UTC 2022 - Fridrich Strba <fstrba@suse.com>
- Upgrade to upstream release 1.33
* Fixes
+ bsc#1204173
+ bsc#1203154 (CVE-2022-38752)
* Changes of 1.33
+ Remove some deprecated unused methods
+ Fix #555: Fixed Github actions
+ Fix #553: LoaderOptions.setCodePointLimit() not honored by
loadAll()
+ Fix #554: Always emit numberish strings with quotes
* Changes of 1.32
+ Fix #543: show the configuration in the test
+ Fix #531: provide configuration to fail early
+ Fix #547: Set the limit for incoming data to prevent a CVE
report in NIST. By default it is 3MB
+ Fix #544: Support unescaped unicode characters for
double-quoted scalars
- Modified patches:
* 0001-replace-bundled-base64coder-with-java.util.Base64.patch
* 0002-Replace-bundled-gdata-java-client-classes-with-commo.patch
+ rebase
- Added patch:
* 0003-Fix-ReaderBomTest.patch
+ remove two tests that require unicode boms
-------------------------------------------------------------------
Wed Sep 7 07:30:01 UTC 2022 - Fridrich Strba <fstrba@suse.com>
- Upgrade to upstream release 1.31
* Fixes
+ bsc#1202932 (CVE-2022-25857)
+ bsc#1203149 (CVE-2022-38749)
+ bsc#1203153 (CVE-2022-38751)
+ bsc#1203158 (CVE-2022-38750)
* Changes of 1.31
+ Fix #539: false positive CVE-2020-13936 (bsc#1183360)
+ Fix #537: Improved RE for integers
+ Improve restrictions against DoS attacks
+ Fix #525: Restrict nested depth for collections to avoid DoS
attacks
+ Fix #522: De-serializing key "on" fails with Exception
+ Example with Lombok and ENV variable substitution was added
+ reported issue with trailing TAB
+ fixes for reading and writing comments
* Changes of 1.30
+ Migrate to new home: snakeyaml/snakeyaml
+ fixes for reading and writing comments
+ Fix #506: Improve parsing a number starting with 0x
* Changes of 1.29
+ fixes for reading and writing comments
- Modified patches:
* 0001-replace-bundled-base64coder-with-java.util.Base64.patch
* 0002-Replace-bundled-gdata-java-client-classes-with-commo.patch
+ rebase
-------------------------------------------------------------------
Sat May 15 17:33:53 UTC 2021 - Fridrich Strba <fstrba@suse.com>
- Upgrade to upstream release 1.28
* Fixes bsc#1159488, bsc#1186088, CVE-2017-18640
* Changes of 1.28
+ Add possibility to construct enum with case sensitivity
+ Fix #493: substitution default can contain special characters
+ Add possibility to read and write comments
+ Fix #485: Alias names are too permissive compared to libyaml
and future spec
* Changes of 1.27
+ Update #307: add example
+ Add: build with CI on github
+ Fix #481: Serialize anchors that are not used by any alias
+ Fix #416: Improve dumping sequences
+ Fix #480: Anchor allows non ASCII characters while dumping
+ Fix #476: Make constructor of EnvScalarConstructor public
+ Fix #474: Parse the value of byte and short after a narrowing
primitive conversion
+ Fix yet another OWASP false positive. It complains that the
Spring controller makes SnakeYAML insecure even though
SnakeYAML does not use Spring controller and does not depend
on Spring (but the tests do). Bump spring.version from
3.2.17.RELEASE to 5.2.4.RELEASE
+ Migrated from hg to git
* Changes of 1.26
+ Fix #377: Allow configuration for preventing billion laughs
attack
+ Add: parse ENV variables similar to how it works for
docker-compose
+ Fix #468: Allow non ASCII characters in the anchor names
+ Add: expose Event.ID in Event via a getter
+ Fix #454: Add example for integer without time pattern
- Removed patch:
* 0003-fix-broken-test.patch
+ not needed since integrated upstream
- Modified patch:
* 0001-replace-bundled-base64coder-with-java.util.Base64.patch
* rediff to changed context
-------------------------------------------------------------------
Sun Nov 10 05:55:34 UTC 2019 - Fridrich Strba <fstrba@suse.com>
- Upgrade to upstream release 1.25
* Changes of 1.25
+ Fix #441: Restore the way to get anchor for a Node
+ Fix #437: Introduce setting to keep !!str tag for String even
when it contains non-printable chars
+ Update plugin versions
* Changes of 1.24
+ BaseConstructor: Factored out postponed mapping logic so
subclasses can effectively override constructMapping2ndStep()
and delegate to the postponed mapping logic
+ Fix #431: Customize simple key length when dumping
+ Fix #430: Wrap runtime exceptions into YAMLException.
+ Fix: Null tag constructor not called when parsing top-level
null value.
+ Fix #429: Provide "Automatic-Module-Name" entry in MANIFEST
+ Fix #426: Fix NPE when duplicate keys are not allowed and the
key is null
+ Apply pull request #41: Support java.sql classes without the
need to depend on java.sql module in java9+
+ Update: Java 7 is required.
+ Fix #423: Date Serialization Fails for TimeZones on Daylight
Savings Time
* Changes of 1.23
+ Update: run tests under Java 11. This is the last release to
support Java 6. As of the next release Java 7 will be required.
+ Fix #412: Restore the Boolean constructors for Events and
Nodes for binary compatibility of dependent projects
+ Fix #411: System Property "java.runtime.name" is not required
to be defined
+ Fix #409: Dumping Enum breaks when Enum value is Anonymous
inner class
* Changes of 1.21
+ Update: Scanner.peekToken() and Scanner.getToken() throw
exception instead of returning null
+ Update: Enhance output of token IDs
+ Update: Mark - expose buffer and pointer
+ Update: Improvements in the Bitbucket pipeline
+ Fix #397: Plain scalars with colons in flow sequences/mappings
are valid YAML. This change follows what happens with PyYAML
and libyaml (thanks to developers from the YAML community)
* Changes of 1.20
+ Fix #393: Improve reflective access operation to avoid warning
under Java 9
+ Hold #397: because of the inconsistent corner cases the ':' is
not yet allowed in a flow context
+ Refactor nodes and events - use enum FlowStyle instead of
Boolean (minor backwards-incompatible change)
+ Refactor ScalarToken, ScalarNode and ScalarEvent - use enum
ScalarStyle instead of Character (minor backwards-incompatible
change)
+ Refactor Mark - remove unused code (minor
backwards-incompatible change)
+ Fix #395 and #394: Introduce DuplicateKeyException and report
line number for duplicate keys when creating non-Javabeans
* Changes of 1.19
+ Apply pull request #22: Only use FIELD access for Android in
PropertyUtils
+ Apply pull request #27: Add getAnnotations() and
getAnnotation() methods to Property.
+ Apply pull request #26 and fix #383: Some configuration
properties of Representer were ignored.
+ Fix issue #386:Fix order of duplicate keys indices to prevent
wrong removals.
+ Update: major improvement when parsing JavaBeans.
+ Fix issue #382 and #322: MethodProperty should check for
generic type in getters and setters.
+ Fix issue #377: Add test for billion laughs attack.
+ Fix issue #368: Relax final restriction on TypeDescription.
+ Fix issue #375: Empty YAML file must return null instead of
throwing an exception when loading a JavaBean.
+ Fix issue #374: Localization settings (e.g. fr_CA) convert
Number type floats to ints.
+ Apply pull request #20: Provide access to node's anchor
+ Fix issue #370: Remove redundant
"Bundle-RequiredExecutionEnvironment: J2SE-1.5"
+ Fix issue #364: Serializing Calendar objects with certain
timezone offsets renders invalid YAML
* Changes of 1.18
+ Add: create Android artifact with android classifier
+ Fix issue #358: Validate DumperOptions to prevent invalid YAML
to be dumped.
+ Fix issue #355: Fix for emitter to split long plain string
scalars over multiple lines.
+ Apply pull request #13: Let Mark implement Serializable so
that ParserException can be serialized
+ Fix issue #337: Throw exception in case of duplicate keys when
LoaderOptions.allowDuplicateKeys is false.
+ Fix issue #351: Keep same nodes order on merge (preprocess
keys for MappingNode and remove duplicates keeping the last
one).
+ Fix issue #349: Ignore white spaces for base64 encoded scalar
+ Fix issue #348: Not removing parent object when composed
object is an anchor
+ Fix issue #323: Support "Miscellaneous Symbols and
Pictographs". This fix introduces minor backwards-incompatible
changes - some of the methods have been renamed. This fixes
also long standing issue with iOS emoji
+ Fix issue #341: Fix NPE in BaseRepresenter.multiRepresenters
if it contains 'null' as a key
+ Update plugin versions
- Removed patch:
* 0001-Replace-bundled-base64-implementation.patch
+ replaced by other implementation
- Modified patch:
* 0002-Replace-bundled-gdata-java-client-classes-with-commo.patch
+ Rediff to changed context
- Added patches:
* 0001-replace-bundled-base64coder-with-java.util.Base64.patch
+ Replace with internal jdk8+ implementation
* 0003-fix-broken-test.patch
+ fix a broken test
-------------------------------------------------------------------
Fri Mar 1 06:32:02 UTC 2019 - Fridrich Strba <fstrba@suse.com>
- Packaging of snakeyaml 1.17 based on Fedora package
- Generated and customized ant build file
- Removed patch:
* snakeyaml-1.10-jdk9.patch
+ not needed any more
-------------------------------------------------------------------
Thu Nov 02 13:12:11 UTC 2017 - jgonzalez@suse.com
- Fix build with java9
- Add:
* snakeyaml-1.10-jdk9.patch
-------------------------------------------------------------------
Tue Jul 1 13:06:37 UTC 2014 - mseidl@suse.de
- modified for sle12
-------------------------------------------------------------------
Fri Nov 18 01:48:56 CET 2011 - ro@suse.de
- explicitly add java-devel to buildrequires
-------------------------------------------------------------------
Fri Aug 26 14:55:26 UTC 2011 - bmaryniuk@suse.com
- Removed bootstrap binaries.
-------------------------------------------------------------------
Fri Aug 26 14:32:27 UTC 2011 - bmaryniuk@suse.com
- Initial build with a bootstrap binaries.

175
snakeyaml.spec Normal file
View File

@ -0,0 +1,175 @@
#
# spec file for package snakeyaml
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global vertag 7f5106920d77
%bcond_with tests
Name: snakeyaml
Version: 1.33
Release: 0
Summary: YAML parser and emitter for the Java programming language
License: Apache-2.0
Group: Development/Libraries/Java
URL: https://bitbucket.org/%{name}/%{name}
Source0: https://bitbucket.org/%{name}/%{name}/get/%{name}-%{version}.tar.bz2
Source1: %{name}-build.xml
# Upstream has forked gdata-java and base64 and refuses [1] to
# consider replacing them by external dependencies. Bundled libraries
# need to be removed and their use replaced by system libraries.
# See rhbz#875777 and http://code.google.com/p/snakeyaml/issues/detail?id=175
#
# Replace use of bundled Base64 implementation with java.util.Base64
Patch0: 0001-replace-bundled-base64coder-with-java.util.Base64.patch
# We don't have gdata-java, use commons-codec instead
Patch1: 0002-Replace-bundled-gdata-java-client-classes-with-commo.patch
Patch2: 0003-Fix-ReaderBomTest.patch
BuildRequires: ant
BuildRequires: apache-commons-codec
BuildRequires: fdupes
BuildRequires: java-devel >= 1.8
BuildRequires: javapackages-local
Requires: mvn(commons-codec:commons-codec)
BuildArch: noarch
%if %{with tests}
BuildRequires: ant-junit
BuildRequires: apache-commons-collections
BuildRequires: apache-commons-lang
BuildRequires: hamcrest-core
BuildRequires: joda-time
BuildRequires: junit
BuildRequires: oro
BuildRequires: velocity
# Differently sorted collections make fail some tests that rely on a particular order
BuildConflicts: java >= 9
BuildConflicts: java-devel >= 9
BuildConflicts: java-headless >= 9
%endif
%description
SnakeYAML features:
* a complete YAML 1.1 parser. In particular,
SnakeYAML can parse all examples from the specification.
* Unicode support including UTF-8/UTF-16 input/output.
* high-level API for serializing and deserializing
native Java objects.
* support for all types from the YAML types repository.
* relatively sensible error messages.
%package javadoc
Summary: API documentation for %{name}
Group: Documentation/HTML
%description javadoc
This package contains %{summary}.
%prep
%setup -q -n %{name}-%{name}-%{vertag}
cp %{SOURCE1} build.xml
%patch0 -p1
%patch1 -p1
%patch2 -p1
%pom_remove_plugin :cobertura-maven-plugin
%pom_remove_plugin :maven-changes-plugin
%pom_remove_plugin :maven-license-plugin
%pom_remove_plugin :maven-javadoc-plugin
%pom_remove_plugin :maven-site-plugin
sed -i "/<artifactId>spring</s/spring/&-core/" pom.xml
rm -f src/test/java/examples/SpringTest.java
# Replacement for bundled gdata-java-client
%pom_add_dep commons-codec:commons-codec
# Unnecessary test-time only dependency
%pom_remove_dep joda-time:joda-time
rm -rf src/test/java/examples/jodatime
%pom_remove_dep org.projectlombok:lombok
%pom_remove_dep org.apache.velocity:velocity-engine-core
# fails in rpmbuild only due to different locale
rm src/test/java/org/yaml/snakeyaml/issues/issue67/NonAsciiCharsInClassNameTest.java
# fails after unbundling
rm src/test/java/org/yaml/snakeyaml/issues/issue318/ContextClassLoaderTest.java
# Tests using dependencies we don't have/have removed
rm src/test/java/org/yaml/snakeyaml/emitter/template/VelocityTest.java
rm src/test/java/org/yaml/snakeyaml/issues/issue387/YamlExecuteProcessContextTest.java
rm src/test/java/org/yaml/snakeyaml/env/ApplicationProperties.java
rm src/test/java/org/yaml/snakeyaml/env/EnvLombokTest.java
rm src/test/java/org/yaml/snakeyaml/issues/issue527/Fuzzy47047Test.java
rm src/test/java/org/yaml/snakeyaml/issues/issue530/Fuzzy47039Test.java
rm src/test/java/org/yaml/snakeyaml/issues/issue543/Fuzzer50355Test.java
rm src/test/java/org/yaml/snakeyaml/issues/issue525/FuzzyStackOverflowTest.java
rm src/test/java/org/yaml/snakeyaml/issues/issue529/Fuzzy47028Test.java
rm src/test/java/org/yaml/snakeyaml/issues/issue531/Fuzzy47081Test.java
rm src/test/java/org/yaml/snakeyaml/issues/issue526/Fuzzy47027Test.java
# Problematic test resources for maven-resources-plugin 3.2
rm src/test/resources/issues/issue99.jpeg
rm src/test/resources/reader/unicode-16be.txt
rm src/test/resources/reader/unicode-16le.txt
rm src/test/resources/pyyaml/spec-05-01-utf16be.data
rm src/test/resources/pyyaml/spec-05-01-utf16le.data
rm src/test/resources/pyyaml/spec-05-02-utf16le.data
rm src/test/resources/pyyaml/odd-utf16.stream-error
rm src/test/resources/pyyaml/invalid-character.loader-error
rm src/test/resources/pyyaml/invalid-character.stream-error
rm src/test/resources/pyyaml/invalid-utf8-byte.loader-error
rm src/test/resources/pyyaml/invalid-utf8-byte.stream-error
rm src/test/resources/pyyaml/empty-document-bug.data
rm src/test/resources/pyyaml/spec-05-02-utf16be.data
rm -rf src/test/resources/fuzzer/
# Test using the jpeg data removed above
rm src/test/java/org/yaml/snakeyaml/issues/issue99/YamlBase64Test.java
# convert CR+LF to LF
sed -i 's/\r//g' LICENSE.txt
%build
mkdir -p lib
build-jar-repository -s lib commons-codec
%if %{with tests}
build-jar-repository -s lib junit hamcrest/core velocity commons-collections commons-lang oro joda-time
%endif
%{ant} \
%if %{without tests}
-Dtest.skip=true \
%endif
clean package javadoc
%install
# jar
install -dm 0755 %{buildroot}%{_javadir}
install -pm 0644 target/%{name}-%{version}.jar %{buildroot}%{_javadir}/%{name}.jar
# pom
install -dm 0755 %{buildroot}%{_mavenpomdir}
install -pm 0644 pom.xml %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
%add_maven_depmap JPP-%{name}.pom %{name}.jar
# javadoc
install -dm 0755 %{buildroot}%{_javadocdir}/%{name}
cp -pr target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name}/
%fdupes -s %{buildroot}%{_javadocdir}
%files -f .mfiles
%license LICENSE.txt
%files javadoc
%license LICENSE.txt
%{_javadocdir}/%{name}
%changelog