auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_START_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); StartErrorEvent emptySubprocess = getStartNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, getStartEventType()); assertGeneralSet(emptySubprocess.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); <START> assertErrorEventExecutionSet(emptySubprocess.getExecutionSet(), EMPTY_VALUE, NON_INTERRUPTING, ""); <END> assertDataIOSet(emptySubprocess.getDataIOSet(), EMPTY_VALUE); }</code><technical_language>suggestion assertErrorEventExecutionSet(emptySubprocess.getExecutionSet(), EMPTY_VALUE, NON_INTERRUPTING, EMPTY_VALUE);</technical_language>

Target:
public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_START_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); StartErrorEvent emptySubprocess = getStartNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, getStartEventType()); assertGeneralSet(emptySubprocess.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertErrorEventExecutionSet(emptySubprocess.getExecutionSet(), EMPTY_VALUE, NON_INTERRUPTING, EMPTY_VALUE); assertDataIOSet(emptySubprocess.getDataIOSet(), EMPTY_VALUE); }
Source:
<code>public void runAtDriver(RuntimeContainer container) { String mlcpCommand = prepareMlcpCommand(); LOGGER.debug(MESSAGES.getMessage("messages.debug.command", mlcpCommand)); LOGGER.info(MESSAGES.getMessage("messages.info.startBulkLoad")); try { Process mlcpProcess = CommandExecutor.executeCommand(mlcpCommand); mlcpProcess.waitFor(); try (InputStream normalInput = mlcpProcess.getInputStream(); BufferedReader reader = new BufferedReader(new java.io.InputStreamReader(normalInput)); InputStream errorInput = mlcpProcess.getErrorStream(); BufferedReader errorReader = new BufferedReader(new java.io.InputStreamReader(errorInput))) { <START> while (reader.ready()) { <END> System.out.println(reader.readLine()); } while (errorReader.ready()) { System.err.println(errorReader.readLine()); } LOGGER.info(MESSAGES.getMessage("messages.info.finishBulkLoad")); } catch (IOException e) { LOGGER.error(MESSAGES.getMessage("messages.error.ioexception", e.getMessage())); throw new ComponentException(e); } } catch (Exception e) { LOGGER.error(MESSAGES.getMessage("messages.error.exception", e.getMessage())); throw new ComponentException(e); } }</code><technical_language>I split 2 parallel Threads speed job execution</technical_language>

Target:
public void runAtDriver(RuntimeContainer container) { String mlcpCommand = prepareMlcpCommand(); LOGGER.debug(MESSAGES.getMessage("messages.debug.command", mlcpCommand)); LOGGER.info(MESSAGES.getMessage("messages.info.startBulkLoad")); try { Process mlcpProcess = CommandExecutor.executeCommand(mlcpCommand); try (InputStream normalInput = mlcpProcess.getInputStream(); InputStream errorInput = mlcpProcess.getErrorStream()) { Thread normalInputReadProcess = new Thread() { public void run() { try(BufferedReader reader = new BufferedReader(new InputStreamReader(normalInput))) { String line; while((line = reader.readLine()) != null) { System.out.println(line); } } catch(IOException ioe) { LOGGER.error(MESSAGES.getMessage("messages.error.ioexception", ioe.getMessage())); ioe.printStackTrace(); } } }; normalInputReadProcess.start(); Thread errorInputReadProcess = new Thread() { public void run() { try(BufferedReader reader = new BufferedReader(new InputStreamReader(errorInput))) { String line; while((line = reader.readLine()) != null) { System.err.println(line); } } catch(IOException ioe) { LOGGER.error(MESSAGES.getMessage("messages.error.ioexception", ioe.getMessage())); ioe.printStackTrace(); } } }; errorInputReadProcess.start(); mlcpProcess.waitFor(); normalInputReadProcess.interrupt(); errorInputReadProcess.interrupt(); LOGGER.info(MESSAGES.getMessage("messages.info.finishBulkLoad")); } } catch (Exception e) { LOGGER.error(MESSAGES.getMessage("messages.error.exception", e.getMessage())); throw new ComponentException(e); } }
Source:
<code>private Metric predictAnomalies(Map<Long, Double> metricData) { Metric predictions = new Metric(getResultScopeName(), getResultMetricName()); Map<Long, Double> predictionDatapoints = new HashMap<>(); for (Map.Entry<Long, Double> entry : metricData.entrySet()) { Long timestamp = entry.getKey(); double value = entry.getValue(); try { double anomalyScore = calculateAnomalyScore(value); predictionDatapoints.put(timestamp, anomalyScore); } catch (ArithmeticException e) { continue; } } <START> predictions.setDatapoints(new HashMap<>(predictionDatapoints)); <END> return predictions; }</code><technical_language>is this addition for? -- I reconstructions of HashMaps this PR</technical_language>

Target:
private Metric predictAnomalies(Map<Long, Double> metricData) { Metric predictions = new Metric(getResultScopeName(), getResultMetricName()); Map<Long, Number> predictionDatapoints = new HashMap<>(); for (Map.Entry<Long, Double> entry : metricData.entrySet()) { Long timestamp = entry.getKey(); double value = entry.getValue(); try { double anomalyScore = calculateAnomalyScore(value); predictionDatapoints.put(timestamp, anomalyScore); } catch (ArithmeticException e) { continue; } } predictions.setDatapoints(predictionDatapoints); return predictions; }
Source:
<code>public void generate(final Ds3ApiSpec spec, final FileUtils fileUtils, final Path destDir) throws IOException { this.fileUtils = fileUtils; try { final ImmutableList<Enum> allEnums = getAllEnums(spec); <START> final Set<String> enumNames = allEnums.stream().map(Enum::getName).collect(Collectors.toSet()); <END> final ImmutableList<Struct> allStructs = getStructsOrderedList(spec, enumNames); final ImmutableList<Request> allRequests = getAllRequests(spec); generateHeader(allEnums, allStructs, allRequests); generateSource(allEnums, allStructs, allRequests); } catch (final ParseException e) { LOG.error("Caught exception: ", e); } }</code><technical_language>Is a reason a Set instead of ImmutableSet</technical_language>

Target:
public void generate(final Ds3ApiSpec spec, final FileUtils fileUtils, final Path destDir) throws IOException { this.fileUtils = fileUtils; try { final ImmutableList<Enum> allEnums = getAllEnums(spec); final ImmutableSet<String> enumNames = ImmutableSet.copyOf(allEnums.stream().map(Enum::getName).collect(Collectors.toSet())); final ImmutableList<Struct> allStructs = getStructsOrderedList(spec, enumNames); final ImmutableList<Request> allRequests = getAllRequests(spec); generateHeader(allEnums, allStructs, allRequests); generateSource(allEnums, allStructs, allRequests); } catch (final ParseException e) { LOG.error("Caught exception: ", e); } }
Source:
<code>public void spec306_afterSubscriptionIsCancelledRequestMustBeNops_shouldFailBy_unexpectedElement() throws Throwable { requireTestFailure(new ThrowingRunnable() { @Override public void run() throws Throwable { demandIgnoringSynchronousPublisherVerification().spec306_afterSubscriptionIsCancelledRequestMustBeNops(); } <START> }, "Did not expect an element but got 0"); <END> }</code><technical_language>0</technical_language>

Target:
public void spec306_afterSubscriptionIsCancelledRequestMustBeNops_shouldFailBy_unexpectedElement() throws Throwable { requireTestFailure(new ThrowingRunnable() { @Override public void run() throws Throwable { demandIgnoringSynchronousPublisherVerification().spec306_afterSubscriptionIsCancelledRequestMustBeNops(); } }, "Did not expect an element but got element [0]"); }
Source:
<code>public void describe(SensorDescriptor descriptor) { <START> descriptor.name("php.ini analyzer"); <END> }</code><technical_language>@pynicolas Analyzer for "php.ini" files? (IMHO name starting capital letter)</technical_language>

Target:
public void describe(SensorDescriptor descriptor) { descriptor.name("Analyzer for \"php.ini\" files"); }
Source:
<code>public void testGetLastMajorVersion() throws OperationException { <START> <END> createDocumentVersions(docWithMajorVersions, VersioningOption.MAJOR, 3); DocumentModel lastVersion = runOperation(docWithMajorVersions); assertNotNull(lastVersion); assertEquals("3", lastVersion.getPropertyValue("dc:description")); assertEquals("3.0", lastVersion.getVersionLabel()); }</code><technical_language>need a blank lines in beginning end of method bodies</technical_language>

Target:
public void testGetLastMajorVersion() throws OperationException { doc = session.createDocumentModel("/Folder", "DocWithMajorVersions", "File"); doc.setPropertyValue("dc:title", "DocWithMajorVersions"); doc = session.createDocument(doc); session.save(); doc = session.getDocument(doc.getRef()); doc = createDocumentVersions(doc, VersioningOption.MAJOR, 3); DocumentModel lastVersion = runOperation(doc); assertNotNull(lastVersion); assertEquals("3", lastVersion.getPropertyValue("dc:description")); assertEquals("3.0", lastVersion.getVersionLabel()); }
Source:
<code>private void handleMultipleConcurrentAgents(VDSStatus lastStatus, VDSReturnValue vdsReturnValue) { final CountDownLatch latch = (getParameters().getAction() == FenceActionType.Stop) ? new CountDownLatch(2) : (getParameters().getAction() == FenceActionType.Start) ? new CountDownLatch(1) : new CountDownLatch(0); if (primaryExecutor.FindVdsToFence()) { ThreadPoolUtil.execute(new Runnable() { @Override public void run() { runThread(latch, primaryReturnValue, primaryExecutor, FenceAgentOrder.Primary, primarySucceeded); } }); ThreadPoolUtil.execute(new Runnable() { @Override public void run() { <START> runThread(latch, secondaryReturnValue, secondaryExecutor, FenceAgentOrder.Secondary, secondarySucceeded); <END> } }); try { latch.await(); } catch (InterruptedException e) { log.error(e); } switch (getParameters().getAction()) { case Start : if (primarySucceeded || secondarySucceeded){ handleSpecificCommandActions(); setFencingSucceeded(true); } else { handleError(lastStatus, primaryReturnValue); handleError(lastStatus, secondaryReturnValue); } break; case Stop: if (primarySucceeded && secondarySucceeded){ handleSpecificCommandActions(); setFencingSucceeded(true); } else { handleError(lastStatus, (!primarySucceeded) ? primaryReturnValue : secondaryReturnValue); } break; default: setFencingSucceeded(true); break; } } }</code><technical_language>Eli, missed - runThread - parameter is set result of executor.Fence - is returned rest of flow? succeeded. This handled differently</technical_language>

Target:
private void handleMultipleConcurrentAgents(VDSStatus lastStatus, VDSReturnValue vdsReturnValue) { final CountDownLatch latch = (getParameters().getAction() == FenceActionType.Stop) ? new CountDownLatch(2) : (getParameters().getAction() == FenceActionType.Start) ? new CountDownLatch(1) : new CountDownLatch(0); if (primaryExecutor.FindVdsToFence()) { ThreadPoolUtil.execute(new Runnable() { @Override public void run() { primaryResult = runThread(latch, primaryExecutor, FenceAgentOrder.Primary); } }); ThreadPoolUtil.execute(new Runnable() { @Override public void run() { secondaryResult = runThread(latch, secondaryExecutor, FenceAgentOrder.Secondary); } }); try { latch.await(); } catch (InterruptedException e) { log.error(e); } switch (getParameters().getAction()) { case Start : if (primaryResult.isSucceeded() || secondaryResult.isSucceeded()){ handleSpecificCommandActions(); setFencingSucceeded(true); } else { handleError(lastStatus, primaryResult.getValue()); handleError(lastStatus, secondaryResult.getValue()); } break; case Stop: if (primaryResult.isSucceeded() && secondaryResult.isSucceeded()){ handleSpecificCommandActions(); setFencingSucceeded(true); } else { handleError(lastStatus, (!primaryResult.isSucceeded() ) ? primaryResult.getValue() : secondaryResult.getValue()); } break; default: setFencingSucceeded(true); break; } } }
Source:
<code><START> public Boolean isFileTypeValid() { <END> return getComponentModel().validFileType; }</code><technical_language>This boolean now. Boolean imply null</technical_language>

Target:
public boolean isFileTypeValid() { return getComponentModel().validFileType; }
Source:
<code>public void registerAdditionalCatalog(Statistic stat) { <START> this.statisticMappings.put(stat.getId(), stat); <END> }</code><technical_language>This check id is registered id lowercased</technical_language>

Target:
public void registerAdditionalCatalog(Statistic stat) { checkNotNull(stat, "null statistic"); this.statisticMappings.put(stat.getId().toLowerCase(Locale.ENGLISH), stat); }
Source:
<code><START> public void setRowGroupSizeThreshold(long rowGroupSizeThreshold) { <END> this.rowGroupSizeThreshold = rowGroupSizeThreshold; }</code><technical_language>this need public either</technical_language>

Target:
void setRowGroupSizeThreshold(long rowGroupSizeThreshold) { this.rowGroupSizeThreshold = rowGroupSizeThreshold; }
Source:
<code>public ServerRespondingWithRetryableException(String msg, Throwable throwable) { super(ADALError.SERVER_RESPONDING_WITH_RETRYABLE_ERROR, msg, throwable); <START> } <END></code><technical_language>> [](start = 5, length = 4) > trailing space</technical_language>

Target:
public ServerRespondingWithRetryableException(String msg, Throwable throwable) { super(null, msg, throwable); }
Source:
<code>public InMemoryConnectionStore(final int capacity, final long threshold, final SessionCache sessionCache) { connections = new LeastRecentlyUsedCache<>(capacity, threshold); connections.setEvictingOnReadAccess(false); connections.setUpdatingOnReadAccess(false); connectionsByEstablishedSession = new HashMap<>(); this.sessionCache = sessionCache; if (sessionCache != null) { connections.addEvictionListener(new LeastRecentlyUsedCache.EvictionListener<Connection>() { @Override public void onEviction(Connection staleConnection) { Handshaker handshaker = staleConnection.getOngoingHandshake(); if (handshaker != null) { handshaker.handshakeFailed(new Exception("Connection evicted from store")); <START> } <END> removeFromEstablishedSessions(staleConnection); removeSessionFromCache(staleConnection); } }); if (sessionCache instanceof ClientSessionCache) { ClientSessionCache clientCache = (ClientSessionCache) sessionCache; LOG.debug("resume client sessions {}", clientCache); for (InetSocketAddress peer : clientCache) { SessionTicket ticket = clientCache.getSessionTicket(peer); SessionId id = clientCache.getSessionIdentity(peer); if (ticket != null && id != null) { Connection connection = new Connection(ticket, id); connection.setResumptionRequired(true); connections.put(peer, connection); LOG.debug("resume {}", peer, id); } } } } LOG.info("Created new InMemoryConnectionStore [capacity: {}, connection expiration threshold: {}s]", capacity, threshold); }</code><technical_language>this change integrated in 2.0.x ? (I if integrate this PR?)</technical_language>

Target:
public InMemoryConnectionStore(final int capacity, final long threshold, final SessionCache sessionCache) { connections = new LeastRecentlyUsedCache<>(capacity, threshold); connections.setEvictingOnReadAccess(false); connections.setUpdatingOnReadAccess(false); connectionsByEstablishedSession = new HashMap<>(); this.sessionCache = sessionCache; if (sessionCache != null) { connections.addEvictionListener(new LeastRecentlyUsedCache.EvictionListener<Connection>() { @Override public void onEviction(Connection staleConnection) { removeFromEstablishedSessions(staleConnection); removeSessionFromCache(staleConnection); } }); if (sessionCache instanceof ClientSessionCache) { ClientSessionCache clientCache = (ClientSessionCache) sessionCache; LOG.debug("resume client sessions {}", clientCache); for (InetSocketAddress peer : clientCache) { SessionTicket ticket = clientCache.getSessionTicket(peer); SessionId id = clientCache.getSessionIdentity(peer); if (ticket != null && id != null) { Connection connection = new Connection(ticket, id); connection.setResumptionRequired(true); connections.put(peer, connection); LOG.debug("resume {}", peer, id); } } } } LOG.info("Created new InMemoryConnectionStore [capacity: {}, connection expiration threshold: {}s]", capacity, threshold); }
Source:
<code>public Session<F> getSession() { if (this.activeTemplateCallbacks.get() > 0) { <START> return this.contextSessions.get(); <END> } else { return this.sessionFactory.getSession(); } }</code><technical_language>Need check for null</technical_language>

Target:
public Session<F> getSession() { if (this.activeTemplateCallbacks.get() > 0) { Session<F> session = this.contextSessions.get(); if (session != null) { return session; } } return this.sessionFactory.getSession(); }
Source:
<code>public List<String> argumentTypeNames() { if (fArgumentTypeNames != null) { return fArgumentTypeNames; } List<String> argumentTypeSignatures = argumentTypeSignatures(); List<String> result = new ArrayList<>(); for (String <START> string : <END> argumentTypeSignatures) { result.add(TypeImpl.signatureToName(string)); } fArgumentTypeNames = result; return fArgumentTypeNames; }</code><technical_language>rename signature</technical_language>

Target:
public List<String> argumentTypeNames() { if (fArgumentTypeNames != null) { return fArgumentTypeNames; } List<String> result = new ArrayList<>(); for (String signature : argumentTypeSignatures()) { result.add(TypeImpl.signatureToName(signature)); } fArgumentTypeNames = result; return fArgumentTypeNames; }
Source:
<code>private void addRelatedMessageLink(MessageDto message, MessageDto messageResource) { <START> if (message.getRelatedMessageId() != 0) <END> { messageResource.add(getAnonymousMessageLinkBuilder(goalIdMapping.getUserId(), message.getRelatedMessageId()) .withRel("related")); } }</code><technical_language>Optional<Long> instead of long, repliedMessageId below</technical_language>

Target:
private void addRelatedMessageLink(MessageDto message, MessageDto messageResource) { message.getRelatedMessageId().ifPresent(rid -> messageResource .add(getAnonymousMessageLinkBuilder(goalIdMapping.getUserId(), rid).withRel("related"))); }
Source:
<code>private void writeVariants(JavaRDD<VariantContext> variants) { final List<VariantContext> collectedVariants = variants.collect(); <START> final List<VariantContext> sortedVariants = collectedVariants.stream().sorted((o1, o2) -> IntervalUtils.compareLocatables(o1, o2, getReferenceSequenceDictionary())).collect(Collectors.toList()); <END> final HaplotypeCallerEngine hcEngine = new HaplotypeCallerEngine(hcArgs, getHeaderForReads(), new ReferenceMultiSourceToReferenceSequenceFileAdaptor(getReference(), getAuthHolder())); try(final VariantContextWriter writer = hcEngine.makeVCFWriter(output, this.getBestAvailableSequenceDictionary())) { hcEngine.writeHeader(writer); sortedVariants.forEach(writer::add); } }</code><technical_language>call getReferenceSequenceDictionary() is done a lot of times. call reuse? Wont save (collect dominates, for sure) a simple change</technical_language>

Target:
private void writeVariants(JavaRDD<VariantContext> variants) { final List<VariantContext> collectedVariants = variants.collect(); final SAMSequenceDictionary referenceDictionary = getReferenceSequenceDictionary(); final List<VariantContext> sortedVariants = collectedVariants.stream() .sorted((o1, o2) -> IntervalUtils.compareLocatables(o1, o2, referenceDictionary)) .collect(Collectors.toList()); final HaplotypeCallerEngine hcEngine = new HaplotypeCallerEngine(hcArgs, getHeaderForReads(), new ReferenceMultiSourceAdapter(getReference(), getAuthHolder())); try(final VariantContextWriter writer = hcEngine.makeVCFWriter(output, this.getBestAvailableSequenceDictionary())) { hcEngine.writeHeader(writer, getHeaderForReads().getSequenceDictionary()); sortedVariants.forEach(writer::add); } }
Source:
<code>public void walkSiteMap(AbstractSiteMap sitemap, Consumer<SiteMapURL> action) throws UnknownFormatException, IOException { if (sitemap == null || action == null) { return; } if (sitemap.isIndex()) { final Collection<AbstractSiteMap> links = ((SiteMapIndex) sitemap).getSitemaps(); for (final AbstractSiteMap asm : links) { if (asm == null) { continue; } walkSiteMap(asm.getUrl(), action); } } else { final Collection<SiteMapURL> links = ((SiteMap) sitemap).getSiteMapUrls(); <START> for (final SiteMapURL url : links) { <END> if (url == null) { continue; } action.accept(url); } } }</code><technical_language>curious: write loop links.stream().filter(Objects::nonNull).forEach(action);</technical_language>

Target:
public void walkSiteMap(AbstractSiteMap sitemap, Consumer<SiteMapURL> action) throws UnknownFormatException, IOException { if (sitemap == null || action == null) { LOG.debug("Got null sitemap and/or action, stopping traversal"); return; } if (sitemap.isIndex()) { final Collection<AbstractSiteMap> links = ((SiteMapIndex) sitemap).getSitemaps(); for (final AbstractSiteMap asm : links) { if (asm == null) { continue; } walkSiteMap(asm.getUrl(), action); } } else { final Collection<SiteMapURL> links = ((SiteMap) sitemap).getSiteMapUrls(); for (final SiteMapURL url : links) { if (url == null) { continue; } action.accept(url); } } }
Source:
<code>protected void checkRyaInstanceExists(final Map<String, String> taskConfig) throws ConnectException { requireNonNull(taskConfig); final AccumuloRyaSinkConfig config = new AccumuloRyaSinkConfig(taskConfig); final Connector connector; try { final Instance instance = new ZooKeeperInstance(config.getClusterName(), config.getZookeepers()); connector = instance.getConnector(config.getUsername(), new PasswordToken( config.getPassword() )); <START> } catch (AccumuloException | AccumuloSecurityException e) { <END> throw new ConnectException("Could not create a Connector to the configured Accumulo instance.", e); } try { final AccumuloConnectionDetails connectionDetails = new AccumuloConnectionDetails( config.getUsername(), config.getPassword().toCharArray(), config.getClusterName(), config.getZookeepers()); final RyaClient client = AccumuloRyaClientFactory.build(connectionDetails, connector); if(!client.getInstanceExists().exists( config.getRyaInstanceName() )) { throw new ConnectException("The Rya Instance named " + config.getRyaInstanceName() + " has not been installed."); } } catch (final RyaClientException e) { throw new ConnectException("Unable to determine if the Rya Instance named " + config.getRyaInstanceName() + " has been installed.", e); } }</code><technical_language>final</technical_language>

Target:
protected void checkRyaInstanceExists(final Map<String, String> taskConfig) throws ConnectException { requireNonNull(taskConfig); final AccumuloRyaSinkConfig config = new AccumuloRyaSinkConfig(taskConfig); final Connector connector; try { final Instance instance = new ZooKeeperInstance(config.getClusterName(), config.getZookeepers()); connector = instance.getConnector(config.getUsername(), new PasswordToken( config.getPassword() )); } catch (final AccumuloException | AccumuloSecurityException e) { throw new ConnectException("Could not create a Connector to the configured Accumulo instance.", e); } try { final AccumuloConnectionDetails connectionDetails = new AccumuloConnectionDetails( config.getUsername(), config.getPassword().toCharArray(), config.getClusterName(), config.getZookeepers()); final RyaClient client = AccumuloRyaClientFactory.build(connectionDetails, connector); if(!client.getInstanceExists().exists( config.getRyaInstanceName() )) { throw new ConnectException("The Rya Instance named " + LogUtils.clean(config.getRyaInstanceName()) + " has not been installed."); } } catch (final RyaClientException e) { throw new ConnectException("Unable to determine if the Rya Instance named " + LogUtils.clean(config.getRyaInstanceName()) + " has been installed.", e); } }
Source:
<code>private void setUpApplicationFeedback() { Intent intent = Intents.Builder.with(getActivity()).buildFeedbackIntent(); if (intent.resolveActivity(getActivity().getPackageManager()) != null) { startActivity(intent); } else { <START> Toast.makeText(getActivity(), "NO Application Found", Toast.LENGTH_SHORT).show(); <END> } }</code><technical_language>Please declare message in Strings.xml xml resource here. This in translation process is done</technical_language>

Target:
private void setUpApplicationFeedback() { Intent intent = Intents.Builder.with(getActivity()).buildFeedbackIntent(); if (intent.resolveActivity(getActivity().getPackageManager()) != null) { startActivity(intent); } else { Toast.makeText(getActivity(), R.string.application_not_found, Toast.LENGTH_SHORT).show(); } }
Source:
<code>private void checkMethodAccessItem(final List<MethodAccessItem> methodAccessItemList, final List<MethodAccessItemDto> methodAccessItemDtoList) { assertEquals(methodAccessItemList.size(), methodAccessItemDtoList.size()); <START> for (final MethodAccessItemDto methodAccessItemDto : methodAccessItemDtoList) { <END> assertEquals(methodAccessItemDto.getAccessMode(), methodAccessItemDto.getAccessMode()); assertEquals(methodAccessItemDto.getMethodId(), methodAccessItemDto.getMethodId()); } }</code><technical_language>attribute access item check, this compares DTOs themselves, instead of objects methodAccessItemList</technical_language>

Target:
private void checkMethodAccessItem(final List<MethodAccessItem> methodAccessItemList, final List<MethodAccessItemDto> methodAccessItemDtoList) { assertEquals(methodAccessItemList.size(), methodAccessItemDtoList.size()); final Iterator<MethodAccessItem> methodAccessItemIterator = methodAccessItemList.iterator(); final Iterator<MethodAccessItemDto> methodAccessItemDtoIterator = methodAccessItemDtoList.iterator(); while (methodAccessItemIterator.hasNext() && methodAccessItemDtoIterator.hasNext()) { final MethodAccessItem methodAccessItem = methodAccessItemIterator.next(); final MethodAccessItemDto methodAccessItemDto = methodAccessItemDtoIterator.next(); assertEquals(methodAccessItem.getAccessMode().name(), methodAccessItemDto.getAccessMode().name()); assertEquals(methodAccessItem.getMethodId(), methodAccessItemDto.getMethodId()); } }
Source:
<code>public void setStatusAddsTransactionEvent() throws Exception { ChargeTransactionEntity chargeTransactionEntity = new ChargeTransactionEntity(); ChargeStatus expectedStatus = ChargeStatus.CREATED; <START> <END> chargeTransactionEntity.updateStatus(expectedStatus); List<TransactionEventEntity> transactionEvents = chargeTransactionEntity.getTransactionEvents(); assertThat(transactionEvents.size(), is(1)); assertThat(transactionEvents.get(0).getStatus(), is(expectedStatus)); }</code><technical_language>assertion transaction events is empty updating status</technical_language>

Target:
public void setStatusAddsTransactionEvent() throws Exception { ChargeTransactionEntity chargeTransactionEntity = new ChargeTransactionEntity(); ChargeStatus expectedStatus = ChargeStatus.CREATED; assertThat(chargeTransactionEntity.getTransactionEvents().size(), is(0)); chargeTransactionEntity.updateStatus(expectedStatus); List<TransactionEventEntity> transactionEvents = chargeTransactionEntity.getTransactionEvents(); assertThat(transactionEvents.size(), is(1)); assertThat(transactionEvents.get(0).getStatus(), is(expectedStatus)); }
Source:
<code>public static void showDialog(Context context) { AlertDialog.Builder dialog = new AlertDialog.Builder(context); dialog.setTitle(context.getString(R.string.pref_nav_drawer_feed_order_title)); dialog.setNegativeButton(android.R.string.cancel, (d, listener) -> d.dismiss()); int selectedIndexTemp = 0; int selected = UserPreferences.getFeedOrder(); String[] entryValues = context.getResources().getStringArray(R.array.nav_drawer_feed_order_values); for (int i = 0; i < entryValues.length; i++) { if (Integer.parseInt(entryValues[i]) == selected) { selectedIndexTemp = i; } <START> } <END> final int selectedIndex = selectedIndexTemp; String[] items = context.getResources().getStringArray(R.array.nav_drawer_feed_order_options); dialog.setSingleChoiceItems(items, selectedIndex, (d, which) -> { if (selectedIndex != which) { UserPreferences.setFeedOrder(entryValues[which]); EventBus.getDefault().post(new UnreadItemsUpdateEvent()); } d.dismiss(); }); dialog.show(); }</code><technical_language>this loop simplified ArrayList.indexOf</technical_language>

Target:
public static void showDialog(Context context) { AlertDialog.Builder dialog = new AlertDialog.Builder(context); dialog.setTitle(context.getString(R.string.pref_nav_drawer_feed_order_title)); dialog.setNegativeButton(android.R.string.cancel, (d, listener) -> d.dismiss()); int selected = UserPreferences.getFeedOrder(); List<String> entryValues = Arrays.asList(context.getResources().getStringArray(R.array.nav_drawer_feed_order_values)); final int selectedIndex = entryValues.indexOf("" + selected); String[] items = context.getResources().getStringArray(R.array.nav_drawer_feed_order_options); dialog.setSingleChoiceItems(items, selectedIndex, (d, which) -> { if (selectedIndex != which) { UserPreferences.setFeedOrder(entryValues.get(which)); EventBus.getDefault().post(new UnreadItemsUpdateEvent()); } d.dismiss(); }); dialog.show(); }
Source:
<code>private void loadResource(File resource) { if(!resource.canRead()) throw new RuntimeException("Cant open JNI file: "+resource.getAbsolutePath()); try { <START> System.out.println("Going to load " + resource + ". Hit return..."); <END> System.in.read(); } catch (IOException e) { e.printStackTrace(); } System.load(resource.getAbsolutePath()); try { System.out.println("Loaded successfully, hit return..."); System.in.read(); } catch (IOException e) { e.printStackTrace(); } }</code><technical_language>I wants System.out in productive code</technical_language>

Target:
private void loadResource(File resource) { if(!resource.canRead()) throw new RuntimeException("Cant open JNI file: "+resource.getAbsolutePath()); System.load(resource.getAbsolutePath()); }
Source:
<code>public void testConvertRegion() { DigitalOceanProviderMetadata metadata = new DigitalOceanProviderMetadata(); JustProvider locationsSupplier = new JustProvider(metadata.getId(), Suppliers.<URI> ofInstance(URI .create(metadata.getEndpoint())), ImmutableSet.<String> of()); <START> RegionToLocation function = new RegionToLocation(locationsSupplier); <END> Region region = new Region(1, "Region 1", "reg1"); Location expected = new LocationBuilder().id("reg1").description("1/Region 1") .parent(getOnlyElement(locationsSupplier.get())).scope(LocationScope.REGION).build(); assertEquals(function.apply(region), expected); }</code><technical_language>done in other tests...move function comparison</technical_language>

Target:
public void testConvertRegion() { DigitalOceanProviderMetadata metadata = new DigitalOceanProviderMetadata(); JustProvider locationsSupplier = new JustProvider(metadata.getId(), Suppliers.<URI> ofInstance(URI .create(metadata.getEndpoint())), ImmutableSet.<String> of()); Region region = new Region(1, "Region 1", "reg1"); Location expected = new LocationBuilder().id("reg1").description("1/Region 1") .parent(getOnlyElement(locationsSupplier.get())).scope(LocationScope.REGION).build(); RegionToLocation function = new RegionToLocation(locationsSupplier); assertEquals(function.apply(region), expected); }
Source:
<code>public void autonomousMain() throws AutonomousModeOverException, InterruptedException { try { if (!Elevator.atTopStatus.get()) { Elevator.setTop.event(); waitUntil(Elevator.atTopStatus); } try { boolean running = Rollers.running.get(); boolean direction = Rollers.direction.get(); boolean closed = Rollers.closed.get(); try { Rollers.direction.set(Rollers.REVERSE); Rollers.running.set(true); Rollers.closed.set(true); waitUntil(crateInPosition); waitForTime(timeout); } finally { Rollers.running.set(running); Rollers.direction.set(direction); Rollers.closed.set(closed); } } finally { <START> Elevator.setBottom.event(); <END> } waitUntil(Elevator.atBottomStatus); waitForTime(1000); } finally { running.set(false); } }</code><technical_language>If fix indentation here, remember spaces indent</technical_language>

Target:
public void autonomousMain() throws AutonomousModeOverException, InterruptedException { try { if (!Elevator.atTop.get()) { Elevator.setTop.event(); waitUntil(Elevator.atTop); } try { boolean running = Rollers.running.get(); boolean direction = Rollers.direction.get(); boolean closed = Rollers.closed.get(); try { Rollers.direction.set(Rollers.REVERSE); Rollers.running.set(true); Rollers.closed.set(true); waitUntil(crateInPosition); waitForTime(timeout); } finally { Rollers.running.set(running); Rollers.direction.set(direction); Rollers.closed.set(closed); } } finally { Elevator.setBottom.event(); } waitUntil(Elevator.atBottom); waitForTime(1000); } finally { running.set(false); } }
Source:
<code>public void shouldNotFindAbsentConfig() { List<Config> configList = Arrays.asList(new Config("foo", false, null, null, null, null, null, null, null, false, null, false, null)); <START> Configs configs = new Configs(); <END> configs.setConfigList(configList); configs.setDefaultConfig("foo"); configService.updateConfigs(configs); configService.getConfig("bar"); }</code><technical_language>Add Constructor parameters</technical_language>

Target:
public void shouldNotFindAbsentConfig() { List<Config> configList = Arrays.asList(new Config("foo", false, null, null, null, null, null, null, null, false, null, false, null)); Configs configs = new Configs(configList, "foo"); configService.updateConfigs(configs); configService.getConfig("bar"); }
Source:
<code>public Response authoriseSmartpayNotifications(String notification) { smartpayNotificationService.handleNotificationFor(notification); String response = "[accepted]"; <START> logger.info("Responding to notification from provider={} with 200 {}", "smartpay", response); <END> return Response.ok(response).build(); }</code><technical_language>Inlining smartpay simpler</technical_language>

Target:
public Response authoriseSmartpayNotifications(String notification) { smartpayNotificationService.handleNotificationFor(notification); String response = "[accepted]"; logger.info("Responding to notification from provider=smartpay with 200 {}", response); return Response.ok(response).build(); }
Source:
<code>public void executeHousekeepingInDB(final List<Long> jobIdList, final boolean shouldRemoveFromDb) { <START> List<List<Long>> jobIdSubSets = Lists.partition(jobIdList, 1000); <END> for (List<Long> jobIdSubList : jobIdSubSets) { executeReadWriteTransaction(new HousekeepingSessionWork(jobIdSubList, shouldRemoveFromDb)); } }</code><technical_language>is '1000' a configurable param, a varibale in class</technical_language>

Target:
public void executeHousekeepingInDB(final List<Long> jobIdList, final boolean shouldRemoveFromDb) { List<List<Long>> jobIdSubSets = Lists.partition(jobIdList, MAX_ITEMS_IN_LIST); for (List<Long> jobIdSubList : jobIdSubSets) { executeReadWriteTransaction(new HousekeepingSessionWork(jobIdSubList, shouldRemoveFromDb)); } }
Source:
<code>static ResultReturner forMethod(Class<?> extensionType, Method method) { <START> Type returnType = GenericTypeReflector.getReturnType(method, extensionType); <END> QualifiedType qualifiedReturnType = QualifiedType.of(returnType, getQualifiers(method)); Class<?> returnClass = getErasedType(returnType); if (Void.TYPE.equals(returnClass)) { return findConsumer(method) .orElseThrow(() -> new IllegalStateException(String.format( "Method %s#%s is annotated as if it should return a value, but the method is void.", method.getDeclaringClass().getName(), method.getName()))); } else if (ResultIterable.class.equals(returnClass)) { return new ResultIterableReturner(qualifiedReturnType); } else if (Stream.class.equals(returnClass)) { return new StreamReturner(qualifiedReturnType); } else if (ResultIterator.class.equals(returnClass)) { return new ResultIteratorReturner(qualifiedReturnType); } else if (Iterator.class.equals(returnClass)) { return new IteratorReturner(qualifiedReturnType); } else if (method.isAnnotationPresent(SingleValue.class)) { return new SingleValueReturner(qualifiedReturnType); } else { return new CollectedResultReturner(qualifiedReturnType); } }</code><technical_language>If this GenericTypes.resolveType() this is a breaking change</technical_language>

Target:
static ResultReturner forMethod(Class<?> extensionType, Method method) { Type returnType = GenericTypes.resolveType(method.getGenericReturnType(), extensionType); QualifiedType<?> qualifiedReturnType = QualifiedType.of(returnType).withAnnotations(getQualifiers(method)); Class<?> returnClass = getErasedType(returnType); if (Void.TYPE.equals(returnClass)) { return findConsumer(method) .orElseThrow(() -> new IllegalStateException(String.format( "Method %s#%s is annotated as if it should return a value, but the method is void.", method.getDeclaringClass().getName(), method.getName()))); } else if (ResultIterable.class.equals(returnClass)) { return new ResultIterableReturner(qualifiedReturnType); } else if (Stream.class.equals(returnClass)) { return new StreamReturner(qualifiedReturnType); } else if (ResultIterator.class.equals(returnClass)) { return new ResultIteratorReturner(qualifiedReturnType); } else if (Iterator.class.equals(returnClass)) { return new IteratorReturner(qualifiedReturnType); } else if (method.isAnnotationPresent(SingleValue.class)) { return new SingleValueReturner(qualifiedReturnType); } else { return new CollectedResultReturner(qualifiedReturnType); } }
Source:
<code>public static short getCompatibleResponseVersion(short requestVersion) { short responseVersion; switch (requestVersion) { case ReplicaMetadataRequest.Replica_Metadata_Request_Version_V1: <START> responseVersion = REPLICA_METADATA_RESPONSE_VERSION_V_5; <END> break; case ReplicaMetadataRequest.Replica_Metadata_Request_Version_V2: responseVersion = REPLICA_METADATA_RESPONSE_VERSION_V_6; break; default: throw new IllegalArgumentException("Invalid replica metadata response version."); } return responseVersion; }</code><technical_language>Minor: return this, need local var</technical_language>

Target:
public static short getCompatibleResponseVersion(short requestVersion) { switch (requestVersion) { case ReplicaMetadataRequest.Replica_Metadata_Request_Version_V1: return REPLICA_METADATA_RESPONSE_VERSION_V_5; case ReplicaMetadataRequest.Replica_Metadata_Request_Version_V2: return REPLICA_METADATA_RESPONSE_VERSION_V_6; default: throw new IllegalArgumentException("Invalid replica metadata request version: " + requestVersion + " No compatible replica metadata response version found"); } }
Source:
<code><START> public IStatus runInternal(final IProgressMonitor monitor) { <END> ResourceSet set = new ResourceSetImpl(); try { if (!resource.isLoaded()) return Status.CANCEL_STATUS; final Resource shadowResource = set.createResource(resource.getURI()); cloneResource(monitor, shadowResource); if (monitor.isCanceled()) return Status.CANCEL_STATUS; final List<Issue> issues = Lists.newArrayList(); try { issues.addAll(validator.validate(shadowResource, CheckMode.FAST_ONLY, new CancelIndicator() { public boolean isCanceled() { return monitor.isCanceled(); } })); } catch (Throwable ex) { return Status.CANCEL_STATUS; } validationIssueProcessor.processIssues(issues, monitor); } catch (Exception ex) { ex.printStackTrace(); return new Status(IStatus.ERROR, DiagramActivator.PLUGIN_ID, ex.getMessage()); } return Status.OK_STATUS; }</code><technical_language>avoid increasing visibility?</technical_language>

Target:
protected IStatus runInternal(final IProgressMonitor monitor) { ResourceSet set = new ResourceSetImpl(); try { if (!resource.isLoaded()) return Status.CANCEL_STATUS; final Resource shadowResource = set.createResource(resource.getURI()); cloneResource(monitor, shadowResource); if (monitor.isCanceled()) return Status.CANCEL_STATUS; final List<Issue> issues = Lists.newArrayList(); try { issues.addAll(validator.validate(shadowResource, CheckMode.FAST_ONLY, new CancelIndicator() { public boolean isCanceled() { return monitor.isCanceled(); } })); } catch (Throwable ex) { return Status.CANCEL_STATUS; } validationIssueProcessor.processIssues(issues, monitor); } catch (Exception ex) { ex.printStackTrace(); return new Status(IStatus.ERROR, DiagramActivator.PLUGIN_ID, ex.getMessage()); } return Status.OK_STATUS; }
Source:
<code>private void refreshTestData(int numStudents, int numQuestions) { if (testData.students.size() == 0) { addStudents(numStudents); } else if (testData.students.size() < numStudents) { addStudents(numStudents - testData.students.size()); } else if (testData.students.size() > numStudents) { decreaseNumOfStudents(numStudents); } if (testData.feedbackQuestions.size() == 0) { addQuestions(numQuestions); } else if (testData.feedbackQuestions.size() < numQuestions) { addQuestions(numQuestions - testData.feedbackQuestions.size()); } else if (testData.feedbackQuestions.size() > numQuestions) { decreaseNumOfQuestions(numQuestions); } updateFeedbackResponses(); <START> removeAndRestoreDataBundle(testData); <END> }</code><technical_language>If test is measuring scalability of read operations, persist data touch data needs change. means writing data part of test, a separate script is run manually need. For measuring scalability of write operations, need separate _primary_ objects write measured _supplementary_ objects simply need for write succeed. e.g. session object needs in datastore for operation of writing responses succeed. that, supplementary object written a script, similar case above</technical_language>

Target:
private void refreshTestData(int numStudents, int numQuestions) { if (testData.students.size() == 0) { addStudents(numStudents); } else if (testData.students.size() < numStudents) { addStudents(numStudents - testData.students.size()); } else if (testData.students.size() > numStudents) { decreaseNumOfStudents(numStudents); } if (testData.feedbackQuestions.size() == 0) { addQuestions(numQuestions); } else if (testData.feedbackQuestions.size() < numQuestions) { addQuestions(numQuestions - testData.feedbackQuestions.size()); } else if (testData.feedbackQuestions.size() > numQuestions) { decreaseNumOfQuestions(numQuestions); } updateFeedbackResponses(); }
Source:
<code>public static void cleanUp() throws IOException, OperationException { operations.removeIfExists(SERVER_ADDRESS); operations.removeIfExists(SERVER_TBR_ADDRESS); operations.removeIfExists(MAIL_SESSION_PRE_ADDRESS); operations.removeIfExists(MAIL_SESSION_TBR_ADDRESS); operations.removeIfExists(MAIL_SESSION_ADDRESS); operations.removeIfExists(MAIL_SESSION_INV_ADDRESS); <START> client.close(); <END> }</code><technical_language>close in finally previous operations throw exception</technical_language>

Target:
public static void cleanUp() throws IOException, OperationException { try { operations.removeIfExists(SERVER_ADDRESS); operations.removeIfExists(SERVER_TBR_ADDRESS); operations.removeIfExists(MAIL_SESSION_PRE_ADDRESS); operations.removeIfExists(MAIL_SESSION_TBR_ADDRESS); operations.removeIfExists(MAIL_SESSION_ADDRESS); operations.removeIfExists(MAIL_SESSION_INV_ADDRESS); } finally { client.close(); } }
Source:
<code>public boolean login() throws LoginException { Callback[] callbacks = configureCallbacks(); try { log.trace("Authenticating user; invoking JAAS login callbacks"); callbackHandler.handle(callbacks); } catch (Exception e) { log.trace("Authentication failed while invoking JAAS login callbacks"); throw new LoginException(e.getMessage()); } String username = ((NameCallback) callbacks[0]).getName(); char[] passwordChars = ((PasswordCallback) callbacks[1]).getPassword(); String password = passwordChars != null ? new String(passwordChars) : null; Properties credentialProperties = credentialPropertiesMap.get(fileName); if (credentialProperties.isEmpty()) { <START> log.trace("Not validating credentials for user '{}' as credential properties file '{}' is empty", <END> username, fileName); authenticated = true; } else if (password != null && password.equals(credentialProperties.get(username))) { log.trace("Credentials provided for user '{}' match those present in the credential properties file '{}'", username, fileName); authenticated = true; } else { log.trace("Credentials provided for user '{}' do not match those present in the credential properties file '{}'", username, fileName); authenticated = false; } return authenticated; }</code><technical_language>This log is a duplicate of in initialize. log this for login</technical_language>

Target:
public boolean login() throws LoginException { Callback[] callbacks = configureCallbacks(); try { log.trace("Authenticating user; invoking JAAS login callbacks"); callbackHandler.handle(callbacks); } catch (Exception e) { log.warn("Authentication failed while invoking JAAS login callbacks", e); throw new LoginException(e.getMessage()); } String username = ((NameCallback) callbacks[0]).getName(); char[] passwordChars = ((PasswordCallback) callbacks[1]).getPassword(); String password = passwordChars != null ? new String(passwordChars) : null; Properties credentialProperties = credentialPropertiesMap.get(fileName); if (credentialProperties.isEmpty()) { log.trace("Not validating credentials for user '{}' as credential properties file '{}' is empty", username, fileName); authenticated = true; } else if (username == null) { log.trace("No credentials were provided or the provided credentials were malformed"); authenticated = false; } else if (password != null && password.equals(credentialProperties.get(username))) { log.trace("Credentials provided for user '{}' match those present in the credential properties file '{}'", username, fileName); authenticated = true; } else if (!credentialProperties.containsKey(username)) { log.trace("User '{}' is not present in the credential properties file '{}'", username, fileName); authenticated = false; } else { log.trace("Credentials provided for user '{}' do not match those present in the credential properties file '{}'", username, fileName); authenticated = false; } return authenticated; }
Source:
<code>@Override protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { if (name.startsWith("org.kohsuke.groovy.sandbox.")) { return this.getClass().getClassLoader().loadClass(name); } else { ClassLoader parentLoader = getParent(); Class<?> c = load(parentClassCache, name, parentLoader, item -> { try { <START> return Optional.of(parentLoader.loadClass(item)); <END> } catch (ClassNotFoundException x) { return Optional.absent(); } }).orNull(); if (c != null) { if (resolve) { super.resolveClass(c); } return c; } else { throw new ClassNotFoundException(name) { @Override public synchronized Throwable fillInStackTrace() { return this; } }; } } }</code><technical_language>clear reading sources IDE handy item is here. Is a reason this stay name</technical_language>

Target:
@Override protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { if (name.startsWith("org.kohsuke.groovy.sandbox.")) { return this.getClass().getClassLoader().loadClass(name); } else { ClassLoader parentLoader = getParent(); Class<?> c = load(parentClassCache, name, parentLoader, () -> { try { return parentLoader.loadClass(name); } catch (ClassNotFoundException x) { return CLASS_NOT_FOUND; } }); if (c != CLASS_NOT_FOUND) { if (resolve) { super.resolveClass(c); } return c; } else { throw new ClassNotFoundException(name) { @Override public synchronized Throwable fillInStackTrace() { return this; } }; } } }
Source:
<code>public Object apply(IncomingMessageEnvelope ime) { Object samzaMsg; <START> if (ime.getMessage() instanceof KV) { <END> samzaMsg = ime.getMessage(); } else { samzaMsg = KV.of(ime.getKey(), ime.getMessage()); } if (samzaMsg == null) { return null; } SamzaSqlRelMsgMetadata metadata = new SamzaSqlRelMsgMetadata(Instant.ofEpochMilli(ime.getEventTime()).toString(), Instant.ofEpochMilli(ime.getArrivalTime()).toString(), null); samzaMsg = MessageAndMetadata.of(samzaMsg, metadata); return samzaMsg; }</code><technical_language>KV type is in High Level API transformer. essentially contains (ime.key(), ime.message()). remove this check completely. ime null</technical_language>

Target:
public Object apply(IncomingMessageEnvelope ime) { Assert.notNull(ime, "ime is null"); KV<Object, Object> keyAndMessageKV = KV.of(ime.getKey(), ime.getMessage()); SamzaSqlRelMsgMetadata metadata = new SamzaSqlRelMsgMetadata(Instant.ofEpochMilli(ime.getEventTime()).toString(), Instant.ofEpochMilli(ime.getArrivalTime()).toString(), null); SamzaSqlInputMessage samzaMsg = SamzaSqlInputMessage.of(keyAndMessageKV, metadata); return samzaMsg; }