auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private Response<CacheableBitmapDrawable> doParse(NetworkResponse response) { response.isImage = true; byte[] data = response.data; BitmapFactory.Options decodeOptions = new BitmapFactory.Options(); decodeOptions.inPreferredConfig = mDecodeConfig; Bitmap bitmap; decodeOptions.inJustDecodeBounds = true; BitmapFactory.decodeByteArray(data, 0, data.length, decodeOptions); int actualWidth = decodeOptions.outWidth; int actualHeight = decodeOptions.outHeight; int sampleSize = 1; if (mMaxWidth > 0 || mMaxHeight > 0) { int desiredWidth = getResizedDimension(mMaxWidth, mMaxHeight, actualWidth, actualHeight); int desiredHeight = getResizedDimension(mMaxHeight, mMaxWidth, actualHeight, actualWidth); sampleSize = findBestSampleSize(actualWidth, actualHeight, desiredWidth, desiredHeight); } decodeOptions.inSampleSize = sampleSize; decodeOptions.inJustDecodeBounds = false; decodeOptions.inMutable = true; Bitmap inBitmap = mCache.getOldestUnused(getCacheKey(), actualWidth / sampleSize, actualHeight / sampleSize, decodeOptions.inPreferredConfig, sampleSize); if (inBitmap != null) { decodeOptions.inBitmap = inBitmap; } try { bitmap = BitmapFactory.decodeByteArray(data, 0, data.length, decodeOptions); } catch (IllegalArgumentException e) { decodeOptions.inBitmap = null; bitmap = BitmapFactory.decodeByteArray(data, 0, data.length, decodeOptions); } if (bitmap == null) { return Response.error(new ParseError(response)); } else { return Response.success(new CacheableBitmapDrawable(mContext.getResources(), bitmap), HttpHeaderParser.parseCacheHeaders(response)); } }

Target:
private Response<CacheableBitmapDrawable> doParse(NetworkResponse response) { response.isImage = true; byte[] data = response.data; BitmapFactory.Options decodeOptions = new BitmapFactory.Options(); decodeOptions.inPreferredConfig = mDecodeConfig; Bitmap bitmap; decodeOptions.inJustDecodeBounds = true; BitmapFactory.decodeByteArray(data, 0, data.length, decodeOptions); int actualWidth = decodeOptions.outWidth; int actualHeight = decodeOptions.outHeight; int sampleSize = 1; if (mMaxWidth > 0 && mMaxHeight > 0) { int desiredWidth = getResizedDimension(mMaxWidth, mMaxHeight, actualWidth, actualHeight); int desiredHeight = getResizedDimension(mMaxHeight, mMaxWidth, actualHeight, actualWidth); sampleSize = findBestSampleSize(actualWidth, actualHeight, desiredWidth, desiredHeight); } decodeOptions.inSampleSize = sampleSize; decodeOptions.inJustDecodeBounds = false; decodeOptions.inMutable = true; Bitmap inBitmap = mCache.getOldestUnused(getCacheKey(), actualWidth / sampleSize, actualHeight / sampleSize, decodeOptions.inPreferredConfig, sampleSize); if (inBitmap != null) { decodeOptions.inBitmap = inBitmap; } try { bitmap = BitmapFactory.decodeByteArray(data, 0, data.length, decodeOptions); } catch (IllegalArgumentException e) { decodeOptions.inBitmap = null; bitmap = BitmapFactory.decodeByteArray(data, 0, data.length, decodeOptions); } if (bitmap == null) { return Response.error(new ParseError(response)); } else { return Response.success(new CacheableBitmapDrawable(mContext.getResources(), bitmap), HttpHeaderParser.parseCacheHeaders(response)); } }
Source:
public int getLocationQuark(ITmfEvent event, int startQuark) { int quark = startQuark; for (TmfXmlStateAttribute attrib : fPath) { quark = attrib.getAttributeQuark(event, quark); } return quark; }

Target:
public int getLocationQuark(ITmfEvent event, int startQuark) { int quark = startQuark; for (TmfXmlStateAttribute attrib : fPath) { quark = attrib.getAttributeQuark(event, quark); if (quark == -1) { break; } } return quark; }
Source:
public MongoDBCacheStoreConfig(String host, int port, int timeout, String username, String password, String database, String collection, int acknowledgment) { if (port < 1 || port > 65535) { log.mongoPortIllegalValue(String.valueOf(port)); } this.host = host; this.port = port; this.username = username; this.password = password; this.database = database; this.collection = collection; this.timeout = timeout; if (acknowledgment <= -1) { this.acknowledgment = -1; } else if (this.acknowledgment >= 2) { this.acknowledgment = 2; } else { this.acknowledgment = acknowledgment; } }

Target:
public MongoDBCacheStoreConfig(String host, int port, int timeout, String username, String password, String database, String collection, int acknowledgment) { if (port < 1 || port > 65535) { log.mongoPortIllegalValue(port); } this.host = host; this.port = port; this.username = username; this.password = password; this.database = database; this.collection = collection; this.timeout = timeout; if (acknowledgment <= -1) { this.acknowledgment = -1; } else if (this.acknowledgment >= 2) { this.acknowledgment = 2; } else { this.acknowledgment = acknowledgment; } }
Source:
void cleanCachesIfFlagSet( String root ) throws IOException { logger.info( "Checking to see if " + CLEAN_KARAF_CACHE + " is enabled" ); final Properties customProperties = getCustomProperties( root ); String cleanCache = customProperties.getProperty( CLEAN_KARAF_CACHE, "false" ); if ( "true".equals( cleanCache ) ) { logger.info( CLEAN_KARAF_CACHE + " is enabled. Karaf data directories will be deleted" ); File cacheParent = new File( root + "/caches" ); File[] clientCacheFolders = cacheParent.listFiles( directoryFilter ); for ( File clientCacheFolder : clientCacheFolders ) { File[] cacheDirs = clientCacheFolder.listFiles( directoryFilter ); for ( File cacheDir : cacheDirs ) { File lockFile = new File( cacheDir, ".lock" ); FileOutputStream fileOutputStream = new FileOutputStream( lockFile ); try { FileLock fileLock = fileOutputStream.getChannel().tryLock(); fileLock.release(); IOUtils.closeQuietly( fileOutputStream ); FileUtils.deleteDirectory( cacheDir ); } catch ( Exception ignored ) { } finally { IOUtils.closeQuietly( fileOutputStream ); } } } customProperties.setProperty( CLEAN_KARAF_CACHE, "false" ); FileOutputStream out = null; try { final String customLocation = root + "/etc/custom.properties"; out = new FileOutputStream( customLocation ); logger.info( "Setting " + CLEAN_KARAF_CACHE + " back to false as this is a one-time action" ); customProperties.store( out, "Turning of one-time cache clean setting" ); } finally { this.karafCustomProperties = customProperties; if ( out != null ) { IOUtils.closeQuietly( out ); } } } }

Target:
void cleanCachesIfFlagSet( String root ) throws IOException { logger.info( "Checking to see if " + CLEAN_KARAF_CACHE + " is enabled" ); String cleanCache = this.karafCustomProperties.getProperty( CLEAN_KARAF_CACHE, "false" ); if ( "true".equals( cleanCache ) ) { logger.info( CLEAN_KARAF_CACHE + " is enabled. Karaf data directories will be deleted" ); File cacheParent = new File( root + "/caches" ); File[] clientCacheFolders = cacheParent.listFiles( directoryFilter ); for ( File clientCacheFolder : clientCacheFolders ) { File[] cacheDirs = clientCacheFolder.listFiles( directoryFilter ); for ( File cacheDir : cacheDirs ) { File lockFile = new File( cacheDir, ".lock" ); FileOutputStream fileOutputStream = new FileOutputStream( lockFile ); try { FileLock fileLock = fileOutputStream.getChannel().tryLock(); fileLock.release(); IOUtils.closeQuietly( fileOutputStream ); FileUtils.deleteDirectory( cacheDir ); } catch ( Exception ignored ) { } finally { IOUtils.closeQuietly( fileOutputStream ); } } } this.karafCustomProperties.setProperty( CLEAN_KARAF_CACHE, "false" ); FileOutputStream out = null; try { final String customLocation = root + "/etc/custom.properties"; out = new FileOutputStream( customLocation ); logger.info( "Setting " + CLEAN_KARAF_CACHE + " back to false as this is a one-time action" ); this.karafCustomProperties.store( out, "Turning of one-time cache clean setting" ); } finally { if ( out != null ) { IOUtils.closeQuietly( out ); } } } }
Source:
public boolean isActive(FeatureState featureState, FeatureUser user) { HttpServletRequest request = HttpServletRequestHolder.get(); if (request != null) { List<String> parts = Strings.splitAndTrim(featureState.getParameter(PARAM_IPS), "[\\s,]+"); try { String remoteAddr = request.getHeader("X-FORWARDED-FOR"); if(Strings.isBlank(remoteAddr)) { remoteAddr = request.getRemoteAddr(); } InetAddress remoteInetAddress = InetAddress.getByName(remoteAddr); for (String part : parts) { if (part.equals(remoteAddr)) { return true; } if (part.contains("/")) { CIDRUtils cidrUtil = new CIDRUtils(part); if (cidrUtil.isInRange(remoteInetAddress)) { return true; } } else if (remoteInetAddress.equals(InetAddress.getByName(part))) { return true; } } } catch (UnknownHostException | IllegalArgumentException e) { log.warn("Ignoring illegal IP address or CIDR range "); } } return false; }

Target:
public boolean isActive(FeatureState featureState, FeatureUser user) { HttpServletRequest request = HttpServletRequestHolder.get(); if (request != null) { List<String> parts = Strings.splitAndTrim(featureState.getParameter(PARAM_IPS), "[\\s,]+"); try { String remoteAddr = request.getHeader("X-Forwarded-For"); if (Strings.isBlank(remoteAddr)) { remoteAddr = request.getRemoteAddr(); } InetAddress remoteInetAddress = InetAddress.getByName(remoteAddr); for (String part : parts) { if (part.equals(remoteAddr)) { return true; } if (part.contains("/")) { CIDRUtils cidrUtil = new CIDRUtils(part); if (cidrUtil.isInRange(remoteInetAddress)) { return true; } } else if (remoteInetAddress.equals(InetAddress.getByName(part))) { return true; } } } catch (UnknownHostException | IllegalArgumentException e) { log.warn("Ignoring illegal IP address or CIDR range "); } } return false; }
Source:
final public void end() { onEnd(); if (previous != null && (!previous.isScheduled())) { previous.schedule(); } }

Target:
public final void end() { onEnd(); if (previous != null && !previous.isScheduled()) { previous.schedule(); } }
Source:
public IssueBacklog(IProject project, IUserSession userSession) { m_project = new ProjectObject(); m_project.setNickName(project.getName()); m_userSession = userSession; m_config = new Configuration(m_userSession); }

Target:
public IssueBacklog(IProject project, IUserSession userSession) { m_project = new ProjectObject(project.getName()); m_userSession = userSession; m_config = new Configuration(m_userSession); }
Source:
FilterBuilder getTagKeyFilter(final TagKeyFilter filter, final boolean nested) { final FilterBuilder builder = FilterBuilders.boolFilter(); if (filter instanceof TagKeyLiteralOrFilter) { ((BoolFilterBuilder) builder).must(FilterBuilders.regexpFilter (QUERY_TAG_VALUE_KEY, "" + ".*")) .must(FilterBuilders.termFilter(QUERY_TAG_KEY_KEY, filter.filter())); } else if (filter instanceof TagKeyRegexFilter) { ((BoolFilterBuilder) builder).must(FilterBuilders.regexpFilter(QUERY_TAG_VALUE_KEY, ".*")) .must(FilterBuilders.regexpFilter(QUERY_TAG_KEY_KEY, filter.filter())); } if (nested) { return FilterBuilders.nestedFilter(TAG_PATH, builder); } return builder; }

Target:
FilterBuilder getTagKeyFilter(final TagKeyFilter filter, final boolean nested) { final FilterBuilder builder = FilterBuilders.boolFilter(); if (filter instanceof TagKeyLiteralOrFilter) { ((BoolFilterBuilder) builder).must(FilterBuilders.regexpFilter (QUERY_TAG_VALUE_KEY, ".*")) .must(FilterBuilders.termFilter(QUERY_TAG_KEY_KEY, filter.filter())); } else if (filter instanceof TagKeyRegexFilter) { ((BoolFilterBuilder) builder).must(FilterBuilders.regexpFilter(QUERY_TAG_VALUE_KEY, ".*")) .must(FilterBuilders.regexpFilter(QUERY_TAG_KEY_KEY, filter.filter())); } if (nested) { return FilterBuilders.nestedFilter(TAG_PATH, builder); } return builder; }
Source:
public void patchGroupWithParentUnprocessable() throws Exception { context.turnOffAuthorisationSystem(); EPerson reviewer1 = EPersonBuilder.createEPerson(context) .withEmail("reviewer1@example.com") .withPassword(password) .build(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1) .withName("Collection 1") .withWorkflowGroup(1, admin, reviewer1) .build(); final Group workflowGroup = col1.getWorkflowStep1(context); final String name = workflowGroup.getName(); String token = getAuthToken(admin.getEmail(), password); String requestBody = " [\n" + " {\n" + " \"op\": \"replace\",\n" + " \"path\": \"/name\",\n" + " \"value\": \"new name\"\n" + " }\n" + " ]"; getClient(token) .perform(patch("/api/eperson/groups/" + workflowGroup.getID()).content(requestBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isUnprocessableEntity()); getClient(token) .perform(get("/api/eperson/groups/" + workflowGroup.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.is( GroupMatcher.matchGroupEntry(workflowGroup.getID(), name)) )); }

Target:
public void patchGroupWithParentUnprocessable() throws Exception { context.turnOffAuthorisationSystem(); EPerson reviewer1 = EPersonBuilder.createEPerson(context) .withEmail("reviewer1@example.com") .withPassword(password) .build(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1) .withName("Collection 1") .withWorkflowGroup(1, admin, reviewer1) .build(); final Group workflowGroup = col1.getWorkflowStep1(context); final String name = workflowGroup.getName(); context.restoreAuthSystemState(); String token = getAuthToken(admin.getEmail(), password); List<Operation> ops = new ArrayList<>(); ReplaceOperation replaceOperation = new ReplaceOperation("/name", "new name"); ops.add(replaceOperation); String requestBody = getPatchContent(ops); getClient(token) .perform(patch("/api/eperson/groups/" + workflowGroup.getID()).content(requestBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isUnprocessableEntity()); getClient(token) .perform(get("/api/eperson/groups/" + workflowGroup.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.is( GroupMatcher.matchGroupEntry(workflowGroup.getID(), name)) )); }
Source:
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) { if (stack.getTagCompound() == null){ stack.setTagInfo("baton_mode", stack.serializeNBT()); stack.getTagCompound().setByte("baton_mode", (byte) BatonMode.CLEAR_COMMAND.ordinal()); } String keyText, text; text = "RMB" + " = " + I18n.format("guistrings.npc.baton.add_remove"); tooltip.add(text); keyText = InputHandler.ALT_ITEM_USE_1.getDisplayName(); BatonMode mode = BatonMode.values()[stack.getTagCompound().getByte("baton_mode")]; text = keyText + " = " + "Execute Command: " + I18n.format(mode.getTranslationKey()); tooltip.add(text); keyText = InputHandler.ALT_ITEM_USE_2.getDisplayName(); text = keyText + " = " + "Lock/Unlock Hotbar, use scroll wheel to change mode when locked"; tooltip.add(text); }

Target:
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) { if (!stack.hasTagCompound()){ stack.setTagInfo("baton_mode", new NBTBuilder().setString("baton_mode", BatonMode.getDefault().getTranslationKey()).build()); stack.setTagInfo("scroll_lock", new NBTBuilder().setBoolean("scroll_lock", false).build()); } String keyText, text; text = "RMB" + " = " + I18n.format("guistrings.npc.baton.add_remove"); tooltip.add(text); keyText = InputHandler.ALT_ITEM_USE_1.getDisplayName(); ; text = keyText + " = " + "Execute Command: " + I18n.format(getMode(stack).getTranslationKey()); tooltip.add(text); keyText = InputHandler.ALT_ITEM_USE_2.getDisplayName(); text = keyText + " = " + "Lock/Unlock Hotbar, use scroll wheel to change mode when locked"; tooltip.add(text); }
Source:
static void testFailed(String name, Throwable exception) { String message = "Test starting: " + name; consoleLog(message); log.error(message, exception); failed.incrementAndGet(); printStatus(); }

Target:
static void testFailed(String name, Throwable exception) { String message = "Test failed: " + name; consoleLog(message); log.error(message, exception); failed.incrementAndGet(); printStatus(); }
Source:
public DiagnosticReport getDiagnosticReport(final String accessionNumber) { loadHandlerMap(); List<Order> orders = dao.getOrdersByAccessionNumber(accessionNumber); if (orders != null && !orders.isEmpty()) { Order order = orders.get(0); String handlerName = orderTypeToHandlerNameMap.get(order.getOrderType().getName()); if (StringUtils.isEmpty(handlerName)) { handlerName = orderTypeToHandlerNameMap.get(DEFAULT_HANDLER); } return FHIRDiagnosticReportUtil.getFHIRDiagnosticReport(order.getUuid(), getHandler(handlerName)); } else { throw new APIException("Can not identify order by accession number"); } }

Target:
public DiagnosticReport getDiagnosticReport(final String accessionNumber) { loadHandlerMap(); List<Order> orders = dao.getOrdersByAccessionNumber(accessionNumber); if (!orders.isEmpty()) { Order order = orders.get(0); String handlerName = orderTypeToHandlerNameMap.get(order.getOrderType().getName()); if (StringUtils.isEmpty(handlerName)) { handlerName = orderTypeToHandlerNameMap.get(DEFAULT_HANDLER); } return FHIRDiagnosticReportUtil.getFHIRDiagnosticReport(order.getUuid(), getHandler(handlerName)); } else { throw new APIException("Can not identify order by accession number"); } }
Source:
protected void uploadIndividuals(String embeddedVP, FilePath[] paths, FilePath workspace) throws WAStorageException { final UploadServiceData serviceData = getServiceData(); try { final CloudBlobContainer container = getCloudBlobContainer(); List<UploadObject> uploadObjects = new ArrayList<>(); for (FilePath src : paths) { final String blobPath = getItemPath(src, embeddedVP); final CloudBlockBlob blob = container.getBlockBlobReference(blobPath); configureBlobPropertiesAndMetadata(blob, src); StorageAccountInfo accountInfo = serviceData.getStorageAccountInfo(); String sas = generateWriteSASURL(accountInfo, blob.getName(), Constants.BLOB_STORAGE, container.getName()); String blobURL = blob.getUri().toString().replace("http://", "https://"); UploadObject uploadObject = new UploadObject(blob.getName(), src, blobURL, sas, Constants.BLOB_STORAGE, blob.getServiceClient().getCredentials().getAccountName(), blob.getProperties(), blob.getMetadata()); uploadObjects.add(uploadObject); } UploadOnSlave uploadOnSlave = new UploadOnSlave(uploadObjects); List<Future<UploadResult>> results = workspace.act(uploadOnSlave); updateAzureBlobs(results, serviceData.getIndividualBlobs()); } catch (Exception e) { String storageAcc = AppInsightsUtils.hash(serviceData.getStorageAccountInfo().getStorageAccName()); AzureStoragePlugin.sendEvent(AppInsightsConstants.AZURE_BLOB_STORAGE, UPLOAD_FAILED, "StorageAccount", storageAcc, "Message", e.getMessage()); throw new WAStorageException("Fail to upload archive to blob", e); } }

Target:
protected void uploadIndividuals(String embeddedVP, FilePath[] paths, FilePath workspace) throws WAStorageException { final UploadServiceData serviceData = getServiceData(); try { final CloudBlobContainer container = getCloudBlobContainer(); List<UploadObject> uploadObjects = new ArrayList<>(); for (FilePath src : paths) { final String blobPath = getItemPath(src, embeddedVP); final CloudBlockBlob blob = container.getBlockBlobReference(blobPath); configureBlobPropertiesAndMetadata(blob, src); UploadObject uploadObject = generateUploadObject(src, serviceData.getStorageAccountInfo(), blob, container.getName()); uploadObjects.add(uploadObject); } UploadOnSlave uploadOnSlave = new UploadOnSlave(uploadObjects); List<Future<UploadResult>> results = workspace.act(uploadOnSlave); updateAzureBlobs(results, serviceData.getIndividualBlobs()); } catch (Exception e) { String storageAcc = AppInsightsUtils.hash(serviceData.getStorageAccountInfo().getStorageAccName()); AzureStoragePlugin.sendEvent(AppInsightsConstants.AZURE_BLOB_STORAGE, UPLOAD_FAILED, "StorageAccount", storageAcc, "Message", e.getMessage()); throw new WAStorageException("Fail to upload archive to blob", e); } }
Source:
public void testConcurrentListenerAddAndRemove(Method method) throws InterruptedException, ExecutionException { String counterName = method.getName(); defineAndCreateCounter(counterName, 1); List<T> counters = getCounters(counterName); List<IncrementTask> taskList = counters.stream() .map(IncrementTask::new) .collect(Collectors.toList()); List<Future<?>> futureTaskList = taskList.stream() .map(this::fork) .collect(Collectors.toList()); T counter = counters.get(0); Handle<BaseCounterImplTest.EventLogger> handle = addListenerTo(counter, new BaseCounterImplTest.EventLogger()); Thread.sleep(1000); handle.remove(); taskList.forEach(IncrementTask::stop); futureTaskList.forEach(this::awaitFuture); drainAndCheckEvents(handle); assertNoEvents(handle); increment(counter); assertNoEvents(handle); }

Target:
public void testConcurrentListenerAddAndRemove(Method method) throws InterruptedException, ExecutionException { String counterName = method.getName(); defineAndCreateCounter(counterName, 1); List<T> counters = getCounters(counterName); List<IncrementTask> taskList = counters.stream() .map(IncrementTask::new) .collect(Collectors.toList()); List<Future<?>> futureTaskList = taskList.stream() .map(this::fork) .collect(Collectors.toList()); T counter = counters.get(0); Handle<BaseCounterImplTest.EventLogger> handle = addListenerTo(counter, new BaseCounterImplTest.EventLogger()); eventually(() -> handle.getCounterListener().size() > 5); handle.remove(); taskList.forEach(IncrementTask::stop); futureTaskList.forEach(this::awaitFuture); drainAndCheckEvents(handle); assertNoEvents(handle); increment(counter); assertNoEvents(handle); }
Source:
public void testInputKinds() { Service service = connect(); InputCollection inputs = service.getInputs(); Set<InputKind> kinds = inputs.getInputKinds(); boolean hasTest2 = false; for (InputKind ik : kinds) { if (ik.kind == "test2") { hasTest2 = true; } } }

Target:
@Test public void testInputKinds() { Service service = connect(); InputCollection inputs = service.getInputs(); Set<InputKind> kinds = inputs.getInputKinds(); boolean hasTest2 = false; for (InputKind ik : kinds) { if (ik.getKind() == "test2") { hasTest2 = true; } } SplunkTestCase.assertTrue(hasTest2); }
Source:
public TaskInfo( String taskName, int maxNumberOfParallelSubtasks, int indexOfSubtask, int numberOfParallelSubtasks, int attemptNumber, String allocationIDAsString) { checkArgument(indexOfSubtask >= 0, "Task index must be a non-negative number."); checkArgument(maxNumberOfParallelSubtasks >= 1, "Max parallelism must be a positive number."); checkArgument(maxNumberOfParallelSubtasks >= numberOfParallelSubtasks, "Max parallelism must be >= than parallelism."); checkArgument(numberOfParallelSubtasks >= 1, "Parallelism must be a positive number."); checkArgument(indexOfSubtask < numberOfParallelSubtasks, "Task index must be less than parallelism."); checkArgument(attemptNumber >= 0, "Attempt number must be a non-negative number."); this.taskName = checkNotNull(taskName, "Task Name must not be null."); this.maxNumberOfParallelSubtasks = maxNumberOfParallelSubtasks; this.indexOfSubtask = indexOfSubtask; this.numberOfParallelSubtasks = numberOfParallelSubtasks; this.attemptNumber = attemptNumber; this.taskNameWithSubtasks = taskName + " (" + (indexOfSubtask + 1) + '/' + numberOfParallelSubtasks + ')' + " - execution #" + attemptNumber; this.allocationIDAsString = checkNotNull(allocationIDAsString); }

Target:
public TaskInfo( String taskName, int maxNumberOfParallelSubtasks, int indexOfSubtask, int numberOfParallelSubtasks, int attemptNumber, String allocationIDAsString) { checkArgument(indexOfSubtask >= 0, "Task index must be a non-negative number."); checkArgument(maxNumberOfParallelSubtasks >= 1, "Max parallelism must be a positive number."); checkArgument(maxNumberOfParallelSubtasks >= numberOfParallelSubtasks, "Max parallelism must be >= than parallelism."); checkArgument(numberOfParallelSubtasks >= 1, "Parallelism must be a positive number."); checkArgument(indexOfSubtask < numberOfParallelSubtasks, "Task index must be less than parallelism."); checkArgument(attemptNumber >= 0, "Attempt number must be a non-negative number."); this.taskName = checkNotNull(taskName, "Task Name must not be null."); this.maxNumberOfParallelSubtasks = maxNumberOfParallelSubtasks; this.indexOfSubtask = indexOfSubtask; this.numberOfParallelSubtasks = numberOfParallelSubtasks; this.attemptNumber = attemptNumber; this.taskNameWithSubtasks = taskName + " (" + (indexOfSubtask + 1) + '/' + numberOfParallelSubtasks + ')' + "#" + attemptNumber; this.allocationIDAsString = checkNotNull(allocationIDAsString); }
Source:
public ActivationKeyDTO setContentOverrides(Set<ActivationKeyContentOverrideDTO> contentOverrides) { if (contentOverrides != null) { if (this.contentOverrides == null) { this.contentOverrides = new HashSet<ActivationKeyContentOverrideDTO>(); } else { this.contentOverrides.clear(); } for (ActivationKeyContentOverrideDTO dto : contentOverrides) { if (dto == null || dto.getContentLabel() == null || "".equals(dto.getContentLabel()) || dto.getName() == null || "".equals(dto.getName()) || dto.getValue() == null || "".equals(dto.getValue())) { throw new IllegalArgumentException("collection contains null or incomplete dtos"); } this.contentOverrides.add( new ActivationKeyContentOverrideDTO( dto.getContentLabel(), dto.getName(), dto.getValue())); } } else { this.contentOverrides = null; } return this; }

Target:
public ActivationKeyDTO setContentOverrides(Set<ActivationKeyContentOverrideDTO> contentOverrides) { if (contentOverrides != null) { if (this.contentOverrides == null) { this.contentOverrides = new HashSet<ActivationKeyContentOverrideDTO>(); } else { this.contentOverrides.clear(); } for (ActivationKeyContentOverrideDTO dto : contentOverrides) { if (isNullOrIncomplete(dto)) { throw new IllegalArgumentException("collection contains null " + "or incomplete content override"); } this.contentOverrides.add( new ActivationKeyContentOverrideDTO( dto.getContentLabel(), dto.getName(), dto.getValue())); } } else { this.contentOverrides = null; } return this; }
Source:
private void run(String[] args) throws Exception { this.config = MaxwellConfig.buildConfig("config.properties", args); SchemaStore.createMaxwellSchema(this.config.getMasterConnection()); if ( this.config.getInitialPosition() != null ) { LOGGER.info("Maxwell is booting, starting at " + this.config.getInitialPosition()); SchemaStore store = SchemaStore.restore(this.config.getMasterConnection(), this.config.getInitialPosition()); this.schema = store.getSchema(); } else { initFirstRun(); } AbstractProducer producer = this.config.getProducer(); MaxwellParser p = new MaxwellParser(this.schema, producer); p.setConfig(this.config); p.run(); }

Target:
private void run(String[] args) throws Exception { this.config = MaxwellConfig.buildConfig("config.properties", args); SchemaStore.ensureMaxwellSchema(this.config.getMasterConnection()); if ( this.config.getInitialPosition() != null ) { LOGGER.info("Maxwell is booting, starting at " + this.config.getInitialPosition()); SchemaStore store = SchemaStore.restore(this.config.getMasterConnection(), this.config.getInitialPosition()); this.schema = store.getSchema(); } else { initFirstRun(); } AbstractProducer producer = this.config.getProducer(); MaxwellParser p = new MaxwellParser(this.schema, producer); p.setConfig(this.config); p.run(); }
Source:
public void forbidsNonPublicCloneMethod() throws Exception { final String file = "CloneMethodMustBePublic.java"; new PMDAssert( file, Matchers.is(false), Matchers.containsString( String.format( PMDValidatorTest.BRACKETS, "CloneMethodMustBePublic" ) ) ).validate(); }

Target:
public void forbidsNonPublicCloneMethod() throws Exception { new PMDAssert( "CloneMethodMustBePublic.java", Matchers.is(false), Matchers.containsString( String.format( PMDValidatorTest.BRACKETS, "CloneMethodMustBePublic" ) ) ).validate(); }
Source:
protected Control createContent(Composite parent, FormToolkit toolkit) { Composite composite = toolkit.createComposite(parent); composite.setLayout(new GridLayout(6, false)); IBuild build = getInput(IBuild.class); viewer = new TreeViewer(toolkit.createTree(composite, SWT.MULTI)); GridDataFactory.fillDefaults().hint(300, 100).span(6, 1).grab(true, true).applyTo(viewer.getControl()); viewer.setContentProvider(new ChildrenContentProvider()); viewer.setLabelProvider(new DecoratingStyledCellLabelProvider(new ChildrenLabelProvider(), null, null)); viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { getPage().getSite().getSelectionProvider().setSelection(event.getSelection()); } }); viewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { Object item = ((IStructuredSelection) event.getSelection()).getFirstElement(); if (item instanceof IBuild) { IBuild build = (IBuild) item; IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); BuildEditorInput buildInput = new BuildEditorInput(build); try { IDE.openEditor(page, buildInput, BuildsUiConstants.ID_EDITOR_BUILDS); } catch (PartInitException e) { } } } }); menuManager = new MenuManager(); WorkbenchUtil.addDefaultGroups(menuManager); getPage().getEditorSite().registerContextMenu(ID_POPUP_MENU, menuManager, viewer, true); Menu menu = menuManager.createContextMenu(viewer.getControl()); viewer.getControl().setMenu(menu); refresh(build); toolkit.paintBordersFor(composite); return composite; }

Target:
protected Control createContent(Composite parent, FormToolkit toolkit) { Composite composite = toolkit.createComposite(parent); composite.setLayout(new GridLayout(6, false)); IBuild build = getInput(IBuild.class); viewer = new TreeViewer(toolkit.createTree(composite, SWT.MULTI)); GridDataFactory.fillDefaults().hint(300, 100).span(6, 1).grab(true, true).applyTo(viewer.getControl()); viewer.setContentProvider(new ChildrenContentProvider()); viewer.setLabelProvider(new DecoratingStyledCellLabelProvider(new ChildrenLabelProvider(), null, null)); viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { getPage().getSite().getSelectionProvider().setSelection(event.getSelection()); } }); viewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { Object item = ((IStructuredSelection) event.getSelection()).getFirstElement(); if (item instanceof IBuildElement) { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); OpenHandler.open(page, Collections.singletonList((IBuildElement) item)); } } }); refresh(build); toolkit.paintBordersFor(composite); return composite; }
Source:
public void testTokenFetch() { long millis = System.currentTimeMillis(); final String username = "someusername" + millis; final String password = "somepassword" + millis; final String repeat = password; new AMLoginInfoTask() { @Override public void onCatch(Throwable caught) { L.e(caught); fail(); } @Override public void onFinish(AMLoginInfoResult result) { if (result.getEnabled()) { L.i("Logging in with AuthManager"); isAuthManagerEnabled = true; amSubject = new AMSubject(username, password, repeat, null); amSubject.execute(); } else { L.i("Logging in with legacy login"); legacySubject = new Subject(username, password, null); legacySubject.execute(); } } }.execute(); CompatCreateAccountResult result = isAuthManagerEnabled ? amSubject.await() : legacySubject.await(); handleCreateAccountResult(result); }

Target:
public void testTokenFetch() { long millis = System.currentTimeMillis(); CompatCreateAccountResult result; final String username = "someusername" + millis; final String password = "somepassword" + millis; loginInfo.execute(); loginInfo.await(); if (isAuthManagerEnabled) { AMSubject amSubject = new AMSubject(username, password, password, null); amSubject.execute(); result = amSubject.await(); } else { Subject subject = new Subject(username, password, null); subject.execute(); result = subject.await(); } handleCreateAccountResult(result); }
Source:
private boolean isInitialImageSizeSupported() { StoragePool storagePool = DbFacade.getInstance().getStoragePoolDao().get( getParameters().getStoragePoolId()); return FeatureSupported.initialSizeSparseDiskSupported(storagePool.getCompatibilityVersion()); }

Target:
private boolean isInitialImageSizeSupported() { VDS vds = DbFacade.getInstance().getVdsDao().get(this.getCurrentIrsProxyData().getCurrentVdsId()); return FeatureSupported.initialSizeSparseDiskSupported(vds.getVdsGroupCompatibilityVersion()); }
Source:
final List<FindReplace> commentlinks() { JsArray<CommentLinkInfo> cls = commentlinks0().values(); List<FindReplace> commentLinks = new ArrayList<FindReplace>(cls.length()); for (int i = 0; i < cls.length(); i++) { CommentLinkInfo cl = cls.get(i); if (!cl.enabled()) { continue; } if (cl.link() != null) { commentLinks.add(new LinkFindReplace(cl.match(), cl.link())); } else { try { FindReplace fr = new RawFindReplace(cl.match(), cl.html()); commentLinks.add(fr); } catch (RuntimeException e) { new ErrorDialog(e.getMessage()).center(); } } } return commentLinks; }

Target:
final List<FindReplace> commentlinks() { JsArray<CommentLinkInfo> cls = commentlinks0().values(); List<FindReplace> commentLinks = new ArrayList<FindReplace>(cls.length()); for (int i = 0; i < cls.length(); i++) { CommentLinkInfo cl = cls.get(i); if (!cl.enabled()) { continue; } if (cl.link() != null) { commentLinks.add(new LinkFindReplace(cl.match(), cl.link())); } else { try { FindReplace fr = new RawFindReplace(cl.match(), cl.html()); commentLinks.add(fr); } catch (RuntimeException e) { int index = e.getMessage().indexOf("at Object"); new ErrorDialog(index == -1 ? e.getMessage() : e.getMessage().substring(0, index)).center(); } } } return commentLinks; }
Source:
public Optional<BibEntry> performSearchById(String identifier) throws FetcherException { Optional<DOI> doi = DOI.parse(identifier); String agency = ""; try { if (doi.isPresent()) { Optional<BibEntry> fetchedEntry; if (getAgency(doi.get()).isPresent() && "medra".equalsIgnoreCase(getAgency(doi.get()).get())) { fetchedEntry = new Medra().performSearchById(identifier); } else { URL doiURL = new URL(doi.get().getURIAsASCIIString()); URLDownload download = new URLDownload(doiURL); download.addHeader("Accept", MediaTypes.APPLICATION_BIBTEX); String bibtexString = download.asString(); fetchedEntry = BibtexParser.singleFromString(bibtexString, preferences, new DummyFileUpdateMonitor()); fetchedEntry.ifPresent(this::doPostCleanup); } return fetchedEntry; } else { throw new FetcherException(Localization.lang("Invalid DOI: '%0'.", identifier)); } } catch (IOException e) { throw new FetcherException(Localization.lang("Connection error"), e); } catch (ParseException e) { throw new FetcherException("Could not parse BibTeX entry", e); } catch (JSONException e) { throw new FetcherException("Could not retrieve Registration Agency", e); } }

Target:
public Optional<BibEntry> performSearchById(String identifier) throws FetcherException { Optional<DOI> doi = DOI.parse(identifier); try { if (doi.isPresent()) { Optional<BibEntry> fetchedEntry; if (doi.get().getAgency().isPresent() && "medra".equalsIgnoreCase(doi.get().getAgency().get())) { return new Medra().performSearchById(identifier); } URL doiURL = new URL(doi.get().getURIAsASCIIString()); URLDownload download = getUrlDownload(doiURL); download.addHeader("Accept", MediaTypes.APPLICATION_BIBTEX); String bibtexString = download.asString(); fetchedEntry = BibtexParser.singleFromString(bibtexString, preferences, new DummyFileUpdateMonitor()); fetchedEntry.ifPresent(this::doPostCleanup); return fetchedEntry; } else { throw new FetcherException(Localization.lang("Invalid DOI: '%0'.", identifier)); } } catch (IOException e) { throw new FetcherException(Localization.lang("Connection error"), e); } catch (ParseException e) { throw new FetcherException("Could not parse BibTeX entry", e); } catch (JSONException e) { throw new FetcherException("Could not retrieve Registration Agency", e); } }
Source:
public void getEligibleVolumes() { this.startProgress(constants.fetchingDataMessage()); AsyncQuery aQuery = new AsyncQuery(new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { GlusterVolumeGeoRepCreateModel.this.stopProgress(); VdcQueryReturnValue vdcReturnValue = (VdcQueryReturnValue) returnValue; if(!vdcReturnValue.getSucceeded()) { setQueryFailureMessage(vdcReturnValue.getExceptionString()); onPropertyChanged(new PropertyChangedEventArgs("queryFailed")); } else { List<GlusterVolumeEntity> eligibleVolumesList = (List<GlusterVolumeEntity>) vdcReturnValue.getReturnValue(); recommendationViolations = null; setVolumeList(eligibleVolumesList); getSlaveClusters().setItems(GlusterVolumeGeoRepCreateModel.this.getClusterForVolumes(eligibleVolumesList)); } } }); Frontend.getInstance().runQuery(VdcQueryType.GetGlusterGeoReplicationEligibleVolumes, new IdQueryParameters(masterVolume.getId()), aQuery); }

Target:
public void getEligibleVolumes() { this.startProgress(constants.fetchingDataMessage()); AsyncQuery aQuery = new AsyncQuery(new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { GlusterVolumeGeoRepCreateModel.this.stopProgress(); VdcQueryReturnValue vdcReturnValue = (VdcQueryReturnValue) returnValue; if(!vdcReturnValue.getSucceeded()) { setQueryFailureMessage(vdcReturnValue.getExceptionString()); } else { List<GlusterVolumeEntity> eligibleVolumesList = (List<GlusterVolumeEntity>) vdcReturnValue.getReturnValue(); setRecommendationViolations(null); setVolumeList(eligibleVolumesList); getSlaveClusters().setItems(GlusterVolumeGeoRepCreateModel.this.getClusterForVolumes(eligibleVolumesList)); } } }); Frontend.getInstance().runQuery(VdcQueryType.GetGlusterGeoReplicationEligibleVolumes, new IdQueryParameters(masterVolume.getId()), aQuery); }
Source:
private String buildPasswordString() { int len = text.get().length(); StringBuilder b = new StringBuilder(len); for (int i = 0; i < len; i++) { b.append("*"); } return b.toString(); }

Target:
private String buildPasswordString() { char[] arr = new char[text.get().length()]; Arrays.fill(arr, '*'); return String.valueOf(arr); }
Source:
private final JDBC2RecoveryConnection getConnection () throws SQLException { String number = new String("" + connectionIndex); String url = new String(dbTag + number + urlTag); String password = new String(dbTag + number + passwordTag); String user = new String(dbTag + number + userTag); String dynamicClass = new String(dbTag + number + dynamicClassTag); Properties dbProperties = new Properties(); String theUser = props.getProperty(user); String thePassword = props.getProperty(password); String theURL = props.getProperty(url); if (theUser != null) { dbProperties.put(TransactionalDriver.userName, theUser); dbProperties.put(TransactionalDriver.password, thePassword); String dc = props.getProperty(dynamicClass); if (dc != null) dbProperties.put(TransactionalDriver.dynamicClass, dc); JDBC2RecoveryConnection connection = new JDBC2RecoveryConnection(theURL, dbProperties); connections.add(connection); return connection; } else return null; }

Target:
private final JDBC2RecoveryConnection getConnection () throws SQLException { if (connections[connectionIndex] == null) { String number = new String(""+ (connectionIndex + 1)); String url = new String(dbTag + number + urlTag); String password = new String(dbTag + number + passwordTag); String user = new String(dbTag + number + userTag); String dynamicClass = new String(dbTag + number + dynamicClassTag); Properties dbProperties = new Properties(); String theUser = props.getProperty(user); String thePassword = props.getProperty(password); String theURL = props.getProperty(url); if (theUser != null) { dbProperties.put(TransactionalDriver.userName, theUser); dbProperties.put(TransactionalDriver.password, thePassword); String dc = props.getProperty(dynamicClass); if (dc != null) dbProperties.put(TransactionalDriver.dynamicClass, dc); JDBC2RecoveryConnection connection = new JDBC2RecoveryConnection(theURL, dbProperties); connections[connectionIndex] = connection; return connection; } else { jdbcLogger.i18NLogger.warn_recovery_basic_xarec("BasicXARecovery.getConnection -"); throw new SQLException(jdbcLogger.i18NLogger.insufficientConnectionInformation()); } } return connections[connectionIndex]; }
Source:
public void predicateFullTextTerm(String term, String fuzzyFlop) { ensureLeftSideIsAPropertyPath(); PropertyPath<TypeDescriptor<TypeMetadata>> property = resolveAlias(propertyPath); if (property.isEmpty()) { throw log.getPredicatesOnEntityAliasNotAllowedException(propertyPath.asStringPath()); } checkAnalyzed(property,true); Object comparisonObject = parameterValue(term); if (phase == Phase.WHERE) { checkAnalyzed(property, true); whereBuilder.addFullTextTerm(property, comparisonObject.toString(), fuzzyFlop == null ? null : (fuzzyFlop.equals("~") ? 2 : Integer.parseInt(fuzzyFlop))); } else if (phase == Phase.HAVING) { throw log.getFullTextQueriesNotAllowedInHavingClauseException(); } else { throw new IllegalStateException(); } }

Target:
public void predicateFullTextTerm(String term, String fuzzyFlop) { ensureLeftSideIsAPropertyPath(); PropertyPath<TypeDescriptor<TypeMetadata>> property = resolveAlias(propertyPath); if (property.isEmpty()) { throw log.getPredicatesOnEntityAliasNotAllowedException(propertyPath.asStringPath()); } if (phase == Phase.WHERE) { checkAnalyzed(property, true); Object comparisonObject = parameterValue(term); whereBuilder.addFullTextTerm(property, comparisonObject.toString(), fuzzyFlop == null ? null : (fuzzyFlop.equals("~") ? 2 : Integer.parseInt(fuzzyFlop))); } else if (phase == Phase.HAVING) { throw log.getFullTextQueriesNotAllowedInHavingClauseException(); } else { throw new IllegalStateException(); } }
Source:
private boolean hasStudentReceivedReminder(String courseName, String courseId, String studentEmail) throws Exception { RetryManager retryManager = new RetryManager(3); return retryManager.runUntilSuccessful(new RetryableTaskReturns<Boolean>("Received email") { String keyToSend; String keyReceivedInEmail; boolean isDoneExecuting; @Override public Boolean run() throws RuntimeException { keyToSend = BackDoor.getEncryptedKeyForStudent(courseId, studentEmail); try { keyReceivedInEmail = EmailAccount.getRegistrationKeyFromGmail(studentEmail, courseName, courseId); isDoneExecuting = true; } catch (Exception e) { isDoneExecuting = false; e.printStackTrace(); } return keyToSend.equals(keyReceivedInEmail); } @Override public boolean isSuccessful(Boolean result) { return isDoneExecuting; } }); }

Target:
private boolean hasStudentReceivedReminder(String courseName, String courseId, String studentEmail) throws Exception { String keyToSend = BackDoor.getEncryptedKeyForStudent(courseId, studentEmail); RetryManager retryManager = new RetryManager(5); String keyReceivedInEmail = retryManager.runUntilSuccessful( new RetryableTaskReturnsThrows<String, Exception>("Retrieve registration key") { @Override public String run() throws IOException, MessagingException { return EmailAccount.getRegistrationKeyFromGmail(studentEmail, courseName, courseId); } @Override public boolean isSuccessful(String result) { return result != null; } }); return keyToSend.equals(keyReceivedInEmail); }
Source:
public void testLoadOrderedPublicEvents_7() throws Throwable { UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24") .withAuthorization(Group.FREE_GROUP_NAME, "tempRole", Permission.BACKOFFICE).build(); String accessToken = mockOAuthInterceptor(user); ResultActions result = mockMvc .perform(get("/plugins/cms/contents") .param("status", IContentService.STATUS_ONLINE) .param("sort", IContentManager.CONTENT_FIRST_EDITOR_FILTER_KEY) .param("direction", FieldSearchFilter.DESC_ORDER) .param("filters[0].attribute", IContentManager.ENTITY_TYPE_CODE_FILTER_KEY) .param("filters[0].operator", "eq") .param("filters[0].value", "EVN") .sessionAttr("user", user) .header("Authorization", "Bearer " + accessToken)); String bodyResult = result.andReturn().getResponse().getContentAsString(); result.andExpect(status().isOk()); String[] expectedFreeContentsId = {}; int payloadSize = JsonPath.read(bodyResult, "$.payload.size()"); Assert.assertEquals(expectedFreeContentsId.length, payloadSize); for (int i = 0; i < expectedFreeContentsId.length; i++) { String expectedId = expectedFreeContentsId[i]; String extractedId = JsonPath.read(bodyResult, "$.payload[" + i + "].id"); Assert.assertEquals(expectedId, extractedId); } }

Target:
public void testLoadOrderedPublicEvents_7() throws Throwable { UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24") .withAuthorization(Group.FREE_GROUP_NAME, "tempRole", Permission.BACKOFFICE).build(); String accessToken = mockOAuthInterceptor(user); ResultActions result = mockMvc .perform(get("/plugins/cms/contents") .param("status", IContentService.STATUS_ONLINE) .param("sort", IContentManager.CONTENT_FIRST_EDITOR_FILTER_KEY) .param("direction", FieldSearchFilter.DESC_ORDER) .param("filters[0].attribute", IContentManager.ENTITY_TYPE_CODE_FILTER_KEY) .param("filters[0].operator", "eq") .param("filters[0].value", "EVN") .sessionAttr("user", user) .header("Authorization", "Bearer " + accessToken)); result.andDo(print()) .andExpect(status().isOk()) .andExpect(jsonPath("$.payload.size()", is(0))); }
Source:
public void visitField(PsiField field) { super.visitField(field); final PsiElement parent = field.getParent(); if (parent instanceof PsiClass) { final PsiClass clazz = (PsiClass) parent; if (clazz.hasAnnotation("lombok.Value")) { final PsiModifierList modifierList = field.getModifierList(); if (modifierList != null) { if (modifierList.hasExplicitModifier(PRIVATE)) { final Optional<PsiElement> psiPrivate = Arrays.stream(modifierList.getChildren()) .filter(psiElement -> psiElement.toString().contains("private")) .findFirst(); psiPrivate.ifPresent(psiElement -> holder.registerProblem(psiElement, "Redundant private field modifier", ProblemHighlightType.WARNING, new RemoveModifierFix(PRIVATE)) ); } if (modifierList.hasExplicitModifier(FINAL)) { final Optional<PsiElement> psiFinal = Arrays.stream(modifierList.getChildren()) .filter(psiElement -> psiElement.toString().contains("final")) .findFirst(); psiFinal.ifPresent(psiElement -> holder.registerProblem(psiElement, "Redundant final field modifier", ProblemHighlightType.WARNING, new RemoveModifierFix(PRIVATE)) ); } } } } }

Target:
public void visitField(PsiField field) { super.visitField(field); final PsiElement parent = field.getParent(); if (parent instanceof PsiClass) { final PsiClass clazz = (PsiClass) parent; if (clazz.hasAnnotation(lombok.Value.class.getName())) { final PsiModifierList modifierList = field.getModifierList(); if (modifierList != null) { if (modifierList.hasExplicitModifier(PRIVATE)) { final Optional<PsiElement> psiPrivate = Arrays.stream(modifierList.getChildren()) .filter(psiElement -> PRIVATE.equals(psiElement.getText())) .findFirst(); psiPrivate.ifPresent(psiElement -> holder.registerProblem(psiElement, "Redundant private field modifier", ProblemHighlightType.WARNING, new RemoveModifierFix(PRIVATE)) ); } if (modifierList.hasExplicitModifier(FINAL)) { final Optional<PsiElement> psiFinal = Arrays.stream(modifierList.getChildren()) .filter(psiElement -> FINAL.equals(psiElement.getText())) .findFirst(); psiFinal.ifPresent(psiElement -> holder.registerProblem(psiElement, "Redundant final field modifier", ProblemHighlightType.WARNING, new RemoveModifierFix(FINAL)) ); } } } } }
Source:
private String setButtonOrLink(JButton button, String desc, String label, String url) { boolean accessibleIDE = PreferencesData.getBoolean("ide.accessible"); String retString = desc; if (accessibleIDE) { button.setVisible(true); button.addActionListener(e -> { Base.openURL(url); }); } else { retString += " " + format("<a href=\"{0}\">{1}</a>", url, label); } return retString; }

Target:
private String setButtonOrLink(JButton button, String desc, String label, String url) { boolean accessibleIDE = PreferencesData.getBoolean("ide.accessible"); String retString = desc; if (accessibleIDE) { button.setVisible(true); button.addActionListener(e -> { Base.openURL(url); }); } else { retString += " " + format("<a href=\"{0}\">{1}</a><br/>", url, label); } return retString; }