@@ -80,9 +80,9 @@ public class RepositoryCreator {
8080 private final String otherUniqueName ;
8181
8282 public interface XmlContext {
83- public void write (Document primary , OutputStream primaryStream ) throws IOException ;
83+ void write (Document primary , OutputStream primaryStream ) throws IOException ;
8484
85- public Document createDocument ();
85+ Document createDocument ();
8686 }
8787
8888 public static class DefaultXmlContext implements XmlContext {
@@ -136,7 +136,7 @@ public void write(final Document doc, final OutputStream outputStream) throws IO
136136 }
137137
138138 public interface Context {
139- public void addPackage (FileInformation fileInformation , RpmInformation rpmInformation , Map <HashAlgorithm , String > checksums , HashAlgorithm idType );
139+ void addPackage (FileInformation fileInformation , RpmInformation rpmInformation , Map <HashAlgorithm , String > checksums , HashAlgorithm idType );
140140 }
141141
142142 public static class FileInformation {
@@ -346,9 +346,7 @@ private void addDependencies(final Element fmt, final String elementName, final
346346 final RpmVersion version = RpmVersion .valueOf (dep .getVersion ());
347347 entry .setAttribute ("epoch" , "" + version .getEpoch ().orElse (0 ));
348348 entry .setAttribute ("ver" , version .getVersion ());
349- if (version .getRelease ().isPresent ()) {
350- entry .setAttribute ("rel" , version .getRelease ().get ());
351- }
349+ version .getRelease ().ifPresent (string -> entry .setAttribute ("rel" , string ));
352350 }
353351
354352 final boolean eq = flags .contains (RpmDependencyFlags .EQUAL );
@@ -474,8 +472,8 @@ private RepositoryCreator(final SpoolOutTarget target, final XmlContext xml, fin
474472 final String dirFilter = System .getProperty ("drone.rpm.yum.primaryDirs" , "bin/,^/etc/" );
475473 final String fileFilter = System .getProperty ("drone.rpm.yum.primaryFiles" , dirFilter );
476474
477- this .primaryFiles = Arrays .stream (fileFilter .split ("," )).map (re -> Pattern . compile ( re ) ).collect (Collectors .toList ());
478- this .primaryDirs = Arrays .stream (dirFilter .split ("," )).map (re -> Pattern . compile ( re ) ).collect (Collectors .toList ());
475+ this .primaryFiles = Arrays .stream (fileFilter .split ("," )).map (Pattern :: compile ).collect (Collectors .toList ());
476+ this .primaryDirs = Arrays .stream (dirFilter .split ("," )).map (Pattern :: compile ).collect (Collectors .toList ());
479477
480478 this .primaryUniqueName = UUID .randomUUID ().toString ().replace ("-" , "" );
481479 this .filelistsUniqueName = UUID .randomUUID ().toString ().replace ("-" , "" );
@@ -488,7 +486,7 @@ private RepositoryCreator(final SpoolOutTarget target, final XmlContext xml, fin
488486 this .primaryStreamBuilder .addDigest (MD_NAME );
489487
490488 this .primaryStreamBuilder .addOutput (String .format ("repodata/%s-primary.xml" , this .primaryUniqueName ), "application/xml" );
491- this .primaryStreamBuilder .addOutput (String .format ("repodata/%s-primary.xml.gz" , this .primaryUniqueName ), "application/x-gzip" , output -> new GZIPOutputStream ( output ) );
489+ this .primaryStreamBuilder .addOutput (String .format ("repodata/%s-primary.xml.gz" , this .primaryUniqueName ), "application/x-gzip" , GZIPOutputStream :: new );
492490
493491 // filelists
494492
@@ -497,7 +495,7 @@ private RepositoryCreator(final SpoolOutTarget target, final XmlContext xml, fin
497495 this .filelistsStreamBuilder .addDigest (MD_NAME );
498496
499497 this .filelistsStreamBuilder .addOutput (String .format ("repodata/%s-filelists.xml" , this .filelistsUniqueName ), "application/xml" );
500- this .filelistsStreamBuilder .addOutput (String .format ("repodata/%s-filelists.xml.gz" , this .filelistsUniqueName ), "application/x-gzip" , output -> new GZIPOutputStream ( output ) );
498+ this .filelistsStreamBuilder .addOutput (String .format ("repodata/%s-filelists.xml.gz" , this .filelistsUniqueName ), "application/x-gzip" , GZIPOutputStream :: new );
501499
502500 // other
503501
@@ -506,7 +504,7 @@ private RepositoryCreator(final SpoolOutTarget target, final XmlContext xml, fin
506504 this .otherStreamBuilder .addDigest (MD_NAME );
507505
508506 this .otherStreamBuilder .addOutput (String .format ("repodata/%s-other.xml" , this .otherUniqueName ), "application/xml" );
509- this .otherStreamBuilder .addOutput (String .format ("repodata/%s-other.xml.gz" , this .otherUniqueName ), "application/x-gzip" , output -> new GZIPOutputStream ( output ) );
507+ this .otherStreamBuilder .addOutput (String .format ("repodata/%s-other.xml.gz" , this .otherUniqueName ), "application/x-gzip" , GZIPOutputStream :: new );
510508
511509 // md
512510
@@ -530,19 +528,13 @@ private boolean matches(final String pathName, final List<Pattern> filterList) {
530528 public void process (final IOConsumer <Context > consumer ) throws IOException {
531529 final long now = System .currentTimeMillis ();
532530
533- this .primaryStreamBuilder .open (primaryStream -> {
534- this .filelistsStreamBuilder .open (filelistsStream -> {
535- this .otherStreamBuilder .open (otherStream -> {
536- final ContextImpl ctx = makeContext (primaryStream , filelistsStream , otherStream );
537- consumer .accept (ctx );
538- ctx .close ();
539- });
540- });
541- });
542-
543- this .mdStreamBuilder .open (stream -> {
544- writeRepoMd (stream , now );
545- });
531+ this .primaryStreamBuilder .open (primaryStream -> this .filelistsStreamBuilder .open (filelistsStream -> this .otherStreamBuilder .open (otherStream -> {
532+ final ContextImpl ctx = makeContext (primaryStream , filelistsStream , otherStream );
533+ consumer .accept (ctx );
534+ ctx .close ();
535+ })));
536+
537+ this .mdStreamBuilder .open (stream -> writeRepoMd (stream , now ));
546538
547539 }
548540
0 commit comments