auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { val cg = ModelSerializer.restoreComputationGraph(ois, true); this.defaultConfiguration = cg.defaultConfiguration; this.configuration = cg.configuration; <START> this.flattenedParams = cg.flattenedParams; <END> this.initCalled = cg.initCalled; this.initDone = cg.initDone; if (cg.getUpdater() != null) this.setUpdater(cg.getUpdater()); }</code><technical_language>wondering if this is want... concern I is array is unrelated layers' param tables (which views of this). I want of: (a) this.flattenedParams.assign(flattenedParams) - if exists (I this point) (b) init() call initialize layers param tables</technical_language>

Target:
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { val cg = ModelSerializer.restoreComputationGraph(ois, true); this.defaultConfiguration = cg.defaultConfiguration.clone(); this.configuration = cg.configuration.clone(); this.init(); this.flattenedParams.assign(cg.flattenedParams); if (cg.getUpdater() != null && cg.getUpdater(false).getStateViewArray() != null) this.getUpdater(true).getStateViewArray().assign(cg.getUpdater(false).getStateViewArray()); }
Source:
<code>public int getValue() { <START> return this.ordinal(); <END> }</code><technical_language>VmStatus.java - a pitfall enums. i.e getValue of Success == 1 of ordinal is is zero based order of members. if remove AdminShutdown, UserShutdown getVAlue == 6 meant return reason variable. enum is a great java utility. members final. values() is final alreay need cache get a forValue mapping need create a mapping reason enum member</technical_language>

Target:
public int getValue() { return reason; }
Source:
<code>private static String getParentPidOfPid(String pid) { <START> final String command = String.format("ps -ajx | awk '$2 == \"%s\"' | awk '{print $3}'", pid); <END> return executeCommandUnix(command); }</code><technical_language>ps command recognize j a x flags aix solaris</technical_language>

Target:
public static String getParentPidOfPid(String pid) { final String command = String.format("ps -ef | awk '$2 == \"%s\"' | awk '{print $3}'", pid); return executeCommandUnix(command); }
Source:
<code>public boolean equals(Object o) { if (o instanceof MultipleInstanceCompletionCondition) { MultipleInstanceCompletionCondition other = (MultipleInstanceCompletionCondition) o; <START> return (null != value) ? value.equals(other.value) : null == other.value; <END> } return false; }</code><technical_language>Objects.equals</technical_language>

Target:
public boolean equals(Object o) { if (o instanceof MultipleInstanceCompletionCondition) { MultipleInstanceCompletionCondition other = (MultipleInstanceCompletionCondition) o; return Objects.equals(value, other.value); } return false; }
Source:
<code>public void destroy() { queryExecutor.shutdown(); try { queryExecutor.awaitTermination(2L, TimeUnit.MINUTES); } catch (InterruptedException e) { <START> Thread.currentThread().interrupt(); <END> throw new IllegalStateException(QUERY_POOL_NAME + " graceful shutdown interrupted.", e); } }</code><technical_language>is another case want compute end time await for time left propagate interruptions of while loop in a finally clause</technical_language>

Target:
public void destroy() { queryExecutor.shutdown(); try { queryExecutor.awaitTermination(2L, TimeUnit.MINUTES); } catch (InterruptedException e) { throw new IllegalStateException(QUERY_POOL_NAME + " graceful shutdown interrupted.", e); } }
Source:
<code>protected boolean validate() { initVmTemplate(); if (!super.validate()) { return false; } if (!validateExternalVnicProfileMapping()) { return false; } drMappingHelper.mapVnicProfiles(vmTemplateFromConfiguration.getInterfaces(), getParameters().getExternalVnicProfileMappings()); ArrayList<DiskImage> disks = new ArrayList(getVmTemplate().getDiskTemplateMap().values()); setImagesWithStoragePoolId(getStorageDomain().getStoragePoolId(), disks); getVmTemplate().setImages(disks); if (getParameters().isImagesExistOnTargetStorageDomain() && !validateUnregisteredEntity(vmTemplateFromConfiguration, ovfEntityData)) { return false; } missingUsers = getImportValidator().findMissingUsers(getParameters().getDbUsers()); if (!missingUsers.isEmpty() && !getParameters().isAllowPartialImport()) { <START> log.error("Missing users: {}", missingUsers.stream().collect(Collectors.joining(","))); <END> return failValidation(EngineMessage.USER_MUST_EXIST_IN_DB); } missingRoles = getImportValidator().findMissingRoles(getParameters().getRoleMap()); if (!missingRoles.isEmpty() && !getParameters().isAllowPartialImport()) { log.error("Missing roles: {}", missingRoles.stream().collect(Collectors.joining(", "))); return failValidation(EngineMessage.VALIDATION_ROLE_DOES_NOT_EXIST); } return super.validate(); }</code><technical_language>error log part of findMissingRoles add a log indicating map users of entity</technical_language>

Target:
protected boolean validate() { initVmTemplate(); if (!super.validate()) { return false; } if (!validateExternalVnicProfileMapping()) { return false; } drMappingHelper.mapVnicProfiles(vmTemplateFromConfiguration.getInterfaces(), getParameters().getExternalVnicProfileMappings()); ArrayList<DiskImage> disks = new ArrayList(getVmTemplate().getDiskTemplateMap().values()); setImagesWithStoragePoolId(getStorageDomain().getStoragePoolId(), disks); getVmTemplate().setImages(disks); if (getParameters().isImagesExistOnTargetStorageDomain() && !validateUnregisteredEntity(vmTemplateFromConfiguration, ovfEntityData)) { return false; } log.info("Checking for missing users"); List<DbUser> missingUsers = getImportValidator().findMissingUsers(getParameters().getDbUsers()); getParameters().getDbUsers().removeAll(missingUsers); Set<String> roles = getParameters().getRoleMap().values() .stream() .collect(Collectors.toSet()); roles.addAll(getParameters().getRoleMap().keySet()); log.info("Checking for missing roles"); missingRoles = getImportValidator().findMissingEntities(roles, val -> roleDao.getByName(val)); getParameters().getUserToRoles().forEach((k, v) -> v.removeAll(missingRoles)); return super.validate(); }
Source:
<code>public void setStatus(ChargeStatus targetStatus, Event event) { if (isValidTransition(fromString(this.status), targetStatus, event)) { <START> var logMessage = format("Changing charge status for externalId [%s] [%s]->[%s] [event=%s]", <END> this.externalId, this.status, targetStatus.getValue(), event); logger.info(logMessage, getStructuredKeys()); this.status = targetStatus.getValue(); } else { var logMessage = format("Charge with state %s cannot proceed to %s [charge_external_id=%s, charge_status=%s, event=%s]", this.status, targetStatus, this.externalId, targetStatus, event); logger.warn(logMessage, getStructuredKeys()); throw new InvalidStateTransitionException(this.status, targetStatus.getValue(), event); } }</code><technical_language>do need log externalid in message if in a structured key</technical_language>

Target:
public void setStatus(ChargeStatus targetStatus, Event event) { if (isValidTransition(fromString(this.status), targetStatus, event)) { var logMessage = format("Changing charge status for externalId [%s] [%s]->[%s] [event=%s]", this.externalId, this.status, targetStatus.getValue(), event); logger.info(logMessage, getStructuredLoggingArgs()); this.status = targetStatus.getValue(); } else { var logMessage = format("Charge with state %s cannot proceed to %s [charge_external_id=%s, charge_status=%s, event=%s]", this.status, targetStatus, this.externalId, targetStatus, event); logger.warn(logMessage, getStructuredLoggingArgs()); throw new InvalidStateTransitionException(this.status, targetStatus.getValue(), event); } }
Source:
<code><START> private static List<Shard> discoverShards(String regionName, String streamName, String accessKey, String secretKey, <END> String appName) { Region region = RegionUtils.getRegion(regionName); if (region == null) { throw new IllegalArgumentException(regionName + " is not a valid AWS region."); } final AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); AmazonKinesis kinesisClient = new AmazonKinesisClient(credentials, getClientConfigWithUserAgent(appName)); kinesisClient.setRegion(region); try { DescribeStreamResult result = kinesisClient.describeStream(streamName); if (!"ACTIVE".equals(result.getStreamDescription().getStreamStatus())) { throw new IllegalArgumentException("Kinesis stream " + streamName + " is not active."); } return result.getStreamDescription().getShards(); } catch (ResourceNotFoundException e) { throw new IllegalArgumentException("Kinesis stream " + streamName + " does not exist."); } catch (Exception e) { throw new IllegalArgumentException("Error found while describing the kinesis stream " + streamName); } }</code><technical_language>is static private both</technical_language>

Target:
public static List<Shard> discoverShards(String regionName, String streamName, String accessKey, String secretKey, String appName) { Region region = RegionUtils.getRegion(regionName); if (region == null) { throw new IllegalArgumentException(regionName + " is not a valid AWS region."); } final AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); AmazonKinesis kinesisClient = new AmazonKinesisClient(credentials, getClientConfigWithUserAgent(appName)); kinesisClient.setRegion(region); try { DescribeStreamResult result = kinesisClient.describeStream(streamName); if (!"ACTIVE".equals(result.getStreamDescription().getStreamStatus())) { throw new IllegalArgumentException("Kinesis stream " + streamName + " is not active."); } return result.getStreamDescription().getShards(); } catch (ResourceNotFoundException e) { throw new IllegalArgumentException("Kinesis stream " + streamName + " does not exist."); } catch (Exception e) { throw new IllegalArgumentException("Error found while describing the kinesis stream " + streamName); } }
Source:
<code>public void stop() { <START> if (entity.getAttribute(RiakNode.RIAK_NODE_IN_CLUSTER)) <END> leaveCluster(); String command = format("%s stop", getRiakCmd()); command = isPackageInstall ? "sudo " + command : command; ScriptHelper stopScript = newScript(STOPPING) .failOnNonZeroResultCode() .body.append(command); if (!isRiakOnPath) { Map<String, String> newPathVariable = ImmutableMap.of("PATH", sbinPath); log.warn("riak command not found on PATH. Altering future commands' environment variables from to {}", getShellEnvironment(), newPathVariable); stopScript.environmentVariablesReset(newPathVariable); } stopScript.execute(); }</code><technical_language>if (isInCluster()) add braces</technical_language>

Target:
public void stop() { leaveCluster(); String command = format("%s stop", getRiakCmd()); command = isPackageInstall ? "sudo " + command : command; ScriptHelper stopScript = newScript(ImmutableMap.of(USE_PID_FILE, false), STOPPING) .body.append(command); if (!isRiakOnPath) { Map<String, String> newPathVariable = ImmutableMap.of("PATH", sbinPath); log.warn("riak command not found on PATH. Altering future commands' environment variables from to {}", getShellEnvironment(), newPathVariable); stopScript.environmentVariablesReset(newPathVariable); } int result = stopScript.execute(); if (result != 0) { newScript(ImmutableMap.of(USE_PID_FILE, ""), STOPPING).execute(); } }
Source:
<code>public boolean equals(Object obj) { if (obj != null && obj instanceof CachedSensorValue) { <START> return this.toString().equals(obj.toString()); <END> } return false; }</code><technical_language>Instead of comparing types toString() sense Eclipse IDE generate hashCode() equals() methods</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof CachedSensorValue)) { return false; } CachedSensorValue other = (CachedSensorValue) obj; if (sensorType != other.sensorType) { return false; } if (sensorValue == null) { if (other.sensorValue != null) { return false; } } else if (!sensorValue.equals(other.sensorValue)) { return false; } if (timestamp == null) { if (other.timestamp != null) { return false; } } else if (!timestamp.equals(other.timestamp)) { return false; } return true; }
Source:
<code>default Spliterator<T> spliterator() { return Spliterators.spliterator(iterator(), isEmpty() ? 0 : 1, <START> Spliterator.IMMUTABLE | Spliterator.DISTINCT | Spliterator.SIZED | Spliterator.SUBSIZED); <END> }</code><technical_language>I ask if SUBSIZED omitted is element in a single-valued type. splitted anymore. wait... Java 9 added Optional.stream(). I ask jshell: java jshell> Optional.of(1).stream().spliterator().characteristics() & Spliterator.SUBSIZED $3 ==> 16384 Ok, need SUBSIZED :)</technical_language>

Target:
default Spliterator<T> spliterator() { return Spliterators.spliterator(iterator(), isEmpty() ? 0 : 1, Spliterator.IMMUTABLE | Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED); }
Source:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.guide_main); mPager = (ViewPager) findViewById(R.id.guide_pager); <START> mPager.setSaveEnabled(false); <END> mIndicator = (TitlePageIndicator) findViewById(R.id.guide_step_title_indicator); if (savedInstanceState != null) { mGuideid = savedInstanceState.getInt(GUIDEID); mFavoriting = savedInstanceState.getBoolean(FAVORITING); mIsOfflineGuide = savedInstanceState.getBoolean(IS_OFFLINE_GUIDE); if (savedInstanceState.containsKey(SAVED_GUIDE)) { mGuide = (Guide) savedInstanceState.getSerializable(SAVED_GUIDE); } if (mGuide != null) { mCurrentPage = savedInstanceState.getInt(CURRENT_PAGE); setGuide(mGuide, mCurrentPage); mIndicator.setCurrentItem(mCurrentPage); mPager.setCurrentItem(mCurrentPage); } } else { extractExtras(getIntent().getExtras()); } if (mGuide != null) { setGuide(mGuide, mCurrentPage); } else { fetchGuideFromApi(mGuideid); } }</code><technical_language>I a fix for this here: e6cf92d16471d728087bdabe803a389ba991080d</technical_language>

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.guide_main); mPager = (ViewPager) findViewById(R.id.guide_pager); mIndicator = (TitlePageIndicator) findViewById(R.id.guide_step_title_indicator); if (savedInstanceState != null) { mGuideid = savedInstanceState.getInt(GUIDEID); mFavoriting = savedInstanceState.getBoolean(FAVORITING); mIsOfflineGuide = savedInstanceState.getBoolean(IS_OFFLINE_GUIDE); if (savedInstanceState.containsKey(SAVED_GUIDE)) { mGuide = (Guide) savedInstanceState.getSerializable(SAVED_GUIDE); } if (mGuide != null) { mCurrentPage = savedInstanceState.getInt(CURRENT_PAGE); setGuide(mGuide, mCurrentPage); mIndicator.setCurrentItem(mCurrentPage); mPager.setCurrentItem(mCurrentPage); } } else { extractExtras(getIntent().getExtras()); } if (mGuide != null) { setGuide(mGuide, mCurrentPage); } else { fetchGuideFromApi(mGuideid); } }
Source:
<code>public void process() { PerformanceMonitor.startActivity("rendering/prePostComposite"); prePostComposite.enable(); sceneReflectiveRefractive = dynamicFBOsManager.get(REFLECTIVE_REFRACTIVE_URN); WRITE_ONLY_GBUFFER.bind(); setViewportToSizeOf(WRITE_ONLY_GBUFFER); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderFullscreenQuad(); bindDisplay(); setViewportToSizeOf(READ_ONLY_GBUFFER); dynamicFBOsManager.swapReadWriteBuffers(); <START> READ_ONLY_GBUFFER.attachDepthBufferTo(sceneReflectiveRefractive); <END> PerformanceMonitor.endActivity(); }</code><technical_language>move this line swap change WRITE_ONLY_GBUFFER, clearer data in written in sceneReflectiveRefractive FBO</technical_language>

Target:
public void process() { PerformanceMonitor.startActivity("rendering/prePostComposite"); prePostComposite.enable(); sceneReflectiveRefractive = displayResolutionDependentFBOs.get(REFLECTIVE_REFRACTIVE); WRITE_ONLY_GBUFFER.bind(); setViewportToSizeOf(WRITE_ONLY_GBUFFER); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderFullscreenQuad(); bindDisplay(); setViewportToSizeOf(READ_ONLY_GBUFFER); displayResolutionDependentFBOs.swapReadWriteBuffers(); READ_ONLY_GBUFFER.attachDepthBufferTo(sceneReflectiveRefractive); PerformanceMonitor.endActivity(); }
Source:
<code>public void generate(ProcessResult processResult) throws IOException { <START> new ApiCodeGenerator(filer, messager).writeApiClasses(processResult.apiClassesToGenerate, processResult.originatingElementsByGeneratedClassQualifiedName); <END> SourceCodewriter sourceCodeWriter = new SourceCodewriter(filer, messager, processResult.originatingElementsByGeneratedClassQualifiedName); PrologCodeWriter prologCodeWriter = new PrologCodeWriter(sourceCodeWriter, "DO NOT EDIT THIS FILE, IT HAS BEEN GENERATED USING AndroidAnnotations.\n"); processResult.codeModel.build(prologCodeWriter, new ResourceCodeWriter(filer)); }</code><technical_language>Local variables please</technical_language>

Target:
public void generate(ProcessResult processResult) throws IOException { ApiCodeGenerator apiCodeGenerator = new ApiCodeGenerator(filer); apiCodeGenerator.writeApiClasses(processResult.apiClassesToGenerate, processResult.originatingElements); SourceCodewriter sourceCodeWriter = new SourceCodewriter(filer, messager, processResult.originatingElements); PrologCodeWriter prologCodeWriter = new PrologCodeWriter(sourceCodeWriter, "DO NOT EDIT THIS FILE, IT HAS BEEN GENERATED USING AndroidAnnotations.\n"); processResult.codeModel.build(prologCodeWriter, new ResourceCodeWriter(filer)); }
Source:
<code>private List<String> getVmsWithAttachedISO() { <START> List<VmStatic> vms = getVmStaticDAO().getAllByStoragePoolId(getStorageDomain().getStoragePoolId()); <END> List<String> vmNames = new ArrayList<>(); for (VmStatic vmStatic : vms) { if (isVMHasAttachedISO(vmStatic.getId())) { vmNames.add(vmStatic.getName()); } } return vmNames; }</code><technical_language>if of vms down? i care deactivate iso domain? making this change please merge query line 132</technical_language>

Target:
private List<String> getVmsWithAttachedISO() { List<VmStatic> vms = getVmStaticDAO().getAllByStoragePoolId(getStorageDomain().getStoragePoolId()); List<String> vmNames = new LinkedList<>(); for (VmStatic vmStatic : vms) { if (VmDeviceUtils.isVMHasAttachedISO(vmStatic.getId())) { vmNames.add(vmStatic.getName()); } } return vmNames; }
Source:
<code>public OzoneOutputStream createKey( String volumeName, String bucketName, String keyName, long size, ReplicationType type, ReplicationFactor factor, Map<String, String> metadata) throws IOException { HddsClientUtils.verifyResourceName(volumeName, bucketName); HddsClientUtils.checkNotNull(keyName, type, factor); String requestId = UUID.randomUUID().toString(); <START> <END> try{ GDPRSymmetricKey gKey = new GDPRSymmetricKey(); metadata.putAll(gKey.getKeyDetails()); }catch (Exception e) { throw new IOException(e); } OmKeyArgs keyArgs = new OmKeyArgs.Builder() .setVolumeName(volumeName) .setBucketName(bucketName) .setKeyName(keyName) .setDataSize(size) .setType(HddsProtos.ReplicationType.valueOf(type.toString())) .setFactor(HddsProtos.ReplicationFactor.valueOf(factor.getValue())) .addAllMetadata(metadata) .setAcls(getAclList()) .build(); OpenKeySession openKey = ozoneManagerClient.openKey(keyArgs); return createOutputStream(openKey, requestId, type, factor); }</code><technical_language>do this if if Bucket is gdprEnabled? this time</technical_language>

Target:
public OzoneOutputStream createKey( String volumeName, String bucketName, String keyName, long size, ReplicationType type, ReplicationFactor factor, Map<String, String> metadata) throws IOException { HddsClientUtils.verifyResourceName(volumeName, bucketName); HddsClientUtils.checkNotNull(keyName, type, factor); String requestId = UUID.randomUUID().toString(); if(Boolean.valueOf(metadata.get(OzoneConsts.GDPR_FLAG))){ try{ GDPRSymmetricKey gKey = new GDPRSymmetricKey(); metadata.putAll(gKey.getKeyDetails()); }catch (Exception e) { if(e instanceof InvalidKeyException && e.getMessage().contains("Illegal key size or default parameters")) { LOG.error("Missing Unlimited Strength Policy jars. Please install " + "Java Cryptography Extension (JCE) Unlimited Strength " + "Jurisdiction Policy Files"); } throw new IOException(e); } } OmKeyArgs keyArgs = new OmKeyArgs.Builder() .setVolumeName(volumeName) .setBucketName(bucketName) .setKeyName(keyName) .setDataSize(size) .setType(HddsProtos.ReplicationType.valueOf(type.toString())) .setFactor(HddsProtos.ReplicationFactor.valueOf(factor.getValue())) .addAllMetadata(metadata) .setAcls(getAclList()) .build(); OpenKeySession openKey = ozoneManagerClient.openKey(keyArgs); return createOutputStream(openKey, requestId, type, factor); }
Source:
<code>private void validateParameters() throws Failure { if (projectName.endsWith(".git")) { projectName = projectName.substring(0, projectName.length() - ".git".length()); } <START> if (!isAnyIncludedIn(currentUser.getEffectiveGroups(), projectCreatorGroups)){ <END> throw new Failure(1, "You are not a member of any required group for creating projects."); } if (ownerIds != null && !ownerIds.isEmpty()){ ownerIds = new ArrayList<AccountGroup.Id>(new HashSet<AccountGroup.Id>(ownerIds)); }else{ ownerIds = new ArrayList<AccountGroup.Id>(projectOwnerGroups); } while (branch.startsWith("/")) { branch = branch.substring(1); } if (!branch.startsWith(Constants.R_HEADS)) { branch = Constants.R_HEADS + branch; } if (!Repository.isValidRefName(branch)) { throw new Failure(1, "--branch \"" + branch + "\" is not a valid name"); } }</code><technical_language>Style-nit: Space {</technical_language>

Target:
private void validateParameters() throws Failure { if (projectName.endsWith(".git")) { projectName = projectName.substring(0, projectName.length() - ".git".length()); } if (!isAnyIncludedIn(currentUser.getEffectiveGroups(), projectCreatorGroups)) { throw new Failure(1, "fatal: Not permitted to create " + projectName); } if (ownerIds != null && !ownerIds.isEmpty()) { ownerIds = new ArrayList<AccountGroup.Id>(new HashSet<AccountGroup.Id>(ownerIds)); } else { ownerIds = new ArrayList<AccountGroup.Id>(projectOwnerGroups); } while (branch.startsWith("/")) { branch = branch.substring(1); } if (!branch.startsWith(Constants.R_HEADS)) { branch = Constants.R_HEADS + branch; } if (!Repository.isValidRefName(branch)) { throw new Failure(1, "--branch \"" + branch + "\" is not a valid name"); } }
Source:
<code>public String getText(Object obj, Long key, String cachedValue) { String result = ""; if (!loading) { if (obj instanceof Artifact && getXViewer() instanceof WorldXViewer) { WorldXViewer worldXViewer = (WorldXViewer) <START> getXViewer(); <END> GoalArtifact parentMembersArtifact = (GoalArtifact) getParentMembersArtifact(worldXViewer); if (parentMembersArtifact != null) { if (Strings.isValid(cachedValue)) { result = cachedValue; } } else { String cachedObjectValue = multiGoalValueMap.get(((Artifact) obj).getUuid()); if (Strings.isValid(cachedObjectValue)) { result = cachedObjectValue; } } } } return result; }</code><technical_language>Assign getXViewer a variable if gonna more once</technical_language>

Target:
public String getText(Object obj, Long key, String cachedValue) { String result = ""; if (!loading) { XViewer xViewer = getXViewer(); if (obj instanceof Artifact && xViewer instanceof WorldXViewer) { WorldXViewer worldXViewer = (WorldXViewer) xViewer; GoalArtifact parentMembersArtifact = (GoalArtifact) getParentMembersArtifact(worldXViewer); if (parentMembersArtifact != null) { if (Strings.isValid(cachedValue)) { result = cachedValue; } } else { String cachedObjectValue = multiGoalValueMap.get(((Artifact) obj).getUuid()); if (Strings.isValid(cachedObjectValue)) { result = cachedObjectValue; } } } } return result; }
Source:
<code>static GlobalDataExchangeMode getShuffleModeAsGlobalDataExchangeMode(final Configuration configuration) { final String value = configuration.getString(ExecutionConfigOptions.TABLE_EXEC_SHUFFLE_MODE); try { return GlobalDataExchangeMode.valueOf(convertLegacyShuffleMode(value).toUpperCase()); <START> } catch (Exception e) { <END> throw new IllegalArgumentException( String.format("Unsupported value %s for config %s.", value, ExecutionConfigOptions.TABLE_EXEC_SHUFFLE_MODE.key())); } }</code><technical_language>catch specific exception</technical_language>

Target:
static GlobalDataExchangeMode getShuffleModeAsGlobalDataExchangeMode(final Configuration configuration) { final String value = configuration.getString(ExecutionConfigOptions.TABLE_EXEC_SHUFFLE_MODE); try { return GlobalDataExchangeMode.valueOf(convertLegacyShuffleMode(value).toUpperCase()); } catch (IllegalArgumentException e) { throw new IllegalArgumentException( String.format("Unsupported value %s for config %s.", value, ExecutionConfigOptions.TABLE_EXEC_SHUFFLE_MODE.key())); } }
Source:
<code>public TreeMultimap<Integer, TSnePoint> getTsnePlotWithClustersAndExpression(String experimentAccession, int k, String geneId) { <START> TreeMultimap<Integer, TSnePoint> clusters = this.getTSnePlotWithClusters(experimentAccession, k); <END> Map<String, Double> expression = geneExpressionDao.fetchGeneExpression(experimentAccession, geneId); TreeMultimap<Integer, TSnePoint> clusterPointsWithExpression = TreeMultimap.create(); clusters.entries().forEach( entry -> clusterPointsWithExpression.put( entry.getKey(), TSnePoint.create( entry.getValue().x(), entry.getValue().y(), expression.get(entry.getValue().name()), entry.getValue().name() ) ) ); return clusterPointsWithExpression; }</code><technical_language>purpose of this.</technical_language>

Target:
public TreeMultimap<Integer, TSnePoint> getTsnePlotWithClustersAndExpression(String experimentAccession, int k, String geneId) { TreeMultimap<Integer, TSnePoint> clusters = getTSnePlotWithClusters(experimentAccession, k); Map<String, Double> expression = geneExpressionDao.fetchGeneExpression(experimentAccession, geneId); TreeMultimap<Integer, TSnePoint> clusterPointsWithExpression = TreeMultimap.create(Comparator.<Integer> naturalOrder(), TSnePoint.getNameComparator()); clusters.entries().forEach( entry -> clusterPointsWithExpression.put( entry.getKey(), TSnePoint.create( entry.getValue().x(), entry.getValue().y(), expression.get(entry.getValue().name()), entry.getValue().name() ) ) ); return clusterPointsWithExpression; }
Source:
<code>public static void writeDouble(double value, ByteBuffer buffer) { <START> buffer.putLong(Double.doubleToRawLongBits(value)); <END> }</code><technical_language>So, ByteBuffer does. concerned change implementation? basically breaking everyone, right? java private ByteBuffer putDouble(long a, double x) { try { long y = Double.doubleToRawLongBits(x); UNSAFE.putLongUnaligned(null, a, y, bigEndian); } finally { Reference.reachabilityFence(this); } return this; }</technical_language>

Target:
public static void writeDouble(double value, ByteBuffer buffer) { buffer.putDouble(value); }
Source:
<code>static void registerOperations(ManagementResourceRegistration registry, ResourceDescriptionResolver resourceDescriptionResolver) { <START> registry.registerOperationHandler(new SimpleOperationDefinitionBuilder(MIGRATE, resourceDescriptionResolver) <END> .setRuntimeOnly() .setAccessConstraints(SensitiveTargetAccessConstraintDefinition.READ_WHOLE_CONFIG) .build(), WebMigrateOperation.MIGRATE_INSTANCE); registry.registerOperationHandler(new SimpleOperationDefinitionBuilder(DESCRIBE_MIGRATION, resourceDescriptionResolver) .setReplyType(ModelType.LIST).setReplyValueType(ModelType.OBJECT) .setRuntimeOnly() .setAccessConstraints(SensitiveTargetAccessConstraintDefinition.READ_WHOLE_CONFIG) .build(), WebMigrateOperation.DESCRIBE_MIGRATION_INSTANCE); }</code><technical_language>definition is missing reply type (something a generic .setReplyType(ModelType.PROPERTY).setReplyValueType(ModelType.OBJECT))</technical_language>

Target:
static void registerOperations(ManagementResourceRegistration registry, ResourceDescriptionResolver resourceDescriptionResolver) { registry.registerOperationHandler(new SimpleOperationDefinitionBuilder(MIGRATE, resourceDescriptionResolver) .setRuntimeOnly() .setAccessConstraints(SensitiveTargetAccessConstraintDefinition.READ_WHOLE_CONFIG) .setReplyParameters(MIGRATION_WARNINGS_ATTR, MIGRATION_ERROR_ATTR) .build(), WebMigrateOperation.MIGRATE_INSTANCE); registry.registerOperationHandler(new SimpleOperationDefinitionBuilder(DESCRIBE_MIGRATION, resourceDescriptionResolver) .setRuntimeOnly() .setAccessConstraints(SensitiveTargetAccessConstraintDefinition.READ_WHOLE_CONFIG) .setReplyParameters(MIGRATION_WARNINGS_ATTR) .build(), WebMigrateOperation.DESCRIBE_MIGRATION_INSTANCE); }
Source:
<code>public void threadGroupNotLeaked() throws Throwable { Set<ThreadGroup> groupsBeforeSet = new HashSet<ThreadGroup>(); ThreadGroup[] groupsBefore = new ThreadGroup[256]; for (int i = 0; i < currentThread().getThreadGroup().enumerate(groupsBefore); ++i) { groupsBeforeSet.add(groupsBefore[i]); } evaluateWithWaitDuration(0); ThreadGroup[] groups = new ThreadGroup[256]; for (int i = 0; i < currentThread().getThreadGroup().enumerate(groups); ++i) { if(!groupsBeforeSet.contains(groups[i]) && "FailOnTimeoutGroup".equals(groups[i].getName())) { fail("A 'FailOnTimeoutGroup' thread group remains referenced after the test execution."); } } <START> } <END></code><technical_language>readability of test improved extracting a method subGroupsOfCurrentThread @Test public void threadGroupNotLeaked() throws Throwable { Collection<ThreadGroup> groupsBeforeSet = subGroupsOfCurrentThread(); evaluateWithWaitDuration(0); for (ThreadGroup group: subGroupsOfCurrentThread()) { if(!groupsBeforeSet.contains(group) && "FailOnTimeoutGroup".equals(group.getName())) { fail("A 'FailOnTimeoutGroup' thread group remains referenced test execution."); } } } private Collection<ThreadGroup> subGroupsOfCurrentThread() { ThreadGroup[] subGroups = new ThreadGroup[256]; int numGroups = currentThread().getThreadGroup().enumerate(subGroups); return asList(subGroups).subList(0, numGroups); }</technical_language>

Target:
public void threadGroupNotLeaked() throws Throwable { Collection<ThreadGroup> groupsBeforeSet = subGroupsOfCurrentThread(); evaluateWithWaitDuration(0); for (ThreadGroup group: subGroupsOfCurrentThread()) { if (!groupsBeforeSet.contains(group) && "FailOnTimeoutGroup".equals(group.getName())) { fail("A 'FailOnTimeoutGroup' thread group remains referenced after the test execution."); } } }
Source:
<code><START> private static Pair<RowSignature, Long> analysisToRowSignature(final SegmentAnalysis analysis) <END> { final RowSignature.Builder rowSignatureBuilder = RowSignature.builder(); for (Map.Entry<String, ColumnAnalysis> entry : analysis.getColumns().entrySet()) { if (entry.getValue().isError()) { continue; } ValueType valueType; try { valueType = ValueType.valueOf(StringUtils.toUpperCase(entry.getValue().getType())); } catch (IllegalArgumentException e) { valueType = ValueType.COMPLEX; } rowSignatureBuilder.add(entry.getKey(), valueType); } return Pair.of(rowSignatureBuilder.build(), analysis.getNumRows()); }</code><technical_language>this return pair? analysis.getNumRows() in caller well</technical_language>

Target:
private static RowSignature analysisToRowSignature(final SegmentAnalysis analysis) { final RowSignature.Builder rowSignatureBuilder = RowSignature.builder(); for (Map.Entry<String, ColumnAnalysis> entry : analysis.getColumns().entrySet()) { if (entry.getValue().isError()) { continue; } ValueType valueType; try { valueType = ValueType.valueOf(StringUtils.toUpperCase(entry.getValue().getType())); } catch (IllegalArgumentException e) { valueType = ValueType.COMPLEX; } rowSignatureBuilder.add(entry.getKey(), valueType); } return rowSignatureBuilder.build(); }
Source:
<code>public void testParseStoreOK() throws IOException, ProtocolException, ImapAsyncClientException { final ImapResponseMapper mapper = new ImapResponseMapper(); final IMAPResponse[] content = new IMAPResponse[1]; <START> content[0] = new IMAPResponse("A042 OK STATUS success"); <END> final StoreResult storeResult = mapper.readValue(content, StoreResult.class); Assert.assertNotNull(storeResult, "store result mismatched."); Assert.assertEquals(storeResult.getIMAPResponses().size(), 1, "getIMAPResponses() mismatched."); Assert.assertTrue(storeResult.getIMAPResponses().get(0).isOK(), "getIMAPResponses() mismatched."); }</code><technical_language>OK STORE success</technical_language>

Target:
public void testParseStoreOK() throws IOException, ProtocolException, ImapAsyncClientException { final ImapResponseMapper mapper = new ImapResponseMapper(); final IMAPResponse[] content = new IMAPResponse[1]; content[0] = new IMAPResponse("A042 OK Store success"); final StoreResult storeResult = mapper.readValue(content, StoreResult.class); Assert.assertNotNull(storeResult, "store result mismatched."); Assert.assertEquals(storeResult.getFetchResponses().size(), 0, "getFetchResponses() mismatched."); }
Source:
<code>private static List<URL> extractCPFromProperty() { String classpath = System.getProperty("java.class.path"); List<URL> classpathURLs = new ArrayList<>(); <START> for (String path : classpath.split(":")) { <END> classpathURLs.add(mapToURL(path)); } return classpathURLs; }</code><technical_language>path separator, this break depending OS</technical_language>

Target:
private static List<URL> extractCPFromProperty() { List<URL> classpathURLs = new ArrayList<>(); String classpath = System.getProperty("java.class.path"); if (Objects.nonNull(classpath)) { for (String path : classpath.split(File.pathSeparator)) { classpathURLs.add(mapToURL(path)); } } return classpathURLs; }
Source:
<code>public HdfsSplitInfo decode(final byte[] bytes) { final ByteArrayInputStream bais = new ByteArrayInputStream(bytes); try (DataInputStream dais = new DataInputStream(bais)) { final String inputPath = dais.readUTF(); final String inputFormatClassName = dais.readUTF(); <START> final ExternalConstructor<JobConf> jobConfExternalConstructor = <END> new JobConfExternalConstructor(inputFormatClassName, inputPath); final FileSplit inputSplit = ReflectionUtils.newInstance(FileSplit.class, jobConfExternalConstructor.newInstance()); inputSplit.readFields(dais); return new HdfsSplitInfo(inputPath, inputSplit, inputFormatClassName); } catch (final IOException e) { throw new RuntimeException("Could not de-serialize JobConf", e); } }</code><technical_language>here: instead of calling constructor directly, Tang</technical_language>

Target:
public HdfsSplitInfo decode(final byte[] bytes) { final ByteArrayInputStream bais = new ByteArrayInputStream(bytes); try (DataInputStream dais = new DataInputStream(bais)) { final String inputPath = dais.readUTF(); final String inputFormatClassName = dais.readUTF(); final JobConf jobConf; try { final Tang tang = Tang.Factory.getTang(); jobConf = tang.newInjector( tang.newConfigurationBuilder() .bindNamedParameter(JobConfExternalConstructor.InputFormatClass.class, inputFormatClassName) .bindNamedParameter(JobConfExternalConstructor.InputPath.class, inputPath) .bindConstructor(JobConf.class, JobConfExternalConstructor.class) .build()) .getInstance(JobConf.class); } catch (final InjectionException e) { throw new RuntimeException("Exception while injecting JobConf", e); } final FileSplit inputSplit = ReflectionUtils.newInstance(FileSplit.class, jobConf); inputSplit.readFields(dais); return HdfsSplitInfo.newBuilder() .setInputPath(inputPath) .setInputSplit(inputSplit) .setInputFormatClassName(inputFormatClassName) .build(); } catch (final IOException e) { throw new RuntimeException("Could not de-serialize JobConf", e); } }
Source:
<code>public static void validateNDKVersion(File ndkHomeDir) throws MojoExecutionException { final File ndkVersionFile = new File(ndkHomeDir, "RELEASE.TXT"); if (!ndkVersionFile.exists()) { <START> throw new MojoExecutionException("Could not locate RELEASE.TXT in the Android NDK base directory '" + ndkHomeDir.getAbsolutePath() + "'. Please verify your setup"); <END> } try { String versionStr = FileUtils.readFileToString(ndkVersionFile); validateNDKVersion(NDK_REQUIRED_VERSION, versionStr); } catch (Exception e) { throw new MojoExecutionException("Error while extracting NDK version from: " + ndkVersionFile); } }</code><technical_language>I pointing / yes.. sounds a great idea</technical_language>

Target:
public static void validateNDKVersion(File ndkHomeDir) throws MojoExecutionException { final File ndkVersionFile = new File(ndkHomeDir, "RELEASE.TXT"); if (!ndkVersionFile.exists()) { throw new MojoExecutionException("Could not locate RELEASE.TXT in the Android NDK base directory '" + ndkHomeDir.getAbsolutePath() + "'. Please verify your setup! " + AndroidNdk.PROPER_NDK_HOME_DIRECTORY_MESSAGE); } try { String versionStr = FileUtils.readFileToString(ndkVersionFile); validateNDKVersion(NDK_REQUIRED_VERSION, versionStr); } catch (Exception e) { throw new MojoExecutionException("Error while extracting NDK version from '" + ndkVersionFile.getAbsolutePath() + "'. Please verify your setup! " + AndroidNdk.PROPER_NDK_HOME_DIRECTORY_MESSAGE); } }
Source:
<code>public Response subscribeForBotDetectionAlerts(BotDetectionAlertSubscriptionDTO body, MessageContext messageContext) throws APIManagementException { String email = body.getEmail(); if (StringUtils.isBlank(email)) { String propertyName = AlertMgtConstants.BOT_DETECTION_EMAIL_FIELD; throw new APIManagementException(propertyName + " property value of payload cannot be blank", ExceptionCodes.from(ExceptionCodes.BLANK_PROPERTY_VALUE, propertyName)); } try { APIAdminImpl apiAdmin = new APIAdminImpl(); BotDetectionData alertSubscription = apiAdmin.getBotDetectionAlertSubscription(AlertMgtConstants.BOT_DETECTION_EMAIL_FIELD, email); if (alertSubscription != null) { RestApiUtil.handleResourceAlreadyExistsError( "Email: " + email + " has already been subscribed for bot detection alerts", log); } apiAdmin.addBotDataEmailConfiguration(email); BotDetectionData newAlertSubscription = apiAdmin.getBotDetectionAlertSubscription(AlertMgtConstants.BOT_DETECTION_EMAIL_FIELD, email); BotDetectionAlertSubscriptionDTO alertSubscriptionDTO = BotDetectionMappingUtil.fromAlertSubscriptionToDTO(newAlertSubscription); return Response.ok(alertSubscriptionDTO).build(); <START> } catch (APIManagementException | SQLException e) { <END> String errorMessage = "Error when subscribing for bot detection alerts with email: " + email; RestApiUtil.handleInternalServerError(errorMessage, e, log); } return null; }</code><technical_language>SQLException coming upto REST API level. check is coming here</technical_language>

Target:
public Response subscribeForBotDetectionAlerts(BotDetectionAlertSubscriptionDTO body, MessageContext messageContext) throws APIManagementException { String email = body.getEmail(); if (StringUtils.isBlank(email)) { String propertyName = AlertMgtConstants.BOT_DETECTION_EMAIL_FIELD; throw new APIManagementException(propertyName + " property value of payload cannot be blank", ExceptionCodes.from(ExceptionCodes.BLANK_PROPERTY_VALUE, propertyName)); } APIAdmin apiAdmin = new APIAdminImpl(); BotDetectionData alertSubscription = apiAdmin.getBotDetectionAlertSubscription(AlertMgtConstants.BOT_DETECTION_EMAIL_FIELD, email); if (alertSubscription != null) { RestApiUtil.handleResourceAlreadyExistsError( "Email: " + email + " has already been subscribed for bot detection alerts", log); } apiAdmin.addBotDetectionAlertSubscription(email); BotDetectionData newAlertSubscription = apiAdmin.getBotDetectionAlertSubscription(AlertMgtConstants.BOT_DETECTION_EMAIL_FIELD, email); BotDetectionAlertSubscriptionDTO alertSubscriptionDTO = BotDetectionMappingUtil.fromAlertSubscriptionToDTO(newAlertSubscription); return Response.ok(alertSubscriptionDTO).build(); }
Source:
<code>public static boolean hasPictureId(byte[] buf, int off, int len) { if (!isValid(buf, off)) return false; if ((buf[off] & X_BIT) == 0 || (buf[off+1] & I_BIT) == 0) <START> return false; <END> return true; }</code><technical_language>I simplify "return isValid(buf,off) && (buf[off] & X_BIT != 0) && (buf[off+1] & I_BIT) != 0)"</technical_language>

Target:
public static boolean hasPictureId(byte[] buf, int off, int len) { return isValid(buf, off, len) && (buf[off] & X_BIT) != 0 && (buf[off+1] & I_BIT) != 0; }
Source:
<code>private void checkForChangedCCZ() { alreadyCheckedForAppFilesChange = true; Intent i = new Intent(this, UpdateActivity.class); <START> startActivityForResult(i, UPDATE_CONSUMER_APP); <END> }</code><technical_language>I need change startActivity -> startActivityForResult</technical_language>

Target:
private void checkForChangedCCZ() { alreadyCheckedForAppFilesChange = true; Intent i = new Intent(this, UpdateActivity.class); startActivity(i); }
Source:
<code>public void mercury_topbar_wikiaLogoRedirectsToFandomPage() { TopBar topBar = new ArticlePage() .open(MercurySubpages.MAIN_PAGE) .getTopBar(); <START> Assertion.assertTrue(topBar.isLogoVisible()); <END> topBar.clickWikiaLogo(); Assertion.assertTrue(topBar.getCurrentUrl().contains("www.wikia.com/fandom")); }</code><technical_language>I if visible, click fail, is assertion needed</technical_language>

Target:
public void mercury_topbar_wikiaLogoRedirectsToFandomPage() { TopBar topBar = new ArticlePage() .open(MercurySubpages.MAIN_PAGE) .getTopBar(); topBar.clickWikiaLogo(); Assertion.assertTrue(topBar.getCurrentUrl().contains("www.wikia.com/fandom")); }
Source:
<code>static List<String> getExecutableNames() { List<String> executableNames = new ArrayList<String>(); switch (Platform.getCurrent()) { case MAC: case UNIX: case LINUX: { Collections.addAll(executableNames, ProcessNames.PHANTOMJS.getUnixImageName(), ProcessNames.CHROMEDRIVER.getUnixImageName()); break; } default: { Collections.addAll(executableNames, ProcessNames.PHANTOMJS.getWindowsImageName(), ProcessNames.CHROMEDRIVER.getWindowsImageName(), ProcessNames.IEDRIVER.getWindowsImageName(), <START> ProcessNames.EDGEDRIVER.getWindowsImageName()); <END> break; } } return executableNames; }</code><technical_language>I this is change please flip this switch statement. default nix instead of windows</technical_language>

Target:
static List<String> getExecutableNames() { List<String> executableNames = new ArrayList<String>(); switch (Platform.getCurrent()) { case WINDOWS: { Collections.addAll(executableNames, ProcessNames.PHANTOMJS.getWindowsImageName(), ProcessNames.CHROMEDRIVER.getWindowsImageName(), ProcessNames.IEDRIVER.getWindowsImageName(), ProcessNames.EDGEDRIVER.getWindowsImageName()); break; } default: { Collections.addAll(executableNames, ProcessNames.PHANTOMJS.getUnixImageName(), ProcessNames.CHROMEDRIVER.getUnixImageName()); break; } } return executableNames; }
Source:
<code>public IndexedInts getRow() { final long timestamp = selector.get(); if (index < 0) { currentTimestamp = timestamp; currentValue = extractionFn.apply(timestamp); ++index; timeValues.put(index, currentValue); } else if (timestamp != currentTimestamp) { <START> if (descending && timestamp > currentTimestamp || !descending && timestamp < currentTimestamp) { <END> throw new IllegalStateException("cannot re-use time dimension selector for multiple scans"); } currentTimestamp = timestamp; final String value = extractionFn.apply(timestamp); if (!value.equals(currentValue)) { currentValue = value; ++index; timeValues.put(index, currentValue); } } final int dimensionValueIndex = index; return new IndexedInts() { @Override public int size() { return 1; } @Override public int get(int i) { return dimensionValueIndex; } @Override public Iterator<Integer> iterator() { return Iterators.singletonIterator(dimensionValueIndex); } @Override public void fill(int index, int[] toFill) { throw new UnsupportedOperationException("fill not supported"); } @Override public void close() throws IOException { } }; }</code><technical_language>nit: add parentheses bcoz obvious if && higher precedence ||</technical_language>

Target:
public IndexedInts getRow() { final long timestamp = selector.get(); if (index < 0) { currentTimestamp = timestamp; currentValue = extractionFn.apply(timestamp); ++index; timeValues.put(index, currentValue); } else if (timestamp != currentTimestamp) { if (descending ? timestamp > currentTimestamp : timestamp < currentTimestamp) { throw new IllegalStateException("cannot re-use time dimension selector for multiple scans"); } currentTimestamp = timestamp; final String value = extractionFn.apply(timestamp); if (!value.equals(currentValue)) { currentValue = value; ++index; timeValues.put(index, currentValue); } } final int dimensionValueIndex = index; return new IndexedInts() { @Override public int size() { return 1; } @Override public int get(int i) { return dimensionValueIndex; } @Override public Iterator<Integer> iterator() { return Iterators.singletonIterator(dimensionValueIndex); } @Override public void fill(int index, int[] toFill) { throw new UnsupportedOperationException("fill not supported"); } @Override public void close() throws IOException { } }; }
Source:
<code>public void testSetGlobalTargetTaskThreadPoolSizeIllegalArgument() { ClusterConfig testConfig = new ClusterConfig("testId"); <START> testConfig.setGlobalTargetTaskThreadPoolSize(0); <END> }</code><technical_language>consider allowing 0. Negative values sense allowed</technical_language>

Target:
public void testSetGlobalTargetTaskThreadPoolSizeIllegalArgument() { ClusterConfig testConfig = new ClusterConfig("testId"); testConfig.setGlobalTargetTaskThreadPoolSize(-1); }
Source:
<code>private DetailedLink findUsage(RSDL rsdl, UriInfo uriInfo, String httpMethod) { for (DetailedLink link : rsdl.getLinks().getLinks()) { if (isMatch(link, uriInfo, httpMethod)) { return link; } } <START> return null; END> }</code><technical_language>For this kind of happen I throw exception generate a error message in log, is difficult diagnose happen</technical_language>

Target:
private DetailedLink findUsage(RSDL rsdl, UriInfo uriInfo, String httpMethod) { DetailedLink link = null; for (DetailedLink currentLink : rsdl.getLinks().getLinks()) { if (isMatch(currentLink, uriInfo, httpMethod)) { link = currentLink; break; } } assert (link != null) : "Corresponding link not found (this should not happen)"; return link; }
Source:
<code><START> public NtpDiscovery() { <END> super(SUPPORTED_THING_TYPES_UIDS, 10); }</code><technical_language>super constructor throws IAE, mark this one, IAE thrown? helpful for caller of constructor this runtime exception thrown</technical_language>

Target:
public NtpDiscovery() throws IllegalArgumentException { super(SUPPORTED_THING_TYPES_UIDS, 10); }
Source:
<code>protected void setAttrs(Comment model, PreparedStatement stmt, boolean setNull) throws SQLException { int index = 1; if (setNull && model.getContent() == null) { <START> stmt.setNull(index, java.sql.Types.CHAR); <END> ++index; } else if (model.getContent() != null) { stmt.setString(index, model.getContent()); ++index; } { stmt.setInt(index, model.getCommenterId()); ++index; } { stmt.setLong(index, model.getCommentedOnId()); ++index; } { stmt.setTimestamp(index, new Timestamp(model.getCreatedAt())); ++index; } stmt.setLong(index, model.getId()); }</code><technical_language>fiddly, this a bit terser with: + stmt.setNull(index++, java.sql.Types.CHAR);</technical_language>

Target:
protected void setAttrs(Comment model, PreparedStatement stmt, boolean setNull) throws SQLException { int index = 1; if (setNull && model.getContent() == null) { stmt.setNull(index++, java.sql.Types.CHAR); } else if (model.getContent() != null) { stmt.setString(index++, model.getContent()); } { stmt.setInt(index++, model.getCommenterId()); } { stmt.setLong(index++, model.getCommentedOnId()); } { stmt.setTimestamp(index++, new Timestamp(model.getCreatedAt())); } stmt.setLong(index, model.getId()); }