auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void process(Exchange exchange) throws Exception { Model model = exchange.getContext().getRegistry().lookupByNameAndType(modelName, Model.class); Translator translator = exchange.getContext().getRegistry().lookupByNameAndType(translatorName, Translator.class); if (exchange.getIn().getBody() instanceof byte[]) { byte[] bytes = exchange.getIn().getBody(byte[].class); Map<String, Float> result = classify(model, translator, new ByteArrayInputStream(bytes)); exchange.getIn().setBody(result); } else if (exchange.getIn().getBody() instanceof File) { Map<String, Float> result = classify(model, translator, exchange.getIn().getBody(File.class)); exchange.getIn().setBody(result); } else if (exchange.getIn().getBody() instanceof InputStream) { Map<String, Float> result = classify(model, translator, exchange.getIn().getBody(InputStream.class)); exchange.getIn().setBody(result); } }

Target:
public void process(Exchange exchange) throws Exception { Model model = exchange.getContext().getRegistry().lookupByNameAndType(modelName, Model.class); Translator translator = exchange.getContext().getRegistry().lookupByNameAndType(translatorName, Translator.class); if (exchange.getIn().getBody() instanceof byte[]) { byte[] bytes = exchange.getIn().getBody(byte[].class); Map<String, Float> result = classify(model, translator, new ByteArrayInputStream(bytes)); exchange.getIn().setBody(result); } else if (exchange.getIn().getBody() instanceof File) { Map<String, Float> result = classify(model, translator, exchange.getIn().getBody(File.class)); exchange.getIn().setBody(result); } else if (exchange.getIn().getBody() instanceof InputStream) { Map<String, Float> result = classify(model, translator, exchange.getIn().getBody(InputStream.class)); exchange.getIn().setBody(result); } else { throw new RuntimeException("Data type is not supported. Body should be byte[], InputStream or File"); } }
Source:
public Set<Event> getEvents(@Parameter(hidden = true) @ApiParam(hidden = true) @Auth User user, @QueryParam("event_search_type") EventSearchType eventSearchType, @Min(1) @Max(MAX_LIMIT) @DefaultValue(PAGINATION_DEFAULT_STRING) @ApiParam(defaultValue = PAGINATION_DEFAULT_STRING, allowableValues = PAGINATION_RANGE) @Parameter(schema = @Schema(maximum = "100", minimum = "1")) @QueryParam("limit") int limit, @QueryParam("offset") @DefaultValue("0") Integer offset) { User userWithSession = this.userDAO.findById(user.getId()); Set<Event> events = new HashSet<>(); switch (eventSearchType) { case STARRED_ENTRIES: Set<Long> entryIDs = userWithSession.getStarredEntries().stream().map(Entry::getId).collect(Collectors.toSet()); events.addAll(this.eventDAO.findEventsByEntryIDs(entryIDs, offset, limit)); return events; case STARRED_ORGANIZATION: Set<Long> organizationIDs = userWithSession.getStarredOrganizations().stream().map(Organization::getId).collect(Collectors.toSet()); events.addAll(this.eventDAO.findAllByOrganizationIds(organizationIDs, offset, limit)); return events; case ALL_STARRED: Set<Long> organizationIDs2 = userWithSession.getStarredOrganizations().stream().map(Organization::getId).collect(Collectors.toSet()); Set<Long> entryIDs2 = userWithSession.getStarredEntries().stream().map(Entry::getId).collect(Collectors.toSet()); events.addAll(this.eventDAO.findAllByOrganizationIdsOrEntryIds(organizationIDs2, entryIDs2, offset, limit)); return events; default: return Collections.emptySet(); } }

Target:
public List<Event> getEvents(@Parameter(hidden = true) @ApiParam(hidden = true) @Auth User user, @QueryParam("event_search_type") EventSearchType eventSearchType, @Min(1) @Max(MAX_LIMIT) @DefaultValue(PAGINATION_DEFAULT_STRING) @ApiParam(defaultValue = PAGINATION_DEFAULT_STRING, allowableValues = PAGINATION_RANGE) @Parameter(schema = @Schema(maximum = "100", minimum = "1")) @QueryParam("limit") int limit, @QueryParam("offset") @DefaultValue("0") Integer offset) { User userWithSession = this.userDAO.findById(user.getId()); switch (eventSearchType) { case STARRED_ENTRIES: Set<Long> entryIDs = userWithSession.getStarredEntries().stream().map(Entry::getId).collect(Collectors.toSet()); return this.eventDAO.findEventsByEntryIDs(entryIDs, offset, limit); case STARRED_ORGANIZATION: Set<Long> organizationIDs = userWithSession.getStarredOrganizations().stream().map(Organization::getId).collect(Collectors.toSet()); return this.eventDAO.findAllByOrganizationIds(organizationIDs, offset, limit); case ALL_STARRED: Set<Long> organizationIDs2 = userWithSession.getStarredOrganizations().stream().map(Organization::getId).collect(Collectors.toSet()); Set<Long> entryIDs2 = userWithSession.getStarredEntries().stream().map(Entry::getId).collect(Collectors.toSet()); return this.eventDAO.findAllByOrganizationIdsOrEntryIds(organizationIDs2, entryIDs2, offset, limit); default: return Collections.emptyList(); } }
Source:
private XGyro getBrokenGyro() { MockGyro brokenGyro = new MockGyro(new MockRobotIO()); brokenGyro.setIsBroken(true); return brokenGyro; }

Target:
private XGyro getBrokenGyro() { MockGyro brokenGyro = new MockGyro(new MockRobotIO(), true); return brokenGyro; }
Source:
public void showProgress(int message) { FragmentBase fragment = (CheckPhoneNumberFragment) getSupportFragmentManager().findFragmentByTag(CheckPhoneNumberFragment.TAG); if (fragment == null || fragment.getView() == null) { fragment = (SubmitConfirmationCodeFragment) getSupportFragmentManager().findFragmentByTag(SubmitConfirmationCodeFragment.TAG); } if (fragment == null || fragment.getView() == null) { throw new IllegalStateException("No fragments added"); } else { fragment.showProgress(message); } }

Target:
public void showProgress(int message) { getActiveFragment().showProgress(message); }
Source:
public void testNewInstanceForNonDefaultConstructor() { Object x = ReflectionUtils.newInstance( NoDefaultCtor.class, null, new Class[] {int.class}, 1); Assert.assertTrue(x instanceof NoDefaultCtor); }

Target:
public void testNewInstanceForNonDefaultConstructor() { Object x = ReflectionUtils.newInstance( NoDefaultCtor.class, null, new Class[] {int.class}, 1); assertTrue(x instanceof NoDefaultCtor); }
Source:
public long getAsLong() { TimestampService timestampServiceForThisCall = timestampService; if (timestampServiceForThisCall == null) { throwNotInitializedException(); } return timestampServiceForThisCall.getFreshTimestamp(); }

Target:
public long getAsLong() { if (timestampService == null) { throwNotInitializedException(); } return timestampService.getFreshTimestamp(); }
Source:
public void setUp() throws IOException, YarnException { conf = new YarnConfiguration(); conf.set(YarnConfiguration.CLIENT_FAILOVER_PROXY_PROVIDER, ConfiguredRMFailoverProxyProvider.class.getName()); conf.set(YarnConfiguration.RM_HA_ENABLED, "true"); }

Target:
public void setUp() throws IOException, YarnException { conf = new YarnConfiguration(); conf.setClass(YarnConfiguration.CLIENT_FAILOVER_NO_HA_PROXY_PROVIDER, ConfiguredRMFailoverProxyProvider.class, RMFailoverProxyProvider.class); conf.setBoolean(YarnConfiguration.RM_HA_ENABLED, true); }
Source:
static List<String> restoreFromPreferences(Repository repo, String branch) { String key = getPreferenceKey(repo, branch); String value = Activator.getDefault().getPreferenceStore() .getString(key); if (value.length() == 0) return Collections.emptyList(); XMLMemento memento; try { memento = XMLMemento.createReadRoot(new StringReader(value)); } catch (WorkbenchException e) { Activator.logError("Error reading branch-project associations", e); return Collections.<String> emptyList(); } IMemento[] children = memento.getChildren(KEY_PROJECT); if (children.length == 0) return Collections.<String> emptyList(); List<String> projectPaths = Stream.of(children) .map(child -> child.getTextData()) .filter(x -> !StringUtils.isEmptyOrNull(x)) .collect(Collectors.toList()); return projectPaths; }

Target:
static List<String> restoreFromPreferences(Repository repo, String branch) { String key = getPreferenceKey(repo, branch); String value = Activator.getDefault().getPreferenceStore() .getString(key); if (value.length() == 0) return Collections.emptyList(); XMLMemento memento; try { memento = XMLMemento.createReadRoot(new StringReader(value)); } catch (WorkbenchException e) { Activator.logError("Error reading branch-project associations", e); return Collections.emptyList(); } IMemento[] children = memento.getChildren(KEY_PROJECT); if (children.length == 0) return Collections.emptyList(); List<String> projectPaths = Stream.of(children) .map(child -> child.getTextData()) .filter(x -> !StringUtils.isEmptyOrNull(x)) .collect(Collectors.toList()); return projectPaths; }
Source:
public JailPanel(int totalPieces, int teamIndex) { mJailDimension = (totalPieces / 4) + (totalPieces % 4); setOpaque(false); setLayout(new GridLayout(mJailDimension, mJailDimension)); setPreferredSize(new Dimension(mJailDimension * 48, mJailDimension * 48)); mSquareLabels = new SquareJLabel[mJailDimension][mJailDimension]; mTeamIndex = teamIndex; setBorder(GuiUtility.createBorder(Messages.getString("PlayGamePanel.capturedPieces"))); setLayout(new GridLayout(mJailDimension, mJailDimension)); setPreferredSize(new Dimension((mJailDimension + 1) * 25, (mJailDimension + 1) * 25)); createGrid(mJailDimension); }

Target:
public JailPanel(int totalPieces, int teamIndex) { mJailDimension = (totalPieces / 4) + (totalPieces % 4); setOpaque(false); setLayout(new GridLayout(mJailDimension, mJailDimension)); setPreferredSize(new Dimension(mJailDimension * 48, mJailDimension * 48)); mSquareLabels = new SquareJLabel[mJailDimension][mJailDimension]; mTeamIndex = teamIndex; setBorder(GuiUtility.createBorder(Messages.getString("PlayGamePanel.capturedPieces"))); setLayout(new GridLayout(mJailDimension, mJailDimension)); setPreferredSize(new Dimension((mJailDimension + 1) * 25, (mJailDimension + 1) * 25)); createGrid(); }
Source:
public void testMetricsExportedThroughPrometheusEndpoint() { final Counter promCounter = Counter.build("foo_bar","test counter" ) .labelNames("label1", "label2") .register(); final Counter filteredCounter = Counter.build("filtered_foo_bar","test counter" ) .labelNames("label1", "label2") .register(); promCounter.labels("val1", "val2").inc(3); filteredCounter.labels("val1", "val2").inc(6); ResponseEntity<String> metricsResponse = template.getForEntity(getBaseUrl() + "/prometheus?names[]=foo_bar", String.class); assertEquals(HttpStatus.OK, metricsResponse.getStatusCode()); assertTrue(MediaType.TEXT_PLAIN.isCompatibleWith(metricsResponse.getHeaders().getContentType())); List<String> responseLines = Arrays.asList(metricsResponse.getBody().split("\n")); assertThat(responseLines, CustomMatchers.<String>exactlyNItems(1, matchesPattern("foo_bar\\{label1=\"val1\",label2=\"val2\",?\\} 3.0"))); }

Target:
public void testMetricsExportedThroughPrometheusEndpoint() { final Counter promCounter = Counter.build("foo_bar", "test counter") .labelNames("label1", "label2") .register(); final Counter filteredCounter = Counter.build("filtered_foo_bar", "test counter") .labelNames("label1", "label2") .register(); promCounter.labels("val1", "val2").inc(3); filteredCounter.labels("val1", "val2").inc(6); ResponseEntity<String> metricsResponse = template.getForEntity(getBaseUrl() + "/prometheus?names[]=foo_bar", String.class); assertEquals(HttpStatus.OK, metricsResponse.getStatusCode()); assertTrue(StringUtils.deleteWhitespace(TextFormat.CONTENT_TYPE_004).equals(metricsResponse.getHeaders().getContentType().toString())); List<String> responseLines = Arrays.asList(metricsResponse.getBody().split("\n")); assertThat(responseLines, CustomMatchers.<String>exactlyNItems(1, matchesPattern("foo_bar\\{label1=\"val1\",label2=\"val2\",?\\} 3.0"))); }
Source:
public boolean hasLazyResultSet() { return involvesIO; }

Target:
public boolean hasLazyResultSet() { return hasLazyResultSet; }
Source:
void downloadBlob(CloudBlobMetadata cloudBlobMetadata, BlobId blobId, OutputStream outputStream) throws StoreException { try { if (cloudBlobMetadata.getEncryptionOrigin() == EncryptionOrigin.VCR) { ByteBuffer encryptedBlob = ByteBuffer.allocate((int) cloudBlobMetadata.getEncryptedSize()); requestAgent.doWithRetries(() -> { cloudDestination.downloadBlob(blobId, new ByteBufferOutputStream(encryptedBlob)); return null; }, "Download", cloudBlobMetadata.getPartitionId()); ByteBuffer decryptedBlob = cryptoAgent.decrypt(encryptedBlob); outputStream.write(decryptedBlob.array()); } else { requestAgent.doWithRetries(() -> { cloudDestination.downloadBlob(blobId, outputStream); return null; }, "Download", cloudBlobMetadata.getPartitionId()); } } catch (CloudStorageException | GeneralSecurityException | IOException e) { throw new StoreException("Error occured in downloading blob for blobid :" + blobId, StoreErrorCodes.IOError); } }

Target:
void downloadBlob(CloudBlobMetadata cloudBlobMetadata, BlobId blobId, OutputStream outputStream) throws StoreException { try { if (cloudBlobMetadata.getEncryptionOrigin() == EncryptionOrigin.VCR) { ByteBuffer encryptedBlob = ByteBuffer.allocate((int) cloudBlobMetadata.getEncryptedSize()); requestAgent.doWithRetries(() -> { cloudDestination.downloadBlob(blobId, new ByteBufferOutputStream(encryptedBlob)); return null; }, "Download", cloudBlobMetadata.getPartitionId()); ByteBuffer decryptedBlob = cryptoAgent.decrypt(encryptedBlob); outputStream.write(decryptedBlob.array()); } else { requestAgent.doWithRetries(() -> { cloudDestination.downloadBlob(blobId, outputStream); return null; }, "Download", cloudBlobMetadata.getPartitionId()); } } catch (CloudStorageException | GeneralSecurityException | IOException e) { throw new StoreException("Error occurred in downloading blob for blobid :" + blobId, StoreErrorCodes.IOError); } }
Source:
public Person updateFavouritesection(Person person, Long sectionId) { Section section = sectionRepository.findById(sectionId) .orElseThrow(() -> new RestException("Section not found", 404)); person.setFavouritesection(section); return personRepository.saveAndFlush(person); }

Target:
public Person updateFavouritesection(Person person, Long sectionId) { Section section = sectionRepository.findById(sectionId) .orElseThrow(() -> new RestException("Section not found", HttpServletResponse.SC_NOT_FOUND)); person.setFavouritesection(section); return personRepository.saveAndFlush(person); }
Source:
public void setUp() throws Exception { URL resource = getClass().getResource("/projects/check-maven-plugin-test"); testProjectServiceClient.importProject( workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.MAVEN_SPRING); ide.open(workspace); projectExplorer.waitProjectExplorer(); }

Target:
public void setUp() throws Exception { URL resource = getClass().getResource("/projects/check-maven-plugin-test"); testProjectServiceClient.importProject( workspace.getId(), get(resource.toURI()), PROJECT_NAME, MAVEN_SPRING); ide.open(workspace); projectExplorer.waitProjectExplorer(); }
Source:
public void beforeAll() { seed = Microservices.builder() .metrics(registry()) .discovery( (serviceRegistry, serviceEndpoint) -> new ScalecubeServiceDiscovery(serviceRegistry, serviceEndpoint).start()) .startAwait(); io.scalecube.transport.Address seedAddress = toAddress(seed.discovery().address()); node = Microservices.builder() .metrics(registry()) .discovery( (serviceRegistry, serviceEndpoint) -> new ScalecubeServiceDiscovery(serviceRegistry, serviceEndpoint) .options(opts -> opts.seedMembers(seedAddress)) .start()) .services(services) .startAwait(); LOGGER.info( "Seed address: " + seed.discovery().address() + ", services address: " + node.serviceAddress()); }

Target:
public void beforeAll() { seed = Microservices.builder() .metrics(registry()) .discovery(ScalecubeServiceDiscovery::new) .startAwait(); io.scalecube.transport.Address seedAddress = toAddress(seed.discovery().address()); node = Microservices.builder() .metrics(registry()) .discovery( (serviceRegistry, serviceEndpoint) -> new ScalecubeServiceDiscovery(serviceRegistry, serviceEndpoint) .options(opts -> opts.seedMembers(seedAddress))) .services(services) .startAwait(); LOGGER.info( "Seed address: " + seed.discovery().address() + ", services address: " + node.serviceAddress()); }
Source:
private void refresh() { Collection<OutputChannelBinding> channels = this.configuration.getOutputChannels(); for (OutputChannelBinding channel : channels) { channel.setTapped(true); } this.adapter.setOutputChannels(channels); this.adapter.stop(); this.adapter.start(); }

Target:
private void refresh() { Collection<OutputChannelBinding> channels = this.configuration.getOutputChannels(); for (OutputChannelBinding channel : channels) { channel.setTapped(true); } this.adapter.stop(); this.adapter.setOutputChannels(channels); this.adapter.start(); }
Source:
public String toString() { return hasRevision() ? String.format("%d-%d-%d-%d", getMajorVersion(), getMinorVersion(), getSnapshot(), getRevision()) : String.format("%d-%d-%d", getMajorVersion(), getMinorVersion(), getSnapshot()); }

Target:
public String toString() { return String.format("%d.%d.%d", getMajorVersion(), getMinorVersion(), getSnapshot()) + (hasRevision() ? ("." + getRevision()) : ""); }
Source:
public void onPistonExtend(BlockPistonExtendEvent e) { if(BlockStorage.check(e.getBlock()) != null) { e.setCancelled(true); } else { for (Block b : e.getBlocks()) { if (BlockStorage.hasBlockInfo(b) || (b.getRelative(e.getDirection()).getType() == Material.AIR && BlockStorage.hasBlockInfo(b.getRelative(e.getDirection())))) { e.setCancelled(true); return; } } } }

Target:
public void onPistonExtend(BlockPistonExtendEvent e) { if (BlockStorage.hasBlockInfo(e.getBlock())) { e.setCancelled(true); } else { for (Block b : e.getBlocks()) { if (BlockStorage.hasBlockInfo(b) || (b.getRelative(e.getDirection()).getType() == Material.AIR && BlockStorage.hasBlockInfo(b.getRelative(e.getDirection())))) { e.setCancelled(true); break; } } } }
Source:
public int getNumOpenConnections() { if (!isServerStarted() || this.server.connectionList == null) { return 0; } return server.numConnections; }

Target:
public int getNumOpenConnections() { if (!isServerStarted()) { return 0; } return server.numConnections; }
Source:
@Test public void testGetBranchFromTag() throws Exception { initRepoWithTag(); FreeStyleProject p = j.createFreeStyleProject(); p.setScm(new MercurialSCM(hgInstallation(), repo.getPath(), MercurialSCM.RevisionType.TAG, "release", null, null, null, false, null)); FreeStyleBuild b = j.assertBuildStatusSuccess(p.scheduleBuild2(0).get()); MercurialTagAction action = b.getAction(MercurialTagAction.class); assertNotNull(action); assertEquals("stable", action.getBranch()); assertEquals("stable", b.getEnvironment().get("MERCURIAL_REVISION_BRANCH")); }

Target:
@Test public void testGetBranchFromTag() throws Exception { initRepoWithTag(); FreeStyleProject p = j.createFreeStyleProject(); p.setScm(new MercurialSCM(hgInstallation(), repo.getPath(), MercurialSCM.RevisionType.TAG, "release", null, null, null, false, null)); FreeStyleBuild b = j.buildAndAssertSuccess(p); MercurialTagAction action = b.getAction(MercurialTagAction.class); assertNotNull(action); assertEquals("stable", action.getBranch()); assertEquals("stable", b.getEnvironment().get("MERCURIAL_REVISION_BRANCH")); }
Source:
private List<Map<String, Object>> getSubjectNotifications(Subject subject) { String userid = subjectIdentity.getUniqueIdentifier(subject); try { String filter = String.format("user = '%s'", userid); List<Map<String, Object>> notificationsList = persistentStore.get( PersistenceType.NOTIFICATION_TYPE.toString(), filter, 0, MAX_PAGE_SIZE); return notificationsList.stream().map(this::mapAttributes).collect(Collectors.toList()); } catch (PersistenceException e) { LOGGER.debug( "PersistenceException while trying to retrieve persisted notifications for user {}", userid, e); } return Collections.emptyList(); }

Target:
private List<Map<String, Object>> getSubjectNotifications(Subject subject) { String userid = subjectIdentity.getUniqueIdentifier(subject); String filter = String.format("user = '%s'", userid); try { List<Map<String, Object>> notificationsList = persistentStore.get( PersistenceType.NOTIFICATION_TYPE.toString(), filter, 0, determineAndRetrieveMaxPageSize()); return notificationsList.stream().map(this::mapAttributes).collect(Collectors.toList()); } catch (PersistenceException e) { LOGGER.debug( "PersistenceException while trying to retrieve persisted notifications for user {}", userid, e); } return Collections.emptyList(); }
Source:
public void display_tags_without_edit() { executeBuild("shared/xoo-sample", "sample", "Sample"); wsClient.wsConnector().call( new PostRequest("api/project_tags/set") .setParam("project", "sample") .setParam("tags", "foo,bar,baz") ); ProjectDashboardPage page = nav.openProjectDashboard("sample"); SelenideElement tags = page.getTags(); tags.$(".tags-list > span").should(hasText("foo, bar, baz")); tags.$("button").shouldNot(exist); tags.$("div.multi-select").shouldNot(exist); }

Target:
public void display_tags_without_edit() { executeBuild("shared/xoo-sample", "sample", "Sample"); wsClient.wsConnector().call( new PostRequest("api/project_tags/set") .setParam("project", "sample") .setParam("tags", "foo,bar,baz") ); ProjectDashboardPage page = nav.openProjectDashboard("sample"); page .shouldHaveTags("foo", "bar", "baz") .shouldNotBeEditable(); }
Source:
public void startWsAgent(String workspaceId) throws NotFoundException, MachineException, InterruptedException { final Instance devMachine = machineManager.getDevMachine(workspaceId); try { machineManager.exec(devMachine.getId(), new CommandImpl(WS_AGENT_PROCESS_NAME, wsAgentStartCommandLine, "Arbitrary"), String.format(WS_AGENT_PROCESS_OUTPUT_CHANNEL, workspaceId)); final HttpJsonRequest wsAgentPingRequest = createPingRequest(devMachine); long pingStartTimestamp = System.currentTimeMillis(); boolean pingPassed; do { pingPassed = pingWsAgent(wsAgentPingRequest); Thread.sleep(wsAgentPingDelayMs); } while (!pingPassed && System.currentTimeMillis() - pingStartTimestamp < wsAgentMaxStartTimeMs); } catch (BadRequestException wsAgentLaunchingExc) { throw new MachineException(wsAgentLaunchingExc.getLocalizedMessage(), wsAgentLaunchingExc); } }

Target:
public void startWsAgent(String workspaceId) throws NotFoundException, MachineException, InterruptedException { final Instance devMachine = machineManager.getDevMachine(workspaceId); try { machineManager.exec(devMachine.getId(), new CommandImpl(WS_AGENT_PROCESS_NAME, wsAgentStartCommandLine, "Arbitrary"), getWsAgentProcessOutputChannel(workspaceId)); final HttpJsonRequest wsAgentPingRequest = createPingRequest(devMachine); long pingStartTimestamp = System.currentTimeMillis(); boolean pingPassed; do { pingPassed = pingWsAgent(wsAgentPingRequest); Thread.sleep(wsAgentPingDelayMs); } while (!pingPassed && System.currentTimeMillis() - pingStartTimestamp < wsAgentMaxStartTimeMs); } catch (BadRequestException wsAgentLaunchingExc) { throw new MachineException(wsAgentLaunchingExc.getLocalizedMessage(), wsAgentLaunchingExc); } }
Source:
public String getModifiedIndex() { if (!eventIndexName.isEmpty()) { return String.format("%s-%s", eventIndexName, TYPE); } return TYPE; }

Target:
private String getModifiedIndex() { if (!eventIndexName.isEmpty()) { return String.format("%s-%s", eventIndexName, TYPE); } return TYPE; }
Source:
public void testLoadNullType() { Dataset<Object> expected = mock(Dataset.class); when(repo.load("test", Object.class)).thenReturn(expected); URI datasetUri = new URIBuilder(repoUri, "test").build(); Dataset<Object> ds = Datasets.load(datasetUri, null); verify(repo).load("test", Object.class); verifyNoMoreInteractions(repo); verifyNoMoreInteractions(expected); Assert.assertEquals(expected, ds); }

Target:
public void testLoadNullType() { URI datasetUri = new URIBuilder(repoUri, "test").build(); Datasets.<Object, Dataset<Object>> load(datasetUri, null); }
Source:
protected CreateElementRequest getCreatePartitionChildRequest(CreateElementRequest req) { CreateElementRequest result = new CreateElementRequest(req.getEditingDomain(), findActivity(req.getContainer()), req.getElementType()); result.setParameter(IN_PARTITION, (ActivityPartition)req.getContainer()); result.setContainmentFeature(findActivityFeature(req)); return result; }

Target:
protected CreateElementRequest getCreatePartitionChildRequest(CreateElementRequest req) { if (req == null) { return null; } CreateElementRequest result = new CreateElementRequest(req.getEditingDomain(), findActivity(req.getContainer()), req.getElementType()); result.setParameter(IN_PARTITION, (ActivityPartition)req.getContainer()); result.setContainmentFeature(findActivityFeature(req.getElementType().getEClass())); return result; }
Source:
private ResultQueueEntry<ReadRowsResponse> getNext() throws IOException { ResultQueueEntry<ReadRowsResponse> queueEntry; try { queueEntry = resultQueue.poll(readPartialRowTimeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IOException("Interrupted while waiting for next result", e); } if (queueEntry == null) { throw new ScanTimeoutException("Timeout while merging responses."); } if (!queueEntry.isCompletionMarker()) { call.request(1); } return queueEntry; }

Target:
private ResultQueueEntry<ReadRowsResponse> getNext() throws IOException { while (!completionMarkerFound.get() && moreCanBeRequested()) { call.request(batchRequestSize); outstandingRequestCount.addAndGet(batchRequestSize); } ResultQueueEntry<ReadRowsResponse> queueEntry; try { queueEntry = resultQueue.poll(readPartialRowTimeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IOException("Interrupted while waiting for next result", e); } if (queueEntry == null) { throw new ScanTimeoutException("Timeout while merging responses."); } return queueEntry; }
Source:
public int compareTo(@NotNull FileSystemWALPointer o) { if (this.partNum < o.partNum) { return -1; } if (this.partNum > o.partNum) { return 1; } if (this.offset < o.offset) { return -1; } if (this.offset > o.offset) { return 1; } return 0; }

Target:
public int compareTo(@NotNull FileSystemWALPointer o) { int partNumComparison = Integer.compare(this.partNum, o.partNum); return partNumComparison == 0 ? Long.compare(this.offset, o.offset) : partNumComparison; }
Source:
public void stop() { try { final Class<?> logManagerClazz = Class.forName("org.apache.logging.log4j.LogManager"); final Field shutdownCallbackRegistryField = Log4jContextFactory.class.getDeclaredField( "shutdownCallbackRegistry" ); shutdownCallbackRegistryField.setAccessible(true); final Log4jShutdown log4jShutdown = (Log4jShutdown) shutdownCallbackRegistryField.get(LogManager.getFactory()); log.info("Shutting down log4j callbacks"); log4jShutdown.runCallbacks(); } catch (ClassNotFoundException | ClassCastException | NoSuchFieldException | IllegalAccessException e) { log.warn(e, "Not attempting log shutdown"); } }

Target:
public void stop() { if (log4jShutdown != null) { log.debug("Shutting down log4j"); log4jShutdown.stop(); } else { log.warn("Log4j shutdown was registered in lifecycle but no shutdown object exists!"); } }
Source:
public Builder exposedPorts(Map<String, ?> exposedPorts) { this.exposedPorts = exposedPorts; return this; }

Target:
public Builder exposedPorts(Map<String, ?> exposedPorts) { this.exposedPorts = ImmutableMap.copyOf(checkNotNull(exposedPorts, "exposedPorts")); return this; }
Source:
public boolean isModified(File path) { long currLastModified; long currSize; Object currFileKey; try { BasicFileAttributes fileAttributes = FS.DETECTED.fileAttributes(path); currLastModified = fileAttributes.lastModifiedTime().toMillis(); currSize = fileAttributes.size(); currFileKey = getFileKey(fileAttributes); } catch (IOException e) { currLastModified = path.lastModified(); currSize = path.length(); currFileKey = MISSING_FILEKEY; } r = new ModificationReason(isSizeChanged(currSize), isFileKeyChanged(currFileKey), isModified(currLastModified)); return r.sizeChanged || r.fileKeyChanged || r.lastModifiedChanged; }

Target:
public boolean isModified(File path) { long currLastModified; long currSize; Object currFileKey; try { BasicFileAttributes fileAttributes = FS.DETECTED.fileAttributes(path); currLastModified = fileAttributes.lastModifiedTime().toMillis(); currSize = fileAttributes.size(); currFileKey = getFileKey(fileAttributes); } catch (IOException e) { currLastModified = path.lastModified(); currSize = path.length(); currFileKey = MISSING_FILEKEY; } sizeChanged = isSizeChanged(currSize); if (sizeChanged) { return true; } fileKeyChanged = isFileKeyChanged(currFileKey); if (fileKeyChanged) { return true; } lastModifiedChanged = isModified(currLastModified); if (lastModifiedChanged) { return true; } return false; }
Source:
public int compareTo(Broadcast other) { int startTimeComparison = transmissionTime.compareTo(other.transmissionTime); if (startTimeComparison != 0) { return startTimeComparison; } int durationComparison = broadcastDuration.compareTo(other.broadcastDuration); if (durationComparison != 0) { return durationComparison; } if (Strings.isNullOrEmpty(broadcastOn) && !Strings.isNullOrEmpty(other.broadcastOn)) { return -1; } if (!Strings.isNullOrEmpty(broadcastOn) && Strings.isNullOrEmpty(other.broadcastOn)) { return 1; } if (Strings.isNullOrEmpty(broadcastOn) && Strings.isNullOrEmpty(other.broadcastOn)) { return 0; } return broadcastOn.compareTo(other.broadcastOn); }

Target:
public int compareTo(Broadcast other) { return ComparisonChain.start() .compare(transmissionTime, other.transmissionTime) .compare(broadcastDuration, other.broadcastDuration) .compare(broadcastOn, other.broadcastOn, Ordering.natural().nullsFirst()) .result(); }
Source:
public Reply<?> update(@Named("id") Object id, Request request) { AccessPointRequestDTO dto = request.read(AccessPointRequestDTO.class).as(Json.class); AccessPointRequest accessPointRequest = adapt(dto); repository.update(accessPointRequest); return Reply.with("Successfully updated AP").ok(); }

Target:
public Reply<?> update(@Named("id") Object id, Request request) { AccessPointRequestDTO dto = request.read(AccessPointRequestDTO.class).as(Json.class); AccessPointRequest apRequest = adapt(dto); repository.update(apRequest); return Reply.with("Successfully updated AP").ok(); }
Source:
public void before() { fBot = new SWTWorkbenchBot(); SWTBotUtils.openView(CALLGRAPHDENSITY_ID); SWTBotView view = fBot.viewById(CALLGRAPHDENSITY_ID); assertNotNull(view); fView = view; CallGraphDensityView funcDensityView = UIThreadRunnable.syncExec((Result<CallGraphDensityView>) () -> { IViewPart viewRef = fView.getViewReference().getView(true); return (viewRef instanceof CallGraphDensityView) ? (CallGraphDensityView) viewRef : null; }); assertNotNull(funcDensityView); fTableBot = fView.bot().table(); assertNotNull(fTableBot); fDensityBot = fView.bot().canvas(); assertNotNull(fDensityBot); fDensityViewer = funcDensityView.getDensityViewer(); fLatch = new CountDownLatch(1); fDensityViewer.removeDataListener(fSyncListener); fDensityViewer.addDataListener(fSyncListener); assertNotNull(fDensityViewer); fTableViewer = funcDensityView.getTableViewer(); assertNotNull(fTableViewer); SWTBotUtils.maximize(funcDensityView); fFuncDensityView = funcDensityView; }

Target:
public void before() { fBot = new SWTWorkbenchBot(); SWTBotUtils.openView(CALLGRAPHDENSITY_ID); SWTBotView view = fBot.viewById(CALLGRAPHDENSITY_ID); assertNotNull(view); fView = view; CallGraphDensityView funcDensityView = UIThreadRunnable.syncExec((Result<CallGraphDensityView>) () -> { IViewPart viewRef = fView.getViewReference().getView(true); return (viewRef instanceof CallGraphDensityView) ? (CallGraphDensityView) viewRef : null; }); assertNotNull(funcDensityView); fTableBot = fView.bot().table(); assertNotNull(fTableBot); fDensityBot = fView.bot().canvas(); assertNotNull(fDensityBot); fDensityViewer = funcDensityView.getDensityViewer(); assertNotNull(fDensityViewer); fLatch = new CountDownLatch(1); fDensityViewer.removeDataListener(fSyncListener); fDensityViewer.addDataListener(fSyncListener); fTableViewer = funcDensityView.getTableViewer(); assertNotNull(fTableViewer); SWTBotUtils.maximize(funcDensityView); fFuncDensityView = funcDensityView; }
Source:
public void draw(Canvas canvas) { super.draw(canvas); createAndSetBitmap(); }

Target:
public void draw(Canvas canvas) { super.draw(canvas); if(boxHeight < previousBoxHeight || boxHeight > previousBoxHeight || boxWidth < previousBoxWidth || boxWidth > previousBoxWidth) { createAndSetBitmap(); } }
Source:
public void addInventoryListener(InventoryListener listener) { try { this.inventoryListenerSupport.inventoryListenerRWLock.writeLock().lock(); status.assertInitialOrStopped(getClass(), "addInventoryListener()"); this.inventoryListenerSupport.inventoryListeners.add(listener); LOG.debugf("Added inventory listener [%s] for endpoint [%s]", listener, getMonitoredEndpoint()); } finally { this.inventoryListenerSupport.inventoryListenerRWLock.writeLock().unlock(); } }

Target:
public void addInventoryListener(InventoryListener listener) { this.inventoryListenerSupport.inventoryListenerRWLock.writeLock().lock(); try { status.assertInitialOrStopped(getClass(), "addInventoryListener()"); this.inventoryListenerSupport.inventoryListeners.add(listener); LOG.debugf("Added inventory listener [%s] for endpoint [%s]", listener, getMonitoredEndpoint()); } finally { this.inventoryListenerSupport.inventoryListenerRWLock.writeLock().unlock(); } }
Source:
public Token getAccessToken(final Token requestToken, final Verifier verifier) { final boolean oob = ((ImgurApi) getApi()).isOob(getConfig()); final OAuthRequest request = new OAuthRequest(getApi().getAccessTokenVerb(), getApi().getAccessTokenEndpoint(), this); request.addBodyParameter(OAuthConstants.CLIENT_ID, getConfig().getApiKey()); request.addBodyParameter(OAuthConstants.CLIENT_SECRET, getConfig().getApiSecret()); request.addBodyParameter(OAuthConstants.GRANT_TYPE, oob ? "pin" : OAuthConstants.AUTHORIZATION_CODE); request.addBodyParameter(oob ? "pin" : OAuthConstants.CODE, verifier.getValue()); return getApi().getAccessTokenExtractor().extract(request.send().getBody()); }

Target:
public Token getAccessToken(final Token requestToken, final Verifier verifier) { final OAuthRequest request = new OAuthRequest(getApi().getAccessTokenVerb(), getApi().getAccessTokenEndpoint(), this); request.addBodyParameter(OAuthConstants.CLIENT_ID, getConfig().getApiKey()); request.addBodyParameter(OAuthConstants.CLIENT_SECRET, getConfig().getApiSecret()); if(ImgurApi.isOob(getConfig())) { request.addBodyParameter(OAuthConstants.GRANT_TYPE, "pin"); request.addBodyParameter("pin", verifier.getValue()); } else { request.addBodyParameter(OAuthConstants.GRANT_TYPE, OAuthConstants.AUTHORIZATION_CODE); request.addBodyParameter(OAuthConstants.CODE, verifier.getValue()); } return getApi().getAccessTokenExtractor().extract(request.send().getBody()); }
Source:
private String createResults() { QueryResults queryResults = new QueryResults( "20160128_214710_00012_rk68b", server.url("/query.html?20160128_214710_00012_rk68b").uri(), null, null, ImmutableList.of(new Column("_col0", "bigint", new ClientTypeSignature("bigint", ImmutableList.of()))), ImmutableList.of(ImmutableList.of(123)), new StatementStats("FINISHED", false, true, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, null), null, null, null); return QUERY_RESULTS_CODEC.toJson(queryResults); }

Target:
private String createResults() { QueryResults queryResults = new QueryResults( "20160128_214710_00012_rk68b", server.url("/query.html?20160128_214710_00012_rk68b").uri(), null, null, ImmutableList.of(new Column("_col0", "bigint", new ClientTypeSignature("bigint", ImmutableList.of()))), ImmutableList.of(ImmutableList.of(123)), StatementStats.builder().setState("FINISHED").build(), null, null, null); return QUERY_RESULTS_CODEC.toJson(queryResults); }
Source:
public AccountResource.Email parse(AccountResource parent, IdString id) throws AuthException, ResourceNotFoundException { if (!(self.get() instanceof IdentifiedUser)) { throw new AuthException("Authentication required"); } IdentifiedUser s = (IdentifiedUser) self.get(); if (s.getAccountId().get() == parent.getUser().getAccountId().get() || s.getCapabilities().canAdministrateServer()) { for (Account.Id a : byEmailCache.get(id.get())) { if (s.getAccountId().equals(a)) { return new AccountResource.Email(parent.getUser(), id.get()); } } } throw new ResourceNotFoundException(); }

Target:
public AccountResource.Email parse(AccountResource parent, IdString id) throws AuthException, ResourceNotFoundException { if (!(self.get() instanceof IdentifiedUser)) { throw new AuthException("Authentication required"); } IdentifiedUser s = (IdentifiedUser) self.get(); if (s.getAccountId().get() == parent.getUser().getAccountId().get() || s.getCapabilities().canAdministrateServer()) { for (Account.Id a : byEmailCache.get(id.get())) { if (parent.getUser().getAccountId().equals(a)) { return new AccountResource.Email(parent.getUser(), id.get()); } } } throw new ResourceNotFoundException(); }
Source:
private static Headers toOkHttpHeaders(HttpHeaders headers) { Headers.Builder bld = new Headers.Builder(); for (Map.Entry<String, List<String>> e : headers.getRequestHeaders().entrySet()) { String name = e.getKey(); List<String> values = e.getValue(); for (String value : values) { bld.add(name, value); } } return bld.build(); }

Target:
private static Headers toOkHttpHeaders(HttpHeaders headers) { Headers.Builder headersBuilder = new Headers.Builder(); if (headers != null) { for (Map.Entry<String, List<String>> e : headers.getRequestHeaders().entrySet()) { String name = e.getKey(); List<String> values = e.getValue(); for (String value : values) { headersBuilder.add(name, value); } } } return headersBuilder.build(); }
Source:
private void copyTemplatePermissions() { PermissionDAO dao = getDbFacade().getPermissionDao(); List<permissions> templatePermissions = dao.getAllForEntity(getVmTemplateId(), getCurrentUser().getUserId(), false); List<permissions> vmPermissions = new ArrayList<permissions>(); for (permissions templatePermission : templatePermissions) { boolean templateOwnerRole = templatePermission.getrole_id().equals(PredefinedRoles.TEMPLATE_OWNER.getId()); boolean templateUserRole = templatePermission.getrole_id().equals(PredefinedRoles.TEMPLATE_USER.getId()); if (templateOwnerRole || templateUserRole) { continue; } vmPermissions.add(new permissions(getCurrentUser().getUserId(), templatePermission.getrole_id(), getVmId(), VdcObjectType.VM)); } if (vmPermissions.size() > 0) { MultiLevelAdministrationHandler.addPermission(vmPermissions.toArray(new permissions[vmPermissions.size()])); } }

Target:
private void copyTemplatePermissions() { PermissionDAO dao = getDbFacade().getPermissionDao(); List<permissions> templatePermissions = dao.getAllForEntity(getVmTemplateId(), getCurrentUser().getUserId(), false); List<permissions> vmPermissions = new ArrayList<permissions>(); for (permissions templatePermission : templatePermissions) { boolean templateOwnerRole = templatePermission.getrole_id().equals(PredefinedRoles.TEMPLATE_OWNER.getId()); boolean templateUserRole = templatePermission.getrole_id().equals(PredefinedRoles.TEMPLATE_USER.getId()); if (templateOwnerRole || templateUserRole) { continue; } vmPermissions.add(new permissions(getCurrentUser().getUserId(), templatePermission.getrole_id(), getVmId(), VdcObjectType.VM)); } if (vmPermissions.size() > 0) { MultiLevelAdministrationHandler.addPermission(vmPermissions.toArray(new permissions[vmPermissions.size()])); getCompensationContext().snapshotNewEntities(vmPermissions); } }
Source:
public static Sensor fromString(String sensorName) { for(Sensor sensor: Sensor.values()) { if(sensor.toString().equalsIgnoreCase(sensorName)) { return sensor; } } throw new IllegalArgumentException("Invalid Sensor Name"); }

Target:
public static Sensor fromString(String sensorName) { for(Sensor sensor: Sensor.values()) { if(sensor.toString().equalsIgnoreCase(sensorName)) { return sensor; } } throw new IllegalArgumentException(String.format("Invalid sensor name: %s", sensorName)); }
Source:
private SidebarPanel createLeftSidebar() { leftSidebar = new SidebarPanel("leftSidebar", getModel(), detailEditor, () -> getEditorCas(), AnnotationPage.this); leftSidebar.add(new AttributeModifier("style", LambdaModel.of(() -> String .format("flex-basis: %d%%;", getModelObject().getPreferences().getSidebarSize())))); return leftSidebar; }

Target:
private SidebarPanel createLeftSidebar() { SidebarPanel leftSidebar = new SidebarPanel("leftSidebar", getModel(), detailEditor, () -> getEditorCas(), AnnotationPage.this); leftSidebar.add(new AttributeModifier("style", LambdaModel.of(() -> String .format("flex-basis: %d%%;", getModelObject().getPreferences().getSidebarSize())))); return leftSidebar; }
Source:
private static PsiElement getAfterElement(PsiElement element) { PsiElement elementParent = element.getParent(); if (element instanceof GoConstDefinition) { if (((GoConstSpec)elementParent).getExpressionList().size() > 0) { return ((GoConstSpec)elementParent).getExpressionList() .get(((GoConstSpec)elementParent).getExpressionList().size() - 1); } return ((GoConstSpec)elementParent).getType() == null ? ((GoConstSpec)elementParent).getConstDefinitionList() .get(((GoConstSpec)elementParent).getConstDefinitionList().size() - 1) : ((GoConstSpec)elementParent).getType(); } if (((GoVarSpec)elementParent).getExpressionList().size() > 0) { return ((GoVarSpec)elementParent).getExpressionList() .get(((GoVarSpec)elementParent).getExpressionList().size() - 1); } return ((GoVarSpec)elementParent).getType() == null ? ((GoVarSpec)elementParent).getVarDefinitionList() .get(((GoVarSpec)elementParent).getVarDefinitionList().size() - 1) : ((GoVarSpec)elementParent).getType(); }

Target:
private static PsiElement getAfterElement(PsiElement element) { PsiElement elementParent = element.getParent(); if (element instanceof GoConstDefinition) { if (!((GoConstSpec)elementParent).getExpressionList().isEmpty()) { return ContainerUtil.getLastItem(((GoConstSpec)elementParent).getExpressionList()); } return ((GoConstSpec)elementParent).getType() == null ? ContainerUtil.getLastItem(((GoConstSpec)elementParent).getConstDefinitionList()) : ((GoConstSpec)elementParent).getType(); } if (!((GoVarSpec)elementParent).getExpressionList().isEmpty()) { return ContainerUtil.getLastItem(((GoVarSpec)elementParent).getExpressionList()); } return ((GoVarSpec)elementParent).getType() == null ? ContainerUtil.getLastItem(((GoVarSpec)elementParent).getVarDefinitionList()) : ((GoVarSpec)elementParent).getType(); }
Source:
public void switchToConversationTab() { if (isCurrentUrlIssue() && GitHubURL.isPullRequestLoaded(getCurrentUrl())) { driver.findElement(By.xpath(" } }

Target:
public void switchToConversationTab() { if (GitHubURL.isPullRequestLoaded(getCurrentUrl())) { driver.findElement(By.xpath(" } }
Source:
public static DynamicFilter from(Expression expression) { checkArgument(expression instanceof ComparisonExpression, "Unexpected expression: %s", expression); ComparisonExpression comparison = (ComparisonExpression) expression; Expression sourceExpression; DeferredSymbolReference deferredReference; if (comparison.getLeft() instanceof DeferredSymbolReference) { sourceExpression = comparison.getRight(); deferredReference = (DeferredSymbolReference) comparison.getLeft(); } else if (comparison.getRight() instanceof DeferredSymbolReference) { sourceExpression = comparison.getLeft(); deferredReference = (DeferredSymbolReference) comparison.getRight(); } else { throw new IllegalArgumentException(format("Unexpected expression: %s", expression.toString())); } return new DynamicFilter( sourceExpression, deferredReference.getSourceId(), deferredReference.getSymbol(), comparison.getType()); }

Target:
public static DynamicFilter from(Expression expression) { checkArgument(expression instanceof ComparisonExpression, "Unexpected expression: %s", expression); ComparisonExpression comparison = (ComparisonExpression) expression; Expression sourceExpression = null; DeferredSymbolReference deferredReference = null; checkState(comparison.getLeft() instanceof DeferredSymbolReference ^ comparison.getRight() instanceof DeferredSymbolReference, "Exactly one deferred symbol per expression is required"); if (comparison.getLeft() instanceof DeferredSymbolReference) { sourceExpression = comparison.getRight(); deferredReference = (DeferredSymbolReference) comparison.getLeft(); } else if (comparison.getRight() instanceof DeferredSymbolReference) { sourceExpression = comparison.getLeft(); deferredReference = (DeferredSymbolReference) comparison.getRight(); } return new DynamicFilter( sourceExpression, deferredReference.getSourceId(), deferredReference.getSymbol(), comparison.getType()); }
Source:
public List<MessageHandlingMember<? super T>> findHandlerMethods(EventMessage<?> eventMessage) { return handlers.stream().filter(h -> h.canHandle(eventMessage)) .collect(Collectors.toCollection(ArrayList::new)); }

Target:
public List<MessageHandlingMember<? super T>> findHandlerMethods(EventMessage<?> eventMessage) { return handlers.stream().filter(h -> h.canHandle(eventMessage)) .collect(Collectors.toList()); }
Source:
public void testUnrecognizedSpec() { when(authentication.getAttributes().get(any(String.class))).thenReturn("strong_two_factor"); spec.setAuthenticationMethod("weak_two_factor"); assertTrue(this.spec.isSatisfiedBy(this.assertion)); }

Target:
public void testUnrecognizedSpec() { when(authentication.getAttributes().get(any(String.class))).thenReturn("strong_two_factor"); spec.setAuthenticationMethod("weak_two_factor"); spec.isSatisfiedBy(this.assertion); }
Source:
private void createIndexDocument(File2Index file2Index) { RegistryContext registryContext = null; boolean skipCache = false; String resourcePath = file2Index.path;; try { skipCache = IndexingManager.getInstance().isCacheSkipped(); Registry registry = IndexingManager.getInstance().getRegistry(file2Index.tenantId); registryContext = registry.getRegistryContext(); if (resourcePath != null) { if (skipCache) { registryContext.registerNoCachePath(resourcePath); if (log.isDebugEnabled()) { log.debug("Resource at path \"" + resourcePath + "\" is added as a no cache path"); } } Resource resource; if (registry.resourceExists(resourcePath) && (resource = registry.get(resourcePath)) != null) { IndexDocumentCreator indexDocumentCreator = new IndexDocumentCreator(file2Index, resource); indexDocumentCreator.createIndexDocument(); String symlinkPath = resource.getProperty("registry.resource.symlink.path"); if (symlinkPath != null) { file2Index.path = symlinkPath; indexDocumentCreator = new IndexDocumentCreator(file2Index, resource); indexDocumentCreator.createIndexDocument(); } } } } catch (RegistryException | IndexerException e) { log.error("Error while indexing.", e); } finally { if (skipCache && registryContext != null) { registryContext.removeNoCachePath(resourcePath); if (log.isDebugEnabled()) { log.debug("Resource at path \"" + resourcePath + "\" is removed from no cache path"); } } } }

Target:
private void createIndexDocument(File2Index file2Index) { RegistryContext registryContext = null; boolean skipCache = false; String resourcePath = file2Index.path; try { skipCache = IndexingManager.getInstance().isCacheSkipped(); Registry registry = IndexingManager.getInstance().getRegistry(file2Index.tenantId); registryContext = registry.getRegistryContext(); if (resourcePath != null) { if (skipCache) { registryContext.registerNoCachePath(resourcePath); if (log.isDebugEnabled()) { log.debug("Resource at path \"" + resourcePath + "\" is added as a no cache path"); } } Resource resource; if (registry.resourceExists(resourcePath) && (resource = registry.get(resourcePath)) != null) { IndexDocumentCreator indexDocumentCreator = new IndexDocumentCreator(file2Index, resource); indexDocumentCreator.createIndexDocument(); String symlinkPath = resource.getProperty(REGISTRY_RESOURCE_SYMLINK_PATH); if (symlinkPath != null) { file2Index.path = symlinkPath; indexDocumentCreator = new IndexDocumentCreator(file2Index, resource); indexDocumentCreator.createIndexDocument(); } } } } catch (RegistryException | IndexerException e) { log.error("Error while indexing. Resource at path " + "\"" + resourcePath + "\"" + "could not be " + "indexed" + e); } finally { if (skipCache && registryContext != null) { registryContext.removeNoCachePath(resourcePath); if (log.isDebugEnabled()) { log.debug("Resource at path \"" + resourcePath + "\" is removed from no cache path"); } } } }