@@ -119,8 +119,9 @@ protected static void setStaticAntProperties(Properties properties) {
119119		if  (properties  == null ) {
120120			immutableAntProperties  = new  Properties ();
121121			BuildDirector .p2Gathering  = false ;
122- 		} else 
122+ 		} else  { 
123123			immutableAntProperties  = properties ;
124+ 		}
124125		if  (getImmutableAntProperty (IBuildPropertiesConstants .PROPERTY_PACKAGER_MODE ) == null ) {
125126			immutableAntProperties .setProperty (IBuildPropertiesConstants .PROPERTY_PACKAGER_MODE , "false" ); //$NON-NLS-1$ 
126127		}
@@ -129,8 +130,9 @@ protected static void setStaticAntProperties(Properties properties) {
129130			immutableAntProperties .setProperty (IBuildPropertiesConstants .PROPERTY_PACKAGER_AS_NORMALIZER , "true" ); //$NON-NLS-1$ 
130131		}
131132
132- 		if  (getPropertyAsBoolean (IBuildPropertiesConstants .PROPERTY_P2_GATHERING ))
133+ 		if  (getPropertyAsBoolean (IBuildPropertiesConstants .PROPERTY_P2_GATHERING )) { 
133134			BuildDirector .p2Gathering  = true ;
135+ 		}
134136	}
135137
136138	public  static  String  getImmutableAntProperty (String  key ) {
@@ -139,14 +141,16 @@ public static String getImmutableAntProperty(String key) {
139141
140142	public  static  boolean  getPropertyAsBoolean (String  key ) {
141143		String  booleanValue  = getImmutableAntProperty (key , null );
142- 		if  ("true" .equalsIgnoreCase (booleanValue )) //$NON-NLS-1$ 
144+ 		if  ("true" .equalsIgnoreCase (booleanValue )) {  //$NON-NLS-1$ 
143145			return  true ;
146+ 		}
144147		return  false ;
145148	}
146149
147150	public  static  String  getImmutableAntProperty (String  key , String  defaultValue ) {
148- 		if  (immutableAntProperties  == null  || !immutableAntProperties .containsKey (key ))
151+ 		if  (immutableAntProperties  == null  || !immutableAntProperties .containsKey (key )) { 
149152			return  defaultValue ;
153+ 		}
150154		Object  obj  = immutableAntProperties .get (key );
151155		return  (obj  instanceof  String ) ? (String ) obj  : null ;
152156	}
@@ -214,8 +218,9 @@ public synchronized Object put(Object key, Object value) {
214218		}
215219
216220		public  static  MissingProperties  getInstance () {
217- 			if  (singleton  == null )
221+ 			if  (singleton  == null ) { 
218222				singleton  = new  MissingProperties ();
223+ 			}
219224			return  singleton ;
220225		}
221226	}
@@ -247,8 +252,9 @@ public static Properties readProperties(String location, String fileName, int er
247252	}
248253
249254	public  void  openScript (String  scriptLocation , String  scriptName ) throws  CoreException  {
250- 		if  (script  != null )
255+ 		if  (script  != null ) { 
251256			return ;
257+ 		}
252258		script  = newAntScript (scriptLocation , scriptName );
253259	}
254260
@@ -309,8 +315,9 @@ protected static boolean loadP2Class() {
309315	 * @return BuildTimeSite 
310316	 */ 
311317	public  BuildTimeSite  getSite (boolean  refresh ) throws  CoreException  {
312- 		if  (siteFactory  != null  && refresh  == false )
318+ 		if  (siteFactory  != null  && refresh  == false ) { 
313319			return  siteFactory .createSite ();
320+ 		}
314321
315322		//If there is an exception from createSite(), we will discard the factory 
316323		BuildTimeSiteFactory  factory  = new  BuildTimeSiteFactory ();
@@ -325,8 +332,9 @@ public BuildTimeSite getSite(boolean refresh) throws CoreException {
325332		BuildTimeSite  result  = factory .createSite ();
326333		siteFactory  = factory ;
327334
328- 		if  (platformProperties  != null )
335+ 		if  (platformProperties  != null ) { 
329336			result .setPlatformPropeties (platformProperties );
337+ 		}
330338
331339		File  baseProfile  = result .getSiteContentProvider ().getBaseProfile ();
332340		if  (baseProfile  != null ) {
@@ -401,8 +409,9 @@ protected void flushState() {
401409	}
402410
403411	private  void  ensurePDEUIStateNotNull () {
404- 		if  (pdeUIState  == null )
412+ 		if  (pdeUIState  == null ) { 
405413			pdeUIState  = new  PDEUIStateWrapper ();
414+ 		}
406415	}
407416
408417	protected  boolean  havePDEUIState () {
@@ -443,12 +452,14 @@ public ProductFile loadProduct(String product, String os) throws CoreException {
443452	//Find a file in a bundle or a feature. 
444453	//location is assumed to be structured like : /<featureId | pluginId>/path.to.the.file 
445454	protected  String  findFile (String  location , boolean  makeRelative ) {
446- 		if  (location  == null  || location .length () == 0 )
455+ 		if  (location  == null  || location .length () == 0 ) { 
447456			return  null ;
457+ 		}
448458
449459		//shortcut building the site if we don't need to 
450- 		if  (new  File (location ).exists ())
460+ 		if  (new  File (location ).exists ()) { 
451461			return  location ;
462+ 		}
452463
453464		PDEState  state ;
454465		try  {
@@ -464,8 +475,9 @@ protected String findFile(String location, boolean makeRelative) {
464475			BundleDescription  bundle  = matches [0 ];
465476			if  (bundle  != null ) {
466477				String  result  = checkFile (IPath .fromOSString (bundle .getLocation ()), path , makeRelative );
467- 				if  (result  != null )
478+ 				if  (result  != null ) { 
468479					return  result ;
480+ 				}
469481			}
470482		}
471483		// Couldn't find the file in any of the plugins, try in a feature. 
@@ -475,54 +487,64 @@ protected String findFile(String location, boolean makeRelative) {
475487		} catch  (CoreException  e ) {
476488			BundleHelper .getDefault ().getLog ().log (e .getStatus ());
477489		}
478- 		if  (feature  == null )
490+ 		if  (feature  == null ) { 
479491			return  null ;
492+ 		}
480493
481494		String  featureRoot  = feature .getRootLocation ();
482- 		if  (featureRoot  != null )
495+ 		if  (featureRoot  != null ) { 
483496			return  checkFile (IPath .fromOSString (featureRoot ), path , makeRelative );
497+ 		}
484498		return  null ;
485499	}
486500
487501	protected  String  findConfigFile (ProductFile  productFile , String  os ) {
488502		String  path  = productFile .getConfigIniPath (os );
489- 		if  (path  == null )
503+ 		if  (path  == null ) { 
490504			return  null ;
505+ 		}
491506
492507		String  result  = findFile (path , false );
493- 		if  (result  != null )
508+ 		if  (result  != null ) { 
494509			return  result ;
510+ 		}
495511
496512		// couldn't find productFile, try it as a path directly 
497513		File  f  = new  File (path );
498- 		if  (f .exists () && f .isFile ())
514+ 		if  (f .exists () && f .isFile ()) { 
499515			return  f .getAbsolutePath ();
516+ 		}
500517
501518		// relative to the working directory 
502519		f  = new  File (getWorkingDirectory (), path );
503- 		if  (f .exists () && f .isFile ())
520+ 		if  (f .exists () && f .isFile ()) { 
504521			return  f .getAbsolutePath ();
522+ 		}
505523
506524		// relative to the working directory/plugins 
507525		f  = new  File (getWorkingDirectory () + "/"  + DEFAULT_PLUGIN_LOCATION , path ); //$NON-NLS-1$ 
508- 		if  (f .exists () && f .isFile ())
526+ 		if  (f .exists () && f .isFile ()) { 
509527			return  f .getAbsolutePath ();
528+ 		}
510529
511530		//relative to .product file 
512531		f  = new  File (productFile .getLocation ().getParent (), path );
513- 		if  (f .exists () && f .isFile ())
532+ 		if  (f .exists () && f .isFile ()) { 
514533			return  f .getAbsolutePath ();
534+ 		}
515535
516536		return  null ;
517537	}
518538
519539	private  String  checkFile (IPath  base , IPath  target , boolean  makeRelative ) {
520540		IPath  path  = base .append (target .removeFirstSegments (1 ));
521541		String  result  = path .toOSString ();
522- 		if  (!new  File (result ).exists ())
542+ 		if  (!new  File (result ).exists ()) { 
523543			return  null ;
524- 		if  (makeRelative )
544+ 		}
545+ 		if  (makeRelative ) {
525546			return  Utils .makeRelative (path , IPath .fromOSString (workingDirectory )).toOSString ();
547+ 		}
526548		return  result ;
527549	}
528550
@@ -536,8 +558,9 @@ public void setFilterP2Base(boolean filter) {
536558
537559	static  private  URI  getDownloadCacheLocation (IProvisioningAgent  agent ) {
538560		IAgentLocation  location  = (IAgentLocation ) agent .getService (IAgentLocation .SERVICE_NAME );
539- 		if  (location  == null )
561+ 		if  (location  == null ) { 
540562			return  null ;
563+ 		}
541564		return  URIUtil .append (location .getDataArea ("org.eclipse.equinox.p2.core" ), "cache/" ); //$NON-NLS-1$ //$NON-NLS-2$ 
542565	}
543566
@@ -587,8 +610,9 @@ protected void addContextRepos(URI[] repos) {
587610
588611	//return only the metadata repos, and also the ones we aren't sure about 
589612	private  List <URI > filterRepos (URI [] contexts , FilenameFilter  repoFilter ) {
590- 		if  (contexts  == null )
613+ 		if  (contexts  == null ) { 
591614			return  null ;
615+ 		}
592616		ArrayList <URI > result  = new  ArrayList <>();
593617		for  (URI  context  : contexts ) {
594618			File  repo  = URIUtil .toFile (context );
@@ -597,24 +621,27 @@ private List<URI> filterRepos(URI[] contexts, FilenameFilter repoFilter) {
597621				result .add (context );
598622			} else  {
599623				String [] list  = repo .list (repoFilter );
600- 				if  (list  != null  && list .length  > 0 )
624+ 				if  (list  != null  && list .length  > 0 ) { 
601625					result .add (context );
626+ 				}
602627			}
603628		}
604629		return  result ;
605630	}
606631
607632	private  List <URI > getAssociatedRepositories (File  profileFile ) {
608- 		if  (profileFile  == null  || !profileFile .exists () || !profileFile .getName ().endsWith (".profile" )) //$NON-NLS-1$ 
633+ 		if  (profileFile  == null  || !profileFile .exists () || !profileFile .getName ().endsWith (".profile" )) {  //$NON-NLS-1$ 
609634			return  Collections .emptyList ();
635+ 		}
610636
611637		ArrayList <URI > result  = new  ArrayList <>();
612638		URI  profileURI  = profileFile .toURI ();
613639		result .add (profileURI );
614640
615641		Map <String , Object > profileInfo  = extractProfileInformation (profileFile );
616- 		if  (profileInfo  == null )
642+ 		if  (profileInfo  == null ) { 
617643			return  result ;
644+ 		}
618645
619646		File  areaFile  = new  File ((String ) profileInfo .get (PROFILE_DATA_AREA ));
620647		if  (areaFile .exists ()) {
@@ -626,8 +653,9 @@ private List<URI> getAssociatedRepositories(File profileFile) {
626653					String  profileId  = (String ) profileInfo .get (PROFILE_ID );
627654					if  (timestamp  == -1L ) {
628655						long [] timestamps  = registry .listProfileTimestamps (profileId );
629- 						if  (timestamps .length  > 0 )
656+ 						if  (timestamps .length  > 0 ) { 
630657							timestamp  = timestamps [timestamps .length  - 1 ];
658+ 						}
631659					}
632660
633661					//specifying the timestamp avoids attempting to lock the profile registry 
@@ -647,8 +675,9 @@ private List<URI> getAssociatedRepositories(File profileFile) {
647675								}
648676							}
649677							String  sharedCache  = profile .getProperty (IProfile .PROP_SHARED_CACHE );
650- 							if  (sharedCache  != null )
678+ 							if  (sharedCache  != null ) { 
651679								result .add (new  File (cache ).toURI ());
680+ 							}
652681							String  dropinRepositories  = profile .getProperty ("org.eclipse.equinox.p2.cache.extensions" ); //$NON-NLS-1$ 
653682							if  (dropinRepositories  != null ) {
654683								// #filterRepos will remove any dropin folders that require synchronization 
@@ -670,8 +699,9 @@ private List<URI> getAssociatedRepositories(File profileFile) {
670699
671700				//download cache 
672701				URI  download  = getDownloadCacheLocation (agent );
673- 				if  (URIUtil .toFile (download ).exists ())
702+ 				if  (URIUtil .toFile (download ).exists ()) { 
674703					result .add (download );
704+ 				}
675705			}
676706		}
677707		return  result ;
@@ -683,25 +713,29 @@ private List<URI> getAssociatedRepositories(File profileFile) {
683713	private  static  String  PROFILE_REGISTRY  = "registry" ; //$NON-NLS-1$ 
684714
685715	private  static  Map <String , Object > extractProfileInformation (File  target ) {
686- 		if  (target  == null  || !target .exists ())
716+ 		if  (target  == null  || !target .exists ()) { 
687717			return  null ;
718+ 		}
688719
689720		IPath  path  = IPath .fromOSString (target .getAbsolutePath ());
690- 		if  (!path .lastSegment ().endsWith (PROFILE ) && !path .lastSegment ().endsWith (PROFILE_GZ ))
721+ 		if  (!path .lastSegment ().endsWith (PROFILE ) && !path .lastSegment ().endsWith (PROFILE_GZ )) { 
691722			return  null ;
723+ 		}
692724
693725		//expect at least "p2/org.eclipse.equinox.p2.engine/profileRegistry/Profile.profile" 
694- 		if  (path .segmentCount () < 4 )
726+ 		if  (path .segmentCount () < 4 ) { 
695727			return  null ;
728+ 		}
696729
697730		Map <String , Object > results  = new  HashMap <>();
698731		results .put (PROFILE_TIMESTAMP , Long .valueOf (-1 ));
699732
700733		String  profileId  = null ;
701734		if  (target .isFile ()) {
702735			//p2/org.eclipse.equinox.p2.engine/profileRegistry/Profile.profile/123456.profile.gz 
703- 			if  (path .segmentCount () < 5 )
736+ 			if  (path .segmentCount () < 5 ) { 
704737				return  null ;
738+ 			}
705739
706740			String  timestamp  = path .lastSegment ();
707741			int  idx  = timestamp .indexOf ('.' );
@@ -751,11 +785,13 @@ public void setProductQualifier(String value) {
751785	 * If the user has specified a platform properties then load it. 
752786	 */ 
753787	public  void  setPlatformProperties (String  filename ) {
754- 		if  (filename  == null  || filename .trim ().length () == 0 )
788+ 		if  (filename  == null  || filename .trim ().length () == 0 ) { 
755789			return ;
790+ 		}
756791		File  file  = new  File (filename );
757- 		if  (!file .exists ())
792+ 		if  (!file .exists ()) { 
758793			return ;
794+ 		}
759795		platformProperties  = new  Properties ();
760796		try  (InputStream  input  = new  BufferedInputStream (new  FileInputStream (file ))) {
761797			platformProperties .load (input );
@@ -768,8 +804,9 @@ public void setPlatformProperties(String filename) {
768804	}
769805
770806	protected  void  generateProductReplaceTask (ProductFile  product , String  productFilePath , AssemblyInformation  assemblyInfo ) {
771- 		if  (product  == null )
807+ 		if  (product  == null ) { 
772808			return ;
809+ 		}
773810
774811		BuildTimeSite  site  = null ;
775812		try  {
@@ -789,10 +826,11 @@ protected void generateProductReplaceTask(ProductFile product, String productFil
789826
790827		script .println ("<eclipse.idReplacer productFilePath=\" "  + AntScript .getEscaped (productFilePath ) + "\" " ); //$NON-NLS-1$ //$NON-NLS-2$ 
791828		script .println ("                    selfVersion=\" "  + version  + "\"  " ); //$NON-NLS-1$ //$NON-NLS-2$ 
792- 		if  (product .useFeatures ())
829+ 		if  (product .useFeatures ()) { 
793830			script .println ("                    featureIds=\" "  + mappings  + "\" />" ); //$NON-NLS-1$ //$NON-NLS-2$ 
794- 		else 
831+ 		}  else  { 
795832			script .println ("                    pluginIds=\" "  + mappings  + "\" />" ); //$NON-NLS-1$ //$NON-NLS-2$  
833+ 		}
796834
797835		return ;
798836	}
0 commit comments