From 07fbe99d9bd041eab1a7e4a8635efebf7c76d8c8 Mon Sep 17 00:00:00 2001 From: lidongy <1879087903@qq.com> Date: Wed, 26 Apr 2023 10:55:35 +0800 Subject: [PATCH 1/3] =?UTF-8?q?REPORT-93688=20REPORT-94439=20=E5=88=9B?= =?UTF-8?q?=E5=BB=BAhsql=E8=BF=9E=E6=8E=A5=E8=B6=85=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/third/org/hsqldb/lib/FrameworkLogger.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fine-hsqldb/src/main/java/com/fr/third/org/hsqldb/lib/FrameworkLogger.java b/fine-hsqldb/src/main/java/com/fr/third/org/hsqldb/lib/FrameworkLogger.java index f59666b73..bd23a50d1 100644 --- a/fine-hsqldb/src/main/java/com/fr/third/org/hsqldb/lib/FrameworkLogger.java +++ b/fine-hsqldb/src/main/java/com/fr/third/org/hsqldb/lib/FrameworkLogger.java @@ -219,9 +219,9 @@ public class FrameworkLogger { try { // log4j v2 available? log4jLoggerClass = Class.forName( - "org.apache.logging.log4j.Logger"); + "com.fr.third.apache.logging.log4j.Logger"); log4jManagerClass = Class.forName( - "org.apache.logging.log4j.LogManager"); + "com.fr.third.apache.logging.log4j.LogManager"); } catch (Exception e) { // The class will only load successfully if Log4j v2 thinks it is @@ -232,11 +232,11 @@ public class FrameworkLogger { // Attempt to configure log4j v2 if (log4jLoggerClass != null) { try { - populateJdkToLog4jLevels("org.apache.logging.log4j.Level"); + populateJdkToLog4jLevels("com.fr.third.apache.logging.log4j.Level"); log4jLogMethod = log4jLoggerClass.getMethod("log", new Class[] { - Class.forName("org.apache.logging.log4j.Level"), + Class.forName("com.fr.third.apache.logging.log4j.Level"), Object.class, Throwable.class }); log4jGetLogger = log4jManagerClass.getMethod("getLogger", @@ -272,7 +272,7 @@ public class FrameworkLogger { try { // log4j v1 available? - log4jLoggerClass = Class.forName("org.apache.log4j.Logger"); + log4jLoggerClass = Class.forName("com.fr.third.apache.log4j.Logger"); log4jManagerClass = log4jLoggerClass; } catch (Exception e) { @@ -284,11 +284,11 @@ public class FrameworkLogger { // Attempt to configure log4j v1 if (log4jLoggerClass != null) { try { - populateJdkToLog4jLevels("org.apache.log4j.Level"); + populateJdkToLog4jLevels("com.fr.third.apache.log4j.Level"); log4jLogMethod = log4jLoggerClass.getMethod("log", new Class[] { - String.class, Class.forName("org.apache.log4j.Priority"), + String.class, Class.forName("com.fr.third.apache.log4j.Priority"), Object.class, Throwable.class }); log4jGetLogger = log4jManagerClass.getMethod("getLogger", @@ -350,7 +350,7 @@ public class FrameworkLogger { lm.readConfiguration(istream); - Logger cmdlineLogger = Logger.getLogger("org.hsqldb.cmdline"); + Logger cmdlineLogger = Logger.getLogger("com.fr.third.org.hsqldb.cmdline"); cmdlineLogger.addHandler(consoleHandler); cmdlineLogger.setUseParentHandlers(false); From 5bf39d83a3a9f3d2872af3bef9dd9943566b6f73 Mon Sep 17 00:00:00 2001 From: lidongy <1879087903@qq.com> Date: Wed, 26 Apr 2023 11:13:13 +0800 Subject: [PATCH 2/3] =?UTF-8?q?REPORT-93688=20REPORT-94439=20=E5=88=9B?= =?UTF-8?q?=E5=BB=BAhsql=E8=BF=9E=E6=8E=A5=E8=B6=85=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../third/org/hsqldb/lib/FrameworkLogger.java | 185 +++++++++--------- 1 file changed, 93 insertions(+), 92 deletions(-) diff --git a/fine-hsqldb/src/main/java/com/fr/third/org/hsqldb/lib/FrameworkLogger.java b/fine-hsqldb/src/main/java/com/fr/third/org/hsqldb/lib/FrameworkLogger.java index bd23a50d1..54f6dad56 100644 --- a/fine-hsqldb/src/main/java/com/fr/third/org/hsqldb/lib/FrameworkLogger.java +++ b/fine-hsqldb/src/main/java/com/fr/third/org/hsqldb/lib/FrameworkLogger.java @@ -50,35 +50,35 @@ import java.lang.reflect.InvocationTargetException; /** * A logging framework wrapper that supports java.util.logging and log4j. - *

+ *

* Logger hierarchies are stored at the Class level. * Log4j will be used if the Log4j system (not necessarily config files) are * found in the runtime classpath. * Otherwise, java.util.logging will be used. - *

+ *

* This is pretty safe because for use cases where multiple hierarchies * are desired, classloader hierarchies will effectively isolate multiple * class-level Logger hierarchies. - *

+ *

* Sad as it is, the java.util.logging facility lacks the most basic * developer-side and configuration-side capabilities. * Besides having a non-scalable discovery system, the designers didn't * comprehend the need for a level between WARNING and SEVERE! * Since we don't want to require log4j in Classpath, we have to live * with these constraints. - *

+ *

* As with all the popular logging frameworks, if you want to capture a * stack trace, you must use the two-parameters logging methods. * I.e., you must also pass a String, or only toString() from your * throwable will be captured. - *

+ *

* Usage example:

  * private static FrameworkLogger logger =
- *        FrameworkLogger.getLog(SqlTool.class);
+ * FrameworkLogger.getLog(SqlTool.class);
  * ...
- *   logger.finer("Doing something log-worthy");
+ * logger.finer("Doing something log-worthy");
  * 
- * + *

*

* The system level property hsqldb.reconfig_logging=false is * required to avoid configuration of java.util.logging. Otherwise @@ -113,17 +113,17 @@ public class FrameworkLogger { public static synchronized String report() { return new StringBuilder().append(loggerInstances.size()).append( - " logger instances: ").append( - loggerInstances.keySet()).toString(); + " logger instances: ").append( + loggerInstances.keySet()).toString(); } - static private Map loggerInstances = new HashMap(); - static private Map jdkToLog4jLevels = new HashMap(); - static private Method log4jGetLogger; - static private Method log4jLogMethod; + static private Map loggerInstances = new HashMap(); + static private Map jdkToLog4jLevels = new HashMap(); + static private Method log4jGetLogger; + static private Method log4jLogMethod; static private boolean callerFqcnAvailable = false; - private Object log4jLogger; - private Logger jdkLogger; + private Object log4jLogger; + private Logger jdkLogger; // No need for more than one static, since we have only one console static private boolean noopMode; // If true, then logging calls do nothing @@ -131,7 +131,8 @@ public class FrameworkLogger { static { try { reconfigure(); - } catch (SecurityException e) {} + } catch (SecurityException e) { + } } /** @@ -148,10 +149,10 @@ public class FrameworkLogger { */ public static synchronized void clearLoggers(String prefixToZap) { - Set targetKeys = new HashSet(); - java.util.Iterator it = loggerInstances.keySet().iterator(); - String k; - String dottedPrefix = prefixToZap + '.'; + Set targetKeys = new HashSet(); + java.util.Iterator it = loggerInstances.keySet().iterator(); + String k; + String dottedPrefix = prefixToZap + '.'; while (it.hasNext()) { k = (String) it.next(); @@ -165,36 +166,36 @@ public class FrameworkLogger { } private static synchronized void - populateJdkToLog4jLevels(String classString) + populateJdkToLog4jLevels(String classString) throws ClassNotFoundException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { Method log4jToLevel = Class.forName(classString).getMethod( - "toLevel", new Class[]{ String.class }); + "toLevel", new Class[]{String.class}); jdkToLog4jLevels.put(Level.ALL, - log4jToLevel.invoke(null, - new Object[]{ "ALL" })); + log4jToLevel.invoke(null, + new Object[]{"ALL"})); jdkToLog4jLevels.put(Level.FINER, - log4jToLevel.invoke(null, - new Object[]{ "DEBUG" })); + log4jToLevel.invoke(null, + new Object[]{"DEBUG"})); jdkToLog4jLevels.put(Level.WARNING, - log4jToLevel.invoke(null, - new Object[]{ "ERROR" })); + log4jToLevel.invoke(null, + new Object[]{"ERROR"})); jdkToLog4jLevels.put(Level.SEVERE, - log4jToLevel.invoke(null, - new Object[]{ "FATAL" })); + log4jToLevel.invoke(null, + new Object[]{"FATAL"})); jdkToLog4jLevels.put(Level.INFO, - log4jToLevel.invoke(null, - new Object[]{ "INFO" })); + log4jToLevel.invoke(null, + new Object[]{"INFO"})); jdkToLog4jLevels.put(Level.OFF, - log4jToLevel.invoke(null, - new Object[]{ "OFF" })); + log4jToLevel.invoke(null, + new Object[]{"OFF"})); jdkToLog4jLevels.put(Level.FINEST, - log4jToLevel.invoke(null, - new Object[]{ "TRACE" })); + log4jToLevel.invoke(null, + new Object[]{"TRACE"})); jdkToLog4jLevels.put(Level.WARNING, - log4jToLevel.invoke(null, - new Object[]{ "WARN" })); + log4jToLevel.invoke(null, + new Object[]{"WARN"})); } static void reconfigure() { @@ -207,8 +208,8 @@ public class FrameworkLogger { loggerInstances.clear(); jdkToLog4jLevels.clear(); - log4jGetLogger = null; - log4jLogMethod = null; + log4jGetLogger = null; + log4jLogMethod = null; callerFqcnAvailable = false; // Precedence: @@ -235,12 +236,12 @@ public class FrameworkLogger { populateJdkToLog4jLevels("com.fr.third.apache.logging.log4j.Level"); log4jLogMethod = log4jLoggerClass.getMethod("log", - new Class[] { - Class.forName("com.fr.third.apache.logging.log4j.Level"), - Object.class, Throwable.class - }); + new Class[]{ + Class.forName("com.fr.third.apache.logging.log4j.Level"), + Object.class, Throwable.class + }); log4jGetLogger = log4jManagerClass.getMethod("getLogger", - new Class[]{ String.class }); + new Class[]{String.class}); // This last object is what we toggle on to generate either // Log4j or Jdk Logger objects (to wrap). @@ -251,8 +252,8 @@ public class FrameworkLogger { // successfully initialized with warnings due to bad config). try { System.err.println( - " failure " - + "instantiating configured Log4j v2 system: " + e); + " failure " + + "instantiating configured Log4j v2 system: " + e); // It's possible we don't have write access to System.err. } catch (Throwable t) { @@ -266,8 +267,8 @@ public class FrameworkLogger { // Reset log4jLoggerClass = null; log4jManagerClass = null; - log4jLogMethod = null; - log4jGetLogger = null; + log4jLogMethod = null; + log4jGetLogger = null; jdkToLog4jLevels.clear(); try { @@ -287,12 +288,12 @@ public class FrameworkLogger { populateJdkToLog4jLevels("com.fr.third.apache.log4j.Level"); log4jLogMethod = log4jLoggerClass.getMethod("log", - new Class[] { - String.class, Class.forName("com.fr.third.apache.log4j.Priority"), - Object.class, Throwable.class - }); + new Class[]{ + String.class, Class.forName("com.fr.third.apache.log4j.Priority"), + Object.class, Throwable.class + }); log4jGetLogger = log4jManagerClass.getMethod("getLogger", - new Class[]{ String.class }); + new Class[]{String.class}); // This last object is what we toggle on to generate either // Log4j or Jdk Logger objects (to wrap). callerFqcnAvailable = true; @@ -304,8 +305,8 @@ public class FrameworkLogger { // successfully initialized with warnings due to bad config). try { System.err.println( - " failure " - + "instantiating configured Log4j v1 system: " + e); + " failure " + + "instantiating configured Log4j v1 system: " + e); // It's possible we don't have write access to System.err. } catch (Throwable t) { @@ -319,8 +320,8 @@ public class FrameworkLogger { // Reset log4jLoggerClass = null; log4jManagerClass = null; - log4jLogMethod = null; - log4jGetLogger = null; + log4jLogMethod = null; + log4jGetLogger = null; callerFqcnAvailable = false; jdkToLog4jLevels.clear(); @@ -343,7 +344,7 @@ public class FrameworkLogger { ConsoleHandler consoleHandler = new ConsoleHandler(); consoleHandler.setFormatter( - new BasicTextJdkLogFormatter(false)); + new BasicTextJdkLogFormatter(false)); consoleHandler.setLevel(Level.INFO); istream = FrameworkLogger.class.getResourceAsStream(path); @@ -371,8 +372,8 @@ public class FrameworkLogger { noopMode = true; System.err.println( - " failure initializing JDK logging system. " - + "Continuing without Application logging."); + " failure initializing JDK logging system. " + + "Continuing without Application logging."); e.printStackTrace(); } finally { if (istream != null) { @@ -380,7 +381,7 @@ public class FrameworkLogger { istream.close(); } catch (IOException ioe) { System.err.println("Failed to close logging input stream: " - + ioe); + + ioe); } } } @@ -397,10 +398,10 @@ public class FrameworkLogger { } else { try { log4jLogger = log4jGetLogger.invoke(null, - new Object[]{ s }); + new Object[]{s}); } catch (Exception e) { throw new RuntimeException( - "Failed to instantiate Log4j Logger", e); + "Failed to instantiate Log4j Logger", e); } } } @@ -412,7 +413,7 @@ public class FrameworkLogger { /** * User's entry-point into this logging system. - *

+ *

* You normally want to work with static (class-level) pointers to * logger instances, for performance efficiency. * See the class-level JavaDoc for a usage example. @@ -431,7 +432,7 @@ public class FrameworkLogger { */ public static FrameworkLogger getLog(Class c, String contextId) { return (contextId == null) ? getLog(c) - : getLog(contextId + '.' + c.getName()); + : getLog(contextId + '.' + c.getName()); } /** @@ -442,7 +443,7 @@ public class FrameworkLogger { */ public static FrameworkLogger getLog(String baseId, String contextId) { return (contextId == null) ? getLog(baseId) - : getLog(contextId + '.' + baseId); + : getLog(contextId + '.' + baseId); } /** @@ -465,9 +466,9 @@ public class FrameworkLogger { * Just like FrameworkLogger.log(Level, String), * but also logs a stack trace. * - * @param level java.util.logging.Level level to filter and log at + * @param level java.util.logging.Level level to filter and log at * @param message Message to be logged - * @param t Throwable whose stack trace will be logged. + * @param t Throwable whose stack trace will be logged. * @see #log(Level, String) * @see Logger#log(Level, String) * @see Level @@ -492,8 +493,8 @@ public class FrameworkLogger { if (log4jLogger == null) { StackTraceElement[] elements = new Throwable().getStackTrace(); - String c = ""; - String m = ""; + String c = ""; + String m = ""; if (elements.length > revertMethods) { c = elements[revertMethods].getClassName(); @@ -508,15 +509,15 @@ public class FrameworkLogger { } else { try { log4jLogMethod.invoke(log4jLogger, callerFqcnAvailable - ? new Object[] { - skipClass.getName(), jdkToLog4jLevels.get(level), - message, t} - : new Object[] { - jdkToLog4jLevels.get(level), message, t} + ? new Object[]{ + skipClass.getName(), jdkToLog4jLevels.get(level), + message, t} + : new Object[]{ + jdkToLog4jLevels.get(level), message, t} ); } catch (Exception e) { throw new RuntimeException( - "Logging failed when attempting to log: " + message, e); + "Logging failed when attempting to log: " + message, e); } } } @@ -539,17 +540,17 @@ public class FrameworkLogger { } else { try { log4jLogMethod.invoke(log4jLogger, callerFqcnAvailable - ? new Object[] { - FrameworkLogger.class.getName(), - jdkToLog4jLevels.get(level), message, null} - : new Object[] { - jdkToLog4jLevels.get(level), message, null} + ? new Object[]{ + FrameworkLogger.class.getName(), + jdkToLog4jLevels.get(level), message, null} + : new Object[]{ + jdkToLog4jLevels.get(level), message, null} ); // Test where SqlFile correct here. } catch (Exception e) { throw new RuntimeException( - "Logging failed when attempting to log: " + message, e); + "Logging failed when attempting to log: " + message, e); } } } @@ -557,7 +558,7 @@ public class FrameworkLogger { // Wrappers /** - * @param level java.util.logging.Level level to filter and log at + * @param level java.util.logging.Level level to filter and log at * @param message Message to be logged * @see Logger#log(Level, String) * @see Level @@ -679,21 +680,21 @@ public class FrameworkLogger { /** * Whether this JVM is configured with java.util.logging defaults. - * + *

* If the JRE-provided config file is not in the expected place, then * we return false. */ public static boolean isDefaultJdkConfig() { File globalCfgFile = new File(System.getProperty("java.home"), - "lib/logging.properties"); + "lib/logging.properties"); if (!globalCfgFile.isFile()) { return false; } FileInputStream fis = null; - LogManager lm = LogManager.getLogManager(); + LogManager lm = LogManager.getLogManager(); try { fis = new FileInputStream(globalCfgFile); @@ -703,14 +704,14 @@ public class FrameworkLogger { defaultProps.load(fis); Enumeration names = defaultProps.propertyNames(); - int i = 0; - String name; - String liveVal; + int i = 0; + String name; + String liveVal; while (names.hasMoreElements()) { i++; - name = (String) names.nextElement(); + name = (String) names.nextElement(); liveVal = lm.getProperty(name); if (liveVal == null) { From e27a5542c7e4df023757e521588b4f4622c1c555 Mon Sep 17 00:00:00 2001 From: lidongy <1879087903@qq.com> Date: Thu, 27 Apr 2023 10:49:39 +0800 Subject: [PATCH 3/3] =?UTF-8?q?REPORT-94814=20=E5=A4=87=E4=BB=BD=E8=BF=98?= =?UTF-8?q?=E5=8E=9F=E6=8A=A5=E9=94=99npe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hibernate/engine/internal/StatefulPersistenceContext.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fine-hibernate/src/main/java/com/fr/third/org/hibernate/engine/internal/StatefulPersistenceContext.java b/fine-hibernate/src/main/java/com/fr/third/org/hibernate/engine/internal/StatefulPersistenceContext.java index e94b79f6c..4a7b4b450 100644 --- a/fine-hibernate/src/main/java/com/fr/third/org/hibernate/engine/internal/StatefulPersistenceContext.java +++ b/fine-hibernate/src/main/java/com/fr/third/org/hibernate/engine/internal/StatefulPersistenceContext.java @@ -223,7 +223,7 @@ public class StatefulPersistenceContext implements PersistenceContext { for ( Entry objectEntityEntryEntry : entityEntryContext.reentrantSafeEntityEntries() ) { // todo : I dont think this need be reentrant safe - if ( objectEntityEntryEntry.getKey() instanceof PersistentAttributeInterceptable ) { + if ( objectEntityEntryEntry != null && objectEntityEntryEntry.getKey() instanceof PersistentAttributeInterceptable ) { final PersistentAttributeInterceptor interceptor = ( (PersistentAttributeInterceptable) objectEntityEntryEntry.getKey() ).$$_hibernate_getInterceptor(); if ( interceptor instanceof LazyAttributeLoadingInterceptor ) { ( (LazyAttributeLoadingInterceptor) interceptor ).unsetSession();