auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean visit(IResource resource) throws CoreException { IPath path = resource.getFullPath(); if(resource instanceof IFile) { if(visited.contains(path)) { return false; } visited.add(path); IFile f = (IFile)resource; for (int i = 0; i < outs.length; i++) { if(outs[i].isPrefixOf(path)) { return false; } } for (int i = 0; i < srcs.length; i++) { if(batch_jobs[i].isPrefixOf(path)) { <START> if(f.getName().endsWith(".xml")) { <END> fileSet.addBatchJob(f); } } else if(srcs[i].isPrefixOf(path)) { if(f.getName().endsWith(".java")) { ICompilationUnit unit = EclipseUtil.getCompilationUnit(f); if(unit != null) { fileSet.add(f.getFullPath(), unit.getTypes()); } } Set<IFile> ds = getDependentFiles(path, visited); if(ds != null) for (IFile d: ds) visit(d); return false; } } Set<IFile> ds = getDependentFiles(path, visited); if(ds != null) for (IFile d: ds) visit(d); } if(resource instanceof IFolder) { for (int i = 0; i < outs.length; i++) { if(outs[i].isPrefixOf(path)) { return false; } } for (int i = 0; i < srcs.length; i++) { if(srcs[i].isPrefixOf(path) || path.isPrefixOf(srcs[i])) { return true; } } if(resource == resource.getProject()) { return true; } return false; } return true; }</code><technical_language>case sensitive in a lines (see ".java")</technical_language>

Target:
public boolean visit(IResource resource) throws CoreException { IPath path = resource.getFullPath(); if(resource instanceof IFile) { if(visited.contains(path)) { return false; } visited.add(path); IFile f = (IFile)resource; for (int i = 0; i < outs.length; i++) { if(outs[i].isPrefixOf(path)) { return false; } } for (int i = 0; i < srcs.length; i++) { if(batch_jobs[i].isPrefixOf(path)) { if(f.getName().toLowerCase().endsWith(".xml")) { fileSet.addBatchJob(f); } } else if(srcs[i].isPrefixOf(path)) { if(f.getName().toLowerCase().endsWith(".java")) { ICompilationUnit unit = EclipseUtil.getCompilationUnit(f); if(unit != null) { fileSet.add(f.getFullPath(), unit.getTypes()); } } Set<IFile> ds = getDependentFiles(path, visited); if(ds != null) for (IFile d: ds) visit(d); return false; } } Set<IFile> ds = getDependentFiles(path, visited); if(ds != null) for (IFile d: ds) visit(d); } else if(resource instanceof IFolder) { for (int i = 0; i < outs.length; i++) { if(outs[i].isPrefixOf(path)) { return false; } } for (int i = 0; i < srcs.length; i++) { if(srcs[i].isPrefixOf(path) || path.isPrefixOf(srcs[i])) { return true; } } if(resource == resource.getProject()) { return true; } return false; } return true; }
Source:
<code>private void onInvalidHeartbeat(MembersViewMetadata senderMembersViewMetadata) { Address senderAddress = senderMembersViewMetadata.getMemberAddress(); if (clusterService.isMaster()) { if (!clusterService.getClusterJoinManager().isMastershipClaimInProgress()) { logger.fine("Sending explicit suspicion to " + senderAddress + " for heartbeat " + senderMembersViewMetadata + ", because it is not a member of this cluster" + " or its heartbeat cannot be validated!"); clusterService.sendExplicitSuspicion(senderMembersViewMetadata); } } else { <START> MemberImpl master = clusterService.getMember(clusterService.getMasterAddress()); <END> if (clusterService.getMembershipManager().isMemberSuspected(master.getAddress(), master.getUuid())) { logger.fine("Not sending heartbeat complaint for " + senderMembersViewMetadata + " to suspected master: " + master.getAddress()); return; } logger.fine("Sending heartbeat complaint to master " + master.getAddress() + " for heartbeat " + senderMembersViewMetadata + ", because it is not a member of this cluster" + " or its heartbeat cannot be validated!"); sendHeartbeatComplaintToMaster(senderMembersViewMetadata); } }</code><technical_language>Is legitimate null master here? if yes, this change lead NPE</technical_language>

Target:
private void onInvalidHeartbeat(MembersViewMetadata senderMembersViewMetadata) { Address senderAddress = senderMembersViewMetadata.getMemberAddress(); if (clusterService.isMaster()) { if (!clusterService.getClusterJoinManager().isMastershipClaimInProgress()) { logger.fine("Sending explicit suspicion to " + senderAddress + " for heartbeat " + senderMembersViewMetadata + ", because it is not a member of this cluster" + " or its heartbeat cannot be validated!"); clusterService.sendExplicitSuspicion(senderMembersViewMetadata); } } else { MemberImpl master = clusterService.getMember(clusterService.getMasterAddress()); if (clusterService.getMembershipManager().isMemberSuspected(master)) { logger.fine("Not sending heartbeat complaint for " + senderMembersViewMetadata + " to suspected master: " + master.getAddress()); return; } logger.fine("Sending heartbeat complaint to master " + master.getAddress() + " for heartbeat " + senderMembersViewMetadata + ", because it is not a member of this cluster" + " or its heartbeat cannot be validated!"); sendHeartbeatComplaintToMaster(senderMembersViewMetadata); } }
Source:
<code>public boolean isActivated() { JenkinsLocationConfiguration loc = JenkinsLocationConfiguration.get(); <START> return loc == null || loc.getUrl() == null; <END> }</code><technical_language>#2935 forces null check (so #3021 save here), if _is_ null, do Jenkins started anyway. java return loc != null && loc.getUrl() == null;</technical_language>

Target:
public boolean isActivated() { JenkinsLocationConfiguration loc = JenkinsLocationConfiguration.get(); return loc != null && ( loc.getUrl() == null || !UrlHelper.isValidRootUrl(loc.getUrl()) ); }
Source:
<code>public double getTitleFontSize() { <START> return 0; <END> }</code><technical_language>applies, titles allowed for connectors, fault sorry, try fix plz</technical_language>

Target:
public double getTitleFontSize() { return label.isPresent() ? label.get().getText().getFontSize() : 0; }
Source:
<code>public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_sort: <START> ReadingListsSortBottomSheetPresenter dialogFragment = new ReadingListsSortBottomSheetPresenter(); <END> dialogFragment.show(getChildFragmentManager(), SortReadingListsDialog.newInstance(this::sortListsBy, Prefs.getReadingListSortMode(ReadingList.SORT_BY_NAME_ASC))); return true; case R.id.create_list: String title = getString(R.string.reading_list_name_sample); List<String> existingTitles = new ArrayList<>(); for (ReadingList tempList : readingLists) { existingTitles.add(tempList.title()); } ReadingListTitleDialog.readingListTitleDialog(getContext(), title, existingTitles, text -> { ReadingList list = ReadingListDbHelper.instance().createList(text.toString(), ""); readingLists.add(list); readingListView.getAdapter().notifyDataSetChanged(); updateEmptyState(null); readingListView.smoothScrollToPosition(readingLists.size() - 1); }).show(); return true; case R.id.menu_search_lists: ((AppCompatActivity) getActivity()) .startSupportActionMode(searchActionModeCallback); return true; default: return super.onOptionsItemSelected(item); } }</code><technical_language>This proper usage of "presenter" pattern. For a simple example, NewsFragment usage of ExclusiveBottomSheetPresenter</technical_language>

Target:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_sort: ExclusiveBottomSheetPresenter bottomSheetPresenter = new ExclusiveBottomSheetPresenter(); bottomSheetPresenter.show(getChildFragmentManager(), SortReadingListsDialog.newInstance(Prefs.getReadingListSortMode(ReadingList.SORT_BY_NAME_ASC))); return true; case R.id.create_list: String title = getString(R.string.reading_list_name_sample); List<String> existingTitles = new ArrayList<>(); for (ReadingList tempList : readingLists) { existingTitles.add(tempList.title()); } ReadingListTitleDialog.readingListTitleDialog(getContext(), title, existingTitles, text -> { ReadingList list = ReadingListDbHelper.instance().createList(text.toString(), ""); readingLists.add(list); readingListView.getAdapter().notifyDataSetChanged(); updateEmptyState(null); readingListView.smoothScrollToPosition(readingLists.size() - 1); }).show(); return true; case R.id.menu_search_lists: ((AppCompatActivity) getActivity()) .startSupportActionMode(searchActionModeCallback); return true; default: return super.onOptionsItemSelected(item); } }
Source:
<code>public void acceptQuery(UUID queryId, Principal user, Map<String, String> headers, String apiVer, String apiQuery) { <START> synchronized (this) { <END> long start = System.currentTimeMillis(); startTime.put(queryId, start); } log.info("Accepted Query with RequestId: " + queryId + " User: " + user + " ApiVersion: " + apiVer + " ApiQuery: " + apiQuery); }</code><technical_language>I need sychronized blocks (the concurrent hash map is good enough)</technical_language>

Target:
public void acceptQuery(UUID queryId, Principal user, Map<String, String> headers, String apiVer, String apiQuery) { long start = System.currentTimeMillis(); log.debug("Accepted Query with RequestId: " + queryId + " User: " + user + " ApiVersion: " + apiVer + " ApiQuery: " + apiQuery + ". Start Time " + start); }
Source:
<code>public ConsolePreferencesPane(UserPrefs prefs, Session session, PreferencesDialogResources res) { prefs_ = prefs; res_ = res; add(headerLabel("Display")); add(checkboxPref("Show syntax highlighting in console input", prefs_.syntaxColorConsole())); add(checkboxPref("Different color for error or message output (requires restart)", prefs_.highlightConsoleErrors())); NumericValueWidget limitLengthPref = numericPref("Limit length of lines to:", prefs_.consoleLineLengthLimit()); add(nudgeRightPlus(limitLengthPref)); consoleColorMode_ = new SelectWidget( "ANSI Escape Codes:", new String[] { "Show ANSI colors", "Remove ANSI codes", "Ignore ANSI codes (1.0 behavior)" }, new String[] { UserPrefs.ANSI_CONSOLE_MODE_ON, UserPrefs.ANSI_CONSOLE_MODE_STRIP, UserPrefs.ANSI_CONSOLE_MODE_OFF }, false, true, false); add(consoleColorMode_); <START> if (session.getSessionInfo().getHaveSrcrefAttribute()) <END> { Label debuggingLabel = headerLabel("Debugging"); spacedBefore(debuggingLabel); add(debuggingLabel); add(spaced(checkboxPref( "Automatically expand tracebacks in error inspector", prefs_.autoExpandErrorTracebacks(), true ))); } Label otherLabel = headerLabel("Other"); spacedBefore(otherLabel); add(otherLabel); add(spaced(checkboxPref("Double-click to select words", prefs_.consoleDoubleClickSelect()))); }</code><technical_language>touching this code anyway, get rid of this check (and of underlying machinery feel like). longer support R versions source references</technical_language>

Target:
public ConsolePreferencesPane(UserPrefs prefs, Session session, PreferencesDialogResources res) { prefs_ = prefs; res_ = res; add(headerLabel("Display")); add(checkboxPref("Show syntax highlighting in console input", prefs_.syntaxColorConsole())); add(checkboxPref("Different color for error or message output (requires restart)", prefs_.highlightConsoleErrors())); NumericValueWidget limitLengthPref = numericPref("Limit output line length to:", prefs_.consoleLineLengthLimit()); add(nudgeRightPlus(limitLengthPref)); consoleColorMode_ = new SelectWidget( "ANSI Escape Codes:", new String[] { "Show ANSI colors", "Remove ANSI codes", "Ignore ANSI codes (1.0 behavior)" }, new String[] { UserPrefs.ANSI_CONSOLE_MODE_ON, UserPrefs.ANSI_CONSOLE_MODE_STRIP, UserPrefs.ANSI_CONSOLE_MODE_OFF }, false, true, false); add(consoleColorMode_); Label debuggingLabel = headerLabel("Debugging"); spacedBefore(debuggingLabel); add(debuggingLabel); add(spaced(checkboxPref( "Automatically expand tracebacks in error inspector", prefs_.autoExpandErrorTracebacks(), true ))); Label otherLabel = headerLabel("Other"); spacedBefore(otherLabel); add(otherLabel); add(spaced(checkboxPref("Double-click to select words", prefs_.consoleDoubleClickSelect()))); }
Source:
<code>private void <START> checkSerialVersionUID(long <END> expectedSUID, Class<?> clazz) { assertEquals(expectedSUID, ObjectStreamClass.lookup(clazz).getSerialVersionUID()); }</code><technical_language>static, move bottom named helper method</technical_language>

Target:
private static void checkSerialVersionUID(long expectedSUID, Class<?> clazz) { assertEquals(expectedSUID, ObjectStreamClass.lookup(clazz).getSerialVersionUID()); }
Source:
<code>public boolean containsAll(@Nullable Collection<?> c) { if (c == null) { <START> throw new IllegalArgumentException(); <END> } fLock.readLock().lock(); try { for (Object elem : c) { if (!this.contains(elem)) { return false; } } return true; } finally { fLock.readLock().unlock(); } }</code><technical_language>return false</technical_language>

Target:
public boolean containsAll(@Nullable Collection<?> c) { fLock.readLock().lock(); try { return fStartTimesIndex.values().containsAll(c); } finally { fLock.readLock().unlock(); } }
Source:
<code>public boolean evaluate(final HttpServletRequest request, final HttpServletResponse response, final Instance instance) { boolean result; try { final Optional<Visitor> opt = visitorAPI.getVisitor(request); if(opt.isPresent()) { final User user = userAPI.getSystemUser(); final PageMode pageMode = PageMode.get(request); final Persona persona = pageMode.showLive? <START> personaAPI.findLive(instance.personaId, user, false): <END> personaAPI.find(instance.personaId, user, false); if(persona == null) { Logger.warn(PersonaActionlet.class, "Persona with id '" + instance.personaId + "' not be found. Could not execute action."); result = false; } else { opt.get().setPersona(persona); result = true; } } else { Logger.warn(PersonaActionlet.class, "No visitor was available on which to set a persona. Could not execute action."); result = false; } } catch (Exception e) { throw new RuleEvaluationFailedException(e, "Could not evaluate action %s", this.getClass().getName()); } return result; }</code><technical_language>personaAPI.findLive(instance.personaId, user, pageMode.respectAnonPerms):</technical_language>

Target:
public boolean evaluate(final HttpServletRequest request, final HttpServletResponse response, final Instance instance) { boolean result; try { final Optional<Visitor> opt = visitorAPI.getVisitor(request); if(opt.isPresent()) { final User user = userAPI.getSystemUser(); final PageMode pageMode = PageMode.get(request); final Persona persona = pageMode.showLive? personaAPI.findLive(instance.personaId, user, pageMode.respectAnonPerms): personaAPI.find(instance.personaId, user, pageMode.respectAnonPerms); if(persona == null) { Logger.warn(PersonaActionlet.class, "Persona with id '" + instance.personaId + "' not be found. Could not execute action."); result = false; } else { opt.get().setPersona(persona); result = true; } } else { Logger.warn(PersonaActionlet.class, "No visitor was available on which to set a persona. Could not execute action."); result = false; } } catch (Exception e) { throw new RuleEvaluationFailedException(e, "Could not evaluate action %s", this.getClass().getName()); } return result; }
Source:
<code>public synchronized void commit() throws IOException { if (logStream != null) { logStream.flush(); } for (FileOutputStream log : streamsToFlush) { log.flush(); if (forceSync) { long startSyncNS = System.nanoTime(); FileChannel channel = log.getChannel(); channel.force(false); syncElapsedMS = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startSyncNS); if (syncElapsedMS > fsyncWarningThresholdMS) { LOG.warn("fsync-ing the write ahead log (" <START> + channel.size() + " bytes) in " <END> + Thread.currentThread().getName() + " took " + syncElapsedMS + "ms which will adversely effect operation latency. " + "See the ZooKeeper troubleshooting guide"); } } } while (streamsToFlush.size() > 1) { streamsToFlush.removeFirst().close(); } }</code><technical_language>@asdf2014 move changed text sentence? ... latency. File size is ### bytes. ... reason I a number of users log triggers this log message minimize impact possible</technical_language>

Target:
public synchronized void commit() throws IOException { if (logStream != null) { logStream.flush(); } for (FileOutputStream log : streamsToFlush) { log.flush(); if (forceSync) { long startSyncNS = System.nanoTime(); FileChannel channel = log.getChannel(); channel.force(false); syncElapsedMS = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startSyncNS); if (syncElapsedMS > fsyncWarningThresholdMS) { LOG.warn("fsync-ing the write ahead log in " + Thread.currentThread().getName() + " took " + syncElapsedMS + "ms which will adversely effect operation latency. " + "File size is " + channel.size() + " bytes. " + "See the ZooKeeper troubleshooting guide"); } } } while (streamsToFlush.size() > 1) { streamsToFlush.removeFirst().close(); } }
Source:
<code>public List<ClusterNode> mapKeyToPrimaryAndBackupsList(K key) { <START> ctx.gateway().readLock(); <END> try { AffinityInfo aff = cache(); return aff.assignment().get(GridAffinityProcessor.this.partition(cacheName, key, aff)); } catch (IgniteCheckedException e) { throw new IgniteException(e); } finally { ctx.gateway().readUnlock(); } }</code><technical_language>reason copy-paste implementation mapKeyToPrimaryAndBackups</technical_language>

Target:
@Override public List<ClusterNode> mapKeyToPrimaryAndBackupsList(K key) { ctx.gateway().readLock(); try { AffinityInfo aff = cache(); return aff.assignment().get(GridAffinityProcessor.this.partition(cacheName, key, aff)); } catch (IgniteCheckedException e) { throw new IgniteException(e); } finally { ctx.gateway().readUnlock(); } }
Source:
<code>public Response validateV2SnapshotByDate( @PathParam("daterange") String daterange, @DefaultValue("false") @QueryParam("force") boolean force) throws Exception { DateUtil.DateRange dateRange = new DateUtil.DateRange(daterange); Optional<BackupVerificationResult> result = backupVerification.verifyBackup( SnapshotMetaService.BACKUP_VERSION, force, dateRange); if (!result.isPresent()) { return Response.noContent() .entity("No valid meta found for provided time range") .build(); } <START> return Response.ok(result.get().toString()).build(); <END> }</code><technical_language>toString ^^</technical_language>

Target:
public Response validateV2SnapshotByDate( @PathParam("daterange") String daterange, @DefaultValue("false") @QueryParam("force") boolean force) throws Exception { DateUtil.DateRange dateRange = new DateUtil.DateRange(daterange); Optional<BackupVerificationResult> result = backupVerification.verifyBackup( BackupVersion.SNAPSHOT_META_SERVICE, force, dateRange); if (!result.isPresent()) { return Response.noContent() .entity("No valid meta found for provided time range") .build(); } return Response.ok(result.get()).build(); }
Source:
<code><START> public void setProjectName(final Project.NameKey projectName) { <END> suggestBox.setText(projectName.get()); }</code><technical_language>Passing in a null allowed a clear this box</technical_language>

Target:
public void setProjectName(final Project.NameKey projectName) { suggestBox.setText(projectName != null ? projectName.get() : ""); }
Source:
<code>public vm_pools get(NGuid id) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource() .addValue("vm_pool_id", id); ParameterizedRowMapper<vm_pools> mapper = new ParameterizedRowMapper<vm_pools>() { @Override public vm_pools mapRow(ResultSet rs, int rowNum) throws SQLException { vm_pools entity = new vm_pools(); entity.setvm_pool_description(rs .getString("vm_pool_description")); entity.setvm_pool_id(Guid.createGuidFromString(rs .getString("vm_pool_id"))); entity.setvm_pool_name(rs.getString("vm_pool_name")); entity.setvm_pool_type(VmPoolType.forValue(rs .getInt("vm_pool_type"))); entity.setparameters(rs.getString("parameters")); <START> entity.setPrestartedVms(rs.getInt("prestarted_vms")); <END> entity.setvds_group_id(Guid.createGuidFromString(rs .getString("vds_group_id"))); entity.setvds_group_name(rs.getString("vds_group_name")); entity.setvm_assigned_count(rs.getInt("assigned_vm_count")); entity.setvm_running_count(rs.getInt("vm_running_count")); return entity; } }; return getCallsHandler().executeRead("GetVm_poolsByvm_pool_id", mapper, parameterSource); }</code><technical_language>duplicating code here?:) extract a static mapper? :)</technical_language>

Target:
public vm_pools get(NGuid id) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource() .addValue("vm_pool_id", id); return getCallsHandler().executeRead("GetVm_poolsByvm_pool_id", new VmPoolRowMapper(), parameterSource); }
Source:
<code>public String getFQDNHostname() { if (fqdnHostName == null) { if (!retrieveHostName) { fqdnHostName = inetAddress.getHostAddress(); } else { fqdnHostName = getFqdnHostName(inetAddress); } <START> } <END> return fqdnHostName; }</code><technical_language>I wondering sense move resolution logic out of TaskManagerLocation class in order more a simple data transfer object. For example, a method fromUnresolvedLocation(UnresolvedTaskManagerLocation, ResolutionMode) resolves hostname depending ResolutionMode. a step want support laziness. If this is case, provide a Supplier<String> fqdnHostNameSupplier call give fqdn hostname store in some field. Separating TaskManagerLocation is resolved simplify individual classes a bit</technical_language>

Target:
public String getFQDNHostname() { return hostNameSupplier.getFqdnHostName(); }
Source:
<code>synchronized void connect() { RestHighLevelClient me = client; if (me == null) { synchronized (ElasticSearchAuditDestination.class) { me = client; if (client == null) { String urls = MiscUtil.getStringProperty(props, propPrefix + "." + ELASTICSEARCH_URLS); String protocol = getStringProperty(props, propPrefix + "." + ELASTICSEARCH_PROTOCOL, "http"); int port = MiscUtil.getIntProperty(props, propPrefix + "." + ELASTICSEARCH_PORT, 8080); if (urls != null) { urls = urls.trim(); } if (urls != null && urls.equalsIgnoreCase("NONE")) { urls = null; } try { me = client = new RestHighLevelClient( RestClient.builder( MiscUtil.toArray(urls, ",").stream() .map(x -> new HttpHost(x, port, protocol)) .<HttpHost>toArray(i -> new HttpHost[i]) )); ; } catch (Throwable t) { <START> LOG.fatal("Can't connect to Solr server. urls=" + urls, t); <END> } } } } }</code><technical_language>Based logic, time log is called if connection is established, connect() is called. if Elastic Search is available, continuously logging fatal. plugins run process of service, bombarded fatal logs. I feel, limit number of logging. keeping track of times log interval. E.g. static variable logged time a configurable interval log. If interval > (currentTime - lastLogTime ), log... a suggestion</technical_language>

Target:
synchronized void connect() { if (client == null) { synchronized (ElasticSearchAuditDestination.class) { if (client == null) { client = newClient(); } } } }
Source:
<code>protected void createUniqueConstraintsIfMissing(DatastoreProvider provider, List<UniqueConstraintDetails> constraints) { EmbeddedNeo4jDatastoreProvider neo4jProvider = (EmbeddedNeo4jDatastoreProvider) provider; GraphDatabaseService neo4jDb = neo4jProvider.getDatabase(); Transaction tx = neo4jDb.beginTx(); <START> if ( tx instanceof TopLevelTransaction ) { <END> TopLevelTransaction topLevelTransaction = (TopLevelTransaction) tx; log.infof( "TopLevelTransaction topLevelTransaction : %s", topLevelTransaction.toString() ); try { Field privateTransactionField = TopLevelTransaction.class.getDeclaredField( "transaction" ); privateTransactionField.setAccessible( true ); KernelTransactionImplementation kernelTransaction = (KernelTransactionImplementation) privateTransactionField.get( topLevelTransaction ); log.infof( "kernelTransaction : %s", kernelTransaction.getTransactionId() ); } catch (IllegalStateException ise) { log.warn( "New toplevel transaction created!" ); } catch (Exception e) { log.error( "ERROR!", e ); } } else { PlaceboTransaction placeboTransaction = (PlaceboTransaction) tx; log.infof( "PlaceboTransaction placeboTransaction : %s", placeboTransaction ); try { Field privateTransactionField = PlaceboTransaction.class.getDeclaredField( "currentTransaction" ); privateTransactionField.setAccessible( true ); KernelTransactionImplementation kernelTransaction = (KernelTransactionImplementation) privateTransactionField.get( placeboTransaction ); log.infof( "kernelTransaction : %s", kernelTransaction.getTransactionId() ); } catch (IllegalStateException ise) { log.warn( "New transction created!" ); } catch (Exception e) { log.error( "ERROR!", e ); } } try { for ( UniqueConstraintDetails constraint : constraints ) { createUniqueConstraint( neo4jDb, constraint ); } tx.success(); } finally { if ( tx != null ) { tx.close(); } } }</code><technical_language>I care Transaction specific implementation</technical_language>

Target:
protected void createUniqueConstraintsIfMissing(DatastoreProvider provider, List<UniqueConstraintDetails> constraints) { EmbeddedNeo4jDatastoreProvider neo4jProvider = (EmbeddedNeo4jDatastoreProvider) provider; GraphDatabaseService neo4jDb = neo4jProvider.getDatabase(); Transaction tx = neo4jDb.beginTx(); try { for ( UniqueConstraintDetails constraint : constraints ) { createUniqueConstraint( neo4jDb, constraint ); } tx.success(); } finally { if ( tx != null ) { tx.close(); } } }
Source:
<code>public void testBadIntegerReconnectAttempts() throws Exception { try { AuditEndpoint endpoint = setupEndpointBadUdpReconnectAttempts(BAD_RECONNECT_NUMBER); Assert.fail("No error was thrown while attempting to log with an invalid reconnect-attempts number."); } catch (IllegalArgumentException e) { <START> assertCorrectError(e, new String[] {"ELY00011008", Integer.toString(BAD_RECONNECT_NUMBER)}); <END> } }</code><technical_language>error codes referenced in tests need updated length is adjusted 5</technical_language>

Target:
public void testBadIntegerReconnectAttempts() throws Exception { try { AuditEndpoint endpoint = setupEndpointBadUdpReconnectAttempts(BAD_RECONNECT_NUMBER); Assert.fail("No error was thrown while attempting to log with an invalid reconnect-attempts number."); } catch (IllegalArgumentException e) { assertCorrectError(e, new String[] {"ELY12000", Integer.toString(BAD_RECONNECT_NUMBER)}); } }
Source:
<code>private void waitForCommitterToComplete( @Nullable TableReference tableRef, Iterable<Long> startTimestamps) { Timer.Context timer = getTimer("waitForCommitTsMillis").time(); waitForCommitToComplete(startTimestamps); long waitForCommitTsMillis = TimeUnit.NANOSECONDS.toMillis(timer.stop()); if (tableRef != null) { <START> perfLogger.debug("Waited get commit timestamps.", <END> SafeArg.of("commitTsMillis", waitForCommitTsMillis), LoggingArgs.tableRef(tableRef)); } else { perfLogger.debug("Waited to get commit timestamps", SafeArg.of("commitTsMillis", waitForCommitTsMillis)); } }</code><technical_language>nit: Waited get commit timestamps</technical_language>

Target:
private void waitForCommitterToComplete( @Nullable TableReference tableRef, Iterable<Long> startTimestamps) { Timer.Context timer = getTimer("waitForCommitTsMillis").time(); waitForCommitToComplete(startTimestamps); long waitForCommitTsMillis = TimeUnit.NANOSECONDS.toMillis(timer.stop()); if (tableRef != null) { perfLogger.debug("Waited to get commit timestamps when reading from a known table.", SafeArg.of("commitTsMillis", waitForCommitTsMillis), LoggingArgs.tableRef(tableRef)); } else { perfLogger.debug("Waited to get commit timestamps.", SafeArg.of("commitTsMillis", waitForCommitTsMillis)); } }
Source:
<code>public void review(final CertifiedProductSearchDetails listing) { for (CertificationResult cert : listing.getCertificationResults()) { if (cert.isSuccess()) { <START> if (cert.getTestToolsUsed() != null && cert.getTestToolsUsed().size() > 0) { <END> Iterator<CertificationResultTestTool> testToolIter = cert.getTestToolsUsed().iterator(); while (testToolIter.hasNext()) { CertificationResultTestTool testTool = testToolIter.next(); if (!StringUtils.isEmpty(testTool.getTestToolName())) { if (StringUtils.isEmpty(testTool.getTestToolVersion())) { listing.getErrorMessages() .add(msgUtil.getMessage("listing.criteria.missingTestToolVersion", testTool.getTestToolName(), cert.getNumber())); } } } } } } }</code><technical_language>nesting questions</technical_language>

Target:
public void review(final CertifiedProductSearchDetails listing) { for (CertificationResult cert : listing.getCertificationResults()) { if (cert.isSuccess() && cert.getTestToolsUsed() != null && cert.getTestToolsUsed().size() > 0) { for (CertificationResultTestTool testTool : cert.getTestToolsUsed()) { if (!StringUtils.isEmpty(testTool.getTestToolName()) && StringUtils.isEmpty(testTool.getTestToolVersion())) { listing.getErrorMessages() .add(msgUtil.getMessage("listing.criteria.missingTestToolVersion", testTool.getTestToolName(), cert.getNumber())); } } } } }
Source:
<code>private static boolean validateClaim(Collection<Object> values) { <START> if (values == null || values.isEmpty()) { <END> return false; } for (Object value : values) { if (!isValidClaimValue(value)) { return false; } } return true; }</code><technical_language>values.isEmpty() - I a claim empty object, this: "warnings": I is right then. This is a totally valid claim. for empty array claim: "alternative_identities": []</technical_language>

Target:
private static boolean validateClaim(Collection<Object> values) { if (values == null) { return false; } for (Object value : values) { isValidClaimValue(value); } return true; }
Source:
<code>private boolean matches(IService service, Class<?>[] argumentTypes) { assert service.getNumberOfParameters() != argumentTypes.length; boolean result = true; final List<IType> parameterTypes = service.getParameterTypes(queryEnvironment); <START> for (int i = 0; i < parameterTypes.size(); i++) { <END> if (argumentTypes[i] != null && !parameterTypes.get(i).isAssignableFrom( new ClassType(queryEnvironment, argumentTypes[i]))) { result = false; break; } } return result; }</code><technical_language>&& result</technical_language>

Target:
private boolean matches(IService service, Class<?>[] argumentTypes) { assert service.getNumberOfParameters() != argumentTypes.length; boolean result = true; final List<IType> parameterTypes = service.getParameterTypes(queryEnvironment); for (int i = 0; i < parameterTypes.size() && result; i++) { if (argumentTypes[i] != null && !parameterTypes.get(i).isAssignableFrom( new ClassType(queryEnvironment, argumentTypes[i]))) { result = false; } } return result; }
Source:
<code><START> protected String getAppsDirectory() { <END> if (appsDirectory == null) return "dropins"; return appsDirectory; }</code><technical_language>this method return smart default return "dropins"</technical_language>

Target:
protected String getAppsDirectory() { if (appsDirectory != null && !appsDirectory.isEmpty()) return appsDirectory; boolean bAppConfigured = false; if (serverDirectory.exists()) bAppConfigured = isAppConfigInTargetServerXml(); else { File srcServerXML = getFileFromConfigDirectory("server.xml", configFile); if (srcServerXML != null && srcServerXML.exists()) bAppConfigured = isAppConfigInSourceServerXml(); } if (appsDirectory == null || appsDirectory.isEmpty()) appsDirectory = bAppConfigured ? "apps" : "dropins"; return appsDirectory; }
Source:
<code>public List<Patient> getCachePatients() { if (null == cachePatients) { <START> getAllPatients(); <END> } return cachePatients; }</code><technical_language>is assignment cachePatients here</technical_language>

Target:
public List<Patient> getCachePatients() { if (null == cachePatients) { cachePatients = getAllPatients(); } return cachePatients; }
Source:
<code>public static boolean checkSecurityInfos(String endpoint, Identity clientIdentity, List<SecurityInfo> securityInfos) { if (clientIdentity.isSecure()) { if (securityInfos == null || securityInfos.isEmpty()) { LOG.warn("A client without security info try to connect through the secure endpont", endpoint); return false; } else { for (SecurityInfo securityInfo : securityInfos) { if (checkSecurityInfo(endpoint, clientIdentity, securityInfo)) { return true; } } return false; } <START> } else { <END> if (securityInfos != null && !securityInfos.isEmpty()) { LOG.warn("client must connect using DTLS ", endpoint); return false; } } return true; }</code><technical_language>} else if() {</technical_language>

Target:
public static boolean checkSecurityInfos(String endpoint, Identity clientIdentity, List<SecurityInfo> securityInfos) { if (clientIdentity.isSecure()) { if (securityInfos == null || securityInfos.isEmpty()) { LOG.warn("A client without security info try to connect through the secure endpont", endpoint); return false; } else { for (SecurityInfo securityInfo : securityInfos) { if (checkSecurityInfo(endpoint, clientIdentity, securityInfo)) { return true; } } return false; } } else if (securityInfos != null && !securityInfos.isEmpty()) { LOG.warn("client must connect using DTLS ", endpoint); return false; } return true; }
Source:
<code><START> public Iterator<Object[]> getObjects(String nameJson, Class<?> elementClass) { <END> Collection<Object[]> objectsArray = new ArrayList<>(); try { final String pathFileJson = SRC_TEST_RESOURCES_JSON.concat(nameJson); Object jsonObject = new JSONParser().parse(new FileReader(pathFileJson)); ObjectMapper objectMapper = new ObjectMapper(); List<Object> objectList = objectMapper.readValue(((JSONArray) jsonObject).toJSONString(), objectMapper.getTypeFactory().constructCollectionType(List.class, elementClass)); for (Object object : objectList) { objectsArray.add(new Object[]{object}); } } catch (IOException | ParseException e) { e.printStackTrace(); } return objectsArray.iterator(); }</code><technical_language>need apply this method duplicated methods. need remove getChatter, getCampaign, ....... this method static</technical_language>

Target:
public Iterator<Object[]> getObjects(String nameJson, Class<?> elementClass) { List<Object[]> objectsArray = new ArrayList<>(); try { final String pathFileJson = SRC_TEST_RESOURCES_JSON.concat(nameJson); Object jsonObject = new JSONParser().parse(new FileReader(pathFileJson)); ObjectMapper objectMapper = new ObjectMapper(); List<Object> objectList = objectMapper.readValue(((JSONArray) jsonObject).toJSONString(), objectMapper.getTypeFactory().constructCollectionType(List.class, elementClass)); for (Object object : objectList) { objectsArray.add(new Object[]{object}); } } catch (IOException | ParseException e) { e.printStackTrace(); } return objectsArray.iterator(); }
Source:
<code>public void onItemBreak(PlayerItemBreakEvent e) { if (Talisman.checkFor(e, SlimefunItems.TALISMAN_ANVIL)) { PlayerInventory inv = e.getPlayer().getInventory(); int slot = inv.getHeldItemSlot(); if (!inv.getItem(inv.getHeldItemSlot()).equals(e.getBrokenItem())) { for (int s : armorSlots) { <START> if (e.getBrokenItem().equalst(inv.getItem(s))) { <END> slot = s; break; } } } ItemStack item = e.getBrokenItem().clone(); ItemMeta meta = item.getItemMeta(); if (meta instanceof Damageable) { ((Damageable) meta).setDamage(0); } item.setItemMeta(meta); int itemSlot = slot; Slimefun.runSync(() -> inv.setItem(itemSlot, item), 1L); } }</code><technical_language>a typo right there... "equalst". test changes commiting them. Especially if compiles properly</technical_language>

Target:
public void onItemBreak(PlayerItemBreakEvent e) { if (Talisman.checkFor(e, SlimefunItems.TALISMAN_ANVIL)) { PlayerInventory inv = e.getPlayer().getInventory(); int slot = inv.getHeldItemSlot(); if (!inv.getItem(inv.getHeldItemSlot()).equals(e.getBrokenItem())) { for (int s : armorSlots) { if (e.getBrokenItem().equals(inv.getItem(s))) { slot = s; break; } } } ItemStack item = e.getBrokenItem().clone(); ItemMeta meta = item.getItemMeta(); if (meta instanceof Damageable) { ((Damageable) meta).setDamage(0); } item.setItemMeta(meta); int itemSlot = slot; Slimefun.runSync(() -> inv.setItem(itemSlot, item), 1L); } }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); boolean previouslyStarted = prefs.getBoolean(getString(R.string.pref_previously_started), false); if(!previouslyStarted) { SharedPreferences.Editor edit = prefs.edit(); edit.putBoolean(getString(R.string.pref_previously_started), Boolean.TRUE); <START> edit.commit(); <END> startActivity(new Intent(MainActivity.this, AvatarRoom.class)); } ImageButton new_user = (ImageButton) findViewById(R.id.newUserButtonFirstPage); new_user.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent myIntent = new Intent(MainActivity.this, AvatarRoom.class); startActivityForResult(myIntent, 0); } }); ImageButton start = (ImageButton) findViewById(R.id.startButtonMain); start.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent myIntent = new Intent(MainActivity.this, MapActivity.class); startActivityForResult(myIntent, 0); } }); }</code><technical_language>store previously started true user completes changing room proceeds map, in case action stops in middle, leave inconsistent state</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); boolean previouslyStarted = prefs.getBoolean(getString(R.string.pref_previously_started), false); if (!previouslyStarted) { startActivity(new Intent(MainActivity.this, AvatarRoom.class)); } ImageButton new_user = (ImageButton) findViewById(R.id.newUserButtonFirstPage); new_user.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent myIntent = new Intent(MainActivity.this, AvatarRoom.class); startActivityForResult(myIntent, 0); } }); ImageButton start = (ImageButton) findViewById(R.id.startButtonMain); start.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent myIntent = new Intent(MainActivity.this, MapActivity.class); startActivityForResult(myIntent, 0); } }); }
Source:
<code>public void testDefaultTypeConfig() { byte[] bytes = "<root><name>foo</name></root>".getBytes(); MessageProperties messageProperties = new MessageProperties(); messageProperties.setContentType("application/xml"); Message message = new Message(bytes, messageProperties); Object foo = xmlConverterWithDefaultType.fromMessage(message); <START> assertTrue(foo instanceof Foo); <END> }</code><technical_language>Please, consider AssertJ assertThat()</technical_language>

Target:
public void testDefaultTypeConfig() { byte[] bytes = "<root><name>foo</name></root>".getBytes(); MessageProperties messageProperties = new MessageProperties(); messageProperties.setContentType("application/xml"); Message message = new Message(bytes, messageProperties); Object foo = xmlConverterWithDefaultType.fromMessage(message); assertThat(foo).isInstanceOf(Foo.class); }
Source:
<code>public void doMonitor(ServiceEmitter emitter) { final CacheStats oldStats = priorStats.get(); final CacheStats newStats = cache.stats(); final CacheStats deltaStats; <START> if (oldStats == null) { <END> deltaStats = newStats; } else { deltaStats = newStats.minus(oldStats); } final ServiceMetricEvent.Builder builder = ServiceMetricEvent.builder(); emitter.emit(builder.build("query/cache/caffeine/delta/requests", deltaStats.requestCount())); emitter.emit(builder.build("query/cache/caffeine/total/requests", newStats.requestCount())); emitter.emit(builder.build("query/cache/caffeine/delta/loadTime", deltaStats.totalLoadTime())); emitter.emit(builder.build("query/cache/caffeine/total/loadTime", newStats.totalLoadTime())); emitter.emit(builder.build("query/cache/caffeine/delta/evictionBytes", deltaStats.evictionWeight())); emitter.emit(builder.build("query/cache/caffeine/total/evictionBytes", newStats.evictionWeight())); if (!priorStats.compareAndSet(oldStats, newStats)) { log.warn( new IllegalStateException("Multiple monitors"), "Multiple monitors on the same cache causing race conditions and unreliable stats reporting" ); } }</code><technical_language>initialize oldStats CacheStats.empty(). if/else removed newStats.minus(oldStats)</technical_language>

Target:
public void doMonitor(ServiceEmitter emitter) { final CacheStats oldStats = priorStats.get(); final CacheStats newStats = cache.stats(); final CacheStats deltaStats = newStats.minus(oldStats); final ServiceMetricEvent.Builder builder = ServiceMetricEvent.builder(); emitter.emit(builder.build("query/cache/caffeine/delta/requests", deltaStats.requestCount())); emitter.emit(builder.build("query/cache/caffeine/total/requests", newStats.requestCount())); emitter.emit(builder.build("query/cache/caffeine/delta/loadTime", deltaStats.totalLoadTime())); emitter.emit(builder.build("query/cache/caffeine/total/loadTime", newStats.totalLoadTime())); emitter.emit(builder.build("query/cache/caffeine/delta/evictionBytes", deltaStats.evictionWeight())); emitter.emit(builder.build("query/cache/caffeine/total/evictionBytes", newStats.evictionWeight())); if (!priorStats.compareAndSet(oldStats, newStats)) { log.warn( new IllegalStateException("Multiple monitors"), "Multiple monitors on the same cache causing race conditions and unreliable stats reporting" ); } }
Source:
<code>public void deeperServiceCall() throws QueryEvaluationException { add("ontology:dummy", "ontology:dummy", "wd:Q1"); add("wd:Q1", "ontology:dummy", "wd:Q123"); addSimpleLabels("Q123"); StringBuilder query = uris().prefixes(Ontology.prefix(new StringBuilder())); query.append("SELECT ?pLabel\n"); query.append("WHERE {\n"); query.append(" ontology:dummy ontology:dummy ?s .\n"); query.append(" {\n"); query.append(" ?s ontology:dummy ?p .\n"); query.append(" SERVICE ontology:label { bd:serviceParam ontology:language \"en , de\" . }\n"); query.append(" }\n"); query.append("}\n"); BlazegraphAssertions.assertThat(query(query.toString())) <START> .haveExactly(1, <END> binding("pLabel", "in en", "en")); }</code><technical_language>hasExactly</technical_language>

Target:
public void deeperServiceCall() throws QueryEvaluationException { add("ontology:dummy", "ontology:dummy", "wd:Q1"); add("wd:Q1", "ontology:dummy", "wd:Q123"); addSimpleLabels("Q123"); StringBuilder query = uris().prefixes(Ontology.prefix(new StringBuilder())); query.append("SELECT ?pLabel\n"); query.append("WHERE {\n"); query.append(" ontology:dummy ontology:dummy ?s .\n"); query.append(" {\n"); query.append(" ?s ontology:dummy ?p .\n"); query.append(" SERVICE ontology:label { bd:serviceParam ontology:language \"en , de\" . }\n"); query.append(" }\n"); query.append("}\n"); TupleQueryResult results = query(query.toString()); BlazegraphAssertions.assertThat(results) .haveExactly(1, binding("pLabel", "in en", "en")); }
Source:
<code><START> private StreamTaskInput<IN> wrapWithSorted(StreamTaskInput<IN> input) { <END> ClassLoader userCodeClassLoader = getUserCodeClassLoader(); return new SortingDataInput<>( input, configuration.getTypeSerializerIn(input.getInputIndex(), userCodeClassLoader), configuration.getStateKeySerializer(userCodeClassLoader), configuration.getStatePartitioner(input.getInputIndex(), userCodeClassLoader), getEnvironment().getMemoryManager(), getEnvironment().getIOManager(), getExecutionConfig().isObjectReuseEnabled(), 1.0, getJobConfiguration(), this ); }</code><technical_language>other tasks? I guess this PR is targeting input? If so, add throw new UnsupportedOperationException() in other tasks, a bit more "releasable master branch" while awaiting follow ups</technical_language>

Target:
private StreamTaskInput<IN> wrapWithSorted(StreamTaskInput<IN> input) { ClassLoader userCodeClassLoader = getUserCodeClassLoader(); return new SortingDataInput<>( input, configuration.getTypeSerializerIn(input.getInputIndex(), userCodeClassLoader), configuration.getStateKeySerializer(userCodeClassLoader), configuration.getStatePartitioner(input.getInputIndex(), userCodeClassLoader), getEnvironment().getMemoryManager(), getEnvironment().getIOManager(), getExecutionConfig().isObjectReuseEnabled(), configuration.getManagedMemoryFractionOperatorUseCaseOfSlot( ManagedMemoryUseCase.BATCH_OP, getTaskConfiguration() ), getJobConfiguration(), this ); }
Source:
<code>private void validate(InstanceAdapter instanceAdapter, boolean isSyncAdapter) { if (isSyncAdapter) { throw new UnsupportedOperationException("At present, sync adapters are not expected to write to the instances table."); } if (instanceAdapter.isUpdated(InstanceAdapter._ID) || instanceAdapter.isUpdated(InstanceAdapter.INSTANCE_START) || instanceAdapter.isUpdated(InstanceAdapter.INSTANCE_START_SORTING) || instanceAdapter.isUpdated(InstanceAdapter.INSTANCE_DUE) || instanceAdapter.isUpdated(InstanceAdapter.INSTANCE_DUE_SORTING) || instanceAdapter.isUpdated(InstanceAdapter.INSTANCE_ORIGINAL_TIME) || instanceAdapter.isUpdated(InstanceAdapter.INSTANCE_STATUS) || instanceAdapter.isUpdated(InstanceAdapter.TASK_ID)) <START> { <END> throw new IllegalArgumentException("Instance columns are read-only."); } }</code><technical_language>mentioned chat, I start understand TaskValueDelegate now, recurrence fields added here, too, updated. Right</technical_language>

Target:
private void validate(InstanceAdapter instanceAdapter, boolean isSyncAdapter) { if (isSyncAdapter) { throw new UnsupportedOperationException("At present, sync adapters are not expected to write to the instances table."); } if (instanceAdapter.isUpdated(InstanceAdapter._ID) || instanceAdapter.isUpdated(InstanceAdapter.INSTANCE_START) || instanceAdapter.isUpdated(InstanceAdapter.INSTANCE_START_SORTING) || instanceAdapter.isUpdated(InstanceAdapter.INSTANCE_DUE) || instanceAdapter.isUpdated(InstanceAdapter.INSTANCE_DUE_SORTING) || instanceAdapter.isUpdated(InstanceAdapter.INSTANCE_ORIGINAL_TIME) || instanceAdapter.isUpdated(InstanceAdapter.DISTANCE_FROM_CURRENT) || instanceAdapter.isUpdated(InstanceAdapter.TASK_ID)) { throw new IllegalArgumentException("Instance columns are read-only."); } TaskAdapter taskAdapter = instanceAdapter.taskAdapter(); if (taskAdapter.isUpdated(TaskAdapter.RRULE) || taskAdapter.isUpdated(TaskAdapter.RDATE) || taskAdapter.isUpdated(TaskAdapter.EXDATE)) { throw new IllegalArgumentException("Recurrence values can not be modified through the instances table."); } }
Source:
<code>public final File getOriginal() { File f = getFile(null); <START> if (f != null) { <END> File p = f.getParentFile(); if (p != null && p.exists()) { File original = null; File[] ff = p.listFiles(new OriginalFilter()); if (ff != null && ff.length > 0) { original = ff[0]; } if (original == null) { if (Type.PRESENTATION == type) { f = getFile(EXTENSION_PDF); } } else { f = original; } } } return f; }</code><technical_language>for double post :( simpler solution be: replace line File f = getFile(null); File f = getFile(Type.PRESENTATION == type ? EXTENSION_PDF : null); This work other modifications ..</technical_language>

Target:
public final File getOriginal() { File f = getFile(Type.PRESENTATION == type ? EXTENSION_PDF : null); if (f != null) { File p = f.getParentFile(); if (p != null && p.exists()) { File[] ff = p.listFiles(new OriginalFilter()); if (ff != null && ff.length > 0) { f = ff[0]; } } } return f; }
Source:
<code>public void onClick(View view) { <START> if (view == twitterButton) { <END> logOutOfTwitter(); loginWithTwitter(); } else if (view == facebookButton) { logOutOfFacebook(); loginWithFacebook(); } }</code><technical_language>if compare ID of view instance need maintain fields</technical_language>

Target:
public void onClick(View view) { if (view.getId() == R.id.twitter_button) { logOutOfTwitter(); loginWithTwitter(); } else if (view.getId() == R.id.facebook_button) { logOutOfFacebook(); loginWithFacebook(); } }