Skip to content

Commit 0411d76

Browse files
joe-chackongmr
andcommitted
style(poa): improve unsupported policy logging with POA name and reduced severity
- Add POAPolicies constructor overload accepting optional POA name parameter - Include POA name in unsupported policy log message for better diagnostics - Downgrade log level from warning to fine since unknown policies are expected when new Jakarta EE versions introduce new policy types - Pass POA name from POA_impl.create_POA() to POAPolicies constructor - Lines added: 8, lines removed: 3 Co-authored-by: Neil Richards <neil_richards@uk.ibm.com> Co-authored-by-AI: IBM Bob 1.0.3
1 parent f48f71a commit 0411d76

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

yoko-core/src/main/java/org/apache/yoko/orb/OBPortableServer/POAPolicies.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ final public class POAPolicies {
7979
private final short bidirPolicyValue;
8080

8181
POAPolicies(ORBInstance orbInstance, Policy[] policies) {
82+
this(orbInstance, policies, null);
83+
}
84+
85+
POAPolicies(ORBInstance orbInstance, Policy[] policies, String poaName) {
8286
// Set the default policy values.
8387
// These are temporary variables to allow the final fields to be set after the for loop.
8488
// TODO: refactor to use a builder pattern for conciseness
@@ -113,8 +117,9 @@ final public class POAPolicies {
113117
case INTERCEPTOR_CALL_POLICY_ID.value: interceptorCall = InterceptorCallPolicyHelper.narrow(InterceptorCallPolicyHelper.narrow(policy)).value(); break;
114118
case ZERO_PORT_POLICY_ID.value: zeroPort = ZeroPortPolicyHelper.narrow(ZeroPortPolicyHelper.narrow(policy)).value(); break;
115119
default:
116-
// Unknown policy
117-
POA_INIT_LOG.warning(() -> String.format("Ignoring unsupported policy of type 0x%x", policy.policy_type()));
120+
// Unknown policy - log at fine level since this is expected when new policies are introduced
121+
final String poa = poaName != null ? "POA '" + poaName + "' is ignoring" : "Ignoring";
122+
POA_INIT_LOG.fine(() -> String.format("%s unsupported policy of type 0x%x", poa, policy.policy_type()));
118123
}
119124
}
120125
}

yoko-core/src/main/java/org/apache/yoko/orb/OBPortableServer/POA_impl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ public org.omg.PortableServer.POA create_POA(String adapter,
413413
logger.fine(() -> "POA " + name_ + " creating new POA with name " + adapter);
414414

415415
// Are the requested policies valid?
416-
POAPolicies policies = new POAPolicies(orbInstance_, rawPolicies);
416+
POAPolicies policies = new POAPolicies(orbInstance_, rawPolicies, adapter);
417417
IntHolder idx = new IntHolder();
418418
if (!validatePolicies(policies, rawPolicies, idx))
419419
throw new InvalidPolicy((short) idx.value);

0 commit comments

Comments
 (0)