auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void addHitPolicyOption( final GuidedDecisionTable52.HitPolicy hitPolicy ) { <START> final AnchorElement anchor = Document.get() <END> .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 ); }</code><technical_language>is; isn't.. this type of "view" construction of GWT's Panel Composite nice.. worth asking @mbarkley @csadilek if a (other writing element-based widget library)</technical_language>

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:
<code>public Collection<Group> listGroupsByIds(Collection<Long> groupIds) throws IOException { List<Group> groups = new ArrayList<>(groupIds.size()); for (Long id : groupIds) { <START> groups.add(getGroupById(id)); <END> } return groups; }</code><technical_language>able do a multi-id query criteria.add(Restrictions.in("groupId", groupIds)) Current method allows for nulls included in returned list I</technical_language>

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:
<code>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) { <START> cancelAllWatchKeys(registeredKeys); <END> 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; }</code><technical_language>jobGroup canceled in response progress monitor cancellation</technical_language>

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:
<code>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, <START> new RqFake( <END> 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']" ) ); }</code><technical_language>@exper0 need remove this blank line</technical_language>

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:
<code>public void toggleExpander(boolean expand) { <START> expander.setValue(expand); <END> updateContentDisplay(); }</code><technical_language>is toggle button arrow in expanded state expand is true? i.e. arrow is 'v' instead of '>'? if not, try expander.setDown(expand)</technical_language>

Target:
public void toggleExpander(boolean expand) { expander.setDown(expand); updateContentDisplay(); }
Source:
<code><START> public String isCreativePlayer() { return creativePlayer; } <END></code><technical_language>String ? needs a boolean</technical_language>

Target:
public boolean isCreativePlayer() { return creativePlayer; }
Source:
<code>public <KIn, VIn, KOut, VOut> Map<KOut, List<VOut>> mapAndCombineForLocalReduction( MapCombineCommand<KIn, VIn, KOut, VOut> mcc) throws InterruptedException { CollectableCollector<KOut, VOut> collector = map(mcc); <START> return combine(mcc, collector); <END> }</code><technical_language>run combiner in parallel mapper well</technical_language>

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:
<code>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); <START> ObjectMapper objectMapper = new ObjectMapper(); <END> return objectMapper.writeValueAsString(objectResponseEntity); } return null; }</code><technical_language>a HTTP Status 404 enough? Do need write a json message well</technical_language>

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:
<code>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( <START> e -> !e.getMetadata().getLabels().entrySet().containsAll(selector.entrySet())); <END> expectedK8SList.setItems(itemsList); assertEquals(toK8SList(recipe.getContent()), expectedK8SList); }</code><technical_language>copied behavior class. I check webapp objects (Pod, Service, Pod) present in result list</technical_language>

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:
<code>public void readData(ObjectDataInput in) throws IOException { this.attributePath = in.readUTF(); int count = in.readInt(); <START> this.values = new CanonicalizingHashSet<R>(count); <END> for (int i = 0; i < count; i++) { R value = in.readObject(); values.addInternal(value); } }</code><technical_language>Minor: HashMap/HashSet expanded reaches load factor, initial capacity needs greater expected number of elements (see: MapUtil#calculateInitialCapacity)</technical_language>

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:
<code>public PartitionLeaderInfo(StoreManager storeManager) { <START> peerLeaderReplicasByPartition = new ConcurrentHashMap<>(); <END> this.storeManager = storeManager; }</code><technical_language>minor: remove this initialize line 41</technical_language>

Target:
public PartitionLeaderInfo(StoreManager storeManager) { this.storeManager = storeManager; }
Source:
<code>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); <START> assert (nextNode instanceof ClaudetteNode); <END> 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(); } }</code><technical_language>handle asserts, gonna checked. (if ...) { throw new IllegalStateException(); } instead</technical_language>

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:
<code>public String toString() { <START> return String.format("%s:%s", Arrays.asList(errorCodes), parameters); <END> }</code><technical_language>Arrays#toString is suited</technical_language>

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

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:
<code>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), <START> tuple("80.0-*", 0L)); <END> }</code><technical_language>coverage of example project is "No data", right</technical_language>

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:
<code>public void close() { if (task != null) { task.closeClean(); } if (globalStateTask != null) { try { globalStateTask.close(); } catch (final IOException e) { } } completeAllProcessableWork(); if (task.hasRecordsQueued()) { <START> log.warn("Due to the configuration, there were some records that can't be processed even" + <END> " though TopologyTestDriver is shutting down.", StreamsConfig.MAX_TASK_IDLE_MS_CONFIG); } if (!eosEnabled) { producer.close(); } stateDirectory.clean(); }</code><technical_language>> ? I remove TopologyTestDriver is shutting (read cleaner this IMHO.)</technical_language>

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:
<code>public static void updateValues(String hostAddress, String[] getCommands, OnOffType onoff) { if (hostAddress.equals("0:0:0:0:0:0:0:1")) hostAddress = "localhost"; <START> logger.debug("action at address ->> " + hostAddress + " On_OFF: " + onoff); <END> 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])); } } } } }</code><technical_language>parameterized logging instead of string concatenation</technical_language>

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:
<code>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(); <START> System.out.println("##########@@@@@@@@@########At the Gate########@@@@@@@!!!!!!!!"+fileName.split(".png")[0]+"@@@@@@@@@@@@$$$$$$$$$$$@@@@@@@@@@"+fileName); <END> 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"); } }</code><technical_language>remove System.out</technical_language>

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:
<code><START> public static TurboIssueEvent createLabelUpdateEvent( <END> String userName, IssueEventType eventType, GregorianCalendar time, String labelName) { return new TurboIssueEvent( new User().setLogin(userName), eventType, time.getTime()) .setLabelName(labelName); }</code><technical_language>this need public</technical_language>

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:
<code>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( <START> id, invalid("key `jsonrpc` not equal to `2.0`", message.get(JSONRPC))); <END> } }</code><technical_language>I this is extant code, bugs hell out of a comparison test constant VERSION (which is "2.0") exception message a hard-coded "2.0". exception message constructed VERSION const</technical_language>

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:
<code>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))) { <START> method.setRequestHeader("Content-Type", "application/json; charset=utf-8"); END> } method.setRequestHeader(ACCEPT, APPLICATION_JSON); return method; }</code><technical_language>watch :)</technical_language>

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:
<code>void shutdown() { <START> for (Entry<ThriftTransportKey,CachedConnections> entry : connections.entrySet()) { <END> Lock lock = locks.get(entry.getKey()); lock.lock(); entry.getValue().closeAllTransports(); } }</code><technical_language>I race conditions this loop of locks (like locks added lifetime of loop). is I array of locks in lbschanno#3</technical_language>

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:
<code>private void resolveParametersAndInvokeTestMethod(JupiterEngineExecutionContext context, DynamicTestExecutor dynamicTestExecutor, ThrowableCollector throwableCollector) { ExtensionRegistry registry = context.getExtensionRegistry(); <START> Object[] arguments = parameterResolver.resolveParameters(getTestMethod(), Optional.empty(), <END> context.getExtensionContext(), registry); invokeBeforeMethodsOrCallbacksUntilExceptionOccurs(context, ((extensionContext, callback) -> () -> callback.beforeParameterizedTestExecution(extensionContext, arguments)), BeforeParameterizedTestExecutionCallback.class); if (throwableCollector.isEmpty()) { invokeTestMethod(context, dynamicTestExecutor); } }</code><technical_language>test instance "empty". retrieve pass in invokeTestMethod()</technical_language>

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:
<code>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 <START> domain = <END> TransactionUtil.getEditingDomain(vpe); CompoundCommand allInOne = new CompoundCommand(cmd.getLabel()); allInOne.append(cmd); domain.getCommandStack().execute(allInOne); }</code><technical_language>computed</technical_language>

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:
<code>public void updateTitle(Title title) { Title builtTitle = currentTitle.build(); <START> if (title.getTitle() != null) { <END> 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()); } }</code><technical_language>Title null. useless check for null. <LINK_0></technical_language>

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:
<code>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); } } <START> if (pattern.length() > 0 && pattern.charAt(pattern.length() - 1) == '\\') { <END> 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; }</code><technical_language>I this is wrong. A pattern "foo\\" is valid match a file named "foo\" (quite non-Windows). A pattern "foo\" "foo\\\" match (backslash-escape end of string)</technical_language>

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:
<code>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) ? <START> 0.1f : <END> 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); } }</code><technical_language>This default is a magic number TimeGraphControl:2395, a constant? match</technical_language>

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:
<code>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 && <START> (cacheFile.getParentFile().listFiles() == null || cacheFile.getParentFile().listFiles().length == 0)) { <END> cleanupCacheFiles(baseFile, cacheFile.getParentFile()); } }</code><technical_language>extract cacheFile.getParentFile().listFiles() a local variable? This is expensive operation</technical_language>

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:
<code>public String toString() { <START> return Objects.toStringHelper(this).omitNullValues().add("id", id).add("poolId", poolId) <END> .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(); }</code><technical_language>weight is missing toString()</technical_language>

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:
<code>byte[] buildRedisTracePayload(){ SpanContext spanContext = tracer.activeSpan().context(); Carrier carrier = new Carrier(new HashMap<>()); <START> tracer.inject(spanContext, Format.Builtin.TEXT_MAP, carrier); <END> 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; }</code><technical_language>tracing in consumer, do need do this</technical_language>

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:
<code>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)) <START> .and(Measurement_Table.is_done.eq(true)) <END> .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; }</code><technical_language>I recommend unifying code in (or is a reason to?)</technical_language>

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:
<code>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(), <START> message.getJMSType(), message.getJMSPriority()); <END> 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); } }</code><technical_language>Some ideas DlmsDeviceMessageMetadata handy I think. A method handleMessage(ObjectMessage) extracting interesting metadata repeated. A toString implementation allows a single log statement for DeviceMessageMetadata instead of logging a set of properties</technical_language>

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); } }