auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String execute(List<String> params, EntityRef callingClient) throws Exception { Object[] processedParams = new Object[method.getParameterTypes().length]; if (isClientEntityRequired()) { if (params.size() + 1 != method.getParameterTypes().length) { throw new IllegalArgumentException("Incorrect number of parameters, expected " + (method.getParameterTypes().length - 1)); } processedParams[processedParams.length - 1] = callingClient; } else if (params.size() != method.getParameterTypes().length) { throw new IllegalArgumentException("Incorrect number of parameters, expected " + (method.getParameterTypes().length)); } for (int i = 0; i < params.size(); ++i) { try { Class<?> type = method.getParameterTypes()[i]; if (type == Float.TYPE) { processedParams[i] = Float.parseFloat(params.get(i)); } else if (type == Integer.TYPE) { processedParams[i] = Integer.parseInt(params.get(i)); } else if (type == String.class) { processedParams[i] = params.get(i); } } catch (NumberFormatException e) { throw new NumberFormatException("Bad argument '" + params.get(i) + "'"); } } if (clientHasPermissionToCallCommand(callingClient)) { try { Object result = method.invoke(provider, processedParams); return (result != null) ? result.toString() : ""; } catch (InvocationTargetException ite) { Throwable e = ite.getTargetException(); throw new IllegalArgumentException(e.getLocalizedMessage(), e); } } else { throw new IllegalArgumentException("You do not have enough permissions to execute this command"); } }

Target:
public String execute(List<String> params, EntityRef callingClient) throws InvalidCommandCallException { Object[] processedParams = new Object[method.getParameterTypes().length]; if (isClientEntityRequired()) { if (params.size() + 1 != method.getParameterTypes().length) { throw new InvalidCommandCallException("Incorrect number of parameters, expected " + (method.getParameterTypes().length - 1)); } processedParams[processedParams.length - 1] = callingClient; } else if (params.size() != method.getParameterTypes().length) { throw new InvalidCommandCallException("Incorrect number of parameters, expected " + (method.getParameterTypes().length)); } for (int i = 0; i < params.size(); ++i) { try { Class<?> type = method.getParameterTypes()[i]; if (type == Float.TYPE) { processedParams[i] = Float.parseFloat(params.get(i)); } else if (type == Integer.TYPE) { processedParams[i] = Integer.parseInt(params.get(i)); } else if (type == String.class) { processedParams[i] = params.get(i); } } catch (NumberFormatException e) { throw new InvalidCommandCallException("Bad argument '" + params.get(i) + "'", e); } } if (clientHasPermissionToCallCommand(callingClient)) { try { Object result = method.invoke(provider, processedParams); return (result != null) ? result.toString() : ""; } catch (InvocationTargetException ite) { Throwable e = ite.getTargetException(); throw new InvalidCommandCallException(e.getLocalizedMessage(), e); } catch (IllegalArgumentException | IllegalAccessException e) { throw new InvalidCommandCallException(e.getMessage(), e); } } else { throw new InvalidCommandCallException("You do not have enough permissions to execute this command"); } }
Source:
public JInterfaceInvokeExpr(Value base, SootMethodRef methodRef, List<? extends Value> args) { super(Jimple.v().newLocalBox(base), methodRef, new ValueBox[args.size()]); methodRef.declaringClass().checkLevelIgnoreResolving(SootClass.HIERARCHY); if (methodRef.isStatic()) { throw new IllegalArgumentException("Trying to create invokeinterface expression for " + "static method \"" + methodRef.getSignature() + "\". Use invokestatic instead"); } if (methodRef.name().equals(SootMethod.constructorName) || methodRef.name().equals(SootMethod.staticInitializerName)) { throw new IllegalArgumentException("Trying to create invokeinterface expression for " + "<init>/<clinit> method \"" + methodRef.getSignature() + "\". Use invokespecial instead"); } try { if (methodRef.resolve().isPrivate()) { throw new IllegalArgumentException("Trying to create invokeinterface expression for " + "private method \"" + methodRef.getSignature() + "\". Use invokespecial instead"); } } catch (SootMethodRefImpl.ClassResolutionFailedException exception) { } for (int i = 0; i < args.size(); i++) this.argBoxes[i] = Jimple.v().newImmediateBox(args.get(i)); }

Target:
public JInterfaceInvokeExpr(Value base, SootMethodRef methodRef, List<? extends Value> args) { super(Jimple.v().newLocalBox(base), methodRef, new ValueBox[args.size()]); methodRef.declaringClass().checkLevelIgnoreResolving(SootClass.HIERARCHY); if(!methodRef.declaringClass().isInterface() && !methodRef.declaringClass().isPhantom()) { throw new RuntimeException("Trying to create interface invoke expression for non-interface type: " + methodRef.declaringClass() + " Use JVirtualInvokeExpr or JSpecialInvokeExpr instead!"); } for(int i = 0; i < args.size(); i++) this.argBoxes[i] = Jimple.v().newImmediateBox(args.get(i)); }
Source:
public void render(com.google.gwt.cell.client.Cell.Context context, ForumMessage value, SafeHtmlBuilder builder) { if (value != null) { SafeHtml editButtonHtml = null; if (value.isTopic()) { editButtonHtml = QuoteTemplate.INSTANCE.topicEditButton(PageType.ForumEditTopicPageType.asHref().asString(), value.getTopicId()); } else { editButtonHtml = QuoteTemplate.INSTANCE.replyEditButton(PageType.ForumEditTopicPageType.asHref().asString(), value.getTopicId(), value.getId()); } String processedString = value.getContent(); try { processedString = MarkdownHelper.PROCESSOR.process(value.getContent()); } catch (IOException e) { new RuntimeException(e); } SafeUri link = UriUtils.fromSafeConstant(PageType.ForumThreadPageType.asHref("view", value.getTopicId().toString(), "view", Integer.toString(value.getIndex())).asString()); User author = value.getAuthor(); String companyName = ""; if (author != null) { SafeHtmlUtils.htmlEscape(FormattingHelper.getCompanyName(author)); } RENDERER.render(builder, FormattingHelper.getUserName(author), companyName, SafeHtmlUtils.fromTrustedString(processedString), FormattingHelper .getTimeSince(value.getCreated()), link, value.canFlag() ? " | " : "", value.canFlag() ? "Flag" : "", value.canEdit() ? " | " : "", value .canEdit() ? editButtonHtml : SafeHtmlUtils.EMPTY_SAFE_HTML, value.canQuote() ? " | " : "", value.canQuote() ? "Quote" : ""); } }

Target:
public void render(com.google.gwt.cell.client.Cell.Context context, ForumMessage value, SafeHtmlBuilder builder) { if (value != null) { SafeHtml editButtonHtml = null; if (value.isTopic()) { editButtonHtml = QuoteTemplate.INSTANCE.topicEditButton(PageType.ForumEditTopicPageType.asHref().asString(), value.getTopicId()); } else { editButtonHtml = QuoteTemplate.INSTANCE.replyEditButton(PageType.ForumEditTopicPageType.asHref().asString(), value.getTopicId(), value.getId()); } String processedString = value.getContent(); try { processedString = MarkdownHelper.PROCESSOR.process(value.getContent()); } catch (IOException e) { new RuntimeException(e); } SafeUri link = UriUtils.fromSafeConstant(PageType.ForumThreadPageType.asHref("view", value.getTopicId().toString(), "view", Integer.toString(value.getIndex())).asString()); User author = value.getAuthor(); String companyName = ""; if (author != null) { companyName = SafeHtmlUtils.htmlEscape(FormattingHelper.getCompanyName(author)); } RENDERER.render(builder, FormattingHelper.getUserName(author), companyName, SafeHtmlUtils.fromTrustedString(processedString), FormattingHelper .getTimeSince(value.getCreated()), link, value.canFlag() ? " | " : "", value.canFlag() ? "Flag" : "", value.canEdit() ? " | " : "", value .canEdit() ? editButtonHtml : SafeHtmlUtils.EMPTY_SAFE_HTML, value.canQuote() ? " | " : "", value.canQuote() ? "Quote" : ""); } }
Source:
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { UploadUrlResponse uploadUrl = (UploadUrlResponse) postParams.get("uploadUrl"); B2Object b2Object = (B2Object) postParams.get("b2Object"); Preconditions.checkArgument(b2Object.fileId() == null, "fileId must be null, was %s", b2Object.fileId()); Preconditions.checkArgument(b2Object.uploadTimestamp() == null, "uploadTimestamp must be null, was %s", b2Object.uploadTimestamp()); HttpRequest.Builder builder = request.toBuilder() .endpoint(uploadUrl.uploadUrl()) .replaceHeader(HttpHeaders.AUTHORIZATION, uploadUrl.authorizationToken()) .replaceHeader(B2Headers.FILE_NAME, escaper.escape(b2Object.fileName())) .replaceHeader(B2Headers.CONTENT_SHA1, b2Object.contentSha1()) .payload(b2Object.payload()); for (Map.Entry<String, String> entry : b2Object.fileInfo().entrySet()) { builder.replaceHeader(B2Headers.FILE_INFO_PREFIX + entry.getKey(), entry.getValue()); } return (R) builder.build(); }

Target:
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { UploadUrlResponse uploadUrl = (UploadUrlResponse) postParams.get("uploadUrl"); String fileName = (String) postParams.get("fileName"); Map<String, String> fileInfo = (Map<String, String>) postParams.get("fileInfo"); HttpRequest.Builder builder = request.toBuilder() .endpoint(uploadUrl.uploadUrl()) .replaceHeader(HttpHeaders.AUTHORIZATION, uploadUrl.authorizationToken()) .replaceHeader(B2Headers.FILE_NAME, escaper.escape(fileName)); for (Map.Entry<String, String> entry : fileInfo.entrySet()) { builder.replaceHeader(B2Headers.FILE_INFO_PREFIX + entry.getKey(), entry.getValue()); } return (R) builder.build(); }
Source:
public void sendMessageToAllClients(VoidMessage message, Long... exclusions) { if (nodeRole != NodeRole.SHARD) throw new ND4JIllegalStateException("Only SHARD allowed to send messages to all Clients"); final DirectBuffer buffer = message.asUnsafeBuffer(); final AtomicInteger cnt = new AtomicInteger(0); clients.values().parallelStream().filter(rc -> { if (rc.getLongHash() == this.originatorId || rc.getLongHash() == 0) { return false; } if (exclusions != null && cnt.get() < exclusions.length) { for (Long exclude : exclusions) if (exclude.longValue() == rc.getLongHash()) { cnt.incrementAndGet(); return false; } } return true; }).forEach((rc)->{ RetransmissionHandler.TransmissionStatus res; long retr = 0; boolean delivered = false; while (!delivered) { synchronized (rc.locker) { res = RetransmissionHandler.getTransmissionStatus(rc.getPublication().offer(buffer)); } switch (res) { case NOT_CONNECTED: { if (!rc.getActivated().get()) { retr++; if (retr > 20) throw new ND4JIllegalStateException( "Can't connect to Shard: [" + rc.getPublication().channel() + "]"); try { Thread.sleep(voidConfiguration.getRetransmitTimeout()); } catch (Exception e) { } } else { throw new ND4JIllegalStateException("Shards reassignment is to be implemented yet"); } } break; case ADMIN_ACTION: case BACKPRESSURE: { try { Thread.sleep(voidConfiguration.getRetransmitTimeout()); } catch (Exception e) { } } break; case MESSAGE_SENT: delivered = true; rc.getActivated().set(true); break; } } }); }

Target:
public void sendMessageToAllClients(VoidMessage message, Long... exclusions) { if (nodeRole != NodeRole.SHARD) throw new ND4JIllegalStateException("Only SHARD allowed to send messages to all Clients"); final DirectBuffer buffer = message.asUnsafeBuffer(); final AtomicInteger cnt = new AtomicInteger(0); clients.values().parallelStream().filter(rc -> { if (rc.getLongHash() == this.originatorId || rc.getLongHash() == 0) { return false; } if (exclusions != null && cnt.get() < exclusions.length) { for (Long exclude : exclusions) if (exclude.longValue() == rc.getLongHash()) { cnt.incrementAndGet(); return false; } } return true; }).forEach((rc)->{ RetransmissionHandler.TransmissionStatus res; long retr = 0; boolean delivered = false; while (!delivered) { synchronized (rc.locker) { res = RetransmissionHandler.getTransmissionStatus(rc.getPublication().offer(buffer)); } switch (res) { case NOT_CONNECTED: { if (!rc.getActivated().get()) { retr++; if (retr > 20) throw new ND4JIllegalStateException( "Can't connect to Shard: [" + rc.getPublication().channel() + "]"); try { LockSupport.parkNanos(voidConfiguration.getRetransmitTimeout() * 1000000); } catch (Exception e) { throw new RuntimeException(e); } } else { throw new ND4JIllegalStateException("Shards reassignment is to be implemented yet"); } } break; case ADMIN_ACTION: case BACKPRESSURE: { try { LockSupport.parkNanos(voidConfiguration.getRetransmitTimeout() * 1000000); } catch (Exception e) { throw new RuntimeException(e); } } break; case MESSAGE_SENT: delivered = true; rc.getActivated().set(true); break; } } }); }
Source:
protected NameSpace getGeoJsonNameSpace() { HashMap<Profile, NameSpace> profileMap = new HashMap<>(); profileMap.put(Profile.SIMPLE_STATION, NameSpace.SIMPLE_STATION); profileMap.put(Profile.SUMMARY_STATION, NameSpace.SUMMARY_STATION); profileMap.put(Profile.SUMMARY_ORGANIZATION, NameSpace.SUMMARY_ORGANIZATION); NameSpace currentNameSpace = profileMap.get(getProfile()); return currentNameSpace; }

Target:
protected NameSpace getGeoJsonNameSpace() { Profile currentProfile = getProfile(); if (currentProfile == null) { return null; } switch(currentProfile) { case SUMMARY_STATION: return NameSpace.SUMMARY_STATION; default: return NameSpace.SIMPLE_STATION; } }
Source:
public Collection<MetamodelDescriptor> provides(final Collection<Viewpoint> enabledViewpoints) { final Collection<MetamodelDescriptor> result = Lists.newArrayList(); Collection<MetamodelDescriptorProvider> providersList = providers; for (MetamodelDescriptorProvider2 provider : Iterables.filter(providersList, MetamodelDescriptorProvider2.class)) { final Collection<MetamodelDescriptor> provided = provider.provides(enabledViewpoints); if (provided != null) { result.addAll(provided); } } for (Viewpoint vp : enabledViewpoints) { for (MetamodelDescriptorProvider provider : providersList) { if (!(provider instanceof MetamodelDescriptorProvider2)) { final Collection<MetamodelDescriptor> provided = provider.provides(vp); if (provided != null) { result.addAll(provided); } } } } return result; }

Target:
public Collection<MetamodelDescriptor> provides(final Collection<Viewpoint> enabledViewpoints) { final Collection<MetamodelDescriptor> result = Sets.newLinkedHashSet(); for (MetamodelDescriptorProvider2 provider : Iterables.filter(providers, MetamodelDescriptorProvider2.class)) { final Collection<MetamodelDescriptor> provided = provider.provides(enabledViewpoints); if (provided != null) { result.addAll(provided); } } for (Viewpoint vp : enabledViewpoints) { for (MetamodelDescriptorProvider provider : providers) { if (!(provider instanceof MetamodelDescriptorProvider2)) { final Collection<MetamodelDescriptor> provided = provider.provides(vp); if (provided != null) { result.addAll(provided); } } } } return result; }
Source:
public long estimateMemorySize() { long size = SIZE_OF_QUAD_TREE_IMPL + (m_extent != null ? m_extent.estimateMemorySize() : 0) + (m_data_extent != null ? m_data_extent.estimateMemorySize() : 0) + (m_quad_tree_nodes != null ? m_quad_tree_nodes.estimateMemorySize() : 0) + (m_element_nodes != null ? m_element_nodes.estimateMemorySize() : 0) + (m_free_data != null ? m_free_data.estimateMemorySize() : 0); if (m_data != null) { size += sizeOfObjectArray(m_data.size()); for (Data data : m_data) { size += data.estimateMemorySize(); } } return size; }

Target:
public long estimateMemorySize() { long size = SIZE_OF_QUAD_TREE_IMPL + (m_extent != null ? m_extent.estimateMemorySize() : 0) + (m_data_extent != null ? m_data_extent.estimateMemorySize() : 0) + (m_quad_tree_nodes != null ? m_quad_tree_nodes.estimateMemorySize() : 0) + (m_element_nodes != null ? m_element_nodes.estimateMemorySize() : 0) + (m_free_data != null ? m_free_data.estimateMemorySize() : 0); if (m_data != null) { size += sizeOfObjectArray(m_data.size()) + m_data.size() * SIZE_OF_DATA; } return size; }
Source:
private void swapFragments(int index, boolean addToStack, Category category){ Fragment fragment = null; switch (index){ case CATEGORIES: if (mCategoriesFragment == null){ mCategoriesFragment = new MyPrioritiesCategoriesFragment(); } fragment = mCategoriesFragment; break; case GOALS: mGoalsFragment = new MyPrioritiesGoalsFragment(); fragment = mGoalsFragment; Bundle args = new Bundle(); args.putSerializable("category", category); fragment.setArguments(args); break; default: break; } if (fragment != null){ if (addToStack){ mFragmentStack.add(fragment); } if (index == CATEGORIES){ mToolbar.setTitle("My Priorities"); if (firstTransition){ getFragmentManager().beginTransaction() .setCustomAnimations(0, R.animator.fade_out_downwards) .replace(R.id.my_priorities_fragment_host, fragment) .commit(); firstTransition = false; } else{ getFragmentManager().beginTransaction() .setCustomAnimations(R.animator.fade_in, R.animator.fade_out_downwards) .replace(R.id.my_priorities_fragment_host, fragment) .commit(); } } else{ mToolbar.setTitle(category.getTitle()); getFragmentManager().beginTransaction() .setCustomAnimations(R.animator.fade_in_upwards, R.animator.fade_out) .replace(R.id.my_priorities_fragment_host, fragment) .commit(); } } }

Target:
private void swapFragments(int index, boolean addToStack, Category category){ Fragment fragment = null; switch (index){ case CATEGORIES: if (mCategoriesFragment == null){ mCategoriesFragment = new MyPrioritiesCategoriesFragment(); } fragment = mCategoriesFragment; break; case GOALS: mGoalsFragment = new MyPrioritiesGoalsFragment(); fragment = mGoalsFragment; Bundle args = new Bundle(); args.putSerializable("category", category); fragment.setArguments(args); break; default: break; } if (fragment != null){ if (addToStack){ mFragmentStack.add(fragment); } if (index == CATEGORIES){ mToolbar.setTitle(R.string.my_priorities_title); if (firstTransition){ getFragmentManager().beginTransaction() .setCustomAnimations(0, R.animator.fade_out_downwards) .replace(R.id.my_priorities_fragment_host, fragment) .commit(); firstTransition = false; } else{ getFragmentManager().beginTransaction() .setCustomAnimations(R.animator.fade_in, R.animator.fade_out_downwards) .replace(R.id.my_priorities_fragment_host, fragment) .commit(); } } else{ mToolbar.setTitle(category.getTitle()); getFragmentManager().beginTransaction() .setCustomAnimations(R.animator.fade_in_upwards, R.animator.fade_out) .replace(R.id.my_priorities_fragment_host, fragment) .commit(); } } }
Source:
private static Optional<FileStoreAttributes> readFromConfig( FileStore s) { StoredConfig userConfig = GlobalConfigCache.getInstance() .getUserConfig(); String key = getConfigKey(s); Duration resolution = Duration.ofNanos(userConfig.getTimeUnit( ConfigConstants.CONFIG_FILESYSTEM_SECTION, key, ConfigConstants.CONFIG_KEY_TIMESTAMP_RESOLUTION, UNDEFINED_DURATION.toNanos(), TimeUnit.NANOSECONDS)); if (UNDEFINED_DURATION.equals(resolution)) { return Optional.empty(); } Duration minRacyThreshold = Duration.ofNanos(userConfig.getTimeUnit( ConfigConstants.CONFIG_FILESYSTEM_SECTION, key, ConfigConstants.CONFIG_KEY_MIN_RACY_THRESHOLD, UNDEFINED_DURATION.toNanos(), TimeUnit.NANOSECONDS)); FileStoreAttributes c = new FileStoreAttributes(resolution); if (!UNDEFINED_DURATION.equals(minRacyThreshold)) { c.minimalRacyInterval = minRacyThreshold; } return Optional.of(c); }

Target:
private static Optional<FileStoreAttributes> readFromConfig( FileStore s) { StoredConfig userConfig; try { userConfig = GlobalConfigCache.getInstance().getUserConfig(); } catch (IOException | ConfigInvalidException e) { LOG.error(JGitText.get().readFileStoreAttributesFailed, e); return Optional.empty(); } String key = getConfigKey(s); Duration resolution = Duration.ofNanos(userConfig.getTimeUnit( ConfigConstants.CONFIG_FILESYSTEM_SECTION, key, ConfigConstants.CONFIG_KEY_TIMESTAMP_RESOLUTION, UNDEFINED_DURATION.toNanos(), TimeUnit.NANOSECONDS)); if (UNDEFINED_DURATION.equals(resolution)) { return Optional.empty(); } Duration minRacyThreshold = Duration.ofNanos(userConfig.getTimeUnit( ConfigConstants.CONFIG_FILESYSTEM_SECTION, key, ConfigConstants.CONFIG_KEY_MIN_RACY_THRESHOLD, UNDEFINED_DURATION.toNanos(), TimeUnit.NANOSECONDS)); FileStoreAttributes c = new FileStoreAttributes(resolution); if (!UNDEFINED_DURATION.equals(minRacyThreshold)) { c.minimalRacyInterval = minRacyThreshold; } return Optional.of(c); }
Source:
public static Var getResultVarFromFunctionCall(URI function, List<ValueExpr> args) { FUNCTION_TYPE type = SEARCH_FUNCTIONS.get(function); if (type == null) { return findBinaryResultVar(args); } else { switch(type) { case GEO: return findBinaryResultVar(args); case FREETEXT: return findLiteralResultVar(args); case TEMPORAL: return findBinaryResultVar(args); default: return findBinaryResultVar(args); } } }

Target:
public static Var getResultVarFromFunctionCall(URI function, List<ValueExpr> args) { FUNCTION_TYPE type = SEARCH_FUNCTIONS.get(function); switch (type) { case GEO: return findBinaryResultVar(args); case FREETEXT: return findLiteralResultVar(args); case TEMPORAL: return findBinaryResultVar(args); default: return findBinaryResultVar(args); } }
Source:
public void importCertToStore(String fileName, String certData, String keyStoreName) throws SecurityConfigException { try { if (keyStoreName == null) { throw new SecurityConfigException("Key Store name can't be null"); } KeyStoreManager keyMan = KeyStoreManager.getInstance(tenantId); KeyStore ks = keyMan.getKeyStore(keyStoreName); byte[] bytes = Base64.decode(certData); CertificateFactory factory = CertificateFactory.getInstance("X.509"); X509Certificate cert; try { cert = (X509Certificate) factory .generateCertificate(new ByteArrayInputStream(bytes)); } catch (CertificateException e) { log.error(e.getMessage(), e); throw new SecurityConfigException("Invalid format of the provided certificate file", e); } if (ks.getCertificateAlias(cert) != null) { return; } ks.setCertificateEntry(fileName, cert); keyMan.updateKeyStore(keyStoreName, ks); } catch (SecurityConfigException e) { throw e; } catch (Exception e) { String msg = "Error when importing cert to the keyStore"; log.error(msg, e); throw new SecurityConfigException(msg, e); } }

Target:
public void importCertToStore(String fileName, String certData, String keyStoreName) throws SecurityConfigException { try { if (keyStoreName == null) { throw new SecurityConfigException("Key Store name can't be null"); } KeyStoreManager keyMan = KeyStoreManager.getInstance(tenantId); KeyStore ks = keyMan.getKeyStore(keyStoreName); byte[] bytes = Base64.decode(certData); CertificateFactory factory = CertificateFactory.getInstance("X.509"); X509Certificate cert; try { cert = (X509Certificate) factory .generateCertificate(new ByteArrayInputStream(bytes)); } catch (CertificateException e) { log.error(e.getMessage(), e); throw new SecurityConfigException("Invalid format of the provided certificate file"); } if (ks.getCertificateAlias(cert) != null) { return; } ks.setCertificateEntry(fileName, cert); keyMan.updateKeyStore(keyStoreName, ks); } catch (SecurityConfigException e) { throw e; } catch (Exception e) { String msg = "Error when importing cert to the keyStore"; log.error(msg, e); throw new SecurityConfigException(msg, e); } }
Source:
public MetadataSegmentView( final @Coordinator DruidLeaderClient druidLeaderClient, final ObjectMapper jsonMapper, final BytesAccumulatingResponseHandler responseHandler, final BrokerSegmentWatcherConfig segmentWatcherConfig, final PlannerConfig plannerConfig ) { Preconditions.checkNotNull(plannerConfig, "plannerConfig"); this.coordinatorDruidLeaderClient = druidLeaderClient; this.jsonMapper = jsonMapper; this.responseHandler = responseHandler; this.segmentWatcherConfig = segmentWatcherConfig; this.isCacheEnabled = plannerConfig.isMetadataSegmentCacheEnable(); this.pollPeriodinMS = plannerConfig.getMetadataSegmentPollPeriod(); this.publishedSegments = isCacheEnabled ? new ConcurrentHashMap<>(1000) : new ConcurrentHashMap<>(); }

Target:
public MetadataSegmentView( final @Coordinator DruidLeaderClient druidLeaderClient, final ObjectMapper jsonMapper, final BytesAccumulatingResponseHandler responseHandler, final BrokerSegmentWatcherConfig segmentWatcherConfig, final PlannerConfig plannerConfig ) { Preconditions.checkNotNull(plannerConfig, "plannerConfig"); this.coordinatorDruidLeaderClient = druidLeaderClient; this.jsonMapper = jsonMapper; this.responseHandler = responseHandler; this.segmentWatcherConfig = segmentWatcherConfig; this.isCacheEnabled = plannerConfig.isMetadataSegmentCacheEnable(); this.pollPeriodInMS = plannerConfig.getMetadataSegmentPollPeriod(); this.publishedSegments = isCacheEnabled ? new ConcurrentHashMap<>(1000) : null; this.scheduledExec = Execs.scheduledSingleThreaded("MetadataSegmentView-Cache--%d"); }
Source:
private ArchivedCoursesTable convertToArchivedCoursesTable(List<CourseAttributes> archivedCourses) { ArchivedCoursesTable archivedCoursesTable = new ArchivedCoursesTable(); int idx = this.activeCourses.getRows().size() - 1; for (CourseAttributes course : archivedCourses) { idx++; List<ElementTag> actionsParam = new ArrayList<>(); String unarchiveLink = getInstructorCourseArchiveLink(course.getId(), false, false); ElementTag unarchivedButton = createButton("Unarchive", "btn btn-default btn-xs", "t_course_unarchive" + idx, unarchiveLink, "", false); String deleteLink = getInstructorCourseDeleteLink(course.getId(), false); Boolean hasDeletePermission = instructorsForCourses.get(course.getId()).isAllowedForPrivilege( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE); ElementTag deleteButton = createButton("Delete", "btn btn-default btn-xs course-delete-link", "t_course_delete" + idx, deleteLink, Const.Tooltips.COURSE_DELETE, !hasDeletePermission); deleteButton.setAttribute("data-course-id", course.getId()); actionsParam.add(unarchivedButton); actionsParam.add(deleteButton); ArchivedCoursesTableRow row = new ArchivedCoursesTableRow(SanitizationHelper.sanitizeForHtml(course.getId()), SanitizationHelper.sanitizeForHtml(course.getName()), SanitizationHelper.sanitizeForHtml( course.getCreatedAtDateString()), SanitizationHelper.sanitizeForHtml( course.getCreatedAtDateStamp()), SanitizationHelper.sanitizeForHtml( course.getCreatedAtFullDateTimeString()), actionsParam); archivedCoursesTable.getRows().add(row); } return archivedCoursesTable; }

Target:
private ArchivedCoursesTable convertToArchivedCoursesTable(List<CourseAttributes> archivedCourses) { ArchivedCoursesTable archivedCoursesTable = new ArchivedCoursesTable(); int idx = this.activeCourses.getRows().size() - 1; for (CourseAttributes course : archivedCourses) { idx++; List<ElementTag> actionsParam = new ArrayList<>(); String unarchiveLink = getInstructorCourseArchiveLink(course.getId(), false, false); ElementTag unarchivedButton = createButton("Unarchive", "btn btn-default btn-xs", "t_course_unarchive" + idx, unarchiveLink, "", false); String deleteLink = getInstructorCourseDeleteLink(course.getId(), false); Boolean hasDeletePermission = instructorsForCourses.get(course.getId()).isAllowedForPrivilege( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE); ElementTag deleteButton = createButton("Delete", "btn btn-default btn-xs course-delete-link", "t_course_delete" + idx, deleteLink, Const.Tooltips.COURSE_DELETE, !hasDeletePermission); deleteButton.setAttribute("data-course-id", course.getId()); actionsParam.add(unarchivedButton); actionsParam.add(deleteButton); ArchivedCoursesTableRow row = new ArchivedCoursesTableRow(SanitizationHelper.sanitizeForHtml(course.getId()), SanitizationHelper.sanitizeForHtml(course.getName()), course.getCreatedAtDateString(), course.getCreatedAtDateStamp(), course.getCreatedAtFullDateTimeString(), actionsParam); archivedCoursesTable.getRows().add(row); } return archivedCoursesTable; }
Source:
public Stage (Viewport viewport, Batch batch) { if (viewport == null) throw new IllegalArgumentException("viewport cannot be null."); if (batch == null) throw new IllegalArgumentException("batch cannot be null."); this.viewport = viewport; this.batch = batch; setRoot(new Group()); viewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true); }

Target:
public Stage (Viewport viewport, Batch batch) { if (viewport == null) throw new IllegalArgumentException("viewport cannot be null."); if (batch == null) throw new IllegalArgumentException("batch cannot be null."); this.viewport = viewport; this.batch = batch; root = new Group(); root.setStage(this); viewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true); }
Source:
public void value(File file) throws IOException { super.flush(); FileReader input = new FileReader(file); char[] buffer = new char[1024 * 4]; int n = 0; while (-1 != (n = input.read(buffer))) { out.write(buffer, 0, n); } out.flush(); }

Target:
void value(File file) throws IOException { super.flush(); FileReader input = null; try { input = new FileReader(file); IOUtils.copy(input, out); } finally { IOUtils.closeQuietly(input); } out.flush(); }
Source:
public static KafkaConsumer<String, ChangeEvent> buildKafkaConsumer(String servers, Map<String, Class<? extends ChangeEvent>> topicToClass) { Properties props = new Properties(); props.put("bootstrap.servers", servers); props.put("group.id", UUID.randomUUID().toString()); props.put("max.poll.interval.ms", "600000"); props.put("enable.auto.commit", "false"); props.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer"); props.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer"); return new KafkaConsumer<>(props, new StringDeserializer(), new JsonDeserializer<ChangeEvent>(topicToClass)); }

Target:
public static KafkaConsumer<String, ChangeEvent> buildKafkaConsumer(String servers, Map<String, Class<? extends ChangeEvent>> topicToClass) { Properties props = new Properties(); props.put("bootstrap.servers", servers); props.put("group.id", UUID.randomUUID().toString()); props.put("max.poll.interval.ms", "600000"); props.put("enable.auto.commit", "false"); return new KafkaConsumer<>(props, new StringDeserializer(), new JsonDeserializer<>(topicToClass)); }
Source:
protected Map<String, String> createProps() { Map<String, String> props = super.createProps(); url = "memory://"; props.put(HdfsSinkConnectorConfig.HDFS_URL_CONFIG, url); props.put(StorageCommonConfig.STORE_URL_CONFIG, url); props.put(HdfsSinkConnectorConfig.FLUSH_SIZE_CONFIG, "3"); props.put( StorageCommonConfig.STORAGE_CLASS_CONFIG, "io.confluent.connect.hdfs.storage.HdfsStorage" ); props.put(HdfsSinkConnectorConfig.FORMAT_CLASS_CONFIG, AvroFormat.class.getName()); props.put( PartitionerConfig.PARTITIONER_CLASS_CONFIG, DefaultPartitioner.class.getName() ); props.put(PartitionerConfig.PARTITION_FIELD_NAME_CONFIG, "int"); props.put( PartitionerConfig.PARTITION_DURATION_MS_CONFIG, String.valueOf(TimeUnit.HOURS.toMillis(1)) ); props.put(PartitionerConfig.PATH_FORMAT_CONFIG, "'year'=YYYY/'month'=MM/'day'=dd/'hour'=HH/"); props.put(PartitionerConfig.LOCALE_CONFIG, "en"); props.put(PartitionerConfig.TIMEZONE_CONFIG, "America/Los_Angeles"); props.put(HdfsSinkConnectorConfig.TOPIC_REGEX_CAPTURE_GROUP_CONFIG, "(.*)[\\.\\-](.*)"); props.put(StorageCommonConfig.TOPICS_DIR_CONFIG, "${1}/${topic}"); return props; }

Target:
protected Map<String, String> createProps() { Map<String, String> props = super.createProps(); url = "memory://"; props.put(HdfsSinkConnectorConfig.HDFS_URL_CONFIG, url); props.put(StorageCommonConfig.STORE_URL_CONFIG, url); props.put(HdfsSinkConnectorConfig.FLUSH_SIZE_CONFIG, "3"); props.put( StorageCommonConfig.STORAGE_CLASS_CONFIG, "io.confluent.connect.hdfs.storage.HdfsStorage" ); props.put(HdfsSinkConnectorConfig.FORMAT_CLASS_CONFIG, AvroFormat.class.getName()); props.put( PartitionerConfig.PARTITIONER_CLASS_CONFIG, DefaultPartitioner.class.getName() ); props.put(PartitionerConfig.PARTITION_FIELD_NAME_CONFIG, "int"); props.put( PartitionerConfig.PARTITION_DURATION_MS_CONFIG, String.valueOf(TimeUnit.HOURS.toMillis(1)) ); props.put(PartitionerConfig.PATH_FORMAT_CONFIG, "'year'=YYYY/'month'=MM/'day'=dd/'hour'=HH/"); props.put(PartitionerConfig.LOCALE_CONFIG, "en"); props.put(PartitionerConfig.TIMEZONE_CONFIG, "America/Los_Angeles"); props.put(HdfsSinkConnectorConfig.TOPIC_CAPTURE_GROUPS_REGEX_CONFIG, "(.*)[\\.\\-](.*)"); props.put(StorageCommonConfig.TOPICS_DIR_CONFIG, "${1}/${topic}"); return props; }
Source:
private void createComponent() { if (multipleSelection) schemaTable = CheckboxTableViewer.newCheckList(page, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); else schemaTable = CheckboxTableViewer.newCheckList(page, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER | SWT.BORDER); schemaTable.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { return element.toString(); } }); schemaTable.setContentProvider(ArrayContentProvider.getInstance()); GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1); layoutData.widthHint = SWT.DEFAULT; layoutData.heightHint = 8 * schemaTable.getTable().getItemHeight(); schemaTable.getControl().setLayoutData(layoutData); schemaTable.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { setPageComplete(validate()); } }); schemaTable.addFilter(new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { String value = (String) element; if (value.equalsIgnoreCase("information_schema") || value.startsWith("pg_")) return false; return true; } }); setPageComplete(false); page.layout(true, true); }

Target:
private void createComponent() { if (multipleSelection) schemaTable = CheckboxTableViewer.newCheckList(page, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); else schemaTable = CheckboxTableViewer.newCheckList(page, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); schemaTable.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { return element.toString(); } }); schemaTable.setContentProvider(ArrayContentProvider.getInstance()); GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1); layoutData.widthHint = SWT.DEFAULT; layoutData.heightHint = 8 * schemaTable.getTable().getItemHeight(); schemaTable.getControl().setLayoutData(layoutData); schemaTable.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { if (event.getChecked() && (!multipleSelection)) { schemaTable.setAllChecked(false); schemaTable.setCheckedElements(new Object[] { event.getElement() }); } setPageComplete(validate()); } }); setPageComplete(false); page.layout(true, true); }
Source:
public Map<String, Boolean> getPermissions() { return Collections.unmodifiableMap(permissions); }

Target:
public Set<String> getPermissions() { return Collections.unmodifiableSet(permissions.keySet()); }
Source:
private void startImportingKeys() { boolean isEncrypted; try { isEncrypted = isEncryptedFile(mCurrentUri); } catch (IOException e) { e.printStackTrace(); Notify.create(mImportActivity, R.string.error_bad_data, Style.ERROR).show(); return; } if (isEncrypted) { Intent intent = new Intent(getActivity(), DecryptActivity.class); intent.setAction(DecryptActivity.ACTION_DECRYPT_FILE_AND_RETURN); intent.setData(mCurrentUri); startActivityForResult(intent, REQUEST_CODE_IMPORT_ENCRYPTED_KEY); } else { mImportActivity.loadCallback(new BytesLoaderState(null, mCurrentUri)); } }

Target:
private void startImportingKeys() { boolean isEncrypted; try { isEncrypted = FileHelper.isEncryptedFile(mImportActivity, mCurrentUri); } catch (IOException e) { Log.e(Constants.TAG, "Error opening file", e); Notify.create(mImportActivity, R.string.error_bad_data, Style.ERROR).show(); return; } if (isEncrypted) { Intent intent = new Intent(mImportActivity, DecryptActivity.class); intent.setAction(Intent.ACTION_VIEW); intent.setData(mCurrentUri); startActivity(intent); } else { mImportActivity.loadCallback(new BytesLoaderState(null, mCurrentUri)); } }
Source:
public void saveObs_ShouldEditObsWithEditReasonComplexConceptANdRequestWhichIsAnInstanceOfMultiHTTPServletRequest() { MockHttpSession mockSession = new MockHttpSession(); MockMultipartHttpServletRequest mockRequest = new MockMultipartHttpServletRequest(); mockRequest.addParameter("saveObs", "saveObs"); mockRequest.setSession(mockSession); when(obsErrors.hasErrors()).thenReturn(false); final String fileName = "test.txt"; final byte[] content = "Hello World".getBytes(); MockMultipartFile mockMultipartFile = new MockMultipartFile("complexDataFile", fileName, "text/plain", content); mockRequest.addFile(mockMultipartFile); when(obsService.saveObs(mockObsWithComplexConcept, "Test Edit Reason")).thenReturn( RadiologyTestData.getEditedMockObs()); radiologyObsFormController.saveObs(mockRequest, null, "Test Edit Reason", mockRadiologyOrder, mockObsWithComplexConcept, obsErrors); assertThat(mockSession.getAttribute(WebConstants.OPENMRS_MSG_ATTR), is(notNullValue())); assertThat((String) mockSession.getAttribute(WebConstants.OPENMRS_MSG_ATTR), is("Obs.saved")); }

Target:
public void saveObs_ShouldEditObsWithEditReasonComplexConceptANdRequestWhichIsAnInstanceOfMultiHTTPServletRequest() { MockHttpSession mockSession = new MockHttpSession(); MockMultipartHttpServletRequest mockRequest = new MockMultipartHttpServletRequest(); mockRequest.addParameter("saveObs", "saveObs"); mockRequest.setSession(mockSession); final String fileName = "test.txt"; final byte[] content = "Hello World".getBytes(); MockMultipartFile mockMultipartFile = new MockMultipartFile("complexDataFile", fileName, "text/plain", content); mockRequest.addFile(mockMultipartFile); when(obsErrors.hasErrors()).thenReturn(false); when(obsService.saveObs(mockObsWithComplexConcept, "Test Edit Reason")).thenReturn( RadiologyTestData.getEditedMockObs()); radiologyObsFormController.saveObs(mockRequest, null, "Test Edit Reason", mockRadiologyOrder, mockObsWithComplexConcept, obsErrors); assertThat(mockSession.getAttribute(WebConstants.OPENMRS_MSG_ATTR), is(notNullValue())); assertThat((String) mockSession.getAttribute(WebConstants.OPENMRS_MSG_ATTR), is("Obs.saved")); }
Source:
public static void write(Serializable ob, File outputCheck) { try { Serializable o = ob; if (outputCheck.getParentFile() != null) outputCheck.getParentFile().mkdirs(); outputCheck.createNewFile(); ObjectOutput output = getOutput(outputCheck.getPath()); try { output.writeObject(o); } finally { output.close(); } } catch (IOException ex) { logger.error("Cannot write to output." + ex); } }

Target:
public static void write(Serializable ob, File outputCheck) { try { Serializable o = ob; if (outputCheck.getParentFile() != null) outputCheck.getParentFile().mkdirs(); outputCheck.createNewFile(); ObjectOutput output = getOutput(outputCheck.getPath()); try { output.writeObject(o); } finally { output.close(); } } catch (IOException ex) { System.err.println("Cannot write to output." + ex); } }
Source:
protected ConfigurationBuilder clusterConfig() { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false); builder.jmxStatistics().enable(); return hotRodCacheConfiguration(builder); }

Target:
protected ConfigurationBuilder clusterConfig() { ConfigurationBuilder builder = super.clusterConfig(); builder.jmxStatistics().enable(); return hotRodCacheConfiguration(builder); }
Source:
public Package getSelectedPackage() { if (packages.size() == 0) { return null; } return packages.get(selectedPackage); }

Target:
public Package getSelectedPackage() { if (packages.isEmpty()) { return null; } return packages.get(selectedPackage); }
Source:
public boolean entityInteract(GlowPlayer player, InteractEntityMessage message) { super.entityInteract(player, message); if (player.getGameMode().equals(GameMode.SPECTATOR)) return false; if (player.getItemInHand() == null) return false; switch (player.getItemInHand().getType()) { case SHEARS: if (isSheared()) return false; if (!player.getGameMode().equals(GameMode.CREATIVE)) { ItemStack shears = player.getItemInHand(); if (shears.getDurability() < 238) { shears.setDurability((short) (shears.getDurability() + 1)); } else { player.getInventory().clear(player.getInventory().getHeldItemSlot()); } } getWorld().playSound(getLocation(), Sound.ENTITY_SHEEP_SHEAR, 1, 1); Random r = new Random(); getWorld().dropItemNaturally(getLocation(), new ItemStack(Material.WOOL, r.nextInt(3) + 1, getColor().getWoolData())); setSheared(true); return true; case INK_SACK: { Dye dye = (Dye) player.getItemInHand().getData(); DyeColor color = dye.getColor(); SheepDyeWoolEvent event = new SheepDyeWoolEvent(this, color); if (event.isCancelled()) return false; color = event.getColor(); if (color.equals(getColor())) { return false; } if (!player.getGameMode().equals(GameMode.CREATIVE)) { if (player.getItemInHand().getAmount() > 1) { player.getItemInHand().setAmount(player.getItemInHand().getAmount() - 1); } else { player.getInventory().clear(player.getInventory().getHeldItemSlot()); } } setColor(color); return true; } default: return false; } }

Target:
public boolean entityInteract(GlowPlayer player, InteractEntityMessage message) { super.entityInteract(player, message); if (!isAdult()) return false; if (player.getGameMode().equals(GameMode.SPECTATOR)) return false; if (player.getItemInHand() == null) return false; switch (player.getItemInHand().getType()) { case SHEARS: if (isSheared()) return false; if (!player.getGameMode().equals(GameMode.CREATIVE)) { ItemStack shears = player.getItemInHand(); if (shears.getDurability() < 238) { shears.setDurability((short) (shears.getDurability() + 1)); } else { player.getInventory().clear(player.getInventory().getHeldItemSlot()); } } getWorld().playSound(getLocation(), Sound.ENTITY_SHEEP_SHEAR, 1, 1); Random r = new Random(); getWorld().dropItemNaturally(getLocation(), new ItemStack(Material.WOOL, r.nextInt(3) + 1, getColor().getWoolData())); setSheared(true); return true; case INK_SACK: { Dye dye = (Dye) player.getItemInHand().getData(); DyeColor color = dye.getColor(); SheepDyeWoolEvent event = new SheepDyeWoolEvent(this, color); if (event.isCancelled()) return false; color = event.getColor(); if (color.equals(getColor())) { return false; } if (!player.getGameMode().equals(GameMode.CREATIVE)) { if (player.getItemInHand().getAmount() > 1) { player.getItemInHand().setAmount(player.getItemInHand().getAmount() - 1); } else { player.getInventory().clear(player.getInventory().getHeldItemSlot()); } } setColor(color); return true; } default: return false; } }
Source:
public void testInvertMap() { final Map<String, String> in = new HashMap<>(5, 1); in.put("1", "A"); in.put("2", "B"); in.put("3", "C"); in.put("4", "D"); in.put("5", "E"); final Set<String> inKeySet = new HashSet<>(in.keySet()); final Set<String> inValSet = new HashSet<>(in.values()); final Map<String, String> out = MapUtils.invertMap(in); final Set<String> outKeySet = new HashSet<>(out.keySet()); final Set<String> outValSet = new HashSet<>(out.values()); assertTrue( inKeySet.equals( outValSet )); assertTrue( inValSet.equals( outKeySet )); assertEquals( "1", out.get("A")); assertEquals( "2", out.get("B")); assertEquals( "3", out.get("C")); assertEquals( "4", out.get("D")); assertEquals( "5", out.get("E")); Map<String, String> emptyMap = new HashMap<>(); Map<String, String> resultMap = MapUtils.invertMap(emptyMap); assertEquals(emptyMap, resultMap); try { MapUtils.invertMap(null); fail("map"); } catch (final NullPointerException ex) { } }

Target:
public void testInvertMap() { final Map<String, String> in = new HashMap<>(5, 1); in.put("1", "A"); in.put("2", "B"); in.put("3", "C"); in.put("4", "D"); in.put("5", "E"); final Set<String> inKeySet = new HashSet<>(in.keySet()); final Set<String> inValSet = new HashSet<>(in.values()); final Map<String, String> out = MapUtils.invertMap(in); final Set<String> outKeySet = new HashSet<>(out.keySet()); final Set<String> outValSet = new HashSet<>(out.values()); assertEquals(inKeySet, outValSet); assertEquals(inValSet, outKeySet); assertEquals("1", out.get("A")); assertEquals("2", out.get("B")); assertEquals("3", out.get("C")); assertEquals("4", out.get("D")); assertEquals("5", out.get("E")); }
Source:
private void rescheduleRunnable(long delayMillis) { if (started && !stopRequested) { try { scheduledExec.schedule(getRecordRunnable(), delayMillis, TimeUnit.MILLISECONDS); } catch (RejectedExecutionException e) { log.info( "Rejecting fetch records runnable submission, worker for partition[%s] is not in a valid state", streamPartition.getPartitionId() ); } } else { log.info("Worker for partition[%s] has been stopped", streamPartition.getPartitionId()); } }

Target:
private void rescheduleRunnable(long delayMillis) { if (started && !stopRequested) { try { scheduledExec.schedule(getRecordRunnable(), delayMillis, TimeUnit.MILLISECONDS); } catch (RejectedExecutionException e) { log.warn( e, "Caught RejectedExecutionException, KinesisRecordSupplier for partition[%s] has likely temporarily shutdown the ExecutorService." + "This is expected behavior after calling seek(), seekToEarliest() and seekToLatest()", streamPartition.getPartitionId() ); } } else { log.info("Worker for partition[%s] has been stopped", streamPartition.getPartitionId()); } }
Source:
public void shutdown() { try ( ErrorHandler errorHandler = new ErrorHandler( "Error when trying to shutdown cluster" ) ) { shutdownCoreMembers( errorHandler ); shutdownReadReplicas( errorHandler ); } }

Target:
public void shutdown() { try ( ErrorHandler errorHandler = new ErrorHandler( "Error when trying to shutdown cluster" ) ) { shutdownReadReplicas( errorHandler ); shutdownCoreMembers( errorHandler ); } }
Source:
private List<ApplicationDeployedEvent> getApplicationDeployedEvents() { List<Deployment> deployments = deploymentConverter.from(repositoryService .createDeploymentQuery() .list()); List<ApplicationDeployedEvent> applicationDeployedEvents = new ArrayList<>(); for (Deployment deployment : deployments) { if(deployment.getName().equals(APPLICATION_DEPLOYED_EVENT_NAME)) { ApplicationDeployedEventImpl applicationDeployedEvent = new ApplicationDeployedEventImpl(deployment); applicationDeployedEvents.add(applicationDeployedEvent); for (ProcessRuntimeEventListener<ApplicationDeployedEvent> listener : listeners) { listener.onEvent(applicationDeployedEvent); } } } return applicationDeployedEvents; }

Target:
private List<ApplicationDeployedEvent> getApplicationDeployedEvents() { List<Deployment> deployments = deploymentConverter.from(repositoryService .createDeploymentQuery() .deploymentName(APPLICATION_DEPLOYMENT_NAME) .list()); List<ApplicationDeployedEvent> applicationDeployedEvents = new ArrayList<>(); for (Deployment deployment : deployments) { ApplicationDeployedEventImpl applicationDeployedEvent = new ApplicationDeployedEventImpl(deployment); applicationDeployedEvents.add(applicationDeployedEvent); } return applicationDeployedEvents; }
Source:
private boolean isIsoVersionSupported(Version isoVersion, OVirtNodeInfo Info) { boolean result = false; Version supported = new Version(Info.minimumVersion); if (isoVersion.compareTo(supported) > 0) { result = true; } return result; }

Target:
private static boolean isIsoVersionSupported(Version isoVersion, OVirtNodeInfo Info) { boolean result = false; Version supported = new Version(Info.minimumVersion); if (isoVersion.compareTo(supported) > 0) { result = true; } return result; }
Source:
public static Object createMessageParser(String className, SecorConfig config) throws Exception { Class<?> clazz = Class.forName(className); for (Constructor<?> ctor : clazz.getConstructors()) { if (config != null) { Class<?>[] paramTypes = ctor.getParameterTypes(); if (paramTypes.length == 1) { Object[] args = {config}; return ctor.newInstance(args); } } else { return ctor.newInstance(); } } throw new IllegalArgumentException("Class not found " + className); }

Target:
public static Object createMessageParser(String className, SecorConfig config) throws Exception { Class<?> clazz = Class.forName(className); for (Constructor<?> ctor : clazz.getConstructors()) { Class<?>[] paramTypes = ctor.getParameterTypes(); if (paramTypes.length == 1) { Object[] args = {config}; return ctor.newInstance(args); } } throw new IllegalArgumentException("Class not found " + className); }