auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void injectionAccountAndContainerForGetHeadDeleteBlobIdV1Test() throws Exception { populateAccountService(); String blobId = new BlobIdV1(BlobId.DEFAULT_FLAG, ClusterMapUtils.UNKNOWN_DATACENTER_ID, refAccount.getId(), refContainer.getId(), clusterMap.getWritablePartitionIds().get(0)).getID(); verifyAccountAndContainerFromBlobId(blobId, Account.UNKNOWN_ACCOUNT, Container.UNKNOWN_CONTAINER, RestServiceErrorCode.NotFound); <START> ByteBuffer content = ByteBuffer.allocate(0); <END> verifyResponsePathAccountAndContainerInjection(refAccount.getName() + "extra", false, Account.UNKNOWN_ACCOUNT, Container.DEFAULT_PUBLIC_CONTAINER); verifyResponsePathAccountAndContainerInjection(refAccount.getName() + "extra", true, Account.UNKNOWN_ACCOUNT, Container.DEFAULT_PRIVATE_CONTAINER); verifyResponsePathAccountAndContainerInjection(refAccount.getName(), false, refAccount, refDefaultPublicContainer); verifyResponsePathAccountAndContainerInjection(refAccount.getName(), true, refAccount, refDefaultPrivateContainer); }</code><technical_language>is this</technical_language>

Target:
public void injectionAccountAndContainerForGetHeadDeleteBlobIdV1Test() throws Exception { populateAccountService(); String blobId = new BlobIdV1(BlobId.DEFAULT_FLAG, ClusterMapUtils.UNKNOWN_DATACENTER_ID, refAccount.getId(), refContainer.getId(), clusterMap.getWritablePartitionIds().get(0)).getID(); verifyAccountAndContainerFromBlobId(blobId, Account.UNKNOWN_ACCOUNT, Container.UNKNOWN_CONTAINER, RestServiceErrorCode.NotFound); verifyResponsePathAccountAndContainerInjection(refAccount.getName() + "extra", false, Account.UNKNOWN_ACCOUNT, Container.DEFAULT_PUBLIC_CONTAINER); verifyResponsePathAccountAndContainerInjection(refAccount.getName() + "extra", true, Account.UNKNOWN_ACCOUNT, Container.DEFAULT_PRIVATE_CONTAINER); verifyResponsePathAccountAndContainerInjection(refAccount.getName(), false, refAccount, refDefaultPublicContainer); verifyResponsePathAccountAndContainerInjection(refAccount.getName(), true, refAccount, refDefaultPrivateContainer); }
Source:
<code>@Test public void testPlanTransformWithRuleNameConflicts() throws Exception { RelOptRule rule1 = new RelOptRule( operand(LogicalProject.class, operand(LogicalFilter.class, RelOptRule.any())), "MYRULE" <START> ) { <END> @Override public boolean matches(RelOptRuleCall call) { return false; } @Override public void onMatch(RelOptRuleCall call) { } }; RelOptRule rule2 = new RelOptRule( operand(LogicalFilter.class, operand(LogicalProject.class, RelOptRule.any())), "MYRULE" ) { @Override public boolean matches(RelOptRuleCall call) { return false; } @Override public void onMatch(RelOptRuleCall call) { } }; RuleSet ruleSet1 = RuleSets.ofList( rule1, EnumerableRules.ENUMERABLE_FILTER_RULE, EnumerableRules.ENUMERABLE_PROJECT_RULE); RuleSet ruleSet2 = RuleSets.ofList( rule2); Planner planner = getPlanner(null, Programs.of(ruleSet1), Programs.of(ruleSet2)); SqlNode parse = planner.parse("select * from \"emps\""); SqlNode validate = planner.validate(parse); RelNode convert = planner.convert(validate); RelTraitSet traitSet = planner.getEmptyTraitSet() .replace(EnumerableConvention.INSTANCE); RelNode transform = planner.transform(0, traitSet, convert); RelNode transform2 = planner.transform(1, traitSet, transform); assertThat(toString(transform2), equalTo( "EnumerableProject(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4])\n" + " EnumerableTableScan(table=[[hr, emps]])\n")); }</code><technical_language>house style is put paren end of previous line</technical_language>

Target:
@Test public void testPlanTransformWithRuleNameConflicts() throws Exception { RelOptRule rule1 = new RelOptRule( operand(LogicalProject.class, operand(LogicalFilter.class, RelOptRule.any())), "MYRULE") { @Override public boolean matches(RelOptRuleCall call) { return false; } public void onMatch(RelOptRuleCall call) { } }; RelOptRule rule2 = new RelOptRule( operand(LogicalFilter.class, operand(LogicalProject.class, RelOptRule.any())), "MYRULE") { @Override public boolean matches(RelOptRuleCall call) { return false; } public void onMatch(RelOptRuleCall call) { } }; RuleSet ruleSet1 = RuleSets.ofList( rule1, EnumerableRules.ENUMERABLE_FILTER_RULE, EnumerableRules.ENUMERABLE_PROJECT_RULE); RuleSet ruleSet2 = RuleSets.ofList( rule2); Planner planner = getPlanner(null, Programs.of(ruleSet1), Programs.of(ruleSet2)); SqlNode parse = planner.parse("select * from \"emps\""); SqlNode validate = planner.validate(parse); RelNode convert = planner.convert(validate); RelTraitSet traitSet = planner.getEmptyTraitSet() .replace(EnumerableConvention.INSTANCE); RelNode transform = planner.transform(0, traitSet, convert); RelNode transform2 = planner.transform(1, traitSet, transform); assertThat(toString(transform2), equalTo( "EnumerableProject(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4])\n" + " EnumerableTableScan(table=[[hr, emps]])\n")); }
Source:
<code>private void parseHashtags(RevCommit commit) throws ConfigInvalidException { if (hashtags != null) { return; } List<String> hashtagsLines = commit.getFooterLines(FOOTER_HASHTAGS); if (hashtagsLines.isEmpty()) { return; } else if (hashtagsLines.size() > 1) { throw expectedOneFooter(FOOTER_HASHTAGS, hashtagsLines); } hashtags = <START> new HashSet<String>(Arrays.asList(hashtagsLines.get(0).split(","))); <END> }</code><technical_language>guava Sets.newHashSet(T... obj)</technical_language>

Target:
private void parseHashtags(RevCommit commit) throws ConfigInvalidException { if (hashtags != null) { return; } List<String> hashtagsLines = commit.getFooterLines(FOOTER_HASHTAGS); if (hashtagsLines.isEmpty()) { return; } else if (hashtagsLines.size() > 1) { throw expectedOneFooter(FOOTER_HASHTAGS, hashtagsLines); } hashtags = Sets.newHashSet(Splitter.on(',').split(hashtagsLines.get(0))); }
Source:
<code>public void processLeftData(final MistDataEvent input) { final Object prevState = applyStatefulFunction.getCurrentState(); applyStatefulFunction.update((IN)input.getValue()); final OUT output = applyStatefulFunction.produceResult(); LOG.log(Level.FINE, "{0} updates the state {1} to {2} with input {3}, and generates {4}", <START> new Object[]{getOperatorIdentifier(), prevState, applyStatefulFunction.getCurrentState(), input, output}); <END> input.setValue(output); outputEmitter.emitData(input); }</code><technical_language>prevState equal current state if state object is same</technical_language>

Target:
public void processLeftData(final MistDataEvent input) { applyStatefulFunction.update((IN)input.getValue()); final OUT output = applyStatefulFunction.produceResult(); LOG.log(Level.FINE, "{0} updates the state to {1} with input {2}, and generates {3}", new Object[]{getOperatorIdentifier(), applyStatefulFunction.getCurrentState(), input, output}); input.setValue(output); outputEmitter.emitData(input); }
Source:
<code>public void setPorts(Service service) { List<PortSpec> ports = getServicePorts(service); Map<String, Object> launchConfigData = DataAccessor.fields(service) .withKey(ServiceDiscoveryConstants.FIELD_LAUNCH_CONFIG).withDefault(Collections.EMPTY_MAP) .as(Map.class); Account env = objectManager.loadResource(Account.class, service.getAccountId()); List<String> newPorts = new ArrayList<>(); for (PortSpec port : ports) { if (port.getPublicPort() == null) { <START> PooledResource resource = poolManager.allocateOneResource(env, service, <END> new PooledResourceOptions().withQualifier( ResourcePoolConstants.ENVIRONMENT_PORT)); if (resource != null) { port.setPublicPort(new Integer(resource.getName())); } newPorts.add(port.toSpec()); } } if (!newPorts.isEmpty()) { launchConfigData.put(InstanceConstants.FIELD_PORTS, newPorts); DataAccessor.fields(service).withKey(ServiceDiscoveryConstants.FIELD_LAUNCH_CONFIG).set(launchConfigData); objectManager.persist(service); } }</code><technical_language>I this work if service multiple random ports. allocateOneResource return port time. write a test a service more random port needs assigned</technical_language>

Target:
public void setPorts(Service service) { List<PortSpec> ports = getServicePorts(service); Map<String, Object> launchConfigData = DataAccessor.fields(service) .withKey(ServiceDiscoveryConstants.FIELD_LAUNCH_CONFIG).withDefault(Collections.EMPTY_MAP) .as(Map.class); Account env = objectManager.loadResource(Account.class, service.getAccountId()); List<String> newPorts = new ArrayList<>(); List<PortSpec> toAllocate = new ArrayList<>(); for (PortSpec port : ports) { if (port.getPublicPort() == null) { toAllocate.add(port); } } List<PooledResource> resource = poolManager.allocateResource(env, service, new PooledResourceOptions().withCount(toAllocate.size()).withQualifier( ResourcePoolConstants.ENVIRONMENT_PORT)); int i = 0; for (PortSpec port : toAllocate) { if (resource.size() <= i) { break; } port.setPublicPort(new Integer(resource.get(i).getName())); newPorts.add(port.toSpec()); i++; } if (!newPorts.isEmpty()) { launchConfigData.put(InstanceConstants.FIELD_PORTS, newPorts); DataAccessor.fields(service).withKey(ServiceDiscoveryConstants.FIELD_LAUNCH_CONFIG).set(launchConfigData); objectManager.persist(service); } }
Source:
<code>public void addDefaultPublications() { if (!hasPublications()) { if (publishPublicationsSpecified) { log.warn("None of the specified publications matched for project '{}' - nothing to publish.", getProject().getPath()); return; } PublishingExtension publishingExtension = (PublishingExtension) getProject().getExtensions().findByName("publishing"); if (publishingExtension == null) { log.warn("None of the specified publications matched for project '{}' - nothing to publish.", getProject().getPath()); return; } Publication mavenJavaPublication = publishingExtension.getPublications().findByName(MAVEN_JAVA); if (mavenJavaPublication != null) { <START> log.info("No publications specified for project '{}' - adding '{}' configuration.", <END> getProject().getPath(), MAVEN_JAVA); addPublication(mavenJavaPublication); } Publication ivyJavaPublication = publishingExtension.getPublications().findByName(IVY_JAVA); if (ivyJavaPublication != null) { log.info("No publications specified for project '{}' - adding '{}' configuration.", getProject().getPath(), IVY_JAVA); addPublication(ivyJavaPublication); } checkDependsOnArtifactsToPublish(); } }</code><technical_language>configuration --> publication</technical_language>

Target:
public void addDefaultPublications() { if (!hasPublications()) { if (publishPublicationsSpecified) { log.warn("None of the specified publications matched for project '{}' - nothing to publish.", getProject().getPath()); return; } PublishingExtension publishingExtension = (PublishingExtension) getProject().getExtensions().findByName("publishing"); if (publishingExtension == null) { log.warn("None of the specified publications matched for project '{}' - nothing to publish.", getProject().getPath()); return; } Publication mavenJavaPublication = publishingExtension.getPublications().findByName(MAVEN_JAVA); if (mavenJavaPublication != null) { log.info("No publications specified for project '{}' - adding '{}' publication.", getProject().getPath(), MAVEN_JAVA); addPublication(mavenJavaPublication); } Publication ivyJavaPublication = publishingExtension.getPublications().findByName(IVY_JAVA); if (ivyJavaPublication != null) { log.info("No publications specified for project '{}' - adding '{}' publication.", getProject().getPath(), IVY_JAVA); addPublication(ivyJavaPublication); } checkDependsOnArtifactsToPublish(); } }
Source:
<code>public Iterable<Map.Entry<UK, UV>> entries() { Map<UK, UV> userMap = stateTable.get(currentNamespace); <START> return userMap == null ? Collections.emptyList() : userMap.entrySet(); <END> }</code><technical_language>Do need return Collections.emptySet align userMap.entrySet()</technical_language>

Target:
public Iterable<Map.Entry<UK, UV>> entries() { Map<UK, UV> userMap = stateTable.get(currentNamespace); return userMap == null ? Collections.emptySet() : userMap.entrySet(); }
Source:
<code>public static Slice stCentroid(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); validateType("ST_Centroid", geometry, EnumSet.of(POINT, MULTI_POINT, LINE_STRING, MULTI_LINE_STRING, POLYGON, MULTI_POLYGON)); GeometryType geometryType = GeometryType.getForEsriGeometryType(geometry.geometryType()); if (geometryType == GeometryType.POINT) { return input; } int pointCount = ((MultiVertexGeometry) geometry.getEsriGeometry()).getPointCount(); if (pointCount == 0) { return serialize(createFromEsriGeometry(new Point(), geometry.getEsriSpatialReference())); } try { return serialize(geometry.centroid()); } catch (RuntimeException e) { if (e instanceof PrestoException && ((PrestoException) e).getErrorCode() == INVALID_FUNCTION_ARGUMENT.toErrorCode()) { throw e; } <START> throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Cannot compute centroid: %s Use ST_IsValid to confirm that input geometry is valid or compute centroid for a bounding box using ST_Envelope.", e.getMessage()), e); <END> } }</code><technical_language>@jagill Is this logic needed? I removed test triggered it</technical_language>

Target:
public static Slice stCentroid(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); validateType("ST_Centroid", geometry, EnumSet.of(POINT, MULTI_POINT, LINE_STRING, MULTI_LINE_STRING, POLYGON, MULTI_POLYGON)); GeometryType geometryType = GeometryType.getForEsriGeometryType(geometry.geometryType()); if (geometryType == GeometryType.POINT) { return input; } int pointCount = ((MultiVertexGeometry) geometry.getEsriGeometry()).getPointCount(); if (pointCount == 0) { return serialize(createFromEsriGeometry(new Point(), geometry.getEsriSpatialReference())); } return serialize(geometry.centroid()); }
Source:
<code>public void closeTree(long requestedEndTime) { synchronized (latestBranch) { this.treeEnd = requestedEndTime; for (int i = 0; i < latestBranch.size(); i++) { latestBranch.get(i).closeThisNode(treeEnd); treeIO.writeNode(latestBranch.get(i)); } try (FileChannel fc = treeIO.getFcOut();) { ByteBuffer buffer = ByteBuffer.allocate(TREE_HEADER_SIZE); buffer.order(ByteOrder.LITTLE_ENDIAN); buffer.clear(); fc.position(0); buffer.putInt(HISTORY_FILE_MAGIC_NUMBER); buffer.putInt(FILE_VERSION); buffer.putInt(config.getProviderVersion()); buffer.putInt(config.getBlockSize()); buffer.putInt(config.getMaxChildren()); buffer.putInt(nodeCount); buffer.putInt(latestBranch.get(0).getSequenceNumber()); buffer.putLong(latestBranch.get(0).getNodeStart()); buffer.flip(); int res = fc.write(buffer); assert (res <= TREE_HEADER_SIZE); } catch (IOException e) { <START> throw new RuntimeException(); <END> } } }</code><technical_language>please put a message in this rte, a fan of making a method throws exception runtime exception</technical_language>

Target:
public void closeTree(long requestedEndTime) { synchronized (latestBranch) { this.treeEnd = requestedEndTime; for (int i = 0; i < latestBranch.size(); i++) { latestBranch.get(i).closeThisNode(treeEnd); treeIO.writeNode(latestBranch.get(i)); } try (FileChannel fc = treeIO.getFcOut();) { ByteBuffer buffer = ByteBuffer.allocate(TREE_HEADER_SIZE); buffer.order(ByteOrder.LITTLE_ENDIAN); buffer.clear(); fc.position(0); buffer.putInt(HISTORY_FILE_MAGIC_NUMBER); buffer.putInt(FILE_VERSION); buffer.putInt(config.getProviderVersion()); buffer.putInt(config.getBlockSize()); buffer.putInt(config.getMaxChildren()); buffer.putInt(nodeCount); buffer.putInt(latestBranch.get(0).getSequenceNumber()); buffer.putLong(latestBranch.get(0).getNodeStart()); buffer.flip(); int res = fc.write(buffer); assert (res <= TREE_HEADER_SIZE); } catch (IOException e) { throw new RuntimeException("State system write error"); } } }
Source:
<code>public static Parameter dataProfilePeriodOfRecord() { return new ParameterBuilder() .name("dataProfile") .description("Data Profile (column set) of the download. For use with the monitoring location summary endpoint.") .modelRef(new ModelRef("string")) .parameterType("query") .required(false) .allowableValues(new AllowableListValues(Arrays.asList( <START> Profile.PERIOD_OF_RECORD.toString()), <END> "LIST")) .build(); }</code><technical_language>Profile.SUMMARY_STATION.toString() is valid here</technical_language>

Target:
public static Parameter dataProfilePeriodOfRecord() { return new ParameterBuilder() .name("dataProfile") .description("Data Profile (column set) of the download. For use with the monitoring location summary endpoint.") .modelRef(new ModelRef("string")) .parameterType("query") .required(false) .allowableValues(new AllowableListValues(Arrays.asList( Profile.SUMMARY_STATION.toString(), Profile.PERIOD_OF_RECORD.toString()), "LIST")) .build(); }
Source:
<code>protected void executeCommand() { VDS vds = getVds(); VDSGroup cluster = getVdsGroup(); Version partialVdcVersion = new Version( new Version(Config.<String> GetValue(ConfigValues.VdcVersion)).toString(2)); RpmVersion vdsVersion = vds.getVersion(); Version vdsmVersion = new Version(vdsVersion.getMajor(),vdsVersion.getMinor()); if (!Config.<HashSet<Version>> GetValue(ConfigValues.SupportedVDSMVersions).contains(vdsmVersion)) { <START> ReportNonOperationReason(NonOperationalReason.VERSION_INCOMPATIBLE_WITH_CLUSTER, <END> Config.<HashSet<Version>> GetValue(ConfigValues.SupportedVDSMVersions).toString(), vdsmVersion.toString()); } else if (!VersionSupport.checkClusterVersionSupported(cluster.getcompatibility_version(), vds)) { ReportNonOperationReason(NonOperationalReason.CLUSTER_VERSION_INCOMPATIBLE_WITH_CLUSTER, cluster.getcompatibility_version().toString(), vds.getSupportedClusterLevels().toString()); } setSucceeded(true); }</code><technical_language>please method name begins a case</technical_language>

Target:
protected void executeCommand() { VDS vds = getVds(); VDSGroup cluster = getVdsGroup(); Version partialVdcVersion = new Version( new Version(Config.<String> GetValue(ConfigValues.VdcVersion)).toString(2)); RpmVersion vdsVersion = vds.getVersion(); Version vdsmVersion = new Version(vdsVersion.getMajor(),vdsVersion.getMinor()); if (!Config.<HashSet<Version>> GetValue(ConfigValues.SupportedVDSMVersions).contains(vdsmVersion)) { reportNonOperationReason(NonOperationalReason.VERSION_INCOMPATIBLE_WITH_CLUSTER, Config.<HashSet<Version>> GetValue(ConfigValues.SupportedVDSMVersions).toString(), vdsmVersion.toString()); } else if (!VersionSupport.checkClusterVersionSupported(cluster.getcompatibility_version(), vds)) { reportNonOperationReason(NonOperationalReason.CLUSTER_VERSION_INCOMPATIBLE_WITH_CLUSTER, cluster.getcompatibility_version().toString(), vds.getSupportedClusterLevels().toString()); } setSucceeded(true); }
Source:
<code>public static VmPayload map(org.ovirt.engine.api.model.VmPayload entity, VmPayload template) { VmPayload model = template != null ? template : new VmPayload(); model.setType(VmDeviceType.valueOf(entity.getType().toUpperCase())); <START> if (entity.getFile() != null) { <END> model.setFileName(entity.getFile().getName()); model.setContent(entity.getFile().getContent()); } return model; }</code><technical_language>entity.isSetFile()</technical_language>

Target:
public static VmPayload map(org.ovirt.engine.api.model.VmPayload entity, VmPayload template) { VmPayload model = template != null ? template : new VmPayload(); model.setType(VmDeviceType.valueOf(entity.getType().toUpperCase())); if (entity.isSetFile()) { model.setFileName(entity.getFile().getName()); model.setContent(entity.getFile().getContent()); } return model; }
Source:
<code><START> public void determineContentAccessCertState(Owner owner) throws GeneralSecurityException, IOException { <END> if (!owner.isContentAccessModeDirty()) { return; } if (StringUtils.isEmpty(owner.getContentAccessMode())) { contentAccessCertCurator.deleteForOwner(owner); } owner.setContentAccessModeDirty(false); ownerCurator.merge(owner); }</code><technical_language>curious: throws GeneralSecurityException and/or IOException here</technical_language>

Target:
public void determineContentAccessCertState(Owner owner) { if (!owner.isContentAccessModeDirty()) { return; } if (owner.contentAccessMode() .equals(ContentAccessCertServiceAdapter.DEFAULT_CONTENT_ACCESS_MODE)) { contentAccessCertCurator.deleteForOwner(owner); } owner.setContentAccessModeDirty(false); ownerCurator.merge(owner); }
Source:
<code><START> public void updateAddresses(final RxDocumentServiceRequest request, final URI serverKey) { <END> Objects.requireNonNull(request, "expected non-null request"); Objects.requireNonNull(serverKey, "expected non-null serverKey"); URI serviceEndpoint = this.endpointManager.resolveServiceEndpoint(request); this.addressCacheByEndpoint.computeIfPresent(serviceEndpoint, (ignored, endpointCache) -> { final GatewayAddressCache addressCache = endpointCache.addressCache; addressCache.updateAddresses(serverKey); return endpointCache; }); }</code><technical_language>need a check method if feature flag is enabled here? if feature flag is disable this method is invoked</technical_language>

Target:
public void updateAddresses(final RxDocumentServiceRequest request, final URI serverKey) { Objects.requireNonNull(request, "expected non-null request"); Objects.requireNonNull(serverKey, "expected non-null serverKey"); if (this.tcpConnectionEndpointRediscoveryEnabled) { URI serviceEndpoint = this.endpointManager.resolveServiceEndpoint(request); this.addressCacheByEndpoint.computeIfPresent(serviceEndpoint, (ignored, endpointCache) -> { final GatewayAddressCache addressCache = endpointCache.addressCache; addressCache.updateAddresses(serverKey); return endpointCache; }); } else { logger.warn("tcpConnectionEndpointRediscovery is not enabled, should not reach here."); } }
Source:
<code>public void RemovePotentialMember(S solution) { Iterator<Pair<S, Double>> it = this.potentialMembers.iterator(); while (it.hasNext()) { <START> if (it.next().getLeft() == solution) { <END> it.remove(); break; } } }</code><technical_language>I notice remove equivalent solutions, a single instance (== is used, .equals(solution)). if instance is times, is removed times. Thus, I suggest equals instead of ==, in case a instance used. additional fix. However, highlights another point: is normal times instance in this container? If not, current issue a wrong use, break fix improves performance</technical_language>

Target:
public void RemovePotentialMember(S solution) { Iterator<Pair<S, Double>> it = this.potentialMembers.iterator(); while (it.hasNext()) { if (it.next().getLeft().equals(solution)) { it.remove(); break; } } }
Source:
<code>static void validateTextField(Schema inputSchema, String key) { if (inputSchema.getField(key) == null) { throw new IllegalArgumentException(String.format("Input field %s does not exist in the input schema %s.", key, inputSchema.toString())); } Schema schema = inputSchema.getField(key).getSchema(); Schema.Type type = schema.isNullable() ? schema.getNonNullable().getType() : schema.getType(); if (type.equals(Schema.Type.ARRAY)) { Schema componentSchema = schema.getComponentSchema(); type = componentSchema.isNullable() ? componentSchema.getNonNullable().getType() : componentSchema.getType(); } <START> if (!(type.equals(Schema.Type.STRING) || type.equals(Schema.Type.ARRAY))) { <END> throw new IllegalArgumentException(String.format("Field to be transformed should be of type String or " + "Nullable String or Array of type String or Nullable " + "String . But was %s for field %s.", type, key)); } }</code><technical_language>this type != Schema.Type.STRING (you compare for enums). is valid for array. If is, means field is array of arrays</technical_language>

Target:
static void validateTextField(Schema inputSchema, String key) { if (inputSchema.getField(key) == null) { throw new IllegalArgumentException(String.format("Input field %s does not exist in the input schema %s.", key, inputSchema.toString())); } Schema schema = inputSchema.getField(key).getSchema(); Schema.Type type = schema.isNullable() ? schema.getNonNullable().getType() : schema.getType(); if (type == Schema.Type.ARRAY) { Schema componentSchema = schema.getComponentSchema(); type = componentSchema.isNullable() ? componentSchema.getNonNullable().getType() : componentSchema.getType(); } if (type != Schema.Type.STRING) { throw new IllegalArgumentException(String.format("Field to be transformed should be of type String or " + "Nullable String or Array of type String or Nullable " + "String . But was %s for field %s.", type, key)); } }
Source:
<code>public VertxPluginRegistry(Vertx vertx, VertxEngineConfig vxEngineConfig, Map<String, String> config) { super(config); <START> this.vertx=vertx; <END> String sslProxyHost = System.getProperty("https.proxyHost", "none"); Integer sslProxyPort = Integer.valueOf(System.getProperty("https.proxyPort", "443")); if(!"none".equalsIgnoreCase(sslProxyHost)){ sslProxy = new ProxyOptions(); sslProxy.setHost(sslProxyHost); sslProxy.setPort(sslProxyPort); sslProxy.setType(ProxyType.HTTP); } String proxyHost = System.getProperty("http.proxyHost", "none"); Integer proxyPort = Integer.valueOf(System.getProperty("http.proxyPort", "80")); if(!"none".equalsIgnoreCase(proxyHost)){ proxy = new ProxyOptions(); proxy.setHost(proxyHost); proxy.setPort(proxyPort); proxy.setType(ProxyType.HTTP); } }</code><technical_language>Style nit: please spaces assignment</technical_language>

Target:
public VertxPluginRegistry(Vertx vertx, VertxEngineConfig vxEngineConfig, Map<String, String> config) { super(config); this.vertx = vertx; String sslProxyHost = System.getProperty("https.proxyHost", "none"); Integer sslProxyPort = Integer.valueOf(System.getProperty("https.proxyPort", "443")); sslNoProxy = System.getProperty("https.nonProxyHosts", "none"); if (!"none".equalsIgnoreCase(sslProxyHost)) { sslProxy = new ProxyOptions(); sslProxy.setHost(sslProxyHost); sslProxy.setPort(sslProxyPort); sslProxy.setType(ProxyType.HTTP); } String proxyHost = System.getProperty("http.proxyHost", "none"); Integer proxyPort = Integer.valueOf(System.getProperty("http.proxyPort", "80")); noProxy = System.getProperty("http.nonProxyHosts", "none"); if (!"none".equalsIgnoreCase(proxyHost)) { proxy = new ProxyOptions(); proxy.setHost(proxyHost); proxy.setPort(proxyPort); proxy.setType(ProxyType.HTTP); } }
Source:
<code><START> PrefixTreeNode addChild(Character c) { <END> if (!hasChild(c)) { children.put(c, new PrefixTreeNode()); } return children.get(c); }</code><technical_language>please add visibility this methods public/protected/private</technical_language>

Target:
protected PrefixTreeNode addChild(Character c) { if (!hasChild(c)) { children.put(c, new PrefixTreeNode()); } return children.get(c); }
Source:
<code>public void overrideConfigs(@Nonnull TableConfig tableConfig) { <START> if (tableConfig.getIsDimTable() != null && tableConfig.getIsDimTable().equals("true")) { <END> _tableDataManagerConfig.addProperty(TABLE_DATA_MANAGER_NAME, DIMENSION.name()); } }</code><technical_language>equalsIgnoreCase</technical_language>

Target:
public void overrideConfigs(@Nonnull TableConfig tableConfig) { _tableDataManagerConfig.addProperty(TABLE_IS_DIMENSION, tableConfig.isDimTable()); }
Source:
<code>public Date getOrder() { <START> GregorianCalendar gc = new GregorianCalendar(2018, 12, 10, 0, 0, 0); <END> return gc.getTime(); }</code><technical_language>i remember month number 11</technical_language>

Target:
public Date getOrder() { GregorianCalendar gc = new GregorianCalendar(2018, 11, 10, 0, 0, 0); return gc.getTime(); }
Source:
<code>protected String kind() { for (AbstractConfigNode n : children) { if (n instanceof ConfigNodeSingleToken) { Token t = ((ConfigNodeSingleToken) n).token(); if (Tokens.isUnquotedText(t) && !t.tokenText().equals("include") && <START> t.tokenText().matches(".*\\w.*")) { <END> return t.tokenText(); } } } return null; }</code><technical_language>yeah - this is kind of a mini-parsing step here. I grab kind in parser pass ConfigNodeInclude constructor something. a bit more memory avoids knowledge of syntax in this method parser completed</technical_language>

Target:
protected ConfigIncludeKind kind() { return kind; }
Source:
<code>public void presentAsFile(final File file, final List<CertifiedProductSearchDetails> cpList) { try (FileWriter writer = new FileWriter(file); <START> CSVPrinter csvPrinter = new CSVPrinter(writer, CSVFormat.EXCEL);) { <END> csvPrinter.printRecord(generateHeaderValues()); for (CertifiedProductSearchDetails cp : cpList) { if (cp.getSurveillance() != null && cp.getSurveillance().size() > 0) { for (Surveillance currSurveillance : cp.getSurveillance()) { List<List<String>> rowValues = generateMultiRowValue(cp, currSurveillance); for (List<String> rowValue : rowValues) { csvPrinter.printRecord(rowValue); } } } } } catch (final IOException ex) { LOGGER.error("Could not write file " + file.getName(), ex); } }</code><technical_language>of multi-resource trys a semi-colon resource (like this one) don't. way, need pick stick it. prefer version trailing semi-colon, I trys, persuaded other a good reason</technical_language>

Target:
public void presentAsFile(final File file, final List<CertifiedProductSearchDetails> cpList) { try (FileWriter writer = new FileWriter(file); CSVPrinter csvPrinter = new CSVPrinter(writer, CSVFormat.EXCEL)) { csvPrinter.printRecord(generateHeaderValues()); for (CertifiedProductSearchDetails cp : cpList) { if (cp.getSurveillance() != null && cp.getSurveillance().size() > 0) { for (Surveillance currSurveillance : cp.getSurveillance()) { List<List<String>> rowValues = generateMultiRowValue(cp, currSurveillance); for (List<String> rowValue : rowValues) { csvPrinter.printRecord(rowValue); } } } } } catch (final IOException ex) { LOGGER.error("Could not write file " + file.getName(), ex); } }
Source:
<code><START> public void heartbeat() { <END> if (!mContext.getClientContext().getClusterConf().clusterDefaultsLoaded()) { return; } ConfigHash hash; try { hash = mClient.getConfigHash(); } catch (IOException e) { LOG.error("Failed to heartbeat to meta master to get configuration hash:", e); mClient.disconnect(); return; } boolean isClusterConfUpdated = !hash.getClusterConfigHash().equals( mContext.getClientContext().getClusterConfHash()); boolean isPathConfUpdated = !hash.getPathConfigHash().equals( mContext.getClientContext().getPathConfHash()); if (isClusterConfUpdated || isPathConfUpdated) { try { mContext.reinit(isClusterConfUpdated, isPathConfUpdated); mException = null; } catch (UnavailableException e) { LOG.error("Failed to reinitialize FileSystemContext:", e); } catch (IOException e) { LOG.error("Failed to close FileSystemContext, interrupting the heartbeat thread", e); mException = e; Thread.currentThread().interrupt(); } } }</code><technical_language>allowed remove this synchronized. However, I remove close(), calls another method is synchronized. If remove synchronized ConfigHashSync#close(), remove deadlock cycle, right? concerned synchronized required for heartbeat()</technical_language>

Target:
public synchronized void heartbeat() { if (!mContext.getClientContext().getClusterConf().clusterDefaultsLoaded()) { return; } ConfigHash hash; try { hash = mClient.getConfigHash(); } catch (IOException e) { LOG.error("Failed to heartbeat to meta master to get configuration hash:", e); mClient.disconnect(); return; } boolean isClusterConfUpdated = !hash.getClusterConfigHash().equals( mContext.getClientContext().getClusterConfHash()); boolean isPathConfUpdated = !hash.getPathConfigHash().equals( mContext.getClientContext().getPathConfHash()); if (isClusterConfUpdated || isPathConfUpdated) { try { mContext.reinit(isClusterConfUpdated, isPathConfUpdated); mException = null; } catch (UnavailableException e) { LOG.error("Failed to reinitialize FileSystemContext:", e); } catch (IOException e) { LOG.error("Failed to close FileSystemContext, interrupting the heartbeat thread", e); mException = e; Thread.currentThread().interrupt(); } } }
Source:
<code>public double[] getTargetVariances() { final double[] values = file.readDoubleArray(TARGET_VARIANCES_PATH); if (values.length != panelTargets.get().size()) { <START> throw new GATKException(String.format("wrong number of elements in the target variances recovered " + <END> "from file '%s': %d != %d", file.getFile(), values.length, panelTargets.get().size())); } return values; }</code><technical_language>above. Also, "wrong" -> "Wrong"</technical_language>

Target:
public double[] getTargetVariances() { final double[] values = file.readDoubleArray(TARGET_VARIANCES_PATH); if (values.length != panelTargets.get().size()) { throw new GATKException(String.format("Wrong number of elements in the target variances recovered " + "from file '%s': number of target variances found in file (%d) != number of panel-target names (%d)", file.getFile(), values.length, panelTargets.get().size())); } return values; }
Source:
<code>public DSAPrivateKeyVersion build() throws BuilderException { try { return new DSAPrivateKeyVersion(this); <START> } catch (Exception e) { <END> throw new BuilderException("Building DSAKeyVersion failed", e); } }</code><technical_language>avoid catch exception</technical_language>

Target:
public DSAPrivateKeyVersion build() throws BuilderException { return new DSAPrivateKeyVersion(this); }
Source:
<code>public ExecutionResult executeInVR(final String routerIP, final String script, final String args, final Duration timeout) { Pair<Boolean, String> result; String cmdline = "/opt/cloud/bin/router_proxy.sh " + script + " " + routerIP + " " + args; cmdline = cmdline.replaceAll(";", "\\\\;"); try { s_logger.debug("Executing command in VR: " + cmdline); <START> result = SshHelper.sshExecute(_host.getIp(), 22, _username, null, _password.peek(), cmdline, 60000, 60000, (int)timeout.getMillis()); <END> } catch (final Exception e) { return new ExecutionResult(false, e.getMessage()); } return new ExecutionResult(result.first(), result.second()); }</code><technical_language>Please consider adding overridden version of SshHelper.sshExecute(String, int, String, String, ??, String, int, int, int) method accepts Duration encapsulate this type conversion</technical_language>

Target:
public ExecutionResult executeInVR(final String routerIP, final String script, final String args, final Duration timeout) { Pair<Boolean, String> result; String cmdline = "/opt/cloud/bin/router_proxy.sh " + script + " " + routerIP + " " + args; cmdline = cmdline.replaceAll(";", "\\\\;"); try { s_logger.debug("Executing command in VR: " + cmdline); result = SshHelper.sshExecute(_host.getIp(), 22, _username, null, _password.peek(), cmdline, VRScripts.CONNECTION_TIMEOUT, VRScripts.CONNECTION_TIMEOUT, timeout); } catch (final Exception e) { return new ExecutionResult(false, e.getMessage()); } return new ExecutionResult(result.first(), result.second()); }
Source:
<code>private Set<String> escapePaths(Set<String> paths) { <START> return paths.stream().map(s -> escapePath(s)).collect(Collectors.toSet()); <END> }</code><technical_language>method reference</technical_language>

Target:
protected Set<String> escapePaths(Set<String> paths) { return paths.stream().map(s -> escapePath(s)).collect(Collectors.toSet()); }
Source:
<code>private String getDefaultUrl(ProviderType type) { if (type == null) { return ""; } switch (type) { case OPENSTACK_NETWORK: return "http://localhost:9696"; case OPENSTACK_IMAGE: return "http://localhost:9292"; case FOREMAN: default: <START> return "https://localhost"; END> } }</code><technical_language>I change default</technical_language>

Target:
private String getDefaultUrl(ProviderType type) { if (type == null) { return ""; } switch (type) { case OPENSTACK_NETWORK: return "http://localhost:9696"; case OPENSTACK_IMAGE: return "http://localhost:9292"; case FOREMAN: default: return "http://localhost"; } }
Source:
<code>public static void init() { SWTBotUtil.failIfUIThread(); URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(COLLAPSE_TRACE_PATH), null); URI uri; try { uri = FileLocator.toFileURL(location).toURI(); fTestFile = new File(uri); } catch (URISyntaxException | IOException e) { e.printStackTrace(); fail(); } assumeTrue(fTestFile.exists()); IEclipsePreferences defaultPreferences = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID); defaultPreferences.put(ITmfTimePreferencesConstants.DATIME, "MMM d HH:mm:ss"); defaultPreferences.put(ITmfTimePreferencesConstants.SUBSEC, ITmfTimePreferencesConstants.SUBSEC_NO_FMT); TmfTimestampFormat.updateDefaultFormats(); SWTBotPreferences.TIMEOUT = 20000; fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT)); fBot = new SWTWorkbenchBot(); <START> final List<SWTBotView> openViews = fBot.views(); <END> for (SWTBotView view : openViews) { if (view.getTitle().equals("Welcome")) { view.close(); fBot.waitUntil(ConditionHelpers.ViewIsClosed(view)); } } SWTBotUtil.switchToTracingPerspective(); SWTBotUtil.waitForJobs(); }</code><technical_language>nice move part of closing Welcome view SWTBotUtil done in a separate patch</technical_language>

Target:
public static void init() { SWTBotUtil.failIfUIThread(); URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(COLLAPSE_TRACE_PATH), null); URI uri; try { uri = FileLocator.toFileURL(location).toURI(); fTestFile = new File(uri); } catch (URISyntaxException | IOException e) { e.printStackTrace(); fail(); } assumeTrue(fTestFile.exists()); IEclipsePreferences defaultPreferences = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID); defaultPreferences.put(ITmfTimePreferencesConstants.DATIME, "MMM d HH:mm:ss"); defaultPreferences.put(ITmfTimePreferencesConstants.SUBSEC, ITmfTimePreferencesConstants.SUBSEC_NO_FMT); TmfTimestampFormat.updateDefaultFormats(); SWTBotPreferences.TIMEOUT = 20000; fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT)); fBot = new SWTWorkbenchBot(); SWTBotUtil.closeView("Welcome", fBot); SWTBotUtil.switchToTracingPerspective(); SWTBotUtil.waitForJobs(); }
Source:
<code>private static EventDataConverter createConverter() { if (eventDataLoaded == null) { try { LoaderUtil.loadClass("org.slf4j.ext.EventData"); eventDataLoaded = true; } catch (final ClassNotFoundException cnfe) { eventDataLoaded = false; } } <START> return eventDataLoaded ? new EventDataConverter() : null; <END> }</code><technical_language>Instead of modifying this method, if update converter field static call this method class initialization? instead of requiring work (and allocation!) time a logger is created, done application loads</technical_language>

Target:
private static EventDataConverter createConverter() { try { LoaderUtil.loadClass("org.slf4j.ext.EventData"); return new EventDataConverter(); } catch (final ClassNotFoundException cnfe) { return null; } }
Source:
<code>private String consumeCapabilities(PacketLineIn pckIn, Consumer<String> serverOptionConsumer, Consumer<String> agentConsumer) throws IOException { String serverOptionPrefix = OPTION_SERVER_OPTION + '='; String agentPrefix = OPTION_AGENT + '='; String line = pckIn.readString(); while (line != PacketLineIn.DELIM && line != PacketLineIn.END) { if (line.startsWith(serverOptionPrefix)) { serverOptionConsumer .accept(line.substring(serverOptionPrefix.length())); } else if (line.startsWith(agentPrefix)) { agentConsumer.accept(line.substring(agentPrefix.length())); <START> } <END> line = pckIn.readString(); } return line; }</code><technical_language>other client capabilities? sense explicit 'else', } else { // Unrecognized capability. Ignore it. }</technical_language>

Target:
private static String consumeCapabilities(PacketLineIn pckIn, Consumer<String> serverOptionConsumer, Consumer<String> agentConsumer) throws IOException { String serverOptionPrefix = OPTION_SERVER_OPTION + '='; String agentPrefix = OPTION_AGENT + '='; String line = pckIn.readString(); while (line != PacketLineIn.DELIM && line != PacketLineIn.END) { if (line.startsWith(serverOptionPrefix)) { serverOptionConsumer .accept(line.substring(serverOptionPrefix.length())); } else if (line.startsWith(agentPrefix)) { agentConsumer.accept(line.substring(agentPrefix.length())); } else { } line = pckIn.readString(); } return line; }
Source:
<code>public void launchConfigurationChanged(ILaunchConfiguration configuration) { if (this.configChangeCalled) { return; } else { this.configChangeCalled = true; updateClasspathProvider(configuration); <START> this.configChangeCalled = false; <END> } }</code><technical_language>Needs in a finally block. error put noop mode forever</technical_language>

Target:
public synchronized void launchConfigurationChanged(ILaunchConfiguration configuration) { if (this.configChangeCalled) { return; } try { this.configChangeCalled = true; updateClasspathProvider(configuration); } finally { this.configChangeCalled = false; } }
Source:
<code>private static Vec3 positionFromSource(CommandSource origin) { <START> if (origin instanceof ICommandSender) { <END> return ((ICommandSender) origin).getPositionVector(); } return null; }</code><technical_language>LocatedSource instead</technical_language>

Target:
private static Vector3d positionFromSource(CommandSource origin) { if (origin instanceof LocatedSource) { return ((LocatedSource) origin).getLocation().getPosition(); } return null; }
Source:
<code>private void verifyRename(Path srcPath, Path dstPath, boolean overwrite) throws Exception { AbstractFileSystem fs = fc.getDefaultFileSystem(); <START> assertTrue(fs instanceof LocalFs); <END> ChecksumFs checksumFs = (ChecksumFs) fs; fs.delete(srcPath, true); fs.delete(dstPath, true); Options.Rename renameOpt = Options.Rename.NONE; if (overwrite) { renameOpt = Options.Rename.OVERWRITE; createTestFile(checksumFs, dstPath, 2); } createTestFile(checksumFs, srcPath, 1); assertTrue(fc.util().exists(checksumFs.getChecksumFile(srcPath))); checksumFs.rename(srcPath, dstPath, renameOpt); assertTrue(fc.util().exists(checksumFs.getChecksumFile(dstPath))); try (FSDataInputStream is = fs.open(dstPath)) { assertEquals(1, is.readInt()); } }</code><technical_language>cast it; get a stack trace</technical_language>

Target:
private void verifyRename(Path srcPath, Path dstPath, boolean overwrite) throws Exception { ChecksumFs fs = (ChecksumFs) fc.getDefaultFileSystem(); fs.delete(srcPath, true); fs.delete(dstPath, true); Options.Rename renameOpt = Options.Rename.NONE; if (overwrite) { renameOpt = Options.Rename.OVERWRITE; createTestFile(fs, dstPath, 2); } createTestFile(fs, srcPath, 1); assertTrue("Checksum file doesn't exist for source file - " + srcPath, fc.util().exists(fs.getChecksumFile(srcPath))); fs.rename(srcPath, dstPath, renameOpt); assertTrue("Checksum file doesn't exist for dest file - " + srcPath, fc.util().exists(fs.getChecksumFile(dstPath))); try (FSDataInputStream is = fs.open(dstPath)) { assertEquals(1, is.readInt()); } }
Source:
<code>public Optional<Timeline> getActiveTimeline(final String name) throws InternalNakadiException, NoSuchEventTypeException { final List<Timeline> timelines = getTimelines(name); if (timelines == null) { return Optional.empty(); } return timelines.stream() <START> .filter(t -> t.getSwitchedAt() != null) <END> .max(Comparator.comparing(Timeline::getOrder)); }</code><technical_language>good, good</technical_language>

Target:
public Optional<Timeline> getActiveTimeline(final String name) throws InternalNakadiException, NoSuchEventTypeException { final List<Timeline> timelines = getTimelinesOrdered(name); if (timelines == null) { return Optional.empty(); } final ListIterator<Timeline> rIterator = timelines.listIterator(timelines.size()); while (rIterator.hasPrevious()) { final Timeline toCheck = rIterator.previous(); if (toCheck.getSwitchedAt() != null) { return Optional.of(toCheck); } } return Optional.empty(); }
Source:
<code>private void showInitialSelection() { IWorkbenchWindow window = PlatformUI.getWorkbench() .getActiveWorkbenchWindow(); if (window == null) { return; } IEditorPart editor = window.getActivePage().getActiveEditor(); if (editor != null) { IEditorInput input = editor.getEditorInput(); <START> if (input instanceof IFileEditorInput) <END> reactOnSelection(new StructuredSelection( ((IFileEditorInput) input).getFile())); } else { IStructuredSelection selection = (IStructuredSelection) window .getSelectionService().getSelection(); reactOnSelection(selection); } }</code><technical_language>This work if editor a file open is in workspace. (SelectionUtils?) this work in case</technical_language>

Target:
private void showInitialSelection() { IWorkbenchWindow window = PlatformUI.getWorkbench() .getActiveWorkbenchWindow(); if (window == null) { return; } IEditorPart editor = window.getActivePage().getActiveEditor(); if (editor != null) { IEditorInput input = editor.getEditorInput(); Repository repository = AdapterUtils.adapt(input, Repository.class); if (repository != null) { reactOnSelection(new StructuredSelection(repository)); } } else { IStructuredSelection selection = (IStructuredSelection) window .getSelectionService().getSelection(); reactOnSelection(selection); } }
Source:
<code>public void showInterstitial() { if (mVungleManager != null) mVungleManager.playAd(mAdapterId, mPlacementForPlay, mAdConfig, new VungleListener() { @Override void onAdEnd(String placement, boolean wasSuccessfulView, boolean wasCallToActionClicked) { if (mMediationInterstitialListener != null) { if (wasCallToActionClicked) { mMediationInterstitialListener.onAdClicked(VungleInterstitialAdapter.this); <START> mMediationInterstitialListener.onAdLeftApplication(VungleInterstitialAdapter.this); <END> } mMediationInterstitialListener.onAdClosed(VungleInterstitialAdapter.this); } } @Override void onAdStart(String placement) { if (mMediationInterstitialListener != null) { mMediationInterstitialListener.onAdOpened(VungleInterstitialAdapter.this); } } @Override void onAdFail(String placement) { if (mMediationInterstitialListener != null) { mMediationInterstitialListener.onAdClosed(VungleInterstitialAdapter.this); } } }); }</code><technical_language>Is this callback called user is in app, immediately click? If clicking ad ad immediately close direct user play store (i.e. is ad) this is fine. If user app video ends this is called, call onLeaveApplication() callback is coming late</technical_language>

Target:
public void showInterstitial() { if (mVungleManager != null) mVungleManager.playAd(mPlacementForPlay, mAdConfig, new VungleListener() { @Override void onAdEnd(String placement, boolean wasSuccessfulView, boolean wasCallToActionClicked) { if (mMediationInterstitialListener != null) { if (wasCallToActionClicked) { mMediationInterstitialListener.onAdClicked(VungleInterstitialAdapter.this); } mMediationInterstitialListener.onAdClosed(VungleInterstitialAdapter.this); } } @Override void onAdStart(String placement) { if (mMediationInterstitialListener != null) { mMediationInterstitialListener.onAdOpened(VungleInterstitialAdapter.this); } } @Override void onAdFail(String placement) { if (mMediationInterstitialListener != null) { mMediationInterstitialListener.onAdClosed(VungleInterstitialAdapter.this); } } }); }
Source:
<code>public void onGitReferenceUpdated(GitReferenceUpdatedListener.Event event) { <START> ReplicationState state = new ReplicationState(injector.getInstance(GitUpdateProcessing.class)); <END> if (!running) { wrappedLog.warn("Replication plugin did not finish startup before event", state); return; } Project.NameKey project = new Project.NameKey(event.getProjectName()); for (Destination cfg : configs) { if (cfg.wouldPushProject(project) && cfg.wouldPushRef(event.getRefName())) { for (URIish uri : cfg.getURIs(project, null)) { cfg.schedule(project, event.getRefName(), uri, state); } } } state.markAllPushTasksScheduled(); }</code><technical_language>need do anymore. This class get injected needs pass parameters explicitly: new ReplicationState(new GitUpdateProcessing(changeHooks, database)); this.database exists. need add injection of ChangeHooks</technical_language>

Target:
public void onGitReferenceUpdated(GitReferenceUpdatedListener.Event event) { ReplicationState state = new ReplicationState(new GitUpdateProcessing(changeHooks, database)); if (!running) { wrappedLog.warn("Replication plugin did not finish startup before event", state); return; } Project.NameKey project = new Project.NameKey(event.getProjectName()); for (Destination cfg : configs) { if (cfg.wouldPushProject(project) && cfg.wouldPushRef(event.getRefName())) { for (URIish uri : cfg.getURIs(project, null)) { cfg.schedule(project, event.getRefName(), uri, state); } } } state.markAllPushTasksScheduled(); }