auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onGoogleSignupFinished(String name, String email, String photoUrl, String username) { AnalyticsTracker.track(AnalyticsTracker.Stat.SIGNUP_SOCIAL_SUCCESS); mLoginAnalyticsListener.trackAnalyticsSignIn(false); if (mIsJetpackConnect) { ActivityLauncher.showSignupEpilogueForResult(this, name, email, photoUrl, username, false); } else { ActivityLauncher.showMainActivityAndSignupEpilogue(this, name, email, photoUrl, username); } setResult(Activity.RESULT_OK); finish(); }

Target:
public void onGoogleSignupFinished(String name, String email, String photoUrl, String username) { AnalyticsTracker.track(AnalyticsTracker.Stat.SIGNUP_SOCIAL_SUCCESS); if (mIsJetpackConnect) { ActivityLauncher.showSignupEpilogueForResult(this, name, email, photoUrl, username, false); } else { ActivityLauncher.showMainActivityAndSignupEpilogue(this, name, email, photoUrl, username); } setResult(Activity.RESULT_OK); finish(); }
Source:
public alluxio.grpc.JobWorkerHealth toProto() { alluxio.grpc.JobWorkerHealth.Builder builder = alluxio.grpc.JobWorkerHealth.newBuilder() .setWorkerId(mWorkerId).addAllLoadAverage(mLoadAverage).setTaskPoolSize(mTaskPoolSize) .setLastUpdated(mLastUpdated); if (mHostname != null) { builder.setHostname(mHostname); } return builder.build(); }

Target:
public alluxio.grpc.JobWorkerHealth toProto() { alluxio.grpc.JobWorkerHealth.Builder builder = alluxio.grpc.JobWorkerHealth.newBuilder() .setWorkerId(mWorkerId).addAllLoadAverage(mLoadAverage).setTaskPoolSize(mTaskPoolSize) .setNumActiveTasks(mNumActiveTasks).setLastUpdated(mLastUpdated); if (mHostname != null) { builder.setHostname(mHostname); } return builder.build(); }
Source:
public void addItem(Object key, Object value, CompletableFuture<?> future) { future.whenComplete((result, exception) -> { if (exception != null) { notifier.notifyEntityIndexingFailure(value.getClass(), key, exception); } else { notifier.notifyDocumentsAdded(1); } }).thenCombine(lastFuture, (ignored1, ignored2) -> null); }

Target:
public void addItem(Object key, Object value, CompletableFuture<?> future) { lastFuture = future.whenComplete((result, exception) -> { if (exception != null) { notifier.notifyEntityIndexingFailure(value.getClass(), key, exception); } else { notifier.notifyDocumentsAdded(1); } }).thenCombine(lastFuture, (ignored1, ignored2) -> null); }
Source:
public OwnerEnvContentAccess getContentAccess(String ownerId, String environmentId) { OwnerEnvContentAccess result = null; if (environmentId != null) { result = (OwnerEnvContentAccess) this.createSecureCriteria() .add(Restrictions.eq("owner.id", ownerId)) .add(Restrictions.eq("environment.id", environmentId)) .uniqueResult(); } else { result = (OwnerEnvContentAccess) this.createSecureCriteria() .add(Restrictions.eq("owner.id", ownerId)) .add(Restrictions.isNull("environment.id")) .uniqueResult(); } return result; }

Target:
public OwnerEnvContentAccess getContentAccess(String ownerId, String environmentId) { OwnerEnvContentAccess result = null; String hql = ""; List<OwnerEnvContentAccess> resultList = null; if (environmentId != null) { hql = "SELECT oeca" + " FROM OwnerEnvContentAccess oeca" + " JOIN oeca.owner o" + " JOIN oeca.environment e" + " WHERE" + " o.id=:ownerId" + " AND" + " e.id=:enviromentId"; Query query = this.getEntityManager().createQuery(hql); resultList = (List<OwnerEnvContentAccess>) query .setParameter("ownerId", ownerId) .setParameter("enviromentId", environmentId) .getResultList(); } else { hql = "SELECT oeca" + " FROM OwnerEnvContentAccess oeca" + " JOIN oeca.owner o" + " WHERE" + " o.id=:ownerId" + " AND" + " oeca.environment is null"; Query query = this.getEntityManager().createQuery(hql); resultList = (List<OwnerEnvContentAccess>) query .setParameter("ownerId", ownerId) .getResultList(); if (resultList.isEmpty()) { result = null; } else { result = resultList.get(0); } } if (resultList.isEmpty()) { result = null; } else { result = resultList.get(0); } return result; }
Source:
public static Throwable exceptionMapper(Throwable throwable) { if (!(throwable instanceof SearchErrorException)) { return throwable; } SearchErrorException exception = (SearchErrorException) throwable; if (EMPTY_BODY_404.equalsIgnoreCase(throwable.getMessage())) { return new ResourceNotFoundException(DOCUMENT_NOT_FOUND, exception.getResponse()); } return new HttpResponseException(exception.getMessage(), exception.getResponse()); }

Target:
public static Throwable exceptionMapper(Throwable throwable) { if (!(throwable instanceof SearchErrorException)) { return throwable; } SearchErrorException exception = (SearchErrorException) throwable; if (exception.getResponse().getStatusCode() == 404) { return new ResourceNotFoundException(DOCUMENT_NOT_FOUND, exception.getResponse()); } return new HttpResponseException(exception.getMessage(), exception.getResponse()); }
Source:
public static BeanPostProcessor messageHandlerHeaderPropagationBeanPostProcessor( final SpringIntegrationProperties springIntegrationProperties) { return new BeanPostProcessor() { @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { if (bean instanceof AbstractReplyProducingMessageHandler) { AbstractReplyProducingMessageHandler messageHandler = (AbstractReplyProducingMessageHandler) bean; messageHandler.addNotPropagatedHeaders( springIntegrationProperties.getMessageHandlerNotPropagatedHeaders()); } return bean; } @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { return bean; } }; }

Target:
public static BeanPostProcessor messageHandlerHeaderPropagationBeanPostProcessor( final SpringIntegrationProperties springIntegrationProperties) { return new BeanPostProcessor() { @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { Class<?> beanClass = AopUtils.isAopProxy(bean) ? AopUtils.getTargetClass(bean) : bean.getClass(); if (AbstractReplyProducingMessageHandler.class.isAssignableFrom(beanClass)) { AbstractReplyProducingMessageHandler messageHandler = (AbstractReplyProducingMessageHandler) bean; messageHandler.addNotPropagatedHeaders( springIntegrationProperties.getMessageHandlerNotPropagatedHeaders()); } return bean; } @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { return bean; } }; }
Source:
public String getSessionName() { return server.getSessionByID(getSessionID()).getName(); }

Target:
public String getSessionName() { return this.session.getName(); }
Source:
protected ClientRequest buildRefreshAccessTokenClientRequest() { ClientRequest.Builder builder = new ClientRequest.Builder(); builder.accept(MediaType.APPLICATION_XML); builder.header(ConcurConstants.AUTHORIZATION_PROPERTY,ConcurConstants.OAUTH_AUTHENTICATION_SCHEME + getConcurAccessToken()); URI uri; try { uri = new URI(getConcurRefreshAccessTokenURL() + ConcurConstants.REFRESH_TOKEN_URL_PARAM + getConcurRefreshToken() + ConcurConstants.CLIENT_ID_URL_PARAM + getConcurConsumerKey() + ConcurConstants.CLIENT_SECRET_URL_PARAM + getConcurSecretKey()); } catch (URISyntaxException e) { throw new RuntimeException(e); } ClientRequest request = builder.build(uri, HttpMethod.GET); return request; }

Target:
protected ClientRequest buildRefreshAccessTokenClientRequest() { ClientRequest.Builder builder = new ClientRequest.Builder(); builder.accept(MediaType.APPLICATION_XML); builder.header(ConcurConstants.AUTHORIZATION_PROPERTY,ConcurConstants.OAUTH_AUTHENTICATION_SCHEME + KFSConstants.BLANK_SPACE + getAccessToken()); URI uri; try { uri = new URI(getConcurRefreshAccessTokenURL() + ConcurConstants.REFRESH_TOKEN_URL_PARAM + CUKFSConstants.EQUALS_SIGN + getRefreshToken() + CUKFSConstants.AMPERSAND + ConcurConstants.CLIENT_ID_URL_PARAM + CUKFSConstants.EQUALS_SIGN + getConsumerKey() + CUKFSConstants.AMPERSAND + ConcurConstants.CLIENT_SECRET_URL_PARAM + CUKFSConstants.EQUALS_SIGN + getSecretKey()); } catch (URISyntaxException e) { throw new RuntimeException("An error occured while building the refresh access token URI: ", e); } return builder.build(uri, HttpMethod.GET); }
Source:
public void immutableTimestampIsGreaterThanFreshTimestampWhenNotLocked() { String randomNamespace = randomNamespace(); long freshTs = cluster.client(randomNamespace).getFreshTimestamp(); long immutableTs = cluster.client(randomNamespace).timelockService().getImmutableTimestamp(); assertThat(immutableTs).isGreaterThan(freshTs); }

Target:
public void immutableTimestampIsGreaterThanFreshTimestampWhenNotLocked() { long freshTs = namespace.getFreshTimestamp(); long immutableTs = namespace.timelockService().getImmutableTimestamp(); assertThat(immutableTs).isGreaterThan(freshTs); }
Source:
private BoolQueryBuilder createUserTaskQuery(User user) throws DataException { BoolQueryBuilder subquery = new BoolQueryBuilder(); subquery.should(createSimpleQuery("processingUser", user.getId(), true)); subquery.should(createSimpleQuery("users.id", user.getId(), true)); for (UserGroup userGroup : user.getUserGroups()) { subquery.should(createSimpleQuery("userGroups.id", userGroup.getId(), true)); } BoolQueryBuilder query = new BoolQueryBuilder(); query.must(subquery); query.must(createSimpleQuery("processingStatus", TaskStatus.LOCKED.getValue(), false)); query.must(createSimpleQuery("processingStatus", TaskStatus.DONE.getValue(), false)); List<JSONObject> templateProcesses = serviceManager.getTemplateService().findByTemplate(true, null); if (templateProcesses.size() > 0) { Set<Integer> templates = new HashSet<>(); for (JSONObject jsonObject : templateProcesses) { templates.add(getIdFromJSONObject(jsonObject)); } query.mustNot(createSetQuery("processForTask.id", templates, true)); } AktuelleSchritteForm form = (AktuelleSchritteForm) Helper.getManagedBeanValue("#{AktuelleSchritteForm}"); if (Objects.equals(form, null)) { form = new AktuelleSchritteForm(); } if (form.getHideCorrectionTasks()) { query.must(createSimpleQuery("priority", 10, true)); } if (!form.getShowAutomaticTasks()) { query.must(createSimpleQuery("typeAutomatic", "false", true)); } return query; }

Target:
private BoolQueryBuilder createUserTaskQuery(User user) throws DataException { BoolQueryBuilder subquery = new BoolQueryBuilder(); subquery.should(createSimpleQuery("processingUser", user.getId(), true)); subquery.should(createSimpleQuery("users.id", user.getId(), true)); for (UserGroup userGroup : user.getUserGroups()) { subquery.should(createSimpleQuery("userGroups.id", userGroup.getId(), true)); } BoolQueryBuilder query = new BoolQueryBuilder(); query.must(subquery); query.must(createSimpleQuery("processingStatus", TaskStatus.LOCKED.getValue(), false)); query.must(createSimpleQuery("processingStatus", TaskStatus.DONE.getValue(), false)); query.must(createOnlyTasksInProcessQuery()); AktuelleSchritteForm form = (AktuelleSchritteForm) Helper.getManagedBeanValue("#{AktuelleSchritteForm}"); if (Objects.equals(form, null)) { form = new AktuelleSchritteForm(); } if (form.getHideCorrectionTasks()) { query.must(createSimpleQuery("priority", 10, true)); } if (!form.getShowAutomaticTasks()) { query.must(createSimpleQuery("typeAutomatic", "false", true)); } return query; }
Source:
public ICrop getCropAt(World world, BlockPos pos, BlockState blockState) { Block block = blockState.getBlock(); if (!block.getTags().contains(BlockTags.LOGS.getId())) { return null; } return new CropDestroy(world, blockState, pos, null); }

Target:
public ICrop getCropAt(World world, BlockPos pos, BlockState blockState) { Block block = blockState.getBlock(); if (!block.isIn(BlockTags.LOGS)) { return null; } return new CropDestroy(world, blockState, pos, null); }
Source:
public static List<URL> getURLsForClasspath(String cp) { try { String[] paths = cp.split(File.pathSeparator); List<URL> urls = new ArrayList<>(); for (int i = 0; i < paths.length; i++) { File f = new File(paths[i]); if ("*".equals(f.getName())) { File parentDir = f.getParentFile(); if (parentDir.exists() && parentDir.isDirectory()) { File[] jars = parentDir.listFiles( new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name != null && (name.endsWith(".jar") || name.endsWith(".JAR")); } } ); for (File jar : jars) { urls.add(jar.toURI().toURL()); } } } else { urls.add(new File(paths[i]).toURI().toURL()); } } return urls; } catch (IOException ex) { throw Throwables.propagate(ex); } }

Target:
public static List<URL> getURLsForClasspath(String cp) { try { String[] paths = cp.split(File.pathSeparator); List<URL> urls = new ArrayList<>(); for (int i = 0; i < paths.length; i++) { File f = new File(paths[i]); if ("*".equals(f.getName())) { File parentDir = f.getParentFile(); if (parentDir.isDirectory()) { File[] jars = parentDir.listFiles( new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name != null && (name.endsWith(".jar") || name.endsWith(".JAR")); } } ); for (File jar : jars) { urls.add(jar.toURI().toURL()); } } } else { urls.add(new File(paths[i]).toURI().toURL()); } } return urls; } catch (IOException ex) { throw Throwables.propagate(ex); } }
Source:
public void testAuditInvoker() throws Exception { IPluginManager pluginManager = Mockito.mock( IPluginManager.class ); PowerMockito.mockStatic( PentahoSystem.class ); BDDMockito.given( PentahoSystem.get( IPluginManager.class ) ).willReturn( pluginManager ); final IActionInvoker actionInvoker = Mockito.spy( MyDefaultActionInvoker.class ); final WorkerNodeActionInvokerAuditor wnActionInvokerAuditer = new WorkerNodeActionInvokerAuditor( actionInvoker ); WorkerNodeActionInvokerAuditor wnaiu = Mockito.spy( wnActionInvokerAuditer ); wnaiu.invokeAction( actionMock, actionUser, actionMapMock ); Mockito.verify( actionInvoker, Mockito.times( 1 ) ).invokeAction( Mockito.eq( actionMock ), Mockito.eq( actionUser ), Mockito.eq( actionMapMock ) ); Mockito.verify( wnaiu, Mockito.times( 2 ) ).makeAuditRecord( Mockito.anyLong() ,Mockito.anyString(), Mockito.anyMap() , Mockito.anyString() ); }}

Target:
public void testAuditInvoker() throws Exception { IPluginManager pluginManager = Mockito.mock( IPluginManager.class ); PowerMockito.mockStatic( PentahoSystem.class ); BDDMockito.given( PentahoSystem.get( IPluginManager.class ) ).willReturn( pluginManager ); final IActionInvoker actionInvoker = Mockito.spy( MyDefaultActionInvoker.class ); final WorkerNodeActionInvokerAuditor wnActionInvokerAuditer = new WorkerNodeActionInvokerAuditor( actionInvoker ); WorkerNodeActionInvokerAuditor wnaiu = Mockito.spy( wnActionInvokerAuditer ); wnaiu.invokeAction( actionMock, actionUser, actionMapMock ); Mockito.verify( actionInvoker, Mockito.times( 1 ) ).invokeAction( Mockito.eq( actionMock ), Mockito.eq( actionUser ), Mockito.eq( actionMapMock ) ); Mockito.verify( wnaiu, Mockito.times( 2 ) ).makeAuditRecord( Mockito.anyLong(), Mockito.anyString(), Mockito.anyMap(), Mockito.anyString() ); }
Source:
public static String timeConvertRound(final int minuteOfDay) { final int minutes = (minuteOfDay + DAY_MINUTES) % 60; final int minutesRound; final int hourAdd; if (minutes < 15) { minutesRound = 0; hourAdd = 0; } else if (minutes < 45) { minutesRound = 30; hourAdd = 0; } else { minutesRound = 0; hourAdd = 1; } final int hours = ((minuteOfDay + DAY_MINUTES) % DAY_MINUTES) / 60; final int hoursRound = hours + hourAdd; final String timeString = DateTimeFormat.forPattern("h:mm aa").print(new DateTime(0).withHourOfDay(hoursRound).withMinuteOfHour(minutesRound)); return timeString; }

Target:
public static String timeConvertRound(final int minuteOfDay) { final int minutes = (minuteOfDay + DateTimeConstants.MINUTES_PER_DAY) % 60; final int minutesRound; final int hourAdd; if (minutes < 15) { minutesRound = 0; hourAdd = 0; } else if (minutes < 45) { minutesRound = 30; hourAdd = 0; } else { minutesRound = 0; hourAdd = 1; } final int hours = ((minuteOfDay + DateTimeConstants.MINUTES_PER_DAY) % DateTimeConstants.MINUTES_PER_DAY) / 60; final int hoursRound = hours + hourAdd; final String timeString = DateTimeFormat.forPattern("h:mm aa").print(new DateTime(0).withHourOfDay(hoursRound).withMinuteOfHour(minutesRound)); return timeString; }
Source:
protected void entityIsTransient(MergeEvent event, Map copyCache) { LOG.trace( "Merging transient instance" ); final Object entity = event.getEntity(); if ( entity instanceof PersistentAttributeInterceptable ) { } final EventSource session = event.getSession(); final String entityName = event.getEntityName(); final EntityPersister persister = session.getEntityPersister( entityName, entity ); final Serializable id = persister.hasIdentifierProperty() ? persister.getIdentifier( entity, session ) : null; final Object copy; final Object existingCopy = copyCache.get( entity ); if ( existingCopy != null ) { persister.setIdentifier( copyCache.get( entity ), id, session ); copy = existingCopy; } else { copy = session.instantiate( persister, id ); ( (MergeContext) copyCache ).put( entity, copy, true ); } super.cascadeBeforeSave( session, persister, entity, copyCache ); copyValues( persister, entity, copy, session, copyCache, ForeignKeyDirection.FROM_PARENT ); saveTransientEntity( copy, entityName, event.getRequestedId(), session, copyCache ); super.cascadeAfterSave( session, persister, entity, copyCache ); copyValues( persister, entity, copy, session, copyCache, ForeignKeyDirection.TO_PARENT ); event.setResult( copy ); if ( copy instanceof PersistentAttributeInterceptable ) { final PersistentAttributeInterceptable interceptable = (PersistentAttributeInterceptable) copy; final PersistentAttributeInterceptor interceptor = interceptable.$$_hibernate_getInterceptor(); if ( interceptor == null ) { persister.getInstrumentationMetadata().injectInterceptor( copy, id, session ); } } }

Target:
protected void entityIsTransient(MergeEvent event, Map copyCache) { LOG.trace( "Merging transient instance" ); final Object entity = event.getEntity(); final EventSource session = event.getSession(); final String entityName = event.getEntityName(); final EntityPersister persister = session.getEntityPersister( entityName, entity ); final Serializable id = persister.hasIdentifierProperty() ? persister.getIdentifier( entity, session ) : null; final Object copy; final Object existingCopy = copyCache.get( entity ); if ( existingCopy != null ) { persister.setIdentifier( copyCache.get( entity ), id, session ); copy = existingCopy; } else { copy = session.instantiate( persister, id ); ( (MergeContext) copyCache ).put( entity, copy, true ); } super.cascadeBeforeSave( session, persister, entity, copyCache ); copyValues( persister, entity, copy, session, copyCache, ForeignKeyDirection.FROM_PARENT ); saveTransientEntity( copy, entityName, event.getRequestedId(), session, copyCache ); super.cascadeAfterSave( session, persister, entity, copyCache ); copyValues( persister, entity, copy, session, copyCache, ForeignKeyDirection.TO_PARENT ); event.setResult( copy ); if ( copy instanceof PersistentAttributeInterceptable ) { final PersistentAttributeInterceptable interceptable = (PersistentAttributeInterceptable) copy; final PersistentAttributeInterceptor interceptor = interceptable.$$_hibernate_getInterceptor(); if ( interceptor == null ) { persister.getBytecodeEnhancementMetadata().injectInterceptor( copy, id, session ); } } }
Source:
public final <T> Callable<T> wrap(final Callable<T> callable) { final Thread caller = Thread.currentThread(); final Callable<T> wrapped = wrapImpl(context(local.getContext(), cleanup(callable))); return new Callable<T>() { @Override public T call() throws Exception { if (caller == Thread.currentThread()) { return callable.call(); } else { return wrapped.call(); } } @Override public String toString() { return callable.toString(); } }; }

Target:
public final <T> Callable<T> wrap(final Callable<T> callable) { final RequestContext callerContext = checkNotNull(local.getContext()); final Callable<T> wrapped = wrapImpl(context(callerContext, cleanup(callable))); return new Callable<T>() { @Override public T call() throws Exception { if (callerContext == local.getContext()) { return callable.call(); } else { return wrapped.call(); } } @Override public String toString() { return callable.toString(); } }; }
Source:
public ICryptoAddressValidator createAddressValidator(String cryptoCurrency) { if (CryptoCurrency.SMART.getCode().equalsIgnoreCase(cryptoCurrency)) { return new AquanowAddressValidator(); } return null; }

Target:
public ICryptoAddressValidator createAddressValidator(String cryptoCurrency) { if (CryptoCurrency.BTC.getCode().equalsIgnoreCase(cryptoCurrency)) { return new AquanowAddressValidator(); } return null; }
Source:
public void handleMessage(Message message) throws Fault { if (shouldHandleMessage(message)) { final TraceeFilterConfiguration filterConfiguration = backend.getConfiguration(profile); if (!backend.isEmpty() && filterConfiguration.shouldProcessContext(channel)) { final Map<String, String> filteredParams = filterConfiguration.filterDeniedParams(backend.copyToMap(), channel); LOGGER.debug("Interceptor handles message!"); if (message instanceof SoapMessage) { final SoapMessage soapMessage = (SoapMessage) message; addSoapHeader(filteredParams, soapMessage); } else { Map<String, List<String>> responseHeaders = CastUtils.cast((Map<?, ?>) message.get(Message.PROTOCOL_HEADERS)); if (responseHeaders == null) { responseHeaders = new HashMap<String, List<String>>(); message.put(Message.PROTOCOL_HEADERS, responseHeaders); } final String contextAsHeader = httpSerializer.render(filteredParams); responseHeaders.put(TraceeConstants.HTTP_HEADER_NAME, Arrays.asList(contextAsHeader)); } } if (channel == TraceeFilterConfiguration.Channel.OutgoingResponse) { backend.clear(); } } }

Target:
public void handleMessage(Message message) throws Fault { if (shouldHandleMessage(message)) { final TraceeFilterConfiguration filterConfiguration = backend.getConfiguration(profile); if (!backend.isEmpty() && filterConfiguration.shouldProcessContext(channel)) { final Map<String, String> filteredParams = filterConfiguration.filterDeniedParams(backend.copyToMap(), channel); logger.debug("Interceptor handles message!"); if (message instanceof SoapMessage) { final SoapMessage soapMessage = (SoapMessage) message; addSoapHeader(filteredParams, soapMessage); } else { Map<String, List<String>> responseHeaders = CastUtils.cast((Map<?, ?>) message.get(Message.PROTOCOL_HEADERS)); if (responseHeaders == null) { responseHeaders = new HashMap<String, List<String>>(); message.put(Message.PROTOCOL_HEADERS, responseHeaders); } final String contextAsHeader = httpSerializer.render(filteredParams); responseHeaders.put(TraceeConstants.HTTP_HEADER_NAME, Arrays.asList(contextAsHeader)); } } } }
Source:
public void releasePersistenceSpaceIdentifier(PersistenceSpaceIdentifier<?> identifier) throws CachePersistenceException { ClusteredCacheIdentifier clusterCacheIdentifier = (ClusteredCacheIdentifier) identifier; if (!knownPersistenceSpaces.containsKey(clusterCacheIdentifier)) { throw new CachePersistenceException("Unknown identifier: " + identifier); } knownPersistenceSpaces.remove(clusterCacheIdentifier); }

Target:
public void releasePersistenceSpaceIdentifier(PersistenceSpaceIdentifier<?> identifier) throws CachePersistenceException { ClusteredCacheIdentifier clusterCacheIdentifier = (ClusteredCacheIdentifier) identifier; if (knownPersistenceSpaces.remove(clusterCacheIdentifier.getId()) == null) { throw new CachePersistenceException("Unknown identifier: " + clusterCacheIdentifier); } }
Source:
protected byte[] safelyLoadFileBytes(String fileName) { InputStream fileContents; byte[] fileByteContent; try { fileContents = new FileInputStream(fileName); } catch (FileNotFoundException e1) { LOG.error("Batch file not found [" + fileName + "]. " + e1.getMessage()); throw new RuntimeException("Batch File not found [" + fileName + "]. " + e1.getMessage()); } try { fileByteContent = IOUtils.toByteArray(fileContents); } catch (IOException e1) { LOG.error("IO Exception loading: [" + fileName + "]. " + e1.getMessage()); throw new RuntimeException("IO Exception loading: [" + fileName + "]. " + e1.getMessage()); } finally { IOUtils.closeQuietly(fileContents); } return fileByteContent; }

Target:
protected byte[] safelyLoadFileBytes(String fileName) { InputStream fileContents; byte[] fileByteContent; try { fileContents = new FileInputStream(fileName); } catch (FileNotFoundException e1) { LOG.error("safelyLoadFileBytes: Batch file not found [" + fileName + "]. " + e1.getMessage()); throw new RuntimeException("Batch File not found [" + fileName + "]. " + e1.getMessage()); } try { fileByteContent = IOUtils.toByteArray(fileContents); } catch (IOException e1) { LOG.error("safelyLoadFileBytes: IO Exception loading: [" + fileName + "]. " + e1.getMessage()); throw new RuntimeException("IO Exception loading: [" + fileName + "]. " + e1.getMessage()); } finally { IOUtils.closeQuietly(fileContents); } return fileByteContent; }
Source:
protected File decodeBase64StringToFile( String base64String, String filePath ) { byte[] decodedBytes = Base64.getDecoder().decode( base64String ); File file = new File( filePath ); try ( FileOutputStream fos = new FileOutputStream( file ) ) { fos.write( decodedBytes ); } catch ( Exception e ) { getLog().logError( " Exception writing decoded BASE64 string to file " + e.toString() ); } return file; }

Target:
protected File decodeBase64StringToFile( String base64String, String filePath ) throws IOException { byte[] decodedBytes = Base64.getDecoder().decode( base64String ); File file = new File( filePath ); try ( FileOutputStream fos = new FileOutputStream( file ) ) { fos.write( decodedBytes ); } catch ( IOException e ) { throw e; } return file; }
Source:
public int hashCode() { return notificationsInfo.hashCode(); }

Target:
public int hashCode() { return HashUtil.combineHashCodes(Objects.hashCode(notificationsInfo)); }
Source:
protected String createPassFile(String value) throws IOException { File temp = File.createTempFile("ovirt", ".tmp"); String filePath = temp.getAbsolutePath(); temp.setReadable(true, true); temp.setWritable(true, true); temp.setExecutable(false); BufferedWriter out = new BufferedWriter(new FileWriter(temp)); out.write(value); out.close(); return filePath; }

Target:
protected String createPassFile(String value) throws IOException { File temp = File.createTempFile("ovirt", ".tmp"); String filePath = temp.getAbsolutePath(); temp.setReadable(true, true); temp.setWritable(true, true); BufferedWriter out = new BufferedWriter(new FileWriter(temp)); out.write(value); out.close(); return filePath; }
Source:
private InstructorAttributes extractCompleteInstructor(String courseId) { InstructorCreateRequest instructorRequest = getAndValidateRequestBody(InstructorCreateRequest.class); String instructorName = instructorRequest.getName(); String instructorEmail = instructorRequest.getEmail(); String instructorRole = instructorRequest.getRoleName(); boolean isDisplayedToStudents = instructorRequest.getIsDisplayedToStudent(); String displayedName = instructorRequest.getDisplayName(); if (displayedName == null || displayedName.isEmpty()) { displayedName = InstructorAttributes.DEFAULT_DISPLAY_NAME; } instructorRole = SanitizationHelper.sanitizeName(instructorRole); displayedName = SanitizationHelper.sanitizeName(displayedName); InstructorAttributes instructorToAdd = createInstructorWithBasicAttributes(courseId, instructorName, instructorEmail, instructorRole, isDisplayedToStudents, displayedName); if (instructorRole.equals(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_CUSTOM)) { updateInstructorCourseLevelPrivileges(instructorToAdd); } updateInstructorWithSectionLevelPrivileges(courseId, instructorToAdd); instructorToAdd.privileges.validatePrivileges(); return instructorToAdd; }

Target:
private InstructorAttributes extractCompleteInstructor(String courseId) { InstructorCreateRequest instructorRequest = getAndValidateRequestBody(InstructorCreateRequest.class); InstructorAttributes instructorToAdd = createInstructorWithBasicAttributes(courseId, instructorRequest.getName(), instructorRequest.getEmail(), instructorRequest.getRoleName(), instructorRequest.getIsDisplayedToStudent(), instructorRequest.getDisplayName()); if (instructorToAdd.getRole().equals(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_CUSTOM)) { updateInstructorCourseLevelPrivileges(instructorToAdd); } updateInstructorWithSectionLevelPrivileges(courseId, instructorToAdd); instructorToAdd.privileges.validatePrivileges(); return instructorToAdd; }
Source:
public void renderFileReport(Report report) throws IOException { for (RuleViolation ruleViolation : report) { StringBuilder fullDescription = new StringBuilder(ruleViolation.getDescription()); String reason = ruleViolation.getRule().getDescription(); if (!StringUtils.isEmpty(reason)) { fullDescription.append("\n").append(reason); } String url = ruleViolation.getRule().getExternalInfoUrl(); if (!StringUtils.isEmpty(url)) { fullDescription.append("\n").append(url); } reviewResult.add(new Violation(ruleViolation.getFilename(), ruleViolation.getBeginLine(), fullDescription.toString(), convert(ruleViolation.getRule().getPriority()))); } }

Target:
public void renderFileReport(Report report) throws IOException { boolean addDetails = Boolean.valueOf(ConfigurationHolder.instance(). getProperty(GeneralOption.VOLATIONS_WITH_DETAILS)); for (RuleViolation ruleViolation : report) { StringBuilder fullDescription = new StringBuilder(ruleViolation.getDescription()); if (addDetails) { fullDescription.append(extractDetailsFromViolation(ruleViolation)); } reviewResult.add(new Violation(ruleViolation.getFilename(), ruleViolation.getBeginLine(), fullDescription.toString(), convert(ruleViolation.getRule().getPriority()))); } }
Source:
public void createCounter( @Suspended final AsyncResponse asyncResponse, @ApiParam(required = true) MetricDefinition metricDefinition, @Context UriInfo uriInfo ) { if(metricDefinition.getType() != null && metricDefinition.getType() != MetricType.COUNTER) { asyncResponse.resume(badRequest(new ApiError("MetricDefinition type does not match " + MetricType .COUNTER.getText()))); } Metric<Long> metric = new Metric<>(new MetricId<>(tenantId, COUNTER, metricDefinition.getId()), metricDefinition.getTags(), metricDefinition.getDataRetention()); URI location = uriInfo.getBaseUriBuilder().path("/counters/{id}").build(metric.getId().getName()); metricsService.createMetric(metric).subscribe(new MetricCreatedObserver(asyncResponse, location)); }

Target:
public void createCounter( @Suspended final AsyncResponse asyncResponse, @ApiParam(required = true) MetricDefinition metricDefinition, @Context UriInfo uriInfo ) { if(metricDefinition.getType() != null && MetricType.COUNTER != metricDefinition.getType()) { asyncResponse.resume(badRequest(new ApiError("MetricDefinition type does not match " + MetricType .COUNTER.getText()))); } Metric<Long> metric = new Metric<>(new MetricId<>(tenantId, COUNTER, metricDefinition.getId()), metricDefinition.getTags(), metricDefinition.getDataRetention()); URI location = uriInfo.getBaseUriBuilder().path("/counters/{id}").build(metric.getId().getName()); metricsService.createMetric(metric).subscribe(new MetricCreatedObserver(asyncResponse, location)); }
Source:
public Color getHeaderForeground () { checkWidget (); return headerForeground != null ? headerForeground : defaultForeground(); }

Target:
public Color getHeaderForeground () { checkWidget (); return headerForeground != null ? headerForeground : display.getSystemColor(SWT.COLOR_LIST_FOREGROUND); }
Source:
static public Collection<URI[]> getLocations() throws URISyntaxException { URI[] params = new URI[] { new URI("<LINK_1>"), new URI("<LINK_10>"), new URI("<LINK_2>"), new URI("<LINK_7>"), new URI("<LINK_3>"), new URI("<LINK_12>"), new URI("<LINK_0>"), new URI("<LINK_8>"), new URI("<LINK_13>"), new URI("<LINK_4>"), new URI("<LINK_5>"), new URI("<LINK_11>"), new URI("<LINK_3>integration-stack"), new URI("<LINK_6>"), }; List<URI[]> result = new ArrayList<URI[]>(); for (URI uri : params) { result.add(new URI[] { uri} ); } return result; }

Target:
static public Collection<String[]> getLocations() throws URISyntaxException, IOException { String[] params = getRootLocations(); Collection<String[]> result = new ArrayList<String[]>(); for (String uri : params) { result.add(new String[] { uri }); } return result; }
Source:
public int hashCode() { int bits = 1; bits = 31 * bits + this.type.ordinal(); bits = 31 * bits + getToX(); bits = 31 * bits + getToY(); bits = 31 * bits + getToZ(); bits = 31 * bits + getFromX(); bits = 31 * bits + getFromY(); bits = 31 * bits + getFromZ(); return bits; }

Target:
public int hashCode() { int bits = 1; bits = 31 * bits + this.type.ordinal(); bits = 31 * bits + getToX(); bits = 31 * bits + getToY(); bits = 31 * bits + getToZ(); bits = 31 * bits + getFromX(); bits = 31 * bits + getFromY(); bits = 31 * bits + getFromZ(); return bits ^ (bits >> 31); }
Source:
protected VmNic createNewInterface() { VmNic iface = new VmNic(); iface.setId(Guid.newGuid()); final long from = MacAddressRangeUtils.macToLong("00:1A:4A:01:00:00"); final int MAX_MACS_IN_POOL = 100000; final int rndInt = RandomUtils.instance().nextInt(MAX_MACS_IN_POOL); long macLong = from + rndInt; iface.setMacAddress(MacAddressRangeUtils.macToString(macLong)); return iface; }

Target:
protected VmNic createNewInterface() { VmNic iface = new VmNic(); iface.setId(Guid.newGuid()); iface.setMacAddress(RandomUtils.instance().nextString(10)); return iface; }
Source:
public void setStashServerBaseUrl(String stashServerBaseUrl) { this.stashServerBaseUrl = stashServerBaseUrl != null && stashServerBaseUrl.endsWith("/") ? stashServerBaseUrl.substring(0, stashServerBaseUrl.length() - 1) : stashServerBaseUrl; }

Target:
public void setStashServerBaseUrl(String stashServerBaseUrl) { this.stashServerBaseUrl = StringUtils.stripEnd(stashServerBaseUrl, "/"); }
Source:
public void onObjectExplorerEvent(ObjectExplorerEvent event) { Debug.logToRConsole("Responding to object explorer event"); switch (event.getType()) { case NEW: onNew(event.getData()); break; case OPEN_NODE: onOpenNode(event.getData()); break; case CLOSE_NODE: onCloseNode(event.getData()); break; case UNKNOWN: break; } }

Target:
public void onObjectExplorerEvent(ObjectExplorerEvent event) { switch (event.getType()) { case NEW: onNew(event.getData()); break; case OPEN_NODE: onOpenNode(event.getData()); break; case CLOSE_NODE: onCloseNode(event.getData()); break; case UNKNOWN: break; } }
Source:
long grabLocksAndRun(SweepLocks locks) throws InterruptedException { boolean sweptSuccessfully = false; try { if (isSweepEnabled.get()) { locks.lockOrRefresh(); if (locks.haveLocks()) { sweptSuccessfully = runOnce(); } else { sweepMetrics.unableToAcquirePersistedLock(); log.debug("Skipping sweep because sweep is running elsewhere."); } } else { log.debug("Skipping sweep because it is currently disabled."); } } catch (InsufficientConsistencyException e) { log.warn("Could not sweep because not all nodes of the database are online.", e); } catch (RuntimeException e) { sweepMetrics.sweepError(); if (checkAndRepairTableDrop()) { log.error("The table being swept by the background sweeper was dropped, moving on..."); } else { SweepBatchConfig lastBatchConfig = getAdjustedBatchConfig(); log.error("The background sweep job failed unexpectedly with batch config {}" + ". Attempting to continue with a lower batch size...", lastBatchConfig, e); batchSizeMultiplier = Math.max(batchSizeMultiplier / 2, 1.5 / lastBatchConfig.candidateBatchSize()); } } if (sweptSuccessfully) { batchSizeMultiplier = Math.min(1.0, batchSizeMultiplier * 1.01); return sweepPauseMillis.get(); } else { return 20 * (1000 + sweepPauseMillis.get()); } }

Target:
long grabLocksAndRun(SweepLocks locks) throws InterruptedException { boolean sweptSuccessfully = false; try { if (isSweepEnabled.get()) { locks.lockOrRefresh(); if (locks.haveLocks()) { sweptSuccessfully = runOnce(); } else { log.debug("Skipping sweep because sweep is running elsewhere."); } } else { log.debug("Skipping sweep because it is currently disabled."); } } catch (InsufficientConsistencyException e) { log.warn("Could not sweep because not all nodes of the database are online.", e); } catch (RuntimeException e) { sweepMetrics.sweepError(); if (checkAndRepairTableDrop()) { log.error("The table being swept by the background sweeper was dropped, moving on..."); } else { SweepBatchConfig lastBatchConfig = getAdjustedBatchConfig(); log.error("The background sweep job failed unexpectedly with batch config {}" + ". Attempting to continue with a lower batch size...", lastBatchConfig, e); batchSizeMultiplier = Math.max(batchSizeMultiplier / 2, 1.5 / lastBatchConfig.candidateBatchSize()); } } if (sweptSuccessfully) { batchSizeMultiplier = Math.min(1.0, batchSizeMultiplier * 1.01); return sweepPauseMillis.get(); } else { return 20 * (1000 + sweepPauseMillis.get()); } }
Source:
protected void executeVmCommand() { if (getVm().getStatus().isUpOrPaused()) { performPlugCommand(getPlugAction(), disk, oldVmDevice); } final VmDevice device = getVmDeviceDao().get(oldVmDevice.getId()); device.setIsPlugged(!oldVmDevice.getIsPlugged()); final List<VmDevice> devices = VmDeviceUtils.updateBootOrderInVmDevice(getVm().getStaticData()); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getVmStaticDAO().incrementDbGeneration(getVm().getId()); getVmDeviceDao().updateAll("UpdateVmDeviceForHotPlugDisk", Arrays.asList(device)); getVmDeviceDao().updateAll("UpdateVmDeviceBootOrder", devices); return null; } }); setSucceeded(true); }

Target:
protected void executeVmCommand() { if (getVm().getStatus().isUpOrPaused()) { performPlugCommand(getPlugAction(), getDisk(), oldVmDevice); } final VmDevice device = getVmDeviceDao().get(oldVmDevice.getId()); device.setIsPlugged(!oldVmDevice.getIsPlugged()); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getVmStaticDAO().incrementDbGeneration(getVm().getId()); getVmDeviceDao().updateHotPlugDisk(device); VmDeviceUtils.updateBootOrderInVmDeviceAndStoreToDB(getVm().getStaticData()); return null; } }); setSucceeded(true); }
Source:
public static String getLinkWithFallback(FeedItem item) { String link = null; if (item != null) { link = item.getLink(); if (link == null) { Feed feed = item.getFeed(); if (feed != null) { link = feed.getLink(); } } } return link; }

Target:
public static String getLinkWithFallback(FeedItem item) { if (item == null) { return null; } else if (item.getLink() != null) { return item.getLink(); } else if (item.getFeed() != null) { return item.getFeed().getLink(); } return null; }
Source:
public Optional<Group> getGroup(String name) { GroupsRecord r = dslContext.fetchOne(GROUPS, GROUPS.NAME.eq(name)); if (r != null) { return Optional.of(r.map(new GroupMapper())); } return Optional.empty(); }

Target:
public Optional<Group> getGroup(String name) { GroupsRecord r = dslContext.fetchOne(GROUPS, GROUPS.NAME.eq(name)); return Optional.ofNullable(r).map((rec) -> rec.map(new GroupMapper())); }
Source:
public void setBaseballCard(BaseballCard card) { Locale locale = Locale.getDefault(); brand.setText(card.brand); year.setText(String.format(locale, "%d", card.year)); number.setText(String.format(locale, "%s", card.number)); player.setText(card.playerName); }

Target:
public void setBaseballCard(BaseballCard card) { Locale locale = Locale.getDefault(); brand.setText(card.brand); year.setText(String.format(locale, "%d", card.year)); number.setText(card.number); player.setText(card.playerName); }
Source:
public SetContentTypeFilter() { try { mimetypeToExtensionMap = new Properties(); mimetypeToExtensionMap.load(new InputStreamReader(this.getClass().getResourceAsStream( "mimetypeToExtension.txt"))); contentTypeProperties = new Properties(); contentTypeProperties.load(new InputStreamReader(this.getClass().getResourceAsStream( "toContentType.properties"))); } catch (IOException e) { log.error("Failed to load mimetype mappings", e); } }

Target:
public SetContentTypeFilter() throws IOException { mimetypeToExtensionMap = new Properties(); mimetypeToExtensionMap.load(new InputStreamReader(this.getClass().getResourceAsStream( "mimetypeToExtension.txt"))); contentTypeProperties = new Properties(); contentTypeProperties.load(new InputStreamReader(this.getClass().getResourceAsStream( "toContentType.properties"))); }
Source:
private static Object[] mapArrayValues(ArrayType arrayType, Object[] values) { Type elementType = arrayType.getElementType(); if (elementType instanceof ArrayType) { return Arrays.stream(values) .map(v -> v == null ? null : newArrayList((Object[]) v)) .toArray(); } if (elementType instanceof RowType) { RowType rowType = (RowType) elementType; return Arrays.stream(values) .map(v -> v == null ? null : newArrayList(mapRowValues(rowType, (Object[]) v))) .toArray(); } if (elementType instanceof CharType) { return Arrays.stream(values) .map(v -> v == null ? null : padEnd((String) v, ((CharType) elementType).getLength(), ' ')) .toArray(); } if (elementType instanceof TimestampType) { return Arrays.stream(values) .map(v -> v == null ? null : ((Timestamp) v).toLocalDateTime()) .toArray(); } return values; }

Target:
private static Object[] mapArrayValues(ArrayType arrayType, Object[] values) { Type elementType = arrayType.getElementType(); if (elementType instanceof ArrayType) { return Arrays.stream(values) .map(v -> v == null ? null : newArrayList((Object[]) v)) .toArray(); } if (elementType instanceof RowType) { RowType rowType = (RowType) elementType; return Arrays.stream(values) .map(v -> v == null ? null : newArrayList(mapRowValues(rowType, (Object[]) v))) .toArray(); } if (elementType instanceof CharType) { int length = ((CharType) elementType).getLength(); return Arrays.stream(values) .map(String.class::cast) .map(v -> v == null ? null : padEnd(v, length, ' ')) .toArray(); } if (elementType instanceof TimestampType) { return Arrays.stream(values) .map(v -> v == null ? null : ((Timestamp) v).toLocalDateTime()) .toArray(); } return values; }
Source:
public static void restoreSystemProperties() { System.clearProperty("org.uberfire.nio.git.daemon.enabled"); System.clearProperty("org.uberfire.nio.git.ssh.enabled"); System.clearProperty("org.uberfire.sys.repo.monitor.disabled"); }

Target:
public static void restoreSystemProperties() { System.clearProperty("org.uberfire.sys.repo.monitor.disabled"); System.clearProperty("org.uberfire.nio.git.daemon.enabled"); System.clearProperty("org.uberfire.nio.git.ssh.enabled"); System.clearProperty("org.uberfire.sys.repo.monitor.disabled"); }
Source:
private Object invokeProxy(Method method, Object[] args, Object statement, long time) throws Exception { Object result = null; String name = method.getName(); String sql = null; Constructor<?> constructor = null; if (this.compare("prepareStatement", name)) { sql = (String) args[0]; constructor = this.getConstructor(1, PreparedStatement.class); if (sql != null) { this.prepareStatement(sql, time); } } else if (!this.compare("prepareCall", name)) { return statement; } result = constructor != null ? constructor.newInstance(new StatementProxy(statement, sql)) : null; return result; }

Target:
private Object invokeProxy(Method method, Object[] args, Object statement, long time) throws Exception { String name = method.getName(); String sql = null; Constructor<?> constructor = null; if (this.compare("prepareStatement", name)) { sql = (String) args[0]; constructor = this.getConstructor(1, PreparedStatement.class); if (sql != null) { this.prepareStatement(sql, time); } } else if (!this.compare("prepareCall", name)) { return statement; } if (constructor != null) { return constructor.newInstance(new StatementProxy(statement, sql)); } else { return null; } }
Source:
public static DateTime weekFloor(DateTime dt) { DateTime startOfWeek = dt.minusDays(dt.getDayOfWeek() - 1); return dayFloor(dt).withYear(startOfWeek.getYear()) .withMonthOfYear(startOfWeek.getMonthOfYear()) .withDayOfMonth(startOfWeek.getDayOfMonth()); }

Target:
public static DateTime weekFloor(DateTime dt) { return dayFloor(dt.minusDays(dt.getDayOfWeek() -1)); }
Source:
protected void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); if (sslFactory != null) { InetSocketAddress peerAddress = ch.remoteAddress(); pipeline.addLast("sslHandler", new SslHandler( sslFactory.createSSLEngine(peerAddress.getHostName(), peerAddress.getPort(), SSLFactory.Mode.SERVER))); } pipeline .addLast("connectionStatsHandler", connectionStatsHandler) .addLast("codec", new HttpServerCodec(nettyConfig.nettyServerMaxInitialLineLength, nettyConfig.nettyServerMaxHeaderSize, nettyConfig.nettyServerMaxChunkSize)) .addLast("healthCheckHandler", new HealthCheckHandler(restServerState, nettyMetrics)) .addLast("publicAccessLogHandler", new PublicAccessLogHandler(publicAccessLogger, nettyMetrics)) .addLast("idleStateHandler", new IdleStateHandler(0, 0, nettyConfig.nettyServerIdleTimeSeconds)) .addLast("chunker", new ChunkedWriteHandler()) .addLast("processor", new NettyMessageProcessor(nettyMetrics, nettyConfig, requestHandler)); }

Target:
protected void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast("connectionStatsHandler", connectionStatsHandler); if (sslFactory != null) { InetSocketAddress peerAddress = ch.remoteAddress(); pipeline.addLast("sslHandler", new SslHandler( sslFactory.createSSLEngine(peerAddress.getHostName(), peerAddress.getPort(), SSLFactory.Mode.SERVER))); } pipeline .addLast("codec", new HttpServerCodec(nettyConfig.nettyServerMaxInitialLineLength, nettyConfig.nettyServerMaxHeaderSize, nettyConfig.nettyServerMaxChunkSize)) .addLast("healthCheckHandler", new HealthCheckHandler(restServerState, nettyMetrics)) .addLast("publicAccessLogHandler", new PublicAccessLogHandler(publicAccessLogger, nettyMetrics)) .addLast("idleStateHandler", new IdleStateHandler(0, 0, nettyConfig.nettyServerIdleTimeSeconds)) .addLast("chunker", new ChunkedWriteHandler()) .addLast("processor", new NettyMessageProcessor(nettyMetrics, nettyConfig, requestHandler)); }
Source:
private boolean isClosed() { return socket.isValid(); }

Target:
private boolean isClosed() { return !socket.isValid(); }
Source:
public SonarLintProjectSettingsPanel(Project project) { bindPanel = new SonarLintProjectBindPanel(); propsPanel = new SonarLintProjectPropertiesPanel(); exclusionsPanel = new ProjectExclusionsPanel(project); analyzersPanel = new SonarLintProjectAnalyzersPanel(project); root = new JPanel(new BorderLayout()); JBTabbedPane tabs = new JBTabbedPane(); rootBindPane = new JPanel(new BorderLayout()); rootBindPane.add(bindPanel.create(project)); rootPropertiesPane = new JPanel(new BorderLayout()); rootPropertiesPane.add(propsPanel.create(), BorderLayout.CENTER); tabs.insertTab("Bind to SonarQube project", null, rootBindPane, "Configure the binding of modules to a SonarQube server", 0); tabs.insertTab("File Exclusions", null, exclusionsPanel.getComponent(), "Configure which files to exclude from analysis", 1); tabs.insertTab("Analysis properties", null, rootPropertiesPane, "Configure analysis properties", 2); tabs.insertTab("Analyzers Info", null, analyzersPanel.getPanel(), "Check which analyzers are currently loaded", 3); tabs.addChangeListener(e -> { if (tabs.getSelectedComponent() == analyzersPanel.getPanel()) { analyzersPanel.reload(); } }); root.add(tabs, BorderLayout.CENTER); }

Target:
public SonarLintProjectSettingsPanel(Project project) { bindPanel = new SonarLintProjectBindPanel(); propsPanel = new SonarLintProjectPropertiesPanel(); exclusionsPanel = new ProjectExclusionsPanel(project); analyzersPanel = new SonarLintProjectAnalyzersPanel(project); root = new JPanel(new BorderLayout()); JBTabbedPane tabs = new JBTabbedPane(); rootBindPane = new JPanel(new BorderLayout()); rootBindPane.add(bindPanel.create(project)); rootPropertiesPane = new JPanel(new BorderLayout()); rootPropertiesPane.add(propsPanel.create(), BorderLayout.CENTER); tabs.insertTab("Bind to SonarQube project", null, rootBindPane, "Configure the binding of modules to a SonarQube server", 0); tabs.insertTab("File Exclusions", null, exclusionsPanel.getComponent(), "Configure which files to exclude from analysis", 1); tabs.insertTab("Analysis properties", null, rootPropertiesPane, "Configure analysis properties", 2); tabs.insertTab("Analyzers", null, analyzersPanel.getPanel(), "Check which analyzers are currently loaded", 3); tabs.addChangeListener(e -> { if (tabs.getSelectedComponent() == analyzersPanel.getPanel()) { analyzersPanel.reload(); } }); root.add(tabs, BorderLayout.CENTER); }