Skip to content

Commit

Permalink
Making the correct Parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Sangyoon21 authored Jul 13, 2024
1 parent 18f03d7 commit 65e1059
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions TestResultSummaryService/parsers/Parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Parser {
const javaVersionRegex =
/=JAVA VERSION OUTPUT BEGIN=[\r\n]+([\s\S]*?)[\r\n]+.*=JAVA VERSION OUTPUT END=/;
const javaBuildDateRegex =
/\s([0-9]{4})-?(0[1-9]|1[012])-?(0[1-9]|[12][0-9]|3[01])/;
/Eclipse OpenJ9 VM \(build [^,]+, JRE [^\s]+ [^\s]+ [^\s]+ (\d{8})_/;
const sdkResourceRegex = /.*?SDK_RESOURCE\=(.*)[\r\n]+/;
let curRegexResult = null;
let javaVersion, jdkDate, sdkResource;
Expand All @@ -26,8 +26,11 @@ class Parser {
}
curRegexResult = null;
// parse jdk date from javaVersion
if ((curRegexResult = javaBuildDateRegex.exec(javaVersion)) !== null) {
jdkDate = curRegexResult[0];
if ((curRegexResult = javaBuildDateRegex.exec(output)) !== null) {
jdkDate = curRegexResult[1].trim(); // Ensure the date is trimmed
// Convert jdkDate from YYYYMMDD to YYYY-MM-DD
jdkDate = `${jdkDate.substring(0, 4)}-${jdkDate.substring(4, 6)}-${jdkDate.substring(6, 8)}`;
console.log('Parsed jdkDate:', jdkDate); // Log statement to show jdkDate
}
return { javaVersion, jdkDate, sdkResource };
}
Expand Down Expand Up @@ -102,7 +105,7 @@ class Parser {
let versions = {};

const releaseInfoRegex =
/=RELEASE INFO BEGIN=\n[\s\S]*?SOURCE="(.*)"[\s\S]*?=RELEASE INFO END=/;
/=RELEASE INFO BEGIN=\n[\s\S]*?SOURCE="(.*)"[\r\n]+.*=RELEASE INFO END=/;
const generalOpenjdkShaRegex = /git:(.*)/;
const openjdkShaRegex = /OpenJDK:\s?([^\s\:]*)/;
const j9AndOmrShaRegex = /OpenJ9:\s?([^\s\:]*).*OMR:\s?([^\s\:]*)/;
Expand Down

0 comments on commit 65e1059

Please sign in to comment.