You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by dj...@apache.org on 2012/01/24 01:53:26 UTC

svn commit: r1235095 [1/5] - in /aries/trunk/versioning: ./ versioning-checker/ versioning-checker/src/main/java/org/apache/aries/versioning/check/ versioning-checker/src/main/java/org/apache/aries/versioning/utils/ versioning-checker/src/test/java/org...

Author: djencks
Date: Tue Jan 24 00:53:25 2012
New Revision: 1235095

URL: http://svn.apache.org/viewvc?rev=1235095&view=rev
Log:
ARIES-757 format versioning code

Modified:
    aries/trunk/versioning/pom.xml
    aries/trunk/versioning/versioning-checker/pom.xml
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/check/SemanticVersioningChecker.java
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/BinaryCompatibilityStatus.java
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/ClassDeclaration.java
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/EmptyClassVisitor.java
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/FieldDeclaration.java
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/GenericDeclaration.java
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/MethodDeclaration.java
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/SemanticVersioningClassVisitor.java
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/SemanticVersioningUtils.java
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/SerialVersionClassVisitor.java
    aries/trunk/versioning/versioning-checker/src/test/java/org/apache/aries/versioning/tests/BinaryCompatibilityTest.java
    aries/trunk/versioning/versioning-checker/src/test/java/org/apache/aries/versioning/tests/SemanticVersionUtilsTest.java
    aries/trunk/versioning/versioning-checker/src/test/java/versioning/java/files/TestA.java
    aries/trunk/versioning/versioning-checker/src/test/java/versioning/java/files/TestB.java
    aries/trunk/versioning/versioning-checker/src/test/java/versioning/java/files/TestBChild.java
    aries/trunk/versioning/versioning-checker/src/test/java/versioning/java/files/TestC.java

Modified: aries/trunk/versioning/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/versioning/pom.xml?rev=1235095&r1=1235094&r2=1235095&view=diff
==============================================================================
--- aries/trunk/versioning/pom.xml (original)
+++ aries/trunk/versioning/pom.xml Tue Jan 24 00:53:25 2012
@@ -20,10 +20,10 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <parent>
-       <groupId>org.apache.aries</groupId>
-       <artifactId>java5-parent</artifactId>
-       <version>0.6-SNAPSHOT</version>
-        <relativePath />
+        <groupId>org.apache.aries</groupId>
+        <artifactId>java5-parent</artifactId>
+        <version>0.6-SNAPSHOT</version>
+        <relativePath/>
     </parent>
 
     <groupId>org.apache.aries.versioning</groupId>
@@ -32,7 +32,7 @@
     <name>Apache Aries Semantic Versioning Checker</name>
     <version>0.1.0-SNAPSHOT</version>
     <description>
-      OSGi Semantic Versioning Checker
+        OSGi Semantic Versioning Checker
     </description>
 
 

Modified: aries/trunk/versioning/versioning-checker/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/versioning/versioning-checker/pom.xml?rev=1235095&r1=1235094&r2=1235095&view=diff
==============================================================================
--- aries/trunk/versioning/versioning-checker/pom.xml (original)
+++ aries/trunk/versioning/versioning-checker/pom.xml Tue Jan 24 00:53:25 2012
@@ -17,28 +17,28 @@
  under the License.
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
 
-  <parent>
-    <groupId>org.apache.aries</groupId>
-      <artifactId>java5-parent</artifactId>
-      <version>0.6-SNAPSHOT</version>
-      <relativePath />
-  </parent>
-  <groupId>org.apache.aries.versioning</groupId>
-  <artifactId>org.apache.aries.versioning.checker</artifactId>
-  <version>0.1.0-SNAPSHOT</version>
-  <packaging>bundle</packaging>
+    <parent>
+        <groupId>org.apache.aries</groupId>
+        <artifactId>java5-parent</artifactId>
+        <version>0.6-SNAPSHOT</version>
+        <relativePath/>
+    </parent>
+    <groupId>org.apache.aries.versioning</groupId>
+    <artifactId>org.apache.aries.versioning.checker</artifactId>
+    <version>0.1.0-SNAPSHOT</version>
+    <packaging>bundle</packaging>
 
-  <name>org.apache.aries.versioning.checker</name>
-  <url>http://maven.apache.org</url>
+    <name>org.apache.aries.versioning.checker</name>
+    <url>http://maven.apache.org</url>
 
     <scm>
-         <connection>scm:svn:http://svn.apache.org/repos/asf/aries/trunk/versioning/checker</connection>
-         <developerConnection>scm:svn:https://svn.apache.org/repos/asf/aries/trunk/versioning/checker</developerConnection>
-         <url>http://svn.apache.org/viewvc/aries/trunk/versioning/checker</url>
-     </scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/aries/trunk/versioning/checker</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/aries/trunk/versioning/checker</developerConnection>
+        <url>http://svn.apache.org/viewvc/aries/trunk/versioning/checker</url>
+    </scm>
 
     <properties>
         <aries.osgi.symbolic.name>
@@ -56,15 +56,15 @@
         <aries.osgi.private.pkg>
             org.apache.aries.versioning.utils;
         </aries.osgi.private.pkg>
-  </properties>
+    </properties>
+
+    <dependencies>
 
-  <dependencies>
-    
         <!-- Dependency on other Aries module bundles -->
         <dependency>
-             <groupId>org.apache.aries</groupId>
-             <artifactId>org.apache.aries.util</artifactId>
-             <version>0.4</version>
+            <groupId>org.apache.aries</groupId>
+            <artifactId>org.apache.aries.util</artifactId>
+            <version>0.4</version>
         </dependency>
         <dependency>
             <groupId>org.apache.aries.testsupport</groupId>
@@ -101,5 +101,5 @@
             <artifactId>slf4j-simple</artifactId>
             <scope>test</scope>
         </dependency>
-  </dependencies>
+    </dependencies>
 </project>

Modified: aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/check/SemanticVersioningChecker.java
URL: http://svn.apache.org/viewvc/aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/check/SemanticVersioningChecker.java?rev=1235095&r1=1235094&r2=1235095&view=diff
==============================================================================
--- aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/check/SemanticVersioningChecker.java (original)
+++ aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/check/SemanticVersioningChecker.java Tue Jan 24 00:53:25 2012
@@ -37,7 +37,6 @@ import java.util.List;
 import java.util.Map;
 
 
-
 import org.apache.aries.util.filesystem.FileSystem;
 import org.apache.aries.util.filesystem.IDirectory;
 import org.apache.aries.util.filesystem.IFile;
@@ -56,664 +55,677 @@ import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+
 import static org.apache.aries.versioning.utils.SemanticVersioningUtils.htmlOneLineBreak;
 import static org.apache.aries.versioning.utils.SemanticVersioningUtils.htmlTwoLineBreaks;;
+
 public class SemanticVersioningChecker {
 
-  private static final Logger _logger = LoggerFactory.getLogger(SemanticVersioningChecker.class);
-  private URLClassLoader newJarsLoader;
-  private URLClassLoader oldJarsLoader;
-  private static final String xmlHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";
-  /**
-   * This method is to scan the current location against base and process each individual jars 
-   * in the current location against the jar with the same symbolic names in the base and produce a xml report specified by versioningReport.
-   * @param base baseline jars
-   * @param current current version of jars
-   * @param versioningReport the validation reports
-   */
-  public static void checkSemanticVersioning(URL base, URL current, File versioningReport) {
-    //For each jar under the current location, open the jar and then use ASM to 
-    //work out whether there are binary incompatible changes against the base location.
-    try {
-      File baseDir = new File(base.toURI());
-      File currentDir = new File(current.toExternalForm());
-      if ( baseDir.exists() && currentDir.exists()) {
-        new SemanticVersioningChecker().performVersioningCheck(FileSystem.getFSRoot(baseDir), FileSystem.getFSRoot(currentDir), versioningReport);
-      } else {
-        _logger.debug("No bundles found to process.");
-      }
-    } catch (URISyntaxException use) {
-      _logger.error(use.getMessage());
-    }
-  }
-
-  // for each jar, open its manifest and found the packages
-  private  void  performVersioningCheck(IDirectory  baseDir, IDirectory currentDir, File versionStatusFile)  {
-    
-    FileWriter versionStatusFileWriter = null;
-    try {
-      versionStatusFileWriter = new FileWriter(versionStatusFile, false);
-      Map<String, BundleInfo> baseBundles = new HashMap<String, BundleInfo>();
-      Map<String, BundleInfo> currentBundles = new HashMap<String, BundleInfo>();
-      
-        //scan each individual bundle and find the corresponding bundle in the baseline and verify the version changes
-        currentBundles = getBundles(currentDir);
-        baseBundles = getBundles(baseDir);
-        URL[] newJarURLs = getListURLs(currentBundles.values()).toArray(new URL[0]);
-        newJarsLoader = new URLClassLoader(newJarURLs);
-
-        URL[] oldJarURLs = getListURLs(baseBundles.values()).toArray(new URL[0]);
-
-        oldJarsLoader = new URLClassLoader(oldJarURLs);
-
-        //Write the xml header
-        writeRecordToWriter(versionStatusFileWriter, xmlHeader + "\r\n");
-        
-        // write the comparison base and current level into the file
-        writeRecordToWriter(versionStatusFileWriter, "<semanaticVersioning currentDir= \"" + currentDir + "\" baseDir = \"" + baseDir + "\">");
-        for (Map.Entry<String, BundleInfo> entry : currentBundles.entrySet()) {
-          String bundleSymbolicName = entry.getKey();
-
-          String bundleElement = null;
-          boolean bundleVersionCorrect = true;
-          // find the same bundle in the base and check whether all the versions are correct
-          BundleInfo currentBundle = entry.getValue();
-          BundleInfo baseBundle = baseBundles.get(bundleSymbolicName);
-          StringBuilder pkgElements = new StringBuilder();
-          String reason = null;
-          if (baseBundle == null) {
-            _logger.debug("The bundle " + bundleSymbolicName + " has no counterpart in the base. The semanit version validation does not apply to this bundle.");
-          } else {
-            // open the manifest and scan the export package and find the package name and exported version
-            // The tool assume the one particular package just exports under one version
-            Map<String, PackageContent> currBundleExpPkgContents = getAllExportedPkgContents(currentBundle);
-            Map<String, PackageContent> baseBundleExpPkgContents = new HashMap<String, PackageContent>();
-            boolean pkg_major_change = false;
-            boolean pkg_minor_change = false;
-            String fatal_package = null;
-            if (!!!currBundleExpPkgContents.isEmpty()) {
-              baseBundleExpPkgContents =  getAllExportedPkgContents(baseBundle);
-              // compare each class right now
-              for (Map.Entry<String, PackageContent> pkg : baseBundleExpPkgContents.entrySet()) {
-                String pkgName = pkg.getKey();
-                Map<String, IFile> baseClazz = pkg.getValue().getClasses();
-                Map<String, IFile> baseXsds = pkg.getValue().getXsds();
-                PackageContent currPkgContents = currBundleExpPkgContents.get(pkgName);
-                if (currPkgContents == null) {
-                  // The package is no longer exported any more. This should lead to bundle major version change.
-                  pkg_major_change = true;
-                  fatal_package = pkgName;
-                  _logger.debug("The package " + pkgName + " in the bundle of " + bundleSymbolicName + " is no longer to be exported. Major change.");
+    private static final Logger _logger = LoggerFactory.getLogger(SemanticVersioningChecker.class);
+    private URLClassLoader newJarsLoader;
+    private URLClassLoader oldJarsLoader;
+    private static final String xmlHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";
+
+    /**
+     * This method is to scan the current location against base and process each individual jars
+     * in the current location against the jar with the same symbolic names in the base and produce a xml report specified by versioningReport.
+     *
+     * @param base             baseline jars
+     * @param current          current version of jars
+     * @param versioningReport the validation reports
+     */
+    public static void checkSemanticVersioning(URL base, URL current, File versioningReport) {
+        //For each jar under the current location, open the jar and then use ASM to
+        //work out whether there are binary incompatible changes against the base location.
+        try {
+            File baseDir = new File(base.toURI());
+            File currentDir = new File(current.toExternalForm());
+            if (baseDir.exists() && currentDir.exists()) {
+                new SemanticVersioningChecker().performVersioningCheck(FileSystem.getFSRoot(baseDir), FileSystem.getFSRoot(currentDir), versioningReport);
+            } else {
+                _logger.debug("No bundles found to process.");
+            }
+        } catch (URISyntaxException use) {
+            _logger.error(use.getMessage());
+        }
+    }
+
+    // for each jar, open its manifest and found the packages
+    private void performVersioningCheck(IDirectory baseDir, IDirectory currentDir, File versionStatusFile) {
+
+        FileWriter versionStatusFileWriter = null;
+        try {
+            versionStatusFileWriter = new FileWriter(versionStatusFile, false);
+            Map<String, BundleInfo> baseBundles = new HashMap<String, BundleInfo>();
+            Map<String, BundleInfo> currentBundles = new HashMap<String, BundleInfo>();
+
+            //scan each individual bundle and find the corresponding bundle in the baseline and verify the version changes
+            currentBundles = getBundles(currentDir);
+            baseBundles = getBundles(baseDir);
+            URL[] newJarURLs = getListURLs(currentBundles.values()).toArray(new URL[0]);
+            newJarsLoader = new URLClassLoader(newJarURLs);
+
+            URL[] oldJarURLs = getListURLs(baseBundles.values()).toArray(new URL[0]);
+
+            oldJarsLoader = new URLClassLoader(oldJarURLs);
+
+            //Write the xml header
+            writeRecordToWriter(versionStatusFileWriter, xmlHeader + "\r\n");
+
+            // write the comparison base and current level into the file
+            writeRecordToWriter(versionStatusFileWriter, "<semanaticVersioning currentDir= \"" + currentDir + "\" baseDir = \"" + baseDir + "\">");
+            for (Map.Entry<String, BundleInfo> entry : currentBundles.entrySet()) {
+                String bundleSymbolicName = entry.getKey();
+
+                String bundleElement = null;
+                boolean bundleVersionCorrect = true;
+                // find the same bundle in the base and check whether all the versions are correct
+                BundleInfo currentBundle = entry.getValue();
+                BundleInfo baseBundle = baseBundles.get(bundleSymbolicName);
+                StringBuilder pkgElements = new StringBuilder();
+                String reason = null;
+                if (baseBundle == null) {
+                    _logger.debug("The bundle " + bundleSymbolicName + " has no counterpart in the base. The semanit version validation does not apply to this bundle.");
                 } else {
-                  Map<String, IFile> curClazz = currPkgContents.getClasses();
-                  Map<String, IFile> curXsds = currPkgContents.getXsds();
-                  //check whether there should be major change/minor change/micro change in this package.
-                  //1. Use ASM to visit all classes in the package 
-                  VersionChange majorChange = new VersionChange();
-                  VersionChange minorChange = new VersionChange();
-                  // check all classes to see whether there are minor or major changes
-                  visitPackage(pkgName, baseClazz, curClazz, majorChange, minorChange);
-                  // If there is no binary compatibility changes, check whether xsd files have been added, changed or deleted
-                  if (!!!majorChange.isChange()) {
-                    checkXsdChangesInPkg(pkgName, baseXsds, curXsds, majorChange);
-                    // If everything is ok with the existing classes. Need to find out whether there are more API (abstract classes) in the current bundle.
-                    // loop through curClazz and visit it and find out whether one of them is abstract.
-                    // check whether there are more xsd or abstract classes added
-                    if (!!!(majorChange.isChange() || minorChange.isChange())){
-                      checkAdditionalClassOrXsds(pkgName, curClazz, curXsds, minorChange);
+                    // open the manifest and scan the export package and find the package name and exported version
+                    // The tool assume the one particular package just exports under one version
+                    Map<String, PackageContent> currBundleExpPkgContents = getAllExportedPkgContents(currentBundle);
+                    Map<String, PackageContent> baseBundleExpPkgContents = new HashMap<String, PackageContent>();
+                    boolean pkg_major_change = false;
+                    boolean pkg_minor_change = false;
+                    String fatal_package = null;
+                    if (!!!currBundleExpPkgContents.isEmpty()) {
+                        baseBundleExpPkgContents = getAllExportedPkgContents(baseBundle);
+                        // compare each class right now
+                        for (Map.Entry<String, PackageContent> pkg : baseBundleExpPkgContents.entrySet()) {
+                            String pkgName = pkg.getKey();
+                            Map<String, IFile> baseClazz = pkg.getValue().getClasses();
+                            Map<String, IFile> baseXsds = pkg.getValue().getXsds();
+                            PackageContent currPkgContents = currBundleExpPkgContents.get(pkgName);
+                            if (currPkgContents == null) {
+                                // The package is no longer exported any more. This should lead to bundle major version change.
+                                pkg_major_change = true;
+                                fatal_package = pkgName;
+                                _logger.debug("The package " + pkgName + " in the bundle of " + bundleSymbolicName + " is no longer to be exported. Major change.");
+                            } else {
+                                Map<String, IFile> curClazz = currPkgContents.getClasses();
+                                Map<String, IFile> curXsds = currPkgContents.getXsds();
+                                //check whether there should be major change/minor change/micro change in this package.
+                                //1. Use ASM to visit all classes in the package
+                                VersionChange majorChange = new VersionChange();
+                                VersionChange minorChange = new VersionChange();
+                                // check all classes to see whether there are minor or major changes
+                                visitPackage(pkgName, baseClazz, curClazz, majorChange, minorChange);
+                                // If there is no binary compatibility changes, check whether xsd files have been added, changed or deleted
+                                if (!!!majorChange.isChange()) {
+                                    checkXsdChangesInPkg(pkgName, baseXsds, curXsds, majorChange);
+                                    // If everything is ok with the existing classes. Need to find out whether there are more API (abstract classes) in the current bundle.
+                                    // loop through curClazz and visit it and find out whether one of them is abstract.
+                                    // check whether there are more xsd or abstract classes added
+                                    if (!!!(majorChange.isChange() || minorChange.isChange())) {
+                                        checkAdditionalClassOrXsds(pkgName, curClazz, curXsds, minorChange);
+                                    }
+                                }
+                                // We have scanned the whole packages, report the result
+                                if (majorChange.isChange() || minorChange.isChange()) {
+                                    String oldVersion = pkg.getValue().getPackageVersion();
+                                    String newVersion = currPkgContents.getPackageVersion();
+                                    if (majorChange.isChange()) {
+                                        pkg_major_change = true;
+                                        fatal_package = pkgName;
+                                        if (!!!isVersionCorrect(VERSION_CHANGE_TYPE.MAJOR_CHANGE, oldVersion, newVersion)) {
+                                            pkgElements.append(getPkgStatusText(pkgName, VERSION_CHANGE_TYPE.MAJOR_CHANGE, oldVersion, newVersion, majorChange.getReason(), majorChange.getChangeClass()));
+                                        }
+                                    } else if (minorChange.isChange()) {
+                                        pkg_minor_change = true;
+                                        if (fatal_package == null) fatal_package = pkgName;
+                                        if (!!!isVersionCorrect(VERSION_CHANGE_TYPE.MINOR_CHANGE, oldVersion, newVersion)) {
+                                            pkgElements.append(getPkgStatusText(pkgName, VERSION_CHANGE_TYPE.MINOR_CHANGE, pkg.getValue().getPackageVersion(), currPkgContents.getPackageVersion(), minorChange.getReason(), minorChange.getChangeClass()));
+                                        }
+                                    }
+                                    pkgElements.append("\r\n");
+                                }
+                            }
+                        }
+                        // If there is a package version change, the bundle version needs to be updated.
+                        // If there is a major change in one of the packages, the bundle major version needs to be increased.
+                        // If there is a minor change in one of the packages, the bundle minor version needs to be increased.
+                        String oldVersion = baseBundle.getBundleManifest().getVersion().toString();
+                        String newVersion = currentBundle.getBundleManifest().getVersion().toString();
+
+
+                        if (pkg_major_change || pkg_minor_change) {
+
+                            if (pkg_major_change) {
+                                // The bundle version's major value should be increased.
+                                reason = "Some packages have major changes. For an instance, the package " + fatal_package + " has major version changes.";
+                                bundleElement = getBundleStatusText(currentBundle.getBundle().getName(), bundleSymbolicName, VERSION_CHANGE_TYPE.MAJOR_CHANGE, oldVersion, newVersion, reason);
+                                bundleVersionCorrect = isVersionCorrect(VERSION_CHANGE_TYPE.MAJOR_CHANGE, oldVersion, newVersion);
+                            } else if (pkg_minor_change) {
+                                reason = "Some packages have minor changes. For an instance, the package " + fatal_package + " has minor version changes.";
+                                bundleElement = getBundleStatusText(currentBundle.getBundle().getName(), bundleSymbolicName, VERSION_CHANGE_TYPE.MINOR_CHANGE, oldVersion, newVersion, reason);
+                                bundleVersionCorrect = isVersionCorrect(VERSION_CHANGE_TYPE.MINOR_CHANGE, oldVersion, newVersion);
+                            }
+                        } else {
+                            reason = "The bundle has no version changes.";
+                            bundleElement = getBundleStatusText(currentBundle.getBundle().getName(), bundleSymbolicName, VERSION_CHANGE_TYPE.NO_CHANGE, oldVersion, newVersion, reason);
+                            bundleVersionCorrect = isVersionCorrect(VERSION_CHANGE_TYPE.NO_CHANGE, oldVersion, newVersion);
+                        }
                     }
-                  }
-                  // We have scanned the whole packages, report the result
-                  if (majorChange.isChange() || minorChange.isChange()) {
-                    String oldVersion = pkg.getValue().getPackageVersion();
-                    String newVersion = currPkgContents.getPackageVersion();
-                    if (majorChange.isChange()) {
-                      pkg_major_change = true;
-                      fatal_package = pkgName;
-                      if (!!!isVersionCorrect(VERSION_CHANGE_TYPE.MAJOR_CHANGE, oldVersion, newVersion)) {                      
-                        pkgElements.append(getPkgStatusText( pkgName, VERSION_CHANGE_TYPE.MAJOR_CHANGE, oldVersion, newVersion, majorChange.getReason(), majorChange.getChangeClass()));                      
-                      }
-                    } else if (minorChange.isChange()) {
-                      pkg_minor_change = true;
-                      if (fatal_package == null) fatal_package = pkgName;
-                      if (!!!isVersionCorrect(VERSION_CHANGE_TYPE.MINOR_CHANGE, oldVersion, newVersion)) {
-                        pkgElements.append(getPkgStatusText( pkgName, VERSION_CHANGE_TYPE.MINOR_CHANGE, pkg.getValue().getPackageVersion(), currPkgContents.getPackageVersion(), minorChange.getReason(), minorChange.getChangeClass()));
-                      }
-                    }
-                    pkgElements.append("\r\n");
-                  }
-                }
-              }
-              // If there is a package version change, the bundle version needs to be updated.
-              // If there is a major change in one of the packages, the bundle major version needs to be increased.
-              // If there is a minor change in one of the packages, the bundle minor version needs to be increased.
-              String oldVersion = baseBundle.getBundleManifest().getVersion().toString();
-              String newVersion = currentBundle.getBundleManifest().getVersion().toString();
-
-
-              if (pkg_major_change || pkg_minor_change) {
-
-                if (pkg_major_change) {
-                  // The bundle version's major value should be increased.
-                  reason = "Some packages have major changes. For an instance, the package " + fatal_package + " has major version changes.";
-                  bundleElement = getBundleStatusText(currentBundle.getBundle().getName(), bundleSymbolicName, VERSION_CHANGE_TYPE.MAJOR_CHANGE, oldVersion, newVersion, reason);
-                  bundleVersionCorrect = isVersionCorrect(VERSION_CHANGE_TYPE.MAJOR_CHANGE, oldVersion, newVersion);
-                } else if (pkg_minor_change) {
-                  reason = "Some packages have minor changes. For an instance, the package " + fatal_package + " has minor version changes.";
-                  bundleElement = getBundleStatusText(currentBundle.getBundle().getName(), bundleSymbolicName, VERSION_CHANGE_TYPE.MINOR_CHANGE, oldVersion, newVersion, reason);
-                  bundleVersionCorrect = isVersionCorrect(VERSION_CHANGE_TYPE.MINOR_CHANGE, oldVersion, newVersion);
-                } 
-              } else {
-                reason = "The bundle has no version changes.";
-                bundleElement = getBundleStatusText(currentBundle.getBundle().getName(), bundleSymbolicName, VERSION_CHANGE_TYPE.NO_CHANGE, oldVersion, newVersion, reason);
-                bundleVersionCorrect = isVersionCorrect(VERSION_CHANGE_TYPE.NO_CHANGE, oldVersion, newVersion);
-              }
-            }
-          }
-          // Need to write bundle element and then package elements
-          if ((!!!bundleVersionCorrect) || ((pkgElements.length() > 0) )) {
-            writeRecordToWriter(versionStatusFileWriter, bundleElement);
-            writeRecordToWriter(versionStatusFileWriter, pkgElements.toString());
-            writeRecordToWriter(versionStatusFileWriter, "</bundle>");
-          }
-        }
-        writeRecordToWriter(versionStatusFileWriter, "</semanaticVersioning>");
-      
-    } catch (IOException ioe) {
-      ioe.printStackTrace();
-    } catch (Exception e) {
-      e.printStackTrace();
-    }
-    finally {
-      IOUtils.close(versionStatusFileWriter);
-    }
-    
-    return ;
-  }
-  /**
-   * Check whether the package has gained additional class or xsd files. If yes, log a minor change.
-   * @param pkgName
-   * @param curClazz
-   * @param curXsds
-   * @param minorChange
-   */
-  private void checkAdditionalClassOrXsds(String pkgName, Map<String, IFile> curClazz,
-      Map<String, IFile> curXsds, VersionChange minorChange)
-  {
-    String reason;
-    Collection<IFile> ifiles = curClazz.values();
-    Iterator<IFile> iterator = ifiles.iterator();
-    while (iterator.hasNext()) {
-      IFile ifile = iterator.next();
-      String changeClass = ifile.getName();
-      SemanticVersioningClassVisitor cv = getVisitor(ifile, newJarsLoader);
-      if (cv.getClassDeclaration() != null) {
-        // If this is a public/protected class, it will need to increase the minor version of the package.
-        minorChange.setChange(true);
-        if (minorChange.isChange()) {
-          reason = "The package " + pkgName + " has gained at least one class : " + getClassName(changeClass)+ ".";
-          minorChange.update(reason, changeClass, false);
-          break;
-        }
-      }
-    }
-    if (!!!(minorChange.isChange() || curXsds.isEmpty())) {
-      /// a new xsd file was added, it is a minor change
-      IFile firstXsd = null;
-      Iterator<IFile> xsdIterator = curXsds.values().iterator();
-      firstXsd = xsdIterator.next();
-
-      reason = "In the package " + pkgName + ", The schema file(s) are added: " + curXsds.keySet()+ ".";
-      minorChange.update(reason, firstXsd.getName(), false);
-    }
-  }
-
-
-  /**
-   * Check whether the package has xsd file changes or deleted. If yes, log a minor change.
-   * @param pkgName
-   * @param baseXsds
-   * @param curXsds
-   * @param majorChange
-   * @throws IOException
-   */
-
-  private void checkXsdChangesInPkg(String pkgName, Map<String, IFile> baseXsds,
-      Map<String, IFile> curXsds, VersionChange majorChange) throws IOException
-      {
-    String reason;
-    for (Map.Entry<String, IFile> file : baseXsds.entrySet()) {
-      // scan the latest version of the class
-      IFile curXsd = curXsds.get(file.getKey());
-      String changeClass = file.getValue().getName();
-      // check whether the xsd have been deleted or changed or added
-      if (curXsd == null) {  
-        reason = "In the package " + pkgName + ", The schema file has been deleted: " + file.getKey()+ ".";
-        majorChange.update(reason, changeClass, false);
-        break;                      
-      } else {
-        // check whether it is the same
-        //read the current xsd file
-        curXsds.remove(file.getKey());
-        String curFileContent = readXsdFile(curXsd.open());
-        String oldFileContent = readXsdFile(file.getValue().open());
-        if (!!!(curFileContent.equals(oldFileContent))) {
-
-          reason = "In the package " + pkgName + ", The schema file has been updated: " + file.getKey()+ ".";
-          majorChange.update(reason, changeClass, false);
-          break;
-        }
-      }
-    }
-      }
-
-  /**
-   * Visit the whole package to scan each class to see whether we need to log minor or major changes.
-   * @param pkgName
-   * @param baseClazz
-   * @param curClazz
-   * @param majorChange
-   * @param minorChange
-   */
-  private void visitPackage(String pkgName, Map<String, IFile> baseClazz,
-      Map<String, IFile> curClazz, VersionChange majorChange, VersionChange minorChange)
-  {
-    StringBuilder major_reason = new StringBuilder();
-    StringBuilder minor_reason = new StringBuilder();
-    boolean is_major_change = false;
-    boolean is_minor_change = false;
-    String fatal_class = null;
-    boolean foundNewAbstract = false;
-    for (Map.Entry<String, IFile> file : baseClazz.entrySet()) {
-      // scan the latest version of the class
-      IFile curFile = curClazz.get(file.getKey());
-      String changeClass = file.getValue().getName();
-      //Scan the base version
-      SemanticVersioningClassVisitor oldcv = getVisitor(file.getValue(), oldJarsLoader);
-      // skip the property files as they are compiled as class file as well
-      ClassDeclaration cd = oldcv.getClassDeclaration();
-      if ((cd != null) && (!SemanticVersioningUtils.isPropertyFile(cd))) {
-        
-        if (curFile == null) {
-          // the class we are scanning has been deleted from the current version of WAS
-          // This should be a major increase
-          major_reason.append(htmlTwoLineBreaks + "The class/interface " + getClassName(changeClass) + " has been deleted from the package." );
-          //majorChange.update(reason, changeClass);
-          is_major_change = true;
-          // only replace the fatal class if not set as the class won't be found in cmvc due to the fact it has been deleted.
-          if (fatal_class == null) {
-            fatal_class = changeClass;
-          }
-        } else {
-          // check for binary compatibility
-          // load the class from the current version of WAS
-          // remove it from the curClazz collection as we would like to know whether there are more classes added
-          curClazz.remove(file.getKey());
-          SemanticVersioningClassVisitor newcv = getVisitor(curFile, newJarsLoader);
-          // check for binary compatibility
-          ClassDeclaration newcd = newcv.getClassDeclaration();
-          BinaryCompatibilityStatus bcs = newcd.getBinaryCompatibleStatus(oldcv.getClassDeclaration());
-
-          if (!bcs.isCompatible()) {
-            major_reason.append(htmlTwoLineBreaks + "In the " + getClassName(changeClass)+ " class or its supers, the following changes have been made since the last release of WAS.");
-            // break binary compatibility
-            major_reason.append( bcs.getReason());
-            is_major_change = true;
-            fatal_class = changeClass;
-          } else {
-            //check to see whether more methods are added
-            ClassDeclaration oldcd = oldcv.getClassDeclaration();
-            Collection<MethodDeclaration> extraMethods = newcd.getExtraMethods(oldcd);
-
-            boolean containsConcrete = false;
-            boolean containsAbstract = false;
-
-            boolean abstractClass = newcd.isAbstract();
-
-            StringBuilder subRemarks = new StringBuilder();
-            String concreteSubRemarks = null;
-            for (MethodDeclaration extraMethod : extraMethods) {
-              //only interested in the visible methods not the system generated ones
-              if (!extraMethod.getName().contains("$")) {
-                if (abstractClass ) {
-                  if (extraMethod.isAbstract()) {
-                    foundNewAbstract = true;
-                    containsAbstract = true;
-                    subRemarks.append(htmlOneLineBreak + SemanticVersioningUtils.getReadableMethodSignature(extraMethod.getName(), extraMethod.getDesc()));
-                  } else {
-                    //only list one abstract method, no need to list all
-                    containsConcrete = true;
-                    concreteSubRemarks=htmlOneLineBreak + SemanticVersioningUtils.getReadableMethodSignature(extraMethod.getName(), extraMethod.getDesc());
-                  }
                 }
-                else {
-                  containsConcrete = true;
-                  concreteSubRemarks=htmlOneLineBreak + SemanticVersioningUtils.getReadableMethodSignature(extraMethod.getName(), extraMethod.getDesc());
-                  break;
+                // Need to write bundle element and then package elements
+                if ((!!!bundleVersionCorrect) || ((pkgElements.length() > 0))) {
+                    writeRecordToWriter(versionStatusFileWriter, bundleElement);
+                    writeRecordToWriter(versionStatusFileWriter, pkgElements.toString());
+                    writeRecordToWriter(versionStatusFileWriter, "</bundle>");
                 }
-              }
             }
-            
-            if (containsConcrete || containsAbstract) {
-              is_minor_change = true;
-              if (!is_major_change) {
-                fatal_class = changeClass;
-              }
-              if ( containsAbstract) {
-
-                minor_reason.append(htmlTwoLineBreaks + "In the " + getClassName(changeClass)+ " class or its supers, the following abstract methods have been added since the last release of WAS.");
-                minor_reason.append(subRemarks);
-              } else {
-                minor_reason.append(htmlTwoLineBreaks + "In the " + getClassName(changeClass)+ " class or its supers, the following method has been added since the last release of WAS.");
-                minor_reason.append(concreteSubRemarks);
-              }
-            }
-            //check to see whether there are extra public/protected fields if there is no additional methods
-              
-              if (!is_minor_change){
-                for (FieldDeclaration field : newcd.getExtraFields(oldcd)) {
-                  if (field.isPublic() || field.isProtected()) {
-                    is_minor_change = true;
-                    String extraFieldRemarks = htmlOneLineBreak + " " + SemanticVersioningUtils.transform(field.getDesc()) + " "+ field.getName() ;
-                    if (!is_major_change) {
-                      fatal_class = changeClass;
-                    }
-                    minor_reason.append(htmlTwoLineBreaks + "In the " + getClassName(changeClass)+ " class or its supers, the following fields have been added since the last release of WAS.");
-                    minor_reason.append(extraFieldRemarks);
+            writeRecordToWriter(versionStatusFileWriter, "</semanaticVersioning>");
+
+        } catch (IOException ioe) {
+            ioe.printStackTrace();
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            IOUtils.close(versionStatusFileWriter);
+        }
+
+        return;
+    }
+
+    /**
+     * Check whether the package has gained additional class or xsd files. If yes, log a minor change.
+     *
+     * @param pkgName
+     * @param curClazz
+     * @param curXsds
+     * @param minorChange
+     */
+    private void checkAdditionalClassOrXsds(String pkgName, Map<String, IFile> curClazz,
+                                            Map<String, IFile> curXsds, VersionChange minorChange) {
+        String reason;
+        Collection<IFile> ifiles = curClazz.values();
+        Iterator<IFile> iterator = ifiles.iterator();
+        while (iterator.hasNext()) {
+            IFile ifile = iterator.next();
+            String changeClass = ifile.getName();
+            SemanticVersioningClassVisitor cv = getVisitor(ifile, newJarsLoader);
+            if (cv.getClassDeclaration() != null) {
+                // If this is a public/protected class, it will need to increase the minor version of the package.
+                minorChange.setChange(true);
+                if (minorChange.isChange()) {
+                    reason = "The package " + pkgName + " has gained at least one class : " + getClassName(changeClass) + ".";
+                    minorChange.update(reason, changeClass, false);
                     break;
-                  }
                 }
-                
-              }
-            
-          }
-        }
-      }
-    }
-    if (is_major_change) {
-      majorChange.update(major_reason.toString(), fatal_class, false);
-    }
-    if (is_minor_change) {
-      minorChange.update(minor_reason.toString(), fatal_class, (foundNewAbstract? true: false));
-    }
-  }
-
-  private String readXsdFile(InputStream is) {
-    BufferedReader br = new BufferedReader( new InputStreamReader(is));
-    StringBuilder sb = new StringBuilder();
-    String line = null;
-    try {
-      while(( line = br.readLine()) != null) {
-        sb.append(line);
-      }
-    } catch (IOException ioe) {
-      IOUtils.close(br);
-    }
-    return sb.toString();
-  }
-  private void writeRecordToWriter(FileWriter fileWriter, String stringToWrite) throws IOException {
-    if (fileWriter != null) {
-      fileWriter.append(stringToWrite);
-      fileWriter.append("\r\n");
-    }
-  }
-  private Map<String, PackageContent> getAllExportedPkgContents(BundleInfo currentBundle)
-  {
-    String packageExports = currentBundle.getBundleManifest().getRawAttributes().getValue(Constants.EXPORT_PACKAGE);
-    List<NameValuePair> exportPackageLists = ManifestHeaderProcessor.parseExportString(packageExports);
-    // only perform validation if there are some packages exported. Otherwise, not interested.
-    Map<String, PackageContent> exportedPackages = new HashMap<String, PackageContent>();
-    if (!!!exportPackageLists.isEmpty()) {
-      File bundleFile = currentBundle.getBundle();
-      IDirectory bundleDir = FileSystem.getFSRoot(bundleFile);
-      for (NameValuePair exportedPackage : exportPackageLists) {
-        String packageName = exportedPackage.getName();
-        String packageVersion = exportedPackage.getAttributes().get(Constants.VERSION_ATTRIBUTE);
-        // need to go through each package and scan every class
-        exportedPackages.put(packageName, new PackageContent(packageName, packageVersion));
-      }
-      // scan the jar and list all the files under each package
-      List<IFile> allFiles = bundleDir.listAllFiles();
-      for (IFile file : allFiles) {
-        String directoryFullPath = file.getName(); 
-        String directoryName = null;
-        String fileName = null;
-        if (file.isFile() && ((file.getName().endsWith(SemanticVersioningUtils.classExt) ||(file.getName().endsWith(SemanticVersioningUtils.schemaExt))))) {
-          if (directoryFullPath.lastIndexOf("/") != -1) {
-            directoryName = directoryFullPath.substring(0, directoryFullPath.lastIndexOf("/"));
-            fileName = directoryFullPath.substring(directoryFullPath.lastIndexOf("/") + 1);
-          }
-        } 
-
-        if (directoryName != null) {
-          String pkgName = directoryName.replaceAll("/", ".") ;
-          PackageContent pkgContent = exportedPackages.get(pkgName);
-          if (pkgContent != null) {
-            if (file.getName().endsWith(SemanticVersioningUtils.classExt)) {
-              pkgContent.addClass(fileName, file);
+            }
+        }
+        if (!!!(minorChange.isChange() || curXsds.isEmpty())) {
+            /// a new xsd file was added, it is a minor change
+            IFile firstXsd = null;
+            Iterator<IFile> xsdIterator = curXsds.values().iterator();
+            firstXsd = xsdIterator.next();
+
+            reason = "In the package " + pkgName + ", The schema file(s) are added: " + curXsds.keySet() + ".";
+            minorChange.update(reason, firstXsd.getName(), false);
+        }
+    }
+
+
+    /**
+     * Check whether the package has xsd file changes or deleted. If yes, log a minor change.
+     *
+     * @param pkgName
+     * @param baseXsds
+     * @param curXsds
+     * @param majorChange
+     * @throws IOException
+     */
+
+    private void checkXsdChangesInPkg(String pkgName, Map<String, IFile> baseXsds,
+                                      Map<String, IFile> curXsds, VersionChange majorChange) throws IOException {
+        String reason;
+        for (Map.Entry<String, IFile> file : baseXsds.entrySet()) {
+            // scan the latest version of the class
+            IFile curXsd = curXsds.get(file.getKey());
+            String changeClass = file.getValue().getName();
+            // check whether the xsd have been deleted or changed or added
+            if (curXsd == null) {
+                reason = "In the package " + pkgName + ", The schema file has been deleted: " + file.getKey() + ".";
+                majorChange.update(reason, changeClass, false);
+                break;
             } else {
-              pkgContent.addXsd(fileName, file);
+                // check whether it is the same
+                //read the current xsd file
+                curXsds.remove(file.getKey());
+                String curFileContent = readXsdFile(curXsd.open());
+                String oldFileContent = readXsdFile(file.getValue().open());
+                if (!!!(curFileContent.equals(oldFileContent))) {
+
+                    reason = "In the package " + pkgName + ", The schema file has been updated: " + file.getKey() + ".";
+                    majorChange.update(reason, changeClass, false);
+                    break;
+                }
             }
-            exportedPackages.put(pkgName, pkgContent);
-          }
         }
-      }
     }
-    return exportedPackages;
-  }
 
-  private Map<String, BundleInfo> getBundles(IDirectory ds)
-  {
-    Map<String, BundleInfo> bundles = new HashMap<String, BundleInfo>();
-    List<IFile> includedFiles = ds.listAllFiles();
+    /**
+     * Visit the whole package to scan each class to see whether we need to log minor or major changes.
+     *
+     * @param pkgName
+     * @param baseClazz
+     * @param curClazz
+     * @param majorChange
+     * @param minorChange
+     */
+    private void visitPackage(String pkgName, Map<String, IFile> baseClazz,
+                              Map<String, IFile> curClazz, VersionChange majorChange, VersionChange minorChange) {
+        StringBuilder major_reason = new StringBuilder();
+        StringBuilder minor_reason = new StringBuilder();
+        boolean is_major_change = false;
+        boolean is_minor_change = false;
+        String fatal_class = null;
+        boolean foundNewAbstract = false;
+        for (Map.Entry<String, IFile> file : baseClazz.entrySet()) {
+            // scan the latest version of the class
+            IFile curFile = curClazz.get(file.getKey());
+            String changeClass = file.getValue().getName();
+            //Scan the base version
+            SemanticVersioningClassVisitor oldcv = getVisitor(file.getValue(), oldJarsLoader);
+            // skip the property files as they are compiled as class file as well
+            ClassDeclaration cd = oldcv.getClassDeclaration();
+            if ((cd != null) && (!SemanticVersioningUtils.isPropertyFile(cd))) {
+
+                if (curFile == null) {
+                    // the class we are scanning has been deleted from the current version of WAS
+                    // This should be a major increase
+                    major_reason.append(htmlTwoLineBreaks + "The class/interface " + getClassName(changeClass) + " has been deleted from the package.");
+                    //majorChange.update(reason, changeClass);
+                    is_major_change = true;
+                    // only replace the fatal class if not set as the class won't be found in cmvc due to the fact it has been deleted.
+                    if (fatal_class == null) {
+                        fatal_class = changeClass;
+                    }
+                } else {
+                    // check for binary compatibility
+                    // load the class from the current version of WAS
+                    // remove it from the curClazz collection as we would like to know whether there are more classes added
+                    curClazz.remove(file.getKey());
+                    SemanticVersioningClassVisitor newcv = getVisitor(curFile, newJarsLoader);
+                    // check for binary compatibility
+                    ClassDeclaration newcd = newcv.getClassDeclaration();
+                    BinaryCompatibilityStatus bcs = newcd.getBinaryCompatibleStatus(oldcv.getClassDeclaration());
+
+                    if (!bcs.isCompatible()) {
+                        major_reason.append(htmlTwoLineBreaks + "In the " + getClassName(changeClass) + " class or its supers, the following changes have been made since the last release of WAS.");
+                        // break binary compatibility
+                        major_reason.append(bcs.getReason());
+                        is_major_change = true;
+                        fatal_class = changeClass;
+                    } else {
+                        //check to see whether more methods are added
+                        ClassDeclaration oldcd = oldcv.getClassDeclaration();
+                        Collection<MethodDeclaration> extraMethods = newcd.getExtraMethods(oldcd);
+
+                        boolean containsConcrete = false;
+                        boolean containsAbstract = false;
+
+                        boolean abstractClass = newcd.isAbstract();
+
+                        StringBuilder subRemarks = new StringBuilder();
+                        String concreteSubRemarks = null;
+                        for (MethodDeclaration extraMethod : extraMethods) {
+                            //only interested in the visible methods not the system generated ones
+                            if (!extraMethod.getName().contains("$")) {
+                                if (abstractClass) {
+                                    if (extraMethod.isAbstract()) {
+                                        foundNewAbstract = true;
+                                        containsAbstract = true;
+                                        subRemarks.append(htmlOneLineBreak + SemanticVersioningUtils.getReadableMethodSignature(extraMethod.getName(), extraMethod.getDesc()));
+                                    } else {
+                                        //only list one abstract method, no need to list all
+                                        containsConcrete = true;
+                                        concreteSubRemarks = htmlOneLineBreak + SemanticVersioningUtils.getReadableMethodSignature(extraMethod.getName(), extraMethod.getDesc());
+                                    }
+                                } else {
+                                    containsConcrete = true;
+                                    concreteSubRemarks = htmlOneLineBreak + SemanticVersioningUtils.getReadableMethodSignature(extraMethod.getName(), extraMethod.getDesc());
+                                    break;
+                                }
+                            }
+                        }
+
+                        if (containsConcrete || containsAbstract) {
+                            is_minor_change = true;
+                            if (!is_major_change) {
+                                fatal_class = changeClass;
+                            }
+                            if (containsAbstract) {
+
+                                minor_reason.append(htmlTwoLineBreaks + "In the " + getClassName(changeClass) + " class or its supers, the following abstract methods have been added since the last release of WAS.");
+                                minor_reason.append(subRemarks);
+                            } else {
+                                minor_reason.append(htmlTwoLineBreaks + "In the " + getClassName(changeClass) + " class or its supers, the following method has been added since the last release of WAS.");
+                                minor_reason.append(concreteSubRemarks);
+                            }
+                        }
+                        //check to see whether there are extra public/protected fields if there is no additional methods
+
+                        if (!is_minor_change) {
+                            for (FieldDeclaration field : newcd.getExtraFields(oldcd)) {
+                                if (field.isPublic() || field.isProtected()) {
+                                    is_minor_change = true;
+                                    String extraFieldRemarks = htmlOneLineBreak + " " + SemanticVersioningUtils.transform(field.getDesc()) + " " + field.getName();
+                                    if (!is_major_change) {
+                                        fatal_class = changeClass;
+                                    }
+                                    minor_reason.append(htmlTwoLineBreaks + "In the " + getClassName(changeClass) + " class or its supers, the following fields have been added since the last release of WAS.");
+                                    minor_reason.append(extraFieldRemarks);
+                                    break;
+                                }
+                            }
 
-    for (IFile ifile : includedFiles) {
+                        }
 
+                    }
+                }
+            }
+        }
+        if (is_major_change) {
+            majorChange.update(major_reason.toString(), fatal_class, false);
+        }
+        if (is_minor_change) {
+            minorChange.update(minor_reason.toString(), fatal_class, (foundNewAbstract ? true : false));
+        }
+    }
 
-      
-      if (ifile.getName().endsWith(SemanticVersioningUtils.jarExt)) {
-        // scan its manifest
+    private String readXsdFile(InputStream is) {
+        BufferedReader br = new BufferedReader(new InputStreamReader(is));
+        StringBuilder sb = new StringBuilder();
+        String line = null;
         try {
-        BundleManifest manifest = BundleManifest.fromBundle(ifile.open());
-        // find the bundle symbolic name, store them in a map with bundle symbolic name as key, bundleInfo as value
-        if (manifest.getSymbolicName() != null) {
-          
-          bundles.put(manifest.getSymbolicName(), new BundleInfo(manifest, new File(ifile.toURL().getPath())));
-          
+            while ((line = br.readLine()) != null) {
+                sb.append(line);
+            }
+        } catch (IOException ioe) {
+            IOUtils.close(br);
+        }
+        return sb.toString();
+    }
+
+    private void writeRecordToWriter(FileWriter fileWriter, String stringToWrite) throws IOException {
+        if (fileWriter != null) {
+            fileWriter.append(stringToWrite);
+            fileWriter.append("\r\n");
+        }
+    }
+
+    private Map<String, PackageContent> getAllExportedPkgContents(BundleInfo currentBundle) {
+        String packageExports = currentBundle.getBundleManifest().getRawAttributes().getValue(Constants.EXPORT_PACKAGE);
+        List<NameValuePair> exportPackageLists = ManifestHeaderProcessor.parseExportString(packageExports);
+        // only perform validation if there are some packages exported. Otherwise, not interested.
+        Map<String, PackageContent> exportedPackages = new HashMap<String, PackageContent>();
+        if (!!!exportPackageLists.isEmpty()) {
+            File bundleFile = currentBundle.getBundle();
+            IDirectory bundleDir = FileSystem.getFSRoot(bundleFile);
+            for (NameValuePair exportedPackage : exportPackageLists) {
+                String packageName = exportedPackage.getName();
+                String packageVersion = exportedPackage.getAttributes().get(Constants.VERSION_ATTRIBUTE);
+                // need to go through each package and scan every class
+                exportedPackages.put(packageName, new PackageContent(packageName, packageVersion));
+            }
+            // scan the jar and list all the files under each package
+            List<IFile> allFiles = bundleDir.listAllFiles();
+            for (IFile file : allFiles) {
+                String directoryFullPath = file.getName();
+                String directoryName = null;
+                String fileName = null;
+                if (file.isFile() && ((file.getName().endsWith(SemanticVersioningUtils.classExt) || (file.getName().endsWith(SemanticVersioningUtils.schemaExt))))) {
+                    if (directoryFullPath.lastIndexOf("/") != -1) {
+                        directoryName = directoryFullPath.substring(0, directoryFullPath.lastIndexOf("/"));
+                        fileName = directoryFullPath.substring(directoryFullPath.lastIndexOf("/") + 1);
+                    }
+                }
+
+                if (directoryName != null) {
+                    String pkgName = directoryName.replaceAll("/", ".");
+                    PackageContent pkgContent = exportedPackages.get(pkgName);
+                    if (pkgContent != null) {
+                        if (file.getName().endsWith(SemanticVersioningUtils.classExt)) {
+                            pkgContent.addClass(fileName, file);
+                        } else {
+                            pkgContent.addXsd(fileName, file);
+                        }
+                        exportedPackages.put(pkgName, pkgContent);
+                    }
+                }
+            }
+        }
+        return exportedPackages;
+    }
+
+    private Map<String, BundleInfo> getBundles(IDirectory ds) {
+        Map<String, BundleInfo> bundles = new HashMap<String, BundleInfo>();
+        List<IFile> includedFiles = ds.listAllFiles();
+
+        for (IFile ifile : includedFiles) {
+
+
+            if (ifile.getName().endsWith(SemanticVersioningUtils.jarExt)) {
+                // scan its manifest
+                try {
+                    BundleManifest manifest = BundleManifest.fromBundle(ifile.open());
+                    // find the bundle symbolic name, store them in a map with bundle symbolic name as key, bundleInfo as value
+                    if (manifest.getSymbolicName() != null) {
+
+                        bundles.put(manifest.getSymbolicName(), new BundleInfo(manifest, new File(ifile.toURL().getPath())));
+
+                    }
+                } catch (MalformedURLException mue) {
+                    _logger.debug("Exception thrown when processing" + ifile.getName(), mue);
+                } catch (IOException ioe) {
+                    _logger.debug("Exception thrown when processing" + ifile.getName(), ioe);
+                }
+            }
         }
-        } catch (MalformedURLException mue) {
-          _logger.debug("Exception thrown when processing" + ifile.getName(), mue);
+        return bundles;
+    }
+
+    private String getStatusText(VERSION_CHANGE_TYPE status, String oldVersionStr, String newVersionStr) {
+
+        Version oldVersion = Version.parseVersion(oldVersionStr);
+        Version newVersion = Version.parseVersion(newVersionStr);
+        Version recommendedVersion = Version.parseVersion(oldVersionStr);
+        if (status == VERSION_CHANGE_TYPE.MAJOR_CHANGE) {
+            recommendedVersion = new Version(oldVersion.getMajor() + 1, 0, 0);
+        } else if (status == VERSION_CHANGE_TYPE.MINOR_CHANGE) {
+            recommendedVersion = new Version(oldVersion.getMajor(), oldVersion.getMinor() + 1, 0);
+        } else {
+            recommendedVersion = oldVersion;
+        }
+        return " oldVersion=\"" + oldVersion
+                + "\" currentVersion=\"" + newVersion +
+                "\" recommendedVersion=\"" + recommendedVersion + "\" correct=\"" + isVersionCorrect(status, oldVersionStr, newVersionStr);
+    }
+
+    private String transformForXml(String str) {
+        str = str.replaceAll("<", "&lt;");
+        str = str.replaceAll(">", "&gt;");
+        return str;
+    }
+
+    private boolean isVersionCorrect(VERSION_CHANGE_TYPE status, String oldVersionStr, String newVersionStr) {
+        boolean versionCorrect = false;
+
+        Version oldVersion = Version.parseVersion(oldVersionStr);
+        Version newVersion = Version.parseVersion(newVersionStr);
+
+        if (status == VERSION_CHANGE_TYPE.MAJOR_CHANGE) {
+            if (newVersion.getMajor() > oldVersion.getMajor()) {
+                versionCorrect = true;
+            }
+        } else if (status == VERSION_CHANGE_TYPE.MINOR_CHANGE) {
+            if ((newVersion.getMajor() > oldVersion.getMajor()) || (newVersion.getMinor() > oldVersion.getMinor())) {
+                versionCorrect = true;
+            }
+        } else {
+            if ((newVersion.getMajor() == oldVersion.getMajor()) && (newVersion.getMinor() == oldVersion.getMinor())) {
+                versionCorrect = true;
+            }
+        }
+        return versionCorrect;
+    }
+
+    private String getPkgStatusText(String pkgName, VERSION_CHANGE_TYPE status, String oldVersionStr, String newVersionStr, String reason, String key_class) {
+
+        String modified_key_class = key_class;
+        if (key_class.endsWith(SemanticVersioningUtils.classExt)) {
+            modified_key_class = key_class.substring(0, key_class.lastIndexOf(SemanticVersioningUtils.classExt)) + SemanticVersioningUtils.javaExt;
+        }
+
+        return "<package name=\"" + pkgName + "\"" + getStatusText(status, oldVersionStr, newVersionStr) + "\" reason=\"" + transformForXml(reason) + "\" key_class=\"" + modified_key_class + "\" change=\"" + status.text() + "\"/>";
+    }
+
+    private String getBundleStatusText(String bundleFileName, String bundleSymbolicName, VERSION_CHANGE_TYPE status, String oldVersionStr, String newVersionStr, String reason) {
+        return "<bundle fileName=\"" + bundleFileName + "\" bundleSymbolicName =\"" + bundleSymbolicName + "\"" + getStatusText(status, oldVersionStr, newVersionStr) + "\" reason=\"" + transformForXml(reason) + "\" change=\"" + status.text() + "\">";
+    }
+
+    private SemanticVersioningClassVisitor getVisitor(IFile file, URLClassLoader loader) {
+        SemanticVersioningClassVisitor oldcv = new SemanticVersioningClassVisitor(loader);
+        try {
+            ClassReader cr = new ClassReader(file.open());
+            cr.accept(oldcv, 0);
         } catch (IOException ioe) {
-          _logger.debug("Exception thrown when processing" + ifile.getName(), ioe);
+            _logger.debug("The file " + file + "cannot be opened.");
         }
-      }
+        return oldcv;
     }
-    return bundles;
-  }
 
-  private String getStatusText( VERSION_CHANGE_TYPE status, String oldVersionStr, String newVersionStr) {
+    private Collection<URL> getListURLs(Collection<BundleInfo> bundles) {
+        Collection<URL> urls = new HashSet<URL>();
+        try {
+            for (BundleInfo bundle : bundles) {
+
+                URL url = bundle.getBundle().toURI().toURL();
+                urls.add(url);
+
+            }
 
-    Version oldVersion = Version.parseVersion(oldVersionStr);
-    Version newVersion = Version.parseVersion(newVersionStr);
-    Version recommendedVersion = Version.parseVersion(oldVersionStr);
-    if (status == VERSION_CHANGE_TYPE.MAJOR_CHANGE) {
-      recommendedVersion = new Version(oldVersion.getMajor() + 1, 0, 0);
-    } else if (status == VERSION_CHANGE_TYPE.MINOR_CHANGE) {
-      recommendedVersion = new Version(oldVersion.getMajor(), oldVersion.getMinor() + 1,  0);
-    } else {
-      recommendedVersion = oldVersion;
-    }
-    return " oldVersion=\"" + oldVersion 
-    + "\" currentVersion=\"" + newVersion +
-    "\" recommendedVersion=\"" + recommendedVersion + "\" correct=\"" + isVersionCorrect(status, oldVersionStr, newVersionStr);
-  }
-
-  private String transformForXml(String str){
-    str = str.replaceAll("<", "&lt;");
-    str = str.replaceAll(">", "&gt;");
-    return str;
-  }
-  private boolean isVersionCorrect(VERSION_CHANGE_TYPE status, String oldVersionStr, String newVersionStr) {
-    boolean versionCorrect = false;
-
-    Version oldVersion = Version.parseVersion(oldVersionStr);
-    Version newVersion = Version.parseVersion(newVersionStr);
-
-    if (status == VERSION_CHANGE_TYPE.MAJOR_CHANGE) {
-      if (newVersion.getMajor() > oldVersion.getMajor()) {
-        versionCorrect = true;
-      }
-    } else if (status == VERSION_CHANGE_TYPE.MINOR_CHANGE){
-      if ((newVersion.getMajor() > oldVersion.getMajor()) || ( newVersion.getMinor() > oldVersion.getMinor())) {
-        versionCorrect = true;
-      }
-    } else {
-      if ((newVersion.getMajor() == oldVersion.getMajor()) && (newVersion.getMinor() == oldVersion.getMinor())) {
-        versionCorrect = true;
-      }
-    }
-    return versionCorrect;
-  }
-
-  private String getPkgStatusText(String pkgName,  VERSION_CHANGE_TYPE status, String oldVersionStr, String newVersionStr,  String reason, String key_class) {
-
-    String modified_key_class = key_class;
-    if (key_class.endsWith(SemanticVersioningUtils.classExt)) {
-      modified_key_class = key_class.substring(0, key_class.lastIndexOf(SemanticVersioningUtils.classExt)) + SemanticVersioningUtils.javaExt;
-    }
-
-    return   "<package name=\"" + pkgName + "\"" +  getStatusText(status, oldVersionStr, newVersionStr) + "\" reason=\""  +transformForXml(reason) + "\" key_class=\"" + modified_key_class +  "\" change=\"" + status.text() + "\"/>";
-  }
-
-  private String getBundleStatusText(String bundleFileName, String bundleSymbolicName, VERSION_CHANGE_TYPE status, String oldVersionStr, String newVersionStr, String reason) {
-    return "<bundle fileName=\"" + bundleFileName + "\" bundleSymbolicName =\"" + bundleSymbolicName + "\"" + getStatusText(status, oldVersionStr, newVersionStr) + "\" reason=\"" + transformForXml(reason) + "\" change=\"" + status.text() + "\">";
-  }
-
-  private SemanticVersioningClassVisitor getVisitor(IFile file, URLClassLoader loader ) {
-    SemanticVersioningClassVisitor oldcv = new SemanticVersioningClassVisitor(loader);
-    try {
-      ClassReader cr = new ClassReader(file.open());
-      cr.accept(oldcv, 0);
-    } catch (IOException ioe) {
-      _logger.debug("The file " + file + "cannot be opened.");
-    }
-    return oldcv; 
-  }
-
-  private Collection<URL> getListURLs(Collection<BundleInfo> bundles){
-    Collection<URL> urls = new HashSet<URL>();
-    try {
-      for (BundleInfo bundle : bundles) {
-
-        URL url = bundle.getBundle().toURI().toURL();
-        urls.add(url);
-
-      }
-
-    } catch (MalformedURLException e) {
-      _logger.debug(e.getMessage());
-    }
-    return urls;
-  }
-
-  private String getClassName(String fullClassPath) {
-    String[] chunks = fullClassPath.split("/");
-    String className = chunks[chunks.length - 1];
-    className = className.replace(SemanticVersioningUtils.classExt, SemanticVersioningUtils.javaExt);
-    return className;
-  }
-
-  private class BundleInfo {
-    private final BundleManifest bundleManifest;
-    private final File bundle;
-    BundleInfo(BundleManifest bm, File bundle) {
-      this.bundleManifest =bm;
-      this.bundle = bundle;
-    }
-    public BundleManifest getBundleManifest()
-    {
-      return bundleManifest;
-    }
-    public File getBundle()
-    {
-      return bundle;
-    }
-  }
-  enum VERSION_CHANGE_TYPE { MAJOR_CHANGE("major"), MINOR_CHANGE("minor"), NO_CHANGE("no");
-  private final String text;
-  VERSION_CHANGE_TYPE(String text) {
-    this.text = text;
-  }
-  public String text() {
-    return this.text;
-  }
+        } catch (MalformedURLException e) {
+            _logger.debug(e.getMessage());
+        }
+        return urls;
+    }
 
-  };
+    private String getClassName(String fullClassPath) {
+        String[] chunks = fullClassPath.split("/");
+        String className = chunks[chunks.length - 1];
+        className = className.replace(SemanticVersioningUtils.classExt, SemanticVersioningUtils.javaExt);
+        return className;
+    }
 
-  private class PackageContent {
-    private final String  packageName;
+    private class BundleInfo {
+        private final BundleManifest bundleManifest;
+        private final File bundle;
+
+        BundleInfo(BundleManifest bm, File bundle) {
+            this.bundleManifest = bm;
+            this.bundle = bundle;
+        }
+
+        public BundleManifest getBundleManifest() {
+            return bundleManifest;
+        }
+
+        public File getBundle() {
+            return bundle;
+        }
+    }
+
+    enum VERSION_CHANGE_TYPE {
+        MAJOR_CHANGE("major"), MINOR_CHANGE("minor"), NO_CHANGE("no");
+        private final String text;
+        VERSION_CHANGE_TYPE(String text)
+        {
+            this.text = text;
+        }
+
+    public String text() {
+        return this.text;
+    }
+
+};
+
+private class PackageContent {
+    private final String packageName;
     private final String packageVersion;
     private final Map<String, IFile> classes = new HashMap<String, IFile>();
     private final Map<String, IFile> xsds = new HashMap<String, IFile>();
+
     PackageContent(String pkgName, String pkgVersion) {
-      packageName = pkgName;
-      packageVersion = pkgVersion;
+        packageName = pkgName;
+        packageVersion = pkgVersion;
     }
+
     public void addClass(String className, IFile file) {
-      classes.put(className, file);
+        classes.put(className, file);
     }
+
     public void addXsd(String className, IFile file) {
-      xsds.put(className, file);
+        xsds.put(className, file);
     }
-    public Map<String, IFile> getClasses () {
-      return classes;
+
+    public Map<String, IFile> getClasses() {
+        return classes;
     }
-    public Map<String, IFile> getXsds () {
-      return xsds;
+
+    public Map<String, IFile> getXsds() {
+        return xsds;
     }
 
-    public String getPackageVersion()
-    {
-      return packageVersion;
+    public String getPackageVersion() {
+        return packageVersion;
     }
+
     public String getPackageName() {
-      return packageName;
+        return packageName;
     }
-  }
+}
 
-  private class VersionChange {
+private class VersionChange {
     boolean change = false;
-    String reason= null;
+    String reason = null;
     String changeClass = null;
     boolean moreAbstractMethod = false;
-    
-    
-    public boolean isMoreAbstractMethod()
-    {
-      return moreAbstractMethod;
-    }
-    public boolean isChange()
-    {
-      return change;
-    }
-    public void setChange(boolean change)
-    {
-      this.change = change;
-    }
-    public String getReason()
-    {
-      return reason;
-    }
-    public String getChangeClass()
-    {
-      return changeClass;
+
+
+    public boolean isMoreAbstractMethod() {
+        return moreAbstractMethod;
+    }
+
+    public boolean isChange() {
+        return change;
     }
+
+    public void setChange(boolean change) {
+        this.change = change;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    public String getChangeClass() {
+        return changeClass;
+    }
+
     public void update(String reason, String changeClass, boolean moreAbstractMethod) {
-      this.change = true;
-      this.reason = reason;
-      this.changeClass = changeClass;
-      this.moreAbstractMethod = moreAbstractMethod;
+        this.change = true;
+        this.reason = reason;
+        this.changeClass = changeClass;
+        this.moreAbstractMethod = moreAbstractMethod;
     }
-  }
+}
 
 }

Modified: aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/BinaryCompatibilityStatus.java
URL: http://svn.apache.org/viewvc/aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/BinaryCompatibilityStatus.java?rev=1235095&r1=1235094&r2=1235095&view=diff
==============================================================================
--- aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/BinaryCompatibilityStatus.java (original)
+++ aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/BinaryCompatibilityStatus.java Tue Jan 24 00:53:25 2012
@@ -18,49 +18,44 @@
  */
 package org.apache.aries.versioning.utils;
 
-public class BinaryCompatibilityStatus
-{
-  private final boolean compatible;
-  private final String reason;
-  
-  public BinaryCompatibilityStatus(boolean compatible, String reason) {
-    this.compatible = compatible;
-    this.reason = reason;
-  }
-
-  public boolean isCompatible()
-  {
-    return compatible;
-  }
-
-  public String getReason()
-  {
-    return reason;
-  }
-
-  @Override
-  public int hashCode()
-  {
-    final int prime = 31;
-    int result = 1;
-    result = prime * result + (compatible ? 1231 : 1237);
-    result = prime * result + ((reason == null) ? 0 : reason.hashCode());
-    return result;
-  }
-
-  @Override
-  public boolean equals(Object obj)
-  {
-    if (this == obj) return true;
-    if (obj == null) return false;
-    if (getClass() != obj.getClass()) return false;
-    BinaryCompatibilityStatus other = (BinaryCompatibilityStatus) obj;
-    if (compatible != other.compatible) return false;
-    if (reason == null) {
-      if (other.reason != null) return false;
-    } else if (!reason.equals(other.reason)) return false;
-    return true;
-  }
-  
+public class BinaryCompatibilityStatus {
+    private final boolean compatible;
+    private final String reason;
+
+    public BinaryCompatibilityStatus(boolean compatible, String reason) {
+        this.compatible = compatible;
+        this.reason = reason;
+    }
+
+    public boolean isCompatible() {
+        return compatible;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + (compatible ? 1231 : 1237);
+        result = prime * result + ((reason == null) ? 0 : reason.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) return true;
+        if (obj == null) return false;
+        if (getClass() != obj.getClass()) return false;
+        BinaryCompatibilityStatus other = (BinaryCompatibilityStatus) obj;
+        if (compatible != other.compatible) return false;
+        if (reason == null) {
+            if (other.reason != null) return false;
+        } else if (!reason.equals(other.reason)) return false;
+        return true;
+    }
+
 
 }