Skip to content

Commit

Permalink
Server env blank line issue fix (#310)
Browse files Browse the repository at this point in the history
* Fixing blank line issue

* Fixing blank line issue

Signed-off-by: Arun Venmany <[email protected]>

---------

Signed-off-by: Arun Venmany <[email protected]>
  • Loading branch information
arunvenmany-ibm authored Oct 11, 2024
1 parent e236035 commit 08ee52a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ public Map<String, PropertiesValidationResult> compute(String text, LibertyTextD
int lineNumber = 0;
try {
while ((line=br.readLine()) != null) {
PropertiesValidationResult validationResult = PropertiesValidationResult.validateServerProperty(line, openedDocument, lineNumber);
if (validationResult.hasErrors()) {
errors.put(line, validationResult);
//blank line is being ignored
if(!line.isBlank()) {
PropertiesValidationResult validationResult = PropertiesValidationResult.validateServerProperty(line, openedDocument, lineNumber);
if (validationResult.hasErrors()) {
errors.put(line, validationResult);
}
}
lineNumber++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void validateServerProperty() {

// check whitespace around equal sign (=)
if (LibertyConfigFileManager.isServerEnvFile(textDocumentItem)) {
if (property.endsWith(" ") || value.startsWith(" ")) {
if ((property != null && property.endsWith(" ")) || (value != null && value.startsWith(" "))) {
startChar = property.trim().length();
endChar = entry.getLineContent().length() - value.trim().length();
hasErrors = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void testServerEnv() throws Exception {
// Checking invalid whitespace before equal sign: WLP_DEBUG_REMOTE =n
createRange(4,16,18),
// Checking invalid whitespace after equal sign: WLP_LOGGING_MESSAGE_FORMAT= SIMPLE
createRange(5,26,28)
createRange(7,26,28)
);
checkDiagnosticsContainsMessages(
"The value `asdf` is not valid for the variable `WLP_LOGGING_CONSOLE_FORMAT`.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ WLP_LOGGING_CONSOLE_LOGLEVEL=iNfO
WLP_LOGGING_CONSOLE_SOURCE=messagE
WLP_DEBUG_ADDRESS=-2
WLP_DEBUG_REMOTE =n
# adding comment line and blank line to check whether its being ignored

WLP_LOGGING_MESSAGE_FORMAT= SIMPLE

0 comments on commit 08ee52a

Please sign in to comment.