konveyor / konveyor/rulesets

Ensure System property is properly parsed when in Lambda expressions

Open
#102 3 comments 0 reactions 0 assignees View on GitHub
kind/bug priority/critical-urgent triage/accepted
Dominant language
Java
Stars
6
Forks
49
PR merge metrics
No merged PRs in 30d

Description

Please ensure all the scenarios below are covered in tests, especially the lambda expression (Example 5).

```java
// Example 1
private static SpringApplicationBuilder configureApplication(SpringApplicationBuilder builder) {
System.setProperty("org.jboss.logging.provider", "slf4j");
return builder.sources(SpringInitializer.class);
}

// Example 2
List profiles = new ArrayList<>();
if (Boolean.parseBoolean(System.getProperty("profile.eventScheduler", Boolean.toString(true)))) {
profiles.add("EventScheduler");
}
if (Boolean.parseBoolean(System.getProperty("profile.taskScheduler", Boolean.toString(true)))) {
profiles.add("TaskScheduler");
}

// Example 3
private String getSuffix() {
String suffix = "";
String instance = System.getenv("INSTANCE_ID");
if (StringUtils.isNotEmpty(instance)) {
String[] split = StringUtils.split(instance, "-");
if (split.length > 0) {
suffix = "-" + split[0];
}
}
return suffix;
}

// Example 4
static {
String port;
if ((port = System.getProperty("test.port")) != null) {
TEST_PORT = Integer.parseInt(port);
}
}

// Example 5
HttpClient httpClient = HttpClient.create()
.proxy(proxy -> proxy
.type(ProxyProvider.Proxy.HTTP)
.host(System.getProperty("https.proxyHost"))
.port(Integer.valueOf(System.getProperty("https.proxyPort")))
.nonProxyHosts(createNonProxyPattern(System.getProperty("http.nonProxyHosts")))
);
```

Contributor guide

Open the contributing guide

Research direction

No file or test path is provided. Start by locating the rule that handles Java System property access and its existing tests; use the five examples, especially the lambda in Example 5, as inputs. Done means all listed forms are covered and System property calls are parsed consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.