3737
3838import org .apache .cloudstack .utils .security .ParserUtils ;
3939import org .apache .commons .collections .CollectionUtils ;
40+ import org .apache .commons .lang .ObjectUtils ;
4041import org .apache .commons .lang .math .NumberUtils ;
4142import org .apache .commons .lang3 .StringUtils ;
4243import org .apache .logging .log4j .Logger ;
@@ -119,8 +120,7 @@ protected OVFPropertyTO createOVFPropertyFromNode(Node node, int index, String c
119120 boolean password = StringUtils .isNotBlank (passStr ) && passStr .equalsIgnoreCase ("true" );
120121 String label = ovfParser .getChildNodeValue (node , "Label" );
121122 String description = ovfParser .getChildNodeValue (node , "Description" );
122- logger .debug ("Creating OVF property index " + index + (category == null ? "" : " for category " + category )
123- + " with key = " + key );
123+ logger .debug ("Creating OVF property index {} with key = {}" , ObjectUtils .defaultIfNull (index + " for category" + category , index ), key );
124124 return new OVFPropertyTO (key , type , value , qualifiers , userConfigurable ,
125125 label , description , password , index , category );
126126 }
@@ -250,7 +250,7 @@ private List<DatadiskTO> matchHardwareItemsToDiskAndFilesInformation(List<OVFVir
250250 int diskNumber = 0 ;
251251 for (OVFVirtualHardwareItemTO diskItem : diskHardwareItems ) {
252252 if (StringUtils .isBlank (diskItem .getHostResource ())) {
253- logger .error ("Missing disk information for hardware item {} {}" , () -> diskItem .getElementName (), () -> diskItem .getInstanceId ());
253+ logger .error ("Missing disk information for hardware item {} {}" , diskItem .getElementName (), diskItem .getInstanceId ());
254254 continue ;
255255 }
256256 String diskId = extractDiskIdFromDiskHostResource (diskItem .getHostResource ());
@@ -334,7 +334,7 @@ protected List<OVFDisk> extractDisksFromOvfDocumentTree(Document doc) {
334334 od ._controller = getControllerType (items , od ._diskId );
335335 vd .add (od );
336336 }
337- logger .trace ("found {} disk definitions" , () -> vd .size ());
337+ logger .trace ("Found {} disk definitions" , vd .size ());
338338 return vd ;
339339 }
340340
@@ -364,7 +364,7 @@ protected List<OVFFile> extractFilesFromOvfDocumentTree(File ovfFile, Document d
364364 vf .add (of );
365365 }
366366 }
367- logger .trace ("found %d file definitions in {}" , ()-> vf .size (), () -> ovfFile .getPath ());
367+ logger .trace ("Found {} file definitions in {}" , vf .size (), ovfFile .getPath ());
368368 return vf ;
369369 }
370370
@@ -502,7 +502,7 @@ private void writeDocumentToFile(String newOvfFilePath, Document doc) {
502502 outfile .write (writer .toString ());
503503 outfile .close ();
504504 } catch (IOException | TransformerException e ) {
505- logger .info ("Unexpected exception caught while rewriting OVF:" + e .getMessage (), e );
505+ logger .info ("Unexpected exception caught while rewriting OVF:{}" , e .getMessage (), e );
506506 throw new CloudRuntimeException (e );
507507 }
508508 }
@@ -518,7 +518,7 @@ OVFFile getFileDefinitionFromDiskDefinition(String fileRef, List<OVFFile> files)
518518
519519 public List <OVFNetworkTO > getNetPrerequisitesFromDocument (Document doc ) throws InternalErrorException {
520520 if (doc == null ) {
521- logger .trace ("no document to parse; returning no prerequisite networks" );
521+ logger .trace ("No document to parse; returning no prerequisite networks" );
522522 return Collections .emptyList ();
523523 }
524524
@@ -534,15 +534,15 @@ public List<OVFNetworkTO> getNetPrerequisitesFromDocument(Document doc) throws I
534534 private void matchNicsToNets (Map <String , OVFNetworkTO > nets , Node systemElement ) {
535535 final DocumentTraversal traversal = (DocumentTraversal ) systemElement ;
536536 final NodeIterator iterator = traversal .createNodeIterator (systemElement , NodeFilter .SHOW_ELEMENT , null , true );
537- logger .trace ("starting out with {} network-prerequisites, parsing hardware" , () -> nets .size ());
537+ logger .trace ("Starting out with {} network-prerequisites, parsing hardware" , nets .size ());
538538 int nicCount = 0 ;
539539 for (Node n = iterator .nextNode (); n != null ; n = iterator .nextNode ()) {
540540 final Element e = (Element ) n ;
541541 if ("rasd:Connection" .equals (e .getTagName ())) {
542542 nicCount ++;
543543 String name = e .getTextContent (); // should be in our nets
544544 if (nets .get (name ) == null ) {
545- logger .info ("found a nic definition without a network definition byname {}, adding it to the list." , name );
545+ logger .info ("Found a nic definition without a network definition byname {}, adding it to the list." , name );
546546 nets .put (name , new OVFNetworkTO ());
547547 }
548548 OVFNetworkTO thisNet = nets .get (name );
@@ -551,7 +551,7 @@ private void matchNicsToNets(Map<String, OVFNetworkTO> nets, Node systemElement)
551551 }
552552 }
553553 }
554- logger .trace ("ending up with %d network-prerequisites, parsed {} nics" , () -> nets .size (), () -> nicCount );
554+ logger .trace ("Ending up with {} network-prerequisites, parsed {} nics" , nets .size (), nicCount );
555555 }
556556
557557 /**
@@ -618,7 +618,7 @@ private Map<String, OVFNetworkTO> getNetworksFromDocumentTree(Document doc) {
618618
619619 nets .put (networkName ,network );
620620 }
621- logger .trace ("found {} networks in template" , () -> nets .size ());
621+ logger .trace ("Found {} networks in template" , nets .size ());
622622 return nets ;
623623 }
624624
0 commit comments