auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public DvrpPassengerEventsReader(EventsManager events) { delegate = new EventsReaderXMLv1(events); this.setValidating(false); delegate.addCustomEventMapper(PassengerRequestRejectedEvent.EVENT_TYPE, getPassengerRequestRejectedEventMapper()); delegate.addCustomEventMapper(PassengerRequestScheduledEvent.EVENT_TYPE, getPassengerRequestScheduledEventMapper()); delegate.addCustomEventMapper(PassengerRequestSubmittedEvent.EVENT_TYPE, getPassengerRequestSubmittedEventMapper()); }

Target:
public DvrpPassengerEventsReader(EventsManager events) { delegate = new EventsReaderXMLv1(events); this.setValidating(false); delegate.addCustomEventMapper(PassengerRequestRejectedEvent.EVENT_TYPE, this::passengerRequestRejectedEvent); delegate.addCustomEventMapper(PassengerRequestScheduledEvent.EVENT_TYPE, this::passengerRequestScheduledEvent); delegate.addCustomEventMapper(PassengerRequestSubmittedEvent.EVENT_TYPE, this::passengerRequestSubmittedEvent); }
Source:
ASTExpression getLengthExpression() { return (ASTExpression) jjtGetChild(jjtGetNumChildren() - 1); }

Target:
public ASTExpression getLengthExpression() { return (ASTExpression) jjtGetChild(jjtGetNumChildren() - 1); }
Source:
public void handleGetAssocationLnObjectsResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception, final AssociationLnListTypeDto resultData) { ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error(DEVICE_RESPONSE_NOT_OK_UNEXPECTED_EXCEPTION, exception); result = ResponseMessageResultType.NOT_OK; } final AssociationLnListType associationLnListValueDomain = this.mapperFactory.getMapperFacade().map(resultData, AssociationLnListType.class); this.webServiceResponseMessageSender.send( ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception).withDataObject(associationLnListValueDomain) .withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(), deviceMessageMetadata.getMessageType()); }

Target:
public void handleGetAssocationLnObjectsResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception, final AssociationLnListTypeDto resultData) { ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error(DEVICE_RESPONSE_NOT_OK_UNEXPECTED_EXCEPTION, exception); result = ResponseMessageResultType.NOT_OK; } final AssociationLnListType associationLnListValueDomain = this.mapperFactory.getMapperFacade().map(resultData, AssociationLnListType.class); ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception).withDataObject(associationLnListValueDomain) .withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(); this.webServiceResponseMessageSender.send( responseMessage, deviceMessageMetadata.getMessageType()); }
Source:
private AutoStartVmToRestart.State processVmDown(AutoStartVmToRestart autoStartVmToRestart, int neededPriority, DateTime iterationStartTime) { Guid vmId = autoStartVmToRestart.getVmId(); VM vm = autoStartVmToRestart.getVm(); if (!isVmNeedsToBeAutoStarted(vm)) { return AutoStartVmToRestart.State.STARTING; } if (!autoStartVmToRestart.isTimeToRun(iterationStartTime)) { return AutoStartVmToRestart.State.DOWN; } if (considerPriority && autoStartVmToRestart.isBlockedOnPriority(neededPriority, iterationStartTime)) { log.debug("VM has lower priority than other VMs. The start will be delayed."); return AutoStartVmToRestart.State.DOWN; } if (isNextRunConfiguration(vmId)) { log.debug("NextRun config found for '{}' vm, the RunVm will be delayed", vm.getName()); if (autoStartVmToRestart.delayNextTimeToRun(iterationStartTime)) { return AutoStartVmToRestart.State.DOWN; } log.warn("Failed to wait for the NextRun config to be applied on vm '{}', trying to run the VM anyway", vm.getName()); } EngineLock runVmLock = createEngineLockForRunVm(vmId); if (!acquireLock(runVmLock)) { log.debug("Could not acquire lock for auto starting VM '{}'", vm.getName()); return AutoStartVmToRestart.State.DOWN; } if (!isVmNeedsToBeAutoStarted(vm)) { releaseLock(runVmLock); return AutoStartVmToRestart.State.STARTING; } if (runVmAndUpdateStatus(vm, runVmLock)) { return AutoStartVmToRestart.State.STARTING; } logFailedAttemptToRestartVm(vm); if (autoStartVmToRestart.scheduleNextTimeToRun(iterationStartTime)) { return AutoStartVmToRestart.State.DOWN; } logFailureToRestartVm(vm); return AutoStartVmToRestart.State.RUNNING; }

Target:
private AutoStartVmToRestart.State processVmDown(AutoStartVmToRestart autoStartVmToRestart, int neededPriority, DateTime iterationStartTime) { Guid vmId = autoStartVmToRestart.getVmId(); VM vm = autoStartVmToRestart.getVm(); if (!vmNeedsToBeAutoStarted(vm)) { return AutoStartVmToRestart.State.VM_STARTING; } if (!autoStartVmToRestart.isTimeToRun(iterationStartTime)) { return AutoStartVmToRestart.State.VM_DOWN; } if (considerPriority && autoStartVmToRestart.isBlockedOnPriority(neededPriority, iterationStartTime)) { log.debug("VM has lower priority than other VMs. The start will be delayed."); return AutoStartVmToRestart.State.VM_DOWN; } if (isNextRunConfiguration(vmId)) { log.debug("NextRun config found for '{}' vm, the RunVm will be delayed", vm.getName()); if (autoStartVmToRestart.delayNextTimeToRun(iterationStartTime)) { return AutoStartVmToRestart.State.VM_DOWN; } log.warn("Failed to wait for the NextRun config to be applied on vm '{}', trying to run the VM anyway", vm.getName()); } EngineLock runVmLock = createEngineLockForRunVm(vmId); if (!acquireLock(runVmLock)) { log.debug("Could not acquire lock for auto starting VM '{}'", vm.getName()); return AutoStartVmToRestart.State.VM_DOWN; } if (!vmNeedsToBeAutoStarted(vm)) { releaseLock(runVmLock); return AutoStartVmToRestart.State.VM_STARTING; } if (runVmAndUpdateStatus(vm, runVmLock)) { return AutoStartVmToRestart.State.VM_STARTING; } return scheduleNextTimeToStart(autoStartVmToRestart, iterationStartTime, vm); }
Source:
public final String getESResultJson(final String esQueryJson, final String url) { StringBuilder stringBuilder = new StringBuilder(); try { HttpClient httpClient = new DefaultHttpClient(); String encodedJson = URLEncoder.encode(esQueryJson, UTF_8); String esGetURL = url + encodedJson; HttpGet getRequest = new HttpGet(esGetURL); getRequest.setHeader(USER_AGENT, IDEA_PLUGIN); HttpResponse response = httpClient.execute(getRequest); if (response.getStatusLine().getStatusCode() != HTTP_OK_STATUS) { throw new RuntimeException(FAILED_HTTP_ERROR_CODE + response.getStatusLine().getStatusCode()); } BufferedReader bufferedReader = new BufferedReader( new InputStreamReader((response.getEntity().getContent()), UTF_8)); String output; while ((output = bufferedReader.readLine()) != null) { stringBuilder.append(output); } bufferedReader.close(); httpClient.getConnectionManager().shutdown(); } catch (IllegalStateException e) { e.printStackTrace(); return RefreshAction.EMPTY_ES_URL; } catch (MalformedURLException e) { e.printStackTrace(); return RefreshAction.EMPTY_ES_URL; } catch (IOException e) { e.printStackTrace(); return RefreshAction.EMPTY_ES_URL; } catch (IllegalArgumentException e) { e.printStackTrace(); return RefreshAction.EMPTY_ES_URL; } return stringBuilder.toString(); }

Target:
public final String getESResultJson(final String esQueryJson, final String url) { StringBuilder stringBuilder = new StringBuilder(); try { HttpClient httpClient = new DefaultHttpClient(); String encodedJson = URLEncoder.encode(esQueryJson, UTF_8); String esGetURL = url + encodedJson; HttpGet getRequest = new HttpGet(esGetURL); getRequest.setHeader(USER_AGENT, IDEA_PLUGIN); HttpResponse response = httpClient.execute(getRequest); if (response.getStatusLine().getStatusCode() != HTTP_OK_STATUS) { throw new RuntimeException(FAILED_HTTP_ERROR + response.getStatusLine().getStatusCode() + " " + response.getStatusLine().getReasonPhrase()); } BufferedReader bufferedReader = new BufferedReader( new InputStreamReader((response.getEntity().getContent()), UTF_8)); String output; while ((output = bufferedReader.readLine()) != null) { stringBuilder.append(output); } bufferedReader.close(); httpClient.getConnectionManager().shutdown(); } catch (IllegalStateException e) { e.printStackTrace(); return RefreshAction.EMPTY_ES_URL; } catch (MalformedURLException e) { e.printStackTrace(); return RefreshAction.EMPTY_ES_URL; } catch (IOException e) { e.printStackTrace(); return RefreshAction.EMPTY_ES_URL; } catch (IllegalArgumentException e) { e.printStackTrace(); return RefreshAction.EMPTY_ES_URL; } return stringBuilder.toString(); }
Source:
private static JsonParserIterator<SupervisorStatus> getSupervisors( DruidLeaderClient indexingServiceClient, ObjectMapper jsonMapper, BytesAccumulatingResponseHandler responseHandler ) { Request request; try { request = indexingServiceClient.makeRequest( HttpMethod.GET, StringUtils.format("/druid/indexer/v1/supervisor?fullStatus"), false ); } catch (IOException e) { throw new RuntimeException(e); } ListenableFuture<InputStream> future = indexingServiceClient.goAsync( request, responseHandler ); final JavaType typeRef = jsonMapper.getTypeFactory().constructType(new TypeReference<SupervisorStatus>() { }); return new JsonParserIterator<>( typeRef, future, request.getUrl().toString(), null, request.getUrl().getHost(), jsonMapper, responseHandler ); }

Target:
private static JsonParserIterator<SupervisorStatus> getSupervisors( DruidLeaderClient indexingServiceClient, ObjectMapper jsonMapper, BytesAccumulatingResponseHandler responseHandler ) { Request request; try { request = indexingServiceClient.makeRequest( HttpMethod.GET, "/druid/indexer/v1/supervisor?system", false ); } catch (IOException e) { throw new RuntimeException(e); } ListenableFuture<InputStream> future = indexingServiceClient.goAsync( request, responseHandler ); final JavaType typeRef = jsonMapper.getTypeFactory().constructType(new TypeReference<SupervisorStatus>() { }); return new JsonParserIterator<>( typeRef, future, request.getUrl().toString(), null, request.getUrl().getHost(), jsonMapper, responseHandler ); }
Source:
public @Nonnull Collection<V> values() { return mainMap.values() .stream() .collect(ImmutableList.toImmutableList()); }

Target:
public @Nonnull Collection<V> values() { return ImmutableList.copyOf(mainMap.values()); }
Source:
public void pass_the_null_tolerance_check() { final NullToleranceTest nullToleranceTest = NullToleranceTest.newBuilder() .setClass(Events.class) .addDefaultValue(newArrayList()) .addDefaultValue(stringValue.getClass()) .build(); final boolean passed = nullToleranceTest.check(); assertTrue(passed); }

Target:
public void pass_the_null_tolerance_check() { final NullToleranceTest nullToleranceTest = NullToleranceTest.newBuilder() .setClass(Events.class) .addDefaultValue(stringValue.getClass()) .build(); final boolean passed = nullToleranceTest.check(); assertTrue(passed); }
Source:
public void showEmptyCharges() { if (recyclerCount() == 0) { ll_error.setVisibility(View.VISIBLE); mNoChargesText.setText(getResources().getString(R.string.message_no_charges_available)); mNoChargesIcon.setImageResource(R.drawable.ic_assignment_turned_in_black_24dp); } }

Target:
public void showEmptyCharges() { if (mChargesNameListAdapter == null || mChargesNameListAdapter.getItemCount() == 0) { ll_error.setVisibility(View.VISIBLE); mNoChargesText.setText(getResources().getString(R.string.message_no_charges_available)); mNoChargesIcon.setImageResource(R.drawable.ic_assignment_turned_in_black_24dp); } }
Source:
public void shouldCheckRateLimitsWhenFilterIsInvoked() throws Exception { rateLimiterFilter.filter(mockContainerRequestContext); verify(rateLimiter).checkRateOf(any(), any(), any()); }

Target:
public void shouldCheckRateLimitsWhenFilterIsInvoked() throws Exception { when(mockContainerRequestContext.getHeaderString("Authorization")).thenReturn("apiKey"); when(mockContainerRequestContext.getMethod()).thenReturn("POST"); rateLimiterFilter.filter(mockContainerRequestContext); verify(rateLimiter).checkRateOf(ACCOUNT_ID, "POST-apiKey", "POST"); }
Source:
public void clearThreadLocalCache() { String canonicalPath = localRealm.get().getPath(); localCount.set(null); localRealm.set(null); globalCount--; if (globalCount < 0) { throw new IllegalStateException("Global reference counter of Realm" + canonicalPath + " got corrupted."); } }

Target:
public void clearThreadLocalCache() { String canonicalPath = localRealm.get().getPath(); localCount.set(null); localRealm.set(null); if (globalCount.decrementAndGet() < 0) { throw new IllegalStateException("Global reference counter of Realm" + canonicalPath + " can not be negative."); } }
Source:
public static List<HostAddress> parse(String spec, HaMode haMode) { if (spec == null) { throw new IllegalArgumentException("Invalid connection URL, host address must not be empty "); } if ("".equals(spec)) { return new ArrayList<>(0); } String[] tokens = spec.trim().split(","); List<HostAddress> arr = new ArrayList<>(tokens.length); if (haMode == HaMode.AURORA && System.getProperty("auroraFailoverTesting") == null) { Pattern clusterPattern = Pattern.compile("(.+)\\.cluster-([a-z0-9]+\\.[a-z0-9\\-]+\\.rds\\.amazonaws\\.com)"); Matcher matcher = clusterPattern.matcher(spec); if ((tokens.length > 1 || (tokens.length == 1 && !matcher.find()))) { throw new IllegalArgumentException("Invalid Aurora connection URL, address should correspond to cluster endpoint"); } } for (String token : tokens) { if (token.startsWith("address=")) { arr.add(parseParameterHostAddress(token)); } else { arr.add(parseSimpleHostAddress(token)); } } int defaultPort = arr.get(arr.size() - 1).port; if (defaultPort == 0) { defaultPort = 3306; } for (int i = 0; i < arr.size(); i++) { if (haMode == HaMode.REPLICATION) { if (i == 0 && arr.get(i).type == null) { arr.get(i).type = ParameterConstant.TYPE_MASTER; } else if (i != 0 && arr.get(i).type == null) { arr.get(i).type = ParameterConstant.TYPE_SLAVE; } } if (arr.get(i).port == 0) { arr.get(i).port = defaultPort; } } return arr; }

Target:
public static List<HostAddress> parse(String spec, HaMode haMode) { if (spec == null) { throw new IllegalArgumentException("Invalid connection URL, host address must not be empty "); } if ("".equals(spec)) { return new ArrayList<>(0); } String[] tokens = spec.trim().split(","); List<HostAddress> arr = new ArrayList<>(tokens.length); for (String token : tokens) { if (token.startsWith("address=")) { arr.add(parseParameterHostAddress(token)); } else { arr.add(parseSimpleHostAddress(token)); } } int defaultPort = arr.get(arr.size() - 1).port; if (defaultPort == 0) { defaultPort = 3306; } for (int i = 0; i < arr.size(); i++) { if (haMode == HaMode.REPLICATION) { if (i == 0 && arr.get(i).type == null) { arr.get(i).type = ParameterConstant.TYPE_MASTER; } else if (i != 0 && arr.get(i).type == null) { arr.get(i).type = ParameterConstant.TYPE_SLAVE; } } if (arr.get(i).port == 0) { arr.get(i).port = defaultPort; } } return arr; }
Source:
private void initPhotoPicker() { mPhotoPickerContainer = findViewById(R.id.photo_fragment_container); resizePhotoPicker(); MediaBrowserType mediaBrowserType = mShowAztecEditor ? MediaBrowserType.AZTEC_EDITOR_PICKER : MediaBrowserType.EDITOR_PICKER; mPhotoPickerFragment = (PhotoPickerFragment) getFragmentManager().findFragmentByTag(PHOTO_PICKER_TAG); if (mPhotoPickerFragment == null) { mPhotoPickerFragment = PhotoPickerFragment.newInstance(this, mediaBrowserType, getSite()); getFragmentManager() .beginTransaction() .add(R.id.photo_fragment_container, mPhotoPickerFragment, PHOTO_PICKER_TAG) .commit(); } }

Target:
private void initPhotoPicker() { mPhotoPickerContainer = findViewById(R.id.photo_fragment_container); resizePhotoPicker(); mPhotoPickerFragment = (PhotoPickerFragment) getFragmentManager().findFragmentByTag(PHOTO_PICKER_TAG); if (mPhotoPickerFragment == null) { MediaBrowserType mediaBrowserType = mShowAztecEditor ? MediaBrowserType.AZTEC_EDITOR_PICKER : MediaBrowserType.EDITOR_PICKER; mPhotoPickerFragment = PhotoPickerFragment.newInstance(this, mediaBrowserType, getSite()); getFragmentManager() .beginTransaction() .add(R.id.photo_fragment_container, mPhotoPickerFragment, PHOTO_PICKER_TAG) .commit(); } }
Source:
public PsiElement exposeByName(String name) { if (name == null) return null; if (hasWildcard()) { for (HaxeModel exposedMember : getExposedMembers()) { if (Objects.equals(exposedMember.getName(), name)) return exposedMember.getBasePsi(); } } else { if (getReferenceExpression() != null) { FullyQualifiedInfo qualifiedInfo = getQualifiedInfo(); if (equalsToAlias(name) || qualifiedInfo.equalsToNamedPart(name) || getExposedMember(name) != null) { HaxeModel result = getExposedMember(name); return result != null ? result.getBasePsi() : null; } } } return null; }

Target:
public PsiElement exposeByName(String name) { if (name == null) return null; if (hasWildcard()) { for (HaxeModel exposedMember : getExposedMembers()) { if (Objects.equals(exposedMember.getName(), name)) return exposedMember.getBasePsi(); } } else { if (getReferenceExpression() != null) { FullyQualifiedInfo qualifiedInfo = getQualifiedInfo(); HaxeModel member = getExposedMember(name); if (((equalsToAlias(name) || qualifiedInfo.equalsToNamedPart(name)) && member != null) || member != null) { return member.getBasePsi(); } } } return null; }
Source:
public PinotTableHandle getTableHandle(ConnectorSession session, SchemaTableName tableName) { if (!listSchemaNames(session).contains(tableName.getSchemaName().toLowerCase(ENGLISH))) { return null; } String pinotTableName; try { pinotTableName = getPinotTableNameFromPrestoTableName(tableName.getTableName()); PinotTable table = pinotPrestoConnection.getTable(pinotTableName); if (table == null) { return null; } } catch (Exception e) { throw new PrestoException( PINOT_FAILURE_GETTING_TABLE, String.format("Failed to get TableHandle for %s", tableName), e); } return new PinotTableHandle(connectorId, tableName.getSchemaName(), pinotTableName); }

Target:
public PinotTableHandle getTableHandle(ConnectorSession session, SchemaTableName tableName) { if (!listSchemaNames(session).contains(tableName.getSchemaName().toLowerCase(ENGLISH))) { return null; } String pinotTableName; try { pinotTableName = getPinotTableNameFromPrestoTableName(tableName.getTableName()); PinotTable table = pinotPrestoConnection.getTable(pinotTableName); if (table == null) { return null; } } catch (Exception e) { throw new PrestoException( PINOT_FAILURE_GETTING_TABLE, String.format("Failed to get TableHandle for %s", tableName), e); } return new PinotTableHandle(tableName.getSchemaName(), pinotTableName); }
Source:
protected MapSqlParameterSource createFullParametersMapper(HostDevice entity) { return createIdParameterMapper(entity.getId()) .addValue("parent_device_name", entity.getParentDeviceName()) .addValue("capability", entity.getCapability()) .addValue("iommu_group", entity.getIommuGroup()) .addValue("mdev_types", StringUtils.join(entity.getMdevTypes(), ",")) .addValue("product_name", entity.getProductName()) .addValue("product_id", entity.getProductId()) .addValue("vendor_name", entity.getVendorName()) .addValue("vendor_id", entity.getVendorId()) .addValue("physfn", entity.getParentPhysicalFunction()) .addValue("total_vfs", entity.getTotalVirtualFunctions()) .addValue("net_iface_name", entity.getNetworkInterfaceName()) .addValue("driver", entity.getDriver()) .addValue("is_assignable", entity.isAssignable()) .addValue("address", SerializationFactory.getSerializer().serialize(entity.getAddress())); }

Target:
protected MapSqlParameterSource createFullParametersMapper(HostDevice entity) { return createIdParameterMapper(entity.getId()) .addValue("parent_device_name", entity.getParentDeviceName()) .addValue("capability", entity.getCapability()) .addValue("iommu_group", entity.getIommuGroup()) .addValue("mdev_types", String.join(",", entity.getMdevTypes())) .addValue("product_name", entity.getProductName()) .addValue("product_id", entity.getProductId()) .addValue("vendor_name", entity.getVendorName()) .addValue("vendor_id", entity.getVendorId()) .addValue("physfn", entity.getParentPhysicalFunction()) .addValue("total_vfs", entity.getTotalVirtualFunctions()) .addValue("net_iface_name", entity.getNetworkInterfaceName()) .addValue("driver", entity.getDriver()) .addValue("is_assignable", entity.isAssignable()) .addValue("address", SerializationFactory.getSerializer().serialize(entity.getAddress())); }
Source:
private void doubleClickXY(int x, int y) { log.debug(MessageFormat.format("Double-clicking on {0}", widget)); notify(SWT.MouseEnter); notify(SWT.MouseMove); notify(SWT.Activate); notify(SWT.FocusIn); notify(SWT.MouseDown, createMouseEvent(x, y, 1, SWT.NONE, 1)); notify(SWT.MouseUp, createMouseEvent(x, y, 1, SWT.BUTTON1, 1)); notify(SWT.Selection, createSelectionEvent(SWT.BUTTON1)); notify(SWT.MouseDoubleClick, createMouseEvent(x, y, 1, SWT.BUTTON1, 2)); notify(SWT.DefaultSelection); notify(SWT.MouseHover); notify(SWT.MouseMove); notify(SWT.MouseExit); notify(SWT.Deactivate); notify(SWT.FocusOut); log.debug(MessageFormat.format("Double-clicked on {0}", widget)); }

Target:
protected void doubleClickXY(int x, int y) { log.debug(MessageFormat.format("Double-clicking on {0}", widget)); notify(SWT.MouseEnter); notify(SWT.MouseMove); notify(SWT.Activate); notify(SWT.FocusIn); notify(SWT.MouseDown, createMouseEvent(x, y, 1, SWT.NONE, 1)); notify(SWT.MouseUp, createMouseEvent(x, y, 1, SWT.BUTTON1, 1)); notify(SWT.Selection, createSelectionEvent(SWT.BUTTON1)); notify(SWT.MouseDoubleClick, createMouseEvent(x, y, 1, SWT.BUTTON1, 2)); notify(SWT.DefaultSelection); notify(SWT.MouseHover); notify(SWT.MouseMove); notify(SWT.MouseExit); notify(SWT.Deactivate); notify(SWT.FocusOut); log.debug(MessageFormat.format("Double-clicked on {0}", widget)); }
Source:
public void testFindStorageDomainForMemoryWithEmptyDomainsList() { verifyNoDomainForMemory(new ArrayList<StorageDomain>()); }

Target:
public void testFindStorageDomainForMemoryWithEmptyDomainsList() { verifyNoDomainForMemory(Collections.<StorageDomain>emptyList()); }
Source:
public void runsOneIterationIfRequested() { SweepResults resultsWithMoreToSweep = SweepResults.createEmptySweepResult(Optional.of(new byte[] {0x55})); setupTaskRunner(resultsWithMoreToSweep); sweeperService.sweepTable(TABLE_REF.getQualifiedName(), Optional.empty(), Optional.of(false), Optional.empty(), Optional.empty(), Optional.empty()); verify(sweepTaskRunner, times(1)).run(any(), any(), any()); verifyNoMoreInteractions(sweepTaskRunner); }

Target:
public void runsOneIterationIfRequested() { setupTaskRunner(RESULTS_WITH_MORE_TO_SWEEP); sweeperService.sweepTable(TABLE_REF.getQualifiedName(), Optional.empty(), Optional.of(false), Optional.empty(), Optional.empty(), Optional.empty()); verify(sweepTaskRunner, times(1)).run(any(), any(), any()); verifyNoMoreInteractions(sweepTaskRunner); }
Source:
public void testDeserialize() throws Exception { String data = getFixture("/v1/accounts/acct_123"); Account resource = APIResource.GSON.fromJson(data, Account.class); assertNotNull(resource); assertNotNull(resource.getId()); }

Target:
public void testDeserialize() throws Exception { final String data = getFixture("/v1/accounts/acct_123"); final Account resource = APIResource.GSON.fromJson(data, Account.class); assertNotNull(resource); assertNotNull(resource.getId()); }
Source:
private void processDiscriminator(String discriminator, Map<String, Property> properties, String file) { for (Map.Entry<String, Property> prop : properties.entrySet()) { if (prop.getKey().equals(discriminator)){ if (prop.getValue() instanceof StringProperty){ StringProperty stringProperty = (StringProperty) prop.getValue(); if(stringProperty.getEnum() != null){ for(String name: stringProperty.getEnum()){ processRefProperty(new RefProperty(RefType.DEFINITION.getInternalPrefix()+name), file); } } }else if (prop.getValue() instanceof RefProperty) { String ref = ((RefProperty) prop.getValue()).getSimpleRef(); Object resolved = swagger.getDefinitions().get(ref); if (resolved instanceof ModelImpl) { ModelImpl schema = (ModelImpl) resolved; if (schema.getEnum() != null) { for (String name : schema.getEnum()) { processRefProperty(new RefProperty(RefType.DEFINITION.getInternalPrefix() + name), file); } } } } } } }

Target:
private void processDiscriminator(String discriminator, Map<String, Property> properties, String file) { for (Map.Entry<String, Property> prop : properties.entrySet()) { if (prop.getKey().equals(discriminator)){ if (prop.getValue() instanceof StringProperty){ StringProperty stringProperty = (StringProperty) prop.getValue(); if(stringProperty.getEnum() != null){ for(String name: stringProperty.getEnum()){ processRefProperty(new RefProperty(RefType.DEFINITION.getInternalPrefix()+name), file); } } }else if (prop.getValue() instanceof RefProperty) { String ref = ((RefProperty) prop.getValue()).getSimpleRef(); Map<String, String> renameCache = cache.getRenameCache(); for (String key : renameCache.keySet()) { String value = renameCache.get(key); if (value.equals(ref)) { Object resolved = cache.getResolutionCache().get(key); if(resolved != null) { if (resolved instanceof ModelImpl) { ModelImpl schema = (ModelImpl) resolved; if (schema.getEnum() != null) { for (String name : schema.getEnum()) { processRefProperty(new RefProperty(RefType.DEFINITION.getInternalPrefix() + name), file); } } } } } } } } } }
Source:
public Iterable<StreamInputReader> getStreamInputReaders() { return fStreamInputReaders; }

Target:
public Iterable<IDeclarationProvider> getStreamInputReaders() { return new LinkedList<IDeclarationProvider>(fStreamInputReaders); }
Source:
private void populateChangeRow(final int row, final ChangeInfo c, final ChangeRowFormatter changeRowFormatter) { ChangeCache cache = ChangeCache.get(c.getId()); cache.getChangeInfoCache().set(c); table.setWidget(row, C_ARROW, null); if (Gerrit.isSignedIn()) { table.setWidget(row, C_STAR, StarredChanges.createIcon(c.getId(), c.isStarred())); } String s = Util.cropSubject(c.getSubject()); if (c.getStatus() != null && c.getStatus() != Change.Status.NEW) { s += " (" + c.getStatus().name() + ")"; } if (changeRowFormatter != null) { removeChangeStyle(row, changeRowFormatter); final String rowStyle = changeRowFormatter.getRowStyle(c); if (rowStyle != null) { table.getRowFormatter().addStyleName(row, rowStyle); } s = changeRowFormatter.getDisplayText(c, s); } table.setWidget(row, C_SUBJECT, new TableChangeLink(s, c)); table.setWidget(row, C_OWNER, link(c.getOwner())); table.setWidget(row, C_PROJECT, new ProjectLink(c.getProject().getKey(), c .getStatus())); table.setWidget(row, C_BRANCH, new BranchLink(c.getProject().getKey(), c .getStatus(), c.getBranch(), c.getTopic())); String lastUpdate = shortFormat(c.getLastUpdatedOn()); if (showPatchsetLevel) { lastUpdate = "PS-" + c.getPatchSetId().toString() + " " + lastUpdate; } table.setText(row, C_LAST_UPDATE, lastUpdate); setRowItem(row, c); }

Target:
private void populateChangeRow(final int row, final ChangeInfo c, final ChangeRowFormatter changeRowFormatter) { ChangeCache cache = ChangeCache.get(c.getId()); cache.getChangeInfoCache().set(c); table.setWidget(row, C_ARROW, null); if (Gerrit.isSignedIn()) { table.setWidget(row, C_STAR, StarredChanges.createIcon(c.getId(), c.isStarred())); } String s = Util.cropSubject(c.getSubject()); if (c.getStatus() != null && c.getStatus() != Change.Status.NEW) { s += " (" + c.getStatus().name() + ")"; } if (changeRowFormatter != null) { removeChangeStyle(row, changeRowFormatter); final String rowStyle = changeRowFormatter.getRowStyle(c); if (rowStyle != null) { table.getRowFormatter().addStyleName(row, rowStyle); } s = changeRowFormatter.getDisplayText(c, s); } table.setWidget(row, C_SUBJECT, new TableChangeLink(s, c)); table.setWidget(row, C_OWNER, link(c.getOwner())); table.setWidget(row, C_PROJECT, new ProjectLink(c.getProject().getKey(), c .getStatus())); table.setWidget(row, C_BRANCH, new BranchLink(c.getProject().getKey(), c .getStatus(), c.getBranch(), c.getTopic())); table.setText(row, C_PATCHSET_NUM, String.format("%d", c.getPatchSetId().get())); table.setText(row, C_LAST_UPDATE, shortFormat(c.getLastUpdatedOn())); setRowItem(row, c); }
Source:
private void publish(TimeAlert alert) { ScalingEvent event = new ScalingEvent(alert); int hostGroupNodeCount = getHostGroupNodeCount(alert.getCluster(), alert.getScalingPolicy()); int desiredNodeCount = scalingPolicyTargetCalculator.getDesiredNodeCount(event, hostGroupNodeCount); int targetNodeCount = desiredNodeCount - hostGroupNodeCount; event.setHostGroupNodeCount(hostGroupNodeCount); event.setDesiredHostGroupNodeCount(desiredNodeCount); if (targetNodeCount < 0) { populateDecommissionCandidates(event, alert.getCluster(), alert.getScalingPolicy(), -targetNodeCount); } eventPublisher.publishEvent(event); LOGGER.debug("Time alert '{}' triggered for cluster '{}'", alert.getName(), alert.getCluster().getStackCrn()); }

Target:
private void publish(TimeAlert alert) { ScalingEvent event = new ScalingEvent(alert); StackV4Response stackV4Response = cloudbreakCommunicator.getByCrn(alert.getCluster().getStackCrn()); int hostGroupNodeCount = stackResponseUtils.getNodeCountForHostGroup(stackV4Response, alert.getScalingPolicy().getHostGroup()); int desiredAbsoluteNodeCount = scalingPolicyTargetCalculator.getDesiredAbsoluteNodeCount(event, hostGroupNodeCount); int targetIncrementNodeCount = desiredAbsoluteNodeCount - hostGroupNodeCount; event.setHostGroupNodeCount(hostGroupNodeCount); event.setDesiredAbsoluteHostGroupNodeCount(desiredAbsoluteNodeCount); if (targetIncrementNodeCount < 0) { populateDecommissionCandidates(event, stackV4Response, alert.getCluster(), alert.getScalingPolicy(), -targetIncrementNodeCount); } eventPublisher.publishEvent(event); LOGGER.debug("Time alert '{}' triggered for cluster '{}'", alert.getName(), alert.getCluster().getStackCrn()); }
Source:
public static JButton createExtendSimulationButton(final MCMCWrapper model) { JButton button = new JButton(Main.IMAGELOADER.getIcon(FileNames.ICON_RESTART)); button.setEnabled(false); button.setText("No, extend"); button.setToolTipText("Extend the simulation"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ((MixedTreatmentComparison) getMTCModel(model.getModel())).setExtendSimulation(ExtendSimulation.EXTEND); } }); return button; }

Target:
public static JButton createExtendSimulationButton(final MCMCWrapper model) { JButton button = new JButton(Main.IMAGELOADER.getIcon(FileNames.ICON_RESTART)); button.setText("No, extend"); button.setToolTipText("Extend the simulation"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ((MixedTreatmentComparison) ((MixedTreatmentComparison)model.getModel())).setExtendSimulation(ExtendSimulation.EXTEND); } }); return button; }
Source:
public void testStateHolderFailureRereadBehavior() throws ClassNotFoundException { StateHolder<Integer, ObjectStreamClass> stateHolder = spy(new TransientStateHolder<>()); StateRepository stateRepository = mock(StateRepository.class); when(stateRepository.getPersistentStateHolder(eq("CompactJavaSerializer-ObjectStreamClassIndex"), eq(Integer.class), eq(ObjectStreamClass.class), any(), any())).thenReturn(stateHolder); AtomicBoolean failing = new AtomicBoolean(); Answer<Object> optionalFailure = invocation -> { try { return invocation.callRealMethod(); } finally { if (failing.get()) { throw new RuntimeException(); } } }; doAnswer(optionalFailure).when(stateHolder).entrySet(); doAnswer(optionalFailure).when(stateHolder).get(any()); doAnswer(optionalFailure).when(stateHolder).putIfAbsent(any(), any()); CompactJavaSerializer<Object> serializerA = new CompactJavaSerializer<>(getClass().getClassLoader()); serializerA.init(stateRepository); Date object = new Date(); failing.set(true); try { serializerA.serialize(object); fail("Expected RuntimeException"); } catch (RuntimeException e) { } failing.set(false); ByteBuffer serialized = serializerA.serialize(object); assertThat(serializerA.read(serialized), is(object)); assertThat(stateHolder.entrySet(), hasSize(1)); CompactJavaSerializer serializerB = new CompactJavaSerializer(getClass().getClassLoader()); serializerB.init(stateRepository); assertThat(serializerB.read(serialized), is(object)); }

Target:
public void testStateHolderFailureRereadBehavior() throws ClassNotFoundException { StateHolder<Integer, ObjectStreamClass> stateMap = spy(new TransientStateHolder<>()); StateRepository stateRepository = mock(StateRepository.class); when(stateRepository.getPersistentStateHolder(eq("CompactJavaSerializer-ObjectStreamClassIndex"), eq(Integer.class), eq(ObjectStreamClass.class), any(), any())).thenReturn(stateMap); AtomicBoolean failing = new AtomicBoolean(); Answer<Object> optionalFailure = invocation -> { try { return invocation.callRealMethod(); } finally { if (failing.get()) { throw new RuntimeException(); } } }; doAnswer(optionalFailure).when(stateMap).entrySet(); doAnswer(optionalFailure).when(stateMap).get(any()); doAnswer(optionalFailure).when(stateMap).putIfAbsent(any(), any()); CompactJavaSerializer<Date> serializerA = new CompactJavaSerializer<Date>(getClass().getClassLoader()); serializerA.init(stateRepository); Date object = new Date(); failing.set(true); try { serializerA.serialize(object); fail("Expected RuntimeException"); } catch (RuntimeException e) { } failing.set(false); ByteBuffer serialized = serializerA.serialize(object); assertThat(serializerA.read(serialized), is(object)); assertThat(stateMap.entrySet(), hasSize(1)); CompactJavaSerializer<Date> serializerB = new CompactJavaSerializer<Date>(getClass().getClassLoader()); serializerB.init(stateRepository); assertThat(serializerB.read(serialized), is(object)); }
Source:
public ScheduledExecutorService resolveScheduledExecutorService() { return resolveSchedulerBean(ScheduledExecutorService.class); }

Target:
ScheduledExecutorService resolveScheduledExecutorService() { return resolveSchedulerBean(ScheduledExecutorService.class); }
Source:
public RankedAdapterFactoryDescriptor.Registry createFilteredAdapterFactoryRegistry() { String disabledAdapterFactoriesString = getEMFComparePreferences().get( EMFComparePreferences.DISABLED_ADAPTER_FACTORY, ""); final List<String> disabledAdapterFactories = Lists.newArrayList(disabledAdapterFactoriesString .split(";")); Multimap<Collection<?>, RankedAdapterFactoryDescriptor> filteredRegistry = Multimaps .unmodifiableListMultimap(ArrayListMultimap.create(Multimaps.filterValues( adapterFactoryRegistry, new Predicate<RankedAdapterFactoryDescriptor>() { public boolean apply(RankedAdapterFactoryDescriptor input) { return !disabledAdapterFactories.contains(input.getId()); } }))); return new RankedAdapterFactoryDescriptorRegistryImpl( ComposedAdapterFactory.Descriptor.Registry.INSTANCE, filteredRegistry); }

Target:
public RankedAdapterFactoryDescriptor.Registry createFilteredAdapterFactoryRegistry() { String disabledAdapterFactoriesString = getEMFComparePreferences().get( EMFComparePreferences.DISABLED_ADAPTER_FACTORY, ""); final List<String> disabledAdapterFactories = Lists.newArrayList(disabledAdapterFactoriesString .split(";")); Multimap<Collection<?>, RankedAdapterFactoryDescriptor> filteredRegistry = ImmutableListMultimap .copyOf(Multimaps.filterValues(adapterFactoryRegistry, new Predicate<RankedAdapterFactoryDescriptor>() { public boolean apply(RankedAdapterFactoryDescriptor input) { return !disabledAdapterFactories.contains(input.getId()); } })); return new RankedAdapterFactoryDescriptorRegistryImpl( ComposedAdapterFactory.Descriptor.Registry.INSTANCE, filteredRegistry); }
Source:
HighlightField highlight() throws IOException { if (shouldSkip()) { return null; } ensureWeigher(); scoreMatters = context.field.fieldOptions().scoreOrdered(); if (!scoreMatters) { Boolean topScoring = (Boolean) getOption("top_scoring"); scoreMatters = topScoring != null && topScoring; } defaultField = new FieldWrapper(this, context, weigher); int numberOfSnippets = context.field.fieldOptions().numberOfFragments(); if (numberOfSnippets == 0) { numberOfSnippets = 1; } segmenter = new DelayedSegmenter(defaultField); HitEnum hitEnum = buildHitEnum(); if(log.isTraceEnabled()) { GraphvizHitEnumGenerator visContext = new GraphvizHitEnumGenerator(hitEnum); GraphvizTermHitEnumWriters.register(visContext, weigher.termInfos()); log.trace("HitEnum Graph : \n{}", visContext.generateGraph()); } List<Snippet> snippets = buildChooser().choose(segmenter, hitEnum, numberOfSnippets); if (snippets.size() != 0) { cache.lastMatched = true; return new HighlightField(context.fieldName, formatSnippets(snippets)); } cache.lastMatched = false; int noMatchSize = context.field.fieldOptions().noMatchSize(); if (noMatchSize <= 0) { return null; } List<String> fieldValues = defaultField.getFieldValues(); if (fieldValues.isEmpty()) { return null; } Text fragment = new StringText(getSegmenterFactory() .extractNoMatchFragment(fieldValues.get(0), noMatchSize)); return new HighlightField(context.fieldName, new Text[] {fragment}); }

Target:
HighlightField highlight() throws IOException { if (shouldSkip()) { return null; } ensureWeigher(); scoreMatters = context.field.fieldOptions().scoreOrdered(); if (!scoreMatters) { Boolean topScoring = (Boolean) getOption("top_scoring"); scoreMatters = topScoring != null && topScoring; } defaultField = new FieldWrapper(this, context, weigher); int numberOfSnippets = context.field.fieldOptions().numberOfFragments(); if (numberOfSnippets == 0) { numberOfSnippets = 1; } segmenter = new DelayedSegmenter(defaultField); List<Snippet> snippets = buildChooser().choose(segmenter, buildHitEnum(), numberOfSnippets); if (snippets.size() != 0) { cache.lastMatched = true; return new HighlightField(context.fieldName, formatSnippets(snippets)); } cache.lastMatched = false; int noMatchSize = context.field.fieldOptions().noMatchSize(); if (noMatchSize <= 0) { return null; } List<String> fieldValues = defaultField.getFieldValues(); if (fieldValues.isEmpty()) { return null; } Text fragment = new StringText(getSegmenterFactory() .extractNoMatchFragment(fieldValues.get(0), noMatchSize)); return new HighlightField(context.fieldName, new Text[] {fragment}); }
Source:
protected SiteMap processText(URL sitemapUrl, InputStream stream) throws IOException { LOG.debug("Processing textual Sitemap"); SiteMap textSiteMap = new SiteMap(sitemapUrl); textSiteMap.setType(SitemapType.TEXT); BOMInputStream bomIs = new BOMInputStream(stream); @SuppressWarnings("resource") BufferedReader reader = new BufferedReader(new InputStreamReader(bomIs, UTF_8)); String line; int i = 0; while ((line = reader.readLine()) != null && ++i <= MAX_URLS) { line = line.trim(); if (line.isEmpty()) continue; try { URL url = new URL(line); boolean valid = urlIsValid(textSiteMap.getBaseUrl(), url.toString()); if (valid || !strict) { SiteMapURL sUrl = new SiteMapURL(url, valid); textSiteMap.addSiteMapUrl(sUrl); LOG.debug(" {}. {}", i, sUrl); } else { LOG.debug("URL: is excluded from the sitemap as it is not a valid url = not under the base url: {}", url.toExternalForm(), textSiteMap.getBaseUrl()); } } catch (MalformedURLException e) { LOG.debug("Bad url: [{}]", line.substring(0, Math.min(1024, line.length()))); } } textSiteMap.setProcessed(true); return textSiteMap; }

Target:
protected SiteMap processText(URL sitemapUrl, InputStream stream) throws IOException { LOG.debug("Processing textual Sitemap"); SiteMap textSiteMap = new SiteMap(sitemapUrl); textSiteMap.setType(SitemapType.TEXT); BOMInputStream bomIs = new BOMInputStream(stream); @SuppressWarnings("resource") BufferedReader reader = new BufferedReader(new InputStreamReader(bomIs, UTF_8)); String line; int i = 0; while ((line = reader.readLine()) != null && ++i <= MAX_URLS) { line = line.trim(); if (line.isEmpty()) { continue; } try { URL url = new URL(line); boolean valid = urlIsValid(textSiteMap.getBaseUrl(), url.toString()); if (valid || !strict) { SiteMapURL sUrl = new SiteMapURL(url, valid); textSiteMap.addSiteMapUrl(sUrl); LOG.debug(" {}. {}", i, sUrl); } else { LOG.debug("URL: is excluded from the sitemap as it is not a valid url = not under the base url: {}", url.toExternalForm(), textSiteMap.getBaseUrl()); } } catch (MalformedURLException e) { LOG.debug("Bad url: [{}]", line.substring(0, Math.min(1024, line.length()))); } } textSiteMap.setProcessed(true); return textSiteMap; }
Source:
private static Stream<Tuple2<Long, Long>> primeFactorsAndResultingValTail(Tuple2<Long, Long> previousFactorAndResultingVal) { return Match .when(1L, p -> Stream.<Tuple2<Long, Long>>nil()) .otherwise(() -> { final long nextPrimeFactor = knownPrimes.filter(p -> previousFactorAndResultingVal._2 % p == 0).take(1).head(); return Stream.build( new Tuple2<>(nextPrimeFactor, previousFactorAndResultingVal._2 / nextPrimeFactor), ProjectEulerTest::primeFactorsAndResultingValTail); }) .apply(previousFactorAndResultingVal._2); }

Target:
private static Stream<Tuple2<Long, Long>> primeFactorsAndResultingValTail(Tuple2<Long, Long> previousFactorAndResultingVal) { return Match .when(1L, p -> Stream.<Tuple2<Long, Long>>nil()) .otherwise(() -> { final long nextPrimeFactor = knownPrimes.filter(p -> previousFactorAndResultingVal._2 % p == 0).take(1).head(); final Tuple2<Long, Long> head = new Tuple2<>(nextPrimeFactor, previousFactorAndResultingVal._2 / nextPrimeFactor); return Stream.gen(head, () -> primeFactorsAndResultingValTail(head)); }) .apply(previousFactorAndResultingVal._2); }
Source:
public void setWorkflowGroup(Context context, Collection collection, int step, Group group) throws SQLException, AuthorizeException { Workflow workflow = null; try { workflow = workflowFactory.getWorkflow(collection); } catch (IOException | WorkflowConfigurationException e) { log.error(LogManager.getHeader(context, "setWorkflowGroup", "collection_id=" + collection.getID() + " " + e.getMessage()), e); } if (!StringUtils.equals("default", workflow.getID())) { throw new IllegalArgumentException( "setWorkflowGroup can be used only on collection with the default basic dspace workflow. " + "Instead, the collection: " + collection.getID() + " has the workflow: " + workflow.getID()); } String roleId; switch (step) { case 1: roleId = "reviewer"; break; case 2: roleId = "editor"; break; case 3: roleId = "finaleditor"; break; default: throw new IllegalArgumentException("Illegal step count: " + step); } CollectionRole colRole = collectionRoleService.find(context, collection, roleId); if (colRole == null) { if (group != null) { colRole = collectionRoleService.create(context, collection, roleId, group); } } else { if (group != null) { colRole.setGroup(group); collectionRoleService.update(context, colRole); } else { collectionRoleService.delete(context, colRole); } } collection.setModified(); }

Target:
public void setWorkflowGroup(Context context, Collection collection, int step, Group group) throws SQLException, AuthorizeException { Workflow workflow = null; try { workflow = workflowFactory.getWorkflow(collection); } catch (IOException | WorkflowConfigurationException e) { log.error(LogManager.getHeader(context, "setWorkflowGroup", "collection_id=" + collection.getID() + " " + e.getMessage()), e); } if (!StringUtils.equals(XmlWorkflowFactory.LEGACY_WORKFLOW_NAME, workflow.getID())) { throw new IllegalArgumentException( "setWorkflowGroup can be used only on collection with the default basic dspace workflow. " + "Instead, the collection: " + collection.getID() + " has the workflow: " + workflow.getID()); } String roleId; switch (step) { case 1: roleId = CollectionRoleService.LEGACY_WORKFLOW_STEP1_NAME; break; case 2: roleId = CollectionRoleService.LEGACY_WORKFLOW_STEP2_NAME; break; case 3: roleId = CollectionRoleService.LEGACY_WORKFLOW_STEP3_NAME; break; default: throw new IllegalArgumentException("Illegal step count: " + step); } CollectionRole colRole = collectionRoleService.find(context, collection, roleId); if (colRole == null) { if (group != null) { colRole = collectionRoleService.create(context, collection, roleId, group); } } else { if (group != null) { colRole.setGroup(group); collectionRoleService.update(context, colRole); } else { collectionRoleService.delete(context, colRole); } } collection.setModified(); }
Source:
public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { AccessGroupSet principals = getAgentPrincipals().getPrincipals(); if (globalPermissionEvaluator.hasGlobalPermission(principals, Permission.reindex)) { throw new ResourceNotFoundException(); } try { LookupMappingsSettings.updateMappings(); } catch (Exception e) { response.getWriter().append("Failed to refresh mappings, check logs."); LOG.error("Failed to refresh mappings", e); } try { xslViewResolver.refreshViews(); } catch (Exception e) { response.getWriter().append("Failed to refresh transform mappings, check logs."); LOG.error("Failed to refresh transform mappings", e); } headerMenuSettings.init(); response.getWriter().append("Mappings refresh was successful."); }

Target:
public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { AccessGroupSet principals = getAgentPrincipals().getPrincipals(); if (!globalPermissionEvaluator.hasGlobalPermission(principals, Permission.reindex)) { throw new ResourceNotFoundException(); } try { LookupMappingsSettings.updateMappings(); } catch (Exception e) { response.getWriter().append("Failed to refresh mappings, check logs."); LOG.error("Failed to refresh mappings", e); } try { xslViewResolver.refreshViews(); } catch (Exception e) { response.getWriter().append("Failed to refresh transform mappings, check logs."); LOG.error("Failed to refresh transform mappings", e); } headerMenuSettings.init(); response.getWriter().append("Mappings refresh was successful."); }