Source:
public void execute(JobExecutionContext arg0) { try { returnValue= new ArrayList <Map>(); List<Class<?>> runOnce; Comparator<Class<?>> comparator = new Comparator<Class<?>>() { public int compare(Class<?> o1, Class<?> o2) { String name = o1.getName(); String name2 = o2.getName(); if(!name.matches("(\\D+)(\\d{5})(.*)")) { return 1; } return o1.getName().compareTo(o2.getName()); } }; try { runOnce = TaskLocatorUtil.getFixTaskClasses(); } catch (Exception e) { throw new DotRuntimeException(e.getMessage(), e); } Collections.sort(runOnce, comparator); int taskId = 0; try { for (Class<?> c : runOnce) { String name = c.getCanonicalName(); name = name.substring(name.lastIndexOf(".") + 1); String id = name.substring(7, 12); try{ taskId = Integer.parseInt(id); } catch (NumberFormatException e) { taskId++; } if (FixTask.class.isAssignableFrom(c)) { FixTask task; try { task = (FixTask) c.newInstance(); } catch (Exception e) { throw new DotRuntimeException(e.getMessage(), e); } HibernateUtil.startTransaction(); Boolean shouldrun=task.shouldRun(); if (shouldrun) { Logger.info(this, "Running: " + name); returnValue.addAll(task.executeFix()); } String executed=""; if (shouldrun) executed="was Executed"; else executed="was not Executed"; Logger.info(this, "fix assets and inconsistencies task: " + name+" "+executed); } } } catch (Exception e) { Logger .fatal( this, "Unable to execute the fix assets and inconsistencies tasks", e); try { throw new DotDataException( "Unable to execute fix assets inconsistencies task : ", e); } catch (DotDataException e1) { } } } finally { try { HibernateUtil.closeSession(); } catch (DotHibernateException e) { Logger.warn(this, e.getMessage(), e); } } Logger.info(this, "Finishing tasks."); }

Target:
public void execute(JobExecutionContext arg0) { returnValue= new ArrayList <Map>(); List<Class<?>> runOnce; Comparator<Class<?>> comparator = new Comparator<Class<?>>() { public int compare(Class<?> o1, Class<?> o2) { String name = o1.getName(); String name2 = o2.getName(); if(!name.matches("(\\D+)(\\d{5})(.*)")) { return 1; } return o1.getName().compareTo(o2.getName()); } }; try { runOnce = TaskLocatorUtil.getFixTaskClasses(); } catch (Exception e) { throw new DotRuntimeException(e.getMessage(), e); } Collections.sort(runOnce, comparator); int taskId = 0; try { for (Class<?> c : runOnce) { String name = c.getCanonicalName(); name = name.substring(name.lastIndexOf(".") + 1); String id = name.substring(7, 12); try{ taskId = Integer.parseInt(id); } catch (NumberFormatException e) { taskId++; } if (FixTask.class.isAssignableFrom(c)) { FixTask task; try { task = (FixTask) c.newInstance(); } catch (Exception e) { throw new DotRuntimeException(e.getMessage(), e); } HibernateUtil.startTransaction(); Boolean shouldrun=task.shouldRun(); if (shouldrun) { Logger.info(this, "Running: " + name); returnValue.addAll(task.executeFix()); } String executed=""; if (shouldrun) executed="was Executed"; else executed="was not Executed"; Logger.info(this, "fix assets and inconsistencies task: " + name+" "+executed); } } } catch (Exception e) { Logger .fatal( this, "Unable to execute the fix assets and inconsistencies tasks", e); try { throw new DotDataException( "Unable to execute fix assets inconsistencies task : ", e); } catch (DotDataException e1) { } } Logger.info(this, "Finishing tasks."); }