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
  • Loading branch information
gsmet authored Jan 14, 2025
2 parents 43f9421 + b8e5816 commit 546d44d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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)
Expand All @@ -12,6 +15,12 @@ public interface TestMappingBuildTimeRunTime {
*/
String value();

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

/**
* A nested Group.
*/
Expand Down

0 comments on commit 546d44d

Please sign in to comment.