auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void addDDF(DDF ddf) throws DDFException { if(ddf.getUUID() == null) { throw new DDFException("uuid is null"); } Lock lock = uuidLocks.get(ddf.getUUID()); try { if(lock.tryLock(120, TimeUnit.SECONDS)) { try { if (ddf.getName() == null) { mDDFCache.put(ddf.getUUID(), ddf); } else { mDDFwithNameCache.put(ddf.getUUID(), ddf); } } finally { lock.unlock(); } } else { throw new DDFException("Timeout getting DDF"); } <START> } catch (InterruptedException e) { <END> } }</code><technical_language>this caught for lock.tryLock? - this addDDF successfully return thread is interrupted? a bad thing</technical_language>

Target:
public void addDDF(DDF ddf) throws DDFException { if (ddf.getUUID() == null) { throw new DDFException("uuid is null"); } Lock lock = uuidLocks.get(ddf.getUUID()); try { if (lock.tryLock(120, TimeUnit.SECONDS)) { try { if (ddf.getName() == null) { mDDFCache.put(ddf.getUUID(), ddf); } else { mDDFwithNameCache.put(ddf.getUUID(), ddf); } } finally { lock.unlock(); } } else { throw new DDFException("Timeout getting DDF"); } } catch (InterruptedException e) { throw new DDFException(e); } }
Source:
<code>private DiskPlanStore(@Parameter(PlanStorePath.class) final String planStorePath) { this.planStorePath = planStorePath; this.datumWriter = new SpecificDatumWriter<LogicalPlan>(LogicalPlan.class); this.datumReader = new SpecificDatumReader<LogicalPlan>(LogicalPlan.class); final File planFolder = new File(planStorePath); <START> if (!planFolder.exists()) { <END> planFolder.mkdir(); } }</code><technical_language>good delete stored files if folder exists</technical_language>

Target:
private DiskPlanStore(@Parameter(PlanStorePath.class) final String planStorePath) { this.planStorePath = planStorePath; this.datumWriter = new SpecificDatumWriter<LogicalPlan>(LogicalPlan.class); this.datumReader = new SpecificDatumReader<LogicalPlan>(LogicalPlan.class); final File planFolder = new File(planStorePath); if (!planFolder.exists()) { planFolder.mkdir(); } else { final File[] destroy = planFolder.listFiles(); for (final File des : destroy) { des.delete(); } } }
Source:
<code>public void sendNotification(MentionNotificationParameters mentionNotificationParameters) { String extractedQuote; <START> if (this.configuration.isQuoteActivated()) { <END> extractedQuote = this.quote.extract(mentionNotificationParameters.getXdom(), mentionNotificationParameters.getAnchorId()).orElse(null); } else { extractedQuote = null; } MentionEventParams params = new MentionEventParams() .setUserReference(mentionNotificationParameters.getAuthorReference().toString()) .setDocumentReference( mentionNotificationParameters.getDocumentReference().toString()) .setLocation(mentionNotificationParameters.getLocation()) .setAnchor(mentionNotificationParameters.getAnchorId()) .setQuote(extractedQuote); MentionEvent event = new MentionEvent(singleton(this.serializer.serialize(mentionNotificationParameters.getMentionedIdentity())), params); this.observationManager.notify(event, "org.xwiki.contrib:mentions-notifications", MentionEvent.EVENT_TYPE); }</code><technical_language>one: right now, if config enable later, means computed mentions quote. new quotes. other hand, this if compute quotes display if change config. IMO depends this config: if this is for perf reason, I agree this if. If for display reason, a switch for velocity template</technical_language>

Target:
public void sendNotification(MentionNotificationParameters mentionNotificationParameters) { String extractedQuote; if (this.configuration.isQuoteActivated()) { extractedQuote = this.quote.extract(mentionNotificationParameters.getXdom(), mentionNotificationParameters.getAnchorId()).orElse(null); } else { extractedQuote = null; } MentionEventParams params = new MentionEventParams() .setUserReference(this.serializer.serialize( mentionNotificationParameters.getAuthorReference())) .setDocumentReference(this.serializer.serialize( mentionNotificationParameters.getDocumentReference())) .setLocation(mentionNotificationParameters.getLocation()) .setAnchor(mentionNotificationParameters.getAnchorId()) .setQuote(extractedQuote); MentionEvent event = new MentionEvent( Collections.singleton(this.serializer.serialize(mentionNotificationParameters.getMentionedIdentity())), params); this.observationManager.notify(event, "org.xwiki.contrib:mentions-notifications", MentionEvent.EVENT_TYPE); }
Source:
<code>protected AbstractFolderActionCommand(@Nonnull final String op, @Nonnull final String folderName) { this.op = op; this.folderName = folderName; <START> this.qResyncParameter = null; <END> }</code><technical_language>else AbstractFolderActionCommand? Is select & examine. If status extends here, add this here</technical_language>

Target:
protected AbstractFolderActionCommand(@Nonnull final String op, @Nonnull final String folderName) { this.op = op; this.folderName = folderName; }
Source:
<code>public boolean extractQuestionDetails( Map<String, String[]> requestParameters, FeedbackQuestionType questionType) { String recommendedLengthString = HttpRequestHelper.getValueFromParamMap(requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_TEXT_RECOMMENDEDLENGTH); <START> this.recommendedLength = recommendedLengthString == null || recommendedLengthString.isEmpty() ? 0 <END> : Integer.parseInt(recommendedLengthString); return true; }</code><technical_language>this keyword is necessary here, I prefer remove (and other parts is necessary). This is maintain consistency some recommendedLength prefixed this some aren't</technical_language>

Target:
public boolean extractQuestionDetails( Map<String, String[]> requestParameters, FeedbackQuestionType questionType) { String recommendedLengthString = HttpRequestHelper.getValueFromParamMap(requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_TEXT_RECOMMENDEDLENGTH); recommendedLength = recommendedLengthString == null || recommendedLengthString.isEmpty() ? 0 : Integer.parseInt(recommendedLengthString); return true; }
Source:
<code>public void sendAsync(RowMap r, AbstractAsyncProducer.CallbackCompleter cc) throws Exception { ProducerRecord<String, String> record = makeProducerRecord(r); String value = KafkaCallback.LOGGER.isDebugEnabled() ? record.value() : null; KafkaCallback callback = new KafkaCallback(cc, r.getNextPosition(), r.getRowIdentity(), value, this.succeededMessageCount, this.failedMessageCount, this.succeededMessageMeter, this.failedMessageMeter, <START> this.context.getConfig().deadLetterTopic, this.context, this); <END> sendAsync(record, callback); }</code><technical_language>fish deadLetterTopic out of config sooner this line...</technical_language>

Target:
public void sendAsync(RowMap r, AbstractAsyncProducer.CallbackCompleter cc) throws Exception { ProducerRecord<String, String> record = makeProducerRecord(r); String value = KafkaCallback.LOGGER.isDebugEnabled() ? record.value() : null; KafkaCallback callback = new KafkaCallback(cc, r.getNextPosition(), r.getRowIdentity(), value, this.succeededMessageCount, this.failedMessageCount, this.succeededMessageMeter, this.failedMessageMeter, this.deadLetterTopic, this.context, this); sendAsync(record, callback); }
Source:
<code>public boolean onGenericMotionEvent(MotionEvent event) { <START> if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB) return false; <END> if ((MotionEventCompat.getSource(event) & InputDevice.SOURCE_CLASS_POINTER) != 0) { switch (event.getAction()) { case MotionEvent.ACTION_SCROLL: float yDistance = MotionEventCompat.getAxisValue(event, MotionEvent.AXIS_VSCROLL); boolean mouseReport = ((vt320) bridge.buffer).isMouseReportEnabled(); if (mouseReport) { int row = (int) Math.floor(event.getY() / bridge.charHeight); int col = (int) Math.floor(event.getX() / bridge.charWidth); ((vt320) bridge.buffer).mouseWheel( yDistance > 0, col, row, (event.getMetaState() & KeyEvent.META_CTRL_ON) != 0, (event.getMetaState() & KeyEvent.META_SHIFT_ON) != 0, (event.getMetaState() & KeyEvent.META_META_ON) != 0); return true; } else if (yDistance != 0) { int base = bridge.buffer.getWindowBase(); bridge.buffer.setWindowBase(base - Math.round(yDistance)); return true; } } } return super.onGenericMotionEvent(event); }</code><technical_language>I get this exist in parent class API level 12 (honeycomb MR1)</technical_language>

Target:
public boolean onGenericMotionEvent(MotionEvent event) { if ((MotionEventCompat.getSource(event) & InputDevice.SOURCE_CLASS_POINTER) != 0) { switch (event.getAction()) { case MotionEvent.ACTION_SCROLL: float yDistance = MotionEventCompat.getAxisValue(event, MotionEvent.AXIS_VSCROLL); boolean mouseReport = ((vt320) bridge.buffer).isMouseReportEnabled(); if (mouseReport) { int row = (int) Math.floor(event.getY() / bridge.charHeight); int col = (int) Math.floor(event.getX() / bridge.charWidth); ((vt320) bridge.buffer).mouseWheel( yDistance > 0, col, row, (event.getMetaState() & KeyEvent.META_CTRL_ON) != 0, (event.getMetaState() & KeyEvent.META_SHIFT_ON) != 0, (event.getMetaState() & KeyEvent.META_META_ON) != 0); return true; } else if (yDistance != 0) { int base = bridge.buffer.getWindowBase(); bridge.buffer.setWindowBase(base - Math.round(yDistance)); return true; } } } return super.onGenericMotionEvent(event); }
Source:
<code>private void setStatements() { setServer = "insert into BetterShardsBungeeConnection (uuid, server) values (?, ?) " <START> + "on duplicate key update server = values(server);"; <END> getServer = "select server from BetterShardsBungeeConnection where uuid = ?;"; getAllPriority = "select name, cap from priorityServers;"; }</code><technical_language>VALUES() ---- baller. tired night up, bravo</technical_language>

Target:
private void setStatements() { setServer = "insert into BetterShardsBungeeConnection (uuid, server) values (?, ?) " + "on duplicate key update server = VALUES(server);"; getServer = "select server from BetterShardsBungeeConnection where uuid = ?;"; getAllPriority = "select name, cap from priorityServers;"; }
Source:
<code>private boolean shouldRedraw(Repository db, AnyObjectId headId, List<String> paths) { <START> boolean pathChange = pathChange(pathFilters, paths); <END> boolean headChange = !headId.equals(currentHeadId); boolean repoChange = false; boolean allBrancheChange = currentShowAllBranches != store .getBoolean(UIPreferences.RESOURCEHISTORY_SHOW_ALL_BRANCHES); currentShowAllBranches = store .getBoolean(UIPreferences.RESOURCEHISTORY_SHOW_ALL_BRANCHES); if (!db.equals(currentRepo)) { repoChange = true; currentRepo = db; } return pathChange || currentWalk == null || headChange || repoChange || allBrancheChange; }</code><technical_language>"pathChange" sound boolean me, I prefer "pathChanged", for other boolean variables</technical_language>

Target:
private boolean shouldRedraw(Repository db, AnyObjectId headId, List<String> paths) { boolean pathChanged = pathChanged(pathFilters, paths); boolean headChanged = !headId.equals(currentHeadId); boolean repoChanged = false; boolean allBranchesChanged = currentShowAllBranches != store .getBoolean(UIPreferences.RESOURCEHISTORY_SHOW_ALL_BRANCHES); currentShowAllBranches = store .getBoolean(UIPreferences.RESOURCEHISTORY_SHOW_ALL_BRANCHES); if (!db.equals(currentRepo)) { repoChanged = true; currentRepo = db; } return pathChanged || currentWalk == null || headChanged || repoChanged || allBranchesChanged; }
Source:
<code>public void validateParameters() { SetupNetworksParameters params = new SetupNetworksParameters(); VdsNetworkInterface nic = new VdsNetworkInterface(); params.setInterfaces(Arrays.asList(nic)); Validator validator = ValidationUtils.getValidator(); nic.setNetworkName("netName"); <START> nic.setGateway(""); <END> nic.setBootProtocol(STATIC_IP); nic.setAddress("1.1.1.1"); assertTrue(validator.validate(params).isEmpty()); params.setConectivityTimeout(-1); assertTrue(validator.validate(params).size() == 1); }</code><technical_language>providing a for gateway emphasis support gateway for management network in setupNetworks</technical_language>

Target:
public void validateParameters() { SetupNetworksParameters params = new SetupNetworksParameters(); VdsNetworkInterface nic = new VdsNetworkInterface(); params.setInterfaces(Arrays.asList(nic)); nic.setNetworkName("otherThenMgmtNetwork"); nic.setGateway("1.1.1.1"); Validator validator = ValidationUtils.getValidator(); assertTrue(validator.validate(params).isEmpty()); nic.setGateway(""); nic.setBootProtocol(STATIC_IP); nic.setAddress("1.1.1.1"); assertTrue(validator.validate(params).isEmpty()); params.setConectivityTimeout(-1); assertTrue(validator.validate(params).size() == 1); }
Source:
<code>public void testBasic() throws InterruptedException { <START> basic_war.as(ZipExporter.class).exportTo(new File("/tmp/" + basic_war.getName()), true); <END> String url = generateURL("/logger", WAR_BASIC_TRACING_FILE); WebTarget base = client.target(url); try { Response response = base.request().get(); Assert.assertEquals(HttpResponseCodes.SC_OK, response.getStatus()); boolean hasTracing = false; for (Map.Entry entry : response.getStringHeaders().entrySet()) { if (entry.getKey().toString().startsWith(RESTEasyTracing.HEADER_TRACING_PREFIX)) { hasTracing = true; break; } } assertTrue(hasTracing); response.close(); } catch (Exception e) { throw new RuntimeException(e); } }</code><technical_language>this for / is needed</technical_language>

Target:
public void testBasic() throws InterruptedException { String url = generateURL("/logger", WAR_BASIC_TRACING_FILE); WebTarget base = client.target(url); try { Response response = base.request().get(); Assert.assertEquals(HttpResponseCodes.SC_OK, response.getStatus()); boolean hasTracing = false; for (Map.Entry entry : response.getStringHeaders().entrySet()) { if (entry.getKey().toString().startsWith(RESTEasyTracing.HEADER_TRACING_PREFIX)) { LOG.info("<K, V> ->" + entry); hasTracing = true; break; } } assertTrue(hasTracing); response.close(); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>public synchronized void setLocation(ITmfLocation location) { if (location != null) { CtfIterator iterator = getIterator(); <START> iterator.seek(((CtfLocation) location).getLocationInfo()); <END> fCurLocation = iterator.getLocation(); } else { fCurLocation = null; } }</code><technical_language>instanceof here?? a thought</technical_language>

Target:
public synchronized void setLocation(ITmfLocation location) { if (location instanceof CtfLocation) { CtfIterator iterator = getIterator(); iterator.seek(((CtfLocation) location).getLocationInfo()); fCurLocation = iterator.getLocation(); } else { fCurLocation = null; } }
Source:
<code>public Options getOptions() { final Options opts = super.getOptions(); numThreadsOpt = new Option("nt", "num-threads", true, "number of threads to use"); negateOpt = new Option("v", "negate", false, "only include rows without search term"); <START> profileNameOpt = new Option("pn", "profile-name", true, <END> "only include rows from that iterator profile"); opts.addOption(numThreadsOpt); opts.addOption(negateOpt); opts.addOption(profileNameOpt); return opts; }</code><technical_language>completely sure, I earlier call super.getOptions(); add a profile option</technical_language>

Target:
public Options getOptions() { final Options opts = super.getOptions(); numThreadsOpt = new Option("nt", "num-threads", true, "number of threads to use"); negateOpt = new Option("v", "negate", false, "only include rows without search term"); opts.addOption(numThreadsOpt); opts.addOption(negateOpt); return opts; }
Source:
<code>public void proceedCommandExecution(Guid childCmdId) { ImageTransfer entity = imageTransferDao.get(getCommandId()); if (entity == null || entity.getPhase() == null) { log.error("Image transfer status entity corrupt or missing from database" + " for image transfer command '{}'", getCommandId()); setCommandStatus(CommandStatus.FAILED); return; } if (entity.getDiskId() != null) { <START> setImageId(entity.getDiskId()); <END> } long ts = System.currentTimeMillis() / 1000; if (pauseTransferIfNecessary(entity, ts)) { return; } executeStateHandler(entity, ts, childCmdId); }</code><technical_language>this unintentional</technical_language>

Target:
public void proceedCommandExecution(Guid childCmdId) { ImageTransfer entity = imageTransferDao.get(getCommandId()); if (entity == null || entity.getPhase() == null) { log.error("Image transfer status entity corrupt or missing from database" + " for image transfer command '{}'", getCommandId()); setCommandStatus(CommandStatus.FAILED); return; } if (entity.getDiskId() != null) { setImageGroupId(entity.getDiskId()); } long ts = System.currentTimeMillis() / 1000; if (pauseTransferIfNecessary(entity, ts)) { return; } executeStateHandler(entity, ts, childCmdId); }
Source:
<code>public ClientFailoverClasspathYamlConfig(ClassLoader classLoader, String resource, Properties properties) { <START> if (classLoader == null) { <END> throw new IllegalArgumentException("classLoader can't be null"); } if (resource == null) { throw new IllegalArgumentException("resource can't be null"); } if (properties == null) { throw new IllegalArgumentException("properties can't be null"); } LOGGER.info("Configuring Hazelcast Client Failover from '" + resource + "'."); InputStream in = classLoader.getResourceAsStream(resource); if (in == null) { throw new IllegalArgumentException("Specified resource '" + resource + "' could not be found!"); } YamlClientFailoverConfigBuilder configBuilder = new YamlClientFailoverConfigBuilder(in); configBuilder.setProperties(properties); configBuilder.build(this); }</code><technical_language>reuse Preconditions.checkNotNull for checks</technical_language>

Target:
public ClientFailoverClasspathYamlConfig(ClassLoader classLoader, String resource, Properties properties) { checkTrue(classLoader != null, "classLoader can't be null"); checkTrue(resource != null, "resource can't be null"); checkTrue(properties != null, "properties can't be null"); LOGGER.info("Configuring Hazelcast Client Failover from '" + resource + "'."); InputStream in = classLoader.getResourceAsStream(resource); checkTrue(in != null, "Specified resource '" + resource + "' could not be found!"); YamlClientFailoverConfigBuilder configBuilder = new YamlClientFailoverConfigBuilder(in); configBuilder.setProperties(properties); configBuilder.build(this); }
Source:
<code>private LinuxStyles() { ImmutableMap.Builder<String, LinuxStyle> builder = new Builder<>(); builder.put("UNKNOWN", new LinuxStyle(new RGB(100, 100, 100), 33)); builder.put("WAIT_UNKNOWN", new LinuxStyle(new RGB(200, 200, 200), 50)); builder.put("WAIT_BLOCKED", new LinuxStyle(new RGB(200, 200, 0), 50)); builder.put("WAIT_FOR_CPU", new LinuxStyle(new RGB(200, 100, 0), 50)); builder.put("IDLE", new LinuxStyle(new RGB(200, 200, 200), 66)); builder.put("USERMODE", new LinuxStyle(new RGB(0, 200, 0), 100)); builder.put("SYSCALL", new LinuxStyle(new RGB(0, 0, 200), 100)); LinuxStyle irqStyle = new LinuxStyle(new RGB(200, 0, 100), 75); <START> builder.put("INTERRUPTED", irqStyle); <END> builder.put("IRQ", irqStyle); builder.put("IRQ_ACTIVE", irqStyle); builder.put("SOFT_IRQ_RAISED", new LinuxStyle(new RGB(200, 200, 0), 100)); LinuxStyle softIrqStyle = new LinuxStyle(new RGB(200, 150, 100), 100); builder.put("SOFT_IRQ", softIrqStyle); builder.put("SOFT_IRQ_ACTIVE", softIrqStyle); fRegistry = builder.build(); }</code><technical_language>is irq style 3 states use. view style. resources view want style for 3 states, another view prefer differentiate them. 2 situations shows a counterexample of centralized registry. sub-states, for IRQ SOFTIRQs for instance, a basic state: IRQ, SOFTIRQ, sub-states depending level of details for a concept a view desires, sub-state state. RUNNING a base state SYSCALL a sub-state</technical_language>

Target:
private LinuxStyles() { ImmutableMap.Builder<String, LinuxStyle> builder = new Builder<>(); builder.put("UNKNOWN", new LinuxStyle(Messages.LinuxStyles_unknown, new RGB(100, 100, 100), 33)); builder.put("WAIT_UNKNOWN", new LinuxStyle(Messages.LinuxStyles_wait, new RGB(200, 200, 200), 50)); builder.put("WAIT_BLOCKED", new LinuxStyle(Messages.LinuxStyles_waitBlocked, new RGB(200, 200, 0), 50)); builder.put("WAIT_FOR_CPU", new LinuxStyle(Messages.LinuxStyles_waitForCPU, new RGB(200, 100, 0), 50)); builder.put("IDLE", new LinuxStyle(Messages.LinuxStyles_idle, new RGB(200, 200, 200), 66)); builder.put("USERMODE", new LinuxStyle(Messages.LinuxStyles_usermode, new RGB(0, 200, 0), 100)); builder.put("SYSCALL", new LinuxStyle(Messages.LinuxStyles_systemCall, new RGB(0, 0, 200), 100)); builder.put("INTERRUPTED", new LinuxStyle(Messages.LinuxStyles_Interrupt, new RGB(200, 0, 100), 75)); builder.put("IRQ", new LinuxStyle(Messages.LinuxStyles_Interrupt, new RGB(200, 0, 100), 75)); builder.put("IRQ_ACTIVE", new LinuxStyle(Messages.LinuxStyles_Interrupt, new RGB(200, 0, 100), 75)); builder.put("SOFT_IRQ_RAISED", new LinuxStyle(Messages.LinuxStyles_softIrqRaised, new RGB(200, 200, 0), 100)); builder.put("SOFT_IRQ", new LinuxStyle(Messages.LinuxStyles_softrq, new RGB(200, 150, 100), 100)); builder.put("SOFT_IRQ_ACTIVE", new LinuxStyle(Messages.LinuxStyles_softrq, new RGB(200, 150, 100), 100)); fRegistry = builder.build(); }
Source:
<code>public void testCreateSchema_Label_CodeReview() throws Exception { LabelType codeReview = getLabelTypes().byLabel("Code-Review"); assertNotNull(codeReview); assertEquals("Code-Review", codeReview.getName()); <START> assertEquals("R", codeReview.getAbbreviatedName()); <END> assertEquals("MaxWithBlock", codeReview.getFunctionName()); assertTrue(codeReview.isCopyMinScore()); assertValueRange(codeReview, 2, 1, 0, -1, -2); }</code><technical_language>CR</technical_language>

Target:
public void testCreateSchema_Label_CodeReview() throws Exception { LabelType codeReview = getLabelTypes().byLabel("Code-Review"); assertNotNull(codeReview); assertEquals("Code-Review", codeReview.getName()); assertEquals("CR", codeReview.getAbbreviatedName()); assertEquals("MaxWithBlock", codeReview.getFunctionName()); assertTrue(codeReview.isCopyMinScore()); assertValueRange(codeReview, 2, 1, 0, -1, -2); }
Source:
<code>default VoltDBPRel getInputNode(RelNode node, int childOrdinal) { RelNode inputNode = node.getInput(childOrdinal); if (inputNode != null) { if (inputNode instanceof RelSubset) { inputNode = ((RelSubset) inputNode).getBest(); <START> assert (inputNode != null); <END> } assert (inputNode instanceof VoltDBPRel); } return (VoltDBPRel) inputNode; }</code><technical_language>Objects.requireNotNull()</technical_language>

Target:
default VoltDBPRel getInputNode(RelNode node, int childOrdinal) { RelNode inputNode = node.getInput(childOrdinal); if (inputNode != null) { if (inputNode instanceof RelSubset) { inputNode = ((RelSubset) inputNode).getBest(); Objects.requireNonNull(inputNode); } Preconditions.checkArgument(inputNode instanceof VoltDBPRel); } return (VoltDBPRel) inputNode; }
Source:
<code>public void onInitialize(MatchingFrame frame, ISearchContext context) { Iterable<? extends Object> values = context.getRuntimeContext().enumerateValues(type, null); it = <START> Iterables.filter(values, Object.class).iterator(); <END> }</code><technical_language>is purpose of this filter</technical_language>

Target:
public void onInitialize(MatchingFrame frame, ISearchContext context) { Iterable<? extends Object> values = context.getRuntimeContext().enumerateValues(type, null); it = (Iterator<Object>) values.iterator(); }
Source:
<code>public void testPANBroadcastSerialDataReceiveSubscribedRx64() throws Exception { Mockito.when(rx64Packet.getReceiveOptions()).thenReturn(RECEIVE_OPTIONS_BROADCAST_PAN); dataReader.addSerialDatatReceiveListener(receiveSerialDataListener); Whitebox.invokeMethod(dataReader, PACKET_RECEIVED_METHOD, rx64Packet); PowerMockito.verifyPrivate(dataReader, Mockito.times(1)).invoke(NOTIFY_SERIAL_DATA_RECEIVED_METHOD, XBEE_64BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES, IS_BROADCAST_DATA); Mockito.verify(receiveSerialDataListener, Mockito.times(1)).broadcastSerialDataReceived(XBEE_64BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES); <START> <END> assertEquals(XBEE_64BIT_ADDRESS.toString(), receiveSerialDataListener.getAddress()); assertArrayEquals(RECEIVED_DATA_BYTES, receiveSerialDataListener.getSerialData()); }</code><technical_language>Add a check verify serialDataReceived method called</technical_language>

Target:
public void testPANBroadcastSerialDataReceiveSubscribedRx64() throws Exception { Mockito.when(rx64Packet.getReceiveOptions()).thenReturn(RECEIVE_OPTIONS_BROADCAST_PAN); dataReader.addSerialDatatReceiveListener(receiveSerialDataListener); Whitebox.invokeMethod(dataReader, PACKET_RECEIVED_METHOD, rx64Packet); PowerMockito.verifyPrivate(dataReader, Mockito.times(1)).invoke(NOTIFY_SERIAL_DATA_RECEIVED_METHOD, XBEE_64BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES, IS_BROADCAST_DATA); Mockito.verify(receiveSerialDataListener, Mockito.times(1)).broadcastSerialDataReceived(XBEE_64BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES); Mockito.verify(receiveSerialDataListener, Mockito.never()).serialDataReceived(Mockito.anyString(), (byte[])Mockito.any()); assertEquals(XBEE_64BIT_ADDRESS.toString(), receiveSerialDataListener.getAddress()); assertArrayEquals(RECEIVED_DATA_BYTES, receiveSerialDataListener.getSerialData()); }
Source:
<code>public Integer getMaxLength() { if (maxLength == null && getDataType().isArrayType() && PDataType.arrayBaseType(getDataType()).getByteSize() == null) { Object value = getValue(); if (value instanceof PhoenixArray) { <START> return ((PhoenixArray) value).getMaxLength(); <END> } } return maxLength; }</code><technical_language>type casting means good class hierarchy structure; call value.getMaxLength</technical_language>

Target:
public Integer getMaxLength() { if (maxLength == null && getDataType() != null && getDataType().isArrayType() && PDataType.arrayBaseType(getDataType()).getByteSize() == null) { Object value = getValue(); if (value instanceof PhoenixArray) { return ((PhoenixArray) value).getMaxLength(); } } return maxLength; }
Source:
<code>protected Map<String, List<Object>> extractPersonAttributes(final X509Certificate certificate) { val attributes = new LinkedHashMap<String, List<Object>>(); if (certificate != null) { if (StringUtils.isNotBlank(certificate.getSigAlgOID())) { attributes.put("sigAlgOid", CollectionUtils.wrapList(certificate.getSigAlgOID())); } val subjectDn = certificate.getSubjectDN(); if (subjectDn != null) { attributes.put("subjectDn", CollectionUtils.wrapList(subjectDn.getName())); } val subjectPrincipal = certificate.getSubjectX500Principal(); if (subjectPrincipal != null) { attributes.put("subjectX500Principal", CollectionUtils.wrapList(subjectPrincipal.getName())); } try { val rfc822Email = getRFC822EmailAddress(certificate.getSubjectAlternativeNames()); if (rfc822Email != null) { attributes.put("x509Rfc822Email", CollectionUtils.wrapList(rfc822Email)); } } catch (final CertificateParsingException e) { LOGGER.warn("Error parsing subject alternative names to get rfc822 email [{}]", e.getMessage()); } try { val x509subjectUPN = X509UPNExtractor.extractUPNString(certificate); if (x509subjectUPN != null) { attributes.put("x509subjectUPN", CollectionUtils.wrapList(x509subjectUPN)); } } catch (final CertificateParsingException e) { <START> LOGGER.warn("Error parsing subject alternative names to get User Principal Name as an attribute [{}]", e.getMessage()); <END> } } return attributes; }</code><technical_language>log stack trace please, debug trace levels</technical_language>

Target:
protected Map<String, List<Object>> extractPersonAttributes(final X509Certificate certificate) { val attributes = new LinkedHashMap<String, List<Object>>(); if (certificate != null) { if (StringUtils.isNotBlank(certificate.getSigAlgOID())) { attributes.put("sigAlgOid", CollectionUtils.wrapList(certificate.getSigAlgOID())); } val subjectDn = certificate.getSubjectDN(); if (subjectDn != null) { attributes.put("subjectDn", CollectionUtils.wrapList(subjectDn.getName())); } val subjectPrincipal = certificate.getSubjectX500Principal(); if (subjectPrincipal != null) { attributes.put("subjectX500Principal", CollectionUtils.wrapList(subjectPrincipal.getName())); } try { val rfc822Email = getRFC822EmailAddress(certificate.getSubjectAlternativeNames()); if (rfc822Email != null) { attributes.put("x509Rfc822Email", CollectionUtils.wrapList(rfc822Email)); } } catch (final CertificateParsingException e) { LOGGER.warn("Error parsing subject alternative names to get rfc822 email [{}]", e.getMessage(), LOGGER.isDebugEnabled() ? e : null); } try { val x509subjectUPN = X509UPNExtractorUtils.extractUPNString(certificate); if (x509subjectUPN != null) { attributes.put("x509subjectUPN", CollectionUtils.wrapList(x509subjectUPN)); } } catch (final CertificateParsingException e) { LOGGER.warn("Error parsing subject alternative names to get User Principal Name as an attribute [{}]", e.getMessage(), LOGGER.isDebugEnabled() ? e : null); } } return attributes; }
Source:
<code>public DIR.ServiceSet.Builder getOSDs(DIR.ServiceSet.Builder allOSDs, InetAddress clientIP, GlobalTypes.VivaldiCoordinates clientCoords, XLocList currentXLoc, int numOSDs, String path) { List<DIR.Service> allServices = allOSDs.getServicesList(); List<DIR.Service> returnList = new LinkedList<DIR.Service>(); if (!this.prefixToOSDMap.isEmpty()) { <START> int prefixLength = path.lastIndexOf("/"); <END> String filePrefix = path.substring(0, prefixLength); for (String prefix : this.prefixToOSDMap.keySet()) { if (prefix.endsWith(filePrefix) || filePrefix.endsWith(prefix)) { for (DIR.Service osd : allServices) { String currentUUID = new ServiceUUID(osd.getUuid()).toString(); if (currentUUID.equals(this.prefixToOSDMap.get(prefix))) { returnList.add(osd); break; } } break; } } } if (returnList.isEmpty()) { returnList.addAll(allServices); } return DIR.ServiceSet.newBuilder().addAllServices(returnList); }</code><technical_language>path Unix-style separators</technical_language>

Target:
public DIR.ServiceSet.Builder getOSDs(DIR.ServiceSet.Builder allOSDs, InetAddress clientIP, GlobalTypes.VivaldiCoordinates clientCoords, XLocList currentXLoc, int numOSDs, String path) { if (path == null) { return allOSDs; } List<DIR.Service> allServices = allOSDs.getServicesList(); List<DIR.Service> returnList = new LinkedList<DIR.Service>(); if (!this.prefixToOSDMap.isEmpty()) { int locationLength = path.lastIndexOf("/"); String fileLocationOnVolume = path.substring(0, locationLength); for (String prefix : this.prefixToOSDMap.keySet()) { if (fileLocationOnVolume.startsWith(prefix)) { for (DIR.Service osd : allServices) { String currentUUID = new ServiceUUID(osd.getUuid()).toString(); if (currentUUID.equals(this.prefixToOSDMap.get (prefix))) { returnList.add(osd); break; } } break; } } } if (returnList.isEmpty()) { returnList.addAll(allServices); } return DIR.ServiceSet.newBuilder().addAllServices(returnList); }
Source:
<code>public String toString() { <START> return String.format("%30s: %s", this.getClass().getSimpleName(), getStatus()); <END> }</code><technical_language>Another I thinking in this context is if pairs of state changes DisableDepthWriting EnableDepthWriting longer need getStatus in this line, class name enough</technical_language>

Target:
public String toString() { return String.format("%30s", this.getClass().getSimpleName()); }
Source:
<code>public void await() { try { latch.await(); } catch (InterruptedException ex) { limitListener.onIgnore(); <START> throw new ThrottleException(ex); <END> } }</code><technical_language>I replace this a normal runtime exception a message "Interrupted while blocking a throttled call" (after setting interrupt status thread)</technical_language>

Target:
void await() { try { latch.await(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); limitListener.onIgnore(); throw new RuntimeException("Interrupted while blocking on a throttled call", e); } }
Source:
<code>public void generateImages(EmptyTask executingThread, Task task, boolean automatic) throws DataException { Process process = task.getProcess(); ImageGenerator generator = new ImageGenerator(new Subfolder(process, process.getProject().getGeneratorSource()), GenerationMode.ALL, SubfolderFactoryService.createAll(process, task.getContentFolders())); generator.setSupervisor(executingThread); if (automatic) { if (executingThread.getException() == null) { <START> task.setEditType(TaskEditType.AUTOMATIC.getValue()); <END> task.setProcessingStatus(TaskStatus.DONE.getValue()); } else { task.setEditType(TaskEditType.AUTOMATIC.getValue()); task.setProcessingStatus(TaskStatus.OPEN.getValue()); save(task); } } }</code><technical_language>In cases TaskEditType is set up. In case set if</technical_language>

Target:
public void generateImages(EmptyTask executingThread, Task task, boolean automatic) throws DataException { try { Process process = task.getProcess(); Subfolder sourceFolder = new Subfolder(process, process.getProject().getGeneratorSource()); List<Subfolder> foldersToGenerate = SubfolderFactoryService.createAll(process, task.getContentFolders()); ImageGenerator generator = new ImageGenerator(sourceFolder, GenerationMode.ALL, foldersToGenerate); generator.setSupervisor(executingThread); generator.run(); finishOrReturnAutomaticTask(task, automatic, executingThread.getException() == null); } catch (IOException e) { Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); } }
Source:
<code>public int compareTo( PointValue other ) { int cmpCRS = this.crs.code - other.crs.code; if ( cmpCRS != 0 ) { return cmpCRS; <START> } <END> if ( this.coordinate.length > other.coordinate.length ) { return 1; } else if ( this.coordinate.length < other.coordinate.length ) { return -1; } for ( int i = 0; i < coordinate.length; i++ ) { int cmpVal = (int) (this.coordinate[i] - other.coordinate[i]); if ( cmpVal != 0 ) { return cmpVal; } } return 0; }</code><technical_language>strange formatting</technical_language>

Target:
public int compareTo( PointValue other ) { int cmpCRS = this.crs.getCode() - other.crs.getCode(); if ( cmpCRS != 0 ) { return cmpCRS; } if ( this.coordinate.length > other.coordinate.length ) { return 1; } else if ( this.coordinate.length < other.coordinate.length ) { return -1; } for ( int i = 0; i < coordinate.length; i++ ) { int cmpVal = (int) (this.coordinate[i] - other.coordinate[i]); if ( cmpVal != 0 ) { return cmpVal; } } return 0; }
Source:
<code>private EhcacheEntityResponse invokeInternal(TimeoutDuration timeLimit, EhcacheEntityMessage message, boolean replicate) throws ClusteredEhcacheException, TimeoutException { try { EhcacheEntityResponse response = waitFor(timeLimit, invokeAsync(message, replicate)); if (Type.FAILURE.equals(response.getType())) { <START> throw ((Failure)response).getCause().withClientStackTrace(); <END> } else { return response; } } catch (EntityException e) { throw new RuntimeException(message + " error: " + e.toString(), e); } catch (MessageCodecException e) { throw new RuntimeException(message + " error: " + e.toString(), e); } catch (TimeoutException e) { String msg = "Timeout exceeded for " + getMessageOp(message) + " message; " + timeLimit; TimeoutException timeoutException = new TimeoutException(msg); timeoutException.initCause(e); LOGGER.info(msg, timeoutException); throw timeoutException; } }</code><technical_language>push withClientStackTrace() Response.decode method directly</technical_language>

Target:
private EhcacheEntityResponse invokeInternal(TimeoutDuration timeLimit, EhcacheEntityMessage message, boolean replicate) throws ClusterException, TimeoutException { try { EhcacheEntityResponse response = waitFor(timeLimit, invokeAsync(message, replicate)); if (Type.FAILURE.equals(response.getType())) { throw ((Failure)response).getCause(); } else { return response; } } catch (EntityException e) { throw new RuntimeException(message + " error: " + e.toString(), e); } catch (MessageCodecException e) { throw new RuntimeException(message + " error: " + e.toString(), e); } catch (TimeoutException e) { String msg = "Timeout exceeded for " + getMessageOp(message) + " message; " + timeLimit; TimeoutException timeoutException = new TimeoutException(msg); timeoutException.initCause(e); LOGGER.info(msg, timeoutException); throw timeoutException; } }
Source:
<code>public void doHead(SlingHttpServletRequest request, SlingHttpServletResponse response) { try{ ResourceResolver resourceResolver = request.getResourceResolver(); String requestUri = request.getParameter( "uri" ); log.debug( "Checking access for URI {}", requestUri ); Resource requestedResource = resourceResolver.resolve( request, requestUri ); if( !ResourceUtil.isNonExistingResource( requestedResource ) ){ <START> log.info("Current Session has access to {}", requestUri ); <END> response.setStatus(SlingHttpServletResponse.SC_OK); } else { log.info("Current Session does not have access to {}", requestUri ); response.setStatus(SlingHttpServletResponse.SC_UNAUTHORIZED); } } catch(Exception e) { log.error("authchecker servlet exception: " + e.getMessage()); response.setStatus( SlingHttpServletResponse.SC_UNAUTHORIZED ); } }</code><technical_language>I @davidjgonzalez suggested change this debug info, questioning suggestion :) auth checker servlet get called request dispatcher? If so, this noisy</technical_language>

Target:
public void doHead(SlingHttpServletRequest request, SlingHttpServletResponse response) { try{ ResourceResolver resourceResolver = request.getResourceResolver(); String requestUri = request.getParameter( "uri" ); log.debug( "Checking access for URI {}", requestUri ); if( isUriValid( requestUri ) ){ Resource requestedResource = resourceResolver.resolve( request, requestUri ); if( !ResourceUtil.isNonExistingResource( requestedResource ) ){ log.debug("Current Session has access to {}", requestUri ); response.setStatus(SlingHttpServletResponse.SC_OK); } else { log.info("Current Session does not have access to {}", requestUri ); response.setStatus(SlingHttpServletResponse.SC_UNAUTHORIZED); } } else { log.debug( "Invalid URI {}", requestUri ); response.setStatus( SlingHttpServletResponse.SC_UNAUTHORIZED ); } } catch(Exception e) { log.error("Authchecker servlet exception", e); response.setStatus( SlingHttpServletResponse.SC_UNAUTHORIZED ); } }
Source:
<code>public Future<Long> readInto(AsyncWritableChannel asyncWritableChannel, Callback<Long> callback) { if (callbackWrapper != null) { throw new IllegalStateException("ReadableStreamChannel cannot be read more than once"); <START> } else if (isOpen() && !readyForRead) { <END> throw new IllegalStateException("The channel cannot be read yet"); } callbackWrapper = new ReadIntoCallbackWrapper(callback); if (!isOpen()) { nettyMetrics.multipartRequestAlreadyClosedError.inc(); callbackWrapper.invokeCallback(new ClosedChannelException()); } while (requestContents.peek() != null) { writeContent(asyncWritableChannel, callbackWrapper, requestContents.peek()); ReferenceCountUtil.release(requestContents.poll()); } return callbackWrapper.futureResult; }</code><technical_language>do duplicate checks for isOpen. line 88</technical_language>

Target:
public Future<Long> readInto(AsyncWritableChannel asyncWritableChannel, Callback<Long> callback) { if (callbackWrapper != null) { throw new IllegalStateException("ReadableStreamChannel cannot be read more than once"); } else if (!readyForRead) { throw new IllegalStateException("The channel cannot be read yet"); } callbackWrapper = new ReadIntoCallbackWrapper(callback); if (!isOpen()) { nettyMetrics.multipartRequestAlreadyClosedError.inc(); callbackWrapper.invokeCallback(new ClosedChannelException()); } HttpContent content = requestContents.poll(); while (content != null) { try { writeContent(asyncWritableChannel, callbackWrapper, content); } finally { ReferenceCountUtil.release(content); } content = requestContents.poll(); } return callbackWrapper.futureResult; }
Source:
<code>public <T> T getValue(ConfigValues name, String version) { T returnValue; Map<String, Object> values = null; <START> if ((values = _vdcOptionCache.get(name.toString())) != null && (values.containsKey(version))) { <END> returnValue = (T) values.get(version); } else { VdcOption option = new VdcOption(); option.setoption_name(name.toString()); option.setoption_value(null); returnValue = (T) getValue(option); if (values != null) { values.put(version, returnValue); } else { Map<String, Object> defaultValues = new HashMap<String, Object>(); defaultValues.put(version, returnValue); _vdcOptionCache.put(option.getoption_name(), defaultValues); log.debug("Adding new value to configuration cache."); } log.debugFormat("Didn't find the value of {0} in DB for version {1} - using default: {2}", name, version, returnValue); } return returnValue; }</code><technical_language>this change removed completely</technical_language>

Target:
public <T> T getValue(ConfigValues name, String version) { T returnValue; Map<String, Object> values = null; if ((values = _vdcOptionCache.get(name.toString())) != null && values.containsKey(version)) { returnValue = (T) values.get(version); } else { VdcOption option = new VdcOption(); option.setoption_name(name.toString()); option.setoption_value(null); returnValue = (T) getValue(option); if (values != null) { values.put(version, returnValue); } else { Map<String, Object> defaultValues = new HashMap<String, Object>(); defaultValues.put(version, returnValue); _vdcOptionCache.put(option.getoption_name(), defaultValues); log.debug("Adding new value to configuration cache."); } log.debugFormat("Didn't find the value of {0} in DB for version {1} - using default: {2}", name, version, returnValue); } return returnValue; }
Source:
<code>public void testLoadTarget() throws CoreException { IApiBaseline baseline = ApiModelFactory.newApiBaselineFromTarget(getClass().getName(), definition, null); <START> assertTrue("This baseline should be appear to be from a target definition", ApiModelFactory.isDerivedFromTarget(baseline)); END> assertTrue("This baseline should be from this particular target definition", ApiModelFactory.isDerivedFromTarget(baseline, definition)); assertTrue(baseline.getApiComponents().length >= 3); }</code><technical_language>..should appear..</technical_language>

Target:
public void testLoadTarget() throws CoreException { IApiBaseline baseline = ApiModelFactory.newApiBaselineFromTarget(getClass().getName(), definition, null); assertTrue("This baseline should appear to be from a target definition", ApiModelFactory.isDerivedFromTarget(baseline)); assertTrue("This baseline should be from this particular target definition", ApiModelFactory.isDerivedFromTarget(baseline, definition)); assertTrue(baseline.getApiComponents().length >= 3); }
Source:
<code>private <T extends FlagAffectedCommand & TopologyAffectedCommand> LocalizedCacheTopology checkTopology(T command) { LocalizedCacheTopology cacheTopology = distributionManager.getCacheTopology(); <START> if (cacheTopology == null) { <END> return null; } if (!command.hasAnyFlag(FlagBitSets.SKIP_OWNERSHIP_CHECK) && command.getTopologyId() >= 0 && command.getTopologyId() != cacheTopology.getTopologyId()) { throw new OutdatedTopologyException("Command topology: " + command.getTopologyId() + ", cache topology: " + cacheTopology.getTopologyId()); } else if (trace) { log.tracef("%s has topology %d (current is %d)", command, command.getTopologyId(), cacheTopology.getTopologyId()); } return cacheTopology; }</code><technical_language>I cache topology is null. case do in mind</technical_language>

Target:
private <T extends FlagAffectedCommand & TopologyAffectedCommand> LocalizedCacheTopology checkTopology(T command) { LocalizedCacheTopology cacheTopology = distributionManager.getCacheTopology(); if (!command.hasAnyFlag(FlagBitSets.SKIP_OWNERSHIP_CHECK) && command.getTopologyId() >= 0 && command.getTopologyId() != cacheTopology.getTopologyId()) { throw new OutdatedTopologyException(command.getTopologyId()); } else if (trace) { log.tracef("%s has topology %d (current is %d)", command, command.getTopologyId(), cacheTopology.getTopologyId()); } return cacheTopology; }
Source:
<code>private void init() { try (InputStream serviceAccount = new ClassPathResource( yonaProperties.getSecurity().getFirebaseAdminServiceAccountKeyFile()).getInputStream()) { FirebaseOptions options = new FirebaseOptions.Builder().setCredentials(GoogleCredentials.fromStream(serviceAccount)) .setDatabaseUrl(yonaProperties.getFirebaseDatabaseUrl()).build(); FirebaseApp.initializeApp(options); } catch (IOException e) { <START> logger.error("Error initializing Firebase client", e); <END> } }</code><technical_language>startup fail of this fails? is enable/disable Firebase support. I propose add extra property isFirebaseEnabled, is false default. If is true, initialization able read configuration file. If false, this init method logs informational message indicating Firebase is disabled</technical_language>

Target:
private void init() { if (!yonaProperties.getFirebase().isEnabled()) { logger.info("Firebase is disabled"); return; } try (InputStream serviceAccount = new ClassPathResource(yonaProperties.getFirebase().getAdminServiceAccountKeyFile()) .getInputStream()) { FirebaseOptions options = new FirebaseOptions.Builder().setCredentials(GoogleCredentials.fromStream(serviceAccount)) .setDatabaseUrl(yonaProperties.getFirebase().getDatabaseUrl()).build(); FirebaseApp.initializeApp(options); } catch (IOException e) { throw YonaException.unexpected(e); } }
Source:
<code>private void monitor(ClientEndpoint clientEndpoint) { <START> if (clientEndpoint.isOwnerConnection() && ClientType.CPP.equals(clientEndpoint.getClientType())) { <END> return; } Connection connection = clientEndpoint.getConnection(); long lastTimePacketReceived = connection.lastReadTimeMillis(); long timeoutInMillis = SECONDS.toMillis(heartbeatTimeoutSeconds); long currentTimeMillis = Clock.currentTimeMillis(); if (lastTimePacketReceived + timeoutInMillis < currentTimeMillis) { String message = "Client heartbeat is timed out, closing connection to " + connection + ". Now: " + timeToString(currentTimeMillis) + ". LastTimePacketReceived: " + timeToString(lastTimePacketReceived); connection.close(message, null); } }</code><technical_language>CPP client works a single connection CPP client 3.10, add version check this condition? if (cppClientVersion < 3.10 noClientVersionExist...</technical_language>

Target:
private void monitor(ClientEndpoint clientEndpoint) { if (clientEndpoint.isOwnerConnection() && ClientType.CPP.equals(clientEndpoint.getClientType()) && clientEndpoint.getClientVersion() < BuildInfo.calculateVersion("3.10")) { return; } Connection connection = clientEndpoint.getConnection(); long lastTimePacketReceived = connection.lastReadTimeMillis(); long timeoutInMillis = SECONDS.toMillis(heartbeatTimeoutSeconds); long currentTimeMillis = Clock.currentTimeMillis(); if (lastTimePacketReceived + timeoutInMillis < currentTimeMillis) { String message = "Client heartbeat is timed out, closing connection to " + connection + ". Now: " + timeToString(currentTimeMillis) + ". LastTimePacketReceived: " + timeToString(lastTimePacketReceived); connection.close(message, null); } }