auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null) { return false; } if (obj.getClass() != this.getClass()) { <START> return true; <END> } PGrange<T> other = (PGrange<T>) obj; return this.lowerInclusive == other.lowerInclusive && this.upperInclusive == other.upperInclusive && nullSafeEquals(this.lowerBound, other.lowerBound) && nullSafeEquals(this.upperBound, other.upperBound); }</code><technical_language>Is write hand "generate equals/hashCode" in IDE? is strange consider "different class" objects equal</technical_language>

Target:
public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null) { return false; } if (obj.getClass() != this.getClass()) { return false; } PGrange<T> other = (PGrange<T>) obj; return this.lowerInclusive == other.lowerInclusive && this.upperInclusive == other.upperInclusive && nullSafeEquals(this.lowerBound, other.lowerBound) && nullSafeEquals(this.upperBound, other.upperBound); }
Source:
<code>public void anAlarmNotificationIsReceivedFromAKnownDevice() throws Throwable { <START> PROPERTIES_MAP.put(DEVICE_IDENTIFICATION_G_LABEL, this.deviceId.getDeviceIdG()); <END> PROPERTIES_MAP.put(ORGANISATION_IDENTIFICATION_LABEL, this.organisationId.getOrganisationId()); this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, TEST_CASE_XML, TEST_SUITE_XML); }</code><technical_language>SetPushSetupAlarm tested E-meter DEVICE_IDENTIFICATION_G_LABEL -> DEVICE_IDENTIFICATION_E_LABEL getDeviceIdG -> getDeviceIdE</technical_language>

Target:
public void anAlarmNotificationIsReceivedFromAKnownDevice() throws Throwable { try { SimulatePushedAlarmsHooks.simulateAlarm(KnownDevice, new byte[] { 0x2C, 0x00, 0x00, 0x01, 0x02 }); SimulatePushedAlarmsHooks.simulateAlarm(KnownDevice, new byte[] { 0x2C, 0x04, 0x20, 0x00, 0x00 }); } catch (final Exception e) { LOGGER.error("Error occured simulateAlarm: ", e); } PROPERTIES_MAP.put(DEVICE_IDENTIFICATION_E_LABEL, this.deviceId.getDeviceIdE()); PROPERTIES_MAP.put(ORGANISATION_IDENTIFICATION_LABEL, this.organisationId.getOrganisationId()); this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, TEST_CASE_XML, TEST_SUITE_XML); }
Source:
<code>public static WSResponse startJob(String conf_id, String url) { Configuration runConfig = getConfigurationFromDb(conf_id); Evaluator newEval = getEvaluator(runConfig); List<TextAnnotation> instances = getInstancesFromDb(runConfig); LearnerInterface learner = new LearnerInterface(url); String jsonInfo = learner.getInfo(); <START> System.out.println(jsonInfo); <END> if(jsonInfo.equals("err")) return null; instances = cleanseInstances(instances, jsonInfo); Job newJob = new Job(learner, instances); WSResponse solverResponse = newJob.sendAndReceiveRequestsFromSolver(); Evaluation eval = newJob.evaluateSolver(); return solverResponse; }</code><technical_language>Is this for testing? want some logging library</technical_language>

Target:
public static WSResponse startJob(String conf_id, String url) { Configuration runConfig = getConfigurationFromDb(conf_id); Evaluator newEval = getEvaluator(runConfig); List<TextAnnotation> instances = getInstancesFromDb(runConfig); LearnerInterface learner = new LearnerInterface(url); String jsonInfo = learner.getInfo(); if(jsonInfo.equals("err")) return null; instances = cleanseInstances(instances, jsonInfo); Job newJob = new Job(learner, instances); WSResponse solverResponse = newJob.sendAndReceiveRequestsFromSolver(); Evaluation eval = newJob.evaluateSolver(); return solverResponse; }
Source:
<code>private boolean isAdvertised(Channel channel) { <START> return channel.getAdvertiseFrom().isBeforeNow() || channel.getAdvertiseFrom().isEqualNow(); <END> }</code><technical_language>This null safe</technical_language>

Target:
private boolean isAdvertised(Channel channel) { return channel.getAdvertiseFrom() == null || !channel.getAdvertiseFrom().isAfterNow(); }
Source:
<code>protected String getEventsFromEventsLogPlugin(IGerritHudsonTriggerConfig config, String url) { logger.info("({}) Going to GET: {}", serverName, url); DefaultHttpClient httpclient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(url); if (config.getGerritProxy() != null && !config.getGerritProxy().isEmpty()) { try { URL proxyUrl = new URL(config.getGerritProxy()); HttpHost proxy = new HttpHost(proxyUrl.getHost(), proxyUrl.getPort(), proxyUrl.getProtocol()); httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); } catch (MalformedURLException e) { logger.error("Could not parse proxy URL, attempting without proxy.", e); } } httpclient.getCredentialsProvider().setCredentials(new AuthScope(null, -1), config.getHttpCredentials()); HttpResponse execute; try { execute = httpclient.execute(httpGet); } catch (IOException e) { logger.warn(e.getMessage(), e); return ""; } int statusCode = execute.getStatusLine().getStatusCode(); logger.info("Received status code: for server: {}", statusCode, serverName); if (statusCode == HttpURLConnection.HTTP_OK) { try { InputStream bodyStream = execute.getEntity().getContent(); <START> String body = IOUtils.toString(bodyStream, "UTF-8"); <END> logger.info(body); return body; } catch (IOException ioe) { logger.warn(ioe.getMessage(), ioe); logger.warn("Not successful at requesting missed events from plugin. (errorcode: {})", EVENTS_LOG_PLUGIN_NAME, statusCode); } } else { logger.warn("Not successful at requesting missed events from plugin. (errorcode: {})", EVENTS_LOG_PLUGIN_NAME, statusCode); } return ""; }</code><technical_language>I server returned content in UTF-8, content type response instead</technical_language>

Target:
protected String getEventsFromEventsLogPlugin(IGerritHudsonTriggerConfig config, String url) { logger.debug("({}) Going to GET: {}", serverName, url); HttpResponse execute = null; try { execute = HttpUtils.performHTTPGet(config, url); } catch (IOException e) { logger.warn(e.getMessage(), e); return ""; } int statusCode = execute.getStatusLine().getStatusCode(); logger.debug("Received status code: for server: {}", statusCode, serverName); if (statusCode == HttpURLConnection.HTTP_OK) { try { HttpEntity entity = execute.getEntity(); ContentType contentType; if (entity == null) { logger.warn("Not successful at requesting missed events from plugin. Null entity returned)", statusCode); } contentType = ContentType.get(entity); if (contentType == null) { contentType = ContentType.DEFAULT_TEXT; } Charset charset = contentType.getCharset(); if (charset == null) { charset = Charset.defaultCharset(); } InputStream bodyStream = entity.getContent(); String body = IOUtils.toString(bodyStream, charset.name()); logger.debug(body); return body; } catch (IOException ioe) { logger.warn(ioe.getMessage(), ioe); logger.warn("Not successful at requesting missed events from plugin. (errorcode: {})", EVENTS_LOG_PLUGIN_NAME, statusCode); } } else { logger.warn("Not successful at requesting missed events from plugin. (errorcode: {})", EVENTS_LOG_PLUGIN_NAME, statusCode); } return ""; }
Source:
<code>public boolean isInProgress(ChargeStatus chargeStatus) { <START> return List.of(lockState, submittedState).contains(chargeStatus); <END> }</code><technical_language>picking, mentioning speaking collection types, a Set List more holds unique values performa a contains check <LINK_0> values is absolutely negligible performance benefit O(1) v O(n), I mentioning relates previous discussions</technical_language>

Target:
public boolean isInProgress(ChargeStatus chargeStatus) { return Set.of(lockState, submittedState).contains(chargeStatus); }
Source:
<code>public void testReservedPoolDisabled() throws Exception { Map<String, String> properties = ImmutableMap.<String, String>builder() .put("experimental.legacy-reserved-pool-enabled", "false") .put("query.low-memory-killer.delay", "5s") .put("query.low-memory-killer.policy", "total-reservation") .build(); try (DistributedQueryRunner queryRunner = createQueryRunner(TINY_SESSION, properties)) { QueryId fakeQueryId = new QueryId("fake"); for (TestingPrestoServer server : queryRunner.getServers()) { List<MemoryPool> memoryPools = server.getLocalMemoryManager().getPools(); assertEquals(memoryPools.size(), 1, "Only general pool should exist"); assertTrue(memoryPools.get(0).tryReserve(fakeQueryId, "test", memoryPools.get(0).getMaxBytes())); } List<Future<?>> queryFutures = new ArrayList<>(); for (int i = 0; i < 2; i++) { queryFutures.add(executor.submit(() -> queryRunner.execute("SELECT COUNT(*), clerk FROM orders GROUP BY clerk"))); } waitForQueryToBeKilled(queryRunner); for (TestingPrestoServer server : queryRunner.getServers()) { Optional<MemoryPool> reserved = server.getLocalMemoryManager().getReservedPool(); <START> MemoryPool general = server.getLocalMemoryManager().getGeneralPool(); <END> assertFalse(reserved.isPresent()); assertTrue(general.getReservedBytes() > 0); general.free(fakeQueryId, "test", general.getMaxBytes()); assertTrue(general.getFreeBytes() > 0); } for (Future<?> query : queryFutures) { query.get(); } } }</code><technical_language>Is a race query is killed other finishes immediately, general pool reservation is empty</technical_language>

Target:
public void testReservedPoolDisabled() throws Exception { Map<String, String> properties = ImmutableMap.<String, String>builder() .put("experimental.reserved-pool-enabled", "false") .put("query.low-memory-killer.delay", "5s") .put("query.low-memory-killer.policy", "total-reservation") .build(); try (DistributedQueryRunner queryRunner = createQueryRunner(TINY_SESSION, properties)) { QueryId fakeQueryId = new QueryId("fake"); for (TestingPrestoServer server : queryRunner.getServers()) { List<MemoryPool> memoryPools = server.getLocalMemoryManager().getPools(); assertEquals(memoryPools.size(), 1, "Only general pool should exist"); assertTrue(memoryPools.get(0).tryReserve(fakeQueryId, "test", memoryPools.get(0).getMaxBytes())); } List<Future<?>> queryFutures = new ArrayList<>(); for (int i = 0; i < 2; i++) { queryFutures.add(executor.submit(() -> queryRunner.execute("SELECT COUNT(*), clerk FROM orders GROUP BY clerk"))); } waitForQueryToBeKilled(queryRunner); for (TestingPrestoServer server : queryRunner.getServers()) { Optional<MemoryPool> reserved = server.getLocalMemoryManager().getReservedPool(); MemoryPool general = server.getLocalMemoryManager().getGeneralPool(); assertFalse(reserved.isPresent()); assertTrue(general.getReservedBytes() > 0); general.free(fakeQueryId, "test", general.getMaxBytes()); assertTrue(general.getFreeBytes() > 0); } for (Future<?> query : queryFutures) { query.get(); } } }
Source:
<code>public void findPatientByUUID_ShouldFindCorrectPatientByUUID() { patientRoomDAO.savePatient(expectedPatientEntity1); patientRoomDAO.savePatient(expectedPatientEntity2); patientRoomDAO.findPatientByUUID(expectedPatientEntity2.getUuid()).subscribe(new SingleObserver<List<PatientEntity>>() { @Override public void onSubscribe(Disposable d) { } @Override public void onSuccess(List<PatientEntity> patientEntities) { Assert.assertEquals(patientEntities.get(0).getEncounters(),expectedEncounterEntity2); Assert.assertEquals(patientEntities.get(0).getDisplay(),expectedPatientEntity2.getDisplay()); Assert.assertEquals(patientEntities.get(0).getAddress_1(),expectedPatientEntity2.getAddress_1()); Assert.assertEquals(patientEntities.get(0).getAddress_2(),expectedPatientEntity2.getAddress_2()); Assert.assertEquals(patientEntities.get(0).getAge(),expectedPatientEntity2.getAge()); Assert.assertEquals(patientEntities.get(0).getBirthDate(),expectedPatientEntity2.getBirthDate()); Assert.assertEquals(patientEntities.get(0).getCauseOfDeath(),expectedPatientEntity2.getCauseOfDeath()); Assert.assertEquals(patientEntities.get(0).getCity(),expectedPatientEntity2.getCity()); Assert.assertEquals(patientEntities.get(0).getCountry(),expectedPatientEntity2.getCountry()); Assert.assertEquals(patientEntities.get(0).getDeathDate(),expectedPatientEntity2.getDeathDate()); Assert.assertEquals(patientEntities.get(0).getFamilyName(),expectedPatientEntity2.getFamilyName()); Assert.assertEquals(patientEntities.get(0).getGender(),expectedPatientEntity2.getGender()); Assert.assertEquals(patientEntities.get(0).getGivenName(),expectedPatientEntity2.getGivenName()); Assert.assertEquals(patientEntities.get(0).getIdentifier(),expectedPatientEntity2.getIdentifier()); Assert.assertEquals(patientEntities.get(0).getMiddleName(),expectedPatientEntity2.getMiddleName()); Assert.assertEquals(patientEntities.get(0).getPhoto(),expectedPatientEntity2.getPhoto()); Assert.assertEquals(patientEntities.get(0).getPostalCode(),expectedPatientEntity2.getPostalCode()); Assert.assertEquals(patientEntities.get(0).getState(),expectedPatientEntity2.getState()); <START> Assert.assertEquals(patientEntities.get(0).isSynced(),expectedPatientEntity2.isSynced()); <END> } @Override public void onError(Throwable e) { Log.i(TAG,e.getMessage()); } }); }</code><technical_language>here. Assert.assertEquals(patientEntities.get(0), expectedPatientEntity2);</technical_language>

Target:
public void findPatientByUUID_ShouldFindCorrectPatientByUUID() { patientRoomDAO.savePatient(expectedPatientEntity1); patientRoomDAO.savePatient(expectedPatientEntity2); patientRoomDAO.findPatientByUUID(expectedPatientEntity2.getUuid()).subscribe(new SingleObserver<List<PatientEntity>>() { @Override public void onSubscribe(Disposable d) { } @Override public void onSuccess(List<PatientEntity> patientEntities) { Assert.assertEquals(patientEntities.get(0), expectedPatientEntity2); } @Override public void onError(Throwable e) { Log.i(TAG, e.getMessage()); } }); }
Source:
<code>public AssertUserFailedException(String errorMessage) { <START> super(MediaWikiApiErrorHandler.ERROR_NO_SUCH_ENTITY, errorMessage); <END> }</code><technical_language>Wrong error constant suggestion super(MediaWikiApiErrorHandler.ERROR_ASSERT_USER_FAILED, errorMessage);</technical_language>

Target:
public AssertUserFailedException(String errorMessage) { super(MediaWikiApiErrorHandler.ERROR_ASSERT_USER_FAILED, errorMessage); }
Source:
<code>private void logAccountingLineBaseList(List accountingLines, StringBuilder sb) { <START> List<AccountingLineBase> accountinLineBases = accountingLines; <END> accountinLineBases.stream().forEach(line -> sb.append(line.toString())); }</code><technical_language>Minor typo in variable name</technical_language>

Target:
private void logAccountingLineBaseList(List accountingLines, StringBuilder sb) { List<AccountingLineBase> accountingLineBases = accountingLines; accountingLineBases.stream().map(AccountingLineBase::toString).forEach(sb::append); }
Source:
<code>public void testSomethingByIterableWithIterable() { final SomethingByIterable s = handle.attach(SomethingByIterable.class); final List<Something> out = s.get(() -> Arrays.asList(new SomethingKey(1, "1"), new SomethingKey(2, "2")) .iterator()); <START> assertThat(out).hasSize(2); <END> }</code><technical_language>check results here, size</technical_language>

Target:
public void testSomethingByIterableWithIterable() { final SomethingByIterable s = handle.attach(SomethingByIterable.class); final List<Something> out = s.get(() -> Arrays.asList(new SomethingKey(1, "1"), new SomethingKey(2, "2")) .iterator()); assertThat(out).hasSameElementsAs(expectedSomethings); }
Source:
<code>public Optional<Relation> getModelClass() { final Relation relation = new Relation(); <START> return Optional.of(relation); <END> }</code><technical_language>return Optional.of(new Relation());</technical_language>

Target:
public Optional<Relation> getModelClass() { return Optional.of(new Relation()); }
Source:
<code>private String getColumnName(Column annotation, Field field) { String name = annotation.name(); <START> return (name.length() > 0) ? name : field.getName(); <END> }</code><technical_language>a toLowerCase here. essentially column names case insensitive. CQL3 this</technical_language>

Target:
private String getColumnName(Column annotation, Field field) { String name = annotation.name().isEmpty() ? field.getName() : annotation.name(); return name.toLowerCase(); }
Source:
<code>public static boolean clear() { <START> if (!isHawkInitialised()) { <END> return false; } return hawkBuilder.getStorage().clear(); }</code><technical_language>replacing this helper method great</technical_language>

Target:
public static boolean clear() { Utils.validateBuild(); return internal.getStorage().clear(); }
Source:
<code>public void revertFile() throws IOException { <START> OutputStream fileOutputStream = Files.newOutputStream( <END> Paths.get("src/test/resources/testmetaOldFormat.xml")); fileOutputStream.write(testMetaOldFormat); fileOutputStream.close(); }</code><technical_language>Again, IOUtils</technical_language>

Target:
public void revertFile() throws IOException { IOUtils.write( testMetaOldFormat, Files.newOutputStream(Paths.get(pathOfOldMetaFormat))); }
Source:
<code>public void aBundledResponseMessageWillContainTheResponseFromAllTheRequests() throws Throwable { LOGGER.debug("check if we get responses for all the requests"); final NodeList nodeList = this.runXpathResult.getNodeList(this.response, " <START> assertEquals(REQUEST_ACTIONS.size(), nodeList.getLength()); <END> }</code><technical_language>Add messages assertions in case of assertion exception usable details failed. applied in assertions</technical_language>

Target:
public void aBundledResponseMessageWillContainTheResponseFromAllTheRequests() throws Throwable { LOGGER.debug("check if we get responses for all the requests"); final NodeList nodeList = this.runXpathResult.getNodeList(this.response, " assertEquals("the number of request actions should equals the nr nodelists", REQUEST_ACTIONS.size(), nodeList.getLength()); }
Source:
<code>private <V> V doInWorkingDirectory(Message<?> message, Session<FTPFile> session, Callable<V> task) throws IOException { Expression workingDirExpression = this.workingDirExpression; FTPClient ftpClient = (FTPClient) session.getClientInstance(); String currentWorkingDirectory = null; try { if (workingDirExpression != null) { currentWorkingDirectory = ftpClient.printWorkingDirectory(); String workingDir = workingDirExpression.getValue(this.evaluationContext, message, String.class); ftpClient.changeWorkingDirectory(workingDir); } return task.call(); } catch (Exception e) { if (e instanceof IOException) { throw (IOException) e; <START> } <END> else { throw new IOException("Uncategorised IO exception", e); } } finally { if (workingDirExpression != null) { ftpClient.changeWorkingDirectory(currentWorkingDirectory); } } }</code><technical_language>null check</technical_language>

Target:
private <V> V doInWorkingDirectory(Message<?> message, Session<FTPFile> session, Callable<V> task) throws IOException { Expression workingDirExpression = this.workingDirExpression; FTPClient ftpClient = (FTPClient) session.getClientInstance(); String currentWorkingDirectory = null; boolean restoreWorkingDirectory = false; try { if (workingDirExpression != null) { currentWorkingDirectory = ftpClient.printWorkingDirectory(); String newWorkingDirectory = workingDirExpression.getValue(this.evaluationContext, message, String.class); if (!Objects.equals(currentWorkingDirectory, newWorkingDirectory)) { ftpClient.changeWorkingDirectory(newWorkingDirectory); restoreWorkingDirectory = true; } } return task.call(); } catch (Exception e) { if (e instanceof IOException) { throw (IOException) e; } else if (e instanceof RuntimeException) { throw (RuntimeException) e; } else { throw new IOException("Uncategorised IO exception", e); } } finally { if (restoreWorkingDirectory) { ftpClient.changeWorkingDirectory(currentWorkingDirectory); } } }
Source:
<code>public BuyerAsTakerProtocol(BuyerAsTakerTrade trade) { super(trade); Offer offer = checkNotNull(trade.getOffer()); processModel.getTradingPeer().setPubKeyRing(offer.getPubKeyRing()); <START> processModel.getTradeManager().requestPersistence(); <END> }</code><technical_language>a NPE here, processModel.tradeManager is null</technical_language>

Target:
public BuyerAsTakerProtocol(BuyerAsTakerTrade trade) { super(trade); Offer offer = checkNotNull(trade.getOffer()); processModel.getTradingPeer().setPubKeyRing(offer.getPubKeyRing()); }
Source:
<code>void wrapTestStorage() { ServerEnvironment serverEnv = ServerEnvironment.instance(); StorageFactory testStorage = InMemoryStorageFactory.newInstance(); <START> serverEnv.configureStorage().tests(testStorage); <END> StorageFactory storageFactory = serverEnv.storageFactory(); assertThat(storageFactory).isInstanceOf(SystemAwareStorageFactory.class); SystemAwareStorageFactory systemAware = (SystemAwareStorageFactory) storageFactory; assertThat(systemAware.delegate()).isEqualTo(testStorage); }</code><technical_language>I java serverEnv.useStorageFactory(factory).inTests(); a lot closer speak</technical_language>

Target:
void wrapTestStorage() { ServerEnvironment serverEnv = ServerEnvironment.instance(); StorageFactory testStorage = InMemoryStorageFactory.newInstance(); serverEnv.use(testStorage, Tests.class); StorageFactory storageFactory = serverEnv.storageFactory(); assertThat(storageFactory).isInstanceOf(SystemAwareStorageFactory.class); SystemAwareStorageFactory systemAware = (SystemAwareStorageFactory) storageFactory; assertThat(systemAware.delegate()).isEqualTo(testStorage); }
Source:
<code>public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { truckIds = new String[cursor.getCount()]; if (cursor.moveToFirst()) { <START> selectedTruckId = cursor.getString(TrucksOwnedByUserQuery.NAME); <END> int counter = 0; do { truckIds[counter] = cursor.getString(TrucksOwnedByUserQuery.ID); counter++; } while (cursor.moveToNext()); } String[] adapterCols = {TrucksOwnedByUserQuery.PROJECTION[TrucksOwnedByUserQuery.NAME]}; int[] adapterRowViews = new int[]{android.R.id.text1}; spinnerAdapter = new SimpleCursorAdapter(getSupportActionBar().getThemedContext(), android.R.layout.simple_spinner_item, cursor, adapterCols, adapterRowViews, 0); spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); actionBarSpinner.setAdapter(spinnerAdapter); actionBarSpinner.setOnItemSelectedListener(this); }</code><technical_language>get name</technical_language>

Target:
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { truckIds = new String[cursor.getCount()]; if (cursor.moveToFirst()) { selectedTruckId = cursor.getString(TrucksOwnedByUserQuery.ID); int counter = 0; do { truckIds[counter] = cursor.getString(TrucksOwnedByUserQuery.ID); counter++; } while (cursor.moveToNext()); } String[] adapterCols = {TrucksOwnedByUserQuery.PROJECTION[TrucksOwnedByUserQuery.NAME]}; int[] adapterRowViews = new int[]{android.R.id.text1}; spinnerAdapter = new SimpleCursorAdapter(getSupportActionBar().getThemedContext(), android.R.layout.simple_spinner_item, cursor, adapterCols, adapterRowViews, 0); spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); actionBarSpinner.setAdapter(spinnerAdapter); actionBarSpinner.setOnItemSelectedListener(this); }
Source:
<code>public boolean handleSingleExercise(Exercise exercise, String path) { if (exercise.isLocked()) { return false; } Path filePath = Folders.tempFolder().resolve(exercise.getName() + ".zip"); downloadExerciseZip(exercise.getZipUrl(), filePath.toString()); try { taskExecutor.extractProject(filePath, Paths.get(path)); } catch (IOException e) { log.error("Could not extract archive: {}", path.toString()); return false; <START> } <END> finally { deleteZip(filePath); } return true; }</code><technical_language>indentation was; new lines blocks. More <LINK_0></technical_language>

Target:
public boolean handleSingleExercise(Exercise exercise, String path) { if (exercise.isLocked()) { return false; } Path filePath = Folders.tempFolder().resolve(exercise.getName() + ".zip"); if(!downloadExerciseZip(exercise.getZipUrl(), filePath.toString())) { return false; } try { taskExecutor.extractProject(filePath, Paths.get(path)); } catch (IOException e) { log.error("Could not extract archive: {}", path.toString()); return false; } finally { deleteZip(filePath); } return true; }
Source:
<code>private static String nanosToString(long nanos) { double value = (double) nanos / _1_SECOND_IN_NANOS; return <START> String.format("%.3g %s", <END> value, JobMessages.cancelability_monitor_abbrevUnitSeconds); }</code><technical_language>results achieved code similar line 60 of org.eclipse.ui.internal.monitoring.DefaultUiFreezeEventLogger</technical_language>

Target:
private static String nanosToString(long nanos) { double value = (double) nanos / _1_SECOND_IN_NANOS; final String format = nanos >= TimeUnit.SECONDS.toNanos(100) ? "%.0f %s" : nanos >= TimeUnit.MILLISECONDS.toNanos(10) ? "%.2g %s" : "%.1g %s"; return String.format(format, value, JobMessages.cancelability_monitor_abbrevUnitSeconds); }
Source:
<code>private void addStorageDomainImageFeature(Features features) { Feature feature = new Feature(); feature.setName("Image Storage Domains"); <START> feature.setDescription("Importing and exporting images from and to image storage domain (as for example OpenStack glance)"); <END> features.getFeature().add(feature); }</code><technical_language>please mention this feature is a "teach preview"</technical_language>

Target:
private void addStorageDomainImageFeature(Features features) { Feature feature = new Feature(); feature.setName("Image Storage Domains (Tech Preview)"); feature.setDescription("Importing and exporting images from and to image storage domain (as for example OpenStack glance)"); features.getFeature().add(feature); }
Source:
<code>public void indexMarker(final IMarker marker) { try { Logger.traceIndexing("Indexing after addition...", marker); final Document doc = LuceneDocumentFactory.createDocument(marker); Logger.debugIndexing("Adding Marker into index with following fields: {}", doc.getFields()); indexWriter.addDocument(doc); indexWriter.commit(); <START> } catch (Exception e) { <END> Logger.error("Failed to index the JAX-RS Endpoint " + marker, e); } finally { Logger.traceIndexing(" Done indexing {}.", marker); } }</code><technical_language>specific exception here</technical_language>

Target:
public void indexMarker(final IMarker marker) { try { Logger.traceIndexing("Indexing after addition...", marker); final Document doc = LuceneDocumentFactory.createDocument(marker); Logger.debugIndexing("Adding Marker into index with following fields: {}", doc.getFields()); indexWriter.addDocument(doc); indexWriter.commit(); } catch (IOException e) { Logger.error("Failed to index the JAX-RS Endpoint " + marker, e); } finally { Logger.traceIndexing(" Done indexing {}.", marker); } }
Source:
<code>public void createAccount(View view) { <START> EditText editText = (EditText) findViewById(R.id.editTextCreateAccount); <END> String username = editText.getText().toString(); if (username.contains(" ")){ displayError(getString(R.string.messageUsernameContainsSpaces)); } else if (username.length() < 1){ displayError(getString(R.string.messageUsernameTooShort)); } else { Intent intent = new Intent(this, CreatingAccountActivity.class); intent.putExtra(CreatingAccountActivity.USERNAME, username); startActivity(intent); } }</code><technical_language>want store view a field in class if multiple time. findViewById a negligible cost</technical_language>

Target:
public void createAccount(View view) { String username = mEditTextCreateAccount.getText().toString(); if (username.contains(" ")){ displayError(getString(R.string.messageUsernameContainsSpaces)); } else if (username.length() < 1){ displayError(getString(R.string.messageUsernameTooShort)); } else { Intent intent = new Intent(this, CreatingAccountActivity.class); intent.putExtra(CreatingAccountActivity.USERNAME, username); startActivity(intent); } }
Source:
<code>public synchronized Set<FractionMetadata> fractions() { return probablyFractionProjects() .stream() .map(FractionRegistry.INSTANCE::of) <START> .filter(e->e!=null) <END> .collect(Collectors.toSet()); }</code><technical_language>Objects::nonNull</technical_language>

Target:
public synchronized Set<FractionMetadata> fractions() { return probablyFractionProjects() .stream() .map(FractionRegistry.INSTANCE::of) .filter(Objects::nonNull) .collect(Collectors.toSet()); }
Source:
<code>public void testNoPassphraseParsing() throws Exception { <START> File file = new File("src/test/resources/com/sonymobile/tools/gerrit/gerritevents/id_rsa"); <END> boolean tested = SshUtil.checkPassPhrase(file, null); assertTrue("Passphrase validation failed to validate null passphrase with none set", tested); tested = SshUtil.checkPassPhrase(file, ""); assertTrue("Passphrase validation failed to validate empty passphrase with none set", tested); tested = SshUtil.checkPassPhrase(file, "nope"); assertFalse("Passphrase validation passed incorrectly on a file with none set", tested); }</code><technical_language>change this? this work running tests published test jar</technical_language>

Target:
public void testNoPassphraseParsing() throws Exception { URL url = Thread.currentThread().getContextClassLoader().getResource( "com/sonymobile/tools/gerrit/gerritevents/id_rsa"); File file = new File(url.getPath()); boolean tested = SshUtil.checkPassPhrase(file, null); assertTrue("Passphrase validation failed to validate null passphrase with none set", tested); tested = SshUtil.checkPassPhrase(file, ""); assertTrue("Passphrase validation failed to validate empty passphrase with none set", tested); tested = SshUtil.checkPassPhrase(file, "nope"); assertFalse("Passphrase validation passed incorrectly on a file with none set", tested); }
Source:
<code>public void addMouseListener(MouseListener listener) { if <START> (this.dropdownTableViewer != <END> null && !this.dropdownTable.isDisposed()) this.dropdownTable.addMouseListener(listener); }</code><technical_language>a check for viewer here? this dropdownTable? table</technical_language>

Target:
public void addMouseListener(MouseListener listener) { if (this.dropdownTable != null && !this.dropdownTable.isDisposed()) this.dropdownTable.addMouseListener(listener); }
Source:
<code>private QemuVolumeFormat(String value) { <START> value = <END> value; }</code><technical_language>this.value = value;</technical_language>

Target:
private QemuVolumeFormat(String value) { this.value = value; }
Source:
<code>public String toString() { <START> return "{" + <END> "dataSource='" + getDataSource() + '\'' + ", stream='" + getId() + '\'' + ", partitions=" + getPartitions() + ", replicas=" + getReplicas() + ", durationSeconds=" + getDurationSeconds() + ", active=" + getActiveTasks() + ", publishing=" + getPublishingTasks() + ", suspended=" + getSuspended() + '}'; }</code><technical_language>toString() is missing name of class</technical_language>

Target:
public String toString() { return "KinesisSupervisorReportPayload{" + "dataSource='" + getDataSource() + '\'' + ", stream='" + getStream() + '\'' + ", partitions=" + getPartitions() + ", replicas=" + getReplicas() + ", durationSeconds=" + getDurationSeconds() + ", active=" + getActiveTasks() + ", publishing=" + getPublishingTasks() + ", suspended=" + getSuspended() + '}'; }
Source:
<code>public void getRankedPassages(Args args) throws Exception { <START> Map<String, Float> scoredDocs = retrieveDocuments(args.query, 100); <END> Map<String, Float> sentencesMap = new LinkedHashMap<>(); IndexUtils util = new IndexUtils(args.index); TokenizerFactory<CoreLabel> tokenizerFactory = PTBTokenizer.factory(new CoreLabelTokenFactory(), ""); for (Map.Entry<String, Float> doc : scoredDocs.entrySet()) { List<Sentence> sentences = util.getSentDocument(doc.getKey()); for (Sentence sent : sentences) { List<CoreLabel> tokens = tokenizerFactory.getTokenizer(new StringReader(sent.text())).tokenize(); String answerTokens = tokens.stream() .map(CoreLabel::toString) .collect(Collectors.joining(" ")); sentencesMap.put(answerTokens, doc.getValue()); } } String queryTokens = tokenizerFactory.getTokenizer(new StringReader(args.query)).tokenize().stream() .map(CoreLabel::toString) .collect(Collectors.joining(" ")); scorer.score(queryTokens, sentencesMap); List<ScoredPassage> topPassages = scorer.extractTopPassages(); for (ScoredPassage s: topPassages) { System.out.println(s.getSentence() + " " + s.getScore()); } }</code><technical_language>I good now. change 100 args.hits</technical_language>

Target:
public void getRankedPassages(Args args) throws Exception { Map<String, Float> scoredDocs = retrieveDocuments(args.query, args.hits); Map<String, Float> sentencesMap = new LinkedHashMap<>(); IndexUtils util = new IndexUtils(args.index); TokenizerFactory<CoreLabel> tokenizerFactory = PTBTokenizer.factory(new CoreLabelTokenFactory(), ""); for (Map.Entry<String, Float> doc : scoredDocs.entrySet()) { List<Sentence> sentences = util.getSentDocument(doc.getKey()); for (Sentence sent : sentences) { List<CoreLabel> tokens = tokenizerFactory.getTokenizer(new StringReader(sent.text())).tokenize(); String answerTokens = tokens.stream() .map(CoreLabel::toString) .collect(Collectors.joining(" ")); sentencesMap.put(answerTokens, doc.getValue()); } } String queryTokens = tokenizerFactory.getTokenizer(new StringReader(args.query)).tokenize().stream() .map(CoreLabel::toString) .collect(Collectors.joining(" ")); scorer.score(queryTokens, sentencesMap); List<ScoredPassage> topPassages = scorer.extractTopPassages(); for (ScoredPassage s: topPassages) { System.out.println(s.getSentence() + " " + s.getScore()); } }
Source:
<code>public void say(String message) { <START> try { <END> new MaryTTS.Speaker(message).start(); } catch (Exception e) { LOG.log(Level.SEVERE, "Impossible to speak for ''{0}''", Freedomotic.getStackTraceInfo(e)); } }</code><technical_language>check if message a valid string</technical_language>

Target:
public void say(String message) { if (!message.isEmpty()) { try { new MaryTTS.Speaker(message).start(); } catch (Exception ex) { LOG.log(Level.SEVERE, "Impossible to speak for ''{0}''", ex); } } else { LOG.log(Level.WARNING, "Impossible to speak. Message is empty"); } }
Source:
<code>public static boolean areApplicabilityTagsInvalid(String wordml, BranchId branch, HashCollection<String, String> validFeatureValues) { Matcher match = FEATURE_CONFIG_PATTERN.matcher(wordml); boolean isFeature = false; String expression = null; while (match.find()) { String plainText = textOnly(match.group()); if (plainText.startsWith("Feature")) { String start = <START> textOnly(match.group(9)); <END> String end = match.group(23); if (end != null) { end = textOnly(end); if (!start.equalsIgnoreCase(end)) { return true; } } isFeature = true; expression = "Feature" + textOnly(match.group(9)); } else if (plainText.startsWith("Configuration")) { String start = textOnly(match.group(38)); String end = match.group(58); if (end != null) { end = textOnly(end); if (!start.equalsIgnoreCase(end)) { return true; } } expression = "Configuration" + textOnly(match.group(38)); } if(isExpressionInvalid(expression, branch, validFeatureValues, isFeature)) { return true; } } return false; }</code><technical_language>this other numbers assigned a constant a meaningful name identify for future maintainability</technical_language>

Target:
public static boolean areApplicabilityTagsInvalid(String wordml, BranchId branch, HashCollection<String, String> validFeatureValues) { Matcher match = FEATURE_CONFIG_PATTERN.matcher(wordml); boolean isFeature = false; String expression = null; while (match.find()) { String plainText = textOnly(match.group()); if (plainText.startsWith("Feature")) { int featStartTagGroup = 9; int featEndTagGroup = 23; String start = textOnly(match.group(featStartTagGroup)); String end = match.group(featEndTagGroup); if (end != null) { end = textOnly(end); if (!start.equalsIgnoreCase(end)) { return true; } } isFeature = true; expression = "Feature" + textOnly(match.group(featStartTagGroup)); } else if (plainText.startsWith("Configuration")) { int configStartTagGroup = 38; int configEndTagGroup = 58; String start = textOnly(match.group(configStartTagGroup)); String end = match.group(configEndTagGroup); if (end != null) { end = textOnly(end); if (!start.equalsIgnoreCase(end)) { return true; } } expression = "Configuration" + textOnly(match.group(configStartTagGroup)); } if (isExpressionInvalid(expression, branch, validFeatureValues, isFeature)) { return true; } } return false; }
Source:
<code>public void preProcess(INDArray array, DistributionStats stats) { if (array.rank() == 2) { <START> array.subiRowVector(stats.getMean()); <END> array.diviRowVector(filteredStd(stats)); } else { Nd4j.getExecutioner().execAndReturn(new BroadcastSubOp(array, stats.getMean(), array, 1)); Nd4j.getExecutioner().execAndReturn(new BroadcastDivOp(array, filteredStd(stats), array, 1)); } }</code><technical_language>here, row vector/column vector explicitly? vector cases handled</technical_language>

Target:
public void preProcess(INDArray array, DistributionStats stats) { if (array.rank() <= 2) { array.subiRowVector(stats.getMean()); array.diviRowVector(filteredStd(stats)); } else { Nd4j.getExecutioner().execAndReturn(new BroadcastSubOp(array, stats.getMean(), array, 1)); Nd4j.getExecutioner().execAndReturn(new BroadcastDivOp(array, filteredStd(stats), array, 1)); } }
Source:
<code>public void shutdown() throws InterruptedException { this.running = false; LOG.info("Shutting down GarbageCollectorThread"); while (!compacting.compareAndSet(false, true)) { <START> wait(1000); <END> } gcExecutor.shutdown(); if (gcExecutor.awaitTermination(60, TimeUnit.SECONDS)) { LOG.warn("GC executor did not shut down in 60 seconds. Killing"); gcExecutor.shutdownNow(); } }</code><technical_language>@govind-menon replace "wait(1000)" a Thread.sleep(100), '100' instead of '1000' lead faster shutdown. sound good</technical_language>

Target:
public void shutdown() throws InterruptedException { this.running = false; LOG.info("Shutting down GarbageCollectorThread"); while (!compacting.compareAndSet(false, true)) { Thread.sleep(100); } gcExecutor.shutdown(); if (gcExecutor.awaitTermination(60, TimeUnit.SECONDS)) { LOG.warn("GC executor did not shut down in 60 seconds. Killing"); gcExecutor.shutdownNow(); } }
Source:
<code>public void setMaxModelMemory(long numBytes) { <START> if (numBytes <= 0) { <END> throw new IllegalArgumentException("[" + MAX_MODEL_MEMORY.getPreferredName() + "] must be positive."); } this.maxModelMemory = numBytes; }</code><technical_language>minimum? A limit of 1 byte sense</technical_language>

Target:
public void setMaxModelMemory(long numBytes) { if (numBytes < MIN_MODEL_MEMORY) { throw new IllegalArgumentException("[" + MAX_MODEL_MEMORY.getPreferredName() + "] must be at least 1mb."); } if (numBytes >= FORECAST_LOCAL_STORAGE_LIMIT.getBytes()) { throw ExceptionsHelper.badRequestException( "[{}] must be less than {}", MAX_MODEL_MEMORY.getPreferredName(), FORECAST_LOCAL_STORAGE_LIMIT.getStringRep()); } this.maxModelMemory = numBytes; }
Source:
<code>void addPart(String name, TypedOutput body) { if (name == null) { throw new NullPointerException("Part name must not be null."); } if (body == null) { throw new NullPointerException("Part body must not be null."); } boolean first = (parts.size() == 0); <START> byte[] part = buildPart(name, body, first); <END> parts.add(part); length += part.length; }</code><technical_language>Replace parts.isEmpty()</technical_language>

Target:
void addPart(String name, TypedOutput body) { if (name == null) { throw new NullPointerException("Part name must not be null."); } if (body == null) { throw new NullPointerException("Part body must not be null."); } byte[] part = buildPart(name, body, parts.isEmpty()); parts.add(part); length += part.length; }
Source:
<code>protected void transfer(IProgressMonitor monitor, Map<String, IProject> projectMapping, List<FileList> missingFiles) throws IOException, SarosCancellationException { try { stoppedLocalEditor = session.getStopManager().stop( session.getLocalUser(), "Read-only while negotiation!"); } catch (InterruptedException e) { log.error("while blocking local editor", e); Thread.currentThread().interrupt(); } for (Entry<String, IProject> entry : projectMapping.entrySet()) { final String projectID = entry.getKey(); final IProject project = entry.getValue(); session.addProjectMapping(projectID, project); } <START> int filesMissing = 0; <END> for (FileList list : missingFiles) filesMissing += list.getPaths().size(); Set<SPath> files = new HashSet<SPath>(filesMissing * 2); for (final FileList list : missingFiles) { IProject project = session.getProject(list.getProjectID()); for (String file : list.getPaths()) { files.add(new SPath(project.getFile(file))); } } awaitActivityQueueingActivation(monitor); activityQueuer = new ResourceActivityQueuer(files); session.registerQueuingHandler(activityQueuer); transmitter.send(ISarosSession.SESSION_CONNECTION_ID, getPeer(), StartActivityQueuingResponse.PROVIDER .create( new StartActivityQueuingResponse(getSessionID(), getID()))); checkCancellation(CancelOption.NOTIFY_PEER); if (filesMissing > 0) receiveStream(monitor, filesMissing); }</code><technical_language>Rename numberOfMissingFiles, missingFileCount that? missingFiles filesMissing (for completely purposes) is a bit confusing</technical_language>

Target:
protected void transfer( IProgressMonitor monitor, Map<String, IProject> projectMapping, List<FileList> missingFiles) throws IOException, SarosCancellationException { for (Entry<String, IProject> entry : projectMapping.entrySet()) { final String projectID = entry.getKey(); final IProject project = entry.getValue(); session.addProjectMapping(projectID, project); } int missingFilesCount = missingFiles.stream().mapToInt(f -> f.getPaths().size()).sum(); Set<SPath> files = new HashSet<>(missingFilesCount * 2); for (FileList list : missingFiles) { IProject project = session.getProject(list.getProjectID()); for (String file : list.getPaths()) { files.add(new SPath(project.getFile(file))); } } awaitActivityQueueingActivation(monitor); activityQueuer.enableQueuing(files); transmitter.send( ISarosSession.SESSION_CONNECTION_ID, getPeer(), StartActivityQueuingResponse.PROVIDER.create( new StartActivityQueuingResponse(getSessionID(), getID()))); checkCancellation(CancelOption.NOTIFY_PEER); if (missingFilesCount > 0) { receiveStream(monitor, missingFilesCount); } }
Source:
<code>protected void resolveLineTagLocations(String sourceName, String... tags) throws IOException { try (BufferedReader reader = new BufferedReader(new FileReader(SOURCE_PATH + sourceName))) { Set<String> tagsToFind = new HashSet<>(Arrays.asList(tags)); String line; int lineNumber = 1; int numberFound = 0; <START> fTagLocations.clear(); <END> line = reader.readLine(); while (line != null) { for (String tag : tagsToFind) { if (line.contains(tag)) { if (fTagLocations.containsKey(tag)) { throw new RuntimeException("Tag " + tag + " was found twice in " + sourceName); } fTagLocations.put(tag, lineNumber); numberFound++; break; } } lineNumber++; line = reader.readLine(); } if (numberFound != tagsToFind.size()) { throw new RuntimeException( "Some tags were not found in " + sourceName); } } }</code><technical_language>cleared here, time change is add locations. numberFound==fTagLocations.size() I this is equal</technical_language>

Target:
protected void resolveLineTagLocations(String sourceName, String... tags) throws IOException { try (BufferedReader reader = new BufferedReader(new FileReader(SOURCE_PATH + sourceName))) { Set<String> tagsToFind = new HashSet<>(Arrays.asList(tags)); String line; int lineNumber = 1; int numberFound = 0; line = reader.readLine(); while (line != null) { for (String tag : tagsToFind) { if (line.contains(tag)) { if (fTagLocations.containsKey(tag)) { throw new RuntimeException("Tag " + tag + " was found twice in " + sourceName); } fTagLocations.put(tag, lineNumber); numberFound++; break; } } lineNumber++; line = reader.readLine(); } if (numberFound != tagsToFind.size()) { throw new RuntimeException( "Some tags were not found in " + sourceName); } } }
Source:
<code>private void addTableToSource(final DatastoreConnection con) { if (con != null) { final Schema defaultSchema = con.getSchemaNavigator().getDefaultSchema(); final int datastoreSize = defaultSchema.getTables().length; <START> if (datastoreSize <= 1) { <END> final Column[] columns = defaultSchema.getTable(0).getColumns(); for (int i = 0; i < columns.length; i++) { if (!_analysisJobBuilder.containsSourceColumn(columns[i])) { _analysisJobBuilder.addSourceColumns(columns); } } } } }</code><technical_language>I call this "tableCount" do a equals 1, encounter schemas tables</technical_language>

Target:
private void addTableToSource(final DatastoreConnection con) { if (con != null) { final Schema defaultSchema = con.getSchemaNavigator().getDefaultSchema(); final int datastoreSize = defaultSchema.getTables().length; if (datastoreSize == 1) { final Column[] columns = defaultSchema.getTable(0).getColumns(); _analysisJobBuilder.addSourceColumns(columns); } } }
Source:
<code>public Status insert(String table, String key, Map<String, ByteIterator> values) { try { user.setUserId(key); for (int i = 0; i < fieldCount; i++) { String field = FIELDS[i + 1]; int fieldIndex = i + 1; String fieldValue = values.get(field).toString(); user.put(fieldIndex, fieldValue); user.setDirty(fieldIndex); } dataStore.put(key, user); } catch (Exception e) { <START> LOG.info("There is a problem inserting data \n"+ e.getMessage(), e); <END> return Status.ERROR; } return Status.OK; }</code><technical_language>Please parameterized logging here</technical_language>

Target:
public Status insert(String table, String key, Map<String, ByteIterator> values) { try { user.setUserId(key); for (int fieldCount = 0; fieldCount < totalFieldCount; fieldCount++) { String field = FIELDS[fieldCount + 1]; int fieldIndex = fieldCount + 1; String fieldValue = values.get(field).toString(); user.put(fieldIndex, fieldValue); user.setDirty(fieldIndex); } dataStore.put(key, user); } catch (Exception e) { LOG.info("There is a problem inserting data \n {}", e.getMessage(), e); return Status.ERROR; } return Status.OK; }