auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private String redirectToList() { try { String referrer = FacesContext.getCurrentInstance().getExternalContext().getRequestHeaderMap() .get("referer"); String callerViewId = referrer.substring(referrer.lastIndexOf("/") + 1); if (!callerViewId.isEmpty() && callerViewId.contains("rulesetEdit.jsf")) { return "/pages/projects.jsf?id=4&" + redirectParameter; } else { return "/pages/RegelsaetzeAlle?" + redirectParameter; } } catch (NullPointerException e) { return "/pages/RegelsaetzeAlle?" + redirectParameter; } }

Target:
private String redirectToList() { try { String referrer = FacesContext.getCurrentInstance().getExternalContext().getRequestHeaderMap() .get("referer"); String callerViewId = referrer.substring(referrer.lastIndexOf("/") + 1); if (!callerViewId.isEmpty() && callerViewId.contains("rulesetEdit.jsf")) { return "/pages/projects.jsf?id=" + projectForm.getActiveTabIndex() + "&" + REDIRECT_PARAMETER; } else { return "/pages/RegelsaetzeAlle?" + REDIRECT_PARAMETER; } } catch (NullPointerException e) { return "/pages/RegelsaetzeAlle?" + REDIRECT_PARAMETER; } }
Source:
private boolean isValidScope(String scope, String id) { if (CachingConstants.SCOPE_PER_HOST.equals(scope)) { return true; } else if (CachingConstants.SCOPE_PER_MEDIATOR.equals(scope)) { if (id != null) { return true; } else { throw new MediatorException("Id is required for a cache wirth scope : " + scope); } } else if (CachingConstants.SCOPE_DISTRIBUTED.equals(scope)) { return true; } else { throw new MediatorException("Unknown scope " + scope + " for the Cache mediator"); } }

Target:
private boolean isValidScope(String scope, String id) { if (CachingConstants.SCOPE_PER_HOST.equals(scope)) { return true; } else if (CachingConstants.SCOPE_PER_MEDIATOR.equals(scope)) { if (id != null) { return true; } else { throw new MediatorException("Id is required for a cache with scope : " + scope); } } else if (CachingConstants.SCOPE_DISTRIBUTED.equals(scope)) { return true; } else { throw new MediatorException("Unknown scope " + scope + " for the Cache mediator"); } }
Source:
public void deleteCollectionSubmittersGroupUnAuthorizedTest() throws Exception { context.turnOffAuthorisationSystem(); Group submittersGroup = collectionService.createSubmitters(context, collection); context.restoreAuthSystemState(); getClient().perform(delete("/api/core/collections/" + collection.getID() + "/submittersGroup")) .andExpect(status().isUnauthorized()); }

Target:
public void deleteCollectionSubmittersGroupUnAuthorizedTest() throws Exception { context.turnOffAuthorisationSystem(); Group submittersGroup = collectionService.createSubmitters(context, collection); context.restoreAuthSystemState(); getClient().perform(delete("/api/core/collections/" + collection.getID() + "/submittersGroup")) .andExpect(status().isUnauthorized()); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/submittersGroup")) .andExpect(status().isOk()) .andExpect( jsonPath("$", GroupMatcher.matchGroupEntry(submittersGroup.getID(), submittersGroup.getName()))); }
Source:
private byte readByte() throws IOException { if(!ensure(1)) { throw new MessageFormatException("insufficient data length for reading byte value"); } byte b = buffer.getByte(position); consume(1); return b; }

Target:
private byte readByte() throws IOException { if(!ensure(1)) { throw new EOFException("insufficient data length for reading byte value"); } byte b = buffer.getByte(position); consume(1); return b; }
Source:
public static void saveState(IMemento memento, WfeInput input) { int artUuid = input.getArtUuid(); BranchId branch = input.getBranchId(); String title = input.getTitle(); if (input.getArtifact() != null && !input.getArtifact().isDeleted()) { artUuid = input.getArtifact().getArtId(); branch = input.getArtifact().getBranch(); title = input.getName(); } if (artUuid > 0 && branch.isValid() && Strings.isValid(title)) { memento.putString(BRANCH_KEY, String.valueOf(branch.getId())); memento.putInteger(ART_KEY, artUuid); memento.putString(TITLE, title); } }

Target:
public static void saveState(IMemento memento, WfeInput input) { int artUuid = input.getArtUuid(); BranchId branch = input.getBranchId(); String title = input.getTitle(); if (input.getArtifact() != null && !input.getArtifact().isDeleted()) { artUuid = input.getArtifact().getArtId(); branch = input.getArtifact().getBranch(); title = input.getName(); } if (artUuid > 0 && branch.isValid() && Strings.isValid(title)) { memento.putString(BRANCH_KEY, branch.getIdString()); memento.putInteger(ART_KEY, artUuid); memento.putString(TITLE, title); } }
Source:
protected String doInBackground(Void... params) { Logger.log(TAG, "doing in background"); socketOccupied = false; try { ServerSocket serverSocket = new ServerSocket(8988); long time = System.currentTimeMillis(); String finalFileName = receiveZipDirectory + time + ".zip"; try { publishProgress("Ready to accept new file transfer.", null); Socket client = serverSocket.accept(); Logger.log(TAG, "Ready in wi-fi direct file server receive loop"); final File f = new File(finalFileName); File dirs = new File(f.getParent()); dirs.mkdirs(); f.createNewFile(); Log.d(TAG, "server: copying files " + f.toString()); InputStream inputstream = client.getInputStream(); CommCareWiFiDirectActivity.copyFile(inputstream, new FileOutputStream(f)); publishProgress("copied files: " + f.getAbsolutePath(), f.getAbsolutePath()); publishProgress("File Server Resetting", null); return f.getAbsolutePath(); } catch (IOException e) { Logger.log(TAG, e.getMessage()); publishProgress("File Server crashed after transfer with IO Exception: " + e.getMessage()); return null; } finally { try { serverSocket.close(); } catch(IOException e) { e.printStackTrace(); } } } catch (IOException ioe) { publishProgress("Ready to accept new file transfer.", null); Logger.log(TAG, "couldn't open socket!"); socketOccupied = true; return null; } }

Target:
protected String doInBackground(Void... params) { Logger.log(TAG, "doing in background"); socketOccupied = false; try { ServerSocket serverSocket = new ServerSocket(8988); long time = System.currentTimeMillis(); String finalFileName = receiveZipDirectory + time + ".zip"; try { publishProgress("Ready to accept new file transfer.", null); Socket client = serverSocket.accept(); Logger.log(TAG, "Ready in wi-fi direct file server receive loop"); final File f = new File(finalFileName); File dirs = new File(f.getParent()); dirs.mkdirs(); f.createNewFile(); Log.d(TAG, "server: copying files " + f.toString()); InputStream inputstream = client.getInputStream(); CommCareWiFiDirectActivity.copyFile(inputstream, new FileOutputStream(f)); publishProgress("copied files: " + f.getAbsolutePath(), f.getAbsolutePath()); publishProgress("File Server Resetting", null); return f.getAbsolutePath(); } catch (IOException e) { String errorMessage = "File Server crashed after transfer with IO Exception: " + e.getMessage(); Logger.exception(errorMessage, e); publishProgress(errorMessage); return null; } finally { try { serverSocket.close(); } catch(IOException e) { e.printStackTrace(); } } } catch (IOException ioe) { publishProgress("Ready to accept new file transfer.", null); Logger.log(TAG, "couldn't open socket!"); socketOccupied = true; return null; } }
Source:
public void downloadBlob(BlobId blobId, OutputStream outputStream) throws CloudStorageException { BlobReadInfo blobReadInfo = null; try { if (!map.containsKey(blobId)) { throw new CloudStorageException("Blob with blobId " + blobId.getID() + " does not exist."); } byte[] blobData = new byte[(int) map.get(blobId).getFirst().getSize()]; map.get(blobId).getSecond().read(blobData); outputStream.write(blobData); } catch (IOException ex) { throw new CloudStorageException( "Could not download blob for blobid " + blobId.getID() + " due to " + ex.toString()); } }

Target:
public void downloadBlob(BlobId blobId, OutputStream outputStream) throws CloudStorageException { CloudMessageReadSet.BlobReadInfo blobReadInfo = null; try { if (!map.containsKey(blobId)) { throw new CloudStorageException("Blob with blobId " + blobId.getID() + " does not exist."); } byte[] blobData = map.get(blobId).getSecond(); outputStream.write(blobData); } catch (IOException ex) { throw new CloudStorageException( "Could not download blob for blobid " + blobId.getID() + " due to " + ex.toString()); } }
Source:
public Obs saveObs(Obs obs) throws APIException { try { String fileName = obs.getComplexData().getTitle(); File outfile = getOutputFileToWrite(obs); OutputStream out = new FileOutputStream(outfile, false); FileInputStream mediaStream = (FileInputStream) obs.getComplexData().getData(); OpenmrsUtil.copyFile(mediaStream, out); obs.setComplexData(null); obs.setValueComplex(fileName + "|" + outfile.getName()); out.close(); } catch (IOException ioe) { throw new APIException("Trying to write complex obs to the file system. ", ioe); } return obs; }

Target:
public Obs saveObs(Obs obs) throws APIException { try { String fileName = obs.getComplexData().getTitle(); File outfile = getOutputFileToWrite(obs); OutputStream out = new FileOutputStream(outfile, false); FileInputStream mediaStream = (FileInputStream) obs.getComplexData().getData(); OpenmrsUtil.copyFile(mediaStream, out); obs.setComplexData(null); obs.setValueComplex(FilenameUtils.removeExtension(fileName) + "|" + outfile.getName()); out.close(); } catch (IOException ioe) { throw new APIException("Trying to write complex obs to the file system. ", ioe); } return obs; }
Source:
private boolean isLibrbdAvailable() { if (!CINDERStorageHelper.isLibrbdAvailable(getVds())) { log.error("Couldn't found librbd1 package on vds (needed for Cinder storage domains).", getVds().getName()); setNonOperational(NonOperationalReason.LIBRBD_PACKAGE_NOT_AVAILABLE, getVds()); return false; } return true; }

Target:
private boolean isLibrbdAvailable() { if (!CINDERStorageHelper.isLibrbdAvailable(getVds())) { log.error("Couldn't found librbd1 package on vds (needed for Cinder storage domains).", getVds().getName()); setNonOperational(NonOperationalReason.LIBRBD_PACKAGE_NOT_AVAILABLE); return false; } return true; }
Source:
private void initSMSButton() { Pattern p = Pattern.compile(".*[a-zA-Z].*"); Matcher m = p.matcher(parentWindow.getCurrentSearchText()); if(parentWindow.hasOperationSet(OperationSetSmsMessaging.class) && !m.find()) { if (smsButton != null && smsButton.getParent() != null) return; smsButton = new JButton(GuiActivator.getResources() .getI18NString("service.gui.SEND_SMS")); smsButton.setIcon(GuiActivator.getResources() .getImage("service.gui.icons.SMS_BUTTON_ICON")); buttonPanel.add(smsButton); smsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final String searchText = parentWindow.getCurrentSearchText(); if(searchText == null) return; SMSManager.sendSMS(smsButton, searchText); } }); } else { if(smsButton != null) buttonPanel.remove(smsButton); } }

Target:
private void initSMSButton() { if(parentWindow.hasOperationSet(OperationSetSmsMessaging.class) && !StringUtils.isAlpha(parentWindow.getCurrentSearchText())) { if (smsButton != null && smsButton.getParent() != null) return; smsButton = new JButton(GuiActivator.getResources() .getI18NString("service.gui.SEND_SMS")); smsButton.setIcon(GuiActivator.getResources() .getImage("service.gui.icons.SMS_BUTTON_ICON")); buttonPanel.add(smsButton); smsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final String searchText = parentWindow.getCurrentSearchText(); if(searchText == null) return; SMSManager.sendSMS(smsButton, searchText); } }); } else { if(smsButton != null) buttonPanel.remove(smsButton); } }
Source:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length == 0) { return false; } final Player player = getPlayer(args[0]); if (player == null) { playerMsg(TFM_Command.PLAYER_NOT_FOUND, ChatColor.RED); return true; } String reason = null; if (args.length >= 2) { reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " "); } TFM_Util.adminAction(sender.getName(), "Kicking " + player.getName() + " from the server", true); sender.sendMessage(ChatColor.RED + "Kicked: " + player.getName()); player.setOp(false); final Location targetPos = player.getLocation(); for (int x = -1; x <= 1; x++) { for (int z = -1; z <= 1; z++) { final Location strike_pos = new Location(targetPos.getWorld(), targetPos.getBlockX() + x, targetPos.getBlockY(), targetPos.getBlockZ() + z); targetPos.getWorld().strikeLightning(strike_pos); } } player.kickPlayer(ChatColor.RED + "You have been kicked from the server" + (reason != null ? ("\nReason: " + ChatColor.YELLOW + reason) : "")); return true; }

Target:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length == 0) { return false; } final Player player = getPlayer(args[0]); if (player == null) { playerMsg(TFM_Command.PLAYER_NOT_FOUND, ChatColor.RED); return true; } String reason = null; if (args.length >= 2) { reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " "); } TFM_Util.adminAction(sender.getName(), "Kicking " + player.getName() + " from the server", true); playerMsg(ChatColor.RED + "Kicked: " + player.getName()); player.kickPlayer(ChatColor.RED + "You have been kicked from the server" + (reason != null ? ("\nReason: " + ChatColor.YELLOW + reason) : "")); return true; }
Source:
public Object visitSizeCommand(InvocationContext ctx, SizeCommand command) throws Throwable { Set<Flag> flags = command.getFlags(); int size = 0; AdvancedCache decoratedCache = cache.getAdvancedCache(); if (flags != null) { decoratedCache = decoratedCache.withFlags(flags.toArray(new Flag[flags.size()])); } return (int) decoratedCache.cacheEntrySet().stream() .filter(CacheFilters.predicate(Tombstone.EXCLUDE_TOMBSTONES)) .count(); }

Target:
public Object visitSizeCommand(InvocationContext ctx, SizeCommand command) throws Throwable { Set<Flag> flags = command.getFlags(); int size = 0; AdvancedCache decoratedCache = cache.getAdvancedCache(); if (flags != null) { decoratedCache = decoratedCache.withFlags(flags.toArray(new Flag[flags.size()])); } return Math.min(Integer.MAX_VALUE, (int) decoratedCache.cacheEntrySet().stream() .filter(CacheFilters.predicate(Tombstone.EXCLUDE_TOMBSTONES)) .count()); }
Source:
private StructType toStructType(TStructDescriptor struct) { List<Field> fields = struct.getFields(); List<ThriftField> children = new ArrayList<ThriftField>(fields.size()); for (int i = 0; i < fields.size(); i++) { Field field = fields.get(i); Requirement req = field.getFieldMetaData() == null ? Requirement.OPTIONAL : Requirement.fromType(field.getFieldMetaData().requirementType); children.add(toThriftField(field.getName(), field, req)); } return new StructType(children, TBaseUtil.isUnion(struct.getThriftClass())); }

Target:
private StructType toStructType(TStructDescriptor struct) { List<Field> fields = struct.getFields(); List<ThriftField> children = new ArrayList<ThriftField>(fields.size()); for (int i = 0; i < fields.size(); i++) { Field field = fields.get(i); Requirement req = field.getFieldMetaData() == null ? Requirement.OPTIONAL : Requirement.fromType(field.getFieldMetaData().requirementType); children.add(toThriftField(field.getName(), field, req)); } return new StructType(children, structOrUnionType(struct.getThriftClass())); }
Source:
public void shouldStartAllModules() throws Exception { SimpleObject deserialized = deserialize(handle(newPostRequest(getURI(), "{\"action\":\"start\", \"allModules\":\"true\"}"))); for (Module loadedModule : mockModuleFactory.loadedModules) { assertThat(mockModuleFactory.startedModules, hasItem(loadedModule)); } }

Target:
public void shouldStartAllModules() throws Exception { assertThat(mockModuleFactory.startedModules, emptyCollectionOf(Module.class)); deserialize(handle(newPostRequest(getURI(), "{\"action\":\"start\", \"allModules\":\"true\"}"))); for (Module loadedModule : mockModuleFactory.loadedModules) { assertThat(mockModuleFactory.startedModules, hasItem(loadedModule)); } }
Source:
protected static void initSumDoubleValues(String tableName, byte[][] splits, String url) throws Exception { ensureTableCreated(url, tableName, "SumDoubleTest", splits); Properties props = new Properties(); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement stmt = conn.prepareStatement( "upsert into " + tableName + "(" + " id, " + " d, " + " f, " + " ud, " + " uf) " + "VALUES (?, ?, ?, ?, ?)"); stmt.setString(1, "1"); stmt.setDouble(2, 0.001); stmt.setFloat(3, 0.01f); stmt.setDouble(4, 0.001); stmt.setFloat(5, 0.01f); stmt.execute(); stmt.setString(1, "2"); stmt.setDouble(2, 0.002); stmt.setFloat(3, 0.02f); stmt.setDouble(4, 0.002); stmt.setFloat(5, 0.02f); stmt.execute(); stmt.setString(1, "3"); stmt.setDouble(2, 0.003); stmt.setFloat(3, 0.03f); stmt.setDouble(4, 0.003); stmt.setFloat(5, 0.03f); stmt.execute(); stmt.setString(1, "4"); stmt.setDouble(2, 0.004); stmt.setFloat(3, 0.04f); stmt.setDouble(4, 0.004); stmt.setFloat(5, 0.04f); stmt.execute(); stmt.setString(1, "5"); stmt.setDouble(2, 0.005); stmt.setFloat(3, 0.05f); stmt.setDouble(4, 0.005); stmt.setFloat(5, 0.05f); stmt.execute(); conn.commit(); } finally { conn.close(); } }

Target:
protected static void initSumDoubleValues(String tableName, byte[][] splits, String url) throws Exception { ensureTableCreated(url, tableName, SUM_DOUBLE_NAME, splits); Properties props = new Properties(); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement stmt = conn.prepareStatement( "upsert into " + tableName + "(" + " id, " + " d, " + " f, " + " ud, " + " uf) " + "VALUES (?, ?, ?, ?, ?)"); stmt.setString(1, "1"); stmt.setDouble(2, 0.001); stmt.setFloat(3, 0.01f); stmt.setDouble(4, 0.001); stmt.setFloat(5, 0.01f); stmt.execute(); stmt.setString(1, "2"); stmt.setDouble(2, 0.002); stmt.setFloat(3, 0.02f); stmt.setDouble(4, 0.002); stmt.setFloat(5, 0.02f); stmt.execute(); stmt.setString(1, "3"); stmt.setDouble(2, 0.003); stmt.setFloat(3, 0.03f); stmt.setDouble(4, 0.003); stmt.setFloat(5, 0.03f); stmt.execute(); stmt.setString(1, "4"); stmt.setDouble(2, 0.004); stmt.setFloat(3, 0.04f); stmt.setDouble(4, 0.004); stmt.setFloat(5, 0.04f); stmt.execute(); stmt.setString(1, "5"); stmt.setDouble(2, 0.005); stmt.setFloat(3, 0.05f); stmt.setDouble(4, 0.005); stmt.setFloat(5, 0.05f); stmt.execute(); conn.commit(); } finally { conn.close(); } }
Source:
public boolean shouldReportRequestLog(){ if (requestType.equals(RequestTypeUpLog)){ return false; } else { return true; } }

Target:
boolean shouldReportRequestLog(){ return requestType.equals(RequestTypeUpLog); }
Source:
public ICPPTemplateParameter[] getTemplateParameters() { if (fTemplateParameters == null) { try { IASTNode point = null; fTemplateParameters = CPPTemplates.specializeTemplateParameters(this, (ICPPScope) getScope(), super.getTemplateParameters(), getOwner(), point); } catch (DOMException e) { CCorePlugin.log(e); } } return fTemplateParameters; }

Target:
public ICPPTemplateParameter[] getTemplateParameters() { return fTemplateParameters; }
Source:
public void finish() { super.finish(); overridePendingTransition(0, R.anim.slide_out_from_top); presentationManager.stopPlayer(); textToSpeechManager.shutdown(); }

Target:
public void finish() { super.finish(); overridePendingTransition(0, R.anim.slide_out_from_top); presentationManager.stopPresentation(); textToSpeechManager.shutdown(); }
Source:
public void removePolicy(String path, AccessControlPolicy policy) throws PathNotFoundException, AccessControlException, AccessDeniedException, LockException, VersionException, RepositoryException { if (session.isReadOnly()) { throw new AccessDeniedException(""); } try { if (!hasPrivileges(path, new Privilege[]{privileges.forName(Privilege.JCR_MODIFY_ACCESS_CONTROL)})) { throw new AccessDeniedException(); } Node node = session.getNode(path); if (node.hasNode(ACCESS_LIST_NODE)) { Node aclNode = node.getNode(ACCESS_LIST_NODE); aclNode.remove(); node.removeMixin(NT_ACCESS_CONTROLLABLE); } } catch (PathNotFoundException e) { } }

Target:
public void removePolicy(String path, AccessControlPolicy policy) throws PathNotFoundException, AccessControlException, AccessDeniedException, LockException, VersionException, RepositoryException { if (session.isReadOnly()) { throw new AccessDeniedException(JcrI18n.permissionDenied.text(path, "read AC content")); } try { if (!hasPrivileges(path, new Privilege[]{privileges.forName(Privilege.JCR_MODIFY_ACCESS_CONTROL)})) { throw new AccessDeniedException(); } Node node = session.getNode(path); if (node.hasNode(ACCESS_LIST_NODE)) { Node aclNode = node.getNode(ACCESS_LIST_NODE); aclNode.remove(); node.removeMixin(NT_ACCESS_CONTROLLABLE); } } catch (PathNotFoundException e) { } }
Source:
public void testDeleteFromListColumnIndexTable() { ColumnModel intColumn = new ColumnModel(); intColumn.setId("12"); intColumn.setName("foo"); intColumn.setColumnType(ColumnType.INTEGER); ColumnModel stringListColumn = new ColumnModel(); stringListColumn.setId("15"); stringListColumn.setName("myList"); stringListColumn.setMaximumSize(54L); stringListColumn.setColumnType(ColumnType.STRING_LIST); ColumnModel booleanColumn = new ColumnModel(); booleanColumn.setId("13"); booleanColumn.setName("bar"); booleanColumn.setColumnType(ColumnType.BOOLEAN); List<ColumnModel> schema = Lists.newArrayList(intColumn, stringListColumn ,booleanColumn); createOrUpdateTable(schema, tableId, isView); int numRows = 5; List<Row> rows = TableModelTestUtils.createRows(schema, numRows); createOrUpdateOrDeleteRows(tableId, rows, schema); tableIndexDAO.populateListColumnIndexTable(tableId, stringListColumn, null); String listColumnindexTableName = SQLUtils.getTableNameForMultiValueColumnIndex(tableId, stringListColumn.getId()); assertEquals(numRows * 2, tableIndexDAO.countQuery("SELECT COUNT(*) FROM `" + listColumnindexTableName + "`", Collections.emptyMap())); tableIndexDAO.deleteFromListColumnIndexTable(tableId, stringListColumn, Sets.newHashSet(rows.get(0).getRowId(), rows.get(2).getRowId())); assertEquals((numRows-2) * 2, tableIndexDAO.countQuery("SELECT COUNT(*) FROM `" + listColumnindexTableName + "`", Collections.emptyMap())); }

Target:
public void testDeleteFromListColumnIndexTable() { ColumnModel intColumn = new ColumnModel(); intColumn.setId("12"); intColumn.setName("foo"); intColumn.setColumnType(ColumnType.INTEGER); ColumnModel stringListColumn = new ColumnModel(); stringListColumn.setId("15"); stringListColumn.setName("myList"); stringListColumn.setMaximumSize(54L); stringListColumn.setColumnType(ColumnType.STRING_LIST); ColumnModel booleanColumn = new ColumnModel(); booleanColumn.setId("13"); booleanColumn.setName("bar"); booleanColumn.setColumnType(ColumnType.BOOLEAN); List<ColumnModel> schema = Lists.newArrayList(intColumn, stringListColumn ,booleanColumn); createOrUpdateTable(schema, tableId, isView); int numRows = 5; List<Row> rows = TableModelTestUtils.createRows(schema, numRows); createOrUpdateOrDeleteRows(tableId, rows, schema); tableIndexDAO.populateListColumnIndexTable(tableId, stringListColumn, null); assertEquals(numRows * 2, countRowsInMultiValueIndex(tableId, stringListColumn.getId())); tableIndexDAO.deleteFromListColumnIndexTable(tableId, stringListColumn, Sets.newHashSet(rows.get(0).getRowId(), rows.get(2).getRowId())); assertEquals((numRows-2) * 2, countRowsInMultiValueIndex(tableId, stringListColumn.getId())); }
Source:
public void setUp(Context context, Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener, EnvVars initialEnvironment) throws IOException, InterruptedException { FilePath configFile = workspace.createTempFile(".kube", "config"); launcher.launch() .cmdAsSingleString("kubectl config --kubeconfig=" + configFile.getRemote() + " set-cluster k8s --server=" + serverUrl + " --insecure-skip-tls-verify=true") .join(); final UsernamePasswordCredentials c = getCredentials(credentialsId); launcher.launch() .cmdAsSingleString("kubectl config --kubeconfig=" + configFile.getRemote() + " set-credentials cluster-admin --username=" + c.getUsername() + " --password=" + Secret.toString(c.getPassword())) .masks(false, false, false, false, false, false, true) .join(); launcher.launch() .cmdAsSingleString("kubectl config --kubeconfig=" + configFile.getRemote() + " set-context k8s --cluster=k8s --user=cluster-admin") .join(); launcher.launch() .cmdAsSingleString("kubectl config --kubeconfig=" + configFile.getRemote() + " use-context k8s") .join(); context.setDisposer(new CleanupDisposer(configFile)); context.env("KUBECONFIG", configFile.getRemote()); }

Target:
public void setUp(Context context, Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener, EnvVars initialEnvironment) throws IOException, InterruptedException { FilePath configFile = workspace.createTempFile(".kube", "config"); int status = launcher.launch() .cmdAsSingleString("kubectl config --kubeconfig=" + configFile.getRemote() + " set-cluster k8s --server=" + serverUrl + " --insecure-skip-tls-verify=true") .join(); if (status != 0) throw new IOException("Failed to run kubectl config "+status); final UsernamePasswordCredentials c = getCredentials(); status = launcher.launch() .cmdAsSingleString("kubectl config --kubeconfig=" + configFile.getRemote() + " set-credentials cluster-admin --username=" + c.getUsername() + " --password=" + Secret.toString(c.getPassword())) .masks(false, false, false, false, false, false, true) .join(); if (status != 0) throw new IOException("Failed to run kubectl config "+status); status = launcher.launch() .cmdAsSingleString("kubectl config --kubeconfig=" + configFile.getRemote() + " set-context k8s --cluster=k8s --user=cluster-admin") .join(); if (status != 0) throw new IOException("Failed to run kubectl config "+status); status = launcher.launch() .cmdAsSingleString("kubectl config --kubeconfig=" + configFile.getRemote() + " use-context k8s") .join(); if (status != 0) throw new IOException("Failed to run kubectl config "+status); context.setDisposer(new CleanupDisposer(configFile.getRemote())); context.env("KUBECONFIG", configFile.getRemote()); }
Source:
public DeletedHandler(final EMOperation completeOp) { this.completeOp = completeOp; }

Target:
DeletedHandler(final EMOperation completeOp) { this.completeOp = completeOp; }
Source:
public void addPages(MavenPomEditor pomEditor) { ITextEditor sourcePage = new MavenStructuredSourceTextEditor(pomEditor); try { int dex = pomEditor.addPage(pomEditor.getEffectivePomSourcePage(), pomEditor.getEffectivePomEditorInput()); pomEditor.setPageText(dex, pomEditor.EFFECTIVE_POM); int sourcePageIndex = pomEditor.addPage(sourcePage, pomEditor.getEditorInput()); pomEditor.setPageText(sourcePageIndex, "TEST"); IDocument sourceDocument = sourcePage.getDocumentProvider().getDocument(pomEditor.getEditorInput()); IDocumentListener documentListener = new IDocumentListener() { public void documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent event) { } public void documentChanged(org.eclipse.jface.text.DocumentEvent event) { try { pomEditor.getPomFile().refreshLocal(IResource.DEPTH_INFINITE, null); } catch(CoreException e) { log.error(e.getMessage(), e); } if (pomEditor.isCheckedWritableStatus() && pomEditor.isReadOnly()) { pomEditor.setCheckedWritableStatus(false); } } }; sourceDocument.addDocumentListener(documentListener); IDOMModel structuredModel = (IDOMModel) pomEditor.getModelManager().getExistingModelForEdit(sourceDocument); if(structuredModel == null) { pomEditor.setStructuredModel( (IDOMModel) pomEditor.getModelManager().getModelForEdit((IStructuredDocument) sourceDocument)); } } catch(PartInitException ex) { log.error(ex.getMessage(), ex); } }

Target:
public void addPages(MavenPomEditor pomEditor) { ITextEditor sourcePage = new MavenStructuredSourceTextEditor(pomEditor); ITextEditor effectPomPage = new MavenStructuredSourceTextEditor(pomEditor); try { int dex = pomEditor.addPage(effectPomPage, pomEditor.getEffectivePomEditorInput()); pomEditor.setPageText(dex, MavenPomEditor.EFFECTIVE_POM); pomEditor.setEffectivePomSourcePage(effectPomPage); int sourcePageIndex = pomEditor.addPage(sourcePage, pomEditor.getEditorInput()); pomEditor.setPageText(sourcePageIndex, MavenPomEditor.POM_XML); pomEditor.setSourcePage(sourcePage); IDocument sourceDocument = sourcePage.getDocumentProvider().getDocument(pomEditor.getEditorInput()); IDocumentListener documentListener = new IDocumentListener() { public void documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent event) { } public void documentChanged(org.eclipse.jface.text.DocumentEvent event) { try { pomEditor.getPomFile().refreshLocal(IResource.DEPTH_INFINITE, null); } catch (CoreException e) { log.error(e.getMessage(), e); } if (pomEditor.isCheckedWritableStatus() && pomEditor.isReadOnly()) { pomEditor.setCheckedWritableStatus(false); } } }; sourceDocument.addDocumentListener(documentListener); pomEditor.setStructuredModel( (IDOMModel) pomEditor.getModelManager().getModelForEdit((IStructuredDocument) sourceDocument)); } catch (PartInitException ex) { log.error(ex.getMessage(), ex); } }
Source:
private String getConnectionString(IPath dbPath) { IPreferencesService preferencesService = Platform .getPreferencesService(); StringBuilder buf = new StringBuilder("jdbc:h2:").append(dbPath.append( DB_NAME).toOSString()); buf.append(";UNDO_LOG=0"); buf.append(";LOCK_MODE=").append( preferencesService.getInt(H2Index.PLUGIN_ID, H2IndexPreferences.DB_LOCK_MODE, 0, null)); buf.append(";CACHE_TYPE=").append( preferencesService.getString(H2Index.PLUGIN_ID, H2IndexPreferences.DB_CACHE_TYPE, null, null)); buf.append(";CACHE_SIZE=").append( preferencesService.getInt(H2Index.PLUGIN_ID, H2IndexPreferences.DB_CACHE_SIZE, 0, null)); buf.append(";QUERY_CACHE_SIZE=").append( preferencesService.getInt(H2Index.PLUGIN_ID, H2IndexPreferences.DB_QUERY_CACHE_SIZE, 0, null)); buf.append(";LARGE_RESULT_BUFFER_SIZE=").append( preferencesService .getInt(H2Index.PLUGIN_ID, H2IndexPreferences.DB_LARGE_RESULT_BUFFER_SIZE, 0, null)); buf.append(";FILE_LOCK=").append( preferencesService.getString(H2Index.PLUGIN_ID, H2IndexPreferences.DB_FILE_LOCK, "", null)); SqlIndex.warn(buf.toString()); return buf.toString(); }

Target:
private String getConnectionString(IPath dbPath) { IPreferencesService preferencesService = Platform .getPreferencesService(); StringBuilder buf = new StringBuilder("jdbc:h2:").append(dbPath.append( DB_NAME).toOSString()); buf.append(";UNDO_LOG=0"); buf.append(";LOCK_MODE=").append( preferencesService.getInt(H2Index.PLUGIN_ID, H2IndexPreferences.DB_LOCK_MODE, 0, null)); buf.append(";CACHE_TYPE=").append( preferencesService.getString(H2Index.PLUGIN_ID, H2IndexPreferences.DB_CACHE_TYPE, null, null)); buf.append(";CACHE_SIZE=").append( preferencesService.getInt(H2Index.PLUGIN_ID, H2IndexPreferences.DB_CACHE_SIZE, 0, null)); buf.append(";QUERY_CACHE_SIZE=").append( preferencesService.getInt(H2Index.PLUGIN_ID, H2IndexPreferences.DB_QUERY_CACHE_SIZE, 0, null)); buf.append(";LARGE_RESULT_BUFFER_SIZE=").append( preferencesService .getInt(H2Index.PLUGIN_ID, H2IndexPreferences.DB_LARGE_RESULT_BUFFER_SIZE, 0, null)); buf.append(";FILE_LOCK=NO"); return buf.toString(); }
Source:
public void doubleClick() { waitForEnabled(); Assert.isTrue(selectionCount() == 1, MessageFormat.format("Double click on list cannot be done as selection count is not 1.")); log.debug(MessageFormat.format("Double-clicking on {0}", this)); notifySelect(true); notifyPostSelectDoubleClick(); }

Target:
public void doubleClick() { waitForEnabled(); log.debug(MessageFormat.format("Double-clicking on {0}", this)); notifySelect(true); notifyPostSelectDoubleClick(); }
Source:
public void expectMessages(List<String> messages) { receivedRequests.clear(); expectedMessages = messages; messages.forEach(m -> listener .register( post(urlEqualTo(path)) .willReturn(aResponse().withStatus(returnedStatusCode).withFixedDelay(delay).withHeader("Location", "http://localhost:1234")))); }

Target:
public void expectMessages(List<String> messages) { receivedRequests.clear(); expectedMessages = messages; messages.forEach(m -> listener .register( post(urlEqualTo(path)) .willReturn(aResponse().withStatus(returnedStatusCode).withFixedDelay(delay)))); }
Source:
public MotionController(PIDSensor sensor) { this.sensor = sensor; output = null; timer = new Timer(); task = new MotionControllerTask(); enable = true; absoluteTolerance = Util.EPSILON; capOutput = false; continuous = false; inputMin = 0.0; inputMax = 0.0; outputMin = 0.0; outputMax = 0.0; reset(); justReset = true; mcException = null; }

Target:
public MotionController(PIDSensor sensor) { this.sensor = sensor; output = null; timer = new Timer(); task = new MotionControllerTask(); enable = true; absoluteTolerance = Double.MIN_VALUE; capOutput = false; continuous = false; inputMin = 0.0; inputMax = 0.0; outputMin = 0.0; outputMax = 0.0; reset(); justReset = true; sensorException = null; }
Source:
public void does_nothing_when_user_can_already_edit_profile() { OrganizationDto organization = db.organizations().insert(); QProfileDto profile = db.qualityProfiles().insert(organization, p -> p.setLanguage(XOO)); UserDto user = db.users().insertUser(); db.organizations().addMember(organization, user); db.qualityProfiles().addUser(profile, user); assertThat(db.getDbClient().qProfileEditUsersDao().exists(db.getSession(), profile, user)).isTrue(); userSession.logIn().addPermission(OrganizationPermission.ADMINISTER_QUALITY_PROFILES, organization); ws.newRequest() .setParam(PARAM_QUALITY_PROFILE, profile.getName()) .setParam(PARAM_LANGUAGE, XOO) .setParam(PARAM_LOGIN, user.getLogin()) .setParam(PARAM_ORGANIZATION, organization.getKey()) .execute(); assertThat(db.getDbClient().qProfileEditUsersDao().exists(db.getSession(), profile, user)).isTrue(); }

Target:
public void does_nothing_when_user_can_already_edit_profile() { OrganizationDto organization = db.organizations().insert(); QProfileDto profile = db.qualityProfiles().insert(organization, p -> p.setLanguage(XOO)); UserDto user = db.users().insertUser(); db.organizations().addMember(organization, user); db.qualityProfiles().addUserPermission(profile, user); assertThat(db.getDbClient().qProfileEditUsersDao().exists(db.getSession(), profile, user)).isTrue(); userSession.logIn().addPermission(OrganizationPermission.ADMINISTER_QUALITY_PROFILES, organization); ws.newRequest() .setParam(PARAM_QUALITY_PROFILE, profile.getName()) .setParam(PARAM_LANGUAGE, XOO) .setParam(PARAM_LOGIN, user.getLogin()) .setParam(PARAM_ORGANIZATION, organization.getKey()) .execute(); assertThat(db.getDbClient().qProfileEditUsersDao().exists(db.getSession(), profile, user)).isTrue(); }
Source:
protected Map<String, String> evaluateAnnotationPlaceholders( NamespaceResolutionContext namespaceCtx) { Map<String, String> evaluatedAnnotations = new HashMap<>(); for (String labelName : namespaceAnnotations.keySet()) { String evaluatedLabelValue = namespaceAnnotations .get(labelName) .replace(USERNAME_PLACEHOLDER, namespaceCtx.getUserName()); evaluatedAnnotations.put(labelName, evaluatedLabelValue); } return evaluatedAnnotations; }

Target:
protected Map<String, String> evaluateAnnotationPlaceholders( NamespaceResolutionContext namespaceCtx) { Map<String, String> evaluatedAnnotations = new HashMap<>(); for (String annotationName : namespaceAnnotations.keySet()) { String evaluatedAnnotationValue = namespaceAnnotations .get(annotationName) .replace(USERNAME_PLACEHOLDER, namespaceCtx.getUserName()); evaluatedAnnotations.put(annotationName, evaluatedAnnotationValue); } return evaluatedAnnotations; }
Source:
private boolean checkFreeSpace() { if (!hasFreeSpace(getStorageDomain())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW); return false; } return true; }

Target:
private boolean checkFreeSpace() { if (!hasFreeSpace(getStorageDomain())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW); } return true; }
Source:
public static Map<String, Map<String, Object>> getTopologyLag(StormTopology userTopology, Map<String,Object> config) { Boolean disableLagMonitoring = ObjectReader.getBoolean(config.get(DaemonConfig.UI_DISABLE_SPOUT_LAG_MONITORING), false); return disableLagMonitoring ? Collections.EMPTY_MAP : TopologySpoutLag.lag(userTopology, config); }

Target:
public static Map<String, Map<String, Object>> getTopologyLag(StormTopology userTopology, Map<String,Object> config) { Boolean disableLagMonitoring = (Boolean)(config.get(DaemonConfig.UI_DISABLE_SPOUT_LAG_MONITORING)); return disableLagMonitoring ? Collections.EMPTY_MAP : TopologySpoutLag.lag(userTopology, config); }
Source:
private boolean classExists(JavaSourceFacet javaSourceFacet) { JavaSource<?> source = buildJavaSource(javaSourceFacet); if (source == null) { return false; } boolean classAlreadyExists; try { JavaResource parsedJavaResource = javaSourceFacet.getJavaResource(source); classAlreadyExists = parsedJavaResource.exists(); } catch (FileNotFoundException ex) { classAlreadyExists = false; } return classAlreadyExists; }

Target:
private boolean classExists(JavaSourceFacet javaSourceFacet) { JavaSource<?> source = buildJavaSource(javaSourceFacet); if (source == null) { return false; } boolean classAlreadyExists; try { JavaResource parsedJavaResource = javaSourceFacet.getJavaResource(source); classAlreadyExists = parsedJavaResource.exists(); } catch (FileNotFoundException | ResourceException ex) { classAlreadyExists = false; } return classAlreadyExists; }
Source:
public static Collection<Object[]> getSolutionFilesAsParameters() { List<Object[]> testParams = new ArrayList<>(); if (MOVE_THREAD_COUNTS_VALUE != null) { String[] moveThreadCounts = MOVE_THREAD_COUNTS_VALUE.split("[,]"); Set<String> uniqueMoveThreadCounts = new LinkedHashSet<>(); for (String moveThreadCount : moveThreadCounts) { boolean added = uniqueMoveThreadCounts.add(moveThreadCount); if (added) { testParams.add(new Object[]{moveThreadCount}); } } } else { testParams.add(new Object[]{DEFAULT_MOVE_THREAD_COUNT}); } return testParams; }

Target:
public static Collection<Object[]> getSolutionFilesAsParameters() { List<Object[]> testParams = new ArrayList<>(); if (MOVE_THREAD_COUNTS_STRING != null) { String[] moveThreadCounts = MOVE_THREAD_COUNTS_STRING.split(","); for (String moveThreadCount : moveThreadCounts) { testParams.add(new Object[]{moveThreadCount}); } } else { testParams.add(new Object[]{SolverConfig.MOVE_THREAD_COUNT_NONE}); } return testParams; }
Source:
private boolean hasHeader(HttpServletResponse response, String headerName) { return response.containsHeader(headerName); }

Target:
private boolean hasHeader(HttpServletResponse response, String headerName) { return response.getHeader(headerName) != null; }
Source:
static <T> Iterator<T> of(T... elements) { Objects.requireNonNull(elements, "elements is null"); if (elements.length == 0) return Iterator.empty(); return new AbstractIterator<T>() { int index = 0; @Override public boolean hasNext() { return index < elements.length; } @Override public T getNext() { return elements[index++]; } }; }

Target:
static <T> Iterator<T> of(T... elements) { Objects.requireNonNull(elements, "elements is null"); if (elements.length == 0) { return Iterator.empty(); } else { return new AbstractIterator<T>() { int index = 0; @Override public boolean hasNext() { return index < elements.length; } @Override public T getNext() { return elements[index++]; } }; } }
Source:
public List<UnhealthySubscription> listUnhealthyForOwner(@PathParam("ownerSourceName") String ownerSourceName, @PathParam("ownerId") String id) { OwnerSource ownerSource = ownerSources.getByName(ownerSourceName) .orElseThrow(() -> new OwnerSourceNotFound(ownerSourceName)); if (!ownerSource.exists(id)) { throw new OwnerSource.OwnerNotFound(ownerSourceName, id); } OwnerId ownerId = new OwnerId(ownerSource.name(), id); return subscriptionService.listUnhealthyForOwner(ownerId); }

Target:
public List<UnhealthySubscription> listUnhealthyForOwner(@PathParam("ownerSourceName") String ownerSourceName, @PathParam("ownerId") String id) { OwnerId ownerId = resolveOwnerId(ownerSourceName, id); return subscriptionService.listUnhealthyForOwner(ownerId); }
Source:
ColumnChunkPageReader(BytesInputDecompressor decompressor, List<DataPage> compressedPages, DictionaryPage compressedDictionaryPage, OffsetIndex offsetIndex, long rowCount) { this.decompressor = decompressor; this.compressedPages = new ArrayList<DataPage>(compressedPages); this.compressedDictionaryPage = compressedDictionaryPage; long count = 0; for (DataPage p : compressedPages) { count += p.getValueCount(); } this.valueCount = count; this.offsetIndex = offsetIndex; this.rowCount = rowCount; }

Target:
ColumnChunkPageReader(BytesInputDecompressor decompressor, List<DataPage> compressedPages, DictionaryPage compressedDictionaryPage, OffsetIndex offsetIndex, long rowCount) { this.decompressor = decompressor; this.compressedPages = new ArrayDeque<DataPage>(compressedPages); this.compressedDictionaryPage = compressedDictionaryPage; long count = 0; for (DataPage p : compressedPages) { count += p.getValueCount(); } this.valueCount = count; this.offsetIndex = offsetIndex; this.rowCount = rowCount; }
Source:
private void checkNumberOfPatientsAndSetScreeningData(ScreeningDto screeningDto, Screening screening, Boolean ignoreLimitation) { Clinic clinic = clinicDataService.findById(Long.parseLong(screeningDto.getClinicId())); LocalDate date = LocalDate.parse(screeningDto.getDate()); Time startTime; Time endTime; if (StringUtils.isNotBlank(screeningDto.getStartTime())) { startTime = Time.valueOf(screeningDto.getStartTime()); endTime = calculateEndTime(startTime); } else { startTime = null; endTime = null; } if (!ignoreLimitation) { visitLimitationHelper.checkCapacityForScreening(date, clinic, screening.getId()); List<Screening> screeningList = screeningDataService.findByDateAndClinicId(date, clinic.getId()); if (screeningList != null) { int numberOfRooms = clinic.getNumberOfRooms(); int maxVisits = clinic.getMaxScreeningVisits(); int patients = 0; for (Screening s : screeningList) { if (s.getId().equals(screening.getId())) { maxVisits++; } else if (startTime != null) { if (startTime.isBefore(s.getStartTime())) { if (s.getStartTime().isBefore(endTime)) { patients++; } } else { if (startTime.isBefore(s.getEndTime())) { patients++; } } } } if (screeningList.size() >= maxVisits) { throw new LimitationExceededException("The limit of the type of the visit is reached for this day"); } if (patients >= numberOfRooms) { throw new LimitationExceededException("Too many visits at the same time"); } } } screening.setDate(date); screening.setStartTime(startTime); screening.setEndTime(endTime); screening.setClinic(clinic); }

Target:
private void checkNumberOfPatientsAndSetScreeningData(ScreeningDto screeningDto, Screening screening, Boolean ignoreLimitation) { Clinic clinic = clinicDataService.findById(Long.parseLong(screeningDto.getClinicId())); LocalDate date = LocalDate.parse(screeningDto.getDate()); Time startTime; Time endTime; if (StringUtils.isNotBlank(screeningDto.getStartTime())) { startTime = Time.valueOf(screeningDto.getStartTime()); endTime = calculateEndTime(startTime); } else { startTime = null; endTime = null; } if (!ignoreLimitation) { visitLimitationHelper.checkCapacityForScreening(date, clinic, screening.getId()); List<Screening> screeningList = screeningDataService.findByDateAndClinicId(date, clinic.getId()); if (screeningList != null) { int numberOfRooms = clinic.getNumberOfRooms(); int maxVisits = clinic.getMaxScreeningVisits(); int patients = 0; for (Screening s : screeningList) { if (s.getId().equals(screening.getId())) { maxVisits++; } else if (startTime != null && s.getStartTime() != null) { if (startTime.isBefore(s.getStartTime())) { if (s.getStartTime().isBefore(endTime)) { patients++; } } else { if (startTime.isBefore(s.getEndTime())) { patients++; } } } } if (screeningList.size() >= maxVisits) { throw new LimitationExceededException("The limit of the type of the visit is reached for this day"); } if (patients >= numberOfRooms) { throw new LimitationExceededException("Too many visits at the same time"); } } } screening.setDate(date); screening.setStartTime(startTime); screening.setEndTime(endTime); screening.setClinic(clinic); }
Source:
private int createMostActiveBranchesMenuItems(Menu menu, Repository[] repositories) { int itemCount = 0; try { List<Map<String, Ref>> activeBranches = new ArrayList<>(); for (Repository repository : repositories) { Map<String, Ref> branchRefMapping = getMostActiveBranches( repository, MAX_NUM_MENU_ENTRIES); activeBranches.add(branchRefMapping); } Set<String> activeBranchIntersection = getBranchNameIntersection(activeBranches); for (String branchName : activeBranchIntersection) { itemCount++; createMenuItemMultiple(menu, repositories, branchName); } if (itemCount >= MAX_NUM_MENU_ENTRIES) { return itemCount; } List<Map<String, Ref>> localBranchMapping = new ArrayList<>(); for (Repository repository : repositories) { Map<String, Ref> localBranches = repository.getRefDatabase() .getRefs(Constants.R_HEADS); localBranchMapping.add(localBranches); } Set<String> localBranchNameIntersection = getBranchNameIntersection( localBranchMapping); localBranchNameIntersection.removeAll(activeBranchIntersection); if (itemCount > 0 && !localBranchNameIntersection.isEmpty()) createSeparator(menu); for (String localBranchName : localBranchNameIntersection) { itemCount++; if (itemCount > MAX_NUM_MENU_ENTRIES) { break; } createMenuItemMultiple(menu, repositories, localBranchName); } } catch (IOException e) { Activator.handleError(e.getMessage(), e, true); } return itemCount; }

Target:
private int createMostActiveBranchesMenuItems(Menu menu, Repository[] repositories) { int itemCount = 0; try { List<Map<String, Ref>> activeBranches = new ArrayList<>(); for (Repository repository : repositories) { Map<String, Ref> branchRefMapping = getMostActiveBranches( repository, MAX_NUM_MENU_ENTRIES); activeBranches.add(branchRefMapping); } Set<String> activeBranchIntersection = getBranchNameIntersection(activeBranches); for (String branchName : activeBranchIntersection) { itemCount++; createMenuItemMultiple(menu, repositories, branchName); } if (itemCount >= MAX_NUM_MENU_ENTRIES) { return itemCount; } List<Map<String, Ref>> localBranchMapping = new ArrayList<>(); for (Repository repository : repositories) { Map<String, Ref> localBranches = repository.getRefDatabase() .getRefs(Constants.R_HEADS); localBranchMapping.add(localBranches); } Set<String> localBranchNameIntersection = getBranchNameIntersection( localBranchMapping); localBranchNameIntersection.removeAll(activeBranchIntersection); if (itemCount > 0 && !localBranchNameIntersection.isEmpty()) { createSeparator(menu); } for (String localBranchName : localBranchNameIntersection) { itemCount++; if (itemCount > MAX_NUM_MENU_ENTRIES) { break; } createMenuItemMultiple(menu, repositories, localBranchName); } } catch (IOException e) { Activator.handleError(e.getMessage(), e, true); } return itemCount; }
Source:
public SWTBotButton buttonWithId(String key, Object value) { Matcher matcher = allOf(widgetOfType(Button.class), withId(key, value), withStyle(SWT.PUSH, "SWT.PUSH")); return new SWTBotButton((Button) widget(matcher), matcher); }

Target:
public SWTBotButton buttonWithId(String key, Object value) { return buttonWithId(key, value, 0); }
Source:
public void addStatement(RemoteStatement statement) { statements.add( statement ); }

Target:
public RemoteStatements addStatement(RemoteStatement statement) { statements.add( statement ); return this; }
Source:
private static int getLineNoOfPreviousNode(final DetailAST node) { int start = 0; final DetailAST previous = node.getPreviousSibling(); if (null != previous) { start = previous.getLineNo(); } return start; }

Target:
private static int getLineNoOfPreviousNode(final DetailAST node) { int start = 0; final DetailAST previous = node.getPreviousSibling(); if (previous != null) { start = previous.getLineNo(); } return start; }