auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static KeyStore loadTrustStore(File trustStorePath, Optional<String> trustStorePassword) <START> throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException <END> { KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType()); try { List<X509Certificate> certificateChain = PemReader.readCertificateChain(trustStorePath); if (!certificateChain.isEmpty()) { trustStore.load(null, null); for (X509Certificate certificate : certificateChain) { X500Principal principal = certificate.getSubjectX500Principal(); trustStore.setCertificateEntry(principal.getName("RFC2253"), certificate); } } } catch (IOException | GeneralSecurityException e) { } try (InputStream in = new FileInputStream(trustStorePath)) { trustStore.load(in, trustStorePassword.map(String::toCharArray).orElse(null)); } return trustStore; }</code><technical_language>this IOException, GeneralSecurityException</technical_language>

Target:
private static KeyStore loadTrustStore(File trustStorePath, Optional<String> trustStorePassword) throws IOException, GeneralSecurityException { KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType()); try { List<X509Certificate> certificateChain = PemReader.readCertificateChain(trustStorePath); if (!certificateChain.isEmpty()) { trustStore.load(null, null); for (X509Certificate certificate : certificateChain) { X500Principal principal = certificate.getSubjectX500Principal(); trustStore.setCertificateEntry(principal.getName(), certificate); } return trustStore; } } catch (IOException | GeneralSecurityException ignored) { } try (InputStream in = new FileInputStream(trustStorePath)) { trustStore.load(in, trustStorePassword.map(String::toCharArray).orElse(null)); } return trustStore; }
Source:
<code>public boolean supports(AuthenticationToken token) { if (!(token instanceof BaseAuthenticationToken)) { LOGGER.debug( "The supplied authentication token is not an instance of BaseAuthenticationToken. Sending back not supported."); return false; } BaseAuthenticationToken authToken = (BaseAuthenticationToken) token; Object credentials = authToken.getCredentials(); <START> if (credentials == null || authToken.getType() != AuthenticationTokenType.PKI) { <END> LOGGER.debug( "The supplied authentication token has null/empty credentials. Sending back no supported."); return false; } LOGGER.debug("Token is supported by {}.", token.getClass(), PKIRealm.class.getName()); return true; }</code><technical_language>I split this check token type prior checking for credentials. a personal preference, though</technical_language>

Target:
public boolean supports(AuthenticationToken token) { if (!(token instanceof BaseAuthenticationToken)) { LOGGER.debug( "The supplied authentication token is not an instance of BaseAuthenticationToken. Sending back not supported."); return false; } BaseAuthenticationToken authToken = (BaseAuthenticationToken) token; Object credentials = authToken.getCredentials(); Object principal = authToken.getPrincipal(); if (authToken.getType() != AuthenticationTokenType.PKI) { LOGGER.debug( "The supplied authentication token has null/empty credentials. Sending back no supported."); return false; } if (credentials instanceof X509Certificate[] && principal instanceof X500Principal) { LOGGER.debug("Token is supported by {}.", token.getClass(), PKIRealm.class.getName()); return true; } return false; }
Source:
<code>private static OMElement loadConfigXML() throws EventBrokerConfigurationException { <START> String carbonConfigHome = System.getProperty(ServerConstants.CARBON_CONFIG_DIR_PATH); <END> String path = carbonConfigHome + File.separator + EventBrokerConstants.EB_CONF; BufferedInputStream inputStream = null; try { inputStream = new BufferedInputStream(new FileInputStream(new File(path))); XMLStreamReader parser = XMLInputFactory.newInstance(). createXMLStreamReader(inputStream); StAXOMBuilder builder = new StAXOMBuilder(parser); OMElement omElement = builder.getDocumentElement(); omElement.build(); return omElement; } catch (FileNotFoundException e) { throw new EventBrokerConfigurationException(EventBrokerConstants.EB_CONF + "cannot be found in the path : " + path, e); } catch (XMLStreamException e) { throw new EventBrokerConfigurationException("Invalid XML for " + EventBrokerConstants.EB_CONF + " located in the path : " + path, e); } finally { try { if (inputStream != null) { inputStream.close(); } } catch (IOException ingored) { throw new EventBrokerConfigurationException("Can not close the input stream"); } } }</code><technical_language>In previous implementation, path constructed. If System property is defined, is issue</technical_language>

Target:
private static OMElement loadConfigXML() throws EventBrokerConfigurationException { String carbonConfigHome = CarbonBaseUtils.getCarbonConfigDirPath(); String path = Paths.get(carbonConfigHome, EventBrokerConstants.EB_CONF).toString(); BufferedInputStream inputStream = null; try { inputStream = new BufferedInputStream(new FileInputStream(new File(path))); XMLStreamReader parser = XMLInputFactory.newInstance(). createXMLStreamReader(inputStream); StAXOMBuilder builder = new StAXOMBuilder(parser); OMElement omElement = builder.getDocumentElement(); omElement.build(); return omElement; } catch (FileNotFoundException e) { throw new EventBrokerConfigurationException(EventBrokerConstants.EB_CONF + "cannot be found in the path : " + path, e); } catch (XMLStreamException e) { throw new EventBrokerConfigurationException("Invalid XML for " + EventBrokerConstants.EB_CONF + " located in the path : " + path, e); } finally { try { if (inputStream != null) { inputStream.close(); } } catch (IOException ingored) { throw new EventBrokerConfigurationException("Can not close the input stream"); } } }
Source:
<code>protected OWLOntology loadModelABox(IRI modelId) throws OWLOntologyCreationException { LOG.info("Load model abox: " + modelId + " from database"); try { BigdataSailRepositoryConnection connection = repo.getReadOnlyConnection(); try { RepositoryResult<Resource> graphs = connection.getContextIDs(); if (!Iterations.asSet(graphs).contains(new URIImpl(modelId.toString()))) { throw new OWLOntologyCreationException("No such model in datastore: " + modelId); } graphs.close(); RepositoryResult<Statement> statements = connection.getStatements(null, null, null, false, new URIImpl(modelId.toString())); <START> boolean minimal = false; <END> OWLOntology abox = loadOntologyDocumentSource(new RioMemoryTripleSource(statements), minimal); statements.close(); abox = postLoadFileFilter(abox); return abox; } finally { connection.close(); } } catch (RepositoryException e) { throw new OWLOntologyCreationException(e); } }</code><technical_language>minimal is supposed true I think. This method loads abox needing tbox, needs for RDF cases, for pulling out model metadata loading Arachne</technical_language>

Target:
protected OWLOntology loadModelABox(IRI modelId) throws OWLOntologyCreationException { LOG.info("Load model abox: " + modelId + " from database"); try { BigdataSailRepositoryConnection connection = repo.getReadOnlyConnection(); try { RepositoryResult<Resource> graphs = connection.getContextIDs(); if (!Iterations.asSet(graphs).contains(new URIImpl(modelId.toString()))) { throw new OWLOntologyCreationException("No such model in datastore: " + modelId); } graphs.close(); RepositoryResult<Statement> statements = connection.getStatements(null, null, null, false, new URIImpl(modelId.toString())); boolean minimal = true; OWLOntology abox = loadOntologyDocumentSource(new RioMemoryTripleSource(statements), minimal); statements.close(); abox = postLoadFileFilter(abox); return abox; } finally { connection.close(); } } catch (RepositoryException e) { throw new OWLOntologyCreationException(e); } }
Source:
<code>private CreateTableAsSelect(Optional<NodeLocation> location, QualifiedName name, Query query, boolean notExists, List<Property> properties, boolean withData, Optional<List<Identifier>> columnAliases, Optional<String> comment) { super(location); this.name = requireNonNull(name, "name is null"); this.query = requireNonNull(query, "query is null"); this.notExists = notExists; <START> this.properties = requireNonNull(properties, "properties is null"); <END> this.withData = withData; this.columnAliases = columnAliases; this.comment = requireNonNull(comment, "comment is null"); }</code><technical_language>This a defensive copy of list</technical_language>

Target:
private CreateTableAsSelect(Optional<NodeLocation> location, QualifiedName name, Query query, boolean notExists, List<Property> properties, boolean withData, Optional<List<Identifier>> columnAliases, Optional<String> comment) { super(location); this.name = requireNonNull(name, "name is null"); this.query = requireNonNull(query, "query is null"); this.notExists = notExists; this.properties = ImmutableList.copyOf(requireNonNull(properties, "properties is null")); this.withData = withData; this.columnAliases = columnAliases; this.comment = requireNonNull(comment, "comment is null"); }
Source:
<code>protected void emitRecordsWithTimestamps( Queue<T> records, KafkaTopicPartitionState<T, KPH> partitionState, long offset, long kafkaEventTimestamp) { synchronized (checkpointLock) { T record; while ((record = records.poll()) != null) { long timestamp; synchronized (partitionState) { timestamp = partitionState.extractTimestamp(record, kafkaEventTimestamp); <START> partitionState.onEvent(record, timestamp); <END> } sourceContext.collectWithTimestamp(record, timestamp); synchronized (partitionState) { partitionState.onEvent(record, timestamp); } } partitionState.setOffset(offset); } }</code><technical_language>I this line removed, no? happen collect</technical_language>

Target:
protected void emitRecordsWithTimestamps( Queue<T> records, KafkaTopicPartitionState<T, KPH> partitionState, long offset, long kafkaEventTimestamp) { synchronized (checkpointLock) { T record; while ((record = records.poll()) != null) { long timestamp = partitionState.extractTimestamp(record, kafkaEventTimestamp); sourceContext.collectWithTimestamp(record, timestamp); partitionState.onEvent(record, timestamp); } partitionState.setOffset(offset); } }
Source:
<code>public boolean isApplicable(String requestPath) { <START> List<String> applicablePaths = ImmutableList.of("druid/coordinator/v1/security/"); <END> for (String path : applicablePaths) { if (requestPath.startsWith(path) && !requestPath.equals(path)) { return true; } } return false; }</code><technical_language>list needed</technical_language>

Target:
public boolean isApplicable(String requestPath) { for (String path : applicablePaths) { if (requestPath.startsWith(path) && !requestPath.equals(path)) { return true; } } return false; }
Source:
<code>private void markTimelineDeleted(final Timeline timeline) { try { timeline.setDeleted(true); <START> timelineDbRepository.updateTimelime(timeline); <END> eventTypeCache.updated(timeline.getEventType()); } catch (final InconsistentStateException e) { LOG.error("Failed to serialize timeline to DB when marking timeline as deleted", e); } catch (final RepositoryProblemException e) { LOG.error("DB failure when marking timeline as deleted", e); } catch (Exception e) { LOG.error("ZK error occurred when updating ET cache", e); } }</code><technical_language>here, updated timeline, event type update failed vice versa</technical_language>

Target:
private void markTimelineDeleted(final Timeline timeline) { boolean timelineUpdatedInDB = false; boolean cacheUpdated = false; try { timeline.setDeleted(true); timelineDbRepository.updateTimelime(timeline); timelineUpdatedInDB = true; eventTypeCache.updated(timeline.getEventType()); cacheUpdated = true; } catch (final InconsistentStateException e) { LOG.error("Failed to serialize timeline to DB when marking timeline as deleted", e); } catch (final RepositoryProblemException e) { LOG.error("DB failure when marking timeline as deleted", e); } catch (Exception e) { LOG.error("ZK error occurred when updating ET cache", e); } finally { if (timelineUpdatedInDB && !cacheUpdated) { try { timeline.setDeleted(false); timelineDbRepository.updateTimelime(timeline); } catch (final Exception e) { LOG.error("Failed to revert timeline state", e); } } } }
Source:
<code>private EventData setSpanContext(EventData event, Context parentContext) { Optional<Object> eventContextData = event.context().getData(SPAN_CONTEXT); if (eventContextData.isPresent()) { <START> tracerProvider.addSpanLinks((Context) eventContextData.get()); <END> return event; } else { Context eventSpanContext = tracerProvider.startSpan(parentContext, ProcessKind.MESSAGE); if (eventSpanContext != null && eventSpanContext.getData(DIAGNOSTIC_ID_KEY).isPresent()) { event.addProperty(DIAGNOSTIC_ID_KEY, eventSpanContext.getData(DIAGNOSTIC_ID_KEY).get().toString()); tracerProvider.endSpan(eventSpanContext, null); event.addContext(SPAN_CONTEXT, eventSpanContext); } } return event; }</code><technical_language>add a check eventContextData.get() is instanceof Context defensive. invalid cast exception crashes program fun. logger/error handling surface errors gracefully</technical_language>

Target:
private EventData setSpanContext(EventData event, Context parentContext) { Optional<Object> eventContextData = event.context().getData(SPAN_CONTEXT); if (eventContextData.isPresent()) { Object spanContextObject = eventContextData.get(); if (spanContextObject instanceof Context) { tracerProvider.addSpanLinks((Context) eventContextData.get()); } else { logger.warning(String.format(Locale.US, "Event Data context type is not of type Context, but type: %s. Not adding span links.", spanContextObject != null ? spanContextObject.getClass() : "null")); } return event; } else { Context eventSpanContext = tracerProvider.startSpan(parentContext, ProcessKind.RECEIVE); if (eventSpanContext != null) { Optional<Object> eventDiagnosticIdOptional = eventSpanContext.getData(DIAGNOSTIC_ID_KEY); if (eventDiagnosticIdOptional.isPresent()) { event.addProperty(DIAGNOSTIC_ID_KEY, eventDiagnosticIdOptional.get().toString()); tracerProvider.endSpan(eventSpanContext, Signal.complete()); event.addContext(SPAN_CONTEXT, eventSpanContext); } } } return event; }
Source:
<code>private void setVdsmId(String eventName, String eventUrl) { if (!eventName.equals(AnsibleConstants.TASK_VDSM_ID)) { return; } String vdsmid = runnerClient.getVdsmId(eventUrl); log.info( "Host reports unique id {}", getVds().getHostName(), vdsmid ); final List<VDS> list = vdsDao.getAllWithUniqueId(vdsmid).stream().filter( vds -> !vds.getId().equals(getVds().getId())).collect(Collectors.toList() ); if (!list.isEmpty()) { final StringBuilder hosts = new StringBuilder(1024); <START> for (VDS v : list) { if (hosts.length() > 0) { hosts.append(", "); } hosts.append(v.getName()); } <END> log.error( "Host reports duplicate unique id of following hosts {}", getVds().getHostName(), vdsmid, hosts ); throw new SoftError( String.format( "Host %1$s reports unique id which already registered for %2$s", getVds().getHostName(), hosts ) ); } log.info("Assigning unique id to Host {}", vdsmid, getVds().getHostName()); getVds().setUniqueId(vdsmid); TransactionSupport.executeInNewTransaction(() -> { vdsStaticDao.update(getVds().getStaticData()); return null; }); }</code><technical_language>replaced with: hosts.stream().map(VDS::getName).collect(Collectors.joining(","));</technical_language>

Target:
private void setVdsmId(String eventName, String eventUrl) { if (!eventName.equals(AnsibleConstants.TASK_VDSM_ID)) { return; } String vdsmid = runnerClient.getVdsmId(eventUrl); log.info( "Host reports unique id {}", getVds().getHostName(), vdsmid ); final List<String> hosts = vdsDao.getAllWithUniqueId(vdsmid) .stream() .filter(vds -> !vds.getId().equals(getVds().getId())) .map(VDS::getName) .collect(Collectors.toList()); if (!hosts.isEmpty()) { log.error( "Host reports duplicate unique id of following hosts {}", getVds().getHostName(), vdsmid, hosts ); throw new SoftError( String.format( "Host %1$s reports unique id which already registered for %2$s", getVds().getHostName(), hosts ) ); } log.info("Assigning unique id to Host {}", vdsmid, getVds().getHostName()); getVds().setUniqueId(vdsmid); TransactionSupport.executeInNewTransaction(() -> { vdsStaticDao.update(getVds().getStaticData()); return null; }); }
Source:
<code>protected void handleComparison(IFile oldData, IFile newData) { String title = MessageFormat.format(Messages.ContentDescription_0, new Object[] { oldData.getName(), newData.getName() }); IPath oldDatum = oldData.getLocation(); IPath newDatum = newData.getLocation(); <START> System.out.println(oldDatum); <END> System.out.println(newDatum); ReportComparisonData diffData = new ReportComparisonData(title, oldDatum, newDatum, newData.getProject()); diffData.parse(); PerfPlugin.getDefault().setReportDiffData(diffData); ReportComparisonView.refreshView(); }</code><technical_language>is this System.out.println needed ? This unnoticed durign regular IDE usage. remove it</technical_language>

Target:
protected void handleComparison(IFile oldData, IFile newData) { String title = MessageFormat.format(Messages.ContentDescription_0, new Object[] { oldData.getName(), newData.getName() }); IPath oldDatum = oldData.getLocation(); IPath newDatum = newData.getLocation(); ReportComparisonData diffData = new ReportComparisonData(title, oldDatum, newDatum, newData.getProject()); diffData.parse(); PerfPlugin.getDefault().setReportDiffData(diffData); ReportComparisonView.refreshView(); }
Source:
<code>private ContactDataBuilder extractContactData(ContactDataBuilder builder, long contactId, Cursor cursor) { final ColumnProcessors processors = new ColumnProcessors(); builder.setContactId(contactId); builder.setName(processors.forString().extract(cursor, Column.display_name)); builder.setPhotoId(processors.forInteger().extract(cursor, Column.photo_id)); String mimeType = processors.forString().extract(cursor, Column.mimetype); String data = processors.forString().extract(cursor, Column.data1); int isPrimary = processors.forInteger().extract(cursor, Column.is_primary); <START> if (mimeType.equals(Email.CONTENT_ITEM_TYPE)) { <END> builder.addEmailId(data); } else if (mimeType.equals(Phone.CONTENT_ITEM_TYPE)) { builder.addPhoneNumber(new ContactNumber(data, isPrimary > 0 ? true : false)); } return builder; }</code><technical_language>contact email phone? Do need merge multiple contacts somewhere</technical_language>

Target:
private ContactDataBuilder extractContactData(ContactDataBuilder builder, long contactId, Cursor cursor) { final ColumnProcessors processors = new ColumnProcessors(); builder.setContactId(contactId); builder.setName(processors.forString().extract(cursor, Column.DISPLAY_NAME)); builder.setPhotoId(processors.forInteger().extract(cursor, Column.PHOTO_ID)); String mimeType = processors.forString().extract(cursor, Column.MIMETYPE); String data = processors.forString().extract(cursor, Column.DATA1); int isPrimary = processors.forInteger().extract(cursor, Column.IS_PRIMARY); if (mimeType.equals(Email.CONTENT_ITEM_TYPE)) { builder.addEmailId(data); } else if (mimeType.equals(Phone.CONTENT_ITEM_TYPE)) { builder.addPhoneNumber(new ContactNumber(data, isPrimary > 0 ? true : false)); } return builder; }
Source:
<code>private void init(ITestNGMethod method, ITestContext ctx, Throwable t, long start, long end) { m_throwable = t; m_instanceName = method.getTestClass().getName(); if (null == m_throwable) { m_status = ITestResult.SUCCESS; } m_startMillis = start; m_endMillis = end; m_method = method; m_context = ctx; Object instance = method.getInstance(); if (instance == null) { m_name = m_method.getMethodName(); return; } if (instance instanceof ITest) { m_name = ((ITest) instance).getTestName(); <START> if (m_name == null) { <END> String msg = String.format( "Warning: [%s] implementation on class [%s] returned null. Defaulting to method name", ITest.class.getName(), instance.getClass().getName()); if (TestRunner.getVerbose() > 1) { System.err.println(msg); } } } else if (method.getTestClass().getTestName() != null) { m_name = method.getTestClass().getTestName(); } else { String string = instance.toString(); m_name = getMethod().getMethodName(); try { if (!Object.class .getMethod("toString") .equals(instance.getClass().getMethod("toString"))) { m_instanceName = string.startsWith("class ") ? string.substring("class ".length()) : string; m_name = m_name + " on " + m_instanceName; } } catch (NoSuchMethodException ignore) { } } }</code><technical_language>returning if m_name != null</technical_language>

Target:
private void init(ITestNGMethod method, ITestContext ctx, Throwable t, long start, long end) { m_throwable = t; m_instanceName = method.getTestClass().getName(); if (null == m_throwable) { m_status = ITestResult.SUCCESS; } m_startMillis = start; m_endMillis = end; m_method = method; m_context = ctx; Object instance = method.getInstance(); if (instance == null) { m_name = m_method.getMethodName(); return; } if (instance instanceof ITest) { m_name = ((ITest) instance).getTestName(); if (m_name != null) { return; } m_name = m_method.getMethodName(); if (TestRunner.getVerbose() > 1) { String msg = String.format( "Warning: [%s] implementation on class [%s] returned null. Defaulting to method name", ITest.class.getName(), instance.getClass().getName()); System.err.println(msg); } return; } if (method.getTestClass().getTestName() != null) { m_name = method.getTestClass().getTestName(); return; } String string = instance.toString(); m_name = getMethod().getMethodName(); try { if (!Object.class .getMethod("toString") .equals(instance.getClass().getMethod("toString"))) { m_instanceName = string.startsWith("class ") ? string.substring("class ".length()) : string; m_name = m_name + " on " + m_instanceName; } } catch (NoSuchMethodException ignore) { } }
Source:
<code><START> public PollerFlux<CreateSearchResponse, PhoneNumberSearch> beginCreateSearch( <END> CreateSearchOptions options, Duration lroDuration) { final Duration interval = lroDuration != null ? lroDuration : DEFAULT_POLL_DURATION; return new PollerFlux<CreateSearchResponse, PhoneNumberSearch>(interval, activationOperation(options), createPollOperation(), (activationResponse, pollingContext) -> Mono.error(new RuntimeException("Cancellation is not supported")), fetchResultOperation()); }</code><technical_language>Public client methods @ServiceMethod annotation</technical_language>

Target:
public PollerFlux<PhoneNumberSearch, PhoneNumberSearch> beginCreateSearch( CreateSearchOptions options, Duration lroDuration) { final Duration interval = lroDuration != null ? lroDuration : DEFAULT_POLL_DURATION; return new PollerFlux<PhoneNumberSearch, PhoneNumberSearch>(interval, createSearchActivationOperation(options), createSearchPollOperation(), (activationResponse, pollingContext) -> Mono.error(new RuntimeException("Cancellation is not supported")), createSearchFetchResultOperation()); }
Source:
<code>public InputStream getStream() throws IOException { Response<ResponseBody> response = generator.simpleGet(uri); if (response.isSuccessful()) { return response.body().byteStream(); } else { <START> throw new RuntimeException(Localization.get("install.fail.error", Integer.toString(response.code()))); <END> } }</code><technical_language>Granted expect HTTP errors happen regularly is throwing a RuntimeException behavior? throw this IOException catch ? Also, this crash application</technical_language>

Target:
public InputStream getStream() throws IOException { Response<ResponseBody> response = generator.simpleGet(uri); if (response.isSuccessful()) { return response.body().byteStream(); } else { throw new IOException(Localization.get("install.fail.error", Integer.toString(response.code()))); } }
Source:
<code>public MessageHandler createHandler(Message message, NotificationContext context) { <START> if (message.getResourceName()!="testStaledMessageResource") { <END> return new TestStateTransitionMessageHandler(message, context); } else { CurrentState currentStateDelta = new CurrentState(message.getResourceName()); currentStateDelta.setSessionId(message.getTgtSessionId()); currentStateDelta.setStateModelDefRef(message.getStateModelDef()); currentStateDelta.setStateModelFactoryName(message.getStateModelFactoryName()); currentStateDelta.setBucketSize(message.getBucketSize()); currentStateDelta.setState(message.getPartitionName(), "MASTER"); return new TestStateTransitionMessageHandler(message, context, currentStateDelta); } }</code><technical_language>equals() check string names same. != checks if **same** object: memory address, etc.</technical_language>

Target:
public MessageHandler createHandler(Message message, NotificationContext context) { CurrentState currentStateDelta = new CurrentState(message.getResourceName()); currentStateDelta.setSessionId(message.getTgtSessionId()); currentStateDelta.setStateModelDefRef(message.getStateModelDef()); currentStateDelta.setStateModelFactoryName(message.getStateModelFactoryName()); currentStateDelta.setBucketSize(message.getBucketSize()); if (!message.getResourceName().equals("testStaledMessageResource")) { currentStateDelta.setState(message.getPartitionName(), "SLAVE"); } else { currentStateDelta.setState(message.getPartitionName(), "MASTER"); } return new TestStateTransitionMessageHandler(message, context, currentStateDelta); }
Source:
<code>public void addScope(ScopeEvent event) { Scope scope = new Scope(); scope.setName(event.getName()); scope.setRoles(event.getRoles()); scope.setDisplayName(event.getDisplayName()); scope.setDescription(event.getDescription()); scope.setTimeStamp(event.getTimeStamp()); SubscriptionDataStore store = SubscriptionDataHolder.getInstance() .getTenantSubscriptionStore(event.getTenantDomain()); if (store == null) { if (log.isDebugEnabled()) { <START> log.debug("Ignoring the Event due to tenant " + event.getTenantDomain() + " not loaded"); <END> } return; } store.addOrUpdateScope(scope); }</code><technical_language>suggestion log.debug("Ignoring event tenant " + event.getTenantDomain() + " is loaded");</technical_language>

Target:
public void addScope(ScopeEvent event) { Scope scope = new Scope(); scope.setName(event.getName()); scope.setRoles(event.getRoles()); scope.setDisplayName(event.getDisplayName()); scope.setDescription(event.getDescription()); scope.setTimeStamp(event.getTimeStamp()); SubscriptionDataStore store = SubscriptionDataHolder.getInstance() .getTenantSubscriptionStore(event.getTenantDomain()); if (store == null) { if (log.isDebugEnabled()) { log.debug("Ignoring the event as the tenant " + event.getTenantDomain() + " is not loaded"); } return; } store.addOrUpdateScope(scope); }
Source:
<code>public static IProject getProject(String name, Connection connection) { assertNotNull(connection); if (StringUtils.isBlank(name)) { return null; } <START> for (IResource resource : connection.getResources(ResourceKind.PROJECT)) { <END> if (name.equals(resource.getName())) { return (IProject) resource; } } return null; }</code><technical_language>Replace safeGetResource(kind, name, null, connection)</technical_language>

Target:
public static IProject getProject(String name, Connection connection) { assertNotNull(connection); if (StringUtils.isBlank(name)) { return null; } return safeGetResource(ResourceKind.PROJECT, name, null, connection); }
Source:
<code>private void createThreadToInterrupt() { new Thread(() -> { try { latch.await(1, TimeUnit.SECONDS); } catch (InterruptedException e) { e.printStackTrace(); } int size = context.getAsyncProcessorAwaitManager().size(); <START> System.out.println("In-flight messages: " + size); <END> assertEquals(1, size); Collection<AsyncProcessorAwaitManager.AwaitThread> threads = context.getAsyncProcessorAwaitManager().browse(); AsyncProcessorAwaitManager.AwaitThread thread = threads.iterator().next(); String id = thread.getExchange().getExchangeId(); context.getAsyncProcessorAwaitManager().interrupt(id); }).start(); }</code><technical_language>Please avoid System.out.println if required for use-case. logs for it</technical_language>

Target:
private void createThreadToInterrupt() { new Thread(() -> { try { latch.await(1, TimeUnit.SECONDS); } catch (InterruptedException e) { e.printStackTrace(); } int size = context.getAsyncProcessorAwaitManager().size(); assertEquals(1, size); Collection<AsyncProcessorAwaitManager.AwaitThread> threads = context.getAsyncProcessorAwaitManager().browse(); AsyncProcessorAwaitManager.AwaitThread thread = threads.iterator().next(); String id = thread.getExchange().getExchangeId(); context.getAsyncProcessorAwaitManager().interrupt(id); }).start(); }
Source:
<code>public static int encode( final MutableDirectBuffer mutableDirectBuffer, final int offset, final int streamId, final int flags, final FrameType type, final ByteBuffer metadata, final ByteBuffer data ) { if (type == FrameType.REQUEST_CHANNEL) { <START> throw new AssertionError("REQUEST_CHANNEL most have initial request N"); <END> } final int frameLength = computeFrameLength(type, metadata.remaining(), data.remaining()); int length = FrameHeaderFlyweight.encodeFrameHeader(mutableDirectBuffer, offset, frameLength, flags, type, streamId); length += FrameHeaderFlyweight.encodeMetadata(mutableDirectBuffer, offset, offset + length, metadata); length += FrameHeaderFlyweight.encodeData(mutableDirectBuffer, offset + length, data); return length; }</code><technical_language>typo:</technical_language>

Target:
public static int encode( final MutableDirectBuffer mutableDirectBuffer, final int offset, final int streamId, final int flags, final FrameType type, final ByteBuffer metadata, final ByteBuffer data ) { if (type.hasInitialRequestN()) { throw new AssertionError(type + " must not be encoded without initial request N"); } final int frameLength = computeFrameLength(type, metadata.remaining(), data.remaining()); int length = FrameHeaderFlyweight.encodeFrameHeader(mutableDirectBuffer, offset, frameLength, flags, type, streamId); length += FrameHeaderFlyweight.encodeMetadata(mutableDirectBuffer, offset, offset + length, metadata); length += FrameHeaderFlyweight.encodeData(mutableDirectBuffer, offset + length, data); return length; }
Source:
<code>protected void compose() { final Execution exec = Executions.getCurrent(); if (exec == null) throw new IllegalStateException("No execution available"); if (isInline()) { if (_inlines != null) return; _inlines = exec.createComponents(_uri != null ? _uri : getDefinition().getMacroURI(), _props); } else { if (!getChildren().isEmpty()) return; exec.createComponents(_uri != null ? _uri : getDefinition().getMacroURI(), this, _props); } <START> this.addEventListener(-10000, "onCreate", new EventListener<Event>() { <END> public void onEvent(Event event) throws Exception { HtmlMacroComponent.this.wireMarcoComponent(); } }); }</code><technical_language>1. Events.ON_CREATE 2. need this</technical_language>

Target:
protected void compose() { final Execution exec = Executions.getCurrent(); if (exec == null) throw new IllegalStateException("No execution available"); if (isInline()) { if (_inlines != null) return; _inlines = exec.createComponents(_uri != null ? _uri : getDefinition().getMacroURI(), _props); } else { if (!getChildren().isEmpty()) return; exec.createComponents(_uri != null ? _uri : getDefinition().getMacroURI(), this, _props); } addEventListener(-10000, Events.ON_CREATE, new EventListener<Event>() { public void onEvent(Event event) throws Exception { HtmlMacroComponent.this.wireMarcoComponent(); } }); }
Source:
<code>public void setUp() { IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT); try { project.create(null); project.open(null); fResource = project.getFile(RESOURCE); final InputStream source = new ByteArrayInputStream(new byte[0]); fResource.create(source, true, null); fResource.setPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, fResource.getParent().getLocationURI().getPath()); } catch (CoreException e) { <START> e.printStackTrace(); <END> } }</code><technical_language>do a good clean fail()</technical_language>

Target:
public void setUp() throws CoreException { IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT); if (!project.exists()) { project.create(null); } project.open(null); fResource = project.getFile(RESOURCE); if (!fResource.exists()) { final InputStream source = new ByteArrayInputStream(new byte[0]); fResource.create(source, true, null); } fResource.setPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, fResource.getParent().getLocationURI().getPath()); }
Source:
<code>public IgniteTestResources(MBeanServer jmx) throws IgniteCheckedException { assert jmx != null; this.jmx = jmx; <START> log = rootLog.getLogger(getClass()); <END> ctx = new GridTestKernalContext(log); rsrcProc = new GridResourceProcessor(ctx); }</code><technical_language>this change</technical_language>

Target:
public IgniteTestResources(MBeanServer jmx) throws IgniteCheckedException { assert jmx != null; this.jmx = jmx; this.log = rootLog.getLogger(getClass()); this.ctx = new GridTestKernalContext(log); this.rsrcProc = new GridResourceProcessor(ctx); }
Source:
<code>private void checkFileExistence(AssetFileIdentity fileIdentity, boolean expectedToExist) throws IOException { try (InputStream stream = contentRepoService.getLatestRepoObject(fileIdentity.toString())) { assertNotNull(stream); assertTrue(expectedToExist); } catch (InMemoryContentRepoService.InMemoryContentRepoServiceException me) { assertFalse(expectedToExist); } catch (NotFoundException nfe) { <START> assertFalse(expectedToExist); <END> } catch (ContentRepoException e) { throw e; } }</code><technical_language>a single catch block</technical_language>

Target:
private void checkFileExistence(AssetFileIdentity fileIdentity, boolean expectedToExist) throws IOException { try (InputStream stream = contentRepoService.getLatestRepoObject(fileIdentity.toString())) { assertNotNull(stream); assertTrue(expectedToExist); } catch (InMemoryContentRepoService.InMemoryContentRepoServiceException|NotFoundException nfe) { assertFalse(expectedToExist); } catch (ContentRepoException e) { throw e; } }
Source:
<code><START> public Square get(Point point){ <END> return squares[point.y][point.x]; }</code><technical_language>set() find() bypassing Square Entity directly, get() return List<Entity> ? Square class public, implementation detail</technical_language>

Target:
public List<Entity> get(Point point){ return getSquare(point).getEntities(); }
Source:
<code>private IncrementalIndex makeIncIndex() { return new OnheapIncrementalIndex( <START> 0, <END> QueryGranularity.NONE, QueryBenchmarkUtil.INGESTION_AGGS, true, false, true, MAX_ROWS ); }</code><technical_language>[minor] I kinda prefer IncrementalIndexSchema based constructor, builder easier read on</technical_language>

Target:
private IncrementalIndex makeIncIndex() { return new OnheapIncrementalIndex( new IncrementalIndexSchema.Builder() .withQueryGranularity(QueryGranularities.NONE) .withMetrics(schemaInfo.getAggsArray()) .withDimensionsSpec(new DimensionsSpec(null, null, null)) .build(), true, false, true, rowsPerSegment ); }
Source:
<code>public void retryWithDataProvider() { TestNG testng = create(DataProviderRetryTest.class); TestListenerAdapter tla = new TestListenerAdapter(); DataProviderRerunListener listener = new DataProviderRerunListener(); testng.addListener((ITestNGListener) tla); testng.addListener(listener); <START> testng.run(); <END> assertThat(tla.getFailedTests()).size().isEqualTo(1); assertThat(tla.getSkippedTests()).size().isEqualTo(2); }</code><technical_language>mentioned above, this listener is required</technical_language>

Target:
public void retryWithDataProvider() { TestNG testng = create(DataProviderRetryTest.class); TestListenerAdapter tla = new TestListenerAdapter(); testng.addListener((ITestNGListener) tla); testng.run(); assertThat(tla.getFailedTests()).size().isEqualTo(1); assertThat(tla.getSkippedTests()).size().isEqualTo(2); }
Source:
<code>public final void init(Config config, TaskContext context) throws Exception { if (this.userTask instanceof InitableTask) { ((InitableTask) this.userTask).init(config, context); } Map<SystemStreamPartition, MessageStream<IncomingSystemMessage>> messageStreams = new HashMap<>(); context.getSystemStreamPartitions().forEach(ssp -> messageStreams.put(ssp, new MessageStreamImpl<>())); this.userTask.transform(messageStreams); messageStreams.forEach((ssp, ms) -> { <START> OperatorImpl<IncomingSystemMessage, ? extends Message> rootOperator = <END> OperatorImpls.createOperatorImpls((MessageStreamImpl<IncomingSystemMessage>) ms, context); operatorChains.put(ssp, rootOperator); }); }</code><technical_language>minor, simpler following: operatorChains.put(ssp, OperatorImpls.createOperatorImpls((MessageStreamImpl<IncomingSystemMessage>) ms, context));</technical_language>

Target:
public final void init(Config config, TaskContext context) throws Exception { if (this.userTask instanceof InitableTask) { ((InitableTask) this.userTask).init(config, context); } Map<SystemStreamPartition, MessageStream<IncomingSystemMessageEnvelope>> messageStreams = new HashMap<>(); context.getSystemStreamPartitions().forEach(ssp -> messageStreams.put(ssp, new MessageStreamImpl<>())); this.userTask.transform(messageStreams); messageStreams.forEach((ssp, ms) -> operatorChains.put(ssp, OperatorImpls.createOperatorImpls((MessageStreamImpl<IncomingSystemMessageEnvelope>) ms, context))); }
Source:
<code>public UploadPartRequest newUploadPartRequest( String destKey, String uploadId, int partNumber, int size, InputStream uploadStream, File sourceFile, Long offset) throws PathIOException { checkNotNull(uploadId); checkArgument((uploadStream != null) ^ (sourceFile != null), "Data source"); checkArgument(size >= 0, "Invalid partition size %s", size); checkArgument(partNumber > 0, "partNumber must be between 1 and %s inclusive, but is %s", UPLOAD_PART_COUNT_LIMIT, partNumber); LOG.debug("Creating part upload request for #{} size {}", uploadId, partNumber, size); <START> if (partNumber >= InternalConstants.UPLOAD_PART_COUNT_LIMIT) { <END> throw new PathIOException(destKey, "Number of parts in multipart upload exceeded."); } UploadPartRequest request = new UploadPartRequest() .withBucketName(bucket) .withKey(destKey) .withUploadId(uploadId) .withPartNumber(partNumber) .withPartSize(size); if (uploadStream != null) { request.setInputStream(uploadStream); } else { checkArgument(sourceFile.exists(), "Source file does not exist: %s", sourceFile); checkArgument(offset >= 0, "Invalid offset %s", offset); long length = sourceFile.length(); checkArgument(offset == 0 || offset < length, "Offset %s beyond length of file %s", offset, length); request.setFile(sourceFile); request.setFileOffset(offset); } return request; }</code><technical_language>Greater than?</technical_language>

Target:
public UploadPartRequest newUploadPartRequest( String destKey, String uploadId, int partNumber, int size, InputStream uploadStream, File sourceFile, Long offset) throws PathIOException { checkNotNull(uploadId); checkArgument((uploadStream != null) ^ (sourceFile != null), "Data source"); checkArgument(size >= 0, "Invalid partition size %s", size); checkArgument(partNumber > 0, "partNumber must be between 1 and %s inclusive, but is %s", DEFAULT_UPLOAD_PART_COUNT_LIMIT, partNumber); LOG.debug("Creating part upload request for #{} size {}", uploadId, partNumber, size); long partCountLimit = longOption(conf, UPLOAD_PART_COUNT_LIMIT, DEFAULT_UPLOAD_PART_COUNT_LIMIT, 1); if (partCountLimit != DEFAULT_UPLOAD_PART_COUNT_LIMIT) { LOG.warn("Configuration property shouldn't be overridden by client", UPLOAD_PART_COUNT_LIMIT); } final String pathErrorMsg = "Number of parts in multipart upload exceeded." + " Current part count = %s, Part count limit = %s "; if (partNumber > partCountLimit) { throw new PathIOException(destKey, String.format(pathErrorMsg, partNumber, partCountLimit)); } UploadPartRequest request = new UploadPartRequest() .withBucketName(bucket) .withKey(destKey) .withUploadId(uploadId) .withPartNumber(partNumber) .withPartSize(size); if (uploadStream != null) { request.setInputStream(uploadStream); } else { checkArgument(sourceFile.exists(), "Source file does not exist: %s", sourceFile); checkArgument(offset >= 0, "Invalid offset %s", offset); long length = sourceFile.length(); checkArgument(offset == 0 || offset < length, "Offset %s beyond length of file %s", offset, length); request.setFile(sourceFile); request.setFileOffset(offset); } return request; }
Source:
<code>private void assertFirstElement(ListExpressionTree tree, Kind kind, String string) { <START> Tree element = tree.elements().get(0).get(); <END> assertThat(((ArrayAssignmentPatternElementTree) element).variable().is(kind)).isTrue(); assertThat(expressionToString(element)).isEqualTo(string); }</code><technical_language>@pynicolas declare ArrayAssignmentPatternElementTree</technical_language>

Target:
private void assertFirstElement(ListExpressionTree tree, Kind kind, String string) { ArrayAssignmentPatternElementTree element = tree.elements().get(0).get(); assertThat(element.variable().is(kind)).isTrue(); assertThat(expressionToString(element)).isEqualTo(string); }
Source:
<code>public static void setTextInputValue(WebElement input, String value) { <START> if (StringUtils.isEmpty(getTextFromElement(input)) && StringUtils.isEmpty(value)) { <END> return; } input.click(); input.clear(); if (!StringUtils.isEmpty(value)) { input.sendKeys(value); } else { input.sendKeys("1"); input.sendKeys(Keys.BACK_SPACE); } WebDriver driver = getCurrentDriver(); if (driver instanceof AndroidDriver) { AndroidDriver androidDriver = (AndroidDriver) driver; androidDriver.hideKeyboard(); } }</code><technical_language>explain changes</technical_language>

Target:
public static void setTextInputValue(WebElement input, String value) { input.click(); input.clear(); if (!StringUtils.isEmpty(value)) { input.sendKeys(value); } else { input.sendKeys("1"); input.sendKeys(Keys.BACK_SPACE); } WebDriver driver = getCurrentDriver(); if (driver instanceof AndroidDriver) { AndroidDriver androidDriver = (AndroidDriver) driver; androidDriver.hideKeyboard(); } }
Source:
<code>protected void applyRow(Relationship component, RelationshipRow row, Collection<Relationship> componentsToAttach) { component.setId(row.getId()); if (row.getEffectiveTime() != null) { component.setEffectiveTime(row.getEffectiveTime()); component.setReleased(true); } else { component.unsetEffectiveTime(); } component.setActive(row.isActive()); component.setModule(getConceptSafe(row.getModuleId(), SnomedRf2Headers.FIELD_MODULE_ID, row.getId())); <START> if (component.getSource() == null || !component.getSource().getId().equals(row.getSourceId())) { <END> component.setSource(getConceptSafe(row.getSourceId(), SnomedRf2Headers.FIELD_SOURCE_ID, row.getId())); } component.setDestination(getConceptSafe(row.getDestinationId(), SnomedRf2Headers.FIELD_DESTINATION_ID, row.getId())); component.setType(getConceptSafe(row.getTypeId(), SnomedRf2Headers.FIELD_TYPE_ID, row.getId())); component.setCharacteristicType(getConceptSafe(row.getCharacteristicTypeId(), SnomedRf2Headers.FIELD_CHARACTERISTIC_TYPE_ID, row.getId())); component.setModifier(getConceptSafe(row.getModifierId(), SnomedRf2Headers.FIELD_MODIFIER_ID, row.getId())); component.setGroup(row.getRelationshipGroup()); if (Concepts.HAS_ACTIVE_INGREDIENT.equals(row.getTypeId()) && Concepts.UNIVERSAL_RESTRICTION_MODIFIER.equals(row.getModifierId()) && component.getUnionGroup() != 1) { component.setUnionGroup(1); } getImportContext().conceptVisited(row.getSourceId()); }</code><technical_language>Do accept import files source ID changed? Is SCT change processor prepared properly index changes</technical_language>

Target:
protected void applyRow(Relationship component, RelationshipRow row, Collection<Relationship> componentsToAttach) { if (row.getEffectiveTime() != null) { component.setEffectiveTime(row.getEffectiveTime()); component.setReleased(true); } else { component.unsetEffectiveTime(); } component.setActive(row.isActive()); component.setModule(getConceptSafe(row.getModuleId(), SnomedRf2Headers.FIELD_MODULE_ID, row.getId())); if (component.getSource() == null || !component.getSource().getId().equals(row.getSourceId())) { component.setSource(getConceptSafe(row.getSourceId(), SnomedRf2Headers.FIELD_SOURCE_ID, row.getId())); } component.setDestination(getConceptSafe(row.getDestinationId(), SnomedRf2Headers.FIELD_DESTINATION_ID, row.getId())); component.setType(getConceptSafe(row.getTypeId(), SnomedRf2Headers.FIELD_TYPE_ID, row.getId())); component.setCharacteristicType(getConceptSafe(row.getCharacteristicTypeId(), SnomedRf2Headers.FIELD_CHARACTERISTIC_TYPE_ID, row.getId())); component.setModifier(getConceptSafe(row.getModifierId(), SnomedRf2Headers.FIELD_MODIFIER_ID, row.getId())); component.setGroup(row.getRelationshipGroup()); if (Concepts.HAS_ACTIVE_INGREDIENT.equals(row.getTypeId()) && Concepts.UNIVERSAL_RESTRICTION_MODIFIER.equals(row.getModifierId()) && component.getUnionGroup() != 1) { component.setUnionGroup(1); } getImportContext().conceptVisited(row.getSourceId()); }
Source:
<code>public boolean replaces(@Nullable LookupExtractorFactory other) { if (this == other) { return false; } <START> if (other == null || getClass() != other.getClass()) { <END> return true; } final KafkaLookupExtractorFactory that = (KafkaLookupExtractorFactory) other; return !(getKafkaTopic().equals(that.getKafkaTopic()) && getKafkaProperties().equals(that.getKafkaProperties())); }</code><technical_language>point of replacing null ? raise NPEs for reasons</technical_language>

Target:
public boolean replaces(@Nullable LookupExtractorFactory other) { if (this == other) { return false; } if (other == null) { return false; } if (getClass() != other.getClass()) { return true; } final KafkaLookupExtractorFactory that = (KafkaLookupExtractorFactory) other; return !(getKafkaTopic().equals(that.getKafkaTopic()) && getKafkaProperties().equals(that.getKafkaProperties()) && getConnectTimeout() == that.getConnectTimeout() && isOneToOne() == that.isOneToOne() ); }
Source:
<code>public DefaultVersionRangeResolver setVersionRangeResultFilter( VersionRangeResultFilter versionRangeResultFilter ) { if ( versionRangeResultFilter == null ) { throw new IllegalArgumentException( "version range result filter has not been specified" ); <START> } <END> this.versionRangeResultFilter = versionRangeResultFilter; return this; }</code><technical_language>Please Commons Lang I done other modules in Maven</technical_language>

Target:
public DefaultVersionRangeResolver setVersionRangeResultFilter( VersionRangeResultFilter versionRangeResultFilter ) { this.versionRangeResultFilter = Validate.notNull( versionRangeResultFilter, "versionRangeResultFilter cannot be null" ); return this; }
Source:
<code>public ConnectionResult checkConnection() { Request.Builder request = new Request.Builder() .url(this.baseUri); Response response = headImplExec(null, this.baseUri.uri().toString(), null, request); ConnectionResult connectionResult = new ConnectionResult(); int statusCode = response.code(); if(statusCode < 300) { connectionResult.setConnected(true); <START> connectionResult.setStatusCode(statusCode); <END> } else { connectionResult.setConnected(false); connectionResult.setStatusCode(statusCode); connectionResult.setErrorMessage(getReasonPhrase(response)); } return connectionResult; }</code><technical_language>In Node.js case, set status code in false case. approach representing status code in field methods of ConnectionResult Integer</technical_language>

Target:
public ConnectionResult checkConnection() { Request.Builder request = new Request.Builder() .url(this.baseUri); Response response = headImplExec(null, this.baseUri.uri().toString(), null, request); ConnectionResultImpl connectionResultImpl = new ConnectionResultImpl(); int statusCode = response.code(); if(statusCode < 300) { connectionResultImpl.setConnected(true); } else { connectionResultImpl.setConnected(false); connectionResultImpl.setStatusCode(statusCode); connectionResultImpl.setErrorMessage(getReasonPhrase(response)); } return connectionResultImpl; }