Pankraz76 commented on code in PR #2373:
URL: https://github.com/apache/maven/pull/2373#discussion_r2131987792
##########
impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelInterpolator.java:
##########
@@ -220,43 +198,35 @@ String projectProperty(Model model, Path projectDir,
String subExpr, boolean pre
if (value != null) {
return value.toString();
}
- } catch (Exception e) {
- // addFeedback("Failed to extract \'" + expression + "\'
from: " + root, e);
+ } catch (IntrospectionException ignored) {
}
} else if (prefixed && subExpr.equals("baseUri")) {
return projectDir.toAbsolutePath().toUri().toASCIIString();
} else if (prefixed && subExpr.startsWith("baseUri.")) {
try {
- Object value = ReflectionValueExtractor.evaluate(
- subExpr, projectDir.toAbsolutePath().toUri(),
true);
+ Object value = ReflectionValueExtractor.evaluate(subExpr,
projectDir.toAbsolutePath().toUri(), true);
if (value != null) {
return value.toString();
}
- } catch (Exception e) {
- // addFeedback("Failed to extract \'" + expression + "\'
from: " + root, e);
+ } catch (IntrospectionException ignored) {
}
} else if (prefixed && subExpr.equals("rootDirectory")) {
return rootLocator.findMandatoryRoot(projectDir).toString();
} else if (prefixed && subExpr.startsWith("rootDirectory.")) {
try {
- Object value =
- ReflectionValueExtractor.evaluate(subExpr,
rootLocator.findMandatoryRoot(projectDir), true);
+ Object value = ReflectionValueExtractor.evaluate(subExpr,
rootLocator.findMandatoryRoot(projectDir), true);
if (value != null) {
return value.toString();
}
- } catch (Exception e) {
- // addFeedback("Failed to extract \'" + expression + "\'
from: " + root, e);
+ } catch (IntrospectionException ignored) {
}
}
}
try {
Object value = ReflectionValueExtractor.evaluate(subExpr, model,
false);
- if (value != null) {
- return value.toString();
- }
- } catch (Exception e) {
- // addFeedback("Failed to extract \'" + expression + "\' from: " +
root, e);
+ return value != null ? value.toString() : null;
Review Comment:
why no .kt or at least optionals going the functional way of live. feels
like 50% of coding is null checks. which is done `.?` so simply in `kotlin`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]