auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private boolean internalValidateAndSetQuota() { <START> if (isInternalExecution()) { <END> return true; } VdcActionType.QuotaDependency quotaDependency = this.getActionType().getQuotaDependency(); List<QuotaConsumptionParameter> consumptionParameters = new ArrayList<QuotaConsumptionParameter>(); try { switch (quotaDependency) { case NONE: return true; case STORAGE: addInternalStorageParameters(consumptionParameters); break; case VDS: addInternalVdsParameters(consumptionParameters); break; case BOTH: addInternalStorageParameters(consumptionParameters); addInternalVdsParameters(consumptionParameters); break; } } catch (ClassCastException e) { log.error("Command: " + this.getClass().getName() + ". Quota handling was expected - class does not implement the expected interface"); } QuotaConsumptionParameters quotaConsumptionParameters; if (getStoragePool() != null) { quotaConsumptionParameters = new QuotaConsumptionParameters( this.getStoragePool(), this.getStoragePool().getId(), this.getReturnValue().getCanDoActionMessages(), this); quotaConsumptionParameters.setParameters(consumptionParameters); } else { quotaConsumptionParameters = new QuotaConsumptionParameters( null, null, this.getReturnValue().getCanDoActionMessages(), this); quotaConsumptionParameters.setParameters(consumptionParameters); log.error("Command: " + this.getClass().getName() + ". Storage pool is not available for quota calculation. "); } if (!consumptionParameters.isEmpty()) { return true; } else { return true; } }</code><technical_language>reasoning this approach? Consider following: Creating a snapshot iterates VM's disks fires internal command snapshot disk. want quota calculation lowest building block possible</technical_language>

Target:
private boolean internalValidateAndSetQuota() { if (isInternalExecution()) { return true; } List<QuotaConsumptionParameter> consumptionParameters = new ArrayList<QuotaConsumptionParameter>(); try { switch (this.getActionType().getQuotaDependency()) { case NONE: return true; case STORAGE: addInternalStorageParameters(consumptionParameters); break; case VDS: addInternalVdsParameters(consumptionParameters); break; case BOTH: addInternalStorageParameters(consumptionParameters); addInternalVdsParameters(consumptionParameters); break; } } catch (ClassCastException e) { log.error("Command: " + this.getClass().getName() + ". Quota handling was expected - class does not implement the expected interface"); } QuotaConsumptionParametersWrapper quotaConsumptionParametersWrapper; if (getStoragePool() != null) { quotaConsumptionParametersWrapper = new QuotaConsumptionParametersWrapper( this.getStoragePool(), this.getReturnValue().getCanDoActionMessages(), this); quotaConsumptionParametersWrapper.setParameters(consumptionParameters); } else { quotaConsumptionParametersWrapper = new QuotaConsumptionParametersWrapper( null,this.getReturnValue().getCanDoActionMessages(), this); quotaConsumptionParametersWrapper.setParameters(consumptionParameters); log.error("Command: " + this.getClass().getName() + ". Storage pool is not available for quota calculation. "); } if (!consumptionParameters.isEmpty()) { return true; } else { return true; } }
Source:
<code>public int hashCode() { int hash = 1; <START> for (int i = 0; i < length(); i++) <END> hash = (31 * hash) + byteAt(i); return hash; }</code><technical_language>in case Bytes object is immutable, nice store this computing. This need constantly recompute for case Bytes in hashset</technical_language>

Target:
final public int hashCode() { if (hashCode == null) { int hash = 1; for (int i = 0; i < length(); i++) { hash = (31 * hash) + byteAt(i); } hashCode = hash; } return hashCode; }
Source:
<code>public void testAutoGeneratedHardwareWithMinCoresMinRamAndInvalidMinDisk() { Supplier<Set<? extends Location>> locations = Suppliers.<Set<? extends Location>>ofInstance(ImmutableSet.of(region)); Supplier<Set<? extends Image>> images = Suppliers.<Set<? extends Image>>ofInstance(ImmutableSet.of(image)); Supplier<Set<? extends Hardware>> hardwares = Suppliers.<Set<? extends Hardware>>ofInstance(ImmutableSet .<Hardware>of(hardware)); Provider<TemplateOptions> optionsProvider = createMock(Provider.class); Provider<TemplateBuilder> templateBuilderProvider = createMock(Provider.class); TemplateBuilder defaultTemplate = createMock(TemplateBuilder.class); GetImageStrategy getImageStrategy = createMock(GetImageStrategy.class); expect(optionsProvider.get()).andReturn(new TemplateOptions()); expect(getImageStrategy.getImage(anyObject(String.class))).andReturn(null); replay(defaultTemplate, optionsProvider, templateBuilderProvider, getImageStrategy); TemplateBuilderImpl templateBuilder = new ArbitraryCpuRamTemplateBuilderImpl(locations, new ImageCacheSupplier(images, 60, Atomics.<AuthorizationException>newReference(), Providers.of(getImageStrategy)), hardwares, Suppliers.ofInstance(region), optionsProvider, templateBuilderProvider); templateBuilder.minCores(2); templateBuilder.minRam(4096); float f = 100; <START> f = -f; <END> templateBuilder.minDisk(f); Template template = templateBuilder.build(); Hardware hardware = template.getHardware(); assertThat(hardware.getId()).isEqualTo("automatic:cores=2.0;ram=4096;disk=-100"); }</code><technical_language>is need for variables, pass below</technical_language>

Target:
public void testAutoGeneratedHardwareWithMinCoresMinRamAndInvalidMinDisk() { Supplier<Set<? extends Location>> locations = Suppliers.<Set<? extends Location>>ofInstance(ImmutableSet.of(region)); Supplier<Set<? extends Image>> images = Suppliers.<Set<? extends Image>>ofInstance(ImmutableSet.of(image)); Supplier<Set<? extends Hardware>> hardwares = Suppliers.<Set<? extends Hardware>>ofInstance(ImmutableSet .<Hardware>of(hardware)); Provider<TemplateOptions> optionsProvider = createMock(Provider.class); Provider<TemplateBuilder> templateBuilderProvider = createMock(Provider.class); TemplateBuilder defaultTemplate = createMock(TemplateBuilder.class); GetImageStrategy getImageStrategy = createMock(GetImageStrategy.class); expect(optionsProvider.get()).andReturn(new TemplateOptions()); expect(getImageStrategy.getImage(anyObject(String.class))).andReturn(null); replay(defaultTemplate, optionsProvider, templateBuilderProvider, getImageStrategy); TemplateBuilderImpl templateBuilder = new ArbitraryCpuRamTemplateBuilderImpl(locations, new ImageCacheSupplier(images, 60, Atomics.<AuthorizationException>newReference(), Providers.of(getImageStrategy)), hardwares, Suppliers.ofInstance(region), optionsProvider, templateBuilderProvider); templateBuilder.minCores(2); templateBuilder.minRam(4096); templateBuilder.minDisk(-100f); Template template = templateBuilder.build(); Hardware hardware = template.getHardware(); assertThat(hardware.getId()).isEqualTo("automatic:cores=2.0;ram=4096;disk=-100"); }
Source:
<code>public T setAvailableProviders(@NonNull List<IdpConfig> idpConfigs) { mProviders.clear(); for (IdpConfig config : idpConfigs) { if (mProviders.contains(config)) { throw new IllegalArgumentException("Each provider can only be set once. " + config.getProviderId() + " was set twice."); } else { mProviders.add(config); } if (config.getProviderId().equals(FACEBOOK_PROVIDER)) { try { <START> Class c = com.facebook.FacebookCallback.class; <END> } catch (NoClassDefFoundError e) { throw new RuntimeException("Facebook provider cannot be configured " + "without dependency. Did you forget to add " + "'com.facebook.android:facebook-android-sdk:VERSION' dependency?"); } } if (config.getProviderId().equals(TWITTER_PROVIDER)) { try { Class c = com.twitter.sdk.android.core.TwitterCore.class; } catch (NoClassDefFoundError e) { throw new RuntimeException("Twitter provider cannot be configured " + "without dependency. Did you forget to add " + "'com.twitter.sdk.android:twitter-core:VERSION' dependency?"); } } } return (T) this; }</code><technical_language>FacebookCallback? FacebookSdk more sense Facebook get rid of</technical_language>

Target:
public T setAvailableProviders(@NonNull List<IdpConfig> idpConfigs) { mProviders.clear(); for (IdpConfig config : idpConfigs) { if (mProviders.contains(config)) { throw new IllegalArgumentException("Each provider can only be set once. " + config.getProviderId() + " was set twice."); } else { mProviders.add(config); } if (config.getProviderId().equals(FACEBOOK_PROVIDER)) { try { Class c = com.facebook.FacebookSdk.class; } catch (NoClassDefFoundError e) { throw new RuntimeException("Facebook provider cannot be configured " + "without dependency. Did you forget to add " + "'com.facebook.android:facebook-android-sdk:VERSION' dependency?"); } } if (config.getProviderId().equals(TWITTER_PROVIDER)) { try { Class c = com.twitter.sdk.android.core.TwitterCore.class; } catch (NoClassDefFoundError e) { throw new RuntimeException("Twitter provider cannot be configured " + "without dependency. Did you forget to add " + "'com.twitter.sdk.android:twitter-core:VERSION' dependency?"); } } } return (T) this; }
Source:
<code>int getPort(URI url) { int port = url.getPort(); <START> if (port == -1) port = 9200 ; <END> return port; }</code><technical_language>ohh.. default 443 if https</technical_language>

Target:
int getPort(URI url) { int port = url.getPort(); if (port == -1) { if (sessionProtocol.isTls()) { port = 443; } else { port = 9200; } } return port; }
Source:
<code>public void testToNova() { <START> assertThat(converter.toNova(BlockPos.ORIGIN)).isEqualTo(Vector3D.ZERO); <END> }</code><technical_language>This needs more test cases, for negative values, making values get swapped around</technical_language>

Target:
public void testToNova() { for (int x = -1; x <= 1; x++) for (int y = -1; y <= 1; y++) for (int z = -1; z <= 1; z++) assertThat(converter.toNova(new BlockPos(x, y, z))).isEqualTo(new Vector3D(x, y, z)); }
Source:
<code>public ConstrainedMethod( ConfigurationSource source, MethodConstraintLocation location, List<ConstrainedParameter> parameterMetaData, Set<MetaConstraint<?>> returnValueConstraints, boolean isCascading) { super( source, ConstrainedElementKind.METHOD, location, returnValueConstraints, isCascading ); Method method = location.getMember(); if ( parameterMetaData.size() != method.getParameterTypes().length ) { throw log.getInvalidLengthOfParameterMetaDataListException( method, method.getParameterTypes().length, parameterMetaData.size() ); } this.parameterMetaData = Collections.unmodifiableList( parameterMetaData ); this.hasParameterConstraints = hasParameterConstraints( parameterMetaData ); <START> if ( isConstrained() ) { <END> run( SetAccessibility.action( method ) ); } }</code><technical_language>method set accessible here, copy hold in ValidatorImpl</technical_language>

Target:
public ConstrainedMethod( ConfigurationSource source, MethodConstraintLocation location, List<ConstrainedParameter> parameterMetaData, Set<MetaConstraint<?>> returnValueConstraints, boolean isCascading) { super( source, ConstrainedElementKind.METHOD, location, returnValueConstraints, isCascading ); Method method = location.getMember(); if ( parameterMetaData.size() != method.getParameterTypes().length ) { throw log.getInvalidLengthOfParameterMetaDataListException( method, method.getParameterTypes().length, parameterMetaData.size() ); } this.parameterMetaData = Collections.unmodifiableList( parameterMetaData ); this.hasParameterConstraints = hasParameterConstraints( parameterMetaData ); }
Source:
<code>private Object[] childrenOf(ProjectNode projectNode) { <START> boolean isGroupProjects = this.taskView.getState().isGroupProjects(); <END> return projectNodesFor(projectNode, isGroupProjects).toArray(); }</code><technical_language>Please clean this a bit. This method this: if (this.taskView.getState().isGroupProjects()) { result.addAll(projectNodesFor(projectNode)); } if (this.taskView.getState().isGroupTasks()) { result.addAll(groupNodesFor(projectNode)); } else { result.addAll(taskNodesFor(projectNode)); } projectNodesFor() method similar taskNodesFor()</technical_language>

Target:
private Object[] childrenOf(ProjectNode projectNode) { Set<Object> result = Sets.newHashSet(); if (!this.taskView.getState().isProjectHierarchyFlattened()) { result.addAll(projectNodesFor(projectNode)); } if (this.taskView.getState().isGroupTasks()) { result.addAll(groupNodesFor(projectNode)); } else { result.addAll(taskNodesFor(projectNode)); } return result.toArray(); }
Source:
<code>private void checkIdentifierIssue(IdentifierTree identifierTree) { <START> if (isVariableIdentifier(identifierTree)) { <END> return; } Symbol symbol = identifierTree.symbol(); if (isDeprecated(symbol)) { String name; if (isConstructor(symbol)) { name = symbol.owner().name(); } else { name = symbol.name(); } reportIssue(identifierTree, "Remove this use of \"" + name + "\"; it is deprecated."); } }</code><technical_language>juste renaming this method : isVariableDeclarationSimpleName</technical_language>

Target:
private void checkIdentifierIssue(IdentifierTree identifierTree) { if (isSimpleNameOfVariableTree(identifierTree)) { return; } Symbol symbol = identifierTree.symbol(); if (isDeprecated(symbol)) { String name; if (isConstructor(symbol)) { name = symbol.owner().name(); } else { name = symbol.name(); } reportIssue(identifierTree, "Remove this use of \"" + name + "\"; it is deprecated."); } }
Source:
<code>public ValidationResult validateAddProvider() { ValidationResult result = validatePluginType(); if (!result.isValid()) { return result; } if <START> (!(result = validateAuthentication()).isValid()) <END> { return result; } return super.validateAddProvider(); }</code><technical_language>care LOC metric. care expressions side effect. ~~ Ideally if test modify anything, needed. Please update result variable, proceed testing it</technical_language>

Target:
public ValidationResult validateAddProvider() { ValidationResult result = validatePluginType(); if (!result.isValid()) { return result; } result = validateAuthentication(); if (!result.isValid()) { return result; } return super.validateAddProvider(); }
Source:
<code>boolean create(User user, char[] password) { Objects.requireNonNull(user.getUserid()); Objects.requireNonNull(user.getEmail()); if (!insertCredentialsIfNotExists(user.getEmail(), password, user.getUserid())) { return false; } if (user.getCreatedDate() == null) { user.setCreatedDate(Instant.now()); } <START> insertUser(user); <END> return true; }</code><technical_language>I understand a batch here, if user insertion fails, e.g. of UnavailableException? wiser delete credentials</technical_language>

Target:
boolean create(User user, char[] password) { Objects.requireNonNull(user.getUserid()); Objects.requireNonNull(user.getEmail()); if (user.getCreatedDate() == null) { user.setCreatedDate(Instant.now()); } try { insertUser(user); if (!insertCredentialsIfNotExists(user.getEmail(), password, user.getUserid())) { session.execute(preparedDeleteUser.bind(user.getUserid())); return false; } return true; } catch (Exception insertException) { try { session.execute(preparedDeleteUser.bind(user.getUserid())); } catch (Exception e) { insertException.addSuppressed(e); } try { session.execute(preparedDeleteCredentials.bind(user.getEmail(), user.getUserid())); } catch (Exception e) { insertException.addSuppressed(e); } throw insertException; } }
Source:
<code>public void threeDimensionalFeatureBounds() { FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(); GeometryFactory gf = new GeometryFactory(new PrecisionModel()); SimpleFeatureType type = null; try { type = DataUtilities.createType("testSchema", "name:String,*geom:Geometry"); } catch (SchemaException e) { e.printStackTrace(); } SimpleFeature f1 = SimpleFeatureBuilder.build(type, new Object[] { "testFeature1", gf.createPoint(new Coordinate(10, 20, 30)) }, null); SimpleFeature f2 = SimpleFeatureBuilder.build(type, new Object[] { "testFeature2", gf.createPoint(new Coordinate(10, 10, 60)) }, null); SimpleFeature f3 = SimpleFeatureBuilder.build(type, new Object[] { "testFeature2", gf.createPoint(new Coordinate(1, 10, 6)) }, null); BoundingBox3D envelope1 = new ReferencedEnvelope3D( 0, 50, 0, 50, 0, 70, null); Filter bbox1 = ff.bbox(ff.property("geom"), envelope1); featureCollection = new ListFeatureCollection(TYPE, featureList); featureCollection.add(f1); featureCollection.add(f2); <START> featureCollection.add(f3); <END> assertTrue(bbox1.evaluate(f1)); assertTrue(bbox1.evaluate(f2)); assertTrue(bbox1.evaluate(f3)); }</code><technical_language>I want check featureCollection.getBounds() method ensure is a ReferencedEnvelope3D</technical_language>

Target:
public void threeDimensionalFeatureBounds() { GeometryFactory gf = new GeometryFactory(new PrecisionModel()); SimpleFeatureType type = null; try { type = DataUtilities.createType("testSchema", "name:String,*geom:Geometry"); } catch (SchemaException e) { e.printStackTrace(); } featureCollection = new ListFeatureCollection(TYPE, featureList); SimpleFeature f1 = SimpleFeatureBuilder.build(type, new Object[] { "testFeature1", gf.createPoint(new Coordinate(10, 20, 30)) }, null); SimpleFeature f2 = SimpleFeatureBuilder.build(type, new Object[] { "testFeature2", gf.createPoint(new Coordinate(10, 10, 60)) }, null); SimpleFeature f3 = SimpleFeatureBuilder.build(type, new Object[] { "testFeature2", gf.createPoint(new Coordinate(1, 10, 6)) }, null); featureCollection.add(f1); featureCollection.add(f2); ReferencedEnvelope origBounds = featureCollection.getBounds(); featureCollection.remove(f2); featureCollection.add(f3); ReferencedEnvelope postRemoveBounds = featureCollection.getBounds(); assertNotEquals(origBounds, postRemoveBounds); assertNotEquals(postRemoveBounds, f3.getBounds()); }
Source:
<code>public ValueObject filterValue(ValueObject value, Bundle context) { if (value == null || value.getObjectType() != ValueObject.TYPE.MAP) { return null; } ValueMap mapValue = value.asMap(); if(this.put != null) { ValueMap copy = ValueFactory.createMap(); copy.putAll(mapValue); <START> copy.put(this.key.getString(context).get(), this.put.getValue(context)); <END> return copy; } else if(this.defaultValue != null) { return mapValue.getOrDefault(this.key.getString(context).get(), this.defaultValue.getValue(context)); } else { return mapValue.get(this.key.getString(context).get()); } }</code><technical_language>if key is null. I tests for this. reasoning for shallow copy of map? This changes result possibly impacts people assumed a shallow copy</technical_language>

Target:
public ValueObject filterValue(ValueObject value, Bundle context) { if (value == null || value.getObjectType() != ValueObject.TYPE.MAP || this.key == null) { return null; } ValueMap mapValue = value.asMap(); if (this.put != null) { ValueMap copy = ValueFactory.createMap(); copy.putAll(mapValue); copy.put(this.key.getString(context).get(), this.put.getValue(context)); return copy; } else if (this.defaultValue != null) { return mapValue.getOrDefault(this.key.getString(context).get(), this.defaultValue.getValue(context)); } else { return mapValue.get(this.key.getString(context).get()); } }
Source:
<code>public CauseOfBlockage canRun(Item item) { if (item.isBuildable()) { return null; } Integer itemId = new Integer(item.id); if (blockedItems.containsKey(itemId)) { BlockedItem blockedItem = blockedItems.get(itemId); if (blockedItem.canRunWithTimeoutCheck()) { if (blockedItem.replicationFailedMessage != null) { item.addAction(new ReplicationFailedAction(blockedItem.replicationFailedMessage)); <START> logger.trace(blockedItem.getEventDescription() + " -> " + blockedItem.replicationFailedMessage); <END> } else { logger.trace(blockedItem.getEventDescription() + " can now run with no timeout check."); } blockedItems.remove(itemId); return null; } else { logger.trace(blockedItem.getEventDescription() + " (item id {}) is still waiting replication to gerrit slaves (waiting " + item.getInQueueForString() + ")", itemId, blockedItem.slavesWaitingFor.size()); return new WaitingForReplication(blockedItem.slavesWaitingFor.values()); } } else { BlockedItem blockedItem = getBlockedItem(item); if (blockedItem != null) { updateFromReplicationCache(blockedItem); blockedItems.put(itemId, blockedItem); return canRun(item); } else { logger.warn("blockedItem null!"); } } return null; }</code><technical_language>please logger.trace("{} -> {}", descr, message) formatting instead, string concatenation is avoided trace level is turned off</technical_language>

Target:
public CauseOfBlockage canRun(Item item) { if (item.isBuildable()) { return null; } Integer itemId = new Integer(item.id); if (blockedItems.containsKey(itemId)) { BlockedItem blockedItem = blockedItems.get(itemId); if (blockedItem.canRunWithTimeoutCheck()) { if (blockedItem.replicationFailedMessage != null) { item.addAction(new ReplicationFailedAction(blockedItem.replicationFailedMessage)); logger.trace("{} -> {}", blockedItem.getEventDescription(), blockedItem.replicationFailedMessage); } else { logger.trace("{} can now run with no timeout check.", blockedItem.getEventDescription()); } blockedItems.remove(itemId); return null; } else { logger.trace(blockedItem.getEventDescription() + " (item id {}) is still waiting replication to gerrit slaves (waiting " + item.getInQueueForString() + ")", itemId, blockedItem.slavesWaitingFor.size()); return new WaitingForReplication(blockedItem.slavesWaitingFor.values()); } } else { BlockedItem blockedItem = getBlockedItem(item); if (blockedItem != null) { updateFromReplicationCache(blockedItem); blockedItems.put(itemId, blockedItem); return canRun(item); } else { logger.debug("blockedItem null for {}!", item.id); } } return null; }
Source:
<code>private static SqlNode toSqlNode(String sql) { try { <START> return new SqlBatchImpl(sql).iterator().next().getParsedQuery(); <END> } catch (SqlParseException | PlannerFallbackException e) { return null; } }</code><technical_language>I pass a single sql statement here, SqlParserFactory.parse(sql)</technical_language>

Target:
private static SqlNode toSqlNode(String sql) { try { return SqlParserFactory.parse(sql); } catch (SqlParseException e) { return null; } }
Source:
<code>public DiagnosticReport saveFHIRDiagnosticReport(DiagnosticReport diagnosticReport) { <START> System.out.println("Laboratory Handler : diSave FHIR Diagnostic Report"); <END> Encounter omrsDiagnosticReport = new Encounter(); if (diagnosticReport.getId() != null) { omrsDiagnosticReport.setUuid(diagnosticReport.getId().getIdPart()); } EncounterService encounterService = Context.getEncounterService(); return diagnosticReport; }</code><technical_language>Death sysouts :)</technical_language>

Target:
public DiagnosticReport saveFHIRDiagnosticReport(DiagnosticReport diagnosticReport) { if (log.isDebugEnabled()) { log.debug("Laboratory Handler : Save FHIR Diagnostic Report"); } Encounter omrsDiagnosticReport = new Encounter(); if (diagnosticReport.getId() != null) { omrsDiagnosticReport.setUuid(diagnosticReport.getId().getIdPart()); } EncounterService encounterService = Context.getEncounterService(); return diagnosticReport; }
Source:
<code>private String getWorkspaceRelativePath(String sourcePath) { if (org.apache.commons.lang.StringUtils.isBlank(sourcePath) || sourcePath.contains("{")) { return sourcePath; } IPath absolutePath = new Path(sourcePath); IContainer container = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(absolutePath); if (container != null) { <START> return container.getFullPath().toPortableString(); <END> } return null; }</code><technical_language>I toPortableString() is preferred toString(). IPath.toString() separator '/' for platforms is need. Docs if toPortableString() is matched fromPortableString() converting Path. toPortableString() doubles ':' belongs device part (for Windows). For example "c:\one\two:x" transformed "c://one/two::x". If segments ':' symbols, is difference toString(). if a segment ':' symbol, fromPortableString() is necessary restore original path, for Linux</technical_language>

Target:
private String getWorkspaceRelativePath(String sourcePath) { if (org.apache.commons.lang.StringUtils.isBlank(sourcePath) || sourcePath.contains("{")) { return sourcePath; } IPath absolutePath = new Path(sourcePath); IContainer container = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(absolutePath); if (container != null) { return container.getFullPath().toString(); } return null; }
Source:
<code>public void setLocation(String location, Job job) throws IOException { FileInputFormat.setInputPaths(job, location); this.jobConf = job.getConfiguration(); String projectedFields = getUDFProperties().getProperty( <START> contextSignature + projectionSuffix); <END> if (projectedFields != null) { requiredFieldList = (RequiredFieldList) ObjectSerializer.deserialize(projectedFields); } }</code><technical_language>do need contextSignature here? is in getUDFProperties() get properties for this UDF signature/FuncSpec</technical_language>

Target:
public void setLocation(String location, Job job) throws IOException { FileInputFormat.setInputPaths(job, location); this.jobConf = job.getConfiguration(); String projectedFields = getUDFProperties().getProperty(projectionKey); if (projectedFields != null) { requiredFieldList = (RequiredFieldList) ObjectSerializer.deserialize(projectedFields); } }
Source:
<code>private void removeReferencesFromTags(List<EnrichmentTag> tags, List<Long> judgmentIds) { tags.parallelStream().forEach(tag -> { try { TAG_TYPE tagValue = jsonStringParser.parseAndValidate(tag.getValue()); removeReference(tagValue, judgmentIds); <START> String value = jsonStringWriter.write(tagValue); <END> tag.setValue(value); } catch (IOException e) { throw new RuntimeException(e); } }); }</code><technical_language>jsonFormatter.format(tagValue)</technical_language>

Target:
private void removeReferencesFromTags(List<EnrichmentTag> tags, List<Long> judgmentIds) { tags.parallelStream().forEach(tag -> { try { TAG_TYPE tagValue = jsonStringParser.parseAndValidate(tag.getValue()); removeReference(tagValue, judgmentIds); String value = jsonFormatter.formatObject(tagValue); tag.setValue(value); } catch (IOException e) { throw new RuntimeException(e); } }); }
Source:
<code>private void addFileToMonitor(FileObject file) { try { monitor.addFile(file); } catch (RuntimeException re) { if (re.getMessage().contains("files-cache")) <START> log.error("There is no implementation for files-cache in VFS2"); <END> else log.error(re.getMessage()); } }</code><technical_language>Nice. Turn exception a log message move on. I this strategy. working, prevent able debug. suggestion: please include stack trace in log message: suggestion log.error("files-cache error adding VFS monitor. is implementation for files-cache in VFS2", file, re);</technical_language>

Target:
private void addFileToMonitor(FileObject file) throws RuntimeException { try { if (monitor != null) monitor.addFile(file); } catch (RuntimeException re) { if (re.getMessage().contains("files-cache")) log.error("files-cache error adding to VFS monitor. " + "There is no implementation for files-cache in VFS2", file, re); else log.error("Runtime error adding to VFS monitor", file, re); throw re; } }
Source:
<code>public void testNoDefaulColortMenuInAppearancePropertyViewFromContainerMappingFontColor() { selectAndCheckEditPart(NODE_CONTAINER, DNodeContainerEditPart.class); bot.viewByTitle("Properties").setFocus(); SWTBotSiriusHelper.selectPropertyTabItem("Appearance"); try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 0).click().contextMenu(DEFAULT_COLOR); fail(); } catch (WidgetNotFoundException e) { <START> assertTrue(true); <END> } }</code><technical_language>of completely useless</technical_language>

Target:
public void testNoDefaulColortMenuInAppearancePropertyViewFromContainerMappingFontColor() { selectAndCheckEditPart(NODE_CONTAINER, DNodeContainerEditPart.class); bot.viewByTitle("Properties").setFocus(); SWTBotSiriusHelper.selectPropertyTabItem("Appearance"); try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 0).click().contextMenu(DEFAULT_COLOR); fail(); } catch (WidgetNotFoundException e) { } }
Source:
<code>public List<String> getProvider() { <START> if (provider == null) { <END> provider = new ArrayList<String>(); } return this.provider; }</code><technical_language>instantiate provider list constructor itself? allow get rid of "if" condition called getProvider method is invoked</technical_language>

Target:
public List<String> getProvider() { return this.provider; }
Source:
<code><START> public TranslatableComponent(TranslatableComponent original) <END> { translate = original.getTranslate(); for (BaseComponent baseComponent : original.getWith()) { with.add( ( baseComponent instanceof TextComponent ? new TextComponent( (TextComponent) baseComponent ) : new TranslatableComponent( (TranslatableComponent) baseComponent ) ) ); } }</code><technical_language>This method clone extra components formatting</technical_language>

Target:
public TranslatableComponent(TranslatableComponent original) { super( original ); setTranslate(original.getTranslate()); for (BaseComponent baseComponent : original.getWith()) { with.add( baseComponent.duplicate() ); } }
Source:
<code>public long getLeastLogEntry() { <START> return currentLog.getLeastLogEntry(); <END> }</code><technical_language>talk this one: I needs careful thought. acceptors for example fail legacy requests a TruncatedStateLogException (see PaxosAcceptor.checkLogIfNeeded()) affect visibility</technical_language>

Target:
public long getLeastLogEntry() { return Math.min(legacyLogLeastLogEntry.get(), cutoffInclusive); }
Source:
<code>protected void repairProfileApplications(final Resource resource) { if (resource == null) { return; } final StereotypeApplicationRepair repair = new StereotypeApplicationRepair(resource); final ZombieStereotypesDescriptor stereotypesDescriptor = repair.repair(); if (stereotypesDescriptor == null || !stereotypesDescriptor.hasZombies()) { return; } for (final IAdaptable schema : stereotypesDescriptor.getZombieSchemas()) { <START> final IRepairAction repairAction = stereotypesDescriptor.getSuggestedRepairAction(schema); <END> stereotypesDescriptor.repair(schema, repairAction, new BasicDiagnostic(), new NullProgressMonitor()); } }</code><technical_language>please check repairAction null, if this problems next line? If so, please add a null check</technical_language>

Target:
protected void repairProfileApplications(final Resource resource) { if (resource == null) { return; } final StereotypeApplicationRepair repair = new StereotypeApplicationRepair(resource); final ZombieStereotypesDescriptor stereotypesDescriptor = repair.repair(); if (stereotypesDescriptor == null || !stereotypesDescriptor.hasZombies()) { return; } for (final IAdaptable schema : stereotypesDescriptor.getZombieSchemas()) { final IRepairAction repairAction = stereotypesDescriptor.getSuggestedRepairAction(schema); if (repairAction != null) { stereotypesDescriptor.repair(schema, repairAction, new BasicDiagnostic(), new NullProgressMonitor()); } } }
Source:
<code>public void force_zero_coverage() { SonarRunner build = Tests.createSonarRunnerBuild() .setProjectDir(TestUtils.projectDir("lcov")) .setProjectKey(Tests.PROJECT_KEY) .setProjectName(Tests.PROJECT_KEY) .setProjectVersion("1.0") .setSourceDirs("."); Tests.setEmptyProfile(Tests.PROJECT_KEY, Tests.PROJECT_KEY); orchestrator.executeBuild(build); assertThat(getProjectMeasure("coverage").getValue()).isEqualTo(0); assertThat(getProjectMeasure("lines_to_cover").getValue()).isEqualTo(10); assertThat(getProjectMeasure("uncovered_lines").getValue()).isEqualTo(10); assertThat(getFileMeasure("coverage_line_hits_data").getData()).startsWith("1=0;2=0;3=0;5=0"); assertThat(getProjectMeasure("conditions_to_cover")).isNull(); <START> assertThat(getProjectMeasure("uncovered_conditions")).isNull(); <END> }</code><technical_language>@vilchik-elena do remove lines coverage</technical_language>

Target:
public void force_zero_coverage() { SonarRunner build = Tests.createSonarRunnerBuild() .setProjectDir(TestUtils.projectDir("lcov")) .setProjectKey(Tests.PROJECT_KEY) .setProjectName(Tests.PROJECT_KEY) .setProjectVersion("1.0") .setSourceDirs(".") .setProperty("sonar.javascript.forceZeroCoverage", "true"); Tests.setEmptyProfile(Tests.PROJECT_KEY, Tests.PROJECT_KEY); orchestrator.executeBuild(build); assertThat(getProjectMeasure("lines_to_cover").getValue()).isEqualTo(10); assertThat(getProjectMeasure("uncovered_lines").getValue()).isEqualTo(10); assertThat(getProjectMeasure("it_lines_to_cover").getValue()).isEqualTo(10); assertThat(getProjectMeasure("it_uncovered_lines").getValue()).isEqualTo(10); assertThat(getFileMeasure("coverage_line_hits_data").getData()).startsWith("1=0;2=0;3=0;5=0"); assertThat(getFileMeasure("it_coverage_line_hits_data").getData()).startsWith("1=0;2=0;3=0;5=0"); assertThat(getProjectMeasure("conditions_to_cover")).isNull(); assertThat(getProjectMeasure("it_conditions_to_cover")).isNull(); assertThat(getProjectMeasure("uncovered_conditions")).isNull(); assertThat(getProjectMeasure("it_uncovered_conditions")).isNull(); }
Source:
<code>public CompletableFuture<Optional<RequiredDifficulty>> updateChain(String username, List<UserPublicKeyLink> chain, ProofOfWork proof) { return writeTarget.updateChain(username, chain, proof) .thenApply(x -> { <START> this.update(); <END> return x; }); }</code><technical_language>this call update() if difficulty-requirement met</technical_language>

Target:
public CompletableFuture<Optional<RequiredDifficulty>> updateChain(String username, List<UserPublicKeyLink> chain, ProofOfWork proof) { return writeTarget.updateChain(username, chain, proof) .thenApply(x -> { if (x.isEmpty()) this.update(); return x; }); }
Source:
<code>protected Map<String, String> getTaskConfiguration() { List<TaskDefinition> tasks = this.getContext().getBuildDefinition().getTaskDefinitions(); for (TaskDefinition taskDefinition : tasks) { if (taskDefinition.isEnabled()) { AbstractBuildContext config = AbstractBuildContext.createContextFromMap(taskDefinition.getConfiguration()); <START> if ((config != null) && config.releaseManagementContext.isReleaseMgmtEnabled()) { <END> return taskDefinition.getConfiguration(); } } } return null; }</code><technical_language>Redundant parentheses (config != null)</technical_language>

Target:
protected Map<String, String> getTaskConfiguration() { List<TaskDefinition> tasks = this.getContext().getBuildDefinition().getTaskDefinitions(); for (TaskDefinition taskDefinition : tasks) { if (taskDefinition.isEnabled() && TaskDefinitionHelper.isReleaseMgmtEnabled(taskDefinition)) { return taskDefinition.getConfiguration(); } } return null; }
Source:
<code>public void doRestart(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, RestartNotSupportedException { checkPermission(ADMINISTER); if (req != null && req.getMethod().equals("GET")) { req.getView(this,"_restart.jelly").forward(req,rsp); return; } <START> if (req.getReferer() == null || req.getMethod().equals("POST")) { <END> rsp.setStatus(200); restart(); return; } if (req == null || req.getMethod().equals("POST")) { restart(); } if (rsp != null) { rsp.sendRedirect2("."); } }</code><technical_language>NPE req == null</technical_language>

Target:
public void doRestart(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, RestartNotSupportedException { checkPermission(ADMINISTER); if (req != null && req.getMethod().equals("GET")) { req.getView(this,"_restart.jelly").forward(req,rsp); return; } if (req != null && req.getReferer() == null && req.getMethod().equals("POST")) { rsp.setStatus(200); restart(); return; } if (req == null || req.getMethod().equals("POST")) { restart(); } if (rsp != null) { rsp.sendRedirect2("."); } }
Source:
<code>public void sendKeyedMessages(String topic, String keySeparator, String... messages) throws IOException { try (AutoClosableProcess autoClosableProcess = AutoClosableProcess.runNonBlocking( <START> kafkaDir.resolve(Paths.get("bin", "kafka-console-producer.sh")).toString(), <END> "--broker-list", KAFKA_ADDRESS, "--topic", topic, "--property", "parse.key=true", "--property", "key.separator=" + keySeparator)) { sendMessagesAndWait(autoClosableProcess, messages); } }</code><technical_language>neat if de-duplicate this; difference additional arguments. thinking of like: sendMessagesAndAwait(topic, messages, additionalArguments) { try (... runNonBlocking(join(baseArgs, additionalArguments))) { ... } } I fine moving this a follow-up get this in sooner</technical_language>

Target:
public void sendKeyedMessages(String topic, String keySeparator, String... messages) throws IOException { List<String> args = new ArrayList<>(createSendMessageArguments(topic)); args.add("--property"); args.add("parse.key=true"); args.add("--property"); args.add("key.separator=" + keySeparator); sendMessagesAndWait(args, messages); }
Source:
<code>private void notifyMsgAsInterrupted(RawData msg) { <START> msg.onError(new InterruptedIOException("Interrupted by shutdown connector.")); <END> }</code><technical_language>this send if connector is started (until now) stopped, I prefer rename message "Connector is running"</technical_language>

Target:
private void notifyMsgAsInterrupted(RawData msg) { msg.onError(new InterruptedIOException("Connector is not running.")); }
Source:
<code>public Integer getMateReferenceIndex() { if (null == mMateReferenceIndex) { if (NO_ALIGNMENT_REFERENCE_NAME.equals(mMateReferenceName)) { mMateReferenceIndex = NO_ALIGNMENT_REFERENCE_INDEX; } else if (null != mHeader) { mMateReferenceIndex = mHeader.getSequenceIndex(mMateReferenceName); } else { <START> throw new IllegalArgumentException("A non-null SAMFileHeader is required to resolve the mate reference index"); <END> } } return mMateReferenceIndex; }</code><technical_language>IllegalStateException</technical_language>

Target:
public Integer getMateReferenceIndex() { if (null == mMateReferenceIndex) { if (NO_ALIGNMENT_REFERENCE_NAME.equals(mMateReferenceName)) { mMateReferenceIndex = NO_ALIGNMENT_REFERENCE_INDEX; } else if (null != mHeader) { mMateReferenceIndex = mHeader.getSequenceIndex(mMateReferenceName); } else { throw new IllegalStateException("A non-null SAMFileHeader is required to resolve the mate reference index"); } } return mMateReferenceIndex; }
Source:
<code>public void testInitOrientations() throws Exception { <START> final List<DecisionTableOrientation> orientations = Arrays.asList(DecisionTableOrientation.CROSS_TABLE, <END> DecisionTableOrientation.RULE_AS_COLUMN, DecisionTableOrientation.RULE_AS_ROW); testedView.initDecisionTableOrientations(orientations); orientations.stream().forEach(orientation -> verify(lstDecisionTableOrientation).addOption(orientation.value())); }</code><technical_language>Out of interest do DecisionTableOrientation.values()</technical_language>

Target:
public void testInitOrientations() throws Exception { final List<DecisionTableOrientation> orientations = Arrays.asList(DecisionTableOrientation.values()); testedView.initDecisionTableOrientations(orientations); orientations.stream().forEach(orientation -> verify(lstDecisionTableOrientation).addOption(orientation.value())); }
Source:
<code>public ProcessExecutorImpl() { this.shutdownThreads = new ShutDownThreadHolder(); this.service = Executors.newCachedThreadPool(); this.scheduledService = Executors.newScheduledThreadPool(1); this.environment = new HashMap<String, String>(); <START> setWorkingDirectory(System.getProperty("user.dir")); <END> }</code><technical_language>Well, "user.dir" is set platforms. null, in ProcessBuilder</technical_language>

Target:
public ProcessExecutorImpl() { this.shutdownThreads = new ShutDownThreadHolder(); this.service = Executors.newCachedThreadPool(); this.scheduledService = Executors.newScheduledThreadPool(1); this.environment = new HashMap<String, String>(); }
Source:
<code>public void deleteNonExisting() throws Exception { context.turnOffAuthorisationSystem(); MetadataField metadataField = MetadataFieldBuilder.createMetadataField(context, ELEMENT, QUALIFIER, SCOPE_NOTE) <START> .build(); <END> Integer id = metadataField.getID(); getClient(getAuthToken(admin.getEmail(), password)) .perform(delete("/api/core/metadatafields/" + id)) .andExpect(status().isNoContent()); assertThat(metadataFieldService.find(context, id), nullValue()); getClient(getAuthToken(admin.getEmail(), password)) .perform(delete("/api/core/metadatafields/" + id)) .andExpect(status().isNotFound()); }</code><technical_language>turn auth system creating test data</technical_language>

Target:
public void deleteNonExisting() throws Exception { context.turnOffAuthorisationSystem(); MetadataField metadataField = MetadataFieldBuilder.createMetadataField(context, ELEMENT, QUALIFIER, SCOPE_NOTE) .build(); context.restoreAuthSystemState(); Integer id = metadataField.getID(); getClient(getAuthToken(admin.getEmail(), password)) .perform(delete("/api/core/metadatafields/" + id)) .andExpect(status().isNoContent()); assertThat(metadataFieldService.find(context, id), nullValue()); getClient(getAuthToken(admin.getEmail(), password)) .perform(delete("/api/core/metadatafields/" + id)) .andExpect(status().isNotFound()); }
Source:
<code>protected void compute(CoreSession session, List<String> ids, Map<String, Serializable> properties) { DocumentModelList docs = loadDocuments(session, ids); for (DocumentModel doc : docs) { ThumbnailAdapter thumbnail = doc.getAdapter(ThumbnailAdapter.class); Blob thumbnailBlob = thumbnail.computeThumbnail(session); doc.setPropertyValue(THUMBNAIL_PROPERTY_NAME, (Serializable) thumbnailBlob); <START> thumbnail.save(session); <END> } }</code><technical_language>I code UpdateThumbnailListener#processDoc method</technical_language>

Target:
protected void compute(CoreSession session, List<String> ids, Map<String, Serializable> properties) { DocumentModelList docs = loadDocuments(session, ids); for (DocumentModel doc : docs) { processDoc(session, doc); } }
Source:
<code>public int compareTo(BodyPartRotationalData o) { <START> return 0; <END> }</code><technical_language>Need implement comparable. is comparable. Granted comparison rely map keys keys, comparing key</technical_language>

Target:
public int compareTo(BodyPartRotationalData o) { int mapSizeComp = Integer.compare(this.rotations.size(), o.partRotation().size()); if (mapSizeComp != 0) { return mapSizeComp; } ComparisonChain comparison = ComparisonChain.start(); Map<BodyPart, Vector3d> parts = o.partRotation().get(); parts.forEach((part, vec) -> { comparison.compare(vec, this.rotations.get(part)); }); return comparison.result(); }
Source:
<code>private List<String> getMergedDimensions(List<IndexableAdapter> indexes) { if (indexes.size() == 0) { return new ArrayList<>(); } <START> List<String> dimOrder = Lists.newArrayList(indexes.get(0).getDimensionNames().iterator()); <END> for (IndexableAdapter index : indexes) { List<String> dimOrder2 = Lists.newArrayList(index.getDimensionNames().iterator()); if(!dimOrder.equals(dimOrder2)) { return getLexicographicMergedDimensions(indexes); } } return dimOrder; }</code><technical_language>need .iterator(). Also, ImmutableList.copyOf instead, immutable lists cool</technical_language>

Target:
private List<String> getMergedDimensions(List<IndexableAdapter> indexes) { if (indexes.size() == 0) { return ImmutableList.of(); } Indexed<String> dimOrder = indexes.get(0).getDimensionNames(); for (IndexableAdapter index : indexes) { Indexed<String> dimOrder2 = index.getDimensionNames(); if(!Iterators.elementsEqual(dimOrder.iterator(), dimOrder2.iterator())) { return getLexicographicMergedDimensions(indexes); } } return ImmutableList.copyOf(dimOrder); }
Source:
<code>public static Time convertToTime(java.util.Date date) { if (date == null) { <START> throw new IllegalArgumentException(MESSAGE_ARGUMENT_NULL_ERROR); <END> } Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(Calendar.YEAR, DEFAULT_YEAR); cal.set(Calendar.MONTH, 0); cal.set(Calendar.DAY_OF_MONTH, 1); Time time = new Time(cal.getTimeInMillis()); return time; }</code><technical_language>Making this message a constant readable, is essentially meaningless. a good idea undo fix standardize argument checking</technical_language>

Target:
public static Time convertToTime(java.util.Date date) { assertArgs(date); Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(Calendar.YEAR, DEFAULT_YEAR); cal.set(Calendar.MONTH, 0); cal.set(Calendar.DAY_OF_MONTH, 1); Time time = new Time(cal.getTimeInMillis()); return time; }
Source:
<code>private String getContextId(final Configuration contextConf) { try { final Injector injector = Tang.Factory.getTang().newInjector(contextConf); return injector.getNamedInstance(ContextIdentifier.class); } catch (final InjectionException e) { <START> throw new RuntimeException("Unable to inject context identifier from context conf", e); <END> } }</code><technical_language>"Unable get context's identifier configuration"</technical_language>

Target:
private String getContextId(final Configuration contextConf) { try { final Injector injector = Tang.Factory.getTang().newInjector(contextConf); return injector.getNamedInstance(ContextIdentifier.class); } catch (final InjectionException e) { throw new RuntimeException("Unable to get the context's identifier from the configuration", e); } }
Source:
<code>public SpringRemoteCacheManagerFactoryBean springCacheManager() { SpringRemoteCacheManagerFactoryBean factoryBean = new SpringRemoteCacheManagerFactoryBean(); factoryBean.setServerList(Arrays.asList(new InetSocketAddress("localhost", SERVER_PORT))); <START> factoryBean.setMarshaller(JavaSerializationMarshaller.class.getName()); <END> factoryBean.setClassWhiteList(AbstractRemoteCacheManagerFactory.SPRING_JAVA_SERIAL_WHITELIST + ",java.util.*"); return factoryBean; }</code><technical_language>this necessary this point, I wrong</technical_language>

Target:
public SpringRemoteCacheManagerFactoryBean springCacheManager() { SpringRemoteCacheManagerFactoryBean factoryBean = new SpringRemoteCacheManagerFactoryBean(); factoryBean.setServerList(Arrays.asList(new InetSocketAddress("localhost", SERVER_PORT))); factoryBean.setClassWhiteList(AbstractRemoteCacheManagerFactory.SPRING_JAVA_SERIAL_WHITELIST + ",java.util.*"); return factoryBean; }