auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public synchronized void allHostNTProcedureCallback(ClientResponse clientResponse) { int hostId = Integer.parseInt(clientResponse.getAppStatusString()); boolean removed = m_outstandingAllHostProcedureHostIds.remove(hostId); <START> assert(removed); END> final Map<Integer,ClientResponse> allHostResponses = m_allHostResponses; m_allHostResponses.put(hostId, clientResponse); if (m_outstandingAllHostProcedureHostIds.size() == 0) { m_outstandingAllHostProc.set(false); m_executorService.submit(new Runnable() { @Override public void run() { m_allHostFut.complete(allHostResponses); } }); } }</code><technical_language>Handle this</technical_language>

Target:
public synchronized void allHostNTProcedureCallback(ClientResponse clientResponse) { int hostId = Integer.parseInt(clientResponse.getAppStatusString()); boolean removed = m_outstandingAllHostProcedureHostIds.remove(hostId); if (!removed) { Log.error(String.format( "ProcedureRunnerNT.allHostNTProcedureCallback for procedure %s received late or unexepected response from hostID %d.", m_procedureName, hostId)); return; } final Map<Integer,ClientResponse> allHostResponses = m_allHostResponses; m_allHostResponses.put(hostId, clientResponse); if (m_outstandingAllHostProcedureHostIds.size() == 0) { m_outstandingAllHostProc.set(false); m_executorService.submit(new Runnable() { @Override public void run() { m_allHostFut.complete(allHostResponses); } }); } }
Source:
<code>public Optional<TextureData> getAssetData(ResourceUrn urn) throws IOException { <START> if (TerasologyConstants.ENGINE_MODULE.equals(urn.getModuleName()) && TextureUtil.EMPTY_RESOURCE_NAME.equals(urn.getResourceName())) { <END> Name fragmentName = urn.getFragmentName(); if (!fragmentName.isEmpty()) { String[] parts = fragmentName.toLowerCase().split("\\."); if (parts.length == 3) { int width = Integer.parseInt(parts[0]); int height = Integer.parseInt(parts[1]); return Optional.of(new TextureData(width,height, Texture.WrapMode.CLAMP, Texture.FilterMode.LINEAR)); } } } return Optional.empty(); }</code><technical_language>I assume this condensed a single URN equals check</technical_language>

Target:
public Optional<TextureData> getAssetData(ResourceUrn urn) throws IOException { if (TerasologyConstants.ENGINE_MODULE.equals(urn.getModuleName()) && TextureUtil.EMPTY_RESOURCE_NAME.equals(urn.getResourceName())) { Name fragmentName = urn.getFragmentName(); if (!fragmentName.isEmpty()) { String[] parts = fragmentName.toLowerCase().split("\\."); if (parts.length == 3) { int width = Integer.parseInt(parts[0]); int height = Integer.parseInt(parts[1]); return Optional.of(new TextureData(width,height, Texture.WrapMode.CLAMP, Texture.FilterMode.LINEAR)); } } } logger.info("illegal texture urn:" + urn.toString()); return Optional.empty(); }
Source:
<code>protected Object callMethod(Object instance, Method method, Object[] convertedArgs) throws Throwable { try { Object result; if (instance instanceof InteractionAwareFixture) { <START> result = ((InteractionAwareFixture)instance).aroundSlimInvoke(this, method, convertedArgs); <END> } else { result = methodInvoke(method, instance, convertedArgs); } return result; } catch (InvocationTargetException e) { if(e.getCause() != null){ throw e.getCause(); }else{ throw e.getTargetException(); } } }</code><technical_language>infinite loop occur. fixture is supposed delegate interaction.methodInvoke(), do interactionAwareFixture handling. fears unfounded: problem exist</technical_language>

Target:
protected Object callMethod(Object instance, Method method, Object[] convertedArgs) throws Throwable { try { Object result; if (instance instanceof InteractionAwareFixture) { Object[] args = { this, method, convertedArgs }; result = methodInvoke(AROUND_METHOD, instance, args); } else { result = methodInvoke(method, instance, convertedArgs); } return result; } catch (InvocationTargetException e) { if(e.getCause() != null){ throw e.getCause(); }else{ throw e.getTargetException(); } } }
Source:
<code>private int <START> moveDexFilesLI(PackageParser.Package <END> newPackage) { if ((newPackage.applicationInfo.flags&ApplicationInfo.FLAG_HAS_CODE) != 0) { int retCode = mInstaller.movedex(newPackage.mScanPath, newPackage.mPath); if (retCode != 0) { mInstaller.rmdex(newPackage.mPath); } } return PackageManager.INSTALL_SUCCEEDED; }</code><technical_language>Hmm. implications of making this method pretend succeed? if movedex() fails, rmdex() new path, pretending move succeeded</technical_language>

Target:
private int moveDexFilesLI(PackageParser.Package newPackage) { if ((newPackage.applicationInfo.flags&ApplicationInfo.FLAG_HAS_CODE) != 0) { final String instructionSet = getAppInstructionSet(newPackage.applicationInfo); int retCode = mInstaller.movedex(newPackage.mScanPath, newPackage.mPath, instructionSet); if (retCode != 0) { mInstaller.rmdex(newPackage.mPath, instructionSet); } } return PackageManager.INSTALL_SUCCEEDED; }
Source:
<code>private DataSource ff4jDataSource() throws NamingException, SQLException { Context ctx = new InitialContext(); <START> DataSource ds = (DataSource) ctx.lookup("java:/comp/env/jdbc/openchpl"); <END> return (DataSource) ds; }</code><technical_language>a property for this: jndiName</technical_language>

Target:
private DataSource ff4jDataSource() throws NamingException, SQLException { Context ctx = new InitialContext(); DataSource ds = (DataSource) ctx.lookup(env.getProperty("jndiName")); return (DataSource) ds; }
Source:
<code>protected void configureCache(ConfigurationBuilder builder) { <START> builder.statistics().available(false); <END> if (transactional != null) { builder.transaction().transactionMode(transactionMode()); if (lockingMode != null) { builder.transaction().lockingMode(lockingMode); } } if (isolationLevel != null) { builder.locking().isolationLevel(isolationLevel); } if (persistence) { builder.persistence().addStore(DummyInMemoryStoreConfigurationBuilder.class); builder.persistence().passivation(passivation); } }</code><technical_language>good know, I tests specifically stats in functional maps</technical_language>

Target:
protected void configureCache(ConfigurationBuilder builder) { builder.statistics().enabled(true); if (transactional != null) { builder.transaction().transactionMode(transactionMode()); if (lockingMode != null) { builder.transaction().lockingMode(lockingMode); } } if (isolationLevel != null) { builder.locking().isolationLevel(isolationLevel); } if (persistence) { builder.persistence().addStore(DummyInMemoryStoreConfigurationBuilder.class); builder.persistence().passivation(passivation); } }
Source:
<code>void registerOp(final LongKeyOperation operation, final int numSubOperations) { if (operation.isFromLocalClient()) { final LongKeyOperation unhandledOperation = ongoingOp.put(operation.getOperationId(), operation); if (unhandledOperation != null) { LOG.log(Level.SEVERE, "Discard the exceptionally unhandled operation: {0}", unhandledOperation); } } operation.setNumSubOps(numSubOperations); <START> <END> }</code><technical_language>remove black line</technical_language>

Target:
void registerOp(final LongKeyOperation operation, final int numSubOperations) { if (operation.isFromLocalClient()) { final LongKeyOperation unhandledOperation = ongoingOp.put(operation.getOperationId(), operation); if (unhandledOperation != null) { LOG.log(Level.SEVERE, "Discard the exceptionally unhandled operation: {0}", unhandledOperation.getOperationId()); } } operation.setNumSubOps(numSubOperations); }
Source:
<code>public List<BlockMetaData> visit(FilterCompat.FilterPredicateCompat filterPredicateCompat) { <START> if (skipStatisticsChecks) { <END> return blocks; } FilterPredicate filterPredicate = filterPredicateCompat.getFilterPredicate(); SchemaCompatibilityValidator.validate(filterPredicate, schema); List<BlockMetaData> filteredBlocks = new ArrayList<BlockMetaData>(); for (BlockMetaData block : blocks) { if (!StatisticsFilter.canDrop(filterPredicate, block.getColumns())) { filteredBlocks.add(block); } } return filteredBlocks; }</code><technical_language>this skip statistics, a lot of cases statistics valid. I need skipped underlying column type is binary, fixed, int96 other objects immutable (string) primitives. In case, checks ignore statistics for potentially corrupted columns</technical_language>

Target:
public List<BlockMetaData> visit(FilterCompat.FilterPredicateCompat filterPredicateCompat) { FilterPredicate filterPredicate = filterPredicateCompat.getFilterPredicate(); SchemaCompatibilityValidator.validate(filterPredicate, schema); List<BlockMetaData> filteredBlocks = new ArrayList<BlockMetaData>(); for (BlockMetaData block : blocks) { if (!StatisticsFilter.canDrop(filterPredicate, block.getColumns())) { filteredBlocks.add(block); } } return filteredBlocks; }
Source:
<code>public void initializeParsers(ExtensionParsingContext context) { context.setSubsystemXmlMapping(SUBSYSTEM_NAME, MessagingSubsystemParser_1_0.NAMESPACE, MessagingSubsystemParser_1_0::new); context.setSubsystemXmlMapping(SUBSYSTEM_NAME, MessagingSubsystemParser_2_0.NAMESPACE, MessagingSubsystemParser_2_0::new); <START> context.setSubsystemXmlMapping(SUBSYSTEM_NAME, MessagingSubsystemParser_3_0.NAMESPACE, MessagingSubsystemParser_3_0::new); <END> }</code><technical_language>Please new MessagingSubsystemParser_3_0(), method reference for other versions. This is a bit of black art. a Supplier is used, ExtensionRegistry is able detect of a PersistentResourceXMLParser triggers a call getParserDescription(). object call happen extension initialization, is part of parallelized part of boot, deferred parsing, is single-threaded. a getParserDescription() impl typically results in a of loading of classes extension impl, execution of static initialization therein, etc, a pretty decent boot time gain out of single threaded parts of boot. a Supplier for legacy versions prevents pointless execution of code for those. a small metaspace cost though. Tradeoffs. :) (One of goals for next-gen declarative subsystem dev is this stuff right automagic, this is black art now. I added ExtensionRegistry trick late in WF 11 cycle for small boot time gains.)</technical_language>

Target:
public void initializeParsers(ExtensionParsingContext context) { context.setSubsystemXmlMapping(SUBSYSTEM_NAME, MessagingSubsystemParser_1_0.NAMESPACE, MessagingSubsystemParser_1_0::new); context.setSubsystemXmlMapping(SUBSYSTEM_NAME, MessagingSubsystemParser_2_0.NAMESPACE, MessagingSubsystemParser_2_0::new); context.setSubsystemXmlMapping(SUBSYSTEM_NAME, MessagingSubsystemParser_3_0.NAMESPACE, PARSER); }
Source:
<code><START> public void testReplaceValueUnequalStoreEntryEqualCacheWriterEntry() throws Exception { <END> final FakeStore realStore = new FakeStore(Collections.singletonMap("key", "unequalValue")); this.store = spy(realStore); final FakeCacheWriter realCache = new FakeCacheWriter(Collections.singletonMap("key", "oldValue")); final Ehcache<String, String> ehcache = this.getEhcache(realCache); assertFalse(ehcache.replace("key", "oldValue", "newValue")); verify(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); verifyZeroInteractions(this.spiedResilienceStrategy); assertThat(realStore.getEntryMap().get("key"), is(equalTo("unequalValue"))); assertThat(realCache.getEntryMap().get("key"), is(equalTo("oldValue"))); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.ReplaceOutcome.MISS)); }</code><technical_language>Broken initial state - I delete this test</technical_language>

Target:
public void testReplaceValueUnequalStoreEntryEqualCacheWriterEntry() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.singletonMap("key", "unequalValue")); this.store = spy(fakeStore); final FakeCacheWriter fakeWriter = new FakeCacheWriter(Collections.singletonMap("key", "oldValue")); final Ehcache<String, String> ehcache = this.getEhcache(fakeWriter); assertFalse(ehcache.replace("key", "oldValue", "newValue")); verify(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); verifyZeroInteractions(this.spiedResilienceStrategy); assertThat(fakeStore.getEntryMap().get("key"), is(equalTo("unequalValue"))); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.ReplaceOutcome.MISS)); }
Source:
<code>public void init(Config config, TaskContext context) { final SystemStreamPartition ssp = Iterables.getFirst(context.getSystemStreamPartitions(), null); <START> if (ssp == null ? false : ssp.getPartition().getPartitionId() == 0) { <END> final int count = checkEachTask ? context.getSamzaContainerContext().taskNames.size() : 1; LATCHES.put(id, new CountDownLatch(count)); timer.schedule(timerTask, TIMEOUT); } }</code><technical_language>a more readable instead of a ternary here: e.g. if (ssp != null || ssp.getPartition().getPartitionId() == 0)</technical_language>

Target:
public void init(Config config, TaskContext context) { final SystemStreamPartition ssp = Iterables.getFirst(context.getSystemStreamPartitions(), null); if (ssp != null || ssp.getPartition().getPartitionId() == 0) { final int count = checkEachTask ? context.getSamzaContainerContext().taskNames.size() : 1; LATCHES.put(id, new CountDownLatch(count)); timer.schedule(timerTask, TIMEOUT); } }
Source:
<code>private MimeMessage[] filterMessagesThruSelector(Message[] messages) throws MessagingException { List<Message> filteredMessages = new LinkedList<Message>(); for (int i = 0; i < messages.length; i++) { MimeMessage message = (MimeMessage) messages[i]; if (this.selectorExpression != null) { if (this.selectorExpression.getValue(this.evaluationContext, message, Boolean.class)) { filteredMessages.add(message); } else { if (this.logger.isDebugEnabled()) { this.logger.debug("Fetched email with subject '" + message.getSubject() + "' will be discarded by the matching filter" + " and will not be flagged as SEEN."); } } } else { filteredMessages.add(message); } } <START> return filteredMessages.toArray(new MimeMessage[filteredMessages.size()]); <END> }</code><technical_language>IDEA previous state. do explicit message cast anyway, prefer filteredMessages a List<MimeMessage>, avoid noise IDE. some warn compiler matter..</technical_language>

Target:
private MimeMessage[] filterMessagesThruSelector(Message[] messages) throws MessagingException { List<MimeMessage> filteredMessages = new LinkedList<MimeMessage>(); for (int i = 0; i < messages.length; i++) { MimeMessage message = (MimeMessage) messages[i]; if (this.selectorExpression != null) { if (this.selectorExpression.getValue(this.evaluationContext, message, Boolean.class)) { filteredMessages.add(message); } else { if (this.logger.isDebugEnabled()) { this.logger.debug("Fetched email with subject '" + message.getSubject() + "' will be discarded by the matching filter" + " and will not be flagged as SEEN."); } } } else { filteredMessages.add(message); } } return filteredMessages.toArray(new MimeMessage[filteredMessages.size()]); }
Source:
<code>public Court getByCourtId(Long courtId) { <START> Map<String, Object> parameterMap = new HashMap<String, Object>(); <END> parameterMap.put("courtId", courtId); String sql = "SELECT * FROM courts WHERE id = :courtId"; Court court = jdbcTemplate.queryForObject(sql, parameterMap, new CourtSQLMapper()); return court; }</code><technical_language>This try/catch need here, if not, another level - Manager catch re-throw a NotFoundException something</technical_language>

Target:
public Court getByCourtId(Long courtId){ try{ Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("courtId", courtId); String sql = "SELECT * FROM courts WHERE id = :courtId"; Court court = jdbcTemplate.queryForObject(sql, parameterMap, new CourtSQLMapper()); return court; }catch (Exception e){ return null; } }
Source:
<code>protected String resolveJava(SlaveComputer computer, TaskListener listener) throws InterruptedException, IOException2 { if (StringUtils.isNotBlank(javaPath)) { return expandExpression(computer, javaPath); } final String workingDirectory = getWorkingDirectory(computer); if (workingDirectory == null) { throw new IOException2("Cannot retrieve a working directory of " + computer, null); } List<String> tried = new ArrayList<String>(); for (JavaProvider provider : JavaProvider.all()) { for (String javaCommand : provider.getJavas(computer, listener, connection)) { LOGGER.fine("Trying Java at "+javaCommand); try { tried.add(javaCommand); <START> String java = checkJavaVersion(listener, javaCommand); <END> return java; } catch (IOException e) { LOGGER.log(FINE, "Failed to check the Java version",e); } } } try { return attemptToInstallJDK(listener, workingDirectory); } catch (IOException e) { throw new IOException2("Could not find any known supported java version in "+tried+", and we also failed to install JDK as a fallback",e); } }</code><technical_language>return it</technical_language>

Target:
protected String resolveJava(SlaveComputer computer, TaskListener listener) throws InterruptedException, IOException2 { if (StringUtils.isNotBlank(javaPath)) { return expandExpression(computer, javaPath); } final String workingDirectory = getWorkingDirectory(computer); if (workingDirectory == null) { throw new IOException2("Cannot retrieve a working directory of " + computer, null); } List<String> tried = new ArrayList<String>(); for (JavaProvider provider : JavaProvider.all()) { for (String javaCommand : provider.getJavas(computer, listener, connection)) { LOGGER.fine("Trying Java at "+javaCommand); try { tried.add(javaCommand); return checkJavaVersion(listener, javaCommand); } catch (IOException e) { LOGGER.log(FINE, "Failed to check the Java version",e); } } } try { return attemptToInstallJDK(listener, workingDirectory); } catch (IOException e) { throw new IOException2("Could not find any known supported java version in "+tried+", and we also failed to install JDK as a fallback",e); } }
Source:
<code>private void addHumanResourcesSubmenu(List<Action> actions) { <START> if (getTaskSelectionManager().getSelectedTasks().size()==1) { <END> Task task = getTaskSelectionManager().getSelectedTasks().get(0); HumanResource[] myResources = myProject.getHumanResourceManager().getResourcesArray(); ArrayList<ResourceAssignment> assignments = new ArrayList<ResourceAssignment>(Arrays.asList(task.getAssignmentCollection().getAssignments())); HashMap<HumanResource, AssignmentToggleAction> humanAssignments = new HashMap<>(); AssignmentToggleAction assignmentAction; for (HumanResource hr : myResources) { assignmentAction = new AssignmentToggleAction(hr, myUIFacade, getTaskSelectionManager().getSelectedTasks().get(0)); humanAssignments.put(hr, assignmentAction); actions.add(assignmentAction); } for (ResourceAssignment ra : assignments) { assignmentAction = humanAssignments.get(ra.getResource()); assignmentAction.putValue(Action.SELECTED_KEY, true); } } }</code><technical_language>pls surround == spaces</technical_language>

Target:
private void addHumanResourcesSubmenu(List<Action> actions) { if (getTaskSelectionManager().getSelectedTasks().size() == 1) { Task task = getTaskSelectionManager().getSelectedTasks().get(0); List<HumanResource> resources = myProject.getHumanResourceManager().getResources(); HashMap<HumanResource, AssignmentToggleAction> human2action = new HashMap<>(); for (HumanResource hr : resources) { AssignmentToggleAction assignmentAction = new AssignmentToggleAction(hr, task, myUIFacade); assignmentAction.putValue(Action.SELECTED_KEY, false); human2action.put(hr, assignmentAction); actions.add(assignmentAction); } ResourceAssignment[] assignments = task.getAssignmentCollection().getAssignments(); for (ResourceAssignment ra : assignments) { AssignmentToggleAction assignmentAction = human2action.get(ra.getResource()); assignmentAction.putValue(Action.SELECTED_KEY, true); } } }
Source:
<code>public void testInterpolatedStitchPoints() { EmbroideryStream stream = new DSTStream(); stream.addStitchPoint(0, 0); stream.addStitchPoint(80, 80); assertEquals(5, stream.getPointList().size()); <START> assertEquals(new PointF(0, 0), stream.getPointList().get(0).getPoint()); <END> assertEquals(new PointF(0, 0), stream.getPointList().get(1).getPoint()); assertTrue(stream.getPointList().get(1).isJumpPoint()); assertEquals(new PointF(40, 40), stream.getPointList().get(2).getPoint()); assertTrue(stream.getPointList().get(2).isJumpPoint()); assertEquals(new PointF(80, 80), stream.getPointList().get(3).getPoint()); assertTrue(stream.getPointList().get(3).isJumpPoint()); assertEquals(new PointF(80, 80), stream.getPointList().get(4).getPoint()); }</code><technical_language>Please create a helper function fight repetition</technical_language>

Target:
public void testInterpolatedStitchPoints() { stream.addStitchPoint(0, 0); stream.addStitchPoint(80, 80); assertEquals(5, stream.getPointList().size()); assertTrue(pointAtPositionEqualsCoordinates(0, 0, 0)); assertTrue(pointAtPositionEqualsCoordinates(1, 0, 0)); assertTrue(stream.getPointList().get(1).isJumpPoint()); assertTrue(pointAtPositionEqualsCoordinates(2, 40, 40)); assertTrue(stream.getPointList().get(2).isJumpPoint()); assertTrue(pointAtPositionEqualsCoordinates(3, 80, 80)); assertTrue(stream.getPointList().get(3).isJumpPoint()); assertTrue(pointAtPositionEqualsCoordinates(4, 80, 80)); verify(header, times(1)).initialize(0, 0); verify(header, times(4)).update(anyFloat(), anyFloat()); }
Source:
<code>protected void evalEnvironmentVariables(Map<String, String> newParametersToSave) { for (Object keyObject : userConfig.keySet()) { String key = (String) keyObject; String value = userConfig.getProperty(key); Matcher matcher = ENV_VALUE_PATTERN.matcher(value); while (matcher.find()) { boolean booleanValue = "?".equals(matcher.group("boolean")); String envVarName = matcher.group("envparam"); String defaultValue = matcher.group("defaultvalue"); String envValue = getEnvironmentVariableValue(envVarName); <START> String result = ""; <END> if (booleanValue) { result = StringUtils.isBlank(envValue) ? "false" : "true"; } else { result = StringUtils.isBlank(envValue) ? defaultValue : envValue; } result = matcher.replaceFirst(result); newParametersToSave.put(key, result); matcher = ENV_VALUE_PATTERN.matcher(result); } } }</code><technical_language>Remove = "" is needed</technical_language>

Target:
protected void evalEnvironmentVariables(Map<String, String> newParametersToSave) { for (Object keyObject : userConfig.keySet()) { String key = (String) keyObject; String value = userConfig.getProperty(key); Matcher matcher = ENV_VALUE_PATTERN.matcher(value); StringBuffer sb = new StringBuffer(); while (matcher.find()) { boolean booleanValue = "??".equals(matcher.group("boolean")); String envVarName = matcher.group("envparam"); String defaultValue = matcher.group("defaultvalue"); String envValue = getEnvironmentVariableValue(envVarName); String result; if (booleanValue) { result = StringUtils.isBlank(envValue) ? "false" : "true"; } else { result = StringUtils.isBlank(envValue) ? defaultValue : envValue; } matcher.appendReplacement(sb, result); } matcher.appendTail(sb); if (matcher.hitEnd()) { newParametersToSave.put(key, sb.toString()); } } }
Source:
<code>public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception { if (args.length < 2) { throw new NotEnoughArgumentsException(); } BigDecimal startingBalance = ess.getSettings().getStartingBalance(); try { cmd = Commandeco.EcoCommands.valueOf(args[0].toUpperCase(Locale.ENGLISH)); <START> if (args[2].contains("%") && !(cmd == Commandeco.EcoCommands.RESET)) { isPercent = true; amount = new BigDecimal(args[2].substring(0,args[2].length()-1)); <END> } else { amount = (cmd == Commandeco.EcoCommands.RESET) ? startingBalance : new BigDecimal(args[2].replaceAll("[^0-9\\.]", "")); } } catch (Exception ex) { throw new NotEnoughArgumentsException(ex); } loopOfflinePlayers(server, sender, false, true, args[1], args); if (cmd == Commandeco.EcoCommands.RESET || cmd == Commandeco.EcoCommands.SET) { if (args[1].contentEquals("**")) { server.broadcastMessage(tl("resetBalAll", NumberUtil.displayCurrency(amount, ess))); } else if (args[1].contentEquals("*")) { server.broadcastMessage(tl("resetBal", NumberUtil.displayCurrency(amount, ess))); } } }</code><technical_language>This is sane - this pass 5%3, throw exception parse number.... is user 'NotEnoughArgumentsException'</technical_language>

Target:
public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception { if (args.length < 2) { throw new NotEnoughArgumentsException(); } BigDecimal startingBalance = ess.getSettings().getStartingBalance(); try { cmd = Commandeco.EcoCommands.valueOf(args[0].toUpperCase(Locale.ENGLISH)); isPercent = args[2].endsWith("%"); amount = (cmd == Commandeco.EcoCommands.RESET) ? startingBalance : new BigDecimal(args[2].replaceAll("[^0-9\\.]", "")); } catch (Exception ex) { throw new NotEnoughArgumentsException(ex); } loopOfflinePlayers(server, sender, false, true, args[1], args); if (cmd == Commandeco.EcoCommands.RESET || cmd == Commandeco.EcoCommands.SET) { if (args[1].contentEquals("**")) { server.broadcastMessage(tl("resetBalAll", NumberUtil.displayCurrency(amount, ess))); } else if (args[1].contentEquals("*")) { server.broadcastMessage(tl("resetBal", NumberUtil.displayCurrency(amount, ess))); } } }
Source:
<code>MockReplicationManager(ReplicationConfig replicationConfig, ClusterMapConfig clusterMapConfig, StoreConfig storeConfig, StorageManager storageManager, ClusterMap clusterMap, DataNodeId dataNodeId) throws ReplicationException { <START> super(replicationConfig, clusterMapConfig, storeConfig, storageManager, new StoreKeyFactory() { <END> @Override public StoreKey getStoreKey(DataInputStream stream) throws IOException { return null; } @Override public StoreKey getStoreKey(String base64String) throws IOException { return null; } }, clusterMap, null, dataNodeId, null, clusterMap.getMetricRegistry(), null); this.dataNodeId = dataNodeId; reset(); }</code><technical_language>this change needed? null work anymore</technical_language>

Target:
MockReplicationManager(ReplicationConfig replicationConfig, ClusterMapConfig clusterMapConfig, StoreConfig storeConfig, StorageManager storageManager, ClusterMap clusterMap, DataNodeId dataNodeId) throws ReplicationException { super(replicationConfig, clusterMapConfig, storeConfig, storageManager, new StoreKeyFactory() { @Override public StoreKey getStoreKey(DataInputStream stream) { return null; } @Override public StoreKey getStoreKey(String input) { return null; } }, clusterMap, null, dataNodeId, null, clusterMap.getMetricRegistry(), null); this.dataNodeId = dataNodeId; reset(); }
Source:
<code>public void removeAttribute(String name) { <START> if (_asyncAttributes == null) _attributes.removeAttribute(name); else _asyncAttributes.removeAttribute(name); <END> }</code><technical_language>I is clearer as: suggestion (_asyncAttributes == null ? _asyncAttributes : _attributes).removeAttribute(name); a private method: java attributes().removeAttribute(name); for other methods below</technical_language>

Target:
public void removeAttribute(String name) { getAttributes().removeAttribute(name); }
Source:
<code>public List<RowMap> jsonMaps() { ArrayList<RowMap> list = new ArrayList<>(); Object value; for ( Iterator<Row> ri = filteredRows().iterator() ; ri.hasNext(); ) { Row r = ri.next(); RowMap rowMap = new RowMap(); rowMap.setRowType(getType()); rowMap.setTable(getTable().getName()); rowMap.setDatabase(getDatabase().getName()); rowMap.setTimestamp(getHeader().getTimestamp() / 1000); rowMap.setXid(getXid()); <START> rowMap.setCommit(isCommit() && !ri.hasNext()); <END> Iterator<Column> colIter = r.getColumns().iterator(); Iterator<ColumnDef> defIter = table.getColumnList().iterator(); while ( colIter.hasNext() && defIter.hasNext() ) { Column c = colIter.next(); ColumnDef d = defIter.next(); if ( c instanceof DatetimeColumn ) value = ((DatetimeColumn) c).getLongValue(); else value = c.getValue(); if ( value != null ) value = d.asJSON(value); rowMap.putData(d.getName(), value); } list.add(rowMap); } return list; }</code><technical_language>Agree @ggrossman . This reads if if(isCommit() && !ri.hasNext()) { rowMap.setCommit() }</technical_language>

Target:
public List<RowMap> jsonMaps() { ArrayList<RowMap> list = new ArrayList<>(); Object value; for ( Iterator<Row> ri = filteredRows().iterator() ; ri.hasNext(); ) { Row r = ri.next(); RowMap rowMap = new RowMap(); rowMap.setRowType(getType()); rowMap.setTable(getTable().getName()); rowMap.setDatabase(getDatabase().getName()); rowMap.setTimestamp(getHeader().getTimestamp() / 1000); rowMap.setXid(getXid()); if ( this.txCommit && !ri.hasNext() ) rowMap.setTXCommit(); Iterator<Column> colIter = r.getColumns().iterator(); Iterator<ColumnDef> defIter = table.getColumnList().iterator(); while ( colIter.hasNext() && defIter.hasNext() ) { Column c = colIter.next(); ColumnDef d = defIter.next(); if ( c instanceof DatetimeColumn ) value = ((DatetimeColumn) c).getLongValue(); else value = c.getValue(); if ( value != null ) value = d.asJSON(value); rowMap.putData(d.getName(), value); } list.add(rowMap); } return list; }
Source:
<code>public void simpleTestTripleDES() throws Exception { KeyPair caPair = KeyPairGenerator.getInstance("RSA").generateKeyPair(); X509Certificate ca = X509Certificates.createEphemeral( new X500Principal("CN=CA"), caPair); KeyPair clientPair = KeyPairGenerator.getInstance("RSA") .generateKeyPair(); X509Certificate client = X509Certificates.createEphemeral( new X500Principal("CN=Client"), clientPair); PkcsPkiEnvelopeEncoder envEncoder = new PkcsPkiEnvelopeEncoder(ca, <START> "DES3"); <END> PkiMessageEncoder encoder = new PkiMessageEncoder( clientPair.getPrivate(), client, envEncoder); PkcsPkiEnvelopeDecoder envDecoder = new PkcsPkiEnvelopeDecoder(ca, caPair.getPrivate()); PkiMessageDecoder decoder = new PkiMessageDecoder(client, envDecoder); PkiMessage<?> actual = decoder.decode(encoder.encode(message)); assertEquals(message, actual); }</code><technical_language>This in Java Standard Algorithm Names; consider DESede instead please</technical_language>

Target:
public void simpleTestTripleDES() throws Exception { KeyPair caPair = KeyPairGenerator.getInstance("RSA").generateKeyPair(); X509Certificate ca = X509Certificates.createEphemeral( new X500Principal("CN=CA"), caPair); KeyPair clientPair = KeyPairGenerator.getInstance("RSA") .generateKeyPair(); X509Certificate client = X509Certificates.createEphemeral( new X500Principal("CN=Client"), clientPair); PkcsPkiEnvelopeEncoder envEncoder = new PkcsPkiEnvelopeEncoder(ca, "DESede"); PkiMessageEncoder encoder = new PkiMessageEncoder( clientPair.getPrivate(), client, envEncoder); PkcsPkiEnvelopeDecoder envDecoder = new PkcsPkiEnvelopeDecoder(ca, caPair.getPrivate()); PkiMessageDecoder decoder = new PkiMessageDecoder(client, envDecoder); PkiMessage<?> actual = decoder.decode(encoder.encode(message)); assertEquals(message, actual); }
Source:
<code>public void returnsNullWhenUsingDottedNotation() { Map<String, Object> query = new HashMap<String, Object>(); query.put("name", "mike"); assertThat(im.find(query, 0, Long.MAX_VALUE, Arrays.asList("name.blah"), null), <START> is(nullValue())); <END> }</code><technical_language>Wrong indent, is call is assertThat call, indent bracket</technical_language>

Target:
public void returnsNullWhenUsingDottedNotation() { Map<String, Object> query = new HashMap<String, Object>(); query.put("name", "mike"); QueryResult queryResult = im.find(query, 0, Long.MAX_VALUE, Arrays.asList("name.blah"), null); assertThat(queryResult, is(nullValue())); }
Source:
<code>default Bundle install() throws Exception { byte[] build = LaunchpadBuilder.workspace.build(LaunchpadBuilder.projectDir.getAbsolutePath(), x().spec); String name = x().spec.bundleSymbolicName.toString(); String version = x().spec.bundleVersion; version = (version == null) ? "0" : version; ByteArrayInputStream bin = new ByteArrayInputStream(build); return x().ws.getBundleContext() <START> .installBundle(name + ';' + version, bin); <END> }</code><technical_language>I suggest - _ instead of ; join bsn version;</technical_language>

Target:
default Bundle install() throws Exception { BuilderSpecification spec = x().spec; byte[] build = LaunchpadBuilder.workspace.build(LaunchpadBuilder.projectDir.getAbsolutePath(), spec); String location; if (spec.location == null) { String name = spec.bundleSymbolicName.toString(); String version = spec.bundleVersion; version = (version == null) ? "0" : version; location = name + '-' + version; } else { location = spec.location; } ByteArrayInputStream bin = new ByteArrayInputStream(build); return x().ws.getBundleContext() .installBundle(location, bin); }
Source:
<code><START> public void readTimeout() throws Throwable { <END> final CountDownLatch startupLatch = new CountDownLatch(1); final CountDownLatch cleanupLatch = new CountDownLatch(1); Thread server = new Thread(new Runnable() { @Override public void run() { ServerSocket serverSocket = null; Socket socket = null; BufferedWriter w = null; try { serverSocket = ServerSocketFactory.getDefault() .createServerSocket(54321); startupLatch.countDown(); socket = serverSocket.accept(); w = new BufferedWriter(new OutputStreamWriter(socket .getOutputStream())); w.write("HTTP/1.0 200 OK"); w.flush(); Thread.sleep(500); } catch (Throwable e) { TEST_LOG.logger.log(Level.SEVERE, "Exception in readTimeout test server", e); } finally { startupLatch.countDown(); IOUtils.closeQuietly(w); IOUtils.closeQuietly(socket); IOUtils.closeQuietly(serverSocket); cleanupLatch.countDown(); } } }); server.start(); startupLatch.await(); try { CloudantClient c = new CloudantClient("http://localhost:54321", "", "", new ConnectOptions().setReadTimeout(new TimeoutCustomizationInterceptor .TimeoutOption(250, TimeUnit.MILLISECONDS))); c.getAllDbs(); } catch (CouchDbException e) { if (e.getCause() != null) { throw e.getCause(); } else { throw e; } } finally { cleanupLatch.await(); } }</code><technical_language>@ricellis OK, sounds a reasonable approach I think, added get more complex. above, a shame differentiate errors works for JVMs</technical_language>

Target:
public void readTimeout() throws Throwable { final CountDownLatch startupLatch = new CountDownLatch(1); final CountDownLatch cleanupLatch = new CountDownLatch(1); Thread server = new Thread(new Runnable() { @Override public void run() { ServerSocket serverSocket = null; Socket socket = null; BufferedWriter w = null; try { serverSocket = ServerSocketFactory.getDefault() .createServerSocket(54321); startupLatch.countDown(); socket = serverSocket.accept(); w = new BufferedWriter(new OutputStreamWriter(socket .getOutputStream())); w.write("HTTP/1.0 200 OK"); w.flush(); Thread.sleep(500); } catch (Throwable e) { TEST_LOG.logger.log(Level.SEVERE, "Exception in readTimeout test server", e); } finally { startupLatch.countDown(); IOUtils.closeQuietly(w); IOUtils.closeQuietly(socket); IOUtils.closeQuietly(serverSocket); cleanupLatch.countDown(); } } }); server.start(); startupLatch.await(); try { CloudantClient c = new CloudantClient("http://localhost:54321", null, (String) null, new ConnectOptions().setReadTimeout(new TimeoutCustomizationInterceptor .TimeoutOption(250, TimeUnit.MILLISECONDS))); c.getAllDbs(); } catch (CouchDbException e) { if (e.getCause() != null) { throw e.getCause(); } else { throw e; } } finally { cleanupLatch.await(); } }
Source:
<code>public void hasSameOrderableAs_shouldReturnTrueIfTheConceptsMatchAndHaveSameDrugNonCodedTrimmingSpaces() throws Exception { DrugOrder order = new DrugOrder(); Concept concept = new Concept(); Drug drug1 = new Drug(); drug1.setConcept(concept); <START> order.setDrug(drug1); <END> order.setDrugNonCoded("Chrocine"); DrugOrder otherOrder = new DrugOrder(); otherOrder.setConcept(concept); otherOrder.setDrug(drug1); otherOrder.setDrugNonCoded(" Chrocine "); assertTrue(order.hasSameOrderableAs(otherOrder)); }</code><technical_language>here, I thought drug null for a nonCoded order, i setting</technical_language>

Target:
public void hasSameOrderableAs_shouldReturnTrueIfTheConceptsMatchAndHaveSameDrugNonCodedTrimmingSpaces() throws Exception { DrugOrder order = new DrugOrder(); Concept concept = new Concept(); order.setConcept(concept); order.setDrugNonCoded("Chrocine"); DrugOrder otherOrder = new DrugOrder(); otherOrder.setConcept(concept); otherOrder.setDrugNonCoded(" Chrocine "); assertTrue(order.hasSameOrderableAs(otherOrder)); }
Source:
<code>public SetAttributesCommand( IBlockingProvider<SimpleFeature> feature, IBlockingProvider<ILayer> layer, String xpath[], Object value[] ) { this.xpath = xpath; this.value = value; <START> this.oldValue = new Object[value.length]; <END> editFeature = feature; editLayer = layer; }</code><technical_language>Delegation is refer 'this' while explicitly invoking a constructor. yes, this. However, Constructor is in codebase. provide a pull request eliminate it. wondering a bit value.length is while loop // for loop get values for(int i = 0; i < xpath.length; i++){ oldValue[i] = feature2.getAttribute(xpath[i]); } xpath.lenght. I assume object-Array length ;)</technical_language>

Target:
public SetAttributesCommand(IBlockingProvider<SimpleFeature> feature, IBlockingProvider<ILayer> layer, String xpath[], Object value[]) { Validate.notNull(xpath); Validate.notNull(value); Validate.isTrue(xpath.length == value.length, "xpath and values do not have same lenght"); this.xpath = xpath; this.value = value; this.oldValue = new Object[xpath.length]; editFeature = feature; editLayer = layer; }
Source:
<code>protected static FileValue getWorkspaceFile(RootedPath directory, Environment env) throws RepositoryFunctionException, InterruptedException { RootedPath workspaceRootedFile = RootedPath.toRootedPath( directory.getRoot(), directory .getRootRelativePath() .getRelative(LabelConstants.WORKSPACE_DOT_BAZEL_FILE_NAME)); if (!workspaceRootedFile.asPath().exists()) { <START> workspaceRootedFile = RootedPath.toRootedPath( <END> directory.getRoot(), directory .getRootRelativePath() .getRelative(LabelConstants.WORKSPACE_FILE_NAME)); } SkyKey workspaceFileKey = FileValue.key(workspaceRootedFile); FileValue value; try { value = (FileValue) env.getValueOrThrow(workspaceFileKey, IOException.class); } catch (IOException e) { throw new RepositoryFunctionException( new IOException("Could not access " + workspaceRootedFile + ": " + e.getMessage()), Transience.PERSISTENT); } return value; }</code><technical_language>Logic is trivial, please extract helper function</technical_language>

Target:
protected static FileValue getWorkspaceFile(RootedPath directory, Environment env) throws RepositoryFunctionException, InterruptedException { RootedPath workspaceRootedFile; try { workspaceRootedFile = WorkspaceFileHelper.getWorkspaceRootedFile(directory, env); if (workspaceRootedFile == null) { return null; } } catch (IOException e) { throw new RepositoryFunctionException( new IOException( "Could not determine workspace file (\"WORKSPACE.bazel\" or \"WORKSPACE\"): " + e.getMessage()), Transience.PERSISTENT); } SkyKey workspaceFileKey = FileValue.key(workspaceRootedFile); FileValue value; try { value = (FileValue) env.getValueOrThrow(workspaceFileKey, IOException.class); } catch (IOException e) { throw new RepositoryFunctionException( new IOException("Could not access " + workspaceRootedFile + ": " + e.getMessage()), Transience.PERSISTENT); } return value; }
Source:
<code>public void mutate(List<? extends Mutation> mutations) throws IOException { <START> ReadLock lock = closeLock.readLock(); <END> try { if (closed.get()) { throw new IllegalStateException("Cannot mutate when the BufferedMutator is closed."); } for (Mutation mutation : mutations) { doMutation(mutation); } } finally { lock.unlock(); } }</code><technical_language>late game for this CL, missing context, whats deal unlock() in finally a lock()</technical_language>

Target:
public void mutate(List<? extends Mutation> mutations) throws IOException { ReadLock lock = mutationLock.readLock(); lock.lock(); try { if (closed) { throw new IllegalStateException("Cannot mutate when the BufferedMutator is closed."); } handleExceptions(); for (Mutation mutation : mutations) { doMutation(mutation); } } finally { lock.unlock(); } }
Source:
<code>public Object execute(Object[] parameters) { ParametersParameterAccessor accessor = new ParametersParameterAccessor(queryMethod.getParameters(), parameters); <START> <END> ResultProcessor processor = this.queryMethod.getResultProcessor().withDynamicProjection(accessor); EntityInstantiators instantiators = new EntityInstantiators(); Converter<Object, Object> converter = new DtoInstantiatingConverter(processor.getReturnedType().getReturnedType(), couchbaseOperations.getConverter().getMappingContext(), instantiators); Statement statement = getStatement(accessor, parameters, processor.getReturnedType()); JsonValue queryPlaceholderValues = getPlaceholderValues(accessor); N1qlQuery query = buildQuery(statement, queryPlaceholderValues, getCouchbaseOperations().getDefaultConsistency().n1qlConsistency()); Statement countStatement = getCount(accessor, parameters); N1qlQuery countQuery = buildQuery(countStatement, queryPlaceholderValues, getCouchbaseOperations().getDefaultConsistency().n1qlConsistency()); return processor.processResult(executeDependingOnType(query, countQuery, queryMethod, accessor.getPageable(), queryMethod.isPageQuery(), queryMethod.isSliceQuery(), queryMethod.isModifyingQuery()), converter); }</code><technical_language>This issuing a query basically map results a DTO. Is a instruct query query execution return requested type in place</technical_language>

Target:
public Object execute(Object[] parameters) { ParametersParameterAccessor accessor = new ParametersParameterAccessor(queryMethod.getParameters(), parameters); ResultProcessor processor = this.queryMethod.getResultProcessor().withDynamicProjection(accessor); ReturnedType returnedType = processor.getReturnedType(); this.returnedType = returnedType.getReturnedType(); if (this.returnedType.isInterface()) { this.returnedType = returnedType.getDomainType(); } Statement statement = getStatement(accessor, parameters, returnedType); JsonValue queryPlaceholderValues = getPlaceholderValues(accessor); N1qlQuery query = buildQuery(statement, queryPlaceholderValues, getCouchbaseOperations().getDefaultConsistency().n1qlConsistency()); Statement countStatement = getCount(accessor, parameters); N1qlQuery countQuery = buildQuery(countStatement, queryPlaceholderValues, getCouchbaseOperations().getDefaultConsistency().n1qlConsistency()); return processor.processResult(executeDependingOnType(query, countQuery, queryMethod, accessor.getPageable(), queryMethod.isPageQuery(), queryMethod.isSliceQuery(), queryMethod.isModifyingQuery())); }
Source:
<code>private String read(String resourcePath) throws IOException { InputStream is = getClass().getResourceAsStream(resourcePath); try { return Util.read(is); } finally { if (is != null) { <START> is.close(); <END> } } }</code><technical_language>I suppose close() is done in Util.read(..)</technical_language>

Target:
private String read(String resourcePath) throws IOException { InputStream is = getClass().getResourceAsStream(resourcePath); return Util.read(is); }
Source:
<code>public void aggregate() { boolean countNulls = NullHandlingHelper.useDefaultValuesForNull(); for (final Integer index : selector.getRow()) { <START> if (countNulls || selector.lookupName(index) != null) { <END> mutableBitmap.add(index); } } }</code><technical_language>Is do this iteration, some finalization of results</technical_language>

Target:
public void aggregate() { IndexedInts row = selector.getRow(); for (int i = 0; i < row.size(); i++) { int index = row.get(i); if (NullHandling.useDefaultValuesForNull() || isNotNull(index)) { mutableBitmap.add(index); } } }
Source:
<code>private synchronized void populateCache(final int index) { if (job != null && job.getState() != Job.NONE) { if (fCache != null && (index >= fPopulateCacheStartIndex) && (index < (fPopulateCacheStartIndex + getCacheSize()))) { return; } job.cancel(); } fPopulateCacheStartIndex = Math.max(0, index - fCacheSize); job = new Job("Fetching Events") { private int startIndex = fPopulateCacheStartIndex; @Override protected IStatus run(final IProgressMonitor monitor) { EventTableQueryFilter filter = new EventTableQueryFilter(Collections.emptyList(), startIndex, getCacheSize(), fPresetFilter, fFilter, null, fCollapseFilterEnabled); TmfModelResponse<@NonNull ITmfVirtualTableModel<@NonNull EventTableLine>> response = fDataProvider.fetch(filter, monitor); @Nullable ITmfVirtualTableModel<@NonNull EventTableLine> model = response.getModel(); if(response.getStatus() == ITmfResponse.Status.COMPLETED) { if(model <START> == null) { return <END> Status.CANCEL_STATUS; } synchronized (TmfEventsCache.this) { fCache = model; fNbEventInCache = model.getData().size(); } } else { return Status.CANCEL_STATUS; } fTable.cacheUpdated(true); if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } return Status.OK_STATUS; } }; job.setSystem(true); job.setPriority(Job.SHORT); job.schedule(); }</code><technical_language>this for a cancelled response</technical_language>

Target:
private synchronized void populateCache(final int index) { if (job != null && job.getState() != Job.NONE) { if (fCache != null && (index >= fPopulateCacheStartIndex) && (index < (fPopulateCacheStartIndex + getCacheSize()))) { return; } job.cancel(); } fPopulateCacheStartIndex = Math.max(0, index - fCacheSize); job = new Job("Fetching Events") { private int startIndex = fPopulateCacheStartIndex; @Override protected IStatus run(final IProgressMonitor monitor) { EventTableQueryFilter filter = new EventTableQueryFilter(Collections.emptyList(), startIndex, getCacheSize(), fPresetFilter, fFilter, null, fCollapseFilterEnabled); TmfModelResponse<@NonNull ITmfVirtualTableModel<@NonNull EventTableLine>> response = fDataProvider.fetch(filter, monitor); @Nullable ITmfVirtualTableModel<@NonNull EventTableLine> model = response.getModel(); if(response.getStatus() == ITmfResponse.Status.COMPLETED) { if(model == null) { return Status.CANCEL_STATUS; } synchronized (TmfEventsCache.this) { fCache = model; } } else { return Status.CANCEL_STATUS; } fTable.cacheUpdated(true); if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } return Status.OK_STATUS; } }; job.setSystem(true); job.setPriority(Job.SHORT); job.schedule(); }
Source:
<code><START> public boolean equals(Object o) { <END> if (this == o) { return true; } if (!(o instanceof Account)) { return false; } Account account = (Account) o; if (id != account.id) { return false; } if (!name.equals(account.name)) { return false; } return status.equals(account.status); }</code><technical_language>this auto generated</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Account)) { return false; } Account account = (Account) o; if (!id.equals(account.id)) { return false; } if (!name.equals(account.name)) { return false; } return status == account.status; }