File tree Expand file tree Collapse file tree
maven_plugin/src/main/java/io/github/chains_project/maven_lockfile Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ permissions:
88 contents : read
99jobs :
1010 maven-quality :
11- runs-on : windows -latest
11+ runs-on : ubuntu -latest
1212
1313 steps :
1414 - name : Harden Runner
Original file line number Diff line number Diff line change 1212import java .nio .file .Path ;
1313import java .util .*;
1414import java .util .stream .Collectors ;
15+ import java .util .stream .StreamSupport ;
1516import org .apache .maven .artifact .Artifact ;
1617import org .apache .maven .artifact .DefaultArtifact ;
1718import org .apache .maven .artifact .handler .DefaultArtifactHandler ;
@@ -517,11 +518,16 @@ private static Pom constructRecursivePom(
517518
518519 String relativePath = isExternalPom
519520 ? null
520- : initialProject
521- .getBasedir ()
522- .toPath ()
523- .relativize (project .getFile ().toPath ())
524- .toString ();
521+ : StreamSupport .stream (
522+ initialProject
523+ .getBasedir ()
524+ .toPath ()
525+ .relativize (project .getFile ().toPath ())
526+ .spliterator (),
527+ false )
528+ .map (Path ::toString )
529+ .collect (Collectors .joining ("/" ));
530+
525531 String checksum ;
526532 ResolvedUrl resolved = null ;
527533 RepositoryId repoId = null ;
Original file line number Diff line number Diff line change 22
33import com .google .common .io .BaseEncoding ;
44import io .github .chains_project .maven_lockfile .reporting .PluginLogManager ;
5+ import java .nio .charset .StandardCharsets ;
56import java .nio .file .Files ;
67import java .nio .file .Path ;
78import java .security .MessageDigest ;
89import java .util .Collection ;
910import java .util .Locale ;
1011import org .apache .maven .artifact .Artifact ;
11- import java .nio .charset .StandardCharsets ;
1212
1313public abstract class AbstractChecksumCalculator {
1414
@@ -51,12 +51,12 @@ public String calculatePomChecksum(Path path) {
5151 try {
5252 MessageDigest messageDigest = MessageDigest .getInstance (checksumAlgorithm );
5353
54- //normalize line endings to prevent false-positives on checksum mismatch
54+ // normalize line endings to prevent false-positives on checksum mismatch
5555 byte [] normalizedBytes = Files .readString (path )
56- .replace ("\r \n " , "\n " )
57- .replace ("\r " , "\n " )
58- .getBytes (StandardCharsets .UTF_8 );
59-
56+ .replace ("\r \n " , "\n " )
57+ .replace ("\r " , "\n " )
58+ .getBytes (StandardCharsets .UTF_8 );
59+
6060 byte [] artifactHash = messageDigest .digest (normalizedBytes );
6161 BaseEncoding baseEncoding = BaseEncoding .base16 ();
6262 return baseEncoding .encode (artifactHash ).toLowerCase (Locale .ROOT );
You can’t perform that action at this time.
0 commit comments