auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private SAMRecord writeAndReadSamRecord(final String format, SAMRecord rec) throws IOException { final File bamFile = File.createTempFile("htsjdk-writeAndReadSamRecord.", "." + format); final SAMFileWriter bamWriter = new SAMFileWriterFactory().makeWriter(rec.getHeader(), false, bamFile, REF_FILE); bamWriter.addAlignment(rec); bamWriter.close(); final SamReader reader = SamReaderFactory.makeDefault().referenceSequence(REF_FILE).open(bamFile); <START> SAMRecordIterator iterator = reader.iterator(); <END> Assert.assertTrue(iterator.hasNext()); rec = iterator.next(); iterator.close(); reader.close(); bamFile.delete(); return rec; }</code><technical_language>final</technical_language>

Target:
private SAMRecord writeAndReadSamRecord(final String format, SAMRecord rec) throws IOException { final File bamFile = File.createTempFile("htsjdk-writeAndReadSamRecord.", "." + format); final SAMFileWriter bamWriter = new SAMFileWriterFactory().makeWriter(rec.getHeader(), false, bamFile, REF_FILE); bamWriter.addAlignment(rec); bamWriter.close(); try(final SamReader reader = SamReaderFactory.makeDefault().referenceSequence(REF_FILE).open(bamFile); final SAMRecordIterator iterator = reader.iterator()) { Assert.assertTrue(iterator.hasNext()); rec = iterator.next(); } bamFile.delete(); return rec; }
Source:
<code>private void adjustCreateGameButtonBackgroundColor(String newValue) { if (Strings.isNullOrEmpty(newValue)) { titleTextField.setStyle("-fx-background-color: -bad;"); } else { titleTextField.setStyle("-fx-background-color: transparent;"); } <START> } <END></code><technical_language>try avoid hardcoding styles. basically, call setStyle(). Instead, a titleTextField.pseudoClassStateChanged(). Assuming call pseudo class invalid, styled so: css .game-title-input:invalid { -fx-background-color: -bad; } ... I a red background nasty :-) -fx-border-color: -bad</technical_language>

Target:
private void adjustCreateGameButtonBackgroundColor(String newValue) { PseudoClass invalidClass = PseudoClass.getPseudoClass("invalid"); if (Strings.isNullOrEmpty(newValue)) { titleTextField.pseudoClassStateChanged(invalidClass, true); } else { titleTextField.pseudoClassStateChanged(invalidClass, false); } }
Source:
<code>private List<GeoTrackPoint> processCSVFile(IngestJobContext context, AbstractFile DATFile, String csvFilePath) throws DroneIngestException { List<GeoTrackPoint> trackPoints = new ArrayList<>(); try (BufferedReader reader = new BufferedReader(new FileReader(new File(csvFilePath)))) { String line = reader.readLine(); Map<String, Integer> headerMap = makeHeaderMap(line.split(",")); while ((line = reader.readLine()) != null) { if (context.dataSourceIngestIsCancelled()) { return null; } String[] values = line.split(","); GeoTrackPoint point = createTrackPoint(headerMap, values); if (point != null) { trackPoints.add(point); } } } catch (IOException ex) { <START> throw new DroneIngestException(String.format("Failed to read DAT csvFile %s", csvFilePath), ex); END> } return trackPoints; }</code><technical_language>log objectID of file in addition path/name</technical_language>

Target:
private List<GeoTrackPoint> processCSVFile(IngestJobContext context, AbstractFile DATFile, String csvFilePath) throws DroneIngestException { List<GeoTrackPoint> trackPoints = new ArrayList<>(); try (BufferedReader reader = new BufferedReader(new FileReader(new File(csvFilePath)))) { String line = reader.readLine(); Map<String, Integer> headerMap = makeHeaderMap(line.split(",")); while ((line = reader.readLine()) != null) { if (context.dataSourceIngestIsCancelled()) { return null; } String[] values = line.split(","); GeoTrackPoint point = createTrackPoint(headerMap, values); if (point != null) { trackPoints.add(point); } } } catch (IOException ex) { throw new DroneIngestException(String.format("Failed to read DAT csvFile %s created for AbstractFile: %s", csvFilePath, DATFile.getId()), ex); } return trackPoints; }
Source:
<code>public CloseableHttpResponse execute(HttpRequestBase request) throws IOException { if (StringUtils.isNotEmpty(config.getAuthToken())) { request.setHeader(HttpHeaders.AUTHORIZATION, AUTHENTICATION_HEADER_PREFIX_BEARER + config.getAuthToken()); } if (StringUtils.isNotEmpty(config.getApiKey())) { request.setHeader(CONTINUUITY_API_KEY_HEADER_NAME, config.getApiKey()); } <START> LOG.debug("Execute Http Request: " + request); <END> return httpClient.execute(request); }</code><technical_language>LOG messages, write LOG.debug("Execute Http Request: {}", request); optimized for LOG levels</technical_language>

Target:
public CloseableHttpResponse execute(HttpRequestBase request) throws IOException { if (StringUtils.isNotEmpty(config.getAuthToken())) { request.setHeader(HttpHeaders.AUTHORIZATION, AUTHENTICATION_HEADER_PREFIX_BEARER + config.getAuthToken()); } if (StringUtils.isNotEmpty(config.getAPIKey())) { request.setHeader(CONTINUUITY_API_KEY_HEADER_NAME, config.getAPIKey()); } LOG.debug("Execute Http Request: {}", request); return httpClient.execute(request); }
Source:
<code>public IPath append(IPath tail) { if (tail == null || tail.segmentCount() == 0) return this; if (this.isEmpty() && ((separators & IS_WINDOWS) == 0) <START> == tail.isValidSegment(":")) END> return tail.setDevice(device).makeRelative().makeUNC(isUNC()); if (this.isRoot() && ((separators & IS_WINDOWS) == 0) == tail.isValidSegment(":")) return tail.setDevice(device).makeAbsolute().makeUNC(isUNC()); int myLen = segments.length; int tailLen = tail.segmentCount(); String[] newSegments = new String[myLen + tailLen]; System.arraycopy(segments, 0, newSegments, 0, myLen); for (int i = 0; i < tailLen; i++) { newSegments[myLen + i] = tail.segment(i); } Path result = new Path(device, newSegments, (separators & (HAS_LEADING | IS_UNC | IS_WINDOWS)) | (tail.hasTrailingSeparator() ? HAS_TRAILING : 0)); String tailFirstSegment = newSegments[myLen]; if (tailFirstSegment.equals("..") || tailFirstSegment.equals(".")) { result.canonicalize(); } return result; }</code><technical_language>tail.isValidSegment(":") is a indirect of determining path is a Windows not</technical_language>

Target:
public IPath append(IPath tail) { if (tail == null || tail.segmentCount() == 0) return this; if (this.isEmpty() && ((flags & IS_FOR_WINDOWS) == 0) == tail.isValidSegment(":")) return tail.setDevice(device).makeRelative().makeUNC(isUNC()); if (this.isRoot() && ((flags & IS_FOR_WINDOWS) == 0) == tail.isValidSegment(":")) return tail.setDevice(device).makeAbsolute().makeUNC(isUNC()); int myLen = segments.length; int tailLen = tail.segmentCount(); String[] newSegments = new String[myLen + tailLen]; System.arraycopy(segments, 0, newSegments, 0, myLen); for (int i = 0; i < tailLen; i++) { newSegments[myLen + i] = tail.segment(i); } Path result = new Path(device, newSegments, (flags & (HAS_LEADING | IS_UNC | IS_FOR_WINDOWS)) | (tail.hasTrailingSeparator() ? HAS_TRAILING : 0)); String tailFirstSegment = newSegments[myLen]; if (tailFirstSegment.equals("..") || tailFirstSegment.equals(".")) { result.canonicalize(); } return result; }
Source:
<code>protected void keyTyped(char c, int i) throws IOException { <START> if (search.isFocused()){ <END> if (!search.isEmpty() && search.handleKey(c, i)) return; } else if (GuiScreen.isAltKeyDown() && ChatAllowedCharacters.isAllowedCharacter(c)) { this.mouseClicked(search.getLeft(), search.getTop(), 0); search.setContent(""); search.handleKey(c, i); return; } if (!itemDisplay.keyTyped(c, i)) { if (i == 1 || !search.handleKey(c, i)) { super.keyTyped(c, i); } } }</code><technical_language>Formatting</technical_language>

Target:
protected void keyTyped(char c, int i) throws IOException { if (search.isFocused()) { if (!search.isEmpty() && search.handleKey(c, i)) return; } else if (GuiScreen.isAltKeyDown() && ChatAllowedCharacters.isAllowedCharacter(c)) { itemDisplay.setFocused(false); search.setFocused(true); search.setText(""); search.handleKey(c, i); return; } if (!itemDisplay.keyTyped(c, i)) { if (i == 1 || !search.handleKey(c, i)) { super.keyTyped(c, i); } } }
Source:
<code>public String toString() { int[] types = getTransportTypes(); String transports = (types.length > 0) ? " Transports: " + transportNamesOf(types) : ""; types = getCapabilities(); String capabilities = (types.length > 0 ? " Capabilities: " : ""); for (int i = 0; i < types.length; ) { capabilities += capabilityNameOf(types[i]); if (++i < types.length) capabilities += "&"; } types = BitUtils.unpackBits(mUnwantedNetworkCapabilities); String unwantedCapabilities = (types.length > 0 ? " <START> UnwantedCapabilities: " <END> : ""); unwantedCapabilities += capabilityNamesOf(types); String upBand = ((mLinkUpBandwidthKbps > 0) ? " LinkUpBandwidth>=" + mLinkUpBandwidthKbps + "Kbps" : ""); String dnBand = ((mLinkDownBandwidthKbps > 0) ? " LinkDnBandwidth>=" + mLinkDownBandwidthKbps + "Kbps" : ""); String specifier = (mNetworkSpecifier == null ? "" : " Specifier: <" + mNetworkSpecifier + ">"); String signalStrength = (hasSignalStrength() ? " SignalStrength: " + mSignalStrength : ""); String uids = (null != mUids ? " Uids: <" + mUids + ">" : ""); String establishingAppUid = " EstablishingAppUid: " + mEstablishingVpnAppUid; return "[" + transports + capabilities + upBand + dnBand + specifier + signalStrength + uids + establishingAppUid + unwantedCapabilities + "]"; }</code><technical_language>Suggest shortening this "Unwanted". string representation of this object is long</technical_language>

Target:
public String toString() { int[] types = getTransportTypes(); String transports = (types.length > 0) ? " Transports: " + transportNamesOf(types) : ""; types = getCapabilities(); String capabilities = (types.length > 0 ? " Capabilities: " : ""); for (int i = 0; i < types.length; ) { capabilities += capabilityNameOf(types[i]); if (++i < types.length) capabilities += "&"; } types = BitUtils.unpackBits(mUnwantedNetworkCapabilities); String unwantedCapabilities = (types.length > 0 ? " Unwanted: " : ""); unwantedCapabilities += capabilityNamesOf(types); String upBand = ((mLinkUpBandwidthKbps > 0) ? " LinkUpBandwidth>=" + mLinkUpBandwidthKbps + "Kbps" : ""); String dnBand = ((mLinkDownBandwidthKbps > 0) ? " LinkDnBandwidth>=" + mLinkDownBandwidthKbps + "Kbps" : ""); String specifier = (mNetworkSpecifier == null ? "" : " Specifier: <" + mNetworkSpecifier + ">"); String signalStrength = (hasSignalStrength() ? " SignalStrength: " + mSignalStrength : ""); String uids = (null != mUids ? " Uids: <" + mUids + ">" : ""); String establishingAppUid = " EstablishingAppUid: " + mEstablishingVpnAppUid; return "[" + transports + capabilities + unwantedCapabilities + upBand + dnBand + specifier + signalStrength + uids + establishingAppUid + "]"; }
Source:
<code>private void updateGui() { <START> if (getActivity() == null || getActivity().isFinishing()) { <END> return; } RestApi mApi = mActivity.getApi(); if (mApi != null) { mApi.getSystemInfo(this::onReceiveSystemInfo); mApi.getSystemVersion(this::onReceiveSystemVersion); mApi.getConnections(this::onReceiveConnections); } }</code><technical_language>is a race checking if getActivity is null null secons call, causing a NPE. store getActivitiy in a variable</technical_language>

Target:
private void updateGui() { MainActivity mainActivity = (MainActivity) getActivity(); if (mainActivity == null) { return; } if (mainActivity.isFinishing()) { return; } RestApi mApi = mainActivity.getApi(); if (mApi != null) { mApi.getSystemInfo(this::onReceiveSystemInfo); mApi.getSystemVersion(this::onReceiveSystemVersion); mApi.getConnections(this::onReceiveConnections); } }
Source:
<code>public void onResume() { checkItemVisibility(); setUpdateIntervalText(); setParallelDownloadsText(UserPreferences.getParallelDownloads()); setEpisodeCacheSizeText(UserPreferences.getEpisodeCacheSize()); setDataFolderText(); <START> GpodnetPreferences.setSyncAttemptListener(() -> ui.getActivity().runOnUiThread( <END> () -> updateLastGpodnetSyncReport( GpodnetPreferences.getLastSyncAttemptResult(), GpodnetPreferences.getLastSyncAttemptTimestamp()))); updateGpodnetPreferenceScreen(); }</code><technical_language>This re-invented SharedPreferences.OnSharedPreferenceChangeListener</technical_language>

Target:
public void onResume() { checkItemVisibility(); setUpdateIntervalText(); setParallelDownloadsText(UserPreferences.getParallelDownloads()); setEpisodeCacheSizeText(UserPreferences.getEpisodeCacheSize()); setDataFolderText(); GpodnetPreferences.registerOnSharedPreferenceChangeListener(gpoddernetListener); updateGpodnetPreferenceScreen(); }
Source:
<code>public IStatus validate(IValidationContext ctx) { IStatus status = null; EObject target = ctx.getTarget(); for (EObject content : target.eContents()) { if (content instanceof IdentifiedElement && !(content instanceof Group || content instanceof ViewpointSpec)) { String elementName = ((IdentifiedElement) content).getName(); <START> if (elementName == null || "".equals(elementName)) { <END> status = ctx.createFailureStatus(getPath(content) + ERROR_MESSAGE); } } } if (status == null) { status = ctx.createSuccessStatus(); } return status; }</code><technical_language>(StringUtil.isEmpty(elementName)) instead ckeck if String is null empty instead (elementName == null || "".equals(elementName))</technical_language>

Target:
public IStatus validate(IValidationContext ctx) { IStatus status = null; EObject target = ctx.getTarget(); for (EObject content : target.eContents()) { if (content instanceof IdentifiedElement && !(content instanceof Group || content instanceof ViewpointSpec)) { String elementName = ((IdentifiedElement) content).getName(); if (StringUtil.isEmpty(elementName)) { status = ctx.createFailureStatus(getPath(content) + ERROR_MESSAGE); } } } if (status == null) { status = ctx.createSuccessStatus(); } return status; }
Source:
<code>public PlanWithProperties visitTableFinish(TableFinishNode node, PreferredProperties preferredProperties) { PlanNode child = planChild(node, PreferredProperties.any()).getNode(); ExchangeNode gather; if (child instanceof ExchangeNode) { <START> ExchangeNode exchangeNode = (ExchangeNode) child; <END> gather = new ExchangeNode( idAllocator.getNextId(), GATHER, REMOTE_STREAMING, new PartitioningScheme(Partitioning.create(SINGLE_DISTRIBUTION, ImmutableList.of()), exchangeNode.getOutputVariables()), exchangeNode.getSources(), exchangeNode.getInputs(), true, Optional.empty()); } else { gather = gatheringOrderedExchange(idAllocator.getNextId(), REMOTE_STREAMING, child); } return withDerivedProperties( ChildReplacer.replaceChildren(node, ImmutableList.of(gather)), ImmutableList.of()); }</code><technical_language>Note change check type is GATHER</technical_language>

Target:
public PlanWithProperties visitTableFinish(TableFinishNode node, PreferredProperties preferredProperties) { PlanNode child = planChild(node, PreferredProperties.any()).getNode(); ExchangeNode gather; if (child instanceof ExchangeNode) { ExchangeNode exchangeNode = (ExchangeNode) child; gather = new ExchangeNode( idAllocator.getNextId(), GATHER, REMOTE_STREAMING, new PartitioningScheme(Partitioning.create(SINGLE_DISTRIBUTION, ImmutableList.of()), exchangeNode.getOutputVariables()), exchangeNode.getSources(), exchangeNode.getInputs(), true, Optional.empty()); } else { gather = ensureSourceOrderingGatheringExchange(idAllocator.getNextId(), REMOTE_STREAMING, child); } return withDerivedProperties( ChildReplacer.replaceChildren(node, ImmutableList.of(gather)), ImmutableList.of()); }
Source:
<code>private void concatResults( final TupleBatchBuffer resultBuffer, final Object[] aggState, final Object key) throws DbException, IOException { int index = 1; for (int agg = 0; agg < aggregators.length; ++agg) { if (aggregators[agg] .getClass() .getName() <START> .equals(StatefulUserDefinedAggregator.class.getName())) { <END> List<TupleBatch> listTb = ltb.get(key); if (listTb.size() > 0) { LOGGER.info("size of tuples for key " + key.toString() + " is " + listTb.size()); aggregators[agg].add(listTb, aggState[agg]); } } aggregators[agg].getResult(resultBuffer, index, aggState[agg]); index += aggregators[agg].getResultSchema().numColumns(); } }</code><technical_language>instanceof</technical_language>

Target:
private void concatResults( final TupleBatchBuffer resultBuffer, final Object[] aggState, final Object key) throws DbException, IOException { int index = 1; for (int agg = 0; agg < aggregators.length; ++agg) { if (aggregators[agg] instanceof StatefulUserDefinedAggregator) { List<TupleBatch> listTb = ltb.get(key); if (listTb.size() > 0) { aggregators[agg].add(listTb); } } aggregators[agg].getResult(resultBuffer, index, aggState[agg]); index += aggregators[agg].getResultSchema().numColumns(); } }
Source:
<code>public T getItem(int index) { DataCommunicator<T> verifiedDataCommunicator = getDataCommunicator(); if (verifiedDataCommunicator.isDefinedSize()) { final int itemCount = this.dataCommunicator.getDataSize(); validateItemIndex(index, itemCount); Optional<T> optionalItem = verifiedDataCommunicator.getDataProvider() .fetch(this.dataCommunicator.buildQuery(index, 1)) .findFirst(); return optionalItem.orElseThrow(() -> new IllegalStateException(String.format( "Item with an index %d is expected to be fetched" + " from backend, but not found", index))); } else { <START> return verifiedDataCommunicator.getActiveItemOnIndex(index); <END> } }</code><technical_language>intention works of anything, defined undefined size. this data communicator get item data communicator item active range a fetch query</technical_language>

Target:
public T getItem(int index) { return getDataCommunicator().getItem(index); }
Source:
<code>public void doWrite(Server server, Query query, ImmutableList<Result> results) throws Exception { influxDB.createDatabase(database); String source = getSource(server); BatchPoints batchPoints = BatchPoints.database(database).retentionPolicy(retentionPolicy) .tag(TAG_HOSTNAME, source).consistency(writeConsistency).build(); for (Result result : results) { Map<String, Object> fixedValues = new HashMap<String,Object>(); fixedValues.put("_jmx_port", Integer.parseInt(server.getPort())); Map<String, Object> resultValues = result.getValues(); <START> if (resultValues != null) { <END> for (Entry<String, Object> entry : resultValues.entrySet()) { if (!entry.getValue().toString().equals("NaN")) { fixedValues.put(entry.getKey(), entry.getValue()); } } } if (fixedValues.size() > 1) { Map<String, String> resultTagsToApply = buildResultTagMap(result); Point point = Point.measurement(result.getKeyAlias()).time(result.getEpoch(), MILLISECONDS) .tag(resultTagsToApply).fields(fixedValues).build(); batchPoints.point(point); } } influxDB.write(batchPoints); }</code><technical_language>result.getValues() is tagged @Nonnull, null check removed (I know, already, code cleaner time touch it...)</technical_language>

Target:
public void doWrite(Server server, Query query, ImmutableList<Result> results) throws Exception { influxDB.createDatabase(database); BatchPoints batchPoints = BatchPoints.database(database).retentionPolicy(retentionPolicy) .tag(TAG_HOSTNAME, server.getSource()).consistency(writeConsistency).build(); for (Result result : results) { HashMap<String, Object> filteredValues = new HashMap(Maps.filterValues(result.getValues(), isNotNaN)); if (!filteredValues.isEmpty()) { filteredValues.put("_jmx_port", Integer.parseInt(server.getPort())); Map<String, String> resultTagsToApply = buildResultTagMap(result); Point point = Point.measurement(result.getKeyAlias()).time(result.getEpoch(), MILLISECONDS) .tag(resultTagsToApply).fields(filteredValues).build(); batchPoints.point(point); } } influxDB.write(batchPoints); }
Source:
<code>public LogEntry newDelegate() throws ResourceDoesNotSupportOperationException { <START> throw new UnsupportedOperationException("method not supported"); <END> }</code><technical_language>getUuid() method added LogEntry, uniqueId identifier. this fetch log entry instead of hard coded get(0)</technical_language>

Target:
public LogEntry newDelegate() throws ResourceDoesNotSupportOperationException { throw new ResourceDoesNotSupportOperationException(); }
Source:
<code>void requestNativeAd( Context context, MediationNativeListener mediationNativeListener, Bundle serverParameters, NativeMediationAdRequest nativeMediationAdRequest, Bundle mediationExtras) { if (!nativeMediationAdRequest.isUnifiedNativeAdRequested()) { Log.e(TAG, "Failed to load ad. Request must be for unified native ads."); if (canInvokeListenerEvent()) mediationNativeListener.onAdFailedToLoad(adapter, AdRequest.ERROR_CODE_INVALID_REQUEST); return; } AdUnitMapper mapper = AdUnitMapper.validateNendAdUnit(serverParameters); if (mapper == null) { if (canInvokeListenerEvent()) mediationNativeListener.onAdFailedToLoad(adapter, AdRequest.ERROR_CODE_INVALID_REQUEST); return; } contextWeakReference = new WeakReference<>(context); this.mediationNativeListener = mediationNativeListener; if (mediationExtras != null) { <START> final NendMediationAdapter.FormatType type = (NendMediationAdapter.FormatType) mediationExtras.getSerializable(KEY_NATIVE_ADS_FORMAT_TYPE); <END> if (type != null) { switch (type) { case TYPE_VIDEO: videoAdLoader = new NativeVideoAdLoader( this, mapper, nativeMediationAdRequest, mediationExtras); videoAdLoader.loadAd(); return; case TYPE_NORMAL: break; default: Log.w(TAG, "Unknown type: "+ type); break; } } } normalAdLoader = new NativeAdLoader( this, new NendAdNativeClient(context, mapper.spotId, mapper.apiKey), nativeMediationAdRequest.getNativeAdOptions()); normalAdLoader.loadAd(); }</code><technical_language>cast NendMediationAdapter.FormatType crash if passes extras this format type</technical_language>

Target:
void requestNativeAd( Context context, MediationNativeListener mediationNativeListener, Bundle serverParameters, NativeMediationAdRequest nativeMediationAdRequest, Bundle mediationExtras) { if (!nativeMediationAdRequest.isUnifiedNativeAdRequested()) { Log.e(TAG, "Failed to load ad. Request must be for unified native ads."); if (canInvokeListenerEvent()) mediationNativeListener.onAdFailedToLoad(adapter, AdRequest.ERROR_CODE_INVALID_REQUEST); return; } AdUnitMapper mapper = AdUnitMapper.validateNendAdUnit(serverParameters); if (mapper == null) { if (canInvokeListenerEvent()) mediationNativeListener.onAdFailedToLoad(adapter, AdRequest.ERROR_CODE_INVALID_REQUEST); return; } contextWeakReference = new WeakReference<>(context); this.mediationNativeListener = mediationNativeListener; if (mediationExtras != null && NendMediationAdapter.FormatType.TYPE_VIDEO == mediationExtras.getSerializable(KEY_NATIVE_ADS_FORMAT_TYPE)) { videoAdLoader = new NativeVideoAdLoader(this, mapper, nativeMediationAdRequest, mediationExtras); videoAdLoader.loadAd(); } else { normalAdLoader = new NativeAdLoader( this, new NendAdNativeClient(context, mapper.spotId, mapper.apiKey), nativeMediationAdRequest.getNativeAdOptions()); normalAdLoader.loadAd(); } }
Source:
<code>private void preRenderSetupSimpleBlendMaterials() { <START> dynamicFBM.getFBO(DefaultDynamicFBOs.ReadOnlyGBuffer.getResourceUrn()).setRenderBufferMask(true, true, true); <END> GL11.glEnable(GL_BLEND); GL11.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); GL11.glDepthMask(false); }</code><technical_language>able do a simple: DefaultDynamicFBOs.ReadOnlyGBuffer.setRenderBufferMask(true, true, true); no</technical_language>

Target:
private void preRenderSetupSimpleBlendMaterials() { READ_ONLY_GBUFFER.setRenderBufferMask(true, true, true); GL11.glEnable(GL_BLEND); GL11.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); GL11.glDepthMask(false); }
Source:
<code>private Rule createNewRuleForRow(final int row, final String headCell, final String ruleCell ) { Integer salience = null; if ( this._currentSequentialFlag ) { salience = _currentSalience--; if (salience < _minSalienceTag) { <START> throw new DecisionTableParseException( "Row number is above the max" ); <END> } } final int spreadsheetRow = row + 1; final String name = this._currentRulePrefix + "_" + spreadsheetRow; final Rule rule = new Rule( name, salience, spreadsheetRow ); rule.setComment( " rule values at " + ruleCell + ", header at " + headCell ); return rule; }</code><technical_language>I message is a confusing.. Stating more aligned issue better; for example "Salience minimum row " + row + "."</technical_language>

Target:
private Rule createNewRuleForRow(final int row, final String headCell, final String ruleCell ) { Integer salience = null; if ( this._currentSequentialFlag ) { salience = _currentSalience--; if (salience < _minSalienceTag) { throw new DecisionTableParseException( "Salience less than the minimum specified on row: " + row ); } } final int spreadsheetRow = row + 1; final String name = this._currentRulePrefix + "_" + spreadsheetRow; final Rule rule = new Rule( name, salience, spreadsheetRow ); rule.setComment( " rule values at " + ruleCell + ", header at " + headCell ); return rule; }
Source:
<code>public Mono<Void> complete(ServiceBusReceivedMessage message) { Objects.requireNonNull(message, "'message' cannot be null."); <START> if (receiveMode != ReceiveMode.PEEK_LOCK && isAutoComplete) { <END> return Mono.error(logger.logExceptionAsError(new UnsupportedOperationException( "Complete is not supported on a receiver opened in ReceiveMode.RECEIVE_AND_DELETE."))); } else if (message.getLockToken() == null) { return Mono.error(logger.logExceptionAsError(new IllegalArgumentException( "'message.getLockToken()' cannot be null."))); } logger.info("{}: Completing message. Sequence number: {}. Lock: {}. Expiration: {}", entityPath, message.getSequenceNumber(), message.getLockToken(), lockTokenExpirationMap.get(message.getLockToken())); return isLockTokenValid(message.getLockToken()).then( connectionProcessor.flatMap(connection -> connection.getManagementNode(entityPath, entityType)) .flatMap(node -> node.complete(message.getLockToken())) .then(Mono.fromRunnable(() -> lockTokenExpirationMap.remove(message.getLockToken())))); }</code><technical_language>Do test user do want autoComplete want call</technical_language>

Target:
public Mono<Void> complete(ServiceBusReceivedMessage message) { return updateDisposition(message, DispositionStatus.COMPLETED, null, null, null); }
Source:
<code>public Map<String, String> getConfig() { <START> if ( injectedConfigNames != null ) { <END> config.clear(); for ( int i = 0; i < injectedConfigNames.size(); i++ ) { config.put( injectedConfigNames.get( i ), injectedConfigValues.get( i ) ); } injectedConfigNames = null; injectedConfigValues = null; } return config; }</code><technical_language>do this init phase instead of in getConfig()</technical_language>

Target:
public Map<String, String> getConfig() { applyInjectedProperties(); return config; }
Source:
<code>protected ISecurePreferences getSecurePreferences() { ILock lock = getSecurePreferencesRootLock(); <START> if (lock != null && lock.getDepth() > 0) { <END> throw new RuntimeException("Possible deadlock detected accessing secure storage; aborting request"); } return super.getSecurePreferences(); }</code><technical_language>So, this trigger anytime another thread accessing secure store concurrently? I if retry 200 ms something</technical_language>

Target:
protected ISecurePreferences getSecurePreferences() { ILock lock = getSecurePreferencesRootLock(); if (lock != null && lock.getDepth() > 0) { try { Thread.sleep(200); } catch (InterruptedException e) { StatusHandler.log(new Status(IStatus.ERROR, RepositoriesUiPlugin.ID_PLUGIN, e.getMessage(), e)); } if (lock.getDepth() > 0) { throw new RuntimeException("Aborting request to prevent deadlock accessing secure storage"); } } return super.getSecurePreferences(); }
Source:
<code>public void processFiles() { if (!this.zipOnly) { this.printZipHeader(); } Set<String> zippedFolders = new HashSet<>(); for (String fileEntry : jobFiles) { String storageLocation = fileEntry[0]; String fileName = fileEntry[1]; if (this.zipOutputStream == null) { openZipStream(); } if (this.directAccessUtil == null) { this.directAccessUtil = new DirectAccessUtil(); } InputStream inputStream = this.directAccessUtil.openDirectAccess(storageLocation); if (inputStream != null && this.zipOutputStream != null) { ZipEntry entry = new ZipEntry(fileName); byte[] bytes = new byte[2 * 8192]; int read = 0; long readSize = 0L; try { if (hasFolder(fileName)) { addFolderToZipStream(getFolderName(fileName), zippedFolders); } this.zipOutputStream.putNextEntry(entry); while ((read = inputStream.read(bytes)) != -1) { this.zipOutputStream.write(bytes, 0, read); readSize += read; } inputStream.close(); this.zipOutputStream.closeEntry(); } catch (IOException ioex) { <START> System.err.println("Faile to compress "+storageLocation); <END> } } else { System.err.println("Failed to access "+storageLocation); } } try { this.zipOutputStream.flush(); this.zipOutputStream.close(); System.out.flush(); System.out.close(); } catch (Exception e) { } }</code><technical_language>suggestion System.err.println("Failed compress "+storageLocation);</technical_language>

Target:
public void processFiles() { if (!this.zipOnly) { this.printZipHeader(); } Set<String> zippedFolders = new HashSet<>(); for (String fileEntry : jobFiles) { String storageLocation = fileEntry[0]; String fileName = fileEntry[1]; if (this.zipOutputStream == null) { openZipStream(); } if (this.directAccessUtil == null) { this.directAccessUtil = new DirectAccessUtil(); } InputStream inputStream = this.directAccessUtil.openDirectAccess(storageLocation); if (inputStream != null && this.zipOutputStream != null) { ZipEntry entry = new ZipEntry(fileName); byte[] bytes = new byte[2 * 8192]; int read = 0; long readSize = 0L; try { if (hasFolder(fileName)) { addFolderToZipStream(getFolderName(fileName), zippedFolders); } this.zipOutputStream.putNextEntry(entry); while ((read = inputStream.read(bytes)) != -1) { this.zipOutputStream.write(bytes, 0, read); readSize += read; } inputStream.close(); this.zipOutputStream.closeEntry(); } catch (IOException ioex) { System.err.println("Failed to compress "+storageLocation); } } else { System.err.println("Failed to access "+storageLocation); } } try { this.zipOutputStream.flush(); this.zipOutputStream.close(); System.out.flush(); System.out.close(); } catch (Exception e) { } }
Source:
<code>private NavigableMap<Offset, File> getIndexSegmentDetails(String logSegmentName) { NavigableMap<Offset, File> indexSegmentFileToStartOffset = new TreeMap<>(); File[] indexSegmentFiles = PersistentIndex.getIndexSegmentFilesForLogSegment(dataDir.getAbsolutePath(), logSegmentName); for (File indexSegmentFile : indexSegmentFiles) { indexSegmentFileToStartOffset.put(IndexSegment.getIndexSegmentStartOffset(indexSegmentFile.getName()), indexSegmentFile); } return indexSegmentFileToStartOffset; <START> } <END></code><technical_language>is need for a navigableMap instead of sortedMap? Personally, I specific interface provides need</technical_language>

Target:
private SortedMap<Offset, File> getIndexSegmentDetails(String logSegmentName) { SortedMap<Offset, File> indexSegmentStartOffsetToFile = new TreeMap<>(); File[] indexSegmentFiles = PersistentIndex.getIndexSegmentFilesForLogSegment(dataDir.getAbsolutePath(), logSegmentName); for (File indexSegmentFile : indexSegmentFiles) { indexSegmentStartOffsetToFile.put(IndexSegment.getIndexSegmentStartOffset(indexSegmentFile.getName()), indexSegmentFile); } return indexSegmentStartOffsetToFile; }
Source:
<code>private void renameNode() { <START> logger().debug("Renaming Couchbase Node from localhost to " + getContainerIpAddress()); <END> Response response = doHttpRequest(MGMT_PORT, "/node/controller/rename", "POST", new FormBody.Builder() .add("hostname", getInternalIpAddress()) .build(), false ); checkSuccessfulResponse(response, "Could not rename couchbase node"); }</code><technical_language>suggestion logger().debug("Renaming Couchbase Node localhost {}", getContainerIpAddress());</technical_language>

Target:
private void renameNode() { logger().debug("Renaming Couchbase Node from localhost to {}", getContainerIpAddress()); Response response = doHttpRequest(MGMT_PORT, "/node/controller/rename", "POST", new FormBody.Builder() .add("hostname", getInternalIpAddress()) .build(), false ); checkSuccessfulResponse(response, "Could not rename couchbase node"); }
Source:
<code>public static Object valueForStringWithType(String value, VoltType type) { <START> if (type == null || type == VoltType.NULL) { <END> return null; } Object retval = ParameterConverter.tryToMakeCompatible(type.classFromType(), value); assert(ParameterConverter.verifyParameterConversion(retval, type.classFromType())); return retval; }</code><technical_language>do allow type == null? sense a type info. add a precondition check forbid that</technical_language>

Target:
public static Object valueForStringWithType(String value, VoltType type) { if (type == VoltType.NULL) { return null; } Object retval = ParameterConverter.tryToMakeCompatible(type.classFromType(), value); assert(ParameterConverter.verifyParameterConversion(retval, type.classFromType())); return retval; }
Source:
<code><START> private List<Contentlet> getRelatedContentFromIndex(Contentlet contentlet,Relationship rel, User user, boolean respectFrontendRoles)throws DotDataException, DotSecurityException { <END> List<ContentletSearch> contentletSearchList = getRelatedContentSearchFromIndex(contentlet, rel, user, respectFrontendRoles); return contentletSearchList.stream().map(ESContentletAPIImpl::transformContentletSearchToContent).collect(Collectors.toList()); }</code><technical_language>![MINOR](<LINK_1> 'Severity: MINOR') Split this 183 characters long line (which is greater 150 authorized). [![rule](<LINK_0>](<LINK_2></technical_language>

Target:
private List<Contentlet> getRelatedContentFromIndex(Contentlet contentlet,Relationship rel, User user, boolean respectFrontendRoles)throws DotDataException, DotSecurityException { List<ContentletSearch> contentletSearchList = getRelatedContentSearchFromIndex(contentlet, rel, user, respectFrontendRoles); return contentletSearchList.stream().map(ESContentletAPIImpl::transformContentletSearchToContent).collect(CollectionsUtils.toImmutableList()); }
Source:
<code>public TestSession getNewSession(Map<String, Object> requestedCapabilities) { LOGGER.entering(); TestSession session = null; <START> try { <END> accessLock.lock(); try { Thread.sleep(3000); } catch (InterruptedException e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); } processParentTunnelCapability(requestedCapabilities); if (sauceApi.getNumberOfTCRunning() <= getMaxNumberOfConcurrentTestSessions()) { session = super.getNewSession(requestedCapabilities); } } finally { accessLock.unlock(); } LOGGER.exiting((session != null) ? session.toString() : null); return session; }</code><technical_language>Nice call removing this unnecessary conversion capabilties key match sauce is expecting</technical_language>

Target:
public TestSession getNewSession(Map<String, Object> requestedCapabilities) { LOGGER.entering(); TestSession session = null; try { Thread.sleep(2000); } catch (InterruptedException e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); } try { accessLock.lock(); processDeprecatedCapabilities(requestedCapabilities); processCredentails(requestedCapabilities); processTunnelIdentifierCapability(requestedCapabilities); processParentTunnelCapability(requestedCapabilities); requestedCapabilities.put(SauceLabsCapability.IDLE_TIMEOUT_CAPABILITY, getTimeOut() / 1000); final int numberOfTCRunning = sauceApi.getNumberOfTCRunning(); if (numberOfTCRunning == -1) { down = true; if (poll = false) { LOGGER.exiting(null); return null; } } if (numberOfTCRunning <= getMaxNumberOfConcurrentTestSessions()) { session = super.getNewSession(requestedCapabilities); } LOGGER.exiting((session != null) ? session.toString() : null); return session; } finally { accessLock.unlock(); } }
Source:
<code>public User getUser(String id) throws NoSuchUserException { <START> User user = connector.getUser(id, sessionData.getAccesstoken()); <END> if (user == null) { throw new NoSuchUserException(id); } return user; }</code><technical_language>method throw NoResultException if user is found</technical_language>

Target:
public User getUser(String id) { return connector.getUser(id, sessionData.getAccesstoken()); }
Source:
<code><START> public final Object getAbstractBuildOwner(Run build, Class targetClass) { <END> return build instanceof AbstractBuild ? (AbstractBuild) build : null; }</code><technical_language>can/should private (and remove @Restricted(NoExternalUse.class))</technical_language>

Target:
private final Object getAbstractBuildOwner(Run build, Class targetClass) { return build instanceof AbstractBuild ? (AbstractBuild) build : null; }
Source:
<code>public void setupTest() { this.mockQuery = Mockito.mock(Query.class); this.mockResult = Mockito.mock(Result.class); <START> this.mockServer = Mockito.mock(Server.class); <END> Mockito.when(this.mockResult.getValues()).thenReturn(ImmutableMap.of("x-att1-x", (Object) "120021")); Mockito.when(this.mockResult.getAttributeName()).thenReturn("X-ATT-X"); Mockito.when(this.mockResult.getClassName()).thenReturn("X-DOMAIN.PKG.CLASS-X"); Mockito.when(this.mockResult.getTypeName()). thenReturn("Type=x-type-x,Group=x-group-x,Other=x-other-x,Name=x-name-x"); Mockito.when(this.mockServer.getLabel()).thenReturn("myhostname"); }</code><technical_language>need for a mock</technical_language>

Target:
public void setupTest() { this.mockResult = Mockito.mock(Result.class); Mockito.when(this.mockResult.getValues()).thenReturn(ImmutableMap.of("x-att1-x", (Object) "120021")); Mockito.when(this.mockResult.getAttributeName()).thenReturn("X-ATT-X"); Mockito.when(this.mockResult.getClassName()).thenReturn("X-DOMAIN.PKG.CLASS-X"); Mockito.when(this.mockResult.getTypeName()). thenReturn("Type=x-type-x,Group=x-group-x,Other=x-other-x,Name=x-name-x"); }
Source:
<code>public JobConfig generateConfig(String executionPlanJson) { Map<String, String> configs = new HashMap<>(); configs.put(JobConfig.JOB_NAME(), jobName); List<String> inputs = inEdges.stream().map(edge -> edge.getFormattedSystemStream()).collect(Collectors.toList()); configs.put(TaskConfig.INPUT_STREAMS(), Joiner.on(',').join(inputs)); if (streamGraph.hasWindowOrJoins()) { if ("-1".equals(config.get(TaskConfig.WINDOW_MS(), "-1"))) { long triggerInterval = computeTriggerInterval(); log.info("Using triggering interval: for jobName: {}", triggerInterval, jobName); configs.put(TaskConfig.WINDOW_MS(), String.valueOf(triggerInterval)); } } log.info("Job has generated configs {}", jobName, configs); configs.put(CONFIG_INTERNAL_EXECUTION_PLAN, executionPlanJson); <START> inEdges.stream().filter(StreamEdge::isIntermeidate).forEach(e -> addStreamConfig(e, configs)); <END> String configPrefix = String.format(CONFIG_JOB_PREFIX, jobName); return new JobConfig(Util.rewriteConfig(extractScopedConfig(config, new MapConfig(configs), configPrefix))); }</code><technical_language>s/isIntermeidate/isIntermediate</technical_language>

Target:
public JobConfig generateConfig(String executionPlanJson) { Map<String, String> configs = new HashMap<>(); configs.put(JobConfig.JOB_NAME(), jobName); List<String> inputs = inEdges.stream().map(edge -> edge.getFormattedSystemStream()).collect(Collectors.toList()); configs.put(TaskConfig.INPUT_STREAMS(), Joiner.on(',').join(inputs)); if (streamGraph.hasWindowOrJoins()) { if ("-1".equals(config.get(TaskConfig.WINDOW_MS(), "-1"))) { long triggerInterval = computeTriggerInterval(); log.info("Using triggering interval: for jobName: {}", triggerInterval, jobName); configs.put(TaskConfig.WINDOW_MS(), String.valueOf(triggerInterval)); } } configs.put(CONFIG_INTERNAL_EXECUTION_PLAN, executionPlanJson); inEdges.stream().filter(StreamEdge::isIntermediate).forEach(edge -> addStreamConfig(edge, configs)); log.info("Job has generated configs {}", jobName, configs); String configPrefix = String.format(CONFIG_JOB_PREFIX, jobName); return new JobConfig(Util.rewriteConfig(extractScopedConfig(config, new MapConfig(configs), configPrefix))); }
Source:
<code>private void updateRemoteVideoSurfaceDimensions() { if (mVideoCallScreen == null) <START> { <END> LogUtil.e("VideoCallPresenter.updateRemoteVideoSurfaceDimensions", "mVideoCallScreen is null"); return; } Activity activity = mVideoCallScreen.getVideoCallScreenFragment().getActivity(); if (activity != null) { Point screenSize = new Point(); activity.getWindowManager().getDefaultDisplay().getSize(screenSize); getRemoteVideoSurfaceTexture().setSurfaceDimensions(screenSize); } }</code><technical_language>Remove this check? throw NullPointerException if null, happen</technical_language>

Target:
private void updateRemoteVideoSurfaceDimensions() { Activity activity = mVideoCallScreen.getVideoCallScreenFragment().getActivity(); if (activity != null) { Point screenSize = new Point(); activity.getWindowManager().getDefaultDisplay().getSize(screenSize); getRemoteVideoSurfaceTexture().setSurfaceDimensions(screenSize); } }
Source:
<code>private void addAttributeValue(Metacard metacard, Map.Entry<String, Object> entry) { final Object value = entry.getValue(); LOGGER.trace( "The map key \"{}\" with value \"{}\" is being added to the metacard.", entry.getKey(), value); try { if (value instanceof Serializable) { metacard.setAttribute(new AttributeImpl(entry.getKey(), (Serializable) value)); } else if (value instanceof List) { metacard.setAttribute(new AttributeImpl(entry.getKey(), (List<Serializable>) value)); } else { LOGGER.debug("The value was expected to be Serializable or a list of Serializable items."); } } catch (ClassCastException ex) { LOGGER.debug( <START> "The value was expected to be Serializable or a list of Serializable items. {}", ex); <END> } }</code><technical_language>drop get full stack trace</technical_language>

Target:
private void addAttributeValue(Metacard metacard, Map.Entry<String, Object> entry) { final Object value = entry.getValue(); LOGGER.trace( "The map key \"{}\" with value \"{}\" is being added to the metacard.", entry.getKey(), value); if (value instanceof Serializable) { metacard.setAttribute(new AttributeImpl(entry.getKey(), (Serializable) value)); } else if (value instanceof List) { try { metacard.setAttribute(new AttributeImpl(entry.getKey(), (List<Serializable>) value)); } catch (ClassCastException ex) { LOGGER.debug( "The value was expected to be Serializable or a list of Serializable items.", ex); } } else { LOGGER.debug( "The was expected to be Serializable or a list of Serializable items.", value); } }
Source:
<code>private void renderHelmet(ScaledResolution res, float partialTicks) { if (pre(HELMET)) return; ItemStack itemstack = this.mc.player.inventory.armorItemInSlot(3); <START> if (this.mc.gameSettings.thirdPersonView == 0 && itemstack.getItem() != Item.getItemFromBlock(Blocks.AIR)) <END> { if (itemstack.getItem() == Item.getItemFromBlock(Blocks.PUMPKIN)) { renderPumpkinOverlay(res); } else { itemstack.getItem().renderHelmetOverlay(itemstack, mc.player, res, partialTicks); } } post(HELMET); }</code><technical_language>fix is a literal translation of logic, !itemstack.isEmpty() a check here</technical_language>

Target:
private void renderHelmet(ScaledResolution res, float partialTicks) { if (pre(HELMET)) return; ItemStack itemstack = this.mc.player.inventory.armorItemInSlot(3); if (this.mc.gameSettings.thirdPersonView == 0 && !itemstack.isEmpty()) { Item item = itemstack.getItem(); if (item == Item.getItemFromBlock(Blocks.PUMPKIN)) { renderPumpkinOverlay(res); } else { item.renderHelmetOverlay(itemstack, mc.player, res, partialTicks); } } post(HELMET); }
Source:
<code>private void postCreateBrick(VdcReturnValueBase returnValue) { CreateBrickModel model = (CreateBrickModel) getWindow(); model.stopProgress(); if (returnValue != null <START> && returnValue.getSucceeded()) <END> setWindow(null); }</code><technical_language>This code style give formatting error. if line statement curly braces</technical_language>

Target:
private void postCreateBrick(VdcReturnValueBase returnValue) { CreateBrickModel model = (CreateBrickModel) getWindow(); model.stopProgress(); if (returnValue != null && returnValue.getSucceeded()) { setWindow(null); } }
Source:
<code>public static PaletteRoot createPalette() { PaletteRoot root = new PaletteRoot(); IToolManager toolManager = ApplicationGIS.getToolManager(); List<PaletteContainer> categories = new ArrayList<PaletteContainer>(); int open = 0; for( ModalToolCategory category : toolManager.getModalToolCategories() ) { open++; String name = category.getName(); name = fixLabel(name); final int NOT_USED = -1; PaletteContainer container; if (open == NOT_USED ) { PaletteToolbar toolbar = new PaletteToolbar(name); toolbar.setUserModificationPermission(PaletteToolbar.PERMISSION_NO_MODIFICATION); container = toolbar; } <START> else if (open == NOT_USED ){ <END> PaletteGroup group = new PaletteGroup( name ); container = group; } else if( open == 1 || open == 2){ PaletteDrawer drawer = new PaletteDrawer(name); drawer.setInitialState(PaletteDrawer.INITIAL_STATE_OPEN); drawer.setDrawerType(ToolEntry.PALETTE_TYPE_TOOL); drawer.setShowDefaultIcon(false); container = drawer; } else { PaletteDrawer drawer = new PaletteDrawer(name); drawer.setInitialState(PaletteDrawer.INITIAL_STATE_CLOSED); drawer.setDrawerType(ToolEntry.PALETTE_TYPE_TOOL); drawer.setShowDefaultIcon(false); container = drawer; } category.container( container ); for( ModalItem modalItem : category ) { String label = fixLabel(modalItem.getName()); ToolEntry tool = new MapToolEntry(label, modalItem, category.getId()); if(modalItem.getId().equals(DEFAULT_ID)){ root.setDefaultEntry(tool); } container.add(tool); } categories.add(container); } root.addAll(categories); return root; }</code><technical_language>if else if same. is busted I say</technical_language>

Target:
public static PaletteRoot createPalette() { PaletteRoot root = new PaletteRoot(); IToolManager toolManager = ApplicationGIS.getToolManager(); List<PaletteContainer> categories = new ArrayList<PaletteContainer>(); int open = 0; for( ModalToolCategory category : toolManager.getModalToolCategories() ) { open++; String name = category.getName(); name = fixLabel(name); PaletteContainer container; PaletteDrawer drawer = new PaletteDrawer(name); if( category == toolManager.getActiveCategory()){ drawer.setInitialState(PaletteDrawer.INITIAL_STATE_OPEN); } else { drawer.setInitialState(PaletteDrawer.INITIAL_STATE_CLOSED); } drawer.setDrawerType(ToolEntry.PALETTE_TYPE_TOOL); drawer.setUserModificationPermission(PaletteContainer.PERMISSION_NO_MODIFICATION); drawer.setShowDefaultIcon(false); container = drawer; category.container( container ); for( ModalItem modalItem : category ) { String label = fixLabel(modalItem.getName()); ToolEntry tool = new MapToolEntry(label, modalItem, category.getId()); if(modalItem.getId().equals(DEFAULT_ID)){ root.setDefaultEntry(tool); } container.add(tool); } categories.add(container); } root.addAll(categories); return root; }