Skip to content

Commit

Permalink
Merge pull request #45548 from radcortez/override-build-defaults-in-r…
Browse files Browse the repository at this point in the history
…untime

Avoid NPE when recording ConfigValue
gsmet authored Jan 14, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 43f9421 + b8e5816 commit 546d44d
Showing 3 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -638,22 +638,22 @@ ReadResult run() {
unknownBuildProperties.remove(property);
ConfigValue value = config.getConfigValue(property);
if (value.getRawValue() != null) {
allBuildTimeValues.put(value.getNameProfiled(), value);
allBuildTimeValues.put(value.getNameProfiled(), value.noProblems().withValue(value.getRawValue()));
}
}
if (buildTimeRunTimeNames.contains(name)) {
unknownBuildProperties.remove(property);
ConfigValue value = config.getConfigValue(property);
if (value.getRawValue() != null) {
allBuildTimeValues.put(value.getNameProfiled(), value);
buildTimeRunTimeValues.put(value.getNameProfiled(), value);
allBuildTimeValues.put(value.getNameProfiled(), value.noProblems().withValue(value.getRawValue()));
buildTimeRunTimeValues.put(value.getNameProfiled(), value.noProblems().withValue(value.getRawValue()));
}
}
if (runTimeNames.contains(name)) {
unknownBuildProperties.remove(property);
ConfigValue value = runtimeConfig.getConfigValue(property);
if (value.getRawValue() != null) {
runTimeValues.put(value.getNameProfiled(), value);
runTimeValues.put(value.getNameProfiled(), value.noProblems().withValue(value.getRawValue()));
}
}
}
Original file line number Diff line number Diff line change
@@ -12,17 +12,13 @@
import io.quarkus.extest.runtime.config.TestMappingBuildTimeRunTime;
import io.quarkus.extest.runtime.config.TestMappingRunTime;
import io.quarkus.test.QuarkusUnitTest;
import io.smallrye.config.SmallRyeConfig;

public class ConfigMappingTest {
@RegisterExtension
static final QuarkusUnitTest TEST = new QuarkusUnitTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
.addAsResource("application.properties"));

@Inject
SmallRyeConfig config;

@Inject
TestMappingBuildTimeRunTime mappingBuildTimeRunTime;
@Inject
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package io.quarkus.extest.runtime.config;

import java.util.Optional;

import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithDefault;

@ConfigMapping(prefix = "quarkus.mapping.btrt")
@ConfigRoot(phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED)
@@ -12,6 +15,12 @@ public interface TestMappingBuildTimeRunTime {
*/
String value();

/**
* A expression value
*/
@WithDefault("${quarkus.mapping.btrt.expression.value}")
Optional<String> expression();

/**
* A nested Group.
*/

0 comments on commit 546d44d

Please sign in to comment.