auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static Package getUserModel(ExecutionEvent event) { ServiceUtilsForHandlers serviceUtils = ServiceUtilsForHandlers.getInstance(); try { URI uri = <START> serviceUtils.getModelSet(event).getURIWithoutExtension().appendFileExtension(UML_EXT); <END> Resource userResource = serviceUtils.getModelSet(event).getResource(uri, false); if (userResource != null && userResource.getContents().size() > 0) { EObject topEObj = userResource.getContents().get(0); if ((topEObj instanceof Package) && (!(topEObj instanceof Profile))) { return (Package) topEObj; } } } catch (ServiceException e) { Activator.log.error(e); } return null; }</code><technical_language>create a variable for ModelSet..</technical_language>

Target:
public static Package getUserModel(ExecutionEvent event) { ServiceUtilsForHandlers serviceUtils = ServiceUtilsForHandlers.getInstance(); try { ModelSet modelSet = serviceUtils.getModelSet(event); URI uri = modelSet.getURIWithoutExtension().appendFileExtension(UML_EXT); Resource userResource = modelSet.getResource(uri, false); if (userResource != null && userResource.getContents().size() > 0) { EObject topEObj = userResource.getContents().get(0); if ((topEObj instanceof Package) && (!(topEObj instanceof Profile))) { return (Package) topEObj; } } } catch (ServiceException e) { Activator.log.error(e); } return null; }
Source:
<code>public boolean add(@Nullable E val) { if (val == null) { throw new IllegalArgumentException(); } fLock.writeLock().lock(); try { fStore.add(val); <START> Comparable<E> cmp = o -> { <END> int ret = Long.compare(val.getStart(), o.getStart()); if (ret == 0) { return Long.compare(val.getEnd(), o.getEnd()); } return ret; }; for (int i = size() - 1; i > 0 && cmp.compareTo(fStore.get(i - 1)) < 0; i--) { Collections.swap(fStore, i, i - 1); } return true; } finally { fLock.writeLock().unlock(); } }</code><technical_language>This object is created for add, right? outside</technical_language>

Target:
public boolean add(@Nullable E val) { if (val == null) { throw new IllegalArgumentException("Cannot add null value"); } fLock.writeLock().lock(); try { fStore.add(val); for (int i = size() - 1; i > 0 && COMPARATOR.compare(val, fStore.get(i - 1)) < 0; i--) { Collections.swap(fStore, i, i - 1); } return true; } finally { fLock.writeLock().unlock(); } }
Source:
<code>public ParentViewHolder(View itemView, ParentItemClickListener parentItemClickListener) { super(itemView); itemView.setOnClickListener(this); this.mParentItemClickListener = parentItemClickListener; this.mRotationEnabled = false; this.mIsRotated = false; this.mIsExpanded = false; <START> this.mRotation = DEFAULT_ROTATE_DURATION; <END> }</code><technical_language>this required in setter lines</technical_language>

Target:
public ParentViewHolder(View itemView, ParentItemClickListener parentItemClickListener) { super(itemView); itemView.setOnClickListener(this); mParentItemClickListener = parentItemClickListener; mRotationEnabled = false; mIsRotated = false; mIsExpanded = false; mRotation = DEFAULT_ROTATE_DURATION_MS; }
Source:
<code>private void onCanceled(LockPlaceHolder canceled) { if (trace) { log.tracef("Release lock for %s. It was canceled.", canceled.owner); } <START> LockPlaceHolder wantToRelease = lockOwners.get(canceled.owner); <END> if (wantToRelease == null) { if (trace) { log.tracef("%s not found!", canceled.owner); } return; } LockPlaceHolder currentLocked = current; if (currentLocked == wantToRelease) { if (!casRelease(currentLocked)) { if (trace) { log.tracef("Releasing lock for %s. It is the current lock owner but another thread changed it.", canceled.owner); } } else { tryAcquire(); } } }</code><technical_language>wantToRelease canceled? clear removes owner lockOwners map in this case..</technical_language>

Target:
private void onCanceled(LockPlaceHolder canceled) { if (trace) { log.tracef("Release lock for %s. It was canceled.", canceled.owner); } LockPlaceHolder currentLocked = current; if (currentLocked == canceled) { tryAcquire(canceled); } }
Source:
<code>public ProcessingEnvironment processingEnvironment() { <START> return processingEnvironment(); <END> }</code><technical_language>remove ()</technical_language>

Target:
public ProcessingEnvironment processingEnvironment() { return processingEnvironment; }
Source:
<code>public void testSTGeometryFromBinary() { assertToFromBinary("POINT EMPTY"); assertToFromBinary("LINESTRING (1 1, 2 2)"); assertToFromBinary("POLYGON ((1 1, 4 1, 4 4, 1 4, 1 1))"); <START> assertToFromBinary("POLYGON ((1 1, 1 4, 4 4, 4 1))", "POLYGON ((1 1, 4 1, 4 4, 1 4, 1 1))"); <END> assertToFromBinary("MULTIPOLYGON (((1 1, 4 1, 4 4, 1 4, 1 1)), ((1 1, 4 1, 4 4, 1 4, 1 1)))"); }</code><technical_language>different</technical_language>

Target:
public void testSTGeometryFromBinary() { assertFunction("ST_GeomFromBinary(null)", GEOMETRY, null); assertGeomFromBinary("POINT EMPTY"); assertGeomFromBinary("MULTIPOINT EMPTY"); assertGeomFromBinary("LINESTRING EMPTY"); assertGeomFromBinary("MULTILINESTRING EMPTY"); assertGeomFromBinary("POLYGON EMPTY"); assertGeomFromBinary("MULTIPOLYGON EMPTY"); assertGeomFromBinary("GEOMETRYCOLLECTION EMPTY"); assertGeomFromBinary("POINT (1 2)"); assertGeomFromBinary("MULTIPOINT ((1 2), (3 4))"); assertGeomFromBinary("LINESTRING (0 0, 1 2, 3 4)"); assertGeomFromBinary("MULTILINESTRING ((1 1, 5 1), (2 4, 4 4))"); assertGeomFromBinary("POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))"); assertGeomFromBinary("POLYGON ((0 0, 3 0, 3 3, 0 3, 0 0), (1 1, 1 2, 2 2, 2 1, 1 1))"); assertGeomFromBinary("MULTIPOLYGON (((1 1, 3 1, 3 3, 1 3, 1 1)), ((2 4, 6 4, 6 6, 2 6, 2 4)))"); assertGeomFromBinary("GEOMETRYCOLLECTION (POINT (1 2), LINESTRING (0 0, 1 2, 3 4), POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)))"); assertGeomFromBinary("MULTIPOINT ((0 0), (0 1), (1 1), (0 1))"); assertGeomFromBinary("LINESTRING (0 0, 0 1, 0 1, 1 1, 1 0, 0 0)"); assertInvalidFunction("ST_GeomFromBinary(from_hex('deadbeef'))", "Invalid WKB"); }
Source:
<code>public void close() { if (!closed) { closed = true; <START> threadLocalGrouper.remove(); <END> groupers.forEach(Grouper::close); } }</code><technical_language>Is this solve problem? If I understand correctly, close() get called time (by thread is reading aggregated values out of ConcurrentGrouper) of threads a ThreadLocal Grouper (the threads Groupers processing-pool threads)</technical_language>

Target:
public void close() { if (!closed) { closed = true; threadToGrouperMap.clear(); groupers.forEach(Grouper::close); } }
Source:
<code>public boolean isStorageQuotaExceeded(Guid quotaId) { if (quotaId == null) { return false; } Quota quota = getQuotaDAO().getById(quotaId); if (quota == null) { return false; } <START> <END> boolean quotaExceededStorage = (quota.getGlobalQuotaStorage() != null && quota.getGlobalQuotaStorage().getStorageSizeGB() != null && !quota.getGlobalQuotaStorage().getStorageSizeGB().equals(QuotaStorage.UNLIMITED) && quota.getGlobalQuotaStorage().getStorageSizeGB() < quota.getGlobalQuotaStorage().getStorageSizeGBUsage()); if (!quotaExceededStorage && quota.getQuotaStorages() != null) { for (QuotaStorage quotaStorage : quota.getQuotaStorages()) { quotaExceededStorage |= quotaStorage.getStorageSizeGB() < quotaStorage.getStorageSizeGBUsage(); } } return quotaExceededStorage; }</code><technical_language>change if/else</technical_language>

Target:
public boolean isStorageQuotaExceeded(Guid quotaId) { if (quotaId == null) { return false; } Quota quota = getQuotaDAO().getById(quotaId); if (quota == null) { return false; } if (quota.getGlobalQuotaStorage() != null && quota.getGlobalQuotaStorage().getStorageSizeGB() != null && !quota.getGlobalQuotaStorage().getStorageSizeGB().equals(QuotaStorage.UNLIMITED) && quota.getGlobalQuotaStorage().getStorageSizeGB() < quota.getGlobalQuotaStorage().getStorageSizeGBUsage()) { return true; } else if (quota.getQuotaStorages() != null) { for (QuotaStorage quotaStorage : quota.getQuotaStorages()) { if (quotaStorage.getStorageSizeGB() < quotaStorage.getStorageSizeGBUsage()) { return true; } } } return false; }
Source:
<code>private void finishIfNoVisibleBlogs() { <START> if (FluxCUtils.isSignedInWPComOrHasWPOrgSite(mAccountStore, mSiteStore)) { <END> ToastUtils.showToast(getBaseContext(), R.string.no_account, ToastUtils.Duration.LONG); startActivity(new Intent(this, SignInActivity.class)); finish(); } else { ToastUtils.showToast(getBaseContext(), R.string.cant_share_no_visible_blog, ToastUtils.Duration.LONG); finish(); } }</code><technical_language>This a result of this PR, this routine wrong me. this if **not** isSignedInWPComOrHasWPOrgSite</technical_language>

Target:
private void finishIfNoVisibleBlogs() { if (!FluxCUtils.isSignedInWPComOrHasWPOrgSite(mAccountStore, mSiteStore)) { ToastUtils.showToast(getBaseContext(), R.string.no_account, ToastUtils.Duration.LONG); startActivity(new Intent(this, SignInActivity.class)); finish(); } else { ToastUtils.showToast(getBaseContext(), R.string.cant_share_no_visible_blog, ToastUtils.Duration.LONG); finish(); } }
Source:
<code>private void onQueueClicked() { queueVisible = true; hideSystemUIIfNeeded(); buildQueue(); updatePlaybackButtons(); getControlsRoot().setVisibility(View.INVISIBLE); <START> animateView(queueLayout, SLIDE_AND_ALPHA, true, DEFAULT_CONTROLS_DURATION); <END> itemsList.scrollToPosition(playQueue.getIndex()); }</code><technical_language>suggestion animateView(queueLayout, SLIDE_AND_ALPHA, true, DEFAULT_CONTROLS_DURATION);</technical_language>

Target:
private void onQueueClicked() { queueVisible = true; hideSystemUIIfNeeded(); buildQueue(); updatePlaybackButtons(); getControlsRoot().setVisibility(View.INVISIBLE); queueLayout.requestFocus(); animateView(queueLayout, SLIDE_AND_ALPHA, true, DEFAULT_CONTROLS_DURATION); itemsList.scrollToPosition(playQueue.getIndex()); }
Source:
<code>void subscribe(final String topic) throws MqttException { if (started.compareAndSet(false, true)) { client = new MqttClient(brokerURI, clientId); client.connect(); client.setCallback(this); } <START> client.subscribe(topic); <END> }</code><technical_language>client null</technical_language>

Target:
void subscribe(final String topic) throws MqttException { synchronized (subscribeLock) { if (!started) { client = new MqttClient(brokerURI, clientId); client.connect(); client.setCallback(this); started = true; } client.subscribe(topic); } }
Source:
<code>public Job dbLoaderJob() throws CdaLoaderException { List<Flow> ontologyFlows = new ArrayList<>(); List<Flow> parallelFlows = new ArrayList<>(); for (int i = 0; i < ontologyLoaderList.size(); i++) { OntologyLoader ontologyLoader = ontologyLoaderList.get(i); <START> parallelFlows.add(new FlowBuilder<Flow>("ontology_" + i + "_parallelFlow").from(ontologyLoader).end()); <END> } FlowBuilder<Flow> parallelFlowBuilder = new FlowBuilder<Flow>("ontologyLoaderParallelFlows").start(parallelFlows.get(0)); for (int i = 1; i < parallelFlows.size(); i++) { SimpleAsyncTaskExecutor executor = new SimpleAsyncTaskExecutor(Executors.defaultThreadFactory()); parallelFlowBuilder.split(executor).add(parallelFlows.get(i)); } Flow ontologyFlow = parallelFlowBuilder.build(); Flow markersFlow = new FlowBuilder<Flow>("markersFlow").from(markerLoader).end(); Flow allelesFlow = new FlowBuilder<Flow>("allelesFlow").from(alleleLoader).end(); Flow strainsFlow = new FlowBuilder<Flow>("strainsFlow").from(strainLoader).end(); Flow bioModelsFlow = new FlowBuilder<Flow>("bioModelsFlow").from(bioModelLoader).end(); Flow phenotypedColoniesFlow = new FlowBuilder<Flow>("phenotypedColoniesFlow").from(phenotypedColonyLoader).end(); return jobBuilderFactory.get("dbLoaderJob") .incrementer(new RunIdIncrementer()) .start(ontologyFlow) .next(markersFlow) .next(allelesFlow) .next(strainsFlow) .next(bioModelsFlow) .next(phenotypedColoniesFlow) .end() .build(); }</code><technical_language>Instead of identifying ontology i, ontology name here</technical_language>

Target:
public Job dbLoaderJob() throws CdaLoaderException { List<Flow> ontologyFlows = new ArrayList<>(); List<Flow> parallelFlows = new ArrayList<>(); for (int i = 0; i < ontologyLoaderList.size(); i++) { OntologyLoader ontologyLoader = ontologyLoaderList.get(i); parallelFlows.add(new FlowBuilder<Flow>("ontology_" + ontologyLoader.getName() + "_parallelFlow").from(ontologyLoader).end()); } FlowBuilder<Flow> parallelFlowBuilder = new FlowBuilder<Flow>("ontologyLoaderParallelFlows").start(parallelFlows.get(0)); for (int i = 1; i < parallelFlows.size(); i++) { SimpleAsyncTaskExecutor executor = new SimpleAsyncTaskExecutor(Executors.defaultThreadFactory()); parallelFlowBuilder.split(executor).add(parallelFlows.get(i)); } Flow ontologyFlow = parallelFlowBuilder.build(); Flow markersFlow = new FlowBuilder<Flow>("markersFlow").from(markerLoader).end(); Flow allelesFlow = new FlowBuilder<Flow>("allelesFlow").from(alleleLoader).end(); Flow strainsFlow = new FlowBuilder<Flow>("strainsFlow").from(strainLoader).end(); Flow bioModelsFlow = new FlowBuilder<Flow>("bioModelsFlow").from(bioModelLoader).end(); Flow phenotypedColoniesFlow = new FlowBuilder<Flow>("phenotypedColoniesFlow").from(phenotypedColonyLoader).end(); return jobBuilderFactory.get("dbLoaderJob") .incrementer(new RunIdIncrementer()) .start(ontologyFlow) .next(markersFlow) .next(allelesFlow) .next(strainsFlow) .next(bioModelsFlow) .next(phenotypedColoniesFlow) .end() .build(); }
Source:
<code>public Rule Reserved() { return FirstOf( <START> Sequence( Find(), builder.setOperation( Operation.FIND ) ), <END> Sequence( Count(), builder.setOperation( Operation.COUNT ) ) ); }</code><technical_language>builder.setOperation() is invoked Operation(). I need do here, too</technical_language>

Target:
public Rule Reserved() { return FirstOf( Find(), Count() ); }
Source:
<code>protected void assertActivatedKeyStore() throws IOException { if (ks != null) return; char[] passwd = securityManager.getMasterPassword(); try { ks = KeyStore.getInstance(KEYSTORETYPE); if (getResource().getType() == Type.UNDEFINED) { ks.load(null, passwd); addInitialKeys(); <START> OutputStream fos = getResource().out(); <END> ks.store(fos, passwd); fos.close(); } else { InputStream fis = getResource().in(); ks.load(fis, passwd); fis.close(); } } catch (Exception ex) { if (ex instanceof IOException) throw (IOException) ex; throw new IOException (ex); } finally { securityManager.disposePassword(passwd); } }</code><technical_language>Needs a try-with-resources block ensure resource leak occurs if exception is thrown</technical_language>

Target:
protected void assertActivatedKeyStore() throws IOException { if (ks != null) return; char[] passwd = securityManager.getMasterPassword(); try { ks = KeyStore.getInstance(KEYSTORETYPE); if (getResource().getType() == Type.UNDEFINED) { ks.load(null, passwd); addInitialKeys(); try (OutputStream fos = getResource().out()) { ks.store(fos, passwd); } } else { try (InputStream fis = getResource().in()) { ks.load(fis, passwd); } } } catch (Exception ex) { if (ex instanceof IOException) throw (IOException) ex; throw new IOException (ex); } finally { securityManager.disposePassword(passwd); } }
Source:
<code>public UniformRandomProducer(double from, double to, long seed) { super(seed); <START> A.ensure(to >= from, "from > to"); <END> this.from = from; this.to = to; }</code><technical_language>conditions same</technical_language>

Target:
public UniformRandomProducer(double from, double to, long seed) { super(seed); A.ensure(to >= from, "from >= to"); this.from = from; this.to = to; }
Source:
<code>public Set<Value> gather(PrimaryKey record, long timestamp) { read.lock(); try { boolean historical = timestamp == Time.NONE; Set<Value> values = Sets.newLinkedHashSet(); for (Value value : history.keySet()) { Set<PrimaryKey> records = historical ? get(value, timestamp) : get(value); if(records.contains(record)) { values.add(value); } } <START> return values; <END> } finally { read.unlock(); } }</code><technical_language>gather a generic filter operation. Set and/or accent4j shorten this? For example, some idealized Java: Java return history.keys() .filter(v -> (historical ? get(v, timestamp) : get(v)).contains(record)) I expect vanilla Java do right now: Java return history.keySet() .stream() .filter(v -> (historical ? get(v, timestamp) : get(v)).contains(record)) .collect(Collectors.toSet()); opposed original: Java Set<Value> values = Sets.newLinkedHashSet(); for (Value : history.keySet()) { Set<PrimaryKey> records = historical ? get(value, timestamp) : get(value); if(records.contains(record)) { values.add(value); } } return values; I advantage in keeping extra verbosity here</technical_language>

Target:
public Set<Value> gather(PrimaryKey record, long timestamp) { Preconditions.checkState(!isPartial(), "Cannot gather from a partial Secondary Record."); read.lock(); try { Map<PrimaryKey, Set<Value>> slice = cube.slice(timestamp); if(slice == null) { Set<Value> values = Sets.newHashSet(); Set<Entry<Value, Set<PrimaryKey>>> entries = timestamp != Time.NONE ? LazyTransformSet.of(history.keySet(), key -> new AbstractMap.SimpleImmutableEntry<>( key, get(key, timestamp))) : present.entrySet(); for (Entry<Value, Set<PrimaryKey>> entry : entries) { Value value = entry.getKey(); Set<PrimaryKey> records = entry.getValue(); if(records.contains(record)) { values.add(value); } for (PrimaryKey $record : records) { if($record.equals(record)) { values.add(value); } cube.put($record, value, timestamp); } } return values; } else { return slice.getOrDefault(record, ImmutableSet.of()); } } finally { read.unlock(); } }
Source:
<code>public String addEscapeCharacters(String s) { if (dbProduct != DatabaseProduct.DERBY) { return s.replaceAll("\\\\", "\\\\\\\\"); } <START> return s; <END> }</code><technical_language>is this needed</technical_language>

Target:
public String addEscapeCharacters(String s) { if (dbProduct == DatabaseProduct.MYSQL) { return s.replaceAll("\\\\", "\\\\\\\\"); } return s; }
Source:
<code>public KeycloakResourceDefinition() { super(PathElement.pathElement(ModelDescriptionConstants.AUTHENTICATION, ModelDescriptionConstants.KEYCLOAK), <START> ControllerResolver.getResolver("core.management.security-realm.authentication.keycloak"), <END> new SecurityRealmChildAddHandler(true, false, new AttributeDefinition[0]), new SecurityRealmChildRemoveHandler(true), OperationEntry.Flag.RESTART_RESOURCE_SERVICES, OperationEntry.Flag.RESTART_RESOURCE_SERVICES); }</code><technical_language>this is minor, for time end result is same, add "." separate parameters, resolver add "." part of impl</technical_language>

Target:
public KeycloakResourceDefinition() { super(PathElement.pathElement(ModelDescriptionConstants.AUTHENTICATION, ModelDescriptionConstants.KEYCLOAK), ControllerResolver.getResolver("core", "management", "security-realm", "authentication", "keycloak"), new SecurityRealmChildAddHandler(true, false, new AttributeDefinition[0]), new SecurityRealmChildRemoveHandler(true), OperationEntry.Flag.RESTART_RESOURCE_SERVICES, OperationEntry.Flag.RESTART_RESOURCE_SERVICES); }
Source:
<code>public void register(ResultSet resultSet, Statement statement) { log.tracef( "Registering result set [%s]", resultSet ); if ( statement == null ) { try { statement = resultSet.getStatement(); } catch (SQLException e) { throw convert( e, "unable to access Statement from ResultSet" ); } <START> } <END> if ( statement != null ) { Set<ResultSet> resultSets = xref.get( statement ); if ( resultSets == null && log.isDebugEnabled() ) { log.debug( "ResultSet statement was not registered (on register)" ); } if ( resultSets == null || resultSets == Collections.EMPTY_SET ) { resultSets = new HashSet<ResultSet>(); xref.put( statement, resultSets ); } resultSets.add( resultSet ); } else { unassociatedResultSets.add( resultSet ); } }</code><technical_language>here, this optimization change DEBUG level is enabled</technical_language>

Target:
public void register(ResultSet resultSet, Statement statement) { log.tracef( "Registering result set [%s]", resultSet ); if ( statement == null ) { try { statement = resultSet.getStatement(); } catch (SQLException e) { throw convert( e, "unable to access Statement from ResultSet" ); } } if ( statement != null ) { Set<ResultSet> resultSets = xref.get( statement ); if ( log.isDebugEnabled() && resultSets == null ) { log.debug( "ResultSet statement was not registered (on register)" ); } if ( resultSets == null || resultSets == Collections.EMPTY_SET ) { resultSets = new HashSet<ResultSet>(); xref.put( statement, resultSets ); } resultSets.add( resultSet ); } else { unassociatedResultSets.add( resultSet ); } }
Source:
<code>public boolean removeNodeId(final String location, final InetAddress address, final int nodeId) { if (address == null) { LOG.warn("removeNodeId: null IP address"); return false; } LOG.debug("removeNodeId: removing IP address from cache: {}:{}", location, str(address)); m_lock.writeLock().lock(); try { <START> return m_managedAddresses.remove(new Key(location, address), new Value(nodeId, PrimaryType.PRIMARY)) || <END> m_managedAddresses.remove(new Key(location, address), new Value(nodeId, PrimaryType.SECONDARY)) || m_managedAddresses.remove(new Key(location, address), new Value(nodeId, PrimaryType.NOT_ELIGIBLE)); } finally { m_lock.writeLock().unlock(); } }</code><technical_language>Nit: re-use Key instead of recreating 3 times</technical_language>

Target:
public boolean removeNodeId(final String location, final InetAddress address, final int nodeId) { if (address == null) { LOG.warn("removeNodeId: null IP address"); return false; } LOG.debug("removeNodeId: removing IP address from cache: {}:{}", location, str(address)); m_lock.writeLock().lock(); try { final Key key = new Key(location, address); return m_managedAddresses.remove(key, new Value(nodeId, PrimaryType.PRIMARY)) || m_managedAddresses.remove(key, new Value(nodeId, PrimaryType.SECONDARY)) || m_managedAddresses.remove(key, new Value(nodeId, PrimaryType.NOT_ELIGIBLE)); } finally { m_lock.writeLock().unlock(); } }
Source:
<code>public void logsWhenRequestsTakeTooLong() { originalRequest = new RequestTime(0L, MAX_REQUEST_DURATION.toNanos() + 1, 0L); RequestTime nextRequest = new RequestTimeBuilder(originalRequest) .progressLocalClock(MAX_INTERVAL_SINCE_PREVIOUS_REQUEST.toNanos() + 2) .progressRemoteClock(1L) .build(); <START> createComparer(originalRequest, nextRequest).compare(); <END> verify(mockedEvents, times(1)).requestsTookTooLong(anyLong(), anyLong()); }</code><technical_language>nit: of lines refactored a compare(originalRequest, nextRequest) method</technical_language>

Target:
public void logsWhenRequestsTakeTooLong() { originalRequest = new RequestTime(0L, ClockSkewComparer.MAX_REQUEST_DURATION.toNanos() + 1, 0L); RequestTime nextRequest = new RequestTime.Builder(originalRequest) .progressLocalClock(ClockSkewComparer.MAX_REQUEST_DURATION.toNanos() + 2) .progressRemoteClock(1L) .build(); compare(originalRequest, nextRequest); verify(mockedEvents, times(1)).requestsTookTooLong(anyLong(), anyLong()); }
Source:
<code>public void theActivityCalendarContainsADayProfile(final Map<String, String> parameters) throws Throwable { final ActivityCalendar activityCalendar = (ActivityCalendar) ScenarioContext.current() .get(PlatformSmartmeteringKeys.ACTIVITY_CALENDAR); final int dayId = Integer.parseInt(parameters.get(PlatformSmartmeteringKeys.DAY_PROFILE_DAY_ID)); final int actionCount = Integer.parseInt(parameters.get(PlatformSmartmeteringKeys.DAY_PROFILE_ACTION_COUNT)); final DayProfile profile = new DayProfile(dayId); for (int i = 1; i <= actionCount; i++) { <START> final String start = parameters.get(PlatformSmartmeteringKeys.DAY_PROFILE_START_TIME + "_" + i); <END> final int selector = Integer .parseInt(parameters.get(PlatformSmartmeteringKeys.DAY_PROFILE_SCRIPT_SELECTOR + "_" + i)); profile.getDayProfileActions().add(new DayProfileAction(start, selector)); } activityCalendar.getDayProfiles().put(dayId, profile); ScenarioContext.current().put(PlatformSmartmeteringKeys.ACTIVITY_CALENDAR, activityCalendar); }</code><technical_language>is a SettingsHelper methods retrieve indexed items a Cucumber step data table, like: final String start = SettingsHelper.getStringValue(parameters, PlatformSmartmeteringKeys.DAY_PROFILE_START_TIME, i);</technical_language>

Target:
public void theActivityCalendarContainsADayProfile(final Map<String, String> parameters) throws Throwable { final ActivityCalendar activityCalendar = (ActivityCalendar) ScenarioContext.current() .get(PlatformSmartmeteringKeys.ACTIVITY_CALENDAR); final int dayId = Integer.parseInt(parameters.get(PlatformSmartmeteringKeys.DAY_PROFILE_DAY_ID)); final int actionCount = Integer.parseInt(parameters.get(PlatformSmartmeteringKeys.DAY_PROFILE_ACTION_COUNT)); final DayProfile profile = new DayProfile(dayId); for (int i = 1; i <= actionCount; i++) { final String start = SettingsHelper.getStringValue(parameters, PlatformSmartmeteringKeys.DAY_PROFILE_START_TIME, i); final int selector = SettingsHelper.getIntegerValue(parameters, PlatformSmartmeteringKeys.DAY_PROFILE_SCRIPT_SELECTOR, i); profile.getDayProfileActions().add(new DayProfileAction(start, selector)); } activityCalendar.getDayProfiles().put(dayId, profile); ScenarioContext.current().put(PlatformSmartmeteringKeys.ACTIVITY_CALENDAR, activityCalendar); }
Source:
<code>public void testTransformerEAP720() throws Exception { <START> testTransformation(EAP_7_1_0); <END> }</code><technical_language>this testing EAP_7_2_0_TEMP</technical_language>

Target:
public void testTransformerEAP720() throws Exception { testTransformation(EAP_7_2_0_TEMP); }
Source:
<code>public Startpoint readStartpoint(SystemStreamPartition ssp, TaskName taskName) { <START> Preconditions.checkState(!stopped, "Underlying metadata store not available"); <END> Preconditions.checkNotNull(ssp, "SystemStreamPartition cannot be null"); byte[] startpointBytes = readWriteStore.get(toReadWriteStoreKey(ssp, taskName)); if (ArrayUtils.isNotEmpty(startpointBytes)) { try { Startpoint startpoint = objectMapper.readValue(startpointBytes, Startpoint.class); if (Instant.now().minus(DEFAULT_EXPIRATION_DURATION).isBefore(Instant.ofEpochMilli(startpoint.getCreationTimestamp()))) { return startpoint; } LOG.warn("Stale Startpoint: was read. Ignoring.", startpoint); } catch (IOException ex) { throw new SamzaException(ex); } } return null; }</code><technical_language>a return Optional<Startpoint> here, handling null caller-end</technical_language>

Target:
public Optional<Startpoint> readStartpoint(SystemStreamPartition ssp, TaskName taskName) { Preconditions.checkState(!stopped, "Underlying metadata store not available"); Preconditions.checkNotNull(ssp, "SystemStreamPartition cannot be null"); byte[] startpointBytes = readWriteStore.get(toReadWriteStoreKey(ssp, taskName)); if (ArrayUtils.isNotEmpty(startpointBytes)) { try { Startpoint startpoint = objectMapper.readValue(startpointBytes, Startpoint.class); if (Instant.now().minus(DEFAULT_EXPIRATION_DURATION).isBefore(Instant.ofEpochMilli(startpoint.getCreationTimestamp()))) { return Optional.of(startpoint); } LOG.warn("Creation timestamp: of startpoint: has crossed the expiration duration: {}. Ignoring it", startpoint.getCreationTimestamp(), startpoint, DEFAULT_EXPIRATION_DURATION); } catch (IOException ex) { throw new SamzaException(ex); } } return Optional.empty(); }
Source:
<code>public AbstractDecimalSelectiveStreamReader( StreamDescriptor streamDescriptor, Optional<TupleDomainFilter> filter, Optional<Type> outputType, LocalMemoryContext systemMemoryContext, int valuesPerPosition) { checkArgument(filter.isPresent() || outputType.isPresent(), "filter must be present if output is not required"); this.streamDescriptor = requireNonNull(streamDescriptor, "streamDescriptor is null"); <START> this.filter = filter.orElse(null); <END> this.outputRequired = outputType.isPresent(); this.systemMemoryContext = requireNonNull(systemMemoryContext, "systemMemoryContext is null"); this.nonDeterministicFilter = this.filter != null && !this.filter.isDeterministic(); this.nullsAllowed = this.filter == null || this.nonDeterministicFilter || this.filter.testNull(); this.scale = streamDescriptor.getOrcType().getScale().get(); this.nullBlock = outputType.map(type -> type.createBlockBuilder(null, 1).appendNull().build()).orElse(null); this.valuesPerPosition = valuesPerPosition; }</code><technical_language>add a requireNonNull for filter outputType. Missed before</technical_language>

Target:
public AbstractDecimalSelectiveStreamReader( StreamDescriptor streamDescriptor, Optional<TupleDomainFilter> filter, Optional<Type> outputType, LocalMemoryContext systemMemoryContext, int valuesPerPosition) { requireNonNull(filter, "filter is null"); requireNonNull(outputType, "outputType is null"); checkArgument(filter.isPresent() || outputType.isPresent(), "filter must be present if output is not required"); this.streamDescriptor = requireNonNull(streamDescriptor, "streamDescriptor is null"); this.filter = filter.orElse(null); this.outputRequired = outputType.isPresent(); this.systemMemoryContext = requireNonNull(systemMemoryContext, "systemMemoryContext is null"); this.nonDeterministicFilter = this.filter != null && !this.filter.isDeterministic(); this.nullsAllowed = this.filter == null || this.nonDeterministicFilter || this.filter.testNull(); this.scale = streamDescriptor.getOrcType().getScale().get(); this.nullBlock = outputType.map(type -> type.createBlockBuilder(null, 1).appendNull().build()).orElse(null); this.valuesPerPosition = valuesPerPosition; }
Source:
<code>public void close() { if (this.runThread.compareAndSet(true, false)) { try { <START> cursor.signalConsumers(); <END> this.stopLatch.await(); } catch (InterruptedException e) { } } }</code><technical_language>is benefit waking other consumers GC consumer closes ? I understand GC consumer null out entries, sleeping consumer benefit in waking up</technical_language>

Target:
public void close() { if (this.runThread.compareAndSet(true, false)) { try { this.stopLatch.await(); } catch (InterruptedException e) { } } }
Source:
<code>private void startLibosinfoServerVM() { try { ProcessBuilder builder = buildExternalJavaProcessCmd(); builder.redirectErrorStream(true); libosinfoRMIServer = builder.start(); } catch (Exception exception) { <START> System.out.println("Can't start exernal VM."); <END> } }</code><technical_language>I intended log, System.out</technical_language>

Target:
private void startLibosinfoServerVM() { try { ProcessBuilder builder = buildShellProcessCmd(); builder.redirectErrorStream(true); libosinfoRMIServer = builder.start(); } catch (Exception exception) { log.error("Can't start exernal VM."); } }
Source:
<code><START> public ArrayList<Award> getAwards(){ <END> return awards; }</code><technical_language>Consider returning List<> Collections.unmodifiableList(awards) instead</technical_language>

Target:
public List<Award> getAwards(){ return Collections.unmodifiableList(awards); }
Source:
<code>private void validateCascadedValues(Object value, ValidationContext<?> context, ValueContext<?, ?> valueContext, Cascadable cascadable, ValidationOrder validationOrder) { for ( TypeVariable<?> cascadingTypeParameter : cascadable.getCascadingTypeParameters() ) { List<TypeVariable<?>> cascadingTypeParametersOfValueType = getCorrespondingTypeParametersInSubType( value.getClass(), TypeHelper.getErasedReferenceType( cascadable.getCascadableType() ), cascadingTypeParameter ); for ( TypeVariable<?> cascadingTypeParameterOfValueType : cascadingTypeParametersOfValueType ) { <START> ValueExtractorDescriptor extractor = valueExtractorManager.getTypeParameterValueExtractor( <END> value.getClass(), cascadingTypeParameterOfValueType ); if ( extractor == null ) { continue; } CascadingValueReceiver receiver = new CascadingValueReceiver( context, valueContext, validationOrder ); ( (ValueExtractor) extractor.getValueExtractor() ).extractValues( value, receiver ); } } }</code><technical_language>getValueExtractor()? for type parameter constraints cascaded validation</technical_language>

Target:
private void validateCascadedValues(Object value, ValidationContext<?> context, ValueContext<?, ?> valueContext, Cascadable cascadable, ValidationOrder validationOrder) { for ( TypeVariable<?> cascadingTypeParameter : cascadable.getCascadingTypeParameters() ) { List<TypeVariable<?>> cascadingTypeParametersOfValueType = getCorrespondingTypeParametersInSubType( value.getClass(), TypeHelper.getErasedReferenceType( cascadable.getCascadableType() ), cascadingTypeParameter ); for ( TypeVariable<?> cascadingTypeParameterOfValueType : cascadingTypeParametersOfValueType ) { ValueExtractorDescriptor extractor = valueExtractorManager.getValueExtractor( value.getClass(), cascadingTypeParameterOfValueType ); if ( extractor == null ) { continue; } CascadingValueReceiver receiver = new CascadingValueReceiver( context, valueContext, validationOrder ); ( (ValueExtractor) extractor.getValueExtractor() ).extractValues( value, receiver ); } } }
Source:
<code>private static void log(Level level, Throwable ex, String msg, Object... data) { <START> modLog.log(level, () -> data == null ? msg : String.format(msg, data), ex); <END> }</code><technical_language>modLog null</technical_language>

Target:
private static void log(Level level, Throwable ex, String msg, Object... data) { LOGGER.log(level, () -> data == null ? msg : String.format(msg, data), ex); }
Source:
<code><START> private void delete() { <END> SceneElement element = getSelectedSceneElement(); Scene scene = getCurrentScene(); List list = scene.getChildren(); controller.command(new RemoveFromListCommand(list, element)); }</code><technical_language>This here. Commands invoked view. I need create actions instead</technical_language>

Target:
private void delete() { controller.action(RemoveFromScene.class, getCurrentScene(), getSelectedSceneElement()); }
Source:
<code>protected FSDataInputStream setupStream(BlockMetadata.FileBlockMetadata block) throws IOException { String filePath = block.getFilePath(); if (filePath.startsWith("/")) { filePath = filePath.substring(1); } RECORD_READER_MODE recordReaderMode = RECORD_READER_MODE.valueOf(this.getMode()); if (recordReaderMode == RECORD_READER_MODE.FIXED_WIDTH_RECORD) { ((S3FixedWidthRecordReaderContext)readerContext).setFilePath(filePath); ((S3FixedWidthRecordReaderContext)readerContext).setFileLength(block.getFileLength()); } else if (recordReaderMode == RECORD_READER_MODE.DELIMITED_RECORD) { ((S3DelimitedRecordReaderContext)readerContext).setFilePath(filePath); ((S3DelimitedRecordReaderContext)readerContext).setFileLength(block.getFileLength()); <START> } <END> return null; }</code><technical_language>move this block initialize()</technical_language>

Target:
protected FSDataInputStream setupStream(BlockMetadata.FileBlockMetadata block) throws IOException { return null; }
Source:
<code>public static Expression rewrite(Expression expression, Map<Symbol, Type> symbolTypes, SymbolAllocator symbolAllocator) { <START> checkState(!(expression instanceof GroupingOperation), "GroupingOperation should have been re-written to a FunctionCall before execution"); <END> if (expression instanceof SymbolReference) { return expression; } return ExpressionTreeRewriter.rewriteWith(new Visitor(symbolTypes, symbolAllocator), expression, new Context()); }</code><technical_language>refactor. grouping hidden in tree, for GROUPING(...) + 1</technical_language>

Target:
public static Expression rewrite(Expression expression, Map<Symbol, Type> symbolTypes, SymbolAllocator symbolAllocator) { return ExpressionTreeRewriter.rewriteWith(new Visitor(symbolTypes, symbolAllocator), expression, new Context()); }
Source:
<code>private static boolean sendToSlackUser(String authToken, String message, String user) { boolean success = false; logger.debug("sendToSlackUser authToken='{}', message='{}', user='{}'", authToken, message, user); SlackSession session = null; try { session = SlackSessionFactory.createWebSocketSlackSession(authToken); session.connect(); SlackUser slackUser = session.findUserByUserName(user); if (user == null) { logger.error("Could not find Slack user '{}'", user); } else { session.sendMessageToUser(slackUser, message, null); success = true; } } catch (IOException e) { logger.error("Error sending message to Slack user", e); } finally { try { if (session != null) { session.disconnect(); } } catch (IOException e) { <START> logger.error("Error disonnecting Slack session", e); <END> } } return success; }</code><technical_language>"disconnecting"</technical_language>

Target:
private static boolean sendToSlackUser(String authToken, String message, String user) { boolean success = false; logger.debug("sendToSlackUser authToken='{}', message='{}', user='{}'", authToken, message, user); SlackSession session = null; try { session = SlackSessionFactory.createWebSocketSlackSession(authToken); session.connect(); SlackUser slackUser = session.findUserByUserName(user); if (user == null) { logger.error("Could not find Slack user '{}'", user); } else { session.sendMessageToUser(slackUser, message, null); success = true; } } catch (IOException e) { logger.error("Error sending message to Slack user", e); } finally { try { if (session != null) { session.disconnect(); } } catch (IOException e) { logger.error("Error disconnecting Slack session", e); } } return success; }
Source:
<code>private Object serializeFieldValue(Schema fieldSchema, Object fieldValue) { Object output = fieldValue; switch (fieldSchema.getType()) { case ARRAY: case MAP: case RECORD: byte[] data = null; try { @SuppressWarnings("rawtypes") SpecificDatumWriter writer = getDatumWriter(fieldSchema); data = IOUtils.serialize(writer, fieldValue); } catch (IOException e) { LOG.error(e.getMessage(), e); } output = data; break; case UNION: if (fieldSchema.getTypes().size() == 2 && isNullable(fieldSchema)) { int schemaPos = getUnionSchema(fieldValue, fieldSchema); Schema unionSchema = fieldSchema.getTypes().get(schemaPos); output = serializeFieldValue(unionSchema, fieldValue); } else { data = null; try { @SuppressWarnings("rawtypes") SpecificDatumWriter writer = getDatumWriter(fieldSchema); data = IOUtils.serialize(writer, fieldValue); } catch (IOException e) { LOG.error(e.getMessage(), e); } output = data; } break; case FIXED: break; case ENUM: case STRING: output = fieldValue.toString(); break; case BYTES: output = ((ByteBuffer) fieldValue).array(); break; case INT: case LONG: case FLOAT: case DOUBLE: case BOOLEAN: <START> output = fieldValue; <END> break; case NULL: break; default: throw new AssertionError(fieldSchema.getType().name()); } return output; }</code><technical_language>output holds fieldValue. need reassign it</technical_language>

Target:
private Object serializeFieldValue(Schema fieldSchema, Object fieldValue) { Object output = fieldValue; switch (fieldSchema.getType()) { case ARRAY: case MAP: case RECORD: byte[] data = null; try { @SuppressWarnings("rawtypes") SpecificDatumWriter writer = getDatumWriter(fieldSchema); data = IOUtils.serialize(writer, fieldValue); } catch (IOException e) { LOG.error(e.getMessage(), e); } output = data; break; case UNION: if (fieldSchema.getTypes().size() == 2 && isNullable(fieldSchema)) { int schemaPos = getUnionSchema(fieldValue, fieldSchema); Schema unionSchema = fieldSchema.getTypes().get(schemaPos); output = serializeFieldValue(unionSchema, fieldValue); } else { data = null; try { @SuppressWarnings("rawtypes") SpecificDatumWriter writer = getDatumWriter(fieldSchema); data = IOUtils.serialize(writer, fieldValue); } catch (IOException e) { LOG.error(e.getMessage(), e); } output = data; } break; case FIXED: break; case ENUM: case STRING: output = fieldValue.toString(); break; case BYTES: output = ((ByteBuffer) fieldValue).array(); break; case INT: case LONG: case FLOAT: case DOUBLE: case BOOLEAN: case NULL: break; default: throw new AssertionError(fieldSchema.getType().name()); } return output; }
Source:
<code>public void doSystemCancel(String chargeId, Long accountId) { final Optional<ChargeEntity> maybeCharge = chargeDao.findByExternalIdAndGatewayAccount(chargeId, accountId); if (maybeCharge.isPresent()) { doCancel(maybeCharge.get(), SYSTEM_CANCELLATION_FLOW); } else { throw new ChargeNotFoundRuntimeException(chargeId); <START> } <END> }</code><technical_language>I want get rid of mapping optional pattern - significantly nicer replacement, if disagree, a LOT of work replace instance, stuck patterns</technical_language>

Target:
public Optional<ChargeEntity> doSystemCancel(String chargeId, Long accountId) { return chargeDao.findByExternalIdAndGatewayAccount(chargeId, accountId) .map(chargeEntity -> { doCancel(chargeEntity, SYSTEM_CANCELLATION_FLOW); return chargeEntity; }); }
Source:
<code>private ExecutionType getRandomExecutionType(Bundle bundle) throws Exception { ExecutionType current = bundle.getProcessObject().getOrder(); Random r = new Random(); ExecutionType[] values = ExecutionType.values(); int i; do { i = r.nextInt(values.length); <START> } while (current.equals(values[i])); <END> return values[i]; }</code><technical_language>is generally recommended == for enums comparison</technical_language>

Target:
private ExecutionType getRandomExecutionType(Bundle bundle) throws Exception { ExecutionType current = bundle.getProcessObject().getOrder(); Random r = new Random(); ExecutionType[] values = ExecutionType.values(); int i; do { i = r.nextInt(values.length); } while (current == values[i]); return values[i]; }
Source:
<code>private static byte[] reverse(final byte[] a) { final int length = a.length; <START> int i = length / 2; <END> while(i-- != 0) { final byte t = a[length - i - 1]; a[length - i - 1] = a[i]; a[i] = t; } return a; }</code><technical_language>This accidentally included unrelated change</technical_language>

Target:
private static byte[] reverse(final byte[] a) { final int length = a.length; for (int i = length / 2; i-- != 0; ) { final byte t = a[length - i - 1]; a[length - i - 1] = a[i]; a[i] = t; } return a; }
Source:
<code>protected void appendHeaderFooterToFile(Path filePath, String commandId, byte[] header, byte[] footer) { try { Path tmpPath = Files.move(filePath, createTemp("tmp" + commandId), StandardCopyOption.REPLACE_EXISTING); try (InputStream is = Files.newInputStream(tmpPath); FileOutputStream os = new FileOutputStream(filePath.toFile(), true)) { if (header.length > 0) { <START> os.write(header); <END> } IOUtils.copy(is, os); if (footer.length > 0) { os.write(footer); } os.flush(); } finally { Files.delete(tmpPath); } } catch (IOException e) { log.error("Unable to append header and footer", e); } }</code><technical_language>if header footer want move + copy file</technical_language>

Target:
protected void appendHeaderFooterToFile(Path filePath, String commandId, byte[] header, byte[] footer) { if (header.length == 0 && footer.length == 0) { return; } try { Path tmpPath = Files.move(filePath, createTemp("tmp" + commandId), StandardCopyOption.REPLACE_EXISTING); try (InputStream is = Files.newInputStream(tmpPath); FileOutputStream os = new FileOutputStream(filePath.toFile(), true)) { if (header.length > 0) { os.write(header); } IOUtils.copy(is, os); if (footer.length > 0) { os.write(footer); } os.flush(); } finally { Files.delete(tmpPath); } } catch (IOException e) { log.error("Unable to append header and footer", e); } }
Source:
<code>protected boolean checkUserAndGroupsAuthorization(Guid userId, String groupIds, final ActionGroup actionGroup, final Guid object, final VdcObjectType type) { <START> final NGuid permId = <END> DbFacade.getInstance().getEntityPermissionsForUserAndGroups(userId, groupIds, actionGroup, object, type); if (permId != null) { if (log.isDebugEnabled()) { log.debugFormat("Found permission {0} for user when running {1}, on {2} with id {3}", permId, getActionType(), type.getVdcObjectTranslation(), object); } return true; } if (log.isDebugEnabled()) { log.debugFormat("No permission found for user when running action {0}, on object {1} for action group {2} with id {3}.", getActionType(), type.getVdcObjectTranslation(), actionGroup, object); } return false; }</code><technical_language>Please getDbFacade() - easier unit test</technical_language>

Target:
protected boolean checkUserAndGroupsAuthorization(Guid userId, String groupIds, final ActionGroup actionGroup, final Guid object, final VdcObjectType type) { final NGuid permId = getDbFacade().getEntityPermissionsForUserAndGroups(userId, groupIds, actionGroup, object, type); if (permId != null) { if (log.isDebugEnabled()) { log.debugFormat("Found permission {0} for user when running {1}, on {2} with id {3}", permId, getActionType(), type.getVdcObjectTranslation(), object); } return true; } if (log.isDebugEnabled()) { log.debugFormat("No permission found for user when running action {0}, on object {1} for action group {2} with id {3}.", getActionType(), type.getVdcObjectTranslation(), actionGroup, object); } return false; }
Source:
<code>private String getDeleteSql() { String sql = null; if (config.deleteEnabled) { switch (config.pkMode) { case RECORD_KEY: if (fieldsMetadata.keyFieldNames.isEmpty()) { throw new ConnectException("Require primary keys to support delete"); } <START> sql = dbDialect.buildDeleteStatement( <END> tableId, asColumns(fieldsMetadata.keyFieldNames) ); break; default: throw new ConnectException("Deletes are only supported for pk.mode record_key"); } } return sql; }</code><technical_language>catch UnsupportedOperationException throw a ConnectException a more useful message</technical_language>

Target:
private String getDeleteSql() { String sql = null; if (config.deleteEnabled) { switch (config.pkMode) { case RECORD_KEY: if (fieldsMetadata.keyFieldNames.isEmpty()) { throw new ConnectException("Require primary keys to support delete"); } try { sql = dbDialect.buildDeleteStatement( tableId, asColumns(fieldsMetadata.keyFieldNames) ); } catch (UnsupportedOperationException e) { throw new ConnectException(String.format( "Deletes to table '%s' are not supported with the %s dialect.", tableId, dbDialect.name() )); } break; default: throw new ConnectException("Deletes are only supported for pk.mode record_key"); } } return sql; }
Source:
<code>public void parsePom(InputStream inputStream) { try { MavenXpp3Reader reader = new MavenXpp3Reader(); Model model = reader.read(inputStream); if (dependencies == null) { dependencies = new LinkedList<>(); } if (repositories == null) { repositories = new LinkedList<>(); } parent = model.getParent(); setPropertiesFromModel(this, model); for (org.apache.maven.model.Dependency dependency : model.getDependencies()) { if (!"test".equalsIgnoreCase(dependency.getScope())) { dependencies.add(new Dependency(new DefaultArtifact( <START> (dependency.getGroupId().contains("${")) ? parent.getGroupId() : dependency.getGroupId(), <END> dependency.getArtifactId(), dependency.getClassifier(), "jar", dependency.getVersion() ), JavaScopes.RUNTIME)); } } for (Repository remoteRepository : model.getRepositories()) { repositories.add(new RemoteRepository(remoteRepository.getId(), "default", remoteRepository.getUrl())); } } catch (Exception e) { LOGGER.error("Error while reading POM file", e); } }</code><technical_language>This is a bit of a stretch, parse do versions</technical_language>

Target:
public void parsePom(InputStream inputStream) { try { MavenXpp3Reader reader = new MavenXpp3Reader(); Model model = reader.read(inputStream); if (dependencies == null) { dependencies = new LinkedList<>(); } if (repositories == null) { repositories = new LinkedList<>(); } parent = model.getParent(); setPropertiesFromModel(this, model); for (org.apache.maven.model.Dependency dependency : model.getDependencies()) { if (!"test".equalsIgnoreCase(dependency.getScope())) { dependencies.add(new Dependency(new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), "jar", dependency.getVersion() ), JavaScopes.RUNTIME)); } } for (Repository remoteRepository : model.getRepositories()) { repositories.add(new RemoteRepository(remoteRepository.getId(), "default", remoteRepository.getUrl())); } } catch (Exception ex) { LOGGER.error("Error while reading POM file", ex); } }