auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException { super.configurePipeline(pipelineConfigurer); Schema inputSchema = pipelineConfigurer.getStageConfigurer().getInputSchema(); if (inputSchema != null) { Schema.Type columnToBeTokenizedType = inputSchema.getField(config.columnToBeTokenized) .getSchema().getType(); Preconditions.checkArgument(columnToBeTokenizedType == Schema.Type.STRING, <START> "Column ,to be tokenized, must be of type String, but was %s.", columnToBeTokenizedType); <END> } }</code><technical_language>nit: Column tokenized '%s' of type String, of type '%s'</technical_language>

Target:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException { super.configurePipeline(pipelineConfigurer); Schema inputSchema = pipelineConfigurer.getStageConfigurer().getInputSchema(); if (inputSchema != null && inputSchema.getField(config.columnToBeTokenized) != null) { Schema.Type columnToBeTokenizedType = inputSchema.getField(config.columnToBeTokenized) .getSchema().getType(); Preconditions.checkArgument(columnToBeTokenizedType == Schema.Type.STRING, "Column to be tokenized %s must be of type String, but was of type %s.", config.columnToBeTokenized, columnToBeTokenizedType); } }
Source:
<code>private void advance0() { while (true) { if (currentRecordStoreIterator == null) { if (!partsIterator.hasNext()) { nextKey = null; nextValue = null; return; } else { int nextPart = partsIterator.next(); boolean isOwned = map.getMapServiceContext().getOwnedPartitions().contains(nextPart); if (!isOwned) { throw QueryException.error(SqlErrorCode.PARTITION_MIGRATED, "Partition is not owned by member: " + nextPart); } currentRecordStore = map.getExistingRecordStore(nextPart); if (currentRecordStore == null) { continue; } <START> currentRecordStore.checkIfLoaded(); <END> currentRecordStoreIterator = currentRecordStore.getStorage().mutationTolerantIterator(); } } assert currentRecordStoreIterator != null; while (currentRecordStoreIterator.hasNext()) { Map.Entry<Data, Record<Object>> entry = currentRecordStoreIterator.next(); if (!currentRecordStore.isExpired(entry.getValue(), now, false)) { nextKey = entry.getKey(); nextValue = entry.getValue().getValue(); return; } } currentRecordStore = null; currentRecordStoreIterator = null; } }</code><technical_language>AFAIU, involved record stores loaded, queries (or some parts of them?) fail RetryableHazelcastException. RetryableHazelcastException is handled for SQL operations, automatic retries for others. need check "side effects" here</technical_language>

Target:
private void advance0() { while (true) { if (currentRecordStoreIterator == null) { if (!partsIterator.hasNext()) { nextKey = null; nextValue = null; return; } else { int nextPart = partsIterator.next(); boolean isOwned = map.getMapServiceContext().getOwnedPartitions().contains(nextPart); if (!isOwned) { throw QueryException.error(SqlErrorCode.PARTITION_MIGRATED, "Partition is not owned by member: " + nextPart); } currentRecordStore = map.getMapServiceContext().getRecordStore(nextPart, map.getName()); if (currentRecordStore == null) { continue; } try { currentRecordStore.checkIfLoaded(); } catch (RetryableHazelcastException e) { throw QueryException.error(SqlErrorCode.MAP_LOADING_IN_PROGRESS, "Map loading is in progress: " + map.getName(), e); } currentRecordStoreIterator = currentRecordStore.getStorage().mutationTolerantIterator(); } } assert currentRecordStoreIterator != null; while (currentRecordStoreIterator.hasNext()) { Map.Entry<Data, Record<Object>> entry = currentRecordStoreIterator.next(); if (!currentRecordStore.isExpired(entry.getValue(), now, false)) { nextKey = entry.getKey(); nextValue = entry.getValue().getValue(); return; } } currentRecordStore = null; currentRecordStoreIterator = null; } }
Source:
<code>public void postCollectionDefaultItemReadGroupCreateDefaultItemReadGroupUnProcessableName() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); groupRest.setName("Fail"); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/itemReadGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnprocessableEntity()); <START> <END> }</code><technical_language>double check group created</technical_language>

Target:
public void postCollectionDefaultItemReadGroupCreateDefaultItemReadGroupUnProcessableName() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); groupRest.setName("Fail"); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/itemReadGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnprocessableEntity()); Group anon = groupService.findByName(context, Group.ANONYMOUS); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/itemReadGroup")) .andExpect(status().isOk()) .andExpect( jsonPath("$", GroupMatcher.matchGroupEntry(anon.getID(), anon.getName()))); }
Source:
<code>public static void setUp() throws Exception { <START> System.setProperty(JiraMailAddressResolver.class.getName() + ".DISABLE", "true"); <END> }</code><technical_language>If this full class name in a fixed string, protect class rename/move</technical_language>

Target:
public static void setUp() throws Exception { System.setProperty("hudson.plugins.jira.JiraMailAddressResolver.disabled", "true"); }
Source:
<code><START> private String getMigrationNetworkIp() { <END> List<NetworkCluster> allNetworksInCluster = DbFacade.getInstance() .getNetworkClusterDao().getAllForCluster(getVm().getVdsGroupId()); NetworkCluster migrationNetworkCluster = null; for (NetworkCluster tempNetworkCluster : allNetworksInCluster) { if (tempNetworkCluster.isMigration()) { migrationNetworkCluster = tempNetworkCluster; break; } } Network migrationNetwork = null; if (migrationNetworkCluster != null) { migrationNetwork = DbFacade.getInstance().getNetworkDao() .get(migrationNetworkCluster.getNetworkId()); } String migrationNetworkName = migrationNetwork == null ? null : migrationNetwork.getName(); String migrationIp = null; if (migrationNetworkName != null) { final List<VdsNetworkInterface> allInterfacesForDstVds = DbFacade.getInstance().getInterfaceDao().getAllInterfacesForVds(getDestinationVds().getId()); for (VdsNetworkInterface nic : allInterfacesForDstVds) { if (nic.getNetworkName() != null && nic.getNetworkName().equals(migrationNetworkName)) { migrationIp = nic.getAddress(); break; } } } return migrationIp; }</code><technical_language>need do this feature is supported</technical_language>

Target:
private String getMigrationNetworkIp() { List<Network> allNetworksInCluster = DbFacade.getInstance().getNetworkDao().getAllForCluster(getVm().getVdsGroupId()); Network migrationNetwork = null; for (Network tempNetwork : allNetworksInCluster) { if (tempNetwork.getCluster().isMigration()) { migrationNetwork = tempNetwork; break; } } String migrationIp = null; if (migrationNetwork != null) { final List<VdsNetworkInterface> allInterfacesForDstVds = DbFacade.getInstance().getInterfaceDao().getAllInterfacesForVds(getDestinationVds().getId()); for (VdsNetworkInterface nic : allInterfacesForDstVds) { if (migrationNetwork.getName().equals(nic.getNetworkName())) { migrationIp = nic.getAddress(); break; } } } return migrationIp; }
Source:
<code>public boolean validate(Project current, Project dest) { if(!findIdeaModuleFiles(mySelectedOtpApps)){ return true; } int resultCode = Messages.showYesNoCancelDialog(ApplicationInfoEx.getInstanceEx().getFullApplicationName() + " module files found:\n\n" + StringUtil.join(myFoundOtpApps, new Function<ImportedOtpApp, String>() { @Override public String fun(ImportedOtpApp importedOtpApp) { VirtualFile ideaModuleFile = importedOtpApp.getIdeaModuleFile(); return ideaModuleFile != null ? " " + ideaModuleFile.getPath() + "\n" : ""; } <START> }, "") + "\nWould you licke to reuse them?", "Module files found", Messages.getQuestionIcon()); <END> if(resultCode == Messages.YES){ return true; }else if(resultCode == Messages.NO){ try{ deleteIdeaModuleFiles(mySelectedOtpApps); return true; }catch (IOException e){ LOG.error(e); return false; } }else { return false; } }</code><technical_language>[x] I meant "licke" "like"</technical_language>

Target:
public boolean validate(Project current, Project dest) { if(!findIdeaModuleFiles(mySelectedOtpApps)){ return true; } int resultCode = Messages.showYesNoCancelDialog(ApplicationInfoEx.getInstanceEx().getFullApplicationName() + " module files found:\n\n" + StringUtil.join(myFoundOtpApps, new Function<ImportedOtpApp, String>() { @Override public String fun(ImportedOtpApp importedOtpApp) { VirtualFile ideaModuleFile = importedOtpApp.getIdeaModuleFile(); return ideaModuleFile != null ? " " + ideaModuleFile.getPath() + "\n" : ""; } }, "") + "\nWould you like to reuse them?", "Module files found", Messages.getQuestionIcon()); if(resultCode == Messages.YES){ return true; }else if(resultCode == Messages.NO){ try{ deleteIdeaModuleFiles(mySelectedOtpApps); return true; }catch (IOException e){ LOG.error(e); return false; } }else { return false; } }
Source:
<code>public void testAcceleoMTLCompletionWithDependencies() { EClass c = EcoreFactory.eINSTANCE.createEClass(); Collection<String> dependencies = <START> Arrays.asList(IMPORT, SERVICE); <END> ContentContext c1 = createContentContext("[/]", 1, "EClass", EcorePackage.eINSTANCE, Collections.<String, VariableType> emptyMap(), dependencies); ContentContext c2 = createContentContext("[self./]", 6, "EClass", EcorePackage.eINSTANCE, Collections.<String, VariableType> emptyMap(), dependencies); ContentContext c3 = createContentContext("[self.name.concat()/]", 18, "EClass"); doTestAcceleoMTLCompletionWithDependencies(c, c1, c2, c3, proposalFunction, dependencies); }</code><technical_language>create a new list behavior before. Lists returned Arrays.asList() elements added removed. rest of code "dependencies" for reading, safer reproduce exact behavior before</technical_language>

Target:
public void testAcceleoMTLCompletionWithDependencies() { EClass c = EcoreFactory.eINSTANCE.createEClass(); Collection<String> dependencies = new ArrayList<String>(Arrays.asList(IMPORT, SERVICE)); ContentContext c1 = createContentContext("[/]", 1, "EClass", EcorePackage.eINSTANCE, Collections.<String, VariableType> emptyMap(), dependencies); ContentContext c2 = createContentContext("[self./]", 6, "EClass", EcorePackage.eINSTANCE, Collections.<String, VariableType> emptyMap(), dependencies); ContentContext c3 = createContentContext("[self.name.concat()/]", 18, "EClass"); doTestAcceleoMTLCompletionWithDependencies(c, c1, c2, c3, proposalFunction, dependencies); }
Source:
<code><START> public boolean createFailedExecutorHealthCheckMessage(final List<ExecutableFlow> flows, <END> final Executor executor, final ExecutorManagerException failureException, final EmailMessage message, final String azkabanName, final String scheme, final String clientHostname, final String clientPortNumber, final List<String> emailList) { if (emailList == null || emailList.isEmpty()) { return false; } message.addAllToAddress(emailList); message.setMimeType("text/html"); message.setSubject( "Alert: Executor is unreachable, " + executor.getHost() + " on " + azkabanName); message.println( "<h2 style=\"color:#FFA500\"> Executor is unreachable. Executor host - " + executor.getHost() + " on Cluster - " + azkabanName + "</h2>"); message.println("Remedial action will be attempted on affected executions - <br>"); message.println("Following flows were reported as running on the executor and will be " + "finalized."); message.println(""); message.println("<h3>Affected executions</h3>"); message.println("<ul>"); appendFlowLinksToMessage(message, flows, scheme, clientHostname, clientPortNumber); message.println("</ul>"); message.println("Executor with id " + executor.getId() + " will be removed."); message.println(""); message.println("<h3>Error detail</h3>"); message.println("<pre>" + ExceptionUtils.getStackTrace(failureException) + "</pre>"); return true; }</code><technical_language>this</technical_language>

Target:
public boolean createFailedExecutorHealthCheckMessage(final List<ExecutableFlow> flows, final Executor executor, final ExecutorManagerException failureException, final EmailMessage message, final String azkabanName, final String scheme, final String clientHostname, final String clientPortNumber, final List<String> emailList) { if (emailList == null || emailList.isEmpty()) { return false; } message.addAllToAddress(emailList); message.setMimeType("text/html"); message.setSubject( "Alert: Executor is unreachable, " + executor.getHost() + " on " + azkabanName); message.println( "<h2 style=\"color:#FFA500\"> Executor is unreachable. Executor host - " + executor .getHost() + " on Cluster - " + azkabanName + "</h2>"); message.println("Remedial action will be attempted on affected executions - <br>"); message.println("Following flows were reported as running on the executor and will be " + "finalized."); message.println(""); message.println("<h3>Affected executions</h3>"); message.println("<ul>"); appendFlowLinksToMessage(message, flows, scheme, clientHostname, clientPortNumber); message.println("</ul>"); message.println(""); message.println("<h3>Error detail</h3>"); message.println(String.format("Following error was reported for executor-id: %s, " + "executor-host: %s, executor-port: %d", executor.getId(), executor.getHost(), executor.getPort())); message.println("<pre>" + ExceptionUtils.getStackTrace(failureException) + "</pre>"); return true; }
Source:
<code>public LogHistoryManager(Path masterLogFile, DataSize maxTotalSize) { requireNonNull(masterLogFile, "masterLogFile is null"); requireNonNull(maxTotalSize, "maxTotalSize is null"); this.masterLogFile = masterLogFile; this.maxTotalSize = maxTotalSize.toBytes(); try { Files.list(masterLogFile.getParent()) .map(this::createLogFile) .filter(Optional::isPresent) .map(Optional::get) .forEach(files::add); totalSize = files.stream() .mapToLong(LogFile::getSize) .sum(); } catch (IOException e) { <START> throw new UncheckedIOException("Unable to list existing log files", e); <END> } pruneLogFilesIfNecessary(0); }</code><technical_language>include path</technical_language>

Target:
public LogHistoryManager(Path masterLogFile, DataSize maxTotalSize) { requireNonNull(masterLogFile, "masterLogFile is null"); requireNonNull(maxTotalSize, "maxTotalSize is null"); this.masterLogFile = masterLogFile; this.maxTotalSize = maxTotalSize.toBytes(); try { Files.list(masterLogFile.getParent()) .map(this::createLogFile) .filter(Optional::isPresent) .map(Optional::get) .forEach(files::add); totalSize = files.stream() .mapToLong(LogFile::getSize) .sum(); } catch (IOException e) { throw new UncheckedIOException("Unable to list existing history log files for " + masterLogFile, e); } pruneLogFilesIfNecessary(0); }
Source:
<code>public synchronized boolean unregister(String headerName) { <START> if (mRegistry.remove(headerName) == null) { <END> return false; } return true; }</code><technical_language>return mRegistry.remove(headerName) != null</technical_language>

Target:
public synchronized boolean unregister(String headerName) { return mRegistry.remove(headerName) != null; }
Source:
<code>public Borrowal(Account account, DocumentCopy<?> copy, BorrowalType type) { this.account = account; this.copy = copy; this.type = type; account.getBorrowals().add( this ); <START> copy.getBorrowals().add( this ); <END> }</code><technical_language>Yeah... other ones. I this is a good idea, this in repository service code</technical_language>

Target:
public Borrowal(Account account, DocumentCopy<?> copy, BorrowalType type) { this.account = account; this.copy = copy; this.type = type; }
Source:
<code><START> private static int determineNumberOfEigenSamples(final OptionalInt requestedNumberOfEigenSamples, final int numberOfCountColumns, final SingularValueDecomposition logNormalsSVD, final Logger logger) { <END> final int numberOfEigenSamples; if (requestedNumberOfEigenSamples.isPresent()) { if (requestedNumberOfEigenSamples.getAsInt() > numberOfCountColumns) { logger.warn(String.format("The number of requested eigen samples (%d) is larger than the available number of read count columns after filtering (%d), thus we will have to use the latter.", requestedNumberOfEigenSamples.getAsInt(), numberOfCountColumns)); } numberOfEigenSamples = Math.min(requestedNumberOfEigenSamples.getAsInt(), numberOfCountColumns); } else { final double[] singularValues = logNormalsSVD.getSingularValues(); final double mean = MathUtils.mean(singularValues, 0, singularValues.length); final double eigenValueCutoff = mean * JOLLIFES_RULE_MEAN_FACTOR; numberOfEigenSamples = (int) DoubleStream.of(singularValues).filter(v -> v > eigenValueCutoff).count(); logger.info(String.format("Jollife's rule produced %d eigen samples out of %d possibles for the reduced PoN", numberOfEigenSamples, numberOfCountColumns)); } return numberOfEigenSamples; }</code><technical_language>I this @VisibleForTesting in order a unit test sample identical coverage (or, better, sample's coverage is a scalar multiple of other, sample 1 = (1,1,1,1), sample 2 = (2,2,2,2) etc). In a case is eigensample. get fancier and, say, generate random vectors v1 v2 generate samples linear combinations of v1 v2. eigensamples, v1 v2</technical_language>

Target:
static int determineNumberOfEigenSamples(final OptionalInt requestedNumberOfEigenSamples, final int numberOfCountColumns, final SingularValueDecomposition logNormalsSVD, final Logger logger) { final int numberOfEigenSamples; if (requestedNumberOfEigenSamples.isPresent()) { if (requestedNumberOfEigenSamples.getAsInt() > numberOfCountColumns) { logger.warn(String.format("The number of requested eigen samples (%d) is larger than the available number of read count columns after filtering (%d), thus we will have to use the latter.", requestedNumberOfEigenSamples.getAsInt(), numberOfCountColumns)); } numberOfEigenSamples = Math.min(requestedNumberOfEigenSamples.getAsInt(), numberOfCountColumns); } else { final double[] singularValues = logNormalsSVD.getSingularValues(); final double mean = MathUtils.mean(singularValues, 0, singularValues.length); final double eigenValueCutoff = mean * JOLLIFES_RULE_MEAN_FACTOR; numberOfEigenSamples = (int) DoubleStream.of(singularValues).filter(v -> v > eigenValueCutoff).count(); logger.info(String.format("Jollife's rule produced %d eigen samples out of %d possibles for the reduced PoN", numberOfEigenSamples, numberOfCountColumns)); } return numberOfEigenSamples; }
Source:
<code>DependencyQueueTaskDispatcher(GerritHandler gerritHandler) { this.currentlyTriggeringEvents = new HashSet<GerritTriggeredEvent>(); <START> gerritHandler.addListener(this); <END> logger.info("Registered to gerrit events"); }</code><technical_language>handler is available? (I'm a bit unsure myself) this NPE</technical_language>

Target:
DependencyQueueTaskDispatcher(GerritHandler gerritHandler) { this.currentlyTriggeringEvents = Collections.newSetFromMap( new ConcurrentHashMap<GerritTriggeredEvent, Boolean>()); if (gerritHandler == null) { logger.error("Gerrit Handler was not available to construct DependencyQueueTaskDispatcher"); } else { gerritHandler.addListener(this); } logger.info("Registered to gerrit events"); }
Source:
<code>public void showAuthenticationErrorNotification(Account account, boolean incoming) { int notificationId = NotificationIds.getAuthenticationErrorNotificationId(account, incoming); Context context = controller.getContext(); PendingIntent editServerSettingsPendingIntent = createContentIntent(context, account, incoming); String title = context.getString(R.string.notification_authentication_error_title); String text = context.getString(R.string.notification_authentication_error_text, account.getDescription()); NotificationCompat.Builder builder = controller.createNotificationBuilder() .setSmallIcon(R.drawable.notification_icon_warning) .setWhen(System.currentTimeMillis()) .setAutoCancel(true) .setTicker(title) .setContentTitle(title) .setContentText(text) .setContentIntent(editServerSettingsPendingIntent) .setStyle(new BigTextStyle().bigText(text)) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC); <START> if (Build.VERSION.SDK_INT >= 21) { <END> builder.setCategory(Notification.CATEGORY_ERROR); } controller.configureNotification(builder, null, null, NOTIFICATION_LED_FAILURE_COLOR, NOTIFICATION_LED_BLINK_FAST, true); getNotificationManager().notify(notificationId, builder.build()); }</code><technical_language>NotificationCompat exists precisely avoid this kind of conditional code. NotificationCompat.Builder everywhere. simply calling setCategory() do right thing</technical_language>

Target:
public void showAuthenticationErrorNotification(Account account, boolean incoming) { int notificationId = NotificationIds.getAuthenticationErrorNotificationId(account, incoming); Context context = controller.getContext(); PendingIntent editServerSettingsPendingIntent = createContentIntent(context, account, incoming); String title = context.getString(R.string.notification_authentication_error_title); String text = context.getString(R.string.notification_authentication_error_text, account.getDescription()); NotificationCompat.Builder builder = controller.createNotificationBuilder() .setSmallIcon(R.drawable.notification_icon_warning) .setWhen(System.currentTimeMillis()) .setAutoCancel(true) .setTicker(title) .setContentTitle(title) .setContentText(text) .setContentIntent(editServerSettingsPendingIntent) .setStyle(new BigTextStyle().bigText(text)) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) .setCategory(NotificationCompat.CATEGORY_ERROR); controller.configureNotification(builder, null, null, NOTIFICATION_LED_FAILURE_COLOR, NOTIFICATION_LED_BLINK_FAST, true); getNotificationManager().notify(notificationId, builder.build()); }
Source:
<code>private void commitTransaction(Connection dbConnection) { try { if (dbConnection != null && !dbConnection.getAutoCommit()) { dbConnection.commit(); } } catch (SQLException e) { <START> rollbackTransaction(dbConnection); <END> log.error("An error occurred while commit transactions. ", e); } }</code><technical_language>suggestion log.error("An error occurred while commit transactions.", e); rollbackTransaction(dbConnection);</technical_language>

Target:
private void commitTransaction(Connection dbConnection) { try { if (dbConnection != null && !dbConnection.getAutoCommit()) { dbConnection.commit(); } } catch (SQLException e) { log.error("An error occurred while transaction commit. ", e); rollbackTransaction(dbConnection); } }
Source:
<code>public void testLoadAccountMRUObjectsFromServer() throws Exception { final List<SalesforceObject> mruObjects_before = metadataManager.loadMRUObjects(Constants.ACCOUNT, MAX_QUERY_LIMIT, CachePolicy.RELOAD_AND_RETURN_CACHE_DATA, REFRESH_INTERVAL, null); Map<String, String> idToNames = new HashMap<String, String>(); int numberOfRecords = 1; <START> idToNames = createRecordsOnServer(numberOfRecords, Constants.ACCOUNT); <END> String[] names = idToNames.values().toArray(new String[numberOfRecords]);; String[] ids = idToNames.keySet().toArray(new String[numberOfRecords]); try { Thread.sleep(2000); final List<SalesforceObject> mruObjects = metadataManager.loadMRUObjects(Constants.ACCOUNT, MAX_QUERY_LIMIT, CachePolicy.RELOAD_AND_RETURN_CACHE_DATA, REFRESH_INTERVAL, null); assertNotNull("MRU list should not be null", mruObjects); assertEquals("MRU list size should not be changed", mruObjects_before.size()+numberOfRecords, mruObjects.size()); assertEquals("Recently viewed object name is incorrect", names[0], mruObjects.get(0).getName()); } finally { deleteRecordsOnServer(ids, Constants.ACCOUNT); } }</code><technical_language>initialize this line 89</technical_language>

Target:
public void testLoadAccountMRUObjectsFromServer() throws Exception { final List<SalesforceObject> mruObjects_before = metadataManager.loadMRUObjects(Constants.ACCOUNT, MAX_QUERY_LIMIT, CachePolicy.RELOAD_AND_RETURN_CACHE_DATA, REFRESH_INTERVAL, null); int numberOfRecords = 1; Map<String, String> idToNames = createRecordsOnServer(numberOfRecords, Constants.ACCOUNT); Collection<String> names = idToNames.values(); Set<String> ids = idToNames.keySet(); try { Thread.sleep(2000); final List<SalesforceObject> mruObjects = metadataManager.loadMRUObjects(Constants.ACCOUNT, MAX_QUERY_LIMIT, CachePolicy.RELOAD_AND_RETURN_CACHE_DATA, REFRESH_INTERVAL, null); assertNotNull("MRU list should not be null", mruObjects); assertEquals("MRU list size should not be changed", mruObjects_before.size()+numberOfRecords, mruObjects.size()); assertEquals("Recently viewed object name is incorrect", names.toArray()[0], mruObjects.get(0).getName()); } finally { deleteRecordsOnServer(ids, Constants.ACCOUNT); } }
Source:
<code>public String generate(TreeLogger treeLogger, GeneratorContext generatorContext, String typeName) throws UnableToCompleteException { setTypeOracle(generatorContext.getTypeOracle()); setPropertyOracle(generatorContext.getPropertyOracle()); setTreeLogger(treeLogger); setTypeClass(getType(typeName)); <START> checkLatestVersion(); <END> PrintWriter printWriter = tryCreatePrintWriter(generatorContext, SUFFIX); if (printWriter == null) { return typeName + SUFFIX; } JClassType preBootstrapper = getPreBootstrapper(); ClassSourceFileComposerFactory composer = initComposer(preBootstrapper); SourceWriter sw = composer.createSourceWriter(generatorContext, printWriter); JClassType bootstrapper = getBootstrapper(); String ginjectorName = new GinjectorGenerator(bootstrapper).generate(getTreeLogger(), generatorContext, GinjectorGenerator.DEFAULT_FQ_NAME); writeInit(sw, ginjectorName, preBootstrapper, bootstrapper); closeDefinition(sw); return getPackageName() + "." + getClassName(); }</code><technical_language>I see, moving check in parent</technical_language>

Target:
public String generate(TreeLogger treeLogger, GeneratorContext generatorContext, String typeName) throws UnableToCompleteException { setTypeOracle(generatorContext.getTypeOracle()); setPropertyOracle(generatorContext.getPropertyOracle()); setTreeLogger(treeLogger); setTypeClass(getType(typeName)); PrintWriter printWriter = tryCreatePrintWriter(generatorContext, SUFFIX); if (printWriter == null) { return typeName + SUFFIX; } JClassType preBootstrapper = getPreBootstrapper(); ClassSourceFileComposerFactory composer = initComposer(preBootstrapper); SourceWriter sw = composer.createSourceWriter(generatorContext, printWriter); JClassType bootstrapper = getBootstrapper(); String ginjectorName = new GinjectorGenerator(bootstrapper).generate(getTreeLogger(), generatorContext, GinjectorGenerator.DEFAULT_FQ_NAME); writeInit(sw, ginjectorName, preBootstrapper, bootstrapper); closeDefinition(sw); return getPackageName() + "." + getClassName(); }
Source:
<code>public String getSimpleName() { <START> int index = getActualName().lastIndexOf(File.separator); <END> if (index != -1){ return actualName; } else { return getActualName().substring(index + 1); } }</code><technical_language>'/'</technical_language>

Target:
public String getSimpleName() { int index = getActualName().lastIndexOf("/"); if (index != -1){ return actualName; } else { return getActualName().substring(index + 1); } }
Source:
<code><START> public boolean equals(Object o) { <END> if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SyncDomainAnswer that = (SyncDomainAnswer) o; if (_success != that._success) return false; return true; }</code><technical_language>This equals implementation include attributes Answer super class</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof SyncDomainAnswer)) return false; if (!super.equals(o)) return false; SyncDomainAnswer that = (SyncDomainAnswer) o; if (_success != that._success) return false; return true; }
Source:
<code>public HelixParticipantTest(String stateModelDef) { List<ZkInfo> zkInfoList = new ArrayList<>(); zkInfoList.add(new ZkInfo(null, "DC0", (byte) 0, 2199, false)); zkJson = constructZkLayoutJSON(zkInfoList); props = new Properties(); props.setProperty("clustermap.host.name", "localhost"); props.setProperty("clustermap.port", "2200"); props.setProperty("clustermap.cluster.name", clusterName); props.setProperty("clustermap.datacenter.name", "DC0"); props.setProperty("clustermap.dcs.zk.connect.strings", zkJson.toString(2)); props.setProperty("clustermap.state.model.definition", stateModelDef); this.stateModelDef = stateModelDef; helixManagerFactory = new MockHelixManagerFactory(); <START> accountService = Mockito.mock(AccountService.class); <END> }</code><technical_language>used, removed. (Also format this file)</technical_language>

Target:
public HelixParticipantTest(String stateModelDef) { List<ZkInfo> zkInfoList = new ArrayList<>(); zkInfoList.add(new ZkInfo(null, "DC0", (byte) 0, 2199, false)); zkJson = constructZkLayoutJSON(zkInfoList); props = new Properties(); props.setProperty("clustermap.host.name", "localhost"); props.setProperty("clustermap.port", "2200"); props.setProperty("clustermap.cluster.name", clusterName); props.setProperty("clustermap.datacenter.name", "DC0"); props.setProperty("clustermap.dcs.zk.connect.strings", zkJson.toString(2)); props.setProperty("clustermap.state.model.definition", stateModelDef); this.stateModelDef = stateModelDef; helixManagerFactory = new MockHelixManagerFactory(); }
Source:
<code>private void setUpTriggersForced() { <START> if( getArguments().getString("state").compareTo("From Favourite") == 0) { <END> setUpFavTriggers(); } else { BackendClient.of(this).getTriggers(new TriggersCallback()); } }</code><technical_language>equals</technical_language>

Target:
private void setUpTriggersForced() { if( getArguments().getString("state").equalsIgnoreCase("From Favourite")) { setUpFavTriggers(); } else { BackendClient.of(this).getTriggers(new TriggersCallback()); } }
Source:
<code>private void refreshProject(IProgressMonitor monitor) throws CoreException { <START> if (_projectMetatData.getNewProjectHandle() != null) { <END> _projectMetatData.getNewProjectHandle().refreshLocal(IProject.DEPTH_INFINITE, monitor); Job updateJob = new UpdateMavenProjectJob(new IProject[] {_projectMetatData.getNewProjectHandle() }); updateJob.schedule(); } }</code><technical_language>_projectMetatData.getNewProjectHandle() extracted local variable is 3 times</technical_language>

Target:
private void refreshProject(IProgressMonitor monitor) throws CoreException { IProject project = _projectMetatData.getNewProjectHandle(); if (project != null) { Job updateJob = new UpdateMavenProjectJob(new IProject[] {project}); updateJob.schedule(); } }
Source:
<code><START> private Pair<String, String> readUntilMatch(Iterator<String> lineIterator, Pattern pattern) { <END> while (lineIterator.hasNext()) { String line = lineIterator.next(); Matcher matcher = pattern.matcher(line); if (matcher.matches()) { return Pair.of(line, matcher.group(1)); } } throw new BugInRandoopException("Error: JUnit output doesn't contain: " + pattern.pattern()); }</code><technical_language>of fields a b client code *very* hard read. Create a new struct class (it public fields clear names) instead of Pair</technical_language>

Target:
private Match readUntilMatch(Iterator<String> lineIterator, Pattern pattern) { while (lineIterator.hasNext()) { String line = lineIterator.next(); Matcher matcher = pattern.matcher(line); if (matcher.matches()) { return new Match(line, matcher.group(1)); } } throw new BugInRandoopException("Error: JUnit output doesn't contain: " + pattern.pattern()); }
Source:
<code>public void testSubmitTopologyDryRun() throws Exception { SchedulerStateManagerAdaptor adaptor = mock(SchedulerStateManagerAdaptor.class); PowerMockito.whenNew(SchedulerStateManagerAdaptor.class).withAnyArguments(). thenReturn(adaptor); SubmitterMain submitterMain = spy(new SubmitterMain(config, topology)); PowerMockito.mockStatic(Context.class); PowerMockito.when(Context.dryRun(config)).thenReturn(true); <START> doThrow(new SubmitDryRunResponse(topology, config, mock(PackingPlan.class))). <END> when(submitterMain).callLauncherRunner(Mockito.any(Config.class)); try { submitterMain.submitTopology(); } finally { verify(uploader, never()).uploadPackage(); verify(adaptor, never()).isTopologyRunning(anyString()); } }</code><technical_language>assert code throws this response mocking behavior do so</technical_language>

Target:
public void testSubmitTopologyDryRun() throws Exception { SchedulerStateManagerAdaptor adaptor = mock(SchedulerStateManagerAdaptor.class); PowerMockito.whenNew(SchedulerStateManagerAdaptor.class).withAnyArguments(). thenReturn(adaptor); SubmitterMain submitterMain = spy(new SubmitterMain(config, topology)); when(config.getBooleanValue(ConfigKeys.get("DRY_RUN"), false)).thenReturn(true); try { submitterMain.submitTopology(); } finally { verify(uploader, never()).uploadPackage(); verify(adaptor, never()).isTopologyRunning(anyString()); } }
Source:
<code>public void actionPerformed(java.awt.event.ActionEvent evt) { PersonaDetailsDialog createPersonaDialog = new PersonaDetailsDialog(ContactArtifactViewer.this, PersonaDetailsMode.CREATE, null, new PersonaCreateCallbackImpl(personaUIComponents), false); PersonaDetailsPanel personaPanel = createPersonaDialog.getDetailsPanel(); if (contactName != null) { personaPanel.setPersonaName(contactName); } for (CentralRepoAccount account : contactUniqueAccountsList) { <START> personaPanel.addAccount(account, "Account found in Contact artifact.", Persona.Confidence.UNKNOWN); <END> } createPersonaDialog.display(); }</code><technical_language>string in a @messages block</technical_language>

Target:
public void actionPerformed(java.awt.event.ActionEvent evt) { PersonaDetailsDialog createPersonaDialog = new PersonaDetailsDialog(ContactArtifactViewer.this, PersonaDetailsMode.CREATE, null, new PersonaCreateCallbackImpl(personaUIComponents), false); PersonaDetailsPanel personaPanel = createPersonaDialog.getDetailsPanel(); if (contactName != null) { personaPanel.setPersonaName(contactName); } for (CentralRepoAccount account : contactUniqueAccountsList) { personaPanel.addAccount(account, Bundle.ContactArtifactViewer_persona_account_justification() , Persona.Confidence.HIGH); } createPersonaDialog.display(); }
Source:
<code>private void offer(Mutation mutation) throws IOException { try { Runnable operation = null; if (options.useBulkApi() && (mutation instanceof Put || mutation instanceof Delete)) { MutateRowRequest request = adapt(mutation); ListenableFuture<Empty> future = bulkMutation.add(request); addExceptionCallback(future, mutation); } else { <START> initializeAsyncMutators(); <END> long operationId = rpcThrottler.registerOperationWithHeapSize(mutation.heapSize()); operation = new MutationOperation(mutation, operationId); if (executorService != null && options.getAsyncMutatorCount() > 0) { asyncOperationsQueue.add(operation); } else { operation.run(); } } } catch (InterruptedException e) { throw new IOException("Interrupted in buffered mutator while mutating row : '" + Bytes.toString(mutation.getRow()), e); } }</code><technical_language>nit: I need do this decide add asyncOperationsQueue</technical_language>

Target:
private void offer(Mutation mutation) throws IOException { try { Runnable operation = null; if (options.useBulkApi() && (mutation instanceof Put || mutation instanceof Delete)) { MutateRowRequest request = adapt(mutation); ListenableFuture<Empty> future = bulkMutation.add(request); addExceptionCallback(future, mutation); } else { long operationId = rpcThrottler.registerOperationWithHeapSize(mutation.heapSize()); operation = new MutationOperation(mutation, operationId); if (executorService != null && options.getAsyncMutatorCount() > 0) { initializeAsyncMutators(); asyncOperationsQueue.add(operation); } else { operation.run(); } } } catch (InterruptedException e) { throw new IOException("Interrupted in buffered mutator while mutating row : '" + Bytes.toString(mutation.getRow()), e); } }
Source:
<code>public InputStream call(CallContext callContext, InputStream[] input) { checkAllowedArgs(callContext.getEndpointState(), callContext.getSessionState(), callContext.getWorkUnit()); return getCaller().arrayCall(getClient(), callContext.getEndpointState(), callContext.getSessionState(), <START> callContext.getWorkUnit(), input); <END> }</code><technical_language>noted above, set endpoint state in call context and, in deprecated method, get return endpoint state call context</technical_language>

Target:
public void call(CallContext callContext, InputStream[] input) { checkAllowedArgs(callContext.getEndpointState(), callContext.getSessionState(), callContext.getWorkUnit()); callContext.withEndpointState(getCaller().arrayCall(getClient(), callContext.getEndpointState(), callContext.getSessionState(), callContext.getWorkUnit(), input)); }
Source:
<code>public void testTwoUniqueIndexes() { SessionFactoryBuilder config = SessionFactoryBuilder.entities( TwoUniqueIndexesEntity.class ); TwoUniqueIndexesEntity entity = new TwoUniqueIndexesEntity(); entity.name = "Fabio Massimo"; entity.email = "fabiomassimo@myemailprovider.eu"; entity.address = "11bis Rue Roquepine Paris"; try ( SessionFactory sessionFactory = config.build() ) { inTransaction( sessionFactory, session -> { session.persist( entity ); } ); inTransaction( sessionFactory, session -> { TwoUniqueIndexesEntity stored = session.load( TwoUniqueIndexesEntity.class, entity.name ); assertThat( entity.email ).isEqualTo( stored.getEmail() ); assertThat( entity.address ).isEqualTo( stored.getAddress() ); } ); inTransaction( sessionFactory, session -> { session.delete( entity ); <START> } ); <END> } }</code><technical_language>I noticed this If assertion fails delete method is executed causing potentially causing problems in follow-up tests. move in a @After method (making entity a global field) in a final block? Thisi is true for other test well. I guess if move in a @After method work for cases</technical_language>

Target:
public void testTwoUniqueIndexes() { config = SessionFactoryBuilder.entities( TwoUniqueIndexesEntity.class ); TwoUniqueIndexesEntity entity = new TwoUniqueIndexesEntity(); entity.name = "Fabio Massimo"; entity.email = "fabiomassimo@myemailprovider.eu"; entity.address = "11bis Rue Roquepine Paris"; this.entity = entity; try ( SessionFactory sessionFactory = config.build() ) { inTransaction( sessionFactory, session -> { session.persist( entity ); } ); inTransaction( sessionFactory, session -> { TwoUniqueIndexesEntity stored = session.load( TwoUniqueIndexesEntity.class, entity.name ); assertThat( entity.email ).isEqualTo( stored.getEmail() ); assertThat( entity.address ).isEqualTo( stored.getAddress() ); } ); } }
Source:
<code>public Experiment getExperiment(String experimentAccession, String accessKey) { try { return getExperimentFromCache(experimentAccession, experimentTypes.get(Pair.of(experimentAccession, accessKey))); } catch (ExecutionException e) { <START> throw new RuntimeException(e); <END> } }</code><technical_language>ResourceNotFoundException returns a 404 in ...ExceptionHandlingController, this return a generic 400. messages shown good log these, a warning, if users access URLs</technical_language>

Target:
public Experiment getExperiment(String experimentAccession, String accessKey) { return getExperimentFromCache(experimentAccession, getExperimentType(experimentAccession, accessKey)); }
Source:
<code>public void run() throws Exception { WebResource webResource = getClient().resource(endpoint + "/v1/catalog/entities"); <START> ClientResponse clientResponse = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); <END> String jsonResponse = clientResponse.getEntity(String.class); List<String> entities = getJsonParser().readValue(jsonResponse,new TypeReference<List<String>>(){}); for (String entity : entities) { getOut().println(entity); } }</code><technical_language>For other http calls, check response code. risk throwing a json parse exception reporting underlying problems user</technical_language>

Target:
public void run() throws Exception { WebResource webResource = getClient().resource(endpoint + "/v1/catalog/entities"); ClientResponse clientResponse = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); if (clientResponse.getStatus() != Response.Status.OK.getStatusCode()) { String err = getErrorMessage(clientResponse); throw new CommandExecutionException(err); } String jsonResponse = clientResponse.getEntity(String.class); List<String> entities = getJsonParser().readValue(jsonResponse,new TypeReference<List<String>>(){}); for (String entity : entities) { getOut().println(entity); } }
Source:
<code>public void testCommandServiceSetup() { List<String> extensionsWithoutCommandSupport = asList( PrometheusKieServerExtension.EXTENSION_NAME, ScenarioSimulationKieServerExtension.EXTENSION_NAME); for (KieServerExtension extension : ((KieServerImpl) kieServer).getServerExtensions()) { <START> KieContainerCommandService<?> tmp = extension.getAppComponents(KieContainerCommandService.class); <END> if (extensionsWithoutCommandSupport.contains(extension.getExtensionName())) { assertNull(tmp); } else { assertNotNull(tmp); } } }</code><technical_language>A small suggestion rename tmp smth concrete)</technical_language>

Target:
public void testCommandServiceSetup() { List<String> extensionsWithoutCommandSupport = asList( PrometheusKieServerExtension.EXTENSION_NAME, ScenarioSimulationKieServerExtension.EXTENSION_NAME); for (KieServerExtension extension : ((KieServerImpl) kieServer).getServerExtensions()) { KieContainerCommandService<?> kieContainerCommandService = extension.getAppComponents(KieContainerCommandService.class); String extensionName = extension.getExtensionName(); Objects.requireNonNull(extensionName, "extension.getExtensionName() should not be null"); if (extensionsWithoutCommandSupport.contains(extensionName)) { assertNull(kieContainerCommandService); } else { assertNotNull(kieContainerCommandService); } } }
Source:
<code>protected Control createDialogArea(Composite parent) { final Composite composite = (Composite) super.createDialogArea(parent); composite.setLayout(new GridLayout(2, false)); getShell().setText( changeCredentials ? UIText.LoginDialog_changeCredentials : UIText.LoginDialog_login); Label uriLabel = new Label(composite, SWT.NONE); uriLabel.setText(UIText.LoginDialog_repository); Text uriText = new Text(composite, SWT.READ_ONLY); uriText.setText(uri.toString()); Label userLabel = new Label(composite, SWT.NONE); userLabel.setText(UIText.LoginDialog_user); if (isUserSet) { user = new Text(composite, SWT.BORDER | SWT.READ_ONLY); user.setText(uri.getUser()); } else user = new Text(composite, SWT.BORDER); GridDataFactory.fillDefaults().grab(true, false).applyTo(user); Label passwordLabel = new Label(composite, SWT.NONE); passwordLabel.setText(UIText.LoginDialog_password); password = new Text(composite, SWT.PASSWORD | SWT.BORDER); GridDataFactory.fillDefaults().grab(true, false).applyTo(password); Label storeLabel = new Label(composite, SWT.NONE); storeLabel.setText(UIText.LoginDialog_storeInSecureStore); storeCheckbox = new Button(composite, SWT.CHECK); storeCheckbox.setSelection(true); if (changeCredentials) <START> storeCheckbox.setEnabled(false); <END> if (isUserSet) password.setFocus(); else user.setFocus(); return composite; }</code><technical_language>is checkbox disabled changing credentials ? a user wants change credentials for a single operation ..</technical_language>

Target:
protected Control createDialogArea(Composite parent) { final Composite composite = (Composite) super.createDialogArea(parent); composite.setLayout(new GridLayout(2, false)); getShell().setText( changeCredentials ? UIText.LoginDialog_changeCredentials : UIText.LoginDialog_login); Label uriLabel = new Label(composite, SWT.NONE); uriLabel.setText(UIText.LoginDialog_repository); Text uriText = new Text(composite, SWT.READ_ONLY); uriText.setText(uri.toString()); Label userLabel = new Label(composite, SWT.NONE); userLabel.setText(UIText.LoginDialog_user); if (isUserSet) { user = new Text(composite, SWT.BORDER | SWT.READ_ONLY); user.setText(uri.getUser()); } else user = new Text(composite, SWT.BORDER); GridDataFactory.fillDefaults().grab(true, false).applyTo(user); Label passwordLabel = new Label(composite, SWT.NONE); passwordLabel.setText(UIText.LoginDialog_password); password = new Text(composite, SWT.PASSWORD | SWT.BORDER); GridDataFactory.fillDefaults().grab(true, false).applyTo(password); if(!changeCredentials) { Label storeLabel = new Label(composite, SWT.NONE); storeLabel.setText(UIText.LoginDialog_storeInSecureStore); storeCheckbox = new Button(composite, SWT.CHECK); storeCheckbox.setSelection(true); } if (isUserSet) password.setFocus(); else user.setFocus(); return composite; }
Source:
<code>public ServerECDSASignatureSignerContext(KeycloakSession session, String algorithm) throws SignatureException { <START> super(getKey(session, algorithm)); <END> }</code><technical_language>method body replaced java int size = ECDSASignatureProvider.ECDSA.valueOf(getAlgorithm()).getSignatureLength(); return asn1DERToConcatenatedRS(super.sign(data), size);</technical_language>

Target:
public ServerECDSASignatureSignerContext(KeycloakSession session, String algorithm) throws SignatureException { super(ServerAsymmetricSignatureSignerContext.getKey(session, algorithm)); }
Source:
<code>public DeadAgentReaper(final MasterModel masterModel, final long timeoutHours) { this(masterModel, timeoutHours, SYSTEM_CLOCK, PERMITS_PER_SECOND, <START> ThreadLocalRandom.current().nextInt(DELAY)); <END> }</code><technical_language>minor: is real benefit (or cost, AFAIK) ThreadLocalRandom a simple new Random().nextInt(DELAY) - is contention here</technical_language>

Target:
public DeadAgentReaper(final MasterModel masterModel, final long timeoutHours) { this(masterModel, timeoutHours, SYSTEM_CLOCK, PERMITS_PER_SECOND, new Random().nextInt(DELAY)); }