@@ -152,7 +152,7 @@ public List<OVFPropertyTO> getConfigurableOVFPropertiesFromDocument(Document doc
152152 if (child .getNodeName ().equalsIgnoreCase ("Category" ) ||
153153 child .getNodeName ().endsWith (":Category" )) {
154154 lastCategoryFound = child .getTextContent ();
155- logger .info ("Category found " + lastCategoryFound );
155+ logger .info ("Category found {}" , lastCategoryFound );
156156 } else if (child .getNodeName ().equalsIgnoreCase ("Property" ) ||
157157 child .getNodeName ().endsWith (":Property" )) {
158158 OVFPropertyTO prop = createOVFPropertyFromNode (child , propertyIndex , lastCategoryFound );
@@ -250,13 +250,13 @@ 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 ());
257257 OVFDisk diskDefinition = getDiskDefinitionFromDiskId (diskId , disks );
258258 if (diskDefinition == null ) {
259- logger .error ("Missing disk definition for disk ID " + diskId );
259+ logger .error ("Missing disk definition for disk ID {}" , diskId );
260260 }
261261 OVFFile fileDefinition = getFileDefinitionFromDiskDefinition (diskDefinition ._fileRef , files );
262262 DatadiskTO datadiskTO = generateDiskTO (fileDefinition , diskDefinition , ovfParentPath , diskNumber , diskItem );
@@ -278,7 +278,7 @@ private DatadiskTO generateDiskTO(OVFFile file, OVFDisk disk, String ovfParentPa
278278 if (StringUtils .isNotBlank (path )) {
279279 File f = new File (path );
280280 if (!f .exists () || f .isDirectory ()) {
281- logger .error ("One of the attached disk or iso does not exists " + path );
281+ logger .error ("One of the attached disk or iso does not exists {}" , path );
282282 throw new InternalErrorException ("One of the attached disk or iso as stated on OVF does not exists " + path );
283283 }
284284 }
@@ -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 %d file definitions in {}" , ()-> vf .size (), () -> ovfFile .getPath ());
368368 return vf ;
369369 }
370370
@@ -518,9 +518,7 @@ OVFFile getFileDefinitionFromDiskDefinition(String fileRef, List<OVFFile> files)
518518
519519 public List <OVFNetworkTO > getNetPrerequisitesFromDocument (Document doc ) throws InternalErrorException {
520520 if (doc == null ) {
521- if (logger .isTraceEnabled ()) {
522- logger .trace ("no document to parse; returning no prerequisite networks" );
523- }
521+ logger .trace ("no document to parse; returning no prerequisite networks" );
524522 return Collections .emptyList ();
525523 }
526524
@@ -536,17 +534,15 @@ public List<OVFNetworkTO> getNetPrerequisitesFromDocument(Document doc) throws I
536534 private void matchNicsToNets (Map <String , OVFNetworkTO > nets , Node systemElement ) {
537535 final DocumentTraversal traversal = (DocumentTraversal ) systemElement ;
538536 final NodeIterator iterator = traversal .createNodeIterator (systemElement , NodeFilter .SHOW_ELEMENT , null , true );
539- logger .trace ("starting out with {} network-prerequisites, parsing hardware" ,nets .size ());
537+ logger .trace ("starting out with {} network-prerequisites, parsing hardware" , () -> nets .size ());
540538 int nicCount = 0 ;
541539 for (Node n = iterator .nextNode (); n != null ; n = iterator .nextNode ()) {
542540 final Element e = (Element ) n ;
543541 if ("rasd:Connection" .equals (e .getTagName ())) {
544542 nicCount ++;
545543 String name = e .getTextContent (); // should be in our nets
546544 if (nets .get (name ) == null ) {
547- if (logger .isInfoEnabled ()) {
548- logger .info (String .format ("found a nic definition without a network definition byname %s, adding it to the list." , name ));
549- }
545+ logger .info ("found a nic definition without a network definition byname {}, adding it to the list." , name );
550546 nets .put (name , new OVFNetworkTO ());
551547 }
552548 OVFNetworkTO thisNet = nets .get (name );
@@ -555,7 +551,7 @@ private void matchNicsToNets(Map<String, OVFNetworkTO> nets, Node systemElement)
555551 }
556552 }
557553 }
558- logger .trace ("ending up with %d network-prerequisites, parsed {} nics" , nets .size (), nicCount );
554+ logger .trace ("ending up with %d network-prerequisites, parsed {} nics" , () -> nets .size (), () -> nicCount );
559555 }
560556
561557 /**
@@ -577,7 +573,7 @@ private void fillNicPrerequisites(OVFNetworkTO nic, Node parentNode) {
577573 int addressOnParent = Integer .parseInt (addressOnParentStr );
578574 nic .setAddressOnParent (addressOnParent );
579575 } catch (NumberFormatException e ) {
580- logger .warn ("Encountered element of type \" AddressOnParent\" , that could not be parse to an integer number: " + addressOnParentStr );
576+ logger .warn ("Encountered element of type \" AddressOnParent\" , that could not be parse to an integer number: {}" , addressOnParentStr );
581577 }
582578
583579 boolean automaticAllocation = StringUtils .isNotBlank (automaticAllocationStr ) && Boolean .parseBoolean (automaticAllocationStr );
@@ -589,7 +585,7 @@ private void fillNicPrerequisites(OVFNetworkTO nic, Node parentNode) {
589585 int instanceId = Integer .parseInt (instanceIdStr );
590586 nic .setInstanceID (instanceId );
591587 } catch (NumberFormatException e ) {
592- logger .warn ("Encountered element of type \" InstanceID\" , that could not be parse to an integer number: " + instanceIdStr );
588+ logger .warn ("Encountered element of type \" InstanceID\" , that could not be parse to an integer number: {}" , instanceIdStr );
593589 }
594590
595591 nic .setResourceSubType (resourceSubType );
@@ -622,7 +618,7 @@ private Map<String, OVFNetworkTO> getNetworksFromDocumentTree(Document doc) {
622618
623619 nets .put (networkName ,network );
624620 }
625- logger .trace ("found {} networks in template" , nets .size ());
621+ logger .trace ("found {} networks in template" , () -> nets .size ());
626622 return nets ;
627623 }
628624
@@ -761,7 +757,7 @@ private Long getLongValueFromString(String value) {
761757 try {
762758 return Long .parseLong (value );
763759 } catch (NumberFormatException e ) {
764- logger .debug ("Could not parse the value: " + value + " , ignoring it" );
760+ logger .debug ("Could not parse the value: {} , ignoring it" , value );
765761 }
766762 }
767763 return null ;
@@ -772,7 +768,7 @@ private Integer getIntValueFromString(String value) {
772768 try {
773769 return Integer .parseInt (value );
774770 } catch (NumberFormatException e ) {
775- logger .debug ("Could not parse the value: " + value + ", ignoring it" );
771+ logger .debug ("Could not parse the value: {} ignoring it" , value );
776772 }
777773 }
778774 return null ;
@@ -810,7 +806,7 @@ public List<OVFEulaSectionTO> getEulaSectionsFromDocument(Document doc) {
810806 try {
811807 compressedLicense = compressOVFEula (eulaLicense );
812808 } catch (IOException e ) {
813- logger .error ("Could not compress the license for info " + eulaInfo );
809+ logger .error ("Could not compress the license for info {}" , eulaInfo );
814810 continue ;
815811 }
816812 OVFEulaSectionTO eula = new OVFEulaSectionTO (eulaInfo , compressedLicense , eulaIndex );
0 commit comments