auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testCannotRebaseChangeAlreadyUpToDate() throws Exception { try { reviewHarness.client.rebase(reviewHarness.shortId, 1, new NullProgressMonitor()); fail("Expected to fail when rebasing a change that is already up to date"); } catch (GerritException e) { assertThat(e.getMessage(), is("Change is already up to date.\n")); } }

Target:
public void testCannotRebaseChangeAlreadyUpToDate() throws Exception { try { reviewHarness.client.rebase(reviewHarness.shortId, 1, new NullProgressMonitor()); fail("Expected to fail when rebasing a change that is already up to date"); } catch (GerritException e) { String message = CharMatcher.JAVA_ISO_CONTROL.removeFrom(e.getMessage()); assertThat(message, is("Change is already up to date.")); } }
Source:
private void assertNotSame(Location loc1, Location loc2) { Assert.assertNotNull(loc1); Assert.assertNotNull(loc2); Assert.assertTrue(loc2 instanceof PortForwardManager, "loc1="+loc1); Assert.assertTrue(loc2 instanceof PortForwardManager, "loc2="+loc2); Assert.assertNotSame(loc1, loc2); Assert.assertNotEquals(((PortForwardManager)loc1).getId(), ((PortForwardManager)loc2).getId()); }

Target:
private void assertNotSame(Location loc1, Location loc2) { Assert.assertNotNull(loc1); Assert.assertNotNull(loc2); Assert.assertTrue(loc1 instanceof PortForwardManager, "loc1="+loc1); Assert.assertTrue(loc2 instanceof PortForwardManager, "loc2="+loc2); Assert.assertNotSame(loc1, loc2); Assert.assertNotEquals(((PortForwardManager)loc1).getId(), ((PortForwardManager)loc2).getId()); }
Source:
private DbUser buildUser(boolean externalSsoEnabled, T params, String authzName) { DbUser dbUser = dbUserDao.getByExternalId(authzName, params.getPrincipalId()); DbUser user = new DbUser(dbUser); user.setId(dbUser == null ? Guid.newGuid() : dbUser.getId()); user.setExternalId(params.getPrincipalId()); user.setDomain(authzName); user.setEmail(params.getEmail()); user.setFirstName(params.getFirstName()); user.setLastName(params.getLastName()); user.setNamespace(params.getNamespace()); user.setLoginName(params.getPrincipalName()); List<Guid> groupIds = new ArrayList<>(); Map<String, ExtMap> groupRecords = new HashMap<>(); flatGroups((Collection<ExtMap>) params.getGroupIds(), groupRecords); for (Map.Entry<String, ExtMap> group: groupRecords.entrySet()) { String name = group.getValue().get(Authz.GroupRecord.NAME); String domain = name.equals("ovirt-administrator") ? "" : authzName; DbGroup dbGroup = externalSsoEnabled ? dbGroupDao.getByNameAndDomain(name, domain) : dbGroupDao.getByExternalId(authzName, group.getKey()); if (dbGroup != null) { dbGroup.setName(name); dbGroupDao.update(dbGroup); groupIds.add(dbGroup.getId()); } } user.setGroupIds(groupIds); user.setAdmin( !roleDao.getAnyAdminRoleForUserAndGroups( user.getId(), StringUtils.join(user.getGroupIds(), ",") ).isEmpty() ); if (dbUser == null) { dbUserDao.save(user); } else if (!dbUser.equals(user)) { dbUserDao.update(user); } return user; }

Target:
private DbUser buildUser(boolean externalSsoEnabled, T params, String authzName) { DbUser dbUser = dbUserDao.getByExternalId(authzName, params.getPrincipalId()); DbUser user = new DbUser(dbUser); user.setId(dbUser == null ? Guid.newGuid() : dbUser.getId()); user.setExternalId(params.getPrincipalId()); user.setDomain(authzName); user.setEmail(params.getEmail()); user.setFirstName(params.getFirstName()); user.setLastName(params.getLastName()); user.setNamespace(params.getNamespace()); user.setLoginName(params.getPrincipalName()); List<Guid> groupIds = new ArrayList<>(); Map<String, ExtMap> groupRecords = new HashMap<>(); flatGroups((Collection<ExtMap>) params.getGroupIds(), groupRecords); for (Map.Entry<String, ExtMap> group: groupRecords.entrySet()) { String name = group.getValue().get(Authz.GroupRecord.NAME); String domain = name.equals(OVIRT_ADMINISTRATOR) ? "" : authzName; DbGroup dbGroup = externalSsoEnabled ? dbGroupDao.getByNameAndDomain(name, domain) : dbGroupDao.getByExternalId(authzName, group.getKey()); if (dbGroup != null) { dbGroup.setName(name); dbGroupDao.update(dbGroup); groupIds.add(dbGroup.getId()); } } user.setGroupIds(groupIds); user.setAdmin( !roleDao.getAnyAdminRoleForUserAndGroups( user.getId(), StringUtils.join(user.getGroupIds(), ",") ).isEmpty() ); if (dbUser == null) { dbUserDao.save(user); } else if (!dbUser.equals(user)) { dbUserDao.update(user); } return user; }
Source:
private String buildMarkdown() { try { StringBuilder htmlErrorReport = new StringBuilder(); final String userComment = userCommentBox.getText().toString(); if (!userComment.isEmpty()) { htmlErrorReport.append(userComment).append("\n"); } htmlErrorReport .append("## Exception") .append("\n* __User Action:__ ") .append(getUserActionString(errorInfo.userAction)) .append("\n* __Request:__ ").append(errorInfo.request) .append("\n* __Content Country:__ ").append(getContentCountryString()) .append("\n* __Content Language:__ ").append(getContentLanguageString()) .append("\n* __App Language:__ ").append(getAppLanguage()) .append("\n* __Service:__ ").append(errorInfo.serviceName) .append("\n* __Version:__ ").append(BuildConfig.VERSION_NAME) .append("\n* __OS:__ ").append(getOsString()).append("\n"); if (errorList.length > 1) { htmlErrorReport .append("<details><summary><b>Exceptions (") .append(errorList.length) .append(")</b></summary><p>\n"); } for (int i = 0; i < errorList.length; i++) { htmlErrorReport.append("<details><summary><b>Crash log "); if (errorList.length > 1) { htmlErrorReport.append(i + 1); } htmlErrorReport.append("</b>") .append("</summary><p>\n") .append("\n```\n").append(errorList[i]).append("\n```\n") .append("</details>\n"); } if (errorList.length > 1) { htmlErrorReport.append("</p></details>\n"); } htmlErrorReport.append("<hr>\n"); return htmlErrorReport.toString(); } catch (Throwable e) { Log.e(TAG, "Error while erroring: Could not build markdown"); e.printStackTrace(); return ""; } }

Target:
private String buildMarkdown() { try { final StringBuilder htmlErrorReport = new StringBuilder(); final String userComment = userCommentBox.getText().toString(); if (!userComment.isEmpty()) { htmlErrorReport.append(userComment).append("\n"); } htmlErrorReport .append("## Exception") .append("\n* __User Action:__ ") .append(getUserActionString(errorInfo.userAction)) .append("\n* __Request:__ ").append(errorInfo.request) .append("\n* __Content Country:__ ").append(getContentCountryString()) .append("\n* __Content Language:__ ").append(getContentLanguageString()) .append("\n* __App Language:__ ").append(getAppLanguage()) .append("\n* __Service:__ ").append(errorInfo.serviceName) .append("\n* __Version:__ ").append(BuildConfig.VERSION_NAME) .append("\n* __OS:__ ").append(getOsString()).append("\n"); if (errorList.length > 1) { htmlErrorReport .append("<details><summary><b>Exceptions (") .append(errorList.length) .append(")</b></summary><p>\n"); } for (int i = 0; i < errorList.length; i++) { htmlErrorReport.append("<details><summary><b>Crash log "); if (errorList.length > 1) { htmlErrorReport.append(i + 1); } htmlErrorReport.append("</b>") .append("</summary><p>\n") .append("\n```\n").append(errorList[i]).append("\n```\n") .append("</details>\n"); } if (errorList.length > 1) { htmlErrorReport.append("</p></details>\n"); } htmlErrorReport.append("<hr>\n"); return htmlErrorReport.toString(); } catch (Throwable e) { Log.e(TAG, "Error while erroring: Could not build markdown"); e.printStackTrace(); return ""; } }
Source:
public Map<Tree, SymbolicBooleanConstraint> evaluateMethod(ExecutionState state, MethodTree tree) { result.clear(); if (tree.block() != null) { try { evaluateStatement(ImmutableList.of(state), tree.block()); } catch (SymbolicExecutionException e) { result.clear(); } } return result; }

Target:
public Map<Tree, SymbolicBooleanConstraint> evaluateMethod(ExecutionState state, MethodTree tree) { result.clear(); if (tree.block() != null) { try { evaluateStatement(ImmutableList.of(state), tree.block()); } catch (SymbolicExecutionException e) { LOGGER.info("analysis of " + tree + " failed: " + e.getMessage(), e); result.clear(); } } return result; }
Source:
public MenuItem(String name, String url) { this.url = url; this.name = name; }

Target:
public MenuItem(String name, String url) { this(name, url, "_blank"); }
Source:
public void callFinalizePublishCommandAsynchronously(Long datasetId, CommandContext ctxt, DataverseRequest request, boolean isPidPrePublished) { logger.fine("Running FinalizeDatasetPublicationCommand, asynchronously"); Dataset theDataset = find(datasetId); try { commandEngine.submit(new FinalizeDatasetPublicationCommand(theDataset, request, isPidPrePublished)); } catch (CommandException cex) { logger.warning("CommandException caught when executing the asynchronous portion of the Dataset Publication Command."); } }

Target:
public void callFinalizePublishCommandAsynchronously(Long datasetId, CommandContext ctxt, DataverseRequest request, boolean isPidPrePublished) { try { Thread.sleep(1000); } catch (Exception ex) { logger.warning("Failed to sleep for a second."); } logger.fine("Running FinalizeDatasetPublicationCommand, asynchronously"); Dataset theDataset = find(datasetId); try { commandEngine.submit(new FinalizeDatasetPublicationCommand(theDataset, request, isPidPrePublished)); } catch (CommandException cex) { logger.warning("CommandException caught when executing the asynchronous portion of the Dataset Publication Command."); } }
Source:
public static FeedbackSessionsForm getFsFormForExistingFs(FeedbackSessionAttributes existingFs, FeedbackSessionsAdditionalSettingsFormSegment additionalSettings, String fsDeleteLink, String fsEditCopyLink) { FeedbackSessionsForm fsForm = new FeedbackSessionsForm(); fsForm.fsDeleteLink = fsDeleteLink; fsForm.copyToLink = fsEditCopyLink; fsForm.courseId = existingFs.getCourseId(); fsForm.isFsNameEditable = false; fsForm.fsName = existingFs.getFeedbackSessionName(); fsForm.isCourseIdEditable = false; fsForm.isFeedbackSessionTypeEditable = false; fsForm.isEditFsButtonsVisible = true; fsForm.timezoneSelectField = PageData.getTimeZoneOptionsAsElementTags(existingFs.getTimeZone()); fsForm.instructions = SanitizationHelper.sanitizeForRichText(existingFs.getInstructions().getValue()); fsForm.fsStartDate = TimeHelper.formatDateForSessionForm(existingFs.getStartTimeLocal()); fsForm.fsStartTimeOptions = PageData.getTimeOptionsAsElementTags(existingFs.getStartTimeLocal()); fsForm.fsEndDate = TimeHelper.formatDateForSessionForm(existingFs.getEndTimeLocal()); fsForm.fsEndTimeOptions = PageData.getTimeOptionsAsElementTags(existingFs.getEndTimeLocal()); fsForm.gracePeriodOptions = PageData.getGracePeriodOptionsAsElementTags(existingFs.getGracePeriod()); fsForm.isSubmitButtonDisabled = false; fsForm.isSubmitButtonVisible = false; fsForm.formSubmitActionLink = Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_SAVE; fsForm.submitButtonText = "Save Changes"; fsForm.additionalSettings = additionalSettings; return fsForm; }

Target:
public static FeedbackSessionsForm getFsFormForExistingFs(FeedbackSessionAttributes existingFs, FeedbackSessionsAdditionalSettingsFormSegment additionalSettings, String fsDeleteLink, String fsEditCopyLink) { FeedbackSessionsForm fsForm = new FeedbackSessionsForm(); fsForm.fsDeleteLink = fsDeleteLink; fsForm.copyToLink = fsEditCopyLink; fsForm.courseId = existingFs.getCourseId(); fsForm.isFsNameEditable = false; fsForm.fsName = existingFs.getFeedbackSessionName(); fsForm.isCourseIdEditable = false; fsForm.isFeedbackSessionTypeEditable = false; fsForm.isEditFsButtonsVisible = true; fsForm.timezoneSelectField = PageData.getTimeZoneOptionsAsElementTags(existingFs.getTimeZone()); fsForm.instructions = SanitizationHelper.sanitizeForRichText(existingFs.getInstructions().getValue()); fsForm.fsStartDate = TimeHelper.formatDateForSessionsForm(existingFs.getStartTimeLocal()); fsForm.fsStartTimeOptions = PageData.getTimeOptionsAsElementTags(existingFs.getStartTimeLocal()); fsForm.fsEndDate = TimeHelper.formatDateForSessionsForm(existingFs.getEndTimeLocal()); fsForm.fsEndTimeOptions = PageData.getTimeOptionsAsElementTags(existingFs.getEndTimeLocal()); fsForm.gracePeriodOptions = PageData.getGracePeriodOptionsAsElementTags(existingFs.getGracePeriod()); fsForm.isSubmitButtonDisabled = false; fsForm.isSubmitButtonVisible = false; fsForm.formSubmitActionLink = Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_SAVE; fsForm.submitButtonText = "Save Changes"; fsForm.additionalSettings = additionalSettings; return fsForm; }
Source:
int computeIndexingBin() { if (getAlignmentStart() > GenomicIndexUtil.BIN_GENOMIC_SPAN || getAlignmentEnd() > GenomicIndexUtil.BIN_GENOMIC_SPAN) { throw new IllegalStateException("Read position too high for BAI bin indexing."); } final int alignmentStart = getAlignmentStart()-1; int alignmentEnd = getAlignmentEnd(); if (alignmentEnd <= 0) { alignmentEnd = alignmentStart + 1; } return GenomicIndexUtil.regionToBin(alignmentStart, alignmentEnd) & (int) BinaryCodec.MAX_USHORT; }

Target:
int computeIndexingBin() { final int alignmentStart = getAlignmentStart() - 1; int alignmentEnd = getAlignmentEnd(); if (alignmentEnd <= 0) { alignmentEnd = alignmentStart + 1; } if (alignmentStart > GenomicIndexUtil.BIN_GENOMIC_SPAN || alignmentEnd > GenomicIndexUtil.BIN_GENOMIC_SPAN) { throw new IllegalStateException("Read position too high for BAI bin indexing."); } return GenomicIndexUtil.regionToBin(alignmentStart, alignmentEnd) & (int) BinaryCodec.MAX_USHORT; }
Source:
public void onPacketData(PacketBufferForestry data, EntityPlayer player) throws IOException { BlockPos pos = data.readBlockPos(); VisualFXType visualFX = VisualFXType.values()[data.readByte()]; SoundFXType soundFX = SoundFXType.values()[data.readByte()]; World world = player.world; IBlockState blockState = world.getBlockState(pos); Block block = blockState.getBlock(); if (visualFX == VisualFXType.BLOCK_BREAK) { Minecraft.getMinecraft().effectRenderer.addBlockDestroyEffects(pos, blockState); } if (soundFX != SoundFXType.NONE) { SoundType soundType = block.getSoundType(blockState, world, pos, null); if (soundFX == SoundFXType.BLOCK_BREAK) { world.playSound(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, soundType.getBreakSound(), SoundCategory.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F, false); } else if (soundFX == SoundFXType.BLOCK_PLACE) { world.playSound(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, soundType.getPlaceSound(), SoundCategory.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F, false); } } }

Target:
public void onPacketData(PacketBufferForestry data, EntityPlayer player) throws IOException { BlockPos pos = data.readBlockPos(); VisualFXType visualFX = VisualFXType.values()[data.readByte()]; SoundFXType soundFX = SoundFXType.values()[data.readByte()]; World world = player.world; IBlockState blockState = NBTUtil.readBlockState(data.readCompoundTag()); Block block = blockState.getBlock(); if (visualFX == VisualFXType.BLOCK_BREAK) { Minecraft.getMinecraft().effectRenderer.addBlockDestroyEffects(pos, blockState); } if (soundFX != SoundFXType.NONE) { SoundType soundType = block.getSoundType(blockState, world, pos, null); if (soundFX == SoundFXType.BLOCK_BREAK) { world.playSound(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, soundType.getBreakSound(), SoundCategory.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F, false); } else if (soundFX == SoundFXType.BLOCK_PLACE) { world.playSound(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, soundType.getPlaceSound(), SoundCategory.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F, false); } } }
Source:
public void whenNoParamsThenDefaultsAreUsed() throws Exception { final ArgumentCaptor<EventStreamConfig> configCaptor = ArgumentCaptor.forClass(EventStreamConfig.class); final EventStream eventStreamMock = mock(EventStream.class); when(eventStreamFactoryMock.createEventStream(any(), any(), configCaptor.capture())) .thenReturn(eventStreamMock); when(topicRepositoryMock.topicExists(eq(TEST_EVENT_TYPE))).thenReturn(true); when(topicRepositoryMock.areCursorsValid(eq(TEST_EVENT_TYPE), any())).thenReturn(true); final MockMvc mockMvc = standaloneSetup(controller) .setMessageConverters(new StringHttpMessageConverter(), new MappingJackson2HttpMessageConverter(objectMapper)) .build(); mockMvc.perform( get(String.format("/event-types/%s/events", TEST_EVENT_TYPE)) .header("X-nakadi-cursors", "[{\"partition\":\"0\",\"offset\":\"0\"}]")) .andExpect(status().isOk()); Thread.sleep(2000); final EventStreamConfig expectedConfig = EventStreamConfig .builder() .withTopic(TEST_EVENT_TYPE) .withBatchLimit(1) .withBatchTimeout(30) .withCursors(ImmutableMap.of("0", "0")) .withStreamKeepAliveLimit(0) .withStreamLimit(0) .withStreamTimeout(0) .build(); assertThat(configCaptor.getValue(), equalTo(expectedConfig)); }

Target:
public void whenNoParamsThenDefaultsAreUsed() throws Exception { final ArgumentCaptor<EventStreamConfig> configCaptor = ArgumentCaptor.forClass(EventStreamConfig.class); final EventStream eventStreamMock = mock(EventStream.class); when(eventStreamFactoryMock.createEventStream(any(), any(), configCaptor.capture())) .thenReturn(eventStreamMock); when(topicRepositoryMock.topicExists(eq(TEST_EVENT_TYPE))).thenReturn(true); when(topicRepositoryMock.areCursorsValid(eq(TEST_EVENT_TYPE), any())).thenReturn(true); final MockMvc mockMvc = standaloneSetup(controller) .setMessageConverters(new StringHttpMessageConverter(), new MappingJackson2HttpMessageConverter(objectMapper)) .build(); mockMvc.perform( get(String.format("/event-types/%s/events", TEST_EVENT_TYPE)) .header("X-nakadi-cursors", "[{\"partition\":\"0\",\"offset\":\"0\"}]")) .andExpect(status().isOk()); final EventStreamConfig expectedConfig = EventStreamConfig .builder() .withTopic(TEST_EVENT_TYPE) .withBatchLimit(1) .withBatchTimeout(30) .withCursors(ImmutableMap.of("0", "0")) .withStreamKeepAliveLimit(0) .withStreamLimit(0) .withStreamTimeout(0) .build(); executeWithRetry(() -> assertThat(configCaptor.getValue(), equalTo(expectedConfig)), new RetryForSpecifiedTimeStrategy<Void>(2000) .withExceptionsThatForceRetry(MockitoException.class) .withWaitBetweenEachTry(50)); }
Source:
public void whenPUTInvalidEventTypeThen422() throws Exception { EventType invalidEventType = buildEventType(); invalidEventType.setCategory(EventCategory.UNDEFINED); Problem expectedProblem = invalidProblem("category", "may not be empty"); putEventType(invalidEventType, invalidEventType.getName()) .andExpect(status().isUnprocessableEntity()) .andExpect(content().contentType("application/problem+json")) .andExpect(content().string(matchesProblem(expectedProblem))); }

Target:
public void whenPUTInvalidEventTypeThen422() throws Exception { EventType invalidEventType = buildEventType(); final JSONObject jsonObject = new JSONObject(objectMapper.writeValueAsString(invalidEventType)); jsonObject.remove("category"); Problem expectedProblem = invalidProblem("category", "may not be null"); putEventType(jsonObject.toString(), invalidEventType.getName()) .andExpect(status().isUnprocessableEntity()) .andExpect(content().contentType("application/problem+json")) .andExpect(content().string(matchesProblem(expectedProblem))); }
Source:
public void getIpv4AddressOfNetworkReturnsNullWhenThereIsNoNetworkOfGivenName() { nic.setIpv4Address(IPV4_ADDRESS); assertThat(underTest.getIpv4AddressOfNetwork("not" + NETWORK_NAME), nullValue(null)); }

Target:
public void getIpv4AddressOfNetworkReturnsNullWhenThereIsNoNetworkOfGivenName() { nic.setIpv4Address(IPV4_ADDRESS); assertThat(underTest.getIpv4AddressOfNetwork(NETWORK_NAME2), nullValue(null)); }
Source:
public void encryptAll(List<String> algorithms) { if (this.encryption == Encryption.CLEAR) { users.replaceAll((u, p) -> encryptPassword((String) u, realm, (String) p, algorithms)); store(realm, encryption); } }

Target:
public void encryptAll(List<String> algorithms) { if (this.encryption == Encryption.CLEAR) { users.replaceAll((u, p) -> encryptPassword((String) u, realm, (String) p, algorithms)); this.encryption = Encryption.ENCRYPTED; store(realm, Encryption.ENCRYPTED); } }
Source:
public void loadFilters() { view.addTextFilter(constants.Process_Definition_Name(), constants.Default_Process_Definition_Name(), true, f -> addSearchFilter(f, likeTo(COL_ID_PROCESSNAME, f.getValue(), false)) ); }

Target:
public void loadFilters() { view.addTextFilter(constants.Name(), constants.Default_Process_Definition_Name(), true, f -> addSearchFilter(f, likeTo(COL_ID_PROCESSNAME, validateValue(f.getValue()), false)) ); }
Source:
private ICPPEvaluation inc(ICPPEvaluation ptr, IASTNode point) { EvalFixed one = new EvalFixed(CPPBasicType.INT, ValueCategory.PRVALUE, IntegralValue.create(1)); return new EvalBinary(IASTBinaryExpression.op_plus, ptr, one, point); }

Target:
private static ICPPEvaluation inc(ICPPEvaluation ptr, IASTNode point) { EvalFixed one = new EvalFixed(CPPBasicType.INT, ValueCategory.PRVALUE, IntegralValue.create(1)); return new EvalBinary(IASTBinaryExpression.op_plus, ptr, one, point); }
Source:
private String decodeStatus(Position position, String value) { if (value != null) { switch (value.toLowerCase()) { case "acc on": case "accstart": position.set(Position.KEY_IGNITION, true); break; case "acc off": case "accstop": position.set(Position.KEY_IGNITION, false); break; case "help me!": position.set(Position.KEY_ALARM, Position.ALARM_SOS); break; case "help me": position.set(Position.KEY_ALARM, Position.ALARM_SOS); break; case "low battery": position.set(Position.KEY_ALARM, Position.ALARM_LOW_BATTERY); break; case "move!": case "moved!": position.set(Position.KEY_ALARM, Position.ALARM_MOVEMENT); break; default: break; } } return null; }

Target:
private String decodeStatus(Position position, String value) { if (value != null) { switch (value.toLowerCase()) { case "acc on": case "accstart": position.set(Position.KEY_IGNITION, true); break; case "acc off": case "accstop": position.set(Position.KEY_IGNITION, false); break; case "help me!": position.set(Position.KEY_ALARM, Position.ALARM_SOS); break; case "low battery": position.set(Position.KEY_ALARM, Position.ALARM_LOW_BATTERY); break; case "move!": case "moved!": position.set(Position.KEY_ALARM, Position.ALARM_MOVEMENT); break; default: break; } } return null; }
Source:
public void fileSeparatorShouldThrowExceptionWhenUsedAsPartOfFolderNameParameter() throws IOException { tempFolder.create(); thrown.expect(IOException.class); thrown.expectMessage(String.format("%s%s%s%n%s", "It's not possible to use the OS separator to create folder hierarchies like 'MyParentFolder'", File.separator, "'MyFolder'.", "Please use newFolder('MyParentFolder', 'MyFolder') instead")); tempFolder.newFolder("MyParentFolder" + File.separator + "MyFolder"); }

Target:
public void fileSeparatorShouldThrowExceptionWhenUsedAsPartOfFolderNameParameter() throws IOException { tempFolder.create(); thrown.expect(IOException.class); String errorMsg = "It's not possible to use the OS separator to create folder " + "hierarchies like 'MyParentFolder'%s'MyFolder'. Please use newFolder('MyParentFolder', "+ "'MyFolder') instead"; thrown.expectMessage(String.format(errorMsg,File.separator)); tempFolder.newFolder("MyParentFolder" + File.separator + "MyFolder"); }
Source:
public void onNext(SuccessResponse successResponse) { Log.i(TAG, successResponse.toString()); userManager.removeAccount(); userManager.refreshAccounts(); logoutSuccess.setValue(successResponse); }

Target:
public void onNext(SuccessResponse successResponse) { Log.i(TAG, successResponse.toString()); logoutSuccess.setValue(successResponse); }
Source:
public void startup(UncaughtExceptionHandler handler) { String name = Thread.currentThread().getName(); Threads.setDaemonThreadRunning(this, name + ".replicationSource.shipper" + walGroupId + "," + source.getQueueId(), (t,e) -> { handler.uncaughtException(t, e); while (true) { try { LOG.info("Refreshing replication sources now due " + "to previous error on shipper thread."); this.source.getSourceManager().refreshSources(this.source.getPeerId()); break; } catch (IOException e1) { LOG.error("Replication sources refresh failed.", e1); sleepForRetries("Sleeping before try refreshing sources again", sleepForRetries, 1, maxRetriesMultiplier); } } }); }

Target:
public void startup(UncaughtExceptionHandler handler) { String name = Thread.currentThread().getName(); Threads.setDaemonThreadRunning(this, name + ".replicationSource.shipper" + walGroupId + "," + source.getQueueId(), handler::uncaughtException); }
Source:
public Task<T> build() { MutableMap<String, Object> taskFlags = MutableMap.copyOf(flags); if (name!=null) taskFlags.add("displayName", name); if (description!=null) taskFlags.add("description", description); if (!tags.isEmpty()) taskFlags.add("tags", tags); if (Boolean.FALSE.equals(dynamic) && children.isEmpty()) { if (swallowChildrenFailures!=null) throw new IllegalArgumentException("Cannot set swallowChildrenFailures for non-dynamic task: "+this); return new BasicTask<T>(taskFlags, body); } if (Boolean.TRUE.equals(dynamic) || (dynamic==null && !parallel)) { if (parallel) throw new UnsupportedOperationException("No implementation of parallel dynamic aggregate task available"); DynamicSequentialTask<T> result = new DynamicSequentialTask<T>(taskFlags, body); if (swallowChildrenFailures!=null && swallowChildrenFailures.booleanValue()) result.swallowChildrenFailures(); for (TaskAdaptable t: children) result.queue(t.asTask()); return result; } if (body != null) { throw new UnsupportedOperationException("No implementation of non-dynamic task with both body and children"); } if (swallowChildrenFailures!=null) { throw new IllegalArgumentException("Cannot set swallowChildrenFailures for non-dynamic task: "+this); } if (parallel) return new ParallelTask(taskFlags, children); else return new SequentialTask(taskFlags, children); }

Target:
public Task<T> build() { MutableMap<String, Object> taskFlags = MutableMap.copyOf(flags); if (name!=null) taskFlags.put("displayName", name); if (description!=null) taskFlags.put("description", description); if (!tags.isEmpty()) taskFlags.put("tags", tags); if (Boolean.FALSE.equals(dynamic) && children.isEmpty()) { if (swallowChildrenFailures!=null) throw new IllegalArgumentException("Cannot set swallowChildrenFailures for non-dynamic task: "+this); return new BasicTask<T>(taskFlags, body); } if (Boolean.TRUE.equals(dynamic) || (dynamic==null && !parallel)) { if (parallel) throw new UnsupportedOperationException("No implementation of parallel dynamic aggregate task available"); DynamicSequentialTask<T> result = new DynamicSequentialTask<T>(taskFlags, body); if (swallowChildrenFailures!=null && swallowChildrenFailures.booleanValue()) result.swallowChildrenFailures(); for (TaskAdaptable t: children) result.queue(t.asTask()); return result; } if (body != null) { throw new UnsupportedOperationException("No implementation of non-dynamic task with both body and children"); } if (swallowChildrenFailures!=null) { throw new IllegalArgumentException("Cannot set swallowChildrenFailures for non-dynamic task: "+this); } if (parallel) return new ParallelTask(taskFlags, children); else return new SequentialTask(taskFlags, children); }
Source:
private static boolean isHDF5File(final File inputFile) { try (final HDF5File hdf5File = new HDF5File(inputFile)) { logger.info(String.format("Opening %s as an HDF5 file...", hdf5File.getFile())); return true; } catch (final GATKException e) { return false; } }

Target:
private static boolean isHDF5File(final File inputFile) { try (final HDF5File hdf5File = new HDF5File(inputFile)) { logger.info(String.format("Opening %s as an HDF5 file...", hdf5File.getFile())); return true; } catch (final HDF5LibException e) { return false; } }
Source:
public static HdfsSplitInfo[] getSplits(final String path, final String inputFormatClassName, final int numOfSplits) { final ExternalConstructor<JobConf> jobConfExternalConstructor = new JobConfExternalConstructor(inputFormatClassName, path); final InputSplit[] inputSplits; try { final JobConf jobConf = jobConfExternalConstructor.newInstance(); final InputFormat inputFormat = jobConf.getInputFormat(); inputSplits = inputFormat.getSplits(jobConf, numOfSplits); if (LOG.isLoggable(Level.FINEST)) { LOG.log(Level.FINEST, "Splits: {0} {1}", new Object[] {Arrays.toString(inputSplits)}); } } catch (final IOException e) { throw new RuntimeException("Unable to get InputSplits using the specified InputFormat", e); } final HdfsSplitInfo[] hdfsSplitInfos = new HdfsSplitInfo[inputSplits.length]; for (int idx = 0; idx < inputSplits.length; idx++) { hdfsSplitInfos[idx] = new HdfsSplitInfo(path, inputSplits[idx], inputFormatClassName); } LOG.log(Level.FINE, "The number of splits: {0}", hdfsSplitInfos.length); return hdfsSplitInfos; }

Target:
public static HdfsSplitInfo[] getSplits(final String path, final String inputFormatClassName, final int numOfSplits) { final JobConf jobConf; try { final Tang tang = Tang.Factory.getTang(); jobConf = tang.newInjector( tang.newConfigurationBuilder() .bindNamedParameter(JobConfExternalConstructor.InputFormatClass.class, inputFormatClassName) .bindNamedParameter(JobConfExternalConstructor.InputPath.class, path) .bindConstructor(JobConf.class, JobConfExternalConstructor.class) .build()) .getInstance(JobConf.class); } catch (final InjectionException e) { throw new RuntimeException("Exception while injecting JobConf", e); } final InputSplit[] inputSplits; try { final InputFormat inputFormat = jobConf.getInputFormat(); inputSplits = inputFormat.getSplits(jobConf, numOfSplits); LOG.log(Level.FINEST, "Splits: {0}", Arrays.toString(inputSplits)); } catch (final IOException e) { throw new RuntimeException("Unable to get InputSplits using the specified InputFormat", e); } final HdfsSplitInfo[] hdfsSplitInfos = new HdfsSplitInfo[inputSplits.length]; for (int idx = 0; idx < inputSplits.length; idx++) { hdfsSplitInfos[idx] = HdfsSplitInfo.newBuilder() .setInputPath(path) .setInputSplit(inputSplits[idx]) .setInputFormatClassName(inputFormatClassName) .build(); } LOG.log(Level.FINE, "The number of splits: {0}", hdfsSplitInfos.length); return hdfsSplitInfos; }
Source:
protected SecretKey engineGenerateSecret(KeySpec keySpec) throws InvalidKeySpecException { if (keySpec instanceof SecretKeySpec) { return (SecretKeySpec) keySpec; } throw new InvalidKeySpecException("keySpec must be SecretKeySpect, given: " + keySpec.getClass().getName()); }

Target:
protected SecretKey engineGenerateSecret(KeySpec keySpec) throws InvalidKeySpecException { if (keySpec instanceof SecretKeySpec) { return (SecretKeySpec) keySpec; } throw log.keySpecMustBeSecretKeySpec(keySpec.getClass().getName()); }
Source:
public void cleanUpBanner(String placementId) { Log.d(TAG, "cleanUpBanner"); Pair<String, VungleNativeAd> pair = activeBannerAds.get(placementId); if (pair != null) { String adapterId = pair.first; removeListeners(adapterId); VungleNativeAd vungleNativeAd = pair.second; if (vungleNativeAd != null) { Log.d(TAG, "cleanUpBanner # finishDisplayingAd"); vungleNativeAd.finishDisplayingAd(); removeActiveBanner(placementId, adapterId); } } }

Target:
void cleanUpBanner(String placementId) { Log.d(TAG, "cleanUpBanner"); VungleNativeAd vungleNativeAd = activeBannerAds.get(placementId); if (vungleNativeAd != null) { Log.d(TAG, "cleanUpBanner # finishDisplayingAd"); vungleNativeAd.finishDisplayingAd(); removeActiveBanner(placementId); } }
Source:
public static AccessModifier getAccessModifierFromModifiersToken(DetailAST ast) { final AccessModifier accessModifier; if (ScopeUtil.isInInterfaceOrAnnotationBlock(ast)) { accessModifier = AccessModifier.PUBLIC; } else { final DetailAST modsToken = ast.findFirstToken(TokenTypes.MODIFIERS); accessModifier = getAccessModifierFromModifiersTokenEx(modsToken); } return accessModifier; }

Target:
public static AccessModifier getAccessModifierFromModifiersToken(DetailAST ast) { final AccessModifier accessModifier; if (ScopeUtil.isInInterfaceOrAnnotationBlock(ast)) { accessModifier = AccessModifier.PUBLIC; } else { final DetailAST modsToken = ast.findFirstToken(TokenTypes.MODIFIERS); accessModifier = getAccessModifierFromModifiersTokenDirectly(modsToken); } return accessModifier; }
Source:
private static boolean anyInterfaceSupportsIpV6() { try { Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); while (interfaces.hasMoreElements()) { NetworkInterface iface = interfaces.nextElement(); Enumeration<InetAddress> addresses = iface.getInetAddresses(); while (addresses.hasMoreElements()) { if (addresses.nextElement() instanceof Inet6Address) { return true; } } } } catch (SocketException e) { logger.debug("Unable to detect if any interface supports IPv6, assuming no", e); } return false; }

Target:
private static boolean anyInterfaceSupportsIpV6() { try { Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); while (interfaces.hasMoreElements()) { NetworkInterface iface = interfaces.nextElement(); Enumeration<InetAddress> addresses = iface.getInetAddresses(); while (addresses.hasMoreElements()) { if (addresses.nextElement() instanceof Inet6Address) { return true; } } } } catch (SocketException e) { logger.debug("Unable to detect if any interface supports IPv6, assuming IPv4-only", e); } return false; }
Source:
private void populateCPUList(ClusterModel clusterModel, List<ServerCpu> cpus, boolean canChangeArchitecture) { ServerCpu oldSelectedCpu = clusterModel.getCPU().getSelectedItem(); clusterModel.getCPU().setItems(cpus); clusterModel.getCPU().setSelectedItem(oldSelectedCpu != null ? Linq.firstOrDefault(cpus, new Linq.ServerCpuPredicate(oldSelectedCpu.getCpuName())) : null); if (clusterModel.getCPU().getSelectedItem() == null || !isCPUinitialized) { initCPU(); } if (clusterModel.getIsEdit()) { if (canChangeArchitecture) { getArchitecture().setItems(new ArrayList<ArchitectureType>(Arrays.asList(ArchitectureType.values()))); } else { getArchitecture().setItems(new ArrayList<ArchitectureType>(Arrays.asList(clusterModel.getEntity() .getArchitecture()))); } ArchitectureType oldSelectedArch = (ArchitectureType) clusterModel.getArchitecture().getSelectedItem(); if (oldSelectedArch != null) { getArchitecture().setSelectedItem(oldSelectedArch); } else { getArchitecture().setSelectedItem(getEntity().getArchitecture()); } } else { filterUnsupportedArchs(clusterModel); getArchitecture().setSelectedItem(ArchitectureType.undefined); } }

Target:
private void populateCPUList(ClusterModel clusterModel, List<ServerCpu> cpus, boolean canChangeArchitecture) { ServerCpu oldSelectedCpu = clusterModel.getCPU().getSelectedItem(); clusterModel.getCPU().setItems(cpus); initSupportedArchitectures(clusterModel); clusterModel.getCPU().setSelectedItem(oldSelectedCpu != null ? Linq.firstOrDefault(cpus, new Linq.ServerCpuPredicate(oldSelectedCpu.getCpuName())) : null); if (clusterModel.getCPU().getSelectedItem() == null || !isCPUinitialized) { initCPU(); } if (clusterModel.getIsEdit()) { if (!canChangeArchitecture) { getArchitecture().setItems(new ArrayList<ArchitectureType>(Arrays.asList(clusterModel.getEntity() .getArchitecture()))); } ArchitectureType oldSelectedArch = (ArchitectureType) clusterModel.getArchitecture().getSelectedItem(); if (oldSelectedArch != null) { getArchitecture().setSelectedItem(oldSelectedArch); } else { getArchitecture().setSelectedItem(getEntity().getArchitecture()); } } else { getArchitecture().setSelectedItem(ArchitectureType.undefined); } }
Source:
protected void loadTemplate(File templateFile) { String templateId = templateFile.getName().substring(0, templateFile.getName().lastIndexOf(".")); try (FileInputStream inputStream = new FileInputStream(templateFile)) { this.stringLoader.putTemplate(templateId, read(inputStream)); logger.info("Loaded template from file {}", templateId, templateFile); } catch (Exception e) { logger.warn("Exception while loading template from due to {}", templateFile, e.getMessage(), e); } }

Target:
protected void loadTemplate(File templateFile) { String templateId = resolveTemplateId(templateFile); try (FileInputStream inputStream = new FileInputStream(templateFile)) { this.stringLoader.putTemplate(templateId, read(inputStream)); logger.info("Loaded template from file {}", templateId, templateFile); } catch (Exception e) { logger.warn("Exception while loading template from due to {}", templateFile, e.getMessage(), e); } }
Source:
public void run() { Map<String, List<String>> sourceIdToRenditionRefs = computeLiveDocumentRefsToRenditionRefs(); List<String> sourceIds = new ArrayList<>(sourceIdToRenditionRefs.keySet()); removeStoredRenditions(sourceIdToRenditionRefs, sourceIds); }

Target:
public void run() { Map<String, List<String>> sourceIdToRenditionRefs = computeLiveDocumentRefsToRenditionRefs(); removeStoredRenditions(sourceIdToRenditionRefs); }
Source:
public void testVersioning() throws Exception { conn.tableOperations().create(tableName); conn.tableOperations().removeProperty(tableName, "table.iterator.scan.vers"); conn.tableOperations().removeProperty(tableName, "table.iterator.majc.vers"); conn.tableOperations().removeProperty(tableName, "table.iterator.minc.vers"); final BatchWriter bw = conn.createBatchWriter(tableName, new BatchWriterConfig()); Mutation m = new Mutation("row1"); m.put("colf", "colq", 1l, "value"); m.put("colf", "colq", 2l, "value"); bw.addMutation(m); bw.flush(); m = new Mutation("row1"); m.put("colf", "colq", 3l, "value"); m.put("colf", "colq", 4l, "value"); bw.addMutation(m); bw.flush(); ClientSideIteratorScanner csis = null; try (Scanner scanner = conn.createScanner(tableName, new Authorizations())) { csis = new ClientSideIteratorScanner(scanner); final IteratorSetting si = new IteratorSetting(10, "localvers", VersioningIterator.class); si.addOption("maxVersions", "2"); csis.addScanIterator(si); checkResults(csis, resultSet1, PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME); checkResults(scanner, resultSet2, PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME); csis.fetchColumnFamily(new Text("colf")); checkResults(csis, resultSet1, PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME); csis.clearColumns(); csis.fetchColumnFamily(new Text("none")); assertFalse(csis.iterator().hasNext()); } finally { if (csis != null) { csis.close(); } } }

Target:
public void testVersioning() throws Exception { conn.tableOperations().create(tableName); conn.tableOperations().removeProperty(tableName, "table.iterator.scan.vers"); conn.tableOperations().removeProperty(tableName, "table.iterator.majc.vers"); conn.tableOperations().removeProperty(tableName, "table.iterator.minc.vers"); final BatchWriter bw = conn.createBatchWriter(tableName, new BatchWriterConfig()); Mutation m = new Mutation("row1"); m.put("colf", "colq", 1l, "value"); m.put("colf", "colq", 2l, "value"); bw.addMutation(m); bw.flush(); m = new Mutation("row1"); m.put("colf", "colq", 3l, "value"); m.put("colf", "colq", 4l, "value"); bw.addMutation(m); bw.flush(); try (Scanner scanner = conn.createScanner(tableName, new Authorizations()); ClientSideIteratorScanner csis = new ClientSideIteratorScanner(scanner)) { final IteratorSetting si = new IteratorSetting(10, "localvers", VersioningIterator.class); si.addOption("maxVersions", "2"); csis.addScanIterator(si); checkResults(csis, resultSet1, PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME); checkResults(scanner, resultSet2, PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME); csis.fetchColumnFamily(new Text("colf")); checkResults(csis, resultSet1, PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME); csis.clearColumns(); csis.fetchColumnFamily(new Text("none")); assertFalse(csis.iterator().hasNext()); } }
Source:
private void export(ClassData def) throws InvalidPluginException { Class<?> clazz; try { clazz = Class.forName(def.className, false, classLoader); } catch (ClassNotFoundException err) { throw new InvalidPluginException(String.format( "Cannot load %s with @Export(\"%s\")", def.className, def.exportedAsName), err); } Export export = clazz.getAnnotation(Export.class); if (export == null) { PluginLoader.log.warn(String.format( "In plugin %s asm incorrectly parsed %s with @Export(\"%s\")", pluginName, clazz.getName(), def.exportedAsName)); return; } if (is(SecureStore.class.getName(), clazz)) { return; } if (is("org.apache.sshd.server.Command", clazz)) { if (sshGen != null) { sshGen.export(export, clazz); } } else if (is("javax.servlet.http.HttpServlet", clazz)) { if (httpGen != null) { httpGen.export(export, clazz); listen(clazz, clazz); } } else { int cnt = sysListen.size(); listen(clazz, clazz); if (cnt == sysListen.size()) { throw new InvalidPluginException(String.format( "Class %s with @Export(\"%s\") not supported", clazz.getName(), export.value())); } } }

Target:
private void export(ClassData def) throws InvalidPluginException { Class<?> clazz; try { clazz = Class.forName(def.className, false, classLoader); } catch (ClassNotFoundException err) { throw new InvalidPluginException(String.format( "Cannot load %s with @Export(\"%s\")", def.className, def.exportedAsName), err); } Export export = clazz.getAnnotation(Export.class); if (export == null) { PluginLoader.log.warn(String.format( "In plugin %s asm incorrectly parsed %s with @Export(\"%s\")", pluginName, clazz.getName(), def.exportedAsName)); return; } if (is("org.apache.sshd.server.Command", clazz)) { if (sshGen != null) { sshGen.export(export, clazz); } } else if (is("javax.servlet.http.HttpServlet", clazz)) { if (httpGen != null) { httpGen.export(export, clazz); listen(clazz, clazz); } } else { int cnt = sysListen.size(); listen(clazz, clazz); if (cnt == sysListen.size()) { throw new InvalidPluginException(String.format( "Class %s with @Export(\"%s\") not supported", clazz.getName(), export.value())); } } }
Source:
protected void processCurrentMessages(final ActorProcessingThread currentThread, final WebDebugger dbg) { assert size > 0; if (VmSettings.SNAPSHOTS_ENABLED && !VmSettings.TEST_SNAPSHOTS) { SnapshotBuffer sb = currentThread.getSnapshotBuffer(); if (SnapshotBackend.getSnapshotVersion() > sb.getSnapshotVersion()) { sb = currentThread.newSnapshot(); } sb.getRecord().handleTodos(sb); firstMessage.serialize(sb); } execute(firstMessage, currentThread, dbg); if (size > 1) { for (EventualMessage msg : mailboxExtension) { if (VmSettings.SNAPSHOTS_ENABLED && !VmSettings.TEST_SNAPSHOTS) { msg.serialize(currentThread.getSnapshotBuffer()); } execute(msg, currentThread, dbg); } } }

Target:
protected void processCurrentMessages(final ActorProcessingThread currentThread, final WebDebugger dbg) { assert size > 0; if (VmSettings.SNAPSHOTS_ENABLED && !VmSettings.TEST_SNAPSHOTS) { SnapshotBuffer sb = currentThread.getSnapshotBuffer(); sb.getRecord().handleTodos(sb); firstMessage.serialize(sb); } execute(firstMessage, currentThread, dbg); if (size > 1) { for (EventualMessage msg : mailboxExtension) { if (VmSettings.SNAPSHOTS_ENABLED && !VmSettings.TEST_SNAPSHOTS) { msg.serialize(currentThread.getSnapshotBuffer()); } execute(msg, currentThread, dbg); } } }
Source:
private void restoreSnapshot() { if (getSelectedItem() == null) { return; } ConfirmationModel model = new ConfirmationModel(); GlusterVolumeSnapshotEntity snapshot = (GlusterVolumeSnapshotEntity) getSelectedItem(); setConfirmWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().confirmRestoreSnapshot() + " - " + getEntity().getName()); model.setHelpTag(HelpTag.volume_restore_snapshot_confirmation); model.setHashName("volume_restore_snapshot_confirmation"); if (snapshot.getStatus() == GlusterSnapshotStatus.STARTED) { model.setMessage(ConstantsManager.getInstance().getMessages().confirmVolumeSnapshotRestoreWithStop()); } else { model.setMessage(ConstantsManager.getInstance().getMessages().confirmVolumeSnapshotRestore()); } UICommand okCommand = UICommand.createDefaultOkUiCommand("onRestoreSnapshot", this); model.getCommands().add(okCommand); UICommand cancelCommand = UICommand.createCancelUiCommand("CancelConfirmation", this); model.getCommands().add(cancelCommand); }

Target:
private void restoreSnapshot() { if (getSelectedItem() == null) { return; } ConfirmationModel model = new ConfirmationModel(); GlusterVolumeSnapshotEntity snapshot = (GlusterVolumeSnapshotEntity) getSelectedItem(); setConfirmWindow(model); model.setTitle(ConstantsManager.getInstance().getMessages().confirmRestoreSnapshot(getEntity().getName())); model.setHelpTag(HelpTag.volume_restore_snapshot_confirmation); model.setHashName("volume_restore_snapshot_confirmation"); if (snapshot.getStatus() == GlusterSnapshotStatus.STARTED) { model.setMessage(ConstantsManager.getInstance() .getConstants() .confirmVolumeSnapshotRestoreWithStopMessage()); } else { model.setMessage(ConstantsManager.getInstance().getConstants().confirmVolumeSnapshotRestoreMesage()); } UICommand okCommand = UICommand.createDefaultOkUiCommand("onRestoreSnapshot", this); model.getCommands().add(okCommand); UICommand cancelCommand = UICommand.createCancelUiCommand("cancelConfirmation", this); model.getCommands().add(cancelCommand); }
Source:
public void clear() { checkAvailable(); int size = records.size(); int removedSoFar = 0; do { Iterator<Map.Entry<KS, R>> iterator = records.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<KS, R> entry = iterator.next(); R record = entry.getValue(); if (records.remove(entry.getKey(), record)) { if (canUpdateStatsOf(record)) { nearCacheStats.decrementOwnedEntryMemoryCost(calculateMemoryCostOf(entry)); nearCacheStats.decrementOwnedEntryCount(); nearCacheStats.incrementInvalidations(); } removedSoFar++; } } } while (removedSoFar < size && !records.isEmpty()); nearCacheStats.incrementInvalidationRequests(); }

Target:
public void clear() { checkAvailable(); int size = records.size(); records.clear(); nearCacheStats.setOwnedEntryCount(0); nearCacheStats.setOwnedEntryMemoryCost(0L); nearCacheStats.incrementInvalidations(size); nearCacheStats.incrementInvalidationRequests(); }
Source:
private EObject findSemanticRoot(final Resource res) { EObject root = res.getContents().get(0); EClass eCls = root.eClass(); boolean isXSD = Iterables.any(eCls.getEAnnotations(), new Predicate<EAnnotation>() { @Override public boolean apply(EAnnotation annotation) { boolean isExtMetadata = "http:/ if (isExtMetadata) { EMap<String, String> details = annotation.getDetails(); if (details.containsKey("name") && details.get("name").isEmpty() && details.containsKey("kind") && "mixed".equals(details.get("kind"))) { return true; } } return false; } }); if (isXSD) { for (int featureID = 0; featureID < eCls.getFeatureCount(); featureID++) { EStructuralFeature eFeature = eCls.getEStructuralFeature(featureID); String name = eFeature.getName(); if (!"mixed".equals(name) && !"xMLNSPrefixMap".equals(name) && !"xSISchemaLocation".equals(name)) { Object obj = root.eGet(eFeature); if (obj instanceof EObject) { root = (EObject) obj; break; } } } } return root; }

Target:
private EObject findSemanticRoot(final Resource res) { EObject root = res.getContents().get(0); EClass eClass = root.eClass(); ExtendedMetaData extendedMetaData = ExtendedMetaData.INSTANCE; if (extendedMetaData.isDocumentRoot(eClass)) { EReference xmlnsPrefixMapFeature = extendedMetaData.getXMLNSPrefixMapFeature(eClass); EReference xsiSchemaLocationFeature = extendedMetaData.getXSISchemaLocationMapFeature(eClass); EAttribute mixedFeatureFeature = extendedMetaData.getMixedFeature(eClass); for (int featureID = 0; featureID < eClass.getFeatureCount(); featureID++) { EStructuralFeature feature = eClass.getEStructuralFeature(featureID); if (feature != mixedFeatureFeature && feature != xmlnsPrefixMapFeature && feature != xsiSchemaLocationFeature) { Object obj = root.eGet(feature); if (obj instanceof EObject) { root = (EObject) obj; break; } } } } return root; }
Source:
public void setSupportedDomainVersionsString(String supportedDomainVersions) { this.supportedDomainVersions = Stream.of(supportedDomainVersions.split(",")) .map(Integer::valueOf) .collect(Collectors.toList()); }

Target:
public void setSupportedDomainVersionsString(String supportedDomainVersions) { if (supportedDomainVersions == null) { return; } this.supportedDomainVersions = Stream.of(supportedDomainVersions.split(",")) .map(Integer::valueOf) .collect(Collectors.toList()); }