auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public FileObject resolveFile(Session session, String dataspace, String pathname) <END> throws FileSystemException, NotConnectedRestException, PermissionRestException { try { return USER.equalsIgnoreCase(dataspace) | SchedulerConstants.USERSPACE_NAME.toString().equalsIgnoreCase(dataspace) ? fileSystem(session).resolveFileInUserspace(pathname) : fileSystem( session).resolveFileInGlobalspace(pathname); } catch (NotConnectedException e) { throw new NotConnectedRestException(e); } catch (PermissionException e) { throw new PermissionRestException(e); } }</code><technical_language>![MAJOR](<LINK_1> Refactor this method throw checked exception instead of: org.apache.commons.vfs2.FileSystemException, org.ow2.proactive_grid_cloud_portal.scheduler.exception.NotConnectedRestException, org.ow2.proactive_grid_cloud_portal.scheduler.exception.PermissionRestException [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public FileObject resolveFile(Session session, String dataspace, String pathname) throws FileSystemException, NotConnectedRestException, PermissionRestException { try { return USER.equalsIgnoreCase(dataspace) || SchedulerConstants.USERSPACE_NAME.toString().equalsIgnoreCase(dataspace) ? fileSystem(session).resolveFileInUserspace(pathname) : fileSystem( session).resolveFileInGlobalspace(pathname); } catch (NotConnectedException e) { throw new NotConnectedRestException(e); } catch (PermissionException e) { throw new PermissionRestException(e); } }
Source:
<code>public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> permissionList = super.getPermissionCheckSubjects(); for (Guid storageId : imageToDestinationDomainMap.values()) { permissionList.add(new PermissionSubject(storageId, VdcObjectType.Storage, <START> getActionType().getActionGroup())); <END> } permissionList.add(new PermissionSubject(getParameters().getSourceDomainId(), VdcObjectType.Storage, getActionType().getActionGroup())); if (getVm() != null && !StringUtils.isEmpty(getVm().getCustomProperties())) { permissionList.add(new PermissionSubject(getClusterId(), VdcObjectType.Cluster, ActionGroup.CHANGE_VM_CUSTOM_PROPERTIES)); } return permissionList; }</code><technical_language>put a set, eliminate duplications, unexpected happen if insert instances of storage domain</technical_language>

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> permissionList = super.getPermissionCheckSubjects(); permissionList.addAll(getStoragePermissionCheckSubjects()); permissionList.add(new PermissionSubject(getParameters().getSourceDomainId(), VdcObjectType.Storage, getActionType().getActionGroup())); if (getVm() != null && !StringUtils.isEmpty(getVm().getCustomProperties())) { permissionList.add(new PermissionSubject(getClusterId(), VdcObjectType.Cluster, ActionGroup.CHANGE_VM_CUSTOM_PROPERTIES)); } return permissionList; }
Source:
<code><START> public ItemWriter<Integer> itemWriter() { <END> MessagingTemplate messagingTemplate = new MessagingTemplate(); messagingTemplate.setDefaultChannel(requests()); ChunkMessageChannelItemWriter<Integer> chunkMessageChannelItemWriter = new ChunkMessageChannelItemWriter<>(); chunkMessageChannelItemWriter.setMessagingOperations(messagingTemplate); chunkMessageChannelItemWriter.setReplyChannel(replies()); return chunkMessageChannelItemWriter; }</code><technical_language>This should, a minimum, return ItemStreamWriter ChunkMessageChannelItemWriter implement ItemStream. said, for components this, I recommend returning concrete type Spring interfaces implemented</technical_language>

Target:
public ChunkMessageChannelItemWriter<Integer> itemWriter() { MessagingTemplate messagingTemplate = new MessagingTemplate(); messagingTemplate.setDefaultChannel(requests()); ChunkMessageChannelItemWriter<Integer> chunkMessageChannelItemWriter = new ChunkMessageChannelItemWriter<>(); chunkMessageChannelItemWriter.setMessagingOperations(messagingTemplate); chunkMessageChannelItemWriter.setReplyChannel(replies()); return chunkMessageChannelItemWriter; }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mImage = new ImageView(this); setContentView(mImage); Bundle extras = getIntent().getExtras(); int orientation = ActivityInfo.SCREEN_ORIENTATION_USER; if (extras.getBoolean(POSTER)) { orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; } else { orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; } <START> setRequestedOrientation(orientation); <END> String imagePath = getIntent().getExtras().getString(PATH); ImageProvider.getInstance(this).loadImage(mImage, imagePath, false); }</code><technical_language>this? I find confusing if app switch orientation, user decide rotate screen</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fullscreen_image_activity); mImage = (ImageView) findViewById(android.R.id.icon); String imagePath = getIntent().getExtras().getString(PATH); mImage.setImageBitmap(ImageProvider.getInstance(this).getImage(imagePath, false)); }
Source:
<code>private void discoverArtifacts(Map<File, ArtifactResult> files, List<DependencyNode> nodes, String parent, List<RemoteRepository> remoteRepositories) throws MojoExecutionException { for (DependencyNode node : nodes) { if (!scopes.contains(node.getDependency() .getScope())) { continue; } <START> List<RemoteRepository> copyOfRepositories = new ArrayList<>(remoteRepositories); <END> copyOfRepositories.addAll(node.getRepositories()); try { ArtifactResult resolvedArtifact = postProcessor.postProcessResult(system.resolveArtifact(session, new ArtifactRequest(node.getArtifact(), copyOfRepositories, parent))); logger.debug("Located file: for artifact {}", resolvedArtifact.getArtifact() .getFile(), resolvedArtifact); files.put(resolvedArtifact.getArtifact() .getFile(), resolvedArtifact); } catch (ArtifactResolutionException e) { throw new MojoExecutionException("Failed to resolve the dependency " + node.getArtifact() .toString(), e); } if (includeTransitive) { discoverArtifacts(files, node.getChildren(), node.getRequestContext(), copyOfRepositories); } else { logger.debug("Ignoring transitive dependencies of {}", node.getDependency()); } } }</code><technical_language>crazy var name. combinedRepositories more meaningful</technical_language>

Target:
private void discoverArtifacts(Map<File, ArtifactResult> files, List<DependencyNode> nodes, String parent, List<RemoteRepository> remoteRepositories) throws MojoExecutionException { for (DependencyNode node : nodes) { if (!scopes.contains(node.getDependency() .getScope())) { continue; } List<RemoteRepository> combinedRepositories = new ArrayList<>(remoteRepositories); combinedRepositories.addAll(node.getRepositories()); try { ArtifactResult resolvedArtifact = postProcessor.postProcessResult(system.resolveArtifact(session, new ArtifactRequest(node.getArtifact(), combinedRepositories, parent))); logger.debug("Located file: for artifact {}", resolvedArtifact.getArtifact() .getFile(), resolvedArtifact); files.put(resolvedArtifact.getArtifact() .getFile(), resolvedArtifact); } catch (ArtifactResolutionException e) { throw new MojoExecutionException("Failed to resolve the dependency " + node.getArtifact() .toString(), e); } if (includeTransitive) { discoverArtifacts(files, node.getChildren(), node.getRequestContext(), combinedRepositories); } else { logger.debug("Ignoring transitive dependencies of {}", node.getDependency()); } } }
Source:
<code>public void setUp() throws Exception { super.setUp(); FakeCheck.reset(); FakeCheck.setReady(true); <START> FileUtils.copyDirectory(getResourceFile("templates/jboss"), new File(nuxeoHome, "templates")); <END> bundles = new File(nuxeoHome, "nxserver/bundles"); bundles.mkdirs(); FileUtils.copyFileToDirectory(getResourceFile("versioned-1.0.jar"), bundles); configGenerator = new ConfigurationGenerator(); bsc = new BackingServiceConfigurator(configGenerator); assertThat(configGenerator.init()).isTrue(); configGenerator.setProperty("nuxeo.home", nuxeoHome.getAbsolutePath()); configGenerator.setProperty("nuxeo.backing.check.retry.maxRetries","5"); configGenerator.setProperty("nuxeo.backing.check.retry.delayInMs","20"); }</code><technical_language>mytemplate instead of jboss avoid confusion</technical_language>

Target:
public void setUp() throws Exception { super.setUp(); FakeCheck.reset(); FakeCheck.setReady(true); FileUtils.copyDirectory(getResourceFile("templates/jboss"), new File(nuxeoHome, "templates")); bundles = new File(nuxeoHome, "nxserver/bundles"); bundles.mkdirs(); FileUtils.copyFileToDirectory(getResourceFile("versioned-1.0.jar"), bundles); configGenerator = new ConfigurationGenerator(); bsc = new BackingServiceConfigurator(configGenerator); assertThat(configGenerator.init()).isTrue(); configGenerator.setProperty("nuxeo.home", nuxeoHome.getAbsolutePath()); configGenerator.setProperty(BackingServiceConfigurator.PARAM_RETRY_POLICY_MAX_RETRIES,"5"); configGenerator.setProperty(BackingServiceConfigurator.PARAM_RETRY_POLICY_DELAY_IN_MS,"20"); }
Source:
<code>public void fail_assertThrowsWithCause_if_callable_throws_exception_with_different_causes() { final Throwable expectedCause = new EmptyStackException(); final Throwable actualCause = new AclNotFoundException(); final RuntimeException runtimeException = new RuntimeException(actualCause); final Callable throwsRuntimeException = new Callable() { @Override public Object call() { throw runtimeException; } }; <START> Verify.assertThrowsWithCause(runtimeException.getClass(), expectedCause.getClass(), <END> throwsRuntimeException); }</code><technical_language>Verify: please add static imports</technical_language>

Target:
public void fail_assertThrowsWithCause_if_callable_throws_exception_with_different_causes() { final Throwable expectedCause = new EmptyStackException(); final Throwable actualCause = new AclNotFoundException(); final RuntimeException runtimeException = new RuntimeException(actualCause); final Callable throwsRuntimeException = new Callable() { @Override public Object call() { throw runtimeException; } }; assertThrowsWithCause(runtimeException.getClass(), expectedCause.getClass(), throwsRuntimeException); }
Source:
<code>protected void onDestroy() { if (!mIsConfigChange && (mRestartEditorOption == RestartEditorOptions.NO_RESTART)) { if (mPostEditorAnalyticsSession != null) { mPostEditorAnalyticsSession.end(); } } mDispatcher.unregister(this); if (mHandler != null) { mHandler.removeCallbacks(mSave); mHandler = null; } cancelAddMediaListThread(); removePostOpenInEditorStickyEvent(); if (mEditorFragment instanceof AztecEditorFragment) { ((AztecEditorFragment) mEditorFragment).disableContentLogOnCrashes(); } <START> if (mReactNativeRequestHandler != null) mReactNativeRequestHandler.destroy(); <END> super.onDestroy(); }</code><technical_language>NIT: for consistency</technical_language>

Target:
protected void onDestroy() { if (!mIsConfigChange && (mRestartEditorOption == RestartEditorOptions.NO_RESTART)) { if (mPostEditorAnalyticsSession != null) { mPostEditorAnalyticsSession.end(); } } mDispatcher.unregister(this); if (mHandler != null) { mHandler.removeCallbacks(mSave); mHandler = null; } mEditorMedia.cancelAddMediaToEditorActions(); removePostOpenInEditorStickyEvent(); if (mEditorFragment instanceof AztecEditorFragment) { ((AztecEditorFragment) mEditorFragment).disableContentLogOnCrashes(); } if (mReactNativeRequestHandler != null) { mReactNativeRequestHandler.destroy(); } super.onDestroy(); }
Source:
<code>public RequestBuilder centerInside() { PicassoBitmapOptions options = getOptions(); if (options.targetWidth == 0 || options.targetHeight == 0) { throw new IllegalStateException("Center crop can only be used after calling resize."); <START> } <END> options.centerInside = true; return this; }</code><technical_language>Add a check+exception for centerCrop, mutually exclusive. add a check in crop for this flag do same</technical_language>

Target:
public RequestBuilder centerInside() { PicassoBitmapOptions options = getOptions(); if (options.targetWidth == 0 || options.targetHeight == 0) { throw new IllegalStateException("Center inside can only be used after calling resize."); } if (options.centerCrop) { throw new IllegalStateException("Center inside can not be used after calling centerCrop"); } options.centerInside = true; return this; }
Source:
<code>public void updateWorkflowWithTooLongStateVariableValueReturnsBadRequest() { UpdateWorkflowInstanceRequest req = new UpdateWorkflowInstanceRequest(); req.stateVariables.put("testUpdate", repeat('a', 8001)); try (Response response = getInstanceIdResource(createResponse.id).put(req)) { assertThat(response.getStatus(), is(BAD_REQUEST.getStatusCode())); <START> assertThat(response.readEntity(String.class), startsWith("Too long value")); <END> } }</code><technical_language>longer return json responses? I this is a bad change</technical_language>

Target:
public void updateWorkflowWithTooLongStateVariableValueReturnsBadRequest() { UpdateWorkflowInstanceRequest req = new UpdateWorkflowInstanceRequest(); req.stateVariables.put("testUpdate", repeat('a', 8001)); try (Response response = getInstanceIdResource(createResponse.id).put(req)) { assertThat(response.getStatus(), is(BAD_REQUEST.getStatusCode())); assertThat(response.getMediaType(), is(APPLICATION_JSON_TYPE)); assertThat(response.readEntity(ErrorResponse.class).error, startsWith("Too long value")); } }
Source:
<code>public Set<State> <START> getAllStates() <END> { List<State> result = Lists.newArrayList(); for (Node node : Iterables.filter(Iterables.filter(AllContents.of(getNotationDiagram()), Node.class), State.notationPredicate())) { Option<State> exec = ISequenceElementAccessor.getState(node); assert exec.some() : INTERNAL_ERROR; result.add(exec.get()); } Collections.sort(result, RangeHelper.lowerBoundOrdering().onResultOf(ISequenceEvent.VERTICAL_RANGE)); return Sets.newLinkedHashSet(result); }</code><technical_language>Needs cache too. (I states diagram)</technical_language>

Target:
public Set<State> getAllStates() { List<State> allStates = null; LinkedHashSet<State> allOrderedStates = null; if (useCache) { if (allOperandsCache != null) { allStates = Lists.newArrayList(allStatesCache); } allOrderedStates = allOrderedStatesCache; } if (allOrderedStates == null) { if (allStates == null) { allStates = Lists.newArrayList(); for (Node node : Iterables.filter(Iterables.filter(AllContents.of(getNotationDiagram()), Node.class), State.notationPredicate())) { Option<State> exec = ISequenceElementAccessor.getState(node); assert exec.some() : INTERNAL_ERROR; allStates.add(exec.get()); } if (useCache) { allStatesCache = allStates; } } Collections.sort(allStates, RangeHelper.lowerBoundOrdering().onResultOf(ISequenceEvent.VERTICAL_RANGE)); allOrderedStates = Sets.newLinkedHashSet(allStates); if (useCache) { allOrderedStatesCache = allOrderedStates; } } return allOrderedStates; }
Source:
<code><START> void setEnableLogging(boolean enableLogging) { <END> this.enableLogging = enableLogging; }</code><technical_language>prefer this a setLogLevel</technical_language>

Target:
AmplitudeLog setEnableLogging(boolean enableLogging) { this.enableLogging = enableLogging; return instance; }
Source:
<code>private void initSelectedSpiceImpl() { SpiceConsoleModel spiceModel = model.getVmConsoles().getConsoleModel(SpiceConsoleModel.class); if (spiceModel == null) { return; } <START> spiceModel.initConsole(); spiceModel.initConsole(); <END> }</code><technical_language>this needs called for properly done, right</technical_language>

Target:
private void initSelectedSpiceImpl() { SpiceConsoleModel spiceModel = model.getVmConsoles().getConsoleModel(SpiceConsoleModel.class); if (spiceModel == null) { return; } spiceModel.initConsole(); }
Source:
<code>public ScriptEngineManagerImpl() { <START> logger.info("ScriptManager loading..."); <END> }</code><technical_language>reduce debug</technical_language>

Target:
public ScriptEngineManagerImpl() { logger.debug("ScriptManager loading..."); }
Source:
<code>protected Iterable<Module> setupModules() { ImmutableSet.Builder<Module> modules = ImmutableSet.builder(); modules.addAll(super.setupModules()); return modules.build(); <START> } <END></code><technical_language>Remove this method</technical_language>

Target:
protected Iterable<Module> setupModules() { ImmutableSet.Builder<Module> modules = ImmutableSet.builder(); modules.addAll(super.setupModules()); modules.add(new OneAndOneRateLimitModule()); return modules.build(); }
Source:
<code>private static String getMessageToLog(String loggerString, AuditLog auditLog) { String message; if (loggerString.isEmpty()) { message = auditLog.toStringForLogging(); } else { message = MessageFormat.format(loggerString, auditLog.getMessage()); } <START> return MessageFormat.format("Audit Log ID: {0}, {1}", auditLog.getAuditLogId(), message); <END> }</code><technical_language>Hmm, "Audit Log ID: " string added line audit log message in engine, shorter: RECORD_ID EVENT_ID Shirly, preferred want filter audit log messages engine.log</technical_language>

Target:
private static String getMessageToLog(String loggerString, AuditLog auditLog) { String message; if (loggerString.isEmpty()) { message = auditLog.toStringForLogging(); } else { message = MessageFormat.format(loggerString, auditLog.getMessage()); } return MessageFormat.format("EVENT_ID: {0}, {1}", auditLog.getLogType().getValue(), message); }
Source:
<code>private String extractJoin(Path.PathElement pathElement) { String relationshipName = pathElement.getFieldName(); Class<?> relationshipClass = pathElement.getFieldType(); String relationshipAlias = FilterPredicate.getTypeAlias(relationshipClass); Class<?> entityClass = pathElement.getType(); String entityAlias = FilterPredicate.getTypeAlias(entityClass); String relationshipIdField = getColumnName(relationshipClass, dictionary.getIdFieldName(relationshipClass)); String relationshipColumnName = getColumnName(entityClass, relationshipName); <START> Subselect subselectAnnotation = dictionary.getAnnotation(relationshipClass, Subselect.class); <END> if (subselectAnnotation == null) { Table tableAnnotation = dictionary.getAnnotation(relationshipClass, Table.class); String relationshipTableName = (tableAnnotation == null) ? dictionary.getJsonAliasFor(relationshipClass) : tableAnnotation.name(); return String.format("LEFT JOIN %s AS %s ON %s.%s = %s.%s", relationshipTableName, relationshipAlias, entityAlias, relationshipColumnName, relationshipAlias, relationshipIdField); } else { return String.format("LEFT JOIN (%s) AS %s ON %s.%s = %s.%s", subselectAnnotation.value(), relationshipAlias, entityAlias, relationshipColumnName, relationshipAlias, relationshipIdField); } }</code><technical_language>I more maintainable long term if of dictionary lookups moved Schema classes. build SQL schema, column join it</technical_language>

Target:
private String extractJoin(Path.PathElement pathElement) { Class<?> entityClass = pathElement.getType(); String entityAlias = FilterPredicate.getTypeAlias(entityClass); Class<?> relationshipClass = pathElement.getFieldType(); String relationshipAlias = FilterPredicate.getTypeAlias(relationshipClass); String relationshipName = pathElement.getFieldName(); String relationshipIdField = getColumnName(relationshipClass, dictionary.getIdFieldName(relationshipClass)); String relationshipColumnName = getColumnName(entityClass, relationshipName); return String.format("LEFT JOIN %s AS %s ON %s.%s = %s.%s", SQLSchema.getTableOrSubselect(dictionary, relationshipClass), relationshipAlias, entityAlias, relationshipColumnName, relationshipAlias, relationshipIdField); }
Source:
<code>public PreparedQuery prepareQuery(Session session, String query, WarningCollector warningCollector) throws ParsingException, PrestoException, SemanticException { Statement wrappedStatement = sqlParser.createStatement(query, createParsingOptions(session, warningCollector)); <START> if (SystemSessionProperties.getWarningHandlingLevel(session) == WarningHandlingLevel.AS_ERROR) { <END> throw new PrestoException(WARNING_AS_ERROR, format("Warning handling level set to AS_ERROR. Warnings: %n %s", warningCollector.getWarnings().stream() .map(PrestoWarning::getMessage) .collect(joining(System.lineSeparator())))); } return prepareQuery(session, wrappedStatement, warningCollector); }</code><technical_language>Static import</technical_language>

Target:
public PreparedQuery prepareQuery(Session session, String query, WarningCollector warningCollector) throws ParsingException, PrestoException, SemanticException { Statement wrappedStatement = sqlParser.createStatement(query, createParsingOptions(session, warningCollector)); if (warningCollector.hasWarnings() && getWarningHandlingLevel(session) == AS_ERROR) { throw new PrestoException(WARNING_AS_ERROR, format("Warning handling level set to AS_ERROR. Warnings: %n %s", warningCollector.getWarnings().stream() .map(PrestoWarning::getMessage) .collect(joining(System.lineSeparator())))); } return prepareQuery(session, wrappedStatement, warningCollector); }
Source:
<code>public void notAddsInvalidHeadersToResponse() throws IOException { final Iterable<String> head = new RsWithHeader( new RsWithHeader(new RsEmpty(), "host:", "c.example.com"), "Host MY", "d.example.com" ).head(); <START> for (final String header: head) { <END> Assert.assertNotNull(header, "header contains null elements"); } }</code><technical_language>I understand, this code executed. fail previous line. correct? if so, do need it</technical_language>

Target:
public void notAddsInvalidHeadersToResponse() throws IOException { new RsWithHeader( new RsWithHeader(new RsEmpty(), "host:", "c.example.com"), "Host MY", "d.example.com" ).head(); }
Source:
<code>public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ("equals".equals(method.getName())) { try { Object otherHandler = args.length > 0 && args[0] != null ? Proxy.getInvocationHandler(args[0]) : null; return equals(otherHandler); } catch (IllegalArgumentException e) { return false; } } else if ("hashCode".equals(method.getName())) { return hashCode(); } else if ("toString".equals(method.getName())) { return toString(); } try { return dispatch.get(method).invoke(args); } catch (Throwable th) { Throwable cause = th.getCause(); if (th instanceof RetryableException && cause != null) { throw cause; } <START> throw th; <END> } }</code><technical_language>This feels breaking previous signature for feign methods interfaces... throw FeignException, throw Exception. I introduce a new method Retryer called propagateException(FeignException), ship feign 2 implementations. * Legacy throws current FeignException * throws root for a FeignException</technical_language>

Target:
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ("equals".equals(method.getName())) { try { Object otherHandler = args.length > 0 && args[0] != null ? Proxy.getInvocationHandler(args[0]) : null; return equals(otherHandler); } catch (IllegalArgumentException e) { return false; } } else if ("hashCode".equals(method.getName())) { return hashCode(); } else if ("toString".equals(method.getName())) { return toString(); } return dispatch.get(method).invoke(args); }
Source:
<code>public void testLevelForBin() { <START> SRAIndex index = getIndex(DEFAULT_ACCESSION); <END> Bin bin = new Bin(0, SRA_BIN_OFFSET); Assert.assertEquals(index.getLevelForBin(bin), LAST_BIN_LEVEL); }</code><technical_language>missing finals; IntelliJ pleased</technical_language>

Target:
public void testLevelForBin() { final SRAIndex index = getIndex(DEFAULT_ACCESSION); final Bin bin = new Bin(0, SRA_BIN_OFFSET); Assert.assertEquals(index.getLevelForBin(bin), LAST_BIN_LEVEL); }
Source:
<code>public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.notifications: <START> NotificationActivity.startYourself(this, "read/unread"); <END> return true; case R.id.list_sheet: if (contributionsActivityPagerAdapter.getItem(1) != null) { ((NearbyFragment)contributionsActivityPagerAdapter.getItem(1)).listOptionMenuIteClicked(); } return true; default: return super.onOptionsItemSelected(item); } }</code><technical_language>Call: NotificationActivity.startYourself(this, "unread"); example I meant pass read unread a filter. :)</technical_language>

Target:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.notifications: NotificationActivity.startYourself(this, "unread"); return true; case R.id.list_sheet: if (contributionsActivityPagerAdapter.getItem(1) != null) { ((NearbyFragment)contributionsActivityPagerAdapter.getItem(1)).listOptionMenuIteClicked(); } return true; default: return super.onOptionsItemSelected(item); } }
Source:
<code>private void setDcCompatibilityLevelUpgradeNeeded(List<StoragePool> dataCenters) { Config.<Set<Version>> getValue(ConfigValues.SupportedClusterLevels) .stream() .max(Comparator.naturalOrder()) <START> .ifPresent( maxSupportedClusterLevel -> dataCenters.forEach( dataCenter -> dataCenter.setStoragePoolCompatibilityLevelUpgradeNeeded( <END> maxSupportedClusterLevel.compareTo(dataCenter.getCompatibilityVersion()) > 0))); }</code><technical_language>lambda in lambda. point of view ~ readable</technical_language>

Target:
private void setDcCompatibilityLevelUpgradeNeeded(List<StoragePool> dataCenters) { Config.<Set<Version>> getValue(ConfigValues.SupportedClusterLevels) .stream() .max(Comparator.naturalOrder()) .ifPresent(maxSupportedClusterLevel -> setDcCompatibilityLevelUpgradeNeeded(dataCenters, maxSupportedClusterLevel)); }
Source:
<code><START> public void updateCredentials(String externalId, String username, String password) { <END> InternalAuthDAO internalAuthDAO = DAOFactory.getInstance().getInternalAuthDAO(); try { InternalAuth internalAuth = internalAuthDAO.findById(NumberUtils.createLong(externalId)); String passwordEncoded = EncodingUtils.md5EncodeString(password); internalAuthDAO.updateUsernameAndPassword(internalAuth, username, passwordEncoded); } catch (UnsupportedEncodingException e) { throw new SmvcRuntimeException(e); } catch (NoSuchAlgorithmException e) { throw new SmvcRuntimeException(e); } }</code><technical_language>this retain oldPassword and/or reset token avoid mistakes/abuse</technical_language>

Target:
public void updateCredentials(String externalId, String username, String password) { InternalAuthDAO internalAuthDAO = DAOFactory.getInstance().getInternalAuthDAO(); try { InternalAuth internalAuth = internalAuthDAO.findById(NumberUtils.createLong(externalId)); if (internalAuth == null) { throw new IllegalStateException(String.format("InternalAuth for id %s not found", externalId)); } String passwordEncoded = EncodingUtils.md5EncodeString(password); internalAuthDAO.updateUsernameAndPassword(internalAuth, username, passwordEncoded); } catch (UnsupportedEncodingException e) { throw new SmvcRuntimeException(e); } catch (NoSuchAlgorithmException e) { throw new SmvcRuntimeException(e); } }
Source:
<code>private void resetDefaultGame() { <START> setGameData(null); <END> ClientSetting.defaultGameName.resetValue(); ClientSetting.defaultGameUri.resetValue(); ClientSetting.flush(); }</code><technical_language>This set game data unnecessary store coming line 88. consistent other lines sets game data this a setter method. Generally, AFAIK avoid setter methods a class (lest overrides setter method suddenly changed a lot more code expected). 2nd, abstraction of method kinda mixed. basically: level checks level setting level checks if( level condition) do medium level else do level I recommend accept a GameData parameter this method re-use. Arguably a method code re-used, calls lines 91 92 (it's same, data set is same, idea DRY, information of values set is repeated in 2 places). a method, be: private void setDefaultGame(@Nullable final URI fileUri, @Nullable final GAmeData gamedata) { if(gameData == null) { ClientSetting.defaultGameName.resetValue(); ClientSetting.defaultGameUri.resetValue(); } else { ClientSetting.defaultGameName.setValue(gameData.getGameName()); ClientSetting.defaultGameUri.setValue(uri.toString()); } ClientSetting.flush(); } Now, above, fact a decoupled file uri game name is good too. a data clump code smell do unified a single object a single data type. I is resolved a follow stop storing default game name, default uri, lookup game name URI is needed</technical_language>

Target:
private void resetDefaultGame() { setGameData(null); setDefaultGame(null, null); }
Source:
<code>public Set<? extends NodeMetadata> rebootNodesMatching(Predicate<NodeMetadata> filter) { logger.debug(">> rebooting nodes matching(%s)", filter); <START> Set<NodeMetadata> set = ImmutableSet.copyOf(transformParallel(nodesMatchingFilterAndNotTerminatedExceptionIfNotFound(filter), <END> new Function<NodeMetadata, ListenableFuture<? extends NodeMetadata>>() { @Override public ListenableFuture<NodeMetadata> apply(final NodeMetadata from) { return userExecutor.submit(new Callable<NodeMetadata>() { public NodeMetadata call() throws Exception { rebootNode(from.getId()); return from; } public String toString() { return "rebootNode(" + from.getId() + ")"; } }); } }, userExecutor, null, logger, "rebootNodesMatching(" + filter + ")")); logger.debug("<< rebooted"); cleanUpIncidentalResourcesOfDeadNodes(set); return set; }</code><technical_language>Rename set rebootedNodes so</technical_language>

Target:
public Set<? extends NodeMetadata> rebootNodesMatching(Predicate<NodeMetadata> filter) { logger.debug(">> rebooting nodes matching(%s)", filter); Set<NodeMetadata> rebootNodes = ImmutableSet.copyOf(transformParallel(nodesMatchingFilterAndNotTerminated(filter), new Function<NodeMetadata, ListenableFuture<? extends NodeMetadata>>() { @Override public ListenableFuture<NodeMetadata> apply(final NodeMetadata from) { return userExecutor.submit(new Callable<NodeMetadata>() { public NodeMetadata call() throws Exception { rebootNode(from.getId()); return from; } public String toString() { return "rebootNode(" + from.getId() + ")"; } }); } }, userExecutor, null, logger, "rebootNodesMatching(" + filter + ")")); logger.debug("<< rebooted(%d)", rebootNodes.size()); return rebootNodes; }
Source:
<code>public void init(StorageQos qos) { if (qos.getMaxThroughput() == null && qos.getMaxReadThroughput() == null && qos.getMaxWriteThroughput() == null) { getThroughput().getChoiceGroupNone().setEntity(true); getThroughput().getChoiceGroupTotal().setEntity(false); getThroughput().getChoiceGroupReadWrite().setEntity(false); } else { getThroughput().getTotal().setEntity(qos.getMaxThroughput()); getThroughput().getRead().setEntity(qos.getMaxReadThroughput()); getThroughput().getWrite().setEntity(qos.getMaxWriteThroughput()); getThroughput().getChoiceGroupNone().setEntity(true); getThroughput().getChoiceGroupTotal().setEntity(false); <START> getThroughput().getChoiceGroupReadWrite().setEntity(false); <END> } if (qos.getMaxIops() == null && qos.getMaxReadIops() == null && qos.getMaxWriteIops() == null) { getIops().getChoiceGroupNone().setEntity(true); getIops().getChoiceGroupTotal().setEntity(false); getIops().getChoiceGroupReadWrite().setEntity(false); } else { getIops().getTotal().setEntity(qos.getMaxIops()); getIops().getRead().setEntity(qos.getMaxReadIops()); getIops().getWrite().setEntity(qos.getMaxWriteIops()); getIops().getChoiceGroupNone().setEntity(true); getIops().getChoiceGroupTotal().setEntity(false); getIops().getChoiceGroupReadWrite().setEntity(false); } }</code><technical_language>exacted of if (same for if else)</technical_language>

Target:
public void init(StorageQos qos) { if (!(qos.getMaxThroughput() == null && qos.getMaxReadThroughput() == null && qos.getMaxWriteThroughput() == null)) { getThroughput().getTotal().setEntity(qos.getMaxThroughput()); getThroughput().getRead().setEntity(qos.getMaxReadThroughput()); getThroughput().getWrite().setEntity(qos.getMaxWriteThroughput()); } getThroughput().getChoiceGroupNone().setEntity(true); getThroughput().getChoiceGroupTotal().setEntity(false); getThroughput().getChoiceGroupReadWrite().setEntity(false); if (!(qos.getMaxIops() == null && qos.getMaxReadIops() == null && qos.getMaxWriteIops() == null)) { getIops().getTotal().setEntity(qos.getMaxIops()); getIops().getRead().setEntity(qos.getMaxReadIops()); getIops().getWrite().setEntity(qos.getMaxWriteIops()); } getIops().getChoiceGroupNone().setEntity(true); getIops().getChoiceGroupTotal().setEntity(false); getIops().getChoiceGroupReadWrite().setEntity(false); }
Source:
<code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.sf__custom_server_url, container); final String label = getEditDefaultValue(R.id.sf__picker_custom_label); final String urlValue = getEditDefaultValue(R.id.sf__picker_custom_url); isDefault = urlValue.equals(getString(R.string.sf__server_url_default_custom_url)); if (isDefault) { getDialog().setTitle(R.string.sf__server_url_add_title); } else { getDialog().setTitle(R.string.sf__server_url_edit_title); } setEditText(R.id.sf__picker_custom_label, label); setEditText(R.id.sf__picker_custom_url, urlValue); final Button applyBtn = rootView.findViewById(R.id.sf__apply_button); applyBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final String lbl = validateInput(R.id.sf__picker_custom_label); if (lbl == null) { return; } final String val = validateInput(R.id.sf__picker_custom_url); <START> if (val == null || HttpUrl.parse(val) == null) { <END> return; } loginServerManager.addCustomLoginServer(lbl.trim(), val.trim()); dismiss(); } }); final Button cancelBtn = rootView.findViewById(R.id.sf__cancel_button); cancelBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dismiss(); } }); return rootView; }</code><technical_language>move validateInput</technical_language>

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.sf__custom_server_url, container); final String label = getEditDefaultValue(R.id.sf__picker_custom_label); final String urlValue = getEditDefaultValue(R.id.sf__picker_custom_url); isDefault = urlValue.equals(getString(R.string.sf__server_url_default_custom_url)); if (isDefault) { getDialog().setTitle(R.string.sf__server_url_add_title); } else { getDialog().setTitle(R.string.sf__server_url_edit_title); } setEditText(R.id.sf__picker_custom_label, label); setEditText(R.id.sf__picker_custom_url, urlValue); final Button applyBtn = rootView.findViewById(R.id.sf__apply_button); applyBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final String lbl = validateInput(R.id.sf__picker_custom_label); if (lbl == null) { return; } final String val = validateInput(R.id.sf__picker_custom_url); if (val == null) { return; } loginServerManager.addCustomLoginServer(lbl.trim(), val.trim()); dismiss(); } }); final Button cancelBtn = rootView.findViewById(R.id.sf__cancel_button); cancelBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dismiss(); } }); return rootView; }
Source:
<code>final static public < A extends LongAccess > ArrayImg< Unsigned128BitType, A > unsigned128Bits( final A access, final long... dim ) { <START> final ArrayImg< Unsigned128BitType, A > img = new ArrayImg<>( access, dim, new Fraction( 1, 64 ) ); <END> final Unsigned128BitType t = new Unsigned128BitType( img ); img.setLinkedType( t ); return img; }</code><technical_language>this new Fraction( t.getBitsPerPixel(), 64 ) instead of new Fraction( 1, 64 ) here</technical_language>

Target:
final static public < A extends LongAccess > ArrayImg< Unsigned128BitType, A > unsigned128Bits( final A access, final long... dim ) { final ArrayImg< Unsigned128BitType, A > img = new ArrayImg<>( access, dim, new Fraction( 128, 64 ) ); final Unsigned128BitType t = new Unsigned128BitType( img ); img.setLinkedType( t ); return img; }
Source:
<code>public void close() { log.info("Closing BackgroundCompactor"); daemon.interrupt(); <START> try { <END> daemon.join(); daemon = null; } catch (InterruptedException e) { throw Throwables.rewrapAndThrowUncheckedException(e); } }</code><technical_language>worth unifying logic of BackgroundSweeper BackgroundCompactor some point</technical_language>

Target:
public void close() { log.info("Closing BackgroundCompactor"); daemon.interrupt(); try { daemon.join(); daemon = null; } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw Throwables.rewrapAndThrowUncheckedException(e); } }
Source:
<code>public boolean verifyEvidence(final Evidence evidence) throws RealmUnavailableException { <START> return getCredential(PasswordCredential.class, null).verify(evidence); <END> }</code><technical_language>If getCredential returns null, NPE</technical_language>

Target:
public boolean verifyEvidence(final Evidence evidence) throws RealmUnavailableException { final PasswordCredential credential = getCredential(PasswordCredential.class, null); if (credential == null) return false; return credential.verify(evidence); }
Source:
<code>public static File[] unpackAllFiles(File root, File dest) { List<File> dirs = new ArrayList<File>(); files = root.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".osz"); } }); if (files == null || files.length < 1) { files = null; return new File[0]; } BeatmapWatchService ws = (Options.isWatchServiceEnabled()) ? BeatmapWatchService.get() : null; if (ws != null) ws.pause(); for (File file : files) { fileIndex++; String dirName = file.getName().substring(0, file.getName().lastIndexOf('.')); File songDir = new File(dest, dirName); if (!songDir.isDirectory()) { songDir.mkdir(); Utils.unzip(file, songDir); file.delete(); dirs.add(songDir); } } if (ws != null) ws.resume(); fileIndex = -1; files = null; if (!dirs.isEmpty()) { <START> UI.getNotificationManager().sendNotification("ui.notifications.beatmaps.imported", dirs.size()); <END> } return dirs.toArray(new File[dirs.size()]); }</code><technical_language>IMO, messages wrong grammar annoy me, is I hacks for plurals. prefer if generally leave in; is a for a localization ignore extra parameters use</technical_language>

Target:
public static File[] unpackAllFiles(File root, File dest) { List<File> dirs = new ArrayList<File>(); files = root.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".osz"); } }); if (files == null || files.length < 1) { files = null; return new File[0]; } BeatmapWatchService ws = (Options.isWatchServiceEnabled()) ? BeatmapWatchService.get() : null; if (ws != null) ws.pause(); for (File file : files) { fileIndex++; String dirName = file.getName().substring(0, file.getName().lastIndexOf('.')); File songDir = new File(dest, dirName); if (!songDir.isDirectory()) { songDir.mkdir(); Utils.unzip(file, songDir); file.delete(); dirs.add(songDir); } } if (ws != null) ws.resume(); fileIndex = -1; files = null; if (!dirs.isEmpty()) { UI.getNotificationManager().sendNotification("ui.notifications.beatmaps.imported", dirs.size(), dirs.size() == 1 ? "" : "s"); } return dirs.toArray(new File[dirs.size()]); }
Source:
<code>public void testParseFile() throws Exception { List<File> testInputFiles = DeclarationGeneratorTests.getTestInputFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith(".depgraph"); } }); List<String> args = new ArrayList<>(); args.add("foo.js"); args.add("--depgraphs"); for (File testInputFile : testInputFiles) { args.add(testInputFile.getAbsolutePath()); } Options opts = new Options(args.toArray(new String[testInputFiles.size() + 2])); <START> List<String> depgraphRoots = new DeclarationGenerator(opts).parseDepgraphRoots(); <END> assertThat(depgraphRoots) .containsExactly("my/thing/static/js/annotations/annotations-canvas-controller.js"); }</code><technical_language>this testing wrong level - restructure code test parsing a depgraph file setting machinery main method opts everything</technical_language>

Target:
public void testParseFile() throws Exception { List<File> testInputFiles = DeclarationGeneratorTests.getTestInputFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith(".depgraph"); } }); List<String> contents = new ArrayList<>(); for (File testInputFile : testInputFiles) { contents.add(Files.toString(testInputFile, UTF_8)); } Depgraph depgraph = Depgraph.parseFrom(contents); assertThat(depgraph.getRoots()) .containsExactly("my/thing/static/js/annotations/annotations-canvas-controller.js"); }
Source:
<code>private static void putRwtVersion(VersionMap values, Version swtVersion) { if (!(swtVersion instanceof OSGiVersion)) return; int major = ((OSGiVersion) swtVersion).getMajor(); if (major != 3) return; int minor = ((OSGiVersion) swtVersion).getMinor(); <START> if (minor <= 5) { <END> values.put(VERSION, "4.3"); } }</code><technical_language>Add support for RAP 3.6</technical_language>

Target:
private static void putRwtVersion(VersionMap values, Version swtVersion) { if (!(swtVersion instanceof OSGiVersion)) return; int major = ((OSGiVersion) swtVersion).getMajor(); if (major != 3) return; int minor = ((OSGiVersion) swtVersion).getMinor(); if (minor <= 6) { values.put(VERSION, "4.3"); } }
Source:
<code>protected void log(@Nullable Site site, Object... params) { if (!app.isEventLoggingEnabled()) { return; } int rate = getSampleRate(); <START> if (rate != 0) { <END> boolean chosen = app.getEventLogSamplingID() % rate == 0 || app.isDevRelease(); if (chosen) { JSONObject eventData = new JSONObject(); String logString = this.getClass().getSimpleName() + ": Sending event"; for (int i = 0; i < params.length; i += 2) { preprocessData(eventData, params[i].toString(), params[i + 1]); logString += ", event_" + params[i] + " = " + params[i + 1]; } Log.d(ANALYTICS_TAG, logString); new EventLoggingEvent( schemaName, revision, Utils.getDBNameForSite(site == null ? getApp().getPrimarySite() : site), app.getUserAgent(), preprocessData(eventData) ).log(); } } }</code><technical_language>if (rate != SAMPLE_LOG_DISABLE)</technical_language>

Target:
protected void log(@Nullable Site site, Object... params) { if (!app.isEventLoggingEnabled()) { return; } int rate = getSampleRate(); if (rate != SAMPLE_LOG_DISABLE) { boolean chosen = app.getEventLogSamplingID() % rate == 0 || app.isDevRelease(); if (chosen) { JSONObject eventData = new JSONObject(); String logString = this.getClass().getSimpleName() + ": Sending event"; for (int i = 0; i < params.length; i += 2) { preprocessData(eventData, params[i].toString(), params[i + 1]); logString += ", event_" + params[i] + " = " + params[i + 1]; } Log.d(ANALYTICS_TAG, logString); new EventLoggingEvent( schemaName, revision, Utils.getDBNameForSite(site == null ? getApp().getPrimarySite() : site), app.getUserAgent(), preprocessData(eventData) ).log(); } } }
Source:
<code>public Map<String, Object> handlePayloadVariables(Map<String, Object> variables) { if (variables != null) { Set<String> mismatchedVars = variableNameValidator.validateVariables(variables); if (!mismatchedVars.isEmpty()) { throw new IllegalStateException("Variables have not valid names: " + String.join(", ", mismatchedVars)); } <START> variables.entrySet() <END> .stream() .filter(stringObjectEntry -> stringObjectEntry.getValue() instanceof String) .forEach(stringObjectEntry -> handleAsDate((String) stringObjectEntry.getValue()).ifPresent(stringObjectEntry::setValue)); } return variables; }</code><technical_language>break separate private methods? is hard understand</technical_language>

Target:
public Map<String, Object> handlePayloadVariables(Map<String, Object> variables) { if (variables != null) { Set<String> mismatchedVars = variableNameValidator.validateVariables(variables); if (!mismatchedVars.isEmpty()) { throw new IllegalStateException("Variables have not valid names: " + String.join(", ", mismatchedVars)); } handleStringVariablesAsDates(variables); } return variables; }
Source:
<code>public void testFSUriWithHostPortUnspecified() throws Exception { Configuration conf = new OzoneConfiguration(); <START> final int OM_PORT_DEFAULT = OmUtils.getOmRpcPort(conf); <END> OzoneClient ozoneClient = mock(OzoneClient.class); ObjectStore objectStore = mock(ObjectStore.class); OzoneVolume volume = mock(OzoneVolume.class); OzoneBucket bucket = mock(OzoneBucket.class); when(ozoneClient.getObjectStore()).thenReturn(objectStore); when(objectStore.getVolume(eq("volume1"))).thenReturn(volume); when(volume.getBucket("bucket1")).thenReturn(bucket); PowerMockito.mockStatic(OzoneClientFactory.class); PowerMockito.when(OzoneClientFactory.getRpcClient(eq("local.host"), eq(OM_PORT_DEFAULT), eq(conf))).thenReturn(ozoneClient); UserGroupInformation ugi = mock(UserGroupInformation.class); PowerMockito.mockStatic(UserGroupInformation.class); PowerMockito.when(UserGroupInformation.getCurrentUser()).thenReturn(ugi); when(ugi.getShortUserName()).thenReturn("user1"); URI uri = new URI("o3fs://bucket1.volume1.local.host"); FileSystem fileSystem = FileSystem.get(uri, conf); OzoneFileSystem ozfs = (OzoneFileSystem) fileSystem; assertEquals(ozfs.getUri().getHost(), "bucket1.volume1.local.host"); assertEquals(ozfs.getUri().getPort(), -1); PowerMockito.verifyStatic(); OzoneClientFactory.getRpcClient("local.host", OM_PORT_DEFAULT, conf); }</code><technical_language>checkstyle: Name 'OM_PORT_DEFAULT' match pattern '^[a-z][a-zA-Z0-9]*$'</technical_language>

Target:
public void testFSUriWithHostPortUnspecified() throws Exception { Configuration conf = new OzoneConfiguration(); final int omPort = OmUtils.getOmRpcPort(conf); OzoneClient ozoneClient = mock(OzoneClient.class); ObjectStore objectStore = mock(ObjectStore.class); OzoneVolume volume = mock(OzoneVolume.class); OzoneBucket bucket = mock(OzoneBucket.class); when(ozoneClient.getObjectStore()).thenReturn(objectStore); when(objectStore.getVolume(eq("volume1"))).thenReturn(volume); when(volume.getBucket("bucket1")).thenReturn(bucket); PowerMockito.mockStatic(OzoneClientFactory.class); PowerMockito.when(OzoneClientFactory.getRpcClient(eq("local.host"), eq(omPort), eq(conf))).thenReturn(ozoneClient); UserGroupInformation ugi = mock(UserGroupInformation.class); PowerMockito.mockStatic(UserGroupInformation.class); PowerMockito.when(UserGroupInformation.getCurrentUser()).thenReturn(ugi); when(ugi.getShortUserName()).thenReturn("user1"); URI uri = new URI("o3fs://bucket1.volume1.local.host"); FileSystem fileSystem = FileSystem.get(uri, conf); OzoneFileSystem ozfs = (OzoneFileSystem) fileSystem; assertEquals(ozfs.getUri().getHost(), "bucket1.volume1.local.host"); assertEquals(ozfs.getUri().getPort(), -1); PowerMockito.verifyStatic(); OzoneClientFactory.getRpcClient("local.host", omPort, conf); }
Source:
<code>public String encryptMiddleMobile(String mobile) { <START> if (Strings.isNullOrEmpty(mobile) || mobile.length() != 11) { <END> return "****"; } String encryptLoginName = mobile.substring(0, 3) + RandomUtils.showChar(4) + mobile.substring(7); return encryptLoginName; }</code><technical_language>remove</technical_language>

Target:
public String encryptMiddleMobile(String mobile) { return mobile.substring(0, 3) + RandomUtils.showChar(4) + mobile.substring(7); }
Source:
<code>private void checkSSLConfig(ExpressionTree expressionTree) { ExpressionTree param = getAssignedValue(expressionTree); if (!param.is(Tree.Kind.ARRAY_INITIALIZER_BRACKET, Tree.Kind.ARRAY_INITIALIZER_FUNCTION)) { return; } ArrayInitializerTree config = (ArrayInitializerTree) param; <START> getProperty(config, "SSL") <END> .flatMap(sslConfig -> { if (sslConfig.is(Tree.Kind.ARRAY_INITIALIZER_BRACKET, Tree.Kind.ARRAY_INITIALIZER_FUNCTION)) { return getProperty((ArrayInitializerTree) sslConfig, "crypto_method"); } return Optional.empty(); }) .ifPresent(value -> checkWeakProtocol(value, STREAM_CONTEXT_CREATE)); }</code><technical_language>config here, more readable pass (ArrayInitializerTree) param drop local variable rename param config suggest expect</technical_language>

Target:
private void checkSSLConfig(ExpressionTree expressionTree) { ExpressionTree config = getAssignedValue(expressionTree); if (!isArrayInitializer(config)) { return; } getProperty((ArrayInitializerTree) config, "SSL") .flatMap(sslConfig -> { if (isArrayInitializer(sslConfig)) { return getProperty((ArrayInitializerTree) sslConfig, "crypto_method"); } return Optional.empty(); }) .ifPresent(value -> checkWeakProtocol(value, STREAM_CONTEXT_CREATE)); }