File tree Expand file tree Collapse file tree
ohsome-planet-cli/src/main/java/org/heigit/ohsome/planet/cmd Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818import java .util .concurrent .Callable ;
1919
2020import static com .google .common .io .RecursiveDeleteOption .ALLOW_INSECURE ;
21+ import static java .util .function .Predicate .not ;
2122
2223@ CommandLine .Command (name = "contributions" ,
2324 mixinStandardHelpOptions = true ,
@@ -123,6 +124,7 @@ public Integer call() throws Exception {
123124 }
124125
125126 var httpServer = Optional .ofNullable (System .getProperty (OHSOME_PLANET_METRICS_PORT , System .getenv (OHSOME_PLANET_METRICS_PORT )))
127+ .filter (not (String ::isBlank ))
126128 .map (Integer ::parseInt )
127129 .map (port -> HTTPServer .builder ().port (port ));
128130 try (var ignored = (httpServer .isPresent ()) ? httpServer .get ().buildAndStart () : null ;
Original file line number Diff line number Diff line change 1111
1212import java .nio .file .Path ;
1313import java .security .InvalidParameterException ;
14+ import java .util .Optional ;
1415import java .util .concurrent .Callable ;
1516
17+ import static java .util .function .Predicate .not ;
18+
1619@ Command (name = "replications" ,
1720 versionProvider = ManifestVersionProvider .class ,
1821 mixinStandardHelpOptions = true ,
@@ -141,9 +144,11 @@ public Integer call() throws Exception {
141144 throw new InvalidParameterException ("Either just-contributions or just-changesets can be specified" );
142145 }
143146
144- var metricsPort = System .getProperty (OHSOME_PLANET_METRICS_PORT , System .getenv (OHSOME_PLANET_METRICS_PORT ));
145- try (var ignored = (metricsPort != null ) ?
146- HTTPServer .builder ().port (Integer .parseInt (metricsPort )).buildAndStart () : null ) {
147+ var httpServer = Optional .ofNullable (System .getProperty (OHSOME_PLANET_METRICS_PORT , System .getenv (OHSOME_PLANET_METRICS_PORT )))
148+ .filter (not (String ::isBlank ))
149+ .map (Integer ::parseInt )
150+ .map (port -> HTTPServer .builder ().port (port ));
151+ try (var ignored = (httpServer .isPresent ()) ? httpServer .get ().buildAndStart () : null ) {
147152
148153 JvmMetrics .builder ().register ();
149154
You can’t perform that action at this time.
0 commit comments