auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void shouldEmphasisText() { assertThat(Markdown.convertToHtml("This is *Sparta !!!*")).isEqualTo("This is <strong>Sparta !!!</strong>"); assertThat(Markdown.convertToHtml("This is *A*")).isEqualTo("This is <strong>A</strong>"); assertThat(Markdown.convertToHtml("This should not be * \n emphasised")).isEqualTo("This should not be * <br/> emphasised"); assertThat(Markdown.convertToHtml("This is *very* very *important*")).isEqualTo("This is <strong>very</strong> very <strong>important</strong>"); <START> assertThat(Markdown.convertToHtml("Not * emphasised * because of whitespaces")).isEqualTo("Not * emphasised * because of whitespaces"); <END> assertThat(Markdown.convertToHtml("Not *emphasised * because of whitespace")).isEqualTo("Not *emphasised * because of whitespace"); assertThat(Markdown.convertToHtml("Not * emphasised* because of whitespace")).isEqualTo("Not * emphasised* because of whitespace"); assertThat(Markdown.convertToHtml("emphasised*inside*word")).isEqualTo("emphasised<strong>inside</strong>word"); assertThat(Markdown.convertToHtml("*Emphasise many words*")).isEqualTo("<strong>Emphasise many words</strong>"); }</code><technical_language>emphasized instead of emphasised</technical_language>

Target:
public void shouldEmphasisText() { assertThat(Markdown.convertToHtml("This is *Sparta !!!*")).isEqualTo("This is <strong>Sparta !!!</strong>"); assertThat(Markdown.convertToHtml("This is *A*")).isEqualTo("This is <strong>A</strong>"); assertThat(Markdown.convertToHtml("This should not be * \n emphasized")).isEqualTo("This should not be * <br/> emphasized"); assertThat(Markdown.convertToHtml("This is *very* very *important*")).isEqualTo("This is <strong>very</strong> very <strong>important</strong>"); assertThat(Markdown.convertToHtml("Not * emphasized * because of whitespaces")).isEqualTo("Not * emphasized * because of whitespaces"); assertThat(Markdown.convertToHtml("Not *emphasized * because of whitespace")).isEqualTo("Not *emphasized * because of whitespace"); assertThat(Markdown.convertToHtml("Not * emphasized* because of whitespace")).isEqualTo("Not * emphasized* because of whitespace"); assertThat(Markdown.convertToHtml("emphasized*inside*word")).isEqualTo("emphasized<strong>inside</strong>word"); assertThat(Markdown.convertToHtml("*Emphasize many words*")).isEqualTo("<strong>Emphasize many words</strong>"); }
Source:
<code>public String getText() { if ("textarea".equals(getWrappedElement().getTagName())) { return getWrappedElement().getText(); } <START> Optional<String> enteredText = Optional.of(getWrappedElement().getAttribute("value")); <END> return enteredText.orElse(""); }</code><technical_language>inlined i</technical_language>

Target:
public String getText() { if ("textarea".equals(getWrappedElement().getTagName())) { return getWrappedElement().getText(); } return Optional.of(getWrappedElement().getAttribute("value")).orElse(""); }
Source:
<code>public void setPatientProgram(PatientProgram patientProgram) { <START> setOwner(new PatientProgram()); <END> }</code><technical_language>intentionally ignore patientProgram parameter</technical_language>

Target:
public void setPatientProgram(PatientProgram patientProgram) { setOwner(patientProgram); }
Source:
<code>public void testSetUser() { Configuration configuration = generateConfiguration(); configuration.setUser("24601", "m@rp.fr", "MM"); <START> assertEquals(User.class, configuration.getUser().getClass()); <END> assertEquals("24601", configuration.getUser().getId()); assertEquals("m@rp.fr", configuration.getUser().getEmail()); assertEquals("MM", configuration.getUser().getName()); }</code><technical_language>This assertion removed test Java type system code</technical_language>

Target:
public void testSetUser() { Configuration configuration = generateConfiguration(); configuration.setUser("24601", "m@rp.fr", "MM"); assertEquals("24601", configuration.getUser().getId()); assertEquals("m@rp.fr", configuration.getUser().getEmail()); assertEquals("MM", configuration.getUser().getName()); }
Source:
<code>public void save() throws IOException { final byte[] out = Constants.encode(toText()); final LockFile lf = new LockFile(getFile()); if (!lf.lock()) throw new IOException("Cannot lock " + getFile()); try { lf.write(out); if (!lf.commit()) throw new IOException("Cannot commit write to " + getFile()); } finally { lf.unlock(); } <START> lastModified = getFile().lastModified(); <END> }</code><technical_language>get this data LockFile. call lf.write above, add this line: lf.setNeedStatInformation(true); lf.commit() successful use: lastModified = lf.getCommitLastModified()</technical_language>

Target:
public void save() throws IOException { final byte[] out = Constants.encode(toText()); final LockFile lf = new LockFile(getFile()); if (!lf.lock()) throw new IOException("Cannot lock " + getFile()); try { lf.setNeedStatInformation(true); lf.write(out); if (!lf.commit()) throw new IOException("Cannot commit write to " + getFile()); } finally { lf.unlock(); } lastModified = lf.getCommitLastModified(); }
Source:
<code><START> public String toString() { <END> StringBuffer labelList = new StringBuffer(); if (labels != null) { for (Label label : labels) { if (labelList.length() != 0) { labelList.append(", "); } labelList.append(label.toString()); } } return status + "[" + labelList + "]"; }</code><technical_language>missing @Override declaration</technical_language>

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append(status); if (status == Status.RULE_ERROR && errorMessage != null) { sb.append('(').append(errorMessage).append(')'); } sb.append('['); if (labels != null) { String delimiter = ""; for (Label label : labels) { sb.append(delimiter).append(label); delimiter = ", "; } } sb.append(']'); return sb.toString(); }
Source:
<code>public void setPrimaryItem(@NonNull ViewGroup container, int position, @NonNull Object object) { Fragment fragment = (Fragment)object; if (fragment != mCurrentPrimaryItem) { if (mCurrentPrimaryItem != null) { mCurrentPrimaryItem.setMenuVisibility(false); if (mResumeOnlyCurrentFragment) { <START> mCurTransaction = mFragmentManager.beginTransaction(); <END> mCurTransaction.setMaxLifecycle(mCurrentPrimaryItem, Lifecycle.State.STARTED); } else { fragment.setUserVisibleHint(false); } } fragment.setMenuVisibility(true); if (mResumeOnlyCurrentFragment) { mCurTransaction.setMaxLifecycle(fragment, Lifecycle.State.RESUMED); } else { fragment.setUserVisibleHint(true); } mCurrentPrimaryItem = fragment; } }</code><technical_language>This needs in == null check</technical_language>

Target:
public void setPrimaryItem(@NonNull ViewGroup container, int position, @NonNull Object object) { Fragment fragment = (Fragment)object; if (fragment != mCurrentPrimaryItem) { if (mCurrentPrimaryItem != null) { mCurrentPrimaryItem.setMenuVisibility(false); if (mResumeOnlyCurrentFragment) { if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); } mCurTransaction.setMaxLifecycle(mCurrentPrimaryItem, Lifecycle.State.STARTED); } else { fragment.setUserVisibleHint(false); } } fragment.setMenuVisibility(true); if (mCurTransaction != null && mResumeOnlyCurrentFragment) { mCurTransaction.setMaxLifecycle(fragment, Lifecycle.State.RESUMED); } else { fragment.setUserVisibleHint(true); } mCurrentPrimaryItem = fragment; } }
Source:
<code>public static void validateFields(Iterable<String> fieldNames) throws FormattedException { Set<String> duplicates = findDuplicates(fieldNames); if (!duplicates.isEmpty()) { throw new FormattedException.Builder() .withErrorCode(FormattedException.ErrorCode.UNPARSABLE_HEADER) .withDetails( new SubErrorHolder( FormattedException.SubErrorCode.DUPLICATE_KEY, fieldNames, duplicates ).get() ) <START> .withMessage(String.format("Duplicate entries founds: %s", duplicates.toString())) <END> .build(); } }</code><technical_language>"founds" bugged :P</technical_language>

Target:
public static void validateFields(Iterable<String> fieldNames) { Set<String> duplicates = findDuplicates(fieldNames); if (!duplicates.isEmpty()) { throw new FormattedException.Builder() .withErrorCode(FormattedException.ErrorCode.UNPARSABLE_HEADER) .withDetails( new SubErrorHolder( FormattedException.SubErrorCode.DUPLICATE_KEY, fieldNames, duplicates ).get() ) .withMessage(String.format("Duplicate entries found: %s", duplicates.toString())) .build(); } }
Source:
<code>public void subscribeServices() { Util.runInBackground(new Runnable() { @Override public void run() { String myIpAddress = null; try { myIpAddress = Util.getIpAddress(context).getHostAddress(); } catch (UnknownHostException e) { e.printStackTrace(); } HttpHost host = new HttpHost(serviceDescription.getIpAddress(), serviceDescription.getPort()); List<Service> serviceList = serviceDescription.getServiceList(); if (serviceList != null) { for (int i = 0; i < serviceList.size(); i++) { String eventSubURL = serviceList.get(i).eventSubURL; <START> if(eventSubURL == null) return; <END> BasicHttpRequest request = new BasicHttpRequest(SUBSCRIBE, eventSubURL); request.setHeader("CALLBACK", "<http://" + myIpAddress + ":" + httpServer.getPort() + eventSubURL + ">"); request.setHeader("NT", "upnp:event"); request.setHeader("TIMEOUT", "Second-" + TIMEOUT); request.setHeader("Connection", "close"); request.setHeader("Content-length", "0"); request.setHeader("USER-AGENT", "Android UPnp/1.1 ConnectSDK"); HttpResponse response = null; try { response = httpClient.execute(host, request); int code = response.getStatusLine().getStatusCode(); if (code == 200) { SIDList.put(serviceList.get(i).serviceType, response.getFirstHeader("SID").getValue()); } response.getEntity().consumeContent(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } } }); resubscribeServices(); }</code><technical_language>I java if(eventSubURL == null) continue; subscribe services null URL</technical_language>

Target:
public void subscribeServices() { Util.runInBackground(new Runnable() { @Override public void run() { String myIpAddress = null; try { myIpAddress = Util.getIpAddress(context).getHostAddress(); } catch (UnknownHostException e) { e.printStackTrace(); } HttpHost host = new HttpHost(serviceDescription.getIpAddress(), serviceDescription.getPort()); List<Service> serviceList = serviceDescription.getServiceList(); if (serviceList != null) { for (int i = 0; i < serviceList.size(); i++) { String eventSubURL = serviceList.get(i).eventSubURL; if(eventSubURL == null) continue; BasicHttpRequest request = new BasicHttpRequest(SUBSCRIBE, eventSubURL); request.setHeader("CALLBACK", "<http://" + myIpAddress + ":" + httpServer.getPort() + eventSubURL + ">"); request.setHeader("NT", "upnp:event"); request.setHeader("TIMEOUT", "Second-" + TIMEOUT); request.setHeader("Connection", "close"); request.setHeader("Content-length", "0"); request.setHeader("USER-AGENT", "Android UPnp/1.1 ConnectSDK"); HttpResponse response = null; try { response = httpClient.execute(host, request); int code = response.getStatusLine().getStatusCode(); if (code == 200) { SIDList.put(serviceList.get(i).serviceType, response.getFirstHeader("SID").getValue()); } response.getEntity().consumeContent(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } } }); resubscribeServices(); }
Source:
<code><START> protected void setActionMessageParameters() { <END> addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ADD); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__USER_PROFILE); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_PROFILE_ALREADY_EXISTS); }</code><technical_language>this method parameters for generic messages, means var-action-x var-type-y is called automatically commandBase, need call specific failure messages added canDoAction in canDoAction have: if (somethingIsWrong) { result = failCanDoAction(msg); } (just a note - 'quick-return' in canDoActions, means issue, return. method more readable (no need ti check of 'result' complicated if-else, a a short one)</technical_language>

Target:
protected void setActionMessageParameters() { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ADD); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__USER_PROFILE); }
Source:
<code>void endSequence() throws IllegalStateException; void startSet(); void endSet() throws IllegalStateException; void startSetOf(); void endSetOf() throws IllegalStateException; void startExplicit(int number); void startExplicit(int clazz, int number); void endExplicit() throws IllegalStateException; void encodeOctetString(String str); void encodeOctetString(byte[] str); void encodeOctetString(ByteStringBuilder str); void encodeIA5String(String str); void encodeIA5String(byte[] str); void encodeIA5String(ByteStringBuilder str); void encodePrintableString(byte[] str); void encodePrintableString(String str); void encodeBitString(byte[] str); void encodeBitString(byte[] str, int numUnusedBits); void encodeBitString(String binaryStr); default void encodeBitString(BigInteger integer) { ByteStringBuilder target = new ByteStringBuilder(); <START> new DEREncoder(target).encode(integer); <END> encodeBitString(target.toArray()); }</code><technical_language>DEREncoder referenced ASN1Encoder - implementation of this method moved DEREncoder</technical_language>

Target:
void endSequence() throws IllegalStateException; void startSet(); void endSet() throws IllegalStateException; void startSetOf(); void endSetOf() throws IllegalStateException; void startExplicit(int number); void startExplicit(int clazz, int number); void endExplicit() throws IllegalStateException; void encodeOctetString(String str); void encodeOctetString(byte[] str); void encodeOctetString(ByteStringBuilder str); void encodeIA5String(String str); void encodeIA5String(byte[] str); void encodeIA5String(ByteStringBuilder str); void encodePrintableString(byte[] str); void encodePrintableString(String str); void encodeBitString(byte[] str); void encodeBitString(byte[] str, int numUnusedBits); void encodeBitString(String binaryStr); void encodeBitString(BigInteger integer); void encodeObjectIdentifier(String objectIdentifier) throws ASN1Exception; void encodeNull(); void encodeImplicit(int number); void encodeImplicit(int clazz, int number); default void encodeInteger(int integer) { encodeInteger(BigInteger.valueOf(integer)); }
Source:
<code>private void onAppComesFromBackground() { AppLog.i(T.UTILS, "App comes from background"); ConnectionChangeReceiver.setEnabled(WordPress.this, true); AnalyticsUtils.refreshMetadata(); mApplicationOpenedDate = new Date(); AnalyticsTracker.track(AnalyticsTracker.Stat.APPLICATION_OPENED); if (NetworkUtils.isNetworkAvailable(mContext)) { if (AccountHelper.isSignedInWordPressDotCom()) { NotificationsUpdateService.startService(getContext()); <START> NotificationsPendingDraftsService.startService(getContext()); <END> } updatePushNotificationTokenIfNotLimited(); sUpdateWordPressComBlogList.runIfNotLimited(); sUpdateCurrentBlogOption.runIfNotLimited(); } sDeleteExpiredStats.runIfNotLimited(); }</code><technical_language>running this service time app foreground. do if a RateLimitedTask, similar, starts service if started time is > 30 minutes so. avoid overload of creating a new service, starting it, etc</technical_language>

Target:
private void onAppComesFromBackground() { AppLog.i(T.UTILS, "App comes from background"); ConnectionChangeReceiver.setEnabled(WordPress.this, true); AnalyticsUtils.refreshMetadata(); mApplicationOpenedDate = new Date(); AnalyticsTracker.track(AnalyticsTracker.Stat.APPLICATION_OPENED); if (NetworkUtils.isNetworkAvailable(mContext)) { if (AccountHelper.isSignedInWordPressDotCom()) { NotificationsUpdateService.startService(getContext()); NotificationsPendingDraftsService.checkPrefsAndStartService(getContext()); } updatePushNotificationTokenIfNotLimited(); sUpdateWordPressComBlogList.runIfNotLimited(); sUpdateCurrentBlogOption.runIfNotLimited(); } sDeleteExpiredStats.runIfNotLimited(); }
Source:
<code>public void send(OpentsdbEvent event) { events.add(event); <START> if (events.size() >= batchSize) { <END> sendEvents(); } }</code><technical_language>good add a limit total number of events queued (suppose send takes a while of network issues lots of events queue in meantime, leading high memory usage)</technical_language>

Target:
public void send(OpentsdbEvent event) { if (!events.offer(event)) { if (countLostEvents.getAndIncrement() % 1000 == 0) { log.error( "Lost total of [%s] events because of emitter queue is full. Please increase the capacity.", countLostEvents.get() ); } } if (events.size() >= batchSize) { sendEvents(); } }
Source:
<code>TxBuilder update(@Nonnull final String tableName, @Nonnull final K key, @Nonnull final V value, @Nullable final M metadata) { Table<K, V, M> table = getTable(tableName); validateNamespace(table); operations.add(() -> { CorfuRecord<V, M> previous = table.get(key); M previousMetadata = Optional.ofNullable(previous) .map(CorfuRecord::getMetadata) .orElseGet(() -> { if (table.getMetadataOptions().isMetadataEnabled()) { return (M) table.getMetadataOptions().getDefaultMetadataInstance(); } return null; }); M newMetadata = null; <START> if (previousMetadata != null) { <END> validateVersion(previousMetadata, metadata); newMetadata = getNewMetadata(previousMetadata, metadata); } table.update(key, value, newMetadata); }); return this; }</code><technical_language>optional</technical_language>

Target:
TxBuilder update(@Nonnull final String tableName, @Nonnull final K key, @Nonnull final V value, @Nullable final M metadata) { Table<K, V, M> table = getTable(tableName); operations.add(() -> { table.update(key, value, metadata); }); return this; }
Source:
<code>public void verifyInstructorPrivileges(AccountAttributes account){ if(isInstructor(account.googleId)) return; <START> throw new UnauthorizedAccessException("User "+account.googleId+" does not have instrcutor privilleges"); <END> }</code><technical_language>typo</technical_language>

Target:
public void verifyInstructorPrivileges(AccountAttributes account){ if(account.isInstructor) { return; } throw new UnauthorizedAccessException("User "+account.googleId+" does not have instructor privilleges"); }
Source:
<code>NatsPollingConsumer(Properties natsProperties, long scanInterval, String name) { this.natsProperties = natsProperties; this.scanInterval = scanInterval; this.name = name; <START> this.subject = natsProperties.getProperty(NatsConstants.SUBJECT); <END> }</code><technical_language>need throw a synapse exception if subject is null</technical_language>

Target:
NatsPollingConsumer(Properties natsProperties, long scanInterval, String name) { this.natsProperties = natsProperties; this.scanInterval = scanInterval; this.name = name; this.subject = natsProperties.getProperty(NatsConstants.SUBJECT); if (subject == null) throw new SynapseException("NATS subject cannot be null."); }
Source:
<code>protected List<String> getClasspath(JBossServer server, IJBossServerRuntime runtime, List<String> currentClasspath) throws CoreException { IVMInstall vmInstall = runtime.getVM(); IRuntimeClasspathEntry modulesEntry = LaunchConfigUtils.getModulesClasspathEntry(server); IRuntimeClasspathEntry jreEntry = LaunchConfigUtils.getJREEntry(vmInstall); String modulesMemento = modulesEntry.getMemento(); <START> String jreMemento = jreEntry.getMemento(); <END> List<String> classpath = new ArrayList<String>(); classpath.addAll(currentClasspath); if( !classpath.contains(modulesMemento)) classpath.add(modulesMemento); if( !classpath.contains(jreMemento)) classpath.add(jreMemento); return classpath; }</code><technical_language>null safe</technical_language>

Target:
protected List<String> getClasspath(JBossServer server, IJBossServerRuntime runtime, List<String> currentClasspath) throws CoreException { IVMInstall vmInstall = runtime.getVM(); IRuntimeClasspathEntry modulesEntry = LaunchConfigUtils.getModulesClasspathEntry(server); IRuntimeClasspathEntry jreEntry = LaunchConfigUtils.getJREEntry(vmInstall); String modulesMemento = modulesEntry == null ? null : modulesEntry.getMemento(); String jreMemento = jreEntry == null ? null : jreEntry.getMemento(); List<String> classpath = new ArrayList<String>(); classpath.addAll(currentClasspath); if( modulesMemento != null && !classpath.contains(modulesMemento)) classpath.add(modulesMemento); if( jreMemento != null && !classpath.contains(jreMemento)) classpath.add(jreMemento); return classpath; }
Source:
<code>private List<PatchSet> getPatchSets29(final String changeInfoId, int reviewId, IProgressMonitor monitor) throws GerritException { List<PatchSet> patchSets = new ArrayList<PatchSet>(); <START> String query = "/changes/?q=" + reviewId + "&o=ALL_REVISIONS"; END> ChangeInfo29[] changeInfo = (ChangeInfo29[]) getChangeInfo29(query, ChangeInfo29[].class, monitor); for (ChangeInfo element : changeInfo) { for (Entry<String, RevisionInfo> revisionInfo : element.getRevisions().entrySet()) { PatchSet.Id patchSetId = new PatchSet.Id(new Change.Id(reviewId), revisionInfo.getValue().getNumber()); patchSets.add(new PatchSet(patchSetId)); } } Collections.sort(patchSets, new Comparator<PatchSet>() { @Override public int compare(PatchSet p1, PatchSet p2) { return p1.getPatchSetId() - p2.getPatchSetId(); } }); return patchSets; }</code><technical_language>I if this is return review number in commit message. In case this is a good change review id is shorter change id, more in other commit messages. pre-2.9 completely more robust</technical_language>

Target:
private List<PatchSet> getPatchSets29(final String changeInfoId, int reviewId, IProgressMonitor monitor) throws GerritException { List<PatchSet> patchSets = new ArrayList<PatchSet>(); String query = "/changes/?q=" + changeInfoId + "+change:" + reviewId + "&o=ALL_REVISIONS"; ChangeInfo29[] changeInfo = (ChangeInfo29[]) getChangeInfo29(query, ChangeInfo29[].class, monitor); for (ChangeInfo element : changeInfo) { for (Entry<String, RevisionInfo> revisionInfo : element.getRevisions().entrySet()) { PatchSet.Id patchSetId = new PatchSet.Id(new Change.Id(reviewId), revisionInfo.getValue().getNumber()); patchSets.add(new PatchSet(patchSetId)); } } Collections.sort(patchSets, new Comparator<PatchSet>() { @Override public int compare(PatchSet p1, PatchSet p2) { return p1.getPatchSetId() - p2.getPatchSetId(); } }); return patchSets; }
Source:
<code>public String doLayout(HttpRequestEvent event) { StringBuilder builder = new StringBuilder(); String contentInterarrivalStats = null; DoubleSummaryStats stats = event.getResponseContentInterarrivalStats(); if (stats != null) { <START> contentInterarrivalStats = format("%.2f, %.2f, %.2f, %d", stats.getMin(), stats.getAverage(), stats.getMax(), stats.getCount()); <END> } builder.append(ISO_FORMATTER.format(event.getTimeStamp())) .append('\t') .append(event.getClientAddress()) .append('\t') .append(event.getStreamId()) .append('\t') .append(event.getProtocolVersion()) .append('\t') .append(event.getMethod()) .append('\t') .append(event.getRequestUri()) .append('\t') .append(event.getUser()) .append('\t') .append(event.getAgent()) .append('\t') .append(event.getResponseCode()) .append('\t') .append(event.getRequestSize()) .append('\t') .append(event.getResponseSize()) .append('\t') .append(event.getBeginToDispatchMillis()) .append('\t') .append(event.getBeginToEndMillis()) .append('\t') .append(event.getFirstToLastContentTimeInMillis()) .append('\t') .append(event.getTimeToLastByte()) .append('\t') .append(event.getTraceToken()) .append('\t') .append(contentInterarrivalStats) .append('\n'); return builder.toString(); }</code><technical_language>PR description this curly brackets values: For example, if response content chunks written HTTP server t=0, t=3, t=20, this field summary statistics for values {3, 17}</technical_language>

Target:
public String doLayout(HttpRequestEvent event) { StringBuilder builder = new StringBuilder(); String contentInterarrivalStats = null; DoubleSummaryStats stats = event.getResponseContentInterarrivalStats(); if (stats != null) { contentInterarrivalStats = format("%.2f, %.2f, %.2f, %d", stats.getMin(), stats.getAverage(), stats.getMax(), stats.getCount()); } builder.append(ISO_FORMATTER.format(event.getTimeStamp())) .append('\t') .append(event.getClientAddress()) .append('\t') .append(event.getMethod()) .append('\t') .append(event.getRequestUri()) .append('\t') .append(event.getUser()) .append('\t') .append(event.getAgent()) .append('\t') .append(event.getResponseCode()) .append('\t') .append(event.getRequestSize()) .append('\t') .append(event.getResponseSize()) .append('\t') .append(event.getTimeToLastByte()) .append('\t') .append(event.getTraceToken()) .append('\t') .append(event.getProtocolVersion()) .append('\t') .append(event.getBeginToDispatchMillis()) .append('\t') .append(event.getBeginToEndMillis()) .append('\t') .append(event.getFirstToLastContentTimeInMillis()) .append('\t') .append(contentInterarrivalStats) .append('\n'); return builder.toString(); }
Source:
<code>public void afterPropertiesSet() { eventBus.register(this); <START> forgedAlliancePreferences = preferencesService.getPreferences().getForgedAlliance(); <END> Vault vault = clientProperties.getVault(); this.mapDownloadUrlFormat = vault.getMapDownloadUrlFormat(); this.mapPreviewUrlFormat = vault.getMapPreviewUrlFormat(); installedSkirmishMaps = FXCollections.observableArrayList(); mapsByFolderName = new HashMap<>(); installedSkirmishMaps.addListener((ListChangeListener<MapBean>) change -> { while (change.next()) { for (MapBean mapBean : change.getRemoved()) { mapsByFolderName.remove(mapBean.getFolderName().toLowerCase()); } for (MapBean mapBean : change.getAddedSubList()) { mapsByFolderName.put(mapBean.getFolderName().toLowerCase(), mapBean); } } }); JavaFxUtil.addListener(forgedAlliancePreferences.pathProperty(), observable -> tryLoadMaps()); JavaFxUtil.addListener(forgedAlliancePreferences.customMapsDirectoryProperty(), observable -> tryLoadMaps()); tryLoadMaps(); }</code><technical_language>constructor</technical_language>

Target:
public void afterPropertiesSet() { eventBus.register(this); JavaFxUtil.addListener(forgedAlliancePreferences.pathProperty(), observable -> tryLoadMaps()); JavaFxUtil.addListener(forgedAlliancePreferences.customMapsDirectoryProperty(), observable -> tryLoadMaps()); tryLoadMaps(); }
Source:
<code>public void testCreate() { Book book = mock(Book.class); DataStoreTransaction tx = mock(DataStoreTransaction.class); when(tx.createNewObject(Book.class)).thenReturn(book); RequestScope scope = new RequestScope(null, null, tx, new User(1), null, getElideSettings(null, dictionary, MOCK_AUDIT_LOGGER)); <START> PersistentResource resource = PersistentResource.createObject(null, Book.class, scope, java.util.Optional.of("uuid")); <END> resource.setValue("title", "should not affect calls since this is create!"); Assert.assertNotNull(resource); scope.runQueuedPreSecurityTriggers(); verify(book, times(1)).onCreateBook(scope); verify(book, times(0)).onDeleteBook(scope); verify(book, times(0)).onUpdateTitle(scope); verify(book, times(1)).preRead(scope); scope.runQueuedPreCommitTriggers(); verify(book, times(1)).preCreateBook(scope); verify(book, times(0)).preDeleteBook(scope); verify(book, times(0)).preUpdateTitle(scope); verify(book, times(1)).preCommitRead(scope); scope.runQueuedPostCommitTriggers(); verify(book, times(1)).postCreateBook(scope); verify(book, times(0)).postDeleteBook(scope); verify(book, times(0)).postUpdateTitle(scope); verify(book, times(1)).postRead(scope); }</code><technical_language>import java.util.Optional</technical_language>

Target:
public void testCreate() { Book book = mock(Book.class); DataStoreTransaction tx = mock(DataStoreTransaction.class); when(tx.createNewObject(Book.class)).thenReturn(book); RequestScope scope = new RequestScope(null, null, tx, new User(1), null, getElideSettings(null, dictionary, MOCK_AUDIT_LOGGER)); PersistentResource resource = PersistentResource.createObject(null, Book.class, scope, Optional.of("uuid")); resource.setValue("title", "should not affect calls since this is create!"); Assert.assertNotNull(resource); scope.runQueuedPreSecurityTriggers(); verify(book, times(1)).onCreateBook(scope); verify(book, times(0)).onDeleteBook(scope); verify(book, times(0)).onUpdateTitle(scope); verify(book, times(1)).preRead(scope); scope.runQueuedPreCommitTriggers(); verify(book, times(1)).preCreateBook(scope); verify(book, times(0)).preDeleteBook(scope); verify(book, times(0)).preUpdateTitle(scope); verify(book, times(1)).preCommitRead(scope); scope.runQueuedPostCommitTriggers(); verify(book, times(1)).postCreateBook(scope); verify(book, times(0)).postDeleteBook(scope); verify(book, times(0)).postUpdateTitle(scope); verify(book, times(1)).postRead(scope); }
Source:
<code>public Integer getCutsRemaining() { <START> Integer cutsConsumed = 0; <END> for (Sample child : getChildren()) { if (child instanceof SampleLCMTube && ((SampleLCMTube) child).getCutsConsumed() != null) { cutsConsumed += ((SampleLCMTube) child).getCutsConsumed(); } } return (getCuts() - getDiscards() - cutsConsumed); }</code><technical_language>This int</technical_language>

Target:
public Integer getCutsRemaining() { int cutsConsumed = 0; for (Sample child : getChildren()) { if (child != null && child instanceof SampleLCMTube && ((SampleLCMTube) child).getCutsConsumed() != null) { cutsConsumed += ((SampleLCMTube) child).getCutsConsumed(); } } return (getCuts() - getDiscards() - cutsConsumed); }
Source:
<code>public void setSeed(long seed) { <START> ObfuscationReflectionHelper.setPrivateValue(WorldInfo.class, this.worldInfo, seed, "randomSeed"); <END> this.rand.setSeed(seed); }</code><technical_language>@bloodmc do want AT's for this prevent errors MC version updates</technical_language>

Target:
public void setSeed(long seed) { this.worldInfo.randomSeed = seed; this.rand.setSeed(seed); }
Source:
<code>protected void doWork(ProductInterface product) throws Exception { <START> long millis = System.currentTimeMillis(); <END> try { worker.doWork(); } catch (Exception e) { System.out.printf("%s: Product %s: EXCEPTION %s (time: %s)%n", Calendar.getInstance().getTime().toString(), product.getName(), e.getMessage(), (System.currentTimeMillis() - millis) / 1000); if (errorCount.incrementAndGet() > MAX_ERRORS) { e.printStackTrace(); throw new BenchmarkException(e); } else { System.err.printf("%s: %s%n", getProductWorker().getName(), e.getMessage()); } } }</code><technical_language>Is this loop</technical_language>

Target:
protected void doWork(ProductInterface product) throws Exception { try { worker.doWork(); } catch (Exception e) { if (errorCount.incrementAndGet() > MAX_ERRORS) { e.printStackTrace(); throw new BenchmarkException(e); } else { System.err.printf("%s: %s%n", getProductWorker().getName(), e.getMessage()); } } }
Source:
<code>public void execute(JobExecutionContext context) throws JobExecutionException { JobDetail jobDetail = context.getJobDetail(); JobDataMap jobDataMap = jobDetail.getJobDataMap(); PopulatorContext pContext = new PopulatorContext(); pContext.setURI((String)jobDataMap.get("xcri.oxcap.populator.uri")); pContext.setUser((String)jobDataMap.get("xcri.oxcap.populator.username")); pContext.setPassword((String)jobDataMap.get("xcri.oxcap.populator.password")); pContext.setName((String)jobDataMap.get("xcri.oxcap.populator.name")); <START> populator.update(pContext); <END> }</code><technical_language>this code a lot in common PopulatorInit, classes merged</technical_language>

Target:
public void execute(JobExecutionContext context) throws JobExecutionException { JobDetail jobDetail = context.getJobDetail(); JobDataMap jobDataMap = jobDetail.getJobDataMap(); PopulatorContext pContext = new PopulatorContext("xcri.oxcap.populator", jobDataMap); populator.update(pContext); }
Source:
<code>private void postDescription(@NonNull String editToken) { descriptionEditCall = new DescriptionEditClient().request(wikiData, pageTitle, editView.getDescription(), editToken, new DescriptionEditClient.Callback() { @Override public void success(@NonNull Call<DescriptionEdit> call) { if (getActivity() != null) { DeviceUtil.hideSoftKeyboard(getActivity()); editView.setSaveState(false); <START> Prefs.setLastDescriptionEditTime(new Date().getTime()); <END> startActivityForResult(DescriptionEditSuccessActivity.newIntent(getContext()), Constants.ACTIVITY_REQUEST_DESCRIPTION_EDIT_SUCCESS); } } @Override public void abusefilter(@NonNull Call<DescriptionEdit> call, String info) { editView.setSaveState(false); editView.setError(info); } @Override public void failure(@NonNull Call<DescriptionEdit> call, @NonNull Throwable caught) { editFailed(caught); } }); }</code><technical_language>I matter consider UTC everywhere. regret UTC millis in nonvolatile storage more regret saved millis in unknown timezone</technical_language>

Target:
private void postDescription(@NonNull String editToken) { descriptionEditCall = new DescriptionEditClient().request(wikiData, pageTitle, editView.getDescription(), editToken, new DescriptionEditClient.Callback() { @Override public void success(@NonNull Call<DescriptionEdit> call) { Prefs.setLastDescriptionEditTime(new Date().getTime()); WikipediaApp.getInstance().listenForNotifications(); if (getActivity() != null) { DeviceUtil.hideSoftKeyboard(getActivity()); editView.setSaveState(false); startActivityForResult(DescriptionEditSuccessActivity.newIntent(getContext()), Constants.ACTIVITY_REQUEST_DESCRIPTION_EDIT_SUCCESS); } } @Override public void abusefilter(@NonNull Call<DescriptionEdit> call, String info) { editView.setSaveState(false); editView.setError(info); } @Override public void failure(@NonNull Call<DescriptionEdit> call, @NonNull Throwable caught) { editFailed(caught); } }); }
Source:
<code>public void emtpyInputEmptyOutputTest() { Dominoes dominoes = new Dominoes(); ArrayList<Domino> dominoesArray = new ArrayList<>(); ArrayList<Domino> chain = dominoes.formChain(dominoesArray); <START> assertNull(chain); <END> }</code><technical_language>tests match [canonical data](<LINK_0> tests check a canChain method return a boolean</technical_language>

Target:
public void emtpyInputEmptyOutputTest() throws ChainNotFoundException { Dominoes dominoes = new Dominoes(); List<Domino> dominoesList = new ArrayList<>(); List<Domino> chain = dominoes.formChain(dominoesList); assertEquals("The output list should be empty.", 0, chain.size()); }
Source:
<code>void retrieveLoop() { try { while (!nodesQueue.isEmpty() || !pendingNodes.isEmpty()) { try { processTimeouts(); while (requestNextNodes(REQUEST_MAX_NODES)) ; synchronized (this) { wait(10); } <START> regularTask(); <END> } catch (InterruptedException e) { throw e; } catch (Throwable t) { logger.error("Error", t); } } } catch (InterruptedException e) { logger.warn("Main fast sync loop was interrupted", e); } }</code><technical_language>commit 100 nodes e.g. (it costs effectively nothing) prevent write buffer overflow running extremely mem (write buf size is e.g. 1M). more effective commit FastSyncDBWriter thread DB flush synchronously</technical_language>

Target:
void retrieveLoop() { try { while (!nodesQueue.isEmpty() || !pendingNodes.isEmpty()) { try { processTimeouts(); while (requestNextNodes(REQUEST_MAX_NODES)) ; synchronized (this) { wait(10); } logStat(); } catch (InterruptedException e) { throw e; } catch (Throwable t) { logger.error("Error", t); } } } catch (InterruptedException e) { logger.warn("Main fast sync loop was interrupted", e); } }
Source:
<code>public int hashCode() { <START> return 47 + index.hashCode(); <END> }</code><technical_language>nit: This a problem, good follow a common hash code equation. hashCode = field1.hashCode * prime^0 + field2.hashCode * prime^1 + field3.hashCode * prime^2 ..</technical_language>

Target:
public int hashCode() { return index.hashCode(); }
Source:
<code><START> protected void executeQueryCommand() { <END> getQueryReturnValue().setReturnValue(DbFacade.getInstance() .getVdsGroupDAO() .getAll(getUserID(), getParameters().isFiltered())); }</code><technical_language>Please getDbFacade()</technical_language>

Target:
protected void executeQueryCommand() { getQueryReturnValue().setReturnValue(getDbFacade() .getVdsGroupDAO() .getAll(getUserID(), getParameters().isFiltered())); }
Source:
<code>public boolean updatePostContentNewEditor(boolean isAutoSave, String title, String content) { if (mPost == null) { return false; } if (!isAutoSave) { } boolean titleChanged = PostUtils.updatePostTitleIfDifferent(mPost, title); boolean contentChanged = true; if (mEditorFragment instanceof AztecEditorFragment) { contentChanged = ((AztecEditorFragment)mEditorFragment).hasHistory(); } if (contentChanged) { <START> contentChanged = PostUtils.updatePostContentIfDifferent(mPost, content); <END> } if (!mPost.isLocalDraft() && (titleChanged || contentChanged)) { mPost.setIsLocallyChanged(true); mPost.setDateLocallyChanged(DateTimeUtils.iso8601FromTimestamp(System.currentTimeMillis() / 1000)); } return titleChanged || contentChanged; }</code><technical_language>Yeah, I asking history - if disabled, changes saved. Adding check necessary I feel safer :)</technical_language>

Target:
public boolean updatePostContentNewEditor(boolean isAutoSave, String title, String content) { if (mPost == null) { return false; } if (!isAutoSave) { } boolean titleChanged = PostUtils.updatePostTitleIfDifferent(mPost, title); boolean contentChanged; if (mEditorFragment instanceof AztecEditorFragment) { contentChanged = ((AztecEditorFragment)mEditorFragment).hasHistory(); if (contentChanged) { mPost.setContent(content); } else if (!((AztecEditorFragment)mEditorFragment).isHistoryEnabled()){ contentChanged = PostUtils.updatePostContentIfDifferent(mPost, content); } } else { contentChanged = PostUtils.updatePostContentIfDifferent(mPost, content); } if (!mPost.isLocalDraft() && (titleChanged || contentChanged)) { mPost.setIsLocallyChanged(true); mPost.setDateLocallyChanged(DateTimeUtils.iso8601FromTimestamp(System.currentTimeMillis() / 1000)); } return titleChanged || contentChanged; }
Source:
<code>public void release() { <START> if (toClose.size() > 0) <END> for (InputStream content = toClose.remove(0); toClose.size() > 0; content = toClose.remove(0)) closeQuietly(content); }</code><technical_language>!toClose.isEmpty()</technical_language>

Target:
public void release() { closeQuietly(closer); }
Source:
<code>public boolean canExecute(ITmfTrace trace) { if (!(trace instanceof LttngUstTrace)) { return false; } LttngUstTrace ustTrace = (LttngUstTrace) trace; <START> if (!"lttng-ust".equals(ustTrace.getTracerName())) { END> return false; } if (ustTrace.getTracerMajorVersion() < 2) { return false; } if (ustTrace.getTracerMajorVersion() == 2 && ustTrace.getTracerMinorVersion() < 8) { return false; } return super.canExecute(trace); }</code><technical_language>extract cte</technical_language>

Target:
public boolean canExecute(ITmfTrace trace) { if (!(trace instanceof LttngUstTrace)) { return false; } LttngUstTrace ustTrace = (LttngUstTrace) trace; String tracerName = CtfUtils.getTracerName(ustTrace); int majorVersion = CtfUtils.getTracerMajorVersion(ustTrace); int minorVersion = CtfUtils.getTracerMinorVersion(ustTrace); if (!LttngUstTrace.TRACER_NAME.equals(tracerName)) { return false; } if (majorVersion < 2) { return false; } if (majorVersion == 2 && minorVersion < 8) { return false; } return super.canExecute(trace); }
Source:
<code>public static char[] convert(String value) throws FieldConvertError { <START> if (!value.matches(CHAR_ARRAY_REGEX)) { <END> throw new FieldConvertError("invalid char array value: " + value); } String[] split = value.split(" "); char[] chars = new char[split.length]; for (int i = 0; i < split.length; i++) { chars[i] = split[i].charAt(0); } return chars; }</code><technical_language>a Matcher re-use Pattern. OTOH this thread-safe anymore need synchronization ThreadLocal. worth changed</technical_language>

Target:
public static char[] convert(String value) throws FieldConvertError { if (!value.matches(CHAR_ARRAY_REGEX)) { throw new FieldConvertError("invalid char array: " + Arrays.toString(value.getBytes())); } String[] split = value.split(" "); char[] chars = new char[split.length]; for (int i = 0; i < split.length; i++) { chars[i] = split[i].charAt(0); } return chars; }
Source:
<code>public ServiceResponse<List<NoteItem>> retrieveNoteItems(int encounterId) { ServiceResponse<List<NoteItem>> response = new ServiceResponse<>(); List<NoteItem> noteItems = new ArrayList<>(); Query<PatientEncounterTabField> query = QueryProvider.getPatientEncounterTabFieldQuery() .fetch("tabField") .where() .isNull("IsDeleted") .eq("patient_encounter_id", encounterId) .eq("tabField.name", "pharmacy_note") .order() .desc("date_taken"); try { List<? extends IPatientEncounterTabField> patientEncounterTreatmentFields = patientEncounterTabFieldRepository.find(query); if (patientEncounterTreatmentFields == null) { response.addError("", "bad query"); } else { <START> for (IPatientEncounterTabField petf : patientEncounterTreatmentFields) { <END> if (petf.getTabField() != null) noteItems.add(itemModelMapper.createNoteItem(petf.getTabFieldValue(),petf.getDateTaken(),userRepository.retrieveUserById(petf.getUserId()).getLastName() + ", " + userRepository.retrieveUserById(petf.getUserId()).getFirstName())); break; } response.setResponseObject(noteItems); } } catch (Exception ex) { response.addError("", "error"); } return response; }</code><technical_language>@stevecarp for loop need exist date exists top of List (you need iterate anything, a for loop is for). pull element a java list instead</technical_language>

Target:
public ServiceResponse<List<NoteItem>> retrieveNoteItems(int encounterId) { ServiceResponse<List<NoteItem>> response = new ServiceResponse<>(); List<NoteItem> noteItems = new ArrayList<>(); Query<PatientEncounterTabField> query = QueryProvider.getPatientEncounterTabFieldQuery() .fetch("tabField") .where() .isNull("IsDeleted") .eq("patient_encounter_id", encounterId) .eq("tabField.name", "pharmacy_note") .order() .desc("date_taken"); try { List<? extends IPatientEncounterTabField> patientEncounterTreatmentFields = patientEncounterTabFieldRepository.find(query); if (patientEncounterTreatmentFields == null) { response.addError("", "bad query"); } else { if(!patientEncounterTreatmentFields.isEmpty()) { IPatientEncounterTabField petf = patientEncounterTreatmentFields.get(0); noteItems.add(itemModelMapper.createNoteItem(petf.getTabFieldValue(), petf.getDateTaken(), userRepository.retrieveUserById(petf.getUserId()).getLastName() + ", " + userRepository.retrieveUserById(petf.getUserId()).getFirstName())); } response.setResponseObject(noteItems); } } catch (Exception ex) { response.addError("", "error"); } return response; }
Source:
<code>public void test(TestHarness th) { long totalMemory = Runtime.getRuntime().totalMemory(); long freeMemory = Runtime.getRuntime().freeMemory(); System.out.println("freeMemory1: " + Runtime.getRuntime().freeMemory()); th.check(totalMemory > freeMemory, "Total memory is strictly greater than free memory"); th.check(freeMemory > 0, "Free memory is strictly greater than 0"); for (int i = 0; i < 1000; i++) { long[] array = new long[100000]; } System.out.println("freeMemory2: " + Runtime.getRuntime().freeMemory()); th.check(totalMemory, Runtime.getRuntime().totalMemory(), "Total memory doesn't change"); <START> th.check(freeMemory > Runtime.getRuntime().freeMemory(), "Free memory decreases after allocating some objects"); <END> freeMemory = Runtime.getRuntime().freeMemory(); Runtime.getRuntime().gc(); System.out.println("freeMemory3: " + Runtime.getRuntime().freeMemory()); th.check(freeMemory < Runtime.getRuntime().freeMemory(), "Free memory increases after a collection"); }</code><technical_language>_array_ is out of scope this assertion, memory collected already? If so, this necessarily check _array_ allocation decreases free memory. I put assertion in a block allocation: Java { long[] array = new long[100000]; th.check(freeMemory > Runtime.getRuntime().freeMemory(), "Free memory decreases allocating some objects"); } (Unsure if need allocate repeatedly, if so, block existing _for_ loop, in case assertion run for iteration of loop.)</technical_language>

Target:
public void test(TestHarness th) { long totalMemory = Runtime.getRuntime().totalMemory(); long freeMemory = Runtime.getRuntime().freeMemory(); System.out.println("freeMemory1: " + Runtime.getRuntime().freeMemory()); th.check(totalMemory > freeMemory, "Total memory is strictly greater than free memory"); th.check(freeMemory > 0, "Free memory is strictly greater than 0"); long[] array = new long[1048576]; System.out.println("freeMemory2: " + Runtime.getRuntime().freeMemory()); th.check(totalMemory, Runtime.getRuntime().totalMemory(), "Total memory doesn't change"); th.check(freeMemory > Runtime.getRuntime().freeMemory(), "Free memory decreases after allocating some objects"); freeMemory = Runtime.getRuntime().freeMemory(); array = null; Runtime.getRuntime().gc(); System.out.println("freeMemory3: " + Runtime.getRuntime().freeMemory()); th.check(freeMemory < Runtime.getRuntime().freeMemory(), "Free memory increases after a collection"); }
Source:
<code>public Collection<RegisteredService> load() { LOGGER.trace("Loading services from [{}]", serviceRegistry.getName()); this.services.putAll(this.serviceRegistry.load() .stream() .collect(Collectors.toMap(r -> { <START> LOGGER.debug("Adding registered service with name and internal identifier [{}]", <END> r.getServiceId(), r.getName(), r.getId()); return r.getId(); }, Function.identity(), (r, s) -> s))); loadInternal(); publishEvent(new CasRegisteredServicesLoadedEvent(this, getAllServices())); evaluateExpiredServiceDefinitions(); LOGGER.info("Loaded service(s) from [{}].", this.services.asMap().size(), this.serviceRegistry.getName()); return services.asMap().values(); }</code><technical_language>suggestion LOGGER.trace("Adding registered service name internal identifier [{}]",</technical_language>

Target:
public Collection<RegisteredService> load() { LOGGER.trace("Loading services from [{}]", serviceRegistry.getName()); this.services.putAll(this.serviceRegistry.load() .stream() .collect(Collectors.toMap(r -> { LOGGER.trace("Adding registered service with name and internal identifier [{}]", r.getServiceId(), r.getName(), r.getId()); return r.getId(); }, Function.identity(), (r, s) -> s))); loadInternal(); publishEvent(new CasRegisteredServicesLoadedEvent(this, getAllServices())); evaluateExpiredServiceDefinitions(); LOGGER.info("Loaded service(s) from [{}].", this.services.asMap().size(), this.serviceRegistry.getName()); return services.asMap().values(); }