auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void recreateStructures(Chunk chunkIn, int x, int z) { if (this.baseGenerator instanceof IChunkGenerator) { ((IChunkGenerator) this.baseGenerator).recreateStructures(chunkIn, x, z); <START> return; <END> } if (this.baseGenerator instanceof SpongeGenerationPopulator) { ((SpongeGenerationPopulator) this.baseGenerator).getHandle(this.world).recreateStructures(chunkIn, x, z); } for (GenerationPopulator populator : this.genpop) { if (populator instanceof MapGenStructure) { ((MapGenStructure) populator).generate(chunkIn.getWorld(), x, z, null); } } }</code><technical_language>I this return error, preventing plugin structures working properly</technical_language>

Target:
public void recreateStructures(Chunk chunkIn, int x, int z) { if (this.baseGenerator instanceof IChunkGenerator) { ((IChunkGenerator) this.baseGenerator).recreateStructures(chunkIn, x, z); } if (this.baseGenerator instanceof SpongeGenerationPopulator) { ((SpongeGenerationPopulator) this.baseGenerator).getHandle(this.world).recreateStructures(chunkIn, x, z); } for (GenerationPopulator populator : this.genpop) { if (populator instanceof MapGenStructure) { ((MapGenStructure) populator).generate(chunkIn.getWorld(), x, z, null); } } }
Source:
<code>public org.atlasapi.media.entity.simple.Image simplify(Image image, Set<Annotation> annotations, ApplicationConfiguration config) { if (image == null) { return new org.atlasapi.media.entity.simple.Image(); } org.atlasapi.media.entity.simple.Image simpleImage = new org.atlasapi.media.entity.simple.Image(image.getCanonicalUri()); if (image.getType() != null) { <START> if(image.getType() != ImageType.GENERIC) { <END> simpleImage.setImageType(image.getType().getName()); } } if (image.getColor() != null) { simpleImage.setColor(image.getColor().getName()); } if (image.getTheme() != null) { simpleImage.setTheme(image.getTheme().getName()); } if (image.getWidth() != null) { simpleImage.setWidth(image.getWidth()); } if (image.getHeight() != null) { simpleImage.setHeight(image.getHeight()); } if (image.getAspectRatio() != null) { simpleImage.setAspectRatio(image.getAspectRatio().getName()); } if (image.getMimeType() != null) { simpleImage.setMimeType(image.getMimeType().toString()); } if (image.getAvailabilityStart() != null) { simpleImage.setAvailabilityStart(image.getAvailabilityStart().toDate()); } if (image.getAvailabilityEnd() != null) { simpleImage.setAvailabilityEnd(image.getAvailabilityEnd().toDate()); } return simpleImage; }</code><technical_language>is this special-cased</technical_language>

Target:
public org.atlasapi.media.entity.simple.Image simplify(Image image, Set<Annotation> annotations, ApplicationConfiguration config) { if (image == null) { return new org.atlasapi.media.entity.simple.Image(); } org.atlasapi.media.entity.simple.Image simpleImage = new org.atlasapi.media.entity.simple.Image(image.getCanonicalUri()); if (image.getType() != null) { simpleImage.setImageType(image.getType().getName()); } if (image.getColor() != null) { simpleImage.setColor(image.getColor().getName()); } if (image.getTheme() != null) { simpleImage.setTheme(image.getTheme().getName()); } if (image.getWidth() != null) { simpleImage.setWidth(image.getWidth()); } if (image.getHeight() != null) { simpleImage.setHeight(image.getHeight()); } if (image.getAspectRatio() != null) { simpleImage.setAspectRatio(image.getAspectRatio().getName()); } if (image.getMimeType() != null) { simpleImage.setMimeType(image.getMimeType().toString()); } if (image.getAvailabilityStart() != null) { simpleImage.setAvailabilityStart(image.getAvailabilityStart().toDate()); } if (image.getAvailabilityEnd() != null) { simpleImage.setAvailabilityEnd(image.getAvailabilityEnd().toDate()); } return simpleImage; }
Source:
<code>public static void init() { handle = new DBI("jdbc:postgresql:jdbi_test", "postgres", "").open(); <START> handle.execute("create table something (id int primary key, name varchar(100))"); <END> }</code><technical_language>worth inserting a row table. Currently result of 0 rows is correct, is a no-op e.g. forgets IN (NULL) clause</technical_language>

Target:
public static void init() { handle = new DBI("jdbc:postgresql:jdbi_test", "postgres", "").open(); handle.execute("create table something (id int primary key, name varchar(100))"); handle.execute("insert into something(id, name) values(1, null)"); handle.execute("insert into something(id, name) values(2, 'bla')"); handle.execute("insert into something(id, name) values(3, 'null')"); handle.execute("insert into something(id, name) values(4, '')"); }
Source:
<code>protected void doTask(Channel channel) { Long lastRead = lastRead(channel); Long now = now(); if (lastRead != null && now - lastRead > heartbeatTimeout) { if (channel instanceof Client) { try { logger.warn("Reconnect to remote channel " + channel.getRemoteAddress() + ", because heartbeat read idle time out: " + heartbeatTimeout + "ms"); ((Client) channel).reconnect(); } catch (Throwable t) { <START> logger.warn("Exception when reconnect to remote channel " + channel.getRemoteAddress(), t); <END> } } else { try { logger.warn("Close channel " + channel + ", because heartbeat read idle time out: " + heartbeatTimeout + "ms"); channel.close(); } catch (Throwable t) { logger.warn("Exception when close channel " + channel, t); } } } }</code><technical_language>Personally this place is worth discussing. of exceptions handled in connect disconnect, is a log. I log removed</technical_language>

Target:
protected void doTask(Channel channel) { Long lastRead = lastRead(channel); Long now = now(); if (lastRead != null && now - lastRead > heartbeatTimeout) { if (channel instanceof Client) { try { logger.warn("Reconnect to remote channel " + channel.getRemoteAddress() + ", because heartbeat read idle time out: " + heartbeatTimeout + "ms"); ((Client) channel).reconnect(); } catch (Throwable t) { } } else { try { logger.warn("Close channel " + channel + ", because heartbeat read idle time out: " + heartbeatTimeout + "ms"); channel.close(); } catch (Throwable t) { logger.warn("Exception when close channel " + channel, t); } } } }
Source:
<code><START> public static Set<User> getUsersFromIds(final String ids, final String delimiter) { <END> final Set<User> userSet = new HashSet<>(); final StringTokenizer tokenizer = new StringTokenizer(ids, delimiter); while (tokenizer.hasMoreTokens()) { boolean idNotFound = Boolean.FALSE; Exception exception = null; final String token = tokenizer.nextToken().trim(); if (Validator.isEmailAddress(token)) { try { User user = APILocator.getUserAPI() .loadByUserByEmail(token, APILocator.getUserAPI().getSystemUser(), false); userSet.add(user); } catch (Exception e) { idNotFound = Boolean.TRUE; exception = e; } } else { try { User user = APILocator.getUserAPI() .loadUserById(token, APILocator.getUserAPI().getSystemUser(), false); userSet.add(user); continue; } catch (Exception e) { idNotFound = Boolean.TRUE; exception = e; } try { final Role role = APILocator.getRoleAPI().loadRoleByKey(token); final List<User> approvingUsersInRole = APILocator.getRoleAPI() .findUsersForRole(role); userSet.addAll(approvingUsersInRole); idNotFound = Boolean.FALSE; } catch (DotSecurityException e) { Logger.warn(WorkflowActionletUtil.class, "An error occurred when retrieving users from role key: " + token, e); } catch (DotDataException e) { idNotFound = Boolean.TRUE; exception = e; } } if (idNotFound) { Logger.warn(WorkflowActionletUtil.class, "The following email/userID/role key could not be found: " + token, exception); } } return userSet; }</code><technical_language>![CRITICAL](<LINK_1> 'Severity: CRITICAL') Refactor this method reduce Cognitive Complexity 18 15 allowed. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public static Set<User> getUsersFromIds(final String ids, final String delimiter) { final Set<User> userSet = new HashSet<>(); final StringTokenizer tokenizer = new StringTokenizer(ids, delimiter); while (tokenizer.hasMoreTokens()) { boolean idNotFound = Boolean.FALSE; Exception exception = null; final String token = tokenizer.nextToken().trim(); if (Validator.isEmailAddress(token)) { try { final User user = APILocator.getUserAPI() .loadByUserByEmail(token, APILocator.getUserAPI().getSystemUser(), false); userSet.add(user); } catch (Exception e) { idNotFound = Boolean.TRUE; exception = e; } } else { try { final User user = APILocator.getUserAPI() .loadUserById(token, APILocator.getUserAPI().getSystemUser(), false); userSet.add(user); continue; } catch (Exception e) { idNotFound = Boolean.TRUE; exception = e; } try { final Role role = APILocator.getRoleAPI().loadRoleByKey(token); final List<User> approvingUsersInRole = APILocator.getRoleAPI() .findUsersForRole(role); userSet.addAll(approvingUsersInRole); idNotFound = Boolean.FALSE; } catch (DotSecurityException e) { Logger.warn(WorkflowActionletUtil.class, "An error occurred when retrieving users from role key: " + token, e); } catch (DotDataException e) { idNotFound = Boolean.TRUE; exception = e; } } if (idNotFound) { Logger.warn(WorkflowActionletUtil.class, "The following email/userID/role key could not be found: " + token, exception); } } return userSet; }
Source:
<code>private void doAddNewBranch() { final String branchName = nameTxtBox.getText().trim(); if ("".equals(branchName)) { nameTxtBox.setFocus(true); return; } final String rev = irevTxtBox.getText().trim(); if ("".equals(rev)) { irevTxtBox.setText("HEAD"); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { irevTxtBox.selectAll(); irevTxtBox.setFocus(true); } }); return; } addBranch.setEnabled(false); ProjectApi.createBranch(getProjectKey(), branchName, rev, new GerritCallback<BranchInfo>() { @Override public void onSuccess(BranchInfo branch) { showAddedBranch(branch); addBranch.setEnabled(true); <START> nameTxtBox.setText(""); irevTxtBox.setText(""); <END> delBranch.setVisible(branchTable.hasBranchCanDelete()); if (branchTable.matches(branch)) { branchTable.insert(branch); } } @Override public void onFailure(Throwable caught) { addBranch.setEnabled(true); selectAllAndFocus(nameTxtBox); new ErrorDialog(caught.getMessage()).center(); } }); }</code><technical_language>need 2 lines clear input fields :)</technical_language>

Target:
private void doAddNewBranch() { final String branchName = nameTxtBox.getText().trim(); if ("".equals(branchName)) { nameTxtBox.setFocus(true); return; } final String rev = irevTxtBox.getText().trim(); if ("".equals(rev)) { irevTxtBox.setText("HEAD"); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { irevTxtBox.selectAll(); irevTxtBox.setFocus(true); } }); return; } addBranch.setEnabled(false); ProjectApi.createBranch(getProjectKey(), branchName, rev, new GerritCallback<BranchInfo>() { @Override public void onSuccess(BranchInfo branch) { showAddedBranch(branch); query = new Query(match).start(start).run(); } @Override public void onFailure(Throwable caught) { addBranch.setEnabled(true); selectAllAndFocus(nameTxtBox); new ErrorDialog(caught.getMessage()).center(); } }); }
Source:
<code>public Map<String, Object> state() { Map<String, Object> state = new HashMap<>(); state.put(Constants.HAWKULAR_APM_TRACEID, traceContext.getTraceId()); Object reportingLevelFromTags = ReportingLevel.parse(getTags().get(Tags.SAMPLING_PRIORITY.getKey())); if (reportingLevelFromTags != null) { state.put(Constants.HAWKULAR_APM_LEVEL, reportingLevelFromTags); } else if (traceContext.getReportingLevel() != null) { state.put(Constants.HAWKULAR_APM_LEVEL, traceContext.getReportingLevel().toString()); } <START> Object transactionFromTags = getTags().get(Constants.PROP_TRANSACTION_NAME); <END> if (traceContext.getTransaction() != null) { state.put(Constants.HAWKULAR_APM_TXN, traceContext.getTransaction()); } else if (transactionFromTags != null) { state.put(Constants.HAWKULAR_APM_TXN, transactionFromTags); } return state; }</code><technical_language>move this else (with condition) - performed if context a transaction</technical_language>

Target:
public Map<String, Object> state() { Map<String, Object> state = new HashMap<>(); state.put(Constants.HAWKULAR_APM_TRACEID, traceContext.getTraceId()); Object reportingLevelFromTags = ReportingLevel.parse(getTags().get(Tags.SAMPLING_PRIORITY.getKey())); if (reportingLevelFromTags != null) { state.put(Constants.HAWKULAR_APM_LEVEL, reportingLevelFromTags); } else if (traceContext.getReportingLevel() != null) { state.put(Constants.HAWKULAR_APM_LEVEL, traceContext.getReportingLevel().toString()); } if (traceContext.getTransaction() != null) { state.put(Constants.HAWKULAR_APM_TXN, traceContext.getTransaction()); } else { Object transactionFromTags = getTags().get(Constants.PROP_TRANSACTION_NAME); if (transactionFromTags != null) { state.put(Constants.HAWKULAR_APM_TXN, transactionFromTags); } } return state; }
Source:
<code>public void getJudgment_NOT_NULL_TEXT_CONTENT() { Judgment judgment = TestInMemoryObjectFactory.createSimpleCcJudgment(); JudgmentTextContent textContent = new JudgmentTextContent(); textContent.setRawTextContent("raw content"); judgment.setTextContent(textContent); judgmentRepository.save(judgment); Judgment actualJudgment = judgmentRepository.findOneAndInitialize(judgment.getId()); assertNotNull("judgment text content is null", actualJudgment.getTextContent()); assertEquals("raw content", actualJudgment.getTextContent().getRawTextContent()); <START> } <END></code><technical_language>given/ execute/ assert</technical_language>

Target:
public void getJudgment_NOT_NULL_TEXT_CONTENT() { Judgment judgment = TestInMemoryObjectFactory.createSimpleNacJudgment(); JudgmentTextContent textContent = new JudgmentTextContent(); textContent.setRawTextContent("raw content"); judgment.setTextContent(textContent); judgmentRepository.save(judgment); Judgment actualJudgment = judgmentRepository.findOneAndInitialize(judgment.getId()); assertNotNull("judgment text content is null", actualJudgment.getTextContent()); assertEquals("raw content", actualJudgment.getTextContent().getRawTextContent()); }
Source:
<code>private List<StoreKey> addPutMessagesToReplicasOfPartition(PartitionId partitionId, List<Host> hosts, int count) throws MessageFormatException, IOException { List<StoreKey> ids = new ArrayList<>(); for (int i = 0; i < count; i++) { short accountId = Utils.getRandomShort(TestUtils.RANDOM); short containerId = Utils.getRandomShort(TestUtils.RANDOM); short blobIdVersion = CommonTestUtils.getCurrentBlobIdVersion(); BlobId id = new BlobId(blobIdVersion, BlobId.BlobIdType.NATIVE, ClusterMapUtils.UNKNOWN_DATACENTER_ID, accountId, containerId, partitionId); ids.add(id); <START> Pair<ByteBuffer, MessageInfo> putMsgInfo = getPutMessage(id, accountId, containerId, i % 2 == 0 ? true : false); <END> for (Host host : hosts) { host.addMessage(partitionId, putMsgInfo.getSecond(), putMsgInfo.getFirst().duplicate()); } } return ids; }</code><technical_language>i % 2 == 0 instead of i % 2 == 0 ? true : false</technical_language>

Target:
private List<StoreKey> addPutMessagesToReplicasOfPartition(PartitionId partitionId, List<Host> hosts, int count) throws MessageFormatException, IOException { List<StoreKey> ids = new ArrayList<>(); for (int i = 0; i < count; i++) { short accountId = Utils.getRandomShort(TestUtils.RANDOM); short containerId = Utils.getRandomShort(TestUtils.RANDOM); short blobIdVersion = CommonTestUtils.getCurrentBlobIdVersion(); boolean toEncrypt = i % 2 == 0; BlobId id = new BlobId(blobIdVersion, BlobId.BlobIdType.NATIVE, ClusterMapUtils.UNKNOWN_DATACENTER_ID, accountId, containerId, partitionId, toEncrypt); ids.add(id); Pair<ByteBuffer, MessageInfo> putMsgInfo = getPutMessage(id, accountId, containerId, toEncrypt); for (Host host : hosts) { host.addMessage(partitionId, putMsgInfo.getSecond(), putMsgInfo.getFirst().duplicate()); } } return ids; }
Source:
<code>public static OrcReaderOptions createDefaultTestConfig() { return new OrcReaderOptions( new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE), <START> new DataSize(1, MEGABYTE), <END> false); }</code><technical_language>call this function createTestingReaderOptions delegate zstdJniDecompressionEnabled = false</technical_language>

Target:
public static OrcReaderOptions createDefaultTestConfig() { return createTestingReaderOptions(false); }
Source:
<code>public GlobalMetricsConfigurationBuilder metrics() { <START> globalConfig.metrics().gauges(true); <END> return globalConfig.metrics(); }</code><technical_language>I thought wanted end this practice, Adrian</technical_language>

Target:
public GlobalMetricsConfigurationBuilder metrics() { return globalConfig.metrics(); }
Source:
<code>public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); CourseDetailsBundle courseDetails; CourseInfo output; try { courseDetails = logic.getCourseDetails(courseId); InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, userInfo.id); List<InstructorAttributes> instructors = logic.getInstructorsForCourse(courseId); <START> String courseStudentListAsCsv = logic.getCourseStudentListAsCsv(courseId, userInfo.id); <END> output = new CourseInfo(instructor, courseDetails, instructors, courseStudentListAsCsv); } catch (EntityDoesNotExistException e) { return new JsonResult("No course with given instructor is found.", HttpStatus.SC_NOT_FOUND); } return new JsonResult(output); }</code><technical_language>2 concerns here, change one: - This means need this data, of is (when "Non-english characters displaying" feature) not. a waste of resources me. change loading data necessary. API fetch CSV. - This CSV is converted HTML in front-end. While is a workable approach, a is serve data JSON easier format necessary (and need for [innerHTML] well). if do this</technical_language>

Target:
public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); CourseDetailsBundle courseDetails; CourseInfo output; try { courseDetails = logic.getCourseDetails(courseId); InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, userInfo.id); List<InstructorAttributes> instructors = logic.getInstructorsForCourse(courseId); output = new CourseInfo(instructor, courseDetails, instructors); } catch (EntityDoesNotExistException e) { return new JsonResult("No course with given instructor is found.", HttpStatus.SC_NOT_FOUND); } return new JsonResult(output); }
Source:
<code>protected String replaceNicsMacSequenceInBootArgs(String oldMacSequence, String newMacSequence, VirtualMachineTO vmSpec) { String bootArgs = vmSpec.getBootArgs(); if (!StringUtils.isEmpty(bootArgs) && !StringUtils.isEmpty(oldMacSequence) && !StringUtils.isEmpty(newMacSequence)) { return bootArgs.replace(oldMacSequence, newMacSequence); } <START> return ""; <END> }</code><technical_language>Is this case possible? bootArgs empty oldMacSequence newMacSequence empty If so, return line 2131 variable bootArgs</technical_language>

Target:
protected String replaceNicsMacSequenceInBootArgs(String oldMacSequence, String newMacSequence, VirtualMachineTO vmSpec) { String bootArgs = vmSpec.getBootArgs(); if (!StringUtils.isBlank(bootArgs) && !StringUtils.isBlank(oldMacSequence) && !StringUtils.isBlank(newMacSequence)) { return bootArgs.replace(oldMacSequence, newMacSequence); } return ""; }
Source:
<code>protected ZkClient(IZkConnection zkConnection, int connectionTimeout, long operationRetryTimeout, PathBasedZkSerializer zkSerializer, String monitorType, String monitorKey, String monitorInstanceName, boolean monitorRootPathOnly) { if (zkConnection == null) { throw new NullPointerException("Zookeeper connection is null!"); } <START> _syncOnNewSession = true; <END> _connection = zkConnection; _pathBasedZkSerializer = zkSerializer; _operationRetryTimeoutInMillis = operationRetryTimeout; _isNewSessionEventFired = false; _asyncCallRetryThread = new ZkAsyncRetryThread(zkConnection.getServers()); _asyncCallRetryThread.start(); connect(connectionTimeout, this); try { if (monitorKey != null && !monitorKey.isEmpty() && monitorType != null && !monitorType .isEmpty()) { _monitor = new ZkClientMonitor(monitorType, monitorKey, monitorInstanceName, monitorRootPathOnly, _eventThread); _monitor.register(); } else { LOG.info("ZkClient monitor key or type is not provided. Skip monitoring."); } } catch (JMException e) { LOG.error("Error in creating ZkClientMonitor", e); } }</code><technical_language>mentioned more changes here. optional? If so, I change in this PR</technical_language>

Target:
protected ZkClient(IZkConnection zkConnection, int connectionTimeout, long operationRetryTimeout, PathBasedZkSerializer zkSerializer, String monitorType, String monitorKey, String monitorInstanceName, boolean monitorRootPathOnly) { if (zkConnection == null) { throw new NullPointerException("Zookeeper connection is null!"); } _connection = zkConnection; _pathBasedZkSerializer = zkSerializer; _operationRetryTimeoutInMillis = operationRetryTimeout; _isNewSessionEventFired = false; _asyncCallRetryThread = new ZkAsyncRetryThread(zkConnection.getServers()); _asyncCallRetryThread.start(); connect(connectionTimeout, this); try { if (monitorKey != null && !monitorKey.isEmpty() && monitorType != null && !monitorType .isEmpty()) { _monitor = new ZkClientMonitor(monitorType, monitorKey, monitorInstanceName, monitorRootPathOnly, _eventThread); _monitor.register(); } else { LOG.info("ZkClient monitor key or type is not provided. Skip monitoring."); } } catch (JMException e) { LOG.error("Error in creating ZkClientMonitor", e); } }
Source:
<code>public static ArrayList<String> getMafs(String maf_file) { <START> if (!isMafFile(maf_file)) <END> throw new RuntimeException("maf file not found"); ArrayList<String> list = null; try { list = new ArrayList<String>(); File file = new File(maf_file); Scanner sc = new Scanner(file); while (sc.hasNextLine()) { String line = sc.nextLine(); if (!line.startsWith("#")) list.add(line); } sc.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } return list; }</code><technical_language>suggestion if (!isMafFile(maf_file)) { ... }</technical_language>

Target:
public static ArrayList<String> getMafs(String maf_file) { if (!isMafFile(maf_file)) { throw new RuntimeException("maf file not found"); } ArrayList<String> list = null; try { list = new ArrayList<String>(); File file = new File(maf_file); Scanner sc = new Scanner(file); while (sc.hasNextLine()) { String line = sc.nextLine(); if (!line.startsWith("#")) { list.add(line); } } sc.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } return list; }
Source:
<code>public static void setFeatureValue(FeatureStructure aFS, Feature aFeature, Object aValue) { switch (aFeature.getRange().getName()) { case CAS.TYPE_NAME_STRING: aFS.setStringValue(aFeature, aValue == null ? null : aValue.toString()); break; case CAS.TYPE_NAME_BOOLEAN: aFS.setBooleanValue(aFeature, Boolean.valueOf(aValue.toString())); break; case CAS.TYPE_NAME_FLOAT: aFS.setFloatValue(aFeature, Float.valueOf(aValue.toString())); break; case CAS.TYPE_NAME_INTEGER: aFS.setIntValue(aFeature, Integer.valueOf(aValue.toString())); break; case CAS.TYPE_NAME_BYTE: aFS.setByteValue(aFeature, Byte.valueOf(aValue.toString())); break; case CAS.TYPE_NAME_DOUBLE: aFS.setDoubleValue(aFeature, Double.valueOf(aValue.toString())); break; case CAS.TYPE_NAME_LONG: aFS.setLongValue(aFeature, Long.valueOf(aValue.toString())); break; case CAS.TYPE_NAME_SHORT: aFS.setShortValue(aFeature, Short.valueOf(aValue.toString())); break; default: <START> } <END> }</code><technical_language>I find explicit return is in terms of readability treating default a fall-through case</technical_language>

Target:
public static void setFeatureValue(FeatureStructure aFS, Feature aFeature, Object aValue) { switch (aFeature.getRange().getName()) { case CAS.TYPE_NAME_STRING: aFS.setStringValue(aFeature, aValue == null ? null : aValue.toString()); break; case CAS.TYPE_NAME_BOOLEAN: aFS.setBooleanValue(aFeature, Boolean.valueOf(aValue.toString())); break; case CAS.TYPE_NAME_FLOAT: aFS.setFloatValue(aFeature, Float.valueOf(aValue.toString())); break; case CAS.TYPE_NAME_INTEGER: aFS.setIntValue(aFeature, Integer.valueOf(aValue.toString())); break; case CAS.TYPE_NAME_BYTE: aFS.setByteValue(aFeature, Byte.valueOf(aValue.toString())); break; case CAS.TYPE_NAME_DOUBLE: aFS.setDoubleValue(aFeature, Double.valueOf(aValue.toString())); break; case CAS.TYPE_NAME_LONG: aFS.setLongValue(aFeature, Long.valueOf(aValue.toString())); break; case CAS.TYPE_NAME_SHORT: aFS.setShortValue(aFeature, Short.valueOf(aValue.toString())); break; default: return; } }
Source:
<code>protected void runOneIteration() throws Exception { <START> logger.info("closing idle connections..."); <END> reapableConnectionManager.closeIdleConnections(clientConfig.getMaxConnectionIdleTime(), clientConfig.getMaxConnectionIdleTimeDurationTimeUnit()); }</code><technical_language>This get chatty for regular usage, it? I suggest changing level debug</technical_language>

Target:
protected void runOneIteration() throws Exception { logger.debug("closing idle connections..."); reapableConnectionManager.closeIdleConnections(clientConfig.getMaxConnectionIdleTime(), clientConfig.getMaxConnectionIdleTimeDurationTimeUnit()); }
Source:
<code>public static String initDef(String className, String body, List<Pair<TypeDescriptor, String>> params, Boolean stateMachine) { StringBuilder source = new StringBuilder(""); source.append(ModifierNames.NoReturn + " "); source.append(className + "::" + GenerationNames.initFunctionName(className) + "("); source.append(PrivateFunctionalTemplates.paramList(params) + ")"); source.append("\n{\n"); source.append(GenerationNames.InitializerFixFunctionNames.InitPorts + "();\n"); if (stateMachine) { source.append(GenerationNames.InitializerFixFunctionNames.InitStateMachine + "();\n"); } source.append(body + "\n"); source.append("}\n"); <START> return source.toString(); <END> }</code><technical_language>a insignificant issue, is StringBuilder needed in methods above</technical_language>

Target:
public static String initDef(String className, String body, List<Pair<TypeDescriptor, String>> params, Boolean stateMachine) { StringBuilder source = new StringBuilder(""); source.append(ModifierNames.NoReturn + " "); source.append(className + "::" + GenerationNames.initFunctionName(className) + "("); source.append(PrivateFunctionalTemplates.paramList(params) + ")" + "\n{\n"); source.append(GenerationNames.InitializerFixFunctionNames.InitPorts + "();\n"); if (stateMachine) { source.append(GenerationNames.InitializerFixFunctionNames.InitStateMachine + "();\n"); } source.append(body + "\n" + "}\n"); return source.toString(); }
Source:
<code>public DistributedRuntimeUDFContext createRuntimeContext(MetricGroup metrics) { Environment env = getEnvironment(); return new IterativeRuntimeUdfContext(env.getTaskInfo(), getUserCodeClassLoader(), <START> getExecutionConfig(), env.getDistributedCacheEntries(), this.accumulatorMap, metrics, ExternalResourceUtils.getExternalResourceInfo(env.getExternalResourceDrivers(), env.getTaskManagerInfo().getConfiguration())); <END> }</code><technical_language>expensive do expect calls ExternalResourceDrivers be? wondering retrieve ExternalResourceInfos for task, independent of need not. I I prefer this feature add additional costs for tasks want it</technical_language>

Target:
public DistributedRuntimeUDFContext createRuntimeContext(MetricGroup metrics) { Environment env = getEnvironment(); return new IterativeRuntimeUdfContext(env.getTaskInfo(), getUserCodeClassLoader(), getExecutionConfig(), env.getDistributedCacheEntries(), this.accumulatorMap, metrics, env.getExternalResourceInfoProvider()); }
Source:
<code>public static String getOriginalFromTempFilename (String filename) { <START> if (filename.endsWith(".tmp")) <END> { return filename.substring(0, filename.length() - TEMP_LEN); } else { return filename; } }</code><technical_language>tmp a constant dont prevent nullpointerexception for filename</technical_language>

Target:
public static String getOriginalFromTempFilename (String filename) { if (filename.endsWith(TEMP_FILE_EXT)) { return filename.substring(0, filename.length() - TEMP_LEN); } else { return filename; } }
Source:
<code>public SortedSet<String> getCurrentChildren(String fullPath) { TreeNode node = find(fullPath); if ( node == null || node.nodeState.get() != NodeState.LIVE ) { return null; } ConcurrentMap<String, TreeNode> map = node.children.get(); SortedSet<String> result; if ( map == null ) { <START> result = Collections.emptySortedSet(); <END> } else { result = ImmutableSortedSet.copyOf(map.keySet()); } return node.nodeState.get() == NodeState.LIVE ? result : null; }</code><technical_language>Collections.emptySortedSet() is a new addition Java 1.8. Curator is building Java 1.6</technical_language>

Target:
public Map<String, ChildData> getCurrentChildren(String fullPath) { TreeNode node = find(fullPath); if ( node == null || node.nodeState.get() != NodeState.LIVE ) { return null; } ConcurrentMap<String, TreeNode> map = node.children.get(); Map<String, ChildData> result; if ( map == null ) { result = ImmutableMap.of(); } else { ImmutableMap.Builder<String, ChildData> builder = ImmutableMap.builder(); for ( Map.Entry<String, TreeNode> entry : map.entrySet() ) { TreeNode childNode = entry.getValue(); ChildData childData = new ChildData(childNode.path, childNode.stat.get(), childNode.data.get()); if ( childNode.nodeState.get() == NodeState.LIVE ) { builder.put(entry.getKey(), childData); } } result = builder.build(); } return node.nodeState.get() == NodeState.LIVE ? result : null; }
Source:
<code>protected Operation prepareOperation() { MapOperationProvider operationProvider = getMapOperationProvider(parameters.name); MapOperation op; <START> if (parameters.ttl == DEFAULT_TTL) { <END> op = operationProvider.createPutIfAbsentOperation(parameters.name, parameters.key, parameters.value); } else { op = operationProvider.createPutIfAbsentWithExpiryOperation(parameters.name, parameters.key, parameters.value, parameters.ttl, DEFAULT_MAX_IDLE); } op.setThreadId(parameters.threadId); return op; }</code><technical_language>this repeated logic in message tasks & member-side map proxy hidden MapOperationProvider eg: MapOperation createPutIfAbsentOperation(String name, Data dataKey, Data value, long ttl, long maxIdle) { if (ttl == DEFAULT_TTL) { return new PutIfAbsentOperation(..); } else { return new PutIfAbsentWithExpiryOperation(..); } }</technical_language>

Target:
protected Operation prepareOperation() { MapOperationProvider operationProvider = getMapOperationProvider(parameters.name); MapOperation op = operationProvider.createPutIfAbsentOperation(parameters.name, parameters.key, parameters.value, parameters.ttl, DEFAULT_MAX_IDLE); op.setThreadId(parameters.threadId); return op; }
Source:
<code>public static MultiFactorAuthenticationService createServiceFrom(final HttpServletRequest request, final HttpClient httpClient, final List<String> supportedLevelsOfAuthentication) { LOGGER.debug("Attempting to extract multifactor authentication parameters from the request"); final String targetService = request.getParameter(CONST_PARAM_TARGET_SERVICE); final String loa = request.getParameter(CONST_PARAM_LOA); final String serviceToUse = StringUtils.hasText(targetService) ? targetService : request.getParameter(CONST_PARAM_SERVICE); if (!StringUtils.hasText(serviceToUse)) { LOGGER.debug("Request has no service associated with it."); return null; } if (!StringUtils.hasText(loa)) { <START> LOGGER.debug("Request has no associated with it.", CONST_PARAM_LOA); <END> return null; } if (!supportedLevelsOfAuthentication.contains(loa)) { LOGGER.debug("Multifactor authentication service does not support parameter value [{}].", CONST_PARAM_LOA, loa); return null; } final String id = cleanupUrl(serviceToUse); final String artifactId = request.getParameter(CONST_PARAM_TICKET); final MultiFactorAuthenticationService svc = new MultiFactorAuthenticationService(id, serviceToUse, artifactId, httpClient, loa); LOGGER.debug("Created multifactor authentication request for with as [{}].", svc.getId(), CONST_PARAM_LOA, svc.getLOA()); return svc; }</code><technical_language>"Request request parameter '{}'." More precise associated. :)</technical_language>

Target:
public static MultiFactorAuthenticationService createServiceFrom(final HttpServletRequest request, final HttpClient httpClient, final List<String> supportedLevelsOfAuthentication) { LOGGER.debug("Attempting to extract multifactor authentication parameters from the request"); final String targetService = request.getParameter(CONST_PARAM_TARGET_SERVICE); final String loa = request.getParameter(CONST_PARAM_LOA); final String serviceToUse = StringUtils.hasText(targetService) ? targetService : request.getParameter(CONST_PARAM_SERVICE); if (!StringUtils.hasText(serviceToUse)) { LOGGER.debug("Request has no request parameter [{}]", CONST_PARAM_SERVICE); return null; } if (!StringUtils.hasText(loa)) { LOGGER.debug("Request has no request parameter [{}]", CONST_PARAM_LOA); return null; } if (!supportedLevelsOfAuthentication.contains(loa)) { LOGGER.debug("Multifactor authentication service does not support parameter value [{}].", CONST_PARAM_LOA, loa); return null; } final String id = cleanupUrl(serviceToUse); final String artifactId = request.getParameter(CONST_PARAM_TICKET); final MultiFactorAuthenticationService svc = new MultiFactorAuthenticationService(id, serviceToUse, artifactId, httpClient, loa); LOGGER.debug("Created multifactor authentication request for with as [{}].", svc.getId(), CONST_PARAM_LOA, svc.getLoa()); return svc; }
Source:
<code>public boolean isActive(FeatureState featureState, FeatureUser user) { ApplicationContext applicationContext = ContextClassLoaderApplicationContextHolder.get(); if (applicationContext == null) { return false; } <START> Environment environment = applicationContext.getEnvironment(); <END> return environment.getProperty(getPropertyName(featureState), Boolean.TYPE, false); }</code><technical_language>Please move "else", is return point</technical_language>

Target:
public boolean isActive(FeatureState featureState, FeatureUser user) { ApplicationContext applicationContext = ContextClassLoaderApplicationContextHolder.get(); if (applicationContext == null) { throw new IllegalStateException("ApplicationContext could not be found, which can occur if there is no " + "bean for TogglzApplicationContextBinderApplicationListener when TogglzAutoConfiguration is not " + "being used"); } Environment environment = applicationContext.getEnvironment(); return environment.getProperty(getPropertyName(featureState), Boolean.TYPE, false); }
Source:
<code>public File renameInvalidSource() throws StorageException { <START> File sourcedFile = sourceFile(here); <END> File renamedFile = new File(here, String.format("%s%s", sourcedFile.getName(), ".error")); if (!sourcedFile.renameTo(renamedFile)) { throw new StorageException("Error renaming file"); } return renamedFile; }</code><technical_language>matters "sourceFile"</technical_language>

Target:
public File renameInvalidSource() throws StorageException { File sourceFile = sourceFile(here); File renamedFile = new File(here, String.format("%s.error", sourceFile.getName())); if (!sourceFile.renameTo(renamedFile)) { throw new StorageException("Error renaming file"); } return renamedFile; }
Source:
<code>public <T extends OAuth2AuthorizedClient> T loadAuthorizedClient(String clientRegistrationId, String principalName) { Assert.hasText(clientRegistrationId, "clientRegistrationId cannot be empty"); Assert.hasText(principalName, "principalName cannot be empty"); SqlParameterValue[] parameters = new SqlParameterValue[] { new SqlParameterValue(Types.VARCHAR, clientRegistrationId), new SqlParameterValue(Types.VARCHAR, principalName) }; try (LobCreator lobCreator = this.lobHandler.getLobCreator()) { <START> PreparedStatementSetter pss = new LobCreatorArgumentPreparedStatementSetter(lobCreator, parameters); <END> List<OAuth2AuthorizedClient> result = this.jdbcOperations.query(LOAD_AUTHORIZED_CLIENT_SQL, pss, this.authorizedClientRowMapper); return !result.isEmpty() ? (T) result.get(0) : null; } }</code><technical_language>revert ArgumentPreparedStatementSetter OAuth2AuthorizedClientRowMapper handle reading of BLOB</technical_language>

Target:
public <T extends OAuth2AuthorizedClient> T loadAuthorizedClient(String clientRegistrationId, String principalName) { Assert.hasText(clientRegistrationId, "clientRegistrationId cannot be empty"); Assert.hasText(principalName, "principalName cannot be empty"); SqlParameterValue[] parameters = new SqlParameterValue[] { new SqlParameterValue(Types.VARCHAR, clientRegistrationId), new SqlParameterValue(Types.VARCHAR, principalName) }; PreparedStatementSetter pss = new ArgumentPreparedStatementSetter(parameters); List<OAuth2AuthorizedClient> result = this.jdbcOperations.query(LOAD_AUTHORIZED_CLIENT_SQL, pss, this.authorizedClientRowMapper); return !result.isEmpty() ? (T) result.get(0) : null; }
Source:
<code>public void deploy(MavenProject project, String container, RuntimeStrategy strategy) throws MojoFailureException { KieContainerResource kieContainer = new KieContainerResource(); kieContainer.setContainerId(container); ReleaseId releaseId = new ReleaseId(); releaseId.setGroupId(project.getGroupId()); releaseId.setArtifactId(project.getArtifactId()); releaseId.setVersion(project.getVersion()); kieContainer.setReleaseId(releaseId); <START> KieServerConfigItem configItem = new KieServerConfigItem(); <END> configItem.setName("RuntimeStrategy"); configItem.setValue(strategy.name()); configItem.setType("BPM"); kieContainer.addConfigItem(configItem); ServiceResponse<KieContainerResource> serviceResponse = client.createContainer(container, kieContainer); ServiceResponse.ResponseType type = serviceResponse.getType(); String msg = serviceResponse.getMsg(); LOG.info("Deploy Response: {}", serviceResponse); if (ServiceResponse.ResponseType.FAILURE.equals(type)) { throw new MojoFailureException(msg); } }</code><technical_language>I thinking this optional add this config property is easily replace set in jar's deployment descriptor. wdyt</technical_language>

Target:
public void deploy(MavenProject project, String container, RuntimeStrategy strategy) throws MojoFailureException { KieContainerResource kieContainer = new KieContainerResource(); kieContainer.setContainerId(container); ReleaseId releaseId = new ReleaseId(); releaseId.setGroupId(project.getGroupId()); releaseId.setArtifactId(project.getArtifactId()); releaseId.setVersion(project.getVersion()); kieContainer.setReleaseId(releaseId); if (strategy != null) { KieServerConfigItem configItem = new KieServerConfigItem(); configItem.setName("RuntimeStrategy"); configItem.setValue(strategy.name()); configItem.setType("BPM"); kieContainer.addConfigItem(configItem); } ServiceResponse<KieContainerResource> serviceResponse = client.createContainer(container, kieContainer); ServiceResponse.ResponseType type = serviceResponse.getType(); String msg = serviceResponse.getMsg(); LOG.info("Deploy Response: {}", serviceResponse); if (ServiceResponse.ResponseType.FAILURE.equals(type)) { throw new MojoFailureException(msg); } }
Source:
<code>public ScheduleBootstrapper scheduleBootstrapper() { return new ScheduleBootstrapper( <START> executorService(10, "ScheduleBootstrapper"), <END> workers.scheduleBootstrapTaskFactory() ); }</code><technical_language>magic number</technical_language>

Target:
public ScheduleBootstrapper scheduleBootstrapper() { return new ScheduleBootstrapper( executorService(NUMBER_OF_SCHEDULE_BOOTSTRAP_THREADS, "ScheduleBootstrapper"), workers.scheduleBootstrapTaskFactory() ); }
Source:
<code>public SqlJsonPrettyFunction() { super("JSON_PRETTY", SqlKind.OTHER_FUNCTION, <START> ReturnTypes.explicit(SqlTypeName.VARCHAR, 20), <END> null, OperandTypes.ANY, SqlFunctionCategory.SYSTEM); }</code><technical_language>precision bigger? For instance, VARCHAR_2000: <LINK_0></technical_language>

Target:
public SqlJsonPrettyFunction() { super("JSON_PRETTY", SqlKind.OTHER_FUNCTION, ReturnTypes.VARCHAR_2000, null, OperandTypes.ANY, SqlFunctionCategory.SYSTEM); }
Source:
<code>public JSchUIConnectionManager(IRemoteServices services) { fConnMgr = (JSchConnectionManager) services.getConnectionManager(); <START> fConnMgr.setDefaultAuthenticatorFactory(new IUserAuthenticatorFactory() { <END> @Override public IUserAuthenticator createUserAuthenticator(IRemoteConnection conn) { return new RemoteAuthenticator(conn); } }); }</code><technical_language>Please initialization code out of Activator class</technical_language>

Target:
public JSchUIConnectionManager(IRemoteServices services) { fConnMgr = (JSchConnectionManager) services.getConnectionManager(); }
Source:
<code>public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException { Preconditions.checkNotNull(sender, "Sender cannot be null"); Preconditions.checkNotNull(args, "Arguments cannot be null"); Preconditions.checkNotNull(alias, "Alias cannot be null"); switch (args.length) { case 1: return StringUtil.copyPartialMatches(args[0], SUBCOMMANDS, new ArrayList<>(SUBCOMMANDS.size())); case 2: switch (SUBCOMMAND_MAP.get(args[0])) { case PROPERTY: return StringUtil .copyPartialMatches(args[1], <START> System.getProperties().stringPropertyNames(), <END> new ArrayList<>( System.getProperties().stringPropertyNames() .size())); case WORLD: if (sender instanceof Player) { Collection<String> worlds = getWorldNames(); return StringUtil .copyPartialMatches(args[1], worlds, new ArrayList<>(worlds.size())); } default: } default: } return Collections.emptyList(); }</code><technical_language>whitespace? readable</technical_language>

Target:
public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException { Preconditions.checkNotNull(sender, "Sender cannot be null"); Preconditions.checkNotNull(args, "Arguments cannot be null"); Preconditions.checkNotNull(alias, "Alias cannot be null"); switch (args.length) { case 1: return StringUtil.copyPartialMatches(args[0], SUBCOMMANDS, new ArrayList<>(SUBCOMMANDS.size())); case 2: switch (SUBCOMMAND_MAP.get(args[0])) { case PROPERTY: Set<String> propertyNames = System.getProperties().stringPropertyNames(); return StringUtil.copyPartialMatches(args[1], propertyNames, new ArrayList<>(propertyNames.size())); case WORLD: if (sender instanceof Player) { Collection<String> worlds = getWorldNames(); return StringUtil.copyPartialMatches(args[1], worlds, new ArrayList<>(worlds.size())); } default: } default: } return Collections.emptyList(); }
Source:
<code>public SiteRequestCondition combine(SiteRequestCondition other) { Set<String> combinedIncludedSites = new ImmutableSet.Builder<String>() .addAll(includedSites) .addAll(other.includedSites) .build(); Set<String> combinedExcludedSites = new ImmutableSet.Builder<String>() .addAll(excludedSites) .addAll(other.excludedSites) .build(); <START> return new SiteRequestCondition(siteSet, siteResolver, combinedIncludedSites, combinedExcludedSites); <END> }</code><technical_language>100% clear Spring this method, do need guard combinedIncludedSites combinedExcludedSites overlapping elements? (For matter, check in constructor also.)</technical_language>

Target:
public SiteRequestCondition combine(SiteRequestCondition other) { Set<String> combinedIncludedSites = new ImmutableSet.Builder<String>() .addAll(includedSites) .addAll(other.includedSites) .build(); Set<String> combinedExcludedSites = new ImmutableSet.Builder<String>() .addAll(excludedSites) .addAll(other.excludedSites) .build(); return create(siteSet, siteResolver, combinedIncludedSites, combinedExcludedSites); }
Source:
<code>public void removeAll(final Iterable<? extends K> keys) { statusTransitioner.checkAvailable(); checkNonNull(keys); Function<Iterable<? extends Map.Entry<? extends K, ? extends V>>, Iterable<? extends Map.Entry<? extends K, ? extends V>>> removalFunction = <START> memoize(new Function<Iterable<? extends Map.Entry<? extends K, ? extends V>>, Iterable<? extends Map.Entry<? extends K, ? extends V>>>() { <END> @Override public Iterable<? extends Map.Entry<? extends K, ? extends V>> apply(Iterable<? extends Map.Entry<? extends K, ? extends V>> entries) { if (cacheWriter != null) { try { cacheWriter.deleteAll(new KeysIterable(entries)); } catch (Exception e) { throw newCacheWriterException(e); } } return new NullValuesIterable(keys); } }); try { store.bulkCompute(keys, removalFunction); } catch (CacheAccessException e) { try { removalFunction.apply(new NullValuesIterable(keys)); } finally { attemptRecovery(keys, e); } } catch (CacheWriterException e) { attemptRecovery(keys, e); throw e; } }</code><technical_language>I this memoized... Store able call this multiple times sets of keys</technical_language>

Target:
public void removeAll(final Iterable<? extends K> keys) { statusTransitioner.checkAvailable(); checkNonNull(keys); final Map<K, ? extends V> entriesToRemove = new HashMap<K, V>(); for (K key: keys) { entriesToRemove.put(key, null); } Function<Iterable<? extends Map.Entry<? extends K, ? extends V>>, Iterable<? extends Map.Entry<? extends K, ? extends V>>> removalFunction = new Function<Iterable<? extends Map.Entry<? extends K, ? extends V>>, Iterable<? extends Map.Entry<? extends K, ? extends V>>>() { @Override public Iterable<? extends Map.Entry<? extends K, ? extends V>> apply(Iterable<? extends Map.Entry<? extends K, ? extends V>> entries) { Iterable<Map.Entry<K, V>> ret = new NullValuesIterable(entries); for (Map.Entry<K, V> entry: ret) { entriesToRemove.remove(entry.getKey()); } if (cacheWriter != null) { try { cacheWriter.deleteAll(new KeysIterable(entries)); } catch (Exception e) { throw newCacheWriterException(e); } } return ret; } }; try { store.bulkCompute(keys, removalFunction); } catch (CacheAccessException e) { try { if (!entriesToRemove.isEmpty()) { removalFunction.apply(entriesToRemove.entrySet()); } } finally { removeKeysWithStrategy(keys, e); } } catch (CacheWriterException e) { removeKeysWithStrategy(keys, e); throw e; } }