auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void handleMCBrand(PluginMessage pluginMessage, PluginMessageEvent event) throws Exception { if ( con.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_8 ) { try { ByteBuf brand = Unpooled.wrappedBuffer( pluginMessage.getData() ); String serverBrand = DefinedPacket.readString( brand ); brand.release(); brand = ByteBufAllocator.DEFAULT.heapBuffer(); DefinedPacket.writeString( bungee.getName() + " (" + bungee.getVersion() + ")" + " <- " + serverBrand, brand ); pluginMessage.setData( brand.array().clone() ); brand.release(); } catch ( Exception ignored ) { return; } } else { String serverBrand = new String( pluginMessage.getData(), "UTF-8" ); pluginMessage.setData((bungee.getName() + " (" + bungee.getVersion() + ")" + " <- " + serverBrand).getBytes("UTF-8")); } con.unsafe().sendPacket( pluginMessage ); throw CancelSendSignal.INSTANCE; }

Target:
private void handleMCBrand(PluginMessage pluginMessage, PluginMessageEvent event) throws Exception { if ( con.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_8 ) { try { ByteBuf brand = Unpooled.wrappedBuffer( pluginMessage.getData() ); String serverBrand = DefinedPacket.readString( brand ); brand.release(); brand = ByteBufAllocator.DEFAULT.heapBuffer(); DefinedPacket.writeString( bungee.getName() + " (" + bungee.getVersion() + ")" + " <- " + serverBrand, brand ); pluginMessage.setData( brand.array().clone() ); brand.release(); } catch ( Exception ignored ) { return; } } else { String serverBrand = new String( pluginMessage.getData(), Charsets.UTF_8 ); pluginMessage.setData((bungee.getName() + " (" + bungee.getVersion() + ")" + " <- " + serverBrand).getBytes(Charsets.UTF_8)); } con.unsafe().sendPacket( pluginMessage ); throw CancelSendSignal.INSTANCE; }
Source:
public void addHitPolicyOption( final GuidedDecisionTable52.HitPolicy hitPolicy ) { final AnchorElement anchor = Document.get() .createAnchorElement(); anchor.setInnerText( HitPolicyInternationalizer.internationalize( hitPolicy ) ); Event.sinkEvents( anchor, Event.ONCLICK ); Event.setEventListener( anchor, event -> { if ( Event.ONCLICK == event.getTypeInt() ) { setSelection( hitPolicy ); ValueChangeEvent.fire( HitPolicySelectorViewImpl.this, hitPolicy ); } } ); final LIElement li = Document.get() .createLIElement(); li.appendChild( anchor ); listOfAvailableHitModes.appendChild( (Node) li ); }

Target:
public void addHitPolicyOption( final GuidedDecisionTable52.HitPolicy hitPolicy ) { final AnchorElement anchor = Document.get() .createAnchorElement(); anchor.setInnerText( HitPolicyInternationalizer.internationalize( hitPolicy ) ); Event.sinkEvents( anchor, Event.ONCLICK ); Event.setEventListener( anchor, event -> { if ( Event.ONCLICK == event.getTypeInt() ) { presenter.onHitPolicySelected( hitPolicy ); } } ); final LIElement li = Document.get() .createLIElement(); li.appendChild( anchor ); listOfAvailableHitModes.appendChild( (Node) li ); }
Source:
public Collection<Group> listGroupsByIds(Collection<Long> groupIds) throws IOException { List<Group> groups = new ArrayList<>(groupIds.size()); for (Long id : groupIds) { groups.add(getGroupById(id)); } return groups; }

Target:
public Collection<Group> listGroupsByIds(Collection<Long> groupIds) throws IOException { Criteria criteria = currentSession().createCriteria(UserImpl.class); criteria.add(Restrictions.in("id", groupIds)); @SuppressWarnings("unchecked") List<Group> results = criteria.list(); return results; }
Source:
boolean monitor(Container container, IProgressMonitor progressMonitor) { if (executor == null || executor.isShutdown()) { start(); } final ConcurrentMap<Path, WatchKey> registeredKeys = new ConcurrentHashMap<>(16, 0.75f, fileWalkerConcurrencyLevel); final JobGroup jobGroup = new JobGroup("Monitor registrar", fileWalkerConcurrencyLevel, 1); final RecursiveResourceRegistrarJob job = new RecursiveResourceRegistrarJob(container, this, registeredKeys); job.setJobGroup(jobGroup); job.schedule(); final Job joinJob = Job.createSystem(pm -> { try { jobGroup.join(0, pm); } catch (OperationCanceledException e) { cancelAllWatchKeys(registeredKeys); monitorFailed(container); } catch (InterruptedException e) { cancelAllWatchKeys(registeredKeys); monitorFailed(container); Thread.currentThread().interrupt(); } if (jobGroup.getResult().isOK()) { synchronized (watchedKeys) { for (Map.Entry<Path, WatchKey> entry : registeredKeys.entrySet()) { if (!isMonitored(entry.getKey())) { watchedKeys.put(entry.getValue(), entry.getKey()); } else { entry.getValue().cancel(); } } } } else { cancelAllWatchKeys(registeredKeys); ResourcesPlugin.getPlugin().getLog().log(jobGroup.getResult()); } if (Policy.DEBUG_AUTO_REFRESH) Policy.debug(DEBUG_PREFIX + "now watching " + watchedKeys.watchedPathsCount() + " paths with " + watchedKeys.watchKeysCount() + " keys"); }); joinJob.schedule(); return true; }

Target:
boolean monitor(Container container, IProgressMonitor progressMonitor) { if (executor == null || executor.isShutdown()) { start(); } final ConcurrentMap<Path, WatchKey> registeredKeys = new ConcurrentHashMap<>(16, 0.75f, fileWalkerConcurrencyLevel); final JobGroup jobGroup = new JobGroup("Monitor registrar", fileWalkerConcurrencyLevel, 1); final RecursiveResourceRegistrarJob job = new RecursiveResourceRegistrarJob(container, this, registeredKeys); job.setJobGroup(jobGroup); job.schedule(); final Job joinJob = Job.createSystem(pm -> { try { jobGroup.join(0, pm); } catch (OperationCanceledException | InterruptedException e) { jobGroup.cancel(); cancelAllWatchKeys(registeredKeys); monitorFailed(container); } if (jobGroup.getResult().isOK()) { synchronized (watchedKeys) { for (Map.Entry<Path, WatchKey> entry : registeredKeys.entrySet()) { if (!isMonitored(entry.getKey())) { watchedKeys.put(entry.getValue(), entry.getKey()); } else { entry.getValue().cancel(); } } } } else { cancelAllWatchKeys(registeredKeys); monitorFailed(container); ResourcesPlugin.getPlugin().getLog().log(jobGroup.getResult()); } if (Policy.DEBUG_AUTO_REFRESH) Policy.debug(DEBUG_PREFIX + "now watching " + watchedKeys.watchedPathsCount() + " paths with " + watchedKeys.watchKeysCount() + " keys"); }); joinJob.schedule(); return true; }
Source:
public void searchesMessages() throws Exception { final MkBase base = new MkBase(); final String urn = "urn:test:99"; final User user = base.user(new URN(urn)); user.aliases().add("test-search-user"); final Alias alias = user.aliases().iterate().iterator().next(); final Bout bout = alias.inbox().bout(alias.inbox().start()); bout.messages().post("test1"); bout.messages().post("test2"); bout.messages().post("fest"); bout.friends().invite(alias.name()); MatcherAssert.assertThat( XhtmlMatchers.xhtml( new RsPrint( new FkBout(TkIndexTest.REGEX, new TkIndex(base)).route( new RqWithHeader( new RqWithAuth( urn, new RqFake( RqMethod.GET, String.format( "/b/%d/search?q=test", bout.number() ) ) ), HEADER_ACCEPT, MIME_TEXT_XML ) ).get() ).printBody() ), XhtmlMatchers.hasXPaths( "/page/bout/friends/friend[alias='test-search-user']", "/page/bout/messages/message[text='test2']", "/page/bout/messages/message[text='test1']" ) ); }

Target:
public void searchesMessages() throws Exception { final MkBase base = new MkBase(); final String urn = "urn:test:99"; final User user = base.user(new URN(urn)); user.aliases().add("test-search-user"); final Alias alias = user.aliases().iterate().iterator().next(); final Bout bout = alias.inbox().bout(alias.inbox().start()); bout.messages().post("test1"); bout.messages().post("test2"); bout.messages().post("fest"); bout.friends().invite(alias.name()); MatcherAssert.assertThat( XhtmlMatchers.xhtml( new RsPrint( new FkBout(TkIndexTest.REGEX, new TkIndex(base)).route( new RqWithAuth( urn, new RqFake( RqMethod.GET, String.format( "/b/%d/search?q=test", bout.number() ) ) ) ).get() ).printBody() ), XhtmlMatchers.hasXPaths( "/page/bout/friends/friend[alias='test-search-user']", "/page/bout/messages/message[text='test2']", "/page/bout/messages/message[text='test1']" ) ); }
Source:
public void toggleExpander(boolean expand) { expander.setValue(expand); updateContentDisplay(); }

Target:
public void toggleExpander(boolean expand) { expander.setDown(expand); updateContentDisplay(); }
Source:
public String isCreativePlayer() { return creativePlayer; }

Target:
public boolean isCreativePlayer() { return creativePlayer; }
Source:
public <KIn, VIn, KOut, VOut> Map<KOut, List<VOut>> mapAndCombineForLocalReduction( MapCombineCommand<KIn, VIn, KOut, VOut> mcc) throws InterruptedException { CollectableCollector<KOut, VOut> collector = map(mcc); return combine(mcc, collector); }

Target:
public <KIn, VIn, KOut, VOut> Map<KOut, List<VOut>> mapAndCombineForLocalReduction( MapCombineCommand<KIn, VIn, KOut, VOut> mcc) throws InterruptedException { CollectableCollector<KOut, VOut> collector = map(mcc); Map<KOut, List<VOut>> collectedValues = collector.removeCollectedValues(); return combine(mcc, collectedValues); }
Source:
public String resetRoute(String id) throws Exception { ManagedRouteMBean resetRoute = camelContext.getManagedRoute(id, ManagedRouteMBean.class); if (resetRoute != null) { resetRoute.reset(true); } else { String description = "The provided route id does not exists"; ResponseEntity<?> objectResponseEntity = ResponseEntity.status(HttpStatus.NO_CONTENT).body(description); ObjectMapper objectMapper = new ObjectMapper(); return objectMapper.writeValueAsString(objectResponseEntity); } return null; }

Target:
public String resetRoute(String id) throws Exception { ManagedRouteMBean resetRoute = camelContext.getManagedRoute(id, ManagedRouteMBean.class); if (resetRoute != null) { resetRoute.reset(true); } else { String description = "The provided route id does not exists : " + camelContext.getRoute(id); ResponseEntity<?> objectResponseEntity = ResponseEntity.status(HttpStatus.BAD_REQUEST).body(description); ObjectMapper objectMapper = new ObjectMapper(); return objectMapper.writeValueAsString(objectResponseEntity); } return null; }
Source:
public void shouldFilterRecipeWithGivenSelectors() throws Exception { String yamlRecipeContent = Files.readFile(getClass().getClassLoader().getResourceAsStream("petclinic.yaml")); final Map<String, String> selector = Collections.singletonMap("app.kubernetes.io/component", "webapp"); Tool tool = new Tool() .withType(OPENSHIFT_TOOL_TYPE) .withLocal(LOCAL_FILENAME) .withName(TOOL_NAME) .withSelector(selector); EnvironmentImpl result = factory.createEnvironment(tool, s -> yamlRecipeContent); RecipeImpl recipe = result.getRecipe(); assertNotNull(recipe); assertEquals(recipe.getType(), OPENSHIFT_TOOL_TYPE); assertEquals(recipe.getContentType(), DEFAULT_RECIPE_CONTENT_TYPE); KubernetesList expectedK8SList = toK8SList(yamlRecipeContent); List<HasMetadata> itemsList = toK8SList(yamlRecipeContent).getItems(); itemsList.removeIf( e -> !e.getMetadata().getLabels().entrySet().containsAll(selector.entrySet())); expectedK8SList.setItems(itemsList); assertEquals(toK8SList(recipe.getContent()), expectedK8SList); }

Target:
public void shouldFilterRecipeWithGivenSelectors() throws Exception { String yamlRecipeContent = Files.readFile(getClass().getClassLoader().getResourceAsStream("petclinic.yaml")); final Map<String, String> selector = Collections.singletonMap("app.kubernetes.io/component", "webapp"); Tool tool = new Tool() .withType(OPENSHIFT_TOOL_TYPE) .withLocal(LOCAL_FILENAME) .withName(TOOL_NAME) .withSelector(selector); EnvironmentImpl result = factory.createEnvironment(tool, s -> yamlRecipeContent); RecipeImpl recipe = result.getRecipe(); assertNotNull(recipe); assertEquals(recipe.getType(), OPENSHIFT_TOOL_TYPE); assertEquals(recipe.getContentType(), DEFAULT_RECIPE_CONTENT_TYPE); List<HasMetadata> resultItemsList = toK8SList(recipe.getContent()).getItems(); assertEquals(resultItemsList.size(), 3); assertEquals(1, resultItemsList.stream().filter(it -> "Pod".equals(it.getKind())).count()); assertEquals(1, resultItemsList.stream().filter(it -> "Service".equals(it.getKind())).count()); assertEquals(1, resultItemsList.stream().filter(it -> "Route".equals(it.getKind())).count()); }
Source:
public void readData(ObjectDataInput in) throws IOException { this.attributePath = in.readUTF(); int count = in.readInt(); this.values = new CanonicalizingHashSet<R>(count); for (int i = 0; i < count; i++) { R value = in.readObject(); values.addInternal(value); } }

Target:
public void readData(ObjectDataInput in) throws IOException { this.attributePath = in.readUTF(); int count = in.readInt(); this.values = new CanonicalizingHashSet<R>(MapUtil.calculateInitialCapacity(count)); for (int i = 0; i < count; i++) { R value = in.readObject(); values.addInternal(value); } }
Source:
public PartitionLeaderInfo(StoreManager storeManager) { peerLeaderReplicasByPartition = new ConcurrentHashMap<>(); this.storeManager = storeManager; }

Target:
public PartitionLeaderInfo(StoreManager storeManager) { this.storeManager = storeManager; }
Source:
private void preOrderPrint(PrintWriter writer, boolean printIntervals, HTNode currentNode, int curDepth) { writer.println(currentNode.toString()); if (printIntervals) { currentNode.debugPrintIntervals(writer); } if (currentNode.getNodeType() == HTConfig.LEAFNODE_TYPE) { return; } try { int extention = ((ClaudetteNode) currentNode).getExtensionSequenceNumber(); while (extention != -1) { HTNode nextNode = treeIO.readNode(extention); assert (nextNode instanceof ClaudetteNode); preOrderPrint(writer, printIntervals, nextNode, curDepth); } if (currentNode.getNodeType() == HTConfig.CORENODE_TYPE) { for (int i = 0; i < ((CoreNode) currentNode).getNbChildren(); i++) { HTNode nextNode = treeIO.readNode(((CoreNode) currentNode).getChild(i)); assert (nextNode instanceof CoreNode); for (int j = 0; j < curDepth; j++) { writer.print(" "); } writer.print("+-"); preOrderPrint(writer, printIntervals, nextNode, curDepth + 1); } } } catch (ClosedChannelException e) { e.printStackTrace(); } }

Target:
private void preOrderPrint(PrintWriter writer, boolean printIntervals, HTNode currentNode, int curDepth) { writer.println(currentNode.toString()); if (printIntervals) { currentNode.debugPrintIntervals(writer); } if (currentNode.getNodeType() == HTNode.LEAFNODE_TYPE) { return; } try { int extention = ((ExtensionNode) currentNode).getExtensionSequenceNumber(); while (extention != -1) { HTNode nextNode = treeIO.readNode(extention); preOrderPrint(writer, printIntervals, nextNode, curDepth); } if (currentNode.getNodeType() == HTNode.CORENODE_TYPE) { for (int i = 0; i < ((CoreNode) currentNode).getNbChildren(); i++) { HTNode nextNode = treeIO.readNode(((CoreNode) currentNode).getChild(i)); for (int j = 0; j < curDepth; j++) { writer.print(" "); } writer.print("+-"); preOrderPrint(writer, printIntervals, nextNode, curDepth + 1); } } } catch (ClosedChannelException e) { e.printStackTrace(); } }
Source:
public String toString() { return String.format("%s:%s", Arrays.asList(errorCodes), parameters); }

Target:
public String toString() { return String.format("%s:%s", Arrays.toString(errorCodes), parameters); }
Source:
private static ListMultimap<byte[], Cell> indexCellsByColumnName(Collection<Cell> cells) { ListMultimap<byte[], Cell> cellsByColumn = MultimapBuilder.treeKeys(UnsignedBytes.lexicographicalComparator()) .arrayListValues() .build(); Set<Cell> addedCells = Sets.newHashSetWithExpectedSize(cells.size()); for (Cell cell : cells) { if (!addedCells.contains(cell)) { cellsByColumn.put(cell.getColumnName(), cell); addedCells.add(cell); } } return cellsByColumn; }

Target:
private static ListMultimap<byte[], Cell> indexCellsByColumnName(Collection<Cell> cells) { ListMultimap<byte[], Cell> cellsByColumn = MultimapBuilder.treeKeys(UnsignedBytes.lexicographicalComparator()) .arrayListValues() .build(); cells.stream() .distinct() .forEach(cell -> cellsByColumn.put(cell.getColumnName(), cell)); return cellsByColumn; }
Source:
public void should_return_facets_on_leak() throws Exception { setServerProperty(orchestrator, "sonar.leak.period", "previous_analysis"); String projectKey = newProjectKey(); analyzeProject(projectKey, "shared/xoo-history-v1"); analyzeProject(projectKey, "shared/xoo-history-v2"); SearchProjectsWsResponse response = searchProjects(SearchProjectsRequest.builder().setOrganization(organizationKey).setFacets(asList( "new_reliability_rating", "new_security_rating", "new_maintainability_rating", "new_coverage")).build()); checkFacet(response, "new_reliability_rating", tuple("1", 1L), tuple("2", 0L), tuple("3", 0L), tuple("4", 0L), tuple("5", 0L)); checkFacet(response, "new_security_rating", tuple("1", 1L), tuple("2", 0L), tuple("3", 0L), tuple("4", 0L), tuple("5", 0L)); checkFacet(response, "new_maintainability_rating", tuple("1", 1L), tuple("2", 0L), tuple("3", 0L), tuple("4", 0L), tuple("5", 0L)); checkFacet(response, "new_coverage", tuple("*-30.0", 0L), tuple("30.0-50.0", 0L), tuple("50.0-70.0", 0L), tuple("70.0-80.0", 0L), tuple("80.0-*", 0L)); }

Target:
public void should_return_facets_on_leak() throws Exception { setServerProperty(orchestrator, "sonar.leak.period", "previous_analysis"); String projectKey = newProjectKey(); analyzeProject(projectKey, "shared/xoo-history-v1"); analyzeProject(projectKey, "shared/xoo-history-v2"); SearchProjectsWsResponse response = searchProjects(SearchProjectsRequest.builder().setOrganization(organizationKey).setFacets(asList( "new_reliability_rating", "new_security_rating", "new_maintainability_rating", "new_coverage", "new_duplicated_lines_density", "new_lines")).build()); checkFacet(response, "new_reliability_rating", tuple("1", 1L), tuple("2", 0L), tuple("3", 0L), tuple("4", 0L), tuple("5", 0L)); checkFacet(response, "new_security_rating", tuple("1", 1L), tuple("2", 0L), tuple("3", 0L), tuple("4", 0L), tuple("5", 0L)); checkFacet(response, "new_maintainability_rating", tuple("1", 1L), tuple("2", 0L), tuple("3", 0L), tuple("4", 0L), tuple("5", 0L)); checkFacet(response, "new_coverage", tuple("*-30.0", 0L), tuple("30.0-50.0", 0L), tuple("50.0-70.0", 0L), tuple("70.0-80.0", 0L), tuple("80.0-*", 0L)); checkFacet(response, "new_duplicated_lines_density", tuple("*-3.0", 0L), tuple("3.0-5.0", 0L), tuple("5.0-10.0", 0L), tuple("10.0-20.0", 0L), tuple("20.0-*", 0L)); checkFacet(response, "new_lines", tuple("*-1000.0", 0L), tuple("1000.0-10000.0", 0L), tuple("10000.0-100000.0", 0L), tuple("100000.0-500000.0", 0L), tuple("500000.0-*", 0L)); }
Source:
public void close() { if (task != null) { task.closeClean(); } if (globalStateTask != null) { try { globalStateTask.close(); } catch (final IOException e) { } } completeAllProcessableWork(); if (task.hasRecordsQueued()) { log.warn("Due to the configuration, there were some records that can't be processed even" + " though TopologyTestDriver is shutting down.", StreamsConfig.MAX_TASK_IDLE_MS_CONFIG); } if (!eosEnabled) { producer.close(); } stateDirectory.clean(); }

Target:
public void close() { if (task != null) { task.closeClean(); } if (globalStateTask != null) { try { globalStateTask.close(); } catch (final IOException e) { } } completeAllProcessableWork(); if (task != null && task.hasRecordsQueued()) { log.warn("Found some records that cannot be processed due to the" + " configuration during TopologyTestDriver#close().", StreamsConfig.MAX_TASK_IDLE_MS_CONFIG); } if (!eosEnabled) { producer.close(); } stateDirectory.clean(); }
Source:
public void setSourcesList(List<BranchSource> sources) throws IOException { if (this.sources.isEmpty() || sources.isEmpty()) { this.sources.replaceBy(sources); return; } Set<String> oldIds = sourceIds(this.sources); Set<String> newIds = sourceIds(sources); if (oldIds.containsAll(newIds) || newIds.containsAll(oldIds)) { this.sources.replaceBy(sources); return; } Map<String,String> changedIds = new HashMap<>(); Set<String> additions = new HashSet<>(newIds); additions.removeAll(oldIds); Set<String> removals = new HashSet<>(oldIds); removals.removeAll(newIds); sources = new ArrayList<>(sources); for (ListIterator<BranchSource> i = sources.listIterator(); i.hasNext(); ) { BranchSource addition = i.next(); if (!additions.contains(addition.getSource().getId())) { continue; } for (BranchSource removal: this.sources) { if (!removals.contains(removal.getSource().getId())) { continue; } if (!equalButForId(removal.getSource(), addition.getSource())) { continue; } changedIds.put(removal.getSource().getId(), addition.getSource().getId()); removals.remove(removal.getSource().getId()); break; } } this.sources.replaceBy(sources); BranchProjectFactory<P,R> factory = getProjectFactory(); for (P item: getItems()) { if (!factory.isProject(item)) { continue; } Branch oldBranch = factory.getBranch(item); if (changedIds.containsKey(oldBranch.getSourceId())) { Branch newBranch = new Branch(changedIds.get(oldBranch.getSourceId()), oldBranch.getHead(), oldBranch.getScm(), oldBranch.getProperties()); newBranch.setActions(oldBranch.getActions()); factory.setBranch(item, newBranch); } } }

Target:
public void setSourcesList(List<BranchSource> sources) throws IOException { if (this.sources.isEmpty() || sources.isEmpty()) { this.sources.replaceBy(sources); return; } Set<String> oldIds = sourceIds(this.sources); Set<String> newIds = sourceIds(sources); if (oldIds.containsAll(newIds) || newIds.containsAll(oldIds)) { this.sources.replaceBy(sources); return; } Map<String,String> changedIds = new HashMap<>(); Set<String> additions = new HashSet<>(newIds); additions.removeAll(oldIds); Set<String> removals = new HashSet<>(oldIds); removals.removeAll(newIds); for (BranchSource addition : sources) { String additionId = addition.getSource().getId(); if (!additions.contains(additionId)) { continue; } for (BranchSource removal : this.sources) { String removalId = removal.getSource().getId(); if (!removals.contains(removalId)) { continue; } if (!equalButForId(removal.getSource(), addition.getSource())) { continue; } changedIds.put(removalId, additionId); removals.remove(removalId); additions.remove(additionId); break; } } this.sources.replaceBy(sources); BranchProjectFactory<P,R> factory = getProjectFactory(); for (P item: getItems()) { if (!factory.isProject(item)) { continue; } Branch oldBranch = factory.getBranch(item); if (changedIds.containsKey(oldBranch.getSourceId())) { Branch newBranch = new Branch(changedIds.get(oldBranch.getSourceId()), oldBranch.getHead(), oldBranch.getScm(), oldBranch.getProperties()); newBranch.setActions(oldBranch.getActions()); factory.setBranch(item, newBranch); } } }
Source:
public static void updateValues(String hostAddress, String[] getCommands, OnOffType onoff) { if (hostAddress.equals("0:0:0:0:0:0:0:1")) hostAddress = "localhost"; logger.debug("action at address ->> " + hostAddress + " On_OFF: " + onoff); for (MegaDeviceBindingProvider provider : megaproviders) { for (String itemName : provider.getItemNames()) { if (provider.getItemType(itemName).toString().contains("SwitchItem")) { if (provider.getIP(itemName).equals(hostAddress) && provider.getPORT(itemName).equals(getCommands[2])) { logger.debug(" itemName: " + provider.getItemType(itemName)); ep.postUpdate(itemName, onoff); } } else if (provider.getItemType(itemName).toString().contains("NumberItem")) { if (provider.getIP(itemName).equals(hostAddress) && provider.getPORT(itemName).equals("at")) { logger.debug(" itemName: " + provider.getItemType(itemName)); ep.postUpdate(itemName, DecimalType.valueOf(getCommands[2])); } else if (provider.getIP(itemName).equals(hostAddress) && getCommands[1].equals("st") && provider.getPORT(itemName).equals("st")) { ep.postUpdate(itemName, DecimalType.valueOf(getCommands[2])); } } else if (provider.getItemType(itemName).toString().contains("StringItem")) { if (provider.getIP(itemName).equals(hostAddress) && provider.getPORT(itemName).equals(getCommands[2]) && getCommands[3].equals("ib")) { ep.postUpdate(itemName, StringType.valueOf(getCommands[4])); } } } } }

Target:
public static void updateValues(String hostAddress, String[] getCommands, OnOffType onoff) { if (hostAddress.equals("0:0:0:0:0:0:0:1")) hostAddress = "localhost"; logger.debug("action at address ->> On_OFF: {}", hostAddress, onoff); for (MegaDeviceBindingProvider provider : megaproviders) { for (String itemName : provider.getItemNames()) { if (provider.getItemType(itemName).toString().contains("SwitchItem")) { if (provider.getIP(itemName).equals(hostAddress) && provider.getPORT(itemName).equals(getCommands[2])) { ep.postUpdate(itemName, onoff); } } else if (provider.getItemType(itemName).toString().contains("NumberItem")) { if (provider.getIP(itemName).equals(hostAddress) && provider.getPORT(itemName).equals("at")) { ep.postUpdate(itemName, DecimalType.valueOf(getCommands[2])); } else if (provider.getIP(itemName).equals(hostAddress) && getCommands[1].equals("st") && provider.getPORT(itemName).equals("st")) { ep.postUpdate(itemName, DecimalType.valueOf(getCommands[2])); } } else if (provider.getItemType(itemName).toString().contains("StringItem")) { if (provider.getIP(itemName).equals(hostAddress) && provider.getPORT(itemName).equals(getCommands[2]) && getCommands[3].equals("ib")) { ep.postUpdate(itemName, StringType.valueOf(getCommands[4])); } } } } }
Source:
public void screenShotAndFrame(String methodName, String device, String className) { try { File framePath = new File(System.getProperty("user.dir") + "/src/test/resources/frames/"); File[] files1 = framePath.listFiles(); if (framePath.exists()) { for (int i = 0; i < files1.length; i++) { if (files1[i].isFile()) { Path p = Paths.get(files1[i].toString()); String fileName = p.getFileName().toString().toLowerCase(); System.out.println("##########@@@@@@@@@########At the Gate########@@@@@@@!!!!!!!!"+fileName.split(".png")[0]+"@@@@@@@@@@@@$$$$$$$$$$$@@@@@@@@@@"+fileName); if (deviceModel.toString().toLowerCase() .contains(fileName.split(".png")[0].toLowerCase())) { System.out.println("##########@@@@@@@@@########ENTERED########@@@@@@@!!!!!!!!"); try { String deviceFrame = files1[i].toString(); String screenToBeFramed = System.getProperty("user.dir") + "/target/screenshot/" + device + "/" + device_udid .replaceAll("\\W", "_") + "/" + className+ "/"+ methodName +"/" + deviceModel +"_"+methodName+"_failed.png"; String framedScreenShot = System.getProperty("user.dir") + "/target/screenshot/" + device + "/" + device_udid.replaceAll("\\W", "_") + "/"+ className+ "/"+ methodName +"/" + deviceModel + "_failed_" + methodName + "_framed.png"; imageUtils.wrapDeviceFrames(deviceFrame, screenToBeFramed, framedScreenShot); File deleteActualImage = new File(screenToBeFramed); deleteActualImage.delete(); break; } catch (InterruptedException e) { e.printStackTrace(); } catch (IM4JavaException e) { e.printStackTrace(); } } } } } } catch (IOException e) { e.printStackTrace(); System.out.println("Resource Directory was not found"); } }

Target:
public void screenShotAndFrame(String methodName, String device, String className) { try { File framePath = new File(System.getProperty("user.dir") + "/src/test/resources/frames/"); File[] files1 = framePath.listFiles(); if (framePath.exists()) { for (int i = 0; i < files1.length; i++) { if (files1[i].isFile()) { Path p = Paths.get(files1[i].toString()); String fileName = p.getFileName().toString().toLowerCase(); if (deviceModel.toString().toLowerCase() .contains(fileName.split(".png")[0].toLowerCase())) { try { String deviceFrame = files1[i].toString(); String screenToBeFramed = System.getProperty("user.dir") + "/target/screenshot/" + device + "/" + device_udid .replaceAll("\\W", "_") + "/" + className+ "/"+ methodName +"/" + deviceModel +"_"+methodName+"_failed.png"; String framedScreenShot = System.getProperty("user.dir") + "/target/screenshot/" + device + "/" + device_udid.replaceAll("\\W", "_") + "/"+ className+ "/"+ methodName +"/" + deviceModel + "_failed_" + methodName + "_framed.png"; imageUtils.wrapDeviceFrames(deviceFrame, screenToBeFramed, framedScreenShot); File deleteActualImage = new File(screenToBeFramed); deleteActualImage.delete(); break; } catch (InterruptedException e) { e.printStackTrace(); } catch (IM4JavaException e) { e.printStackTrace(); } } } } } } catch (IOException e) { e.printStackTrace(); System.out.println("Resource Directory was not found"); } }
Source:
public static TurboIssueEvent createLabelUpdateEvent( String userName, IssueEventType eventType, GregorianCalendar time, String labelName) { return new TurboIssueEvent( new User().setLogin(userName), eventType, time.getTime()) .setLabelName(labelName); }

Target:
private static TurboIssueEvent createLabelUpdateEvent( String userName, IssueEventType eventType, GregorianCalendar time, String labelName) { return new TurboIssueEvent( new User().setLogin(userName), eventType, time.getTime()) .setLabelName(labelName); }
Source:
private void validateJsonRpcVersion(Map message, Object id) throws JsonRpcException { if (!message.containsKey(JSONRPC)) { throw new JsonRpcException(id, invalid("required key `jsonrpc` missing")); } if (!VERSION.equals(message.get(JSONRPC))) { throw new JsonRpcException( id, invalid("key `jsonrpc` not equal to `2.0`", message.get(JSONRPC))); } }

Target:
private void validateJsonRpcVersion(Map message, Object id) throws JsonRpcException { if (!message.containsKey(JSONRPC)) { throw new JsonRpcException(id, invalid(String.format("required key `%s` missing", JSONRPC))); } if (!VERSION.equals(message.get(JSONRPC))) { throw new JsonRpcException( id, invalid( String.format("key `%s` not equal to `%s`", JSONRPC, VERSION), message.get(JSONRPC))); } }
Source:
public HttpMethodBase createMethod() throws IOException { HttpMethodBase method = null; if (httpMethod == HttpMethod.POST) { method = createPostMethod(); } else if (httpMethod == HttpMethod.GET) { method = new GetMethod(getUrl() + serviceUri); } else if (httpMethod == HttpMethod.PUT) { method = createPutMethod(); } else if (httpMethod == HttpMethod.DELETE) { method = createDeleteMethod(); } Assert.isNotNull(method, "Failed to create method for " + httpMethod); if (!(method.getClass().equals(DeleteMethod.class))) { method.setRequestHeader("Content-Type", "application/json; charset=utf-8"); } method.setRequestHeader(ACCEPT, APPLICATION_JSON); return method; }

Target:
public HttpMethodBase createMethod() throws IOException { HttpMethodBase method = null; if (httpMethod == HttpMethod.POST) { method = createPostMethod(); } else if (httpMethod == HttpMethod.GET) { method = new GetMethod(getUrl() + serviceUri); } else if (httpMethod == HttpMethod.PUT) { method = createPutMethod(); } else if (httpMethod == HttpMethod.DELETE) { method = createDeleteMethod(); } Assert.isNotNull(method, "Failed to create method for " + httpMethod); method.setRequestHeader(ACCEPT, APPLICATION_JSON); return method; }
Source:
void shutdown() { for (Entry<ThriftTransportKey,CachedConnections> entry : connections.entrySet()) { Lock lock = locks.get(entry.getKey()); lock.lock(); entry.getValue().closeAllTransports(); } }

Target:
void shutdown() { for (Lock lock : locks) { lock.lock(); } try { if (shutdown) { return; } shutdown = true; connections.values().forEach(CachedConnections::closeAllTransports); } finally { for (Lock lock : locks) { lock.unlock(); } } }
Source:
private void resolveParametersAndInvokeTestMethod(JupiterEngineExecutionContext context, DynamicTestExecutor dynamicTestExecutor, ThrowableCollector throwableCollector) { ExtensionRegistry registry = context.getExtensionRegistry(); Object[] arguments = parameterResolver.resolveParameters(getTestMethod(), Optional.empty(), context.getExtensionContext(), registry); invokeBeforeMethodsOrCallbacksUntilExceptionOccurs(context, ((extensionContext, callback) -> () -> callback.beforeParameterizedTestExecution(extensionContext, arguments)), BeforeParameterizedTestExecutionCallback.class); if (throwableCollector.isEmpty()) { invokeTestMethod(context, dynamicTestExecutor); } }

Target:
private void resolveParametersAndInvokeTestMethod(JupiterEngineExecutionContext context, DynamicTestExecutor dynamicTestExecutor, ThrowableCollector throwableCollector) { ExtensionRegistry registry = context.getExtensionRegistry(); Object instance = context.getExtensionContext().getRequiredTestInstance(); Object[] arguments = parametersResolver.resolveParameters(getTestMethod(), Optional.ofNullable(instance), context.getExtensionContext(), registry); invokeBeforeMethodsOrCallbacksUntilExceptionOccurs(context, ((extensionContext, callback) -> () -> callback.processArguments(extensionContext, Arrays.copyOf(arguments, arguments.length))), ArgumentsProcessor.class); if (throwableCollector.isEmpty()) { invokeTestMethod(context, dynamicTestExecutor, arguments); } }
Source:
private void runRevealCommand(final RootEditPart root, final DDiagramEditor editor, final DDiagramElement vpe) { final Object adapter = editor.getAdapter(IDiagramCommandFactoryProvider.class); final IDiagramCommandFactoryProvider cmdFactoryProvider = (IDiagramCommandFactoryProvider) adapter; final TransactionalEditingDomain transactionalEditingDomain = TransactionUtil.getEditingDomain(editor.getEditingDomain().getResourceSet()); final IDiagramCommandFactory emfCommandFactory = cmdFactoryProvider.getCommandFactory(transactionalEditingDomain); final Command cmd = emfCommandFactory.buildRevealCommand(vpe); final TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(vpe); CompoundCommand allInOne = new CompoundCommand(cmd.getLabel()); allInOne.append(cmd); domain.getCommandStack().execute(allInOne); }

Target:
private void runRevealCommand(final RootEditPart root, final DDiagramEditor editor, final DDiagramElement vpe) { final Object adapter = editor.getAdapter(IDiagramCommandFactoryProvider.class); final IDiagramCommandFactoryProvider cmdFactoryProvider = (IDiagramCommandFactoryProvider) adapter; final TransactionalEditingDomain transactionalEditingDomain = TransactionUtil.getEditingDomain(editor.getEditingDomain().getResourceSet()); final IDiagramCommandFactory emfCommandFactory = cmdFactoryProvider.getCommandFactory(transactionalEditingDomain); final Command cmd = emfCommandFactory.buildRevealCommand(vpe); CompoundCommand allInOne = new CompoundCommand(cmd.getLabel()); allInOne.append(cmd); transactionalEditingDomain.getCommandStack().execute(allInOne); }
Source:
public void updateTitle(Title title) { Title builtTitle = currentTitle.build(); if (title.getTitle() != null) { currentTitle.title(title.getTitle()); } if (title.getSubtitle() != null) { currentTitle.subtitle(title.getSubtitle()); } if (builtTitle.getFadeIn() != title.getFadeIn() && title.getFadeIn() != Title.DEFAULT_FADE_IN) { currentTitle.fadeIn(title.getFadeIn()); } if (builtTitle.getStay() != title.getStay() && title.getStay() != Title.DEFAULT_STAY) { currentTitle.stay(title.getStay()); } if (builtTitle.getFadeOut() != title.getFadeOut() && title.getFadeOut() != Title.DEFAULT_FADE_OUT) { currentTitle.fadeOut(title.getFadeOut()); } }

Target:
public void updateTitle(Title title) { Title builtTitle = currentTitle.build(); if (title.getTitle().length != 0) { currentTitle.title(title.getTitle()); } if (title.getSubtitle() != null) { currentTitle.subtitle(title.getSubtitle()); } if (builtTitle.getFadeIn() != title.getFadeIn() && title.getFadeIn() != Title.DEFAULT_FADE_IN) { currentTitle.fadeIn(title.getFadeIn()); } if (builtTitle.getStay() != title.getStay() && title.getStay() != Title.DEFAULT_STAY) { currentTitle.stay(title.getStay()); } if (builtTitle.getFadeOut() != title.getFadeOut() && title.getFadeOut() != Title.DEFAULT_FADE_OUT) { currentTitle.fadeOut(title.getFadeOut()); } }
Source:
public FastIgnoreRule(String pattern) { if (pattern == null) throw new IllegalArgumentException("Pattern must not be null!"); if (pattern.length() == 0) { dirOnly = false; inverse = false; this.matcher = NO_MATCH; return; } inverse = pattern.charAt(0) == '!'; if (inverse) { pattern = pattern.substring(1); if (pattern.length() == 0) { dirOnly = false; this.matcher = NO_MATCH; return; } } if (pattern.charAt(0) == '#') { this.matcher = NO_MATCH; dirOnly = false; return; } if (pattern.charAt(0) == '\\' && pattern.length() > 1) { char next = pattern.charAt(1); if (next == '!' || next == '#') { pattern = pattern.substring(1); } } if (pattern.length() > 0 && pattern.charAt(pattern.length() - 1) == '\\') { this.matcher = NO_MATCH; dirOnly = false; return; } dirOnly = isDirectoryPattern(pattern); if (dirOnly) { pattern = stripTrailingWhitespace(pattern); pattern = stripTrailing(pattern, PATH_SEPARATOR); if (pattern.length() == 0) { this.matcher = NO_MATCH; return; } } IMatcher m; try { m = PathMatcher.createPathMatcher(pattern, Character.valueOf(PATH_SEPARATOR), dirOnly); } catch (InvalidPatternException e) { m = NO_MATCH; LOG.error(e.getMessage(), e); } this.matcher = m; }

Target:
public FastIgnoreRule(String pattern) { if (pattern == null) throw new IllegalArgumentException("Pattern must not be null!"); if (pattern.length() == 0) { dirOnly = false; inverse = false; this.matcher = NO_MATCH; return; } inverse = pattern.charAt(0) == '!'; if (inverse) { pattern = pattern.substring(1); if (pattern.length() == 0) { dirOnly = false; this.matcher = NO_MATCH; return; } } if (pattern.charAt(0) == '#') { this.matcher = NO_MATCH; dirOnly = false; return; } if (pattern.charAt(0) == '\\' && pattern.length() > 1) { char next = pattern.charAt(1); if (next == '!' || next == '#') { pattern = pattern.substring(1); } } if (pattern.length() > 0 && pattern.charAt(pattern.length() - 1) == '\\') { int backslashesCount = 1; for (int i = pattern.length() - 2; i >= 0; i--) { if (pattern.charAt(i) == '\\') { backslashesCount++; } else { break; } } if (backslashesCount % 2 == 1) { this.matcher = NO_MATCH; dirOnly = false; return; } } dirOnly = isDirectoryPattern(pattern); if (dirOnly) { pattern = stripTrailingWhitespace(pattern); pattern = stripTrailing(pattern, PATH_SEPARATOR); if (pattern.length() == 0) { this.matcher = NO_MATCH; return; } } IMatcher m; try { m = PathMatcher.createPathMatcher(pattern, Character.valueOf(PATH_SEPARATOR), dirOnly); } catch (InvalidPatternException e) { m = NO_MATCH; LOG.error(e.getMessage(), e); } this.matcher = m; }
Source:
public static void loadValue(ITimeGraphPresentationProvider presentationProvider, StateItem stateItem) { IPreferenceStore store = getStore(); String rgbKey = getRgbKey(presentationProvider, stateItem); String widthKey = getWidthKey(presentationProvider, stateItem); Map<String, Object> styleMap = stateItem.getStyleMap(); RGB defaultRgb = stateItem.getStateColor(); String defaultString = store.getDefaultString(rgbKey); if (defaultString.isEmpty()) { store.setDefault(rgbKey, new RGBAColor(defaultRgb.red, defaultRgb.green, defaultRgb.blue, 255).toString()); } String rgbColor = store.getString(rgbKey); if (store.getInt(ITimeEventStyleStrings.heightFactor()) == 0) { float defaultHeight = isLink(stateItem) ? 0.1f : 1.0f; float defaultWidth = (float) stateItem.getStyleMap().getOrDefault(ITimeEventStyleStrings.heightFactor(), defaultHeight); store.setDefault(widthKey, defaultWidth); } float width = store.getFloat(widthKey); RGBAColor rgba = RGBAColor.fromString(rgbColor); if (rgba != null) { styleMap.put(ITimeEventStyleStrings.fillColor(), rgba.toInt()); styleMap.put(ITimeEventStyleStrings.heightFactor(), width); } }

Target:
public static void loadValue(ITimeGraphPresentationProvider presentationProvider, StateItem stateItem) { IPreferenceStore store = getStore(); String rgbKey = getRgbKey(presentationProvider, stateItem); String widthKey = getWidthKey(presentationProvider, stateItem); Map<String, Object> styleMap = stateItem.getStyleMap(); RGB defaultRgb = stateItem.getStateColor(); String defaultString = store.getDefaultString(rgbKey); if (defaultString.isEmpty()) { store.setDefault(rgbKey, new RGBAColor(defaultRgb.red, defaultRgb.green, defaultRgb.blue, 255).toString()); } String rgbColor = store.getString(rgbKey); if (store.getInt(ITimeEventStyleStrings.heightFactor()) == 0) { float defaultHeight = isLink(stateItem) ? TimeGraphControl.DEFAULT_LINK_WIDTH : TimeGraphControl.DEFAULT_STATE_WIDTH; float defaultWidth = (float) stateItem.getStyleMap().getOrDefault(ITimeEventStyleStrings.heightFactor(), defaultHeight); store.setDefault(widthKey, defaultWidth); } float width = store.getFloat(widthKey); RGBAColor rgba = RGBAColor.fromString(rgbColor); if (rgba != null) { styleMap.put(ITimeEventStyleStrings.fillColor(), rgba.toInt()); styleMap.put(ITimeEventStyleStrings.heightFactor(), width); } }
Source:
public void cleanupCacheFiles(File baseFile, File cacheFile) throws IOException { if (cacheFile.equals(baseFile)) { return; } synchronized (lock) { log.info("Deleting directory[%s]", cacheFile); try { FileUtils.deleteDirectory(cacheFile); } catch (Exception e) { log.error("Unable to remove file[%s]", cacheFile); } } if (cacheFile.getParentFile() != null && (cacheFile.getParentFile().listFiles() == null || cacheFile.getParentFile().listFiles().length == 0)) { cleanupCacheFiles(baseFile, cacheFile.getParentFile()); } }

Target:
public void cleanupCacheFiles(File baseFile, File cacheFile) throws IOException { if (cacheFile.equals(baseFile)) { return; } synchronized (lock) { log.info("Deleting directory[%s]", cacheFile); try { FileUtils.deleteDirectory(cacheFile); } catch (Exception e) { log.error("Unable to remove file[%s]", cacheFile); } } File parent = cacheFile.getParentFile(); if (parent != null) { File[] children = parent.listFiles(); if (children == null || children.length == 0) { cleanupCacheFiles(baseFile, parent); } } }
Source:
public String toString() { return Objects.toStringHelper(this).omitNullValues().add("id", id).add("poolId", poolId) .add("pointsTo", pointsTo).add("priority", priority).add("type", type).add("forceAnswer", forceAnswer) .add("probingEnabled", probingEnabled).add("status", status).add("serving", serving) .add("description", description).toString(); }

Target:
public String toString() { return Objects.toStringHelper(this).add("id", id).add("poolId", poolId).add("pointsTo", pointsTo) .add("weight", weight).add("priority", priority).add("type", type).add("forceAnswer", forceAnswer) .add("probingEnabled", probingEnabled).add("status", status).add("serving", serving) .add("description", description).toString(); }
Source:
byte[] buildRedisTracePayload(){ SpanContext spanContext = tracer.activeSpan().context(); Carrier carrier = new Carrier(new HashMap<>()); tracer.inject(spanContext, Format.Builtin.TEXT_MAP, carrier); final byte[] firstByte = ByteBuffer.allocate(1).put("0".getBytes()).array(); final byte[] context = carrier.toString().getBytes(); int context_length = context.length; final byte[] spanContextLength = ByteBuffer.allocate(4).putInt(context_length).array(); byte[] tracePayload = new byte[firstByte.length + spanContextLength.length + context.length]; System.arraycopy(firstByte, 0, tracePayload, 0, firstByte.length); System.arraycopy(spanContextLength, 0, tracePayload, firstByte.length, spanContextLength.length); System.arraycopy(context, 0, tracePayload, firstByte.length + spanContextLength.length, context.length); return tracePayload; }

Target:
byte[] buildRedisTracePayload(){ String sptCtxtFormat = SpanContextFormat.TEXTMAP.toString(); byte[] context = getSpanContext(sptCtxtFormat); if (context == null){ return null; } final byte[] firstByte = sptCtxtFormat.equals(SpanContextFormat.TEXTMAP.toString()) ? ByteBuffer.allocate(1).put("0".getBytes()).array(): ByteBuffer.allocate(1).put("1".getBytes()).array(); int context_length = context.length; final byte[] spanContextLength = ByteBuffer.allocate(4).putInt(context_length).array(); byte[] tracePayload = new byte[firstByte.length + spanContextLength.length + context.length]; System.arraycopy(firstByte, 0, tracePayload, 0, firstByte.length); System.arraycopy(spanContextLength, 0, tracePayload, firstByte.length, spanContextLength.length); System.arraycopy(context, 0, tracePayload, firstByte.length + spanContextLength.length, context.length); return tracePayload; }
Source:
protected Void doInBackground(Integer... params) { if (params.length != 2) throw new IllegalArgumentException("MKCollectorResubmitTask requires 2 nullable params: result_id, measurement_id"); Where<Measurement> msmQuery = SQLite.select().from(Measurement.class) .where(Measurement_Table.is_failed.eq(false)) .and(Measurement_Table.is_rerun.eq(false)) .and(Measurement_Table.is_done.eq(true)) .and(OperatorGroup.clause() .or(Measurement_Table.is_uploaded.eq(false)) .or(Measurement_Table.report_id.isNull())); if (params[0] != null) { msmQuery.and(Measurement_Table.result_id.eq(params[0])); } if (params[1] != null) { msmQuery.and(Measurement_Table.id.eq(params[1])); } List<Measurement> measurements = msmQuery.queryList(); for (int i = 0; i < measurements.size(); i++) { A activity = getActivity(); if (activity == null) break; String paramOfParam = activity.getString(R.string.paramOfParam, Integer.toString(i + 1), Integer.toString(measurements.size())); publishProgress(activity.getString(R.string.Modal_ResultsNotUploaded_Uploading, paramOfParam)); Measurement m = measurements.get(i); m.result.load(); try { perform(activity, m); } catch (IOException e) { e.printStackTrace(); } } return null; }

Target:
protected Void doInBackground(Integer... params) { if (params.length != 2) throw new IllegalArgumentException("MKCollectorResubmitTask requires 2 nullable params: result_id, measurement_id"); Where<Measurement> msmQuery = Measurement.selectUploadable(); if (params[0] != null) { msmQuery.and(Measurement_Table.result_id.eq(params[0])); } if (params[1] != null) { msmQuery.and(Measurement_Table.id.eq(params[1])); } List<Measurement> measurements = msmQuery.queryList(); for (int i = 0; i < measurements.size(); i++) { A activity = getActivity(); if (activity == null) break; String paramOfParam = activity.getString(R.string.paramOfParam, Integer.toString(i + 1), Integer.toString(measurements.size())); publishProgress(activity.getString(R.string.Modal_ResultsNotUploaded_Uploading, paramOfParam)); Measurement m = measurements.get(i); m.result.load(); try { perform(activity, m); } catch (IOException e) { e.printStackTrace(); } } return null; }
Source:
protected abstract void handleMessage(DeviceMessageMetadata deviceMessageMetadata, final Object dataObject) throws FunctionalException; @Override public void processMessage(final ObjectMessage message) throws JMSException { Object dataObject = null; final DeviceMessageMetadata deviceMessageMetadata = new DeviceMessageMetadata( message.getStringProperty(Constants.DEVICE_IDENTIFICATION), message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION), message.getJMSCorrelationID(), message.getJMSType(), message.getJMSPriority()); try { dataObject = message.getObject(); } catch (final JMSException e) { LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e); LOGGER.debug("correlationUid: {}", deviceMessageMetadata.getCorrelationUid()); LOGGER.debug("messageType: {}", deviceMessageMetadata.getMessageType()); LOGGER.debug("organisationIdentification: {}", deviceMessageMetadata.getOrganisationIdentification()); LOGGER.debug("deviceIdentification: {}", deviceMessageMetadata.getDeviceIdentification()); return; } try { LOGGER.info("Calling application service function: {}", deviceMessageMetadata.getMessageType()); this.handleMessage(deviceMessageMetadata, dataObject); } catch (final Exception e) { this.handleError(e, deviceMessageMetadata); } }

Target:
protected abstract void handleMessage(DeviceMessageMetadata deviceMessageMetadata, final Object dataObject) throws FunctionalException; @Override public void processMessage(final ObjectMessage message) throws JMSException { Object dataObject = null; final DeviceMessageMetadata deviceMessageMetadata = new DeviceMessageMetadata(message); try { dataObject = message.getObject(); } catch (final JMSException e) { LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e); LOGGER.debug(deviceMessageMetadata.toString()); return; } try { LOGGER.info("Calling application service function: {}", deviceMessageMetadata.getMessageType()); this.handleMessage(deviceMessageMetadata, dataObject); } catch (final Exception e) { this.handleError(e, deviceMessageMetadata); } }