auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>SamzaContainer createSamzaContainer(String processorId, JobModel jobModel) { return SamzaContainer.apply(processorId, <START> jobModel, <END> ScalaJavaUtil.toScalaMap(this.customMetricsReporter), this.taskFactory, JobContextImpl.fromConfigWithDefaults(this.config), Option.apply(this.applicationDefinedContainerContextFactory), Option.apply(this.applicationDefinedTaskContextFactory)); }</code><technical_language>Minor: Convention is multiple params line instead of param line</technical_language>

Target:
SamzaContainer createSamzaContainer(String processorId, JobModel jobModel) { return SamzaContainer.apply(processorId, jobModel, ScalaJavaUtil.toScalaMap(this.customMetricsReporter), this.taskFactory, JobContextImpl.fromConfigWithDefaults(this.config), Option.apply(this.applicationDefinedContainerContextFactoryOptional.orElse(null)), Option.apply(this.applicationDefinedTaskContextFactoryOptional.orElse(null))); }
Source:
<code>public AbstractPartTreeBlazePersistenceQuery(EntityViewAwareJpaQueryMethod method, EntityManager em, PersistenceProvider persistenceProvider, CriteriaBuilderFactory cbf, EntityViewManager evm) { super(method, em); this.cbf = cbf; this.evm = evm; this.entityViewClass = method.getEntityViewClass(); this.domainClass = method.getEntityInformation().getJavaType(); this.parameters = method.getJpaParameters(); String methodName = method.getName(); boolean matchesSpecificationSignature = parameters.hasSpecificationParameter() && QUERY_PATTERN.matcher(methodName).matches(); boolean hasEntityViewSettingProcessorParameter = parameters.hasEntityViewSettingProcessorParameter(); <START> String source = (matchesSpecificationSignature || hasEntityViewSettingProcessorParameter) ? "" : methodName; <END> this.tree = new PartTree(source, domainClass); boolean recreateQueries = parameters.potentiallySortsDynamically() || entityViewClass != null || matchesSpecificationSignature || hasEntityViewSettingProcessorParameter; this.query = isCountProjection(tree) ? new AbstractPartTreeBlazePersistenceQuery.CountQueryPreparer(persistenceProvider, recreateQueries) : new AbstractPartTreeBlazePersistenceQuery.QueryPreparer(persistenceProvider, recreateQueries); }</code><technical_language>elaborate predicate deduced method name a processor is present</technical_language>

Target:
public AbstractPartTreeBlazePersistenceQuery(EntityViewAwareJpaQueryMethod method, EntityManager em, PersistenceProvider persistenceProvider, CriteriaBuilderFactory cbf, EntityViewManager evm) { super(method, em); this.cbf = cbf; this.evm = evm; this.entityViewClass = method.getEntityViewClass(); this.domainClass = method.getEntityInformation().getJavaType(); this.parameters = method.getJpaParameters(); String methodName = method.getName(); boolean skipMethodNamePredicateMatching = QUERY_PATTERN.matcher(methodName).matches(); String source = skipMethodNamePredicateMatching ? "" : methodName; this.tree = new PartTree(source, domainClass); boolean hasEntityViewSettingProcessorParameter = parameters.hasEntityViewSettingProcessorParameter(); boolean recreateQueries = parameters.potentiallySortsDynamically() || entityViewClass != null || skipMethodNamePredicateMatching || hasEntityViewSettingProcessorParameter; this.query = isCountProjection(tree) ? new AbstractPartTreeBlazePersistenceQuery.CountQueryPreparer(persistenceProvider, recreateQueries) : new AbstractPartTreeBlazePersistenceQuery.QueryPreparer(persistenceProvider, recreateQueries); }
Source:
<code>private StorageDomainStatus getStorageDomainStatus() { <START> StorageDomainStatus status = null; <END> if (getStorageDomain() != null && getStorageDomain().getstatus() != null) { status = getStorageDomain().getstatus(); } return status; }</code><technical_language>need getStorageDomain().getstatus() != null condition</technical_language>

Target:
private StorageDomainStatus getStorageDomainStatus() { StorageDomainStatus status = null; if (getStorageDomain() != null) { status = getStorageDomain().getstatus(); } return status; }
Source:
<code>public void after() throws MuleException { flow.stop(); flow.dispose(); <START> stopIfNeeded(muleContext.getSchedulerService()); <END> }</code><technical_language>this happen test infrastructure</technical_language>

Target:
public void after() throws MuleException { flow.stop(); flow.dispose(); }
Source:
<code>public List<ITmfStateInterval> queryHistoryRange(int attributeQuark, long t1, long t2, long resolution, IProgressMonitor monitor) throws TimeRangeException, AttributeNotFoundException, StateSystemDisposedException { if (isDisposed) { throw new StateSystemDisposedException(); } List<ITmfStateInterval> intervals; ITmfStateInterval currentInterval; long ts, tEnd; IProgressMonitor mon = monitor; if (mon == null) { mon = new NullProgressMonitor(); } if (t2 < t1 || resolution <= 0) { throw new TimeRangeException(); } if (t2 > this.getCurrentEndTime()) { tEnd = this.getCurrentEndTime(); } else { tEnd = t2; } intervals = new ArrayList<>(); currentInterval = querySingleState(t1, attributeQuark); intervals.add(currentInterval); <START> for (ts = t1; (currentInterval.getEndTime() != -1) && (ts < tEnd); <END> ts += ((currentInterval.getEndTime() - ts) / resolution + 1) * resolution) { if (mon.isCanceled()) { return intervals; } currentInterval = querySingleState(ts, attributeQuark); intervals.add(currentInterval); } if (currentInterval.getEndTime() < tEnd) { currentInterval = querySingleState(tEnd, attributeQuark); intervals.add(currentInterval); } return intervals; }</code><technical_language>currentInterval endTime longer -1 patch 20903, I believe</technical_language>

Target:
public List<ITmfStateInterval> queryHistoryRange(int attributeQuark, long t1, long t2, long resolution, IProgressMonitor monitor) throws TimeRangeException, AttributeNotFoundException, StateSystemDisposedException { if (isDisposed) { throw new StateSystemDisposedException(); } List<ITmfStateInterval> intervals; ITmfStateInterval currentInterval; long ts, tEnd; IProgressMonitor mon = monitor; if (mon == null) { mon = new NullProgressMonitor(); } if (t2 < t1 || resolution <= 0) { throw new TimeRangeException(); } if (t2 > this.getCurrentEndTime()) { tEnd = this.getCurrentEndTime(); } else { tEnd = t2; } intervals = new ArrayList<>(); currentInterval = querySingleState(t1, attributeQuark); intervals.add(currentInterval); for (ts = t1; ts < tEnd; ts = Math.max(currentInterval.getEndTime() + 1, ts + resolution)) { if (mon.isCanceled()) { return intervals; } currentInterval = querySingleState(ts, attributeQuark); intervals.add(currentInterval); } if (currentInterval.getEndTime() < tEnd) { currentInterval = querySingleState(tEnd, attributeQuark); intervals.add(currentInterval); } return intervals; }
Source:
<code>public Response send(Command entity) throws Exception { Context.getPermissionsManager().checkReadonly(getUserId()); long deviceId = entity.getDeviceId(); long id = entity.getId(); Context.getPermissionsManager().checkDevice(getUserId(), deviceId); if (id != 0) { Context.getPermissionsManager().checkPermission(Command.class, getUserId(), id); Context.getPermissionsManager().checkUserDeviceCommand(getUserId(), deviceId, id); } else { Context.getPermissionsManager().checkLimitCommands(getUserId()); } <START> boolean sent = Context.getCommandsManager().sendCommand(entity); <END> if (!sent) { return Response.accepted(entity).build(); } return Response.ok(entity).build(); }</code><technical_language>Do need variable here? check result directly</technical_language>

Target:
public Response send(Command entity) throws Exception { Context.getPermissionsManager().checkReadonly(getUserId()); long deviceId = entity.getDeviceId(); long id = entity.getId(); Context.getPermissionsManager().checkDevice(getUserId(), deviceId); if (id != 0) { Context.getPermissionsManager().checkPermission(Command.class, getUserId(), id); Context.getPermissionsManager().checkUserDeviceCommand(getUserId(), deviceId, id); } else { Context.getPermissionsManager().checkLimitCommands(getUserId()); } if (!Context.getCommandsManager().sendCommand(entity)) { return Response.accepted(entity).build(); } return Response.ok(entity).build(); }
Source:
<code>protected SSHClient _getSSHClient() { EngineSSHClient client = new EngineSSHClient(); client.setVds(_vds); <START> return (SSHClient) client; <END> }</code><technical_language>do need cast? is add a method SSHDialog::getSSHClient() allow direct interaction this object</technical_language>

Target:
protected SSHClient _getSSHClient() { EngineSSHClient client = new EngineSSHClient(); if (_client != null) { VDS vds = ((EngineSSHClient)_client).getVds(); if (vds != null) { client.setVds(vds); } } return client; }
Source:
<code><START> private static final Type entryType(Type keyType, Type valueType) <END> { return new ArrayType(new RowType(ImmutableList.of(keyType, valueType), Optional.empty())); }</code><technical_language>I final for functions in code base</technical_language>

Target:
private static Type entryType(Type keyType, Type valueType) { return new ArrayType(new RowType(ImmutableList.of(keyType, valueType), Optional.empty())); }
Source:
<code>public boolean removeRaider(Raider raider) { if (raider.getRaid().isPresent()) { <START> if (this.equals(raider.getRaid().get())) { <END> this.raid.leaveRaid((AbstractRaiderEntity) raider, true); return true; } } return false; }</code><technical_language>Raid != Wave</technical_language>

Target:
public boolean removeRaider(Raider raider) { checkNotNull(raider, "Raider cannot be null."); if (raider.getRaid().isPresent()) { if (this.equals(raider.getRaid().get().getWaves().get(this.waveId))) { this.raid.leaveRaid((AbstractRaiderEntity) raider, true); return true; } } return false; }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { IEvaluationContext context = (IEvaluationContext) event.getApplicationContext(); <START> IWorkbench workbench = (IWorkbench) context.getVariable(IWorkbench.class.getName()); <END> workbench.getDisplay().close(); return null; }</code><technical_language>HandlerUtil.getActiveWorkbenchWindow(event).getService(IWorkbench.class) get workbench</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbench workbench = HandlerUtil.getActiveWorkbenchWindow(event).getService(IWorkbench.class); workbench.getDisplay().close(); return null; }
Source:
<code>private static CoordinationStore<VersionedInternalSchemaMetadata> createCoordinationStore( KeyValueService keyValueService, LongSupplier timestampSupplier, boolean initializeAsync) { <START> return createRawCoordinationStore(keyValueService, timestampSupplier, initializeAsync); <END> }</code><technical_language>inline this method</technical_language>

Target:
private static CoordinationStore<VersionedInternalSchemaMetadata> createCoordinationStore( KeyValueService keyValueService, LongSupplier timestampSupplier, boolean initializeAsync) { return KeyValueServiceCoordinationStore.create( ObjectMappers.newServerObjectMapper(), keyValueService, AtlasDbConstants.DEFAULT_METADATA_COORDINATION_KEY, timestampSupplier, VersionedInternalSchemaMetadata::knowablySemanticallyEquivalent, VersionedInternalSchemaMetadata.class, initializeAsync); }
Source:
<code>protected synchronized void handleEvent(CoordinatorEvent event) { LOG.info("START: Handle event " + event.getType() + ", Instance: " + _adapter.getInstanceName()); try { switch (event.getType()) { case LEADER_DO_ASSIGNMENT: assignDatastreamTasksToInstances(); break; case HANDLE_ASSIGNMENT_CHANGE: handleAssignmentChange(); break; case HANDLE_NEW_DATASTREAM: handleNewDatastream(); break; case HANDLE_INSTANCE_ERROR: handleInstanceError(event); } } catch (Exception e) { <START> LOG.error("ERROR: event + " + event + " failed."); <END> } LOG.info("END: Handle event " + event); }</code><technical_language>log exception too</technical_language>

Target:
protected synchronized void handleEvent(CoordinatorEvent event) { LOG.info("START: Handle event " + event.getType() + ", Instance: " + _adapter.getInstanceName()); try { switch (event.getType()) { case LEADER_DO_ASSIGNMENT: assignDatastreamTasksToInstances(); break; case HANDLE_ASSIGNMENT_CHANGE: handleAssignmentChange(); break; case HANDLE_NEW_DATASTREAM: handleNewDatastream(); break; case HANDLE_INSTANCE_ERROR: handleInstanceError(event); } } catch (Throwable e) { LOG.error("ERROR: event + " + event + " failed.", e); } LOG.info("END: Handle event " + event); }
Source:
<code>private static void addN90s(Map<String, List<JsonNode>> subClasses) { JsonNode wikidataJson = WikidataLocations.load(); Pair<List<JsonNode>, Map<String, List<JsonNode>>> topAndSub = Classification.buildHierarchyWikidata(wikidataJson); String n9 = "<LINK_0>"; <START> String euregio = "<LINK_0>1"; <END> List<JsonNode> n9Sub = new ArrayList<>(); n9Sub.addAll(topAndSub.getLeft()); n9Sub.add(subClasses.get(n9).stream() .filter(json -> json.get("value").textValue().equals(euregio)) .iterator().next()); subClasses.put(n9, n9Sub); subClasses.putAll(topAndSub.getRight()); }</code><technical_language>"<LINK_1>" appears multiple times reused declaring a static final</technical_language>

Target:
private static void addN90s(Map<String, List<JsonNode>> subClasses) { JsonNode wikidataJson = WikidataLocations.load(); Pair<List<JsonNode>, Map<String, List<JsonNode>>> topAndSub = Classification.buildHierarchyWikidata(wikidataJson); String n9 = NWBIB_SPATIAL + "N9"; String euregio = NWBIB_SPATIAL + "N91"; List<JsonNode> n9Sub = new ArrayList<>(); n9Sub.addAll(topAndSub.getLeft()); n9Sub.add(subClasses.get(n9).stream() .filter(json -> json.get("value").textValue().equals(euregio)) .iterator().next()); subClasses.put(n9, n9Sub); subClasses.putAll(topAndSub.getRight()); }
Source:
<code>public PermissionsPolicyHeaderWriter() { <START> this(""); <END> }</code><technical_language>I this set policy "". want ensure users configuring policy if PermissionsPolicyHeaderWriter. This allow create a PermissionsPolicyHeaderWriter policy</technical_language>

Target:
public PermissionsPolicyHeaderWriter() { }
Source:
<code>private Algorithm parseAlgorithm() throws TypeImportException, XMLStreamException { String name = getAttributeValue(LibraryElementTags.NAME_ATTRIBUTE); String comment = getAttributeValue(LibraryElementTags.COMMENT_ATTRIBUTE); Algorithm retVal = null; while (getReader().hasNext()) { int event = getReader().next(); if (event == XMLStreamConstants.START_ELEMENT) { switch (getReader().getLocalName()) { case LibraryElementTags.FBD_ELEMENT: throw new TypeImportException("Algorithm: Unsupported Algorithmtype (only ST and Other possible)!"); case LibraryElementTags.ST_ELEMENT: retVal = LibraryElementFactory.eINSTANCE.createSTAlgorithm(); parseST((STAlgorithm) retVal); break; case LibraryElementTags.LD_ELEMENT: throw new TypeImportException("Algorithm: Unsupported Algorithmtype (only ST and Other possible)!"); case LibraryElementTags.OTHER_ELEMENT: retVal = LibraryElementFactory.eINSTANCE.createOtherAlgorithm(); parseOtherAlg((OtherAlgorithm) retVal); break; default: throw new XMLStreamException("Unexpected xml child (" + getReader().getLocalName() + ") found!"); } } else if <START> (event == XMLStreamConstants.END_ELEMENT) { <END> if (!getReader().getLocalName().equals(LibraryElementTags.ALGORITHM_ELEMENT)) { throw new XMLStreamException("Unexpected xml end tag found in " + LibraryElementTags.ALGORITHM_ELEMENT + ": " + getReader().getLocalName()); } break; } } if (null != retVal) { retVal.setName(name); retVal.setComment(comment); } return retVal; }</code><technical_language>order of operands</technical_language>

Target:
private Algorithm parseAlgorithm() throws TypeImportException, XMLStreamException { String name = getAttributeValue(LibraryElementTags.NAME_ATTRIBUTE); String comment = getAttributeValue(LibraryElementTags.COMMENT_ATTRIBUTE); Algorithm retVal = null; while (getReader().hasNext()) { int event = getReader().next(); if (XMLStreamConstants.START_ELEMENT == event) { switch (getReader().getLocalName()) { case LibraryElementTags.FBD_ELEMENT: throw new TypeImportException("Algorithm: Unsupported Algorithmtype (only ST and Other possible)!"); case LibraryElementTags.ST_ELEMENT: retVal = LibraryElementFactory.eINSTANCE.createSTAlgorithm(); parseST((STAlgorithm) retVal); break; case LibraryElementTags.LD_ELEMENT: throw new TypeImportException("Algorithm: Unsupported Algorithmtype (only ST and Other possible)!"); case LibraryElementTags.OTHER_ELEMENT: retVal = LibraryElementFactory.eINSTANCE.createOtherAlgorithm(); parseOtherAlg((OtherAlgorithm) retVal); break; default: throw new XMLStreamException("Unexpected xml child (" + getReader().getLocalName() + ") found!"); } } else if (XMLStreamConstants.END_ELEMENT == event) { if (!getReader().getLocalName().equals(LibraryElementTags.ALGORITHM_ELEMENT)) { throw new XMLStreamException("Unexpected xml end tag found in " + LibraryElementTags.ALGORITHM_ELEMENT + ": " + getReader().getLocalName()); } break; } } if (null != retVal) { retVal.setName(name); retVal.setComment(comment); } return retVal; }
Source:
<code><START> private void postConstruct() { <END> CLASS_TO_MAPPER_MAP.put(MeterReads.class, this.monitoringMapper); CLASS_TO_MAPPER_MAP.put(EventMessageDataContainer.class, this.managementMapper); CLASS_TO_MAPPER_MAP.put(ActionValueResponseObject.class, this.commonMapper); }</code><technical_language>![MAJOR](<LINK_1> Private method 'postConstruct' is used. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
private void postConstruct() { CLASS_TO_MAPPER_MAP.put(MeterReads.class, this.monitoringMapper); CLASS_TO_MAPPER_MAP.put(MeterReadsGas.class, this.monitoringMapper); CLASS_TO_MAPPER_MAP.put(EventMessageDataContainer.class, this.managementMapper); CLASS_TO_MAPPER_MAP.put(ActionResponse.class, this.commonMapper); CLASS_TO_MAPPER_MAP.put(AlarmRegister.class, this.monitoringMapper); CLASS_TO_MAPPER_MAP.put(AdministrativeStatusTypeResponse.class, this.configurationMapper); CLASS_TO_MAPPER_MAP.put(PeriodicMeterReadsContainer.class, this.monitoringMapper); CLASS_TO_MAPPER_MAP.put(PeriodicMeterReadsContainerGas.class, this.monitoringMapper); CLASS_TO_MAPPER_MAP.put(GetConfigurationResponseContainer.class, this.monitoringMapper); CLASS_TO_MAPPER_MAP.put(FirmwareVersionResponseContainer.class, this.monitoringMapper); }
Source:
<code>public CuratorFramework newClient(String connectString, int sessionTimeoutMs, int connectionTimeoutMs, RetryPolicy retryPolicy) { <START> CuratorFramework curator = mock(CuratorFramework.class); <END> RetryLoop retryLoop = mock(RetryLoop.class); when(retryLoop.shouldContinue()).thenReturn(false); CuratorZookeeperClient czkClient = mock(CuratorZookeeperClient.class); when(czkClient.newRetryLoop()).thenReturn(retryLoop); when(curator.getZookeeperClient()).thenReturn(czkClient); when(curator.getConnectionStateListenable()).thenReturn(mock(Listenable.class)); when(curator.getChildren()).thenThrow(KeeperException.ConnectionLossException.class); when(curator.newNamespaceAwareEnsurePath(anyString())).thenReturn(mock(EnsurePath.class)); return curator; }</code><technical_language>final. assignments below</technical_language>

Target:
public CuratorFramework newClient(String connectString, int sessionTimeoutMs, int connectionTimeoutMs, RetryPolicy retryPolicy) { final CuratorFramework curator = mock(CuratorFramework.class); final RetryLoop retryLoop = mock(RetryLoop.class); when(retryLoop.shouldContinue()).thenReturn(false); final CuratorZookeeperClient czkClient = mock(CuratorZookeeperClient.class); when(czkClient.newRetryLoop()).thenReturn(retryLoop); when(curator.getZookeeperClient()).thenReturn(czkClient); when(curator.getConnectionStateListenable()).thenReturn(mock(Listenable.class)); when(curator.getChildren()).thenThrow(KeeperException.ConnectionLossException.class); when(curator.newNamespaceAwareEnsurePath(anyString())).thenReturn(mock(EnsurePath.class)); return curator; }
Source:
<code>public String getCourseId() { <START> return browser.driver.findElement(By.id(Const.ParamsNames.COURSE_ID)).getAttribute("value"); <END> }</code><technical_language>is a @FindBy defined for courseid, I refer</technical_language>

Target:
public String getCourseId() { return courseIdTextBox.getAttribute("value"); }
Source:
<code><START> private static String getLocalIP(NetworkInterface intf) { <END> String result = null; for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr .hasMoreElements(); ) { String calculated; InetAddress inetAddress = enumIpAddr.nextElement(); if (!inetAddress.isLoopbackAddress()) { InetAddressValidator validator = InetAddressValidator.getInstance(); calculated = inetAddress.getHostAddress().toString(); if (validator.isValid(calculated)) { result = calculated; break; } } } return result; }</code><technical_language>please add Nullable annotation</technical_language>

Target:
private static String getLocalIP(NetworkInterface intf) { for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr .hasMoreElements(); ) { InetAddress inetAddress = enumIpAddr.nextElement(); if (!inetAddress.isLoopbackAddress()) { InetAddressValidator validator = InetAddressValidator.getInstance(); String calculated = inetAddress.getHostAddress().toString(); if (validator.isValid(calculated)) { return calculated; } } } return null; }
Source:
<code>private void publishEvent(String event, Message msg, Map<String, String> parameters) { Map<String, String> map = new HashMap<String, String>(); map.putAll(parameters); <START> map.put(MESSAGE_CLASS, msg.getClass().getCanonicalName()); <END> ZAP.getEventBus().publishSyncEvent( getPublisher(), new Event(getPublisher(), event, null, map)); }</code><technical_language>a specific ID/token (e.g. "HTTP", "WebSocket") instead of class name</technical_language>

Target:
private void publishEvent(String event, Message msg, Map<String, String> parameters) { Map<String, String> map = new HashMap<String, String>(); map.putAll(parameters); map.put(MESSAGE_TYPE, msg.getType()); ZAP.getEventBus().publishSyncEvent( getPublisher(), new Event(getPublisher(), event, null, map)); }
Source:
<code>protected final void connect() throws ConnectionException { final SslContext sslCtx = null; final InetSocketAddress remoteAddress = new InetSocketAddress(getURI().getHost(), getURI().getPort()); if (remoteAddress.isUnresolved()) { throw new ConnectionException("Remote address does not exist " + remoteAddress.getHostString()); } final EventLoopGroup group = new NioEventLoopGroup(); try { final ClientWebSocketWrapper handler = new ClientWebSocketWrapper( WebSocketClientHandshakerFactory.newHandshaker( getURI(), WebSocketVersion.V13, null, false, new DefaultHttpHeaders()), this); final Bootstrap bootstrap = new Bootstrap(); bootstrap.group(group) .channel(NioSocketChannel.class) .handler(new ChannelInitializer<SocketChannel>() { @SuppressWarnings("PMD.CommentRequired") @Override protected void initChannel(final SocketChannel channel) { final ChannelPipeline pipeline = channel.pipeline(); if (sslCtx != null) { pipeline.addFirst(sslCtx.newHandler(channel.alloc(), getURI().getHost(), getURI().getPort())); } pipeline.addLast( new HttpClientCodec(), new HttpObjectAggregator(OBJECT_AGGREGATOR_CODE), handler); } }); LOG.info("{} connecting to[ ]", this.getClass().getSimpleName() , getURI()); final Channel channel = bootstrap.connect(getURI().getHost(), getURI().getPort()).sync().channel(); handler.handshakeFuture().sync(); <START> LOG.error("Something happened? {}", channel.metadata()); <END> } catch (InterruptedException e) { LOG.info(LoggingConstants.EXCEPTION_MESSAGE, e); group.shutdownGracefully(); } }</code><technical_language>delete this message</technical_language>

Target:
protected final void connect() throws ConnectionException { final SslContext sslCtx = null; final InetSocketAddress remoteAddress = new InetSocketAddress(getURI().getHost(), getURI().getPort()); if (remoteAddress.isUnresolved()) { throw new ConnectionException("Remote address does not exist " + remoteAddress.getHostString()); } final EventLoopGroup group = new NioEventLoopGroup(); try { final ClientWebSocketWrapper handler = new ClientWebSocketWrapper( WebSocketClientHandshakerFactory.newHandshaker( getURI(), WebSocketVersion.V13, null, false, new DefaultHttpHeaders()), this); final Bootstrap bootstrap = new Bootstrap(); bootstrap.group(group) .channel(NioSocketChannel.class) .handler(new ChannelInitializer<SocketChannel>() { @SuppressWarnings("PMD.CommentRequired") @Override protected void initChannel(final SocketChannel channel) { final ChannelPipeline pipeline = channel.pipeline(); if (sslCtx != null) { pipeline.addFirst(sslCtx.newHandler(channel.alloc(), getURI().getHost(), getURI().getPort())); } pipeline.addLast( new HttpClientCodec(), new HttpObjectAggregator(OBJECT_AGGREGATOR_CODE), handler); } }); LOG.info("{} connecting to[ ]", this.getClass().getSimpleName() , getURI()); bootstrap.connect(getURI().getHost(), getURI().getPort()).sync().channel(); handler.handshakeFuture().sync(); } catch (InterruptedException e) { LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); group.shutdownGracefully(); } }
Source:
<code>protected void doOperation() { List<AdminEmailAttributes> allEmails = adminEmailsLogic.getAllAdminEmails(); if (isPreview) { System.out.println("Checking Sanitization for admin emails..."); } int numberOfAffectedEmails = 0; for (AdminEmailAttributes email : allEmails) { if (isPreview) { <START> if (previewSanitizedDataForAdminEmail(email)) { <END> numberOfAffectedEmails++; } } else { fixSanitizedDataForEmail(email); } } if (isPreview) { System.out.println("There are/is " + numberOfAffectedEmails + " affected email(s)!"); } else { System.out.println("Sanitization fixing done!"); } }</code><technical_language>Break checking for presence of sanitized data preview 2 steps? I.e replace this a call checkEmailHasSanitizedData, do preview if so</technical_language>

Target:
protected void doOperation() { List<AdminEmailAttributes> allEmails = adminEmailsLogic.getAllAdminEmails(); int numberOfAffectedEmails = 0; int numberOfUpdatedEmails = 0; LoopHelper loopHelper = new LoopHelper(100, "admin emails processed."); println("Running data migration for sanitization on admin emails..."); println("Preview: " + isPreview); for (AdminEmailAttributes email : allEmails) { loopHelper.recordLoop(); boolean isEmailSanitized = DataMigrationForSanitizedDataHelper.isSanitizedHtml(email.getContentValue()); if (!isEmailSanitized) { continue; } numberOfAffectedEmails++; try { desanitizeAndUpdateEmail(email); numberOfUpdatedEmails++; } catch (InvalidParametersException | EntityDoesNotExistException e) { println("Problem sanitizing email id " + email.getEmailId()); println(e.getMessage()); } } println("Total number of emails: " + loopHelper.getCount()); println("Number of affected emails: " + numberOfAffectedEmails); println("Number of updated emails: " + numberOfUpdatedEmails); }
Source:
<code>public void registerAttributes(ManagementResourceRegistration resourceRegistration) { <START> super.registerAttributes(resourceRegistration); <END> resourceRegistration.registerReadOnlyAttribute(TRACER_CONFIGURATION_NAME, null); resourceRegistration.registerReadOnlyAttribute(TRACER_CONFIGURATION, null); }</code><technical_language>super implementation is a no-op design</technical_language>

Target:
public void registerAttributes(ManagementResourceRegistration resourceRegistration) { resourceRegistration.registerReadOnlyAttribute(TRACER_CONFIGURATION_NAME, null); resourceRegistration.registerReadOnlyAttribute(TRACER_CONFIGURATION, null); }
Source:
<code>protected void testExecute() throws Exception { ______TS("Typical case"); CourseAttributes course = typicalBundle.courses.get("typicalCourse1"); FeedbackSessionAttributes session = typicalBundle.feedbackSessions.get("session1InCourse1"); String[] params = { Const.ParamsNames.COURSE_ID, course.getId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, session.getFeedbackSessionName(), }; PublishFeedbackSessionAction publishFeedbackSessionAction = getAction(params); JsonResult result = getJsonResult(publishFeedbackSessionAction); FeedbackSessionData feedbackSessionData = (FeedbackSessionData) result.getOutput(); assertEquals(feedbackSessionData.getFeedbackSessionName(), session.getFeedbackSessionName()); <START> assertEquals(feedbackSessionData.getPublishStatus(), FeedbackSessionPublishStatus.PUBLISHED); <END> ______TS("Failure case: Session is already published"); assertTrue(logic.getFeedbackSession(session.getFeedbackSessionName(), course.getId()).isPublished()); result = getJsonResult(getAction(params)); MessageOutput output = (MessageOutput) result.getOutput(); assertEquals(output.getMessage(), "Error publishing feedback session: Session has already been published."); assertEquals(result.getStatusCode(), HttpStatus.SC_BAD_REQUEST); }</code><technical_language>data return sever is verified. However, add another assertion verify status of feedback session in DB. (e.g. logic.getFeedbackSession() verify publish status)</technical_language>

Target:
protected void testExecute() throws Exception { ______TS("Typical case"); CourseAttributes course = typicalBundle.courses.get("typicalCourse1"); FeedbackSessionAttributes session = typicalBundle.feedbackSessions.get("session1InCourse1"); String[] params = { Const.ParamsNames.COURSE_ID, course.getId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, session.getFeedbackSessionName(), }; PublishFeedbackSessionAction publishFeedbackSessionAction = getAction(params); JsonResult result = getJsonResult(publishFeedbackSessionAction); FeedbackSessionData feedbackSessionData = (FeedbackSessionData) result.getOutput(); assertEquals(feedbackSessionData.getFeedbackSessionName(), session.getFeedbackSessionName()); assertEquals(FeedbackSessionPublishStatus.PUBLISHED, feedbackSessionData.getPublishStatus()); assertTrue(logic.getFeedbackSession(session.getFeedbackSessionName(), course.getId()).isPublished()); ______TS("Failure case: Session is already published"); assertTrue(logic.getFeedbackSession(session.getFeedbackSessionName(), course.getId()).isPublished()); result = getJsonResult(getAction(params)); MessageOutput output = (MessageOutput) result.getOutput(); assertEquals("Error publishing feedback session: Session has already been published.", output.getMessage()); assertEquals(HttpStatus.SC_BAD_REQUEST, result.getStatusCode()); }
Source:
<code>public synchronized void cleanUp(Set<Long> activeTableIds) { if (activeTableIds.isEmpty()) { return; } long latestTableId = Collections.max(activeTableIds); <START> for (Iterator<Map.Entry<Long, TableData>> tableDatas = tables.entrySet().iterator(); tableDatas.hasNext(); ) { <END> Map.Entry<Long, TableData> tablePagesEntry = tableDatas.next(); Long tableId = tablePagesEntry.getKey(); if (tableId < latestTableId && !activeTableIds.contains(tableId)) { for (Page removedPage : tablePagesEntry.getValue().getPages()) { currentBytes -= removedPage.getRetainedSizeInBytes(); } tableDatas.remove(); } } }</code><technical_language>tableDataIterator</technical_language>

Target:
public synchronized void cleanUp(Set<Long> activeTableIds) { if (activeTableIds.isEmpty()) { return; } long latestTableId = Collections.max(activeTableIds); for (Iterator<Map.Entry<Long, TableData>> tableDataIterator = tables.entrySet().iterator(); tableDataIterator.hasNext(); ) { Map.Entry<Long, TableData> tablePagesEntry = tableDataIterator.next(); Long tableId = tablePagesEntry.getKey(); if (tableId < latestTableId && !activeTableIds.contains(tableId)) { for (Page removedPage : tablePagesEntry.getValue().getPages()) { currentBytes -= removedPage.getRetainedSizeInBytes(); } tableDataIterator.remove(); } } }
Source:
<code><START> RequestOptions toRequestOptions() { <END> final RequestOptions requestOptions = new RequestOptions(); requestOptions.setConsistencyLevel(getConsistencyLevel()); requestOptions.setSessionToken(sessionToken); return requestOptions; }</code><technical_language>sure, thinking isContentResponseOnWriteEnabled add here</technical_language>

Target:
RequestOptions toRequestOptions() { final RequestOptions requestOptions = new RequestOptions(); requestOptions.setIfMatchETag(getIfMatchETag()); requestOptions.setIfNoneMatchETag(getIfNoneMatchETag()); requestOptions.setContentResponseOnWriteEnabled(isContentResponseOnWriteEnabled()); return requestOptions; }
Source:
<code><START> public ConsistencyCheckerTool(ClusterMap clusterMap, StoreKeyFactory storeKeyFactory, StoreConfig storeConfig, <END> Set<StoreKey> filterSet, Throttler throttler, StoreToolsMetrics metrics, Time time, StoreKeyConverter storeKeyConverter) { StoreMetrics storeMetrics = new StoreMetrics("ConsistencyCheckerTool", clusterMap.getMetricRegistry()); indexProcessingHelper = new IndexProcessingHelper(storeKeyFactory, storeConfig, filterSet, throttler, storeMetrics, metrics, time, storeKeyConverter); }</code><technical_language>minor: give this instance of IndexProcessingHelper instead (since this class extra input provide for construction) share instances multiple components need IndexProcessingHelper</technical_language>

Target:
public ConsistencyCheckerTool(ClusterMap clusterMap, StoreKeyFactory storeKeyFactory, StoreConfig storeConfig, Set<StoreKey> filterSet, Throttler throttler, StoreToolsMetrics metrics, Time time, StoreKeyConverter storeKeyConverter) { StoreMetrics storeMetrics = new StoreMetrics("ConsistencyCheckerTool", clusterMap.getMetricRegistry()); this.filterSet = filterSet; dumpIndexTool = new DumpIndexTool(storeKeyFactory, storeConfig, time, metrics, storeMetrics, throttler, storeKeyConverter); }
Source:
<code>void flushStoredSessions() { if (flushingRequest.tryAcquire(1)) { try { <START> List<File> storedFiles = sessionStore.findStoredFiles(); <END> for (File storedFile : storedFiles) { Session payload = new Session(storedFile); DeliveryStatus deliveryStatus = deliverSessionPayload(payload); switch (deliveryStatus) { case DELIVERED: sessionStore.deleteStoredFiles(storedFiles); break; case UNDELIVERED: sessionStore.cancelQueuedFiles(storedFiles); logger.w("Leaving session payload for future delivery"); break; case FAILURE: logger.w("Deleting invalid session tracking payload"); sessionStore.deleteStoredFiles(storedFiles); break; default: break; } } } finally { flushingRequest.release(1); } } }</code><technical_language>Whats migration impact for sessions persisted a pre-v5 notifier read v5</technical_language>

Target:
void flushStoredSessions() { if (flushingRequest.tryAcquire(1)) { try { List<File> storedFiles = sessionStore.findStoredFiles(); for (File storedFile : storedFiles) { flushStoredSession(storedFile); } } finally { flushingRequest.release(1); } } }
Source:
<code>public void testNumberAdapter() throws Exception { NumberAdapter adapter = new NumberAdapter(); String value = adapter.marshal(4.65450971582E11); <START> assertTrue(value.equals("4.65450971582E11")); <END> }</code><technical_language>assertEquals instead of assertTrue here. verify unmarshalling resulting string a similar result</technical_language>

Target:
public void testNumberAdapter() throws Exception { NumberAdapter adapter = new NumberAdapter(); assertEquals("4.65450971582E11", adapter.marshal(4.65450971582E11)); assertEquals(4.65450971582E11, adapter.unmarshal("4.65450971582E11")); assertEquals("45.0", adapter.marshal(45)); assertEquals(45.0, adapter.unmarshal("45")); assertEquals("2.147483647E9", adapter.marshal(Integer.MAX_VALUE)); assertEquals("NaN", adapter.marshal(Double.NaN)); assertEquals(Double.NaN, adapter.unmarshal("NaN")); assertEquals("Infinity", adapter.marshal(Double.POSITIVE_INFINITY)); assertEquals(Double.POSITIVE_INFINITY, adapter.unmarshal("Infinity")); assertEquals("-Infinity", adapter.marshal(Double.NEGATIVE_INFINITY)); assertEquals(Double.NEGATIVE_INFINITY, adapter.unmarshal("-Infinity")); assertEquals(Double.MAX_VALUE, adapter.unmarshal("1.7976931348623157E308D")); assertEquals("1.7976931348623157E308", adapter.marshal(Double.MAX_VALUE)); assertEquals("9.223372036854776E18", adapter.marshal(Long.MAX_VALUE)); assertEquals("-9.223372036854776E18", adapter.marshal(Long.MIN_VALUE)); }
Source:
<code>private boolean isIllegalImport(String importText) { boolean result = false; if (regexp) { for (Pattern pattern : illegalPkgsRegexps) { <START> if (pattern.matcher(importText).matches()) { <END> result = true; } } for (Pattern pattern : illegalClassesRegexps) { if (pattern.matcher(importText).matches()) { result = true; } } } else { for (String element : illegalPkgs) { if (importText.startsWith(element + ".")) { result = true; } } for (String element : illegalClasses) { if (importText.equals(element)) { result = true; } } } return result; }</code><technical_language>break is missed. If smth illegal is - stop search/matching quickly. Please update other cases below</technical_language>

Target:
private boolean isIllegalImport(String importText) { final boolean result; if (regexp) { result = isIllegalImportByRegularExpressions(importText); } else { result = isIllegalImportByPackagesAndClassNames(importText); } return result; }
Source:
<code>public void testCreateAnnouncementLocation() { URI baseURI = URI.create("<LINK_2>"); <START> URI baseWithSlash = URI.create("<LINK_0>"); <END> String nodeId = "ffff"; URI expected = URI.create("<LINK_0>v1/announcement/" + nodeId); assertEquals(expected, HttpDiscoveryAnnouncementClient.createAnnouncementLocation(baseURI, nodeId)); assertEquals(expected, HttpDiscoveryAnnouncementClient.createAnnouncementLocation(baseWithSlash, nodeId)); }</code><technical_language>inline variables</technical_language>

Target:
public void testCreateAnnouncementLocation() { String nodeId = "ffff"; URI expected = URI.create("<LINK_0>v1/announcement/" + nodeId); assertEquals(createAnnouncementLocation(URI.create("<LINK_2>"), nodeId), expected); assertEquals(createAnnouncementLocation(URI.create("<LINK_0>"), nodeId), expected); }
Source:
<code>public void testInitialization() { assertNull(module.getStateSystem()); module.schedule(); <START> assertEquals("Initialization succeeded", true, module.waitForInitialization()); <END> assertNotNull(module.getStateSystem()); }</code><technical_language>assertTrue</technical_language>

Target:
public void testInitialization() { assertNull(module.getStateSystem()); module.schedule(); assertTrue("Initialization succeeded", module.waitForInitialization()); assertNotNull(module.getStateSystem()); }
Source:
<code>public void testStoreResults(@TempDir Path tempDir) { String queryId = "bb31ca4e-ed8f-4be0-a0f3-12099fb9263c"; FileResultStorageEngine engine = new FileResultStorageEngine(tempDir.toString()); AsyncQuery query = new AsyncQuery(); query.setId(queryId); engine.storeResults(query, Observable.fromArray(new String[]{"hi", "hello"})); File file = new File(tempDir.toString() + File.separator + queryId); <START> assertTrue(file.exists()); <END> }</code><technical_language>read verify return wrote out</technical_language>

Target:
public void testStoreResults(@TempDir Path tempDir) { String queryId = "store_results_success"; String validOutput = "hi\nhello"; String[] input = validOutput.split("\n"); storeResultsFile(tempDir.toString(), queryId, Observable.fromArray(input)); File file = new File(tempDir.toString() + File.separator + queryId); assertTrue(file.exists()); String finalResult = readResultsFile(tempDir.toString(), queryId); assertEquals(finalResult, validOutput); }
Source:
<code>public void execute() { if (Config.isDevServer()) { log.info("Skipping backup in dev server."); return; } if (!Config.ENABLE_DATASTORE_BACKUP) { log.info("Skipping backup by system admin's choice."); return; } List<String> scopes = new ArrayList<>(); scopes.add("<LINK_2>"); String accessToken = AppIdentityServiceFactory.getAppIdentityService().getAccessToken(scopes).getAccessToken(); String appId = Config.getAppId(); HttpPost post = new HttpPost("<LINK_0>" + appId + ":export"); post.setHeader("Content-Type", "application/json"); post.setHeader("Authorization", "Bearer " + accessToken); Map<String, Object> body = new HashMap<>(); body.put("output_url_prefix", "gs://" + Config.GCS_BUCKETNAME + "/datastore-backups/" + Instant.now().toString()); StringEntity entity = new StringEntity(JsonUtils.toJson(body), Charset.forName("UTF-8")); post.setEntity(entity); try (CloseableHttpClient client = HttpClients.createDefault(); CloseableHttpResponse resp = client.execute(post); BufferedReader br = new BufferedReader(new InputStreamReader(resp.getEntity().getContent()))) { String output = br.lines().collect(Collectors.joining(System.lineSeparator())); <START> log.info("Backup request successful:" + System.lineSeparator() + output); <END> } catch (IOException e) { log.severe("Backup request failure: " + e.getMessage()); } }</code><technical_language>check response status code? ![image](<LINK_1></technical_language>

Target:
public void execute() { if (Config.isDevServer()) { log.info("Skipping backup in dev server."); return; } if (!Config.ENABLE_DATASTORE_BACKUP) { log.info("Skipping backup by system admin's choice."); return; } List<String> scopes = new ArrayList<>(); scopes.add("<LINK_2>"); String accessToken = AppIdentityServiceFactory.getAppIdentityService().getAccessToken(scopes).getAccessToken(); String appId = Config.getAppId(); HttpPost post = new HttpPost("<LINK_0>" + appId + ":export"); post.setHeader("Content-Type", "application/json"); post.setHeader("Authorization", "Bearer " + accessToken); Map<String, Object> body = new HashMap<>(); String timestamp = Instant.now().toString(); body.put("output_url_prefix", "gs://" + Config.BACKUP_GCS_BUCKETNAME + "/datastore-backups/" + timestamp); StringEntity entity = new StringEntity(JsonUtils.toJson(body), Charset.forName("UTF-8")); post.setEntity(entity); try (CloseableHttpClient client = HttpClients.createDefault(); CloseableHttpResponse resp = client.execute(post); BufferedReader br = new BufferedReader(new InputStreamReader(resp.getEntity().getContent()))) { String output = br.lines().collect(Collectors.joining(System.lineSeparator())); if (resp.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { log.info("Backup request successful:" + System.lineSeparator() + output); } else { log.severe("Backup request failure:" + System.lineSeparator() + output); } } catch (IOException e) { log.severe("Backup request failure: " + e.getMessage()); } }
Source:
<code>public static Map<String, StudentResultSummary> getContribQnStudentResultSummary(FeedbackQuestionAttributes question, FeedbackSessionResultsBundle feedbackSessionResultsBundle) { Map<String, StudentResultSummary> contribQnStats = feedbackSessionResultsBundle.contributionQuestionStudentResultSummary.get(question.getId()); if (contribQnStats == null) { FeedbackContributionQuestionDetails fqcd = (FeedbackContributionQuestionDetails) question.getQuestionDetails(); contribQnStats = fqcd.getStudentResults(feedbackSessionResultsBundle, question); Map<String, StudentResultSummary> anonContribQnStats = new HashMap<>(); contribQnStats.forEach((key, studentResultSummary) -> anonContribQnStats.put( feedbackSessionResultsBundle.getAnonEmailFromStudentEmail(key), studentResultSummary)); <START> for (Map.Entry<String, StudentResultSummary> entry : anonContribQnStats.entrySet()) { <END> if (contribQnStats.get(entry.getKey()) == null) { contribQnStats.put(entry.getKey(), entry.getValue()); } } feedbackSessionResultsBundle.contributionQuestionStudentResultSummary.put(question.getId(), contribQnStats); } return contribQnStats; }</code><technical_language>this block is doing: 1. Copy items contribQnStats new key anonContribQnStats 1. Copy items anonContribQnStats key if key exist in contribQnStats This simplified anonContribQnStats is necessary. do it? Hint: involves map.putIfAbsent</technical_language>

Target:
public static Map<String, StudentResultSummary> getContribQnStudentResultSummary(FeedbackQuestionAttributes question, FeedbackSessionResultsBundle feedbackSessionResultsBundle) { return feedbackSessionResultsBundle.contributionQuestionStudentResultSummary.computeIfAbsent( question.getId(), key -> { FeedbackContributionQuestionDetails fqcd = (FeedbackContributionQuestionDetails) question.getQuestionDetails(); Map<String, StudentResultSummary> contribQnStats = fqcd.getStudentResults(feedbackSessionResultsBundle, question); new HashMap<>(contribQnStats).forEach((contribQnStatsKey, value) -> contribQnStats.putIfAbsent( feedbackSessionResultsBundle.getAnonEmailFromStudentEmail(contribQnStatsKey), value)); return contribQnStats; } ); }
Source:
<code>public RawIterator<Object[],ProcedureException> apply( Context ctx, Object[] input, ResourceTracker resourceTracker ) throws ProcedureException { try { int numberOfDeclaredArguments = signature.inputSignature().size(); if ( numberOfDeclaredArguments != input.length ) { throw new ProcedureException( Status.Procedure.ProcedureCallFailed, "Procedure `%s` takes %d arguments but %d was provided.", signature.name(), numberOfDeclaredArguments, input.length ); } for ( int i = 0; i < input.length; i++ ) { <START> input[i] = signature.inputSignature().get( i ).map( input[i] ); <END> } Object cls = constructor.invoke(); inject( ctx, cls ); Object rs = procedureMethod.invoke( cls, input ); if ( rs == null ) { return asRawIterator( emptyIterator() ); } else { return new MappingIterator( ((Stream<?>) rs).iterator(), ((Stream<?>) rs)::close, resourceTracker ); } } catch ( Throwable throwable ) { throw newProcedureException( throwable ); } }</code><technical_language>signature.inputSignature assigned a local variable loop. I find a bit scary modify input in place here, caller (or in future) array for other this mapping is expected</technical_language>

Target:
public RawIterator<Object[],ProcedureException> apply( Context ctx, Object[] input, ResourceTracker resourceTracker ) throws ProcedureException { try { input = verifyInput( "Procedure", signature.name(), signature.inputSignature(), input ); Object cls = constructor.invoke(); inject( ctx, cls ); Object rs = procedureMethod.invoke( cls, input ); if ( rs == null ) { return asRawIterator( emptyIterator() ); } else { return new MappingIterator( ((Stream<?>) rs).iterator(), ((Stream<?>) rs)::close, resourceTracker ); } } catch ( Throwable throwable ) { throw newProcedureException( throwable ); } }
Source:
<code>public ApiCaller(ServletContext context, PerunPrincipal perunPrincipal, PerunClient client) throws InternalErrorException { Perun perun = WebApplicationContextUtils.getWebApplicationContext(context).getBean("perun", Perun.class); PerunPrincipal rpcPrincipal = new PerunPrincipal(RPCPRINCIPAL, ExtSourcesManager.EXTSOURCE_NAME_INTERNAL, ExtSourcesManager.EXTSOURCE_INTERNAL); this.rpcSession = perun.getPerunSession(rpcPrincipal, new PerunClient()); <START> this.tasksManager = WebApplicationContextUtils.getWebApplicationContext(context).getBean("tasksManager", TasksManager.class); <END> this.cabinetManager = WebApplicationContextUtils.getWebApplicationContext(context).getBean("cabinetManager", CabinetManager.class); this.registrarManager = WebApplicationContextUtils.getWebApplicationContext(context).getBean("registrarManager", RegistrarManager.class); this.notificationManager = WebApplicationContextUtils.getWebApplicationContext(context).getBean("perunNotifNotificationManager", PerunNotifNotificationManager.class); this.vootManager = new VOOT(); this.scimManager = new SCIM(); this.session = perun.getPerunSession(perunPrincipal, client); }</code><technical_language>need this more, TasksManager is a part of perun-core. eg. getAttributesManager() implement getter for this manager</technical_language>

Target:
public ApiCaller(ServletContext context, PerunPrincipal perunPrincipal, PerunClient client) throws InternalErrorException { Perun perun = WebApplicationContextUtils.getWebApplicationContext(context).getBean("perun", Perun.class); PerunPrincipal rpcPrincipal = new PerunPrincipal(RPCPRINCIPAL, ExtSourcesManager.EXTSOURCE_NAME_INTERNAL, ExtSourcesManager.EXTSOURCE_INTERNAL); this.rpcSession = perun.getPerunSession(rpcPrincipal, new PerunClient()); this.cabinetManager = WebApplicationContextUtils.getWebApplicationContext(context).getBean("cabinetManager", CabinetManager.class); this.registrarManager = WebApplicationContextUtils.getWebApplicationContext(context).getBean("registrarManager", RegistrarManager.class); this.notificationManager = WebApplicationContextUtils.getWebApplicationContext(context).getBean("perunNotifNotificationManager", PerunNotifNotificationManager.class); this.vootManager = new VOOT(); this.scimManager = new SCIM(); this.session = perun.getPerunSession(perunPrincipal, client); }