auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void openErrorLogView() { SWTBotMenu windowMenuBot = bot.menu("Window"); String showView = "Show View"; SWTBotMenu showViewMenuBot = windowMenuBot.menu(showView); SWTBotMenu otherMenuBot = showViewMenuBot.menu("Other..."); otherMenuBot.click(); <START> bot.shell(showView).activate(); <END> SWTBotTree viewsTreeBot = bot.tree(); bot.text().setText("Error"); SWTBotTreeItem expandNode = viewsTreeBot.expandNode("General"); bot.waitUntil(new TreeItemExpanded(expandNode, expandNode.getText())); expandNode.getNode("Error Log").doubleClick(); }</code><technical_language>replace this code : bot.menu("Window").menu("Show View").menu("Other...").click();</technical_language>

Target:
private void openErrorLogView() { bot.menu("Window").menu("Show View").menu("Other...").click(); SWTBotTree viewsTreeBot = bot.tree(); bot.text().setText("Error"); SWTBotTreeItem expandNode = viewsTreeBot.expandNode("General"); bot.waitUntil(new TreeItemExpanded(expandNode, expandNode.getText())); expandNode.getNode("Error Log").doubleClick(); }
Source:
<code>protected void doGet(final HttpServletRequest req, final HttpServletResponse rsp) throws IOException { final Page.Content page = get().get(select(req)); final byte[] raw; final CurrentUser user = currentUser.get(); if (user instanceof IdentifiedUser) { final StringWriter w = new StringWriter(); w.write(HPD_ID + ".account="); json(((IdentifiedUser) user).getAccount(), w); w.write(";"); w.write(HPD_ID + ".xsrfToken="); json(session.get().getToken(), w); w.write(";"); w.write(HPD_ID + ".accountDiffPref="); json(((IdentifiedUser) user).getAccountDiffPreference(), w); w.write(";"); <START> <END> w.write(HPD_ID + ".theme="); json(signedInTheme, w); w.write(";"); final byte[] userData = w.toString().getBytes("UTF-8"); raw = concat(page.part1, userData, page.part2); } else { raw = page.full; } final byte[] tosend; if (RPCServletUtils.acceptsGzipEncoding(req)) { rsp.setHeader("Content-Encoding", "gzip"); tosend = raw == page.full ? page.full_gz : HtmlDomUtil.compress(raw); } else { tosend = raw; } rsp.setHeader("Expires", "Fri, 01 Jan 1980 00:00:00 GMT"); rsp.setHeader("Pragma", "no-cache"); rsp.setHeader("Cache-Control", "no-cache, must-revalidate"); rsp.setContentType("text/html"); rsp.setCharacterEncoding(HtmlDomUtil.ENC); rsp.setContentLength(tosend.length); final OutputStream out = rsp.getOutputStream(); try { out.write(tosend); } finally { out.close(); } }</code><technical_language>a pattern this populate plugin array in HostPageData dynamically request. means writing some portion fo HostPageData dynamically, want refactor this entire block a bit forget page.full block in else concat build 3 sections of page up</technical_language>

Target:
protected void doGet(final HttpServletRequest req, final HttpServletResponse rsp) throws IOException { final Page.Content page = get().get(select(req)); final CurrentUser user = currentUser.get(); final StringWriter w = new StringWriter(); if (user instanceof IdentifiedUser) { w.write(HPD_ID + ".account="); json(((IdentifiedUser) user).getAccount(), w); w.write(";"); w.write(HPD_ID + ".xsrfToken="); json(session.get().getToken(), w); w.write(";"); w.write(HPD_ID + ".accountDiffPref="); json(((IdentifiedUser) user).getAccountDiffPreference(), w); w.write(";"); w.write(HPD_ID + ".theme="); json(signedInTheme, w); w.write(";"); } else { w.write(HPD_ID + ".theme="); json(signedOutTheme, w); w.write(";"); } w.write(HPD_ID + ".plugnisUrls="); json(getPluginUrls(), w); w.write(";"); final byte[] userData = w.toString().getBytes("UTF-8"); final byte[] raw = concat(page.part1, userData, page.part2); final byte[] tosend; if (RPCServletUtils.acceptsGzipEncoding(req)) { rsp.setHeader("Content-Encoding", "gzip"); tosend = HtmlDomUtil.compress(raw); } else { tosend = raw; } rsp.setHeader("Expires", "Fri, 01 Jan 1980 00:00:00 GMT"); rsp.setHeader("Pragma", "no-cache"); rsp.setHeader("Cache-Control", "no-cache, must-revalidate"); rsp.setContentType("text/html"); rsp.setCharacterEncoding(HtmlDomUtil.ENC); rsp.setContentLength(tosend.length); final OutputStream out = rsp.getOutputStream(); try { out.write(tosend); } finally { out.close(); } }
Source:
<code>public RowExpression pushNegationToLeaves(RowExpression expression) { if (isNotCallExpression(expression)) { RowExpression argument = ((CallExpression) expression).getArguments().get(0); if (isNotCallExpression(argument)) { return pushNegationToLeaves(((CallExpression) argument).getArguments().get(0)); } if (isConjunctionOrDisjunction(argument)) { SpecialFormExpression specialForm = ((SpecialFormExpression) argument); if (specialForm.getForm() == AND) { <START> return or(pushNegationToLeaves(notCallExpression(specialForm.getArguments().get(0))), pushNegationToLeaves(notCallExpression(specialForm.getArguments().get(1)))); <END> } return and(pushNegationToLeaves(notCallExpression(specialForm.getArguments().get(0))), pushNegationToLeaves(notCallExpression(specialForm.getArguments().get(1)))); } return expression; } if (isConjunctionOrDisjunction(expression)) { SpecialFormExpression specialForm = ((SpecialFormExpression) expression); if (specialForm.getForm() == AND) { return and(pushNegationToLeaves(specialForm.getArguments().get(0)), pushNegationToLeaves(specialForm.getArguments().get(1))); } return or(pushNegationToLeaves(specialForm.getArguments().get(0)), pushNegationToLeaves(specialForm.getArguments().get(1))); } return expression; }</code><technical_language>nit: I in general prefer static import / :). . consider reorg java return or( pushNegationToLeaves( notCallExpression(specialForm.getArguments().get(0))), pushNegationToLeaves( notCallExpression(specialForm.getArguments().get(1)))); This a bit easier parse human ? :)</technical_language>

Target:
public RowExpression pushNegationToLeaves(RowExpression expression) { return expression.accept(new PushNegationVisitor(), null); }
Source:
<code>public static Map<SystemStreamPartition, String> readOffsetFile(File storagePartitionDir, Set<SystemStreamPartition> storeSSPs) { Map<SystemStreamPartition, String> offsets = null; String fileContents; File offsetFileRef = new File(storagePartitionDir, OFFSET_FILE_NAME); String storePath = storagePartitionDir.getPath(); if (offsetFileRef.exists()) { LOG.info("Found offset file in storage partition directory: {}", storePath); try { fileContents = FileUtil.readWithChecksum(offsetFileRef); try { offsets = OBJECT_MAPPER.readValue(fileContents, OFFSETS_TYPE_REFERENCE); } catch (JsonParseException | JsonMappingException e) { LOG.info("Exception in json-parsing offset file {}, reading as string offset-value", storagePartitionDir.toPath(), OFFSET_FILE_NAME); offsets = (storeSSPs.size() == 1) ? storeSSPs.stream().collect(Collectors.toMap(x -> x, y -> fileContents)) : null; } catch (IOException e) { LOG.info("Exception in json-parsing offset file {}, reading as string offset-value", storagePartitionDir.toPath(), OFFSET_FILE_NAME); <START> offsets = (storeSSPs.size() == 1) ? storeSSPs.stream().collect(Collectors.toMap(x -> x, y -> fileContents)) : null; <END> } } catch (Exception e) { LOG.warn("Failed to read offset file in storage partition directory: {}", storePath, e); } } else { LOG.info("No offset file found in storage partition directory: {}", storePath); } return offsets; }</code><technical_language>this is needed right? get here, unable read file. this cover file exists scenario</technical_language>

Target:
public static Map<SystemStreamPartition, String> readOffsetFile(File storagePartitionDir, Set<SystemStreamPartition> storeSSPs) { Map<SystemStreamPartition, String> offsets = new HashMap<>(); String fileContents = null; File offsetFileRef = new File(storagePartitionDir, OFFSET_FILE_NAME); String storePath = storagePartitionDir.getPath(); if (offsetFileRef.exists()) { LOG.info("Found offset file in storage partition directory: {}", storePath); try { fileContents = FileUtil.readWithChecksum(offsetFileRef); offsets = OBJECT_MAPPER.readValue(fileContents, OFFSETS_TYPE_REFERENCE); } catch (JsonParseException | JsonMappingException e) { LOG.info("Exception in json-parsing offset file {}, reading as string offset-value", storagePartitionDir.toPath(), OFFSET_FILE_NAME); final String finalFileContents = fileContents; offsets = (storeSSPs.size() == 1) ? storeSSPs.stream().collect(Collectors.toMap(ssp -> ssp, offset -> finalFileContents)) : offsets; } catch (Exception e) { LOG.warn("Failed to read offset file in storage partition directory: {}", storePath, e); } } else { LOG.info("No offset file found in storage partition directory: {}", storePath); } return offsets; }
Source:
<code>public void testSaveSettingsEmptyProperty() throws BundleException { SettingsDto dto = new SettingsDto(); dto.setTaskPossibleErrors(null); dto.setTaskLogActivities(null); controller.saveSettings(dto); <START> verify(settingsFacade, never()).setProperty(eq(TASK_LOG_ACTIVITIES_KEY), anyString()); <END> verify(settingsFacade, times(1)).setProperty(eq(TASK_POSSIBLE_ERRORS_KEY), anyString()); }</code><technical_language>this line is executed - line throws exception test ends success</technical_language>

Target:
public void testSaveSettingsEmptyProperty() throws BundleException { SettingsDto dto = new SettingsDto(); dto.setTaskPossibleErrors(null); dto.setTaskLogActivities(null); controller.saveSettings(dto); }
Source:
<code>public int hashCode() { <START> return hash; <END> }</code><technical_language>safe. if ntCall changes</technical_language>

Target:
public int hashCode() { int result = ntCall.key.hashCode(); result = 31 * result + stateBegin; result = 31 * result + state.hashCode(); return result; }
Source:
<code>private void processCheckpoint(StreamAddressSpace streamAddressSpace, Function<ILogData, BackpointerOp> filter, NavigableSet<Long> queue) { List<Long> checkpointAddresses = new ArrayList<>(); streamAddressSpace.getAddressMap().forEach(checkpointAddresses::add); <START> checkpointAddresses.sort(Collections.reverseOrder()); <END> Iterable<List<Long>> batches = Iterables.partition(checkpointAddresses, runtime.getParameters().getCheckpointReadBatchSize()); boolean checkpointResolved = false; for (List<Long> batch : batches) { if (checkpointResolved) { break; } try { List<ILogData> entries = readAll(batch); for (ILogData data : entries) { checkpointResolved = filterCheckpointEntry(data, filter, queue); if (checkpointResolved) { break; } } } catch (TrimmedException te) { checkpointResolved = processCheckpointBatchByEntry(batch, filter, queue); } } }</code><technical_language>replace List SortedSet</technical_language>

Target:
private void processCheckpoint(StreamAddressSpace streamAddressSpace, Function<ILogData, BackpointerOp> filter, NavigableSet<Long> queue) { SortedSet<Long> checkpointAddresses = new TreeSet<>(Collections.reverseOrder()); streamAddressSpace.getAddressMap().forEach(checkpointAddresses::add); Iterable<List<Long>> batches = Iterables.partition(checkpointAddresses, runtime.getParameters().getCheckpointReadBatchSize()); boolean checkpointResolved = false; for (List<Long> batch : batches) { if (checkpointResolved) { break; } try { List<ILogData> entries = readAll(batch); for (ILogData data : entries) { checkpointResolved = filterCheckpointEntry(data, filter, queue); if (checkpointResolved) { break; } } } catch (TrimmedException te) { checkpointResolved = processCheckpointBatchByEntry(batch, filter, queue); } } }
Source:
<code>public String extractAttributeValueString(Attribute attrib) { StringBuilder strBuilder = new StringBuilder(); if (attrib != null) { List<XMLObject> attrVals = attrib.getAttributeValues(); for (Object o : attrVals) { if (o instanceof org.w3c.dom.Element) { org.w3c.dom.Element elem = (org.w3c.dom.Element) o; strBuilder.append(elem.getTextContent()); break; } else if (o instanceof String) { <START> strBuilder.append(o + " "); <END> } else if (o instanceof XSStringImpl) { strBuilder.append(((XSStringImpl) o).getValue()); } } } return strBuilder.toString().trim(); }</code><technical_language>append instead of +</technical_language>

Target:
public String extractAttributeValueString(Attribute attrib) { StringBuilder strBuilder = new StringBuilder(); if (attrib != null) { List<XMLObject> attrVals = attrib.getAttributeValues(); for (Object o : attrVals) { if (o instanceof org.w3c.dom.Element) { org.w3c.dom.Element elem = (org.w3c.dom.Element) o; strBuilder.append(elem.getTextContent()); break; } else if (o instanceof String) { strBuilder.append(o).append(" "); } else if (o instanceof XSStringImpl) { strBuilder.append(((XSStringImpl) o).getValue()); } } } return strBuilder.toString().trim(); }
Source:
<code>public static void watch(Thread thread, Runnable task) { ObjectUtil.checkNotNull(thread, "thread"); if (!thread.isAlive()) { throw new IllegalArgumentException("thread must be alive."); } <START> schedule(thread, ObjectUtil.checkNotNull(task, "task"), true); <END> }</code><technical_language>move mull check null check for thread ensure change behaviour</technical_language>

Target:
public static void watch(Thread thread, Runnable task) { ObjectUtil.checkNotNull(thread, "thread"); ObjectUtil.checkNotNull(task, "task"); if (!thread.isAlive()) { throw new IllegalArgumentException("thread must be alive."); } schedule(thread, task, true); }
Source:
<code>private static void transferChunk(Layout layout, CorfuRuntime runtime, String endpoint, List<Long> chunk) { long ts1 = System.currentTimeMillis(); Map<Long, ILogData> dataMap = runtime.getAddressSpaceView() .fetchAll(chunk, true); long ts2 = System.currentTimeMillis(); log.info("stateTransfer: read [{}-{}] in ms", <START> chunk.get(0), chunk.get(chunk.size() - 1), (ts2 - ts1)); <END> List<LogData> entries = new ArrayList<>(); for (long address : chunk) { if (!dataMap.containsKey(address)) { log.error("Missing address in batch {}", address, chunk); throw new IllegalStateException("Missing address"); } entries.add((LogData) dataMap.get(address)); } ts1 = System.currentTimeMillis(); boolean transferSuccess = CFUtils.getUninterruptibly(runtime.getLayoutView() .getRuntimeLayout(layout) .getLogUnitClient(endpoint) .writeRange(entries), OverwriteException.class); ts2 = System.currentTimeMillis(); if (!transferSuccess) { log.error("stateTransfer: Failed to transfer to {}", chunk, endpoint); throw new IllegalStateException("Failed to transfer!"); } log.info("stateTransfer: Transferred address chunk [{}-{}] to in ms", chunk.get(0), chunk.get(chunk.size() - 1), endpoint, (ts2 - ts1)); }</code><technical_language>@WenbinZhu please change this</technical_language>

Target:
private static void transferChunk(Layout layout, CorfuRuntime runtime, String endpoint, List<Long> chunk) { if (chunk.isEmpty()) { return; } long ts1 = System.currentTimeMillis(); Map<Long, ILogData> dataMap = runtime.getAddressSpaceView() .fetchAll(chunk, true); long ts2 = System.currentTimeMillis(); log.info("stateTransfer: read [{}-{}] in ms", chunk.get(0), chunk.get(chunk.size() - 1), (ts2 - ts1)); List<LogData> entries = new ArrayList<>(); for (long address : chunk) { if (!dataMap.containsKey(address)) { log.error("Missing address in batch {}", address, chunk); throw new IllegalStateException("Missing address"); } entries.add((LogData) dataMap.get(address)); } try { ts1 = System.currentTimeMillis(); boolean transferSuccess = CFUtils.getUninterruptibly(runtime.getLayoutView() .getRuntimeLayout(layout) .getLogUnitClient(endpoint) .writeRange(entries), OverwriteException.class); ts2 = System.currentTimeMillis(); if (!transferSuccess) { log.error("stateTransfer: Failed to transfer to {}", chunk, endpoint); throw new IllegalStateException("Failed to transfer!"); } } catch (OverwriteException oe) { log.error("stateTransfer: Overwrite Exception on transfer of chunk: {}", chunk); throw oe; } log.info("stateTransfer: Transferred address chunk [{}-{}] to in ms", chunk.get(0), chunk.get(chunk.size() - 1), endpoint, (ts2 - ts1)); }
Source:
<code>static URI relativize(URI current, URI target) { <START> String slash <END> = "/"; if (!target.toString().equals(target.getPath())) { return target; } if (!current.toString().equals(current.getPath())) { return target; } String cur = current.normalize().getPath(); String dest = target.normalize().getPath(); if (cur.startsWith(slash) != dest.startsWith(slash)) { return target; } while (cur.startsWith(slash)) { cur = cur.substring(1); } while (dest.startsWith(slash)) { dest = dest.substring(1); } if (cur.indexOf('/') == -1 || dest.indexOf('/') == -1) { String prefix = "prefix/"; cur = prefix + cur; dest = prefix + dest; } if (!cur.endsWith(slash)) { int lastSlash = cur.lastIndexOf('/'); cur = cur.substring(0, lastSlash); } String destFile = ""; if (!dest.endsWith(slash)) { int lastSlash = dest.lastIndexOf('/'); destFile = dest.substring(lastSlash + 1, dest.length()); dest = dest.substring(0, dest.lastIndexOf('/')); } String[] cs = cur.split(slash); String[] ds = dest.split(slash); int common = 0; while (common < cs.length && common < ds.length && cs[common].equals(ds[common])) { common++; } StringJoiner j = new StringJoiner(slash); for (int i = common; i < cs.length; i++) { j.add(".."); } for (int i = common; i < ds.length; i++) { j.add(ds[i]); } j.add(destFile); return URI.create(j.toString()); }</code><technical_language>static final String</technical_language>

Target:
static URI relativize(URI current, URI target) { if (!target.toString().equals(target.getPath())) { return target; } if (!current.toString().equals(current.getPath())) { return target; } String cur = current.normalize().getPath(); String dest = target.normalize().getPath(); if (cur.startsWith(SLASH) != dest.startsWith(SLASH)) { return target; } while (cur.startsWith(SLASH)) { cur = cur.substring(1); } while (dest.startsWith(SLASH)) { dest = dest.substring(1); } if (cur.indexOf('/') == -1 || dest.indexOf('/') == -1) { String prefix = "prefix/"; cur = prefix + cur; dest = prefix + dest; } if (!cur.endsWith(SLASH)) { int lastSlash = cur.lastIndexOf('/'); cur = cur.substring(0, lastSlash); } String destFile = ""; if (!dest.endsWith(SLASH)) { int lastSlash = dest.lastIndexOf('/'); destFile = dest.substring(lastSlash + 1, dest.length()); dest = dest.substring(0, dest.lastIndexOf('/')); } String[] cs = cur.split(SLASH); String[] ds = dest.split(SLASH); int common = 0; while (common < cs.length && common < ds.length && cs[common].equals(ds[common])) { common++; } StringJoiner j = new StringJoiner(SLASH); for (int i = common; i < cs.length; i++) { j.add(".."); } for (int i = common; i < ds.length; i++) { j.add(ds[i]); } j.add(destFile); return URI.create(j.toString()); }
Source:
<code>default List<MessageFilter<Message>> filters() { List<Filter> list = getFilterList(); <START> return ImmutableList.copyOf(list); <END> }</code><technical_language>Lists obtained a message immutable. need for extra copying</technical_language>

Target:
default List<MessageFilter<Message>> filters() { List<Filter> filterList = getFilterList(); @SuppressWarnings("unchecked") List<MessageFilter<Message>> list = (List<MessageFilter<Message>>) (List<?>) filterList; return list; }
Source:
<code>public void click(final MouseEvent event) { if (getHost() instanceof CollapseHandlePart) { <START> @SuppressWarnings("unchecked") <END> final CompartmentContentPart<?, ?> compartment = VisualPartUtil.findParentVisualPartInstance(getHost().getAnchorages().keys() .iterator().next(), CompartmentContentPart.class); if (null != compartment && compartment.isCanCollapse()) { final boolean valueToSet = !compartment.isCollapsed(); final DrawerStyle drawerStyle = getcreateDrawerStyle(compartment); final SetRequest setRequest = new SetRequest(drawerStyle, NotationPackage.Literals.DRAWER_STYLE__COLLAPSED, valueToSet); final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(drawerStyle); if (provider != null) { final CompositeCommand collapseCommand = new CompositeCommand("Collapse element"); collapseCommand.add(provider.getEditCommand(setRequest)); AdapterFactoryEditingDomain.getEditingDomainFor(drawerStyle).getCommandStack().execute(new GMFtoEMFCommandWrapper(collapseCommand)); } } } }</code><technical_language>GEF4 properly handles generics. Hiding a warning in this case hides error in code. Do suppress warnings</technical_language>

Target:
public void click(final MouseEvent event) { if (getHost() instanceof CollapseHandlePart) { @SuppressWarnings("unchecked") final CompartmentContentPart<?, ?> compartment = VisualPartUtil.findParentVisualPartInstance(getHost().getAnchorages().keys() .iterator().next(), CompartmentContentPart.class); if (null != compartment && compartment.isCanCollapse()) { final boolean valueToSet = !compartment.isCollapsed(); final DrawerStyle drawerStyle = getCreateDrawerStyle(compartment); final SetRequest setRequest = new SetRequest(drawerStyle, NotationPackage.Literals.DRAWER_STYLE__COLLAPSED, valueToSet); final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(drawerStyle); if (provider != null) { final CompositeCommand collapseCommand = new CompositeCommand("Collapse element"); collapseCommand.add(provider.getEditCommand(setRequest)); AdapterFactoryEditingDomain.getEditingDomainFor(drawerStyle).getCommandStack().execute(new GMFtoEMFCommandWrapper(collapseCommand)); } } } }
Source:
<code>void handleOnNewIntent(Uri uri) { <START> if (uri == null || !REACT_TWITTER_OAUTH_SCHEME.equals(uri.getScheme())) { <END> return; } intentModule.handleOnNewIntent(uri); }</code><technical_language>extract metod</technical_language>

Target:
void handleOnNewIntent(Uri uri) { if (!isUriValid(uri)) { return; } intentModule.handleOnNewIntent(uri); }
Source:
<code>public Spec spec() { try { return new Spec.Simple( <START> new JdkRequest(UriBuilder.fromUri(this.home).build()) <END> .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .method(Request.GET) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .xml() .xpath("/page/rule/spec/text()") .get(0) ); } catch (IOException ex) { throw new IllegalStateException(ex); } }</code><technical_language>need UriBuilder</technical_language>

Target:
public Spec spec() { try { return new Spec.Simple( new JdkRequest(this.home) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .xml() .xpath("/page/rule/spec/text()") .get(0) ); } catch (IOException ex) { throw new IllegalStateException(ex); } }
Source:
<code>public JSONObject getTranslation( JSONObject query ) { JSONObject result = null; try { <START> String service = query.getString("service"); <END> if ( service.equals( "google" ) ) { String text = query.getString("text"); String target = query.getString("target"); ConfigPropertiesUtil configUtil = new ConfigPropertiesUtil(); Properties properties = configUtil.getConfigProperties(); String translationApiKey = properties.getProperty(TRANSLATE_API_KEY); result = translateGoogle( text, target, translationApiKey ); } } catch ( JSONException e ) { LOGGER.error( "Incorrect Configuration for Translation API", e ); } catch ( ConfigException e ) { LOGGER.error( "Error with internal configuration properties", e ); } return result; }</code><technical_language>this return null if "service" is in query? avoid npe StringUtils.equals reversing equals</technical_language>

Target:
public JSONObject getTranslation( JSONObject query ) { JSONObject result = null; try { String service = query.getString("service"); String text = query.getString("text"); String target = query.getString("target"); if ( StringUtils.equalsIgnoreCase( service, "google" ) ) { Properties properties = _service.getConfigProperties(); if ( properties != null ) { String translationApiKey = properties.getProperty(TRANSLATE_API_KEY); String translationApiEndpoint = properties.getProperty(TRANSLATE_API_ENDPOINT); if ( translationApiKey != null && translationApiEndpoint != null ) { result = translateGoogle( text, target, translationApiKey, translationApiEndpoint ); } } } if ( result == null ){ JSONObject resultErr = new JSONObject(); resultErr.put("message", "Incorrect Translation Service Configuration"); result = new JSONObject(); result.put("error", resultErr); } } catch ( JSONException e ) { LOGGER.error( "Incorrect Configuration for Translation API", e ); } catch ( ConfigException e ) { LOGGER.error( "Error with internal configuration properties", e ); } return result; }
Source:
<code>protected int initializeConsumers() { int count = 0; synchronized (this.consumersMonitor) { if (this.consumers == null) { this.consumers = new HashMap<BlockingQueueConsumer, Boolean>(this.concurrentConsumers); cancellationLock.reset(); <START> while (this.consumers.size() < this.concurrentConsumers) { <END> BlockingQueueConsumer consumer = createBlockingQueueConsumer(); this.consumers.put(consumer, true); count++; } } } return count; }</code><technical_language>enough iterate before? initializeConsumers() is called - doStart()</technical_language>

Target:
protected int initializeConsumers() { int count = 0; synchronized (this.consumersMonitor) { if (this.consumers == null) { cancellationLock.reset(); this.consumers = new HashMap<BlockingQueueConsumer, Boolean>(this.concurrentConsumers); for (int i = 0; i < this.concurrentConsumers; i++) { BlockingQueueConsumer consumer = createBlockingQueueConsumer(); this.consumers.put(consumer, true); count++; } } } return count; }
Source:
<code>public Set<String> getVolumes(@Nonnull EnvVars launchEnv, String objectId) throws IOException, InterruptedException { LaunchResult result = launch(launchEnv, true, "inspect", objectId); if (result.getStatus() != 0) { return Collections.EMPTY_SET; } JsonParser parser = new JsonParser(); JsonElement information = parser.parse(result.getOut()); <START> JsonObject volumes = information.getAsJsonArray().get(0).getAsJsonObject().getAsJsonObject("Config").getAsJsonObject("Volumes"); <END> Gson gson = new Gson(); Type volumesMapType = new TypeToken<Map<String, JsonElement>>(){}.getType(); Map<String, JsonElement> volumesMap = gson.fromJson(volumes, volumesMapType); return volumesMap.keySet(); }</code><technical_language>I avoid GSON dep calling java inspect(launchEnv, objectId, "{{.Config.Volumes}}") lines</technical_language>

Target:
public List<String> getVolumes(@Nonnull EnvVars launchEnv, String objectId) throws IOException, InterruptedException { LaunchResult result = launch(launchEnv, true, "inspect", "-f", "{{range $index, $element := .Config.Volumes}}{{$index}}\n{{end}}", objectId); if (result.getStatus() != 0) { return Collections.EMPTY_LIST; } String volumes = result.getOut(); return Arrays.asList(volumes.split("\\n")); }
Source:
<code>private HttpClientRequest doRequest(HttpMethod method, String host, int port, String relativeURI, MultiMap headers) { Objects.requireNonNull(method, "no null method accepted"); Objects.requireNonNull(host, "no null host accepted"); Objects.requireNonNull(relativeURI, "no null relativeURI accepted"); checkClosed(); ProxyOptions proxyOptions = options.getProxyOptions(); if (!options.isSsl() && proxyOptions != null && proxyOptions.getType() == ProxyType.HTTP) { if (headers == null) { headers = MultiMap.caseInsensitiveMultiMap(); } relativeURI = "http://" + host + (port != 80 ? ":" + port : "") + relativeURI; host = proxyOptions.getHost(); port = proxyOptions.getPort(); <START> log.debug("changing request to proxy request " + relativeURI); <END> log.debug("username "+proxyOptions.getUsername()+" password "+proxyOptions.getPassword()); if (proxyOptions.getUsername() != null && proxyOptions.getPassword() != null) { log.debug("adding authorization header"); headers.add("Proxy-Authorization", "Basic " + Base64.getEncoder() .encodeToString((proxyOptions.getUsername() + ":" + proxyOptions.getPassword()).getBytes())); } headers.add("Host", host + (port != 80 ? ":" + port : "")); } HttpClientRequest req = new HttpClientRequestImpl(this, method, host, port, options.isSsl(), relativeURI, vertx); if (headers != null) { req.headers().setAll(headers); } return req; }</code><technical_language>remove log</technical_language>

Target:
private HttpClientRequest doRequest(HttpMethod method, String host, int port, String relativeURI, MultiMap headers) { Objects.requireNonNull(method, "no null method accepted"); Objects.requireNonNull(host, "no null host accepted"); Objects.requireNonNull(relativeURI, "no null relativeURI accepted"); checkClosed(); String connectHost; int connectPort; ProxyOptions proxyOptions = options.getProxyOptions(); final boolean useProxy = !options.isSsl() && proxyOptions != null && proxyOptions.getType() == ProxyType.HTTP; if (useProxy) { relativeURI = "http://" + host + (port != 80 ? ":" + port : "") + relativeURI; connectHost = proxyOptions.getHost(); connectPort = proxyOptions.getPort(); if (proxyOptions.getUsername() != null && proxyOptions.getPassword() != null) { if (headers == null) { headers = MultiMap.caseInsensitiveMultiMap(); } headers.add("Proxy-Authorization", "Basic " + Base64.getEncoder() .encodeToString((proxyOptions.getUsername() + ":" + proxyOptions.getPassword()).getBytes())); } } else { connectHost = host; connectPort = port; } HttpClientRequest req = new HttpClientRequestImpl(this, method, connectHost, connectPort, options.isSsl(), relativeURI, vertx); if (useProxy) { req.setHost(host + (port != 80 ? ":" + port : "")); } if (headers != null) { req.headers().setAll(headers); } return req; }
Source:
<code>public static List<Pair<RelNode, List<RelOptMaterialization>>> useMaterializedViews( final RelNode rel, List<RelOptMaterialization> materializations) { <START> return useMaterializedViews(rel, materializations, null); <END> }</code><technical_language>parameter empty list null (I hit NPE)</technical_language>

Target:
public static List<Pair<RelNode, List<RelOptMaterialization>>> useMaterializedViews( final RelNode rel, List<RelOptMaterialization> materializations) { return useMaterializedViews(rel, materializations, ImmutableList.of()); }
Source:
<code>public static OperationModel createModel( VisibilityPredicate visibility, ReflectionPredicate reflectionPredicate, List<Pattern> omitMethods, Set<@ClassGetName String> classnames, Set<@ClassGetName String> coveredClassesGoalNames, ClassNameErrorHandler errorHandler, List<String> literalsFileList, SpecificationCollection operationSpecifications) throws SignatureParseException, NoSuchMethodException { OperationModel model = new OperationModel(); model.omitMethods = omitMethods; model.addClassTypes( visibility, reflectionPredicate, classnames, coveredClassesGoalNames, errorHandler, literalsFileList); OmitMethodsPredicate omitPredicate = new OmitMethodsPredicate(omitMethods); model.omitMethodsPredicate = omitPredicate; model.addOperationsFromClasses( <START> model.classTypes, visibility, reflectionPredicate, omitPredicate, operationSpecifications); <END> model.addOperationsUsingSignatures( GenInputsAbstract.methodlist, visibility, reflectionPredicate, omitPredicate); model.addObjectConstructor(); return model; }</code><technical_language>model contains a field this object in it. So, this need passed in more</technical_language>

Target:
public static OperationModel createModel( VisibilityPredicate visibility, ReflectionPredicate reflectionPredicate, List<Pattern> omitMethods, Set<@ClassGetName String> classnames, Set<@ClassGetName String> coveredClassesGoalNames, ClassNameErrorHandler errorHandler, List<String> literalsFileList, SpecificationCollection operationSpecifications) throws SignatureParseException, NoSuchMethodException { OperationModel model = new OperationModel(); model.omitMethods = omitMethods; model.addClassTypes( visibility, reflectionPredicate, classnames, coveredClassesGoalNames, errorHandler, literalsFileList); model.omitMethodsPredicate = new OmitMethodsPredicate(omitMethods); model.addOperationsFromClasses( model.classTypes, visibility, reflectionPredicate, operationSpecifications); model.addOperationsUsingSignatures( GenInputsAbstract.methodlist, visibility, reflectionPredicate); model.addObjectConstructor(); return model; }
Source:
<code><START> @DataBoundSetter public final void setParameterDefinitions(List<ParameterDefinition> parameterDefinitions) { <END> this.parameterDefinitions = parameterDefinitions; }</code><technical_language>code style</technical_language>

Target:
public final void setParameterDefinitions(List<ParameterDefinition> parameterDefinitions) { this.parameterDefinitions = parameterDefinitions; }
Source:
<code>private static BackgroundHiveSplitLoader backgroundHiveSplitLoaderOfflinePartitions() <START> throws Exception <END> { ConnectorSession connectorSession = new TestingConnectorSession( new HiveSessionProperties(new HiveClientConfig().setMaxSplitSize(new DataSize(1.0, GIGABYTE))).getSessionProperties()); return new BackgroundHiveSplitLoader( SIMPLE_TABLE, createPartitionMetadataWithOfflinePartitions(), TupleDomain.all(), createBucketSplitInfo(Optional.empty(), ImmutableList.of()), connectorSession, new TestingHdfsEnvironment(), new NamenodeStats(), new TestingDirectoryLister(TEST_FILES), directExecutor(), 2, false); }</code><technical_language>Exception is thrown</technical_language>

Target:
private static BackgroundHiveSplitLoader backgroundHiveSplitLoaderOfflinePartitions() { ConnectorSession connectorSession = new TestingConnectorSession( new HiveSessionProperties(new HiveClientConfig().setMaxSplitSize(new DataSize(1.0, GIGABYTE))).getSessionProperties()); return new BackgroundHiveSplitLoader( SIMPLE_TABLE, createPartitionMetadataWithOfflinePartitions(), TupleDomain.all(), createBucketSplitInfo(Optional.empty(), ImmutableList.of()), connectorSession, new TestingHdfsEnvironment(), new NamenodeStats(), new TestingDirectoryLister(TEST_FILES), directExecutor(), 2, false); }
Source:
<code>protected Message<?> toMessage(EventObject event) { EntryEventMessagePayload<?, ?> messagePayload = null; final Map<String, Object> headers = new HashMap<String, Object>(); headers.put(HazelcastHeaders.EVENT, ((AbstractIMapEvent) event).getEventType()); headers.put(HazelcastHeaders.MEMBER, ((AbstractIMapEvent) event).getMember()); headers.put(HazelcastHeaders.NAME, ((AbstractIMapEvent) event).getName()); if (event instanceof EntryEvent) { Assert.notNull(((EntryEvent) event).getKey(), "key must not be null"); messagePayload = new EntryEventMessagePayload( ((EntryEvent) event).getKey(), ((EntryEvent) event).getValue(), ((EntryEvent) event).getOldValue()); } else if (event instanceof MapEvent) { messagePayload = new EntryEventMessagePayload(((MapEvent) event).getNumberOfEntriesAffected()); <START> } else { <END> throw new IllegalStateException("Invalid event is received. Event : " + event); } return getMessageBuilderFactory().withPayload(messagePayload).copyHeaders(headers).build(); }</code><technical_language>else new line. is Spring code style rule</technical_language>

Target:
protected Message<?> toMessage(EventObject event) { final Map<String, Object> headers = new HashMap<String, Object>(); headers.put(HazelcastHeaders.EVENT_TYPE, ((AbstractIMapEvent) event).getEventType().name()); headers.put(HazelcastHeaders.MEMBER, ((AbstractIMapEvent) event).getMember().getSocketAddress()); headers.put(HazelcastHeaders.CACHE_NAME, ((AbstractIMapEvent) event).getName()); if (event instanceof EntryEvent) { Assert.notNull(((EntryEvent) event).getKey(), "key must not be null"); EntryEventMessagePayload<?, ?> messagePayload = new EntryEventMessagePayload( ((EntryEvent) event).getKey(), ((EntryEvent) event).getValue(), ((EntryEvent) event).getOldValue()); return getMessageBuilderFactory().withPayload(messagePayload).copyHeaders(headers).build(); } else if (event instanceof MapEvent) { return getMessageBuilderFactory() .withPayload(((MapEvent) event).getNumberOfEntriesAffected()).copyHeaders(headers).build(); } else { throw new IllegalStateException("Invalid event is received. Event : " + event); } }
Source:
<code>public List<NuxeoOAuth2Token> getProviderUserTokens(@Context HttpServletRequest request) { <START> String nxuser = request.getUserPrincipal().getName(); <END> return getTokens(nxuser).stream() .filter(token -> token.getClientId() == null).collect(Collectors.toList()); }</code><technical_language>I a special case for anonymous principal, disallow API in a case</technical_language>

Target:
public List<NuxeoOAuth2Token> getProviderUserTokens(@Context HttpServletRequest request) { checkNotAnonymousUser(); String nxuser = request.getUserPrincipal().getName(); return getTokens(nxuser).stream() .filter(token -> token.getClientId() == null).collect(Collectors.toList()); }
Source:
<code>private static String getIommu(CpuVendor cpuVendor, boolean iommu) { if (!iommu) { return ""; } switch (cpuVendor) { case AMD: return <START> "amd_iommu=1 "; <END> case INTEL: return "intel_iommu=1 "; case IBM: return ""; default: throw new RuntimeException("Unknown CpuType: " + cpuVendor); } }</code><technical_language>left on, nested/unsafe interrupts require =1</technical_language>

Target:
private static String getIommu(CpuVendor cpuVendor, boolean iommu) { if (!iommu) { return ""; } switch (cpuVendor) { case AMD: return "amd_iommu=on "; case INTEL: return "intel_iommu=on "; case IBM: return ""; default: throw new RuntimeException("Unknown CpuType: " + cpuVendor); } }
Source:
<code>public void action() throws Exception { <START> log("Create an remove an empty local node source with time slot policy"); <END> createEmptyNodeSource(EMPTY_NODE_SOURCE_NAME); removeNodeSource(EMPTY_NODE_SOURCE_NAME); log("Create a local node source with " + NODES_NUMBER + " nodes with time slot policy"); createDefaultNodeSource(NODE_SOURCE_NAME); log("Waiting for the time slot policy to remove the nodes"); repeater.accept(NODES_NUMBER, () -> this.rmHelper.waitForAnyNodeEvent(RMEventType.NODE_REMOVED)); log("Waiting for the time slot policy to add the nodes again"); RMTHelper.waitForNodesToBeUp(NODES_NUMBER, this.monitorsHandler); log("Waiting for the time slot policy to remove the nodes again"); repeater.accept(NODES_NUMBER, () -> this.rmHelper.waitForAnyNodeEvent(RMEventType.NODE_REMOVED)); removeNodeSource(NODE_SOURCE_NAME); }</code><technical_language>"Create remove empty local node" sense</technical_language>

Target:
public void action() throws Exception { log("Create then remove an empty local node source with time slot policy"); createEmptyNodeSource(EMPTY_NODE_SOURCE_NAME); removeNodeSource(EMPTY_NODE_SOURCE_NAME); log("Create a local node source with " + NODES_NUMBER + " nodes with time slot policy"); createDefaultNodeSource(NODE_SOURCE_NAME); log("Waiting for the time slot policy to remove the nodes"); repeater.accept(NODES_NUMBER, () -> this.rmHelper.waitForAnyNodeEvent(RMEventType.NODE_REMOVED)); log("Waiting for the time slot policy to add the nodes again"); RMTHelper.waitForNodesToBeUp(NODES_NUMBER, this.monitorsHandler); log("Waiting for the time slot policy to remove the nodes again"); repeater.accept(NODES_NUMBER, () -> this.rmHelper.waitForAnyNodeEvent(RMEventType.NODE_REMOVED)); removeNodeSource(NODE_SOURCE_NAME); }
Source:
<code>public void handleSend(@Nullable Resp response, @Nullable Throwable error, Span span) { HttpServerResponse serverResponse; if (response == null || response instanceof HttpServerResponse) { serverResponse = (HttpServerResponse) response; <START> } else { <END> serverResponse = new HttpServerResponse.FromHttpAdapter<>(adapter, response); } handleFinish(serverResponse, error, span); }</code><technical_language>this check</technical_language>

Target:
public void handleSend(@Nullable Resp response, @Nullable Throwable error, Span span) { HttpServerResponse serverResponse; if (response == null || response instanceof HttpServerResponse) { serverResponse = (HttpServerResponse) response; } else { serverResponse = new FromResponseAdapter<>(adapter, response); } handleFinish(serverResponse, error, span); }
Source:
<code>public void prepareEnvironment(ITestContext context) throws Exception { <START> System.setProperty("java.security.auth.login.config", "./kafka_server_jaas.conf"); <END> try { for (ITestNGMethod method : context.getAllTestMethods()) { method.setRetryAnalyzer(new Retry()); } for (Starter<?> starter : STARTERS.values()) { starter.start(); } this.zookeeper = startZookeeperClient(); CuratorFramework kafkaZookeeper = startKafkaZookeeperClient(); SharedServices.initialize(STARTERS, zookeeper, kafkaZookeeper); logger.info("Environment was prepared"); } catch (Exception e) { logger.error("Exception during environment preparation", e); } }</code><technical_language>This property is related kafka, I move KafkaStarter</technical_language>

Target:
public void prepareEnvironment(ITestContext context) throws Exception { try { for (ITestNGMethod method : context.getAllTestMethods()) { method.setRetryAnalyzer(new Retry()); } for (Starter<?> starter : STARTERS.values()) { starter.start(); } this.zookeeper = startZookeeperClient(); CuratorFramework kafkaZookeeper = startKafkaZookeeperClient(); SharedServices.initialize(STARTERS, zookeeper, kafkaZookeeper); logger.info("Environment was prepared"); } catch (Exception e) { logger.error("Exception during environment preparation", e); } }
Source:
<code>public static long requireNonNegative( long value ) { if ( value < 0 ) { <START> throw new IllegalArgumentException( "Expected non-negative integer value, got " + value ); <END> } return value; }</code><technical_language>messages claims integers expected while checking longs actually; some rewording nice</technical_language>

Target:
public static long requireNonNegative( long value ) { if ( value < 0 ) { throw new IllegalArgumentException( "Expected non-negative long value, got " + value ); } return value; }
Source:
<code>protected static void validateImageUuid(String image) { DockerImage dockerImage = DockerImage.parse(image); if (dockerImage == null) { return; } String server = dockerImage.getServer(); List<String> whitelistRegistries = WHITELIST_REGISTRIES.get(); String defaultRegistry = DEFAULT_REGISTRY.get(); String userProvidedRegistry = dockerImage.getServer(); <START> if (!image.contains(server)) { <END> if(!StringUtils.isBlank(defaultRegistry)) { userProvidedRegistry = defaultRegistry; } } if (whitelistRegistries.size() > 0) { if (!StringUtils.isEmpty(userProvidedRegistry) && !StringUtils.isBlank(userProvidedRegistry)) { if (!whitelistRegistries.contains(userProvidedRegistry)) { throw new ValidationErrorException(ValidationErrorCodes.INVALID_OPTION, InstanceConstants.FIELD_IMAGE_UUID); } } else { if (!StringUtils.isEmpty(defaultRegistry) && !StringUtils.isBlank(defaultRegistry)) { if (!whitelistRegistries.contains(defaultRegistry)) { throw new ValidationErrorException(ValidationErrorCodes.INVALID_OPTION, InstanceConstants.FIELD_IMAGE_UUID); } } } } }</code><technical_language>change startsWith contains</technical_language>

Target:
protected static void validateImageUuid(String image) { DockerImage dockerImage = DockerImage.parse(image); if (dockerImage == null) { return; } String registry = dockerImage.getServer(); List<String> whitelistRegistries = WHITELIST_REGISTRIES.get(); String defaultRegistry = DEFAULT_REGISTRY.get(); String userProvidedRegistry = dockerImage.getServer(); if (!image.contains(registry)) { if(!StringUtils.isBlank(defaultRegistry)) { userProvidedRegistry = defaultRegistry; } } if (whitelistRegistries.size() > 0) { if (!StringUtils.isEmpty(userProvidedRegistry) && !StringUtils.isBlank(userProvidedRegistry)) { if (!whitelistRegistries.contains(userProvidedRegistry)) { throw new ValidationErrorException(ValidationErrorCodes.INVALID_OPTION, InstanceConstants.FIELD_IMAGE_UUID); } } else { if (!StringUtils.isEmpty(defaultRegistry) && !StringUtils.isBlank(defaultRegistry)) { if (!whitelistRegistries.contains(defaultRegistry)) { throw new ValidationErrorException(ValidationErrorCodes.INVALID_OPTION, InstanceConstants.FIELD_IMAGE_UUID); } } } } }
Source:
<code>private boolean isFromExcludedPackage(String candidateClassName) { String classNameWithPackage = candidateClassName; if (!candidateClassName.contains(DOT)) { classNameWithPackage = parentContext .getClassNameWithPackage(candidateClassName) .orElse(null); } if (classNameWithPackage == null) { return false; } else { return excludedPackages.stream().anyMatch(classNameWithPackage::startsWith); <START> } <END> }</code><technical_language>do single return methods</technical_language>

Target:
private boolean isFromExcludedPackage(String candidateClassName) { String classNameWithPackage = candidateClassName; if (!candidateClassName.contains(DOT)) { classNameWithPackage = parentContext.getClassNameWithPackage(candidateClassName) .orElse(""); } boolean isFromExcludedPackage = false; if (classNameWithPackage.contains(DOT)) { final int lastDotIndex = classNameWithPackage.lastIndexOf(DOT); final String packageName = classNameWithPackage.substring(0, lastDotIndex); isFromExcludedPackage = packageName.startsWith("java.lang") || excludedPackages.contains(packageName); } return isFromExcludedPackage; }
Source:
<code>public void testCall() { String change_id = null; String commit_id = null; try { GitAccess gAccess = new GitAccess(); Git git = gAccess.getGitProject(); gAccess.addFile("EGerritTestReviewFile.java", "Hello reviewers community !\n This is the second line \n"); gAccess.pushFile(); change_id = gAccess.getChangeId(); commit_id = gAccess.getCommitId(); } catch (Exception e1) { e1.printStackTrace(); } CreateDraftCommand command = fGerrit.createDraftComments(change_id, commit_id); CommentInfo commentInfo = new CommentInfo(); commentInfo.setLine(2); commentInfo.setMessage("This is a test comment"); commentInfo.setPath("EGerritTestReviewFile.java"); command.setCommentInfo(commentInfo); <START> command.requiresAuthentication(true); <END> CommentInfo result = null; try { result = command.call(); } catch (EGerritException e) { fail(e.getMessage()); } SetReviewCommand command2 = fGerrit.setReview(change_id, commit_id); ReviewInput reviewInput = new ReviewInput(); reviewInput.setMessage("This review is NOW ready to go ..."); Map obj = new HashMap(); obj.put("Code-Review", "2"); reviewInput.setLabels(obj); command2.setReviewInput(reviewInput); command2.requiresAuthentication(true); ReviewInfo result2 = null; try { result2 = command2.call(); } catch (EGerritException e) { fail(e.getMessage()); } System.out.println(result2); assertEquals(result2.getLabels(), reviewInput.getLabels()); }</code><technical_language>do set true for requiresAuthentication is set create class</technical_language>

Target:
public void testCall() { String change_id = null; String commit_id = null; try { GitAccess gAccess = new GitAccess(); Git git = gAccess.getGitProject(); gAccess.addFile("EGerritTestReviewFile.java", "Hello reviewers community !\n This is the second line \n"); gAccess.pushFile(); change_id = gAccess.getChangeId(); commit_id = gAccess.getCommitId(); } catch (Exception e1) { fail(e1.getMessage()); } CreateDraftCommand command = fGerrit.createDraftComments(change_id, commit_id); CommentInfo commentInfo = new CommentInfo(); commentInfo.setLine(2); commentInfo.setMessage("This is a test comment"); commentInfo.setPath("EGerritTestReviewFile.java"); command.setCommentInfo(commentInfo); CommentInfo result = null; try { result = command.call(); } catch (EGerritException e) { fail(e.getMessage()); } SetReviewCommand command2 = fGerrit.setReview(change_id, commit_id); ReviewInput reviewInput = new ReviewInput(); reviewInput.setMessage("This review is NOW ready to go ..."); Map obj = new HashMap(); obj.put("Code-Review", "2"); reviewInput.setLabels(obj); command2.setReviewInput(reviewInput); ReviewInfo result2 = null; try { result2 = command2.call(); } catch (EGerritException e) { fail(e.getMessage()); } assertEquals(result2.getLabels(), reviewInput.getLabels()); }
Source:
<code>public void traceOpened(@Nullable TmfTraceOpenedSignal signal) { LatencyAnalysis analysis = LatencyViewerUtils.getAnalysisFromSignal(signal); if (analysis != null) { <START> analysis.addListener(fListener); <END> LatencyViewerUtils.runAnalysis(); } }</code><technical_language>a listener twice, traceSelected traceOpened</technical_language>

Target:
public void traceOpened(@Nullable TmfTraceOpenedSignal signal) { LatencyAnalysis analysis = LatencyViewerUtils.getAnalysisFromSignal(signal); if (analysis != null) { LatencyViewerUtils.runAnalysis(fListener); } }