auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public InMemoryYamlConfig(String yaml, Properties properties) { LOGGER.info("Configuring Hazelcast from 'in-memory YAML'."); <START> if (yaml == null || "".equals(yaml.trim())) { <END> throw new IllegalArgumentException("YAML configuration is null or empty! Please use a well-structured YAML."); } if (properties == null) { throw new IllegalArgumentException("properties can't be null"); } InputStream in = new ByteArrayInputStream(stringToBytes(yaml)); new YamlConfigBuilder(in).setProperties(properties).build(this); }</code><technical_language>isEmpty</technical_language>

Target:
public InMemoryYamlConfig(String yaml, Properties properties) { LOGGER.info("Configuring Hazelcast from 'in-memory YAML'."); if (isNullOrEmptyAfterTrim(yaml)) { throw new IllegalArgumentException("YAML configuration is null or empty! Please use a well-structured YAML."); } if (properties == null) { throw new IllegalArgumentException("properties can't be null"); } InputStream in = new ByteArrayInputStream(stringToBytes(yaml)); new YamlConfigBuilder(in).setProperties(properties).build(this); }
Source:
<code>private void finishBundle(Bundle bundle) { queue.remove(bundle); finishedBundles.add(bundle); registerReadyMarker(bundle); Set<Bundle> remainingBundles = getRemainingBundles(); if (!remainingBundles.isEmpty()) { logger.trace("Remaining bundles with {}: {}", xmlDirectory, remainingBundles); } else { <START> logger.debug("Finished loading bundles with {}", xmlDirectory); <END> loadingCompleted(); } }</code><technical_language>I get of messages for bundle in installation... if expected hit this line (if so, reduce trace) if is some issue in processing run out of remainingBundles startup continuously</technical_language>

Target:
private void finishBundle(Bundle bundle) { queue.remove(bundle); finishedBundles.add(bundle); registerReadyMarker(bundle); Set<Bundle> remainingBundles = getRemainingBundles(); if (!remainingBundles.isEmpty()) { logger.trace("Remaining bundles with {}: {}", xmlDirectory, remainingBundles); } else { logger.trace("Finished loading bundles with {}", xmlDirectory); loadingCompleted(); } }
Source:
<code>public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { Repository repository = (Repository) receiver; <START> if (repository == null) { <END> return false; } GitFlowRepository gitFlowRepository = new GitFlowRepository(repository); try { if (IS_INITIALIZED.equals(property)) { return gitFlowRepository.getConfig().isInitialized(); } else if (IS_FEATURE.equals(property)) { return gitFlowRepository.isFeature(); } else if (IS_RELEASE.equals(property)) { return gitFlowRepository.isRelease(); } else if (IS_HOTFIX.equals(property)) { return gitFlowRepository.isHotfix(); } else if (IS_DEVELOP.equals(property)) { return gitFlowRepository.isDevelop(); } else if (IS_MASTER.equals(property)) { return gitFlowRepository.isMaster(); } else if (HAS_DEFAULT_REMOTE.equals(property)) { return gitFlowRepository.getConfig().hasDefaultRemote(); } } catch (IOException e) { Activator.getDefault().getLog().log(error(e.getMessage(), e)); } return false; }</code><technical_language>this null check done casting Repository, check if passed object is of type Repository in order prevent CCEs</technical_language>

Target:
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { if (receiver == null || !(receiver instanceof Repository)) { return false; } Repository repository = (Repository) receiver; GitFlowRepository gitFlowRepository = new GitFlowRepository(repository); try { if (IS_INITIALIZED.equals(property)) { return gitFlowRepository.getConfig().isInitialized(); } else if (IS_FEATURE.equals(property)) { return gitFlowRepository.isFeature(); } else if (IS_RELEASE.equals(property)) { return gitFlowRepository.isRelease(); } else if (IS_HOTFIX.equals(property)) { return gitFlowRepository.isHotfix(); } else if (IS_DEVELOP.equals(property)) { return gitFlowRepository.isDevelop(); } else if (IS_MASTER.equals(property)) { return gitFlowRepository.isMaster(); } else if (HAS_DEFAULT_REMOTE.equals(property)) { return gitFlowRepository.getConfig().hasDefaultRemote(); } } catch (IOException e) { Activator.getDefault().getLog().log(error(e.getMessage(), e)); } return false; }
Source:
<code>public ImmutableList<DiffAnalytics> parseDifferentialResults(JsonObject obj) { try { ImmutableList.Builder<DiffAnalytics> diffAnalyticsListBuilder = ImmutableList.builder(); JsonArray results = obj.getAsJsonArray("results"); for(JsonElement e : results) { DiffAnalytics diffAnalytics = buildDiffAnalyticObject(e); <START> if(diffAnalytics != null) <END> { diffAnalyticsListBuilder.add(diffAnalytics); } } return diffAnalyticsListBuilder.build(); } catch (RuntimeException e) { throw new RuntimeException("Input Json is missing a results field OR results field is not an Array",e); } }</code><technical_language>If returning null, error, Optional is preferable. expresses absent is ok, act accordingly. Another option is catch exception skip element in case</technical_language>

Target:
public ImmutableList<DiffAnalytics> parseDifferentialResults(JsonObject obj) { try { ImmutableList.Builder<DiffAnalytics> diffAnalyticsListBuilder = ImmutableList.builder(); JsonArray results = obj.getAsJsonArray("results"); for(JsonElement e : results) { DiffAnalytics diffAnalytics = buildDiffAnalyticsObject(e); if(Optional.ofNullable(diffAnalytics).isPresent()) { diffAnalyticsListBuilder.add(diffAnalytics); } } return diffAnalyticsListBuilder.build(); } catch (IllegalFormatException e) { throw new RuntimeException("Input Json is missing a results field OR results field is not an Array",e.getCause()); } }
Source:
<code>public void waitForRollups() throws InterruptedException { Thread.currentThread().sleep(LOCATOR_WAIT_FOR_ALL_SECS * 1000); <START> } <END></code><technical_language>totally mess calling this repeatedly. shouldnt expose kinda methods. If want control, LOCATOR_WAIT_FOR_ALL_SECS set in a separate constructor. For tests set zero if dont want wait. non-static set in constructor. integer field</technical_language>

Target:
protected void waitForRollups() throws InterruptedException { Thread.currentThread().sleep(LOCATOR_WAIT_FOR_ALL_SECS * 1000); }
Source:
<code>public void visit(final Parameter n, final Void arg) { printJavaComment(n.getComment(), arg); printAnnotations(n.getAnnotations(), false, arg); printModifiers(n.getModifiers()); if (n.getType() != null) { n.getType().accept(this, arg); } if (n.isVarArgs()) { printAnnotations(n.getVarArgsAnnotations(), false, arg); printer.print("..."); } <START> if (n.getType() != null && !(n.getType() instanceof UnknownType)) { <END> printer.print(" "); } n.getName().accept(this, arg); }</code><technical_language>Null checks necessary in JavaParser</technical_language>

Target:
public void visit(final Parameter n, final Void arg) { printJavaComment(n.getComment(), arg); printAnnotations(n.getAnnotations(), false, arg); printModifiers(n.getModifiers()); n.getType().accept(this, arg); if (n.isVarArgs()) { printAnnotations(n.getVarArgsAnnotations(), false, arg); printer.print("..."); } if (!(n.getType() instanceof UnknownType)) { printer.print(" "); } n.getName().accept(this, arg); }
Source:
<code>public int hashCode() { int result = name != null ? name.hashCode() : 0; result = 31 * result + (type != null ? type.hashCode() : 0); result = 31 * result + (description != null ? description.hashCode() : 0); <START> result = 31 * result + (defaultValue != null ? defaultValue.hashCode() : 0); <END> return result; }</code><technical_language>change Objects.hashCode(...)</technical_language>

Target:
public int hashCode() { return Objects.hashCode(name, type, description, defaultValue); }
Source:
<code>void left() { <START> session.end(); <END> }</code><technical_language>I add a null check in case</technical_language>

Target:
void left() { if (session != null) { session.end(); } }
Source:
<code>private void proceedBalloonCheck() { if (getVdsManager().getCopyVds().isBalloonEnabled()) { VmBalloonInfo balloonInfo = vdsmVm.getVmStatistics().getVmBalloonInfo(); if (balloonInfo.getBalloonLastMemory() == null || balloonInfo.getBalloonLastMemory() == 0) { balloonInfo.setBalloonLastMemory(balloonInfo.getCurrentMemory()); return; } Guid vmId = vdsmVm.getVmDynamic().getId(); <START> if (dbVm == null) { <END> return; } if (isBalloonDeviceActiveOnVm(vdsmVm) && (Objects.equals(balloonInfo.getCurrentMemory(), balloonInfo.getBalloonMaxMemory()) || !isBalloonWorking(balloonInfo))) { vmBalloonDriverIsRequestedAndUnavailable(vmId); } else { vmBalloonDriverIsNotRequestedOrAvailable(vmId); } balloonInfo.setBalloonLastMemory(balloonInfo.getCurrentMemory()); if (vdsmVm.getVmStatistics().getusage_mem_percent() != null && vdsmVm.getVmStatistics().getusage_mem_percent() == 0 && balloonInfo.isBalloonDeviceEnabled() && !Objects.equals(balloonInfo.getCurrentMemory(), balloonInfo.getBalloonMaxMemory())) { guestAgentIsDownAndBalloonInfalted(vmId); } else { guestAgentIsUpOrBalloonDeflated(vmId); } } }</code><technical_language>this patch shortened line right? I changing order of if statements. please add null check if-clause</technical_language>

Target:
private void proceedBalloonCheck() { if (getVdsManager().getCopyVds().isBalloonEnabled()) { VmBalloonInfo balloonInfo = vdsmVm.getVmStatistics().getVmBalloonInfo(); Guid vmId = vdsmVm.getVmDynamic().getId(); if (dbVm == null) { return; } if (balloonInfo.getBalloonLastMemory() == null || balloonInfo.getBalloonLastMemory() == 0) { balloonInfo.setBalloonLastMemory(balloonInfo.getCurrentMemory()); return; } if (isBalloonDeviceActiveOnVm(vdsmVm) && (Objects.equals(balloonInfo.getCurrentMemory(), balloonInfo.getBalloonMaxMemory()) || !isBalloonWorking(balloonInfo))) { vmBalloonDriverIsRequestedAndUnavailable(vmId); } else { vmBalloonDriverIsNotRequestedOrAvailable(vmId); } balloonInfo.setBalloonLastMemory(balloonInfo.getCurrentMemory()); if (vdsmVm.getVmStatistics().getusage_mem_percent() != null && vdsmVm.getVmStatistics().getusage_mem_percent() == 0 && balloonInfo.isBalloonDeviceEnabled() && !Objects.equals(balloonInfo.getCurrentMemory(), balloonInfo.getBalloonMaxMemory())) { guestAgentIsDownAndBalloonInfalted(vmId); } else { guestAgentIsUpOrBalloonDeflated(vmId); } } }
Source:
<code>@Override protected Void doInBackground(Void... voids) { if(!albumsMode && !all_photos && !fav_photos){ for(Media m: getAlbum().getSelectedMedia()){ bitmaps.add(getBitmap(m.getPath())); } }else if(!albumsMode && all_photos && !fav_photos){ for(Media m: selectedMedias){ bitmaps.add(getBitmap(m.getPath())); } } byte[] bytes = createGIFFromImages(bitmaps); File file = new File(Environment.getExternalStorageDirectory() + "/" + "Phimpme_gifs"); <START> DateFormat dateFormat = new SimpleDateFormat("dMMMyyyy_HHmmss"); <END> String date = dateFormat.format(Calendar.getInstance().getTime()); if(file.exists() && file.isDirectory()){ FileOutputStream outStream = null; try{ outStream = new FileOutputStream(file.getPath() + "/" + "GIF_"+date+".gif"); outStream.write(bytes); outStream.close(); }catch(Exception e){ e.printStackTrace(); } }else { if (file.mkdir()) { FileOutputStream outStream = null; try { outStream = new FileOutputStream(file.getPath() + "/" + "GIF_"+date+".gif"); outStream.write(bytes); outStream.close(); } catch (Exception e) { e.printStackTrace(); } } } return null; }</code><technical_language>ddMMYY_HHmm want seconds :P</technical_language>

Target:
@Override protected Void doInBackground(Void... voids) { if(!albumsMode && !all_photos && !fav_photos){ for(Media m: getAlbum().getSelectedMedia()){ bitmaps.add(getBitmap(m.getPath())); } }else if(!albumsMode && all_photos && !fav_photos){ for(Media m: selectedMedias){ bitmaps.add(getBitmap(m.getPath())); } } byte[] bytes = createGIFFromImages(bitmaps); File file = new File(Environment.getExternalStorageDirectory() + "/" + "Phimpme_gifs"); DateFormat dateFormat = new SimpleDateFormat("ddMMyy_HHmm"); String date = dateFormat.format(Calendar.getInstance().getTime()); if(file.exists() && file.isDirectory()){ FileOutputStream outStream = null; try{ outStream = new FileOutputStream(file.getPath() + "/" + "GIF_"+date+".gif"); outStream.write(bytes); outStream.close(); }catch(Exception e){ e.printStackTrace(); } }else { if (file.mkdir()) { FileOutputStream outStream = null; try { outStream = new FileOutputStream(file.getPath() + "/" + "GIF_"+date+".gif"); outStream.write(bytes); outStream.close(); } catch (Exception e) { e.printStackTrace(); } } } return null; }
Source:
<code>public ColumnValueSelector<?> makeColumnValueSelector(String columnName) { if (columnName.equals(Column.TIME_COLUMN_NAME)) { class TimeLongColumnSelector implements LongColumnSelector { @Override public long getLong() { return row.get().getTimestampFromEpoch(); } @Override public boolean isNull() { return false; } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("row", row); } } return new TimeLongColumnSelector(); } else { return new ColumnValueSelector() { @Override public double getDouble() { <START> return DimensionHandlerUtils.nullToZeroDouble(row.get().getMetric(columnName)).doubleValue(); <END> } @Override public boolean isNull() { return row.get().getRaw(columnName) == null; } @Override public float getFloat() { return DimensionHandlerUtils.nullToZeroDouble(row.get().getMetric(columnName)).floatValue(); } @Override public long getLong() { return DimensionHandlerUtils.nullToZeroDouble(row.get().getMetric(columnName)).longValue(); } @Nullable @Override public Object getObject() { return row.get().getRaw(columnName); } @Override public Class classOfObject() { return Object.class; } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("row", row); } }; } }</code><technical_language>this method throw exception, if is null, SQL-compatible handling is on? (same below)</technical_language>

Target:
public ColumnValueSelector<?> makeColumnValueSelector(String columnName) { if (columnName.equals(Column.TIME_COLUMN_NAME)) { class TimeLongColumnSelector implements LongColumnSelector { @Override public long getLong() { return row.get().getTimestampFromEpoch(); } @Override public boolean isNull() { return false; } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("row", row); } } return new TimeLongColumnSelector(); } else { return new ColumnValueSelector() { @Override public boolean isNull() { return row.get().getRaw(columnName) == null; } @Override public double getDouble() { Number metric = row.get().getMetric(columnName); assert NullHandling.replaceWithDefault() || metric != null; return DimensionHandlerUtils.nullToZero(metric).doubleValue(); } @Override public float getFloat() { Number metric = row.get().getMetric(columnName); assert NullHandling.replaceWithDefault() || metric != null; return DimensionHandlerUtils.nullToZero(metric).floatValue(); } @Override public long getLong() { Number metric = row.get().getMetric(columnName); assert NullHandling.replaceWithDefault() || metric != null; return DimensionHandlerUtils.nullToZero(metric).longValue(); } @Nullable @Override public Object getObject() { return row.get().getRaw(columnName); } @Override public Class classOfObject() { return Object.class; } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("row", row); } }; } }
Source:
<code>public void findEncounter_shouldThrowIllegalArgumentExceptionIfGivenEncounterParametersIsNull() throws Exception { EncounterParameters encounterParameters = null; Visit visit = visitService.getVisit(VISIT_ID_WITH_VOIDED_ENCOUNTER); expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("encounterParameters are required"); <START> radiologyEncounterMatcher.findEncounter(visit, encounterParameters); <END> }</code><technical_language>@bgeVam inline null</technical_language>

Target:
public void findEncounter_shouldThrowIllegalArgumentExceptionIfGivenEncounterParametersIsNull() throws Exception { Visit visit = visitService.getVisit(VISIT_ID_WITH_VOIDED_ENCOUNTER); expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("encounterParameters are required"); radiologyEncounterMatcher.findEncounter(visit, null); }
Source:
<code><START> public Map<TopicPartition, OffsetAndMetadata> committableOffsetsAndMetadata() { <END> final Map<TopicPartition, Long> partitionTimes = extractPartitionTimes(); final Map<TopicPartition, OffsetAndMetadata> consumedOffsetsAndMetadata = new HashMap<>(consumedOffsets.size()); for (final Map.Entry<TopicPartition, Long> entry : consumedOffsets.entrySet()) { final TopicPartition partition = entry.getKey(); Long offset = partitionGroup.headRecordOffset(partition); if (offset == null) { try { offset = mainConsumer.position(partition); } catch (final TimeoutException error) { throw new IllegalStateException(error); } catch (final KafkaException fatal) { throw new StreamsException(fatal); } } final long partitionTime = partitionTimes.get(partition); consumedOffsetsAndMetadata.put(partition, new OffsetAndMetadata(offset, encodeTimestamp(partitionTime))); } return consumedOffsetsAndMetadata; }</code><technical_language>In eos-alpha eos-beta non-eos, loop "committable partitions" call mainConsumer#position once, this function extracted out of task a per-task call. More specifically, in prepareXX calls, based state of task clean flag commit source topic offsets for this task, prepareXX function return Map<TopicPartition, Long> partitionTimes encoding extracted timestamps for partition instead of void --- decided commit return empty map. TaskManager mainConsumer call position pass commitOffsetsOrTransaction call</technical_language>

Target:
public Map<TopicPartition, OffsetAndMetadata> committableOffsetsAndMetadata() { if (state() == State.CLOSED) { throw new IllegalStateException("Task " + id + " is closed."); } if (state() != State.RUNNING) { return Collections.emptyMap(); } final Map<TopicPartition, Long> partitionTimes = extractPartitionTimes(); final Map<TopicPartition, OffsetAndMetadata> consumedOffsetsAndMetadata = new HashMap<>(consumedOffsets.size()); for (final Map.Entry<TopicPartition, Long> entry : consumedOffsets.entrySet()) { final TopicPartition partition = entry.getKey(); Long offset = partitionGroup.headRecordOffset(partition); if (offset == null) { try { offset = mainConsumer.position(partition); } catch (final TimeoutException error) { throw new IllegalStateException(error); } catch (final KafkaException fatal) { throw new StreamsException(fatal); } } final long partitionTime = partitionTimes.get(partition); consumedOffsetsAndMetadata.put(partition, new OffsetAndMetadata(offset, encodeTimestamp(partitionTime))); } return consumedOffsetsAndMetadata; }
Source:
<code><START> public org.apache.hadoop.hbase.client.CompactionState getCompactionState( <END> final TableName tableName) { org.apache.hadoop.hbase.client.CompactionState compactionState = org.apache.hadoop.hbase.client.CompactionState.NONE; try { List<RegionInfo> regions = assignmentManager.getRegionStates().getRegionsOfTable(tableName, false); for (RegionInfo regionInfo : regions) { ServerName serverName = assignmentManager.getRegionStates().getRegionServerOfRegion(regionInfo); if (serverName == null) { continue; } ServerMetrics sl = serverManager.getLoad(serverName); if (sl == null) { continue; } RegionMetrics regionMetrics = sl.getRegionMetrics().get(regionInfo.getRegionName()); if (regionMetrics.getCompactionState() == org.apache.hadoop.hbase.client.CompactionState.MAJOR) { if (compactionState == org.apache.hadoop.hbase.client.CompactionState.MINOR) { compactionState = org.apache.hadoop.hbase.client.CompactionState.MAJOR_AND_MINOR; } else { compactionState = org.apache.hadoop.hbase.client.CompactionState.MAJOR; } } else if (regionMetrics.getCompactionState() == org.apache.hadoop.hbase.client.CompactionState.MINOR) { if (compactionState == org.apache.hadoop.hbase.client.CompactionState.MAJOR) { compactionState = org.apache.hadoop.hbase.client.CompactionState.MAJOR_AND_MINOR; } else { compactionState = org.apache.hadoop.hbase.client.CompactionState.MINOR; } } } } catch (Exception e) { compactionState = null; LOG.error("Exception when get compaction state for " + tableName.getNameAsString(), e); } return compactionState; }</code><technical_language>full class name here</technical_language>

Target:
public CompactionState getCompactionState(final TableName tableName) { CompactionState compactionState = CompactionState.NONE; try { List<RegionInfo> regions = assignmentManager.getRegionStates().getRegionsOfTable(tableName, false); for (RegionInfo regionInfo : regions) { ServerName serverName = assignmentManager.getRegionStates().getRegionServerOfRegion(regionInfo); if (serverName == null) { continue; } ServerMetrics sl = serverManager.getLoad(serverName); if (sl == null) { continue; } RegionMetrics regionMetrics = sl.getRegionMetrics().get(regionInfo.getRegionName()); if (regionMetrics.getCompactionState() == CompactionState.MAJOR) { if (compactionState == CompactionState.MINOR) { compactionState = CompactionState.MAJOR_AND_MINOR; } else { compactionState = CompactionState.MAJOR; } } else if (regionMetrics.getCompactionState() == CompactionState.MINOR) { if (compactionState == CompactionState.MAJOR) { compactionState = CompactionState.MAJOR_AND_MINOR; } else { compactionState = CompactionState.MINOR; } } } } catch (Exception e) { compactionState = null; LOG.error("Exception when get compaction state for " + tableName.getNameAsString(), e); } return compactionState; }
Source:
<code>public PopulatedAssetsView() { <START> domUtil = new Elemental2DomUtil(); <END> }</code><technical_language>inject this</technical_language>

Target:
public PopulatedAssetsView() { }
Source:
<code>public StreamsAddressResponse getStreamsAddressSpace() { <START> Map<UUID, StreamAddressSpace> streamsAddressSpace = new HashMap<>(logMetadata.getStreamsAddressSpaceMap()); <END> return new StreamsAddressResponse(streamsAddressSpace); }</code><technical_language>a big overhead - providing entire map? is used</technical_language>

Target:
public StreamsAddressResponse getStreamsAddressSpace() { return new StreamsAddressResponse(logMetadata.getGlobalTail(), logMetadata.getStreamsAddressSpaceMap()); }
Source:
<code>protected boolean validateQuota() { <START> getParameters().setQuotaId(QuotaHelper.getInstance().getQuotaIdToConsume(getVmTemplate().getQuotaId(), <END> getStoragePool())); for (DiskImage diskImage : mImages) { diskImage.setQuotaId(QuotaHelper.getInstance().getQuotaIdToConsume(getVmTemplate().getQuotaId(), getStoragePool())); } if (!isInternalExecution()) { return QuotaManager.validateMultiStorageQuota(getStoragePool().getQuotaEnforcementType(), getQuotaConsumeMap(), getCommandId(), getReturnValue().getCanDoActionMessages()); } return true; }</code><technical_language>this is quota check permission on, quota over</technical_language>

Target:
protected boolean validateQuota() { getParameters().setQuotaId(QuotaHelper.getInstance().getQuotaIdToConsume(getQuotaId(), getStoragePool())); for (DiskImage diskImage : mImages) { diskImage.setQuotaId(QuotaHelper.getInstance().getQuotaIdToConsume(getQuotaId(), getStoragePool())); } if (!isInternalExecution()) { return QuotaManager.validateMultiStorageQuota(getStoragePool().getQuotaEnforcementType(), getQuotaConsumeMap(), getCommandId(), getReturnValue().getCanDoActionMessages()); } return true; }
Source:
<code>private List<String> resolvePartialGroupNames(String userName, String errMessage, String groupNames) throws PartialGroupNameException { if (Shell.WINDOWS) { throw new PartialGroupNameException("Does not support partial group" + " name resolution on Windows. " + errMessage); } if (groupNames.isEmpty()) { throw new PartialGroupNameException("The user name '" + userName + "' is not found. " + errMessage); } else { LOG.warn("Some group names for '{}' are not resolvable. {}", userName, errMessage); ShellCommandExecutor exec2 = createGroupIDExecutor(userName); try { exec2.execute(); return parsePartialGroupNames(groupNames, exec2.getOutput()); } catch (ExitCodeException ece) { throw new PartialGroupNameException("failed to get group id list for " + "user '" + userName + "'", ece); } catch (IOException ioe) { String message = "Can't execute the shell command to " + "get the list of group id for user '" + userName + "'"; if (exec2.isTimedOut()) { message += " because of the command taking longer than " + "the configured timeout: " + timeout + " seconds"; <START> throw new PartialGroupNameException(message); <END> } throw new PartialGroupNameException(message, ioe); } } }</code><technical_language>this line is needed if throw exception anyway? difference is carry original exception</technical_language>

Target:
private List<String> resolvePartialGroupNames(String userName, String errMessage, String groupNames) throws PartialGroupNameException { if (Shell.WINDOWS) { throw new PartialGroupNameException("Does not support partial group" + " name resolution on Windows. " + errMessage); } if (groupNames.isEmpty()) { throw new PartialGroupNameException("The user name '" + userName + "' is not found. " + errMessage); } else { LOG.warn("Some group names for '{}' are not resolvable. {}", userName, errMessage); ShellCommandExecutor partialResolver = createGroupIDExecutor(userName); try { partialResolver.execute(); return parsePartialGroupNames( groupNames, partialResolver.getOutput()); } catch (ExitCodeException ece) { throw new PartialGroupNameException( "failed to get group id list for user '" + userName + "'", ece); } catch (IOException ioe) { String message = "Can't execute the shell command to " + "get the list of group id for user '" + userName + "'"; if (partialResolver.isTimedOut()) { message += " because of the command taking longer than " + "the configured timeout: " + timeout + " seconds"; } throw new PartialGroupNameException(message, ioe); } } }
Source:
<code>public CohortDefinition getPersonWithAttribute() { PersonAttributeCohortDefinition cd = new PersonAttributeCohortDefinition(); cd.addParameter(new Parameter("attributeType", "reporting.parameter.attributeType", PersonAttributeType.class)); cd.addParameter(new Parameter("values", "reporting.parameter.values", String.class, List.class, null)); <START> return new MappedParametersCohortDefinition(cd, "attributeType", "attributeType", "values", "values"); <END> }</code><technical_language>I this line is adding value. return "cd" if changing names mappings of of parameters</technical_language>

Target:
public CohortDefinition getPersonWithAttribute() { PersonAttributeCohortDefinition cd = new PersonAttributeCohortDefinition(); cd.addParameter(new Parameter("attributeType", "reporting.parameter.attributeType", PersonAttributeType.class)); cd.addParameter(new Parameter("values", "reporting.parameter.values", String.class, List.class, null)); return cd; }
Source:
<code>private void renderFinalStereoImage(RenderingStage renderingStage) { switch (renderingStage) { case LEFT_EYE: vrProvider.updateState(); leftEye.bind(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderFullscreenQuad(); break; case RIGHT_EYE: rightEye.bind(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderFullscreenQuad(); vrProvider.submitFrame(); GL11.glFinish(); break; } <START> new BindFBOTask(0,DEFAULT_FRAME_BUFFER_URN).execute(); <END> }</code><technical_language>Eeeeeew. :stuck_out_tongue: Yes, this is pretty ugly. :smile: is advantage in BindFBOTask - which, way, a private class is intended for direct instantiation. I recommend for time simply glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0) then, suggest, breaking this node nodes, binding FBO BindFBO state changes. way, need clear left/rightEye buffers? if yes, do a depth attachment</technical_language>

Target:
private void renderFinalStereoImage(RenderingStage renderingStage) { switch (renderingStage) { case LEFT_EYE: vrProvider.updateState(); leftEyeFbo.bind(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderFullscreenQuad(); break; case RIGHT_EYE: rightEyeFbo.bind(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderFullscreenQuad(); vrProvider.submitFrame(); GL11.glFinish(); break; } glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); }
Source:
<code>public void handle(Request request, Response response) throws Exception { <START> Boolean isMember = request.mandatoryParamAsBoolean(PARAM_MEMBER); <END> if (isMember){ userSession.checkLoggedIn(); } try (DbSession dbSession = dbClient.openSession(false)) { OrganizationQuery dbQuery = buildDbQuery(request); int total = dbClient.organizationDao().countByQuery(dbSession, dbQuery); Paging paging = buildWsPaging(request, total); List<OrganizationDto> organizations = dbClient.organizationDao().selectByQuery(dbSession, dbQuery, forPage(paging.getPageIndex()).andSize(paging.getPageSize())); Set<String> adminOrganizationUuids = searchOrganizationWithAdminPermission(dbSession); writeResponse(request, response, organizations, adminOrganizationUuids, paging); } }</code><technical_language>mandatoryParam primitive type</technical_language>

Target:
public void handle(Request request, Response response) throws Exception { boolean isMember = request.mandatoryParamAsBoolean(PARAM_MEMBER); if (isMember){ userSession.checkLoggedIn(); } try (DbSession dbSession = dbClient.openSession(false)) { OrganizationQuery dbQuery = buildDbQuery(request); int total = dbClient.organizationDao().countByQuery(dbSession, dbQuery); Paging paging = buildWsPaging(request, total); List<OrganizationDto> organizations = dbClient.organizationDao().selectByQuery(dbSession, dbQuery, forPage(paging.getPageIndex()).andSize(paging.getPageSize())); Set<String> adminOrganizationUuids = searchOrganizationWithAdminPermission(dbSession); writeResponse(request, response, organizations, adminOrganizationUuids, paging); } }
Source:
<code>public void launch(ISelection selection, String mode) { try { Object objSelected = ((IStructuredSelection) selection).getFirstElement(); <START> if (objSelected instanceof IFile) { launchHelper((IFile) objSelected, mode); } else if (objSelected instanceof IContainer) { launchHelper((IContainer) objSelected, mode); <END> } } catch (CoreException e) { NodePlugin.logError(e.getLocalizedMessage()); } }</code><technical_language>launchHelper() accepts IResource. I checking casting IResource is enough in here, do need else</technical_language>

Target:
public void launch(ISelection selection, String mode) { try { Object objSelected = ((IStructuredSelection) selection).getFirstElement(); if (objSelected instanceof IResource) { launchHelper((IResource) objSelected, mode); } } catch (CoreException e) { NodePlugin.logError(e.getLocalizedMessage()); } }
Source:
<code>protected final boolean activateBasicLayer(final DDiagram dDiagram, final String layerName) { BasicLayer layer = getBasicLayer(dDiagram, layerName); if (layer != null && <START> !dDiagram.getActivatedLayers().contains(layer)) <END> { Command changeLayersActivationCmd = new ChangeLayerActivationCommand(session.getTransactionalEditingDomain(), dDiagram, layer, new NullProgressMonitor()); session.getTransactionalEditingDomain().getCommandStack().execute(changeLayersActivationCmd); return true; } return false; }</code><technical_language>need test getAllActivatedLayers Perhaps, created method updated activateLayer(final DDiagram dDiagram, final String layerName) (perhaps changing name is mandatory)</technical_language>

Target:
protected final boolean activateBasicLayer(final DDiagram dDiagram, final String layerName) { BasicLayer layer = getBasicLayer(dDiagram, layerName); if (layer != null && !dDiagram.getActivatedLayers().contains(layer) && !dDiagram.getActivatedTransientLayers().contains(layer)) { Command changeLayersActivationCmd = new ChangeLayerActivationCommand(session.getTransactionalEditingDomain(), dDiagram, layer, new NullProgressMonitor()); session.getTransactionalEditingDomain().getCommandStack().execute(changeLayersActivationCmd); return true; } return false; }
Source:
<code>private Config( ConfigBuilder builder ) { this.logging = builder.logging; this.connectionPoolSize = builder.connectionPoolSize; this.idleTimeBeforeConnectionTest = builder.idleTimeBeforeConnectionTest; this.encryptionLevel = builder.encruptionLevel; this.trustStrategy = builder.trustStrategy; <START> this.authToken = builder.authToken; <END> }</code><technical_language>Config.build().withAuthToken(..)</technical_language>

Target:
private Config( ConfigBuilder builder ) { this.logging = builder.logging; this.connectionPoolSize = builder.connectionPoolSize; this.idleTimeBeforeConnectionTest = builder.idleTimeBeforeConnectionTest; this.encryptionLevel = builder.encruptionLevel; this.trustStrategy = builder.trustStrategy; }
Source:
<code>public ArtifactProviderCache() { this.parentCache = new MapMaker() .initialCapacity(500) <START> .expirationT(30, TimeUnit.MINUTES) END> .makeMap(); clearSearchCache(); }</code><technical_language>this file this change included in this commit</technical_language>

Target:
public ArtifactProviderCache() { this.parentCache = new MapMaker() .initialCapacity(500) .expiration(30, TimeUnit.MINUTES) .makeMap(); clearSearchCache(); }
Source:
<code>public Server get() { requireNonNull(this.props); final int maxThreads = this.props .getInt("jetty.maxThreads", Constants.DEFAULT_JETTY_MAX_THREAD_COUNT); final boolean useSsl = this.props.getBoolean("jetty.use.ssl", true); final int port; final Server server = new Server(); if (useSsl) { final int sslPortNumber = this.props .getInt("jetty.ssl.port", Constants.DEFAULT_SSL_PORT_NUMBER); port = sslPortNumber; logger.info("Setting up Jetty Https Server with port:" + sslPortNumber + " and numThreads:" + maxThreads); server.addConnector(getSslSocketConnector(sslPortNumber)); } else { port = this.props.getInt("jetty.port", Constants.DEFAULT_PORT_NUMBER); server.addConnector(getSocketConnector(port)); } setStatsOnConnectors(server); <START> logger.info(String.format("Starting %sserver on port: %d", useSsl ? "SSL " : "", port)); <END> return server; }</code><technical_language>is log correct, for useSsl case, port sslPortNumber</technical_language>

Target:
public Server get() { requireNonNull(this.props); final int maxThreads = this.props .getInt("jetty.maxThreads", Constants.DEFAULT_JETTY_MAX_THREAD_COUNT); final boolean useSsl = this.props.getBoolean("jetty.use.ssl", true); final int port; final Server server = new Server(); if (useSsl) { final int sslPortNumber = this.props .getInt("jetty.ssl.port", Constants.DEFAULT_SSL_PORT_NUMBER); port = sslPortNumber; server.addConnector(getSslSocketConnector(sslPortNumber)); } else { port = this.props.getInt("jetty.port", Constants.DEFAULT_PORT_NUMBER); server.addConnector(getSocketConnector(port)); } setStatsOnConnectors(server); logger.info(String.format( "Starting %sserver on port: %d # Max threads: %d", useSsl ? "SSL " : "", port, maxThreads)); return server; }
Source:
<code>public PngModule() { super (NAME, RELEASE, DATE, FORMAT, COVERAGE, MIMETYPE, WELLFORMED, VALIDITY, REPINFO, NOTE, RIGHTS, RANDOM); keywordList = new HashMap(); <START> keywordList.put(KEYWORD[0], new Booolean(false,KEYWORD[0])); keywordList.put(KEYWORD[1], new Booolean(false,KEYWORD[1])); keywordList.put(KEYWORD[2], new Booolean(false,KEYWORD[2])); keywordList.put(KEYWORD[3], new Booolean(false,KEYWORD[3])); keywordList.put(CREATION_TIME_KEYWORD, new Booolean(false,CREATION_TIME_KEYWORD)); keywordList.put(KEYWORD[4], new Booolean(false,KEYWORD[4])); keywordList.put(KEYWORD[5], new Booolean(false,KEYWORD[5])); keywordList.put(KEYWORD[6], new Booolean(false,KEYWORD[6])); keywordList.put(KEYWORD[7], new Booolean(false,KEYWORD[7])); keywordList.put(KEYWORD[8], new Booolean(false,KEYWORD[8])); END> }</code><technical_language>maintain code readability replace KEYWORD array a named variable for keyword, in manner CREATION_TIME_KEYWORD above. This code more searchable - allowing variable names find precise location referenced - remove need cross reference array index numbers values, making more obvious keyword is added keywordList line.</technical_language>

Target:
public PngModule() { super (NAME, RELEASE, DATE, FORMAT, COVERAGE, MIMETYPE, WELLFORMED, VALIDITY, REPINFO, NOTE, RIGHTS, RANDOM); keywordList = new HashMap(); keywordList.put(TITLE_KEYWORD, new Booolean(false,TITLE_KEYWORD)); keywordList.put(AUTHOR_KEYWORD, new Booolean(false,AUTHOR_KEYWORD)); keywordList.put(DESCRIPTION_KEYWORD, new Booolean(false,DESCRIPTION_KEYWORD)); keywordList.put(COPYRIGHT_KEYWORD, new Booolean(false,COPYRIGHT_KEYWORD)); keywordList.put(CREATION_TIME_KEYWORD, new Booolean(false,CREATION_TIME_KEYWORD)); keywordList.put(SOFTWARE_KEYWORD, new Booolean(false,SOFTWARE_KEYWORD)); keywordList.put(DISCLAIMER_KEYWORD, new Booolean(false,DISCLAIMER_KEYWORD)); keywordList.put(WARNING_KEYWORD, new Booolean(false,WARNING_KEYWORD)); keywordList.put(SOURCE_KEYWORD, new Booolean(false,SOURCE_KEYWORD)); keywordList.put(COMMENT_KEYWORD, new Booolean(false,COMMENT_KEYWORD)); }
Source:
<code>public StringBuffer format(@Nullable Object obj, @Nullable StringBuffer toAppendTo, @Nullable FieldPosition pos) { if <START> (obj != null && <END> obj instanceof Number && toAppendTo != null) { @Nullable LamiGraphRange internalRange = fInternalRange; @Nullable LamiGraphRange externalRange = fExternalRange; if (internalRange == null || externalRange == null) { StringBuffer buffer = super.format(obj, toAppendTo, pos); return buffer == null ? new StringBuffer() : buffer; } if (internalRange.getDelta().compareTo(BigDecimal.ZERO) == 0) { StringBuffer buffer = super.format(externalRange.getMinimum().doubleValue(), toAppendTo, pos); return buffer == null ? new StringBuffer() : buffer; } BigDecimal range = externalRange.getDelta(); if (range.compareTo(BigDecimal.ZERO) == 0) { range = BigDecimal.ONE; } BigDecimal externalValue = (new BigDecimal(obj.toString())) .subtract(internalRange.getMinimum()) .multiply(range) .divide(internalRange.getDelta(), 22, BigDecimal.ROUND_DOWN) .add(externalRange.getMinimum()); Double value = externalValue.doubleValue(); StringBuffer buffer = super.format(value, toAppendTo, pos); return buffer == null ? new StringBuffer() : buffer; } throw new IllegalArgumentException("Cannot format given Object as a Number: " + obj); }</code><technical_language>If instance of Number null</technical_language>

Target:
public StringBuffer format(@Nullable Object obj, @Nullable StringBuffer toAppendTo, @Nullable FieldPosition pos) { if (!(obj instanceof Number) || toAppendTo == null) { throw new IllegalArgumentException("Cannot format given Object as a Number: " + obj); } @Nullable LamiGraphRange internalRange = fInternalRange; @Nullable LamiGraphRange externalRange = fExternalRange; if (internalRange == null || externalRange == null) { StringBuffer buffer = super.format(obj, toAppendTo, pos); return buffer == null ? new StringBuffer() : buffer; } if (internalRange.getDelta().compareTo(BigDecimal.ZERO) == 0) { StringBuffer buffer = super.format(externalRange.getMinimum().doubleValue(), toAppendTo, pos); return buffer == null ? new StringBuffer() : buffer; } BigDecimal range = externalRange.getDelta(); if (range.compareTo(BigDecimal.ZERO) == 0) { range = BigDecimal.ONE; } BigDecimal externalValue = (new BigDecimal(obj.toString())) .subtract(internalRange.getMinimum()) .multiply(range) .divide(internalRange.getDelta(), BIG_DECIMAL_DIVISION_SCALE, BigDecimal.ROUND_DOWN) .add(externalRange.getMinimum()); Double value = externalValue.doubleValue(); StringBuffer buffer = super.format(value, toAppendTo, pos); return buffer == null ? new StringBuffer() : buffer; }
Source:
<code>public DataExplorerModel deselectAll() { WebDriverWait wait = new WebDriverWait(driver, 60); wait.until(ExpectedConditions.elementToBeClickable(deselectAllButton)); Actions action = new Actions(driver); action.moveToElement(deselectAllButton).click().perform(); <START> spinner().waitTillDone(60, TimeUnit.SECONDS); <END> return this; }</code><technical_language>simply work normal wait method</technical_language>

Target:
public DataExplorerModel deselectAll() { deselectAllButton.click(); return this; }
Source:
<code>public void addSelectionListener(SelectionListener listener) { if <START> (this.dropdownTableViewer != <END> null && !this.dropdownTable.isDisposed()) this.dropdownTable.addSelectionListener(listener); }</code><technical_language>a check for viewer here? this dropdownTable? table</technical_language>

Target:
public void addSelectionListener(SelectionListener listener) { if (this.dropdownTable != null && !this.dropdownTable.isDisposed()) this.dropdownTable.addSelectionListener(listener); }
Source:
<code>public void getRadiologyOrders_shouldReturnAllRadiologyOrdersForGivenAccessionNumberIfAccessionNumberIsSpecified() throws Exception { RadiologyOrderSearchCriteria radiologyOrderSearchCriteria = new RadiologyOrderSearchCriteria.Builder().withAccessionNumber(EXISTING_RADIOLOGY_ORDER_ACCESSION_NUMBER) .build(); List<RadiologyOrder> radiologyOrders = radiologyOrderService.getRadiologyOrders(radiologyOrderSearchCriteria); assertThat(radiologyOrders.size(), is(1)); <START> for (RadiologyOrder radiologyOrder : radiologyOrders) { <END> assertThat(radiologyOrder.getAccessionNumber(), is(EXISTING_RADIOLOGY_ORDER_ACCESSION_NUMBER)); } }</code><technical_language>@bgeVam loop? size is 1</technical_language>

Target:
public void getRadiologyOrders_shouldReturnAllRadiologyOrdersForGivenAccessionNumberIfAccessionNumberIsSpecified() throws Exception { RadiologyOrderSearchCriteria radiologyOrderSearchCriteria = new RadiologyOrderSearchCriteria.Builder().withAccessionNumber(EXISTING_RADIOLOGY_ORDER_ACCESSION_NUMBER) .build(); List<RadiologyOrder> radiologyOrders = radiologyOrderService.getRadiologyOrders(radiologyOrderSearchCriteria); assertThat(radiologyOrders.size(), is(1)); assertThat(radiologyOrders.get(0) .getAccessionNumber(), is(EXISTING_RADIOLOGY_ORDER_ACCESSION_NUMBER)); }
Source:
<code>Outer(int fileNum, File outFile, int maxLength) throws FileNotFoundException { this.fileNum = fileNum; this.outFile = outFile; this.maxLength = maxLength; FileOutputStream outStream = new FileOutputStream(outFile); this.channel = outStream.getChannel(); <START> closer.register(outStream); <END> closer.register(channel); }</code><technical_language>move closer place file output stream is created? java final FileOutputStream outStream = closer.register(new FileOutputStream(outFile)); work</technical_language>

Target:
Outer(int fileNum, File outFile, int maxLength) throws FileNotFoundException { this.fileNum = fileNum; this.outFile = outFile; this.maxLength = maxLength; FileOutputStream outStream = closer.register(new FileOutputStream(outFile)); this.channel = closer.register(outStream.getChannel()); }
Source:
<code>private List<XmlPackage> getAllPackages() { final List<XmlPackage> allPackages = Lists.newArrayList(); final List<XmlPackage> suitePackages = this.m_xmlTest.getSuite().getPackages(); <START> if (suitePackages != null) <END> allPackages.addAll(suitePackages); final List<XmlPackage> testPackages = this.m_xmlTest.getPackages(); if (testPackages != null) allPackages.addAll(testPackages); return allPackages; }</code><technical_language>null check is needed, org.testng.xml.XmlSuite#getPackages returns empty list always</technical_language>

Target:
private List<XmlPackage> getAllPackages() { final List<XmlPackage> allPackages = Lists.newArrayList(); final List<XmlPackage> suitePackages = this.m_xmlTest.getSuite().getPackages(); if (suitePackages != null) { allPackages.addAll(suitePackages); } final List<XmlPackage> testPackages = this.m_xmlTest.getPackages(); if (testPackages != null) { allPackages.addAll(testPackages); } return allPackages; }
Source:
<code>protected boolean applyUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName, ModelNode resolvedValue, ModelNode currentValue, HandbackHolder<Void> handbackHolder) throws OperationFailedException { Resource resource = context.readResource(PathAddress.EMPTY_ADDRESS); ModelNode model = resource.getModel(); attributeDefinition.validateAndSet(operation, model); JaxrsContextParamHandler.setContextParam(attributeName, resolvedValue); if (ModelType.LIST.equals(resolvedValue.getType())) { StringBuffer sb = new StringBuffer("\""); boolean first = true; for (ModelNode element : resolvedValue.asList()) { if (first) { first = false; } else { sb.append(","); } sb.append(element.asString()); } <START> } <END> return false; }</code><technical_language>This cruft</technical_language>

Target:
protected boolean applyUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName, ModelNode resolvedValue, ModelNode currentValue, HandbackHolder<Void> handbackHolder) throws OperationFailedException { JaxrsContextParamHandler.setContextParam(attributeName, resolvedValue); return false; }
Source:
<code>public PaymentWorksNewVendorDetailDTO getVendorDetailFromPaymentWorks(String newVendorRequestId) { Client client = buildClient(); String URL = (new StringBuilder(getPaymentworksApiUrl()).append(NEW_VENDOR_REQUEST_DETAILS_PREFIX).append(PaymentWorksConstants.FORWARD_SLASH) .append(newVendorRequestId).append(PaymentWorksConstants.FORWARD_SLASH).append(NEW_VENDOR_REQUEST_DETAILS_SUFFIX)).toString(); ClientResponse response = client.handle(buildClientRequest(URL)); PaymentWorksNewVendorDetailDTO newVendorDetail = response.getEntity(PaymentWorksNewVendorDetailDTO.class); LOG.debug("getVendorDetailFromPaymentWorks, Status: " + response.getStatus()); if (response.getStatus() == 200) { LOG.debug("getVendorDetailFromPaymentWorks, New Vendor Request Detail retrieved."); } else { <START> LOG.error("Failed to retrieve New Vendor Request Detail for Vendor Request Id(" + newVendorRequestId + "): " + response.getEntity(String.class)); <END> } return newVendorDetail; }</code><technical_language>logging this error is sufficient</technical_language>

Target:
public PaymentWorksNewVendorDetailDTO getVendorDetailFromPaymentWorks(String newVendorRequestId) { Client client = buildClient(); String URL = (new StringBuilder(getPaymentworksApiUrl()).append(NEW_VENDOR_REQUEST_DETAILS_PREFIX) .append(PaymentWorksConstants.FORWARD_SLASH).append(newVendorRequestId) .append(PaymentWorksConstants.FORWARD_SLASH).append(NEW_VENDOR_REQUEST_DETAILS_SUFFIX)).toString(); ClientResponse response = client.handle(buildClientRequest(URL)); PaymentWorksNewVendorDetailDTO newVendorDetail = null; if (response.getStatus() == HttpURLConnection.HTTP_OK) { LOG.debug("getVendorDetailFromPaymentWorks, New Vendor Request Detail retrieved."); newVendorDetail = response.getEntity(PaymentWorksNewVendorDetailDTO.class); } else { LOG.error("Failed to retrieve New Vendor Request Detail for Vendor Request Id(" + newVendorRequestId + "): " + response.getEntity(String.class)); throw new RuntimeException("Unable to get vendor detail information from PaymentWorks"); } return newVendorDetail; }