auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public long skip(long n) throws IOException { <END> long k = count - pos; if (n < k) { k = n < 0 ? 0 : n; } pos += k; return k; }</code><technical_language>logic in method improved. is currently difficult understand hard follow is correct not. if is following: if (n <= 0) { return 0; } long remaining = count - pos; if(remaining < n) { n = remaining; } pos += n;</technical_language>

Target:
public long skip(long n) throws IOException { if (n <= 0) { return 0; } long remaining = count - pos; if(remaining < n) { n = remaining; } pos += n; return n; }
Source:
<code>public ActionResult execute() { String searchKey = getNonNullRequestParamValue(Const.ParamsNames.ADMIN_SEARCH_KEY); List<InstructorAttributes> instructors = logic.searchInstructorsInWholeSystem(searchKey).instructorList; List<InstructorData> instructorDataList = new ArrayList<>(); for (InstructorAttributes instructor : instructors) { InstructorData instructorData = new InstructorData(instructor); <START> instructorData.setKey(StringHelper.encrypt(instructor.getKey())); <END> if (instructor.getGoogleId() != null) { AccountAttributes account = logic.getAccount(instructor.getGoogleId()); if (account != null) { String institute = StringHelper.isEmpty(account.institute) ? "None" : account.institute; instructorData.setInstitute(institute); } } instructorDataList.add(instructorData); } InstructorsData instructorsData = new InstructorsData(); instructorsData.setInstructors(instructorDataList); instructorsData.getInstructors().forEach(InstructorData::hideInformationForSearch); return new JsonResult(instructorsData); }</code><technical_language>standardize information hiding? want do in this convention hideInformationForXXX</technical_language>

Target:
public ActionResult execute() { String searchKey = getNonNullRequestParamValue(Const.ParamsNames.ADMIN_SEARCH_KEY); List<InstructorAttributes> instructors = logic.searchInstructorsInWholeSystem(searchKey).instructorList; List<InstructorData> instructorDataList = new ArrayList<>(); for (InstructorAttributes instructor : instructors) { InstructorData instructorData = new InstructorData(instructor); instructorData.addAdditionalInformationForAdminSearch( StringHelper.encrypt(instructor.getKey()), getInstituteFromGoogleId(instructor.getGoogleId())); instructorData.hideInformationForSearch(); instructorDataList.add(instructorData); } InstructorsData instructorsData = new InstructorsData(); instructorsData.setInstructors(instructorDataList); return new JsonResult(instructorsData); }
Source:
<code>private InterpreterContext getInterpreterContext() { AngularObjectRegistry registry = null; ResourcePool resourcePool = null; if (this.interpreter != null) { registry = this.interpreter.getInterpreterGroup().getAngularObjectRegistry(); resourcePool = this.interpreter.getInterpreterGroup().getResourcePool(); } Credentials credentials = note.getCredentials(); if (subject != null) { UserCredentials userCredentials; try { userCredentials = credentials.getUserCredentials(subject.getUser()); } catch (IOException e) { <START> LOGGER.error("Unable to get Usercredentials. Working with empty UserCredentials", e); <END> userCredentials = new UserCredentials(); } subject.setUserCredentials(userCredentials); } return InterpreterContext.builder() .setNoteId(note.getId()) .setNoteName(note.getName()) .setParagraphId(getId()) .setReplName(intpText) .setParagraphTitle(title) .setParagraphText(text) .setAuthenticationInfo(subject) .setLocalProperties(localProperties) .setConfig(config) .setGUI(settings) .setNoteGUI(getNoteGui()) .setAngularObjectRegistry(registry) .setResourcePool(resourcePool) .build(); }</code><technical_language>If allow fallback empty UserCredentials, I LOGGER.warn</technical_language>

Target:
private InterpreterContext getInterpreterContext() { AngularObjectRegistry registry = null; ResourcePool resourcePool = null; if (this.interpreter != null) { registry = this.interpreter.getInterpreterGroup().getAngularObjectRegistry(); resourcePool = this.interpreter.getInterpreterGroup().getResourcePool(); } Credentials credentials = note.getCredentials(); if (subject != null) { UserCredentials userCredentials; try { userCredentials = credentials.getUserCredentials(subject.getUser()); } catch (IOException e) { LOGGER.warn("Unable to get Usercredentials. Working with empty UserCredentials", e); userCredentials = new UserCredentials(); } subject.setUserCredentials(userCredentials); } return InterpreterContext.builder() .setNoteId(note.getId()) .setNoteName(note.getName()) .setParagraphId(getId()) .setReplName(intpText) .setParagraphTitle(title) .setParagraphText(text) .setAuthenticationInfo(subject) .setLocalProperties(localProperties) .setConfig(config) .setGUI(settings) .setNoteGUI(getNoteGui()) .setAngularObjectRegistry(registry) .setResourcePool(resourcePool) .build(); }
Source:
<code>public List<E> getInwardEdges(V target) { <START> return vertexInMap.get(target).edges; <END> }</code><technical_language>This is faster, do prove runtime performance gain outweighs memory overhead of adding edges</technical_language>

Target:
public List<E> getInwardEdges(V target) { return vertexMap.get(target).inEdges; }
Source:
<code>public List<String> validateQuestionDetails(String courseId) { List<String> errors = new ArrayList<>(); if (generateOptionsFor == FeedbackParticipantType.NONE) { if (numOfMcqChoices < Const.FeedbackQuestion.MCQ_MIN_NUM_OF_CHOICES) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_NOT_ENOUGH_CHOICES + Const.FeedbackQuestion.MCQ_MIN_NUM_OF_CHOICES + "."); } <START> boolean isEmptyMcqOptionEntered = false; <END> for (String mcqText : mcqChoices) { if (mcqText.trim().equals("")) { isEmptyMcqOptionEntered = true; break; } } if (isEmptyMcqOptionEntered) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_EMPTY_MCQ_OPTION); } if (hasAssignedWeights && mcqChoices.size() != mcqWeights.size()) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_INVALID_WEIGHT); } if (!hasAssignedWeights && (!mcqWeights.isEmpty() || mcqOtherWeight != 0)) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_INVALID_WEIGHT); } if (hasAssignedWeights && !otherEnabled && mcqOtherWeight != 0) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_INVALID_WEIGHT); } if (hasAssignedWeights && !mcqWeights.isEmpty()) { for (double weight : mcqWeights) { if (weight < 0) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_INVALID_WEIGHT); } } if (otherEnabled && mcqOtherWeight < 0) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_INVALID_WEIGHT); } } } return errors; }</code><technical_language>one-line this stream anyMatch</technical_language>

Target:
public List<String> validateQuestionDetails(String courseId) { List<String> errors = new ArrayList<>(); if (generateOptionsFor == FeedbackParticipantType.NONE) { if (numOfMcqChoices < Const.FeedbackQuestion.MCQ_MIN_NUM_OF_CHOICES) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_NOT_ENOUGH_CHOICES + Const.FeedbackQuestion.MCQ_MIN_NUM_OF_CHOICES + "."); } boolean isEmptyMcqOptionEntered = mcqChoices.stream().anyMatch(mcqText -> mcqText.trim().equals("")); if (isEmptyMcqOptionEntered) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_EMPTY_MCQ_OPTION); } if (hasAssignedWeights && mcqChoices.size() != mcqWeights.size()) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_INVALID_WEIGHT); } if (!hasAssignedWeights && (!mcqWeights.isEmpty() || mcqOtherWeight != 0)) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_INVALID_WEIGHT); } if (hasAssignedWeights && !otherEnabled && mcqOtherWeight != 0) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_INVALID_WEIGHT); } if (hasAssignedWeights && !mcqWeights.isEmpty()) { for (double weight : mcqWeights) { if (weight < 0) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_INVALID_WEIGHT); } } if (otherEnabled && mcqOtherWeight < 0) { errors.add(Const.FeedbackQuestion.MCQ_ERROR_INVALID_WEIGHT); } } } return errors; }
Source:
<code>public Blob run(Blob blob) throws IOException { String mimetype = blob.getMimeType(); <START> if ("application/pdf".equals(mimetype)) { <END> return blob; } Blob result; if (blob instanceof StringBlob && !"text/plain".equals(mimetype)) { if (!"text/html".equals(mimetype)) { blob = convertBlobToMimeType(blob, "text/html"); } Path tempDirectory = Framework.createTempDirectory("blobs"); blob = replaceURLsByAbsolutePaths(blob, tempDirectory); result = convertBlobToMimeType(blob, "application/pdf"); FileUtils.deleteQuietly(tempDirectory.toFile()); } else { result = convertBlobToMimeType(blob, "application/pdf"); } adjustBlobName(blob, result); return result; }</code><technical_language>Please constants for MIME types in places</technical_language>

Target:
public Blob run(Blob blob) throws IOException { String mimetype = blob.getMimeType(); if (MimetypeRegistry.PDF_MIMETYPE.equals(mimetype)) { return blob; } Blob result; if (MediaType.TEXT_PLAIN.equals(mimetype)) { result = convertBlobToMimeType(blob, MimetypeRegistry.PDF_MIMETYPE); } else { if (!MediaType.TEXT_HTML.equals(mimetype)) { String filename = blob.getFilename(); blob = convertBlobToMimeType(blob, MediaType.TEXT_HTML); blob.setFilename(filename); } Path tempDirectory = Framework.createTempDirectory("blobs"); blob = replaceURLsByAbsolutePaths(blob, tempDirectory); result = convertBlobToMimeType(blob, MimetypeRegistry.PDF_MIMETYPE); org.apache.commons.io.FileUtils.deleteQuietly(tempDirectory.toFile()); } adjustBlobName(blob, result); return result; }
Source:
<code>List<String> getTestClasses() { <START> return testClasses; <END> }</code><technical_language>is reason for this change? I remain is</technical_language>

Target:
List<String> getTestClasses() { return Collections.unmodifiableList(testClasses); }
Source:
<code><START> public void complexDependencyPlanExecutionTest() { <END> final Plan plan = PlanImpl.newBuilder() .addEvaluatorToDelete("SERVER", EVAL_PREFIX + 1) .addEvaluatorToDelete("SERVER", EVAL_PREFIX + 3) .addEvaluatorToDelete("WORKER", EVAL_PREFIX + 7) .addEvaluatorToAdd("SERVER", EVAL_PREFIX + 2) .addEvaluatorToAdd("WORKER", EVAL_PREFIX + 5) .addEvaluatorToAdd("WORKER", EVAL_PREFIX + 6) .addTransferStep("SERVER", new TransferStepImpl(EVAL_PREFIX + 4, EVAL_PREFIX + 2, new DataInfoImpl(1))) .addTransferStep("WORKER", new TransferStepImpl(EVAL_PREFIX + 8, EVAL_PREFIX + 9, new DataInfoImpl(1))) .build(); final Future<PlanResult> result = planExecutor.execute(plan); final int planSize = plan.getPlanSize(); try { final PlanResultImpl summary = (PlanResultImpl) result.get(); assertEquals(planSize, summary.getNumExecutedOps()); } catch (final Exception e) { e.printStackTrace(); } }</code><technical_language>test this test case besides step is executed? advance simplePlanExecutionTest(). I think, this method check executor executes plan dependency</technical_language>

Target:
public void complexDependencyPlanExecutionTest() { final Plan plan = PlanImpl.newBuilder() .addEvaluatorToDelete("SERVER", EVAL_PREFIX + 1) .addEvaluatorToDelete("SERVER", EVAL_PREFIX + 2) .addEvaluatorToDelete("WORKER", EVAL_PREFIX + 3) .addTransferStep("WORKER", new TransferStepImpl(EVAL_PREFIX + 4, EVAL_PREFIX + 5, new DataInfoImpl(1))) .addEvaluatorToAdd("SERVER", EVAL_PREFIX + 6) .addEvaluatorToAdd("WORKER", EVAL_PREFIX + 7) .addEvaluatorToAdd("WORKER", EVAL_PREFIX + 8) .addTransferStep("SERVER", new TransferStepImpl(EVAL_PREFIX + 9, EVAL_PREFIX + 6, new DataInfoImpl(1))) .build(); final Future<PlanResult> result = planExecutor.execute(plan); final int planSize = plan.getPlanSize(); try { final PlanResult summary = result.get(20, TimeUnit.SECONDS); assertEquals(planSize, summary.getNumExecutedOps()); } catch (final TimeoutException e) { fail("Failed to execute the plan. Timeout occurred."); e.printStackTrace(); } catch (final InterruptedException | ExecutionException e) { fail("Failed to execute the plan. Exception occurred."); e.printStackTrace(); } }
Source:
<code>public void testConfigurationProvider() { try { <START> ServerConfiguration configuration = ConfigurationFileLoader.loadConfiguration(); <END> assertEquals(configuration.getProperty(TestConfigurationProvider.PROPERTY_1_NAME, null), TestConfigurationProvider.PROPERTY_1_VALUE); assertEquals(configuration.getProperty(TestConfigurationProvider.PROPERTY_2_NAME, null), TestConfigurationProvider.PROPERTY_2_VALUE); assertEquals(configuration.getProperty(TestConfigurationProvider.PROPERTY_3_NAME, null), TestConfigurationProvider.PROPERTY_3_VALUE); assertEquals(configuration.getProperty(AdditionalTestConfigurationProvider.PROPERTY_NAME, null), AdditionalTestConfigurationProvider.PROPERTY_VALUE); } catch (Exception e) { fail("Error in test", e); } }</code><technical_language>Add final keyword</technical_language>

Target:
public void testConfigurationProvider() { try { final ServerConfiguration configuration = ConfigurationFileLoader.loadConfiguration(); assertEquals(configuration.getProperty(TestConfigurationProvider.PROPERTY_1_NAME, null), TestConfigurationProvider.PROPERTY_1_VALUE); assertEquals(configuration.getProperty(TestConfigurationProvider.PROPERTY_2_NAME, null), TestConfigurationProvider.PROPERTY_2_VALUE); assertEquals(configuration.getProperty(TestConfigurationProvider.PROPERTY_3_NAME, null), TestConfigurationProvider.PROPERTY_3_VALUE); assertEquals(configuration.getProperty(AdditionalTestConfigurationProvider.PROPERTY_NAME, null), AdditionalTestConfigurationProvider.PROPERTY_VALUE); } catch (Exception e) { fail("Error in test", e); } }
Source:
<code>private void fetchWpSettings() { WordPress.getRestClientUtilsV1_1().getGeneralSettings( mSite.getSiteId(), new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { AppLog.d(AppLog.T.API, "Received response to Settings REST request."); credentialsVerified(true); mRemoteSettings.localTableId = mSite.getId(); deserializeDotComRestResponse(mSite, response); if (!mRemoteSettings.equals(mSettings)) { final Map<String, String> currentPostFormats = mSettings.postFormats; boolean location = mSettings.location; boolean optimizedImage = mSettings.optimizedImage; int maxImageWidth = mSettings.maxImageWidth; int imageQualitySetting = mSettings.imageQualitySetting; boolean optimizedVideo = mSettings.optimizedVideo; int maxVideoWidth = mSettings.maxVideoWidth; int videoEncoderBitrate = mSettings.videoEncoderBitrate; mSettings.copyFrom(mRemoteSettings); mSettings.postFormats = currentPostFormats; mSettings.location = location; mSettings.optimizedImage = optimizedImage; mSettings.maxImageWidth = maxImageWidth; mSettings.imageQualitySetting = imageQualitySetting; mSettings.optimizedVideo = optimizedVideo; mSettings.maxVideoWidth = maxVideoWidth; mSettings.videoEncoderBitrate = videoEncoderBitrate; mJpSettings.jetpackProtectWhitelist.clear(); mJpSettings.jetpackProtectWhitelist.addAll(mRemoteJpSettings.jetpackProtectWhitelist); SiteSettingsTable.saveSettings(mSettings); notifyUpdatedOnUiThread(null); } <START> if (mSite.isJetpackConnected()) { <END> fetchJetpackMonitorSettings(); fetchJetpackProtectAndSsoSettings(); } } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { AppLog.w(AppLog.T.API, "Error response to Settings REST request: " + error); notifyUpdatedOnUiThread(error); } }); }</code><technical_language>Is a reason calls in fetchRemoteData</technical_language>

Target:
private void fetchWpSettings() { WordPress.getRestClientUtilsV1_1().getGeneralSettings( mSite.getSiteId(), new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { AppLog.d(AppLog.T.API, "Received response to Settings REST request."); credentialsVerified(true); mRemoteSettings.localTableId = mSite.getId(); deserializeDotComRestResponse(mSite, response); if (!mRemoteSettings.equals(mSettings)) { final Map<String, String> currentPostFormats = mSettings.postFormats; boolean location = mSettings.location; mSettings.copyFrom(mRemoteSettings); mSettings.postFormats = currentPostFormats; mSettings.location = location; SiteSettingsTable.saveSettings(mSettings); } notifyUpdatedOnUiThread(null); } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { AppLog.w(AppLog.T.API, "Error response to Settings REST request: " + error); notifyUpdatedOnUiThread(error); } }); }
Source:
<code>private static String getMultiArchPath() { String cpu = Platform.ARCH; String kernel = Platform.iskFreeBSD() ? "-kfreebsd" : (Platform.isGNU() ? "" : "-linux"); String libc = "-gnu"; if (Platform.isIntel()) { cpu = (Platform.is64Bit() ? "x86_64" : "i386"); } else if (Platform.isPPC()) { cpu = (Platform.is64Bit() ? "powerpc64" : "powerpc"); } else if (Platform.isARM()) { cpu = "arm"; libc = "-gnueabi"; } else if (Platform.isMIPS()) { cpu = (Platform.is64Bit() ? "mips64el" : "mipsel"); <START> } <END> return cpu + kernel + libc; }</code><technical_language>cpu is filled Platform#getCanonicalArchitecture, is this needed JVM set correct architecture? I remove this, this conflict big-endian mips support. I checked debian mips64el is a libc suffix: -gnueabi64: /usr/lib/mips64el-linux-gnuabi64 libc corrected. I suggest: java else if (Platform.ARCH.equals("mips64el")) { libc = "-gnueabi64"; }</technical_language>

Target:
private static String getMultiArchPath() { String cpu = Platform.ARCH; String kernel = Platform.iskFreeBSD() ? "-kfreebsd" : (Platform.isGNU() ? "" : "-linux"); String libc = "-gnu"; if (Platform.isIntel()) { cpu = (Platform.is64Bit() ? "x86_64" : "i386"); } else if (Platform.isPPC()) { cpu = (Platform.is64Bit() ? "powerpc64" : "powerpc"); } else if (Platform.isARM()) { cpu = "arm"; libc = "-gnueabi"; } else if (Platform.ARCH.equals("mips64el")) { libc = "-gnuabi64"; } return cpu + kernel + libc; }
Source:
<code>public void setup() throws Exception { context.put(ModuleManager.class, moduleManager); mockTime = mock(EngineTime.class); context.put(Time.class, mockTime); NetworkSystemImpl networkSystem = new NetworkSystemImpl(mockTime, context); context.put(Game.class, new Game()); context.put(NetworkSystem.class, networkSystem); EntitySystemSetupUtil.addReflectionBasedLibraries(context); EntitySystemSetupUtil.addEntityManagementRelatedClasses(context); engineEntityManager = context.get(EngineEntityManager.class); <START> BlockManager blockManagerLocal = context.get(BlockManager.class); END> BiomeManager biomeManager = context.get(BiomeManager.class); Path savePath = PathManager.getInstance().getSavePath("world1"); context.put(StorageManager.class, new ReadWriteStorageManager(savePath, moduleManager.getEnvironment(), engineEntityManager, blockManagerLocal, biomeManager)); componentSystemManager = new ComponentSystemManager(context); context.put(ComponentSystemManager.class, componentSystemManager); LoadPrefabs prefabLoadStep = new LoadPrefabs(context); boolean complete = false; prefabLoadStep.begin(); while (!complete) { complete = prefabLoadStep.step(); } context.get(ComponentSystemManager.class).initialise(); }</code><technical_language>Is local BlockManager needed? set in @BeforeClass ..</technical_language>

Target:
public void setup() throws Exception { context.put(ModuleManager.class, moduleManager); mockTime = mock(EngineTime.class); context.put(Time.class, mockTime); NetworkSystemImpl networkSystem = new NetworkSystemImpl(mockTime, context); context.put(Game.class, new Game()); context.put(NetworkSystem.class, networkSystem); EntitySystemSetupUtil.addReflectionBasedLibraries(context); EntitySystemSetupUtil.addEntityManagementRelatedClasses(context); engineEntityManager = context.get(EngineEntityManager.class); BlockManager mockBlockManager = context.get(BlockManager.class); BiomeManager biomeManager = context.get(BiomeManager.class); Path savePath = PathManager.getInstance().getSavePath("world1"); context.put(StorageManager.class, new ReadWriteStorageManager(savePath, moduleManager.getEnvironment(), engineEntityManager, mockBlockManager, biomeManager)); componentSystemManager = new ComponentSystemManager(context); context.put(ComponentSystemManager.class, componentSystemManager); LoadPrefabs prefabLoadStep = new LoadPrefabs(context); boolean complete = false; prefabLoadStep.begin(); while (!complete) { complete = prefabLoadStep.step(); } context.get(ComponentSystemManager.class).initialise(); }
Source:
<code>private static Set<UUID> getAvailablePlayerUUIDs(Path playersDirectory) { Set<UUID> ret = new HashSet<>(); try (DirectoryStream<Path> stream = Files.newDirectoryStream(playersDirectory, "*.dat")) { for (Path entry : stream) { try { <START> String name = entry.getFileName().toString().replaceAll("\\.dat$", ""); <END> ret.add(UUID.fromString(name)); } catch (IllegalArgumentException ex) { } } } catch (IOException ex) { SpongeImpl.getLogger().error("Could not get the available UUIDs", ex); } return ret; }</code><technical_language>"\\.dat$" is compiled time. compile regex Matcher#replaceAll</technical_language>

Target:
private static Set<UUID> getAvailablePlayerUUIDs(Path playersDirectory) { Set<UUID> ret = new HashSet<>(); try (DirectoryStream<Path> stream = Files.newDirectoryStream(playersDirectory, "*.dat")) { for (Path entry : stream) { try { String name = DAT_FILENAME_SUFFIX.matcher(entry.getFileName().toString()).replaceAll(""); ret.add(UUID.fromString(name)); } catch (IllegalArgumentException ex) { } } } catch (IOException ex) { SpongeImpl.getLogger().error("Could not get the available UUIDs", ex); } return ret; }
Source:
<code>public String getDescription() { return "Transform files representing a structured table under an Alluxio directory." + "\n\n" + "Files are coalesced and converted to parquet format." + "\n\n" <START> + "Definition is in format like 'write(hive).option(hive.num.files, 100)'."; <END> }</code><technical_language>point users some kind of regex options, valid values are? I understand format based docs usage string here</technical_language>

Target:
public String getDescription() { return "Transform files representing a structured table under an Alluxio directory." + "\n\n" + "Files are coalesced and converted to parquet format." + "\n\n" + "Definition is in format like 'write(hive).option(hive.num.files, 100)'," + "currently, the only modification you can do to the example definition is " + "the number of files in the option."; }
Source:
<code>public static List<KeyRange> generateAllSaltingRanges(int bucketNum) { List<KeyRange> allRanges = Lists.<KeyRange>newArrayListWithExpectedSize(bucketNum); byte[] bound = new byte[] {0}; <START> for (int i=0; i<bucketNum; i++) { <END> byte[] boundCopy = Arrays.copyOf(bound, bound.length); allRanges.add(SALTING_COLUMN.getDataType().getKeyRange( boundCopy, true, boundCopy, true)); ByteUtil.nextKey(bound, 1); } return allRanges; }</code><technical_language>a bit simpler as: byte[] saltByte = new byte[] {i}; allRanges.add(SALTING_COLUMN.getDataType().getKeyRange(saltByte, true, saltByte, true))</technical_language>

Target:
public static List<KeyRange> generateAllSaltingRanges(int bucketNum) { List<KeyRange> allRanges = Lists.<KeyRange>newArrayListWithExpectedSize(bucketNum); for (int i=0; i<bucketNum; i++) { byte[] saltByte = new byte[] {(byte) i}; allRanges.add(SALTING_COLUMN.getDataType().getKeyRange( saltByte, true, saltByte, true)); } return allRanges; }
Source:
<code>public void gosecUtilsConstructorTest() throws Exception { <START> assertThat(gosecSsoUtils.userName.equals("anyUser")).isTrue(); <END> }</code><technical_language>assertThat(gosecSsoUtils.userName).equals("anyUser");</technical_language>

Target:
public void gosecUtilsConstructorTest() throws Exception { assertThat(gosecSsoUtils.ssoHost).isEqualTo("www.google.com"); assertThat(gosecSsoUtils.userName).isEqualTo("anyUser"); assertThat(gosecSsoUtils.passWord).isEqualTo("anyPassWord"); }
Source:
<code>private boolean valuesChanged( int[] propertyIds, SchemaDescriptor.PropertySchemaType propertySchemaType ) { if ( propertySchemaType == COMPLETE_ALL_TOKENS ) { for ( int propertyId : propertyIds ) { if ( knownProperties.get( propertyId ).type == Changed ) { return true; } } return false; } else { for ( int propertyId : propertyIds ) { <START> if ( knownProperties.get( propertyId ).type != UnChanged ) <END> { return true; } } return false; } }</code><technical_language>I feel this "not unchanged" logic needs some explanation. is this is true in Changed case, for Before, After, NoValue</technical_language>

Target:
private boolean valuesChanged( int[] propertyIds, SchemaDescriptor.PropertySchemaType propertySchemaType ) { if ( propertySchemaType == COMPLETE_ALL_TOKENS ) { for ( int propertyId : propertyIds ) { if ( knownProperties.get( propertyId ).type == Changed ) { return true; } } return false; } else { for ( int propertyId : propertyIds ) { PropertyValueType type = knownProperties.get( propertyId ).type; if ( type != UnChanged && type != NoValue ) { return true; } } return false; } }
Source:
<code>public void cassandraKvsInitializesAsynchronously() { KeyValueService asyncInitializedKvs = CassandraKeyValueServiceImpl.create( MetricsManagers.createForTests(), CassandraContainer.KVS_CONFIG, CassandraKeyValueServiceRuntimeConfig::getDefault, CassandraContainer.LEADER_CONFIG, CassandraMutationTimestampProviders.legacyModeForTestsOnly(), true, FakeQosClient.INSTANCE); assertThat(asyncInitializedKvs.isInitialized()).isFalse(); startCassandra(); <START> <END> Awaitility.await().atMost(25, TimeUnit.SECONDS).until(asyncInitializedKvs::isInitialized); }</code><technical_language>nit: want check initialised soon after? I suppose a tiny bit racy/flaky</technical_language>

Target:
public void cassandraKvsInitializesAsynchronously() throws IOException, InterruptedException { KeyValueService asyncInitializedKvs = CASSANDRA.getAsyncInitializeableKvs(); assertThat(asyncInitializedKvs.isInitialized()).isFalse(); CASSANDRA.initialize(); Awaitility.await().atMost(35, TimeUnit.SECONDS).until(asyncInitializedKvs::isInitialized); }
Source:
<code>public void testAllProvidersArePopulated() { List<String> providers = Arrays.asList( AuthUI.FACEBOOK_PROVIDER, AuthUI.GOOGLE_PROVIDER, AuthUI.EMAIL_PROVIDER); <START> new GoogleProvider(null, null); <END> AuthMethodPickerActivity authMethodPickerActivity = createActivity(providers); assertEquals(providers.size(), ((LinearLayout) authMethodPickerActivity.findViewById(R.id.btn_holder)) .getChildCount()); Button emailButton = (Button) authMethodPickerActivity.findViewById(R.id.email_provider); assertEquals(View.VISIBLE, emailButton.getVisibility()); }</code><technical_language>purpose of this line</technical_language>

Target:
public void testAllProvidersArePopulated() { List<String> providers = Arrays.asList( AuthUI.FACEBOOK_PROVIDER, AuthUI.GOOGLE_PROVIDER, AuthUI.EMAIL_PROVIDER); AuthMethodPickerActivity authMethodPickerActivity = createActivity(providers); assertEquals(providers.size(), ((LinearLayout) authMethodPickerActivity.findViewById(R.id.btn_holder)) .getChildCount()); Button emailButton = (Button) authMethodPickerActivity.findViewById(R.id.email_provider); assertEquals(View.VISIBLE, emailButton.getVisibility()); }
Source:
<code>public void validate() throws IndexBuilderException { <START> for (Term term: TAXON_REQUIRED) <END> if (!this.termLocations.containsKey(term)) throw new IndexBuilderException("CSV file does not contain required term " + term); }</code><technical_language>Cases this slightly easier read if optional block brackets used</technical_language>

Target:
public void validate() throws IndexBuilderException { for (Term term: TAXON_REQUIRED) { if (!this.termLocations.containsKey(term)) throw new IndexBuilderException("CSV file does not contain required term " + term); } }
Source:
<code><START> public void beforeCheckpoint(long windowId) { <END> logger.debug("checkpointedWindowId checkpointed at {}", Codec.getStringWindowId(checkpointedWindowId), Codec.getStringWindowId(windowId)); if (checkpointedWindowId == 0) { checkpointedWindowId = windowId; logger.debug("firstRun={} checkpointedWindowId={}", firstRun, Codec.getStringWindowId(checkpointedWindowId)); } }</code><technical_language>Fix code style</technical_language>

Target:
public void beforeCheckpoint(long windowId) { if (checkpointedWindowId == 0) { checkpointedWindowId = windowId; } logger.debug("{}, windowId={}", this, Codec.getStringWindowId(windowId)); }
Source:
<code>public String toString() { return this.getReadId() + "-" + this.getOffset() + "_" + (this.getMateId()) + " " + "readSeq: " <START> + (this.thisReadSequence != null ? this.thisReadSequence.toString() : "") + " " + "mateReadSeq: " <END> + (this.mateReadSequence != null ? this.mateReadSequence.toString() : ""); }</code><technical_language>write null explicitly empty string</technical_language>

Target:
public String toString() { return this.getReadId() + "-" + this.getOffset() + "_" + (this.getMateId()) + " " + "readSeq: " + (this.thisReadSequence != null ? this.thisReadSequence.toString() : "null") + " " + "mateReadSeq: " + (this.mateReadSequence != null ? this.mateReadSequence.toString() : "null"); }
Source:
<code>public KualiAddress() { super(); this.active = true; <START> this.objectId = UUID.randomUUID().toString(); <END> }</code><technical_language>is need set for object id</technical_language>

Target:
public KualiAddress() { super(); active = true; }
Source:
<code>protected void checkForLostData(AvailabilityStrategyContext context, List<Address> newMembers) { CacheTopology stableTopology = context.getStableTopology(); List<Address> stableMembers = stableTopology.getMembers(); List<Address> lostMembers = new ArrayList<>(stableMembers); lostMembers.removeAll(newMembers); if (isDataLost(stableTopology.getCurrentCH(), newMembers)) { <START> log.errorf("Cache %s lost data because of abrupt leavers %s", lostMembers); <END> } if (lostMembers.size() >= Math.ceil(stableMembers.size() / 2d)) { log.errorf("Cache %s lost a majority of members (%d out of %d), possible split brain causing data inconsistency", lostMembers.size(), stableMembers.size()); } }</code><technical_language>Log method</technical_language>

Target:
protected void checkForLostData(AvailabilityStrategyContext context, List<Address> newMembers) { CacheTopology stableTopology = context.getStableTopology(); List<Address> stableMembers = stableTopology.getMembers(); List<Address> lostMembers = new ArrayList<>(stableMembers); lostMembers.removeAll(newMembers); if (isDataLost(stableTopology.getCurrentCH(), newMembers)) { log.lostDataBecauseOfAbruptLeavers(context.getCacheName(), lostMembers); } if (lostMembers.size() >= Math.ceil(stableMembers.size() / 2d)) { log.minorityPartition(context.getCacheName(), lostMembers.size(), stableMembers.size()); } }
Source:
<code>public void setup() { j.jenkins.setSecurityRealm(j.createDummySecurityRealm()); j.jenkins.setAuthorizationStrategy(new MockAuthorizationStrategy() <START> .grant(Jenkins.MANAGE).everywhere().to("bob") <END> .grant(Jenkins.READ, Item.READ, Item.EXTENDED_READ).everywhere().to("alice")); }</code><technical_language>Revert this</technical_language>

Target:
public void setup() { j.jenkins.setSecurityRealm(j.createDummySecurityRealm()); j.jenkins.setAuthorizationStrategy(new MockAuthorizationStrategy() .grant(Jenkins.ADMINISTER).everywhere().to("bob") .grant(Jenkins.READ, Item.READ, Item.EXTENDED_READ).everywhere().to("alice")); }
Source:
<code>public int compareTo(IItemDescriptor<T> o) { if (o == null) { <START> return -1; <END> } int comp = (getRank() - o.getRank()) * -1; if (comp == 0) { comp = getID().compareTo(o.getID()); } return comp; }</code><technical_language>this happen. contract of comparable is throw NullPointerException if object is null. Please change a Preconditions.checkNotNull(o)</technical_language>

Target:
public int compareTo(IItemDescriptor<T> o) { Preconditions.checkNotNull(o); int comp = getRank() - o.getRank(); if (comp == 0) { comp = getID().compareTo(o.getID()); } return comp; }
Source:
<code><START> public StudentsData() { } <END></code><technical_language>sense a StudentsData object students, do this constructor List<StudentData> argument? leave students final remove setter</technical_language>

Target:
public StudentsData() { this.students = new ArrayList<>(); }
Source:
<code>private Configuration getConfig() { Configuration conf = new Configuration(false); conf.set(SqsApplication.SQSDEV_CREDS_FILENAME_PROPERTY, SQS_OPERATOR_CREDS_FILENAME); conf.addResource(this.getClass().getResourceAsStream("/META-INF/properties.xml")); String pre = "dt.operator.fileOut.prop."; <START> conf.set( pre + "filePath", FILE_DIR); <END> pre = "dt.operator.sqsIn.prop."; conf.set( pre + "subject", currentQueueName); return conf; }</code><technical_language>Odd spacing</technical_language>

Target:
private Configuration getConfig() { Configuration conf = new Configuration(false); conf.addResource(this.getClass().getResourceAsStream("/META-INF/properties.xml")); String pre = "dt.operator.fileOut.prop."; conf.set(pre + "filePath", FILE_DIR); pre = "dt.operator.sqsIn.prop."; conf.set(pre + "subject", currentQueueName); conf.set(pre + "aws.endpoint", "http://localhost:9324"); return conf; }
Source:
<code>protected void onResume() { super.onResume(); disposable = realm.where(Person.class).findAllAsync().asFlowable() <START> .flatMap(new Function<RealmResults<Person>, Publisher<Person>>() { <END> @Override public Publisher<Person> apply(RealmResults<Person> persons) throws Exception { return Flowable.fromIterable(persons); } }) .zipWith(Flowable.interval(1, TimeUnit.SECONDS), new BiFunction<Person, Long, Person>() { @Override public Person apply(Person person, Long tick) throws Exception { return person; } }) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Consumer<Person>() { @Override public void accept(Person person) throws Exception { TextView personView = new TextView(AnimationActivity.this); personView.setText(person.getName()); container.addView(personView); } }); }</code><technical_language>Converting Java 8 is fine improve readability a lot for this</technical_language>

Target:
protected void onResume() { super.onResume(); disposable = realm.where(Person.class).findAllAsync().asFlowable() .flatMap(persons -> Flowable.fromIterable(persons)) .zipWith(Flowable.interval(1, TimeUnit.SECONDS), (person, tick) -> person) .observeOn(AndroidSchedulers.mainThread()) .subscribe(person -> { TextView personView = new TextView(AnimationActivity.this); personView.setText(person.getName()); container.addView(personView); }); }
Source:
<code>public ActualProperties build() { <START> List<LocalProperty<Symbol>> localProperties = unordered ? filteredCopy(this.localProperties, property -> !property.isOrderSensitive()) : this.localProperties; <END> return new ActualProperties(global, localProperties, constants); }</code><technical_language>I find this easier read: java List<LocalProperty<Symbol>> localProperties = this.localProperties; if (unordered) { localProperties = filteredCopy(localProperties, property -> !property.isOrderSensitive()); } return new ActualProperties(global, localProperties, constants);</technical_language>

Target:
public ActualProperties build() { List<LocalProperty<Symbol>> localProperties = this.localProperties; if (unordered) { localProperties = filteredCopy(this.localProperties, property -> !property.isOrderSensitive()); } return new ActualProperties(global, localProperties, constants); }
Source:
<code>public void testOnJobRenamed() throws Exception { FreeStyleProject p1 = jenkins.createFreeStyleProject("build1"); List<DeliveryPipelineView.ComponentSpec> componentSpecs = new ArrayList<DeliveryPipelineView.ComponentSpec>(); <START> componentSpecs.add(new DeliveryPipelineView.ComponentSpec("comp1", "build1", null)); <END> componentSpecs.add(new DeliveryPipelineView.ComponentSpec("comp2", "build2", null)); DeliveryPipelineView view = new DeliveryPipelineView("Test"); view.setComponentSpecs(componentSpecs); jenkins.getInstance().addView(view); p1.renameTo("newbuild"); assertEquals("newbuild", view.getComponentSpecs().get(0).getFirstJob()); }</code><technical_language>I test cases (DeliveryPipelineViewTest GuiFunctionalIT) ComponentSpec constructor bind null a constant "NONE", clarify intention of null usage in test cases</technical_language>

Target:
public void testOnJobRenamed() throws Exception { FreeStyleProject p1 = jenkins.createFreeStyleProject("build1"); List<DeliveryPipelineView.ComponentSpec> componentSpecs = new ArrayList<DeliveryPipelineView.ComponentSpec>(); componentSpecs.add(new DeliveryPipelineView.ComponentSpec("comp1", "build1", NONE)); componentSpecs.add(new DeliveryPipelineView.ComponentSpec("comp2", "build2", NONE)); DeliveryPipelineView view = new DeliveryPipelineView("Test"); view.setComponentSpecs(componentSpecs); jenkins.getInstance().addView(view); p1.renameTo("newbuild"); assertEquals("newbuild", view.getComponentSpecs().get(0).getFirstJob()); }
Source:
<code>public void shouldRemoveEmptySCMPasswordAndEncryptedPasswordAttributes_XslMigrationFrom109To110() throws Exception { ReflectionUtil.setField(new DESCipherProvider(systemEnvironment), "cachedKey", null); FileUtils.writeStringToFile(systemEnvironment.getDESCipherFile(), "269298bc31c44620", UTF_8); String content = configWithPipeline( "<pipeline name='some_pipeline'>" + " <materials>" + " <svn url='svn1' username='bob' encryptedPassword='' dest='svn1'/>" + " <svn url='svn2' username='bob' password='' dest='svn2'/>" + " <tfs url='tfsurl1' username='user' domain='domain' encryptedPassword='' projectPath='path' dest='tfs1' />" + " <tfs url='tfsurl2' username='user' domain='domain' password='' projectPath='path' dest='tfs2' />" + " <p4 port='host:9999' username='user' encryptedPassword='' dest='perforce1'>" + " <view><![CDATA[view]]></view>" + " </p4>" + " <p4 port='host:9999' username='user' password='' dest='perforce2'>" + " <view><![CDATA[view]]></view>" + " </p4>" + " </materials>" + " <stage name='some_stage'>" + " <jobs>" + " <job name='some_job'>" + " </job>" + " </jobs>" + " </stage>" + "</pipeline>", 109); assertThat(XpathUtils.nodeExists(content, " assertThat(XpathUtils.nodeExists(content, " CruiseConfig config = ConfigMigrator.loadWithMigration(content).config; <START> String xmlPartial = xmlWriter.toXmlPartial(config); <END> assertThat(XpathUtils.nodeExists(xmlPartial, " assertThat(XpathUtils.nodeExists(xmlPartial, " }</code><technical_language>check if a empty password encryptedPassword exists, nodeExists</technical_language>

Target:
public void shouldRemoveEmptySCMPasswordAndEncryptedPasswordAttributes_XslMigrationFrom109To110() throws Exception { resetCipher.setupDESCipherFile(); String content = configWithPipeline( "<pipeline name='some_pipeline'>" + " <materials>" + " <svn url='svn1' username='bob' encryptedPassword='' dest='svn1'/>" + " <svn url='svn2' username='bob' password='' dest='svn2'/>" + " <tfs url='tfsurl1' username='user' domain='domain' encryptedPassword='' projectPath='path' dest='tfs1' />" + " <tfs url='tfsurl2' username='user' domain='domain' password='' projectPath='path' dest='tfs2' />" + " <p4 port='host:9999' username='user' encryptedPassword='' dest='perforce1'>" + " <view><![CDATA[view]]></view>" + " </p4>" + " <p4 port='host:9999' username='user' password='' dest='perforce2'>" + " <view><![CDATA[view]]></view>" + " </p4>" + " </materials>" + " <stage name='some_stage'>" + " <jobs>" + " <job name='some_job'>" + " </job>" + " </jobs>" + " </stage>" + "</pipeline>", 109); assertThat(XpathUtils.nodeExists(content, " assertThat(XpathUtils.nodeExists(content, " CruiseConfig config = ConfigMigrator.loadWithMigration(content).config; String xmlPartial = xmlWriter.toXmlPartial(config); assertThat(XpathUtils.nodeExists(xmlPartial, " assertThat(XpathUtils.nodeExists(xmlPartial, " }
Source:
<code>public void upgradeForWrite(int stripeId, String nodeName) { requireNonNull(nodeName); if (stripeId < 1) { throw new IllegalArgumentException("Stripe ID should be greater than or equal to 1"); } if (nomadServer.getChangeApplicator() != null) { throw new IllegalStateException("Nomad is already upgraded"); } router.register(SettingNomadChange.class, new SettingNomadChangeProcessor(dynamicConfigService, configChangeHandlerManager, dynamicConfigListener)); router.register(NodeRemovalNomadChange.class, new NodeRemovalNomadChangeProcessor(dynamicConfigService, dynamicConfigListener)); router.register(NodeAdditionNomadChange.class, new NodeAdditionNomadChangeProcessor(dynamicConfigService, dynamicConfigListener)); router.register(ClusterActivationNomadChange.class, new ClusterActivationNomadChangeProcessor(stripeId, nodeName)); <START> router.register(StripeAdditionNomadChange.class, new StripeAdditionNomadChangeProcessor(dynamicConfigService, dynamicConfigListener)); <END> router.register(StripeRemovalNomadChange.class, new StripeRemovalNomadChangeProcessor(dynamicConfigService, dynamicConfigListener)); nomadServer.setChangeApplicator( new ConfigChangeApplicator(stripeId, nodeName, new MultiSettingNomadChangeProcessor(nomadPermissionChangeProcessor .then(new ApplicabilityNomadChangeProcessor(stripeId, nodeName, router))))); LOGGER.debug("Successfully completed upgradeForWrite procedure"); }</code><technical_language>StripeAdditionNomadChangeProcessor needs licenseService dynamicConfigService</technical_language>

Target:
public void upgradeForWrite(int stripeId, String nodeName) { requireNonNull(nodeName); if (stripeId < 1) { throw new IllegalArgumentException("Stripe ID should be greater than or equal to 1"); } if (nomadServer.getChangeApplicator() != null) { throw new IllegalStateException("Nomad is already upgraded"); } router.register(SettingNomadChange.class, new SettingNomadChangeProcessor(dynamicConfigService, configChangeHandlerManager, dynamicConfigListener)); router.register(NodeRemovalNomadChange.class, new NodeRemovalNomadChangeProcessor(dynamicConfigService, dynamicConfigListener)); router.register(NodeAdditionNomadChange.class, new NodeAdditionNomadChangeProcessor(dynamicConfigService, dynamicConfigListener)); router.register(ClusterActivationNomadChange.class, new ClusterActivationNomadChangeProcessor(stripeId, nodeName)); router.register(StripeAdditionNomadChange.class, new StripeAdditionNomadChangeProcessor(dynamicConfigService, dynamicConfigListener, licenseService)); router.register(StripeRemovalNomadChange.class, new StripeRemovalNomadChangeProcessor(dynamicConfigService, dynamicConfigListener)); nomadServer.setChangeApplicator( new ConfigChangeApplicator(stripeId, nodeName, new MultiSettingNomadChangeProcessor(nomadPermissionChangeProcessor .then(new ApplicabilityNomadChangeProcessor(stripeId, nodeName, router))))); LOGGER.debug("Successfully completed upgradeForWrite procedure"); }
Source:
<code>public Response lookup(@Context final HttpServletRequest request, @PathParam("objectType") RdapRequestType requestType, @PathParam("key") final String key) { LOGGER.info("Request: {}", RestServiceHelper.getRequestURI(request)); Set<ObjectType> whoisObjectTypes = requestType.getWhoisObjectTypes(key); switch (requestType) { <START> case autnum: { <END> String autnumKey = String.format("AS%s", key); rdapRequestValidator.validateAutnum(autnumKey); return lookupForAutNum(request, autnumKey); } case domain: { rdapRequestValidator.validateDomain(key); return lookupObject(request, whoisObjectTypes, key); } case ip: { rdapRequestValidator.validateIp(request.getRequestURI(), key); return lookupWithRedirectUrl(request, whoisObjectTypes, key); } case entity: { rdapRequestValidator.validateEntity(key); return lookupObject(request, whoisObjectTypes, key); } case nameserver: { throw rdapExceptionMapper.notFound("nameserver not found"); } default: { throw rdapExceptionMapper.badRequest("unknown type"); } } }</code><technical_language>convention enum constants uppercased</technical_language>

Target:
public Response lookup(@Context final HttpServletRequest request, @PathParam("objectType") RdapRequestType requestType, @PathParam("key") final String key) { LOGGER.info("Request: {}", RestServiceHelper.getRequestURI(request)); Set<ObjectType> whoisObjectTypes = requestType.getWhoisObjectTypes(key); switch (requestType) { case AUTNUM: { String autnumKey = String.format("AS%s", key); rdapRequestValidator.validateAutnum(autnumKey); return lookupForAutNum(request, autnumKey); } case DOMAIN: { rdapRequestValidator.validateDomain(key); return lookupObject(request, whoisObjectTypes, key); } case IP: { rdapRequestValidator.validateIp(request.getRequestURI(), key); return lookupWithRedirectUrl(request, whoisObjectTypes, key); } case ENTITY: { rdapRequestValidator.validateEntity(key); return lookupObject(request, whoisObjectTypes, key); } case NAMESERVER: { throw new NotFoundException("nameserver not found"); } default: { throw new BadRequestException("unknown type"); } } }
Source:
<code>public void testWithSqlObjectSingleValue() throws Exception { Dao dao = h2.getJdbi().onDemand(Dao.class); dao.insert(new Something(1, "Coda")); dao.insert(new Something(2, "Brian")); Optional<String> rs = dao.findNameById(1); <START> assertThat(rs).isEqualTo(Optional.of("Coda")); <END> rs = dao.smartFindNameById(1); assertThat(rs).isEqualTo(Optional.of("Coda")); rs = dao.inheritedGenericFindNameById(1); assertThat(rs).isEqualTo(Optional.of("Coda")); }</code><technical_language>Alternatively: assertThat(rs).contains("Coda");</technical_language>

Target:
public void testWithSqlObjectSingleValue() throws Exception { Dao dao = h2.getJdbi().onDemand(Dao.class); dao.insert(new Something(1, "Coda")); dao.insert(new Something(2, "Brian")); Optional<String> rs = dao.findNameById(1); assertThat(rs).contains("Coda"); rs = dao.smartFindNameById(1); assertThat(rs).contains("Coda"); rs = dao.inheritedGenericFindNameById(1); assertThat(rs).contains("Coda"); }
Source:
<code>public Iterator getPrefixes(String namespaceURI) { <START> throw new UnsupportedOperationException("This implementation only allows a one to one prefix to namespace ration."); <END> }</code><technical_language>ration == relation</technical_language>

Target:
public Iterator getPrefixes(String namespaceURI) { throw new UnsupportedOperationException("This implementation only allows a one to one prefix to namespace ratio."); }
Source:
<code>protected boolean canDoAction() { Map<Guid, StorageDomain> domainsMap = new HashMap<Guid, StorageDomain>(); if (getVdsGroup() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_CAN_NOT_BE_EMPTY); return false; } if (!canDoActionBeforeCloneVm(domainsMap)) { return false; } if (getParameters().isImportAsNewEntity()) { initImportClonedVm(); <START> final VM vm = getVm(); <END> if (vm.getInterfaces().size() > getMacPoolForVm().getAvailableMacsCount()) { addCanDoActionMessage(VdcBllMessages.MAC_POOL_NOT_ENOUGH_MAC_ADDRESSES); return false; } } return canDoActionAfterCloneVm(domainsMap); }</code><technical_language>need extract variable</technical_language>

Target:
protected boolean canDoAction() { Map<Guid, StorageDomain> domainsMap = new HashMap<Guid, StorageDomain>(); if (getVdsGroup() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_CAN_NOT_BE_EMPTY); return false; } if (!canDoActionBeforeCloneVm(domainsMap)) { return false; } if (getParameters().isImportAsNewEntity()) { initImportClonedVm(); if (getVm().getInterfaces().size() > getMacPool().getAvailableMacsCount()) { addCanDoActionMessage(VdcBllMessages.MAC_POOL_NOT_ENOUGH_MAC_ADDRESSES); return false; } } return canDoActionAfterCloneVm(domainsMap); }