auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public BitreserveRestAdapter(final String token) { RequestInterceptor requestInterceptor = new RequestInterceptor() { @Override public void intercept(RequestFacade request) { HashMap<String, String> map = Header.getHeaders(); for (Map.Entry<String, String> entry : map.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); request.addHeader(key, value); } if (token != null && !TextUtils.isEmpty(token)) { request.addHeader("Authorization", Header.encodeCredentialsForBasicAuthorization(token, "X-OAuth-Basic")); } } }; this.adapter = new RestAdapter.Builder().setEndpoint(GlobalConfigurations.SERVER_URL) <START> .setRequestInterceptor(requestInterceptor) <END> .setLogLevel(GlobalConfigurations.DEBUG ? RestAdapter.LogLevel.FULL : RestAdapter.LogLevel.NONE) .setErrorHandler(new BitreserveRetrofitErrorHandling()) .build(); }</code><technical_language>Also, sort lines</technical_language>

Target:
public BitreserveRestAdapter(final String token) { RequestInterceptor requestInterceptor = new RequestInterceptor() { @Override public void intercept(RequestFacade request) { HashMap<String, String> map = Header.getHeaders(); for (Map.Entry<String, String> entry : map.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); request.addHeader(key, value); } if (token != null && !TextUtils.isEmpty(token)) { request.addHeader("Authorization", Header.encodeCredentialsForBasicAuthorization(token, "X-OAuth-Basic")); } } }; this.adapter = new RestAdapter.Builder().setEndpoint(GlobalConfigurations.SERVER_URL) .setErrorHandler(new BitreserveRetrofitErrorHandling()) .setLogLevel(GlobalConfigurations.DEBUG ? RestAdapter.LogLevel.FULL : RestAdapter.LogLevel.NONE) .setRequestInterceptor(requestInterceptor) .build(); }
Source:
<code>public void bindTo(MeterRegistry registry) { <START> startedCounter = <END> Counter.builder(workspaceMetric("starting_attempts.total")) .description("The count of workspaces start attempts") .register(registry); eventService.subscribe( event -> { if (event.getPrevStatus() == WorkspaceStatus.STOPPED && event.getStatus() == WorkspaceStatus.STARTING) { startedCounter.increment(); } }, WorkspaceStatusEvent.class); }</code><technical_language>Nitpick: startingCounter</technical_language>

Target:
public void bindTo(MeterRegistry registry) { startingCounter = Counter.builder(workspaceMetric("starting_attempts.total")) .description("The count of workspaces start attempts") .register(registry); eventService.subscribe( event -> { if (event.getPrevStatus() == WorkspaceStatus.STOPPED && event.getStatus() == WorkspaceStatus.STARTING) { startingCounter.increment(); } }, WorkspaceStatusEvent.class); }
Source:
<code>protected boolean canDoAction() { GlusterVolumeEntity glusterVolume = getGlusterVolume(); if (!super.canDoAction()) { return false; } boolean isVolumeDistributed = glusterVolume.getVolumeType().isDistributedType(); if (!isVolumeDistributed) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_NOT_DISTRIBUTED); <START> } else if (isVolumeDistributed && glusterVolume.getBricks().size() == 1) { <END> return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_DISTRIBUTED_AND_HAS_SINGLE_VOLUME); } return true; }</code><technical_language>redundant clause if , "else if" if (!isVolumeDistributed) - this means else if called isVolumeDestributed == true need include in 2nd clause</technical_language>

Target:
protected boolean canDoAction() { GlusterVolumeEntity glusterVolume = getGlusterVolume(); if (!super.canDoAction()) { return false; } boolean isVolumeDistributed = glusterVolume.getVolumeType().isDistributedType(); if (!isVolumeDistributed) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_NOT_DISTRIBUTED); } else if (glusterVolume.getBricks().size() == 1) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_DISTRIBUTED_AND_HAS_SINGLE_VOLUME); } return true; }
Source:
<code>private AbstractProject validateAndGetJenkinsProject(final ReleaseWebHookResource resource) { if (StringUtils.isEmpty(resource.getProjectName())) { throw new InvalidParameterException("Project name is empty"); } for (final Item project : Jenkins.getActiveInstance().getAllItems()) { <START> if (project instanceof AbstractProject && project.getName().equalsIgnoreCase(resource.getProjectName())) { <END> return (AbstractProject) project; } } throw new InvalidParameterException("Cannot find Jenkins Job with the name " + resource.getProjectName()); }</code><technical_language>store result of resource.getProjectName locally computing loop</technical_language>

Target:
private AbstractProject validateAndGetJenkinsProject(final ReleaseWebHookResource resource) { String projectName = resource.getProjectName(); if (StringUtils.isBlank(projectName)) { throw new InvalidParameterException("Project name is empty"); } for (final Item project : Jenkins.getActiveInstance().getAllItems()) { if (project instanceof AbstractProject && project.getName().equalsIgnoreCase(projectName)) { return (AbstractProject) project; } } throw new InvalidParameterException("Cannot find Jenkins Project with the name " + resource.getProjectName()); }
Source:
<code><START> private void handleFilterRegex(SearchPredicateFactory theF, BooleanPredicateClausesStep<?> theB, ValueSet.ConceptSetFilterComponent theFilter) { <END> if (theFilter.getOp() == ValueSet.FilterOperator.REGEX) { String value = theFilter.getValue(); if (value.endsWith("$")) { value = value.substring(0, value.length() - 1); } else if (!value.endsWith(".*")) { value = value + ".*"; } if (!value.startsWith("^") && !value.startsWith(".*")) { value = ".*" + value; } else if (value.startsWith("^")) { value = value.substring(1); } Term term = new Term(TermConceptPropertyBinder.CONCEPT_FIELD_PROPERTY_PREFIX + theFilter.getProperty(), value); RegexpQuery query = new RegexpQuery(term); theB.must(theF.extension(LuceneExtension.get()).fromLuceneQuery(query)); } else { String value = theFilter.getValue(); Term term = new Term(TermConceptPropertyBinder.CONCEPT_FIELD_PROPERTY_PREFIX + theFilter.getProperty(), value); theB.must(theF.match().field(term.field()).matching(term.text())); } }</code><technical_language>Nitpick! Meaningful names code more readable</technical_language>

Target:
private void handleFilterRegex(SearchPredicateFactory theF, BooleanPredicateClausesStep<?> theB, ValueSet.ConceptSetFilterComponent theFilter) { if (theFilter.getOp() == ValueSet.FilterOperator.REGEX) { String value = theFilter.getValue(); if (value.endsWith("$")) { value = value.substring(0, value.length() - 1); } else if (!value.endsWith(".*")) { value = value + ".*"; } if (!value.startsWith("^") && !value.startsWith(".*")) { value = ".*" + value; } else if (value.startsWith("^")) { value = value.substring(1); } Term term = new Term(TermConceptPropertyBinder.CONCEPT_FIELD_PROPERTY_PREFIX + theFilter.getProperty(), value); if (isFullTextSetToUseElastic()) { String regexpQuery = "{'regexp':{'" + term.field() + "':{'value':'" + term.text() + "'}}}"; ourLog.debug("Build Elasticsearch Regexp Query: {}", regexpQuery); theB.must(theF.extension(ElasticsearchExtension.get()).fromJson(regexpQuery)); } else { RegexpQuery query = new RegexpQuery(term); theB.must(theF.extension(LuceneExtension.get()).fromLuceneQuery(query)); } } else { String value = theFilter.getValue(); Term term = new Term(TermConceptPropertyBinder.CONCEPT_FIELD_PROPERTY_PREFIX + theFilter.getProperty(), value); theB.must(theF.match().field(term.field()).matching(term.text())); } }
Source:
<code>public PlanWithProperties visitUnnest(UnnestNode node, PreferredProperties preferredProperties) { PreferredProperties translatedPreferred = preferredProperties.translate(variable -> { <START> checkArgument(variable instanceof VariableReferenceExpression, "Expect VariableReferenceExpression"); <END> return node.getReplicateVariables().contains(variable) ? Optional.of(variable) : Optional.empty(); }); return rebaseAndDeriveProperties(node, planChild(node, translatedPreferred)); }</code><technical_language>Please add actual type, in case fails</technical_language>

Target:
public PlanWithProperties visitUnnest(UnnestNode node, PreferredProperties preferredProperties) { PreferredProperties translatedPreferred = preferredProperties.translate(variable -> node.getReplicateVariables().contains(variable) ? Optional.of(variable) : Optional.empty()); return rebaseAndDeriveProperties(node, planChild(node, translatedPreferred)); }
Source:
<code>public long getRetainedSizeInBytes() { <START> return pageBuilder.getRetainedSizeInBytes() + outputQueue.stream().mapToLong(Page::getRetainedSizeInBytes).sum(); <END> }</code><technical_language>add instance size/object overhead of MergingPageOutput</technical_language>

Target:
public long getRetainedSizeInBytes() { long retainedSizeInBytes = INSTANCE_SIZE; retainedSizeInBytes += pageBuilder.getRetainedSizeInBytes(); if (currentInput != null) { retainedSizeInBytes += currentInput.getRetainedSizeInBytes(); } for (Page page : outputQueue) { retainedSizeInBytes += page.getRetainedSizeInBytes(); } return retainedSizeInBytes; }
Source:
<code>public boolean tryCreateAsDirectory() { try { if (exists()) { return isDirectory(); } if (!canCreateAsDirectory()) { return false; } if (parent() != null) { <START> parent().createAsDirectory(); <END> } return createDirectoryHandler.apply(this); } catch (Exception e) { throw handleErrorInCallback(e, "createDirectoryHandler"); } }</code><technical_language>suggestion if (!parent().createAsDirectory()) { return false; }</technical_language>

Target:
public boolean tryCreateAsDirectory() { try { if (exists()) { return isDirectory(); } if (!canCreateAsDirectory()) { return false; } if (parent() != null && !parent().tryCreateAsDirectory()) { return false; } return createDirectoryHandler.apply(this); } catch (Exception e) { throw handleErrorInCallback(e, "createDirectoryHandler"); } }
Source:
<code>public NimbusJwtDecoder build() { <START> ConfigurableJWTProcessor<SecurityContext> processor = processor(); <END> jwtProcessorCustomizer.accept(processor); return new NimbusJwtDecoder(processor); }</code><technical_language>delta if processor() jwtProcessorCustomizer instead. reason needs build() method</technical_language>

Target:
public NimbusJwtDecoder build() { return new NimbusJwtDecoder(processor()); }
Source:
<code>void write(List<DeepLinkAnnotatedElement> elements) { if (file == null) { messager.printMessage(Diagnostic.Kind.NOTE, "Output file is null, DeepLink doc not generated."); return; } if (elements == null || elements.isEmpty()) { messager.printMessage(Diagnostic.Kind.NOTE, "No deep link, DeepLink doc not generated."); return; } PrintWriter writer; try { writer = new PrintWriter(new FileWriter(file), true); for (DeepLinkAnnotatedElement element : elements) { writer.print(element.getUri() + PROPERTY_DELIMITER); String doc = formatJavaDoc( processingEnv.getElementUtils().getDocComment(element.getElement())); if (doc != null) { writer.print(doc); } writer.print(PROPERTY_DELIMITER); writer.print(element.getAnnotatedElement().getSimpleName()); if (element.getAnnotationType().equals(DeepLinkEntry.Type.METHOD)) { writer.print(CLASS_METHOD_NAME_DELIMITER); writer.print(element.getMethod()); } writer.print(ELEMENT_DELIMITER); } writer.flush(); <START> writer.close(); <END> } catch (IOException e) { e.printStackTrace(); messager.printMessage(Diagnostic.Kind.NOTE, "DeepLink doc not generated, "); } messager.printMessage(Diagnostic.Kind.NOTE, "DeepLink doc generated at: " + file.getPath()); }</code><technical_language>writer closed in a finally block</technical_language>

Target:
void write(List<DeepLinkAnnotatedElement> elements) { if (file == null) { messager.printMessage(Diagnostic.Kind.NOTE, "Output file is null, DeepLink doc not generated."); return; } if (elements == null || elements.isEmpty()) { messager.printMessage(Diagnostic.Kind.NOTE, "No deep link, DeepLink doc not generated."); return; } try (PrintWriter writer = new PrintWriter(new FileWriter(file), true)) { for (DeepLinkAnnotatedElement element : elements) { writer.print(element.getUri() + PROPERTY_DELIMITER); String doc = formatJavaDoc( processingEnv.getElementUtils().getDocComment(element.getElement())); if (doc != null) { writer.print(doc); } writer.print(PROPERTY_DELIMITER); writer.print(element.getAnnotatedElement().getSimpleName()); if (element.getAnnotationType().equals(DeepLinkEntry.Type.METHOD)) { writer.print(CLASS_METHOD_NAME_DELIMITER); writer.print(element.getMethod()); } writer.print(ELEMENT_DELIMITER); } writer.flush(); } catch (IOException e) { messager.printMessage(Diagnostic.Kind.ERROR, "DeepLink doc not generated: " + e.getMessage()); } messager.printMessage(Diagnostic.Kind.NOTE, "DeepLink doc generated at: " + file.getPath()); }
Source:
<code>public void start() throws ServerException { for (String stackPath: stackPaths) { if (!Strings.isNullOrEmpty(stackPath)) { for (StackImpl stack: loadStacks(stackPath)) { try { <START> try { <END> stackDao.update(stack); } catch (NotFoundException e) { stackDao.create(stack); } } catch (ConflictException e) { throw new ServerException("Failed to store stack " + stack, e); } } } } }</code><technical_language>combine this try blocks</technical_language>

Target:
public void start() throws ServerException { for (String stackPath: stackPaths) { if (!Strings.isNullOrEmpty(stackPath)) { for (DecoratedStackImpl stack: loadStacks(stackPath)) { try { try { stackDao.update(stack); } catch (NotFoundException e) { stackDao.create(stack); } } catch (ConflictException e) { throw new ServerException("Failed to store stack " + stack, e); } } } } }
Source:
<code>public void startContainer(ContainerModel containerModel, Config config, int maxChangelogStreamPartitions) { LocalityManager localityManager = null; if (new ClusterManagerConfig(config).getHostAffinityEnabled()) { localityManager = SamzaContainer$.MODULE$.getLocalityManager(containerModel.getContainerId(), config); } log.info("About to create container: " + containerModel.getContainerId()); container = SamzaContainer$.MODULE$.apply( containerModel.getContainerId(), containerModel, config, maxChangelogStreamPartitions, localityManager, new JmxServer(), Util.<String, MetricsReporter>javaMapAsScalaMap(metricsReporterMap), taskFactory); log.info("About to start container: " + containerModel.getContainerId()); containerFuture = executorService.submit(() -> { try { container.run(); } catch (Throwable t) { if (errorHandler != null) { errorHandler.onProcessorError(t); } else { <START> throw t; <END> } } }); }</code><technical_language>Question: If this is running in a thread, sense throw error? sense log this error? (Or is logging handled higher stack)</technical_language>

Target:
public void startContainer(ContainerModel containerModel, Config config, int maxChangelogStreamPartitions) { if (isContainerRunning()) { log.warn("Container is already running. Should call stopContainer before starting the container again!"); return; } LocalityManager localityManager = null; if (new ClusterManagerConfig(config).getHostAffinityEnabled()) { localityManager = SamzaContainerWrapper.getLocalityManager(containerModel.getContainerId(), config); } log.info("About to create container: " + containerModel.getContainerId()); container = SamzaContainerWrapper.createInstance( containerModel.getContainerId(), containerModel, config, maxChangelogStreamPartitions, localityManager, new JmxServer(), Util.<String, MetricsReporter>javaMapAsScalaMap(metricsReporterMap), taskFactory, null); log.info("About to start container: " + containerModel.getContainerId()); executorService = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder() .setNameFormat("processor-thread-%d").build()); containerFuture = executorService.submit(() -> { try { container.run(); } catch (Throwable t) { if (lifecycleCallback != null) { lifecycleCallback.onError(t); } } }); }
Source:
<code>public static JobStatus getJobStatusWithRetries(final Ds3Client client, final UUID jobId, final JobStatus expectedStatus) throws IOException, InterruptedException { final GetJobSpectraS3Request getJobSpectraS3Request = new GetJobSpectraS3Request(jobId); for (int retry = 0; retry < MAX_RETRIES; retry++) { actualStatus = client.getJobSpectraS3(getJobSpectraS3Request).getMasterObjectListResult().getStatus(); <START> if (actualStatus.equals(expectedStatus)) { <END> LOG.info("Found expected JobStatus " + expectedStatus + " after " + retry*POLLING_PERIOD_MILLIS + " millis."); break; } LOG.info("Expected JobStatus " + expectedStatus + " but is actually " + actualStatus + " after " + retry*POLLING_PERIOD_MILLIS + " millis."); Thread.sleep(POLLING_PERIOD_MILLIS); } return actualStatus; }</code><technical_language>equals method enums</technical_language>

Target:
public static JobStatus getJobStatusWithRetries(final Ds3Client client, final UUID jobId, final JobStatus expectedStatus) throws IOException, InterruptedException { final GetJobSpectraS3Request getJobSpectraS3Request = new GetJobSpectraS3Request(jobId); for (int retry = 0; retry < MAX_RETRIES; retry++) { actualStatus = client.getJobSpectraS3(getJobSpectraS3Request).getMasterObjectListResult().getStatus(); if (actualStatus == expectedStatus) { LOG.info("Found expected JobStatus " + expectedStatus + " after " + retry*POLLING_PERIOD_MILLIS + " millis."); break; } LOG.info("Expected JobStatus " + expectedStatus + " but is actually " + actualStatus + " after " + retry*POLLING_PERIOD_MILLIS + " millis."); Thread.sleep(POLLING_PERIOD_MILLIS); } return actualStatus; }
Source:
<code>public boolean allowsEStructuralFeatureCustomization(EObject element) { boolean customizationAllowed = false; for (Dialect dialect : dialects.values()) { customizationAllowed = customizationAllowed || dialect.getServices().allowsEStructuralFeatureCustomization(element); <START> } <END> return customizationAllowed; }</code><technical_language>Instead of for statement : Iterator<Dialect> dialectsValueIterator = dialects.values().iterator(); while (dialectsValueIterator.hasNext() && !customizationAllowed) { customizationAllowed = dialectsValueIterator.next().getServices().allowsEStructuralFeatureCustomization(element); }</technical_language>

Target:
public boolean allowsEStructuralFeatureCustomization(EObject element) { boolean customizationAllowed = false; Iterator<Dialect> dialectsValueIterator = dialects.values().iterator(); while (dialectsValueIterator.hasNext() && !customizationAllowed) { customizationAllowed = dialectsValueIterator.next().getServices().allowsEStructuralFeatureCustomization(element); } return customizationAllowed; }
Source:
<code>public FirestorePagingAdapter(@NonNull FirestorePagingOptions<T> options) { <START> super(new DiffCallback<>(options.getParser())); <END> mParser = options.getParser(); mData = options.getData(); if (options.getOwner() != null) { options.getOwner().getLifecycle().addObserver(this); } }</code><technical_language>This sad brings bad memories of super calls happy. move diff callback creation options builder devs overwrite if needed</technical_language>

Target:
public FirestorePagingAdapter(@NonNull FirestorePagingOptions<T> options) { super(options.getDiffCallback()); mSnapshots = options.getData(); mLoadingState = Transformations.switchMap(mSnapshots, new Function<PagedList<DocumentSnapshot>, LiveData<LoadingState>>() { @Override public LiveData<LoadingState> apply(PagedList<DocumentSnapshot> input) { FirestoreDataSource dataSource = (FirestoreDataSource) input.getDataSource(); return dataSource.getLoadingState(); } }); mDataSource = Transformations.map(mSnapshots, new Function<PagedList<DocumentSnapshot>, FirestoreDataSource>() { @Override public FirestoreDataSource apply(PagedList<DocumentSnapshot> input) { return (FirestoreDataSource) input.getDataSource(); } }); mParser = options.getParser(); if (options.getOwner() != null) { options.getOwner().getLifecycle().addObserver(this); } }
Source:
<code>private PatchList readPatchList(final PatchListKey key, final Repository repo) throws IOException { final RevWalk rw = new RevWalk(repo); final RevCommit b = rw.parseCommit(key.getNewId()); final AnyObjectId a = aFor(key, repo, b); if (a == null) { return new PatchList(a, b, computeIntraline, new PatchListEntry[0]); } RevTree aTree = rw.parseTree(a); RevTree bTree = b.getTree(); final TreeWalk walk = new TreeWalk(repo); walk.reset(); walk.setRecursive(true); walk.addTree(aTree); walk.addTree(bTree); walk.setFilter(TreeFilter.ANY_DIFF); ByteArrayOutputStream buf = new ByteArrayOutputStream(); <START> PrintStream ps = new PrintStream(buf); <END> while (walk.next()) { outputDiff(ps, walk.getPathString(), walk.getObjectId(0), walk .getFileMode(0), walk.getObjectId(1), walk.getFileMode(1), repo); } org.eclipse.jgit.patch.Patch p = new org.eclipse.jgit.patch.Patch(); p.parse(new ByteArrayInputStream(buf.toByteArray())); final int cnt = p.getFiles().size(); final PatchListEntry[] entries = new PatchListEntry[cnt]; for (int i = 0; i < cnt; i++) { entries[i] = newEntry(repo, aTree, bTree, p.getFiles().get(i)); } return new PatchList(a, b, computeIntraline, entries); }</code><technical_language>This is platform default encoding, vary wildly. instead force UTF-8 is encoding Patch happily parse</technical_language>

Target:
private PatchList readPatchList(final PatchListKey key, final Repository repo) throws IOException { final RevWalk rw = new RevWalk(repo); final RevCommit b = rw.parseCommit(key.getNewId()); final AnyObjectId a = aFor(key, repo, b); if (a == null) { return new PatchList(a, b, computeIntraline, new PatchListEntry[0]); } RevTree aTree = rw.parseTree(a); RevTree bTree = b.getTree(); final TreeWalk walk = new TreeWalk(repo); walk.reset(); walk.setRecursive(true); walk.addTree(aTree); walk.addTree(bTree); walk.setFilter(TreeFilter.ANY_DIFF); ByteArrayOutputStream buf = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(buf, true, "UTF-8"); while (walk.next()) { outputDiff(ps, walk.getPathString(), walk.getObjectId(0), walk .getFileMode(0), walk.getObjectId(1), walk.getFileMode(1), repo); } org.eclipse.jgit.patch.Patch p = new org.eclipse.jgit.patch.Patch(); ps.flush(); p.parse(new ByteArrayInputStream(buf.toByteArray())); final int cnt = p.getFiles().size(); final PatchListEntry[] entries = new PatchListEntry[cnt]; for (int i = 0; i < cnt; i++) { entries[i] = newEntry(repo, aTree, bTree, p.getFiles().get(i)); } return new PatchList(a, b, computeIntraline, entries); }
Source:
<code>public Mono<DuplexConnection> connect(int mtu) { Mono<DuplexConnection> isError = FragmentationDuplexConnection.checkMtu(mtu); return isError != null ? isError : client .doOnConnected(c -> c.addHandlerLast(new RSocketLengthCodec())) .connect() .map( c -> { if (mtu > 0) { return new FragmentationDuplexConnection( new ReassemblyDuplexConnection( new TcpDuplexConnection(c, false), ByteBufAllocator.DEFAULT, true), ByteBufAllocator.DEFAULT, mtu, <START> true, <END> "client"); } else { return new ReassemblyDuplexConnection( new TcpDuplexConnection(c), ByteBufAllocator.DEFAULT, false); } }); }</code><technical_language>This a nicer if FragmentationDuplexConnection(...) a sub-class of ReassemblyDuplexConnection</technical_language>

Target:
public Mono<DuplexConnection> connect(int mtu) { Mono<DuplexConnection> isError = FragmentationDuplexConnection.checkMtu(mtu); return isError != null ? isError : client .doOnConnected(c -> c.addHandlerLast(new RSocketLengthCodec())) .connect() .map( c -> { if (mtu > 0) { return new FragmentationDuplexConnection( new TcpDuplexConnection(c, false), ByteBufAllocator.DEFAULT, mtu, true, "client"); } else { return new ReassemblyDuplexConnection( new TcpDuplexConnection(c), ByteBufAllocator.DEFAULT, false); } }); }
Source:
<code>public void <START> testAggregateDiskImagesSnapshots() <END> { disk1.setId(Guid.newGuid()); disk1.setActive(true); disk1.setStorageIds(new ArrayList<>()); disk2.setId(disk1.getId()); disk2.setActive(false); disk3.setId(disk1.getId()); disk3.setActive(false); List<DiskImage> disks = new ArrayList<>(); disks.add(disk1); disks.add(disk2); disks.add(disk3); List<DiskImage> result = imagesHandler.aggregateDiskImagesSnapshots(disks) .stream() .map(DiskImage.class::cast) .collect(Collectors.toList()); assertEquals("disk should hold three snapshots", 3, result.get(0).getSnapshots().size()); }</code><technical_language>I add another active disk snapshots check returned list size is 2 number of snapshots of disk is expect be</technical_language>

Target:
public void testAggregateDiskImagesSnapshots() { disk1.setId(Guid.newGuid()); disk1.setActive(true); disk1.setStorageIds(new ArrayList<>()); disk2.setId(disk1.getId()); disk2.setActive(false); disk3.setId(disk1.getId()); disk3.setActive(false); DiskImage diskWithoutSnapshots = new DiskImage(); diskWithoutSnapshots.setId(Guid.newGuid()); diskWithoutSnapshots.setActive(true); diskWithoutSnapshots.setStorageIds(new ArrayList<>()); List<DiskImage> result = new ArrayList<>(imagesHandler.aggregateDiskImagesSnapshots(Arrays.asList( disk1, disk2, disk3, diskWithoutSnapshots))); DiskImage resultDisk = result.stream().filter(diskImage -> diskImage.getId() == disk1.getId()).findFirst().orElse(null); assertEquals("wrong number of disks returned", 2, result.size()); assertEquals("wrong number of snapshots for disk1", 3, resultDisk.getSnapshots().size()); }
Source:
<code>public void destroy(int code) { synchronized (lock) { <START> destroyed.set(true); <END> try { if (routeBuilder == null) { return; } for (RouteDefinition routeDef : routeBuilder.getRouteCollection().getRoutes()) { try { String routeId = routeDef.getId(); LOGGER.trace("Stopping route with ID = and path {}", routeId, monitoredDirectory); camelContext.stopRoute(routeId); boolean status = camelContext.removeRoute(routeId); LOGGER.trace("Status of removing route is {}", routeId, status); camelContext.removeRouteDefinition(routeDef); } catch (Exception e) { LOGGER.debug("Unable to stop Camel route with route ID = {}", routeDef.getId(), e); } } } finally { lock.notifyAll(); } } }</code><technical_language>is point in keeping defined atomic boolean</technical_language>

Target:
public void destroy(int code) { if (routeBuilder == null) { return; } for (RouteDefinition routeDef : routeBuilder.getRouteCollection().getRoutes()) { try { String routeId = routeDef.getId(); LOGGER.trace("Stopping route with ID = and path {}", routeId, monitoredDirectory); camelContext.stopRoute(routeId); boolean status = camelContext.removeRoute(routeId); LOGGER.trace("Status of removing route is {}", routeId, status); camelContext.removeRouteDefinition(routeDef); } catch (Exception e) { LOGGER.debug("Unable to stop Camel route with route ID = {}", routeDef.getId(), e); } } }
Source:
<code>public ProjectList call() { final ProjectList result = new ProjectList(); List<Project> projects = getProjects(); <START> result.setProjects(projects); <END> result.setCanCreateProject(user.getCapabilities().canCreateProject()); return result; }</code><technical_language>Nit: 2 lines combined easily</technical_language>

Target:
public ProjectList call() { final ProjectList result = new ProjectList(); result.setProjects(getProjects()); result.setCanCreateProject(user.getCapabilities().canCreateProject()); return result; }
Source:
<code>private void verifyQueryExecution() { try ( Session session = driver.session() ) { <START> session.readTransaction( (TransactionWork<Void>) tx -> <END> { StatementResult statementResult = tx.run( "MATCH (n) RETURN n.name, n.profession, n.planet, n.city ORDER BY n.name" ); List<String> fields = Arrays.asList( "n.name", "n.profession", "n.planet", "n.city" ); Record amy = statementResult.next(); assertEquals( amy.keys(), fields ); assertPairs( amy.fields(), "n.name", "Amy", "n.profession", "Student", "n.planet", "Mars", "n.city", "null"); Record fry = statementResult.next(); assertEquals( fry.keys(), fields ); assertPairs( fry.fields(), "n.name", "Fry", "n.profession", "Delivery Boy", "n.planet", "Earth", "n.city", "New York"); Record lila = statementResult.next(); assertEquals( lila.keys(), fields ); assertPairs( lila.fields(), "n.name", "Lila", "n.profession", "Pilot", "n.planet", "Earth", "n.city", "New York"); assertFalse( statementResult.hasNext() ); return null; } ); } }</code><technical_language>Is cast needed here</technical_language>

Target:
private void verifyQueryExecution() { try ( Session session = driver.session() ) { session.readTransaction( tx -> { StatementResult statementResult = tx.run( "MATCH (n) RETURN n.name, n.profession, n.planet, n.city ORDER BY n.name" ); List<String> fields = Arrays.asList( "n.name", "n.profession", "n.planet", "n.city" ); Record amy = statementResult.next(); assertEquals( amy.keys(), fields ); assertPairs( amy.fields(), "n.name", "Amy", "n.profession", "Student", "n.planet", "Mars", "n.city", "null"); Record fry = statementResult.next(); assertEquals( fry.keys(), fields ); assertPairs( fry.fields(), "n.name", "Fry", "n.profession", "Delivery Boy", "n.planet", "Earth", "n.city", "New York"); Record lila = statementResult.next(); assertEquals( lila.keys(), fields ); assertPairs( lila.fields(), "n.name", "Lila", "n.profession", "Pilot", "n.planet", "Earth", "n.city", "New York"); assertFalse( statementResult.hasNext() ); return null; } ); } }
Source:
<code>public Mono<Void> bulkUpdate(List<UpdateQuery> queries, BulkOptions bulkOptions, IndexCoordinates index) { Assert.notNull(queries, "List of UpdateQuery must not be null"); <START> Assert.notNull(bulkOptions, "BulkOptions must not be null"); <END> return doBulkOperation(queries, bulkOptions, index).then(); }</code><technical_language>index null</technical_language>

Target:
public Mono<Void> bulkUpdate(List<UpdateQuery> queries, BulkOptions bulkOptions, IndexCoordinates index) { Assert.notNull(queries, "List of UpdateQuery must not be null"); Assert.notNull(bulkOptions, "BulkOptions must not be null"); Assert.notNull(index, "Index must not be null"); return doBulkOperation(queries, bulkOptions, index).then(); }
Source:
<code>private File makeReadGroupFile(final SAMReadGroupRecord readGroup, final String preExtSuffix) { String fileName = ""; <START> if (RG_TAG.equalsIgnoreCase("PU")){ <END> fileName = readGroup.getPlatformUnit(); } else if (RG_TAG.equalsIgnoreCase("ID")){ fileName = readGroup.getReadGroupId(); } fileName = IOUtil.makeFileNameSafe(fileName); if (preExtSuffix != null) fileName += preExtSuffix; fileName += ".fastq"; final File result = (OUTPUT_DIR != null) ? new File(OUTPUT_DIR, fileName) : new File(fileName); IOUtil.assertFileIsWritable(result); return result; }</code><technical_language>in case RG_TAG="PU" readGroup.getPlatformUnit() returns null, vice versa</technical_language>

Target:
private File makeReadGroupFile(final SAMReadGroupRecord readGroup, final String preExtSuffix) { String fileName = null; if (RG_TAG.equalsIgnoreCase("PU")){ fileName = readGroup.getPlatformUnit(); } else if (RG_TAG.equalsIgnoreCase("ID")){ fileName = readGroup.getReadGroupId(); } if (fileName == null) { throw new PicardException("The selected RG_TAG: "+RG_TAG+" is not present in the bam header."); } fileName = IOUtil.makeFileNameSafe(fileName); if (preExtSuffix != null) fileName += preExtSuffix; fileName += ".fastq"; final File result = (OUTPUT_DIR != null) ? new File(OUTPUT_DIR, fileName) : new File(fileName); IOUtil.assertFileIsWritable(result); return result; }
Source:
<code>SearchPanel() { final FlowPanel body = new FlowPanel(); initWidget(body); setStyleName(Gerrit.RESOURCES.css().searchPanel()); searchBox = new HintTextBox(); searchBox.setVisibleLength(70); searchBox.setHintText(Gerrit.C.searchHint()); <START> searchBox.setHintStyleName(Gerrit.RESOURCES.css().inputFieldTypeHint()); <END> searchBox.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(final KeyPressEvent event) { switch (event.getCharCode()) { case KeyCodes.KEY_ENTER: doSearch(); break; case KeyCodes.KEY_ESCAPE: searchBox.setText(""); searchBox.setFocus(false); break; } } }); final Button searchButton = new Button(Gerrit.C.searchButton()); searchButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { doSearch(); } }); body.add(searchBox); body.add(searchButton); }</code><technical_language>assume this in HintTextBox class</technical_language>

Target:
SearchPanel() { final FlowPanel body = new FlowPanel(); initWidget(body); setStyleName(Gerrit.RESOURCES.css().searchPanel()); searchBox = new HintTextBox(); searchBox.setVisibleLength(70); searchBox.setHintText(Gerrit.C.searchHint()); searchBox.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(final KeyPressEvent event) { switch (event.getCharCode()) { case KeyCodes.KEY_ENTER: doSearch(); break; case KeyCodes.KEY_ESCAPE: searchBox.setText(""); searchBox.setFocus(false); break; } } }); final Button searchButton = new Button(Gerrit.C.searchButton()); searchButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { doSearch(); } }); body.add(searchBox); body.add(searchButton); }
Source:
<code><START> public int getWorkpiecesSize() { <END> if (this.getWorkpieces() == null) { return 0; } else { return this.getWorkpieces().size(); } }</code><technical_language>leave changes for this method out? This method other changed methods</technical_language>

Target:
public int getWorkpiecesSize() { return this.getWorkpieces().size(); }
Source:
<code>public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) { if (!isSpringConfigured(beanFactory)) { <START> logger.error("Could not configure Spring Data JPA auditing-feature because the bean " <END> + BEAN_CONFIGURER_ASPECT_BEAN_NAME + " is not present!\n" + "If you want to use auditing please add the @EnableSpringConfigured annotation or\n" + "the <context:spring-configured> element to your configuration."); } }</code><technical_language>want expose spring-configured users. enable explicitly do now</technical_language>

Target:
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) { try { beanFactory.getBeanDefinition(BEAN_CONFIGURER_ASPECT_BEAN_NAME); } catch (NoSuchBeanDefinitionException o_O) { throw new IllegalStateException( "Invalid auditing setup! Make sure you've used @EnableJpaAuditing or <jpa:auditing /> correctly!", o_O); } for (String beanName : getEntityManagerFactoryBeanNames(beanFactory)) { BeanDefinition definition = beanFactory.getBeanDefinition(beanName); definition.setDependsOn(addStringToArray(definition.getDependsOn(), BEAN_CONFIGURER_ASPECT_BEAN_NAME)); } for (String beanName : beanNamesForTypeIncludingAncestors(beanFactory, AuditorAware.class, true, false)) { BeanDefinition definition = beanFactory.getBeanDefinition(beanName); definition.setLazyInit(true); } }
Source:
<code>public String build() { try { return representationBuilder().build().serialize(); } catch (JsonProcessingException e) { <START> e.printStackTrace(); <END> } return null; }</code><technical_language>Log exception pass exception a printStackTrace. Then, checking for null build? wrap this a Runtime exception a descriptive message</technical_language>

Target:
public String build() { try { return representationBuilder().build().serialize(); } catch (JsonProcessingException e) { LOGGER.error("error occurred while building the HAL resource with navigation links", e); throw new RuntimeException("error occurred while building the HAL resource with navigation links", e); } }
Source:
<code>public List<ICallStackElement> getChildren() { List<ICallStackElement> children = fChildren; if (children == null) { <START> CallStackGroupDescriptor nextLevel = fNextLevel; <END> if (nextLevel == null) { children = Collections.EMPTY_LIST; } else { children = nextLevel.getNextElements(this, fQuark, fSymbolKeyElement, fThreadIdProvider); } fChildren = children; } return children; }</code><technical_language>check if current next</technical_language>

Target:
public List<ICallStackElement> getChildren() { List<ICallStackElement> children = fChildren; if (children == null) { CallStackGroupDescriptor nextGroup = fNextGroup; if (nextGroup == null) { children = Collections.EMPTY_LIST; } else { children = nextGroup.getElements(this, fQuark, fSymbolKeyElement, fThreadIdProvider); } fChildren = children; } return children; }
Source:
<code>public WagedRebalancer(HelixManager helixManager) { _assignmentMetadataStore = new AssignmentMetadataStore(); <START> _rebalanceAlgorithm = ConstraintBasedAlgorithmFactory.getInstance(0, 0); <END> _mappingCalculator = new DelayedAutoRebalancer(); }</code><technical_language>magic 0, 0 here</technical_language>

Target:
public WagedRebalancer(HelixManager helixManager) { _assignmentMetadataStore = new AssignmentMetadataStore(); _rebalanceAlgorithm = ConstraintBasedAlgorithmFactory.getInstance(); _mappingCalculator = new DelayedAutoRebalancer(); }
Source:
<code>protected void writeChildren(URI[] children) { if (children == null || children.length == 0) return; start(CHILDREN_ELEMENT); attribute(COLLECTION_SIZE_ATTRIBUTE, children.length); for (URI <START> children1 : <END> children) { writeChild(children1); } end(CHILDREN_ELEMENT); }</code><technical_language>child</technical_language>

Target:
protected void writeChildren(URI[] children) { if (children == null || children.length == 0) return; start(CHILDREN_ELEMENT); attribute(COLLECTION_SIZE_ATTRIBUTE, children.length); for (URI child : children) { writeChild(child); } end(CHILDREN_ELEMENT); }
Source:
<code>public void load() throws IOException, ConfigInvalidException { int maxStaleRetries = 5; int retries = 0; while (true) { final FileSnapshot oldSnapshot = snapshot; final FileSnapshot newSnapshot = FileSnapshot.save(getFile()); try { final byte[] in = IO.readFully(getFile()); final ObjectId newHash = hash(in); if (hash.equals(newHash)) { if (oldSnapshot.equals(newSnapshot)) oldSnapshot.setClean(newSnapshot); else snapshot = newSnapshot; } else { final String decoded; if (isUtf8(in)) { decoded = RawParseUtils.decode( RawParseUtils.UTF8_CHARSET, in, 3, in.length); utf8Bom = true; } else { decoded = RawParseUtils.decode(in); } fromText(decoded); snapshot = newSnapshot; hash = newHash; } } catch (FileNotFoundException noFile) { if (configFile.exists()) { throw noFile; } clear(); snapshot = newSnapshot; } catch (IOException e) { if (FileUtils.isStaleFileHandle(e) && retries < maxStaleRetries) { if (LOG.isDebugEnabled()) { LOG.debug(MessageFormat.format( JGitText.get().configHandleIsStale, Integer.valueOf(retries)), e); } retries++; continue; } final IOException e2 = new IOException(MessageFormat .format(JGitText.get().cannotReadFile, getFile())); <START> e2.initCause(e); <END> throw e2; } catch (ConfigInvalidException e) { throw new ConfigInvalidException(MessageFormat .format(JGitText.get().cannotReadFile, getFile()), e); } return; } }</code><technical_language>pass e2 parameter constructor IOException(String, Throwable) in line</technical_language>

Target:
public void load() throws IOException, ConfigInvalidException { int maxStaleRetries = 5; int retries = 0; while (true) { final FileSnapshot oldSnapshot = snapshot; final FileSnapshot newSnapshot = FileSnapshot.save(getFile()); try { final byte[] in = IO.readFully(getFile()); final ObjectId newHash = hash(in); if (hash.equals(newHash)) { if (oldSnapshot.equals(newSnapshot)) oldSnapshot.setClean(newSnapshot); else snapshot = newSnapshot; } else { final String decoded; if (isUtf8(in)) { decoded = RawParseUtils.decode( RawParseUtils.UTF8_CHARSET, in, 3, in.length); utf8Bom = true; } else { decoded = RawParseUtils.decode(in); } fromText(decoded); snapshot = newSnapshot; hash = newHash; } return; } catch (FileNotFoundException noFile) { if (configFile.exists()) { throw noFile; } clear(); snapshot = newSnapshot; return; } catch (IOException e) { if (FileUtils.isStaleFileHandle(e) && retries < maxStaleRetries) { if (LOG.isDebugEnabled()) { LOG.debug(MessageFormat.format( JGitText.get().configHandleIsStale, Integer.valueOf(retries)), e); } retries++; continue; } throw new IOException(MessageFormat .format(JGitText.get().cannotReadFile, getFile()), e); } catch (ConfigInvalidException e) { throw new ConfigInvalidException(MessageFormat .format(JGitText.get().cannotReadFile, getFile()), e); } } }
Source:
<code>public Void call() throws Exception { Objects.requireNonNull(acl, "New acl to be added not specified."); OzoneAddress address = new OzoneAddress(uri); address.ensureKeyAddress(); <START> OzoneClient client = address.createClient(createOzoneConfiguration()); <END> String volumeName = address.getVolumeName(); String bucketName = address.getBucketName(); String keyName = address.getKeyName(); if (isVerbose()) { System.out.printf("Volume Name : %s%n", volumeName); System.out.printf("Bucket Name : %s%n", bucketName); System.out.printf("Key Name : %s%n", keyName); } OzoneObj obj = OzoneObjInfo.Builder.newBuilder() .setBucketName(bucketName) .setVolumeName(volumeName) .setKeyName(address.getKeyName()) .setResType(OzoneObj.ResourceType.KEY) .setStoreType(storeType == null ? OZONE : OzoneObj.StoreType.valueOf(storeType)) .build(); boolean result = client.getObjectStore().addAcl(obj, OzoneAcl.parseAcl(acl)); System.out.printf("%s%n", JsonUtils.toJsonStringWithDefaultPrettyPrinter( JsonUtils.toJsonString("Acl set successfully: " + result))); return null; }</code><technical_language>close client release resource done</technical_language>

Target:
public Void call() throws Exception { Objects.requireNonNull(acl, "New acl to be added not specified."); OzoneAddress address = new OzoneAddress(uri); address.ensureKeyAddress(); OzoneClient client = address.createClient(createOzoneConfiguration()); String volumeName = address.getVolumeName(); String bucketName = address.getBucketName(); String keyName = address.getKeyName(); if (isVerbose()) { System.out.printf("Volume Name : %s%n", volumeName); System.out.printf("Bucket Name : %s%n", bucketName); System.out.printf("Key Name : %s%n", keyName); } OzoneObj obj = OzoneObjInfo.Builder.newBuilder() .setBucketName(bucketName) .setVolumeName(volumeName) .setKeyName(address.getKeyName()) .setResType(OzoneObj.ResourceType.KEY) .setStoreType(storeType == null ? OZONE : OzoneObj.StoreType.valueOf(storeType)) .build(); boolean result = client.getObjectStore().addAcl(obj, OzoneAcl.parseAcl(acl)); System.out.printf("%s%n", JsonUtils.toJsonStringWithDefaultPrettyPrinter( JsonUtils.toJsonString("Acl set successfully: " + result))); client.close(); return null; }
Source:
<code>public OAuthTestResourceConfig() { <START> super(); <END> register(AuthResource.class); }</code><technical_language>Ditto for super()</technical_language>

Target:
public OAuthTestResourceConfig() { register(AuthResource.class); }
Source:
<code>public void invalidateVisualState() { if (inputAnchor.hasConnection()) { this.inputType.setText(this.inputAnchor.getStringType()); Optional<GhciSession> ghci = getPane().getGhciSession(); if (ghci.isPresent()) { ListenableFuture<String> result = ghci.get().pull(inputAnchor.getFullExpr()); Futures.addCallback(result, new FutureCallback<String>() { public void onSuccess(String s) { <START> Platform.runLater(() -> setOutput(s)); <END> } public void onFailure(Throwable throwable) { Platform.runLater(() -> setOutput("?!?!?!")); } }); } } else { this.inputType.setText(" ... "); setOutput("??"); } }</code><technical_language>is purpose of a runLater a call back</technical_language>

Target:
public void invalidateVisualState() { if (inputAnchor.hasConnection()) { this.inputType.setText(this.inputAnchor.getStringType()); Optional<GhciSession> ghci = getPane().getGhciSession(); if (ghci.isPresent()) { ListenableFuture<String> result = ghci.get().pull(inputAnchor.getFullExpr()); Futures.addCallback(result, new FutureCallback<String>() { public void onSuccess(String s) { Platform.runLater(() -> setOutput(s)); } public void onFailure(Throwable throwable) { onSuccess("?!?!?!"); } }); } } else { this.inputType.setText(" ... "); setOutput("??"); } }
Source:
<code>public void setUp() throws Exception { super.setUp(); dao = dbFacade.getEngineSessionDao(); newEngineSession = new EngineSession(); newEngineSession.setEngineSessionId(Guid.newGuid().toString()); newEngineSession.setUserId(Guid.newGuid()); <START> newEngineSession.setRoleIds(new LinkedList<Guid>(Arrays.asList(FixturesTool.EXISTING_GROUP_ID))); <END> newEngineSession.setGroupIds(new LinkedList<Guid>(Arrays.asList(FixturesTool.EXISTING_GROUP_ID))); newEngineSession.setUserName(""); existingEngineSession = dao.get(ID); }</code><technical_language>critical - HashSet</technical_language>

Target:
public void setUp() throws Exception { super.setUp(); dao = dbFacade.getEngineSessionDao(); newEngineSession = new EngineSession(); newEngineSession.setEngineSessionId(Guid.newGuid().toString()); newEngineSession.setUserId(Guid.newGuid()); newEngineSession.setRoleIds(new HashSet<Guid>(Arrays.asList(FixturesTool.EXISTING_GROUP_ID))); newEngineSession.setGroupIds(new HashSet<Guid>(Arrays.asList(FixturesTool.EXISTING_GROUP_ID))); newEngineSession.setUserName(""); existingEngineSession = dao.get(ID); }
Source:
<code>public List<Statement> createNodesStatements() { assertStatementFactoryExists(); Map<String, Set<Node>> newNodesByLabels = groupNodesByLabel(newNodeBuilders); List<Statement> statements = new ArrayList<>(newNodesByLabels.size()); for (Set<Node> nodeModels : newNodesByLabels.values()) { NewNodeEmitter newNodeEmitter = new NewNodeEmitter(nodeModels); Pair<String, Map<String, Object>> emittedCypher = newNodeEmitter.emit(); <START> statements.add(statementFactory.statement(emittedCypher.first, emittedCypher.second)); <END> } return statements; }</code><technical_language>if emit() a Pair internally (for sake of argument) statementFactory.statement(pair.first, pair.second) emit actual Statement: statements.add(newNodeEmitter.emit()) xxxEmitter classes more proper statment builders, e.g.: statements.add(newNodeStatements().build())</technical_language>

Target:
public List<Statement> createNodesStatements() { assertStatementFactoryExists(); Map<String, Set<Node>> newNodesByLabels = groupNodesByLabel(newNodeBuilders); List<Statement> statements = new ArrayList<>(newNodesByLabels.size()); for (Set<Node> nodeModels : newNodesByLabels.values()) { NewNodeStatementBuilder newNodeBuilder = new NewNodeStatementBuilder(nodeModels, statementFactory); statements.add(newNodeBuilder.build()); } return statements; }
Source:
<code>public void enrich(final BatchItem batchItem, final EventType eventType) throws EnrichmentException { try { final JSONObject metadata = batchItem.getEvent().getJSONObject("metadata"); setReceivedAt(metadata); setEventTypeName(metadata, eventType); setFlowId(metadata); <START> setPartiotion(metadata, batchItem); <END> } catch (final JSONException e) { throw new EnrichmentException("enrichment error", e); } }</code><technical_language>Typo: s/setPartiotion/setPartition/</technical_language>

Target:
public void enrich(final BatchItem batchItem, final EventType eventType) throws EnrichmentException { try { final JSONObject metadata = batchItem.getEvent().getJSONObject("metadata"); setReceivedAt(metadata); setEventTypeName(metadata, eventType); setFlowId(metadata); setPartition(metadata, batchItem); } catch (final JSONException e) { throw new EnrichmentException("enrichment error", e); } }