auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static Name combineAlternatives(MemberInvolvementTree attribute) { Name name1 = attribute.shallowToString(); Name name2 = attribute.getAlternative().shallowToString(); <START> if (name1.toString().compareTo(name2.toString()) < 0) { <END> name1.addWords(name2.getWords()); return name1; } else { name2.addWords(name1.getWords()); return name2; } }</code><technical_language>Names comparable, use: name1.compareTo(name2) < 0</technical_language>

Target:
private Name combineAlternatives(MemberInvolvementTree attribute) { Name name1 = attribute.shallowToString(); Name name2 = attribute.getAlternative().shallowToString(); if (name1.compareTo(name2) < 0) { return names.concatenate(name1, name2); } else { return names.concatenate(name2, name1); } }
Source:
<code><START> public void testAdjacentParallel(Routing routing1, Routing routing2) throws Exception { <END> checkUdpSupported(); List<String> stringList = getListOfUniqueStrings(800); String stringArray[] = new String[800]; stringArray = stringList.toArray(stringArray); Topology topology = newTopology("testAdj"); TStream<String> out0 = topology.strings(stringArray).parallel(of(20), routing1); out0 = out0.transform(randomStringProducer("region1")).endParallel(); TStream<String> out2 = out0.parallel(of(5), routing2); out2 = out2.transform(randomStringProducer("region2")).endParallel(); TStream<String> numRegions = out2.flatMap(uniqueStringCounter(800, "region")); Tester tester = topology.getTester(); Condition<List<String>> assertFinished = tester.stringContentsUnordered(numRegions, "20", "5"); Condition<Long> expectedCount = tester.tupleCount(out2, 800); complete(tester, allConditions(assertFinished, expectedCount), 60, TimeUnit.SECONDS); assertTrue(expectedCount.valid()); assertTrue(assertFinished.valid()); }</code><technical_language>private method - in this test</technical_language>

Target:
private void testAdjacentParallel(Routing routing1, Routing routing2) throws Exception { checkUdpSupported(); List<String> stringList = getListOfUniqueStrings(800); String stringArray[] = new String[800]; stringArray = stringList.toArray(stringArray); Topology topology = newTopology("testAdj"); TStream<String> out0 = topology.strings(stringArray).parallel(of(20), routing1); out0 = out0.transform(randomStringProducer("region1")).endParallel(); TStream<String> out2 = out0.parallel(of(5), routing2); out2 = out2.transform(randomStringProducer("region2")).endParallel(); TStream<String> numRegions = out2.flatMap(uniqueStringCounter(800, "region")); Tester tester = topology.getTester(); Condition<List<String>> assertFinished = tester.stringContentsUnordered(numRegions, "20", "5"); Condition<Long> expectedCount = tester.tupleCount(out2, 800); complete(tester, allConditions(assertFinished, expectedCount), 60, TimeUnit.SECONDS); assertTrue(expectedCount.valid()); assertTrue(assertFinished.valid()); }
Source:
<code>public void setUp() { orderedExecutor = Executors.newSingleThreadExecutor(); unorderedExecutor = Executors.newCachedThreadPool(); store = mock(Store.class); <START> TestTimeSource timeSource = new TestTimeSource(); <END> eventService = new CacheEventNotificationServiceImpl<Number, String>(orderedExecutor, unorderedExecutor, store, timeSource); listener = mock(CacheEventListener.class); }</code><technical_language>question previous TestTimeSource inclusion - reinforces point moving SystemTimeSource</technical_language>

Target:
public void setUp() { orderedExecutor = Executors.newSingleThreadExecutor(); unorderedExecutor = Executors.newCachedThreadPool(); store = mock(Store.class); TimeSource timeSource = SystemTimeSource.INSTANCE; eventService = new CacheEventNotificationServiceImpl<Number, String>(orderedExecutor, unorderedExecutor, store, timeSource); listener = mock(CacheEventListener.class); }
Source:
<code>public ActionResult execute() { Intent intent = Intent.valueOf(getNonNullRequestParamValue(Const.ParamsNames.INTENT)); InstructorAttributes instructorAttributes; InstructorData instructorData; String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); switch (intent) { case INSTRUCTOR_SUBMISSION: instructorAttributes = getInstructorOfCourseFromRequest(courseId); if (instructorAttributes == null) { return new JsonResult("Instructor could not be found for this course", HttpStatus.SC_NOT_FOUND); } instructorData = new InstructorData(instructorAttributes); break; case FULL_DETAIL: instructorAttributes = logic.getInstructorForGoogleId(courseId, userInfo.getId()); if (instructorAttributes == null) { return new JsonResult("Instructor could not be found for this course", HttpStatus.SC_NOT_FOUND); <START> } <END> instructorData = new InstructorData(instructorAttributes); instructorData.setGoogleId(instructorAttributes.googleId); break; default: throw new InvalidHttpParameterException("Unknown intent " + intent); } return new JsonResult(instructorData); }</code><technical_language>previous implementation is DRY, this is not. add some line of code populate Google ID necessary, e.g. java if (instructorAttributes == null) { return new JsonResult("Instructor for this course", HttpStatus.SC_NOT_FOUND); } InstructorData instructorData = new InstructorData(instructorAttributes); if (intent == Intent.FULL_DETAIL) { instructorData.setGoogleId(instructorAttributes.googleId); } return new JsonResult(instructorData);</technical_language>

Target:
public ActionResult execute() { Intent intent = Intent.valueOf(getNonNullRequestParamValue(Const.ParamsNames.INTENT)); InstructorAttributes instructorAttributes; String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); switch (intent) { case INSTRUCTOR_SUBMISSION: instructorAttributes = getInstructorOfCourseFromRequest(courseId); break; case FULL_DETAIL: instructorAttributes = logic.getInstructorForGoogleId(courseId, userInfo.getId()); break; default: throw new InvalidHttpParameterException("Unknown intent " + intent); } if (instructorAttributes == null) { return new JsonResult("Instructor could not be found for this course", HttpStatus.SC_NOT_FOUND); } InstructorData instructorData = new InstructorData(instructorAttributes); if (intent == Intent.FULL_DETAIL) { instructorData.setGoogleId(instructorAttributes.googleId); } return new JsonResult(instructorData); }
Source:
<code>void display(final ProjectDetail result) { final Project project = result.project; final Project.NameKey wildKey = Gerrit.getConfig().getWildProject(); final boolean isWild = wildKey.equals(project.getNameKey()); Project.NameKey parent = project.getParent(); if (parent == null) { parent = wildKey; } parentPanel.setVisible(!isWild); parentName.setTargetHistoryToken(Dispatcher.toProjectAdmin(parent, ProjectAdminScreen.ACCESS_TAB)); parentName.setText(parent.get()); <START> rights.display(result.groups, result.rights, !result.canModifyData); <END> }</code><technical_language>ability delete access rule is per-access rule, of per-reference ownership features. delete button visible for a InheritedRefRight if user ownership reference space RefControl. DeleteRefRights logic server is determine if this row removed. exported InheritedRefRight a new boolean field UI show (or hide) delete checkbox</technical_language>

Target:
void display(final ProjectDetail result) { final Project project = result.project; final Project.NameKey wildKey = Gerrit.getConfig().getWildProject(); final boolean isWild = wildKey.equals(project.getNameKey()); Project.NameKey parent = project.getParent(); if (parent == null) { parent = wildKey; } parentPanel.setVisible(!isWild); parentName.setTargetHistoryToken(Dispatcher.toProjectAdmin(parent, ProjectAdminScreen.ACCESS_TAB)); parentName.setText(parent.get()); rights.display(result.groups, result.rights); addPanel.setVisible(result.canModifyAccess); delRight.setVisible(rights.getCanDelete()); }
Source:
<code>public String getExpectedFailureValue() { <START> return content.substring(5, content.length()-1); <END> }</code><technical_language>"fail[]".length() instead of 5</technical_language>

Target:
public String getExpectedFailureValue() { return content.substring(INEQUALITY_START_TOKEN.length(), content.length()-INEQUALITY_END_TOKEN.length()); }
Source:
<code>private static HiveTableDefinition.HiveTableDefinitionBuilder tableDefinitionBuilder(String fileFormat, Optional<String> recommendTableName, Optional<String> rowFormat) { String tableName = format("%s_hive_coercion", recommendTableName.orElse(fileFormat).toLowerCase(Locale.ENGLISH)); String floatToDoubleType = fileFormat.toLowerCase(Locale.ENGLISH).contains("parquet") ? "DOUBLE" : "FLOAT"; return HiveTableDefinition.builder(tableName) .setCreateTableDDLTemplate("" + "CREATE TABLE %NAME%(" + " tinyint_to_smallint TINYINT," + " tinyint_to_int TINYINT," + " tinyint_to_bigint TINYINT," + " smallint_to_int SMALLINT," + " smallint_to_bigint SMALLINT," + " int_to_bigint INT," + " bigint_to_varchar BIGINT," + " float_to_double " + floatToDoubleType + "," + " row_to_row STRUCT<keep: STRING, ti2si: TINYINT, si2int: SMALLINT, int2bi: INT, bi2vc: BIGINT>," + " list_to_list ARRAY<STRUCT<ti2int: TINYINT, si2bi: SMALLINT, bi2vc: BIGINT, remove: STRING>>," + " map_to_map MAP<TINYINT, STRUCT<ti2bi: TINYINT, int2bi: INT, float2double: " + floatToDoubleType + ">>" + ") " + "PARTITIONED BY (id BIGINT) " + <START> rowFormat.map(s -> "ROW FORMAT " + s + " ").orElse(" ") + <END> "STORED AS " + fileFormat); }</code><technical_language>replace "ROW FORMAT " + s + " " format(...)</technical_language>

Target:
private static HiveTableDefinition.HiveTableDefinitionBuilder tableDefinitionBuilder(String fileFormat, Optional<String> recommendTableName, Optional<String> rowFormat) { String tableName = format("%s_hive_coercion", recommendTableName.orElse(fileFormat).toLowerCase(Locale.ENGLISH)); String floatToDoubleType = fileFormat.toLowerCase(Locale.ENGLISH).contains("parquet") ? "DOUBLE" : "FLOAT"; return HiveTableDefinition.builder(tableName) .setCreateTableDDLTemplate("" + "CREATE TABLE %NAME%(" + " tinyint_to_smallint TINYINT," + " tinyint_to_int TINYINT," + " tinyint_to_bigint TINYINT," + " smallint_to_int SMALLINT," + " smallint_to_bigint SMALLINT," + " int_to_bigint INT," + " bigint_to_varchar BIGINT," + " float_to_double " + floatToDoubleType + "," + " row_to_row STRUCT<keep: STRING, ti2si: TINYINT, si2int: SMALLINT, int2bi: INT, bi2vc: BIGINT>," + " list_to_list ARRAY<STRUCT<ti2int: TINYINT, si2bi: SMALLINT, bi2vc: BIGINT, remove: STRING>>," + " map_to_map MAP<TINYINT, STRUCT<ti2bi: TINYINT, int2bi: INT, float2double: " + floatToDoubleType + ">>" + ") " + "PARTITIONED BY (id BIGINT) " + rowFormat.map(s -> format("ROW FORMAT %s ", s)).orElse("") + "STORED AS " + fileFormat); }
Source:
<code>public void builderWithThreshold() { Registry r = newRegistry(); PercentileDistributionSummary t = PercentileDistributionSummary.builder(r) .withName("test") .withThreshold(100_000) .build(); <START> checkPercentiles(t, 25); <END> }</code><technical_language>Is this needed default accuracy unreliable for <25</technical_language>

Target:
public void builderWithThreshold() { Registry r = newRegistry(); PercentileDistributionSummary t = PercentileDistributionSummary.builder(r) .withName("test") .withRange(25_000, 100_000) .build(); checkPercentiles(t, 25); }
Source:
<code>BuilderExecutionSettings() { myEmbeddedGradleDaemonEnabled = SystemProperties.getBooleanProperty(BuildProcessJvmArgs.USE_EMBEDDED_GRADLE_DAEMON, false); myGradleDaemonMaxIdleTimeInMs = SystemProperties.getIntProperty(BuildProcessJvmArgs.GRADLE_DAEMON_MAX_IDLE_TIME_IN_MS, -1); myGradleDaemonVmOptions = getJvmOptions(); myGradleHomeDir = findDir(BuildProcessJvmArgs.GRADLE_HOME_DIR_PATH, "Gradle home"); myGradleServiceDir = findDir(BuildProcessJvmArgs.GRADLE_SERVICE_DIR_PATH, "Gradle service"); myJavaHomeDir = findDir(BuildProcessJvmArgs.GRADLE_JAVA_HOME_DIR_PATH, "Java home"); myProjectDir = findProjectRootDir(); String buildActionName = System.getProperty(BuildProcessJvmArgs.BUILD_ACTION); <START> myBuildAction = BuildAction.valueOf(buildActionName); <END> myVerboseLoggingEnabled = SystemProperties.getBooleanProperty(BuildProcessJvmArgs.USE_GRADLE_VERBOSE_LOGGING, false); myParallelBuild = SystemProperties.getBooleanProperty(GlobalOptions.COMPILE_PARALLEL_OPTION, false); }</code><technical_language>Is buildActionName *guaranteed* defined? If not, I Enum#valueOf throw exception; a null check set default in case</technical_language>

Target:
BuilderExecutionSettings() { myEmbeddedGradleDaemonEnabled = SystemProperties.getBooleanProperty(BuildProcessJvmArgs.USE_EMBEDDED_GRADLE_DAEMON, false); myGradleDaemonMaxIdleTimeInMs = SystemProperties.getIntProperty(BuildProcessJvmArgs.GRADLE_DAEMON_MAX_IDLE_TIME_IN_MS, -1); myGradleDaemonVmOptions = getJvmOptions(); myGradleHomeDir = findDir(BuildProcessJvmArgs.GRADLE_HOME_DIR_PATH, "Gradle home"); myGradleServiceDir = findDir(BuildProcessJvmArgs.GRADLE_SERVICE_DIR_PATH, "Gradle service"); myJavaHomeDir = findDir(BuildProcessJvmArgs.GRADLE_JAVA_HOME_DIR_PATH, "Java home"); myProjectDir = findProjectRootDir(); String buildActionName = System.getProperty(BuildProcessJvmArgs.BUILD_ACTION); myBuildMode = Strings.isNullOrEmpty(buildActionName) ? BuildMode.DEFAULT_BUILD_MODE : BuildMode.valueOf(buildActionName); myVerboseLoggingEnabled = SystemProperties.getBooleanProperty(BuildProcessJvmArgs.USE_GRADLE_VERBOSE_LOGGING, false); myParallelBuild = SystemProperties.getBooleanProperty(GlobalOptions.COMPILE_PARALLEL_OPTION, false); }
Source:
<code>protected void copyAttachments(SQLDatabase db, long parentSequence, long newSequence) throws AttachmentException { Cursor c = null; try { c = db.rawQuery(SQL_ATTACHMENTS_SELECT_ALL, new String[]{String.valueOf(parentSequence)}); copyCursorValuesToNewSequence(db, c, newSequence); } catch (SQLException e){ throw new AttachmentException("Failed to copy attachments",e); <START> }finally { <END> DatabaseUtils.closeCursorQuietly(c); } }</code><technical_language>spacing; more of these</technical_language>

Target:
protected void copyAttachments(SQLDatabase db, long parentSequence, long newSequence) throws DatastoreException { Cursor c = null; try { c = db.rawQuery(SQL_ATTACHMENTS_SELECT_ALL, new String[]{String.valueOf(parentSequence)}); copyCursorValuesToNewSequence(db, c, newSequence); } catch (SQLException e){ throw new DatastoreException("Failed to copy attachments", e); }finally { DatabaseUtils.closeCursorQuietly(c); } }
Source:
<code>public void updateTest() { String preupdateString = "preupdate"; String user0 = "user0"; String user1 = "user1"; String user2 = "user2"; OPartitionedDatabasePool pool = orientDBClient.getDatabasePool(); <START> ODatabaseDocumentTx db = pool.acquire(); <END> try { for (String key : Arrays.asList(user0, user1, user2)) { ODocument doc = new ODocument(CLASS); for (int i = 0; i < NUM_FIELDS; i++) { doc.field(FIELD_PREFIX + i, preupdateString); } doc.save(); ODictionary<ORecord> dictionary = db.getDictionary(); dictionary.put(key, doc); } } finally { db.close(); } HashMap<String, ByteIterator> updateMap = new HashMap<>(); for (int i = 0; i < NUM_FIELDS; i++) { updateMap.put(FIELD_PREFIX + i, new StringByteIterator(buildDeterministicValue(user1, FIELD_PREFIX + i))); } orientDBClient.update(CLASS, user1, updateMap); db = pool.acquire(); try { ODictionary<ORecord> dictionary = db.getDictionary(); ODocument result = dictionary.get(user0); for (int i = 0; i < NUM_FIELDS; i++) { assertEquals("Assert first row fields contain preupdateString", result.field(FIELD_PREFIX + i), preupdateString); } result = dictionary.get(user1); for (int i = 0; i < NUM_FIELDS; i++) { assertEquals("Assert updated row fields are correct", result.field(FIELD_PREFIX + i), updateMap.get(FIELD_PREFIX + i).toString()); } result = dictionary.get(user2); for (int i = 0; i < NUM_FIELDS; i++) { assertEquals("Assert third row fields contain preupdateString", result.field(FIELD_PREFIX + i), preupdateString); } } finally { db.close(); } }</code><technical_language>This a try w/ resources. other pool.acquire() calls</technical_language>

Target:
public void updateTest() { String preupdateString = "preupdate"; String user0 = "user0"; String user1 = "user1"; String user2 = "user2"; OPartitionedDatabasePool pool = orientDBClient.getDatabasePool(); try(ODatabaseDocumentTx db = pool.acquire()) { for (String key : Arrays.asList(user0, user1, user2)) { ODocument doc = new ODocument(CLASS); for (int i = 0; i < NUM_FIELDS; i++) { doc.field(FIELD_PREFIX + i, preupdateString); } doc.save(); ODictionary<ORecord> dictionary = db.getDictionary(); dictionary.put(key, doc); } } HashMap<String, ByteIterator> updateMap = new HashMap<>(); for (int i = 0; i < NUM_FIELDS; i++) { updateMap.put(FIELD_PREFIX + i, new StringByteIterator(buildDeterministicValue(user1, FIELD_PREFIX + i))); } orientDBClient.update(CLASS, user1, updateMap); try(ODatabaseDocumentTx db = pool.acquire()) { ODictionary<ORecord> dictionary = db.getDictionary(); ODocument result = dictionary.get(user0); for (int i = 0; i < NUM_FIELDS; i++) { assertEquals("Assert first row fields contain preupdateString", result.field(FIELD_PREFIX + i), preupdateString); } result = dictionary.get(user1); for (int i = 0; i < NUM_FIELDS; i++) { assertEquals("Assert updated row fields are correct", result.field(FIELD_PREFIX + i), updateMap.get(FIELD_PREFIX + i).toString()); } result = dictionary.get(user2); for (int i = 0; i < NUM_FIELDS; i++) { assertEquals("Assert third row fields contain preupdateString", result.field(FIELD_PREFIX + i), preupdateString); } } }
Source:
<code>public static By getFindElementType(String locator) { logger.entering(locator); <START> String tempLocator = locator; <END> Preconditions.checkArgument(StringUtils.isNotBlank(tempLocator), INVALID_LOCATOR_ERR_MSG); By valueToReturn = null; tempLocator = tempLocator.trim(); int typeDelimiterIndex = tempLocator.indexOf('='); String locatorType = typeDelimiterIndex != -1 ? tempLocator.substring(0, typeDelimiterIndex) : tempLocator; switch (locatorType) { case "id": valueToReturn = By.id(tempLocator.substring(typeDelimiterIndex + 1)); break; case "name": valueToReturn = By.name(tempLocator.substring(typeDelimiterIndex + 1)); break; case "link": valueToReturn = By.linkText(tempLocator.substring(typeDelimiterIndex + 1)); break; case "xpath": valueToReturn = By.xpath(tempLocator.substring(typeDelimiterIndex + 1)); break; case "css": valueToReturn = By.cssSelector(tempLocator.substring(typeDelimiterIndex + 1)); break; case "classname": valueToReturn = By.className(tempLocator.substring(typeDelimiterIndex + 1)); break; default: if (tempLocator.startsWith("/") || tempLocator.startsWith("./")) { valueToReturn = By.xpath(tempLocator); break; } valueToReturn = new ByIdOrName(tempLocator); } if (logger.isLoggable(Level.FINE)) { String msg = valueToReturn.getClass().getSimpleName() + " will be the location strategy that will be used for locating " + tempLocator; logger.log(Level.FINE, msg); } logger.exiting(valueToReturn); return valueToReturn; }</code><technical_language>give this a name (like seleniumLocator) create this object Precondition assignment happens</technical_language>

Target:
public static By getFindElementType(String locator) { logger.entering(locator); Preconditions.checkArgument(StringUtils.isNotBlank(locator), INVALID_LOCATOR_ERR_MSG); By valueToReturn = null; String seleniumLocator = locator.trim(); int typeDelimiterIndex = seleniumLocator.indexOf('='); String locatorType = typeDelimiterIndex != -1 ? seleniumLocator.substring(0, typeDelimiterIndex) : seleniumLocator; switch (locatorType) { case "id": valueToReturn = By.id(seleniumLocator.substring(typeDelimiterIndex + 1)); break; case "name": valueToReturn = By.name(seleniumLocator.substring(typeDelimiterIndex + 1)); break; case "link": valueToReturn = By.linkText(seleniumLocator.substring(typeDelimiterIndex + 1)); break; case "xpath": valueToReturn = By.xpath(seleniumLocator.substring(typeDelimiterIndex + 1)); break; case "css": valueToReturn = By.cssSelector(seleniumLocator.substring(typeDelimiterIndex + 1)); break; case "classname": valueToReturn = By.className(seleniumLocator.substring(typeDelimiterIndex + 1)); break; default: if (seleniumLocator.startsWith("/") || seleniumLocator.startsWith("./")) { valueToReturn = By.xpath(seleniumLocator); break; } valueToReturn = new ByIdOrName(seleniumLocator); } if (logger.isLoggable(Level.FINE)) { String msg = valueToReturn.getClass().getSimpleName() + " will be the location strategy that will be used for locating " + seleniumLocator; logger.log(Level.FINE, msg); } logger.exiting(valueToReturn); return valueToReturn; }
Source:
<code>public Response removeCustomizedStateAggregationConfig(@PathParam("clusterId") String clusterId) { HelixZkClient zkClient = getHelixZkClient(); if (!ZKUtil.isClusterSetup(clusterId, zkClient)) { return notFound("Cluster is not properly setup!"); <START> } <END> HelixAdmin admin = getHelixAdmin(); try { admin.removeCustomizedStateAggregationConfig(clusterId); } catch (HelixException ex) { _logger.error("Error in removing CustomizedStateAggregationConfig to cluster: " + clusterId, ex); return badRequest(ex.getMessage()); } catch (Exception ex) { _logger.error("Cannot remove CustomizedStateAggregationConfig to cluster: " + clusterId, ex); return serverError(ex); } return OK(); }</code><technical_language>lines in a private check method reduce duplicate code</technical_language>

Target:
public Response removeCustomizedStateAggregationConfig(@PathParam("clusterId") String clusterId) { if (!doesClusterExist(clusterId)) { return notFound(String.format("Cluster %s does not exist", clusterId)); } HelixAdmin admin = getHelixAdmin(); try { admin.removeCustomizedStateAggregationConfig(clusterId); } catch (Exception ex) { _logger.error( "Cannot remove CustomizedStateAggregationConfig from cluster: {}, Exception: {}", clusterId, ex); return serverError(ex); } return OK(); }
Source:
<code>public void createConsole(String additionalInitialComands) { Display.getDefault().syncExec(new Runnable() { public void run() { IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager(); boolean continueWithNewConsole = true; if (manager.getConsoles().length >= 1 && Consoles.showDialog) { continueWithNewConsole = MessageDialog.openQuestion(Display.getDefault().getActiveShell(), "Duplicate console", <START> "Scripting console already Exists\nDo you still want to proceed with a new one?"); <END> } if (continueWithNewConsole) { try { createConsole(createGeniePydevInterpreter(), additionalInitialComands); } catch (Exception e) { LOG.error(e); } } } }); Job.getJobManager().addJobChangeListener(JOB_CHANGE_LISTENER); }</code><technical_language>need a capital Exists. I good more info as: * Warning suer new console open * left running in running in background * switch consoles * terminate consoles</technical_language>

Target:
public void createConsole(String additionalInitialComands) { Display.getDefault().syncExec(new Runnable() { public void run() { IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager(); boolean continueWithNewConsole = true; if (manager.getConsoles().length >= 1) { continueWithNewConsole = MessageDialog.openQuestion(Display.getDefault().getActiveShell(), "Duplicate console", "Scripting Console already exists. New Console will open on top of the current one. " + "Scripts running on current console will still run in the background.\n\n" + "You can switch between consoles using \"Display Selected Console\"" + " button. To terminate a console please click on the red icon from the menu bar.\n\n" + "Do you still want to proceed with a new Console?"); } if (continueWithNewConsole) { try { createConsole(createGeniePydevInterpreter(), additionalInitialComands); } catch (Exception e) { LOG.error(e); } } } }); Job.getJobManager().addJobChangeListener(JOB_CHANGE_LISTENER); }
Source:
<code>public FormField findFormField(String fieldName) { return fields.stream() <START> .filter(field -> field.getFieldName().equals(fieldName) || fieldName.equals(field.getFieldBinding())) <END> .findFirst() .orElse(null); }</code><technical_language>avoid NPE, use: java Objects.equals(field.getFieldName(), fieldName) || Objects.euqals(fieldName, field.getFieldBinding())</technical_language>

Target:
public FormField findFormField(String fieldName) { return fields.stream() .filter(field -> Objects.equals(field.getFieldName(), fieldName) || Objects.equals(fieldName, field.getFieldBinding())) .findFirst() .orElse(null); }
Source:
<code><START> public static IStatus exportXmlFile(String from, String to) { <END> File fromFile = getXmlFilesPath().addTrailingSeparator().append(from + XML_EXTENSION).toFile(); if (!fromFile.exists()) { Activator.logError("Failed to find XML analysis file " + fromFile.getName()); return Status.CANCEL_STATUS; } File toFile = new File(to); try { if (!toFile.exists()) { toFile.createNewFile(); } } catch (IOException e) { String error = Messages.XmlUtils_ErrorCopyingFile; Activator.logError(error, e); return new Status(IStatus.ERROR, Activator.PLUGIN_ID, error, e); } try (FileInputStream fis = new FileInputStream(fromFile); FileOutputStream fos = new FileOutputStream(toFile); FileChannel source = fis.getChannel(); FileChannel destination = fos.getChannel();) { destination.transferFrom(source, 0, source.size()); } catch (IOException e) { String error = Messages.XmlUtils_ErrorCopyingFile; Activator.logError(error, e); return new Status(IStatus.ERROR, Activator.PLUGIN_ID, error, e); } return Status.OK_STATUS; }</code><technical_language>too, file include extension. assume caller removed it</technical_language>

Target:
public static IStatus exportXmlFile(String from, String to) { File fromFile = getXmlFilesPath().addTrailingSeparator().append(from).toFile(); if (!fromFile.exists()) { Activator.logError("Failed to find XML analysis file " + fromFile.getName()); return Status.CANCEL_STATUS; } File toFile = new File(to); return copyXmlFile(fromFile, toFile); }
Source:
<code>public String toString() { <START> return "{" + <END> "\"customerId\":" + customerId + ",\"name\":\"" + name + "\"" + ",\"age\":" + age + ",\"address\":\"" + address + "\"" + '}'; }</code><technical_language>If this is for test validation, verify pojo instances instead of toString conversion</technical_language>

Target:
public String toString() { return "CustomerInfo{" + "customerId=" + customerId + ", name='" + name + '\'' + ", age=" + age + ", address='" + address + '\'' + '}'; }
Source:
<code>public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { CallContext.current().setEventDetails("Router Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); VirtualRouter router = _routerService.findRouter(getId()); Map<String, String> result = null; if (router == null || router.getRole() != VirtualRouter.Role.VIRTUAL_ROUTER) { throw new InvalidParameterValueException("Can't find router by id"); } else { <START> result = _routerService.getRouterHealthCheckResults(getId(), shouldPerformFreshChecks()); <END> } if (result != null) { DomainRouterHealthCheckResultsResponse routerResponse = _responseGenerator.createHealthCheckResponse(router, result); routerResponse.setResponseName(getCommandName()); setResponseObject(routerResponse); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start router"); } }</code><technical_language>This executed else block need split result definition multiple lines</technical_language>

Target:
public void execute() throws ResourceUnavailableException, InvalidParameterValueException, ServerApiException { CallContext.current().setEventDetails("Router Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getRouterId())); VirtualRouter router = _routerService.findRouter(getRouterId()); if (router == null || router.getRole() != VirtualRouter.Role.VIRTUAL_ROUTER) { throw new InvalidParameterValueException("Can't find router by routerId"); } try { List<RouterHealthCheckResultResponse> healthChecks = _queryService.listRouterHealthChecks(this); RouterHealthCheckResultsListResponse routerResponse = new RouterHealthCheckResultsListResponse(); routerResponse.setRouterId(router.getUuid()); routerResponse.setHealthChecks(healthChecks); routerResponse.setObjectName("routerhealthchecks"); routerResponse.setResponseName(getCommandName()); setResponseObject(routerResponse); } catch (CloudRuntimeException ex){ ex.printStackTrace(); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to execute command due to exception: " + ex.getLocalizedMessage()); } }
Source:
<code>Set<Status> ignoredStates() { return EnumSet.of( Status.REQUESTED, Status.CREATE_IN_PROGRESS, Status.UPDATE_IN_PROGRESS, Status.UPDATE_REQUESTED, Status.STOP_REQUESTED, Status.START_REQUESTED, Status.STOP_IN_PROGRESS, Status.START_IN_PROGRESS, Status.WAIT_FOR_SYNC, Status.MAINTENANCE_MODE_ENABLED, Status.EXTERNAL_DATABASE_CREATION_IN_PROGRESS, <START> Status.BACKUP_IN_PROGRESS, Status.BACKUP_FINISHED, Status.BACKUP_FAILED, Status.RESTORE_IN_PROGRESS, Status.RESTORE_FINISHED, Status.RESTORE_FAILED ); <END> }</code><technical_language>a bit confused @foldik @bbihari chime in. I FINISHED states here, normal operational. Also, I if backup fails, cluster operational, it</technical_language>

Target:
Set<Status> ignoredStates() { return EnumSet.of( Status.REQUESTED, Status.CREATE_IN_PROGRESS, Status.UPDATE_IN_PROGRESS, Status.UPDATE_REQUESTED, Status.STOP_REQUESTED, Status.START_REQUESTED, Status.STOP_IN_PROGRESS, Status.START_IN_PROGRESS, Status.WAIT_FOR_SYNC, Status.MAINTENANCE_MODE_ENABLED, Status.EXTERNAL_DATABASE_CREATION_IN_PROGRESS, Status.BACKUP_IN_PROGRESS, Status.BACKUP_FAILED, Status.RESTORE_IN_PROGRESS, Status.RESTORE_FAILED ); }
Source:
<code>private static void <START> getLatency(Long <END> latency) { Long innerLatency; if (latency != (long) minimum) { innerLatency = latency; } else { innerLatency = getDelayFromXml(); } try { TimeUnit.MILLISECONDS.sleep(innerLatency); } catch (InterruptedException e) { log.error("failed to to run getLatency error is:{}", e); } }</code><technical_language>do need this method? merge this getLatency()</technical_language>

Target:
private static void getLatency(Long latency) { Long innerLatency; if (latency != minimum) { innerLatency = latency; } else { innerLatency = getDelayFromXml(); } try { TimeUnit.MILLISECONDS.sleep(innerLatency); } catch (InterruptedException e) { log.error("failed to to run getLatency error is:{}", e); } }
Source:
<code>public static FakePlayer getFakePlayer(World world){ <START> val dimId = world.provider.getDimension(); <END> if(fakePlayers.containsKey(dimId)) return fakePlayers.get(dimId); if(world instanceof WorldServer){ FakePlayerLP fp = new FakePlayerLP((WorldServer) world); fakePlayers.put(dimId, fp); return fp; } if(world instanceof WorldClient){ FakePlayerLP fp = new FakePlayerLP(FMLCommonHandler.instance().getMinecraftServerInstance().getWorld(dimId)); fakePlayers.put(dimId, fp); return fp; } return null; }</code><technical_language>Please val in java code for LP</technical_language>

Target:
public static FakePlayer getFakePlayer(World world) { int dimId = world.provider.getDimension(); if (fakePlayers.containsKey(dimId)) return fakePlayers.get(dimId); if (world instanceof WorldServer) { FakePlayerLP fp = new FakePlayerLP((WorldServer) world); fakePlayers.put(dimId, fp); return fp; } if (world instanceof WorldClient) { FakePlayerLP fp = new FakePlayerLP(FMLCommonHandler.instance().getMinecraftServerInstance().getWorld(dimId)); fakePlayers.put(dimId, fp); return fp; } return null; }
Source:
<code>public void configurePersister(XStreamPersister persister, XStreamMessageConverter converter) { persister.setCallback(new XStreamPersister.Callback() { @Override protected Class<LayerGroupInfo> getObjectClass() { return LayerGroupInfo.class; } @Override protected CatalogInfo getCatalogObject() { Map<String, String> uriTemplateVars = (Map<String, String>) RequestContextHolder.getRequestAttributes().getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, RequestAttributes.SCOPE_REQUEST); String workspace = uriTemplateVars.get("workspaceName"); String layerGroup = uriTemplateVars.get("layerGroupName"); if (layerGroup == null) { return null; } return catalog.getLayerGroupByName(workspace, layerGroup); } @Override protected void postEncodeReference(Object obj, String ref, String prefix, HierarchicalStreamWriter writer, MarshallingContext context) { if ( obj instanceof StyleInfo ) { StringBuilder link = new StringBuilder(); if (prefix != null) { link.append("/workspaces/").append(converter.encode(prefix)); } link.append("/styles/").append(converter.encode(ref)); converter.encodeLink(link.toString(), writer); } if ( obj instanceof LayerInfo ) { converter.encodeLink("/layers/" + converter.encode(ref), writer); } else if ( obj instanceof LayerGroupInfo) { <START> converter.encodeLink("/layergroups/" + converter.encode(ref), writer); <END> } } }); }</code><technical_language>if group is workspace specific</technical_language>

Target:
public void configurePersister(XStreamPersister persister, XStreamMessageConverter converter) { persister.setCallback(new XStreamPersister.Callback() { @Override protected Class<LayerGroupInfo> getObjectClass() { return LayerGroupInfo.class; } @Override protected CatalogInfo getCatalogObject() { Map<String, String> uriTemplateVars = (Map<String, String>) RequestContextHolder.getRequestAttributes().getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, RequestAttributes.SCOPE_REQUEST); String workspace = uriTemplateVars.get("workspaceName"); String layerGroup = uriTemplateVars.get("layerGroupName"); if (layerGroup == null) { return null; } return catalog.getLayerGroupByName(workspace, layerGroup); } @Override protected void postEncodeReference(Object obj, String ref, String prefix, HierarchicalStreamWriter writer, MarshallingContext context) { if ( obj instanceof StyleInfo ) { StringBuilder link = new StringBuilder(); if (prefix != null) { link.append("/workspaces/").append(converter.encode(prefix)); } link.append("/styles/").append(converter.encode(ref)); converter.encodeLink(link.toString(), writer); } if ( obj instanceof LayerInfo ) { converter.encodeLink("/layers/" + converter.encode(ref), writer); } else if ( obj instanceof LayerGroupInfo) { LayerGroupInfo lg = (LayerGroupInfo) obj; if (lg.getWorkspace() != null) { converter.encodeLink("/workspaces/"+lg.getWorkspace().getName()+"/layergroups/" + converter.encode(ref), writer); } else { converter.encodeLink("/layergroups/" + converter.encode(ref), writer); } } } }); }
Source:
<code>private File createWindowsSshAskpass(SSHUserPrivateKey sshUser) throws IOException { File ssh = File.createTempFile("pass", ".bat"); PrintWriter w = null; try { w = new PrintWriter(ssh); w.println("@echo off"); <START> w.println("echo " + Secret.toString(sshUser.getPassphrase())); <END> w.flush(); } finally { if (w != null) { w.close(); } } ssh.setExecutable(true); return ssh; }</code><technical_language>I created a private key a passphrase intentionally includes command processor special characters (like pipe, caret, than, greater than, sign, etc.), try passphrase ( <mark|earl^waite>@gmail.com) code, initial attempt authenticate repository (from web user interface), reports: Failed connect repository : Command "C:\Program Files\git\bin\git.exe -c core.askpass=true ls-remote -h mark-pc1.markwaite.net:/var/lib/git/hasphrase/bin.git HEAD" returned status code 128: stdout: stderr: 'earlwaite' is recognized internal external command, operable program batch file. 'earlwaite' is recognized internal external command, operable program batch file. Permission denied, please try again. 'earlwaite' is recognized internal external command, operable program batch file. Permission denied, please try again. 'earlwaite' is recognized internal external command, operable program batch file. Permission denied (publickey,password). fatal: read remote repository. Please correct access rights repository exists. I means is additional logic needed in call decide if surrounding quotes required user provided passphrase (or not)</technical_language>

Target:
private File createWindowsSshAskpass(SSHUserPrivateKey sshUser) throws IOException { File ssh = File.createTempFile("pass", ".bat"); try (PrintWriter w = new PrintWriter(ssh, Charset.defaultCharset().toString())) { w.println("@echo off"); w.println("echo " + Secret.toString(sshUser.getPassphrase())); w.flush(); } ssh.setExecutable(true); return ssh; }
Source:
<code><START> void setState(ParseObject.State newState) { <END> State.Builder builder = new State.Builder(getState()); builder.apply(newState); super.setState(builder.build()); }</code><technical_language>For future PRs, /* package */ designate package protected methods</technical_language>

Target:
void setState(ParseObject.State newState) { if (isCurrentUser() && getSessionToken() != null && newState.get("sessionToken") == null) { newState = newState.newBuilder().put("sessionToken", getSessionToken()).build(); } super.setState(newState); }
Source:
<code>public static MultiMap<Type, TypedClassOperation> readOperations(@Nullable Path file) throws OperationParseException { <START> return readOperations(file, true); <END> }</code><technical_language>This is incorrect change method violate specification. Clients call a overload of this method, change method's implementation</technical_language>

Target:
public static MultiMap<Type, TypedClassOperation> readOperations(@Nullable Path file) throws OperationParseException { return readOperations(file, false); }
Source:
<code>public ITmfTrace getTrace() { for (ITmfTrace trace : TmfTraceManager.getInstance().getOpenedTraces()) { <START> for (ITmfTrace t : TmfTraceManager.getTraceSetWithExperiment(trace)) { <END> if (getResource().equals(t.getResource()) && (t instanceof TmfExperiment)) { return t; } } } return null; }</code><technical_language>I avoid trace set altogether, experiment in opened traces collection</technical_language>

Target:
public ITmfTrace getTrace() { for (ITmfTrace trace : TmfTraceManager.getInstance().getOpenedTraces()) { if (getResource().equals(trace.getResource()) && (trace instanceof TmfExperiment)) { return trace; } } return null; }
Source:
<code>private ArrayList<Element> readXML() { try { <START> Document templatesXML = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(getClass().getResourceAsStream("/latexstudio/editor/resources/templates.xml")); <END> Element rootElement = templatesXML.getDocumentElement(); NodeList templatesNodeList = rootElement.getChildNodes(); ArrayList<Element> templates = new ArrayList<Element>(); for (int i = 0; i < templatesNodeList.getLength(); i++) { Node node = templatesNodeList.item(i); if (node instanceof Element) { templates.add((Element) node); } } return templates; } catch (IOException e) { } catch (SAXException e) { } catch (ParserConfigurationException e) { } return null; }</code><technical_language>move path ApplicationUtils class</technical_language>

Target:
private ArrayList<Element> readXML() { try { Document templatesXML = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(getClass().getResourceAsStream(ApplicationUtils.pathToTemplatesFile)); Element rootElement = templatesXML.getDocumentElement(); NodeList templatesNodeList = rootElement.getChildNodes(); ArrayList<Element> templates = new ArrayList<Element>(); for (int i = 0; i < templatesNodeList.getLength(); i++) { Node node = templatesNodeList.item(i); if (node instanceof Element) { templates.add((Element) node); } } return templates; } catch (IOException | SAXException | ParserConfigurationException e) { LOGGER.log("Templates data couldn't be read."); e.printStackTrace(); } return null; }
Source:
<code>private static String readLine(BufferedReader in) { String result = null; <START> try { <END> result = in.readLine(); } catch (Exception e) { logger.error("Can't read from " + testingFile + ": " + e); System.exit(1); } return result; }</code><technical_language>again, next call is System.exit(), write STDERR</technical_language>

Target:
private static String readLine(BufferedReader in) { String result = null; try { result = in.readLine(); } catch (Exception e) { System.err.println("Can't read from " + testingFile + ": " + e); System.exit(1); } return result; }
Source:
<code>protected String tryLock(String key) { log.debug("Trying to lock '{}'", key); long deadline = System.nanoTime() + duration.toNanos(); long ttl = duration.multipliedBy(TTL_MULTIPLIER).toSeconds(); do { String lockInfo = "node=" + nodeId + " time=" + Instant.now(); if (kvStore.compareAndSet(key, null, lockInfo, ttl)) { log.debug("Lock '{}' acquired after {}ms", () -> key, () -> (System.nanoTime() - (deadline - duration.toNanos())) / 1_000_000); return lockInfo; } log.debug(" Sleeping on busy lock '{}' for {}ms", () -> key, () -> pollDelay.toMillis()); <START> try { <END> Thread.sleep(pollDelay.toMillis()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeServiceException(e); } } while (System.nanoTime() < deadline); log.debug("Failed to acquire lock '{}' after {}s", () -> key, () -> duration.toSeconds()); return null; }</code><technical_language>replaced by: log.debug("Sleeping busy lock '{}' for {}ms", () -> key, pollDelay::toMillis);</technical_language>

Target:
protected String tryLock(String key) { log.debug("Trying to lock '{}'", key); long deadline = System.nanoTime() + duration.toNanos(); long ttl = duration.multipliedBy(TTL_MULTIPLIER).toSeconds(); do { String lockInfo = "node=" + nodeId + " time=" + Instant.now(); if (kvStore.compareAndSet(key, null, lockInfo, ttl)) { log.debug("Lock '{}' acquired after {}ms", () -> key, () -> (System.nanoTime() - (deadline - duration.toNanos())) / 1_000_000); return lockInfo; } log.debug(" Sleeping on busy lock '{}' for {}ms", () -> key, pollDelay::toMillis); try { Thread.sleep(pollDelay.toMillis()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeServiceException(e); } } while (System.nanoTime() < deadline); log.debug("Failed to acquire lock '{}' after {}s", () -> key, duration::toSeconds); return null; }
Source:
<code>public void setCpuMaxDeviation(final Double maxCpuUsagePercentage, final Double totalCpuUsedPercentage, final Long totalHosts) { if (maxCpuUsagePercentage != null && totalCpuUsedPercentage != null && totalHosts != null && totalHosts != 0) { final Double averageCpuUsagePercentage = totalCpuUsedPercentage / totalHosts; <START> this.cpuMaxDeviation = String.format("%.2f%%", (maxCpuUsagePercentage - averageCpuUsagePercentage) * 1.0 / averageCpuUsagePercentage); <END> } }</code><technical_language>is '* 1.0' needed is devided next? I a cast if is, in this case</technical_language>

Target:
public void setCpuMaxDeviation(final Double maxCpuUsagePercentage, final Double totalCpuUsedPercentage, final Long totalHosts) { if (maxCpuUsagePercentage != null && totalCpuUsedPercentage != null && totalHosts != null && totalHosts != 0) { final Double averageCpuUsagePercentage = totalCpuUsedPercentage / totalHosts; this.cpuMaxDeviation = String.format("%.2f%%", (maxCpuUsagePercentage - averageCpuUsagePercentage) / averageCpuUsagePercentage); } }
Source:
<code>private void respawnPlayer(EntityRef clientEntity) { ClientComponent client = clientEntity.getComponent(ClientComponent.class); EntityRef playerCharacter = client.character; LocationComponent location = clientEntity.getComponent(LocationComponent.class); PlayerFactory playerFactory = new PlayerFactory(entityManager, worldProvider); Vector3f spawnPosition = playerFactory.findSpawnPositionFromLocationComponent(location); location.setWorldPosition(spawnPosition); clientEntity.saveComponent(location); AliveCharacterComponent aliveCharacterComponent = new AliveCharacterComponent(); <START> playerCharacter.addComponent(aliveCharacterComponent); <END> playerCharacter.send(new CharacterTeleportEvent(spawnPosition)); logger.debug("Re-spawing player at: {}", spawnPosition); Client clientListener = networkSystem.getOwner(clientEntity); Vector3i distance = clientListener.getViewDistance().getChunkDistance(); updateRelevanceEntity(clientEntity, distance); playerCharacter.send(new OnPlayerRespawnedEvent()); }</code><technical_language>short-cut lines addComponent(new AliveCharacterComponent():</technical_language>

Target:
private void respawnPlayer(EntityRef clientEntity) { ClientComponent client = clientEntity.getComponent(ClientComponent.class); EntityRef playerCharacter = client.character; LocationComponent location = clientEntity.getComponent(LocationComponent.class); PlayerFactory playerFactory = new PlayerFactory(entityManager, worldProvider); Vector3f spawnPosition = playerFactory.findSpawnPositionFromLocationComponent(location); location.setWorldPosition(spawnPosition); clientEntity.saveComponent(location); playerCharacter.addComponent(new AliveCharacterComponent()); playerCharacter.send(new CharacterTeleportEvent(spawnPosition)); logger.debug("Re-spawing player at: {}", spawnPosition); Client clientListener = networkSystem.getOwner(clientEntity); Vector3i distance = clientListener.getViewDistance().getChunkDistance(); updateRelevanceEntity(clientEntity, distance); playerCharacter.send(new OnPlayerRespawnedEvent()); }
Source:
<code>public ClientIOTaskResult aggregate(Iterable<TaskResult> results) throws Exception { Iterator<TaskResult> it = results.iterator(); if (it.hasNext()) { TaskResult taskResult = it.next(); if (!(taskResult instanceof ClientIOTaskResult)) { throw new IOException( "TaskResult is not of type ClientIOTaskResult. class: " + taskResult.getClass() .getName()); } <START> return (ClientIOTaskResult) taskResult; <END> } return new ClientIOTaskResult(); }</code><technical_language>is aggregation</technical_language>

Target:
public ClientIOTaskResult aggregate(Iterable<TaskResult> results) throws Exception { Iterator<TaskResult> it = results.iterator(); if (it.hasNext()) { TaskResult taskResult = it.next(); if (it.hasNext()) { throw new IOException( "ClientIO is a single node test, so multiple task results cannot be aggregated."); } if (!(taskResult instanceof ClientIOTaskResult)) { throw new IOException( "TaskResult is not of type ClientIOTaskResult. class: " + taskResult.getClass() .getName()); } return (ClientIOTaskResult) taskResult; } return new ClientIOTaskResult(); }
Source:
<code>@Override public boolean isLocked() throws IgniteException { try { <START> if (sync.reentrantCount.get() > 0) <END> return true; if (sync.isGloballyLocked) return true; GridCacheLockState2Base<LockOwner> state = sync.forceGet(); if (state == null) return false; ArrayDeque<LockOwner> nodes = state.owners; return !(nodes == null || nodes.isEmpty() || (sync.nodeId.equals(nodes.getFirst().nodeId) && nodes.size() == 1) ); } catch (IgniteCheckedException e) { throw U.convertException(e); } }</code><technical_language>This ..</technical_language>

Target:
@Override public boolean isLocked() throws IgniteException { ctx.kernalContext().gateway().readLock(); try { if (sync.reentrantCnt.get() > 0 || sync.isGloballyLocked) return true; GridCacheLockState2Base<LockOwner> state = sync.forceGet(); if (state == null) return false; ArrayDeque<LockOwner> nodes = state.owners; return !(nodes == null || nodes.isEmpty() || (sync.nodeId.equals(nodes.getFirst().nodeId()) && nodes.size() == 1) ); } catch (IgniteCheckedException e) { throw U.convertException(e); } finally { ctx.kernalContext().gateway().readUnlock(); } }
Source:
<code>public void run(Timeout timeout) { DefaultFuture future = DefaultFuture.getFuture(requestID); <START> if (future.isDone()) { <END> return; } if (future.getExecutor() != null) { future.getExecutor().execute(() -> { Response timeoutResponse = new Response(future.getId()); timeoutResponse.setStatus(future.isSent() ? Response.SERVER_TIMEOUT : Response.CLIENT_TIMEOUT); timeoutResponse.setErrorMessage(future.getTimeoutMessage(true)); DefaultFuture.received(future.getChannel(), timeoutResponse, true); }); } }</code><technical_language>need judge null</technical_language>

Target:
public void run(Timeout timeout) { DefaultFuture future = DefaultFuture.getFuture(requestID); if (future == null || future.isDone()) { return; } if (future.getExecutor() != null) { future.getExecutor().execute(() -> { Response timeoutResponse = new Response(future.getId()); timeoutResponse.setStatus(future.isSent() ? Response.SERVER_TIMEOUT : Response.CLIENT_TIMEOUT); timeoutResponse.setErrorMessage(future.getTimeoutMessage(true)); DefaultFuture.received(future.getChannel(), timeoutResponse, true); }); } }