auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private boolean updateCacheTopology(String cacheName, CacheTopology cacheTopology, Address sender, LocalCacheStatus cacheStatus) { synchronized (runningCaches) { if (!sender.equals(transport.getCoordinator())) { log.debugf("Ignoring topology %d from old coordinator %s", cacheTopology.getTopologyId(), sender); return false; } else { log.debugf("Updating local topology for cache %s: %s", cacheName, cacheTopology); <START> cacheStatus.setCurrentTopology(cacheTopology); <END> } } return true; }</code><technical_language>is this change needed</technical_language>

Target:
private boolean updateCacheTopology(String cacheName, CacheTopology cacheTopology, Address sender, LocalCacheStatus cacheStatus) { synchronized (runningCaches) { if (!sender.equals(transport.getCoordinator())) { log.debugf("Ignoring topology %d from old coordinator %s", cacheTopology.getTopologyId(), sender); return false; } } log.debugf("Updating local topology for cache %s: %s", cacheName, cacheTopology); cacheStatus.setCurrentTopology(cacheTopology); return true; }
Source:
<code><START> private boolean isAcceptableType(Env env, JavaType arg, JavaType formal, boolean autoboxing) { <END> if(arg.isTagged(JavaType.DEFERRED)) { List<JavaType> samMethodArgs = findSamMethodArgs(formal); AbstractTypedTree tree = ((DeferredType) arg).tree(); if (tree.is(Tree.Kind.METHOD_REFERENCE)) { return validMethodReference(env, (MethodReferenceTree) tree, samMethodArgs); } return !tree.is(Tree.Kind.LAMBDA_EXPRESSION) || ((LambdaExpressionTree) tree).parameters().size() == samMethodArgs.size(); } if(formal.isTagged(JavaType.TYPEVAR) && !arg.isTagged(JavaType.TYPEVAR)) { return subtypeOfTypeVar(arg, (TypeVariableJavaType) formal); } if (formal.isArray() && arg.isArray()) { return isAcceptableType(env, ((ArrayJavaType) arg).elementType(), ((ArrayJavaType) formal).elementType(), autoboxing); } if (arg.isParameterized() || formal.isParameterized() || isWilcardType(arg) || isWilcardType(formal)) { return callWithRawType(arg, formal) || types.isSubtype(arg, formal) || isAcceptableByAutoboxing(arg, formal.erasure()); } return types.isSubtype(arg.erasure(), formal.erasure()) || (autoboxing && isAcceptableByAutoboxing(arg, formal.erasure())); }</code><technical_language>![MAJOR](<LINK_1> Reduce number of returns of this method 6, maximum allowed 5. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
private boolean isAcceptableType(Env env, JavaType arg, JavaType formal, boolean autoboxing) { if(arg.isTagged(JavaType.DEFERRED)) { List<JavaType> samMethodArgs = findSamMethodArgs(formal); AbstractTypedTree tree = ((DeferredType) arg).tree(); if (tree.is(Tree.Kind.METHOD_REFERENCE)) { return validMethodReference(env, (MethodReferenceTree) tree, formal, samMethodArgs); } return !tree.is(Tree.Kind.LAMBDA_EXPRESSION) || ((LambdaExpressionTree) tree).parameters().size() == samMethodArgs.size(); } if(formal.isTagged(JavaType.TYPEVAR) && !arg.isTagged(JavaType.TYPEVAR)) { return subtypeOfTypeVar(arg, (TypeVariableJavaType) formal); } if (formal.isArray() && arg.isArray()) { return isAcceptableType(env, ((ArrayJavaType) arg).elementType(), ((ArrayJavaType) formal).elementType(), autoboxing); } if (arg.isParameterized() || formal.isParameterized() || isWilcardType(arg) || isWilcardType(formal)) { return callWithRawType(arg, formal) || types.isSubtype(arg, formal) || isAcceptableByAutoboxing(arg, formal.erasure()); } return types.isSubtype(arg.erasure(), formal.erasure()) || (autoboxing && isAcceptableByAutoboxing(arg, formal.erasure())); }
Source:
<code>public Object invoke(ELContext context, Object base, Object method, Class<?>[] paramTypes, Object[] params) { if ( resolve( context, base, method ) ) { throw new ValidationException( "Invalid property" ); } Object returnValue = null; <START> if ( base instanceof FormatterWrapper ) { <END> returnValue = evaluateFormatExpression( context, base, method, paramTypes, params ); } return returnValue; }</code><technical_language>other methods invoked, e.g. ${'FooBar'.subString(3)}? I guess lots of sense, I is legal. WDYT</technical_language>

Target:
public Object invoke(ELContext context, Object base, Object method, Class<?>[] paramTypes, Object[] params) { if ( resolve( context, base, method ) ) { throw new ValidationException( "Invalid property" ); } Object returnValue = null; if ( base instanceof FormatterWrapper ) { returnValue = evaluateFormatExpression( context, method, params ); } return returnValue; }
Source:
<code>private String getMetadataContainerElement() { if (isInlineMacro) { return "span"; } else { return "div"; <START> } <END> }</code><technical_language>remove empty line</technical_language>

Target:
private String getMetadataContainerElement() { if (getBlockState().isInLine()) { return "span"; } else { return "div"; } }
Source:
<code>public VdcReturnValueBase ExecuteAction() { _actionState = CommandActionState.EXECUTE; String tempVar = getDescription(); getReturnValue().setDescription((tempVar != null) ? tempVar : getReturnValue().getDescription()); setActionMessageParameters(); boolean actionAllowed = false; Step validatingStep = ExecutionHandler.addStep(executionContext, StepEnum.VALIDATING, null); try { <START> try { <END> actionAllowed = acquireLock() && (getReturnValue().getCanDoAction() || InternalCanDoAction()); } finally { ExecutionHandler.endStep(executionContext, validatingStep, actionAllowed); } if (actionAllowed) { getReturnValue().setCanDoAction(true); getReturnValue().setIsSyncronious(true); getParameters().setTaskStartTime(System.currentTimeMillis()); Execute(); } else { getReturnValue().setCanDoAction(false); } } finally { freeLock(); } return getReturnValue(); }</code><technical_language>Exception thrown here, need finally try</technical_language>

Target:
public VdcReturnValueBase ExecuteAction() { _actionState = CommandActionState.EXECUTE; String tempVar = getDescription(); getReturnValue().setDescription((tempVar != null) ? tempVar : getReturnValue().getDescription()); setActionMessageParameters(); boolean actionAllowed = false; Step validatingStep = ExecutionHandler.addStep(executionContext, StepEnum.VALIDATING, null); try { actionAllowed = acquireLock() && (getReturnValue().getCanDoAction() || InternalCanDoAction()); ExecutionHandler.endStep(executionContext, validatingStep, actionAllowed); if (actionAllowed) { getReturnValue().setCanDoAction(true); getReturnValue().setIsSyncronious(true); getParameters().setTaskStartTime(System.currentTimeMillis()); Execute(); } else { getReturnValue().setCanDoAction(false); } } finally { freeLock(); } return getReturnValue(); }
Source:
<code>private Collection<AsyncQuery> updateAsyncQueryCollection(FilterExpression filterExpression, UpdateQuery updateFunction) { log.debug("updateAsyncQueryCollection"); Collection<AsyncQuery> asyncQueryList = null; try { asyncQueryList = (Collection<AsyncQuery>) executeInTransaction(dataStore, (tx, scope) -> { EntityProjection asyncQueryCollection = EntityProjection.builder() .type(AsyncQuery.class) .filterExpression(filterExpression) .build(); Iterable<Object> loaded = tx.loadObjects(asyncQueryCollection, scope); Iterator<Object> itr = loaded.iterator(); while (itr.hasNext()) { AsyncQuery query = (AsyncQuery) itr.next(); updateFunction.update(query); tx.save(query, scope); } return loaded; }); <START> } catch (Exception e) { <END> log.error("Exception: {}", e); } return asyncQueryList; }</code><technical_language>This is broad is swallowing exceptions need propagated</technical_language>

Target:
private Collection<AsyncQuery> updateAsyncQueryCollection(FilterExpression filterExpression, UpdateQuery updateFunction) { log.debug("updateAsyncQueryCollection"); Collection<AsyncQuery> asyncQueryList = null; asyncQueryList = (Collection<AsyncQuery>) executeInTransaction(dataStore, (tx, scope) -> { EntityProjection asyncQueryCollection = EntityProjection.builder() .type(AsyncQuery.class) .filterExpression(filterExpression) .build(); Iterable<Object> loaded = tx.loadObjects(asyncQueryCollection, scope); Iterator<Object> itr = loaded.iterator(); while (itr.hasNext()) { AsyncQuery query = (AsyncQuery) itr.next(); updateFunction.update(query); tx.save(query, scope); } return loaded; }); return asyncQueryList; }
Source:
<code>private void readArchive(ZipFile zipFile) throws IOException { Enumeration<? extends ZipEntry> zipEnums = zipFile.entries(); while (zipEnums.hasMoreElements()) { ZipEntry entry = zipEnums.nextElement(); if (!entry.isDirectory()) { if (defaultsConf == null && entry.getName().equals("defaults.yaml")) { <START> try (InputStream in = zipFile.getInputStream(entry); InputStreamReader isr = new InputStreamReader(in)) { <END> defaultsConf = (Map<String, Object>) yaml.load(isr); } } if (stormConf == null && entry.getName().equals("storm.yaml")) { try (InputStream in = zipFile.getInputStream(entry); InputStreamReader isr = new InputStreamReader(in)) { stormConf = (Map<String, Object>) yaml.load(isr); } } } } }</code><technical_language>Nit: in variable, builder isr in step</technical_language>

Target:
private void readArchive(ZipFile zipFile) throws IOException { Enumeration<? extends ZipEntry> zipEnums = zipFile.entries(); while (zipEnums.hasMoreElements()) { ZipEntry entry = zipEnums.nextElement(); if (!entry.isDirectory()) { if (defaultsConf == null && entry.getName().equals("defaults.yaml")) { try (InputStreamReader isr = new InputStreamReader(zipFile.getInputStream(entry))) { defaultsConf = (Map<String, Object>) yaml.load(isr); } } if (stormConf == null && entry.getName().equals("storm.yaml")) { try (InputStreamReader isr = new InputStreamReader(zipFile.getInputStream(entry))) { stormConf = (Map<String, Object>) yaml.load(isr); } } } } }
Source:
<code>private static void printUsage() { <START> final HelpFormatter formatter = new HelpFormatter(); <END> formatter.setWidth(HELP_WIDTH); formatter.printHelp(String.format("java %s [options] -c <config.xml> file...", Main.class.getName()), buildOptionsExcludeHidden()); }</code><technical_language>Please revert this formatting changes</technical_language>

Target:
private static void printUsage() { final HelpFormatter formatter = new HelpFormatter(); formatter.setWidth(HELP_WIDTH); formatter.printHelp(String.format("java %s [options] -c <config.xml> file...", Main.class.getName()), buildOptions()); }
Source:
<code>public String validateFields() { if (this.isEmptyField(FIELD_STRING)) { return Constant.messages.getString("brk.brkpoint.error.nostr"); } if (Match.regex.equals(this.strToMatch(this.getStringValue(FIELD_MATCH)))) { try { Pattern.compile(this.getStringValue(FIELD_STRING)); } catch (Exception e) { return Constant.messages.getString("brk.brkpoint.error.regex"); } } return null; <START> if(FIELD_STRING.contains("#")==true){ <END> return Constant.messages.getString("brk.brkpoint.edit.title"); } }</code><technical_language>do contains of field (e.g. getStringValue(FIELD_STRING)). - comparison true removed. - Note this check needs done return statement</technical_language>

Target:
public String validateFields() { if (this.isEmptyField(FIELD_STRING)) { return Constant.messages.getString("brk.brkpoint.error.nostr"); } if (Match.regex.equals(this.strToMatch(this.getStringValue(FIELD_MATCH)))) { try { Pattern.compile(this.getStringValue(FIELD_STRING)); } catch (Exception e) { return Constant.messages.getString("brk.brkpoint.error.regex"); } } if (this.getStringValue(FIELD_STRING).contains("#") && Location.url.equals(this.strToLoc(this.getStringValue(FIELD_LOCATION))) && Match.contains.equals(this.strToMatch(this.getStringValue(FIELD_MATCH)))) { return Constant.messages.getString("brk.brkpoint.warn.urlfragment"); } return null; }
Source:
<code>protected DeleteImageGroupVDSCommandParameters buildDeleteMemoryImageParams(List<Guid> guids) { return <START> Injector.get(PostDeleteActionHandler.class).fixParameters( <END> new DeleteImageGroupVDSCommandParameters(guids.get(1), guids.get(0), guids.get(2), isPostZero(), false)); }</code><technical_language>a field in more place, initialize in constructor</technical_language>

Target:
protected DeleteImageGroupVDSCommandParameters buildDeleteMemoryImageParams(List<Guid> guids) { return postDeleteActionHandler.fixParameters( new DeleteImageGroupVDSCommandParameters(guids.get(1), guids.get(0), guids.get(2), isPostZero(), false)); }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { Shell activeShell= HandlerUtil.getActiveShell(event); Object newNameValue= HandlerUtil.getVariable(event, LTK_RENAME_COMMAND_NEWNAME_PARAMETER_KEY); String newName= null; if (newNameValue instanceof String) { newName= (String) newNameValue; <START> } <END> ISelection sel= HandlerUtil.getCurrentSelection(event); if (sel instanceof IStructuredSelection) { IResource resource= getCurrentResource((IStructuredSelection) sel); if (resource != null) { RenameResourceWizard refactoringWizard= new RenameResourceWizard(resource); if (newName != null) { refactoringWizard.setNewName(newName); } RefactoringWizardOpenOperation op= new RefactoringWizardOpenOperation(refactoringWizard); try { op.run(activeShell, RefactoringUIMessages.RenameResourceHandler_title); } catch (InterruptedException e) { } } } return null; }</code><technical_language>else log</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { Shell activeShell= HandlerUtil.getActiveShell(event); Object newNameValue= HandlerUtil.getVariable(event, LTK_RENAME_COMMAND_NEWNAME_PARAMETER_KEY); String newName= null; if (newNameValue instanceof String) { newName= (String) newNameValue; } else { RefactoringUIPlugin.logErrorMessage("Rename refactoring command new name parameter, expected String but got a " + newNameValue.getClass().getName()); } ISelection sel= HandlerUtil.getCurrentSelection(event); if (sel instanceof IStructuredSelection) { IResource resource= getCurrentResource((IStructuredSelection) sel); if (resource != null) { RenameResourceWizard refactoringWizard; if (newName != null) { refactoringWizard= new RenameResourceWizard(resource, newName); } else { refactoringWizard= new RenameResourceWizard(resource); } RefactoringWizardOpenOperation op= new RefactoringWizardOpenOperation(refactoringWizard); try { op.run(activeShell, RefactoringUIMessages.RenameResourceHandler_title); } catch (InterruptedException e) { } } } return null; }
Source:
<code>protected Control createDialogArea(Composite parent) { Composite parent2 = (Composite) super.createDialogArea(parent); Composite composite = new Composite(parent2, SWT.NONE); composite.setLayout(new GridLayout(1, false)); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).applyTo(composite); createCenterArea(composite); composite.pack(); <START> return parent; <END> }</code><technical_language>this return parent2</technical_language>

Target:
protected Control createDialogArea(Composite parent) { Composite parent2 = (Composite) super.createDialogArea(parent); Composite composite = new Composite(parent2, SWT.NONE); composite.setLayout(new GridLayout(1, false)); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).applyTo(composite); createCenterArea(composite); composite.pack(); return parent2; }
Source:
<code>public void test() throws Exception { test(false); test(true); testDropReferencedUserDefinedFunction(); testDropCascade(); testScriptExcludeSchema(); testScriptExcludeTable(); testScriptExcludeFunctionAlias(); testScriptExcludeConstant(); testScriptExcludeSequence(); testScriptExcludeConstraint(); testScriptExcludeTrigger(); testScriptExcludeRight(); testRunscriptFromClasspath(); testCancelScript(); testEncoding(); testClobPrimaryKey(); <START> testComment(); <END> deleteDb("runscript"); }</code><technical_language>Please, move this test createTable.sql. SCRIPT TABLE TEST1 output is big I reason custom checks for presence of substrings</technical_language>

Target:
public void test() throws Exception { test(false); test(true); testDropReferencedUserDefinedFunction(); testDropCascade(); testScriptExcludeSchema(); testScriptExcludeTable(); testScriptExcludeFunctionAlias(); testScriptExcludeConstant(); testScriptExcludeSequence(); testScriptExcludeConstraint(); testScriptExcludeTrigger(); testScriptExcludeRight(); testRunscriptFromClasspath(); testCancelScript(); testEncoding(); testClobPrimaryKey(); deleteDb("runscript"); }
Source:
<code>public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CONDITIONAL_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); StartConditionalEvent emptySubprocess = getStartNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, StartConditionalEvent.class); assertGeneralSet(emptySubprocess.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertConditionalEventExecutionSet(emptySubprocess.getExecutionSet(), CONDITION_EXPRESSION_SCRIPT_DEFAULT_VALUE, CONDITION_EXPRESSION_LANGUAGE, CONDITION_ERPRESSION_TYPE, NON_INTERRUPTING, <START> ""); <END> }</code><technical_language>suggestion EMPTY_VALUE);</technical_language>

Target:
public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CONDITIONAL_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); StartConditionalEvent emptySubprocess = getStartNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, StartConditionalEvent.class); assertGeneralSet(emptySubprocess.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertConditionalEventExecutionSet(emptySubprocess.getExecutionSet(), CONDITION_EXPRESSION_SCRIPT_DEFAULT_VALUE, CONDITION_EXPRESSION_LANGUAGE, CONDITION_ERPRESSION_TYPE, NON_INTERRUPTING, EMPTY_VALUE); }
Source:
<code>public void testCascadingDeletion() throws IOException, InterruptedException { server.expect().delete().withPath("/apis/test.fabric8.io/v1alpha1/namespaces/ns1/hellos/example-hello").andReturn(HttpURLConnection.HTTP_OK, "{\"metadata\":{},\"apiVersion\":\"v1\",\"kind\":\"Status\",\"details\":{\"name\":\"prometheus-example-rules\",\"group\":\"monitoring.coreos.com\",\"kind\":\"prometheusrules\",\"uid\":\"b3d085bd-6a5c-11e9-8787-525400b18c1d\"},\"status\":\"Success\"}").once(); KubernetesClient client = server.getClient(); Map<String, Object> result = client.customResource(customResourceDefinitionContext) .delete("ns1", "example-hello", true); assertEquals("Success", result.get("status")); <START> DeleteOptions expectedDeleteOptions = new DeleteOptions(); <END> expectedDeleteOptions.setPropagationPolicy("Orphan"); RecordedRequest request = server.getLastRequest(); assertEquals("DELETE", request.getMethod()); assertEquals("{\"apiVersion\":\"v1\",\"kind\":\"DeleteOptions\",\"orphanDependents\":false}", request.getBody().readUtf8()); }</code><technical_language>find this is used</technical_language>

Target:
public void testCascadingDeletion() throws IOException, InterruptedException { server.expect().delete().withPath("/apis/test.fabric8.io/v1alpha1/namespaces/ns1/hellos/example-hello").andReturn(HttpURLConnection.HTTP_OK, "{\"metadata\":{},\"apiVersion\":\"v1\",\"kind\":\"Status\",\"details\":{\"name\":\"prometheus-example-rules\",\"group\":\"monitoring.coreos.com\",\"kind\":\"prometheusrules\",\"uid\":\"b3d085bd-6a5c-11e9-8787-525400b18c1d\"},\"status\":\"Success\"}").once(); KubernetesClient client = server.getClient(); Map<String, Object> result = client.customResource(customResourceDefinitionContext) .delete("ns1", "example-hello", true); assertEquals("Success", result.get("status")); RecordedRequest request = server.getLastRequest(); assertEquals("DELETE", request.getMethod()); assertEquals("{\"apiVersion\":\"v1\",\"kind\":\"DeleteOptions\",\"orphanDependents\":false}", request.getBody().readUtf8()); }
Source:
<code>public void execute(String[] args, ConsoleReader reader) throws Exception { try (AppPackage ap = newAppPackageInstance(new File(expandFileName(args[1], true)))) { for (Map.Entry<String, PropertyInfo> entry : ap.getDefaultProperties().entrySet()) { <START> if (entry.getKey().contains(".attr.")) { <END> entry.getValue().setDescription(null); } } for (AppInfo appInfo : ap.getApplications()) { for (Map.Entry<String, PropertyInfo> entry : appInfo.defaultProperties.entrySet()) { if (entry.getKey().contains(".attr.")) { entry.getValue().setDescription(null); } } } JSONSerializationProvider jomp = new JSONSerializationProvider(); JSONObject apInfo = new JSONObject(jomp.getContext(null).writeValueAsString(ap)); apInfo.remove("name"); printJson(apInfo); } }</code><technical_language>While creating PropertyInfo load Description for attributes. need for loops</technical_language>

Target:
public void execute(String[] args, ConsoleReader reader) throws Exception { try (AppPackage ap = newAppPackageInstance(new File(expandFileName(args[1], true)))) { JSONSerializationProvider jomp = new JSONSerializationProvider(); JSONObject apInfo = new JSONObject(jomp.getContext(null).writeValueAsString(ap)); apInfo.remove("name"); printJson(apInfo); } }
Source:
<code>public void saveWMSServerFile() { try { <START> CoreWorkspace ws = (CoreWorkspace) Services.getService(CoreWorkspace.class); <END> File file = new File(ws.getWorkspaceFolder() + File.separator + WMSServerFile); PrintWriter pw = new PrintWriter(file); for (String server : serverswms) { pw.println(server); } pw.close(); } catch (FileNotFoundException e) { LOGGER.error(I18N.tr("Cannot save the list of WMS url")); } }</code><technical_language>useless cast</technical_language>

Target:
public void saveWMSServerFile() { try { CoreWorkspace ws = Services.getService(CoreWorkspace.class); File file = new File(ws.getWorkspaceFolder() + File.separator + WMSServerFile); PrintWriter pw = new PrintWriter(file); for (String server : serverswms) { pw.println(server); } pw.close(); } catch (FileNotFoundException e) { LOGGER.error(I18N.tr("Cannot save the list of WMS url")); } }
Source:
<code>private static MerchantConfig getInstanceMap(Map<String, String> request, Properties props) throws ConfigException { <START> String key = getKeyForInstanceMap(request, props); <END> if(!mcObjects.containsKey(key)) { synchronized (Client.class) { if (!mcObjects.containsKey(key)) { mcObjects.put(key, getMerchantConfigObject(request, props)); } } } return mcObjects.get(key); }</code><technical_language>midOrKeyAlias</technical_language>

Target:
private static MerchantConfig getInstanceMap(Map<String, String> request, Properties props) throws ConfigException { String midOrKeyAlias = getKeyForInstanceMap(request, props); if(!mcObjects.containsKey(midOrKeyAlias)) { synchronized (Client.class) { if (!mcObjects.containsKey(midOrKeyAlias)) { mcObjects.put(midOrKeyAlias, getMerchantConfigObject(request, props)); } } } MerchantConfig mc = mcObjects.get(midOrKeyAlias); String merchantID = request.get(ELEM_MERCHANT_ID); if(StringUtils.isEmpty(merchantID)) { merchantID = mc.getMerchantID(); request.put(ELEM_MERCHANT_ID, merchantID); } return mc; }
Source:
<code>private MockHelixPropertyStore<ZNRecord> getMockHelixStore(HelixPropertyStoreConfig storeConfig) { String storeRootPath = storeConfig.zkClientConnectString + storeConfig.rootPath; MockHelixPropertyStore<ZNRecord> helixStore = storeKeyToMockStoreMap.get(storeRootPath); if (helixStore == null) { helixStore = new MockHelixPropertyStore<>(); storeKeyToMockStoreMap.put(storeRootPath, helixStore); } <START> return helixStore; <END> }</code><technical_language>minor: replace lines 89-94 java return storeKeyToMockStoreMap.computeIfAbsent(storeRootPath, path -> new MockHelixPropertyStore<>);</technical_language>

Target:
private MockHelixPropertyStore<ZNRecord> getMockHelixStore(HelixPropertyStoreConfig storeConfig) { return storeKeyToMockStoreMap.computeIfAbsent(storeConfig.zkClientConnectString + storeConfig.rootPath, path -> new MockHelixPropertyStore<>()); }
Source:
<code>public void run() { try { InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line = null; while ((line = br.readLine()) != null) { sb.append(line); sb.append(System.getProperty("line.separator")); } } catch (IOException ioe) { <START> ioe.printStackTrace(); <END> } }</code><technical_language>System.out call :(</technical_language>

Target:
public void run() { try (InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr)){ String line = null; while ((line = br.readLine()) != null) { sb.append(line); sb.append(System.getProperty("line.separator")); } } catch (IOException ioe) { throw new RuntimeException("Problem consuming stream: " + ioe.getMessage(), ioe); } }
Source:
<code>public UpdateQuery build() { <START> Checks.checkNotEmpty(table, "Please specify table name"); <END> return new UpdateQuery( table, where, whereArgs ); }</code><technical_language>Static import</technical_language>

Target:
public UpdateQuery build() { checkNotEmpty(table, "Please specify table name"); return new UpdateQuery( table, where, whereArgs ); }
Source:
<code>public void initialize(Context context) { context.registerSyntaxNodeConsumer(PyElementTypes.PRINT_STATEMENT, ctx -> { PyPrintStatement node = (PyPrintStatement) ctx.syntaxNode(); PsiElement currentNode = node.getFirstChild().getNextSibling(); while (currentNode instanceof PsiWhiteSpace) { currentNode = currentNode.getNextSibling(); } <START> if (currentNode == null || !currentNode.getText().startsWith("(")) { <END> ctx.addIssue(node.getFirstChild(), "Replace print statement by built-in function."); } }); }</code><technical_language>Suggestion: if (PsiTreeUtil.findChildOfType(ctx.syntaxNode(), PyParenthesizedExpression.class) == null) {</technical_language>

Target:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(PyElementTypes.PRINT_STATEMENT, ctx -> { List<PyElement> expressions = PsiTreeUtil.getChildrenOfAnyType(ctx.syntaxNode(), PyExpression.class, PyPrintTarget.class); if (expressions.size() == 1 && expressions.get(0) instanceof PyParenthesizedExpression) { return; } ctx.addIssue(ctx.syntaxNode().getFirstChild(), "Replace print statement by built-in function."); }); }
Source:
<code>public <T> String display(Type targetType, T value) throws HTMLDisplayerException { <START> if (targetType == null && value != null) { <END> return getHTMLDisplayer(value.getClass()).display(value); } else { return getHTMLDisplayer(targetType).display(value); } }</code><technical_language>a detail: I created a private (maybe sense in public sure) getHTMLDisplayer(Type targetType, Object value) put this logic in a common method</technical_language>

Target:
public <T> String display(Type targetType, T value) throws HTMLDisplayerException { Type type = getType(targetType, value); return getHTMLDisplayer(type).display(type, value); }
Source:
<code>private List<String> getIds(Map<String, Serializable> params) throws IOException { List<String> ids = new ArrayList<>(); Object ofs = OBJECTS_IDS_FOR_SCHEMA.lookUp(params); <START> if (ofs == null || !(ofs instanceof String)) return ids; <END> String idsStr = (String) ofs; String[] parts = idsStr.split(","); for (String epart : parts) { String id = epart.trim(); if (StringUtils.isNotEmpty(id)) ids.add(id); } return ids; }</code><technical_language>if is NULL empty sense return empty list, if is a string exception throw no? silently swallowing some error</technical_language>

Target:
private List<String> getIds(Map<String, Serializable> params) throws IOException { List<String> ids = new ArrayList<>(); Object ofs = OBJECTS_IDS_FOR_SCHEMA.lookUp(params); if (ofs == null) return ids; if (!(ofs instanceof String)) { throw new IllegalArgumentException("Object Ids parameter should be String type."); } String idsStr = (String) ofs; String[] parts = idsStr.split(","); for (String epart : parts) { String id = epart.trim(); if (StringUtils.isNotEmpty(id)) ids.add(id); } return ids; }
Source:
<code>public void handleGet(RestRequestInfo restRequestInfo) throws RestServiceException { RestRequestMetadata restRequestMetadata = restRequestInfo.getRestRequestMetadata(); logger.trace("Handling get restRequestMetadata - " + restRequestMetadata.getUri()); AdminOperationType operationType = getOperationType(restRequestMetadata); switch (operationType) { case echo: EchoHandler.handleRequest(restRequestInfo); break; case getReplicasForBlobId: GetReplicasForBlobIdHandler.handleRequest(restRequestInfo, clusterMap); break; default: <START> throw new IllegalStateException("Blob GET not implemented"); <END> } }</code><technical_language>this "Unsupported operation for Admin service"</technical_language>

Target:
public void handleGet(RestRequestInfo restRequestInfo) throws RestServiceException { RestRequestMetadata restRequestMetadata = restRequestInfo.getRestRequestMetadata(); logger.trace("Handling get restRequestMetadata - " + restRequestMetadata.getUri()); AdminOperationType operationType = getOperationType(restRequestMetadata); switch (operationType) { case echo: EchoHandler.handleRequest(restRequestInfo); break; case getReplicasForBlobId: GetReplicasForBlobIdHandler.handleRequest(restRequestInfo, clusterMap); break; default: throw new RestServiceException("Unsupported operation for Admin service", RestServiceErrorCode.UnsupportedOperation); } }
Source:
<code>private SqlInvokedFunction createSqlInvokedFunction(CreateFunction statement) { if (statement.getFunctionName().getParts().size() != 3) { throw new PrestoException(GENERIC_USER_ERROR, format("Invalid function name: %s, require exactly 3 parts", statement.getFunctionName())); } QualifiedFunctionName functionName = QualifiedFunctionName.of( new CatalogSchemaName( <START> statement.getFunctionName().getParts().get(0), <END> statement.getFunctionName().getParts().get(1)), statement.getFunctionName().getParts().get(2)); List<SqlParameter> parameters = statement.getParameters().stream() .map(parameter -> new SqlParameter(parameter.getName().toString().toLowerCase(ENGLISH), parseTypeSignature(parameter.getType()))) .collect(toImmutableList()); TypeSignature returnType = parseTypeSignature(statement.getReturnType()); String description = statement.getComment().orElse(""); RoutineCharacteristics routineCharacteristics = new RoutineCharacteristics( RoutineCharacteristics.Language.valueOf(statement.getCharacteristics().getLanguage().name()), RoutineCharacteristics.Determinism.valueOf(statement.getCharacteristics().getDeterminism().name()), RoutineCharacteristics.NullCallClause.valueOf(statement.getCharacteristics().getNullCallClause().name())); String body = formatSql(statement.getBody(), Optional.empty()); return new SqlInvokedFunction( functionName, parameters, returnType, description, routineCharacteristics, body, Optional.empty()); }</code><technical_language>nit: for readability, introduce a local variable for statement.getFunctionName().getParts() in check</technical_language>

Target:
private SqlInvokedFunction createSqlInvokedFunction(CreateFunction statement) { List<String> parts = statement.getFunctionName().getParts(); if (parts.size() != 3) { throw new PrestoException(GENERIC_USER_ERROR, format("Invalid function name: %s, require exactly 3 parts", statement.getFunctionName())); } QualifiedFunctionName functionName = QualifiedFunctionName.of( new CatalogSchemaName(parts.get(0), parts.get(1)), parts.get(2)); List<SqlParameter> parameters = statement.getParameters().stream() .map(parameter -> new SqlParameter(parameter.getName().toString().toLowerCase(ENGLISH), parseTypeSignature(parameter.getType()))) .collect(toImmutableList()); TypeSignature returnType = parseTypeSignature(statement.getReturnType()); String description = statement.getComment().orElse(""); RoutineCharacteristics routineCharacteristics = new RoutineCharacteristics( RoutineCharacteristics.Language.valueOf(statement.getCharacteristics().getLanguage().name()), RoutineCharacteristics.Determinism.valueOf(statement.getCharacteristics().getDeterminism().name()), RoutineCharacteristics.NullCallClause.valueOf(statement.getCharacteristics().getNullCallClause().name())); String body = formatSql(statement.getBody(), Optional.empty()); return new SqlInvokedFunction( functionName, parameters, returnType, description, routineCharacteristics, body, Optional.empty()); }
Source:
<code>public void calledWithTooFewCommandArguments_returnsError() { List<byte[]> commandAsBytes = new ArrayList<>(); commandAsBytes.add("EXPIREAT".getBytes()); commandAsBytes.add("key".getBytes()); Command command = new Command(commandAsBytes); <START> Throwable thrown = catchThrowable(() -> command.execute(mockContext())); <END> AssertionsForClassTypes.assertThat(thrown).hasMessageContaining("wrong number of arguments"); AssertionsForClassTypes.assertThat(thrown).isInstanceOf(RedisParametersMismatchException.class); }</code><technical_language>this a assertThatThrownBy assertion</technical_language>

Target:
public void calledWithTooFewCommandArguments_returnsError() { List<byte[]> commandAsBytes = new ArrayList<>(); commandAsBytes.add("EXPIREAT".getBytes()); commandAsBytes.add("key".getBytes()); Command command = new Command(commandAsBytes); assertThatThrownBy(() -> command.execute(mockContext())) .hasMessageContaining("wrong number of arguments") .isInstanceOf(RedisParametersMismatchException.class); }
Source:
<code>public void onReceive(Context ctx, Intent intent) { String action = intent.getAction(); switch (action) { case INSTALL_ACTION: installReferrer(ctx, intent); break; case Intent.ACTION_BOOT_COMPLETED: recordChannelId(ctx); NotificationPollService.start(ctx.getApplicationContext()); break; <START> default: <END> L.d("action=" + action); break; } }</code><technical_language>InstallReceiver depend a WikipediaApp instance created system? NotificationPollService.start() is called there, I this call a time</technical_language>

Target:
public void onReceive(Context ctx, Intent intent) { String action = intent.getAction(); switch (action) { case INSTALL_ACTION: installReferrer(ctx, intent); break; case Intent.ACTION_BOOT_COMPLETED: recordChannelId(ctx); break; default: L.d("action=" + action); break; } }
Source:
<code>public void testExecuteAsyncInvalidTable() throws Exception { GroupRequest groupRequest = new GroupRequest(); groupRequest.setTable(TestUtils.TEST_TABLE_NAME + "-dummy-32"); groupRequest.setNesting(Arrays.asList("os", "device", "version")); <START> queryExecutor.executeAsync(groupRequest); <END> }</code><technical_language>Check for equality of error code</technical_language>

Target:
public void testExecuteAsyncInvalidTable() throws Exception { GroupRequest groupRequest = new GroupRequest(); groupRequest.setTable(TestUtils.TEST_TABLE_NAME + "-dummy-32"); groupRequest.setNesting(Arrays.asList("os", "device", "version")); try { queryExecutor.executeAsync(groupRequest); } catch (QueryStoreException e) { assertEquals(QueryStoreException.ErrorCode.NO_SUCH_TABLE, e.getErrorCode()); throw e; } }
Source:
<code>private Object visitModify(InvocationContext ctx, FlagAffectedCommand command, Object key) throws Throwable { if (isProperWriter(ctx, command, key)) { CacheEntry entry = ctx.lookupEntry(key); if (!entry.isChanged()) { return null; } else if (entry.getValue() == null) { getModifications(ctx, key, command).removeEntry(key); } else { if (generateStatistics) putCount++; InternalCacheValue sv = entryFactory.getValueFromCtx(key, ctx); if (sv != null) { <START> MarshallableEntry me = marshalledEntryFactory.create(key, sv); <END> getModifications(ctx, key, command).addMarshalledEntry(key, me); } } } return null; }</code><technical_language>Changing MarshallableEntryFactory variable to: java private final MarshallableEntryFactory<?, ?> marshalledEntryFactory; quickly update usages MarshallableEntry<?, ?> CacheEntry<?, ?> class</technical_language>

Target:
private Object visitModify(InvocationContext ctx, FlagAffectedCommand command, Object key) { if (isProperWriter(ctx, command, key)) { CacheEntry<?, ?> entry = ctx.lookupEntry(key); if (!entry.isChanged()) { return null; } else if (entry.getValue() == null) { getModifications(ctx, key, command).removeEntry(key); } else { if (generateStatistics) putCount++; InternalCacheValue<?> sv = entryFactory.getValueFromCtx(key, ctx); if (sv != null) { MarshallableEntry<? ,?> me = marshalledEntryFactory.create(key, (InternalCacheValue) sv); getModifications(ctx, key, command).addMarshalledEntry(key, me); } } } return null; }
Source:
<code>public PlanInterpreterGuessingType reconstruct() { attemptType(null, CatalogItemType.ENTITY); <START> attemptType(null, CatalogItemType.TEMPLATE); <END> attemptType("services", CatalogItemType.ENTITY); attemptType(POLICIES_KEY, CatalogItemType.POLICY); attemptType(LOCATIONS_KEY, CatalogItemType.LOCATION); if (!resolved && catalogItemType==CatalogItemType.TEMPLATE) { planYaml = itemYaml; resolved = true; } return this; }</code><technical_language>This succeed, ENTITY resolve this fail well, for reason</technical_language>

Target:
public PlanInterpreterGuessingType reconstruct() { if (catalogItemType==CatalogItemType.TEMPLATE) { attemptType(null, CatalogItemType.TEMPLATE); } else { attemptType(null, CatalogItemType.ENTITY); attemptType("services", CatalogItemType.ENTITY); attemptType(POLICIES_KEY, CatalogItemType.POLICY); attemptType(LOCATIONS_KEY, CatalogItemType.LOCATION); } if (!resolved && catalogItemType==CatalogItemType.TEMPLATE) { planYaml = itemYaml; resolved = true; } return this; }
Source:
<code>synchronized KeyStore createKeyStore(Path keystoreFilePath, String keystoreType, char[] password) throws KeystoreServiceException { <START> Path parentPath = keystoreFilePath.getParent(); <END> if (!Files.isDirectory(parentPath)) { try{ Files.createDirectories(parentPath); } catch (IOException e) { LOG.failedToCreateKeystore(keystoreFilePath.toString(), keystoreType, e); throw new KeystoreServiceException(e); } } try { KeyStore ks = KeyStore.getInstance(keystoreType); ks.load(null, null); writeKeyStoreToFile(ks, keystoreFilePath, password); return ks; } catch (NoSuchAlgorithmException | CertificateException | KeyStoreException | IOException e) { LOG.failedToCreateKeystore(keystoreFilePath.toString(), keystoreType, e); throw new KeystoreServiceException(e); } }</code><technical_language>@jameschen1519 - is for this method return null, I believe. I implications next line in case, I extend existing test cases in DefaultKeystoreServiceTest provide proper assurances here</technical_language>

Target:
synchronized KeyStore createKeyStore(Path keystoreFilePath, String keystoreType, char[] password) throws KeystoreServiceException { Path parentPath = keystoreFilePath.getParent(); if (parentPath != null && !Files.isDirectory(parentPath)) { try{ Files.createDirectories(parentPath); } catch (IOException e) { LOG.failedToCreateKeystore(keystoreFilePath.toString(), keystoreType, e); throw new KeystoreServiceException(e); } } try { KeyStore ks = KeyStore.getInstance(keystoreType); ks.load(null, null); writeKeyStoreToFile(ks, keystoreFilePath, password); return ks; } catch (NoSuchAlgorithmException | CertificateException | KeyStoreException | IOException e) { LOG.failedToCreateKeystore(keystoreFilePath.toString(), keystoreType, e); throw new KeystoreServiceException(e); } }
Source:
<code>public static Optional<String> extractExpression(Object value) { Optional<String> result = Optional.empty(); if (isExpression(value)) { String expression = (String) value; <START> if (expression != null && !expression.isEmpty()) { <END> String trimmedText = expression.trim(); result = Optional.of(trimmedText.substring(DEFAULT_EXPRESSION_PREFIX.length(), trimmedText.length() - DEFAULT_EXPRESSION_POSTFIX.length())); } } return result; }</code><technical_language>StringUtils</technical_language>

Target:
public static Optional<String> extractExpression(Object value) { Optional<String> result = empty(); if (isExpression(value)) { String expression = (String) value; if (isNotEmpty(expression)) { String trimmedText = expression.trim(); result = of(trimmedText.substring(DEFAULT_EXPRESSION_PREFIX.length(), trimmedText.length() - DEFAULT_EXPRESSION_POSTFIX.length())); } } return result; }
Source:
<code>public void writeTo(OutputStream out) throws IOException { CountingOutputStream countingStream = new CountingOutputStream( out ); Writer writer = new OutputStreamWriter( countingStream, CHARSET ); for ( JsonObject bodyPart : bodyParts ) { gson.toJson( bodyPart, writer ); writer.append( '\n' ); } writer.flush(); <START> hintContentLenght( countingStream.getBytesWritten() ); <END> }</code><technical_language>confusing size in chars size in bytes? right encoding applied</technical_language>

Target:
public void writeTo(OutputStream out) throws IOException { CountingOutputStream countingStream = new CountingOutputStream( out ); Writer writer = new OutputStreamWriter( countingStream, CHARSET ); for ( JsonObject bodyPart : bodyParts ) { gson.toJson( bodyPart, writer ); writer.append( '\n' ); } writer.flush(); hintContentLength( countingStream.getBytesWritten() ); }
Source:
<code>public static InsertMediaDialog newInstance(@NonNull InsertMediaCallback callback, @NonNull SiteModel site) { InsertMediaDialog dialog = new InsertMediaDialog(); dialog.setStyle(AppCompatDialogFragment.STYLE_NORMAL, R.style.Theme_AppCompat_Light_Dialog); dialog.setCallback(callback); Bundle args = new Bundle(); args.putSerializable(WordPress.SITE, site); <START> return dialog; <END> }</code><technical_language>dialog.setArguments(args); is missing here</technical_language>

Target:
public static InsertMediaDialog newInstance(@NonNull InsertMediaCallback callback, @NonNull SiteModel site) { InsertMediaDialog dialog = new InsertMediaDialog(); dialog.setStyle(AppCompatDialogFragment.STYLE_NORMAL, R.style.Theme_AppCompat_Light_Dialog); dialog.setCallback(callback); Bundle args = new Bundle(); args.putSerializable(WordPress.SITE, site); dialog.setArguments(args); return dialog; }
Source:
<code>public void testSaveSessionWithErrorDuringSave() { doOpenSession(); session.getSessionResource().eAdapters().add(new AdapterImpl() { @Override public void notifyChanged(Notification msg) { if (msg.getNotifier() == session.getSessionResource() && msg.getFeatureID(null) == Resource.RESOURCE__IS_MODIFIED) { throw new <START> RuntimeException("This is a SavingPolicy that always fails."); <END> } } }); doCreateViews(); DiagramDescription description = findDiagramDescription("Acceleo Class Diagram"); Assert.assertNotNull(THE_UNIT_TEST_DATA_SEEMS_INCORRECT, description); doCreateRepresentations(description, 9); doOpenAllRepresentations(); assertTrue("The session should be dirty.", editors.get(0).isDirty()); try { session.save(new NullProgressMonitor()); fail("A RuntimeException should be thrown"); } catch (RuntimeException e) { } doCleanup(); }</code><technical_language>update message</technical_language>

Target:
public void testSaveSessionWithErrorDuringSave() { doOpenSession(); session.getSessionResource().eAdapters().add(new AdapterImpl() { @Override public void notifyChanged(Notification msg) { if (msg.getNotifier() == session.getSessionResource() && msg.getFeatureID(null) == Resource.RESOURCE__IS_MODIFIED) { throw new RuntimeException("An adapter to have save fails."); } } }); doCreateViews(); DiagramDescription description = findDiagramDescription("Acceleo Class Diagram"); Assert.assertNotNull(THE_UNIT_TEST_DATA_SEEMS_INCORRECT, description); doCreateRepresentations(description, 9); doOpenAllRepresentations(); assertTrue("The session should be dirty.", editors.get(0).isDirty()); try { session.save(new NullProgressMonitor()); fail("A RuntimeException should be thrown"); } catch (RuntimeException e) { } doCleanup(); }
Source:
<code>public void dataSharingSuspendedUpdatesSession() throws Exception { Account account = Mockito.mock(Account.class); TestUtils.mockEditAccount(accountDao, account); doAnswer((InvocationOnMock invocation) -> { session.setParticipant(new StudyParticipant.Builder().copyOf(session.getParticipant()) .withSharingScope(SharingScope.NO_SHARING).build()); return null; }).when(sessionUpdateService).updateSharingScope(session, SharingScope.NO_SHARING); Result result = controller.suspendDataSharing(); TestUtils.assertResult(result, 200); JsonNode node = TestUtils.getJson(result); assertEquals("no_sharing", node.get("sharingScope").asText()); assertFalse(node.get("dataSharing").asBoolean()); verify(account).setSharingScope(SharingScope.NO_SHARING); verify(accountDao).editAccount(eq(TestConstants.TEST_STUDY), eq(HEALTH_CODE), accountConsumerCaptor.capture()); Consumer<Account> accountConsumer = accountConsumerCaptor.getValue(); Account updatedAccount = Account.create(); accountConsumer.accept(updatedAccount); <START> assertEquals(SharingScope.NO_SHARING, updatedAccount.getSharingScope()); <END> }</code><technical_language>This block do anything. default sharing scope is no_sharing. This is redundant block above, verifies account.setSharingScope() called</technical_language>

Target:
public void dataSharingSuspendedUpdatesSession() throws Exception { Account account = Mockito.mock(Account.class); TestUtils.mockEditAccount(accountDao, account); doAnswer((InvocationOnMock invocation) -> { session.setParticipant(new StudyParticipant.Builder().copyOf(session.getParticipant()) .withSharingScope(SharingScope.NO_SHARING).build()); return null; }).when(sessionUpdateService).updateSharingScope(session, SharingScope.NO_SHARING); Result result = controller.suspendDataSharing(); TestUtils.assertResult(result, 200); JsonNode node = TestUtils.getJson(result); assertEquals("no_sharing", node.get("sharingScope").asText()); assertFalse(node.get("dataSharing").asBoolean()); verify(account).setSharingScope(SharingScope.NO_SHARING); verify(accountDao).editAccount(eq(TestConstants.TEST_STUDY), eq(HEALTH_CODE), any()); }
Source:
<code>public static Map<IPath, RepositoryMapping> getMappings(@Nullable final IProject project) { GitProjectData data = getProjectData(project); if (data == null) { return <START> new HashMap<>(); <END> } return data.getRepositoryMappings(); }</code><technical_language>Collections.emptyMap()</technical_language>

Target:
public static Map<IPath, RepositoryMapping> getMappings(@Nullable final IProject project) { GitProjectData data = getProjectData(project); if (data == null) { return Collections.emptyMap(); } return data.getRepositoryMappings(); }
Source:
<code>public AuthUser authenticate(final AuthRequest request) throws AuthException { List<AuthUser> authUsers = Lists.newArrayList(); List<AuthException> authExs = Lists.newArrayList(); for (AuthBackend backend : authBackends) { try { authUsers.add(checkNotNull(backend.authenticate(request))); } catch (MissingCredentialsException ex) { } catch (AuthException ex) { authExs.add(ex); } } <START> if (authExs.isEmpty()) { <END> return authUsers.get(0); } else if (authExs.size() == 1) { throw authExs.get(0); } else if (authExs.isEmpty() && authUsers.isEmpty()) { throw new MissingCredentialsException(); } String msg = String.format("Multiple AuthBackends attempted to handle request:" + " authUsers=%s authExs=%s", authUsers, authExs); throw new AuthException(msg); }</code><technical_language>bug: authUsers.size() == 1</technical_language>

Target:
public AuthUser authenticate(final AuthRequest request) throws AuthException { List<AuthUser> authUsers = Lists.newArrayList(); List<AuthException> authExs = Lists.newArrayList(); for (AuthBackend backend : authBackends) { try { authUsers.add(checkNotNull(backend.authenticate(request))); } catch (MissingCredentialsException ex) { } catch (AuthException ex) { authExs.add(ex); } } if (authUsers.size() == 1) { return authUsers.get(0); } else if (authUsers.isEmpty() && authExs.size() == 1) { throw authExs.get(0); } else if (authExs.isEmpty() && authUsers.isEmpty()) { throw new MissingCredentialsException(); } String msg = String.format("Multiple AuthBackends attempted to handle request:" + " authUsers=%s authExs=%s", authUsers, authExs); throw new AuthException(msg); }
Source:
<code><START> private static final void addProcessor(String key, Processor processor) throws UnsupportedOperationException { <END> if (!map.containsKey(key)) { map.put(key, processor); } else { String msg = "Key " + key + " already exists in processor map"; throw new UnsupportedOperationException(msg); } }</code><technical_language>If parameters changed (Processor processor, String key ...) need create List unpack it</technical_language>

Target:
private static final void addProcessor(String key, Processor processor) throws IllegalStateException { if (!map.containsKey(key)) { map.put(key, processor); } else { String msg = "Key " + key + " already exists in processor map"; throw new IllegalStateException(msg); } }