This is an automated email from the ASF dual-hosted git repository.
gk pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/turbine-core.git
The following commit(s) were added to refs/heads/trunk by this push:
new ca351499 Update deps: Fulcrum Quartz to 2.0.0, Jackson2 to 2.18.2,
Testcontainers to 1.20.4, refactor BaseInitBroker extract
buildCircularDependencyMessage method, adjust log lvel in DateTimeFormattermake
instance vars Logger and ConcurrentMap final in AnnotationProcessor, add hints
for jira in .asf.yaml
ca351499 is described below
commit ca35149940c2a2071391009037ce6adf8b757ade
Author: gk <[email protected]>
AuthorDate: Tue Feb 4 17:02:34 2025 +0100
Update deps: Fulcrum Quartz to 2.0.0, Jackson2 to 2.18.2, Testcontainers to
1.20.4, refactor BaseInitBroker extract buildCircularDependencyMessage method,
adjust log lvel in DateTimeFormattermake instance vars Logger and ConcurrentMap
final in AnnotationProcessor, add hints for jira in .asf.yaml
---
.asf.yaml | 4 +-
pom.xml | 6 +-
.../turbine/annotation/AnnotationProcessor.java | 4 +-
.../turbine/services/BaseInitableBroker.java | 65 +++++++++++-----------
.../localization/DateTimeFormatterService.java | 6 +-
5 files changed, 42 insertions(+), 43 deletions(-)
diff --git a/.asf.yaml b/.asf.yaml
index 6b2e0de1..8840bf32 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -22,4 +22,6 @@ github:
labels:
- web-framework
- java
- - apache
\ No newline at end of file
+ - apache
+ notifications:
+ jira_options: link label comment
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 84f047dd..3e8cd719 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1359,14 +1359,14 @@
<fulcrum.parser>4.0.0</fulcrum.parser>
<fulcrum.security>4.0.0</fulcrum.security>
<fulcrum.localization>2.0.0</fulcrum.localization>
- <fulcrum.quartz>2.0.0-SNAPSHOT</fulcrum.quartz>
+ <fulcrum.quartz>2.0.0</fulcrum.quartz>
<fulcrum.testcontainer>2.0.1</fulcrum.testcontainer>
<!-- inherited in fulcrum components, testcontainer -->
<fulcrum.yaafi>2.0.1</fulcrum.yaafi>
<torque.version>6.0</torque.version>
- <jackson2.version>2.17.2</jackson2.version>
+ <jackson2.version>2.18.2</jackson2.version>
<doclint>none</doclint>
- <docker.testcontainers.version>1.18.3</docker.testcontainers.version>
+ <docker.testcontainers.version>1.20.4</docker.testcontainers.version>
<!--jacoco.skip>true</jacoco.skip-->
<argLine />
</properties>
diff --git a/src/java/org/apache/turbine/annotation/AnnotationProcessor.java
b/src/java/org/apache/turbine/annotation/AnnotationProcessor.java
index 58149f8c..1936fc04 100644
--- a/src/java/org/apache/turbine/annotation/AnnotationProcessor.java
+++ b/src/java/org/apache/turbine/annotation/AnnotationProcessor.java
@@ -53,10 +53,10 @@ import org.apache.turbine.util.TurbineException;
public class AnnotationProcessor
{
/** Logging */
- private static Logger log =
LogManager.getLogger(AnnotationProcessor.class);
+ private static final Logger log =
LogManager.getLogger(AnnotationProcessor.class);
/** Annotation cache */
- private static ConcurrentMap<String, Annotation[]> annotationCache = new
ConcurrentHashMap<>();
+ private static final ConcurrentMap<String, Annotation[]> annotationCache =
new ConcurrentHashMap<>();
/**
* Get cached annotations for field, class or method
diff --git a/src/java/org/apache/turbine/services/BaseInitableBroker.java
b/src/java/org/apache/turbine/services/BaseInitableBroker.java
index 41718d45..96aa8d46 100644
--- a/src/java/org/apache/turbine/services/BaseInitableBroker.java
+++ b/src/java/org/apache/turbine/services/BaseInitableBroker.java
@@ -86,51 +86,48 @@ public abstract class BaseInitableBroker
// empty
}
- /**
- * Performs early initialization of an Initable class.
- *
- * @param className The name of the class to be initialized.
- * @param data An Object to be used for initialization activities.
- * @throws InitializationException Initialization was not successful.
- */
@Override
- public void initClass(String className, Object data)
- throws InitializationException
- {
- // make sure that only one thread calls this method recursively
- synchronized (stack)
- {
+ public void initClass(String className, Object data) throws
InitializationException {
+ synchronized (stack) {
int pos = stack.search(className);
- if (pos != -1)
- {
- StringBuilder msg = new StringBuilder().append(className)
- .append(" couldn't be initialized because of circular
dependency chain:\n");
- for (int i = pos; i > 0; i--)
- {
- msg.append(stack.elementAt(stack.size() - i - 1) + "->");
- }
- msg.append(className).append('\n');
-
- throw new InitializationException(msg.toString());
+ if (pos != -1) {
+ throw new
InitializationException(buildCircularDependencyMessage(className, pos));
}
- try
- {
+ try {
stack.push(className);
Initable instance = getInitableInstance(className);
- if (!instance.getInit())
- {
- // this call might result in an indirect recursion
+ boolean instanceInitialized = instance.getInit();
+
+ if (!instanceInitialized) {
instance.init(data);
}
+ } finally {
+ stack.pop(); // Ensure class is removed from stack even if an
exception occurs.
}
- finally
- {
- // Succeeded or not, make sure the name gets off the stack.
- stack.pop();
- }
}
}
+ /**
+ * Builds a message for a circular dependency exception.
+ *
+ * @param className
+ * @param dependencyPosition
+ * @return
+ */
+ private String buildCircularDependencyMessage(String className, int
dependencyPosition) {
+ StringBuilder msg = new StringBuilder()
+ .append(className)
+ .append(" couldn't be initialized because of circular
dependency chain:")
+ .append(System.lineSeparator());
+
+ for (int i = dependencyPosition; i > 0; i--) {
+ msg.append(stack.elementAt(stack.size() - i - 1))
+ .append("->");
+ }
+ msg.append(className).append(System.lineSeparator());
+ return msg.toString();
+ }
+
/**
* Shuts down an <code>Initable</code>.
*
diff --git
a/src/java/org/apache/turbine/services/localization/DateTimeFormatterService.java
b/src/java/org/apache/turbine/services/localization/DateTimeFormatterService.java
index c18fc05d..582cfb66 100644
---
a/src/java/org/apache/turbine/services/localization/DateTimeFormatterService.java
+++
b/src/java/org/apache/turbine/services/localization/DateTimeFormatterService.java
@@ -149,17 +149,17 @@ public class DateTimeFormatterService
{
dtf = dtf.withLocale(locale);
} else {
- log.warn("adding default local {}", getLocale() );
+ log.warn("adding default locale {}", getLocale() );
dtf = dtf.withLocale( getLocale());
}
if (zoneId != null)
{
dtf = dtf.withZone(zoneId);
} else {
- log.warn("adding default zone {}", getZoneId() );
+ log.info("adding default zone {}", getZoneId() );
dtf = dtf.withZone(getZoneId());
}
- log.warn("try to format {} with {}.", temporalAccessor, dtf );
+ log.info("try to format {} with {}.", temporalAccessor, dtf );
try {
result =
dtf.format(temporalAccessor);