auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected static void parseGene(String line, ArrayList<Gene> genes, Map<Integer, Gene> geneStart, Map<Integer, Gene> geneEnd, Map<String, Label> geneMap) { <START> String[] tokens = line.split(" "); <END> Gene gene = new Gene(tokens[1], Integer.parseInt(tokens[4]), Integer.parseInt(tokens[5])); genes.add(gene); geneMap.put(gene.getName(), new GeneLabel(gene.getName())); geneMap.put(PREFIX_GENE_START + gene.getName(), new StartGeneLabel(gene.getName(), gene.getStart())); geneMap.put(PREFIX_GENE_END + gene.getName(), new EndGeneLabel(gene.getName(), gene.getEnd())); geneStart.put(Integer.parseInt(tokens[4]), gene); geneEnd.put(Integer.parseInt(tokens[5]), gene); }</code><technical_language>u crazy</technical_language>

Target:
protected static void parseGene(String line, ArrayList<Gene> genes, Map<Integer, Gene> geneStart, Map<Integer, Gene> geneEnd, Map<String, Label> geneMap) { String[] tokens = line.split(TAB); if (GENE_TYPE.equals(tokens[GENE_TYPE_POSITION])) { String[] attributes = tokens[GENE_ATTRIBUTES_POSITION].split(GENE_ATTRIBUTE_DELIMITER); Gene gene = new Gene( attributes[GENE_ATTRIBUTE_DISPLAY_NAME_POSITION] .replace(GENE_DISPLAY_NAME_IDENTIFIER, ""), Integer.parseInt(tokens[GENE_REF_START_POSITION]), Integer.parseInt(tokens[GENE_REF_END_POSITION]) ); genes.add(gene); geneMap.put(gene.getName(), new GeneLabel(gene.getName())); geneMap.put(PREFIX_GENE_START + gene.getName(), new StartGeneLabel(gene.getName(), gene.getStart())); geneMap.put(PREFIX_GENE_END + gene.getName(), new EndGeneLabel(gene.getName(), gene.getEnd())); geneStart.put(Integer.parseInt(tokens[GENE_REF_START_POSITION]), gene); geneEnd.put(Integer.parseInt(tokens[GENE_REF_END_POSITION]), gene); } }
Source:
<code>protected DataStreamSink(DataStream<T> inputStream, StreamSink<T> operator) { this.transformation = new SinkTransformation<>( <START> inputStream.getTransformation(), "Unnamed", operator, inputStream.getExecutionEnvironment().getParallelism()); <END> }</code><technical_language>Unrelated changes, please revert pull a separate hotfix if deem necessary (I don't)</technical_language>

Target:
protected DataStreamSink(DataStream<T> inputStream, StreamSink<T> operator) { this.transformation = new SinkTransformation<T>(inputStream.getTransformation(), "Unnamed", operator, inputStream.getExecutionEnvironment().getParallelism()); }
Source:
<code><START> protected LoadingLookupFactory( <END> DataFetcher dataFetcher, LoadingCache<String, String> loadingCache, LoadingCache<String, List<String>> reverseLoadingCache, LoadingLookup loadingLookup ) { this.dataFetcher = dataFetcher; this.loadingCache = loadingCache; this.reverseLoadingCache = reverseLoadingCache; this.loadingLookup = loadingLookup; }</code><technical_language>call this other constructor</technical_language>

Target:
protected LoadingLookupFactory( DataFetcher dataFetcher, LoadingCache<String, String> loadingCache, LoadingCache<String, List<String>> reverseLoadingCache, LoadingLookup loadingLookup ) { this.dataFetcher = Preconditions.checkNotNull(dataFetcher); this.loadingCache = Preconditions.checkNotNull(loadingCache); this.reverseLoadingCache = Preconditions.checkNotNull(reverseLoadingCache); this.loadingLookup = loadingLookup; }
Source:
<code>private void checkVideoStatus(VideoBlockModel unit) { try { final DownloadEntry entry = unit.getDownloadEntry(environment.getStorage()); if ( entry == null ) return; if ( entry.isDownload() ){ if ( entry.isVideoForWebOnly ){ Toast.makeText(getActivity(), getString(R.string.video_only_on_web_short), Toast.LENGTH_SHORT).show(); return; } if(!entry.isDownloaded()){ IDialogCallback dialogCallback = new IDialogCallback() { @Override public void onPositiveClicked() { startOnlinePlay(entry); } @Override public void onNegativeClicked() { <START> ((CourseUnitNavigationActivity) getActivity()).showInfoMessage(getString(R.string.wifi_off_message)); <END> notifyAdapter(); } }; MediaConsentUtils.consentToMediaPlayback(getActivity(), dialogCallback, environment.getConfig()); }else{ if ( AppConstants.offline_flag ){ ((CourseBaseActivity) getActivity()) .showOfflineAccessMessage(); } else { startOnlinePlay(entry); } } } } catch (Exception e) { logger.error(e); } }</code><technical_language>casts easy get wrong get screwed in a refactoring do instanceof check something</technical_language>

Target:
private void checkVideoStatus(VideoBlockModel unit) { try { final DownloadEntry entry = unit.getDownloadEntry(environment.getStorage()); if ( entry == null ) return; if ( entry.isDownload() ){ if ( entry.isVideoForWebOnly ){ Toast.makeText(getActivity(), getString(R.string.video_only_on_web_short), Toast.LENGTH_SHORT).show(); return; } if(!entry.isDownloaded()){ IDialogCallback dialogCallback = new IDialogCallback() { @Override public void onPositiveClicked() { startOnlinePlay(entry); } @Override public void onNegativeClicked() { ((BaseFragmentActivity) getActivity()).showInfoMessage(getString(R.string.wifi_off_message)); notifyAdapter(); } }; MediaConsentUtils.consentToMediaPlayback(getActivity(), dialogCallback, environment.getConfig()); }else{ if ( AppConstants.offline_flag ){ ((CourseBaseActivity) getActivity()) .showOfflineAccessMessage(); } else { startOnlinePlay(entry); } } } } catch (Exception e) { logger.error(e); } }
Source:
<code>private static void exitMethod(JoinPoint joinPoint, Object result, long lengthMillis) { <START> if (android.os.Build.VERSION.SDK_INT >= 18) { <END> Trace.endSection(); } Signature signature = joinPoint.getSignature(); Class<?> cls = signature.getDeclaringType(); String methodName = signature.getName(); boolean hasReturnType = signature instanceof MethodSignature && ((MethodSignature) signature).getReturnType() != void.class; StringBuilder builder = new StringBuilder("\u21E0 ") .append(methodName) .append(" [") .append(lengthMillis) .append("ms]"); if (hasReturnType) { builder.append(" = "); builder.append(Strings.toString(result)); } Log.v(asTag(cls), builder.toString()); }</code><technical_language>reason import Build class? Build.VERSION_CODES.JELLY_BEAN_MR2 instead of 18</technical_language>

Target:
private static void exitMethod(JoinPoint joinPoint, Object result, long lengthMillis) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { Trace.endSection(); } Signature signature = joinPoint.getSignature(); Class<?> cls = signature.getDeclaringType(); String methodName = signature.getName(); boolean hasReturnType = signature instanceof MethodSignature && ((MethodSignature) signature).getReturnType() != void.class; StringBuilder builder = new StringBuilder("\u21E0 ") .append(methodName) .append(" [") .append(lengthMillis) .append("ms]"); if (hasReturnType) { builder.append(" = "); builder.append(Strings.toString(result)); } Log.v(asTag(cls), builder.toString()); }
Source:
<code>public boolean showSavingProgressDialogIfNeeded() { if (!isAdded()) { return false; } if (!mHtmlModeEnabled) return false; if (mSavingContentProgressDialog != null && mSavingContentProgressDialog.isShowing()) { return true; } <START> mSavingContentProgressDialog = new ProgressDialog(getActivity()); <END> mSavingContentProgressDialog.setCancelable(false); mSavingContentProgressDialog.setIndeterminate(true); mSavingContentProgressDialog.setMessage(getActivity().getString(R.string.long_post_dlg_saving)); mSavingContentProgressDialog.show(); return true; }</code><technical_language>minor nit: check mSavingContentProgressDialog == null create a new ProgressDialog in case? this: if (mSavingContentProgressDialog == null) { mSavingContentProgressDialog = new ProgressDialog(getActivity()); mSavingContentProgressDialog.setCancelable(false); mSavingContentProgressDialog.setIndeterminate(true); mSavingContentProgressDialog.setMessage(getActivity().getString(R.string.long_post_dlg_saving)); } mSavingContentProgressDialog.show();</technical_language>

Target:
public boolean showSavingProgressDialogIfNeeded() { if (!isAdded()) { return false; } if (!mHtmlModeEnabled) return false; if (mSavingContentProgressDialog != null && mSavingContentProgressDialog.isShowing()) { return true; } if (mSavingContentProgressDialog == null) { mSavingContentProgressDialog = new ProgressDialog(getActivity()); mSavingContentProgressDialog.setCancelable(false); mSavingContentProgressDialog.setIndeterminate(true); mSavingContentProgressDialog.setMessage(getActivity().getString(R.string.long_post_dlg_saving)); } mSavingContentProgressDialog.show(); return true; }
Source:
<code>void stopRegularScan(ScanClient client) { if (client == null) { return; } <START> for (ScanClient c : mRegularScanClients) { if (c.scannerId != client.scannerId) { continue; } client = c; <END> int deliveryMode = getDeliveryMode(client); if (deliveryMode == DELIVERY_MODE_ON_FOUND_LOST) { for (ScanFilter filter : client.filters) { int entriesToFree = getNumOfTrackingAdvertisements(client.settings); if (!manageAllocationOfTrackingAdvertisement(entriesToFree, false)) { Log.e(TAG, "Error freeing for onfound/onlost filter resources " + entriesToFree); try { mService.onScanManagerErrorCallback(client.scannerId, ScanCallback.SCAN_FAILED_INTERNAL_ERROR); } catch (RemoteException e) { Log.e(TAG, "failed on onScanManagerCallback at freeing", e); } } } } break; } mRegularScanClients.remove(client); if (numRegularScanClients() == 0) { if (DBG) { Log.d(TAG, "stop scan"); } gattClientScanNative(false); } removeScanFilters(client.scannerId); }</code><technical_language>If client passed this function is mScanNative.getBatchScanClient(scannerId) mScanNative.getRegularScanClient(scannerId), run for-loop find scan client anymore? ScanClient passed this function is real ScanClient mRegularScanClients mBatchScanClients? Please implementation of getRegularScanClient() in line 871 getBatchScanClient() in line 1039 of this file</technical_language>

Target:
void stopRegularScan(ScanClient client) { if (client == null) { return; } int deliveryMode = getDeliveryMode(client); if (deliveryMode == DELIVERY_MODE_ON_FOUND_LOST) { for (ScanFilter filter : client.filters) { int entriesToFree = getNumOfTrackingAdvertisements(client.settings); if (!manageAllocationOfTrackingAdvertisement(entriesToFree, false)) { Log.e(TAG, "Error freeing for onfound/onlost filter resources " + entriesToFree); try { mService.onScanManagerErrorCallback(client.scannerId, ScanCallback.SCAN_FAILED_INTERNAL_ERROR); } catch (RemoteException e) { Log.e(TAG, "failed on onScanManagerCallback at freeing", e); } } } } mRegularScanClients.remove(client); if (numRegularScanClients() == 0) { if (DBG) { Log.d(TAG, "stop scan"); } gattClientScanNative(false); } removeScanFilters(client.scannerId); }
Source:
<code>public VariantEntity convert(DBObject dbObject) { <START> logger.warn("INSIDE MongoDBObjectToVariantEntityConverter.convert"); <END> DBObjectToVariantConverter converter = new DBObjectToVariantConverter( new DBObjectToVariantSourceEntryConverter(VariantStorageManager.IncludeSrc.NO), new DBObjectToVariantStatsConverter() ); return new VariantEntity(converter.convertToDataModelType(dbObject)); }</code><technical_language>I remove this, put .debug also, start a method empty line</technical_language>

Target:
public VariantEntity convert(DBObject dbObject) { DBObjectToVariantConverter converter = new DBObjectToVariantConverter( new DBObjectToVariantSourceEntryConverter(VariantStorageManager.IncludeSrc.FIRST_8_COLUMNS), new DBObjectToVariantStatsConverter() ); return new VariantEntity(converter.convertToDataModelType(dbObject)); }
Source:
<code>public void doQuery(List<ITmfStateInterval> currentStateInfo, long t) throws TimeRangeException, StateSystemDisposedException { <START> if (t <= super.getEndTime()) { <END> super.doQuery(currentStateInfo, t); } else { checkValidTime(t); } if (isFinishedBuilding()) { return; } for (int i = 0; i < currentStateInfo.size(); i++) { if (currentStateInfo.get(i) == null) { ITmfStateInterval interval = doSingularQuery(t, i); currentStateInfo.set(i, interval); } } }</code><technical_language>check getSHT().getTreeEnd() instead. technically thing, more clear semantically for</technical_language>

Target:
public void doQuery(List<ITmfStateInterval> currentStateInfo, long t) throws TimeRangeException, StateSystemDisposedException { if (t <= getSHT().getTreeEnd()) { super.doQuery(currentStateInfo, t); } else { checkValidTime(t); } if (isFinishedBuilding()) { return; } for (int i = 0; i < currentStateInfo.size(); i++) { if (currentStateInfo.get(i) == null) { ITmfStateInterval interval = doSingularQuery(t, i); currentStateInfo.set(i, interval); } } }
Source:
<code>public void testInferredGenericTypeInfo() throws Exception { byte[] bytes = "[ {\"name\" : \"foo\" } ]".getBytes(); MessageProperties messageProperties = new MessageProperties(); messageProperties.setContentType("application/json"); messageProperties <START> .setInferredArgumentType(Bar.class.getMethod("setFoos", List.class).getGenericParameterTypes()[0]); <END> Message message = new Message(bytes, messageProperties); Object foo = this.converter.fromMessage(message); assertThat(foo, instanceOf(List.class)); assertThat(((List<?>) foo).get(0), instanceOf(Foo.class)); }</code><technical_language>I infer Type in annotation processor, this variant: messageProperties.setInferredArgumentType((new ParameterizedTypeReference<List<Foo>>() {}).getType()); produce result, mind... for general info :smile:</technical_language>

Target:
public void testInferredGenericTypeInfo() throws Exception { byte[] bytes = "[ {\"name\" : \"foo\" } ]".getBytes(); MessageProperties messageProperties = new MessageProperties(); messageProperties.setContentType("application/json"); messageProperties.setInferredArgumentType((new ParameterizedTypeReference<List<Foo>>() {}).getType()); Message message = new Message(bytes, messageProperties); Object foo = this.converter.fromMessage(message); assertThat(foo, instanceOf(List.class)); assertThat(((List<?>) foo).get(0), instanceOf(Foo.class)); }
Source:
<code>private boolean isAndroidAppInstalled(String uri) { PackageManager pm = getPackageManager(); boolean app_installed = false; try { pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES); app_installed = true; } catch (PackageManager.NameNotFoundException e) { <START> Log.i("debug", "App not installed on Android device"); <END> app_installed = false; } return app_installed; }</code><technical_language>Constants.TAG</technical_language>

Target:
private boolean isAndroidAppInstalled(String uri) { PackageManager mPackageManager = getPackageManager(); boolean mAppInstalled = false; try { mPackageManager.getPackageInfo(uri, PackageManager.GET_ACTIVITIES); mAppInstalled = true; } catch (PackageManager.NameNotFoundException e) { Log.e(Constants.TAG, "App not installed on Android device"); mAppInstalled = false; } return mAppInstalled; }
Source:
<code><START> private void prefetch(Topic topic) { <END> switch (topic.getContentType()) { case AVRO: avroSchemaRepo.getSchema(topic); break; case JSON: jsonSchemaRepo.getSchema(topic); break; default: LOGGER.warn("Schema prefetch failed for topic {}: unknown content type {}", topic.getQualifiedName(), topic.getContentType()); break; } }</code><technical_language>i try more generic, if simple - complicated</technical_language>

Target:
private void prefetch(Topic topic) { schemaRepositories.stream() .filter(repo -> repo.canService(topic.getContentType())) .forEach(repo -> repo.getSchema(topic)); }
Source:
<code><START> public MISTCepStatefulQuery build() { <END> if (cepInput == null || initialState == null || cepStatefulRules.size() == 0 || cepFinalStates.size() == 0) { throw new IllegalStateException("One of cep input, initial state, rules, or final states are not set!"); } return new MISTCepStatefulQuery(cepInput, initialState, cepStatefulRules, cepFinalStates); }</code><technical_language>I need check validation of state transition diagram. handle in a separate issue. Please create issue for this</technical_language>

Target:
public MISTCepStatefulQuery build() { if (cepInput == null || initialState == null || cepStatefulRules.size() == 0 || cepFinalState.size() == 0) { throw new IllegalStateException("One of cep input, initial state, rules, or final states are not set!"); } return new MISTCepStatefulQuery(cepInput, initialState, cepStatefulRules, cepFinalState); }
Source:
<code>public AggregatorFactory getCombiningFactory() { return new DoubleLastAggregatorFactory(name, name) { @Override public Aggregator factorize(ColumnSelectorFactory metricFactory, ColumnValueSelector selector) { return new DoubleLastAggregator(null, null) { @Override public void aggregate() { SerializablePair<Long, Double> pair = (SerializablePair<Long, Double>) selector.getObject(); if (pair.lhs >= lastTime) { lastTime = pair.lhs; lastValue = pair.rhs; } } }; } @Override public BufferAggregator factorizeBuffered(ColumnSelectorFactory metricFactory, ColumnValueSelector selector) { return new DoubleLastBufferAggregator(null, null) { @Override public void aggregate(ByteBuffer buf, int position) { SerializablePair<Long, Double> pair = (SerializablePair<Long, Double>) selector.getObject(); long lastTime = buf.getLong(position); if (pair.lhs >= lastTime) { buf.putLong(position, pair.lhs); <START> buf.putDouble(position + Double.BYTES, pair.rhs); <END> } } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("selector", selector); } }; } }; }</code><technical_language>skips a long, this line changed</technical_language>

Target:
public AggregatorFactory getCombiningFactory() { return new DoubleLastAggregatorFactory(name, name) { @Override public Aggregator factorize(ColumnSelectorFactory metricFactory, ColumnValueSelector selector) { return new DoubleLastAggregator(null, null) { @Override public void aggregate() { SerializablePair<Long, Double> pair = (SerializablePair<Long, Double>) selector.getObject(); if (pair.lhs >= lastTime) { lastTime = pair.lhs; lastValue = pair.rhs; } } }; } @Override public BufferAggregator factorizeBuffered(ColumnSelectorFactory metricFactory, ColumnValueSelector selector) { return new DoubleLastBufferAggregator(null, null) { @Override public void aggregate(ByteBuffer buf, int position) { SerializablePair<Long, Double> pair = (SerializablePair<Long, Double>) selector.getObject(); long lastTime = buf.getLong(position); if (pair.lhs >= lastTime) { buf.putLong(position, pair.lhs); buf.putDouble(position + Long.BYTES, pair.rhs); } } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("selector", selector); } }; } }; }
Source:
<code>public Program(byte[] codeHash, byte[] ops, ProgramInvoke programInvoke, Transaction transaction, SystemProperties config) { this.config = config; this.invoke = programInvoke; this.transaction = transaction; this.codeHash = codeHash == null || FastByteComparisons.equal(HashUtil.EMPTY_DATA_HASH, codeHash) ? null : codeHash; this.ops = nullToEmpty(ops); traceListener = new ProgramTraceListener(config.vmTrace()); this.memory = setupProgramListener(new Memory()); this.stack = setupProgramListener(new Stack()); <START> this.originalRepo = programInvoke.getRepository().getSnapshotTo(programInvoke.getRepository().getRoot()); <END> this.storage = setupProgramListener(new Storage(programInvoke)); this.trace = new ProgramTrace(config, programInvoke); this.blockchainConfig = config.getBlockchainConfig().getConfigForBlock(programInvoke.getNumber().longValue()); }</code><technical_language>you, please, more specific problem</technical_language>

Target:
public Program(byte[] codeHash, byte[] ops, ProgramInvoke programInvoke, Transaction transaction, SystemProperties config) { this.config = config; this.invoke = programInvoke; this.transaction = transaction; this.codeHash = codeHash == null || FastByteComparisons.equal(HashUtil.EMPTY_DATA_HASH, codeHash) ? null : codeHash; this.ops = nullToEmpty(ops); traceListener = new ProgramTraceListener(config.vmTrace()); this.memory = setupProgramListener(new Memory()); this.stack = setupProgramListener(new Stack()); this.originalRepo = programInvoke.getRepository().clone(); this.storage = setupProgramListener(new Storage(programInvoke)); this.trace = new ProgramTrace(config, programInvoke); this.blockchainConfig = config.getBlockchainConfig().getConfigForBlock(programInvoke.getNumber().longValue()); }
Source:
<code><START> public void testAddNewRelationship_withIndex() throws Exception { <END> final Node diagram = createNode(CaseManagementDiagram.class); final Node start = createNode(StartNoneEvent.class); final Node end = createNode(EndNoneEvent.class); final Node stage = createNode(AdHocSubprocess.class); final Node candidate = createNode(AdHocSubprocess.class); createChildEdge(diagram, start); createChildEdge(diagram, stage); createChildEdge(diagram, end); final Edge edge = createSequenceFlow(start, stage); createSequenceFlow(stage, end); final CaseManagementSetChildNodeGraphCommand command = new CaseManagementSetChildNodeGraphCommand(diagram, candidate, OptionalInt.of(1), Optional.of(diagram), originalIndex); command.addNewRelationship(context); assertTrue(command.in.isPresent()); assertEquals(start, command.in.get()); assertTrue(command.out.isPresent()); assertEquals(stage, command.out.get()); assertTrue(command.edge.isPresent()); assertEquals(edge, command.edge.get()); assertEquals(candidate, ((Edge) diagram.getOutEdges().get(1)).getTargetNode()); assertEquals(candidate, ((Edge) start.getOutEdges().get(0)).getTargetNode()); assertEquals(1, stage.getInEdges().stream().filter(sequencePredicate()).count()); assertEquals(candidate, ((List) stage.getInEdges().stream().filter(sequencePredicate()) .map(e -> ((Edge) e).getSourceNode()).collect(Collectors.toList())).get(0)); }</code><technical_language>Exception is thrown</technical_language>

Target:
public void testAddNewRelationship_withIndex() { final Node diagram = createNode(CaseManagementDiagram.class); final Node start = createNode(StartNoneEvent.class); final Node end = createNode(EndNoneEvent.class); final Node stage = createNode(AdHocSubprocess.class); final Node candidate = createNode(AdHocSubprocess.class); createChildEdge(diagram, start); createChildEdge(diagram, stage); createChildEdge(diagram, end); final Edge edge = createSequenceFlow(start, stage); createSequenceFlow(stage, end); final CaseManagementSetChildNodeGraphCommand command = new CaseManagementSetChildNodeGraphCommand(diagram, candidate, OptionalInt.of(1), Optional.of(diagram), originalIndex); command.addNewRelationship(context); assertTrue(command.in.isPresent()); assertEquals(start, command.in.get()); assertTrue(command.out.isPresent()); assertEquals(stage, command.out.get()); assertTrue(command.edge.isPresent()); assertEquals(edge, command.edge.get()); assertEquals(candidate, ((Edge) diagram.getOutEdges().get(1)).getTargetNode()); assertEquals(candidate, ((Edge) start.getOutEdges().get(0)).getTargetNode()); assertEquals(1, stage.getInEdges().stream().filter(sequencePredicate()).count()); assertEquals(candidate, ((List) stage.getInEdges().stream().filter(sequencePredicate()) .map(e -> ((Edge) e).getSourceNode()).collect(Collectors.toList())).get(0)); }
Source:
<code>private static AdvancedInformation executeAut(AutLaunch launch) { AdvancedInformation info = null; try { final GetAdvancedInfo advInfoCmd = TeslaFactory.eINSTANCE .createGetAdvancedInfo(); final Object obj = launch.execute(advInfoCmd); if (obj instanceof AdvancedInformation) info = (AdvancedInformation) obj; } catch (Exception e) { <START> return (AdvancedInformation) RcpttPlugin.createStatus(e); <END> } return info; }</code><technical_language>ClassCastException</technical_language>

Target:
private static AdvancedInformation executeAut(AutLaunch launch) { AdvancedInformation info = null; try { final GetAdvancedInfo advInfoCmd = TeslaFactory.eINSTANCE .createGetAdvancedInfo(); final Object obj = launch.execute(advInfoCmd); if (obj instanceof AdvancedInformation) info = (AdvancedInformation) obj; } catch (Exception e) { RcpttPlugin.log(e); } return info; }
Source:
<code>protected TransportOptions createTransportOptions(InetAddress host) { return new TransportOptions( TransportOptions.BigtableTransports.HTTP2_NETTY_TLS, host, options.getPort(), <START> SSL_CONTEXT_FACTORY, <END> elg); }</code><technical_language>move SSL_CONTEXT_FACTORY TransportOptions, need configure it. Also, I future proofing, want drop HTTP2_NETTY_TLS option, configurable, re-add need it. Right adds some knotting. Similar port</technical_language>

Target:
protected TransportOptions createTransportOptions(InetAddress host) { return new TransportOptions( TransportOptions.BigtableTransports.HTTP2_NETTY_TLS, host, options.getPort(), TransportOptions.SSL_CONTEXT_FACTORY, elg); }
Source:
<code>public static void main(String[] args) throws Exception { SamzaMonitorService monitorService = null; try { SamzaRestConfig config = parseConfig(args); ReadableMetricsRegistry metricsRegistry = new MetricsRegistryMap(); log.info("Creating new SamzaRestService with config: {}", config); MetricsConfig metricsConfig = new MetricsConfig(config); Map<String, MetricsReporter> metricsReporters = MetricsReporterLoader.getMetricsReporters(metricsConfig, Util.getLocalHost().getHostName()); SamzaRestService restService = new SamzaRestService(new Server(config.getPort()), metricsRegistry, metricsReporters, new ServletContextHandler(ServletContextHandler.SESSIONS)); SamzaRestApplication samzaRestApplication = new SamzaRestApplication(config); ServletContainer container = new ServletContainer(samzaRestApplication); restService.addServlet(container, "/*"); monitorService = new SamzaMonitorService(config, metricsRegistry); monitorService.start(); restService.runBlocking(); monitorService.stop(); } catch (Throwable t) { log.error("Exception in main.", t); } finally { if (monitorService != null) { <START> monitorService.stop(); <END> } } }</code><technical_language>monitorService.stop is called line 106. Do need remove that</technical_language>

Target:
public static void main(String[] args) throws Exception { SamzaMonitorService monitorService = null; try { SamzaRestConfig config = parseConfig(args); ReadableMetricsRegistry metricsRegistry = new MetricsRegistryMap(); log.info("Creating new SamzaRestService with config: {}", config); MetricsConfig metricsConfig = new MetricsConfig(config); Map<String, MetricsReporter> metricsReporters = MetricsReporterLoader.getMetricsReporters(metricsConfig, Util.getLocalHost().getHostName()); SamzaRestService restService = new SamzaRestService(new Server(config.getPort()), metricsRegistry, metricsReporters, new ServletContextHandler(ServletContextHandler.SESSIONS)); SamzaRestApplication samzaRestApplication = new SamzaRestApplication(config); ServletContainer container = new ServletContainer(samzaRestApplication); restService.addServlet(container, "/*"); monitorService = new SamzaMonitorService(config, metricsRegistry); monitorService.start(); restService.runBlocking(); } catch (Throwable t) { log.error("Exception in main.", t); } finally { if (monitorService != null) { monitorService.stop(); } } }
Source:
<code>public void stripPrefixIfPresent() throws Exception { <START> Assert.assertEquals("", mS3UnderFileSystem.stripPrefixIfPresent("s3a://" + BUCKET_NAME)); <END> }</code><technical_language>previous code returned</technical_language>

Target:
public void stripPrefixIfPresent() throws Exception { Assert.assertEquals("", mS3UnderFileSystem.stripPrefixIfPresent("s3a://" + BUCKET_NAME)); Assert.assertEquals("", mS3UnderFileSystem.stripPrefixIfPresent("s3a://" + BUCKET_NAME + "/")); Assert.assertEquals("test/", mS3UnderFileSystem.stripPrefixIfPresent("test")); Assert.assertEquals("test/", mS3UnderFileSystem.stripPrefixIfPresent("s3a://" + BUCKET_NAME + "/test/")); }
Source:
<code>public void loadAfter(@NonNull final LoadParams<String> params, @NonNull final LoadCallback<String, DataSnapshot> callback) { mLoadingState.postValue(LoadingState.LOADING_MORE); Query mNewQuery = mQuery.startAt(null, params.key).limitToFirst(params.requestedLoadSize + 1); mNewQuery.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { if (dataSnapshot.exists()) { List<DataSnapshot> data = new ArrayList<>(); String lastKey = null; Iterator<DataSnapshot> iterator = dataSnapshot.getChildren().iterator(); <START> if (iterator.hasNext()) <END> iterator.next(); while (iterator.hasNext()) { DataSnapshot snapshot = iterator.next(); data.add(snapshot); } mLoadingState.postValue(LoadingState.LOADED); mRetryRunnable = null; if (data.isEmpty()) mLoadingState.postValue(LoadingState.FINISHED); else { lastKey = getLastPageKey(data); } callback.onResult(data, lastKey); } else { mRetryRunnable = getRetryLoadAfter(params, callback); setDatabaseNotFoundError(); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { mRetryRunnable = getRetryLoadAfter(params, callback); setError(databaseError); } }); }</code><technical_language>Style nit: please if statements: if (iterator.hasNext()) { iterator.next() }</technical_language>

Target:
public void loadAfter(@NonNull final LoadParams<String> params, @NonNull final LoadCallback<String, DataSnapshot> callback) { mLoadingState.postValue(LoadingState.LOADING_MORE); Query mNewQuery = mQuery.startAt(null, params.key).limitToFirst(params.requestedLoadSize + 1); mNewQuery.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { if (dataSnapshot.exists()) { List<DataSnapshot> data = new ArrayList<>(); String lastKey = null; Iterator<DataSnapshot> iterator = dataSnapshot.getChildren().iterator(); if (iterator.hasNext()) { iterator.next(); } while (iterator.hasNext()) { DataSnapshot snapshot = iterator.next(); data.add(snapshot); } mLoadingState.postValue(LoadingState.LOADED); mRetryRunnable = null; if (data.isEmpty()) mLoadingState.postValue(LoadingState.FINISHED); else { lastKey = getLastPageKey(data); } callback.onResult(data, lastKey); } else { mRetryRunnable = getRetryLoadAfter(params, callback); setDatabaseNotFoundError(); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { mRetryRunnable = getRetryLoadAfter(params, callback); setError(databaseError); } }); }
Source:
<code>private void testLocalOperation(CheckRemoteLockAcquiredOnlyOnceTest.CacheOperation o) throws Exception { assert !advancedCache(1).getRpcManager().getTransport().isCoordinator(); assert advancedCache(0).getRpcManager().getTransport().isCoordinator(); tm(0).begin(); o.execute(); assert lockManager(0).isLocked(key); assert !lockManager(1).isLocked(key); assertEquals(controlInterceptor.remoteInvocations, 0); <START> <END> }</code><technical_language>Rollback transaction end</technical_language>

Target:
private void testLocalOperation(CheckRemoteLockAcquiredOnlyOnceTest.CacheOperation o) throws Exception { assert !advancedCache(1).getRpcManager().getTransport().isCoordinator(); assert advancedCache(0).getRpcManager().getTransport().isCoordinator(); tm(0).begin(); o.execute(); assert lockManager(0).isLocked(key); assert !lockManager(1).isLocked(key); assertEquals(controlInterceptor.remoteInvocations, 0); tm(0).rollback(); }
Source:
<code>public void onSignupSheetTermsOfServiceClicked() { AnalyticsTracker.track(AnalyticsTracker.Stat.SIGNUP_TERMS_OF_SERVICE_TAPPED); String locale = LanguageUtils.getPatchedCurrentDeviceLanguage(this); <START> if (locale.indexOf("_") > -1) { <END> locale = locale.substring(0, locale.indexOf("_")); } ActivityLauncher.openUrlExternal(this, getResources().getString(R.string.wordpresscom_tos_url, locale)); }</code><technical_language>AndroidStudio's inspection highlights suggests replacing indexOf contains for condition expression. WDYT replacing it? If touch this line, index is recalculated below, introducing a temp variable hold index avoid lookup anyway</technical_language>

Target:
public void onSignupSheetTermsOfServiceClicked() { AnalyticsTracker.track(AnalyticsTracker.Stat.SIGNUP_TERMS_OF_SERVICE_TAPPED); String locale = LanguageUtils.getPatchedCurrentDeviceLanguage(this); int pos = locale.indexOf("_"); if (pos > -1) { locale = locale.substring(0, pos); } ActivityLauncher.openUrlExternal(this, getResources().getString(R.string.wordpresscom_tos_url, locale)); }
Source:
<code>public void testPullWithUntrackedStash() throws Exception { PullResult res = target.pull().call(); assertTrue(res.getFetchResult().getTrackingRefUpdates().isEmpty()); assertTrue(res.getMergeResult().getMergeStatus() .equals(MergeStatus.ALREADY_UP_TO_DATE)); <START> <END> writeToFile(sourceFile, "Source change"); source.add().addFilepattern("SomeFile.txt").call(); source.commit().setMessage("Source change in remote").call(); writeToFile(new File(dbTarget.getWorkTree(), "untracked.txt"), "untracked"); RevCommit revCommit = target.stashCreate() .setIndexMessage("message here").setIncludeUntracked(true) .call(); assertNotNull(revCommit); String stashName = revCommit.getName(); res = target.pull().call(); target.stashApply().setStashRef(stashName).call(); }</code><technical_language>line matters is writeToFile( ... ). If checking is update is necessary part of setUp()</technical_language>

Target:
public void testPullWithUntrackedStash() throws Exception { target.pull().call(); writeToFile(sourceFile, "Source change"); source.add().addFilepattern("SomeFile.txt").call(); source.commit().setMessage("Source change in remote").call(); writeToFile(new File(dbTarget.getWorkTree(), "untracked.txt"), "untracked"); RevCommit stash = target.stashCreate().setIndexMessage("message here") .setIncludeUntracked(true).call(); assertNotNull(stash); assertTrue(target.status().call().isClean()); assertTrue(target.pull().call().isSuccessful()); assertEquals("[SomeFile.txt, mode:100644, content:Source change]", indexState(dbTarget, CONTENT)); assertFalse(JGitTestUtil.check(dbTarget, "untracked.txt")); assertEquals("Source change", JGitTestUtil.read(dbTarget, "SomeFile.txt")); target.stashApply().setStashRef(stash.getName()).call(); assertEquals("[SomeFile.txt, mode:100644, content:Source change]", indexState(dbTarget, CONTENT)); assertEquals("untracked", JGitTestUtil.read(dbTarget, "untracked.txt")); assertEquals("Source change", JGitTestUtil.read(dbTarget, "SomeFile.txt")); }
Source:
<code>public void tearDownBtm() throws Exception { if(cacheManager != null) { cacheManager.close(); } <START> transactionManager.shutdown(); <END> if (TransactionManagerServices.isTransactionManagerRunning()) { TransactionManagerServices.getTransactionManager().shutdown(); } }</code><technical_language>Right, transactionManager.shutdown() call is redundant if () block below</technical_language>

Target:
public void tearDownBtm() throws Exception { if(cacheManager != null) { cacheManager.close(); } if (TransactionManagerServices.isTransactionManagerRunning()) { TransactionManagerServices.getTransactionManager().shutdown(); } }
Source:
<code>public Map<String, Sketch> extractAggregationResult(AggregationResultHolder aggregationResultHolder) { Map<Predicate, Union> unionMap = aggregationResultHolder.getResult(); if (unionMap == null || unionMap.isEmpty()) { <START> return null; <END> } Map<String, Sketch> result = new HashMap<>(); for (PredicateInfo predicateInfo : _predicateInfoMap.values()) { Sketch sketch = unionMap.get(predicateInfo.getPredicate()).getResult(); if (!sketch.isEmpty()) { result.put(predicateInfo.getStringPredicate(), sketch); } } return result; }</code><technical_language>Is caller good null? I changed handle null return this function</technical_language>

Target:
public Map<String, Sketch> extractAggregationResult(AggregationResultHolder aggregationResultHolder) { Map<Predicate, Union> unionMap = aggregationResultHolder.getResult(); if (unionMap == null || unionMap.isEmpty()) { return Collections.emptyMap(); } Map<String, Sketch> result = new HashMap<>(); for (PredicateInfo predicateInfo : _predicateInfoMap.values()) { Sketch sketch = unionMap.get(predicateInfo.getPredicate()).getResult(); if (!sketch.isEmpty()) { result.put(predicateInfo.getStringPredicate(), sketch); } } return result; }
Source:
<code>public static TestSuite suite() throws IOException { TestSuite suite = new TestSuite(DeclarationGeneratorTests.class.getName()); List<File> testFiles = getTestInputFiles(JS_NO_EXTERNS); for (final File input : testFiles) { File golden = getGoldenFile(input, ".d.ts"); final String goldenText = getTestFileText(golden); ProgramSubject subject = assertThatProgram(input); if (input.getName().contains("_with_platform")) { subject.withPlatform = true; } if (input.getName().contains("_emit_platform_externs")) { subject.emitPlatformExterns = true; } if (input.getName().contains("_output_base")) { subject.emitBase = true; } <START> if (Arrays.asList("partial", "multifilePartial", "crossModuleImports") <END> .contains(input.getParentFile().getName())) { subject.partialInput = true; } subject.extraExternFile = getExternFileNameOrNull(input.getName()); suite.addTest(new DeclarationTest(input.getName(), goldenText, subject)); } return suite; }</code><technical_language>kinda unpredictable "crossModuleImports" implies "partial". "partialCrossModuleImports" something</technical_language>

Target:
public static TestSuite suite() throws IOException { TestSuite suite = new TestSuite(DeclarationGeneratorTests.class.getName()); List<File> testFiles = getTestInputFiles(JS_NO_EXTERNS); for (final File input : testFiles) { File golden = getGoldenFile(input, ".d.ts"); final String goldenText = getTestFileText(golden); ProgramSubject subject = assertThatProgram(input); if (input.getName().contains("_with_platform")) { subject.withPlatform = true; } if (input.getName().contains("_emit_platform_externs")) { subject.emitPlatformExterns = true; } if (input.getName().contains("_output_base")) { subject.emitBase = true; } if (Arrays.asList("partial", "multifilePartial", "partialCrossModuleImports") .contains(input.getParentFile().getName())) { subject.partialInput = true; } subject.extraExternFile = getExternFileNameOrNull(input.getName()); suite.addTest(new DeclarationTest(input.getName(), goldenText, subject)); } return suite; }
Source:
<code>public void androidAppLinks() throws Exception { study.getAndroidAppLinks().add(TestConstants.ANDROID_APP_LINK); <START> study.getAndroidAppLinks().add(TestConstants.ANDROID_APP_LINK_2); <END> Result result = controller.androidAppLinks(); assertEquals(200, result.status()); TypeReference<List<AndroidAppSiteAssociation>> type = new TypeReference<List<AndroidAppSiteAssociation>>() {}; List<AndroidAppSiteAssociation> links = TestUtils.getResponsePayload(result, type); assertEquals(TestConstants.ANDROID_APP_LINK, links.get(0).getTarget()); assertEquals(TestConstants.ANDROID_APP_LINK_2, links.get(1).getTarget()); }</code><technical_language>Is worth creating a test multiple studies (and multiple links study) this correctly accumulates links multiple studies? (For this Apple version.)</technical_language>

Target:
public void androidAppLinks() throws Exception { DynamoStudy study2 = new DynamoStudy(); study2.setIdentifier("test-study2"); study2.setSupportEmail("support@email.com"); study2.setPasswordPolicy(PasswordPolicy.DEFAULT_PASSWORD_POLICY); doReturn(ImmutableList.of(study, study2)).when(studyService).getStudies(); study.getAndroidAppLinks().add(TestConstants.ANDROID_APP_LINK); study.getAndroidAppLinks().add(TestConstants.ANDROID_APP_LINK_2); study2.getAndroidAppLinks().add(TestConstants.ANDROID_APP_LINK_3); study2.getAndroidAppLinks().add(TestConstants.ANDROID_APP_LINK_4); Result result = controller.androidAppLinks(); assertEquals(200, result.status()); JsonNode node = TestUtils.getJson(result); assertEquals(TestConstants.ANDROID_APP_LINK, getLinkAtIndex(node, 0)); assertEquals(TestConstants.ANDROID_APP_LINK_2, getLinkAtIndex(node, 1)); assertEquals(TestConstants.ANDROID_APP_LINK_3, getLinkAtIndex(node, 2)); assertEquals(TestConstants.ANDROID_APP_LINK_4, getLinkAtIndex(node, 3)); }
Source:
<code>private static boolean hasMatrixParam(List<PathSegment> pathSegments, String param) { if (pathSegments != null) for (PathSegment segement : pathSegments) { MultivaluedMap<String, String> matrixParams = segement.getMatrixParameters(); if (matrixParams != null && !matrixParams.isEmpty()) for (String key : matrixParams.keySet()) { if (key.equals(param)) return true; <START> } <END> } return false; }</code><technical_language>if (matrixParams.containsKey(param) { ... }</technical_language>

Target:
private static boolean hasMatrixParam(List<PathSegment> pathSegments, String param) { if (pathSegments != null) for (PathSegment segement : pathSegments) { MultivaluedMap<String, String> matrixParams = segement.getMatrixParameters(); if (matrixParams != null && !matrixParams.isEmpty() && matrixParams.containsKey(param)) return true; } return false; }
Source:
<code>protected synchronized void injectSizzle() { if (sizzleSource == null) { try { <START> sizzleSource = IOUtils.toString(currentThread().getContextClassLoader().getResource("sizzle.js"), Charset.defaultCharset()); <END> } catch (IOException e) { throw new RuntimeException("Cannot load sizzle.js from classpath", e); } } executeJavaScript(sizzleSource); }</code><technical_language>a bad idea rely default encoding. cp-1251, KOI8R, Chinese - else. StandardCharsets.UTF8 instead</technical_language>

Target:
protected synchronized void injectSizzle() { if (sizzleSource == null) { try { sizzleSource = IOUtils.toString(currentThread().getContextClassLoader().getResource("sizzle.js"), StandardCharsets.UTF_8); } catch (IOException e) { throw new RuntimeException("Cannot load sizzle.js from classpath", e); } } executeJavaScript(sizzleSource); }
Source:
<code>public void testNonexistentLocalCommandExitStatus() throws Exception { ThreadProperty.set("class", this.getClass().getCanonicalName()); CommonG commong = new CommonG(); String command = "shur"; commong.runLocalCommand(command); int exitstatus = commong.getCommandExitStatus(); <START> assertThat(exitstatus).as("Running command echo locally").isEqualTo(1); <END> }</code><technical_language>Command is shur, isnt it</technical_language>

Target:
public void testNonexistentLocalCommandExitStatus() throws Exception { ThreadProperty.set("class", this.getClass().getCanonicalName()); CommonG commong = new CommonG(); String command = "shur"; commong.runLocalCommand(command); int exitstatus = commong.getCommandExitStatus(); assertThat(exitstatus).as("Running nonexistent command 'shur' locally").isEqualTo(1); }
Source:
<code>public static boolean isEmbedded(String driverClass, String url) { <START> return (driverClass != null && (matches(HSQL, driverClass) || ( matches(H2, driverClass) && !StringUtils.hasText("mem")) <END> || matches(DERBY, driverClass) || matches(HSQLDB, driverClass))); }</code><technical_language>updated code url argument. This tests validate change of behaviour missing. check url more narrowed, :h2:mem: perhaps</technical_language>

Target:
public static boolean isEmbedded(String driverClass, String url) { return (driverClass != null && (matches(HSQL, driverClass) || (matches(H2, driverClass) && url.contains(":h2:mem")) || matches(DERBY, driverClass) || matches(HSQLDB, driverClass))); }
Source:
<code>public void tccReceived(RTCPTCCPacket pkt) { PacketDetail retrievedPacketDetail; for (int receivedSequenceNo: pkt.getPackets().keySet()) { retrievedPacketDetail = outgoingPacketFields .get(receivedSequenceNo); if (retrievedPacketDetail != null) { long _bitrate = bitrateEstimator .rtcpTCCRemoteBitrateEstimator((int) pkt.getSourceSSRC(), retrievedPacketDetail.pktTime, pkt.getPackets().get(receivedSequenceNo), retrievedPacketDetail.pktLength); <START> pkt.getPackets().remove(receivedSequenceNo); <END> } } }</code><technical_language>This problems (deleting element Map while iterating key set). meant remove element outgoingPacketFields map</technical_language>

Target:
public void tccReceived(RTCPTCCPacket pkt) { PacketDetail retrievedPacketDetail; for (int receivedSequenceNo: pkt.getPackets().keySet()) { if (outgoingPacketFields.containsKey(receivedSequenceNo)){ retrievedPacketDetail = outgoingPacketFields .get(receivedSequenceNo); if (retrievedPacketDetail != null) { long _bitrate = bitrateEstimator .rtcpTCCRemoteBitrateEstimator( (int) pkt.getSourceSSRC(), retrievedPacketDetail.pktTime, pkt.getPackets().get(receivedSequenceNo), retrievedPacketDetail.pktLength); outgoingPacketFields.remove(receivedSequenceNo); } } } }
Source:
<code>public synchronized void putAll(List<Entry<K, V>> entries) { Preconditions.checkNotNull(rwTable, "Cannot write to a read-only table: " + rdTable); entries.forEach(e -> { <START> this.rwTable.put(e.getKey(), e.getValue()); <END> this.cache.put(e.getKey(), e.getValue()); }); }</code><technical_language>call put in this class for atomacy</technical_language>

Target:
public void putAll(List<Entry<K, V>> entries) { Preconditions.checkNotNull(rwTable, "Cannot write to a read-only table: " + rdTable); entries.forEach(e -> put(e.getKey(), e.getValue())); }
Source:
<code>public MockBoundedByteBufferReceive send(Send send) throws IOException { RequestOrResponseType type = ((RequestOrResponse) send).getRequestType(); switch (type) { case PutRequest: PutRequest putRequest = (PutRequest) send; final ServerErrorCode putError = hardError != null ? hardError : putErrors.size() > 0 ? putErrors.poll() : ServerErrorCode.No_Error; if (putError == ServerErrorCode.No_Error) { updateBlobMap(putRequest); } return new MockBoundedByteBufferReceive( new PutResponse(putRequest.getCorrelationId(), putRequest.getClientId(), putError) { ByteBuffer getPayload() { ByteBuffer buf; <START> buf = ByteBuffer.allocate(2 + 2 + 4 + 4 + 2); <END> buf.putShort((short) RequestOrResponseType.PutResponse.ordinal()); buf.putShort(versionId); buf.putInt(correlationId); buf.putInt(0); buf.putShort((short) putError.ordinal()); buf.flip(); return buf; } }.getPayload()); default: throw new IOException("Unknown request type received"); } }</code><technical_language>add some doc is for</technical_language>

Target:
public MockBoundedByteBufferReceive send(Send send) throws IOException { RequestOrResponseType type = ((RequestOrResponse) send).getRequestType(); switch (type) { case PutRequest: PutRequest putRequest = (PutRequest) send; final ServerErrorCode putError = hardError != null ? hardError : putErrors.size() > 0 ? putErrors.poll() : ServerErrorCode.No_Error; if (putError == ServerErrorCode.No_Error) { updateBlobMap(putRequest); } return new MockBoundedByteBufferReceive( new PutResponse(putRequest.getCorrelationId(), putRequest.getClientId(), putError) { ByteBuffer getPayload() throws IOException { ByteArrayOutputStream bStream = new ByteArrayOutputStream(); DataOutputStream dStream = new DataOutputStream(bStream); dStream.writeShort((short) RequestOrResponseType.PutResponse.ordinal()); dStream.writeShort(versionId); dStream.writeInt(correlationId); dStream.writeInt(0); dStream.writeShort((short) putError.ordinal()); return ByteBuffer.wrap(bStream.toByteArray()); } }.getPayload()); default: throw new IOException("Unknown request type received"); } }