Input:
	public ServiceInterface create(String interfaceUrl, String username,
			char[] password, String myProxyServer, String myProxyPort,
			Object[] otherOptions) throws ServiceInterfaceException {
		try {
			final QName serviceName = new QName("http://api.grisu",
					"GrisuService");
			final QName portName = new QName("http://api.grisu",
					"ServiceInterfacePort");
			Service s;
			try {
				s = Service.create(
						new URL(interfaceUrl.replace("soap/GrisuService",
								"api.wsdl")), serviceName);
			} catch (final MalformedURLException e) {
				throw new RuntimeException(e);
			}
			final MTOMFeature mtom = new MTOMFeature();
			try {
				s.getPort(portName, ServiceInterface.class, mtom);
			} catch (final Error e) {
				throw new ServiceInterfaceException(
						"Sorry, could not login. Most likely your client version is incompatible with the server.\n\n"
								+ "Please download the latest version from:\n\nhttp://code.ceres.auckland.ac.nz/stable-downloads\n\n"
								+ "If you have the latest version and are still experiencing this problem please contact\n\n"
								+ "eresearch-admin@list.auckland.ac.nz\n\n"
								+ "with a description of the issue.\n\nUnderlying cause: "
								+ e.getLocalizedMessage());
			}
			final ServiceInterface service = s.getPort(portName,
					ServiceInterface.class);
			final BindingProvider bp = (javax.xml.ws.BindingProvider) service;
			bp.getRequestContext().put(
					javax.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
					interfaceUrl);
			bp.getRequestContext().put(
					JAXWSProperties.HTTP_CLIENT_STREAMING_CHUNK_SIZE, 4096);
			bp.getRequestContext()
			.put("com.sun.xml.internal.ws.transport.http.client.streaming.chunk.size",
					new Integer(4096));
			bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY,
					username);
			bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,
					new String(password));
			bp.getRequestContext().put(
					BindingProvider.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
			final SOAPBinding binding = (SOAPBinding) bp.getBinding();
			binding.setMTOMEnabled(true);
			String clientstring = LoginManager.getClientName()
					+ " "
					+ LoginManager.getClientVersion()
					+ " / "
					+ "frontend "
					+ grisu.jcommons.utils.Version
					.get("grisu-client");
			Map map = Maps.newHashMap();
			map.put("X-login-host", myProxyServer);
			map.put("X-login-port", myProxyPort);
			map.put("X-grisu-client", Collections.singletonList(clientstring));
			String session_id = LoginManager.USER_SESSION;
			if (StringUtils.isNotBlank(session_id)) {
				map.put("X-client-session-id",
						Collections.singletonList(session_id));
			}
			bp.getRequestContext()
			.put(MessageContext.HTTP_REQUEST_HEADERS, map);
			CommandLogHandler authnHandler = new CommandLogHandler(bp);
			List<Handler> hc = binding.getHandlerChain();
			hc.add(authnHandler);
			binding.setHandlerChain(hc);
			return service;
		} catch (final Exception e) {
			throw new ServiceInterfaceException(
					"Could not create JaxwsServiceInterface: "
							+ e.getLocalizedMessage(), e);
		}
	}

Output:
	public ServiceInterface create(String interfaceUrl, String username,
			char[] password, String myProxyServer, String myProxyPort,
			Object[] otherOptions) throws ServiceInterfaceException {
		try {
			final QName serviceName = new QName("http://api.grisu",
					"GrisuService");
			final QName portName = new QName("http://api.grisu",
					"ServiceInterfacePort");
			Service s;
			try {
				s = Service.create(
						new URL(interfaceUrl.replace("soap/GrisuService",
								"api.wsdl")), serviceName);
			} catch (final MalformedURLException e) {
				throw new RuntimeException(e);
			}
			final MTOMFeature mtom = new MTOMFeature();
			try {
				s.getPort(portName, ServiceInterface.class, mtom);
			} catch (final Error e) {
				throw new ServiceInterfaceException(
						"Sorry, could not login. Most likely your client version is incompatible with the server.\n\n"
								+ "Please download the latest version from:\n\nhttp://code.ceres.auckland.ac.nz/stable-downloads\n\n"
								+ "If you have the latest version and are still experiencing this problem please contact\n\n"
								+ "eresearch-admin@list.auckland.ac.nz\n\n"
								+ "with a description of the issue.\n\nUnderlying cause: "
								+ e.getLocalizedMessage());
			}
			final ServiceInterface service = s.getPort(portName,
					ServiceInterface.class);
			final BindingProvider bp = (javax.xml.ws.BindingProvider) service;
			bp.getRequestContext().put(
					javax.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
					interfaceUrl);
			bp.getRequestContext().put(
					JAXWSProperties.HTTP_CLIENT_STREAMING_CHUNK_SIZE, 4096);
			bp.getRequestContext()
			.put("com.sun.xml.internal.ws.transport.http.client.streaming.chunk.size",
					new Integer(4096));
			bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY,
					username);
			bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,
					new String(password));
			bp.getRequestContext().put(
					BindingProvider.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
			final SOAPBinding binding = (SOAPBinding) bp.getBinding();
			binding.setMTOMEnabled(true);
			String clientstring = LoginManager.getClientName()
					+ " "
					+ LoginManager.getClientVersion()
					+ " / "
					+ "frontend "
					+ grisu.jcommons.utils.Version
					.get("grisu-client");
			Map map = Maps.newHashMap();
			map.put("X-login-host", Collections.singletonList(myProxyServer));
			map.put("X-login-port", Collections.singletonList(myProxyPort));
			map.put("X-grisu-client", Collections.singletonList(clientstring));
			String session_id = LoginManager.USER_SESSION;
			if (StringUtils.isNotBlank(session_id)) {
				map.put("X-client-session-id",
						Collections.singletonList(session_id));
			}
			bp.getRequestContext()
			.put(MessageContext.HTTP_REQUEST_HEADERS, map);
			CommandLogHandler authnHandler = new CommandLogHandler(bp);
			List<Handler> hc = binding.getHandlerChain();
			hc.add(authnHandler);
			binding.setHandlerChain(hc);
			return service;
		} catch (final Exception e) {
			throw new ServiceInterfaceException(
					"Could not create JaxwsServiceInterface: "
							+ e.getLocalizedMessage(), e);
		}
	}


Input:
    public static void main(String[] arg) throws Exception {
        int port = arg.length > 1 ? Integer.parseInt(arg[1]) : 8080;
        Server server = new Server(port);
        ServletHandler servletHandler = new ServletHandler();
        servletHandler.addServletWithMapping(GameServlet.class, "/chat/*");
        ResourceHandler resourceHandler = new ResourceHandler();
        resourceHandler.setResourceBase("./dune-client/resources/");
        DefaultHandler defaultHandler = new DefaultHandler();
        HandlerList handlers = new HandlerList();
        handlers.setHandlers(new Handler[]{servletHandler, resourceHandler, defaultHandler});
        server.setHandler(handlers);
        server.start();
        server.join();
    }

Output:
    public static void main(String[] arg) throws Exception {
        int port = arg.length > 1 ? Integer.parseInt(arg[1]) : 8080;
        Server server = new Server(port);
        ServletHandler servletHandler = new ServletHandler();
        servletHandler.addServletWithMapping(GameServlet.class, "/chat/*");
        ResourceHandler resourceHandler = new ResourceHandler();
        resourceHandler.setResourceBase("dune-client/resources/");
        DefaultHandler defaultHandler = new DefaultHandler();
        HandlerList handlers = new HandlerList();
        handlers.setHandlers(new Handler[]{servletHandler, resourceHandler, defaultHandler});
        server.setHandler(handlers);
        server.start();
        server.join();
    }


Input:
    public static void shop(SignChangeEvent event) {
        Inventory chest = ChestFinder.findChest(event.getBlock());
        Block chestBlock = ChestFinder.findChestBlock(event.getBlock());
        if(chest == null) {
            event.getPlayer().sendMessage(ConfigManager.main.Chat_prefix + ConfigManager.language.Sign_Shop_NoChest);
            event.getBlock().breakNaturally();
            return;
        }
        String[] lines = event.getLines();
        Integer amount;
        try {
            amount = Integer.parseInt(lines[1]);
        } catch(NumberFormatException e) {
            event.getPlayer().sendMessage(ConfigManager.main.Chat_prefix + ConfigManager.language.Sign_Shop_InvalidAmount);
            event.getBlock().breakNaturally();
            return;
        }
        Matcher matcher = pattern.matcher(lines[2]);
        Float buy = 0.0F, sell = 0.0F;
        if(matcher.find()) {
            try {
                buy = Float.parseFloat(matcher.group(1));
                sell = Float.parseFloat(matcher.group(2));
            } catch(NumberFormatException e) {
                event.getPlayer().sendMessage(ConfigManager.main.Chat_prefix + ConfigManager.language.Sign_Shop_InvalidBuySell);
                event.getBlock().breakNaturally();
                return;
            }
        } else {
            event.getPlayer().sendMessage(ConfigManager.main.Chat_prefix + ConfigManager.language.Sign_Shop_NoValidBuySellLine);
            event.getBlock().breakNaturally();
            return;
        }
        Boolean hasItem = false;
        ListIterator<ItemStack> itemStackListIterator = chest.iterator();
        while(itemStackListIterator.hasNext()) {
            ItemStack itemStack = itemStackListIterator.next();
            if(itemStack == null) continue;
            hasItem = true;
            break;
        }
        if(!hasItem) {
            event.getPlayer().sendMessage(ConfigManager.main.Chat_prefix + ConfigManager.language.Sign_Shop_ChestIsEmpty);
            event.getBlock().breakNaturally();
            return;
        }
        com.geNAZt.RegionShop.Database.Model.Chest.store(event.getPlayer(), event.getBlock(), chestBlock, event.getPlayer().getWorld());
        com.geNAZt.RegionShop.Database.Table.Chest chest1 = com.geNAZt.RegionShop.Database.Model.Chest.get(chestBlock, event.getPlayer().getWorld(), false);
        itemStackListIterator = chest.iterator();
        Integer firstID = null;
        Byte firstData = null;
        Integer itemAmount = 0;
        ItemStack firstItemStack = null;
        while(itemStackListIterator.hasNext()) {
            ItemStack itemStack = itemStackListIterator.next();
            if(itemStack == null) continue;
            if(firstID == null) {
                firstID = itemStack.getTypeId();
                firstData = itemStack.getData().getData();
                firstItemStack = itemStack;
                if(Add.add(itemStack, event.getPlayer(), chest1, sell, buy, amount) == -1) {
                    event.getBlock().breakNaturally();
                    return;
                }
                itemAmount += itemStack.getAmount();
                continue;
            }
            if(itemStack.getTypeId() == firstID && itemStack.getData().getData() == firstData) {
                itemAmount += itemStack.getAmount();
            }
        }
        Items item = chest1.getItemStorage().getItems().iterator().next();
        item.setCurrentAmount(itemAmount);
        Database.getServer().update(item);
        item.getItemStorage().setItemAmount(itemAmount);
        Database.getServer().update(item.getItemStorage());
        ItemStack itemStack = firstItemStack.clone();
        itemStack.setAmount(1);
        org.bukkit.entity.Item droppedItem = event.getPlayer().getWorld().dropItem(new Location(event.getPlayer().getWorld(), (double) chest1.getChestX() + 0.5, (double)chest1.getChestY() + 1.2, (double)chest1.getChestZ() + 0.5), itemStack);
        droppedItem.setVelocity(new Vector(0, 0.1, 0));
        NMS.safeGuard(droppedItem);
        String itemName = ItemName.getDataName(firstItemStack) + firstItemStack.getType().toString();
        if (firstItemStack.getItemMeta().hasDisplayName()) {
            itemName = "(" + firstItemStack.getItemMeta().getDisplayName() + ")";
        }
        for(Integer line = 0; line < 4; line++) {
            event.setLine(line, ConfigManager.language.Sign_Shop_SignText.get(line).
                    replace("%player",  event.getPlayer().getName()).
                    replace("%itemname", ItemName.nicer(itemName)).
                    replace("%amount", amount.toString()).
                    replace("%sell", sell.toString()).
                    replace("%buy", buy.toString()));
        }
    }

Output:
    public static void shop(SignChangeEvent event) {
        Inventory chest = ChestFinder.findChest(event.getBlock());
        Block chestBlock = ChestFinder.findChestBlock(event.getBlock());
        if(chest == null) {
            event.getPlayer().sendMessage(ConfigManager.main.Chat_prefix + ConfigManager.language.Sign_Shop_NoChest);
            event.getBlock().breakNaturally();
            return;
        }
        String[] lines = event.getLines();
        Integer amount;
        try {
            amount = Integer.parseInt(lines[1]);
        } catch(NumberFormatException e) {
            event.getPlayer().sendMessage(ConfigManager.main.Chat_prefix + ConfigManager.language.Sign_Shop_InvalidAmount);
            event.getBlock().breakNaturally();
            return;
        }
        Matcher matcher = pattern.matcher(lines[2]);
        Float buy = 0.0F, sell = 0.0F;
        if(matcher.find()) {
            try {
                sell = Float.parseFloat(matcher.group(1));
                buy = Float.parseFloat(matcher.group(2));
            } catch(NumberFormatException e) {
                event.getPlayer().sendMessage(ConfigManager.main.Chat_prefix + ConfigManager.language.Sign_Shop_InvalidBuySell);
                event.getBlock().breakNaturally();
                return;
            }
        } else {
            event.getPlayer().sendMessage(ConfigManager.main.Chat_prefix + ConfigManager.language.Sign_Shop_NoValidBuySellLine);
            event.getBlock().breakNaturally();
            return;
        }
        Boolean hasItem = false;
        ListIterator<ItemStack> itemStackListIterator = chest.iterator();
        while(itemStackListIterator.hasNext()) {
            ItemStack itemStack = itemStackListIterator.next();
            if(itemStack == null) continue;
            hasItem = true;
            break;
        }
        if(!hasItem) {
            event.getPlayer().sendMessage(ConfigManager.main.Chat_prefix + ConfigManager.language.Sign_Shop_ChestIsEmpty);
            event.getBlock().breakNaturally();
            return;
        }
        com.geNAZt.RegionShop.Database.Model.Chest.store(event.getPlayer(), event.getBlock(), chestBlock, event.getPlayer().getWorld());
        com.geNAZt.RegionShop.Database.Table.Chest chest1 = com.geNAZt.RegionShop.Database.Model.Chest.get(chestBlock, event.getPlayer().getWorld(), false);
        itemStackListIterator = chest.iterator();
        Integer firstID = null;
        Byte firstData = null;
        Integer itemAmount = 0;
        ItemStack firstItemStack = null;
        while(itemStackListIterator.hasNext()) {
            ItemStack itemStack = itemStackListIterator.next();
            if(itemStack == null) continue;
            if(firstID == null) {
                firstID = itemStack.getTypeId();
                firstData = itemStack.getData().getData();
                firstItemStack = itemStack;
                if(Add.add(itemStack, event.getPlayer(), chest1, sell, buy, amount) == -1) {
                    event.getBlock().breakNaturally();
                    return;
                }
                itemAmount += itemStack.getAmount();
                continue;
            }
            if(itemStack.getTypeId() == firstID && itemStack.getData().getData() == firstData) {
                itemAmount += itemStack.getAmount();
            }
        }
        Items item = chest1.getItemStorage().getItems().iterator().next();
        item.setCurrentAmount(itemAmount);
        Database.getServer().update(item);
        item.getItemStorage().setItemAmount(itemAmount);
        Database.getServer().update(item.getItemStorage());
        ItemStack itemStack = firstItemStack.clone();
        itemStack.setAmount(1);
        org.bukkit.entity.Item droppedItem = event.getPlayer().getWorld().dropItem(new Location(event.getPlayer().getWorld(), (double) chest1.getChestX() + 0.5, (double)chest1.getChestY() + 1.2, (double)chest1.getChestZ() + 0.5), itemStack);
        droppedItem.setVelocity(new Vector(0, 0.1, 0));
        NMS.safeGuard(droppedItem);
        String itemName = ItemName.getDataName(firstItemStack) + firstItemStack.getType().toString();
        if (firstItemStack.getItemMeta().hasDisplayName()) {
            itemName = "(" + firstItemStack.getItemMeta().getDisplayName() + ")";
        }
        for(Integer line = 0; line < 4; line++) {
            event.setLine(line, ConfigManager.language.Sign_Shop_SignText.get(line).
                    replace("%player",  event.getPlayer().getName()).
                    replace("%itemname", ItemName.nicer(itemName)).
                    replace("%amount", amount.toString()).
                    replace("%sell", sell.toString()).
                    replace("%buy", buy.toString()));
        }
    }


Input:
    public double distance(EventSet es1, EventSet es2) {
		EventHistogram h1 = new EventHistogram();
		EventHistogram h2 = new EventHistogram();
		Set<Event> s = new HashSet<Event>();
		List<Pair<Event,Double>> l1 = new ArrayList<Pair<Event,Double>>();
		List<Pair<Event,Double>> l2 = new ArrayList<Pair<Event,Double>>();
		HashMap<Event,Integer> hm1 = new HashMap<Event,Integer>();
		HashMap<Event,Integer> hm2 = new HashMap<Event,Integer>();
		double oldfreq = Double.POSITIVE_INFINITY;
		double correlation = 0.0;
		for (int i = 0; i < es1.size(); i++) {
			h1.add(es1.eventAt(i));
			s.add(es1.eventAt(i));
		}
		for (int i = 0; i < es2.size(); i++) {
			h2.add(es2.eventAt(i));
			s.add(es2.eventAt(i));
		}
		for (Event e: h1) {
			l1.add(new Pair<Event, Double>(e,h1.getRelativeFrequency(e),2) );
		}
		for (Event e: h2) {
			l2.add(new Pair<Event, Double>(e,h2.getRelativeFrequency(e),2) );
		}
		Collections.sort(l1);
		Collections.reverse(l1);
		Collections.sort(l2);
		Collections.reverse(l2);
		int rank = 0;
		int count = 0;
		for (Pair<Event,Double> p : l1) {
			Event e = (Event) (p.getFirst());
			double f = (Double) (p.getSecond());
			count++;
			if (f != oldfreq) {
				rank = count;
				oldfreq = f;
			}
			hm1.put(e,rank);
		}
		rank = 0;
		count = 0;
		for (Pair<Event,Double> p : l2) {
			Event e = (Event) (p.getFirst());
			double f = (Double) (p.getSecond());
			count++;
			if (f != oldfreq) {
				rank = count;
				oldfreq = f;
			}
			hm2.put(e,rank);
		}
		Integer x1, x2, y1, y2;
		for (Event e1 : s) {
			for (Event e2: s) {
				if (e1.equals(e2)) continue;
				x1 = hm1.get(e1);
				if (x1 == null) x1 = hm1.size()+1;
				x2 = hm2.get(e1);
				if (x2 == null) x2 = hm2.size()+1;
				y1 = hm1.get(e2);
				if (y1 == null) y1 = hm1.size()+1;
				y2 = hm2.get(e2);
				if (y2 == null) y2 = hm2.size()+1;
				correlation += (sgn(x1.compareTo(y1)) * sgn(x2.compareTo(y2)));
				System.out.println(correlation);
			}
		}
		correlation /= (hm1.size() * (hm2.size()-1));
		return 1.0 - correlation;
    }

Output:
    public double distance(EventSet es1, EventSet es2) {
		EventHistogram h1 = new EventHistogram();
		EventHistogram h2 = new EventHistogram();
		Set<Event> s = new HashSet<Event>();
		List<Pair<Event,Double>> l1 = new ArrayList<Pair<Event,Double>>();
		List<Pair<Event,Double>> l2 = new ArrayList<Pair<Event,Double>>();
		HashMap<Event,Integer> hm1 = new HashMap<Event,Integer>();
		HashMap<Event,Integer> hm2 = new HashMap<Event,Integer>();
		double oldfreq = Double.POSITIVE_INFINITY;
		double correlation = 0.0;
		for (int i = 0; i < es1.size(); i++) {
			h1.add(es1.eventAt(i));
			s.add(es1.eventAt(i));
		}
		for (int i = 0; i < es2.size(); i++) {
			h2.add(es2.eventAt(i));
			s.add(es2.eventAt(i));
		}
		for (Event e: h1) {
			l1.add(new Pair<Event, Double>(e,h1.getRelativeFrequency(e),2) );
		}
		for (Event e: h2) {
			l2.add(new Pair<Event, Double>(e,h2.getRelativeFrequency(e),2) );
		}
		Collections.sort(l1);
		Collections.reverse(l1);
		Collections.sort(l2);
		Collections.reverse(l2);
		int rank = 0;
		int count = 0;
		for (Pair<Event,Double> p : l1) {
			Event e = (Event) (p.getFirst());
			double f = (Double) (p.getSecond());
			count++;
			if (f != oldfreq) {
				rank = count;
				oldfreq = f;
			}
			hm1.put(e,rank);
		}
		rank = 0;
		count = 0;
		for (Pair<Event,Double> p : l2) {
			Event e = (Event) (p.getFirst());
			double f = (Double) (p.getSecond());
			count++;
			if (f != oldfreq) {
				rank = count;
				oldfreq = f;
			}
			hm2.put(e,rank);
		}
		Integer x1, x2, y1, y2;
		Set<Event> s2 = new HashSet<Event>(s);
		for (Event e1 : s) {
			s2.remove(e1);
			for (Event e2: s2) {
				if (e1.equals(e2)) continue;
				x1 = hm1.get(e1);
				if (x1 == null) x1 = hm1.size()+1;
				x2 = hm2.get(e1);
				if (x2 == null) x2 = hm2.size()+1;
				y1 = hm1.get(e2);
				if (y1 == null) y1 = hm1.size()+1;
				y2 = hm2.get(e2);
				if (y2 == null) y2 = hm2.size()+1;
				correlation += (sgn(x1.compareTo(y1)) * sgn(x2.compareTo(y2)));
			}
		}
		correlation /= (hm1.size() * (hm2.size()-1));
		return 1.0 - correlation;
    }


Input:
    public void onMessage(Message message) {
        DSBIngestMessage ingestMessage = null;
        StudyVersion sv = null;
        List successfulFiles = new ArrayList();
        List problemFiles = new ArrayList();
        try {
            ObjectMessage om = (ObjectMessage) message;
            ingestMessage = (DSBIngestMessage) om.getObject();
            sv = studyService.getStudyVersionById( ingestMessage.getStudyVersionId() );
            String detail = "Ingest processing for " +ingestMessage.getFileBeans().size() + " file(s).";
            Iterator iter = ingestMessage.getFileBeans().iterator();
            while (iter.hasNext()) {
                StudyFileEditBean fileBean = (StudyFileEditBean) iter.next();
                try {
                    if (fileBean.getStudyFile() instanceof NetworkDataFile ) {
                        Context ctx = new InitialContext();
                        networkDataService = (NetworkDataServiceLocal) ctx.lookup("java:comp/env/networkData");
                        networkDataService.ingest(fileBean);
                        successfulFiles.add(fileBean);
                    } else {
                        parseXML( new DSBWrapper().ingest(fileBean) , fileBean.getFileMetadata() );
                        successfulFiles.add(fileBean);
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                    problemFiles.add(fileBean);
                }
            }
            if (!successfulFiles.isEmpty()) {
                studyFileService.addIngestedFiles(ingestMessage.getStudyId(), ingestMessage.getVersionNote(), successfulFiles, ingestMessage.getIngestUserId());
            }
            if ( ingestMessage.sendInfoMessage() || ( problemFiles.size() >= 0 && ingestMessage.sendErrorMessage() ) ) {
                mailService.sendIngestCompletedNotification(ingestMessage.getIngestEmail(), sv, successfulFiles, problemFiles);
            }
        } catch (JMSException ex) {
            ex.printStackTrace();
        } catch (Exception ex) {
            ex.printStackTrace();
            if (ingestMessage.sendErrorMessage()) {
                mailService.sendIngestCompletedNotification(ingestMessage.getIngestEmail(), sv, null, ingestMessage.getFileBeans());
            }
        } finally {
            try {
                studyService.removeStudyLock( ingestMessage.getStudyId() );
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    }

Output:
    public void onMessage(Message message) {
        DSBIngestMessage ingestMessage = null;
        StudyVersion sv = null;
        List successfulFiles = new ArrayList();
        List problemFiles = new ArrayList();
        try {
            ObjectMessage om = (ObjectMessage) message;
            ingestMessage = (DSBIngestMessage) om.getObject();
            String detail = "Ingest processing for " +ingestMessage.getFileBeans().size() + " file(s).";
            Iterator iter = ingestMessage.getFileBeans().iterator();
            while (iter.hasNext()) {
                StudyFileEditBean fileBean = (StudyFileEditBean) iter.next();
                try {
                    if (fileBean.getStudyFile() instanceof NetworkDataFile ) {
                        Context ctx = new InitialContext();
                        networkDataService = (NetworkDataServiceLocal) ctx.lookup("java:comp/env/networkData");
                        networkDataService.ingest(fileBean);
                        successfulFiles.add(fileBean);
                    } else {
                        parseXML( new DSBWrapper().ingest(fileBean) , fileBean.getFileMetadata() );
                        successfulFiles.add(fileBean);
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                    problemFiles.add(fileBean);
                }
            }
            if (!successfulFiles.isEmpty()) {
                studyFileService.addIngestedFiles(ingestMessage.getStudyId(), ingestMessage.getVersionNote(), successfulFiles, ingestMessage.getIngestUserId());
            }
            if ( ingestMessage.sendInfoMessage() || ( problemFiles.size() >= 0 && ingestMessage.sendErrorMessage() ) ) {
                mailService.sendIngestCompletedNotification(ingestMessage, successfulFiles, problemFiles);
            }
        } catch (JMSException ex) {
            ex.printStackTrace();
        } catch (Exception ex) {
            ex.printStackTrace();
            if (ingestMessage.sendErrorMessage()) {
                mailService.sendIngestCompletedNotification(ingestMessage, null, ingestMessage.getFileBeans());
            }
        } finally {
            try {
                studyService.removeStudyLock( ingestMessage.getStudyId() );
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    }


Input:
	public static void main(String[] args) {
		 HostConfiguration hostConfig = new HostConfiguration();
	     HttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
	     HttpConnectionManagerParams params = new HttpConnectionManagerParams();
	     int maxHostConnections = 20;
	     params.setMaxConnectionsPerHost(hostConfig, maxHostConnections);
	     connectionManager.setParams(params);
	     HttpClient client = new HttpClient(connectionManager);
	     Credentials creds = new UsernamePasswordCredentials("admin", "admin");
	     client.getState().setCredentials(AuthScope.ANY, creds);
	     client.setHostConfiguration(hostConfig);
	     String select =
    		"<D:select>" +
				"<D:prop  xmlns:ns1=\"http://ns.everydo.com/basic\" xmlns:ns0=\"DAV:\">"+
					"<ns0:displayname />"+
					"<ns1:subjects />"+
					"<ns0:iscollection />"+
					"<ns0:getlastmodified />"+
				"</D:prop>"+
			"</D:select>";
	     String from =
		     "<D:from>"+
				"<D:scope>"+
					"<D:depth>infinity</D:depth>"+
				"</D:scope>"+
			"</D:from>";
	     String lessDay = get_custom_time_string(0, 0, 0);
	     String greaterDay = get_custom_time_string(23, 59, 59);
	     String where =
			"<D:where>"+
				"<D:lte caseless=\"no\">"+
					"<D:prop xmlns=\"DAV:\">"+
						"<getlastmodified />"+
					"</D:prop>"+
					"<D:literal>" + greaterDay + "</D:literal>"+
				"</D:lte>"+
				"<D:gte caseless=\"no\">"+
				"<D:prop xmlns=\"DAV:\">"+
					"<getlastmodified />"+
				"</D:prop>"+
				"<D:literal>" + lessDay + "</D:literal>"+
				"</D:gte>"+
			"</D:where>";
	    String orderby =
	    	 "<D:orderby>"+
				"<D:order>"+
					"<D:prop xmlns:ns0=\"DAV:\">"+
						"<ns0:displayname />"+
					"</D:prop>"+
					"<D:descending />"+
				"</D:order>"+
			"</D:orderby>";
        String limit =
            "<D:limit>"+
                "<D:nresults>20</D:nresults>"+
            "</D:limit>";
	    String query = select + from + where + orderby + limit;
	    SearchMethod searchMethod=null;
		try {
			 searchMethod = new SearchMethod("http://localhost:8089/files?start=20",query,"D:basicsearch");
			 client.executeMethod(searchMethod);
			 Namespace edoNamespace = Namespace.getNamespace("http://ns.everydo.com/basic");
		     if (searchMethod.getStatusCode() != 207){
				 System.out.println("����ִ��ʧ�ܣ���������ǣ�" + searchMethod.getStatusCode());
				 return;
 			 }
			 MultiStatusResponse[] responses = null;
			 try{
				 MultiStatus resp = searchMethod.getResponseBodyAsMultiStatus();
				 responses = resp.getResponses();
			 } catch (DavException e){
				 System.out.println(e.getMessage());
			 }
			 for (int i=0; i<responses.length; i++) {
				 MultiStatusResponse content = responses[i];
				 String docHref = content.getHref();
				 System.out.println("source url: " + URLDecoder.decode(docHref, "utf-8"));
				 DavPropertySet properys = content.getProperties(200);
			     Boolean isFile = properys.get("iscollection").getValue().equals("0");
			     System.out.println("IsFile: " + isFile.toString());
			     String sourceName = properys.get("displayname").getValue().toString();
	             System.out.println("display name: " + sourceName);
			     if (isFile){
		             DavProperty subjects = properys.get("subjects", edoNamespace);
		             if (subjects == null || subjects.getValue() == null){
		            	 System.out.println("subjects: null");
		             }else{
		            	 System.out.println("subjects: " + subjects.getValue().toString());
		             }
			     }
			 }
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

Output:
	public static void main(String[] args) {
		 HostConfiguration hostConfig = new HostConfiguration();
	     HttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
	     HttpConnectionManagerParams params = new HttpConnectionManagerParams();
	     int maxHostConnections = 20;
	     params.setMaxConnectionsPerHost(hostConfig, maxHostConnections);
	     connectionManager.setParams(params);
	     HttpClient client = new HttpClient(connectionManager);
	     Credentials creds = new UsernamePasswordCredentials("admin", "admin");
	     client.getState().setCredentials(AuthScope.ANY, creds);
	     client.setHostConfiguration(hostConfig);
	     String select =
    		"<D:select>" +
				"<D:prop  xmlns:ns1=\"http://ns.everydo.com/basic\" xmlns:ns0=\"DAV:\">"+
					"<ns0:displayname />"+
					"<ns1:subjects />"+
					"<ns0:iscollection />"+
					"<ns0:getlastmodified />"+
				"</D:prop>"+
			"</D:select>";
	     String from =
		     "<D:from>"+
				"<D:scope>"+
					"<D:href>/</D:href>"+
					"<D:depth>infinity</D:depth>"+
				"</D:scope>"+
			"</D:from>";
	     String lessDay = get_custom_time_string(0, 0, 0);
	     String greaterDay = get_custom_time_string(23, 59, 59);
	     String where =
			"<D:where>"+
				"<D:lte caseless=\"no\">"+
					"<D:prop xmlns=\"DAV:\">"+
						"<getlastmodified />"+
					"</D:prop>"+
					"<D:literal>" + greaterDay + "</D:literal>"+
				"</D:lte>"+
				"<D:gte caseless=\"no\">"+
				"<D:prop xmlns=\"DAV:\">"+
					"<getlastmodified />"+
				"</D:prop>"+
				"<D:literal>" + lessDay + "</D:literal>"+
				"</D:gte>"+
			"</D:where>";
	    String orderby =
	    	 "<D:orderby>"+
				"<D:order>"+
					"<D:prop xmlns:ns0=\"DAV:\">"+
						"<ns0:displayname />"+
					"</D:prop>"+
					"<D:descending />"+
				"</D:order>"+
			"</D:orderby>";
        String limit =
            "<D:limit>"+
                "<D:nresults>20</D:nresults>"+
            "</D:limit>";
	    String query = select + from + where + orderby + limit;
	    SearchMethod searchMethod=null;
		try {
			 searchMethod = new SearchMethod("http://localhost:8089/files?start=20",query,"D:basicsearch");
			 client.executeMethod(searchMethod);
			 Namespace edoNamespace = Namespace.getNamespace("http://ns.everydo.com/basic");
		     if (searchMethod.getStatusCode() != 207){
				 System.out.println("����ִ��ʧ�ܣ���������ǣ�" + searchMethod.getStatusCode());
				 return;
 			 }
			 MultiStatusResponse[] responses = null;
			 try{
				 MultiStatus resp = searchMethod.getResponseBodyAsMultiStatus();
				 responses = resp.getResponses();
			 } catch (DavException e){
				 System.out.println(e.getMessage());
			 }
			 for (int i=0; i<responses.length; i++) {
				 MultiStatusResponse content = responses[i];
				 String docHref = content.getHref();
				 System.out.println("source url: " + URLDecoder.decode(docHref, "utf-8"));
				 DavPropertySet properys = content.getProperties(200);
			     Boolean isFile = properys.get("iscollection").getValue().equals("0");
			     System.out.println("IsFile: " + isFile.toString());
			     String sourceName = properys.get("displayname").getValue().toString();
	             System.out.println("display name: " + sourceName);
			     if (isFile){
		             DavProperty subjects = properys.get("subjects", edoNamespace);
		             if (subjects == null || subjects.getValue() == null){
		            	 System.out.println("subjects: null");
		             }else{
		            	 System.out.println("subjects: " + subjects.getValue().toString());
		             }
			     }
			 }
		} catch (IOException e) {
			e.printStackTrace();
		}
	}


Input:
	protected void checkSemantic(final String bpmnFileName,
			boolean checkActivities, boolean checkEvents,
			boolean checkMessageFlow, MainProcess mainProcess)
					throws IOException {
		final Diagram diagramFor = ModelHelper.getDiagramFor(mainProcess,null);
		DiagramEditPart dep;
		try{
			dep = OffscreenEditPartFactory.getInstance().createDiagramEditPart(diagramFor, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
		} catch(Exception ex){
			dep = OffscreenEditPartFactory.getInstance().createDiagramEditPart(diagramFor, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
		}
		MainProcessEditPart mped = (MainProcessEditPart) dep;
		IBonitaModelExporter exporter = new BonitaModelExporterImpl(mped) ;
		File bpmnFileExported = File.createTempFile("withAllExported", ".bpmn");
		final boolean transformed = new BonitaToBPMN().transform(exporter, bpmnFileExported, new NullProgressMonitor());
		assertTrue("Error during export", transformed);
		ResourceSet resourceSet1 = new ResourceSetImpl();
		final Map<String, Object> extensionToFactoryMap = resourceSet1.getResourceFactoryRegistry().getExtensionToFactoryMap();
		final DiResourceFactoryImpl diResourceFactoryImpl = new DiResourceFactoryImpl();
		extensionToFactoryMap.put("bpmn", diResourceFactoryImpl);
		URL bpmnResource = FileLocator.toFileURL(BPMNImportExportTest.class.getResource(bpmnFileName));
		Resource resource1 = resourceSet1.createResource(URI.createFileURI(bpmnResource.getFile()));
		resource1.load(Collections.emptyMap());
		Resource resource2 = resourceSet1.createResource(URI.createFileURI(bpmnFileExported.getAbsolutePath()));
		resource2.load(Collections.emptyMap());
		DocumentRoot model1 = (DocumentRoot) resource1.getContents().get(0);
		DocumentRoot model2 = (DocumentRoot) resource2.getContents().get(0);
		int nbProcess1 = 0;
		Set<String> processNames = new HashSet<String>();
		List<String> activityNames = new ArrayList<String>();
		int nbActivity1 = 0;
		int nbBoundaryEvent1 = 0;
		int nbTsignal1 = 0;
		int nbEvents1 = 0;
		int nbTextannotation1 = 0;
		int nbMessageFlow1 = 0;
		int nbProcessItemeDefinition1 = 0;
		int nbDataObject1 = 0;
		int nbProperty1 = 0;
		for(TRootElement rootElement : model1.getDefinitions().getRootElement()){
			if(rootElement instanceof TProcess){
				nbProcess1++;
				final String processName = ((TProcess) rootElement).getName() != null ? ((TProcess) rootElement).getName() : ((TProcess) rootElement).getId();
				processNames.add(processName);
				for(TArtifact tArtifact :((TProcess) rootElement).getArtifact()){
					if(tArtifact instanceof TTextAnnotation){
						nbTextannotation1++;
					}
				}
				for(TFlowElement tFlowElement : ((TProcess) rootElement).getFlowElement()){
					if(tFlowElement instanceof TActivity){
						nbActivity1++;
						String name  = getFlowElementName((TActivity) tFlowElement);
						activityNames.add(name);
						if(tFlowElement instanceof TSubProcess){
							if(((TSubProcess) tFlowElement).isTriggeredByEvent()){
								nbActivity1 += findNbActivitiesInSubProc((TSubProcess)tFlowElement) ;
								nbActivity1--;
							} else {
								nbProcess1++;
								nbActivity1 += findNbActivitiesInSubProc((TSubProcess)tFlowElement);
							}
						}
						System.out.println("activity count for model 1 "+ nbActivity1 + tFlowElement.getId() +" ### "+ tFlowElement.getName());
						nbProperty1 += ((TActivity) tFlowElement).getProperty().size();
					} else if(tFlowElement instanceof TDataObject){
						nbDataObject1++;
					} else if(tFlowElement instanceof TIntermediateThrowEvent){
						if((((TThrowEvent) tFlowElement).getEventDefinition() == null
								|| ((TThrowEvent) tFlowElement).getEventDefinition().isEmpty())
								&& (((TThrowEvent) tFlowElement).getEventDefinitionRef() == null
								|| ((TThrowEvent) tFlowElement).getEventDefinitionRef().isEmpty())){
							nbActivity1++;
						}
					}
				}
			} else if(rootElement instanceof TBoundaryEvent){
				nbBoundaryEvent1++;
			} else if(rootElement instanceof TSignal){
				nbTsignal1++;
			} else if(rootElement instanceof TEvent){
				nbEvents1++;
			} else if(rootElement instanceof TCollaboration){
				nbMessageFlow1+=((TCollaboration) rootElement).getMessageFlow().size();
			} else if(rootElement instanceof TItemDefinition){
				nbProcessItemeDefinition1++;
			}
		}
		int nbProcess2 = 0;
		int nbBoundaryEvent2 = 0;
		int nbActivity2 = 0;
		int nbTsignal2 = 0;
		int nbEvents2 = 0;
		int nbTextannotation2 = 0;
		int nbMessageFlow2 =0;
		int nbProcessItemeDefinition2 = 0;
		int nbDataObject2 = 0;
		int nbProperty2 = 0;
		for(TRootElement rootElement : model2.getDefinitions().getRootElement()){
			if(rootElement instanceof TProcess){
				nbProcess2++;
				final String processName = ((TProcess) rootElement).getName() != null ? ((TProcess) rootElement).getName() : ((TProcess) rootElement).getId();
				if(!processNames.remove(processName)){
					System.out.println(processName+ "  has appeared");
				}
				for(TArtifact tArtifact :((TProcess) rootElement).getArtifact()){
					if(tArtifact instanceof TTextAnnotation){
						nbTextannotation2++;
					}
				}
				for(TFlowElement tFlowElement : ((TProcess) rootElement).getFlowElement()){
					if(tFlowElement instanceof TActivity){
						nbActivity2++;
						String name  = getFlowElementName((TActivity) tFlowElement);
						if(!activityNames.remove(name)){
							System.out.println("The activity : "+name +" is missing ");
						}
						if(tFlowElement instanceof TSubProcess){
							nbActivity2 += findNbActivitiesInSubProc((TSubProcess)tFlowElement);
							if(((TSubProcess) tFlowElement).isTriggeredByEvent()){
								nbActivity2--;
							}
						}
						System.out.println("activity count for model 2 "+ nbActivity2 + tFlowElement.getId() +" ### "+ tFlowElement.getName());
						nbProperty2 += ((TActivity) tFlowElement).getProperty().size();
					} else if(tFlowElement instanceof TDataObject){
						nbDataObject2++;
					}
				}
			} else if(rootElement instanceof TBoundaryEvent){
				nbBoundaryEvent2++;
			} else if(rootElement instanceof TSignal){
				nbTsignal2++;
			} else if(rootElement instanceof TEvent){
				nbEvents2++;
			}  else if(rootElement instanceof TCollaboration){
				nbMessageFlow2 = ((TCollaboration) rootElement).getMessageFlow().size();
			} else if(rootElement instanceof TItemDefinition){
				nbProcessItemeDefinition2++;
			}
		}
		Collection<String> ids = new HashSet<String>();
		Collection<String> duplicatedIds = new HashSet<String>();
		Collection<EObject> noIds = new HashSet<EObject>();
		for (Iterator<EObject> iterator = model2.eAllContents(); iterator.hasNext();) {
			EObject object = iterator.next();
			if(object instanceof TBaseElement){
				String id = ((TBaseElement) object).getId();
				if(id == null){
					noIds.add(object);
				}
				if(ids.contains(id)){
					duplicatedIds.add(id);
				}
				ids.add(id);
			}
		}
		if(!activityNames.isEmpty()){
			System.out.println("Some activity have disappeared for diagram:" + bpmnFileName);
			for (String activityName : activityNames) {
				System.out.println(activityName+"\n");
			}
		}
		assertEquals("We don't find the same number of process", nbProcess1, nbProcess2);
		assertTrue("There are missing processes:"+processNames.toString(), processNames.isEmpty());
		assertEquals("We don't find the same number of boundaries event", nbBoundaryEvent1, nbBoundaryEvent2);
		if(checkActivities){
			assertEquals("We don't find the same number of activities", nbActivity1, nbActivity2);
		}
		assertEquals("We don't find the same number of TSignal defined", nbTsignal1, nbTsignal2);
		if(checkEvents){
			assertEquals("We don't find the same number of TEvent defined", nbEvents1, nbEvents2);
		}
		if(checkMessageFlow){
			assertEquals("We don't find the same number of TMessageFlow defined", nbMessageFlow1, nbMessageFlow2);
		}
		assertTrue("There are null ids: "+noIds, noIds.isEmpty());
		assertTrue("There are duplicated ids: "+duplicatedIds, duplicatedIds.isEmpty());
		assertEquals("Some data were lost", nbDataObject1, nbDataObject2);
		assertEquals("Some property (transient data) were lost", nbProperty1, nbProperty2);
	}

Output:
	protected void checkSemantic(final String bpmnFileName,
			boolean checkActivities, boolean checkEvents,
			boolean checkMessageFlow, MainProcess mainProcess)
					throws IOException {
		final Diagram diagramFor = ModelHelper.getDiagramFor(mainProcess,null);
		DiagramEditPart dep;
		try{
			dep = OffscreenEditPartFactory.getInstance().createDiagramEditPart(diagramFor, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
		} catch(Exception ex){
			dep = OffscreenEditPartFactory.getInstance().createDiagramEditPart(diagramFor, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
		}
		MainProcessEditPart mped = (MainProcessEditPart) dep;
		IBonitaModelExporter exporter = new BonitaModelExporterImpl(mped) ;
		File bpmnFileExported = File.createTempFile("withAllExported", ".bpmn");
		final boolean transformed = new BonitaToBPMN().transform(exporter, bpmnFileExported, new NullProgressMonitor());
		assertTrue("Error during export", transformed);
		ResourceSet resourceSet1 = new ResourceSetImpl();
		final Map<String, Object> extensionToFactoryMap = resourceSet1.getResourceFactoryRegistry().getExtensionToFactoryMap();
		final DiResourceFactoryImpl diResourceFactoryImpl = new DiResourceFactoryImpl();
		extensionToFactoryMap.put("bpmn", diResourceFactoryImpl);
		URL bpmnResource = FileLocator.toFileURL(BPMNImportExportTest.class.getResource(bpmnFileName));
		Resource resource1 = resourceSet1.createResource(URI.createFileURI(new File(bpmnResource.getFile()).getAbsolutePath()));
		resource1.load(Collections.emptyMap());
		Resource resource2 = resourceSet1.createResource(URI.createFileURI(bpmnFileExported.getAbsolutePath()));
		resource2.load(Collections.emptyMap());
		DocumentRoot model1 = (DocumentRoot) resource1.getContents().get(0);
		DocumentRoot model2 = (DocumentRoot) resource2.getContents().get(0);
		int nbProcess1 = 0;
		Set<String> processNames = new HashSet<String>();
		List<String> activityNames = new ArrayList<String>();
		int nbActivity1 = 0;
		int nbBoundaryEvent1 = 0;
		int nbTsignal1 = 0;
		int nbEvents1 = 0;
		int nbTextannotation1 = 0;
		int nbMessageFlow1 = 0;
		int nbProcessItemeDefinition1 = 0;
		int nbDataObject1 = 0;
		int nbProperty1 = 0;
		for(TRootElement rootElement : model1.getDefinitions().getRootElement()){
			if(rootElement instanceof TProcess){
				nbProcess1++;
				final String processName = ((TProcess) rootElement).getName() != null ? ((TProcess) rootElement).getName() : ((TProcess) rootElement).getId();
				processNames.add(processName);
				for(TArtifact tArtifact :((TProcess) rootElement).getArtifact()){
					if(tArtifact instanceof TTextAnnotation){
						nbTextannotation1++;
					}
				}
				for(TFlowElement tFlowElement : ((TProcess) rootElement).getFlowElement()){
					if(tFlowElement instanceof TActivity){
						nbActivity1++;
						String name  = getFlowElementName((TActivity) tFlowElement);
						activityNames.add(name);
						if(tFlowElement instanceof TSubProcess){
							if(((TSubProcess) tFlowElement).isTriggeredByEvent()){
								nbActivity1 += findNbActivitiesInSubProc((TSubProcess)tFlowElement) ;
								nbActivity1--;
							} else {
								nbProcess1++;
								nbActivity1 += findNbActivitiesInSubProc((TSubProcess)tFlowElement);
							}
						}
						System.out.println("activity count for model 1 "+ nbActivity1 + tFlowElement.getId() +" ### "+ tFlowElement.getName());
						nbProperty1 += ((TActivity) tFlowElement).getProperty().size();
					} else if(tFlowElement instanceof TDataObject){
						nbDataObject1++;
					} else if(tFlowElement instanceof TIntermediateThrowEvent){
						if((((TThrowEvent) tFlowElement).getEventDefinition() == null
								|| ((TThrowEvent) tFlowElement).getEventDefinition().isEmpty())
								&& (((TThrowEvent) tFlowElement).getEventDefinitionRef() == null
								|| ((TThrowEvent) tFlowElement).getEventDefinitionRef().isEmpty())){
							nbActivity1++;
						}
					}
				}
			} else if(rootElement instanceof TBoundaryEvent){
				nbBoundaryEvent1++;
			} else if(rootElement instanceof TSignal){
				nbTsignal1++;
			} else if(rootElement instanceof TEvent){
				nbEvents1++;
			} else if(rootElement instanceof TCollaboration){
				nbMessageFlow1+=((TCollaboration) rootElement).getMessageFlow().size();
			} else if(rootElement instanceof TItemDefinition){
				nbProcessItemeDefinition1++;
			}
		}
		int nbProcess2 = 0;
		int nbBoundaryEvent2 = 0;
		int nbActivity2 = 0;
		int nbTsignal2 = 0;
		int nbEvents2 = 0;
		int nbTextannotation2 = 0;
		int nbMessageFlow2 =0;
		int nbProcessItemeDefinition2 = 0;
		int nbDataObject2 = 0;
		int nbProperty2 = 0;
		for(TRootElement rootElement : model2.getDefinitions().getRootElement()){
			if(rootElement instanceof TProcess){
				nbProcess2++;
				final String processName = ((TProcess) rootElement).getName() != null ? ((TProcess) rootElement).getName() : ((TProcess) rootElement).getId();
				if(!processNames.remove(processName)){
					System.out.println(processName+ "  has appeared");
				}
				for(TArtifact tArtifact :((TProcess) rootElement).getArtifact()){
					if(tArtifact instanceof TTextAnnotation){
						nbTextannotation2++;
					}
				}
				for(TFlowElement tFlowElement : ((TProcess) rootElement).getFlowElement()){
					if(tFlowElement instanceof TActivity){
						nbActivity2++;
						String name  = getFlowElementName((TActivity) tFlowElement);
						if(!activityNames.remove(name)){
							System.out.println("The activity : "+name +" is missing ");
						}
						if(tFlowElement instanceof TSubProcess){
							nbActivity2 += findNbActivitiesInSubProc((TSubProcess)tFlowElement);
							if(((TSubProcess) tFlowElement).isTriggeredByEvent()){
								nbActivity2--;
							}
						}
						System.out.println("activity count for model 2 "+ nbActivity2 + tFlowElement.getId() +" ### "+ tFlowElement.getName());
						nbProperty2 += ((TActivity) tFlowElement).getProperty().size();
					} else if(tFlowElement instanceof TDataObject){
						nbDataObject2++;
					}
				}
			} else if(rootElement instanceof TBoundaryEvent){
				nbBoundaryEvent2++;
			} else if(rootElement instanceof TSignal){
				nbTsignal2++;
			} else if(rootElement instanceof TEvent){
				nbEvents2++;
			}  else if(rootElement instanceof TCollaboration){
				nbMessageFlow2 = ((TCollaboration) rootElement).getMessageFlow().size();
			} else if(rootElement instanceof TItemDefinition){
				nbProcessItemeDefinition2++;
			}
		}
		Collection<String> ids = new HashSet<String>();
		Collection<String> duplicatedIds = new HashSet<String>();
		Collection<EObject> noIds = new HashSet<EObject>();
		for (Iterator<EObject> iterator = model2.eAllContents(); iterator.hasNext();) {
			EObject object = iterator.next();
			if(object instanceof TBaseElement){
				String id = ((TBaseElement) object).getId();
				if(id == null){
					noIds.add(object);
				}
				if(ids.contains(id)){
					duplicatedIds.add(id);
				}
				ids.add(id);
			}
		}
		if(!activityNames.isEmpty()){
			System.out.println("Some activity have disappeared for diagram:" + bpmnFileName);
			for (String activityName : activityNames) {
				System.out.println(activityName+"\n");
			}
		}
		assertEquals("We don't find the same number of process", nbProcess1, nbProcess2);
		assertTrue("There are missing processes:"+processNames.toString(), processNames.isEmpty());
		assertEquals("We don't find the same number of boundaries event", nbBoundaryEvent1, nbBoundaryEvent2);
		if(checkActivities){
			assertEquals("We don't find the same number of activities", nbActivity1, nbActivity2);
		}
		assertEquals("We don't find the same number of TSignal defined", nbTsignal1, nbTsignal2);
		if(checkEvents){
			assertEquals("We don't find the same number of TEvent defined", nbEvents1, nbEvents2);
		}
		if(checkMessageFlow){
			assertEquals("We don't find the same number of TMessageFlow defined", nbMessageFlow1, nbMessageFlow2);
		}
		assertTrue("There are null ids: "+noIds, noIds.isEmpty());
		assertTrue("There are duplicated ids: "+duplicatedIds, duplicatedIds.isEmpty());
		assertEquals("Some data were lost", nbDataObject1, nbDataObject2);
		assertEquals("Some property (transient data) were lost", nbProperty1, nbProperty2);
	}


Input:
    public static void coerceNamespaceAwarePropertyValues(AbstractBeanDefinition bd, Element element, PropertyDescriptor[] descriptors, int i) {
        PropertyDescriptor descriptor = descriptors[i];
        if (descriptor.getPropertyType().isAssignableFrom(QName.class)) {
            String name = descriptor.getName();
            MutablePropertyValues propertyValues = bd.getPropertyValues();
            PropertyValue propertyValue = propertyValues.getPropertyValue(name);
            if (propertyValue != null) {
                Object value = propertyValue.getValue();
                if (value instanceof String) {
                    propertyValues.removePropertyValue(propertyValue);
                    propertyValues.addPropertyValue(name, createQName(element, (String) value));
                }
            }
        } else if (descriptor.getPropertyType().isAssignableFrom(QName[].class)) {
            String name = descriptor.getName();
            MutablePropertyValues propertyValues = bd.getPropertyValues();
            PropertyValue propertyValue = propertyValues.getPropertyValue(name);
            if (propertyValue != null) {
                Object value = propertyValue.getValue();
                if (value instanceof List) {
                    List values = (List) value;
                    List newValues = new ManagedList();
                    for (Iterator iter = values.iterator(); iter.hasNext();) {
                        Object v = iter.next();
                        if (v instanceof String) {
                            newValues.add(createQName(element, (String) v));
                        } else {
                            newValues.add(v);
                        }
                    }
                    propertyValues.removePropertyValue(propertyValue);
                    propertyValues.addPropertyValue(name, newValues);
                }
            }
        }
    }

Output:
    public static void coerceNamespaceAwarePropertyValues(AbstractBeanDefinition bd, Element element, PropertyDescriptor[] descriptors, int i) {
        PropertyDescriptor descriptor = descriptors[i];
        if (descriptor.getPropertyType() == null) {
            return;
        }
        if (descriptor.getPropertyType().isAssignableFrom(QName.class)) {
            String name = descriptor.getName();
            MutablePropertyValues propertyValues = bd.getPropertyValues();
            PropertyValue propertyValue = propertyValues.getPropertyValue(name);
            if (propertyValue != null) {
                Object value = propertyValue.getValue();
                if (value instanceof String) {
                    propertyValues.removePropertyValue(propertyValue);
                    propertyValues.addPropertyValue(name, createQName(element, (String) value));
                }
            }
        } else if (descriptor.getPropertyType().isAssignableFrom(QName[].class)) {
            String name = descriptor.getName();
            MutablePropertyValues propertyValues = bd.getPropertyValues();
            PropertyValue propertyValue = propertyValues.getPropertyValue(name);
            if (propertyValue != null) {
                Object value = propertyValue.getValue();
                if (value instanceof List) {
                    List values = (List) value;
                    List newValues = new ManagedList();
                    for (Iterator iter = values.iterator(); iter.hasNext();) {
                        Object v = iter.next();
                        if (v instanceof String) {
                            newValues.add(createQName(element, (String) v));
                        } else {
                            newValues.add(v);
                        }
                    }
                    propertyValues.removePropertyValue(propertyValue);
                    propertyValues.addPropertyValue(name, newValues);
                }
            }
        }
    }


Input:
   public Configuration getUserConfiguration() throws ConfigurationException
   {
      if (userConfiguration == null)
      {
         String property = System.getProperty(USER_CONFIG_PATH);
         File userConfigurationFile;
         if (property == null || property.isEmpty())
         {
            userConfigurationFile = new File(OperatingSystemUtils.getUserForgeDir(), "config.xml");
         }
         else
         {
            userConfigurationFile = new File(property);
         }
         if (!userConfigurationFile.exists() || userConfigurationFile.length() == 0L)
         {
            userConfigurationFile.mkdirs();
            try (FileWriter fw = new FileWriter(userConfigurationFile))
            {
               fw.write("<configuration/>");
            }
            catch (IOException e)
            {
               throw new ConfigurationException("Error while create user configuration", e);
            }
         }
         userConfiguration = getConfiguration(userConfigurationFile);
      }
      return userConfiguration;
   }

Output:
   public Configuration getUserConfiguration() throws ConfigurationException
   {
      if (userConfiguration == null)
      {
         String property = System.getProperty(USER_CONFIG_PATH);
         File userConfigurationFile;
         if (property == null || property.isEmpty())
         {
            userConfigurationFile = new File(OperatingSystemUtils.getUserForgeDir(), "config.xml");
         }
         else
         {
            userConfigurationFile = new File(property);
         }
         if (!userConfigurationFile.exists() || userConfigurationFile.length() == 0L)
         {
            File parentFile = userConfigurationFile.getParentFile();
            if (parentFile != null)
            {
               parentFile.mkdirs();
            }
            try (FileWriter fw = new FileWriter(userConfigurationFile))
            {
               fw.write("<configuration/>");
            }
            catch (IOException e)
            {
               throw new ConfigurationException("Error while create user configuration", e);
            }
         }
         userConfiguration = getConfiguration(userConfigurationFile);
      }
      return userConfiguration;
   }


Input:
    public static void main(final String[] args) throws IOException, ParseException {
        final Option baseDirOpt = new Option("b", "base-dir", true, "Base directory for test search");
        final Option includeOpt = new Option("i", "include", true,
                "Comma-separated list of Ant-style paths to the tests to run");
        final Option excludeOpt = new Option("e", "exclude", true,
                "Comma-separated list of Ant-style paths to the tests to exclude from run");
        final Option outputDirOpt = new Option("o", "output-dir", true, "The output directory for coverage reports");
        final Option outputInstrumentedFilesOpt = new Option("f", "output-instrumented-files", false,
                "Whether to output instrumented files (default is false)");
        final Option noInstrumentPatternOpt = new Option("n", "no-instrument-pattern", true,
                "Regular expression patterns to match classes to exclude from instrumentation");
        noInstrumentPatternOpt.setArgs(Option.UNLIMITED_VALUES);
        final Option sourcesToPreloadOpt = new Option("p", "preload-sources", true,
                "Comma-separated list of Ant-style paths to files to preload");
        final Option sourcesToPreloadEncodingOpt = new Option(null, "preload-sources-encoding", true,
                "Encoding to use when preloading sources");
        final Option threadCountOpt = new Option("t", "thread-count", true,
                "The maximum number of threads to use (defaults to the number of cores)");
        final Option outputStrategyOpt = new Option("s", "output-strategy", true,
                "Coverage report output strategy. One of " + Arrays.toString(OutputStrategy.values()));
        final Option includeInlineScriptsOpt = new Option("d", "include-inline-scripts", false,
                "Whether to include inline scripts into instrumentation by default (default is false)");
        final Option backgroundJavaScriptTimeoutOpt = new Option("j", "background-javascript-timeout", true,
                "How long to wait for background JavaScript to finish running (in milliseconds, default is 5 minutes)");
        final Option browserVersionOpt = new Option("v", "browser-version", true,
                "Determines the browser and version profile that HtmlUnit will simulate");
        final Option reportFormatsOpt = new Option(null, "report-formats", true,
                "A comma-separated list of formats of the reports to be generated. Valid values are: HTML, RAW, CSV");
        final Option helpOpt = new Option("h", "help", false, "Print this message");
        final Options options = new Options();
        options.addOption(baseDirOpt);
        options.addOption(includeOpt);
        options.addOption(excludeOpt);
        options.addOption(outputDirOpt);
        options.addOption(outputInstrumentedFilesOpt);
        options.addOption(noInstrumentPatternOpt);
        options.addOption(threadCountOpt);
        options.addOption(outputStrategyOpt);
        options.addOption(includeInlineScriptsOpt);
        options.addOption(helpOpt);
        options.addOption(sourcesToPreloadOpt);
        options.addOption(sourcesToPreloadEncodingOpt);
        options.addOption(backgroundJavaScriptTimeoutOpt);
        options.addOption(browserVersionOpt);
        options.addOption(reportFormatsOpt);
        try {
            CommandLineParser parser = new GnuParser();
            CommandLine line = parser.parse(options, args, false);
            baseDirOpt.setRequired(true);
            includeOpt.setRequired(true);
            outputDirOpt.setRequired(true);
            options.addOption(baseDirOpt);
            options.addOption(includeOpt);
            options.addOption(outputDirOpt);
            if (line.hasOption(helpOpt.getOpt())) {
                printHelpAndExit(options);
            }
            parser = new GnuParser();
            line = parser.parse(options, args);
            final File baseDir = new File(line.getOptionValue(baseDirOpt.getOpt()));
            final String includes = line.getOptionValue(includeOpt.getOpt());
            final String excludes = line.getOptionValue(excludeOpt.getOpt());
            final File outputDir = new File(line.getOptionValue(outputDirOpt.getOpt()));
            final CoverageGenerator gen = new CoverageGenerator(baseDir, includes, excludes, outputDir);
            if (line.hasOption(outputInstrumentedFilesOpt.getOpt())) {
                gen.setOutputInstrumentedFiles(true);
            }
            gen.setNoInstrumentPatterns(line.getOptionValues(noInstrumentPatternOpt.getOpt()));
            gen.setSourcesToPreload(line.getOptionValue(sourcesToPreloadOpt.getOpt()));
            gen.setOutputStrategy(line.getOptionValue(outputStrategyOpt.getOpt()));
            final String threadCount = line.getOptionValue(threadCountOpt.getOpt());
            if (threadCount != null) {
                try {
                    gen.setThreadCount(Integer.parseInt(threadCount));
                } catch (final Exception e) {
                    System.err.println("Invalid thread count");
                    printHelpAndExit(options);
                }
            }
            if (line.hasOption(includeInlineScriptsOpt.getOpt())) {
                gen.setIncludeInlineScripts(true);
            }
            final String backgroundJavaScriptTimeout = line.getOptionValue(backgroundJavaScriptTimeoutOpt.getOpt());
            if (backgroundJavaScriptTimeout != null) {
                try {
                    gen.setBackgroundJavaScriptTimeout(Long.valueOf(backgroundJavaScriptTimeout));
                } catch (final Exception e) {
                    System.err.println("Invalid timeout");
                    printHelpAndExit(options);
                }
            }
            gen.setBrowserVersion(line.getOptionValue(browserVersionOpt.getOpt()));
            gen.setReportFormats(line.getOptionValue(reportFormatsOpt.getOpt()));
            gen.run();
        } catch (final MissingOptionException e) {
            System.err.println(e.getMessage());
            printHelpAndExit(options);
        } catch (final UnrecognizedOptionException e) {
            System.err.println(e.getMessage());
            printHelpAndExit(options);
        } catch (final ParseException e) {
            System.err.println(e.getMessage());
            System.exit(1);
        }
    }

Output:
    public static void main(final String[] args) throws IOException, ParseException {
        final Option baseDirOpt = new Option("b", "base-dir", true, "Base directory for test search");
        final Option includeOpt = new Option("i", "include", true,
                "Comma-separated list of Ant-style paths to the tests to run");
        final Option excludeOpt = new Option("e", "exclude", true,
                "Comma-separated list of Ant-style paths to the tests to exclude from run");
        final Option outputDirOpt = new Option("o", "output-dir", true, "The output directory for coverage reports");
        final Option outputInstrumentedFilesOpt = new Option("f", "output-instrumented-files", false,
                "Whether to output instrumented files (default is false)");
        final Option noInstrumentPatternOpt = new Option("n", "no-instrument-pattern", true,
                "Regular expression patterns to match classes to exclude from instrumentation");
        noInstrumentPatternOpt.setArgs(Option.UNLIMITED_VALUES);
        final Option sourcesToPreloadOpt = new Option("p", "preload-sources", true,
                "Comma-separated list of Ant-style paths to files to preload");
        final Option sourcesToPreloadEncodingOpt = new Option(null, "preload-sources-encoding", true,
                "Encoding to use when preloading sources");
        final Option threadCountOpt = new Option("t", "thread-count", true,
                "The maximum number of threads to use (defaults to the number of cores)");
        final Option outputStrategyOpt = new Option("s", "output-strategy", true,
                "Coverage report output strategy. One of " + Arrays.toString(OutputStrategy.values()));
        final Option includeInlineScriptsOpt = new Option("d", "include-inline-scripts", false,
                "Whether to include inline scripts into instrumentation by default (default is false)");
        final Option backgroundJavaScriptTimeoutOpt = new Option("j", "background-javascript-timeout", true,
                "How long to wait for background JavaScript to finish running (in milliseconds, default is 5 minutes)");
        final Option browserVersionOpt = new Option("v", "browser-version", true,
                "Determines the browser and version profile that HtmlUnit will simulate");
        final Option reportFormatsOpt = new Option(null, "report-formats", true,
                "A comma-separated list of formats of the reports to be generated. Valid values are: HTML, RAW, CSV");
        final Option helpOpt = new Option("h", "help", false, "Print this message");
        final Options options = new Options();
        options.addOption(baseDirOpt);
        options.addOption(includeOpt);
        options.addOption(excludeOpt);
        options.addOption(outputDirOpt);
        options.addOption(outputInstrumentedFilesOpt);
        options.addOption(noInstrumentPatternOpt);
        options.addOption(threadCountOpt);
        options.addOption(outputStrategyOpt);
        options.addOption(includeInlineScriptsOpt);
        options.addOption(helpOpt);
        options.addOption(sourcesToPreloadOpt);
        options.addOption(sourcesToPreloadEncodingOpt);
        options.addOption(backgroundJavaScriptTimeoutOpt);
        options.addOption(browserVersionOpt);
        options.addOption(reportFormatsOpt);
        try {
            CommandLineParser parser = new GnuParser();
            CommandLine line = parser.parse(options, args, false);
            baseDirOpt.setRequired(true);
            includeOpt.setRequired(true);
            outputDirOpt.setRequired(true);
            options.addOption(baseDirOpt);
            options.addOption(includeOpt);
            options.addOption(outputDirOpt);
            if (line.hasOption(helpOpt.getLongOpt())) {
                printHelpAndExit(options);
            }
            parser = new GnuParser();
            line = parser.parse(options, args);
            final File baseDir = new File(line.getOptionValue(baseDirOpt.getLongOpt()));
            final String includes = line.getOptionValue(includeOpt.getLongOpt());
            final String excludes = line.getOptionValue(excludeOpt.getLongOpt());
            final File outputDir = new File(line.getOptionValue(outputDirOpt.getLongOpt()));
            final CoverageGenerator gen = new CoverageGenerator(baseDir, includes, excludes, outputDir);
            if (line.hasOption(outputInstrumentedFilesOpt.getLongOpt())) {
                gen.setOutputInstrumentedFiles(true);
            }
            gen.setNoInstrumentPatterns(line.getOptionValues(noInstrumentPatternOpt.getLongOpt()));
            gen.setSourcesToPreload(line.getOptionValue(sourcesToPreloadOpt.getLongOpt()));
            gen.setOutputStrategy(line.getOptionValue(outputStrategyOpt.getLongOpt()));
            final String threadCount = line.getOptionValue(threadCountOpt.getLongOpt());
            if (threadCount != null) {
                try {
                    gen.setThreadCount(Integer.parseInt(threadCount));
                } catch (final Exception e) {
                    System.err.println("Invalid thread count");
                    printHelpAndExit(options);
                }
            }
            if (line.hasOption(includeInlineScriptsOpt.getLongOpt())) {
                gen.setIncludeInlineScripts(true);
            }
            final String backgroundJavaScriptTimeout = line.getOptionValue(backgroundJavaScriptTimeoutOpt.getLongOpt());
            if (backgroundJavaScriptTimeout != null) {
                try {
                    gen.setBackgroundJavaScriptTimeout(Long.valueOf(backgroundJavaScriptTimeout));
                } catch (final Exception e) {
                    System.err.println("Invalid timeout");
                    printHelpAndExit(options);
                }
            }
            gen.setBrowserVersion(line.getOptionValue(browserVersionOpt.getLongOpt()));
            gen.setReportFormats(line.getOptionValue(reportFormatsOpt.getLongOpt()));
            gen.run();
        } catch (final MissingOptionException e) {
            System.err.println(e.getMessage());
            printHelpAndExit(options);
        } catch (final UnrecognizedOptionException e) {
            System.err.println(e.getMessage());
            printHelpAndExit(options);
        } catch (final ParseException e) {
            System.err.println(e.getMessage());
            System.exit(1);
        }
    }


Input:
    public void onSensorChanged(SensorEvent arg) {
        double leftPower, rightPower;
        double accel = (arg.values[2]/50.) * 100;
        double orient = (arg.values[1]/50.) * 50;
        leftPower = accel;
        rightPower = accel;
        if(arg.values[1] > 0)
        {
            leftPower += orient;
        }
        else
        {
            rightPower -= orient;
        }
        if(leftPower > 100) leftPower = 100;
        if(leftPower < -100) leftPower = -100;
        if(rightPower > 100) rightPower = 100;
        if(rightPower < -100) rightPower = -100;
        this.tv.setText(String.format("%.2f %.2f %.2f\n%3.0f %3.0f\n%3.0f %3.0f", arg.values[0], arg.values[1], arg.values[2], accel, orient, leftPower, rightPower));
    }

Output:
    public void onSensorChanged(SensorEvent arg) {
        double leftPower, rightPower;
        double accel = (arg.values[2]/50.) * 100;
        double orient = (arg.values[1]/50.) * 50;
        leftPower = accel;
        rightPower = accel;
        if(arg.values[1] > 0)
        {
            leftPower -= orient;
        }
        else
        {
            rightPower += orient;
        }
        if(leftPower > 100) leftPower = 100;
        if(leftPower < -100) leftPower = -100;
        if(rightPower > 100) rightPower = 100;
        if(rightPower < -100) rightPower = -100;
        this.tv.setText(String.format("%.2f %.2f %.2f\n%3.0f %3.0f\n%3.0f %3.0f", arg.values[0], arg.values[1], arg.values[2], accel, orient, leftPower, rightPower));
    }


Input:
    public static void printLabelings(Classifier classifier, File vectorfile, String outputFilename) throws IOException {
        CsvIterator reader =
            new CsvIterator(new FileReader(vectorfile),
                            "(.+)\\t(.+)\\t(.*)",
                            3, 2, 1);
        Iterator<Instance> instances =
            classifier.getInstancePipe().newIteratorFrom(reader);
        CsvIterator reader2 =
            new CsvIterator(new FileReader(vectorfile),
                            "(.+)\\t(.+)\\t(.*)",
                            3, 2, 1);
        PrintStream output = new PrintStream(new FileOutputStream(outputFilename));
        while (instances.hasNext()) {
        	Instance reader2Instance = reader2.next();
        	Instance instance = (Instance) instances.next();
            Labeling labeling = classifier.classify(instance).getLabeling();
            output.print(instance.getName() + "\t");
            Object trueLabel = reader2Instance.getTarget();
            if(trueLabel!=null)
            	output.print(trueLabel.toString() + "\t");
            for (int rank = 0; rank < labeling.numLocations(); rank++){
                output.print(labeling.getLabelAtRank(rank) + ":" +
                                 labeling.getValueAtRank(rank) + " ");
            }
            output.println();
        }
    }

Output:
    public static void printLabelings(Classifier classifier, File vectorfile, String outputFilename) throws IOException {
        CsvIterator reader =
            new CsvIterator(new FileReader(vectorfile),
                            "(.+)\\t(.*)\\t(.*)",
                            3, 2, 1);
        Iterator<Instance> instances =
            classifier.getInstancePipe().newIteratorFrom(reader);
        CsvIterator reader2 =
            new CsvIterator(new FileReader(vectorfile),
                            "(.+)\\t(.*)\\t(.*)",
                            3, 2, 1);
        PrintStream output = new PrintStream(new FileOutputStream(outputFilename));
        while (instances.hasNext()) {
        	Instance reader2Instance = reader2.next();
        	Instance instance = (Instance) instances.next();
            Labeling labeling = classifier.classify(instance).getLabeling();
            output.print(instance.getName() + "\t");
            Object trueLabel = reader2Instance.getTarget();
            if(trueLabel!=null)
            	output.print(trueLabel.toString() + "\t");
            for (int rank = 0; rank < labeling.numLocations(); rank++){
                output.print(labeling.getLabelAtRank(rank) + ":" +
                                 labeling.getValueAtRank(rank) + " ");
            }
            output.println();
        }
    }


Input:
    protected void run() throws Exception {
        DBService dbs = core.getDBService();
        if (!dbs.isDBSessionActive()) {
            dbs.startDBSession();
        }
        sp = dbs.attachObjectToDBSession(sp);
        HashMap<String, Object> properties = new HashMap<String, Object>();
        properties.put("project", sp);
        List<?> assosRules = dbs.findObjectsByProperties(InvocationRule.class,
                properties);
        if ((assosRules != null) && (assosRules.size() > 0)) {
            for (Object nextDAO : assosRules) {
                InvocationRule.deleteInvocationRule(dbs,
                        core.getMetricActivator(), (InvocationRule) nextDAO);
            }
        }
        List<Plugin> ps = (List<Plugin>) dbs.doHQL("from Plugin");
        for (Plugin p : ps ) {
            AlitheiaPlugin ap = core.getPluginAdmin().getPlugin(core.getPluginAdmin().getPluginInfo(p.getHashcode()));
            ap.cleanup(sp);
        }
        boolean success = true;
        ClusterNodeProject cnp = ClusterNodeProject.getProjectAssignment(sp);
        if (cnp != null) {
            success &= dbs.deleteRecord(cnp);
        }
        List<StoredProjectConfig> confParams = StoredProjectConfig.fromProject(sp);
        if (!confParams.isEmpty()) {
        	success &= dbs.deleteRecords(confParams);
        }
        success &= dbs.deleteRecord(sp);
        if (success) {
            dbs.commitDBSession();
        } else {
            dbs.rollbackDBSession();
        }
    }

Output:
    protected void run() throws Exception {
        DBService dbs = core.getDBService();
        if (!dbs.isDBSessionActive()) {
            dbs.startDBSession();
        }
        sp = dbs.attachObjectToDBSession(sp);
        HashMap<String, Object> properties = new HashMap<String, Object>();
        properties.put("project", sp);
        List<?> assosRules = dbs.findObjectsByProperties(InvocationRule.class,
                properties);
        if ((assosRules != null) && (assosRules.size() > 0)) {
            for (Object nextDAO : assosRules) {
                InvocationRule.deleteInvocationRule(dbs,
                        core.getMetricActivator(), (InvocationRule) nextDAO);
            }
        }
        List<Plugin> ps = (List<Plugin>) dbs.doHQL("from Plugin");
        for (Plugin p : ps ) {
            AlitheiaPlugin ap = core.getPluginAdmin().getPlugin(core.getPluginAdmin().getPluginInfo(p.getHashcode()));
            ap.cleanup(sp);
        }
        boolean success = true;
        List<StoredProjectConfig> confParams = StoredProjectConfig.fromProject(sp);
        if (!confParams.isEmpty()) {
        	success &= dbs.deleteRecords(confParams);
        }
        success &= dbs.deleteRecord(sp);
        if (success) {
            dbs.commitDBSession();
        } else {
            dbs.rollbackDBSession();
        }
    }


Input:
    protected int run() throws Exception {
        Team targetTeam = validateTeam(team, create, stderr);
        Hudson h = Hudson.getInstance();
        TeamManager teamManager = h.getTeamManager();
        if (team != null && targetTeam == null) {
            return -1;
        }
        String qualifiedJobName = targetTeam == null
                ? getNewJobName(name)
                : teamManager.getRawTeamQualifiedJobName(targetTeam, name);
        TopLevelItem item = h.getItem(qualifiedJobName);
        if (item == null && !create) {
            stderr.println("Job '" + qualifiedJobName + "' does not exist and create is set to false");
            return -1;
        } else if (item != null && create) {
            stderr.println("Job '" + qualifiedJobName + "' already exists and create is set to true");
            return -1;
        }
        if (item == null) {
            name = name.trim();
            if (!isGoodName(name, stderr)) {
                return -1;
            }
            h.checkPermission(Item.CREATE);
            h.createProjectFromXML(name, team, stdin);
        } else {
            XmlFile oldConfigXml = null;
            Object oldItem = null;
            try {
                h.checkPermission(Job.CONFIGURE);
                File rootDirOfJob = teamManager.getRootFolderForJob(item.getName());
                oldConfigXml = Items.getConfigFile(rootDirOfJob);
                oldItem = oldConfigXml.read();
                File configXml = oldConfigXml.getFile();
                IOUtils.copy(stdin, configXml);
                h.reloadProjectFromDisk(configXml.getParentFile());
            } catch (IOException e) {
                if (oldConfigXml != null && oldItem != null) {
                    oldConfigXml.write(oldItem);
                }
                throw e;
            }
        }
        return 0;
    }

Output:
    protected int run() throws Exception {
        Team targetTeam = validateTeam(team, create, stderr);
        Hudson h = Hudson.getInstance();
        TeamManager teamManager = h.getTeamManager();
        if (team != null && targetTeam == null) {
            return -1;
        }
        String qualifiedJobName = !create ? name :
                (targetTeam == null
                    ? getNewJobName(name)
                    : teamManager.getRawTeamQualifiedJobName(targetTeam, name));
        TopLevelItem item = h.getItem(qualifiedJobName);
        if (item == null && !create) {
            stderr.println("Job '" + qualifiedJobName + "' does not exist and create is set to false");
            return -1;
        } else if (item != null && create) {
            stderr.println("Job '" + qualifiedJobName + "' already exists and create is set to true");
            return -1;
        }
        if (item == null) {
            name = name.trim();
            if (!isGoodName(name, stderr)) {
                return -1;
            }
            h.checkPermission(Item.CREATE);
            h.createProjectFromXML(name, team, stdin);
        } else {
            XmlFile oldConfigXml = null;
            Object oldItem = null;
            try {
                item.checkPermission(Job.CONFIGURE);
                File rootDirOfJob = teamManager.getRootFolderForJob(item.getName());
                oldConfigXml = Items.getConfigFile(rootDirOfJob);
                oldItem = oldConfigXml.read();
                File configXml = oldConfigXml.getFile();
                IOUtils.copy(stdin, configXml);
                h.reloadProjectFromDisk(configXml.getParentFile());
            } catch (IOException e) {
                if (oldConfigXml != null && oldItem != null) {
                    oldConfigXml.write(oldItem);
                }
                throw e;
            }
        }
        return 0;
    }


Input:
	public List<DevInfo> findAllDevs() {
		List<PcapIf> alldevs = new ArrayList<PcapIf>();
		StringBuilder errbuf = new StringBuilder();
		List<DevInfo> devs = new ArrayList<DevInfo>();
		int r = Pcap.findAllDevs(alldevs, errbuf);
		if (r == Pcap.NOT_OK || alldevs.isEmpty()) {
			System.err.printf("Cannot read list of devices, error is %s\n",
					errbuf.toString());
			return null;
		}
		int index = 0;
		for (PcapIf device : alldevs)
			devs.add(new DevInfo(index, device.getName(), device.getDescription()));
		return devs;
	}

Output:
	public List<DevInfo> findAllDevs() {
		List<PcapIf> alldevs = new ArrayList<PcapIf>();
		StringBuilder errbuf = new StringBuilder();
		List<DevInfo> devs = new ArrayList<DevInfo>();
		int r = Pcap.findAllDevs(alldevs, errbuf);
		if (r == Pcap.NOT_OK || alldevs.isEmpty()) {
			System.err.printf("Cannot read list of devices, error is %s\n",
					errbuf.toString());
			return null;
		}
		int index = 0;
		for (PcapIf device : alldevs)
			devs.add(new DevInfo(index++, device.getName(), device.getDescription()));
		return devs;
	}


Input:
	public void SchritteKopieren(Prozess prozessVorlage, Prozess prozessKopie) {
		HashSet<Schritt> mySchritte = new HashSet<Schritt>();
		for (Schritt step : prozessVorlage.getSchritteList()) {
			Schritt stepneu = new Schritt();
			stepneu.setTypAutomatisch(step.isTypAutomatisch());
			stepneu.setScriptname1(step.getScriptname1());
			stepneu.setScriptname2(step.getScriptname2());
			stepneu.setScriptname3(step.getScriptname3());
			stepneu.setScriptname4(step.getScriptname4());
			stepneu.setScriptname5(step.getScriptname5());
			stepneu.setTypAutomatischScriptpfad(step.getTypAutomatischScriptpfad());
			stepneu.setTypAutomatischScriptpfad2(step.getTypAutomatischScriptpfad2());
			stepneu.setTypAutomatischScriptpfad3(step.getTypAutomatischScriptpfad3());
			stepneu.setTypAutomatischScriptpfad4(step.getTypAutomatischScriptpfad4());
			stepneu.setTypAutomatischScriptpfad5(step.getTypAutomatischScriptpfad5());
			stepneu.setBatchStep(step.getBatchStep());
			stepneu.setTypScriptStep(step.getTypScriptStep());
			stepneu.setTypBeimAnnehmenAbschliessen(step.isTypBeimAnnehmenAbschliessen());
			stepneu.setTypBeimAnnehmenModul(step.isTypBeimAnnehmenModul());
			stepneu.setTypBeimAnnehmenModulUndAbschliessen(step.isTypBeimAnnehmenModulUndAbschliessen());
			stepneu.setTypExportDMS(step.isTypExportDMS());
			stepneu.setTypExportRus(step.isTypExportRus());
			stepneu.setTypImagesLesen(step.isTypImagesLesen());
			stepneu.setTypImagesSchreiben(step.isTypImagesSchreiben());
			stepneu.setTypImportFileUpload(step.isTypImportFileUpload());
			stepneu.setTypMetadaten(step.isTypMetadaten());
			stepneu.setPrioritaet(step.getPrioritaet());
			stepneu.setBearbeitungsstatusEnum(step.getBearbeitungsstatusEnum());
			stepneu.setReihenfolge(step.getReihenfolge());
			stepneu.setTitel(step.getTitel());
			stepneu.setHomeverzeichnisNutzen(step.getHomeverzeichnisNutzen());
			stepneu.setProzess(prozessKopie);
			stepneu.setStepPlugin(step.getStepPlugin());
			stepneu.setValidationPlugin(step.getValidationPlugin());
			stepneu.setTypBeimAbschliessenVerifizieren(step.isTypBeimAbschliessenVerifizieren());
			HashSet<Schritteigenschaft> myEigenschaften = new HashSet<Schritteigenschaft>();
			for (Schritteigenschaft eig : step.getEigenschaftenList()) {
				Schritteigenschaft eigneu = new Schritteigenschaft();
				eigneu.setIstObligatorisch(eig.isIstObligatorisch());
				eigneu.setType(eig.getType());
				eigneu.setTitel(eig.getTitel());
				eigneu.setWert(eig.getWert());
				eigneu.setSchritt(stepneu);
				myEigenschaften.add(eigneu);
			}
			stepneu.setEigenschaften(myEigenschaften);
			HashSet<Benutzer> myBenutzer = new HashSet<Benutzer>();
			for (Benutzer benneu : step.getBenutzer()) {
				myBenutzer.add(benneu);
			}
			stepneu.setBenutzer(myBenutzer);
			HashSet<Benutzergruppe> myBenutzergruppen = new HashSet<Benutzergruppe>();
			for (Benutzergruppe grupneu : step.getBenutzergruppen()) {
				myBenutzergruppen.add(grupneu);
			}
			stepneu.setBenutzergruppen(myBenutzergruppen);
			mySchritte.add(stepneu);
		}
		prozessKopie.setSchritte(mySchritte);
	}

Output:
	public void SchritteKopieren(Prozess prozessVorlage, Prozess prozessKopie) {
		HashSet<Schritt> mySchritte = new HashSet<Schritt>();
		for (Schritt step : prozessVorlage.getSchritteList()) {
			Schritt stepneu = new Schritt();
			stepneu.setTypAutomatisch(step.isTypAutomatisch());
			stepneu.setScriptname1(step.getScriptname1());
			stepneu.setScriptname2(step.getScriptname2());
			stepneu.setScriptname3(step.getScriptname3());
			stepneu.setScriptname4(step.getScriptname4());
			stepneu.setScriptname5(step.getScriptname5());
			stepneu.setTypAutomatischScriptpfad(step.getTypAutomatischScriptpfad());
			stepneu.setTypAutomatischScriptpfad2(step.getTypAutomatischScriptpfad2());
			stepneu.setTypAutomatischScriptpfad3(step.getTypAutomatischScriptpfad3());
			stepneu.setTypAutomatischScriptpfad4(step.getTypAutomatischScriptpfad4());
			stepneu.setTypAutomatischScriptpfad5(step.getTypAutomatischScriptpfad5());
			stepneu.setBatchStep(step.getBatchStep());
			stepneu.setTypScriptStep(step.getTypScriptStep());
			stepneu.setTypBeimAnnehmenAbschliessen(step.isTypBeimAnnehmenAbschliessen());
			stepneu.setTypBeimAnnehmenModul(step.isTypBeimAnnehmenModul());
			stepneu.setTypBeimAnnehmenModulUndAbschliessen(step.isTypBeimAnnehmenModulUndAbschliessen());
			stepneu.setTypModulName(step.getTypModulName());
			stepneu.setTypExportDMS(step.isTypExportDMS());
			stepneu.setTypExportRus(step.isTypExportRus());
			stepneu.setTypImagesLesen(step.isTypImagesLesen());
			stepneu.setTypImagesSchreiben(step.isTypImagesSchreiben());
			stepneu.setTypImportFileUpload(step.isTypImportFileUpload());
			stepneu.setTypMetadaten(step.isTypMetadaten());
			stepneu.setPrioritaet(step.getPrioritaet());
			stepneu.setBearbeitungsstatusEnum(step.getBearbeitungsstatusEnum());
			stepneu.setReihenfolge(step.getReihenfolge());
			stepneu.setTitel(step.getTitel());
			stepneu.setHomeverzeichnisNutzen(step.getHomeverzeichnisNutzen());
			stepneu.setProzess(prozessKopie);
			stepneu.setStepPlugin(step.getStepPlugin());
			stepneu.setValidationPlugin(step.getValidationPlugin());
			stepneu.setTypBeimAbschliessenVerifizieren(step.isTypBeimAbschliessenVerifizieren());
			HashSet<Schritteigenschaft> myEigenschaften = new HashSet<Schritteigenschaft>();
			for (Schritteigenschaft eig : step.getEigenschaftenList()) {
				Schritteigenschaft eigneu = new Schritteigenschaft();
				eigneu.setIstObligatorisch(eig.isIstObligatorisch());
				eigneu.setType(eig.getType());
				eigneu.setTitel(eig.getTitel());
				eigneu.setWert(eig.getWert());
				eigneu.setSchritt(stepneu);
				myEigenschaften.add(eigneu);
			}
			stepneu.setEigenschaften(myEigenschaften);
			HashSet<Benutzer> myBenutzer = new HashSet<Benutzer>();
			for (Benutzer benneu : step.getBenutzer()) {
				myBenutzer.add(benneu);
			}
			stepneu.setBenutzer(myBenutzer);
			HashSet<Benutzergruppe> myBenutzergruppen = new HashSet<Benutzergruppe>();
			for (Benutzergruppe grupneu : step.getBenutzergruppen()) {
				myBenutzergruppen.add(grupneu);
			}
			stepneu.setBenutzergruppen(myBenutzergruppen);
			mySchritte.add(stepneu);
		}
		prozessKopie.setSchritte(mySchritte);
	}


Input:
	public SampleProvider() {
		super(AUTHORITY, DB_VERSION);
		final DBHelper messageHelper = new GenericDBHelper(Message.class,
				Message.CONTENT_URI);
		addDirAndItemUri(messageHelper, Message.PATH);
	}

Output:
	public SampleProvider() {
		super(AUTHORITY, DB_VERSION);
		final DBHelper messageHelper = new GenericDBHelper(Message.class);
		addDirAndItemUri(messageHelper, Message.PATH);
	}


Input:
	private void print(Method method, Object[] args) {
        if (shouldPrint()) {
        	if ("prepareStmt".equals(method.getName())) {
        		print("prepareStmt: " + args[0]);
                if (((String)args[0]).indexOf("ODE_SCOPE") > 0) {
                    for (StackTraceElement traceElement : Thread.currentThread().getStackTrace()) {
                        print(traceElement.toString());
                    }
                }
        	} else if ("prepareCall".equals(method.getName())) {
        		print("prepareCall: " + args[0]);
        	} else if ("close".equals(method.getName())) {
        		print("close()");
        	} else if ("commit".equals(method.getName())) {
        		print("commit()");
        	} else if ("rollback".equals(method.getName())) {
        		print("rollback()");
        	} else if ("setTransactionIsolation".equals(method.getName())) {
        		print("Set isolation level to " + args[0]);
        	}
        	  else if (method.getName().startsWith("execute")) {
        		print(method.getName() + ", " + getParams());
        	} else if ("clearParameters".equals(method.getName())) {
        		_paramsByIdx.clear();
        		_paramsByName.clear();
        	} else if ("setNull".equals(method.getName())) {
        		if (String.class.isAssignableFrom(args[0].getClass())) {
        			_paramsByName.put((String)args[0], null);
        		} else if (Integer.class.isAssignableFrom(args[0].getClass())) {
        			_paramsByIdx.put((Integer)args[0], null);
        		}
        	} else if (PARAMSTYPES.contains(method.getName())){
        		if (String.class.isAssignableFrom(args[0].getClass())) {
        			_paramsByName.put((String)args[0], args[1]);
        		} else if (Integer.class.isAssignableFrom(args[0].getClass())) {
        			_paramsByIdx.put((Integer)args[0], args[1]);
        		}
        	}
        }
	}

Output:
	private void print(Method method, Object[] args) {
        if (shouldPrint()) {
        	if ("prepareStatement".equals(method.getName())) {
        		print("prepareStmt: " + args[0]);
                if (((String)args[0]).indexOf("ODE_SCOPE") > 0) {
                    for (StackTraceElement traceElement : Thread.currentThread().getStackTrace()) {
                        print(traceElement.toString());
                    }
                }
        	} else if ("prepareCall".equals(method.getName())) {
        		print("prepareCall: " + args[0]);
        	} else if ("close".equals(method.getName())) {
        		print("close()");
        	} else if ("commit".equals(method.getName())) {
        		print("commit()");
        	} else if ("rollback".equals(method.getName())) {
        		print("rollback()");
        	} else if ("setTransactionIsolation".equals(method.getName())) {
        		print("Set isolation level to " + args[0]);
        	}
        	  else if (method.getName().startsWith("execute")) {
        		print(method.getName() + ", " + getParams());
        	} else if ("clearParameters".equals(method.getName())) {
        		_paramsByIdx.clear();
        		_paramsByName.clear();
        	} else if ("setNull".equals(method.getName())) {
        		if (String.class.isAssignableFrom(args[0].getClass())) {
        			_paramsByName.put((String)args[0], null);
        		} else if (Integer.class.isAssignableFrom(args[0].getClass())) {
        			_paramsByIdx.put((Integer)args[0], null);
        		}
        	} else if (PARAMSTYPES.contains(method.getName())){
        		if (String.class.isAssignableFrom(args[0].getClass())) {
        			_paramsByName.put((String)args[0], args[1]);
        		} else if (Integer.class.isAssignableFrom(args[0].getClass())) {
        			_paramsByIdx.put((Integer)args[0], args[1]);
        		}
        	}
        }
	}


Input:
    private void droid6() throws FileNotFoundException, IOException, CommandExecutionException {
        BinarySignatureIdentification bin = new BinarySignatureIdentification(file, sigFile);
        List<IdentificationResult> resultList = bin.getResultList();
        List<IdentificationResult> extResultList = bin.getExtResultList();
        if(resultList.size() == 1){
            IdentificationResult result = resultList.get(0);
            System.out.println("droidMatch: true");
            System.out.println("droidPuid: " + result.getPuid());
            System.out.println("droidMimeType: " + result.getMimeType());
            System.out.println("droidMethod: binary signature" );
            if(result.getName() != null)
            System.out.println("droidFileName: " + result.getName());
            if(result.getVersion() != null)
            System.out.println("droidFileVersion: " + result.getVersion());
        }
        if(resultList.isEmpty()){
            if(extResultList.isEmpty()){
                System.out.println("droidMatch: false");
            }
            else{
                System.out.println("droidMatch: true");
                System.out.println("droidPuid: " + extResultList.get(0).getPuid());
                System.out.println("droidMimeType: " + extResultList.get(0).getMimeType());
                System.out.println("droidMethod: extension" );
            }
        }
    }

Output:
    private void droid6() throws FileNotFoundException, IOException, CommandExecutionException {
        BinarySignatureIdentification bin = new BinarySignatureIdentification(file, sigFile);
        List<IdentificationResult> resultList = bin.getResultList();
        List<IdentificationResult> extResultList = bin.getExtResultList();
        if(resultList.size() == 1){
            IdentificationResult result = resultList.get(0);
            System.out.println("droidMatch: true");
            System.out.println("droidPuid: " + result.getPuid());
            if(result.getMimeType() != null)
            System.out.println("droidMimeType: " + result.getMimeType());
            if(result.getName() != null)
            System.out.println("droidFileName: " + result.getName());
            if(result.getVersion() != null)
            System.out.println("droidFileVersion: " + result.getVersion());
            System.out.println("droidIdentificationMethod: binary signature" );
        }
        if(resultList.isEmpty()){
            if(extResultList.isEmpty()){
                System.out.println("droidMatch: false");
            }
            else{
                IdentificationResult result = extResultList.get(0);
                System.out.println("droidMatch: true");
                System.out.println("droidPuid: " + result.getPuid());
                    if(result.getMimeType() != null)
                System.out.println("droidMimeType: " + result.getMimeType());
                    if(result.getName() != null)
                System.out.println("droidFileName: " + result.getName());
                    if(result.getVersion() != null)
                System.out.println("droidFileVersion: " + result.getVersion());
                System.out.println("droidIdentificationMethod: extension" );
            }
        }
    }


Input:
	protected int[] sortModifierKeys(final int modifierKeys) {
		final IKeyLookup lookup = KeyLookupFactory.getDefault();
		final String platform = SWT.getPlatform();
		final int[] sortedKeys = new int[4];
		int index = 0;
		if ("win32".equals(platform) || "wpf".equals(platform)) {
			if ((modifierKeys & lookup.getCtrl()) != 0) {
				sortedKeys[index++] = lookup.getCtrl();
			}
			if ((modifierKeys & lookup.getAlt()) != 0) {
				sortedKeys[index++] = lookup.getAlt();
			}
			if ((modifierKeys & lookup.getShift()) != 0) {
				sortedKeys[index++] = lookup.getShift();
			}
		} else if ("gtk".equals(platform) || "motif".equals(platform)) {
			if ((modifierKeys & lookup.getShift()) != 0) {
				sortedKeys[index++] = lookup.getShift();
			}
			if ((modifierKeys & lookup.getCtrl()) != 0) {
				sortedKeys[index++] = lookup.getCtrl();
			}
			if ((modifierKeys & lookup.getAlt()) != 0) {
				sortedKeys[index++] = lookup.getAlt();
			}
		} else if ("carbon".equals(platform)) {
			if ((modifierKeys & lookup.getShift()) != 0) {
				sortedKeys[index++] = lookup.getShift();
			}
			if ((modifierKeys & lookup.getCtrl()) != 0) {
				sortedKeys[index++] = lookup.getCtrl();
			}
			if ((modifierKeys & lookup.getAlt()) != 0) {
				sortedKeys[index++] = lookup.getAlt();
			}
			if ((modifierKeys & lookup.getCommand()) != 0) {
				sortedKeys[index++] = lookup.getCommand();
			}
		}
		return sortedKeys;
	}

Output:
	protected int[] sortModifierKeys(final int modifierKeys) {
		final IKeyLookup lookup = KeyLookupFactory.getDefault();
		final String platform = SWT.getPlatform();
		final int[] sortedKeys = new int[4];
		int index = 0;
		if ("win32".equals(platform) || "wpf".equals(platform)) {
			if ((modifierKeys & lookup.getCtrl()) != 0) {
				sortedKeys[index++] = lookup.getCtrl();
			}
			if ((modifierKeys & lookup.getAlt()) != 0) {
				sortedKeys[index++] = lookup.getAlt();
			}
			if ((modifierKeys & lookup.getShift()) != 0) {
				sortedKeys[index++] = lookup.getShift();
			}
		} else if ("gtk".equals(platform) || "motif".equals(platform)) {
			if ((modifierKeys & lookup.getShift()) != 0) {
				sortedKeys[index++] = lookup.getShift();
			}
			if ((modifierKeys & lookup.getCtrl()) != 0) {
				sortedKeys[index++] = lookup.getCtrl();
			}
			if ((modifierKeys & lookup.getAlt()) != 0) {
				sortedKeys[index++] = lookup.getAlt();
			}
		} else if ("carbon".equals(SWT.getPlatform()) || "cocoa".equals(SWT.getPlatform())) {
			if ((modifierKeys & lookup.getShift()) != 0) {
				sortedKeys[index++] = lookup.getShift();
			}
			if ((modifierKeys & lookup.getCtrl()) != 0) {
				sortedKeys[index++] = lookup.getCtrl();
			}
			if ((modifierKeys & lookup.getAlt()) != 0) {
				sortedKeys[index++] = lookup.getAlt();
			}
			if ((modifierKeys & lookup.getCommand()) != 0) {
				sortedKeys[index++] = lookup.getCommand();
			}
		}
		return sortedKeys;
	}