From 59a724aefb1cd5b50bd7d3735a74a53f5d0a255d Mon Sep 17 00:00:00 2001 From: Maksim Date: Mon, 30 Mar 2020 19:03:20 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E6=9A=82=E6=97=B6=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E6=97=A7=E7=89=88=E6=9C=AC=E6=96=B0=E5=BC=95=E6=93=8E=E6=8F=92?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.third_step1-jdk11.gradle | 1 + build.third_step1.gradle | 1 + .../mathcs/backport/java/util/Arrays.java | 798 ++++++++++++++++++ 3 files changed, 800 insertions(+) create mode 100644 fine-deprecated-utils/src/edu/emory/mathcs/backport/java/util/Arrays.java diff --git a/build.third_step1-jdk11.gradle b/build.third_step1-jdk11.gradle index 9007d2927..6279a3f14 100644 --- a/build.third_step1-jdk11.gradle +++ b/build.third_step1-jdk11.gradle @@ -31,6 +31,7 @@ sourceSets{ main{ java{ srcDirs=[ + "${srcDir}/fine-deprecated-utils/src", "${srcDir}/fine-asm/src", "${srcDir}/fine-antlr4/src", "${srcDir}/fine-aspectj/src", diff --git a/build.third_step1.gradle b/build.third_step1.gradle index 3a87cb298..a4857239b 100644 --- a/build.third_step1.gradle +++ b/build.third_step1.gradle @@ -32,6 +32,7 @@ sourceSets{ main{ java{ srcDirs=[ + "${srcDir}/fine-deprecated-utils/src", "${srcDir}/fine-asm/src", "${srcDir}/fine-antlr4/src", "${srcDir}/fine-aspectj/src", diff --git a/fine-deprecated-utils/src/edu/emory/mathcs/backport/java/util/Arrays.java b/fine-deprecated-utils/src/edu/emory/mathcs/backport/java/util/Arrays.java new file mode 100644 index 000000000..477fa3475 --- /dev/null +++ b/fine-deprecated-utils/src/edu/emory/mathcs/backport/java/util/Arrays.java @@ -0,0 +1,798 @@ +package edu.emory.mathcs.backport.java.util; + +import java.lang.reflect.Array; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; + +/** + * 该类由前面版本third包反编译生成,用于兼容新引擎旧版本插件,7-8月份删除 + */ +@Deprecated +public class Arrays { + private Arrays() { + } + + public static void sort(long[] a) { + java.util.Arrays.sort(a); + } + + public static void sort(long[] a, int fromIndex, int toIndex) { + java.util.Arrays.sort(a, fromIndex, toIndex); + } + + public static void sort(int[] a) { + java.util.Arrays.sort(a); + } + + public static void sort(int[] a, int fromIndex, int toIndex) { + java.util.Arrays.sort(a, fromIndex, toIndex); + } + + public static void sort(short[] a) { + java.util.Arrays.sort(a); + } + + public static void sort(short[] a, int fromIndex, int toIndex) { + java.util.Arrays.sort(a, fromIndex, toIndex); + } + + public static void sort(char[] a) { + java.util.Arrays.sort(a); + } + + public static void sort(char[] a, int fromIndex, int toIndex) { + java.util.Arrays.sort(a, fromIndex, toIndex); + } + + public static void sort(byte[] a) { + java.util.Arrays.sort(a); + } + + public static void sort(byte[] a, int fromIndex, int toIndex) { + java.util.Arrays.sort(a, fromIndex, toIndex); + } + + public static void sort(double[] a) { + java.util.Arrays.sort(a); + } + + public static void sort(double[] a, int fromIndex, int toIndex) { + java.util.Arrays.sort(a, fromIndex, toIndex); + } + + public static void sort(float[] a) { + java.util.Arrays.sort(a); + } + + public static void sort(float[] a, int fromIndex, int toIndex) { + java.util.Arrays.sort(a, fromIndex, toIndex); + } + + public static void sort(Object[] a) { + java.util.Arrays.sort(a); + } + + public static void sort(Object[] a, int fromIndex, int toIndex) { + java.util.Arrays.sort(a, fromIndex, toIndex); + } + + public static void sort(Object[] a, Comparator c) { + java.util.Arrays.sort(a, c); + } + + public static void sort(Object[] a, int fromIndex, int toIndex, Comparator c) { + java.util.Arrays.sort(a, fromIndex, toIndex, c); + } + + public static int binarySearch(long[] a, long key) { + return java.util.Arrays.binarySearch(a, key); + } + + public static int binarySearch(int[] a, int key) { + return java.util.Arrays.binarySearch(a, key); + } + + public static int binarySearch(short[] a, short key) { + return java.util.Arrays.binarySearch(a, key); + } + + public static int binarySearch(char[] a, char key) { + return java.util.Arrays.binarySearch(a, key); + } + + public static int binarySearch(byte[] a, byte key) { + return java.util.Arrays.binarySearch(a, key); + } + + public static int binarySearch(double[] a, double key) { + return java.util.Arrays.binarySearch(a, key); + } + + public static int binarySearch(float[] a, float key) { + return java.util.Arrays.binarySearch(a, key); + } + + public static int binarySearch(Object[] a, Object key) { + return java.util.Arrays.binarySearch(a, key); + } + + public static int binarySearch(Object[] a, Object key, Comparator c) { + return java.util.Arrays.binarySearch(a, key, c); + } + + public static boolean equals(long[] a, long[] a2) { + return java.util.Arrays.equals(a, a2); + } + + public static boolean equals(int[] a, int[] a2) { + return java.util.Arrays.equals(a, a2); + } + + public static boolean equals(short[] a, short[] a2) { + return java.util.Arrays.equals(a, a2); + } + + public static boolean equals(char[] a, char[] a2) { + return java.util.Arrays.equals(a, a2); + } + + public static boolean equals(byte[] a, byte[] a2) { + return java.util.Arrays.equals(a, a2); + } + + public static boolean equals(boolean[] a, boolean[] a2) { + return java.util.Arrays.equals(a, a2); + } + + public static boolean equals(double[] a, double[] a2) { + return java.util.Arrays.equals(a, a2); + } + + public static boolean equals(float[] a, float[] a2) { + return java.util.Arrays.equals(a, a2); + } + + public static boolean equals(Object[] a, Object[] a2) { + return java.util.Arrays.equals(a, a2); + } + + public static void fill(long[] a, long val) { + java.util.Arrays.fill(a, val); + } + + public static void fill(long[] a, int fromIndex, int toIndex, long val) { + java.util.Arrays.fill(a, fromIndex, toIndex, val); + } + + public static void fill(int[] a, int val) { + java.util.Arrays.fill(a, val); + } + + public static void fill(int[] a, int fromIndex, int toIndex, int val) { + java.util.Arrays.fill(a, fromIndex, toIndex, val); + } + + public static void fill(short[] a, short val) { + java.util.Arrays.fill(a, val); + } + + public static void fill(short[] a, int fromIndex, int toIndex, short val) { + java.util.Arrays.fill(a, fromIndex, toIndex, val); + } + + public static void fill(char[] a, char val) { + java.util.Arrays.fill(a, val); + } + + public static void fill(char[] a, int fromIndex, int toIndex, char val) { + java.util.Arrays.fill(a, fromIndex, toIndex, val); + } + + public static void fill(byte[] a, byte val) { + java.util.Arrays.fill(a, val); + } + + public static void fill(byte[] a, int fromIndex, int toIndex, byte val) { + java.util.Arrays.fill(a, fromIndex, toIndex, val); + } + + public static void fill(boolean[] a, boolean val) { + java.util.Arrays.fill(a, val); + } + + public static void fill(boolean[] a, int fromIndex, int toIndex, boolean val) { + java.util.Arrays.fill(a, fromIndex, toIndex, val); + } + + public static void fill(double[] a, double val) { + java.util.Arrays.fill(a, val); + } + + public static void fill(double[] a, int fromIndex, int toIndex, double val) { + java.util.Arrays.fill(a, fromIndex, toIndex, val); + } + + public static void fill(float[] a, float val) { + java.util.Arrays.fill(a, val); + } + + public static void fill(float[] a, int fromIndex, int toIndex, float val) { + java.util.Arrays.fill(a, fromIndex, toIndex, val); + } + + public static void fill(Object[] a, Object val) { + java.util.Arrays.fill(a, val); + } + + public static void fill(Object[] a, int fromIndex, int toIndex, Object val) { + java.util.Arrays.fill(a, fromIndex, toIndex, val); + } + + public static Object[] copyOf(Object[] original, int newLength) { + return copyOf(original, newLength, original.getClass()); + } + + public static Object[] copyOf(Object[] original, int newLength, Class newType) { + Object[] arr = newType == Object[].class ? new Object[newLength] : (Object[])Array.newInstance(newType.getComponentType(), newLength); + int len = original.length < newLength ? original.length : newLength; + System.arraycopy(original, 0, arr, 0, len); + return arr; + } + + public static byte[] copyOf(byte[] original, int newLength) { + byte[] arr = new byte[newLength]; + int len = original.length < newLength ? original.length : newLength; + System.arraycopy(original, 0, arr, 0, len); + return arr; + } + + public static short[] copyOf(short[] original, int newLength) { + short[] arr = new short[newLength]; + int len = original.length < newLength ? original.length : newLength; + System.arraycopy(original, 0, arr, 0, len); + return arr; + } + + public static int[] copyOf(int[] original, int newLength) { + int[] arr = new int[newLength]; + int len = original.length < newLength ? original.length : newLength; + System.arraycopy(original, 0, arr, 0, len); + return arr; + } + + public static long[] copyOf(long[] original, int newLength) { + long[] arr = new long[newLength]; + int len = original.length < newLength ? original.length : newLength; + System.arraycopy(original, 0, arr, 0, len); + return arr; + } + + public static char[] copyOf(char[] original, int newLength) { + char[] arr = new char[newLength]; + int len = original.length < newLength ? original.length : newLength; + System.arraycopy(original, 0, arr, 0, len); + return arr; + } + + public static float[] copyOf(float[] original, int newLength) { + float[] arr = new float[newLength]; + int len = original.length < newLength ? original.length : newLength; + System.arraycopy(original, 0, arr, 0, len); + return arr; + } + + public static double[] copyOf(double[] original, int newLength) { + double[] arr = new double[newLength]; + int len = original.length < newLength ? original.length : newLength; + System.arraycopy(original, 0, arr, 0, len); + return arr; + } + + public static boolean[] copyOf(boolean[] original, int newLength) { + boolean[] arr = new boolean[newLength]; + int len = original.length < newLength ? original.length : newLength; + System.arraycopy(original, 0, arr, 0, len); + return arr; + } + + public static Object[] copyOfRange(Object[] original, int from, int to) { + return copyOfRange(original, from, to, original.getClass()); + } + + public static Object[] copyOfRange(Object[] original, int from, int to, Class newType) { + int newLength = to - from; + if (newLength < 0) { + throw new IllegalArgumentException(from + " > " + to); + } else { + Object[] arr = newType == Object[].class ? new Object[newLength] : (Object[])Array.newInstance(newType.getComponentType(), newLength); + int ceil = original.length - from; + int len = ceil < newLength ? ceil : newLength; + System.arraycopy(original, from, arr, 0, len); + return arr; + } + } + + public static byte[] copyOfRange(byte[] original, int from, int to) { + int newLength = to - from; + if (newLength < 0) { + throw new IllegalArgumentException(from + " > " + to); + } else { + byte[] arr = new byte[newLength]; + int ceil = original.length - from; + int len = ceil < newLength ? ceil : newLength; + System.arraycopy(original, from, arr, 0, len); + return arr; + } + } + + public static short[] copyOfRange(short[] original, int from, int to) { + int newLength = to - from; + if (newLength < 0) { + throw new IllegalArgumentException(from + " > " + to); + } else { + short[] arr = new short[newLength]; + int ceil = original.length - from; + int len = ceil < newLength ? ceil : newLength; + System.arraycopy(original, from, arr, 0, len); + return arr; + } + } + + public static int[] copyOfRange(int[] original, int from, int to) { + int newLength = to - from; + if (newLength < 0) { + throw new IllegalArgumentException(from + " > " + to); + } else { + int[] arr = new int[newLength]; + int ceil = original.length - from; + int len = ceil < newLength ? ceil : newLength; + System.arraycopy(original, from, arr, 0, len); + return arr; + } + } + + public static long[] copyOfRange(long[] original, int from, int to) { + int newLength = to - from; + if (newLength < 0) { + throw new IllegalArgumentException(from + " > " + to); + } else { + long[] arr = new long[newLength]; + int ceil = original.length - from; + int len = ceil < newLength ? ceil : newLength; + System.arraycopy(original, from, arr, 0, len); + return arr; + } + } + + public static char[] copyOfRange(char[] original, int from, int to) { + int newLength = to - from; + if (newLength < 0) { + throw new IllegalArgumentException(from + " > " + to); + } else { + char[] arr = new char[newLength]; + int ceil = original.length - from; + int len = ceil < newLength ? ceil : newLength; + System.arraycopy(original, from, arr, 0, len); + return arr; + } + } + + public static float[] copyOfRange(float[] original, int from, int to) { + int newLength = to - from; + if (newLength < 0) { + throw new IllegalArgumentException(from + " > " + to); + } else { + float[] arr = new float[newLength]; + int ceil = original.length - from; + int len = ceil < newLength ? ceil : newLength; + System.arraycopy(original, from, arr, 0, len); + return arr; + } + } + + public static double[] copyOfRange(double[] original, int from, int to) { + int newLength = to - from; + if (newLength < 0) { + throw new IllegalArgumentException(from + " > " + to); + } else { + double[] arr = new double[newLength]; + int ceil = original.length - from; + int len = ceil < newLength ? ceil : newLength; + System.arraycopy(original, from, arr, 0, len); + return arr; + } + } + + public static boolean[] copyOfRange(boolean[] original, int from, int to) { + int newLength = to - from; + if (newLength < 0) { + throw new IllegalArgumentException(from + " > " + to); + } else { + boolean[] arr = new boolean[newLength]; + int ceil = original.length - from; + int len = ceil < newLength ? ceil : newLength; + System.arraycopy(original, from, arr, 0, len); + return arr; + } + } + + public static List asList(Object[] a) { + return java.util.Arrays.asList(a); + } + + public static int hashCode(long[] a) { + if (a == null) { + return 0; + } else { + int hash = 1; + + for(int i = 0; i < a.length; ++i) { + long e = a[i]; + hash = 31 * hash + (int)(e ^ e >>> 32); + } + + return hash; + } + } + + public static int hashCode(int[] a) { + if (a == null) { + return 0; + } else { + int hash = 1; + + for(int i = 0; i < a.length; ++i) { + hash = 31 * hash + a[i]; + } + + return hash; + } + } + + public static int hashCode(short[] a) { + if (a == null) { + return 0; + } else { + int hash = 1; + + for(int i = 0; i < a.length; ++i) { + hash = 31 * hash + a[i]; + } + + return hash; + } + } + + public static int hashCode(char[] a) { + if (a == null) { + return 0; + } else { + int hash = 1; + + for(int i = 0; i < a.length; ++i) { + hash = 31 * hash + a[i]; + } + + return hash; + } + } + + public static int hashCode(byte[] a) { + if (a == null) { + return 0; + } else { + int hash = 1; + + for(int i = 0; i < a.length; ++i) { + hash = 31 * hash + a[i]; + } + + return hash; + } + } + + public static int hashCode(boolean[] a) { + if (a == null) { + return 0; + } else { + int hash = 1; + + for(int i = 0; i < a.length; ++i) { + hash = 31 * hash + (a[i] ? 1231 : 1237); + } + + return hash; + } + } + + public static int hashCode(float[] a) { + if (a == null) { + return 0; + } else { + int hash = 1; + + for(int i = 0; i < a.length; ++i) { + hash = 31 * hash + Float.floatToIntBits(a[i]); + } + + return hash; + } + } + + public static int hashCode(double[] a) { + if (a == null) { + return 0; + } else { + int hash = 1; + + for(int i = 0; i < a.length; ++i) { + long e = Double.doubleToLongBits(a[i]); + hash = 31 * hash + (int)(e ^ e >>> 32); + } + + return hash; + } + } + + public static int hashCode(Object[] a) { + if (a == null) { + return 0; + } else { + int hash = 1; + + for(int i = 0; i < a.length; ++i) { + Object e = a[i]; + hash = 31 * hash + (e == null ? 0 : e.hashCode()); + } + + return hash; + } + } + + public static int deepHashCode(Object[] a) { + if (a == null) { + return 0; + } else { + int hash = 1; + + for(int i = 0; i < a.length; ++i) { + Object e = a[i]; + hash = 31 * hash + (e instanceof Object[] ? deepHashCode((Object[])e) : (e instanceof byte[] ? hashCode((byte[])e) : (e instanceof short[] ? hashCode((short[])e) : (e instanceof int[] ? hashCode((int[])e) : (e instanceof long[] ? hashCode((long[])e) : (e instanceof char[] ? hashCode((char[])e) : (e instanceof boolean[] ? hashCode((boolean[])e) : (e instanceof float[] ? hashCode((float[])e) : (e instanceof double[] ? hashCode((double[])e) : (e != null ? e.hashCode() : 0)))))))))); + } + + return hash; + } + } + + public static boolean deepEquals(Object[] a1, Object[] a2) { + if (a1 == a2) { + return true; + } else if (a1 != null && a2 != null) { + int len = a1.length; + if (len != a2.length) { + return false; + } else { + for(int i = 0; i < len; ++i) { + Object e1 = a1[i]; + Object e2 = a2[i]; + if (e1 != e2) { + if (e1 == null) { + return false; + } + + boolean eq = e1.getClass() == e2.getClass() && !e1.getClass().isArray() ? (e1 instanceof Object[] && e2 instanceof Object[] ? deepEquals((Object[])e1, (Object[])e2) : (e1 instanceof byte[] && e2 instanceof byte[] ? equals((byte[])e1, (byte[])e2) : (e1 instanceof short[] && e2 instanceof short[] ? equals((short[])e1, (short[])e2) : (e1 instanceof int[] && e2 instanceof int[] ? equals((int[])e1, (int[])e2) : (e1 instanceof long[] && e2 instanceof long[] ? equals((long[])e1, (long[])e2) : (e1 instanceof char[] && e2 instanceof char[] ? equals((char[])e1, (char[])e2) : (e1 instanceof boolean[] && e2 instanceof boolean[] ? equals((boolean[])e1, (boolean[])e2) : (e1 instanceof float[] && e2 instanceof float[] ? equals((float[])e1, (float[])e2) : (e1 instanceof double[] && e2 instanceof double[] ? equals((double[])e1, (double[])e2) : e1.equals(e2)))))))))) : e1.equals(e2); + if (!eq) { + return false; + } + } + } + + return true; + } + } else { + return false; + } + } + + public static String toString(long[] a) { + if (a == null) { + return "null"; + } else if (a.length == 0) { + return "[]"; + } else { + StringBuffer buf = new StringBuffer(); + buf.append('[').append(a[0]); + + for(int i = 1; i < a.length; ++i) { + buf.append(", ").append(a[i]); + } + + buf.append(']'); + return buf.toString(); + } + } + + public static String toString(int[] a) { + if (a == null) { + return "null"; + } else if (a.length == 0) { + return "[]"; + } else { + StringBuffer buf = new StringBuffer(); + buf.append('[').append(a[0]); + + for(int i = 1; i < a.length; ++i) { + buf.append(", ").append(a[i]); + } + + buf.append(']'); + return buf.toString(); + } + } + + public static String toString(short[] a) { + if (a == null) { + return "null"; + } else if (a.length == 0) { + return "[]"; + } else { + StringBuffer buf = new StringBuffer(); + buf.append('[').append(a[0]); + + for(int i = 1; i < a.length; ++i) { + buf.append(", ").append(a[i]); + } + + buf.append(']'); + return buf.toString(); + } + } + + public static String toString(char[] a) { + if (a == null) { + return "null"; + } else if (a.length == 0) { + return "[]"; + } else { + StringBuffer buf = new StringBuffer(); + buf.append('[').append(a[0]); + + for(int i = 1; i < a.length; ++i) { + buf.append(", ").append(a[i]); + } + + buf.append(']'); + return buf.toString(); + } + } + + public static String toString(byte[] a) { + if (a == null) { + return "null"; + } else if (a.length == 0) { + return "[]"; + } else { + StringBuffer buf = new StringBuffer(); + buf.append('[').append(a[0]); + + for(int i = 1; i < a.length; ++i) { + buf.append(", ").append(a[i]); + } + + buf.append(']'); + return buf.toString(); + } + } + + public static String toString(boolean[] a) { + if (a == null) { + return "null"; + } else if (a.length == 0) { + return "[]"; + } else { + StringBuffer buf = new StringBuffer(); + buf.append('[').append(a[0]); + + for(int i = 1; i < a.length; ++i) { + buf.append(", ").append(a[i]); + } + + buf.append(']'); + return buf.toString(); + } + } + + public static String toString(float[] a) { + if (a == null) { + return "null"; + } else if (a.length == 0) { + return "[]"; + } else { + StringBuffer buf = new StringBuffer(); + buf.append('[').append(a[0]); + + for(int i = 1; i < a.length; ++i) { + buf.append(", ").append(a[i]); + } + + buf.append(']'); + return buf.toString(); + } + } + + public static String toString(double[] a) { + if (a == null) { + return "null"; + } else if (a.length == 0) { + return "[]"; + } else { + StringBuffer buf = new StringBuffer(); + buf.append('[').append(a[0]); + + for(int i = 1; i < a.length; ++i) { + buf.append(", ").append(a[i]); + } + + buf.append(']'); + return buf.toString(); + } + } + + public static String toString(Object[] a) { + if (a == null) { + return "null"; + } else if (a.length == 0) { + return "[]"; + } else { + StringBuffer buf = new StringBuffer(); + buf.append('[').append(a[0]); + + for(int i = 1; i < a.length; ++i) { + buf.append(", ").append(a[i]); + } + + buf.append(']'); + return buf.toString(); + } + } + + public static String deepToString(Object[] a) { + if (a == null) { + return "null"; + } else { + StringBuffer buf = new StringBuffer(); + deepToString(a, buf, new ArrayList()); + return buf.toString(); + } + } + + private static void deepToString(Object[] a, StringBuffer buf, List seen) { + seen.add(a); + buf.append('['); + + for(int i = 0; i < a.length; ++i) { + if (i > 0) { + buf.append(", "); + } + + Object e = a[i]; + if (e == null) { + buf.append("null"); + } else if (!e.getClass().isArray()) { + buf.append(e.toString()); + } else if (e instanceof Object[]) { + if (seen.contains(e)) { + buf.append("[...]"); + } else { + deepToString((Object[])e, buf, seen); + } + } else { + buf.append(e instanceof byte[] ? toString((byte[])e) : (e instanceof short[] ? toString((short[])e) : (e instanceof int[] ? toString((int[])e) : (e instanceof long[] ? toString((long[])e) : (e instanceof char[] ? toString((char[])e) : (e instanceof boolean[] ? toString((boolean[])e) : (e instanceof float[] ? toString((float[])e) : (e instanceof double[] ? toString((double[])e) : "")))))))); + } + } + + buf.append(']'); + seen.remove(seen.size() - 1); + } +} From 966d9055cb1abb38fcd80b4f40f70f4942a92cd1 Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Thu, 2 Apr 2020 11:59:40 +0800 Subject: [PATCH 2/7] =?UTF-8?q?REPORT-29126=20=E5=AF=BC=E5=87=BApdf?= =?UTF-8?q?=EF=BC=8C=E5=AD=97=E4=BD=93=E5=8A=A0=E7=B2=97=E6=95=88=E6=9E=9C?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/third/com/lowagie/text/pdf/PdfGraphics2D.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fine-itext-old/src/com/fr/third/com/lowagie/text/pdf/PdfGraphics2D.java b/fine-itext-old/src/com/fr/third/com/lowagie/text/pdf/PdfGraphics2D.java index ee5a7cfcf..9f4db7192 100755 --- a/fine-itext-old/src/com/fr/third/com/lowagie/text/pdf/PdfGraphics2D.java +++ b/fine-itext-old/src/com/fr/third/com/lowagie/text/pdf/PdfGraphics2D.java @@ -429,10 +429,11 @@ public class PdfGraphics2D extends Graphics2D { // Simulate a bold font. // 30有点粗 ,换成40 float strokeWidth = font.getSize2D() * (weight.floatValue() - TextAttribute.WEIGHT_REGULAR.floatValue()) / 40f; + //重点是这个渲染模式的设置,其他无所谓 + cb.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE); if (strokeWidth != 1) { + cb.setLineWidth(strokeWidth); if(realPaint instanceof Color){ - cb.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE); - cb.setLineWidth(strokeWidth); Color color = (Color)realPaint; int alpha = color.getAlpha(); if (alpha != currentStrokeGState) { From f9abf02648b76d2d128860033685d9c4f7a033b5 Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Thu, 2 Apr 2020 12:23:26 +0800 Subject: [PATCH 3/7] =?UTF-8?q?REPORT-29126=20=E5=AF=BC=E5=87=BApdf?= =?UTF-8?q?=EF=BC=8C=E5=AD=97=E4=BD=93=E5=8A=A0=E7=B2=97=E6=95=88=E6=9E=9C?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E4=BA=86=EF=BC=88=E6=BC=8F=E6=8F=90=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/third/com/lowagie/text/pdf/PdfGraphics2D.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fine-itext-old/src/com/fr/third/com/lowagie/text/pdf/PdfGraphics2D.java b/fine-itext-old/src/com/fr/third/com/lowagie/text/pdf/PdfGraphics2D.java index 9f4db7192..f184556e6 100755 --- a/fine-itext-old/src/com/fr/third/com/lowagie/text/pdf/PdfGraphics2D.java +++ b/fine-itext-old/src/com/fr/third/com/lowagie/text/pdf/PdfGraphics2D.java @@ -447,9 +447,9 @@ public class PdfGraphics2D extends Graphics2D { cb.setGState(gs); } cb.setColorStroke(color); - restoreTextRenderingMode = true; } } + restoreTextRenderingMode = true; } } From 3f7d8a4f160487eec52cabeaa73df4f15e41e998 Mon Sep 17 00:00:00 2001 From: Zed Date: Tue, 7 Apr 2020 19:09:35 +0800 Subject: [PATCH 4/7] =?UTF-8?q?DEC-12783=20=E3=80=90=E8=BF=AD=E4=BB=A3?= =?UTF-8?q?=E3=80=91=E8=BF=81=E7=A7=BBdb2=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E5=A4=9A=E8=AF=AD=E8=A8=80=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0key=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cfg/annotations/SimpleValueBinder.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/SimpleValueBinder.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/SimpleValueBinder.java index c80d9f1c1..3251b86e6 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/SimpleValueBinder.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/SimpleValueBinder.java @@ -54,6 +54,7 @@ import com.fr.third.org.hibernate.type.PrimitiveCharacterArrayNClobType; import com.fr.third.org.hibernate.type.SerializableToBlobType; import com.fr.third.org.hibernate.type.StandardBasicTypes; import com.fr.third.org.hibernate.type.StringNVarcharType; +import com.fr.third.org.hibernate.type.StringType; import com.fr.third.org.hibernate.type.WrappedMaterializedBlobType; import com.fr.third.org.hibernate.usertype.DynamicParameterizedType; @@ -89,6 +90,14 @@ public class SimpleValueBinder { private AttributeConverterDescriptor attributeConverterDescriptor; + private static String DRIVER_CLASS; + + private static final String DB2_PREFIX = "db2"; + + public static void setDriverClass(String driverClass) { + DRIVER_CLASS = driverClass; + } + public void setReferencedEntityName(String referencedEntityName) { this.referencedEntityName = referencedEntityName; } @@ -278,7 +287,7 @@ public class SimpleValueBinder { else if ( isNationalized ) { if ( buildingContext.getBuildingOptions().getReflectionManager().equals( returnedClassOrElement, String.class ) ) { // nvarchar - type = StringNVarcharType.INSTANCE.getName(); + type = DRIVER_CLASS != null && DRIVER_CLASS.contains(DB2_PREFIX) ? StringType.INSTANCE.getName() : StringNVarcharType.INSTANCE.getName(); explicitType = type; } else if ( buildingContext.getBuildingOptions().getReflectionManager().equals( returnedClassOrElement, Character.class ) || @@ -454,7 +463,7 @@ public class SimpleValueBinder { public void fillSimpleValue() { LOG.debugf( "Starting fillSimpleValue for %s", propertyName ); - + if ( attributeConverterDescriptor != null ) { if ( ! BinderHelper.isEmptyAnnotationValue( explicitType ) ) { throw new AnnotationException( @@ -531,7 +540,7 @@ public class SimpleValueBinder { if ( timeStampVersionType != null ) { simpleValue.setTypeName( timeStampVersionType ); } - + if ( simpleValue.getTypeName() != null && simpleValue.getTypeName().length() > 0 && simpleValue.getMetadata().getTypeResolver().basic( simpleValue.getTypeName() ) == null ) { try { From 35dde4f353e206f47c54e594bba1aa8e4846dc78 Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Mon, 13 Apr 2020 13:53:45 +0800 Subject: [PATCH 5/7] =?UTF-8?q?REPORT-27284=20table=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E5=AF=BC=E5=87=BAPDF=E5=90=8E=20=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E3=80=81=E8=BE=B9=E6=A1=86=E4=B8=8E=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E4=B8=8D=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../text/html/Utils/BackgroundUtil.java | 48 +++++++++++++++++++ .../text/html/simpleparser/IncCell.java | 33 +------------ .../text/html/simpleparser/IncTable.java | 21 ++++++-- .../third/v2/lowagie/text/pdf/PdfPTable.java | 6 +-- .../v2/lowagie/text/pdf/TableProperties.java | 15 ++++++ 5 files changed, 83 insertions(+), 40 deletions(-) create mode 100644 fine-itext/src/com/fr/third/v2/lowagie/text/html/Utils/BackgroundUtil.java diff --git a/fine-itext/src/com/fr/third/v2/lowagie/text/html/Utils/BackgroundUtil.java b/fine-itext/src/com/fr/third/v2/lowagie/text/html/Utils/BackgroundUtil.java new file mode 100644 index 000000000..61c0ce452 --- /dev/null +++ b/fine-itext/src/com/fr/third/v2/lowagie/text/html/Utils/BackgroundUtil.java @@ -0,0 +1,48 @@ +package com.fr.third.v2.lowagie.text.html.Utils; + +import com.fr.third.v2.lowagie.text.html.CSSUtils; +import com.fr.third.v2.lowagie.text.html.simpleparser.ChainedProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * @author Hugh.C + * @version 1.0 + * Created by Hugh.C on 2020/2/26 + */ +public class BackgroundUtil { + + public static Map parse2RulesMap(ChainedProperties props) { + Map backgroundRules = new HashMap(); + String value = props.getProperty("bgcolor"); + if (value != null) { + backgroundRules.put("background-color", value); + } + value = props.getLastChainProperty("background-size"); + if (value != null) { + backgroundRules.put("background-size", value); + } + value = props.getLastChainProperty("background"); + if (value != null) { + Map backgroundStyles = CSSUtils.processBackground(value); + backgroundRules.putAll(backgroundStyles); + } + value = props.getLastChainProperty("background-color"); + if (value != null) { + backgroundRules.put("background-color", value); + } + value = props.getLastChainProperty("background-position"); + if (value != null) { + backgroundRules.put("background-position", value); + } + value = props.getLastChainProperty("background-repeat"); + if (value != null) { + backgroundRules.put("background-repeat", value); + } + value = props.getLastChainProperty("background-image"); + if (value != null) { + backgroundRules.put("background-image", value); + } + return backgroundRules; + } +} diff --git a/fine-itext/src/com/fr/third/v2/lowagie/text/html/simpleparser/IncCell.java b/fine-itext/src/com/fr/third/v2/lowagie/text/html/simpleparser/IncCell.java index 6e0597921..8b8318bb1 100644 --- a/fine-itext/src/com/fr/third/v2/lowagie/text/html/simpleparser/IncCell.java +++ b/fine-itext/src/com/fr/third/v2/lowagie/text/html/simpleparser/IncCell.java @@ -47,6 +47,7 @@ package com.fr.third.v2.lowagie.text.html.simpleparser; +import com.fr.third.v2.lowagie.text.html.Utils.BackgroundUtil; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; @@ -117,37 +118,7 @@ public class IncCell implements TextElementArray { cell.setStyleHeight(CSSUtils.parseFloat(value)); } //解析background相关属性并保存到cell对象 - Map backgroundRules = new HashMap(); - value = props.getProperty("bgcolor"); - if (value != null) { - backgroundRules.put("background-color", value); - } - value = props.getLastChainProperty("background-size"); - if (value != null) { - backgroundRules.put("background-size", value); - } - value = props.getLastChainProperty("background"); - if (value != null) { - Map backgroundStyles = CSSUtils.processBackground(value); - backgroundRules.putAll(backgroundStyles); - } - value = props.getLastChainProperty("background-color"); - if (value != null) { - backgroundRules.put("background-color", value); - } - value = props.getLastChainProperty("background-position"); - if (value != null) { - backgroundRules.put("background-position", value); - } - value = props.getLastChainProperty("background-repeat"); - if (value != null) { - backgroundRules.put("background-repeat", value); - } - value = props.getLastChainProperty("background-image"); - if (value != null) { - backgroundRules.put("background-image", value); - } - cell.setBackground(backgroundRules); + cell.setBackground(BackgroundUtil.parse2RulesMap(props)); } public boolean add(Object o) { diff --git a/fine-itext/src/com/fr/third/v2/lowagie/text/html/simpleparser/IncTable.java b/fine-itext/src/com/fr/third/v2/lowagie/text/html/simpleparser/IncTable.java index 9c99d6370..0e99b6d65 100644 --- a/fine-itext/src/com/fr/third/v2/lowagie/text/html/simpleparser/IncTable.java +++ b/fine-itext/src/com/fr/third/v2/lowagie/text/html/simpleparser/IncTable.java @@ -47,6 +47,8 @@ package com.fr.third.v2.lowagie.text.html.simpleparser; +import com.fr.third.v2.lowagie.text.html.HtmlTags; +import com.fr.third.v2.lowagie.text.html.Utils.BackgroundUtil; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -174,12 +176,12 @@ public class IncTable { } for (int rowIndex = 0; rowIndex < rows.size(); rowIndex++) { ArrayList cols = (ArrayList) rows.get(rowIndex); - for (int colIndex = 0; colIndex < cols.size(); colIndex++) { + int colSpan = 1; + for (int colIndex = 0; colIndex < cols.size(); colIndex+=colSpan) { PdfPCell pCell = ((PdfPCell) cols.get(colIndex)); - - int cellCols = pCell.getColspan(); - float avgWidth = pCell.getStyleWidth() / cellCols; - for (int i = 0; i < cellCols && colIndex + i < colCount; i++) { + colSpan = pCell.getColspan(); + float avgWidth = pCell.getStyleWidth() / colSpan; + for (int i = 0; i < colSpan && colIndex + i < colCount; i++) { if (relativeColWidths.get(colIndex + i) < avgWidth) { relativeColWidths.set(colIndex + i, avgWidth); } @@ -271,6 +273,11 @@ public class IncTable { if(value != null){ borderStyle.setBorderColor(Markup.decodeColor(value)); } + value = (String) props.get("bordercolor"); + if (value != null) { + borderStyle.setBorderColor(Markup.decodeColor(value)); + } + value = (String)props.get("border-collapse"); if(value != null){ tableProperties.setCollapse(value.equals("collapse")); @@ -283,6 +290,10 @@ public class IncTable { if(value != null){ tableProperties.setCellpadding(CSSUtils.parseFloat(value)); } + ChainedProperties properties = new ChainedProperties(); + properties.addToChain(HtmlTags.TABLE, props); + //解析background相关属性 + tableProperties.setBackground(BackgroundUtil.parse2RulesMap(properties)); return tableProperties; } } diff --git a/fine-itext/src/com/fr/third/v2/lowagie/text/pdf/PdfPTable.java b/fine-itext/src/com/fr/third/v2/lowagie/text/pdf/PdfPTable.java index 199d21d6f..38d9a250f 100644 --- a/fine-itext/src/com/fr/third/v2/lowagie/text/pdf/PdfPTable.java +++ b/fine-itext/src/com/fr/third/v2/lowagie/text/pdf/PdfPTable.java @@ -350,8 +350,7 @@ public class PdfPTable implements LargeElement { return; float total = 0; int numCols = getNumberOfColumns(); - BorderStyle borderStyle = tableProperties.getBorderStyle(); - float borderWidth = tableProperties.isCollapse() ? borderStyle.getBorderWidth() / 2 : borderStyle.getBorderWidth(); + float borderWidth = tableProperties.getBorderWidth(); float cellspacing = tableProperties.getCellspacing(); float cellpadding = tableProperties.getCellpadding(); for (int k = 0; k < numCols; ++k) @@ -435,8 +434,7 @@ public class PdfPTable implements LargeElement { if (totalWidth <= 0) return 0; totalHeight = 0; - BorderStyle borderStyle = tableProperties.getBorderStyle(); - float borderWidth = tableProperties.isCollapse() ? borderStyle.getBorderWidth() / 2 : borderStyle.getBorderWidth(); + float borderWidth = tableProperties.getBorderWidth(); float cellspacing = tableProperties.getCellspacing(); float cellpadding = tableProperties.getCellpadding(); for (int k = 0; k < rows.size(); ++k) { diff --git a/fine-itext/src/com/fr/third/v2/lowagie/text/pdf/TableProperties.java b/fine-itext/src/com/fr/third/v2/lowagie/text/pdf/TableProperties.java index fa1c7de0b..a886f136e 100644 --- a/fine-itext/src/com/fr/third/v2/lowagie/text/pdf/TableProperties.java +++ b/fine-itext/src/com/fr/third/v2/lowagie/text/pdf/TableProperties.java @@ -1,5 +1,7 @@ package com.fr.third.v2.lowagie.text.pdf; +import java.util.Map; + /** * 描述table的属性类 * 包括cellspacing、cellpadding、border等 @@ -9,11 +11,16 @@ public class TableProperties { private float cellspacing = 2.0f; private float cellpadding = 1.0f; private boolean collapse = false; + public Map background; public BorderStyle getBorderStyle() { return borderStyle; } + public float getBorderWidth() { + return 0 == getCellspacing() ? borderStyle.getBorderWidth() / 2 : borderStyle.getBorderWidth(); + } + public void setBorderStyle(BorderStyle borderStyle) { this.borderStyle = borderStyle; } @@ -42,6 +49,14 @@ public class TableProperties { this.collapse = collapse; } + public Map getBackground() { + return background; + } + + public void setBackground(Map background) { + this.background = background; + } + public String toHtmlString(){ StringBuffer sb = new StringBuffer(); if(!isCollapse()){ From 4a326534d91e9975084f8ab6647b3313e23e4167 Mon Sep 17 00:00:00 2001 From: "Cloud.Liu" Date: Mon, 13 Apr 2020 20:47:12 +0800 Subject: [PATCH 6/7] =?UTF-8?q?REPORT-29784=20third=E5=88=A0=E5=87=8F?= =?UTF-8?q?=E5=BC=95=E8=B5=B7=E5=AE=9A=E6=97=B6=E8=B0=83=E5=BA=A6=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/org/apache/commons/codec/digest/DigestUtils.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fine-commons-codec/src/org/apache/commons/codec/digest/DigestUtils.java b/fine-commons-codec/src/org/apache/commons/codec/digest/DigestUtils.java index cf40b1cc8..517c509e0 100644 --- a/fine-commons-codec/src/org/apache/commons/codec/digest/DigestUtils.java +++ b/fine-commons-codec/src/org/apache/commons/codec/digest/DigestUtils.java @@ -9,4 +9,7 @@ public class DigestUtils { public static String sha1Hex(String data) { return com.fr.third.org.apache.commons.codec.digest.DigestUtils.sha1Hex(data); } + public static String md5Hex(String data) { + return com.fr.third.org.apache.commons.codec.digest.DigestUtils.md5Hex(data); + } } From 3f2a0354419260518fac13e1e99318b88d47db3e Mon Sep 17 00:00:00 2001 From: zhouping Date: Tue, 14 Apr 2020 15:21:08 +0800 Subject: [PATCH 7/7] =?UTF-8?q?REPORT-29490=20=E5=AE=89=E5=85=A8=E6=BC=8F?= =?UTF-8?q?=E6=B4=9Eby=20zack?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/third/javax/xml/stream/XMLEntityManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fine-third-default/fine-sjsxp/src/main/java/com/fr/third/javax/xml/stream/XMLEntityManager.java b/fine-third-default/fine-sjsxp/src/main/java/com/fr/third/javax/xml/stream/XMLEntityManager.java index 334eeddbf..341ac472f 100644 --- a/fine-third-default/fine-sjsxp/src/main/java/com/fr/third/javax/xml/stream/XMLEntityManager.java +++ b/fine-third-default/fine-sjsxp/src/main/java/com/fr/third/javax/xml/stream/XMLEntityManager.java @@ -443,7 +443,7 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { } // setEntityHandler(XMLEntityHandler) //this function returns StaxXMLInputSource - public StaxXMLInputSource resolveEntityAsPerStax(XMLResourceIdentifier resourceIdentifier) throws java.io.IOException{ + public StaxXMLInputSource resolveEntityAsPerStax(XMLResourceIdentifier resourceIdentifier) throws IOException{ if(resourceIdentifier == null ) return null; @@ -976,8 +976,8 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver { fEntityStack.removeAllElements(); fCurrentEntity = null; fValidation = false; - fExternalGeneralEntities = true; - fExternalParameterEntities = true; + fExternalGeneralEntities = false; + fExternalParameterEntities = false; fAllowJavaEncodings = true ; //test();