auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected Position handlePosition(Position position) { Collection<Attribute> attributes = Context.getAttributesManager().getItems( Context.getAttributesManager().getAllDeviceItems(position.getDeviceId())); for (Attribute attribute : attributes) { if (attribute.getAttribute() != null) { Object result = null; try { result = computeAttribute(attribute, position); } catch (JexlException error) { Log.warning(error); } if (result != null) { try { switch (attribute.getType()) { case "number": position.getAttributes().put(attribute.getAttribute(), (Number) result); break; case "boolean": position.getAttributes().put(attribute.getAttribute(), (Boolean) result); break; default: String attributeValue = null; String attributeName = attribute.getAttribute(); if (attributeName.equals("alarm") || attributeName.equals("event")) { Object temp = position.getAttributes(). get(attribute.getAttribute()); if (temp != null) { attributeValue = temp.toString(); } } if (attributeValue != null) { attributeValue += "," + result.toString(); } else { attributeValue = result.toString(); } position.getAttributes().put(attribute.getAttribute(), attributeValue); } } catch (ClassCastException error) { Log.warning(error); } } } } return position; }

Target:
protected Position handlePosition(Position position) { Collection<Attribute> attributes = Context.getAttributesManager().getItems( Context.getAttributesManager().getAllDeviceItems(position.getDeviceId())); for (Attribute attribute : attributes) { if (attribute.getAttribute() != null) { Object result = null; try { result = computeAttribute(attribute, position); } catch (JexlException error) { Log.warning(error); } if (result != null) { try { switch (attribute.getType()) { case "number": position.getAttributes().put(attribute.getAttribute(), (Number) result); break; case "boolean": position.getAttributes().put(attribute.getAttribute(), (Boolean) result); break; default: String attributeValue = null; String attributeName = attribute.getAttribute(); if (attributeName.equals(Position.KEY_ALARM)) { if (position.getAttributes(). get(attribute.getAttribute()) != null) { attributeValue = (String) position.getAttributes(). get(attribute.getAttribute()); } } if (attributeValue != null) { attributeValue += "," + result.toString(); } else { attributeValue = result.toString(); } position.getAttributes().put(attribute.getAttribute(), attributeValue); } } catch (ClassCastException error) { Log.warning(error); } } } } return position; }
Source:
protected void addToStack(String value, String property, boolean addToMdc) { if (!isNotBlank(property) || value == null) { return; } Deque<String> deque = getDeque(property); String current = deque.peekFirst(); if (value.equals(current)) { return; } deque.addFirst(value); addToCurrentSection(property); if (addToMdc) { MDC.put(property, value); } }

Target:
protected void addToStack(String value, String property, boolean addToMdc) { if (!isNotBlank(property)) { return; } Deque<String> deque = getDeque(property); String current = deque.peekFirst(); if (valuesEqual(current, value)) { return; } addToCurrentSection(property); if (value == null) { deque.addFirst(NULL_VALUE); if (addToMdc) { MDC.remove(property); } } else { deque.addFirst(value); if (addToMdc) { MDC.put(property, value); } } }
Source:
public void resourceChanged(IResourceChangeEvent event) { if (event.getDelta() == null) return; if (sarosSessionManager == null) { initialize(); if (sarosSessionManager == null) { throw new IllegalStateException("Failed to inject saros session manager instance"); } } Deque<IResourceDelta> stack = new LinkedList<IResourceDelta>(); stack.addAll(Arrays.asList(event.getDelta().getAffectedChildren())); while (!stack.isEmpty()) { IResourceDelta delta = stack.pop(); stack.addAll(Arrays.asList(delta.getAffectedChildren())); if (delta.getResource().getType() == IResource.FILE) { if (delta.getKind() == IResourceDelta.NO_CHANGE) continue; if ((delta.getKind() == IResourceDelta.CHANGED) && (delta.getFlags() == IResourceDelta.MARKERS)) continue; final IFile file = delta.getResource().getAdapter(IFile.class); final ISarosSession sarosSession = sarosSessionManager.getSession(); if (sarosSession == null) { if (log.isTraceEnabled()) { log.trace("Ignoring resource change without a running session for file " + file); } return; } Set<IReferencePoint> sharedReferencePoints = sarosSession.getReferencePoints(); saros.filesystem.IFile fileWrapper = ResourceConverter.convertToFile(sharedReferencePoints, file); if (fileWrapper == null) { if (log.isTraceEnabled()) { log.trace("Ignoring resource change for non-shared file " + file); } return; } for (IFileContentChangedListener listener : fileContentChangedListeners) { listener.fileContentChanged(fileWrapper); } } } }

Target:
public void resourceChanged(IResourceChangeEvent event) { if (event.getDelta() == null) return; if (sarosSessionManager == null) { initialize(); if (sarosSessionManager == null) { throw new IllegalStateException("Failed to inject saros session manager instance"); } } Deque<IResourceDelta> stack = new LinkedList<IResourceDelta>(); stack.addAll(Arrays.asList(event.getDelta().getAffectedChildren())); while (!stack.isEmpty()) { IResourceDelta delta = stack.pop(); stack.addAll(Arrays.asList(delta.getAffectedChildren())); if (delta.getResource().getType() == IResource.FILE) { if (delta.getKind() == IResourceDelta.NO_CHANGE) continue; if ((delta.getKind() == IResourceDelta.CHANGED) && (delta.getFlags() == IResourceDelta.MARKERS)) continue; final IFile file = delta.getResource().getAdapter(IFile.class); final ISarosSession sarosSession = sarosSessionManager.getSession(); if (sarosSession == null) { if (log.isTraceEnabled()) { log.trace("Ignoring resource change without a running session for file " + file); } return; } Set<IReferencePoint> sharedReferencePoints = sarosSession.getReferencePoints(); saros.filesystem.IFile fileWrapper = ResourceConverter.convertToFile(sharedReferencePoints, file); if (fileWrapper == null) { if (log.isTraceEnabled()) { log.trace("Ignoring resource change for non-shared file " + file); } return; } for (IFileContentChangedListener listener : fileContentChangedListeners) { try { listener.fileContentChanged(fileWrapper); } catch (RuntimeException e) { log.error("internal error in listener: " + listener, e); } } } } }
Source:
private GlusterVolumeRemoveBricksParameters toParameters(Action action) { GlusterVolumeRemoveBricksParameters params = new GlusterVolumeRemoveBricksParameters(); List<GlusterBrickEntity> entityBricks = new ArrayList<GlusterBrickEntity>(); for (GlusterBrick brick : action.getBricks().getGlusterBricks()) { GlusterBrickEntity entity = new GlusterBrickEntity(); entity.setBrickDirectory(brick.getBrickDir()); entity.setVolumeId(new Guid(getVolumeId())); if (brick.getId() != null) { entity.setId(new Guid(brick.getId())); } else { entity.setId(null); } if (brick.getName() != null) { String arr = brick.getName().split("\\:"); if (arr.length > 1) { entity.setServerName(arr[0]); entity.setBrickDirectory(arr[1]); } } entityBricks.add(entity); } params.setVolumeId(new Guid(getVolumeId())); params.setBricks(entityBricks); params.setCommandType(VdcActionType.StartRemoveGlusterVolumeBricks); return params; }

Target:
private GlusterVolumeRemoveBricksParameters toParameters(Action action) { GlusterVolumeRemoveBricksParameters params = new GlusterVolumeRemoveBricksParameters(); List<GlusterBrickEntity> entityBricks = new ArrayList<GlusterBrickEntity>(); for (GlusterBrick brick : action.getBricks().getGlusterBricks()) { GlusterBrickEntity entity = new GlusterBrickEntity(); entity.setBrickDirectory(brick.getBrickDir()); entity.setVolumeId(new Guid(getVolumeId())); if (brick.getName() != null) { String arr = brick.getName().split("\\:"); if (arr.length > 1) { entity.setServerName(arr[0]); entity.setBrickDirectory(arr[1]); } else { continue; } } entityBricks.add(entity); } params.setVolumeId(asGuid(getVolumeId())); params.setBricks(entityBricks); params.setCommandType(VdcActionType.StartRemoveGlusterVolumeBricks); return params; }
Source:
public QueryHistoryMetricsKey key() { if (key == null) key = new QueryHistoryMetricsKey(qry, schema, loc); return key; }

Target:
public QueryHistoryMetricsKey key() { return key; }
Source:
private void runEvictionStrategies() { final ILogger logger = this.logger(); final int forcedEvictionRetryCount = getRetryCount(); final Eviction[] evictions = new Eviction[] { new RecordStoreForcedEviction(forcedEvictionRetryCount, logger, this), new PartitionRecordStoreForcedEviction(forcedEvictionRetryCount, logger, this), new AllEntriesEviction(logger, this), new PartitionAllEntriesEviction(logger, this) }; for (Eviction eviction : evictions) { eviction.execute(); if (eviction.isSuccessful()) { return; } } }

Target:
private void runEvictionStrategies() { for (ForcedEviction eviction : WithForcedEviction.EVICTIONS) { if (eviction.execute(getRetryCount(), this, logger())) { return; } } }
Source:
private PrivateKey getPrivateKey(String alias, String password) { try { return (PrivateKey) keyStore.getKey(alias, password.toCharArray()); } catch (KeyStoreException | NoSuchAlgorithmException | UnrecoverableKeyException e) { LOGGER.debug("Unable to retrieve private key from key store", e); } return null; }

Target:
private PrivateKey getPrivateKey(String alias, String password) { try { Key key = keyStore.getKey(alias, password.toCharArray()); if (key instanceof PrivateKey) { return (PrivateKey) key; } } catch (KeyStoreException | NoSuchAlgorithmException | UnrecoverableKeyException e) { LOGGER.debug("Unable to retrieve private key from key store", e); } return null; }
Source:
private ProjectType resolveProjectType(String artifactId, String owa) { if (artifactId != null) { return ProjectType.MODULE; } else if (owa != null) { return ProjectType.OWA; } List<String> options = new ArrayList<>(Arrays.asList( FETCH_MODULE_OPTION, FETCH_OWA_OPTION )); if (projectType == null) { String choice = wizard.promptForMissingValueWithOptions("What would you like to fetch?%s", null, "", options); switch (choice) { case FETCH_MODULE_OPTION: return ProjectType.MODULE; case FETCH_OWA_OPTION: return ProjectType.OWA; } } return null; }

Target:
private ProjectType resolveProjectType(String artifactId, String owa) { ProjectType result = null; if (StringUtils.isNotBlank(artifactId)) { result = ProjectType.MODULE; } else if (StringUtils.isNotBlank(owa)) { result = ProjectType.OWA; } if (result == null) { List<String> options = new ArrayList<>(Arrays.asList( FETCH_MODULE_OPTION, FETCH_OWA_OPTION )); String choice = wizard.promptForMissingValueWithOptions("What would you like to fetch?%s", null, "", options); switch (choice) { case FETCH_MODULE_OPTION: result = ProjectType.MODULE; break; case FETCH_OWA_OPTION: result = ProjectType.OWA; break; } } return result; }
Source:
public boolean matches(final URL url) { return url.getProtocol().equals("file"); }

Target:
public boolean matches(final URL url) { return Objects.equals(url.getProtocol(), "file"); }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view; if (IS_COURSEWARE_ACCESSIBLE) { view = inflater.inflate(R.layout.fragment_course_dashboard, container, false); courseTextName = (TextView) view.findViewById(R.id.course_detail_name); courseTextDetails = (TextView) view.findViewById(R.id.course_detail_extras); headerImageView = (ImageView) view.findViewById(R.id.header_image_view); parent = (LinearLayout) view.findViewById(R.id.dashboard_detail); } else { view = inflater.inflate(R.layout.fragment_course_dashboard_disabled, container, false); errorText = (TextView) view.findViewById(R.id.error_msg); } return view; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view; if (isCoursewareAccessible) { view = inflater.inflate(R.layout.fragment_course_dashboard, container, false); courseTextName = (TextView) view.findViewById(R.id.course_detail_name); courseTextDetails = (TextView) view.findViewById(R.id.course_detail_extras); headerImageView = (ImageView) view.findViewById(R.id.header_image_view); parent = (LinearLayout) view.findViewById(R.id.dashboard_detail); } else { view = inflater.inflate(R.layout.fragment_course_dashboard_disabled, container, false); errorText = (TextView) view.findViewById(R.id.error_msg); } return view; }
Source:
private void parseUpwardsStepCount() throws ParseException { if (!isDigit(curr())) { fail(); } if (pos == input.length()) { return; } for (char current = curr(); isDigit(current) && pos < input.length() - 1; current = curr()) ; pos--; }

Target:
private void parseUpwardsStepCount() throws ParseException { if (!isDigit(curr())) { fail(); } else if (curr() == '0') { next(); if (curr() == '/' || curr() == '#' || curr() == EOF) { pos--; } else { fail(); } } for (char current = next(); isDigit(current) && pos < input.length(); current = next()) ; }
Source:
static OkHttpClient create(Logger logger) { OkHttpClient.Builder okHttpClientBuilder = new OkHttpClient.Builder(); int readTimeout = 0; try { if (!System.getProperty(READ_TIMEOUT_SEC_PROPERTY, "").isEmpty()) { readTimeout = Integer.parseInt(System.getProperty(READ_TIMEOUT_SEC_PROPERTY)); } } catch (NumberFormatException e) { readTimeout = DEFAULT_READ_TIMEOUT_MILLISECONDS; } okHttpClientBuilder.connectTimeout(CONNECT_TIMEOUT_MILLISECONDS, TimeUnit.MILLISECONDS); okHttpClientBuilder.readTimeout(readTimeout, TimeUnit.MILLISECONDS); ConnectionSpec tls = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS) .allEnabledTlsVersions() .allEnabledCipherSuites() .supportsTlsExtensions(true) .build(); okHttpClientBuilder.connectionSpecs(asList(tls, ConnectionSpec.CLEARTEXT)); X509TrustManager systemDefaultTrustManager = systemDefaultTrustManager(); okHttpClientBuilder.sslSocketFactory(systemDefaultSslSocketFactory(systemDefaultTrustManager, logger), systemDefaultTrustManager); final String proxyUser = System.getProperty("http.proxyUser", ""); if (!System.getProperty("http.proxyHost", "").isEmpty() && !proxyUser.isEmpty()) { okHttpClientBuilder.proxyAuthenticator((route, response) -> { if (response.request().header(PROXY_AUTHORIZATION) != null) { return null; } if (HttpURLConnection.HTTP_PROXY_AUTH == response.code()) { String credential = Credentials.basic(proxyUser, System.getProperty("http.proxyPassword")); return response.request().newBuilder().header(PROXY_AUTHORIZATION, credential).build(); } return null; }); } return okHttpClientBuilder.build(); }

Target:
static OkHttpClient create(Logger logger) { OkHttpClient.Builder okHttpClientBuilder = new OkHttpClient.Builder(); int readTimeout = DEFAULT_READ_TIMEOUT_MILLISECONDS; if (!System.getProperty(READ_TIMEOUT_SEC_PROPERTY, "").isEmpty()) { readTimeout = Integer.parseInt(System.getProperty(READ_TIMEOUT_SEC_PROPERTY)); } okHttpClientBuilder.connectTimeout(CONNECT_TIMEOUT_MILLISECONDS, TimeUnit.MILLISECONDS); okHttpClientBuilder.readTimeout(readTimeout, TimeUnit.MILLISECONDS); ConnectionSpec tls = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS) .allEnabledTlsVersions() .allEnabledCipherSuites() .supportsTlsExtensions(true) .build(); okHttpClientBuilder.connectionSpecs(asList(tls, ConnectionSpec.CLEARTEXT)); X509TrustManager systemDefaultTrustManager = systemDefaultTrustManager(); okHttpClientBuilder.sslSocketFactory(systemDefaultSslSocketFactory(systemDefaultTrustManager, logger), systemDefaultTrustManager); final String proxyUser = System.getProperty("http.proxyUser", ""); if (!System.getProperty("http.proxyHost", "").isEmpty() && !proxyUser.isEmpty()) { okHttpClientBuilder.proxyAuthenticator((route, response) -> { if (response.request().header(PROXY_AUTHORIZATION) != null) { return null; } if (HttpURLConnection.HTTP_PROXY_AUTH == response.code()) { String credential = Credentials.basic(proxyUser, System.getProperty("http.proxyPassword")); return response.request().newBuilder().header(PROXY_AUTHORIZATION, credential).build(); } return null; }); } return okHttpClientBuilder.build(); }
Source:
private void deleteSite() { final Blog currentBlog = WordPress.getCurrentBlog(); WordPress.getRestClientUtils().deleteSite(currentBlog.getDotComBlogId(), new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { removeBlog(); } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { handleDeleteSiteError(); } }); }

Target:
private void deleteSite() { final Blog currentBlog = WordPress.getCurrentBlog(); if (currentBlog.isDotcomFlag()) { final ProgressDialog progressDialog = ProgressDialog.show(getActivity(), "", getString(R.string.delete_site_progress), true, false); WordPress.getRestClientUtils().deleteSite(currentBlog.getDotComBlogId(), new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { progressDialog.dismiss(); removeBlog(); } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { progressDialog.dismiss(); handleDeleteSiteError(); } }); } }
Source:
private static Pattern buildPattern(final String spec) { if (spec == null) { throw new IllegalArgumentException("null package name"); } if (spec.isEmpty()) { throw new IllegalArgumentException("empty package name"); } final StringBuilder regex = new StringBuilder(); for (int idx = 0; idx < spec.length(); idx++) { char ch = spec.charAt(idx); if (ch == '*') { regex.append(".*"); } else if (ch == '.') { regex.append("\\."); } else if (idx == 0 && !Character.isJavaIdentifierStart(ch)) { throw new IllegalArgumentException("invalid package name: " + spec); } else if (!Character.isJavaIdentifierPart(ch)) { throw new IllegalArgumentException("invalid package name: " + spec); } else { regex.append(ch); } } try { return Pattern.compile(regex.toString()); } catch (PatternSyntaxException e) { throw new IllegalArgumentException("invalid package specification: " + spec, e); } }

Target:
private static Pattern buildPattern(final String spec) { if (StringUtils.isEmpty(spec)) { throw new IllegalArgumentException("empty package name"); } final StringBuilder regex = new StringBuilder(); for (int idx = 0; idx < spec.length(); idx++) { char ch = spec.charAt(idx); if (ch == '*') { regex.append(".*"); } else if (ch == '.') { regex.append("\\."); } else if (idx == 0 && !Character.isJavaIdentifierStart(ch)) { throw new IllegalArgumentException("invalid package name: " + spec); } else if (!Character.isJavaIdentifierPart(ch)) { throw new IllegalArgumentException("invalid package name: " + spec); } else { regex.append(ch); } } try { return Pattern.compile(regex.toString()); } catch (PatternSyntaxException e) { throw new IllegalArgumentException("invalid package specification: " + spec, e); } }
Source:
private void stopStateTransitionExecutor() { int numberOfAttempts = 0; while (!stateTransitionEmitterProcess.isReadyForShutdown() && numberOfAttempts < MAX_NUMBER_OF_SHUTDOWN_READINESS_CHECKS) { LOGGER.info("State transition receiver is not ready for shutdown"); numberOfAttempts++; try { Thread.sleep(DELAY_BETWEEN_SHUTDOWN_CHECKS_IN_MILLISECONDS); } catch (InterruptedException e) { handleInterruptedException(); return; } } stateTransitionMessageExecutorService.shutdown(); try { if (!stateTransitionMessageExecutorService.awaitTermination(2L, TimeUnit.SECONDS)) { stateTransitionMessageExecutorService.shutdownNow(); } LOGGER.info("State transition receiver - number of not processed messages {}", stateTransitionEmitterProcess.getNumberOfNotProcessedMessages()); } catch (InterruptedException e) { handleInterruptedException(); } }

Target:
private void stopStateTransitionExecutor() { int numberOfAttempts = 0; while (!stateTransitionEmitterProcess.isReadyForShutdown() && numberOfAttempts < MAX_NUMBER_OF_SHUTDOWN_READINESS_CHECKS) { LOGGER.info("State transition receiver is not ready for shutdown"); numberOfAttempts++; try { Thread.sleep(DELAY_BETWEEN_SHUTDOWN_CHECKS_IN_MILLISECONDS); } catch (InterruptedException e) { handleInterruptedException(); } } stateTransitionMessageExecutorService.shutdown(); try { if (!stateTransitionMessageExecutorService.awaitTermination(2L, TimeUnit.SECONDS)) { stateTransitionMessageExecutorService.shutdownNow(); } LOGGER.info("State transition receiver - number of not processed messages {}", stateTransitionEmitterProcess.getNumberOfNotProcessedMessages()); } catch (InterruptedException e) { handleInterruptedException(); } }
Source:
public Hints createHintsFromRequest(Request request) throws UnsupportedEncodingException, URISyntaxException, IOException, RepositoryConnectionException { final Optional<String> nameOptional = Optional.fromNullable(getStringAttribute(request, REPO_ATTR)); if (!nameOptional.isPresent()) { throw new RestletException(String.format( "Cannot create GeoGIG repository. Missing '%s' resource", REPO_ATTR), Status.CLIENT_ERROR_BAD_REQUEST); } final String repoName = nameOptional.get(); final Hints hints = new Hints(); hints.set(Hints.REPOSITORY_NAME, repoName); updateHintsWithParams(hints, getRequestParameters(request)); return hints; }

Target:
public static Hints createHintsFromRequest(Request request) throws UnsupportedEncodingException, URISyntaxException, IOException, RepositoryConnectionException { final Optional<String> nameOptional = Optional.fromNullable(getStringAttribute(request, REPO_ATTR)); if (!nameOptional.isPresent()) { throw new RestletException(String.format( "Cannot create GeoGIG repository. Missing '%s' resource", REPO_ATTR), Status.CLIENT_ERROR_BAD_REQUEST); } final String repoName = nameOptional.get(); final Hints hints = new Hints(); hints.set(Hints.REPOSITORY_NAME, repoName); INSTANCE.updateHintsWithParams(hints, INSTANCE.getRequestParameters(request)); return hints; }
Source:
public boolean startDeleteClaimWorkflow(String userStoreDomain, String userName, String claimURI, String profileName) throws WorkflowException { WorkflowService workflowService = IdentityWorkflowDataHolder.getInstance().getWorkflowService(); String tenant = CarbonContext.getThreadLocalCarbonContext().getTenantDomain(); String nameWithTenant = UserCoreUtil.addTenantDomainToEntry(userName, tenant); String fullyQualifiedName = UserCoreUtil.addDomainToName(nameWithTenant, userStoreDomain); Map<String, Object> wfParams = new HashMap<>(); Map<String, Object> nonWfParams = new HashMap<>(); wfParams.put(USERNAME, userName); wfParams.put(USER_STORE_DOMAIN, userStoreDomain); wfParams.put(CLAIM_URI, claimURI); wfParams.put(PROFILE_NAME, profileName); String uuid = UUID.randomUUID().toString(); boolean state = startWorkFlow(wfParams, nonWfParams, uuid); if (!Boolean.TRUE.equals(getWorkFlowCompleted()) && !state) { try { workflowService.addRequestEntityRelationships(uuid, new Entity[]{new Entity(fullyQualifiedName, "USER"), new Entity(claimURI, "CLAIM")}); } catch (InternalWorkflowException e) { log.info("No workflow associated with the operation."); } } return state; }

Target:
public boolean startDeleteClaimWorkflow(String userStoreDomain, String userName, String claimURI, String profileName) throws WorkflowException { WorkflowService workflowService = IdentityWorkflowDataHolder.getInstance().getWorkflowService(); String tenant = CarbonContext.getThreadLocalCarbonContext().getTenantDomain(); String fullyQualifiedName = UserCoreUtil.addDomainToName(userName, userStoreDomain); Map<String, Object> wfParams = new HashMap<>(); Map<String, Object> nonWfParams = new HashMap<>(); wfParams.put(USERNAME, userName); wfParams.put(USER_STORE_DOMAIN, userStoreDomain); wfParams.put(CLAIM_URI, claimURI); wfParams.put(PROFILE_NAME, profileName); String uuid = UUID.randomUUID().toString(); if (workflowService.eventEngagedWithWorkflows(UserStoreWFConstants.DELETE_USER_CLAIM_EVENT) && !Boolean.TRUE .equals(getWorkFlowCompleted()) && !isValidOperation(new Entity[]{new Entity(fullyQualifiedName, UserStoreWFConstants.ENTITY_TYPE_USER, tenant), new Entity(claimURI, UserStoreWFConstants .ENTITY_TYPE_CLAIM, tenant)})) { throw new WorkflowException("Operation is not valid."); } boolean state = startWorkFlow(wfParams, nonWfParams, uuid); if (!Boolean.TRUE.equals(getWorkFlowCompleted()) && !state) { try { workflowService.addRequestEntityRelationships(uuid, new Entity[]{new Entity(fullyQualifiedName, UserStoreWFConstants.ENTITY_TYPE_USER, tenant), new Entity(claimURI, UserStoreWFConstants .ENTITY_TYPE_CLAIM, tenant)}); } catch (InternalWorkflowException e) { if (log.isDebugEnabled()) { log.debug("No workflow associated with the operation.", e); } } } return state; }
Source:
public final boolean execute(String sql) throws SQLException { if (connection().shouldStartTransaction()) { internalExecute(connection().getStartTransactionSql()); } return internalExecute(sql); }

Target:
public boolean execute(String sql) throws SQLException { if (connection().shouldStartTransaction()) { internalExecute(connection().getStartTransactionSql()); } return internalExecute(sql); }
Source:
public static int calculateThreads(final int executorThreads, final String name) { final int optimalThreads= Math.max(BASE_OPTIMAL_THREADS, (Runtime.getRuntime().availableProcessors() + THREAD_OVERHEAD)); int threadsChosen = optimalThreads; if (executorThreads > optimalThreads) { threadsChosen = executorThreads; LOG.debug("Requested more than optimal threads. This is not necessarily an error, but you may be overallocating."); } else { if (executorThreads > 0) { LOG.warn("You requested less than optimal threads. We've ignored that."); } } LOG.debug("For factory {}, Optimal Threads {}, Configured Threads {}", name, optimalThreads, threadsChosen); return threadsChosen; }

Target:
public static int calculateThreads(final int executorThreads, final String name) { final int optimalThreads= Math.max(BASE_OPTIMAL_THREADS, (Runtime.getRuntime().availableProcessors() + THREAD_OVERHEAD)); int threadsChosen = optimalThreads; if (executorThreads > optimalThreads) { threadsChosen = executorThreads; LOG.warn("Requested more than optimal threads. This is not necessarily an error, but you may be overallocating."); } else { if (executorThreads > 0) { LOG.warn("You requested less than optimal threads. We've ignored that."); } } LOG.debug("For factory {}, Optimal Threads {}, Configured Threads {}", name, optimalThreads, threadsChosen); return threadsChosen; }
Source:
protected final Map<String, Object> parseIntoCapabilities(String[] capabilities) { Map<String, Object> capabilityMap = new HashMap<String, Object>(); final int TWO = 2; for (String eachCapability : capabilities) { String[] keyValuePair = eachCapability.split(":", 2); if (keyValuePair.length == TWO) { String value = keyValuePair[1]; Object desiredCapability = value; if (value.startsWith("'") && value.endsWith("'")) { String trimmedValue = StringUtils.mid(value, 1, value.length() - 2); if (trimmedValue.equalsIgnoreCase("true")) { desiredCapability = "true"; } else if (trimmedValue.equalsIgnoreCase("false")) { desiredCapability = "false"; } } else if (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("false")) { desiredCapability = Boolean.parseBoolean(value); } capabilityMap.put(keyValuePair[0], desiredCapability); } else { StringBuilder errMsg = new StringBuilder(); errMsg.append("Capabilities are to be provided as name value pair separated by colons. "); errMsg.append("For e.g., capabilityName:capabilityValue"); throw new IllegalArgumentException(errMsg.toString()); } } return capabilityMap; }

Target:
protected final Map<String, Object> parseIntoCapabilities(String[] capabilities) { Map<String, Object> capabilityMap = new HashMap<String, Object>(); for (String eachCapability : capabilities) { String[] keyValuePair = eachCapability.split(":", 2); if (keyValuePair.length == 2) { String value = keyValuePair[1]; Object desiredCapability = value; if (value.startsWith("'") && value.endsWith("'")) { String trimmedValue = StringUtils.mid(value, 1, value.length() - 2); if (trimmedValue.equalsIgnoreCase("true")) { desiredCapability = "true"; } else if (trimmedValue.equalsIgnoreCase("false")) { desiredCapability = "false"; } } else if (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("false")) { desiredCapability = Boolean.parseBoolean(value); } capabilityMap.put(keyValuePair[0], desiredCapability); } else { StringBuilder errMsg = new StringBuilder(); errMsg.append("Capabilities are to be provided as name value pair separated by colons. "); errMsg.append("For e.g., capabilityName:capabilityValue"); throw new IllegalArgumentException(errMsg.toString()); } } return capabilityMap; }
Source:
public Weight createWeight(IndexSearcher searcher, boolean needsScores, float boost) throws IOException { return new ConstantScoreWeight(this, 10) { @Override public Scorer scorer(LeafReaderContext context) throws IOException { NumericDocValues fields = context.reader() .getNumericDocValues(IndexFields.NDV_FLAGS); if (fields == null) { return null; } TwoPhaseIterator iterator = new TwoPhaseIterator(fields) { @Override public boolean matches() throws IOException { long flags = fields.longValue(); if (fTrueFlags != 0 && (flags & fTrueFlags) == 0) { return false; } if (fFalseFlags != 0 && (flags & fFalseFlags) != 0) { return false; } return true; } @Override public float matchCost() { return 2; } }; return new ConstantScoreScorer(this, 10, iterator); } @Override public boolean isCacheable(LeafReaderContext ctx) { return false; } }; }

Target:
public Weight createWeight(IndexSearcher searcher, boolean needsScores, float boost) throws IOException { return new ConstantScoreWeight(this, 10) { @Override public Scorer scorer(LeafReaderContext context) throws IOException { NumericDocValues fields = context.reader() .getNumericDocValues(IndexFields.NDV_FLAGS); if (fields == null) { return null; } TwoPhaseIterator iterator = new TwoPhaseIterator(fields) { @Override public boolean matches() throws IOException { long flags = fields.longValue(); if (fTrueFlags != 0 && (flags & fTrueFlags) == 0) { return false; } if (fFalseFlags != 0 && (flags & fFalseFlags) != 0) { return false; } return true; } @Override public float matchCost() { return 2; } }; return new ConstantScoreScorer(this, 10, iterator); } @Override public boolean isCacheable(LeafReaderContext ctx) { return DocValues.isCacheable(ctx, IndexFields.NDV_FLAGS); } }; }
Source:
public void fixupPartReferences(Map<Integer, Part> knownParts) { if (replacementPart instanceof PartRef) { int id = replacementPart.getId(); replacementPart = knownParts.get(id); if ((replacementPart == null) && (id > 0)) { MekHQ.getLogger().error(PartRef.class, String.format("Part %d ('%s') references missing replacement part %d", getId(), getName(), id)); } } if (parentPart instanceof PartRef) { int id = parentPart.getId(); parentPart = knownParts.get(id); if ((parentPart == null) && (id > 0)) { MekHQ.getLogger().error(PartRef.class, String.format("Part %d ('%s') references missing parent part %d", getId(), getName(), id)); } } for (int ii = childParts.size() - 1; ii >= 0; --ii) { Part childPart = childParts.get(ii); if (childPart instanceof PartRef) { Part realPart = knownParts.get(childPart.getId()); if (realPart != null) { childParts.set(ii, realPart); } else if (childPart.getId() > 0) { MekHQ.getLogger().error(PartRef.class, String.format("Part %d ('%s') references missing child part %d", getId(), getName(), childPart.getId())); childParts.remove(ii); } } } }

Target:
public void fixupPartReferences(Map<Integer, Part> knownParts) { if (replacementPart instanceof PartRef) { int id = replacementPart.getId(); replacementPart = knownParts.get(id); if ((replacementPart == null) && (id > 0)) { MekHQ.getLogger().error( String.format("Part %d ('%s') references missing replacement part %d", getId(), getName(), id)); } } if (parentPart instanceof PartRef) { int id = parentPart.getId(); parentPart = knownParts.get(id); if ((parentPart == null) && (id > 0)) { MekHQ.getLogger().error(PartRef.class, String.format("Part %d ('%s') references missing parent part %d", getId(), getName(), id)); } } for (int ii = childParts.size() - 1; ii >= 0; --ii) { Part childPart = childParts.get(ii); if (childPart instanceof PartRef) { Part realPart = knownParts.get(childPart.getId()); if (realPart != null) { childParts.set(ii, realPart); } else if (childPart.getId() > 0) { MekHQ.getLogger().error(PartRef.class, String.format("Part %d ('%s') references missing child part %d", getId(), getName(), childPart.getId())); childParts.remove(ii); } } } }
Source:
private void spawnOrb() { int xp = ThreadLocalRandom.current().nextInt(9) + 3; ExpBottleEvent event = EventFactory.getInstance() .callEvent(new ExpBottleEvent(this, xp)); ExperienceOrb orb = (ExperienceOrb) world.spawnEntity(location, EntityType.EXPERIENCE_ORB); orb.setExperience(xp); if (orb instanceof GlowExperienceOrb) { ((GlowExperienceOrb) orb).setFromBottle(true); } remove(); }

Target:
private void spawnOrb() { int xp = ThreadLocalRandom.current().nextInt(9) + 3; ExpBottleEvent event = EventFactory.getInstance() .callEvent(new ExpBottleEvent(this, xp)); xp = event.getExperience(); ExperienceOrb orb = (ExperienceOrb) world.spawnEntity(location, EntityType.EXPERIENCE_ORB); orb.setExperience(xp); if (orb instanceof GlowExperienceOrb) { ((GlowExperienceOrb) orb).setFromBottle(true); } remove(); }
Source:
protected void validateAndSetFiscalYear(CuBudgetAdjustmentDocument document, AccountingXmlDocumentEntry documentEntry) { Integer fiscalYear = documentEntry.getPostingFiscalYear(); if (ObjectUtils.isNull(fiscalYear)) { throw new RuntimeException("Fiscal year cannot be null"); } @SuppressWarnings("unchecked") List<FiscalYearFunctionControl> allowedYears = fiscalYearFunctionControlService.getBudgetAdjustmentAllowedYears(); boolean fiscalYearAllowed = allowedYears.stream() .anyMatch((fyFunctionControl) -> fiscalYear.equals(fyFunctionControl.getUniversityFiscalYear())); if (!fiscalYearAllowed) { throw new RuntimeException("Budget Adjustments are not allowed for fiscal year: " + fiscalYear); } document.setPostingYear(fiscalYear); }

Target:
protected void validateAndSetFiscalYear(CuBudgetAdjustmentDocument document, AccountingXmlDocumentEntry documentEntry) { Integer fiscalYear = documentEntry.getPostingFiscalYear(); if (ObjectUtils.isNull(fiscalYear)) { throw new ValidationException("Fiscal year cannot be null"); } @SuppressWarnings("unchecked") List<FiscalYearFunctionControl> allowedYears = fiscalYearFunctionControlService.getBudgetAdjustmentAllowedYears(); boolean fiscalYearAllowed = allowedYears.stream() .anyMatch((fyFunctionControl) -> fiscalYear.equals(fyFunctionControl.getUniversityFiscalYear())); if (!fiscalYearAllowed) { throw new ValidationException("Budget Adjustments are not allowed for fiscal year: " + fiscalYear); } document.setPostingYear(fiscalYear); }
Source:
public long writeTo(WritableByteChannel channel) throws IOException { long written = 0; if (sentBytes < sizeInBytes()) { if (bufferToSend == null) { bufferToSend = ByteBuffer.allocate(sizeExcludingBlobAndCrcSize()); writeHeader(); int crcStart = bufferToSend.position(); bufferToSend.put(blobId.toBytes()); BlobPropertiesSerDe.putBlobPropertiesToBuffer(bufferToSend, properties); bufferToSend.putInt(usermetadata.capacity()); bufferToSend.put(usermetadata); bufferToSend.putShort((short) blobType.ordinal()); bufferToSend.putLong(blobSize); crc.update(bufferToSend.array(), bufferToSend.arrayOffset() + crcStart, bufferToSend.position() - crcStart); crc.update(blob.array(), blob.arrayOffset(), blob.remaining()); crcBuf.putLong(crc.getValue()); crcBuf.flip(); bufferToSend.flip(); } if (bufferToSend.hasRemaining()) { written = channel.write(bufferToSend); } if (!bufferToSend.hasRemaining()) { written += channel.write(blob); if (!blob.hasRemaining()) { blobWriteComplete = true; } } if (currentVersion == Put_Request_Version_V3 && blobWriteComplete && crcBuf.hasRemaining()) { written += channel.write(crcBuf); } sentBytes += written; } return written; }

Target:
public long writeTo(WritableByteChannel channel) throws IOException { long written = 0; if (sentBytes < sizeInBytes()) { if (bufferToSend == null) { bufferToSend = ByteBuffer.allocate(sizeExcludingBlobAndCrcSize()); writeHeader(); int crcStart = bufferToSend.position(); bufferToSend.put(blobId.toBytes()); BlobPropertiesSerDe.putBlobPropertiesToBuffer(bufferToSend, properties); bufferToSend.putInt(usermetadata.capacity()); bufferToSend.put(usermetadata); bufferToSend.putShort((short) blobType.ordinal()); bufferToSend.putLong(blobSize); crc.update(bufferToSend.array(), bufferToSend.arrayOffset() + crcStart, bufferToSend.position() - crcStart); crc.update(blob.array(), blob.arrayOffset(), blob.remaining()); crcBuf.putLong(crc.getValue()); crcBuf.flip(); bufferToSend.flip(); } if (bufferToSend.hasRemaining()) { written = channel.write(bufferToSend); } if (!bufferToSend.hasRemaining()) { written += channel.write(blob); okayToWriteCrc = !blob.hasRemaining() && currentVersion == Put_Request_Version_V3; } if (okayToWriteCrc && crcBuf.hasRemaining()) { written += channel.write(crcBuf); } sentBytes += written; } return written; }
Source:
public Optional<Metacard> apply(InputStream inputStream, WfsMetadata metadata) { if (!isStateValid(inputStream, metadata)) { LOGGER.debug("Transformer state is invalid: {}, {}", featureType, mappingEntries); return Optional.empty(); } lookupMetacardType(metadata); if (metacardType == null) { return Optional.empty(); } Map<String, String> contextMap = new HashMap<>(); populateContextMap(inputStream, contextMap); if (CollectionUtils.isEmpty(contextMap)) { return Optional.empty(); } MetacardImpl metacard = (MetacardImpl) createMetacard(contextMap); String id = null; if (StringUtils.isBlank(metacard.getId())) { id = contextMap.get(METACARD_ID); if (StringUtils.isNotBlank(id)) { metacard.setId(id); } else { LOGGER.debug("Feature id is blank. Unable to set metacard id."); } } metacard.setSourceId(metadata.getId()); Date date = new Date(); if (metacard.getEffectiveDate() == null) { metacard.setEffectiveDate(date); } if (metacard.getCreatedDate() == null) { metacard.setCreatedDate(date); } if (metacard.getModifiedDate() == null) { metacard.setModifiedDate(date); } if (StringUtils.isBlank(metacard.getTitle())) { metacard.setTitle(id); } metacard.setContentTypeName(metacardType.getName()); try { metacard.setTargetNamespace( new URI(WfsConstants.NAMESPACE_URN_ROOT + metacardType.getName())); } catch (URISyntaxException e) { LOGGER.debug( "Unable to set Target Namespace on metacard: {}.", WfsConstants.NAMESPACE_URN_ROOT + metacardType.getName(), e); } return Optional.of(metacard); }

Target:
public Optional<Metacard> apply(InputStream inputStream, WfsMetadata metadata) { if (!isStateValid(inputStream, metadata)) { LOGGER.debug("Transformer state is invalid: {}, {}", featureType, mappingEntries); return Optional.empty(); } lookupMetacardType(metadata); if (metacardType == null) { return Optional.empty(); } Map<String, String> contextMap = new HashMap<>(); populateContextMap(inputStream, contextMap); if (CollectionUtils.isEmpty(contextMap)) { return Optional.empty(); } return Optional.of(createMetacard(contextMap, metadata.getId())); }
Source:
public void testCreateKey() throws Exception { MockWebServer server = mockEtcdJavaWebServer(); server.enqueue(new MockResponse().setBody(payloadFromResource("/keys-create.json")).setResponseCode(201)); EtcdApi etcdApi = api(server.getUrl("/")); KeysApi api = etcdApi.keysApi(); try { Key createdKey = api.createKey("hello", "world"); assertNotNull(createdKey); assertTrue(createdKey.node().key().equals("/hello")); assertTrue(createdKey.node().value().equals("world")); assertSent(server, "PUT", "/" + EtcdApiMetadata.API_VERSION + "/keys/hello"); } finally { etcdApi.close(); server.shutdown(); } }

Target:
public void testCreateKey() throws Exception { MockWebServer server = mockEtcdJavaWebServer(); server.enqueue(new MockResponse().setBody(payloadFromResource("/keys-create.json")).setResponseCode(201)); EtcdApi etcdApi = api(server.getUrl("/")); KeysApi api = etcdApi.keysApi(); try { Key createdKey = api.createKey("hello", "world"); assertNotNull(createdKey); assertTrue(createdKey.node().key().equals("/hello")); assertTrue(createdKey.node().value().equals("world")); assertSentWithFormData(server, "PUT", "/" + EtcdApiMetadata.API_VERSION + "/keys/hello", "value=world"); } finally { etcdApi.close(); server.shutdown(); } }
Source:
public Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, Account owner) { PhysicalNetworkVO physnet = _physicalNetworkDao.findById(plan.getPhysicalNetworkId()); DataCenter dc = _dcDao.findById(plan.getDataCenterId()); if (!canHandle(offering, dc.getNetworkType(), physnet)) { if (s_logger.isDebugEnabled()) { s_logger.debug("Refusing to design this network"); } return null; } NetworkVO networkObject = (NetworkVO)super.design(offering, plan, userSpecified, owner); if (networkObject == null) { return null; } networkObject.setBroadcastDomainType(Networks.BroadcastDomainType.Vsp); return networkObject; }

Target:
public Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, Account owner) { PhysicalNetworkVO physnet = _physicalNetworkDao.findById(plan.getPhysicalNetworkId()); DataCenter dc = _dcDao.findById(plan.getDataCenterId()); if (!canHandle(offering, dc.getNetworkType(), physnet)) { if (s_logger.isDebugEnabled()) { s_logger.debug("Refusing to design network using network offering " + offering.getId() + (physnet != null ? " on physical network " + physnet.getId() : "")); } return null; } NetworkVO networkObject = (NetworkVO)super.design(offering, plan, userSpecified, owner); if (networkObject == null) { return null; } networkObject.setBroadcastDomainType(Networks.BroadcastDomainType.Vsp); return networkObject; }
Source:
public static <V,T extends Throwable> hudson.remoting.Future<V> callAsync(final VirtualChannel channel, final Callable<V,T> callable) throws IOException { Future<hudson.remoting.Future<V>> future = Computer.threadPoolForRemoting.submit(new java.util.concurrent.Callable<hudson.remoting.Future<V>>() { @Override public hudson.remoting.Future<V> call() throws IOException { return channel.callAsync(callable); } }); try { return future.get(SupportPlugin.REMOTE_OPERATION_TIMEOUT_MS, TimeUnit.MILLISECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e) { throw new IOException(e); } }

Target:
public static <V,T extends Throwable> hudson.remoting.Future<V> callAsync(final VirtualChannel channel, final Callable<V,T> callable) throws IOException { Future<hudson.remoting.Future<V>> future = Computer.threadPoolForRemoting.submit(new java.util.concurrent.Callable<hudson.remoting.Future<V>>() { @Override public hudson.remoting.Future<V> call() throws IOException { return channel.callAsync(callable); } }); try { return future.get(SupportPlugin.REMOTE_OPERATION_TIMEOUT_MS, TimeUnit.MILLISECONDS); } catch (InterruptedException | ExecutionException e) { throw new IOException(e); } catch (TimeoutException te) { future.cancel(true); throw new IOException(te); } }
Source:
protected Text createFilterText(Composite parent) { filterText = new Text(parent, SWT.NONE); Dialog.applyDialogFont(filterText); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalAlignment = GridData.FILL; data.verticalAlignment = GridData.CENTER; filterText.setLayoutData(data); filterText.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.keyCode == 0x0D) { gotoSelectedElement(); dispose(); } else if (e.keyCode == SWT.ARROW_DOWN) { delegate.getTreeViewer().getTree().setFocus(); } else if (e.character == SWT.ESC) { dispose(); } } }); filterText.setText(""); filterText.addModifyListener(e -> { AtomicBoolean firstMatchFound = new AtomicBoolean(false); TreeViewer viewer = delegate.getTreeViewer(); viewer.getControl().setRedraw(false); viewer.setFilters(new ViewerFilter() { @Override public boolean select(Viewer v, Object parentElement, Object element) { boolean result = isMatch(filterText.getText(), element); if (result && element instanceof FileDiffRegion && !firstMatchFound.getAndSet(true)) { viewer.setSelection( new StructuredSelection(element)); } return result; } }); viewer.expandAll(); viewer.getControl().setRedraw(true); }); return filterText; }

Target:
protected Text createFilterText(Composite parent) { filterText = new Text(parent, SWT.NONE); Dialog.applyDialogFont(filterText); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalAlignment = GridData.FILL; data.verticalAlignment = GridData.CENTER; filterText.setLayoutData(data); filterText.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.keyCode == 0x0D) { gotoSelectedElement(); dispose(); } else if (e.keyCode == SWT.ARROW_DOWN) { delegate.getTreeViewer().getTree().setFocus(); } else if (e.character == SWT.ESC) { dispose(); } } }); filterText.setText(""); filterText.addModifyListener(e -> { AtomicBoolean firstMatchFound = new AtomicBoolean(false); TreeViewer viewer = delegate.getTreeViewer(); viewer.getControl().setRedraw(false); String text=filterText.getText(); Pattern pattern = Pattern.compile( ".*" + text.replace('?', '.').replaceAll("\\*", "\\.\\*") + ".*", Pattern.CASE_INSENSITIVE); viewer.setFilters(new ViewerFilter() { @Override public boolean select(Viewer v, Object parentElement, Object element) { boolean result = isMatch(text, pattern, element); if (result && element instanceof FileDiffRegion && !firstMatchFound.getAndSet(true)) { viewer.setSelection( new StructuredSelection(element)); } return result; } }); viewer.expandAll(); viewer.getControl().setRedraw(true); }); return filterText; }
Source:
public void cleanupOldUnusedTasks(Map<String, Set<DatastreamTask>> previousAssignmentByInstance, Map<String, List<DatastreamTask>> newAssignmentsByInstance) { Set<DatastreamTask> newTasks = newAssignmentsByInstance.values().stream().flatMap(Collection::stream).collect(Collectors.toSet()); Set<DatastreamTask> oldTasks = previousAssignmentByInstance.values().stream().flatMap(Collection::stream).collect(Collectors.toSet()); List<DatastreamTask> unusedTasks = oldTasks.stream().filter(x -> !newTasks.contains(x)).collect(Collectors.toList()); LOG.info("Deleting the unused tasks "); unusedTasks.forEach(t -> deleteConnectorTask(t.getConnectorType(), t.getDatastreamTaskName())); }

Target:
public void cleanupOldUnusedTasks(Map<String, Set<DatastreamTask>> previousAssignmentByInstance, Map<String, List<DatastreamTask>> newAssignmentsByInstance) { Set<DatastreamTask> newTasks = newAssignmentsByInstance.values().stream().flatMap(Collection::stream).collect(Collectors.toSet()); Set<DatastreamTask> oldTasks = previousAssignmentByInstance.values().stream().flatMap(Collection::stream).collect(Collectors.toSet()); List<DatastreamTask> unusedTasks = oldTasks.stream().filter(x -> !newTasks.contains(x)).collect(Collectors.toList()); LOG.info("Deleting the unused tasks ", unusedTasks); unusedTasks.forEach(t -> deleteConnectorTask(t.getConnectorType(), t.getDatastreamTaskName())); }
Source:
private List<String> objListToStrList(List<Object> oList) { List<String> sList = new ArrayList<String>(oList.size()); for (Object o : oList) { sList.add(o.toString()); } return sList; }

Target:
private static List<String> objListToStrList(List<Object> oList) { List<String> sList = new ArrayList<String>(oList.size()); for (Object o : oList) { sList.add(o.toString()); } return sList; }
Source:
void reportMultipleCallInTree(List<Type> expectedExceptions, Tree treeToVisit, Tree reportLocation, String placeToRefactor) { List<Type> checkedTypes = expectedExceptions.stream() .filter(e -> !isChecked(e)) .collect(Collectors.toList()); if (checkedTypes.isEmpty()) { return; } MethodInvocationCollector visitor = new MethodInvocationCollector(symbol -> !JUNIT_FAIL_MATCHER.matches(symbol)); treeToVisit.accept(visitor); List<Tree> invocationTree = visitor.invocationTree; if (invocationTree.size() > 1) { reportIssue(reportLocation, String.format("Refactor the %s in order to have only one invocation throwing an expected exception.", placeToRefactor), secondaryLocations(invocationTree), null); } }

Target:
void reportMultipleCallInTree(List<Type> expectedExceptions, Tree treeToVisit, Tree reportLocation, String placeToRefactor) { List<Type> checkedTypes = expectedExceptions.stream() .filter(e -> !isChecked(e)) .collect(Collectors.toList()); if (checkedTypes.isEmpty()) { return; } MethodInvocationCollector visitor = new MethodInvocationCollector(symbol -> !JUNIT_FAIL_MATCHER.matches(symbol)); treeToVisit.accept(visitor); List<Tree> invocationTree = visitor.invocationTree; if (invocationTree.size() > 1) { reportIssue(reportLocation, String.format("Refactor the %s to have only one invocation throwing an exception.", placeToRefactor), secondaryLocations(invocationTree), null); } }