auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public List<String> listDeviceIDsByEmail(@Scope(OAuthScope.ADMINISTRATION_READ) final AccessToken accessToken, @QueryParam("email") String email) { LOGGER.debug("Searching devices for email = {}", email); Optional<Long> accountId = getAccountIdByEmail(email); if (!accountId.isPresent()) { throw new WebApplicationException(Response.Status.NOT_FOUND); } final List<DeviceAccountPair> devices = deviceDAO.getDeviceAccountMapFromAccountId(accountId.get()); final List<String> deviceIdList = new ArrayList<>(); for (DeviceAccountPair pair: devices) { deviceIdList.add(pair.externalDeviceId); } return deviceIdList; }

Target:
public List<String> listDeviceIDsByEmail(@Scope(OAuthScope.ADMINISTRATION_READ) final AccessToken accessToken, @QueryParam("email") String email) { LOGGER.debug("Searching devices for email = {}", email); Optional<Long> accountId = getAccountIdByEmail(email); if (!accountId.isPresent()) { LOGGER.debug("ID not found for account {}", email); throw new WebApplicationException(Response.Status.NOT_FOUND); } final List<DeviceAccountPair> devices = deviceDAO.getDeviceAccountMapFromAccountId(accountId.get()); final List<String> deviceIdList = new ArrayList<>(); for (DeviceAccountPair pair: devices) { deviceIdList.add(pair.externalDeviceId); } return deviceIdList; }
Source:
private IndexDiffData calcIndexDiffData(IProgressMonitor monitor, String jobName, Collection<String> filesToUpdate, Collection<IResource> resourcesToUpdate) throws IOException { EclipseGitProgressTransformer jgitMonitor = new EclipseGitProgressTransformer( monitor); List<String> treeFilterPaths = calcTreeFilterPaths(filesToUpdate); WorkingTreeIterator iterator = null; try { iterator = IteratorService.createInitialIterator(repository); } catch (IllegalStateException e) { return null; } IndexDiff diffForChangedResources = new IndexDiff(repository, Constants.HEAD, iterator); diffForChangedResources.setFilter(PathFilterGroup .createFromStrings(treeFilterPaths)); diffForChangedResources.diff(jgitMonitor, 0, 0, jobName); return new IndexDiffData(indexDiffData, filesToUpdate, resourcesToUpdate, diffForChangedResources); }

Target:
private IndexDiffData calcIndexDiffData(IProgressMonitor monitor, String jobName, Collection<String> filesToUpdate, Collection<IResource> resourcesToUpdate) throws IOException { EclipseGitProgressTransformer jgitMonitor = new EclipseGitProgressTransformer( monitor); List<String> treeFilterPaths = calcTreeFilterPaths(filesToUpdate); WorkingTreeIterator iterator = IteratorService.createInitialIterator(repository); if (iterator == null) return null; IndexDiff diffForChangedResources = new IndexDiff(repository, Constants.HEAD, iterator); diffForChangedResources.setFilter(PathFilterGroup .createFromStrings(treeFilterPaths)); diffForChangedResources.diff(jgitMonitor, 0, 0, jobName); return new IndexDiffData(indexDiffData, filesToUpdate, resourcesToUpdate, diffForChangedResources); }
Source:
protected SAMSequenceDictionary getDictionaryForMergedBam() { SAMSequenceDictionary finalDict; if (alignedSamFile != null && !alignedSamFile.isEmpty()) { finalDict = SAMSequenceDictionaryExtractor.extractDictionary(alignedSamFile.get(0)); alignedSamFile.stream() .map(SAMSequenceDictionaryExtractor::extractDictionary) .forEach(finalDict::assertSameDictionary); } else { final SeparateEndAlignmentIterator mergingIterator = new SeparateEndAlignmentIterator(this.read1AlignedSamFile, this.read2AlignedSamFile, referenceFasta); finalDict = mergingIterator.getHeader().getSequenceDictionary(); } SAMSequenceDictionary referenceDict = SAMSequenceDictionaryExtractor.extractDictionary(referenceFasta); if (referenceDict == null) { throw new PicardException("No sequence dictionary found for " + referenceFasta.getAbsolutePath() + ". Use CreateSequenceDictionary.jar to create a sequence dictionary."); } return SAMSequenceDictionary.mergeDictionaries(finalDict, referenceDict, matchingDictionaryTags); }

Target:
protected SAMSequenceDictionary getDictionaryForMergedBam() { SAMSequenceDictionary finalDict; if (alignedSamFile != null && !alignedSamFile.isEmpty()) { finalDict = SAMSequenceDictionaryExtractor.extractDictionary(alignedSamFile.get(0)); alignedSamFile.stream() .map(SAMSequenceDictionaryExtractor::extractDictionary) .forEach(finalDict::assertSameDictionary); } else { final SeparateEndAlignmentIterator mergingIterator = new SeparateEndAlignmentIterator(this.read1AlignedSamFile, this.read2AlignedSamFile, referenceFasta); finalDict = mergingIterator.getHeader().getSequenceDictionary(); } SAMSequenceDictionary referenceDict = SAMSequenceDictionaryExtractor.extractDictionary(referenceFasta); if (referenceDict == null) { throw new PicardException("No sequence dictionary found for " + referenceFasta.getAbsolutePath() + ". Use Picard's CreateSequenceDictionary to create a sequence dictionary."); } return SAMSequenceDictionary.mergeDictionaries(finalDict, referenceDict, requiredMatchingDictionaryTags); }
Source:
public Response link(@PathParam("itemName") @ApiParam(value = "itemName") String itemName, @PathParam("channelUID") @ApiParam(value = "channelUID") String channelUid) { if (!itemRegistry.isValidItemName(itemName)) { return Response.status(Status.METHOD_NOT_ALLOWED).build(); } itemChannelLinkRegistry.add(new ItemChannelLink(itemName, new ChannelUID(channelUid))); return Response.ok().build(); }

Target:
public Response link(@PathParam("itemName") @ApiParam(value = "itemName") String itemName, @PathParam("channelUID") @ApiParam(value = "channelUID") String channelUid) { itemChannelLinkRegistry.add(new ItemChannelLink(itemName, new ChannelUID(channelUid))); return Response.ok().build(); }
Source:
private Runnable loadProject(ScannerReport.Metadata reportMetadata, Organization organization) { String reportProjectKey = projectKeyFromReport(reportMetadata); String componentKey = ceTask.getComponentKey(); if (componentKey == null) { throw MessageException.of(format( "Compute Engine task component key is null. Project with UUID %s must have been deleted since report was uploaded. Can not proceed.", ceTask.getComponentUuid())); } ComponentDto dto = toProject(reportProjectKey); analysisMetadata.setProject(new Project(dto.uuid(), dto.getDbKey(), dto.name())); return () -> { if (!componentKey.equals(reportProjectKey)) { throw MessageException.of(format( "ProjectKey in report (%s) is not consistent with projectKey under which the report as been submitted (%s)", reportProjectKey, componentKey)); } if (!dto.getOrganizationUuid().equals(organization.getUuid())) { throw MessageException.of(format("Project is not in the expected organization: %s", organization.getKey())); } if (dto.getMainBranchProjectUuid() != null) { throw MessageException.of("Project should not reference a branch"); } }; }

Target:
private Runnable loadProject(ScannerReport.Metadata reportMetadata, Organization organization) { String reportProjectKey = projectKeyFromReport(reportMetadata); String componentKey = ceTask.getComponentKey(); if (componentKey == null) { throw MessageException.of(format( "Compute Engine task component key is null. Project with UUID %s must have been deleted since report was uploaded. Can not proceed.", ceTask.getComponentUuid())); } ComponentDto dto = toProject(reportProjectKey); analysisMetadata.setProject(new Project(dto.uuid(), dto.getDbKey(), dto.name())); return () -> { if (!componentKey.equals(reportProjectKey)) { throw MessageException.of(format( "ProjectKey in report (%s) is not consistent with projectKey under which the report has been submitted (%s)", reportProjectKey, componentKey)); } if (!dto.getOrganizationUuid().equals(organization.getUuid())) { throw MessageException.of(format("Project is not in the expected organization: %s", organization.getKey())); } if (dto.getMainBranchProjectUuid() != null) { throw MessageException.of("Project should not reference a branch"); } }; }
Source:
public List<Header> decodeHeaders(final ByteBuffer src) throws HPackException { final boolean enforceSizeLimit = maxListSize < Integer.MAX_VALUE; int listSize = 0; final List<Header> list = new ArrayList<>(); while (src.hasRemaining()) { final Header header = decodeHeader(src); if (header == null) { break; } if (enforceSizeLimit) { listSize += header.getName().length() * 2; if (header.getValue() != null) { listSize += header.getValue().length() * 2; } listSize += 32; if (listSize >= maxListSize) { throw new HeaderListConstraintException("Maximum header list size exceeded"); } } list.add(header); } return list; }

Target:
public List<Header> decodeHeaders(final ByteBuffer src) throws HPackException { final boolean enforceSizeLimit = maxListSize < Integer.MAX_VALUE; int listSize = 0; final List<Header> list = new ArrayList<>(); while (src.hasRemaining()) { final HPackHeader header = decodeHPackHeader(src); if (header == null) { break; } if (enforceSizeLimit) { listSize += header.getTotalSize(); if (listSize >= maxListSize) { throw new HeaderListConstraintException("Maximum header list size exceeded"); } } list.add(new BasicHeader(header.getName(), header.getValue(), header.isSensitive())); } return list; }
Source:
protected void executeTask(ProcessContext process) throws Exception { try (BatchJob job = createJob(process)) { logParameters(process); job.execute(); } }

Target:
protected void executeTask(ProcessContext process) throws Exception { logParameters(process); try (BatchJob job = createJob(process)) { job.execute(); } }
Source:
public static void runTestListeners(ITestResult tr, List<ITestListener> listeners) { for (ITestListener itl : listeners) { switch (tr.getStatus()) { case ITestResult.SKIP: itl.onTestSkipped(tr); break; case ITestResult.SUCCESS_PERCENTAGE_FAILURE: itl.onTestFailedButWithinSuccessPercentage(tr); break; case ITestResult.FAILURE: if (ITestResult.wasFailureDueToTimeout(tr)) { itl.onTestFailedWithTimeout(tr); } itl.onTestFailure(tr); break; case ITestResult.SUCCESS: itl.onTestSuccess(tr); break; case ITestResult.STARTED: itl.onTestStart(tr); break; default: throw new AssertionError("Unknown status: " + tr.getStatus()); } } }

Target:
public static void runTestListeners(ITestResult tr, List<ITestListener> listeners) { for (ITestListener itl : listeners) { switch (tr.getStatus()) { case ITestResult.SKIP: itl.onTestSkipped(tr); break; case ITestResult.SUCCESS_PERCENTAGE_FAILURE: itl.onTestFailedButWithinSuccessPercentage(tr); break; case ITestResult.FAILURE: if (ITestResult.wasFailureDueToTimeout(tr)) { itl.onTestFailedWithTimeout(tr); } else { itl.onTestFailure(tr); } break; case ITestResult.SUCCESS: itl.onTestSuccess(tr); break; case ITestResult.STARTED: itl.onTestStart(tr); break; default: throw new AssertionError("Unknown status: " + tr.getStatus()); } } }
Source:
private void requestNewWorker(WorkerResourceSpec workerResourceSpec) { final TaskExecutorProcessSpec taskExecutorProcessSpec = TaskExecutorProcessUtils.processSpecFromWorkerResourceSpec(flinkConfig, workerResourceSpec); final int pendingCount = pendingWorkerCounter.increaseAndGet(workerResourceSpec); log.info("Requesting new worker with resource spec {}, current pending count: {}.", workerResourceSpec, pendingCount); resourceManagerDriver.requestResource(taskExecutorProcessSpec) .whenComplete((worker, exception) -> { if (exception != null) { final int count = pendingWorkerCounter.decreaseAndGet(workerResourceSpec); log.warn("Failed requesting worker with resource spec {}, current pending count: {}, exception: {}", workerResourceSpec, count, exception); requestWorkerIfRequired(); } else { final ResourceID resourceId = worker.getResourceID(); workerNodeMap.put(resourceId, worker); currentAttemptUnregisteredWorkers.put(resourceId, workerResourceSpec); log.info("Requested worker with resource spec {}.", resourceId, workerResourceSpec); } }); }

Target:
private void requestNewWorker(WorkerResourceSpec workerResourceSpec) { final TaskExecutorProcessSpec taskExecutorProcessSpec = TaskExecutorProcessUtils.processSpecFromWorkerResourceSpec(flinkConfig, workerResourceSpec); final int pendingCount = pendingWorkerCounter.increaseAndGet(workerResourceSpec); log.info("Requesting new worker with resource spec {}, current pending count: {}.", workerResourceSpec, pendingCount); CompletableFuture<WorkerType> requestResourceFuture = resourceManagerDriver.requestResource(taskExecutorProcessSpec); FutureUtils.assertNoException( requestResourceFuture.handle((worker, exception) -> { if (exception != null) { final int count = pendingWorkerCounter.decreaseAndGet(workerResourceSpec); log.warn("Failed requesting worker with resource spec {}, current pending count: {}, exception: {}", workerResourceSpec, count, exception); requestWorkerIfRequired(); } else { final ResourceID resourceId = worker.getResourceID(); workerNodeMap.put(resourceId, worker); currentAttemptUnregisteredWorkers.put(resourceId, workerResourceSpec); log.info("Requested worker with resource spec {}.", resourceId, workerResourceSpec); } return null; })); }
Source:
public void testInterruptedDuringAcquire() throws Exception { Timing timing = new Timing(); final CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1)); client.start(); final InterProcessMutex lock = new InterProcessMutex(client, LOCK_PATH); final AtomicBoolean interruptOnError = new AtomicBoolean(true); ((CuratorFrameworkImpl)client).debugUnhandledErrorListener = new UnhandledErrorListener() { @Override public void unhandledError(String message, Throwable e) { if(interruptOnError.compareAndSet(true, false)) { Thread.currentThread().interrupt(); } } }; try { client.create().creatingParentsIfNeeded().forPath(LOCK_PATH); } catch(NodeExistsException e) { } try { Thread.currentThread().interrupt(); lock.acquire(); Assert.fail(); } catch(InterruptedException e) { Assert.assertTrue(!lock.isOwnedByCurrentThread()); } try { Assert.assertTrue(lock.acquire(timing.seconds(), TimeUnit.SECONDS)); } catch(Exception e) { Assert.fail(); } finally { if(lock.isOwnedByCurrentThread()) { lock.release(); } } }

Target:
public void testInterruptedDuringAcquire() throws Exception { Timing timing = new Timing(); final CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1)); client.start(); final InterProcessMutex lock = new InterProcessMutex(client, LOCK_PATH); final AtomicBoolean interruptOnError = new AtomicBoolean(true); ((CuratorFrameworkImpl)client).debugUnhandledErrorListener = new UnhandledErrorListener() { @Override public void unhandledError(String message, Throwable e) { if(interruptOnError.compareAndSet(true, false)) { Thread.currentThread().interrupt(); } } }; try { client.create().creatingParentsIfNeeded().forPath(LOCK_PATH); } catch(NodeExistsException e) { } try { Thread.currentThread().interrupt(); lock.acquire(); Assert.fail("Lock acquisition succeeded when failure was expected"); } catch(InterruptedException e) { Assert.assertFalse(lock.isOwnedByCurrentThread()); } try { Assert.assertTrue(lock.acquire(timing.seconds(), TimeUnit.SECONDS)); } catch(Exception e) { Assert.fail(); } finally { if(lock.isOwnedByCurrentThread()) { lock.release(); } } }
Source:
private PutObjectRequest stagingFilePutRequest(StagingFile file) { AmazonS3URI uri = file.file().s3Uri(); FileReference reference = file.file().reference(); switch (reference.type()) { case LOCAL: { if (file.template()) { try { String content = workspace.templateFile(templateEngine, reference.filename(), UTF_8, params); byte[] bytes = content.getBytes(UTF_8); ObjectMetadata metadata = new ObjectMetadata(); metadata.setContentLength(bytes.length); return new PutObjectRequest(uri.getBucket(), uri.getKey(), new ByteArrayInputStream(bytes), metadata); } catch (IOException | TemplateException e) { throw new TaskExecutionException(e, TaskExecutionException.buildExceptionErrorConfig(e)); } } else { return new PutObjectRequest(uri.getBucket(), uri.getKey(), workspace.getFile(reference.filename())); } } case RESOURCE: { byte[] bytes; try { bytes = Resources.toByteArray(new URL(reference.reference().get())); } catch (IOException e) { throw new TaskExecutionException(e, TaskExecutionException.buildExceptionErrorConfig(e)); } ObjectMetadata metadata = new ObjectMetadata(); metadata.setContentLength(bytes.length); return new PutObjectRequest(uri.getBucket(), uri.getKey(), new ByteArrayInputStream(bytes), metadata); } case DIRECT: byte[] bytes = reference.contents().get(); ObjectMetadata metadata = new ObjectMetadata(); metadata.setContentLength(bytes.length); return new PutObjectRequest(uri.getBucket(), uri.getKey(), new ByteArrayInputStream(bytes), metadata); case S3: default: throw new AssertionError(); } }

Target:
private PutObjectRequest stagingFilePutRequest(StagingFile file) { AmazonS3URI uri = file.file().s3Uri(); FileReference reference = file.file().reference(); switch (reference.type()) { case LOCAL: { if (file.template()) { String content; try { content = workspace.templateFile(templateEngine, reference.filename(), UTF_8, params); } catch (IOException | TemplateException e) { throw new ConfigException("Failed to load file: " + file.file().reference().filename(), e); } byte[] bytes = content.getBytes(UTF_8); ObjectMetadata metadata = new ObjectMetadata(); metadata.setContentLength(bytes.length); return new PutObjectRequest(uri.getBucket(), uri.getKey(), new ByteArrayInputStream(bytes), metadata); } else { return new PutObjectRequest(uri.getBucket(), uri.getKey(), workspace.getFile(reference.filename())); } } case RESOURCE: { byte[] bytes; try { bytes = Resources.toByteArray(new URL(reference.reference().get())); } catch (IOException e) { throw new TaskExecutionException(e, TaskExecutionException.buildExceptionErrorConfig(e)); } ObjectMetadata metadata = new ObjectMetadata(); metadata.setContentLength(bytes.length); return new PutObjectRequest(uri.getBucket(), uri.getKey(), new ByteArrayInputStream(bytes), metadata); } case DIRECT: byte[] bytes = reference.contents().get(); ObjectMetadata metadata = new ObjectMetadata(); metadata.setContentLength(bytes.length); return new PutObjectRequest(uri.getBucket(), uri.getKey(), new ByteArrayInputStream(bytes), metadata); case S3: default: throw new AssertionError(); } }
Source:
private void startTagsEdit(GalleryItemFragment item) { startActivityForResult(SuggestedEditsImageTagEditActivity.Companion.newIntent(this, item.getMediaPage()), ACTIVITY_REQUEST_ADD_IMAGE_TAGS); }

Target:
private void startTagsEdit(GalleryItemFragment item) { startActivityForResult(SuggestedEditsImageTagEditActivity.newIntent(this, item.getMediaPage()), ACTIVITY_REQUEST_ADD_IMAGE_TAGS); }
Source:
public final Option<A> maximumOption(final Ord<A> o) { return headOption().map(x -> maximum(o)); }

Target:
public final Option<A> maximumOption(final Ord<A> o) { return NonEmptyList.fromList(this).map(nel -> nel.maximum(o)); }
Source:
public void testApplication() throws IOException, Exception { try { LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); conf.addResource(this.getClass().getResourceAsStream("/META-INF/properties-CassandraInputApplication.xml")); conf.set("dt.operator.CassandraReader.prop.store.node", "localhost"); conf.set("dt.operator.CassandraReader.prop.store.keyspace", KEYSPACE); conf.set("dt.operator.CassandraReader.prop.tablename", TABLE_NAME); lma.prepareDAG(new Application(), conf); LocalMode.Controller lc = lma.getController(); lc.run(10000); ((StramLocalCluster)lc).setExitCondition(new Callable<Boolean>() { @Override public Boolean call() throws Exception { if (getNumOfEventsInStore() == 10) { return true; } return false; } }); } catch (ConstraintViolationException e) { Assert.fail("constraint violations: " + e.getConstraintViolations()); } }

Target:
public void testApplication() throws IOException, Exception { try { LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); conf.addResource(this.getClass().getResourceAsStream("/META-INF/properties-CassandraInputApplication.xml")); conf.set("dt.operator.CassandraReader.prop.store.node", "localhost"); conf.set("dt.operator.CassandraReader.prop.store.keyspace", KEYSPACE); conf.set("dt.operator.CassandraReader.prop.tablename", TABLE_NAME); lma.prepareDAG(new Application(), conf); LocalMode.Controller lc = lma.getController(); ((StramLocalCluster)lc).setExitCondition(new Callable<Boolean>() { @Override public Boolean call() throws Exception { if (getNumOfEventsInStore() == 10) { return true; } return false; } }); lc.run(10000); Assert.assertEquals(10, getNumOfEventsInStore()); } catch (ConstraintViolationException e) { Assert.fail("constraint violations: " + e.getConstraintViolations()); } }
Source:
public ClientServerInputMultiplexer( DuplexConnection source, PluginRegistry plugins, boolean isClient) { this.source = source; final MonoProcessor<Flux<ByteBuf>> setup = MonoProcessor.create(); final MonoProcessor<Flux<ByteBuf>> server = MonoProcessor.create(); final MonoProcessor<Flux<ByteBuf>> client = MonoProcessor.create(); source = plugins.applyConnection(Type.SOURCE, source); setupConnection = plugins.applyConnection(Type.SETUP, new InternalDuplexConnection(source, setup)); serverConnection = plugins.applyConnection(Type.SERVER, new InternalDuplexConnection(source, server)); clientConnection = plugins.applyConnection(Type.CLIENT, new InternalDuplexConnection(source, client)); clientServerConnection = new InternalDuplexConnection(source, client, server); source .receive() .groupBy( frame -> { int streamId = FrameHeaderFlyweight.streamId(frame); final Type type; if (streamId == 0) { FrameType frameType = FrameHeaderFlyweight.frameType(frame); if (isSetup(frameType)) { type = Type.SETUP; } else { if (isRequesterFrame(frameType)) { type = isClient ? Type.CLIENT : Type.SERVER; } else { type = isClient ? Type.SERVER : Type.CLIENT; } } } else if ((streamId & 0b1) == 0) { type = Type.SERVER; } else { type = Type.CLIENT; } return type; }) .subscribe( group -> { switch (group.key()) { case SETUP: setup.onNext(group); break; case SERVER: server.onNext(group); break; case CLIENT: client.onNext(group); break; } }, t -> { LOGGER.error("Error receiving frame:", t); dispose(); }); }

Target:
public ClientServerInputMultiplexer( DuplexConnection source, PluginRegistry plugins, boolean isClient) { this.source = source; final MonoProcessor<Flux<ByteBuf>> setup = MonoProcessor.create(); final MonoProcessor<Flux<ByteBuf>> server = MonoProcessor.create(); final MonoProcessor<Flux<ByteBuf>> client = MonoProcessor.create(); source = plugins.applyConnection(Type.SOURCE, source); setupConnection = plugins.applyConnection(Type.SETUP, new InternalDuplexConnection(source, setup)); serverConnection = plugins.applyConnection(Type.SERVER, new InternalDuplexConnection(source, server)); clientConnection = plugins.applyConnection(Type.CLIENT, new InternalDuplexConnection(source, client)); clientServerConnection = new InternalDuplexConnection(source, client, server); source .receive() .groupBy( frame -> { int streamId = FrameHeaderFlyweight.streamId(frame); final Type type; if (streamId == 0) { switch (FrameHeaderFlyweight.frameType(frame)) { case SETUP: case RESUME: case RESUME_OK: type = Type.SETUP; break; case LEASE: case KEEPALIVE: case ERROR: type = isClient ? Type.CLIENT : Type.SERVER; break; default: type = isClient ? Type.SERVER : Type.CLIENT; } } else if ((streamId & 0b1) == 0) { type = Type.SERVER; } else { type = Type.CLIENT; } return type; }) .subscribe( group -> { switch (group.key()) { case SETUP: setup.onNext(group); break; case SERVER: server.onNext(group); break; case CLIENT: client.onNext(group); break; } }, t -> { LOGGER.error("Error receiving frame:", t); dispose(); }); }
Source:
public void getDescription_BothOldAndNewAnnotations() throws NoSuchMethodException { String actualResult = getDescriptionWithMethodNameAndParamIndex(TEST_METHOD_9, FIRST_INDEX); assertEquals(SECOND_DESCRIPTION_METHOD_ANNOTATION, actualResult); }

Target:
public void getDescription_BothOldAndNewAnnotations() throws NoSuchMethodException { String actualRes = getDescriptionWithMethodNameAndParamIndex(TEST_METHOD_9, FIRST_INDEX); assertEquals(SECOND_DESCRIPTION_METHOD_ANNOTATION, actualRes); }
Source:
public static Optional<String> getPayloadSerDe(Datastream datastream) { if (!datastream.hasDestination()) { return Optional.empty(); } return Optional.ofNullable(datastream.getDestination().getPayloadSerDe(GetMode.NULL)); }

Target:
public static Optional<String> getPayloadSerDe(Datastream datastream) { return Optional.ofNullable(datastream.getDestination()).map(d -> d.getPayloadSerDe(GetMode.NULL)); }
Source:
public GetTaskListCommandParameters(Guid vdsId) { spUUID = null; }

Target:
public GetTaskListCommandParameters(Guid vdsId) { super(vdsId); StoragePoolId = null; }
Source:
public Settings() { if (this.configurations == null) { this.configurations = new ArrayList<>(); } }

Target:
public Settings() { this.configurations = new ArrayList<>(); }
Source:
public ServerAuthentication<String> serverAuthentication(Map<String, String> environment) { return new SimpleServerAuthentication<String>() { @Override public Authenticator<String> authenticator() { return new Authenticator<String>() { @Override public Optional<String> extractCredentials(final HttpRequestContext request) { return Optional.fromNullable(request.getHeaderValue(HttpHeaders.AUTHORIZATION)); } @Override public Optional<HeliosUser> authenticate(final String credentials) throws AuthenticationException { if ("secret123".equals(credentials)) { return Optional.of(new HeliosUser("the-user")); } ; return Optional.absent(); } }; } }; }

Target:
public ServerAuthentication<String> serverAuthentication(Map<String, String> environment) { return new SimpleServerAuthentication<String>() { @Override public Authenticator<String> authenticator() { return new Authenticator<String>() { @Override public Optional<String> extractCredentials(final HttpRequestContext request) { return Optional.fromNullable(request.getHeaderValue(HttpHeaders.AUTHORIZATION)); } @Override public Optional<HeliosUser> authenticate(final String credentials) throws AuthenticationException { if ("secret123".equals(credentials)) { return Optional.of(new HeliosUser("the-user")); } return Optional.absent(); } }; } }; }
Source:
public static void getLatency(){ try { getLatency((long) minimum); } catch (Exception e) { log.error("failed to get latency error is: {}", e); } }

Target:
public static void getLatency(){ try { getLatency(minimum); } catch (Exception e) { log.error("failed to get latency error is: {}", e); } }
Source:
public DebugStringVariableSubstitutor(String projectName) { this(projectName == null ? null : projectName.isEmpty() ? null : ResourcesPlugin.getWorkspace().getRoot().getProject(projectName)); }

Target:
public DebugStringVariableSubstitutor(String projectName) { this(projectName == null || projectName.isEmpty() ? null : ResourcesPlugin.getWorkspace().getRoot().getProject(projectName)); }
Source:
public ObjectBindingPatternTreeImpl objectBindingPattern2(InternalSyntaxToken lCurlyBrace, RestElementTree rest, InternalSyntaxToken rCurlyBrace) { return new ObjectBindingPatternTreeImpl( lCurlyBrace, new SeparatedList<>(ImmutableList.<Tree>of(rest), Collections.<InternalSyntaxToken>emptyList()), rCurlyBrace); }

Target:
public ObjectBindingPatternTreeImpl objectBindingPattern2(InternalSyntaxToken lCurlyBrace, RestElementTree rest, InternalSyntaxToken rCurlyBrace) { return new ObjectBindingPatternTreeImpl( lCurlyBrace, new SeparatedList<>(ImmutableList.<Tree>of(rest), ImmutableList.<InternalSyntaxToken>of()), rCurlyBrace); }
Source:
public void bootstrapLayoutServer(@Nonnull String endpoint, @Nonnull Layout layout) { try { CFUtils.getUninterruptibly(getRuntimeLayout(layout) .getLayoutClient(endpoint) .bootstrapLayout(layout), AlreadyBootstrappedException.class); log.info("bootstrapLayoutServer: Layout Server bootstrap successful."); } catch (AlreadyBootstrappedException abe) { log.info("bootstrapLayoutServer: Layout Server already bootstrapped."); } }

Target:
CompletableFuture<Boolean> bootstrapLayoutServer(@Nonnull String endpoint, @Nonnull Layout layout) { return getRuntimeLayout(layout).getLayoutClient(endpoint).bootstrapLayout(layout) .exceptionally(throwable -> { try { CFUtils.unwrap(throwable, AlreadyBootstrappedException.class); } catch (AlreadyBootstrappedException e) { log.info("bootstrapLayoutServer: Layout Server already bootstrapped.", endpoint); } return true; }) .thenApply(result -> { log.info("bootstrapLayoutServer: Layout Server bootstrap successful", endpoint); return true; }); }
Source:
public List<CellWithTimestamp> getTimestamps(TableReference tableRef, byte[] startRowInclusive, int limit) { try (CloseableTrace trace = startLocalTrace("cqlExecutor.getTimestamps(table {}, limit {})", LoggingArgs.safeTableOrPlaceholder(tableRef), limit)) { return registerDuration(() -> delegate.getTimestamps(tableRef, startRowInclusive, limit), GET_TIMESTAMPS_TIMER); } }

Target:
public List<CellWithTimestamp> getTimestamps(TableReference tableRef, byte[] startRowInclusive, int limit) { try (CloseableTrace trace = startLocalTrace("cqlExecutor.getTimestamps(table {}, limit {})", LoggingArgs.safeTableOrPlaceholder(tableRef), limit)) { return registerDuration(() -> delegate.getTimestamps(tableRef, startRowInclusive, limit), GET_TIMESTAMPS_TIMER, logger -> logger.warn("cqlExecutor.getTimestamps({}, {})", LoggingArgs.tableRef(tableRef), SafeArg.of("limit", limit))); } }
Source:
void drainLoop() { int missed = 1; JoinInnerSubscriber<T>[] s = this.subscribers; int n = s.length; Subscriber<? super T> a = this.downstream; for (;;) { long r = requested.get(); long e = 0; middle: while (e != r) { if (cancelled) { cleanup(); return; } boolean d = done.get() == 0; boolean empty = true; for (JoinInnerSubscriber<T> inner : s) { SimplePlainQueue<T> q = inner.queue; if (q != null) { T v = q.poll(); if (v != null) { empty = false; a.onNext(v); inner.requestOne(); if (++e == r) { break middle; } } } } if (d && empty) { Throwable ex = errors.get(); if (ex != null) { a.onError(errors.terminate()); } else { a.onComplete(); } return; } if (empty) { break; } } if (e == r) { if (cancelled) { cleanup(); return; } boolean d = done.get() == 0; boolean empty = true; for (JoinInnerSubscriber<T> inner : s) { SimpleQueue<T> q = inner.queue; if (q != null && !q.isEmpty()) { empty = false; break; } } if (d && empty) { Throwable ex = errors.get(); if (ex != null) { a.onError(errors.terminate()); } else { a.onComplete(); } return; } } if (e != 0 && r != Long.MAX_VALUE) { requested.addAndGet(-e); } int w = get(); if (w == missed) { missed = addAndGet(-missed); if (missed == 0) { break; } } else { missed = w; } } }

Target:
void drainLoop() { int missed = 1; JoinInnerSubscriber<T>[] s = this.subscribers; int n = s.length; Subscriber<? super T> a = this.downstream; for (;;) { long r = requested.get(); long e = 0; middle: while (e != r) { if (cancelled) { cleanup(); return; } boolean d = done.get() == 0; boolean empty = true; for (int i = 0; i < n; i++) { JoinInnerSubscriber<T> inner = s[i]; SimplePlainQueue<T> q = inner.queue; if (q != null) { T v = q.poll(); if (v != null) { empty = false; a.onNext(v); inner.requestOne(); if (++e == r) { break middle; } } } } if (d && empty) { Throwable ex = errors.get(); if (ex != null) { a.onError(errors.terminate()); } else { a.onComplete(); } return; } if (empty) { break; } } if (e == r) { if (cancelled) { cleanup(); return; } boolean d = done.get() == 0; boolean empty = true; for (int i = 0; i < n; i++) { JoinInnerSubscriber<T> inner = s[i]; SimpleQueue<T> q = inner.queue; if (q != null && !q.isEmpty()) { empty = false; break; } } if (d && empty) { Throwable ex = errors.get(); if (ex != null) { a.onError(errors.terminate()); } else { a.onComplete(); } return; } } if (e != 0 && r != Long.MAX_VALUE) { requested.addAndGet(-e); } int w = get(); if (w == missed) { missed = addAndGet(-missed); if (missed == 0) { break; } } else { missed = w; } } }
Source:
private File createJar( @Nonnull List<String> classPath, @Nonnull String startClassName, @Nonnull File dumpLogDirectory ) throws IOException { File file = File.createTempFile( "surefirebooter", ".jar", getTempDirectory() ); if ( !isDebug() ) { file.deleteOnExit(); } String parent = file.getParent(); FileOutputStream fos = new FileOutputStream( file ); try ( JarOutputStream jos = new JarOutputStream( fos ) ) { jos.setLevel( JarOutputStream.STORED ); JarEntry je = new JarEntry( "META-INF/MANIFEST.MF" ); jos.putNextEntry( je ); Manifest man = new Manifest(); StringBuilder cp = new StringBuilder(); for ( Iterator<String> it = classPath.iterator(); it.hasNext(); ) { String classPathElement = it.next(); String uri = toClasspathElementUri( parent, classPathElement, dumpLogDirectory ); cp.append( uri ); if ( new File( classPathElement ).isDirectory() && !uri.endsWith( "/" ) ) { cp.append( '/' ); } if ( it.hasNext() ) { cp.append( ' ' ); } } man.getMainAttributes().putValue( "Manifest-Version", "1.0" ); man.getMainAttributes().putValue( "Class-Path", cp.toString().trim() ); man.getMainAttributes().putValue( "Main-Class", startClassName ); man.write( jos ); jos.closeEntry(); jos.flush(); return file; } }

Target:
private File createJar( @Nonnull List<String> classPath, @Nonnull String startClassName, @Nonnull File dumpLogDirectory ) throws IOException { File file = File.createTempFile( "surefirebooter", ".jar", getTempDirectory() ); if ( !isDebug() ) { file.deleteOnExit(); } Path parent = file.getParentFile().toPath(); FileOutputStream fos = new FileOutputStream( file ); try ( JarOutputStream jos = new JarOutputStream( fos ) ) { jos.setLevel( JarOutputStream.STORED ); JarEntry je = new JarEntry( "META-INF/MANIFEST.MF" ); jos.putNextEntry( je ); Manifest man = new Manifest(); StringBuilder cp = new StringBuilder(); for ( Iterator<String> it = classPath.iterator(); it.hasNext(); ) { Path classPathElement = Paths.get( it.next() ); String uri = toClasspathElementUri( parent, classPathElement, dumpLogDirectory ); cp.append( uri ); if ( isDirectory( classPathElement ) && !uri.endsWith( "/" ) ) { cp.append( '/' ); } if ( it.hasNext() ) { cp.append( ' ' ); } } man.getMainAttributes().putValue( "Manifest-Version", "1.0" ); man.getMainAttributes().putValue( "Class-Path", cp.toString().trim() ); man.getMainAttributes().putValue( "Main-Class", startClassName ); man.write( jos ); jos.closeEntry(); jos.flush(); return file; } }
Source:
private SourceStatus findSourceStatusFor(Publisher source, List<SourceReadEntry> reads) { for (SourceReadEntry status : reads) { if (status.getPublisher().equals(source)) { return status.getSourceStatus(); } } return null; }

Target:
private SourceStatus findSourceStatusFor(Publisher source, List<SourceReadEntry> reads) { for (SourceReadEntry status : reads) { if (status.getPublisher().equals(source)) { return status.getSourceStatus(); } } return source.getDefaultSourceStatus(); }
Source:
public void revokeAccessTokens(String id, String token) { AccessToken accessToken = new AccessToken.Builder(token).build(); try { connector.revokeAllAccessTokens(id, accessToken); } catch (ConnectionInitializationException e) { String message = "Unable to revoke access token on auth-server " + authServerHome + ": " + e.getMessage(); LOGGER.warn(message); throw e; } }

Target:
public void revokeAccessTokens(String id, String token) { AccessToken accessToken = new AccessToken.Builder(token).build(); try { connector.revokeAllAccessTokens(id, accessToken); } catch (ConnectionInitializationException e) { LOGGER.warn(String.format("Unable to revoke access token on auth-server %s: %s", authServerHome, e.getMessage())); throw e; } }
Source:
void persist() { try { recordManager.commit(); } catch (IOException e) { e.printStackTrace(); } }

Target:
void persist() { try { recordManager.commit(); } catch (IOException e) { logger.error(e); } }
Source:
public void onTestFailure(ITestResult result) { driver = NewDriverProvider.getWebDriver(); if (driver == null) { driver = NewDriverProvider.getWebDriver(); } imageCounter += 1; if (Global.LOG_ENABLED) { try { new Shooter().savePageScreenshot(screenPath + imageCounter, driver); CommonUtils.appendTextToFile(screenPath + imageCounter + ".html", driver.getPageSource()); } catch (Exception e) { log("onException", "driver has no ability to catch screenshot or html source - driver may died", false); } String exception = escapeHtml(result.getThrowable().toString() + "\n" + ExceptionUtils.getStackTrace(result.getThrowable())); StringBuilder builder = new StringBuilder(); builder.append("<tr class=\"error\"><td>error</td><td>" + exception + "</td><td> <br/><a href='screenshots/screenshot" + imageCounter + ".png'>Screenshot</a><br/><a href='screenshots/screenshot" + imageCounter + ".html'>HTML Source</a></td></tr>"); CommonUtils.appendTextToFile(logPath, builder.toString()); testLogging.addSteps(new TestStepsLogging("error", "error", exception, false, screenPath + imageCounter +".png")); imageCounter += 1; logJSError(driver); onTestSuccess(result); } }

Target:
public void onTestFailure(ITestResult result) { driver = NewDriverProvider.getWebDriver(); if (driver == null) { driver = NewDriverProvider.getWebDriver(); } imageCounter += 1; if (Global.LOG_ENABLED) { try { new Shooter().savePageScreenshot(screenPath + imageCounter, driver); CommonUtils.appendTextToFile(screenPath + imageCounter + ".html", driver.getPageSource()); } catch (Exception e) { log("onException", "driver has no ability to catch screenshot or html source - driver may died", false); } String exception = escapeHtml(result.getThrowable().toString() + "\n" + ExceptionUtils.getStackTrace(result.getThrowable())); StringBuilder builder = new StringBuilder(); builder.append("<tr class=\"error\"><td>error</td><td>" + exception + "</td><td> <br/><a href='screenshots/screenshot" + imageCounter + ".png'>Screenshot</a><br/><a href='screenshots/screenshot" + imageCounter + ".html'>HTML Source</a></td></tr>"); CommonUtils.appendTextToFile(logPath, builder.toString()); String screenshotPath = screenPath + imageCounter + ".png"; String htmlPath = screenPath + imageCounter + ".html"; testLogging.addSteps( new TestStepsLogging("error", "error", exception, false, screenshotPath, htmlPath)); logJSError(driver); onTestSuccess(result); } }
Source:
public static String toASCII(String input, int flag) { try { return IDNA.convertIDNToASCII(input, flag).toString(); } catch (android.icu.text.StringPrepParseException e) { if (input.equals(".")) { return input; } throw new IllegalArgumentException("Invalid input to toASCII: " + input, e); } END Android-changed: Use ICU4J implementation }

Target:
public static String toASCII(String input, int flag) { try { return IDNA.convertIDNToASCII(input, flag).toString(); } catch (android.icu.text.StringPrepParseException e) { if (".".equals(input)) { return input; } throw new IllegalArgumentException("Invalid input to toASCII: " + input, e); } END Android-changed: Use ICU4J implementation }
Source:
public Product() { this.attributes = new HashMap<>(); this.productContent = new LinkedList<>(); this.dependentProductIds = new HashSet<>(); this.branding = new HashSet<>(); this.providedProducts = new HashSet<>(); this.derivedProvidedProducts = new HashSet<>(); this.providedProductDtos = null; this.derivedProvidedProductDtos = null; }

Target:
public Product() { this.attributes = new HashMap<>(); this.productContent = new LinkedList<>(); this.dependentProductIds = new HashSet<>(); this.branding = new HashSet<>(); this.providedProducts = new HashSet<>(); }
Source:
public static Slice castFromInteger(@SqlType(INTEGER) long value) throws IOException { return internalCastFromLong(value, 20); }

Target:
public static Slice castFromInteger(@SqlType(INTEGER) long value) throws IOException { return internalCastFromLong(value, 12); }
Source:
public Iterable<Repo> iterate( @NotNull(message = "identifier can't be NULL") final String identifier) { throw new NotImplementedException("MkRepos#iterate"); }

Target:
public Iterable<Repo> iterate( @NotNull(message = "identifier can't be NULL") final String identifier) { throw new UnsupportedOperationException("MkRepos#iterate"); }
Source:
public boolean mediate(MessageContext synCtx) { if (synCtx.getEnvironment().isDebuggerEnabled()) { if (super.divertMediationRoute(synCtx)) { return true; } } SynapseLog synLog = getLog(synCtx); if (synLog.isTraceOrDebugEnabled()) { synLog.traceOrDebug("Start : Respond Mediator"); if (synLog.isTraceTraceEnabled()) { synLog.traceTrace("Message : " + synCtx.getEnvelope()); } } synCtx.setTo(null); synCtx.setResponse(true); String proxyName = (String) synCtx.getProperty(SynapseConstants.PROXY_SERVICE); if (proxyName == null || "".equals(proxyName)) { RESTUtils.handleCORSHeadersForResponse(synCtx); } Axis2MessageContext axis2smc = (Axis2MessageContext) synCtx; org.apache.axis2.context.MessageContext axis2MessageCtx = axis2smc.getAxis2MessageContext(); axis2MessageCtx.getOperationContext() .setProperty(org.apache.axis2.Constants.RESPONSE_WRITTEN, "SKIP"); Axis2Sender.sendBack(synCtx); if (synLog.isTraceOrDebugEnabled()) { synLog.traceOrDebug("End : Respond Mediator"); } return false; }

Target:
public boolean mediate(MessageContext synCtx) { if (synCtx.getEnvironment().isDebuggerEnabled()) { if (super.divertMediationRoute(synCtx)) { return true; } } SynapseLog synLog = getLog(synCtx); if (synLog.isTraceOrDebugEnabled()) { synLog.traceOrDebug("Start : Respond Mediator"); if (synLog.isTraceTraceEnabled()) { synLog.traceTrace("Message : " + synCtx.getEnvelope()); } } synCtx.setTo(null); synCtx.setResponse(true); String proxyName = (String) synCtx.getProperty(SynapseConstants.PROXY_SERVICE); if (proxyName == null || proxyName.isEmpty()) { RESTUtils.handleCORSHeadersForResponse(synCtx); } Axis2MessageContext axis2smc = (Axis2MessageContext) synCtx; org.apache.axis2.context.MessageContext axis2MessageCtx = axis2smc.getAxis2MessageContext(); axis2MessageCtx.getOperationContext() .setProperty(org.apache.axis2.Constants.RESPONSE_WRITTEN, "SKIP"); Axis2Sender.sendBack(synCtx); if (synLog.isTraceOrDebugEnabled()) { synLog.traceOrDebug("End : Respond Mediator"); } return false; }
Source:
public void testAuths() throws Exception { LocalFileSystem localFs = FileSystem.getLocal(new Configuration()); String testFile = createTmpTestFile(); RFileWriter writer = RFile.newWriter().to(testFile).withFileSystem(localFs).build(); Key k1 = new Key("r1", "f1", "q1", "A&B"); Key k2 = new Key("r1", "f1", "q2", "A"); Key k3 = new Key("r1", "f1", "q3"); Value v1 = new Value("p".getBytes()); Value v2 = new Value("c".getBytes()); Value v3 = new Value("t".getBytes()); writer.append(k1, v1); writer.append(k2, v2); writer.append(k3, v3); writer.close(); Scanner scanner = RFile.newScanner().from(testFile).withFileSystem(localFs) .withAuthorizations(new Authorizations("A")).build(); assertEquals(Map.of(k2, v2, k3, v3), toMap(scanner)); assertEquals(new Authorizations("A"), scanner.getAuthorizations()); scanner.close(); scanner = RFile.newScanner().from(testFile).withFileSystem(localFs) .withAuthorizations(new Authorizations("A", "B")).build(); assertEquals(Map.of(k1, v1, k2, v2, k3, v3), toMap(scanner)); assertEquals(new Authorizations("A", "B"), scanner.getAuthorizations()); scanner.close(); scanner = RFile.newScanner().from(testFile).withFileSystem(localFs) .withAuthorizations(new Authorizations("B")).build(); assertEquals(Map.of(k3, v3), toMap(scanner)); assertEquals(new Authorizations("B"), scanner.getAuthorizations()); scanner.close(); }

Target:
public void testAuths() throws Exception { LocalFileSystem localFs = FileSystem.getLocal(new Configuration()); String testFile = createTmpTestFile(); RFileWriter writer = RFile.newWriter().to(testFile).withFileSystem(localFs).build(); Key k1 = new Key("r1", "f1", "q1", "A&B"); Key k2 = new Key("r1", "f1", "q2", "A"); Key k3 = new Key("r1", "f1", "q3"); Value v1 = new Value("p".getBytes()); Value v2 = new Value("c".getBytes()); Value v3 = new Value("t".getBytes()); writer.append(k1, v1); writer.append(k2, v2); writer.append(k3, v3); writer.close(); Scanner scanner = RFile.newScanner().from(testFile).withFileSystem(localFs) .withAuthorizations(new Authorizations("A")).build(); assertEquals(ImmutableMap.of(k2, v2, k3, v3), toMap(scanner)); assertEquals(new Authorizations("A"), scanner.getAuthorizations()); scanner.close(); scanner = RFile.newScanner().from(testFile).withFileSystem(localFs) .withAuthorizations(new Authorizations("A", "B")).build(); assertEquals(ImmutableMap.of(k1, v1, k2, v2, k3, v3), toMap(scanner)); assertEquals(new Authorizations("A", "B"), scanner.getAuthorizations()); scanner.close(); scanner = RFile.newScanner().from(testFile).withFileSystem(localFs) .withAuthorizations(new Authorizations("B")).build(); assertEquals(ImmutableMap.of(k3, v3), toMap(scanner)); assertEquals(new Authorizations("B"), scanner.getAuthorizations()); scanner.close(); }
Source:
public void remove(CraftingRecipe recipe) { recipes.remove(recipe); }

Target:
public void remove(CraftingRecipe recipe) { this.recipes.remove(recipe); }
Source:
public ResponseEntity<?> createEventType(@Valid @RequestBody final EventType eventType, final Errors errors, final NativeWebRequest nativeWebRequest) { if (featureToggleService.isFeatureEnabled("disable_event_type_creation")) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } if (errors.hasErrors()) { return create(new ValidationProblem(errors), nativeWebRequest); } try { validateSchema(eventType); enrichment.validate(eventType); partitionResolver.validate(eventType); eventTypeRepository.saveEventType(eventType); topicRepository.createTopic(eventType.getName(), eventType.getDefaultStatistics()); return status(HttpStatus.CREATED).build(); } catch (final InvalidEventTypeException | NoSuchPartitionStrategyException | DuplicatedEventTypeNameException e) { LOG.debug("Failed to create EventType.", e); return create(e.asProblem(), nativeWebRequest); } catch (final TopicCreationException e) { LOG.error("Problem creating kafka topic. Rolling back event type database registration.", e); try { eventTypeRepository.removeEventType(eventType.getName()); } catch (final NakadiException e1) { return create(e.asProblem(), nativeWebRequest); } return create(e.asProblem(), nativeWebRequest); } catch (final NakadiException e) { LOG.error("Error creating event type " + eventType, e); return create(e.asProblem(), nativeWebRequest); } }

Target:
public ResponseEntity<?> createEventType(@Valid @RequestBody final EventType eventType, final Errors errors, final NativeWebRequest nativeWebRequest) { if (featureToggleService.isFeatureEnabled(DISABLE_EVENT_TYPE_CREATION)) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } if (errors.hasErrors()) { return create(new ValidationProblem(errors), nativeWebRequest); } try { assignTopic(eventType); validateSchema(eventType); enrichment.validate(eventType); partitionResolver.validate(eventType); eventTypeRepository.saveEventType(eventType); topicRepository.createTopic(eventType.getTopic(), eventType.getDefaultStatistics()); return status(HttpStatus.CREATED).build(); } catch (final InvalidEventTypeException | NoSuchPartitionStrategyException | DuplicatedEventTypeNameException e) { LOG.debug("Failed to create EventType.", e); return create(e.asProblem(), nativeWebRequest); } catch (final TopicCreationException e) { LOG.error("Problem creating kafka topic. Rolling back event type database registration.", e); try { eventTypeRepository.removeEventType(eventType.getTopic()); } catch (final NakadiException e1) { return create(e.asProblem(), nativeWebRequest); } return create(e.asProblem(), nativeWebRequest); } catch (final NakadiException e) { LOG.error("Error creating event type " + eventType, e); return create(e.asProblem(), nativeWebRequest); } }
Source:
Type getTypeForBlock(PinotColumnHandle pinotColumnHandle) { if (pinotColumnHandle.getColumnType().equals(INTEGER)) { return BIGINT; } else { return pinotColumnHandle.getColumnType(); } }

Target:
private static Type getTypeForBlock(PinotColumnHandle pinotColumnHandle) { if (pinotColumnHandle.getColumnType().equals(INTEGER)) { return BIGINT; } return pinotColumnHandle.getColumnType(); }
Source:
public List<Failure> getFailures() { return Collections.unmodifiableList(new ArrayList<>(failures)); }

Target:
public List<Failure> getFailures() { return Collections.unmodifiableList(failures); }