auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testConvertToMailgun() { EmailWrapper wrapper = getTypicalEmailWrapper(); try (FormDataMultiPart formData = new MailgunService().parseToEmail(wrapper)) { assertEquals(wrapper.getSenderName() + " <" + wrapper.getSenderEmail() + ">", formData.getField("from").getValue()); assertEquals(wrapper.getRecipient(), formData.getField("to").getValue()); assertEquals(wrapper.getBcc(), formData.getField("bcc").getValue()); assertEquals(wrapper.getReplyTo(), formData.getField("h:Reply-To").getValue()); assertEquals(wrapper.getSubject(), formData.getField("subject").getValue()); assertEquals(wrapper.getContent(), formData.getField("html").getValue()); } catch (IOException e) { fail("Could not close email wrapper stream: " + TeammatesException.toStringWithStackTrace(e)); } }

Target:
public void testConvertToMailgun() throws Exception { EmailWrapper wrapper = getTypicalEmailWrapper(); try (FormDataMultiPart formData = new MailgunService().parseToEmail(wrapper)) { assertEquals(wrapper.getSenderName() + " <" + wrapper.getSenderEmail() + ">", formData.getField("from").getValue()); assertEquals(wrapper.getRecipient(), formData.getField("to").getValue()); assertEquals(wrapper.getBcc(), formData.getField("bcc").getValue()); assertEquals(wrapper.getReplyTo(), formData.getField("h:Reply-To").getValue()); assertEquals(wrapper.getSubject(), formData.getField("subject").getValue()); assertEquals(wrapper.getContent(), formData.getField("html").getValue()); } }
Source:
private CompletableFuture<PhysicalSlot> requestNewSlot( SlotRequestId slotRequestId, ResourceProfile resourceProfile, boolean willSlotBeOccupiedIndefinitely) { if (willSlotBeOccupiedIndefinitely) { return slotPool.requestNewAllocatedSlot(slotRequestId, resourceProfile, null); } else { slotPool.disableBatchSlotRequestTimeoutCheck(); return slotPool.requestNewAllocatedBatchSlot(slotRequestId, resourceProfile); } }

Target:
private CompletableFuture<PhysicalSlot> requestNewSlot( SlotRequestId slotRequestId, ResourceProfile resourceProfile, boolean willSlotBeOccupiedIndefinitely) { if (willSlotBeOccupiedIndefinitely) { return slotPool.requestNewAllocatedSlot(slotRequestId, resourceProfile, null); } else { return slotPool.requestNewAllocatedBatchSlot(slotRequestId, resourceProfile); } }
Source:
void writeSQLine(final SAMSequenceRecord sequenceRecord) { final int numAttributes = sequenceRecord.getAttributes() != null ? sequenceRecord.getAttributes().size() : 0; final String[] fields = new String[3 + numAttributes]; fields[0] = HEADER_LINE_START + HeaderRecordType.SQ; fields[1] = SAMSequenceRecord.SEQUENCE_NAME_TAG + TAG_KEY_VALUE_SEPARATOR + sequenceRecord.getSequenceName(); fields[2] = SAMSequenceRecord.SEQUENCE_LENGTH_TAG + TAG_KEY_VALUE_SEPARATOR + Integer.toString(sequenceRecord.getSequenceLength()); encodeTags(sequenceRecord, fields, 3); println(StringUtil.join(FIELD_SEPARATOR, fields)); }

Target:
private void writeSQLine(final SAMSequenceRecord sequenceRecord) { final int numAttributes = sequenceRecord.getAttributes() != null ? sequenceRecord.getAttributes().size() : 0; final String[] fields = new String[3 + numAttributes]; fields[0] = HEADER_LINE_START + HeaderRecordType.SQ; fields[1] = SAMSequenceRecord.SEQUENCE_NAME_TAG + TAG_KEY_VALUE_SEPARATOR + sequenceRecord.getSequenceName(); fields[2] = SAMSequenceRecord.SEQUENCE_LENGTH_TAG + TAG_KEY_VALUE_SEPARATOR + Integer.toString(sequenceRecord.getSequenceLength()); encodeTags(sequenceRecord, fields, 3); println(StringUtil.join(FIELD_SEPARATOR, fields)); }
Source:
public void filtersOldItems() { final Domain dmn = Mockito.mock(Domain.class); Mockito.when(dmn.select(Mockito.any(SelectRequest.class))) .thenReturn( Arrays.asList( create("item1", "2000"), create("item2", "3000"), create("item3", "1000"), create("item4", "2500") ) ); final Region region = Mockito.mock(Region.class); Mockito.when(region.domain(Mockito.any(String.class))).thenReturn(dmn); final Set<String> set = new HashSet<String>(); for (Item item : new SanitizedDomains(region, 2300).domain("") .select(new SelectRequest())) { set.add(item.name()); } MatcherAssert.assertThat( set, Matchers.<Set<String>>allOf( Matchers.hasSize(2), Matchers.hasItems("item1", "item3") ) ); }

Target:
public void filtersOldItems() { final Domain dmn = Mockito.mock(Domain.class); final Set<String> cleared = new HashSet<String>(); final List<Item> list = new ArrayList<Item>( Arrays.asList( this.create("item1", 2000, cleared), this.create("item2", 3000, cleared), this.create("item3", 1000, cleared), this.create("item4", 2500, cleared) ) ); Mockito.when(dmn.select(Mockito.any(SelectRequest.class))) .thenReturn(list); final Region region = Mockito.mock(Region.class); Mockito.when(region.domain(Mockito.any(String.class))).thenReturn(dmn); final Set<String> set = new HashSet<String>(); for (Item item : new SanitizedDomains(region, 2300).domain("") .select(new SelectRequest())) { set.add(item.name()); } MatcherAssert.assertThat( set, Matchers.<Set<String>>allOf( Matchers.hasSize(2), Matchers.hasItems("item1", "item3") ) ); MatcherAssert.assertThat( cleared, Matchers.<Set<String>>allOf( Matchers.hasSize(2), Matchers.hasItems("item2", "item4") ) ); }
Source:
public ActionResult execute() { String studentId; String studentEmail = getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); String studentName = ""; if (studentEmail == null || courseId == null) { if (userInfo == null) { return new JsonResult("No student found", HttpStatus.SC_NOT_FOUND); } studentId = userInfo.id; } else { StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); if (student == null) { return new JsonResult("No student found", HttpStatus.SC_NOT_FOUND); } studentId = student.getGoogleId(); studentName = student.getName(); } StudentProfileAttributes studentProfile; if (StringHelper.isEmpty(studentId)) { studentProfile = StudentProfileAttributes.builder("placeholderId").build(); } else { studentProfile = logic.getStudentProfile(studentId); studentName = logic.getAccount(studentId).name; } if (studentProfile == null) { studentProfile = StudentProfileAttributes.builder(studentId).build(); } StudentProfileData output = new StudentProfileData(studentName, studentProfile); if (userInfo == null || userInfo.isStudent && !userInfo.isInstructor && !studentId.equals(userInfo.id)) { output.hideInformationWhenViewedByOtherStudent(); } return new JsonResult(output); }

Target:
public ActionResult execute() { String studentId; String studentEmail = getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); String studentName = ""; if (studentEmail == null || courseId == null) { if (userInfo == null) { return new JsonResult("No student found", HttpStatus.SC_NOT_FOUND); } studentId = userInfo.id; } else { StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); if (student == null) { return new JsonResult("No student found", HttpStatus.SC_NOT_FOUND); } studentId = student.getGoogleId(); studentName = student.getName(); } StudentProfileAttributes studentProfile; if (StringHelper.isEmpty(studentId)) { studentProfile = StudentProfileAttributes.builder("").build(); } else { studentProfile = logic.getStudentProfile(studentId); studentName = logic.getAccount(studentId).name; } if (studentProfile == null) { studentProfile = StudentProfileAttributes.builder(studentId).build(); } StudentProfileData output = new StudentProfileData(studentName, studentProfile); if (userInfo == null || userInfo.isStudent && !userInfo.isInstructor && !studentId.equals(userInfo.id)) { output.hideInformationWhenViewedByOtherStudent(); } return new JsonResult(output); }
Source:
private JPanel getPanel() { if (rootPanel == null) { about = new SonarLintAboutPanel(); rules = new RuleConfigurationPanel(); exclusions = new GlobalExclusionsPanel(); globalPanel = new SonarLintGlobalOptionsPanel(); serversPanel = new SonarQubeServerMgmtPanel(); JPanel settingsPanel = new JPanel(new BorderLayout()); settingsPanel.add(globalPanel.getComponent(), BorderLayout.NORTH); settingsPanel.add(serversPanel.getComponent(), BorderLayout.CENTER); rootPanel = new JPanel(new BorderLayout()); tabs = new JBTabbedPane(); tabs.insertTab("Settings", null, settingsPanel, "Configure SonarLint for all projects", 0); tabs.insertTab("File Exclusions", null, exclusions.getComponent(), "Configure which files should be excluded from analysis", 1); tabs.insertTab("Rules", null, rules.getComponent(), "Choose which rules are enabled when not connected to SonarQube", RULES_TAB_INDEX); tabs.insertTab("About", null, about.getComponent(), "About SonarLint", 3); rootPanel.add(tabs, BorderLayout.CENTER); } return rootPanel; }

Target:
private JPanel getPanel() { if (rootPanel == null) { about = new SonarLintAboutPanel(); rules = new RuleConfigurationPanel(); exclusions = new GlobalExclusionsPanel(); globalPanel = new SonarLintGlobalOptionsPanel(); serversPanel = new SonarQubeServerMgmtPanel(); JPanel settingsPanel = new JPanel(new BorderLayout()); settingsPanel.add(globalPanel.getComponent(), BorderLayout.NORTH); settingsPanel.add(serversPanel.getComponent(), BorderLayout.CENTER); rootPanel = new JPanel(new BorderLayout()); tabs = new JBTabbedPane(); tabs.insertTab("Settings", null, settingsPanel, "Configure SonarLint for all projects", SETTINGS_TAB_INDEX); tabs.insertTab("File Exclusions", null, exclusions.getComponent(), "Configure which files should be excluded from analysis", FILE_EXCLUSIONS_TAB_INDEX); tabs.insertTab("Rules", null, rules.getComponent(), "Choose which rules are enabled when not connected to SonarQube", RULES_TAB_INDEX); tabs.insertTab("About", null, about.getComponent(), "About SonarLint", ABOUT_TAB_INDEX); rootPanel.add(tabs, BorderLayout.CENTER); } return rootPanel; }
Source:
public synchronized void release(long amount) { if (used - amount < 0) { used = 0; return; } used -= amount; }

Target:
public ResourceQuota release(long amount) { return new ResourceQuota(name, Math.max(0, used - amount), limit); }
Source:
public void write(SerializedPage page) throws IOException { retainedBytes += page.getRetainedSizeInBytes(); PageDataOutput pageDataOutput = new PageDataOutput(page); long writtenSize = pageDataOutput.size(); if (maxBufferedBytes - bufferedBytes < writtenSize) { dataSink.write(bufferedPages); bufferedPages.clear(); bufferedBytes = 0; retainedBytes = 0; } else { bufferedPages.add(new PageDataOutput(page)); bufferedBytes += writtenSize; } }

Target:
public void write(SerializedPage page) throws IOException { PageDataOutput pageDataOutput = new PageDataOutput(page); long writtenSize = pageDataOutput.size(); if (maxBufferedBytes - bufferedBytes < writtenSize) { dataSink.write(bufferedPages); bufferedPages.clear(); bufferedBytes = 0; retainedBytes = 0; } bufferedPages.add(pageDataOutput); bufferedBytes += writtenSize; retainedBytes += page.getRetainedSizeInBytes(); }
Source:
protected void addMacsFromDbToPool() { List<VmNic> interfaces = getVmNicInterfacesFromDb(); for (VmNic iface : interfaces) { if (iface.getMacAddress() != null) { forceAddMacWithoutLocking(iface.getMacAddress()); } } }

Target:
private void addMacsFromDbToPool() { List<VmNic> interfaces = getVmNicInterfacesFromDb(); for (VmNic iface : interfaces) { if (iface.getMacAddress() != null) { forceAddMacWithoutLocking(iface.getMacAddress()); } } }
Source:
public void doFilter( ServletRequest req, ServletResponse resp, FilterChain chain ) throws ServletException, IOException { HttpServletRequest request = (HttpServletRequest) req; String requestId = Optional.ofNullable( request.getHeader( X_REQUEST_ID ) ).orElse( UUID.randomUUID().toString() ); try { logger.info( "received request with request id of: " + requestId ); MDC.put( REQUEST_ID, "rid-" + requestId ); chain.doFilter( req, resp ); } finally { logger.info( "Exiting request with request id of: " + requestId ); ( (HttpServletResponse) resp ).setHeader( X_REQUEST_ID, requestId ); MDC.clear(); } }

Target:
public void doFilter( ServletRequest req, ServletResponse resp, FilterChain chain ) throws ServletException, IOException { HttpServletRequest request = (HttpServletRequest) req; String requestId = Optional.ofNullable( request.getHeader( X_REQUEST_ID ) ).orElse( UUID.randomUUID().toString() ); try { if ( logger.isDebugEnabled() ) { logger.debug( "received request with request id of: " + requestId ); } MDC.put( REQUEST_ID, String.format( REQUEST_ID_FORMAT, requestId ) ); chain.doFilter( req, resp ); } finally { if ( logger.isDebugEnabled() ) { logger.debug( "Exiting request with request id of: " + requestId ); } ( (HttpServletResponse) resp ).setHeader( X_REQUEST_ID, requestId ); MDC.remove( X_REQUEST_ID ); } }
Source:
public synchronized void listen(BibDatabaseContextChangedEvent event) { if (event instanceof FieldChangedEvent) { FieldChangedEvent fieldChange = (FieldChangedEvent) event; totalDelta += fieldChange.getDelta(); boolean isNewEdit = lastFieldChanged.isEmpty(); boolean isEditChanged = !isNewEdit && !lastFieldChanged.get().equals(fieldChange.getField()); boolean isMajorChange = totalDelta >= 30; fieldChange.setFilteredOut(!(isEditChanged || isMajorChange)); eventPost(fieldChange); lastFieldChanged = Optional.of(fieldChange.getField()); } else { eventPost(event); } }

Target:
public synchronized void listen(BibDatabaseContextChangedEvent event) { if (event instanceof FieldChangedEvent) { FieldChangedEvent fieldChange = (FieldChangedEvent) event; boolean isNewEdit = lastFieldChanged.isEmpty() || lastEntryChanged.isEmpty(); boolean isChangedField = lastFieldChanged.filter(f -> !f.equals(fieldChange.getField())).isPresent(); boolean isChangedEntry = lastEntryChanged.filter(e -> !e.equals(fieldChange.getBibEntry())).isPresent(); boolean isEditChanged = !isNewEdit && (isChangedField || isChangedEntry); boolean isMajorChange = fieldChange.getDelta() > 1; fieldChange.setFilteredOut(!(isEditChanged || isMajorChange)); eventBus.post(fieldChange); lastFieldChanged = Optional.of(fieldChange.getField()); lastEntryChanged = Optional.of(fieldChange.getBibEntry()); } else { eventBus.post(event); } }
Source:
public void setRetentionDiscovery(Integer retentionDiscovery) { if (retentionDiscovery!=null && (retentionDiscovery < DEFAULT_RETENTION_DISCOVERY || retentionDiscovery > MAX_RETENTION_DISCOVERY)) { this.retentionDiscovery = DEFAULT_RETENTION_DISCOVERY; } else { this.retentionDiscovery = retentionDiscovery; } }

Target:
public void setRetentionDiscovery(Integer retentionDiscovery) { if (retentionDiscovery != null) { if (retentionDiscovery > MAX_RETENTION_DISCOVERY_DAYS) { this.retentionDiscovery = MAX_RETENTION_DISCOVERY_DAYS; } else if (retentionDiscovery > 0) { this.retentionDiscovery = retentionDiscovery; } } else { this.retentionDiscovery = retentionDiscovery; } }
Source:
public CategoryPill findCategoryOn(int position) { CategoryPill result = null; final List<WebElement> categoryPills = findCategoryPills(); if (position < categoryPills.size()) { result = new CategoryPill(categoryPills.get(position)); } return result; }

Target:
public CategoryPill findCategoryOn(int position) { final List<WebElement> categoryPills = findCategoryPills(); if (position < categoryPills.size()) { return new CategoryPill(categoryPills.get(position)); } else { return null; } }
Source:
public WebElement getVisibilityOptionTableRow(int questionNumber, int optionRowNumber) { return getVisibilityOptions(questionNumber).findElement(By.xpath("table/tbody/tr[" + optionRowNumber + "]")); }

Target:
public WebElement getVisibilityOptionTableRow(int questionNumber, int optionRowNumber) { return getVisibilityOptions(questionNumber).findElement(By.xpath("(table/tbody/tr|table/tbody/hide)[" + optionRowNumber + "]")); }
Source:
public void adsVuapCheckSlotSizesOasis(Page page, String slotName, String iframeId) throws InterruptedException { String slotSelector = AdsContent.getSlotSelector(slotName); AdsBaseObject ads = new AdsBaseObject(driver, urlBuilder.getUrlForPage(page), DESKTOP_SIZE); scrollToSlot(slotName, ads); VideoFanTakeover videoFanTakeover = new VideoFanTakeover(driver, iframeId); videoFanTakeover.waitForAdToLoad(); double imageHeight = videoFanTakeover.getAdSlotHeight(slotSelector); videoFanTakeover.play(); videoFanTakeover.waitForVideoStart(slotName); double videoHeight = videoFanTakeover.getAdVideoHeight(slotName); Assertion.assertTrue(videoFanTakeover.isVideoAdBiggerThanImageAdOasis(videoHeight, imageHeight )); videoFanTakeover.waitForVideoPlayerHidden(slotName); Assertion.assertTrue(videoFanTakeover.isImageAdInCorrectSize(imageHeight, slotSelector)); }

Target:
public void adsVuapCheckSlotSizesOasis(Page page, String slotName, String iframeId) throws InterruptedException { String slotSelector = AdsContent.getSlotSelector(slotName); AdsBaseObject ads = new AdsBaseObject(driver, urlBuilder.getUrlForPage(page), DESKTOP_SIZE); scrollToSlot(slotName, ads); VideoFanTakeover videoFanTakeover = new VideoFanTakeover(driver, iframeId, slotName); videoFanTakeover.waitForAdToLoad(); double imageHeight = videoFanTakeover.getAdSlotHeight(slotSelector); videoFanTakeover.play(); double videoHeight = videoFanTakeover.getAdVideoHeight(); Assertion.assertTrue(videoFanTakeover.isVideoAdBiggerThanImageAdOasis(videoHeight, imageHeight )); videoFanTakeover.waitForVideoPlayerHidden(); Assertion.assertTrue(videoFanTakeover.isImageAdInCorrectSize(imageHeight, slotSelector)); }
Source:
public void field_access_on_this() { Expression.Variable x = UCFGBuilder.variableWithId("x"); Expression.Variable aux0 = UCFGBuilder.variableWithId("%0"); Expression.Variable aux1 = UCFGBuilder.variableWithId("%1"); Expression.Variable aux2 = UCFGBuilder.variableWithId("%2"); Expression.Variable aux3 = UCFGBuilder.variableWithId("%3"); Expression.Variable aux4 = UCFGBuilder.variableWithId("%4"); UCFG expectedUCFG = UCFGBuilder.createUCFGForMethod("A#method()Ljava/lang/String;") .addBasicBlock(newBasicBlock("1") .assignTo(aux0, call("__id").withArgs(new Expression.FieldAccess(variableWithId("field"))), new LocationInFile(FILE_KEY, 5,15,5,25)) .assignTo(x, call("__id").withArgs(aux0), new LocationInFile(FILE_KEY, 5,4,5,26)) .assignTo(aux1, call("__id").withArgs(new Expression.FieldAccess(variableWithId("field"))), new LocationInFile(FILE_KEY, 6,11,6,16)) .assignTo(aux2, call("__id").withArgs(new Expression.FieldAccess(new Expression.ClassName("A"), variableWithId("FIELD"))), new LocationInFile(FILE_KEY, 6,19,6,24)) .assignTo(aux3, call("__concat").withArgs(aux1, aux2), new LocationInFile(FILE_KEY, 6,11,6,24)) .assignTo(aux4, call("__concat").withArgs(aux3, x), new LocationInFile(FILE_KEY, 6,11,6,28)) .ret(aux4, new LocationInFile(FILE_KEY, 6,4,6,29))) .build(); assertCodeToUCfg("class A {\n" + " String field;\n" + " static String FIELD;\n" + " String method() {\n" + " String x = this.field;\n" + " return field + FIELD + x;\n" + " }\n" + "}\n", expectedUCFG); }

Target:
public void field_access_on_this() { Expression.Variable x = variableWithId("x"); Expression.Variable aux0 = variableWithId("%0"); Expression.Variable aux1 = variableWithId("%1"); Expression.Variable aux2 = variableWithId("%2"); Expression.Variable aux3 = variableWithId("%3"); Expression.Variable aux4 = variableWithId("%4"); UCFG expectedUCFG = UCFGBuilder.createUCFGForMethod("A#method()Ljava/lang/String;") .addBasicBlock(newBasicBlock("1") .assignTo(aux0, call("__id").withArgs(new Expression.FieldAccess(variableWithId("field"))), new LocationInFile(FILE_KEY, 5,15,5,25)) .assignTo(x, call("__id").withArgs(aux0), new LocationInFile(FILE_KEY, 5,4,5,26)) .assignTo(aux1, call("__id").withArgs(new Expression.FieldAccess(variableWithId("field"))), new LocationInFile(FILE_KEY, 6,11,6,16)) .assignTo(aux2, call("__id").withArgs(new Expression.FieldAccess(new Expression.ClassName("A"), variableWithId("FIELD"))), new LocationInFile(FILE_KEY, 6,19,6,24)) .assignTo(aux3, call("__concat").withArgs(aux1, aux2), new LocationInFile(FILE_KEY, 6,11,6,24)) .assignTo(aux4, call("__concat").withArgs(aux3, x), new LocationInFile(FILE_KEY, 6,11,6,28)) .ret(aux4, new LocationInFile(FILE_KEY, 6,4,6,29))) .build(); assertCodeToUCfg("class A {\n" + " String field;\n" + " static String FIELD;\n" + " String method() {\n" + " String x = this.field;\n" + " return field + FIELD + x;\n" + " }\n" + "}\n", expectedUCFG); }
Source:
protected IStructuredSelection getSelection(ExecutionEvent event) throws ExecutionException { ISelection selection; if (event != null) selection = HandlerUtil.getCurrentSelectionChecked(event); else { IHandlerService hsr = (IHandlerService) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(IHandlerService.class); IEvaluationContext ctx = hsr.createContextSnapshot(true); selection = (ISelection) ctx.getVariable(ISources.ACTIVE_MENU_SELECTION_NAME); if (selection == null) throw new ExecutionException( UIText.RepositoryActionHandler_CouldNotGetSelection_message); } if (selection instanceof IStructuredSelection) return (IStructuredSelection) selection; return new StructuredSelection(); }

Target:
protected IStructuredSelection getSelection(ExecutionEvent event) throws ExecutionException { ISelection selection; if (event != null) selection = HandlerUtil.getCurrentSelectionChecked(event); else { IHandlerService hsr = (IHandlerService) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(IHandlerService.class); IEvaluationContext ctx = hsr.getCurrentState(); selection = (ISelection) ctx.getVariable(ISources.ACTIVE_MENU_SELECTION_NAME); if (selection == null) throw new ExecutionException( UIText.RepositoryActionHandler_CouldNotGetSelection_message); } if (selection instanceof IStructuredSelection) return (IStructuredSelection) selection; return new StructuredSelection(); }
Source:
protected void enterRootModule() { Intent i; if (useGridMenu("root")) { i = new Intent(getApplicationContext(), MenuGrid.class); } else { i = new Intent(getApplicationContext(), MenuList.class); } startActivityForResult(i, GET_COMMAND); }

Target:
protected void enterRootModule() { Intent i; if (useGridMenu(org.commcare.suite.model.Menu.ROOT_MENU_ID)) { i = new Intent(getApplicationContext(), MenuGrid.class); } else { i = new Intent(getApplicationContext(), MenuList.class); } startActivityForResult(i, GET_COMMAND); }
Source:
public BufferedImage run() throws Exception { final String request = new GetMapBuilder().endPoint(layer.getUrl()) .version(layer.getVersion()) .layer(layer.getName()) .bbox(bbox) .crs(srsName) .width(width) .height(height) .format(FORMAT) .transparent(true) .toKVP(); LOG.info(request); URL url = new URL(request); for (int i = 0; i < RETRY_COUNT - 1; i++) { try { return ImageIO.read(url); } catch (IOException e) { LOG.warn(e); } } return ImageIO.read(url); }

Target:
public BufferedImage run() throws Exception { final String request = new GetMapBuilder().endPoint(layer.getUrl()) .version(layer.getVersion()) .layer(layer.getName()) .bbox(bbox) .crs(srsName) .width(width) .height(height) .format(FORMAT) .transparent(true) .toKVP(); return CommandLoadImageFromURL.load(request); }
Source:
private String getBondOptionForPair(Entry<String, EntityModel> pair) { String res = pair.getKey(); if (res.equals("custom")) { res = (String) pair.getValue().getEntity(); } return res; }

Target:
private String getBondOptionForPair(Entry<String, EntityModel> pair) { String res = pair.getKey(); if ("custom".equals(res)) { return (String) pair.getValue().getEntity(); } return res; }
Source:
public TestResult run(@Context UriInfo uriInfo) throws Exception { Map<String, String> queryParameters = getMap(uriInfo.getQueryParameters()); String projectPath = queryParameters.get("projectPath"); String absoluteProjectPath = ResourcesPlugin.getPathToWorkspace() + projectPath; queryParameters.put("absoluteProjectPath", absoluteProjectPath); System.out.println(projectManager); System.out.println(absoluteProjectPath); System.out.println(projectPath); String projectType = ""; if (projectManager != null) { projectType = projectManager.getProject(projectPath).getType(); System.out.println(projectType); } String testFramework = queryParameters.get("testFramework"); System.out.println(queryParameters.toString()); TestRunner runner = frameworkRegistry.getTestRunner(testFramework); if (runner == null) { throw new Exception("No test frameworks found: " + testFramework); } System.out.println(runner); TestResult result = frameworkRegistry.getTestRunner(testFramework).execute(queryParameters, classpathRegistry.getTestClasspathProvider(projectType)); System.out.println(result); return result; }

Target:
public TestResult run(@Context UriInfo uriInfo) throws Exception { Map<String, String> queryParameters = getMap(uriInfo.getQueryParameters()); String projectPath = queryParameters.get("projectPath"); String absoluteProjectPath = ResourcesPlugin.getPathToWorkspace() + projectPath; queryParameters.put("absoluteProjectPath", absoluteProjectPath); String projectType = ""; if (projectManager != null) { projectType = projectManager.getProject(projectPath).getType(); } String testFramework = queryParameters.get("testFramework"); TestRunner runner = frameworkRegistry.getTestRunner(testFramework); if (runner == null) { throw new Exception("No test frameworks found: " + testFramework); } TestResult result = frameworkRegistry.getTestRunner(testFramework).execute(queryParameters, classpathRegistry.getTestClasspathProvider(projectType)); return result; }
Source:
private String getVariableLabel(VariableMetadata variableMetadata) { if (variableMetadata.getName().startsWith(CASE_VARIABLE_PREFIX)) { return translationService.getValue(CASE_VARIABLE_LABEL_PREFIX) + " " + variableMetadata.getName().substring(CASE_VARIABLE_PREFIX.length(), variableMetadata.getName().length()); } else { return variableMetadata.getName(); } }

Target:
private String getVariableLabel(VariableMetadata variableMetadata) { if (variableMetadata.getName().startsWith(CASE_VARIABLE_PREFIX)) { return translationService.getValue(CASE_VARIABLE_LABEL_PREFIX) + " " + variableMetadata.getName().substring(CASE_VARIABLE_PREFIX.length()); } else { return variableMetadata.getName(); } }
Source:
protected void executeCommand() { if (isOperationAllowed()) { List<Cluster> clusters = getClustersWithOvsSwitchType(getNetwork().getId()); checkValidDefaultProvider(clusters); List<Cluster> clustersWithOVS = getClustersWithValidDefaultProvider(clusters); createListOfClustersByProvider(clustersWithOVS); List<Guid> providerIds = new ArrayList<>(listOfClustersByProvider.keySet()); IntStream.range(0, providerIds.size()) .forEach(i -> runAutodefineForOneProvider(providerIds.get(i), i)); } setSucceeded(true); }

Target:
protected void executeCommand() { List<Cluster> clusters = getClustersWithOvsSwitchType(getNetwork().getId()); checkValidDefaultProvider(clusters); List<Cluster> clustersWithOVS = getClustersWithValidDefaultProvider(clusters); createListOfClustersByProvider(clustersWithOVS); List<Guid> providerIds = new ArrayList<>(listOfClustersByProvider.keySet()); IntStream.range(0, providerIds.size()) .forEach(i -> runAutodefineForOneProvider(providerIds.get(i), i)); setSucceeded(true); }
Source:
protected void runCommand(Runnable runnable) { while (true) { try { runnable.run(); break; } catch (CacheException e) { Throwable innerThrowable = e; do { if (innerThrowable instanceof SuspectException) { log.trace("Ignoring suspect exception and retrying operation for ClusterRegistry."); continue; } } while ((innerThrowable = innerThrowable.getCause()) != null); throw e; } } }

Target:
protected void runCommand(Runnable runnable) { while (true) { try { runnable.run(); break; } catch (CacheException e) { if (SuspectException.isSuspectExceptionInChain(e)) { log.trace("Ignoring suspect exception and retrying operation for ClusterRegistry."); } else { throw e; } } } }
Source:
protected Map<String, GroupInfo> createGroupInfos() { if(!CONNECT_TIME_SAVED) { return Collections.emptyMap(); } HashMap<String, GroupInfo> groupInfos = new HashMap<>(); groupInfos.put("aggregate_rpt_pct2", createPercentileGroupInfo("aggregate_rpt_pct2", 95, String.format( PERCENTILE_FORMAT, Integer.valueOf(95)))); return groupInfos; }

Target:
protected Map<String, GroupInfo> createGroupInfos() { if(!CONNECT_TIME_SAVED) { return Collections.emptyMap(); } ConnectTimeValueSelector valueSelector = new ConnectTimeValueSelector(false); NameSeriesSelector seriesSelector = new NameSeriesSelector(); HashMap<String, GroupInfo> groupInfos = new HashMap<>(); groupInfos.put(PERCENTILE_PROPERTY, createPercentileGroupInfo(PERCENTILE_PROPERTY, 95, String.format( PERCENTILE_FORMAT, Integer.valueOf(95)),valueSelector,seriesSelector)); return groupInfos; }
Source:
public Map<String, String> getMetadata() { return Collections.unmodifiableMap(metadata); }

Target:
public Map<String, String> getMetadata() { return metadata; }
Source:
public String set(String key, String value) { String command = "set"; registry.distributionSummary(TelemetryHelper.payloadSizeId(idPrefix, command)).record(payloadSize(value)); try { return registry.timer(timerId(idPrefix, command)).record(() -> delegated.set(key, value) ); } catch (Exception e) { registry.counter(allErrorId(idPrefix)).increment(); registry.counter(errorId(idPrefix, command)).increment(); throw new InstrumentedJedisException("could not execute delegate function", e); } }

Target:
public String set(String key, String value) { String command = "set"; registry.distributionSummary(TelemetryHelper.payloadSizeId(registry, poolName, command)).record(payloadSize(value)); try { return registry.timer(timerId(registry, poolName, command)).record(() -> delegated.set(key, value) ); } catch (Exception e) { registry.counter(allErrorId(registry, poolName)).increment(); registry.counter(errorId(registry, poolName, command)).increment(); throw new InstrumentedJedisException("could not execute delegate function", e); } }
Source:
public void emitTuples() { if (currentWindowId <= idempotentStorageManager.getLargestRecoveryWindow()) { return; } int count = consumer.messageSize(); if (maxTuplesPerWindow > 0) { count = Math.min(count, maxTuplesPerWindow - emitCount); } if (count > 0) { if ((emitCount > 0) && ((maxMsgSizePerWindow - emitMsgSize) < consumer.peekMessage().msg.size())) { return; } } int numEmitted = 0; for (int i = 0; i < count; i++) { KafkaConsumer.KafkaMessage message = consumer.pollMessage(); if(offsetStats.containsKey(message.kafkaPart) && message.offSet <= offsetStats.get(message.kafkaPart)) continue; emitTuple(message.msg); ++numEmitted; emitMsgSize += message.msg.size(); offsetStats.put(message.kafkaPart, message.offSet); MutablePair<Long, Integer> offsetAndCount = currentWindowRecoveryState.get(message.kafkaPart); if(offsetAndCount == null) { currentWindowRecoveryState.put(message.kafkaPart, new MutablePair<Long, Integer>(message.offSet, 1)); } else { offsetAndCount.setRight(offsetAndCount.right+1); } message = consumer.peekMessage(); if (message != null) { if ((maxMsgSizePerWindow - emitMsgSize) < message.msg.size()) { break; } } } emitCount += numEmitted; }

Target:
public void emitTuples() { if (currentWindowId <= idempotentStorageManager.getLargestRecoveryWindow()) { return; } int count = consumer.messageSize() + ((pendingMessage != null) ? 1 : 0); if (maxTuplesPerWindow > 0) { count = Math.min(count, maxTuplesPerWindow - emitCount); } KafkaConsumer.KafkaMessage message = null; for (int i = 0; i < count; i++) { if (pendingMessage != null) { message = pendingMessage; pendingMessage = null; } else { message = consumer.pollMessage(); } if ((emitCount > 0) && ((maxTotalMsgSizePerWindow - emitTotalMsgSize) < message.msg.size())) { pendingMessage = message; break; } emitTuple(message.msg); emitCount++; emitTotalMsgSize += message.msg.size(); offsetStats.put(message.kafkaPart, message.offSet); MutablePair<Long, Integer> offsetAndCount = currentWindowRecoveryState.get(message.kafkaPart); if(offsetAndCount == null) { currentWindowRecoveryState.put(message.kafkaPart, new MutablePair<Long, Integer>(message.offSet, 1)); } else { offsetAndCount.setRight(offsetAndCount.right+1); } } }
Source:
public void onValueSelected(final String modelName) { if (NONE.equals(modelName)) { scenario.setModelName(null); } else { scenario.setModelName(modelName); } }

Target:
public void onValueSelected(final String modelName) { if (Objects.equals(NONE, modelName)) { scenario.setModelName(null); } else { scenario.setModelName(modelName); } }
Source:
public static DelayedAction create(ActionDelay delay, Action action) { if (action.getType().isStop()) { throw new IllegalArgumentException("Action type cannot be stop"); } return new DelayedAction(delay.getDelay(TimeUnit.NANOSECONDS), action, r -> { Action nextAction = action.getCallback().apply(r); if (action.getType().isStop()) { return createStop(nextAction); } return create(delay.getCallback().apply(r), nextAction); }); }

Target:
public static DelayedAction create(ActionDelay delay, Action action) { if (action.getType().isStop()) { throw new IllegalArgumentException("Action type cannot be stop"); } return new DelayedAction(delay.getDelay(TimeUnit.NANOSECONDS), action, r -> { Action nextAction = action.getCallback().apply(r); if (nextAction.getType().isStop()) { return createStop(nextAction); } return create(delay.getCallback().apply(r), nextAction); }); }
Source:
public CompletedCheckpointStore createCheckpointStore( JobID jobID, int maxNumberOfCheckpointsToRetain, ClassLoader userClassLoader) throws Exception { final String configMapName = getConfigMapNameFunction.apply(jobID); return createCompletedCheckpointStore( configuration, kubeClient, executor, configMapName, lockIdentity, maxNumberOfCheckpointsToRetain); }

Target:
public CompletedCheckpointStore createCheckpointStore( JobID jobID, int maxNumberOfCheckpointsToRetain, ClassLoader userClassLoader) throws Exception { final String configMapName = getConfigMapNameFunction.apply(jobID); return KubernetesUtils.createCompletedCheckpointStore( configuration, kubeClient, executor, configMapName, lockIdentity, maxNumberOfCheckpointsToRetain); }
Source:
public void prepare(String name) { String testDir = TestingUtil.tmpDirectory(name); Util.recursiveFileRemove(testDir); rootDir = new File(testDir); confDir = new File(rootDir, Server.DEFAULT_SERVER_CONFIG); if (!confDir.mkdirs()) { throw new RuntimeException("Failed to create server configuration directory " + confDir); } URL configurationFileURL = getClass().getClassLoader().getResource(configuration.configurationFile()); if(new File(configuration.configurationFile()).isAbsolute()) { configurationFileURL = Exceptions.unchecked(() -> new File(configuration.configurationFile()).toURI().toURL()); } if (configurationFileURL == null) { throw new RuntimeException("Cannot find test configuration file: " + configuration.configurationFile()); } Path configurationFilePath; try { configurationFilePath = Paths.get(configurationFileURL.toURI()); Util.recursiveDirectoryCopy(configurationFilePath.getParent(), confDir.toPath()); } catch (Exception e) { throw new RuntimeException(e); } createUserFile("default", true); createKeyStores(); }

Target:
public void prepare(String name) { String testDir = TestingUtil.tmpDirectory(name); Util.recursiveFileRemove(testDir); rootDir = new File(testDir); confDir = new File(rootDir, Server.DEFAULT_SERVER_CONFIG); if (!confDir.mkdirs()) { throw new RuntimeException("Failed to create server configuration directory " + confDir); } URL configurationFileURL; if (new File(configuration.configurationFile()).isAbsolute()) { configurationFileURL = Exceptions.unchecked(() -> new File(configuration.configurationFile()).toURI().toURL()); } else { configurationFileURL = getClass().getClassLoader().getResource(configuration.configurationFile()); } if (configurationFileURL == null) { throw new RuntimeException("Cannot find test configuration file: " + configuration.configurationFile()); } Path configurationFilePath; try { configurationFilePath = Paths.get(configurationFileURL.toURI()); Util.recursiveDirectoryCopy(configurationFilePath.getParent(), confDir.toPath()); } catch (Exception e) { throw new RuntimeException(e); } createUserFile("default", true); createKeyStores(); }
Source:
private void testDownload(String urlString, IProgressMonitor monitor) { try { IPath foundationCoreStateLocation = FoundationCorePlugin.getDefault().getStateLocation(); URL url = new URL(urlString); URLTransportUtility util = new URLTransportUtility(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); IStatus s = util.download("displayName", urlString, baos, monitor); assertTrue(s.isOK()); String stringFromDownload = baos.toString(); assertNotNull(stringFromDownload); assertNotNull(stringFromDownload); } catch(MalformedURLException murle) { fail("Bad url: " + urlString); } }

Target:
private void testDownload(String urlString, IProgressMonitor monitor) { URLTransportUtility util = new URLTransportUtility(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); IStatus s = util.download("displayName", urlString, baos, monitor); assertTrue(s.isOK()); String stringFromDownload = baos.toString(); assertNotNull(stringFromDownload); assertNotNull(stringFromDownload); }
Source:
public static Optional<License> parse(String base64) { try { String data = new String(Base64.decodeBase64(base64.trim().getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8); Properties props = new Properties(); props.load(new StringReader(data)); Collection<String> plugins = Arrays.asList(StringUtils.split(props.getProperty(PLUGINS_KEY), ',')); String editionKey = props.getProperty(EDITION_KEY); if (editionKey != null && !plugins.isEmpty()) { return Optional.of(new License(editionKey, plugins, base64)); } } catch (Exception e) { } return Optional.empty(); }

Target:
public static Optional<License> parse(String base64) { try { String data = new String(Base64.decodeBase64(base64.trim().getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8); Properties props = new Properties(); props.load(new StringReader(data)); Collection<String> plugins = Arrays.asList(StringUtils.split(props.getProperty(PLUGINS_KEY), ',')); String editionKey = props.getProperty(EDITION_KEY); if (editionKey != null && !plugins.isEmpty()) { return Optional.of(new License(editionKey, plugins, base64)); } else { LOG.debug("Failed to parse license: no edition key and/or no plugin found"); } } catch (Exception e) { LOG.debug("Failed to parse license", e); } return Optional.empty(); }
Source:
public LocalFileDirectTaskLogger(LogFilePrefix prefix, String taskName) throws IOException { String dateDir = LogFiles.formatDataDir(prefix); String attemptDir = LogFiles.formatSessionAttemptDir(prefix); Path dir = getPrefixDir(dateDir, attemptDir); Files.createDirectories(dir); String temporaryFileName = LogFiles.formatPlainTextFileName(taskName, Instant.now(), agentId.toString()); this.temporaryPath = dir.resolve(temporaryFileName); this.temporaryOutput = Files.newOutputStream(temporaryPath, CREATE, APPEND); String conclusiveFileName = LogFiles.formatFileName(taskName, Instant.now(), agentId.toString()); this.conclusivePath = dir.resolve(conclusiveFileName); }

Target:
public LocalFileDirectTaskLogger(LogFilePrefix prefix, String taskName) throws IOException { String dateDir = LogFiles.formatDataDir(prefix); String attemptDir = LogFiles.formatSessionAttemptDir(prefix); Path dir = getPrefixDir(dateDir, attemptDir); Files.createDirectories(dir); String fileName = LogFiles.formatFileName(taskName, Instant.now(), agentId.toString()); this.path = dir.resolve(fileName); String temporaryFileName = LogFiles.formatPlainTextFileName(taskName, Instant.now(), agentId.toString()); this.temporaryPath = dir.resolve(temporaryFileName); if (realtimeFollow) { this.output = Files.newOutputStream(temporaryPath, CREATE, APPEND); } else { this.output = new GZIPOutputStream(Files.newOutputStream(path, CREATE, APPEND), 16*1024); } }
Source:
public List<String> getJudgmentTypes() { return judgmentTypes; }

Target:
public Set<JudgmentType> getJudgmentTypes() { if (judgmentTypes == null) { return new HashSet<JudgmentType>(); } else { return judgmentTypes; } }
Source:
public void store(String tenantId, List<Span> spans, Function<Span, String> cacheKeyEntrySupplier) throws CacheException { if (cacheContainer != null) { spansCache.startBatch(); } for (Span span : spans) { log.debugf("Store span [%s]" + span); spansCache.put(cacheKeyEntrySupplier.apply(span), span, 1, TimeUnit.MINUTES); if (span.getTraceId() != null) { Set<Span> trace = traceCache.get(span.getTraceId()); if (trace == null) { trace = new HashSet<>(); traceCache.put(span.getTraceId(), trace); } trace.add(span); } } if (cacheContainer != null) { spansCache.endBatch(true); } }

Target:
public void store(String tenantId, List<Span> spans, Function<Span, String> cacheKeyEntrySupplier) throws CacheException { if (cacheContainer != null) { spansCache.startBatch(); } for (Span span : spans) { log.debugf("Store span [%s]" + span); spansCache.put(cacheKeyEntrySupplier.apply(span), span, 1, TimeUnit.MINUTES); if (span.getTraceId() != null) { Set<Span> trace = traceCache.get(span.getTraceId()); if (trace == null) { trace = new HashSet<>(); } trace.add(span); traceCache.put(span.getTraceId(), trace); } } if (cacheContainer != null) { spansCache.endBatch(true); } }
Source:
private boolean sendResponse(Object result) { if (RESPONSE_FLAG.compareAndSet(this, Boolean.FALSE, Boolean.TRUE)) { try { if (result instanceof Throwable) { result = new ErrorResponse((Throwable) result, op.getCallId(), op.isUrgent()); } op.sendResponse(result); } catch (HazelcastSerializationException e) { op.sendResponse(new ErrorResponse(e, op.getCallId(), op.isUrgent())); } return true; } return false; }

Target:
private boolean sendResponse(Object result) { if (RESPONSE_FLAG.compareAndSet(this, Boolean.FALSE, Boolean.TRUE)) { try { op.sendResponse(result); } catch (HazelcastSerializationException e) { op.sendResponse(e); } return true; } return false; }
Source:
public void testChangeHeaderAfterWritingHeader() { final File bcfOutputFile = VariantBaseTest.createTempFile("testWriteAndReadVCF.", ".bcf"); Tribble.indexFile(bcfOutputFile).deleteOnExit(); Set<VCFHeaderLine> metaData = new HashSet<VCFHeaderLine>(); Set<String> additionalColumns = new HashSet<String>(); final SAMSequenceDictionary sequenceDict = createArtificialSequenceDictionary(); final VCFHeader header = createFakeHeader(metaData, additionalColumns, sequenceDict); final VariantContextWriter writer2 = new VariantContextWriterBuilder() .setOutputFile(bcfOutputFile).setReferenceDictionary(sequenceDict) .setOptions(EnumSet.of(Options.INDEX_ON_THE_FLY)) .build(); writer2.writeHeader(header); writer2.setVCFHeader(header); writer2.add(createVC(header)); writer2.close(); }

Target:
public void testChangeHeaderAfterWritingHeader() throws IOException { final File bcfOutputFile = File.createTempFile("testWriteAndReadVCF.", ".bcf", tempDir); bcfOutputFile.deleteOnExit(); final VCFHeader header = createFakeHeader(); try (final VariantContextWriter writer = new VariantContextWriterBuilder() .setOutputFile(bcfOutputFile).setReferenceDictionary(header.getSequenceDictionary()) .unsetOption(Options.INDEX_ON_THE_FLY) .build()) { writer.writeHeader(header); writer.setVCFHeader(header); } }
Source:
public void testGetExternalResourcesWithConfigKeyNotSpecifiedOrEmpty() { final Configuration config = new Configuration(); final String resourceConfigKey = ""; config.set(ExternalResourceOptions.EXTERNAL_RESOURCE_LIST, RESOURCE_LIST); config.setLong(ExternalResourceOptions.keyWithResourceNameAndSuffix(RESOURCE_NAME_1, ExternalResourceOptions.EXTERNAL_RESOURCE_AMOUNT_SUFFIX), RESOURCE_AMOUNT_1); config.setLong(ExternalResourceOptions.keyWithResourceNameAndSuffix(RESOURCE_NAME_2, ExternalResourceOptions.EXTERNAL_RESOURCE_AMOUNT_SUFFIX), RESOURCE_AMOUNT_2); config.setString(ExternalResourceOptions.keyWithResourceNameAndSuffix(RESOURCE_NAME_1, SUFFIX), resourceConfigKey); final Map<String, Long> configMap = ExternalResourceUtils.getExternalResources(config, SUFFIX); assertThat(configMap.entrySet(), is(empty())); }

Target:
public void testGetExternalResourcesWithConfigKeyNotSpecifiedOrEmpty() { final Configuration config = new Configuration(); final String resourceConfigKey = ""; config.set(ExternalResourceOptions.EXTERNAL_RESOURCE_LIST, RESOURCE_LIST); config.setLong(ExternalResourceOptions.getAmountConfigOptionForResource(RESOURCE_NAME_1), RESOURCE_AMOUNT_1); config.setLong(ExternalResourceOptions.getAmountConfigOptionForResource(RESOURCE_NAME_2), RESOURCE_AMOUNT_2); config.setString(ExternalResourceOptions.getSystemConfigKeyConfigOptionForResource(RESOURCE_NAME_1, SUFFIX), resourceConfigKey); final Map<String, Long> configMap = ExternalResourceUtils.getExternalResources(config, SUFFIX); assertThat(configMap.entrySet(), is(empty())); }
Source:
public void shouldUpdateProcessesAssignedToTemplate() throws Exception { Template template = new ServiceManager().getTemplateService().getById(1); System.out.println(template.getDocket().getId() + " " + template.getRuleset().getId()); for (Process process : template.getProcesses()) { assertNotEquals("Template and Process have assigned the same docket!", template.getDocket(), process.getDocket()); assertNotEquals("Template and Process have assigned the same ruleset!", template.getRuleset(), process.getRuleset()); } Updater updater = new Updater(template); updater.updateProcessesAssignedToTemplate(); for (Process process : template.getProcesses()) { assertEquals("Template and Process have assigned different docket!", template.getDocket(), process.getDocket()); assertEquals("Template and Process have assigned different ruleset!", template.getRuleset(), process.getRuleset()); } }

Target:
public void shouldUpdateProcessesAssignedToTemplate() throws Exception { Template template = new ServiceManager().getTemplateService().getById(1); for (Process process : template.getProcesses()) { assertNotEquals("Template and Process have assigned the same docket!", template.getDocket(), process.getDocket()); assertNotEquals("Template and Process have assigned the same ruleset!", template.getRuleset(), process.getRuleset()); } Updater updater = new Updater(template); updater.updateProcessesAssignedToTemplate(); for (Process process : template.getProcesses()) { assertEquals("Template and Process have assigned different docket!", template.getDocket(), process.getDocket()); assertEquals("Template and Process have assigned different ruleset!", template.getRuleset(), process.getRuleset()); } }
Source:
public void execute(IProgressMonitor m) throws CoreException { SubMonitor progress = SubMonitor.convert(m, CoreText.DisconnectProviderOperation_disconnecting, projectList.size() * 2); for (IProject p : projectList) { if (GitTraceLocation.CORE.isActive()) GitTraceLocation.getTrace().trace( GitTraceLocation.CORE.getLocation(), "disconnect " + p.getName()); unmarkTeamPrivate(p); RepositoryProvider.unmap(p); progress.worked(1); p.refreshLocal(IResource.DEPTH_INFINITE, progress.newChild(1)); } }

Target:
public void execute(IProgressMonitor m) throws CoreException { SubMonitor progress = SubMonitor.convert(m, CoreText.DisconnectProviderOperation_disconnecting, projectList.size()); for (IProject p : projectList) { if (GitTraceLocation.CORE.isActive()) { GitTraceLocation.getTrace().trace( GitTraceLocation.CORE.getLocation(), "disconnect " + p.getName()); } unmarkTeamPrivate(p); RepositoryProvider.unmap(p); p.refreshLocal(IResource.DEPTH_INFINITE, progress.newChild(1)); } }