Title: [40979] trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity: Trying to fix the build failure issue.

Diff

Modified: trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/Profiler.java (40978 => 40979)


--- trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/Profiler.java	2013-08-14 11:07:27 UTC (rev 40978)
+++ trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/Profiler.java	2013-08-30 04:45:27 UTC (rev 40979)
@@ -90,7 +90,6 @@
 
 	public static void initialize(final IDataBase dataBase) {
 		long snapshptInterval = Configuration.getConfiguration().getSnapshotInterval();
-		LOGGER.error("Profiler initialize : " + dataBase + ", " + snapshptInterval);
 		if (snapshptInterval > 0) {
 			Timer timer = new Timer();
 			TimerTask timerTask = new TimerTask() {
@@ -107,7 +106,6 @@
 			timer.schedule(timerTask, snapshptInterval, snapshptInterval);
 		}
 		long reportInterval = Configuration.getConfiguration().getReportInterval();
-		LOGGER.error("Profiler initialize : " + dataBase + ", " + reportInterval);
 		if (reportInterval > 0) {
 			Timer timer = new Timer();
 			TimerTask timerTask = new TimerTask() {
@@ -123,6 +121,7 @@
 			};
 			timer.schedule(timerTask, snapshptInterval, snapshptInterval);
 		}
+		LOGGER.info("Profiler initialize : " + dataBase + ", " + snapshptInterval + ", " + reportInterval);
 		TIME_UNIT_DENOMINATOR = Configuration.getConfiguration().getTimeUnitDenominator();
 	}
 

Modified: trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/Transformer.java (40978 => 40979)


--- trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/Transformer.java	2013-08-14 11:07:27 UTC (rev 40978)
+++ trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/Transformer.java	2013-08-30 04:45:27 UTC (rev 40979)
@@ -65,9 +65,9 @@
 		if (!INITIALISED) {
 			INITIALISED = true;
 			LoggingConfigurator.configure();
+			LOGGER = Logger.getLogger(Transformer.class);
 			CLASS_ADAPTER_CLASSES = Configuration.getConfiguration().classAdapters.toArray(new Class[Configuration.getConfiguration().classAdapters.size()]);
-			LOGGER = Logger.getLogger(Transformer.class);
-			LOGGER.error("Starting Serenity : ");
+			LOGGER.info("Starting Serenity : ");
 			if (instrumentation != null) {
 				instrumentation.addTransformer(new Transformer());
 			}
@@ -93,7 +93,7 @@
 			Profiler.initialize(ramDataBase);
 			new Listener(null, ramDataBase).execute();
 			addShutdownHook(ramDataBase);
-			LOGGER.error("Finished initializing Serenity : ");
+			LOGGER.info("Finished initializing Serenity : ");
 		}
 	}
 
@@ -106,27 +106,27 @@
 		shutdownHook = new Thread() {
 			public void run() {
 				Date start = new Date();
-				LOGGER.warn("Starting accumulation : " + start);
+				LOGGER.info("Starting accumulation : " + start);
 
 				long processStart = System.currentTimeMillis();
 				new Accumulator(null).execute();
-				LOGGER.warn("Accumlulator : " + (System.currentTimeMillis() - processStart));
+				LOGGER.info("Accumlulator : " + (System.currentTimeMillis() - processStart));
 
 				processStart = System.currentTimeMillis();
 				new Cleaner(null, dataBase).execute();
-				LOGGER.warn("Cleaner : " + (System.currentTimeMillis() - processStart));
+				LOGGER.info("Cleaner : " + (System.currentTimeMillis() - processStart));
 
 				processStart = System.currentTimeMillis();
 				new Aggregator(null, dataBase).execute();
-				LOGGER.warn("Aggregator : " + (System.currentTimeMillis() - processStart));
+				LOGGER.info("Aggregator : " + (System.currentTimeMillis() - processStart));
 
 				processStart = System.currentTimeMillis();
 				new Reporter(null, dataBase).execute();
-				LOGGER.warn("Reporter : " + (System.currentTimeMillis() - processStart));
+				LOGGER.info("Reporter : " + (System.currentTimeMillis() - processStart));
 
 				processStart = System.currentTimeMillis();
 				dataBase.close();
-				LOGGER.warn("Close database : " + (System.currentTimeMillis() - processStart));
+				LOGGER.info("Close database : " + (System.currentTimeMillis() - processStart));
 
 				String dumpData = Configuration.getConfiguration().getProperty(IConstants.DUMP);
 				if (dumpData != null && "true".equals(dumpData.trim())) {
@@ -136,8 +136,8 @@
 				Date end = new Date();
 				long million = 1000 * 1000;
 				long duration = end.getTime() - start.getTime();
-				LOGGER.warn("Finished accumulation : " + end + ", duration : " + duration + " millis");
-				LOGGER.warn("Total memory : " + (Runtime.getRuntime().totalMemory() / million) + ", max memory : "
+				LOGGER.info("Finished accumulation : " + end + ", duration : " + duration + " millis");
+				LOGGER.info("Total memory : " + (Runtime.getRuntime().totalMemory() / million) + ", max memory : "
 						+ (Runtime.getRuntime().maxMemory() / million) + ", free memory : " + (Runtime.getRuntime().freeMemory() / million));
 			}
 		};

Modified: trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/hudson/SerenityPublisher.java (40978 => 40979)


--- trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/hudson/SerenityPublisher.java	2013-08-14 11:07:27 UTC (rev 40978)
+++ trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/hudson/SerenityPublisher.java	2013-08-30 04:45:27 UTC (rev 40979)
@@ -40,12 +40,12 @@
 import com.ikokoon.toolkit.LoggingConfigurator;
 
 /**
- * This class runs at the end of the build, called by Hudson. The purpose is to copy the database files from the output directories for each module in
- * the case of Maven and Ant builds to the output directory for the build for display in the Hudson front end plugin. As well as this the source that
- * was found for the project is copied to the source directory where the front end can access it.
- *
+ * This class runs at the end of the build, called by Hudson. The purpose is to copy the database files from the output directories for each module in the case
+ * of Maven and Ant builds to the output directory for the build for display in the Hudson front end plugin. As well as this the source that was found for the
+ * project is copied to the source directory where the front end can access it.
+ * 
  * Once all the database files are copied to a location on the local machine then they are merged together and pruned.
- *
+ * 
  * @author Michael Couck
  * @since 12.07.09
  * @version 01.00
@@ -55,7 +55,7 @@
 
 	/**
 	 * The file filter that matches all the files available. We'll filter then later.
-	 *
+	 * 
 	 * @author Michael Couck
 	 * @since 12.05.10
 	 * @version 01.00
@@ -75,7 +75,7 @@
 	private static final String SERENITY_ODB_REGEX = ".*serenity.odb";
 	private static final String SERENITY_SOURCE_REGEX = ".*serenity.*.source.*";
 	/** The LOGGER. */
-	protected static Logger logger = Logger.getLogger(SerenityPublisher.class);
+	protected static Logger LOGGER = Logger.getLogger(SerenityPublisher.class);
 	/** The description for Hudson. */
 	@Extension
 	public static final DescriptorImpl DESCRIPTOR = new DescriptorImpl();
@@ -90,200 +90,226 @@
 	@Override
 	public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener buildListener) throws InterruptedException, IOException {
 		PrintStream printStream = buildListener.getLogger();
-		printStream.println("Publishing Serenity reports...");
-		if (!Result.SUCCESS.equals(build.getResult())) {
-			printStream.println("Build was not successful... but will still try to publish the report");
-		}
+		try {
+			printStream.println("Publishing Serenity reports...");
+			if (!Result.SUCCESS.equals(build.getResult())) {
+				printStream.println("Build was not successful... but will still try to publish the report");
+			}
 
-		// Copy the source for the Java files to the build directory
-		copySourceToBuildDirectory(build, buildListener);
+			// Copy the source for the Java files to the build directory
+			copySourceToBuildDirectory(build, buildListener);
 
-		// Copy the database files from the output directories to the build directory. and
-		// merge them and then aggregate all the data, then prune the data
-		IDataBase targetDataBase = copyDataBasesToBuildDirectory(build, buildListener);
-		aggregate(build, buildListener, targetDataBase);
-		prune(build, buildListener, targetDataBase);
-		targetDataBase.close();
+			// Copy the database files from the output directories to the build directory. and
+			// merge them and then aggregate all the data, then prune the data
+			IDataBase targetDataBase = copyDataBasesToBuildDirectory(build, buildListener);
+			aggregate(build, buildListener, targetDataBase);
+			prune(build, buildListener, targetDataBase);
+			targetDataBase.close();
 
-		printStream.println("Publishing the Serenity results...");
-		ISerenityResult result = new SerenityResult(build);
-		SerenityBuildAction buildAction = new SerenityBuildAction(build, result);
-		build.getActions().add(buildAction);
+			printStream.println("Publishing the Serenity results...");
+			ISerenityResult result = new SerenityResult(build);
+			SerenityBuildAction buildAction = new SerenityBuildAction(build, result);
+			build.getActions().add(buildAction);
+		} catch (Exception e) {
+			LOGGER.error(null, e);
+			// buildListener.error(e.getMessage());
+			printStream.println(e.getMessage());
+		}
 
 		return true;
 	}
 
 	/**
-	 * Scans the output directory for the project and locates all the database files. These files are then copied to a local file in the user temp
-	 * directory. The databases are merged into the main database.
-	 *
-	 * @param build
-	 *            the build for this project
-	 * @param buildListener
-	 *            the listener of the build
+	 * Scans the output directory for the project and locates all the database files. These files are then copied to a local file in the user temp directory.
+	 * The databases are merged into the main database.
+	 * 
+	 * @param build the build for this project
+	 * @param buildListener the listener of the build
 	 * @return the primary database file for the final result
 	 * @throws InterruptedException
 	 * @throws IOException
 	 */
 	private IDataBase copyDataBasesToBuildDirectory(AbstractBuild<?, ?> build, BuildListener buildListener) throws InterruptedException, IOException {
 		final PrintStream printStream = buildListener.getLogger();
+		IDataBase targetDataBase = null;
 
-		File buildDirectory = build.getRootDir();
-		printStream.println("Build directory...  " + buildDirectory);
-		File targetDataBaseFile = new File(buildDirectory, IConstants.DATABASE_FILE_ODB);
-		printStream.println("Target database... " + targetDataBaseFile);
+		try {
+			File buildDirectory = build.getRootDir();
+			printStream.println("Build directory...  " + buildDirectory);
+			File targetDataBaseFile = new File(buildDirectory, IConstants.DATABASE_FILE_ODB);
+			printStream.println("Target database... " + targetDataBaseFile);
 
-		// Create the final output database file for the build
-		String targetPath = targetDataBaseFile.getAbsolutePath();
-		IDataBase odbDataBase = IDataBase.DataBaseManager.getDataBase(DataBaseOdb.class, targetPath, null);
-		IDataBase targetDataBase = IDataBase.DataBaseManager.getDataBase(DataBaseRam.class, IConstants.DATABASE_FILE_RAM + "." + Math.random(),
-				odbDataBase);
+			// Create the final output database file for the build
+			String targetPath = targetDataBaseFile.getAbsolutePath();
+			IDataBase odbDataBase = IDataBase.DataBaseManager.getDataBase(DataBaseOdb.class, targetPath, null);
+			targetDataBase = IDataBase.DataBaseManager.getDataBase(DataBaseRam.class, IConstants.DATABASE_FILE_RAM + "." + Math.random(), odbDataBase);
 
-		// Scan the build output roots for database files to merge
-		FilePath[] moduleRoots = build.getModuleRoots();
-		FileFilter fileFilter = new FileFilterImpl();
-		// The list of Serenity database files found in the module roots
-		List<FilePath> serenityOdbs = new ArrayList<FilePath>();
-		Pattern pattern = Pattern.compile(SERENITY_ODB_REGEX);
-		for (FilePath moduleRoot : moduleRoots) {
-			// printStream.println("Module root : " + moduleRoot.toURI());
-			try {
-				findFilesAndDirectories(moduleRoot, serenityOdbs, fileFilter, pattern, printStream);
-			} catch (Exception e) {
-				printStream.println("Exception searching for database files : " + moduleRoot);
-				e.printStackTrace(buildListener.fatalError("Exception searching for Serenity database files : " + moduleRoot));
+			// Scan the build output roots for database files to merge
+			FilePath[] moduleRoots = build.getModuleRoots();
+			FileFilter fileFilter = new FileFilterImpl();
+			// The list of Serenity database files found in the module roots
+			List<FilePath> serenityOdbs = new ArrayList<FilePath>();
+			Pattern pattern = Pattern.compile(SERENITY_ODB_REGEX);
+			for (FilePath moduleRoot : moduleRoots) {
+				// printStream.println("Module root : " + moduleRoot.toURI());
+				try {
+					findFilesAndDirectories(moduleRoot, serenityOdbs, fileFilter, pattern, printStream);
+				} catch (Exception e) {
+					printStream.println("Exception searching for database files : " + moduleRoot);
+					// buildListener.error("Exception searching for database files : " + moduleRoot);
+					// e.printStackTrace(buildListener.fatalError("Exception searching for Serenity database files : " + moduleRoot));
+					LOGGER.error(null, e);
+				}
 			}
-		}
 
-		// Iterate over the database files that were found and merge them to the final database
-		for (FilePath serenityOdb : serenityOdbs) {
-			File sourceFile = File.createTempFile("serenity", ".odb");
-			FilePath sourceFilePath = new FilePath(sourceFile);
-			serenityOdb.copyTo(sourceFilePath);
-			String sourcePath = sourceFile.getAbsolutePath();
-			IDataBase sourceDataBase = IDataBase.DataBaseManager.getDataBase(DataBaseOdb.class, sourcePath, null);
-			try {
-				// Copy the data from the source into the target, then close the source
-				printStream.println("Copying database from... " + sourcePath + " to... " + targetPath);
-				DataBaseToolkit.copyDataBase(sourceDataBase, targetDataBase);
-				boolean deleted = sourceFile.delete();
-				if (!deleted) {
-					printStream.println("Couldn't delete temp database file... " + sourcePath);
-					sourceFile.deleteOnExit();
+			// Iterate over the database files that were found and merge them to the final database
+			for (FilePath serenityOdb : serenityOdbs) {
+				File sourceFile = File.createTempFile("serenity", ".odb");
+				FilePath sourceFilePath = new FilePath(sourceFile);
+				serenityOdb.copyTo(sourceFilePath);
+				String sourcePath = sourceFile.getAbsolutePath();
+				IDataBase sourceDataBase = IDataBase.DataBaseManager.getDataBase(DataBaseOdb.class, sourcePath, null);
+				try {
+					// Copy the data from the source into the target, then close the source
+					printStream.println("Copying database from... " + sourcePath + " to... " + targetPath);
+					DataBaseToolkit.copyDataBase(sourceDataBase, targetDataBase);
+					boolean deleted = sourceFile.delete();
+					if (!deleted) {
+						printStream.println("Couldn't delete temp database file... " + sourcePath);
+						sourceFile.deleteOnExit();
+					}
+				} catch (Exception e) {
+					// e.printStackTrace(buildListener.fatalError("Unable to copy Serenity database file from : " + sourcePath + ", to : " + targetPath));
+					// build.setResult(Result.UNSTABLE);
+					// buildListener.error("Unable to copy Serenity database file from : " + sourcePath + ", to : " + targetPath);
+					LOGGER.error(null, e);
+				} finally {
+					sourceDataBase.close();
 				}
-			} catch (Exception e) {
-				e.printStackTrace(buildListener.fatalError("Unable to copy Serenity database file from : " + sourcePath + ", to : " + targetPath));
-				build.setResult(Result.UNSTABLE);
-			} finally {
-				sourceDataBase.close();
 			}
+		} catch (Exception e) {
+			printStream.println(e.getMessage());
+			// buildListener.error(e.getMessage());
 		}
 		return targetDataBase;
 	}
 
 	/**
 	 * Scans recursively the {@link FilePath}(s) for the database files.
-	 *
-	 * @param filePath
-	 *            the starting file path to start scanning from
-	 * @param filePaths
-	 *            the list of file paths that were found
-	 * @param fileFilter
-	 *            the file filter that will return all files in the path
-	 * @param printStream
-	 *            the LOGGER to the front end
+	 * 
+	 * @param filePath the starting file path to start scanning from
+	 * @param filePaths the list of file paths that were found
+	 * @param fileFilter the file filter that will return all files in the path
+	 * @param printStream the LOGGER to the front end
 	 * @throws Exception
 	 */
 	private void findFilesAndDirectories(FilePath filePath, List<FilePath> filePaths, FileFilter fileFilter, Pattern pattern, PrintStream printStream)
 			throws Exception {
-		// printStream.println("File path : " + filePath.toURI());
-		List<FilePath> list = filePath.list(fileFilter);
-		if (list != null) {
-			for (FilePath childFilePath : list) {
-				findFilesAndDirectories(childFilePath, filePaths, fileFilter, pattern, printStream);
+		try {
+			List<FilePath> list = filePath.list(fileFilter);
+			if (list != null) {
+				for (FilePath childFilePath : list) {
+					findFilesAndDirectories(childFilePath, filePaths, fileFilter, pattern, printStream);
+				}
 			}
+			Matcher matcher = pattern.matcher(filePath.toURI().toString());
+			if (matcher.find()) {
+				filePaths.add(filePath);
+			}
+		} catch (Exception e) {
+			LOGGER.error(null, e);
 		}
-		Matcher matcher = pattern.matcher(filePath.toURI().toString());
-		if (matcher.find()) {
-			filePaths.add(filePath);
-		}
 	}
 
 	/**
 	 * Runs the aggregator on the final database to generate the statistics etc.
-	 *
-	 * @param build
-	 *            the build for the project
-	 * @param buildListener
-	 *            the build listener that has the LOGGER in it
-	 * @param targetDataBase
-	 *            the target database to aggregate
+	 * 
+	 * @param build the build for the project
+	 * @param buildListener the build listener that has the LOGGER in it
+	 * @param targetDataBase the target database to aggregate
 	 */
 	private void aggregate(AbstractBuild<?, ?> build, BuildListener buildListener, IDataBase targetDataBase) {
-		buildListener.getLogger().println("Aggregating data... ");
-		new Aggregator(null, targetDataBase).execute();
+		try {
+			buildListener.getLogger().println("Aggregating data... ");
+			new Aggregator(null, targetDataBase).execute();
+		} catch (Exception e) {
+			buildListener.getLogger().println(e.getMessage());
+			// buildListener.error(e.getMessage());
+			LOGGER.error(null, e);
+		}
 	}
 
 	/**
 	 * Prunes the database removing all the objects that are no longer needed, like the lines and afferent/efferent objects.
-	 *
-	 * @param build
-	 *            the build for the project
-	 * @param buildListener
-	 *            the build listener that has the LOGGER in it
-	 * @param targetDataBase
-	 *            the target database to aggregate
+	 * 
+	 * @param build the build for the project
+	 * @param buildListener the build listener that has the LOGGER in it
+	 * @param targetDataBase the target database to aggregate
 	 */
 	private void prune(AbstractBuild<?, ?> build, BuildListener buildListener, IDataBase targetDataBase) {
-		buildListener.getLogger().println("Pruning data...");
-		new Pruner(null, targetDataBase).execute();
+		try {
+			buildListener.getLogger().println("Pruning data...");
+			new Pruner(null, targetDataBase).execute();
+		} catch (Exception e) {
+			buildListener.getLogger().println(e.getMessage());
+			// buildListener.error(e.getMessage());
+			LOGGER.error(null, e);
+		}
 	}
 
 	private boolean copySourceToBuildDirectory(AbstractBuild<?, ?> build, final BuildListener buildListener) throws InterruptedException, IOException {
-		FilePath workSpace = build.getWorkspace();
-		PrintStream printStream = buildListener.getLogger();
-		printStream.println("Workspace root... " + workSpace.toURI().getRawPath());
+		try {
+			FilePath workSpace = build.getWorkspace();
+			PrintStream printStream = buildListener.getLogger();
+			printStream.println("Workspace root... " + workSpace.toURI().getRawPath());
 
-		FilePath[] moduleRoots = build.getModuleRoots();
-		FileFilter fileFilter = new FileFilterImpl();
-		// The list of Serenity source directories found in the module roots
-		List<FilePath> sourceDirectories = new ArrayList<FilePath>();
-		Pattern pattern = Pattern.compile(SERENITY_SOURCE_REGEX);
-		for (FilePath moduleRoot : moduleRoots) {
-			// printStream.println("Module root : " + moduleRoot.toURI());
-			try {
-				findFilesAndDirectories(moduleRoot, sourceDirectories, fileFilter, pattern, printStream);
-			} catch (Exception e) {
-				printStream.println("Exception searching for source directories : " + moduleRoot);
-				e.printStackTrace(buildListener.fatalError("Exception searching for Serenity source files : " + moduleRoot));
+			FilePath[] moduleRoots = build.getModuleRoots();
+			FileFilter fileFilter = new FileFilterImpl();
+			// The list of Serenity source directories found in the module roots
+			List<FilePath> sourceDirectories = new ArrayList<FilePath>();
+			Pattern pattern = Pattern.compile(SERENITY_SOURCE_REGEX);
+			for (FilePath moduleRoot : moduleRoots) {
+				// printStream.println("Module root : " + moduleRoot.toURI());
+				try {
+					findFilesAndDirectories(moduleRoot, sourceDirectories, fileFilter, pattern, printStream);
+				} catch (Exception e) {
+					printStream.println("Exception searching for source directories : " + moduleRoot);
+					// buildListener.error("Exception searching for source directories : " + moduleRoot);
+					// e.printStackTrace(buildListener.fatalError("Exception searching for Serenity source files : " + moduleRoot));
+					LOGGER.error(null, e);
+				}
 			}
-		}
 
-		FilePath buildDirectory = new FilePath(build.getRootDir());
-		FilePath buildSourceDirectory = new FilePath(buildDirectory, IConstants.SERENITY_SOURCE);
+			FilePath buildDirectory = new FilePath(build.getRootDir());
+			FilePath buildSourceDirectory = new FilePath(buildDirectory, IConstants.SERENITY_SOURCE);
 
-		try {
-			buildSourceDirectory.deleteContents();
-			for (FilePath sourceDirectory : sourceDirectories) {
-				String sourcePath = sourceDirectory.toURI().toString();
-				// This is a hack. The pattern for the source directories (.*serenity.*.source) doesn't work in a slave for some reason. So we
-				// have to use .*serenity.*.source.*, which returns all the directories and files with the pattern in it, and after that we have to
-				// check that this is not a sub directory of the source folder and that it is not a file either. Pity that, try to get the bloody
-				// pattern working in the future
-				boolean isDirectoryAndSerenitySource = !sourceDirectory.isDirectory() && !sourcePath.endsWith("serenity/source/")
-						&& !sourcePath.endsWith("serenity\\source\\");
-				if (isDirectoryAndSerenitySource) {
-					continue;
+			try {
+				buildSourceDirectory.deleteContents();
+				for (FilePath sourceDirectory : sourceDirectories) {
+					String sourcePath = sourceDirectory.toURI().toString();
+					// This is a hack. The pattern for the source directories (.*serenity.*.source) doesn't work in a slave for some reason. So we
+					// have to use .*serenity.*.source.*, which returns all the directories and files with the pattern in it, and after that we have to
+					// check that this is not a sub directory of the source folder and that it is not a file either. Pity that, try to get the bloody
+					// pattern working in the future
+					boolean isDirectoryAndSerenitySource = !sourceDirectory.isDirectory() && !sourcePath.endsWith("serenity/source/")
+							&& !sourcePath.endsWith("serenity\\source\\");
+					if (isDirectoryAndSerenitySource) {
+						continue;
+					}
+					printStream.println("Copying source from... " + sourceDirectory.toURI().toString() + " to... " + buildSourceDirectory.toURI().getRawPath());
+					buildSourceDirectory.deleteContents();
+					sourceDirectory.copyRecursiveTo(buildSourceDirectory);
 				}
-				printStream.println("Copying source from... " + sourceDirectory.toURI().toString() + " to... "
-						+ buildSourceDirectory.toURI().getRawPath());
-				buildSourceDirectory.deleteContents();
-				sourceDirectory.copyRecursiveTo(buildSourceDirectory);
+			} catch (IOException e) {
+				Util.displayIOException(e, buildListener);
+				// e.printStackTrace(buildListener.fatalError("Unable to copy Serenity source directories from : " + sourceDirectories + ", to : " + buildDirectory));
+				// buildListener.error("Unable to copy Serenity source directories from : " + sourceDirectories + ", to : " + buildDirectory);
+				LOGGER.error(null, e);
 			}
-		} catch (IOException e) {
-			Util.displayIOException(e, buildListener);
-			e.printStackTrace(buildListener.fatalError("Unable to copy Serenity source directories from : " + sourceDirectories + ", to : "
-					+ buildDirectory));
+		} catch (Exception e) {
+			LOGGER.error(null, e);
+			// buildListener.error(e.getMessage());
+			buildListener.getLogger().println(e.getMessage());
 		}
 		return true;
 	}
@@ -291,7 +317,7 @@
 	@Override
 	@SuppressWarnings("rawtypes")
 	public Action getProjectAction(AbstractProject abstractProject) {
-		logger.debug("getProjectAction(AbstractProject)");
+		LOGGER.info("getProjectAction(AbstractProject)");
 		return new SerenityProjectAction(abstractProject);
 	}
 
@@ -308,21 +334,21 @@
 		 */
 		DescriptorImpl() {
 			super(SerenityPublisher.class);
-			logger.debug("DescriptorImpl");
+			LOGGER.info("DescriptorImpl");
 		}
 
 		/**
 		 * This human readable name is used in the configuration screen.
 		 */
 		public String getDisplayName() {
-			logger.debug("getDisplayName");
+			LOGGER.info("getDisplayName");
 			return "Publish Serenity Report";
 		}
 
 		@Override
 		@SuppressWarnings("rawtypes")
 		public boolean isApplicable(java.lang.Class<? extends AbstractProject> jobType) {
-			logger.debug("isApplicable");
+			LOGGER.info("isApplicable");
 			return true;
 		}
 
@@ -331,7 +357,7 @@
 		 */
 		@Override
 		public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
-			logger.debug("configure");
+			LOGGER.info("configure");
 			req.bindParameters(this, "serenity.");
 			save();
 			return super.configure(req, json);
@@ -342,14 +368,14 @@
 		 */
 		@Override
 		public SerenityPublisher newInstance(StaplerRequest req, JSONObject json) throws FormException {
-			logger.debug("newInstance");
+			LOGGER.info("newInstance");
 			SerenityPublisher instance = req.bindParameters(SerenityPublisher.class, "serenity.");
 			return instance;
 		}
 	}
 
 	public BuildStepMonitor getRequiredMonitorService() {
-		logger.debug("getRequiredMonitorService");
+		LOGGER.info("getRequiredMonitorService");
 		return BuildStepMonitor.STEP;
 	}
 }
\ No newline at end of file

Modified: trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/persistence/DataBaseJpa.java (40978 => 40979)


--- trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/persistence/DataBaseJpa.java	2013-08-14 11:07:27 UTC (rev 40978)
+++ trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/persistence/DataBaseJpa.java	2013-08-30 04:45:27 UTC (rev 40979)
@@ -27,7 +27,7 @@
 // */
 //public class DataBaseJpa extends DataBase {
 //
-//	private Logger logger = Logger.getLogger(this.getClass());
+//	private Logger LOGGER = Logger.getLogger(this.getClass());
 //	@PersistenceContext(type = PersistenceContextType.TRANSACTION, unitName = IConstants.SERENITY_PERSISTENCE_UNIT)
 //	private EntityManager entityManager;
 //	private boolean closed = true;
@@ -47,10 +47,10 @@
 //		boolean commit = begin();
 //		try {
 //			E e = entityManager.find(klass, id);
-//			logger.info("find(klass, id) : " + e);
+//			LOGGER.info("find(klass, id) : " + e);
 //			return e;
 //		} catch (Exception e) {
-//			logger.error("Exception finding : " + klass + ", " + id, e);
+//			LOGGER.error("Exception finding : " + klass + ", " + id, e);
 //		} finally {
 //			commit(commit);
 //		}
@@ -113,7 +113,7 @@
 //	 * {@inheritDoc}
 //	 */
 //	public synchronized void close() {
-//		logger.info("Closing the JPA database : " + entityManager.isOpen());
+//		LOGGER.info("Closing the JPA database : " + entityManager.isOpen());
 //		if (entityManager.isOpen()) {
 //			boolean commit = begin();
 //			try {
@@ -163,7 +163,7 @@
 //				EntityManagerFactory factory = Persistence.createEntityManagerFactory(IConstants.SERENITY_PERSISTENCE_UNIT);
 //				entityManager = factory.createEntityManager();
 //			} catch (Exception e) {
-//				logger.error("Error setting up the entity manager in stand alone.", e);
+//				LOGGER.error("Error setting up the entity manager in stand alone.", e);
 //			}
 //		}
 //		return entityManager;

Modified: trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/Listener.java (40978 => 40979)


--- trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/Listener.java	2013-08-14 11:07:27 UTC (rev 40978)
+++ trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/Listener.java	2013-08-30 04:45:27 UTC (rev 40979)
@@ -35,12 +35,12 @@
 	 */
 	public void execute() {
 		try {
-			logger.warn("Starting socket listener on port : " + IConstants.PORT);
+			logger.info("Starting socket listener on port : " + IConstants.PORT);
 			Timer timer = new Timer();
 			TimerTask timerTask = new TimerTask() {
 				@Override
 				public void run() {
-					logger.warn("Running : " + this);
+					logger.info("Running : " + this);
 					ServerSocket serverSocket = null;
 					try {
 						serverSocket = new ServerSocket(IConstants.PORT);
@@ -49,7 +49,7 @@
 								Socket socket = serverSocket.accept();
 								ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
 								Object object = ois.readObject();
-								logger.warn("Client message : " + object);
+								logger.info("Client message : " + object);
 								if (String.class.isAssignableFrom(object.getClass())) {
 									if (object.equals(IConstants.REPORT)) {
 										new Reporter(null, dataBase).execute();
@@ -63,8 +63,7 @@
 							}
 						}
 					} catch (Exception e) {
-						logger.error("Exception opening a socket, could be the firewall : ");
-						logger.error("The listener will not be listening : ", e);
+						logger.error("Exception opening a socket, could be the firewall, the listener will not be listening : ", e);
 					} finally {
 						try {
 							serverSocket.close();

--
You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to