auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static void hideUnecessaryIngredients(State state, Domain domain, IngredientRecipe goal, List<ObjectInstance>allIngredients) { Boolean match; for (ObjectInstance obj : allIngredients) { match = false; List<IngredientRecipe> contents = goal.getContents(); contents.add(goal); for (IngredientRecipe ing : contents) { if (ing.getName().equals(obj.getName())) { IngredientFactory.setAttributes(obj, ing.generateAttributeNumber(), ing.getToolAttributes()); match = true; break; } } if (!match) { for (Entry<String, IngredientRecipe> entry : goal.getNecessaryTraits().entrySet()) { if (IngredientFactory.getTraits(obj).contains(entry.getKey())) { IngredientRecipe ing = entry.getValue(); IngredientFactory.setAttributes(obj, ing.generateAttributeNumber(), ing.getToolAttributes()); match = true; break; } } } if (match) { <START> if (obj.getName().equals(goal.getName()) == !goal.getSwapped()) { <END> if (IngredientFactory.getUseCount(obj) <= 1) { ObjectInstance hidden = makeHiddenObjectCopy(state, domain, obj); ObjectInstance container = state.getObject(IngredientFactory.getContainer(hidden)); ContainerFactory.removeIngredient(container, hidden.getName()); state.removeObject(obj); state.addObject(hidden); } } if (IngredientFactory.getUseCount(obj) > 0) { IngredientFactory.setUseCount(obj, IngredientFactory.getUseCount(obj) -1); } } } }</code><technical_language>This if statement is tricky read. break lines. Especially if xor type operation. bool1 ^ bool2</technical_language>

Target:
public static void hideUnecessaryIngredients(State state, Domain domain, IngredientRecipe goal, List<ObjectInstance>allIngredients) { Boolean match; for (ObjectInstance obj : allIngredients) { match = false; List<IngredientRecipe> contents = goal.getContents(); contents.add(goal); for (IngredientRecipe ing : contents) { if (ing.getName().equals(obj.getName())) { IngredientFactory.setAttributes(obj, ing.generateAttributeNumber(), ing.getToolAttributes()); match = true; break; } } if (!match) { for (Entry<String, IngredientRecipe> entry : goal.getNecessaryTraits().entrySet()) { if (IngredientFactory.getTraits(obj).contains(entry.getKey())) { IngredientRecipe ing = entry.getValue(); IngredientFactory.setAttributes(obj, ing.generateAttributeNumber(), ing.getToolAttributes()); match = true; break; } } } if (match) { boolean bool1 = obj.getName().equals(goal.getName()); boolean bool2 = !goal.getSwapped(); if (bool1 == bool2) { if (IngredientFactory.getUseCount(obj) <= 1) { ObjectInstance hidden = makeHiddenObjectCopy(state, domain, obj); ObjectInstance container = state.getObject(IngredientFactory.getContainer(hidden)); ContainerFactory.removeIngredient(container, hidden.getName()); state.removeObject(obj); state.addObject(hidden); } } if (IngredientFactory.getUseCount(obj) > 0) { IngredientFactory.setUseCount(obj, IngredientFactory.getUseCount(obj) -1); } } } }
Source:
<code>private void runAsJob(final URIish uri, final CloneOperation op) { final Job job = new Job(NLS.bind(UIText.GitCloneWizard_jobName, uri.toString())) { @Override protected IStatus run(final IProgressMonitor monitor) { try { return executeCloneOperation(op, monitor); } catch (InterruptedException e) { return Status.CANCEL_STATUS; } catch (InvocationTargetException e) { Throwable thr = e.getCause(); return new Status(IStatus.ERROR, Activator.getPluginId(), 0, thr.getMessage(), thr); } } }; job.setUser(true); <START> job.belongsTo(CLONE_JOB_FAMILY); <END> job.schedule(); }</code><technical_language>override this method</technical_language>

Target:
private void runAsJob(final URIish uri, final CloneOperation op) { final Job job = new Job(NLS.bind(UIText.GitCloneWizard_jobName, uri.toString())) { @Override protected IStatus run(final IProgressMonitor monitor) { try { return executeCloneOperation(op, monitor); } catch (InterruptedException e) { return Status.CANCEL_STATUS; } catch (InvocationTargetException e) { Throwable thr = e.getCause(); return new Status(IStatus.ERROR, Activator.getPluginId(), 0, thr.getMessage(), thr); } } @Override public boolean belongsTo(Object family) { return CLONE_JOB_FAMILY.equals(family); } }; job.setUser(true); job.schedule(); }
Source:
<code>private IStatus updateElements(IWorkingSet[] workingSets, IProgressMonitor monitor) { try { if(isDisposed.get() || monitor.isCanceled()) { return Status.CANCEL_STATUS; } IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot(); IJavaModel model= JavaCore.create(root); List<IAdaptable> testResult= new ArrayList<>(); List<IAdaptable> mainResult= new ArrayList<>(); for (IJavaProject jProject : model.getJavaProjects()) { if (monitor.isCanceled() || isDisposed.get()) return Status.CANCEL_STATUS; <START> final IJavaProject project= jProject; <END> if (project.getProject().isOpen()) { for (IPackageFragmentRoot iPackageFragmentRoot : project.getPackageFragmentRoots()) { IClasspathEntry classpathEntry= iPackageFragmentRoot.getRawClasspathEntry(); if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE) { if (classpathEntry.isTest()) { testResult.add(iPackageFragmentRoot); } else { mainResult.add(iPackageFragmentRoot); } } } } } IAdaptable[] testArray= testResult.toArray(new IAdaptable[testResult.size()]); IAdaptable[] productionArray= mainResult.toArray(new IAdaptable[mainResult.size()]); fUpdateUIJob.setTask(new Runnable() { @Override public void run() { for (IWorkingSet w : workingSets) { if(this != fUpdateUIJob.getTask()) { break; } if (MAIN_NAME.equals(w.getName())) { w.setElements(productionArray); } else if (TEST_NAME.equals(w.getName())) { w.setElements(testArray); } } } }); } catch (Exception e) { return Status.CANCEL_STATUS; } return Status.OK_STATUS; }</code><technical_language>obsolete; rename loop var project</technical_language>

Target:
private IStatus updateElements(IWorkingSet[] workingSets, IProgressMonitor monitor) { try { if(isDisposed.get() || monitor.isCanceled()) { return Status.CANCEL_STATUS; } IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot(); IJavaModel model= JavaCore.create(root); List<IAdaptable> testResult= new ArrayList<>(); List<IAdaptable> mainResult= new ArrayList<>(); for (IJavaProject project : model.getJavaProjects()) { if (monitor.isCanceled() || isDisposed.get()) return Status.CANCEL_STATUS; if (project.getProject().isOpen()) { for (IPackageFragmentRoot iPackageFragmentRoot : project.getPackageFragmentRoots()) { IClasspathEntry classpathEntry= iPackageFragmentRoot.getRawClasspathEntry(); if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE) { if (classpathEntry.isTest()) { testResult.add(iPackageFragmentRoot); } else { mainResult.add(iPackageFragmentRoot); } } } } } IAdaptable[] testArray= testResult.toArray(new IAdaptable[testResult.size()]); IAdaptable[] productionArray= mainResult.toArray(new IAdaptable[mainResult.size()]); fUpdateUIJob.setTask(new Runnable() { @Override public void run() { for (IWorkingSet w : workingSets) { if(this != fUpdateUIJob.getTask()) { break; } if (MAIN_NAME.equals(w.getName())) { w.setElements(productionArray); } else if (TEST_NAME.equals(w.getName())) { w.setElements(testArray); } } } }); } catch (Exception e) { return Status.CANCEL_STATUS; } return Status.OK_STATUS; }
Source:
<code>public ValidationResult validate(Object value) { <START> if (!(value instanceof String || value instanceof Double)) { return ValidationResult.ok(); } <END> if (value instanceof String && ((String) value).isEmpty()) { return ValidationResult.ok(); } Double doubleValue = value instanceof String ? tryParse((String) value) : (Double) value; if (doubleValue == null) { return ValidationResult.fail(constants.thisFieldMustContainNumberInvalidReason()); } return ValidationResult.ok(); }</code><technical_language>I is fine for DoubleValidation if is String Double? IIUC pass validation if send other object do number. IMO check if is String Number, if return fail</technical_language>

Target:
public ValidationResult validate(Object value) { if (!(value instanceof String || value instanceof Double)) { return ValidationResult.fail(constants.thisFieldMustContainNumberInvalidReason()); } if (value instanceof String && ((String) value).isEmpty()) { return ValidationResult.ok(); } Double doubleValue = value instanceof String ? tryParse((String) value) : (Double) value; if (doubleValue == null) { return ValidationResult.fail(constants.thisFieldMustContainNumberInvalidReason()); } return ValidationResult.ok(); }
Source:
<code>public void testNoUrlDecodingOfResponse() throws Exception { <START> String contentName = "swift-test-content-%20-1401395399020"; <END> String jsonObjectList = "[{\"last_modified\": \"2014-05-29T20:30:03.845660\", " + "\"bytes\": 19, " + "\"name\": \"" + contentName + "\", " + "\"content_type\": \"application/unknown\"}]"; InputStream stream = Strings2.toInputStream(jsonObjectList); ParseObjectInfoListFromJsonResponse parser = new ParseObjectInfoListFromJsonResponse(new GsonWrapper(new Gson())); GeneratedHttpRequest.Builder builder = new GeneratedHttpRequest.Builder(); builder.method("method") .endpoint("<LINK_0>") .invocation(Invocation.create(Invokable.from(Object.class.getMethod("toString", null)), ImmutableList.<Object>of("container-name", new ListContainerOptions[0]))) .caller(null); parser.setContext(builder.build()); ObjectInfo objectInfo = parser.apply(stream).iterator().next(); assertEquals(objectInfo.getName(), contentName); }</code><technical_language>I %x intentionally is a valid URL encoding. error I correct for is content name includes a % character is a valid URL encoding. For example: "graph-of-75%-closure.png" "report-50%x25%-success.xls". types of names show in content sets of customers, get a list of content items fails patch. Making change %20 removes purpose of test</technical_language>

Target:
public void testNoUrlDecodingOfResponse() throws Exception { String contentName = "swift-test-content-%x-1401395399020"; String jsonObjectList = "[{\"last_modified\": \"2014-05-29T20:30:03.845660\", " + "\"bytes\": 19, " + "\"name\": \"" + contentName + "\", " + "\"content_type\": \"application/unknown\"}]"; InputStream stream = Strings2.toInputStream(jsonObjectList); ParseObjectInfoListFromJsonResponse parser = new ParseObjectInfoListFromJsonResponse(new GsonWrapper(new Gson())); GeneratedHttpRequest.Builder builder = new GeneratedHttpRequest.Builder(); builder.method("method") .endpoint("<LINK_0>") .invocation(Invocation.create(Invokable.from(Object.class.getMethod("toString", null)), ImmutableList.<Object>of("container-name", new ListContainerOptions[0]))) .caller(null); parser.setContext(builder.build()); ObjectInfo objectInfo = parser.apply(stream).iterator().next(); assertEquals(objectInfo.getName(), contentName); }
Source:
<code>private Map<String, List<List<Integer>>> generateKeys(Ignite ignite, int keysCnt) { Map<String, List<List<Integer>>> cacheKeys = new HashMap<>(); for (CacheConfiguration cfg : cacheConfigurations()) { String cacheName = cfg.getName(); IgniteCache cache = ignite.cache(cacheName); List<List<Integer>> keys = new ArrayList<>(); for (KeyType keyType : KeyType.values()) { <START> if (cfg.getCacheMode() == LOCAL) continue; if (keyType == KeyType.BACKUP && cfg.getCacheMode() == PARTITIONED && cfg.getBackups() == 0) continue; if (keyType == KeyType.NEAR && cfg.getCacheMode() == REPLICATED) continue; <END> List<Integer> keys0 = findKeys(cache, keysCnt, keyType.getKeyIndex() * 100_000, keyType); assertEquals(cacheName, keysCnt, keys0.size()); keys.add(keys0); } if (!keys.isEmpty()) cacheKeys.put(cacheName, keys); } return cacheKeys; }</code><technical_language>this block simplified single if</technical_language>

Target:
private Map<String, List<List<Integer>>> generateKeys(Ignite ignite, int keysCnt) { Map<String, List<List<Integer>>> cacheKeys = new HashMap<>(); for (CacheConfiguration cfg : cacheConfigurations()) { String cacheName = cfg.getName(); IgniteCache cache = ignite.cache(cacheName); List<List<Integer>> keys = new ArrayList<>(); for (TypePartitionForKey typePartitionForKey : TypePartitionForKey.values()) { if ((cfg.getCacheMode() == LOCAL) || (typePartitionForKey == TypePartitionForKey.BACKUP && cfg.getCacheMode() == PARTITIONED && cfg.getBackups() == 0) || (typePartitionForKey == TypePartitionForKey.OTHER && cfg.getCacheMode() == REPLICATED)) continue; List<Integer> keys0 = findKeys(cache, keysCnt, 0, typePartitionForKey); assertEquals(cacheName, keysCnt, keys0.size()); keys.add(keys0); } if (!keys.isEmpty()) cacheKeys.put(cacheName, keys); } return cacheKeys; }
Source:
<code>public boolean exists(Serializable id) { String columnName = null; boolean doesExists = false; columnName = getPrimaryColumnName(); if (columnName != null) { String jpql = "SELECT count(t) FROM " + entityType.getCanonicalName() + <START> " t WHERE " + columnName + " = :id"; <END> if (this.getEntityManager().createQuery(jpql, Long.class) .setParameter("id", id) .getSingleResult() > 0) { doesExists = true; } } return doesExists; }</code><technical_language>Try avoid string concatenation in query if reasonable do so. If do it, change a JPA criteria query instead. I argue this is a place do so</technical_language>

Target:
public boolean exists(Serializable id) { boolean doesExists = false; String columnName = getPrimaryKeyName(); if (columnName != null) { CriteriaBuilder builder = this.getEntityManager().getCriteriaBuilder(); CriteriaQuery<Long> query = builder.createQuery(Long.class); query.select(builder.count(query.from(entityType))); Root<E> root = query.from(entityType); query.where(builder.equal(root.get(columnName), id)); if (this.getEntityManager().createQuery(query).getSingleResult() > 0) { doesExists = true; } } return doesExists; }
Source:
<code>public void onBlockFlowTo(BlockFromToEvent event) { Block toblock = event.getToBlock(); Block fromblock = event.getBlock(); if (ElementalAbility.isLava(fromblock)) { event.setCancelled(!EarthPassive.canFlowFromTo(fromblock, toblock)); } if (ElementalAbility.isWater(fromblock)) { event.setCancelled(!WaterBubble.isAir(toblock)); if (!event.isCancelled()) { event.setCancelled(!WaterManipulation.canFlowFromTo(fromblock, toblock)); } if (!event.isCancelled()) { <START> if (Illumination.isIlluminationTorch(block)) { <END> TempBlock temp = TempBlock.get(block); if (temp != null) temp.revertBlock(); } } } }</code><technical_language>Uh, variable block exist in this scope. a compiler check commits</technical_language>

Target:
public void onBlockFlowTo(BlockFromToEvent event) { Block toblock = event.getToBlock(); Block fromblock = event.getBlock(); if (ElementalAbility.isLava(fromblock)) { event.setCancelled(!EarthPassive.canFlowFromTo(fromblock, toblock)); } if (ElementalAbility.isWater(fromblock)) { event.setCancelled(!WaterBubble.isAir(toblock)); if (!event.isCancelled()) { event.setCancelled(!WaterManipulation.canFlowFromTo(fromblock, toblock)); } if (!event.isCancelled()) { if (Illumination.isIlluminationTorch(toblock)) { TempBlock temp = TempBlock.get(toblock); if (temp != null) temp.revertBlock(); } } } }
Source:
<code>public boolean forgetAllParticipants() { boolean notifiedAll = true; <START> Iterator<LRARecord> iterator = pending.iterator(); <END> while (iterator.hasNext()) { LRARecord record = iterator.next(); if (record.forget()) { iterator.remove(); } else { notifiedAll = false; } } return notifiedAll; }</code><technical_language>ideas * pending null be? * I would, personally if I miss some detail, consider more readable lamda style pending.removeIf(record -> record.forget())</technical_language>

Target:
public boolean forgetAllParticipants() { if (pending == null) { return true; } pending.removeIf(LRARecord::forget); return pending.isEmpty(); }
Source:
<code>public void binaryExcludedTrue() throws SQLException { <START> boolean original = P6LogOptions.getActiveInstance().getExcludebinary(); <END> try { P6LogOptions.getActiveInstance().setExcludebinary(true); String update = "insert into img values (?, ?, ?)"; PreparedStatement prep = getPreparedStatement(update); prep.setInt(1, 1); prep.setBytes(2, "foo".getBytes(StandardCharsets.UTF_8)); Blob data = connection.createBlob(); data.setBytes(1, "foo".getBytes(StandardCharsets.UTF_8)); prep.setBlob(3, data); prep.execute(); assertTrue(super.getLastLogEntry().contains("insert into img values (1, '[binary]', ")); } finally { P6LogOptions.getActiveInstance().setExcludebinary(original); } }</code><technical_language>@before</technical_language>

Target:
public void binaryExcludedTrue() throws SQLException { P6LogOptions.getActiveInstance().setExcludebinary(true); String update = "insert into img values (?, ?, ?)"; PreparedStatement prep = getPreparedStatement(update); prep.setInt(1, 1); prep.setBytes(2, "foo".getBytes(StandardCharsets.UTF_8)); if( "PostgreSQL".equals(db) || "Firebird".equals(db) || "SQLite".equals(db)) { prep.setBytes(3, "foo".getBytes(StandardCharsets.UTF_8)); } else { Blob data = connection.createBlob(); data.setBytes(1, "foo".getBytes(StandardCharsets.UTF_8)); prep.setBlob(3, data); } prep.execute(); assertTrue(super.getLastLogEntry().contains("insert into img values (1, '[binary]', ")); }
Source:
<code>public Set<K> keySet(Predicate predicate) { checkNotNull(predicate, "Predicate cannot be null!"); Set<K> resultingSet = new HashSet<K>(); <START> Set<QueryableEntry> query = indexes.query(predicate, -1); <END> if (query != null) { for (QueryableEntry entry : query) { K key = toObject(entry.getKeyData()); resultingSet.add(key); } } else { doFullKeyScan(predicate, resultingSet); } return resultingSet; }</code><technical_language>Is OK pass -1 here? cache inconsistent results if check for partition count is skipped, we</technical_language>

Target:
public Set<K> keySet(Predicate predicate) { checkNotNull(predicate, "Predicate cannot be null!"); Set<K> resultingSet = new HashSet<K>(); Set<QueryableEntry> query = indexes.query(predicate, SKIP_PARTITIONS_COUNT_CHECK); if (query != null) { for (QueryableEntry entry : query) { K key = toObject(entry.getKeyData()); resultingSet.add(key); } } else { doFullKeyScan(predicate, resultingSet); } return resultingSet; }
Source:
<code>public void testToStringCheckObjectRecursionPrevention() throws Exception { Node n1 = new Node(); Node n2 = new Node(); Node n3 = new Node(); Node n4 = new Node(); n1.name = "n1"; n2.name = "n2"; n3.name = "n3"; n4.name = "n4"; n1.next = n2; n2.next = n3; n3.next = n4; n4.next = n3; try { <START> assertTrue("Wrong toString behaviour", <END> n1.toString().length() == 106); assertTrue("Wrong toString behaviour", n2.toString().length() == 85); assertTrue("Wrong toString behaviour", n3.toString().length() == 64); assertTrue("Wrong toString behaviour", n4.toString().length() == 64); } catch (StackOverflowError e) { fail("Recursion happened."); } }</code><technical_language>reason split lines</technical_language>

Target:
public void testToStringCheckObjectRecursionPrevention() throws Exception { Node n1 = new Node(); Node n2 = new Node(); Node n3 = new Node(); Node n4 = new Node(); n1.name = "n1"; n2.name = "n2"; n3.name = "n3"; n4.name = "n4"; n1.next = n2; n2.next = n3; n3.next = n4; n4.next = n3; n1.nodes = new Node[4]; n2.nodes = n1.nodes; n3.nodes = n1.nodes; n4.nodes = n1.nodes; n1.nodes[0] = n1; n1.nodes[1] = n2; n1.nodes[2] = n3; n1.nodes[3] = n4; String expN1 = n1.toString(); String expN2 = n2.toString(); String expN3 = n3.toString(); String expN4 = n4.toString(); info(expN1); info(expN2); info(expN3); info(expN4); info(GridToStringBuilder.toString("Test", "Appended vals", n1)); CyclicBarrier bar = new CyclicBarrier(4); IgniteInternalFuture<String> fut1 = GridTestUtils.runAsync(new BarrierCallable(bar, n1, expN1)); IgniteInternalFuture<String> fut2 = GridTestUtils.runAsync(new BarrierCallable(bar, n2, expN2)); IgniteInternalFuture<String> fut3 = GridTestUtils.runAsync(new BarrierCallable(bar, n3, expN3)); IgniteInternalFuture<String> fut4 = GridTestUtils.runAsync(new BarrierCallable(bar, n4, expN4)); fut1.get(3_000); fut2.get(3_000); fut3.get(3_000); fut4.get(3_000); }
Source:
<code>protected void prepareBuffer() { if (toSend != null && toSend.content() != null) { <START> bufferToSend = PooledByteBufAllocator.DEFAULT.heapBuffer((int) sizeInBytes()); <END> } else { bufferToSend = PooledByteBufAllocator.DEFAULT.heapBuffer( (int) super.sizeInBytes() + (Partition_Response_Info_List_Size + partitionResponseInfoSize)); } writeHeader(); if (partitionResponseInfoList != null) { bufferToSend.writeInt(partitionResponseInfoList.size()); for (PartitionResponseInfo partitionResponseInfo : partitionResponseInfoList) { partitionResponseInfo.writeTo(bufferToSend); } } if (toSend != null) { if (toSend.content() != null) { int maxNumComponent = 1 + toSend.content().nioBufferCount(); CompositeByteBuf compositeByteBuf = bufferToSend.alloc().compositeHeapBuffer(maxNumComponent); compositeByteBuf.addComponent(true, bufferToSend); if (toSend.content() instanceof CompositeByteBuf) { Iterator<ByteBuf> iter = ((CompositeByteBuf) toSend.content()).iterator(); while (iter.hasNext()) { compositeByteBuf.addComponent(true, iter.next()); } } else { compositeByteBuf.addComponent(true, toSend.content()); } bufferToSend = compositeByteBuf; toSend = null; } } }</code><technical_language>reason directBuffer</technical_language>

Target:
protected void prepareBuffer() { bufferToSend = PooledByteBufAllocator.DEFAULT.ioBuffer( (int) super.sizeInBytes() + (Partition_Response_Info_List_Size + partitionResponseInfoSize)); writeHeader(); if (partitionResponseInfoList != null) { bufferToSend.writeInt(partitionResponseInfoList.size()); for (PartitionResponseInfo partitionResponseInfo : partitionResponseInfoList) { partitionResponseInfo.writeTo(bufferToSend); } } if (toSend != null) { if (toSend.content() != null) { int maxNumComponent = 1 + toSend.content().nioBufferCount(); CompositeByteBuf compositeByteBuf = bufferToSend.alloc().compositeHeapBuffer(maxNumComponent); compositeByteBuf.addComponent(true, bufferToSend); if (toSend.content() instanceof CompositeByteBuf) { Iterator<ByteBuf> iter = ((CompositeByteBuf) toSend.content()).iterator(); while (iter.hasNext()) { compositeByteBuf.addComponent(true, iter.next()); } } else { compositeByteBuf.addComponent(true, toSend.content()); } bufferToSend = compositeByteBuf; toSend = null; } } }
Source:
<code>protected DiagramEventBroker getDiagramEventBroker() { TransactionalEditingDomain theEditingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain(); if (null != theEditingDomain) { <START> return DiagramEventBroker.getInstance(theEditingDomain); <END> } return null; }</code><technical_language>Multi returns avoided</technical_language>

Target:
protected DiagramEventBroker getDiagramEventBroker() { DiagramEventBroker eventBorker = null; TransactionalEditingDomain theEditingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain(); if (null != theEditingDomain) { eventBorker = DiagramEventBroker.getInstance(theEditingDomain); } return eventBorker; }
Source:
<code>public ValidationResult checkAccount(String chartOfAccountsCode, String accountNumber) { Account account = accountService.getByPrimaryId(chartOfAccountsCode, accountNumber); <START> String accountErrorMessageString = ConcurConstants.AccountingStringFieldNames.ACCOUNT_NUMBER + CUKFSConstants.COLON + chartOfAccountsCode + KFSConstants.COMMA + accountNumber; <END> return checkMissingOrInactive(account, MessageFormat.format(configurationService.getPropertyValueAsString(KFSKeyConstants.ERROR_EXISTENCE), accountErrorMessageString), MessageFormat.format(configurationService.getPropertyValueAsString(KFSKeyConstants.ERROR_INACTIVE), accountErrorMessageString)); }</code><technical_language>a cases building errorMessageString a similar format: fieldName:value,value . helpful break a function? I asking this</technical_language>

Target:
public ValidationResult checkAccount(String chartOfAccountsCode, String accountNumber) { Account account = accountService.getByPrimaryId(chartOfAccountsCode, accountNumber); String accountErrorMessageString = ConcurUtils.formatStringForErrorMessage(ConcurConstants.AccountingStringFieldNames.ACCOUNT_NUMBER, chartOfAccountsCode, accountNumber); return checkMissingOrInactive(account, MessageFormat.format(configurationService.getPropertyValueAsString(KFSKeyConstants.ERROR_EXISTENCE), accountErrorMessageString), MessageFormat.format(configurationService.getPropertyValueAsString(KFSKeyConstants.ERROR_INACTIVE), accountErrorMessageString)); }
Source:
<code>public static void main(String[] args) { String connectionString = "endpoint={endpoint_value};id={id_value};secret={secret_value}"; final ConfigurationAsyncClient client = new ConfigurationClientBuilder() .connectionString(connectionString) .buildAsyncClient(); final String key = "hello"; final String value = "world"; client.setConfigurationSetting(key, null, value).subscribe( result -> { final ConfigurationSetting setting = result; System.out.println(String.format("[SetConfigurationSetting] Key: %s, Value: %s", setting.getKey(), setting.getValue())); }, error -> System.err.println("There was an error while adding the setting: " + error.toString()), () -> System.out.println(String.format("Set setting with key=%s and value=%s added or updated.", key, value))); client.setReadOnly(key, null).subscribe( result -> { final ConfigurationSetting setting = result; System.out.println(String.format("[Read-Only Setting] Key: %s, Value: %s", setting.getKey(), setting.getValue())); }, error -> System.err.println("There was an error while making the setting to read-only: " + error.toString()), <START> null <END> ); client.clearReadOnly(key, null).subscribe( result -> { final ConfigurationSetting setting = result; System.out.println(String.format("[Cleared Read-Only Setting] Key: %s, Value: %s", setting.getKey(), setting.getValue())); }, error -> System.err.println("There was an error while making the setting to read-only: " + error.toString()), null ); }</code><technical_language>is this null? overload then</technical_language>

Target:
public static void main(String[] args) { String connectionString = "endpoint={endpoint_value};id={id_value};secret={secret_value}"; final ConfigurationAsyncClient client = new ConfigurationClientBuilder() .connectionString(connectionString) .buildAsyncClient(); final String key = "hello"; final String value = "world"; client.setConfigurationSetting(key, null, value).subscribe( result -> { final ConfigurationSetting setting = result; System.out.printf(String.format("[SetConfigurationSetting] Key: %s, Value: %s", setting.getKey(), setting.getValue())); }, error -> System.err.println("There was an error while adding the setting: " + error), () -> System.out.printf(String.format("Set setting with key=%s and value=%s added or updated.", key, value))); client.setReadOnly(key, null).subscribe( result -> { final ConfigurationSetting setting = result; System.out.printf(String.format("[Read-Only Setting] Key: %s, Value: %s", setting.getKey(), setting.getValue())); }, error -> System.err.println("There was an error while making the setting to read-only: " + error), null ); client.clearReadOnly(key, null).subscribe( result -> { final ConfigurationSetting setting = result; System.out.printf(String.format("[Cleared Read-Only Setting] Key: %s, Value: %s", setting.getKey(), setting.getValue())); }, error -> System.err.println("There was an error while making the setting to read-only: " + error), null ); }
Source:
<code>public void setUp() throws Exception { this.client = helper.createClientForBasicAuth(); this.project = helper.getOrCreateIntegrationTestProject(client); IImageStream is = client.getResourceFactory().stub( ResourceKind.IMAGE_STREAM, IntegrationTestHelper.appendRandom("ruby-hello-world"), project.getName()); LOG.debug("Creating imagestream {}", is); this.is = client.create(is); LOG.debug("Generated imagestream {}", is); IBuildConfigBuilder builder = client.adapt(IBuildConfigBuilder.class); assertNotNull("Exp. the client to be able to use a buildconfigbuilder", builder); <START> LOG.debug("Creating BUILDCONFIG {}", bc); <END> this.bc = client.create( helper.stubBuildConfig(client, project.getNamespaceName(), IntegrationTestHelper.appendRandom("test-bc"), "<LINK_0>", Collections.emptyMap())); LOG.debug("Created BUILDCONFIG {}", bc); assertNotNull(bc); }</code><technical_language>rationale for</technical_language>

Target:
public void setUp() throws Exception { this.client = helper.createClientForBasicAuth(); this.project = helper.getOrCreateIntegrationTestProject(client); IImageStream is = client.getResourceFactory().stub( ResourceKind.IMAGE_STREAM, IntegrationTestHelper.appendRandom("ruby-hello-world"), project.getName()); LOG.debug("Creating imagestream {}", is); this.is = client.create(is); LOG.debug("Generated imagestream {}", is); IBuildConfigBuilder builder = client.adapt(IBuildConfigBuilder.class); assertNotNull("Exp. the client to be able to use a buildconfigbuilder", builder); LOG.debug("Creating BuildConfig {}", bc); this.bc = client.create( helper.stubBuildConfig(client, project.getNamespaceName(), IntegrationTestHelper.appendRandom("test-bc"), "<LINK_0>", Collections.emptyMap())); LOG.debug("Created BuildConfig {}", bc); assertNotNull(bc); }
Source:
<code>@Override public boolean onDone(@Nullable Boolean res, @Nullable Throwable err, boolean cancel) { assert !cancel; long time = System.currentTimeMillis(); if (startTime != -1) endTime.compareAndSet(-1, time); boolean byThisCall = super.onDone(res, err, cancel); <START> if (byThisCall && (res == false || isFailed())) <END> lastCancelledTime.accumulateAndGet(time, Math::max); return byThisCall; }</code><technical_language>change res == Boolean.FALSE avoid unboxing</technical_language>

Target:
@Override public boolean onDone(@Nullable Boolean res, @Nullable Throwable err, boolean cancel) { assert !cancel : "RebalanceFuture cancel is not supported. Use res = false."; boolean byThisCall = super.onDone(res, err, cancel); boolean isCancelled = res == Boolean.FALSE || isFailed(); if (byThisCall) { if (isCancelled) lastCancelledTime.accumulateAndGet(System.currentTimeMillis(), Math::max); else if (startTime != -1) endTime = System.currentTimeMillis(); } return byThisCall; }
Source:
<code>public void updateParentCommandId(ArrayList<VdcActionParametersBase> parameters, CommandBase command) { <START> for (VdcActionParametersBase param : parameters) { <END> param.setParentCommand(command.getActionType()); param.setParentParameters(command.getParameters()); } }</code><technical_language>1. replace params.forEach 2. more sense this method reside in HostSetupNetworksParametersBuilder - I related "ReportFailedChildHostOperationsUtil"</technical_language>

Target:
public void updateParentCommandId(ArrayList<VdcActionParametersBase> parameters, CommandBase command) { parameters.forEach(param -> { param.setParentCommand(command.getActionType()); param.setParentParameters(command.getParameters()); }); }
Source:
<code>public void prepare(Map stormConf, TopologyContext context, final OutputCollector collector) { _rand = new Random(); _collector = collector; Number subpid = _process.launch(stormConf, context); LOG.info("Launched subprocess with pid " + subpid); _readerThread = new Thread(new Runnable() { public void run() { while (_running) { try { <START> Emission emission = _process.readEmission(); <END> String command = emission.getCommand(); if(command.equals("ack")) { handleAck(emission.getId()); } else if (command.equals("fail")) { handleFail(emission.getId()); } else if (command.equals("error")) { handleError(emission.getMsg()); } else if (command.equals("log")) { String msg = emission.getMsg(); LOG.info("Shell msg: " + msg); } else if (command.equals("emit")) { handleEmit(emission); } } catch (InterruptedException e) { } catch (Throwable t) { die(t); } } } }); _readerThread.start(); _writerThread = new Thread(new Runnable() { public void run() { while (_running) { try { Object write = _pendingWrites.poll(1, SECONDS); if (write instanceof Immission) { _process.writeImmission((Immission)write); } else if (write instanceof List<?>) { } } catch (InterruptedException e) { } catch (Throwable t) { die(t); } } } }); _writerThread.start(); }</code><technical_language>is emission is null, action</technical_language>

Target:
public void prepare(Map stormConf, TopologyContext context, final OutputCollector collector) { Object maxPending = stormConf.get(Config.TOPOLOGY_SHELLBOLT_MAX_PENDING); if (maxPending != null) { this._pendingWrites = new LinkedBlockingQueue(((Number)maxPending).intValue()); } _rand = new Random(); _collector = collector; _process = new ShellProcess(_command); Number subpid = _process.launch(stormConf, context); LOG.info("Launched subprocess with pid " + subpid); _readerThread = new Thread(new Runnable() { public void run() { while (_running) { try { ShellMsg shellMsg = _process.readShellMsg(); String command = shellMsg.getCommand(); if(command.equals("ack")) { handleAck(shellMsg.getId()); } else if (command.equals("fail")) { handleFail(shellMsg.getId()); } else if (command.equals("error")) { handleError(shellMsg.getMsg()); } else if (command.equals("log")) { String msg = shellMsg.getMsg(); LOG.info("Shell msg: " + msg); } else if (command.equals("emit")) { handleEmit(shellMsg); } } catch (InterruptedException e) { } catch (Throwable t) { die(t); } } } }); _readerThread.start(); _writerThread = new Thread(new Runnable() { public void run() { while (_running) { try { Object write = _pendingWrites.poll(1, SECONDS); if (write instanceof BoltMsg) { _process.writeBoltMsg((BoltMsg)write); } else if (write instanceof List<?>) { _process.writeTaskIds((List<Integer>)write); } else if (write != null) { throw new RuntimeException("Unknown class type to write: " + write.getClass().getName()); } } catch (InterruptedException e) { } catch (Throwable t) { die(t); } } } }); _writerThread.start(); }
Source:
<code>private void checkForPreConditions() throws Exception { assumeFalse(compatibleClientVersion.contains(MetaDataProtocol.CURRENT_CLIENT_VERSION)); <START> org.apache.hadoop.hbase.client.Connection conn = ConnectionFactory.createConnection(conf); <END> Admin admin = conn.getAdmin(); assertFalse(admin.tableExists(TableName.valueOf(QueryConstants.SYSTEM_SCHEMA_NAME, PhoenixDatabaseMetaData.SYSTEM_CATALOG_TABLE))); }</code><technical_language>Put try-with-resources</technical_language>

Target:
private void checkForPreConditions() throws Exception { assumeFalse(compatibleClientVersion.contains(MetaDataProtocol.CURRENT_CLIENT_VERSION)); try (org.apache.hadoop.hbase.client.Connection conn = ConnectionFactory.createConnection(conf)) { Admin admin = conn.getAdmin(); assertFalse(admin.tableExists(TableName.valueOf(QueryConstants.SYSTEM_SCHEMA_NAME, PhoenixDatabaseMetaData.SYSTEM_CATALOG_TABLE))); } }
Source:
<code>public static MediaFile fromMediaModel(MediaModel media) { if (media == null) { return null; } MediaFile mediaFile = new MediaFile(); mediaFile.setBlogId(String.valueOf(media.getLocalSiteId())); mediaFile.setMediaId(String.valueOf(media.getMediaId())); mediaFile.setId(media.getId()); mediaFile.setFileName(media.getFileName()); mediaFile.setFilePath(media.getFilePath()); mediaFile.setMimeType(media.getMimeType()); mediaFile.setThumbnailURL(media.getThumbnailUrl()); mediaFile.setFileURL(media.getUrl()); mediaFile.setTitle(media.getTitle()); mediaFile.setDescription(media.getDescription()); mediaFile.setCaption(media.getCaption()); mediaFile.setUploadState(media.getUploadState()); mediaFile.setVideo(media.getMimeType().startsWith("video")); <START> mediaFile.setVideoPressShortCode(ShortcodeUtils.getVideoPressShortcodeFromId(media.getVideoPressGuid())); <END> return mediaFile; }</code><technical_language>great phase out MediaFile altogether</technical_language>

Target:
public static MediaFile fromMediaModel(MediaModel media) { if (media == null) { return null; } MediaFile mediaFile = new MediaFile(); mediaFile.setBlogId(String.valueOf(media.getLocalSiteId())); mediaFile.setMediaId(String.valueOf(media.getMediaId())); mediaFile.setId(media.getId()); mediaFile.setFileName(media.getFileName()); mediaFile.setFilePath(media.getFilePath()); mediaFile.setMimeType(media.getMimeType()); mediaFile.setThumbnailURL(media.getThumbnailUrl()); mediaFile.setFileURL(media.getUrl()); mediaFile.setTitle(media.getTitle()); mediaFile.setDescription(media.getDescription()); mediaFile.setCaption(media.getCaption()); mediaFile.setUploadState(media.getUploadState()); mediaFile.setVideo(org.wordpress.android.fluxc.utils.MediaUtils.isVideoMimeType(media.getMimeType())); mediaFile.setVideoPressShortCode(ShortcodeUtils.getVideoPressShortcodeFromId(media.getVideoPressGuid())); return mediaFile; }
Source:
<code>public CommentInfo get() throws RestApiException { try { return CommentInfoMapper.INSTANCE.apply(getDraft.apply(draft)); } catch (OrmException e) { throw new RestApiException("Cannot <START> update draft", <END> e); } }</code><technical_language>retrieve</technical_language>

Target:
public CommentInfo get() throws RestApiException { try { return CommentInfoMapper.INSTANCE.apply(getDraft.apply(draft)); } catch (OrmException e) { throw new RestApiException("Cannot retrieve draft", e); } }
Source:
<code>public static <K, V, C> Function<CacheEntry<K, V>, CacheEntry<K, C>> converterToFunction(KeyValueFilterConverter<? super K, ? super V, C> filterConverter) { <START> return new FilterConverterAsCacheEntryFunction<K, V, C>(filterConverter); <END> }</code><technical_language>IntelliJ type parameters needed</technical_language>

Target:
public static <K, V, C> Function<CacheEntry<K, V>, CacheEntry<K, C>> converterToFunction(KeyValueFilterConverter<? super K, ? super V, C> filterConverter) { return new FilterConverterAsCacheEntryFunction<>(filterConverter); }
Source:
<code>protected void dataCenter_SelectedItemChanged() { AsyncDataProvider.getStorageDomainList(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { <START> MoveOrCopyDiskModel diskModel = (MoveOrCopyDiskModel) target; <END> @SuppressWarnings("unchecked") ArrayList<StorageDomain> storageDomains = (ArrayList<StorageDomain>) returnValue; diskModel.onInitStorageDomains(storageDomains); } }), ((StoragePool) getDataCenter().getSelectedItem()).getId()); }</code><technical_language>diskModel is for DiskModel instance. i.e. s/diskModel/moveOrCopyDiskModel</technical_language>

Target:
protected void dataCenter_SelectedItemChanged() { initStorageDomains(); }
Source:
<code>protected AbstractBeanDefinition doParse(Element element, ParserContext parserContext, String channelName) { BeanDefinitionBuilder builder = ReactorNamespaceUtils.createBeanDefitionBuilder(SyslogInboundChannelAdapter.class, element); String s = element.getAttribute("port"); int port = 5140; if (StringUtils.hasText(s)) { port = Integer.parseInt(s); <START> } <END> builder.addConstructorArgValue(port); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "channel", "outputChannel"); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "error-channel", "errorChannel"); return builder.getBeanDefinition(); }</code><technical_language>parse Integer - a property placeholder; context property editors care of it</technical_language>

Target:
protected AbstractBeanDefinition doParse(Element element, ParserContext parserContext, String channelName) { BeanDefinitionBuilder builder = ReactorNamespaceUtils.createBeanDefinitionBuilder(SyslogInboundChannelAdapter.class, element); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "host", "host"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "port", "port"); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "error-channel", "errorChannel"); return builder.getBeanDefinition(); }
Source:
<code>public void setTableId(Table.ID tId) { if (tId == null) <START> throw new IllegalArgumentException("null table id not allowed"); <END> this.tableId = tId; hashCode = 0; }</code><technical_language>This Objects.requiresNonNull(tId, "null table id allowed")</technical_language>

Target:
public void setTableId(Table.ID tId) { Objects.requireNonNull(tId, "null table id not allowed"); this.tableId = tId; hashCode = 0; }
Source:
<code>public Map<String, Integer> getPartitionCountWithPendingState(String resourceStateModel, String state) { Map<String, Integer> pendingPartitionCount = new HashMap<String, Integer>(); for (String resource : _pendingStateMap.keySet()) { String stateModel = _resourceStateModelMap.get(resource); <START> if (stateModel != null && stateModel.equals(resourceStateModel) <END> || stateModel == null && resourceStateModel == null) { for (Partition partition : _pendingStateMap.get(resource).keySet()) { Map<String, Message> partitionMessage = _pendingStateMap.get(resource).get(partition); for (Map.Entry<String, Message> participantMap : partitionMessage.entrySet()) { String participant = participantMap.getKey(); if (!pendingPartitionCount.containsKey(participant)) { pendingPartitionCount.put(participant, 0); } String toState = participantMap.getValue().getToState(); if (toState != null && toState.equals(state) || toState == null && state == null) { pendingPartitionCount.put(participant, pendingPartitionCount.get(participant) + 1); } } } } } return pendingPartitionCount; }</code><technical_language>IMHO generally group conditions people need google confirm "&& takes precedence ||"</technical_language>

Target:
public Map<String, Integer> getPartitionCountWithPendingState(String resourceStateModel, String state) { return getPartitionCountWithState(resourceStateModel, state, (Map) _pendingStateMap); }
Source:
<code>public static String descramble(String scrambled) { if(scrambled==null) return null; try { return new String(Base64.getDecoder().decode(scrambled.getBytes(StandardCharsets.UTF_8)),StandardCharsets.UTF_8); } catch (IllegalArgumentException e) { <START> return ""; END> } }</code><technical_language>related this PR wondering if returning null Optional.empty() in case of corrupted data better</technical_language>

Target:
public static String descramble(String scrambled) { if(scrambled==null) return null; try { return new String(Base64.getDecoder().decode(scrambled.getBytes(StandardCharsets.UTF_8)),StandardCharsets.UTF_8); } catch (IllegalArgumentException e) { LOGGER.log(Level.WARNING,"Corrupted data", e); return ""; } }
Source:
<code>public static final int[] getSubWordMatchingRegions(String pattern, String name) { <START> <END> if (name == null) return null; if (pattern == null) { return EMPTY_REGIONS; } int segmentStart = 0; int[] segments = EMPTY_REGIONS; char[] nameChars = name.toCharArray(); int iName = -1; for (int iPattern = 0; iPattern < pattern.length(); iPattern++) { iName++; if (iName == nameChars.length){ return null; } char patternChar = pattern.charAt(iPattern); char nameChar = nameChars[iName]; if (patternChar == nameChar) { continue; } if (ScannerHelper.toLowerCase(nameChar) == patternChar) { continue; } if (iName > segmentStart) { segments = Arrays.copyOf(segments, segments.length + 2); segments[segments.length - 2] = segmentStart; segments[segments.length - 1] = iName - segmentStart; } int wordStart = indexOfWordStart(nameChars, iName, patternChar); if (wordStart < 0) { return null; } segmentStart = wordStart; iName = wordStart; } segments = Arrays.copyOf(segments, segments.length + 2); segments[segments.length - 2] = segmentStart; segments[segments.length - 1] = iName - segmentStart + 1; return segments; }</code><technical_language>I fix extranous whitespace in this file</technical_language>

Target:
public static final int[] getSubWordMatchingRegions(String pattern, String name) { if (name == null) return null; if (pattern == null) { return EMPTY_REGIONS; } int segmentStart = 0; int[] segments = EMPTY_REGIONS; char[] nameChars = name.toCharArray(); int iName = -1; for (int iPattern = 0; iPattern < pattern.length(); iPattern++) { iName++; if (iName == nameChars.length){ return null; } char patternChar = pattern.charAt(iPattern); char nameChar = nameChars[iName]; if (patternChar == nameChar) { continue; } if (ScannerHelper.toLowerCase(nameChar) == patternChar) { continue; } if (iName > segmentStart) { segments = Arrays.copyOf(segments, segments.length + 2); segments[segments.length - 2] = segmentStart; segments[segments.length - 1] = iName - segmentStart; } int wordStart = CharOperation.indexOfWordStart(nameChars, iName, patternChar); if (wordStart < 0) { return null; } segmentStart = wordStart; iName = wordStart; } segments = Arrays.copyOf(segments, segments.length + 2); segments[segments.length - 2] = segmentStart; segments[segments.length - 1] = iName - segmentStart + 1; return segments; }
Source:
<code>protected void configure(HttpSecurity http) throws Exception { if(environment.acceptsProfiles("!"+Initializer.PROFILE_DEV)) { http.requiresChannel().antMatchers("/healthz").requiresInsecure() .and() .requiresChannel().mvcMatchers(" additional-field", ADMIN_API + "/event promo-code", ADMIN_API + "/reservation/event email/", ADMIN_API + "/event pending-payments", ADMIN_API + "/events sponsor-scan/export", ADMIN_API + "/events */audit" }; configurer.csrfTokenRepository(getCsrfTokenRepository()) .and() .authorizeRequests() .antMatchers(ADMIN_API + "/configuration new", ADMIN_API + "/reservation/event */notify", ADMIN_API + "/reservation/event performPayment").hasAnyRole(ADMIN, OWNER, SUPERVISOR) <END> .antMatchers(ADMIN_API + " export/**").hasAnyRole(ADMIN, OWNER) .antMatchers("/admin/**").hasAnyRole(ADMIN, OWNER, SUPERVISOR) .antMatchers("/api/attendees/**").denyAll() .antMatchers("/**").permitAll() .and() .formLogin() .loginPage("/authentication") .loginProcessingUrl("/authenticate") .failureUrl("/authentication?failed") .and().logout().permitAll(); http.addFilterBefore(new RecaptchaLoginFilter(recaptchaService, "/authenticate", "/authentication?recaptchaFailed", configurationManager), UsernamePasswordAuthenticationFilter.class); if(environment.acceptsProfiles(Initializer.PROFILE_DEMO)) { http.addFilterAfter(new UserCreatorBeforeLoginFilter(userManager, "/authenticate"), RecaptchaLoginFilter.class); } }</code><technical_language>performPayment -> perform-payment ? I url lowercase</technical_language>

Target:
protected void configure(HttpSecurity http) throws Exception { if(environment.acceptsProfiles("!"+Initializer.PROFILE_DEV)) { http.requiresChannel().antMatchers("/healthz").requiresInsecure() .and() .requiresChannel().mvcMatchers(" additional-field", ADMIN_API + "/event promo-code", ADMIN_API + "/reservation/event email/", ADMIN_API + "/event pending-payments", ADMIN_API + "/events sponsor-scan/export", ADMIN_API + "/events */audit" }; configurer.csrfTokenRepository(getCsrfTokenRepository()) .and() .authorizeRequests() .antMatchers(ADMIN_API + "/configuration new", ADMIN_API + "/reservation/event */notify", ADMIN_API + "/reservation/event confirm").hasAnyRole(ADMIN, OWNER, SUPERVISOR) .antMatchers(ADMIN_API + " export/**").hasAnyRole(ADMIN, OWNER) .antMatchers("/admin/**").hasAnyRole(ADMIN, OWNER, SUPERVISOR) .antMatchers("/api/attendees/**").denyAll() .antMatchers("/**").permitAll() .and() .formLogin() .loginPage("/authentication") .loginProcessingUrl("/authenticate") .failureUrl("/authentication?failed") .and().logout().permitAll(); http.addFilterBefore(new RecaptchaLoginFilter(recaptchaService, "/authenticate", "/authentication?recaptchaFailed", configurationManager), UsernamePasswordAuthenticationFilter.class); if(environment.acceptsProfiles(Initializer.PROFILE_DEMO)) { http.addFilterAfter(new UserCreatorBeforeLoginFilter(userManager, "/authenticate"), RecaptchaLoginFilter.class); } }
Source:
<code>private void setCurrentRepo(Repository newRepo) { Repository old = getCurrentRepo(); this.currentRepo = newRepo; <START> if(old == null) { if (newRepo == null) return; } else { if (old.equals(newRepo)) return; } <END> this.firePropertyChange(this, P_REPOSITORY, old, newRepo); }</code><technical_language>if(Objects.equals(old, new)) return; here? If not, please add breaces if/else cases</technical_language>

Target:
private void setCurrentRepo(Repository newRepo) { Repository old = getCurrentRepo(); this.currentRepo = newRepo; if (!Objects.equals(old, newRepo)) { this.firePropertyChange(this, P_REPOSITORY, old, newRepo); } }