Skip to content

Commit a7b2caa

Browse files
Address code review feedback
- Fix IFunctionResolver Javadoc to remove incorrect null return mention (method is @nonnull and throws exception on no match) - Fix InvalidTreatTypeDynamicMetapathException to register the evaluationStack parameter by calling registerEvaluationContext() - Add registerEvaluationContext(Deque) method to MetapathException for registering evaluation stack directly - Fix IContainerModelGrouped Javadoc to correctly describe Collection return types instead of "ordered mapping" - Fix validation/package-info.java to link to IConstraint type instead of package (avoids doclint warnings) - Add Objects.requireNonNull in ExceptionUtils.wrap() and have wrapAndThrow() delegate to wrap() to avoid duplication - Fix flexmark/impl/package-info.java Javadoc formatting for SuppressPTagExtension
1 parent e173c0c commit a7b2caa

File tree

7 files changed

+32
-14
lines changed

7 files changed

+32
-14
lines changed

core/src/main/java/gov/nist/secauto/metaschema/core/datatype/markup/flexmark/impl/package-info.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@
4141
* <ul>
4242
* <li>{@link HtmlCodeRenderExtension} - Custom rendering for inline
4343
* {@code <code>} elements to properly handle special characters</li>
44-
* <li>{@link SuppressPTagExtension} - Suppresses {@code
45-
*
46-
<p>
47-
* } paragraph tags in single-line markup content</li>
44+
* <li>{@link SuppressPTagExtension} - Suppresses paragraph tags in single-line markup content</li>
4845
* <li>{@link FixedEmphasisDelimiterProcessor} - Fixed implementation of
4946
* emphasis delimiter processing to handle edge cases in Markdown emphasis
5047
* parsing</li>

core/src/main/java/gov/nist/secauto/metaschema/core/metapath/InvalidTreatTypeDynamicMetapathException.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public InvalidTreatTypeDynamicMetapathException(
3434
@NonNull Deque<IExpression> evaluationStack,
3535
@Nullable String message) {
3636
super(TREAT_DOES_NOT_MATCH_TYPE, message);
37+
registerEvaluationContext(evaluationStack);
3738
}
3839

3940
/**

core/src/main/java/gov/nist/secauto/metaschema/core/metapath/MetapathException.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,22 @@ public MetapathException registerEvaluationContext(@NonNull DynamicContext dynam
102102
return this;
103103
}
104104

105+
/**
106+
* Registers the evaluation context from the provided evaluation stack.
107+
* <p>
108+
* A snapshot of the stack is captured if not already set.
109+
*
110+
* @param stack
111+
* the evaluation stack recording the expressions being evaluated
112+
* @return this exception instance for chaining
113+
*/
114+
public MetapathException registerEvaluationContext(@NonNull Deque<? extends IExpression> stack) {
115+
if (evaluationStack == null) {
116+
evaluationStack = new ArrayDeque<>(stack);
117+
}
118+
return this;
119+
}
120+
105121
/**
106122
* Registers the evaluation context from the provided metapath expression.
107123
* <p>

core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/IFunctionResolver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
public interface IFunctionResolver {
1818
/**
1919
* Retrieve the function with the provided name that supports the signature of
20-
* the provided methods, if such a function exists.
20+
* the provided methods.
2121
*
2222
* @param name
2323
* the name of a group of functions
2424
* @param arity
2525
* the count of arguments for use in determining an argument signature
2626
* match
27-
* @return the matching function or {@code null} if no match exists
27+
* @return the matching function
2828
* @throws StaticMetapathException
2929
* with the code {@link StaticMetapathException#NO_FUNCTION_MATCH} if
3030
* a matching function was not found

core/src/main/java/gov/nist/secauto/metaschema/core/model/IContainerModelGrouped.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ default Collection<? extends INamedModelInstanceGrouped> getModelInstances() {
3131
/**
3232
* Get all named model instances within the container.
3333
*
34-
* @return an ordered mapping of use name to model instance
34+
* @return the named model instances in this container
3535
*/
3636
@Override
3737
@NonNull
@@ -53,7 +53,7 @@ default Collection<? extends INamedModelInstanceGrouped> getModelInstances() {
5353
/**
5454
* Get all field instances within the container.
5555
*
56-
* @return a mapping of use name to field instance
56+
* @return the field instances in this container
5757
*/
5858
@Override
5959
@NonNull
@@ -75,7 +75,7 @@ default Collection<? extends INamedModelInstanceGrouped> getModelInstances() {
7575
/**
7676
* Get all assembly instances within the container.
7777
*
78-
* @return a mapping of use name to assembly instance
78+
* @return the assembly instances in this container
7979
*/
8080
@Override
8181
@NonNull

core/src/main/java/gov/nist/secauto/metaschema/core/model/validation/package-info.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
* <h2>Usage Context</h2>
2727
* <p>
2828
* This validation framework differs from constraint validation
29-
* ({@link gov.nist.secauto.metaschema.core.model.constraint}) in that it:
29+
* ({@link gov.nist.secauto.metaschema.core.model.constraint.IConstraint}) in
30+
* that it:
3031
* <ul>
3132
* <li>Validates against schema documents (XSD/JSON Schema) rather than
3233
* constraint rules</li>
@@ -39,9 +40,10 @@
3940
* <p>
4041
* For constraint-based validation (e.g., allowed values, uniqueness,
4142
* cardinality), use the
42-
* {@link gov.nist.secauto.metaschema.core.model.constraint} package instead.
43+
* {@link gov.nist.secauto.metaschema.core.model.constraint.IConstraint}
44+
* instead.
4345
*
44-
* @see gov.nist.secauto.metaschema.core.model.constraint
46+
* @see gov.nist.secauto.metaschema.core.model.constraint.IConstraint
4547
*/
4648

4749
package gov.nist.secauto.metaschema.core.model.validation;

core/src/main/java/gov/nist/secauto/metaschema/core/util/ExceptionUtils.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
package gov.nist.secauto.metaschema.core.util;
77

8+
import java.util.Objects;
9+
810
import edu.umd.cs.findbugs.annotations.NonNull;
911

1012
/**
@@ -24,7 +26,7 @@ public final class ExceptionUtils {
2426
*/
2527
@NonNull
2628
public static WrappedException wrap(@NonNull Throwable ex) {
27-
return new WrappedException(ex);
29+
return new WrappedException(Objects.requireNonNull(ex, "ex"));
2830
}
2931

3032
/**
@@ -39,7 +41,7 @@ public static WrappedException wrap(@NonNull Throwable ex) {
3941
*/
4042
@NonNull
4143
public static WrappedException wrapAndThrow(@NonNull Throwable ex) {
42-
return new WrappedException(ex);
44+
return wrap(ex);
4345
}
4446

4547
/**

0 commit comments

Comments
 (0)