auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private MethodSpec createToContentValuesMethod(ExecutableElement method, Map<String, ExecutableElement> properties) { MethodSpec.Builder builder = MethodSpec.methodBuilder(method.getSimpleName().toString()) .addModifiers(PUBLIC) .returns(CONTENT_VALUES) .addStatement("$T values = new $T($L)", CONTENT_VALUES, CONTENT_VALUES, properties.size()); for (Map.Entry<String, ExecutableElement> entry : properties.entrySet()) { String name = entry.getKey(); ExecutableElement element = entry.getValue(); TypeName type = TypeName.get(element.getReturnType()); if (getCursorMethod(type) == null) { throw new IllegalArgumentException(String.format("Property \"%s\" has type " + "\"%s\" that can't be put into ContentValues.", name, type)); } String columnName = getColumnName(element); if (columnName == null) columnName = entry.getKey(); builder.addStatement("values.put($S, $L())", columnName, name); } return builder.addStatement("return values") .build(); }

Target:
private MethodSpec createToContentValuesMethod(ExecutableElement method, Map<String, ExecutableElement> properties) { MethodSpec.Builder builder = MethodSpec.methodBuilder(method.getSimpleName().toString()) .addModifiers(PUBLIC) .returns(CONTENT_VALUES) .addStatement("$1T values = new $1T($2L)", CONTENT_VALUES, properties.size()); for (Map.Entry<String, ExecutableElement> entry : properties.entrySet()) { String name = entry.getKey(); ExecutableElement element = entry.getValue(); TypeName type = TypeName.get(element.getReturnType()); if (getCursorMethod(type) == null) { throw new IllegalArgumentException(String.format("Property \"%s\" has type " + "\"%s\" that can't be put into ContentValues.", name, type)); } String columnName = getColumnName(element); if (columnName == null) columnName = entry.getKey(); builder.addStatement("values.put($S, $L())", columnName, name); } return builder.addStatement("return values") .build(); }
Source:
private List<SectionMatcher> getLocalAccessSections() { List<SectionMatcher> sm = localAccessSections; if (sm == null) { Collection<AccessSection> fromConfig = config.getAccessSections(); sm = new ArrayList<SectionMatcher>(fromConfig.size()); for (AccessSection section : fromConfig) { if (isAllProjects) { final List<Permission> permissions = section.getPermissions(); section = new AccessSection(section.getName()); section.setPermissions(permissions); for (final String permissionName : Permission.getPermissionNames()) { if (!Permission.canBeOnAllProjects(section.getName(), permissionName)) { section.removePermission(permissionName); } } } SectionMatcher matcher = SectionMatcher.wrap(section); if (matcher != null) { sm.add(matcher); } } localAccessSections = sm; } return sm; }

Target:
private List<SectionMatcher> getLocalAccessSections() { List<SectionMatcher> sm = localAccessSections; if (sm == null) { Collection<AccessSection> fromConfig = config.getAccessSections(); sm = new ArrayList<SectionMatcher>(fromConfig.size()); for (AccessSection section : fromConfig) { if (isAllProjects) { section = cloneAccessSection(section); for (final String permissionName : Permission.getPermissionNames()) { if (!Permission.canBeOnAllProjects(section.getName(), permissionName)) { section.removePermission(permissionName); } } } SectionMatcher matcher = SectionMatcher.wrap(section); if (matcher != null) { sm.add(matcher); } } localAccessSections = sm; } return sm; }
Source:
public void setTransformAnimated( final Matrix newTransform, long durationMs, @Nullable final Runnable onAnimationComplete) { FLog.v(getLogTag(), "setTransformAnimated: duration %d ms", durationMs); stopAnimation(); Preconditions.checkArgument(durationMs > 0); Preconditions.checkState(!isAnimating()); setAnimating(true); mValueAnimator.setDuration(durationMs); getTransform().getValues(getStartValues()); newTransform.getValues(getStopValues()); mValueAnimator.addUpdateListener((valueAnimator) -> { calculateInterpolation(getWorkingTransform(), (float) valueAnimator.getAnimatedValue()); AnimatedZoomableController.super.setTransform(getWorkingTransform()); }); mValueAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationCancel(Animator animation) { FLog.v(getLogTag(), "setTransformAnimated: animation cancelled"); onAnimationStopped(); } @Override public void onAnimationEnd(Animator animation) { FLog.v(getLogTag(), "setTransformAnimated: animation finished"); onAnimationStopped(); } private void onAnimationStopped() { if (onAnimationComplete != null) { onAnimationComplete.run(); } setAnimating(false); getDetector().restartGesture(); } }); mValueAnimator.start(); }

Target:
public void setTransformAnimated( final Matrix newTransform, long durationMs, @Nullable final Runnable onAnimationComplete) { FLog.v(getLogTag(), "setTransformAnimated: duration %d ms", durationMs); stopAnimation(); Preconditions.checkArgument(durationMs > 0); Preconditions.checkState(!isAnimating()); setAnimating(true); mValueAnimator.setDuration(durationMs); getTransform().getValues(getStartValues()); newTransform.getValues(getStopValues()); mValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { calculateInterpolation(getWorkingTransform(), (float) valueAnimator.getAnimatedValue()); AnimatedZoomableController.super.setTransform(getWorkingTransform()); } }); mValueAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationCancel(Animator animation) { FLog.v(getLogTag(), "setTransformAnimated: animation cancelled"); onAnimationStopped(); } @Override public void onAnimationEnd(Animator animation) { FLog.v(getLogTag(), "setTransformAnimated: animation finished"); onAnimationStopped(); } private void onAnimationStopped() { if (onAnimationComplete != null) { onAnimationComplete.run(); } setAnimating(false); getDetector().restartGesture(); } }); mValueAnimator.start(); }
Source:
private TransactionManager tryToCreateTransactionManager(AtlasDbEteConfiguration config, Environment environment) throws InterruptedException { if (config.getAtlasDbConfig().initializeAsync()) { return createTransactionManager(config.getAtlasDbConfig(), environment, config.getAtlasDbRuntimeConfig()); } else { return createTransactionManagerWithRetry(config.getAtlasDbConfig(), config.getAtlasDbRuntimeConfig(), environment ); } }

Target:
private TransactionManager tryToCreateTransactionManager(AtlasDbEteConfiguration config, Environment environment) throws InterruptedException { if (config.getAtlasDbConfig().initializeAsync()) { return createTransactionManager(config.getAtlasDbConfig(), config.getAtlasDbRuntimeConfig(), environment); } else { return createTransactionManagerWithRetry(config.getAtlasDbConfig(), config.getAtlasDbRuntimeConfig(), environment); } }
Source:
private IProject getSingleProject() { IProject result= null; for (IPackageFragmentRoot fPackageFragmentRoot : fPackageFragmentRoots) { if (result == null) { result= fPackageFragmentRoot.getJavaProject().getProject(); } else if (!result.equals(fPackageFragmentRoot.getJavaProject().getProject())) { return null; } } return result; }

Target:
private IProject getSingleProject() { IProject result= null; for (IPackageFragmentRoot root : fPackageFragmentRoots) { if (result == null) { result= root.getJavaProject().getProject(); } else if (!result.equals(root.getJavaProject().getProject())) { return null; } } return result; }
Source:
public BlobStoreStatsTest(boolean isLogSegmented) throws InterruptedException, IOException, StoreException { tempDir = StoreTestUtils.createTempDirectory("indexDir-" + UtilsTest.getRandomString(10)); state = new CuratedLogIndexState(isLogSegmented, tempDir); DiskIOScheduler diskIOScheduler = new DiskIOScheduler(null); blobStoreStats = new BlobStoreStats(state.index, state.time, diskIOScheduler); }

Target:
public BlobStoreStatsTest(boolean isLogSegmented) throws InterruptedException, IOException, StoreException { tempDir = StoreTestUtils.createTempDirectory("blobStoreStatsDir-" + UtilsTest.getRandomString(10)); state = new CuratedLogIndexState(isLogSegmented, tempDir); blobStoreStats = new BlobStoreStats(state.index, state.time, DISK_IO_SCHEDULER); }
Source:
public void buildVmVideoCards() { boolean videoCardOverridden = vm.isRunOnce() && vm.getDefaultDisplayType() != null; boolean isHeadlessMode = vm.getDefaultDisplayType() == DisplayType.none; if (videoCardOverridden) { if(isHeadlessMode) { return; } buildVmVideoDeviceOverridden(); } else { buildVmVideoDevicesFromDb(); } }

Target:
public void buildVmVideoCards() { boolean videoCardOverridden = vm.isRunOnce() && vm.getDefaultDisplayType() != null; if (videoCardOverridden) { if (vm.getDefaultDisplayType() == DisplayType.none) { return; } buildVmVideoDeviceOverridden(); } else { buildVmVideoDevicesFromDb(); } }
Source:
public void finishAnnouncing() throws SegmentLoadingException { finished = true; if (startedAnnouncing != null && (startedAnnouncing.isDone() || !startedAnnouncing.cancel(false))) { log.info("Waiting for background segment announcing task to complete"); try { doneAnnouncing.get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new SegmentLoadingException(e, "Loading Interrupted"); } catch (ExecutionException e) { throw new SegmentLoadingException(e.getCause(), "Background Announcing Task Failed"); } } else { try { announcer.announceSegments(queue); } catch (Exception e) { throw new SegmentLoadingException(e, "Failed to announce segments[%s]", queue); } } log.info("Completed background segment announcing"); }

Target:
public void finishAnnouncing() throws SegmentLoadingException { synchronized (lock) { finished = true; try { final List<DataSegment> segments = Lists.newLinkedList(); queue.drainTo(segments); announcer.announceSegments(segments); } catch (Exception e) { throw new SegmentLoadingException(e, "Failed to announce segments[%s]", queue); } try { if (startedAnnouncing != null) { startedAnnouncing.cancel(false); } if (doneAnnouncing.isDone()) { doneAnnouncing.get(); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new SegmentLoadingException(e, "Loading Interrupted"); } catch (ExecutionException e) { throw new SegmentLoadingException(e.getCause(), "Background Announcing Task Failed"); } } log.info("Completed background segment announcing"); }
Source:
public boolean isSuccess(CompletionStage<Void> future) { try { FunctionalTestUtils.await(future); return true; } catch (Error e) { return false; } }

Target:
public boolean isSuccess(CompletionStage<Void> future) { try { FunctionalTestUtils.await(future); return true; } catch (Throwable e) { return false; } }
Source:
private static boolean isPlugin(Path path) { Path parent = path.getParent(); while (parent != null) { if (parent.getName().equals("plugins")) { return true; } parent = parent.getParent(); } return false; }

Target:
private static boolean isPlugin(Path path) { Path parent = path.getParent(); while (parent != null) { if (ConfigConstants.DEFAULT_FLINK_PLUGINS_DIRS.equals(parent.getName())) { return true; } parent = parent.getParent(); } return false; }
Source:
private void dispatchMethod(MicroservicesRegistryImpl currentMicroservicesRegistry, Request request, Response response) throws Exception { HttpUtil.setConnectionHeader(request, response); PatternPathRouter.RoutableDestination<HttpResourceModel> destination = currentMicroservicesRegistry. getMetadata(). getDestinationMethod(request.getUri(), request.getHttpMethod(), request.getContentType(), request.getAcceptTypes()); HttpResourceModel resourceModel = destination.getDestination(); response.setMediaType(Util.getResponseType(request.getAcceptTypes(), resourceModel.getProducesMediaTypes())); InterceptorExecutor annotationFilterExecutor = new InterceptorExecutor(); Method method = resourceModel.getMethod(); annotationFilterExecutor.processRequestInterceptors(currentMicroservicesRegistry, method, request); HttpMethodInfoBuilder httpMethodInfoBuilder = new HttpMethodInfoBuilder(). httpResourceModel(resourceModel). httpRequest(request). httpResponder(response). requestInfo(destination.getGroupNameValues()); HttpMethodInfo httpMethodInfo = httpMethodInfoBuilder.build(); if (httpMethodInfo.isStreamingSupported()) { while (!(request.isEmpty() && request.isEomAdded())) { httpMethodInfo.chunk(request.getMessageBody()); } httpMethodInfo.end(); } else { httpMethodInfo.invoke(request, destination); } annotationFilterExecutor.processResponseInterceptors(currentMicroservicesRegistry, method, request, response); }

Target:
private void dispatchMethod(MicroservicesRegistryImpl currentMicroservicesRegistry, Request request, Response response) throws Exception { HttpUtil.setConnectionHeader(request, response); PatternPathRouter.RoutableDestination<HttpResourceModel> destination = currentMicroservicesRegistry. getMetadata(). getDestinationMethod(request.getUri(), request.getHttpMethod(), request.getContentType(), request.getAcceptTypes()); HttpResourceModel resourceModel = destination.getDestination(); response.setMediaType(Util.getResponseType(request.getAcceptTypes(), resourceModel.getProducesMediaTypes())); HttpMethodInfoBuilder httpMethodInfoBuilder = new HttpMethodInfoBuilder(). httpResourceModel(resourceModel). httpRequest(request). httpResponder(response). requestInfo(destination.getGroupNameValues()); HttpMethodInfo httpMethodInfo = httpMethodInfoBuilder.build(); if (httpMethodInfo.isStreamingSupported()) { while (!(request.isEmpty() && request.isEomAdded())) { httpMethodInfo.chunk(request.getMessageBody()); } httpMethodInfo.end(request, httpMethodInfo, currentMicroservicesRegistry); } else { httpMethodInfo.invoke(destination, request, httpMethodInfo, currentMicroservicesRegistry); } }
Source:
public void activate(Context context) { super.activate(context); for (Field field : inputClass.getFields()) { try { fieldMap.put(generateGettersForField(inputClass, field.getName()), generateSettersForField(outputClass, field.getName())); } catch (NoSuchFieldException e) { logger.warn("Unable to find field with name {}, ignoring that field. Exception: {}", field.getName(), e); } } for (FieldInfo fieldInfo : this.includeFieldInfo) { try { includeSetters.add(generateSettersForField(outputClass, fieldInfo.getColumnName())); } catch (NoSuchFieldException e) { throw new RuntimeException("Given field name is not present in output POJO", e); } } for (FieldInfo fieldInfo : this.lookupFieldInfo) { try { lookupGetters.add(generateGettersForField(inputClass, fieldInfo.getColumnName())); } catch (NoSuchFieldException e) { throw new RuntimeException("Given lookup field is not present in POJO", e); } } }

Target:
public void activate(Context context) { super.activate(context); for (Field field : inputClass.getDeclaredFields()) { try { fieldMap.put(generateGettersForField(inputClass, field.getName()), generateSettersForField(outputClass, field.getName())); } catch (NoSuchFieldException e) { throw new RuntimeException("Unable to find field with name " + field.getName() + ", ignoring that field.", e); } } for (FieldInfo fieldInfo : this.includeFieldInfo) { try { includeSetters.add(generateSettersForField(outputClass, fieldInfo.getColumnName())); } catch (NoSuchFieldException e) { throw new RuntimeException("Given field name is not present in output POJO", e); } } for (FieldInfo fieldInfo : this.lookupFieldInfo) { try { lookupGetters.add(generateGettersForField(inputClass, fieldInfo.getColumnName())); } catch (NoSuchFieldException e) { throw new RuntimeException("Given lookup field is not present in POJO", e); } } }
Source:
public void testWatermarkPolicy() throws WorkException, InterruptedException { log.info("Running testWatermarkPolicy()"); long startTime = System.currentTimeMillis(); int scheduleWorkAcceptedServer1 = server1Proxy.getScheduleWorkAccepted(); int scheduleWorkAcceptedServer2 = server2Proxy.getScheduleWorkAccepted(); int distributedScheduleWorkAccepted = server1Proxy.getDistributedScheduleWorkAccepted(); for (int i = 0; i < WATERMARK_MAX_THREADS; i++) { server1Proxy.scheduleWork(new LongWork().setName("testWatermarkPolicy-work" + (i + 1))); } Assert.assertTrue("Expected time < " + (startTime + LongWork.WORK_TIMEOUT) + ", actual: " + System.currentTimeMillis(), startTime + LongWork.WORK_TIMEOUT > System.currentTimeMillis()); Thread.sleep(LongWork.WORK_TIMEOUT * 2 + 100); logWorkStats(); Assert.assertTrue("Expected scheduleWorkAccepted = " + (scheduleWorkAcceptedServer1 + 1) + "/" + (scheduleWorkAcceptedServer2 + 1) + " but was: " + server1Proxy.getScheduleWorkAccepted() + "/" + server2Proxy.getScheduleWorkAccepted(), (server1Proxy.getScheduleWorkAccepted() == scheduleWorkAcceptedServer1 + 1) && (server2Proxy.getScheduleWorkAccepted() == scheduleWorkAcceptedServer2 + 1)); }

Target:
public void testWatermarkPolicy() throws WorkException, InterruptedException { int scheduleWorkAcceptedServer1 = server1Proxy.getScheduleWorkAccepted(); int scheduleWorkAcceptedServer2 = server2Proxy.getScheduleWorkAccepted(); int distributedScheduleWorkAccepted = server1Proxy.getDistributedScheduleWorkAccepted(); for (int i = 0; i < WATERMARK_MAX_THREADS; i++) { server1Proxy.scheduleWork(new LongWork()); } Assert.assertTrue("Work did not finish in the expected time on the expected node", waitForScheduleWork(server2Proxy, scheduleWorkAcceptedServer2 + 1, TimeoutUtil.adjust(WORK_FINISH_MAX_TIMEOUT))); Assert.assertTrue("Work did not finish in the expected time on the expected node", waitForScheduleWork(server1Proxy, scheduleWorkAcceptedServer1 + 1, TimeoutUtil.adjust(WORK_FINISH_MAX_TIMEOUT))); Assert.assertTrue("Expected distributedScheduleWorkAccepted = " + (distributedScheduleWorkAccepted + WATERMARK_MAX_THREADS) + " but was: " + server2Proxy.getDistributedScheduleWorkAccepted(), server2Proxy.getDistributedScheduleWorkAccepted() == distributedScheduleWorkAccepted + WATERMARK_MAX_THREADS); }
Source:
public FormData prepareFormDataSet(FormFields form) { List<HtmlParameter> formDataSet = new LinkedList<>(); List<HtmlParameter> submitFields = new ArrayList<>(); Iterator<FormField> it = form.iterator(); while (it.hasNext()) { FormField field = it.next(); if (log.isDebugEnabled()) { log.debug("New form field: " + field.getDebugInfo()); } List<HtmlParameter> currentList = formDataSet; if (field.getFormControl().getFormControlType().isSubmit()) { currentList = submitFields; } for (String value : getValues(field)) { currentList.add(new HtmlParameter(Type.form, field.getName(), value)); } } return new FormData(formDataSet, submitFields); }

Target:
private FormData prepareFormDataSet(FormFields form) { List<HtmlParameter> formDataSet = new LinkedList<>(); List<HtmlParameter> submitFields = new ArrayList<>(); Iterator<FormField> it = form.iterator(); while (it.hasNext()) { FormField field = it.next(); if (log.isDebugEnabled()) { log.debug("New form field: " + field.getDebugInfo()); } List<HtmlParameter> currentList = formDataSet; if (field.getFormControl().getFormControlType().isSubmit()) { currentList = submitFields; } for (String value : getDefaultTextValue(field)) { currentList.add(new HtmlParameter(Type.form, field.getName(), value)); } } return new FormData(formDataSet, submitFields); }
Source:
public void testNoNodesDieOnRequest() throws Exception { Ignite srv1 = startGrid(0); replaceWithCountingMappingRequestListener(((GridKernalContext)U.field(srv1, "ctx")).io()); Ignite srv2 = startGrid(1); replaceWithCountingMappingRequestListener(((GridKernalContext)U.field(srv2, "ctx")).io()); Ignite srv3 = startGrid(2); replaceWithCountingMappingRequestListener(((GridKernalContext)U.field(srv3, "ctx")).io()); srv3.cache(DEFAULT_CACHE_NAME).put( 1, new Organization(1, "Microsoft", "One Microsoft Way Redmond, WA 98052-6399, USA")); clientMode = true; Ignite cl1 = startClientGrid(4); cl1.cache(DEFAULT_CACHE_NAME).get(1); int result = mappingReqsCounter.get(); assertEquals("Expected requests count is 1, actual is " + result, 1, result); }

Target:
public void testNoNodesDieOnRequest() throws Exception { Ignite srv1 = startGrid(0); replaceWithCountingMappingRequestListener(((GridKernalContext)U.field(srv1, "ctx")).io()); Ignite srv2 = startGrid(1); replaceWithCountingMappingRequestListener(((GridKernalContext)U.field(srv2, "ctx")).io()); Ignite srv3 = startGrid(2); replaceWithCountingMappingRequestListener(((GridKernalContext)U.field(srv3, "ctx")).io()); srv3.cache(DEFAULT_CACHE_NAME).put( 1, new Organization(1, "Microsoft", "One Microsoft Way Redmond, WA 98052-6399, USA")); Ignite cl1 = startClientGrid(4); cl1.cache(DEFAULT_CACHE_NAME).get(1); int result = mappingReqsCounter.get(); assertEquals("Expected requests count is 1, actual is " + result, 1, result); }
Source:
public ActionResult execute() { CourseArchiveRequest courseArchiveRequest = getAndValidateRequestBody(CourseArchiveRequest.class); String idOfCourseToArchive = courseArchiveRequest.getCourseId(); String archiveStatus = courseArchiveRequest.getArchiveStatus(); boolean isArchive = Boolean.parseBoolean(archiveStatus); try { logic.setArchiveStatusOfInstructor(userInfo.id, idOfCourseToArchive, isArchive); if (!isArchive) { return new JsonResult("The course has been unarchived.", HttpStatus.SC_OK); } } catch (InvalidParametersException e) { return new JsonResult(e.getMessage(), HttpStatus.SC_BAD_REQUEST); } catch (EntityDoesNotExistException e) { return new JsonResult(e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR); } return new JsonResult("The course has been archived. It will not appear in the home page any more. " + "You can access archived courses from the 'Courses' tab.\n" + "Go there to undo the archiving and bring the course back to the home page.", HttpStatus.SC_OK); }

Target:
public ActionResult execute() { String idOfCourseToArchive = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); CourseArchiveRequest courseArchiveRequest = getAndValidateRequestBody(CourseArchiveRequest.class); boolean isArchive = courseArchiveRequest.getArchiveStatus(); try { logic.setArchiveStatusOfInstructor(userInfo.id, idOfCourseToArchive, isArchive); } catch (InvalidParametersException e) { return new JsonResult(e.getMessage(), HttpStatus.SC_BAD_REQUEST); } catch (EntityDoesNotExistException e) { throw new EntityNotFoundException(e); } return new JsonResult(new CourseArchiveData(idOfCourseToArchive, isArchive)); }
Source:
public GameColors() { Json json = Assets.getJson("core:colorsConfig"); JSONObject rootNode = json.getJsonValue(); Validator.validate(rootNode, "engine:schemaColorsConfig"); for (String s : rootNode.keySet()) { Color c = load(rootNode.getString(s)); colors.put(s, c); } json.dispose(); fire = get("fire"); smoke = get("smoke"); hullLights = get("hullLights"); }

Target:
public GameColors() { Json json = Assets.getJson("core:colorsConfig"); JSONObject rootNode = json.getJsonValue(); Validator.validate(rootNode, "engine:schemaColorsConfig"); for (String key : rootNode.keySet()) { Color c = load(rootNode.getString(key)); colors.put(key, c); } json.dispose(); fire = get("fire"); smoke = get("smoke"); hullLights = get("hullLights"); }
Source:
private SafeHtml formatList(JsArrayString l) { SafeHtmlBuilder sb = new SafeHtmlBuilder(); int size = l.length(); for (int i = 0; i < size; i++) { sb.openSpan() .addStyleName(style.includedInElement()) .append(l.get(i)) .closeSpan(); if (i < size - 1) { sb.append(", "); } } return sb; }

Target:
private SafeHtml formatList(JsArrayString l) { SafeHtmlBuilder html = new SafeHtmlBuilder(); int size = l.length(); for (int i = 0; i < size; i++) { html.openSpan() .addStyleName(style.includedInElement()) .append(l.get(i)) .closeSpan(); if (i < size - 1) { html.append(", "); } } return html; }
Source:
static String messageWithLabelAndPropertyName( TokenNameLookup tokenNameLookup, String formatString, LabelSchemaDescriptor descriptor ) { int[] propertyIds = descriptor.getPropertyIds(); if ( tokenNameLookup != null ) { String propertyString = propertyIds.length == 1 ? "property " + tokenNameLookup.propertyKeyGetName( descriptor.getPropertyId() ) : "properties " + Arrays.stream( propertyIds ) .mapToObj( (i) -> "'" + tokenNameLookup.propertyKeyGetName( i ) + "'") .collect( Collectors.joining( " and " )); return String.format( formatString, tokenNameLookup.labelGetName( descriptor.getLabelId() ), propertyString); } else { String keyString = propertyIds.length == 1 ? "key[" + propertyIds[0] + "]" : "keys[" + Arrays.stream( propertyIds ) .mapToObj( Integer::toString ) .collect( Collectors.joining( ", " )) + "]"; return String.format( formatString, "label[" + descriptor.getLabelId() + "]", keyString ); } }

Target:
static String messageWithLabelAndPropertyName( TokenNameLookup tokenNameLookup, String formatString, LabelSchemaDescriptor descriptor ) { int[] propertyIds = descriptor.getPropertyIds(); if ( tokenNameLookup != null ) { String propertyString = propertyIds.length == 1 ? "property '" + tokenNameLookup.propertyKeyGetName( propertyIds[0]) + "'" : "properties " + Arrays.stream( propertyIds ) .mapToObj( (i) -> "'" + tokenNameLookup.propertyKeyGetName( i ) + "'") .collect( Collectors.joining( " and " )); return String.format( formatString, tokenNameLookup.labelGetName( descriptor.getLabelId() ), propertyString); } else { String keyString = propertyIds.length == 1 ? "key[" + propertyIds[0] + "]" : "keys[" + Arrays.stream( propertyIds ) .mapToObj( Integer::toString ) .collect( Collectors.joining( ", " )) + "]"; return String.format( formatString, "label[" + descriptor.getLabelId() + "]", keyString ); } }
Source:
static String findVersionInClasspath(Project project, String group, String module) { return project.getBuildscript() .getConfigurations() .getByName("classpath") .getIncoming() .getArtifacts() .getArtifacts() .stream() .map(artifactResult -> artifactResult.getId().getComponentIdentifier()) .filter(identifier -> identifier instanceof ModuleComponentIdentifier) .map(componentIdentifier -> (ModuleComponentIdentifier) componentIdentifier) .filter(identifier -> (group.equals(identifier.getGroup()) && module.equals(identifier.getModule()))) .findFirst() .map(ModuleComponentIdentifier::getVersion) .orElse(null); }

Target:
static String findVersionInClasspath(Project project, String group, String module) { return project.getBuildscript() .getConfigurations() .getByName("classpath") .getIncoming() .getArtifacts() .getArtifacts() .stream() .flatMap(artifactResult -> artifactResult.getId().getComponentIdentifier() instanceof ModuleComponentIdentifier ? Stream.of((ModuleComponentIdentifier) artifactResult.getId().getComponentIdentifier()) : Stream.empty()) .filter(identifier -> (group.equals(identifier.getGroup()) && module.equals(identifier.getModule()))) .findFirst() .map(ModuleComponentIdentifier::getVersion) .orElse(null); }
Source:
private PdpFeedGroupEntryFixture(String payeeName, String payeeIdType, String payeeId, String customerInstitutionIdentifier, EnumSet<PdpFeedDetailEntryFixture> detailEntries) { this(payeeName, payeeIdType, payeeId, "xyz", customerInstitutionIdentifier, PdpFeedFileConstants.PAYMENT_DATE, PdpFeedFileConstants.COMBINE_GROUP_INDICATOR_YES, PdpFeedFileConstants.BANK_CODE, detailEntries); }

Target:
private PdpFeedGroupEntryFixture(String payeeName, String payeeIdType, String payeeId, String customerInstitutionIdentifier, EnumSet<PdpFeedDetailEntryFixture> detailEntries) { this(payeeName, payeeIdType, payeeId, PdpFeedFileConstants.PAYMENT_OWNERSHIP_CODE, customerInstitutionIdentifier, PdpFeedFileConstants.PAYMENT_DATE, PdpFeedFileConstants.COMBINE_GROUP_INDICATOR_YES, PdpFeedFileConstants.BANK_CODE, detailEntries); }
Source:
public TerminalOpener terminalOpener() { return new AutomaticTerminalOpener(terminalOpenerFactory(), operatingSystemFetcher(), Optional.of(terminalCommand)); }

Target:
public TerminalOpener terminalOpener() { return new AutomaticTerminalOpener(terminalOpenerFactory(), operatingSystemFetcher(), Optional.of(linuxTerminalCommand)); }
Source:
private void fetchRemoteData() { WordPress.getRestClientUtils().getGeneralSettings( String.valueOf(mBlog.getRemoteBlogId()), new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { handleResponseToGeneralSettingsRequest(response); } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { if (isAdded()) { ToastUtils.showToast(getActivity(), "Error getting site info"); } } }); }

Target:
private void fetchRemoteData() { WordPress.getRestClientUtils().getGeneralSettings( String.valueOf(mBlog.getRemoteBlogId()), new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { handleResponseToGeneralSettingsRequest(response); } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { AppLog.w(AppLog.T.API, "Error GETing site settings: " + error); if (isAdded()) { ToastUtils.showToast(getActivity(), getString(R.string.error_fetch_remote_site_settings)); getActivity().finish(); } } }); }
Source:
private int QueryGetData(long pFormatetc) { if (transferAgents == null) return COM.E_FAIL; TransferData transferData = new TransferData(); transferData.formatetc = new FORMATETC(); COM.MoveMemory(transferData.formatetc, pFormatetc, FORMATETC.sizeof); transferData.type = transferData.formatetc.cfFormat; for (Transfer transfer : transferAgents) { if (transfer != null && transfer.isSupportedType(transferData)) return COM.S_OK; } return COM.DV_E_FORMATETC; }

Target:
private int QueryGetData(long pFormatetc) { if (transferAgents == null) return COM.E_FAIL; TransferData transferData = new TransferData(); transferData.formatetc = new FORMATETC(); COM.MoveMemory(transferData.formatetc, pFormatetc, FORMATETC.sizeof); transferData.type = transferData.formatetc.cfFormat; for (Transfer transferAgent : transferAgents) { if (transferAgent != null && transferAgent.isSupportedType(transferData)) return COM.S_OK; } return COM.DV_E_FORMATETC; }
Source:
public void testBookieCompaction() throws Exception { storage.setMasterKey(4, "key".getBytes()); ByteBuf entry3 = Unpooled.buffer(1024); entry3.writeLong(4); entry3.writeLong(3); entry3.writeBytes("entry-3".getBytes()); storage.addEntry(entry3); EntryLogger entryLogger = ((DbLedgerStorage) storage).getEntryLogger(); ByteBuf newEntry3 = Unpooled.buffer(1024); newEntry3.writeLong(4); newEntry3.writeLong(3); newEntry3.writeBytes("new-entry-3".getBytes()); long location = entryLogger.addEntry(4, newEntry3, false); List<EntryLocation> locations = Lists.newArrayList(new EntryLocation(4, 3, location)); storage.updateEntriesLocations(locations); ByteBuf res = storage.getEntry(4, 3); System.out.println("res: " + ByteBufUtil.hexDump(res)); System.out.println("newEntry3: " + ByteBufUtil.hexDump(newEntry3)); assertEquals(newEntry3, res); storage.shutdown(); }

Target:
public void testBookieCompaction() throws Exception { storage.setMasterKey(4, "key".getBytes()); ByteBuf entry3 = Unpooled.buffer(1024); entry3.writeLong(4); entry3.writeLong(3); entry3.writeBytes("entry-3".getBytes()); storage.addEntry(entry3); EntryLogger entryLogger = ((DbLedgerStorage) storage).getEntryLogger(); ByteBuf newEntry3 = Unpooled.buffer(1024); newEntry3.writeLong(4); newEntry3.writeLong(3); newEntry3.writeBytes("new-entry-3".getBytes()); long location = entryLogger.addEntry(4, newEntry3, false); List<EntryLocation> locations = Lists.newArrayList(new EntryLocation(4, 3, location)); storage.updateEntriesLocations(locations); ByteBuf res = storage.getEntry(4, 3); System.out.println("res: " + ByteBufUtil.hexDump(res)); System.out.println("newEntry3: " + ByteBufUtil.hexDump(newEntry3)); assertEquals(newEntry3, res); }
Source:
public static boolean checkInputForCollationAndLimit(RelMetadataQuery mq, RelNode input, RelCollation collation, RexNode offset, RexNode fetch) { boolean alreadySorted = collation.getFieldCollations().isEmpty(); if (!alreadySorted) { final ImmutableList<RelCollation> collations = mq.collations(input); if (collations != null) { for (RelCollation inputCollation : collations) { if (inputCollation.satisfies(collation)) { alreadySorted = true; break; } } } } if (!alreadySorted) { return false; } if (fetch == null) { return true; } final Double rowCount = mq.getMaxRowCount(input); if (rowCount == null) { return false; } else { final int offsetVal = offset == null ? 0 : RexLiteral.intValue(offset); final int limit = RexLiteral.intValue(fetch); return (double) offsetVal + (double) limit >= rowCount; } }

Target:
public static boolean checkInputForCollationAndLimit(RelMetadataQuery mq, RelNode input, RelCollation collation, RexNode offset, RexNode fetch) { return alreadySorted(mq, input, collation) && alreadySmaller(mq, input, offset, fetch); }
Source:
public static TemporaryModel fromBundle(Bundle bundle) { String mEditedModelFileName = bundle.getString(INTENT_MODEL_FILENAME); if (mEditedModelFileName == null) { Timber.d("fromBundle() - model file name under key %s", INTENT_MODEL_FILENAME); return null; } Timber.d("onCreate() loading saved model file %s", mEditedModelFileName); JSONObject tempModelJSON; try { tempModelJSON = getTempModel((mEditedModelFileName)); } catch (IOException e) { Timber.w(e, "Unable to load saved model file"); return null; } TemporaryModel model = new TemporaryModel(tempModelJSON); model.loadTemplateChanges(bundle); return model; }

Target:
public static @Nullable TemporaryModel fromBundle(Bundle bundle) { String mEditedModelFileName = bundle.getString(INTENT_MODEL_FILENAME); if (mEditedModelFileName == null) { Timber.d("fromBundle() - model file name under key %s", INTENT_MODEL_FILENAME); return null; } Timber.d("onCreate() loading saved model file %s", mEditedModelFileName); JSONObject tempModelJSON; try { tempModelJSON = getTempModel((mEditedModelFileName)); } catch (IOException e) { Timber.w(e, "Unable to load saved model file"); return null; } TemporaryModel model = new TemporaryModel(tempModelJSON); model.loadTemplateChanges(bundle); return model; }
Source:
private void onMatchmakerInfo(MatchmakerInfoMessage message) { List<CompletableFuture<?>> futures = new ArrayList<>(); message.getQueues().forEach(remoteQueue -> { MatchmakingQueue localQueue = matchmakingQueues.stream() .filter(q -> Objects.equals(q.getQueueName(), remoteQueue.getQueueName())).findFirst().orElse(null); if (localQueue == null) { queuesAdded = true; CompletableFuture<Optional<MatchmakingQueue>> future = fafService.getMatchmakingQueue(remoteQueue.getQueueName()); futures.add(future); future.thenAccept(result -> result.ifPresent( matchmakingQueue -> { matchmakingQueues.add(matchmakingQueue); matchmakingQueue.setQueuePopTime(OffsetDateTime.parse(remoteQueue.getQueuePopTime()).toInstant()); matchmakingQueue.setTeamSize(remoteQueue.getTeamSize()); matchmakingQueue.setPartiesInQueue(remoteQueue.getBoundary75s().size()); Platform.runLater(() -> matchmakingQueue.setPlayersInQueue(remoteQueue.getNumPlayers())); })); } else { localQueue.setQueuePopTime(OffsetDateTime.parse(remoteQueue.getQueuePopTime()).toInstant()); localQueue.setTeamSize(remoteQueue.getTeamSize()); localQueue.setPartiesInQueue(remoteQueue.getBoundary75s().size()); Platform.runLater(() -> localQueue.setPlayersInQueue(remoteQueue.getNumPlayers())); } }); CompletableFuture.allOf(futures.toArray(new CompletableFuture<?>[futures.size()])).thenRun(() -> { if (queuesAdded) { eventBus.post(new QueuesAddedEvent()); queuesAdded = false; } }); }

Target:
protected void onMatchmakerInfo(MatchmakerInfoMessage message) { List<CompletableFuture<?>> futures = new ArrayList<>(); message.getQueues().forEach(messageQueue -> { CompletableFuture<Optional<MatchmakingQueue>> future = fafService.getMatchmakingQueue(messageQueue.getQueueName()); futures.add(future.thenCompose(result -> result.map(matchmakingQueue -> copyInfoAndAddQueueIfNecessary(matchmakingQueue, messageQueue)) .orElseGet(() -> CompletableFuture.completedFuture(null)))); }); CompletableFuture.allOf(futures.toArray(new CompletableFuture<?>[futures.size()])).thenRun(() -> { queuesReadyForUpdate.set(true); }); }
Source:
protected boolean validate() { StorageDomainToPoolRelationValidator storageDomainToPoolRelationValidator = new StorageDomainToPoolRelationValidator(getStorageDomain().getStorageStaticData(), getStoragePool()); boolean returnValue = checkStoragePool() && initializeVds() && validate(storageDomainToPoolRelationValidator.validateDomainCanBeAttachedToPool()); if (returnValue && getStoragePool().getStatus() == StoragePoolStatus.Uninitialized && getStorageDomain().getStorageDomainType() != StorageDomainType.Data) { returnValue = false; addValidationMessage(EngineMessage.ERROR_CANNOT_ADD_STORAGE_POOL_WITHOUT_DATA_DOMAIN); } if (returnValue && getStoragePool().getStatus() != StoragePoolStatus.Uninitialized) { returnValue = checkMasterDomainIsUp(); } return returnValue; }

Target:
protected boolean validate() { StorageDomainToPoolRelationValidator storageDomainToPoolRelationValidator = new StorageDomainToPoolRelationValidator(getStorageDomain().getStorageStaticData(), getStoragePool()); boolean returnValue = checkStoragePool() && initializeVds() && checkStorageDomain() && validate(storageDomainToPoolRelationValidator.validateDomainCanBeAttachedToPool()); if (returnValue && getStoragePool().getStatus() == StoragePoolStatus.Uninitialized && getStorageDomain().getStorageDomainType() != StorageDomainType.Data) { returnValue = false; addValidationMessage(EngineMessage.ERROR_CANNOT_ADD_STORAGE_POOL_WITHOUT_DATA_DOMAIN); } if (returnValue && getStoragePool().getStatus() != StoragePoolStatus.Uninitialized) { returnValue = checkMasterDomainIsUp(); } return returnValue; }
Source:
public String getFirstIndexForAlias(String aliasName) { ImmutableOpenMap<String, List<AliasMetaData>> aliases = aliases = client.admin().indices().prepareGetAliases(aliasName).get().getAliases(); if (aliases.isEmpty()) { return null; } return aliases.keysIt().next(); }

Target:
public String getFirstIndexForAlias(String aliasName) { ImmutableOpenMap<String, List<AliasMetaData>> aliases = client.admin().indices().prepareGetAliases(aliasName).get().getAliases(); if (aliases.isEmpty()) { return null; } return aliases.keysIt().next(); }
Source:
protected Collection<Integer> getRequiredOpenPorts() { Set<Integer> ports = MutableSet.copyOf(getConfig(REQUIRED_OPEN_LOGIN_PORTS)); Map<ConfigKey<?>, ?> allConfig = config().getBag().getAllConfigAsConfigKeyMap(); Set<ConfigKey<?>> configKeys = Sets.newHashSet(allConfig.keySet()); configKeys.addAll(getEntityType().getConfigKeys()); for (ConfigKey<?> k: configKeys) { if (PortRange.class.isAssignableFrom(k.getType())) { PortRange p = (PortRange)getConfig(k); if (p != null && !p.isEmpty()) ports.add(p.iterator().next()); } else if(k.getName().matches(".*\\.port")){ Object value = getConfig(k); if (value instanceof Integer){ ports.add((Integer)value); } else if (PortRange.class.isAssignableFrom(value.getClass())) { PortRange p = (PortRange)value; if (p != null && !p.isEmpty()) ports.add(p.iterator().next()); } } } log.debug("getRequiredOpenPorts detected default for {}", ports, this); return ports; }

Target:
protected Collection<Integer> getRequiredOpenPorts() { Set<Integer> ports = MutableSet.copyOf(getConfig(REQUIRED_OPEN_LOGIN_PORTS)); Map<ConfigKey<?>, ?> allConfig = config().getBag().getAllConfigAsConfigKeyMap(); Set<ConfigKey<?>> configKeys = Sets.newHashSet(allConfig.keySet()); configKeys.addAll(getEntityType().getConfigKeys()); for (ConfigKey<?> k: configKeys) { Object value; if (PortRange.class.isAssignableFrom(k.getType()) || k.getName().matches(".*\\.port")) { value = config().get(k); } else { Maybe<Object> maybeValue = config().getRaw(k); value = maybeValue.isPresent() ? maybeValue.get() : null; } Maybe<PortRange> maybePortRange = TypeCoercions.tryCoerce(value, new TypeToken<PortRange>() {}); if (maybePortRange.isPresentAndNonNull()) { PortRange p = maybePortRange.get(); if (p != null && !p.isEmpty()) ports.add(p.iterator().next()); } } log.debug("getRequiredOpenPorts detected default for {}", ports, this); return ports; }
Source:
public ArrayList<Map.Entry<String, EntityModel<String>>> getBondingOptionListDependingOnNetwork( RefObject<Map.Entry<String, EntityModel<String>>> defaultItem, boolean hasNetworkAttached) { ArrayList<Map.Entry<String, EntityModel<String>>> list = new ArrayList<Map.Entry<String, EntityModel<String>>>(); EntityModel<String> entityModel = new EntityModel<String>(); entityModel.setEntity("(Mode 1) Active-Backup"); list.add(new KeyValuePairCompat<String, EntityModel<String>>("mode=1 miimon=100", entityModel)); entityModel = new EntityModel<String>(); entityModel.setEntity("(Mode 2) Load balance (balance-xor)"); list.add(new KeyValuePairCompat<String, EntityModel<String>>("mode=2 miimon=100", entityModel)); entityModel = new EntityModel<String>(); entityModel.setEntity("(Mode 4) Dynamic link aggregation (802.3ad)"); defaultItem.argvalue = new KeyValuePairCompat<String, EntityModel<String>>("mode=4 miimon=100", entityModel); list.add(defaultItem.argvalue); if (!hasNetworkAttached){ entityModel = new EntityModel<String>(); entityModel.setEntity("(Mode 5) Adaptive transmit load balancing (balance-tlb)"); list.add(new KeyValuePairCompat<String, EntityModel<String>>("mode=5 miimon=100", entityModel)); } entityModel = new EntityModel<String>(); entityModel.setEntity(""); list.add(new KeyValuePairCompat<String, EntityModel<String>>("custom", entityModel)); return list; }

Target:
public ArrayList<Map.Entry<String, EntityModel<String>>> getBondingOptionListDependingOnNetwork( RefObject<Map.Entry<String, EntityModel<String>>> defaultItem, boolean hasNetworkAttached) { ArrayList<Map.Entry<String, EntityModel<String>>> list = new ArrayList<Map.Entry<String, EntityModel<String>>>(); for(BondMode mode : BondMode.values()){ if (!BondMode.BOND_MODES_VALID_FOR_NETWORK.contains(mode.getValue()) && hasNetworkAttached){ continue; } list.add(getBondOption(mode)); } EntityModel<String> entityModel = new EntityModel<String>(); entityModel.setEntity(""); list.add(new KeyValuePairCompat<String, EntityModel<String>>("custom", entityModel)); return list; }
Source:
public AccountGroup createGroup() throws OrmException, NameAlreadyUsedException, PermissionDeniedException { if (!currentUser.getCapabilities().canCreateGroup()) { throw new PermissionDeniedException(String.format( "%s does not have \"Create Group\" capability.", currentUser.getUserName())); } AccountGroup.Id groupId = new AccountGroup.Id(db.nextAccountGroupId()); AccountGroup.UUID uuid = GroupUUID.make( createGroupArgs.getGroupName(), currentUser.newCommitterIdent( serverIdent.getWhen(), serverIdent.getTimeZone())); AccountGroup group = new AccountGroup(createGroupArgs.getGroup(), groupId, uuid); group.setVisibleToAll(createGroupArgs.visibleToAll); if (createGroupArgs.ownerGroupId != null) { AccountGroup ownerGroup = groupCache.get(createGroupArgs.ownerGroupId); if (ownerGroup != null) { group.setOwnerGroupUUID(ownerGroup.getGroupUUID()); } } if (createGroupArgs.groupDescription != null) { group.setDescription(createGroupArgs.groupDescription); } AccountGroupName gn = new AccountGroupName(group); try { db.accountGroupNames().insert(Collections.singleton(gn)); } catch (OrmDuplicateKeyException e) { throw new NameAlreadyUsedException(createGroupArgs.getGroupName()); } db.accountGroups().insert(Collections.singleton(group)); addMembers(group, createGroupArgs.initialMembers); groupIncludeCache.evictAccountsOf(uuid); if (createGroupArgs.initialGroups != null) { addGroups(groupId, createGroupArgs.initialGroups); groupIncludeCache.evictMembersOf(uuid); } groupCache.onCreateGroup(createGroupArgs.getGroup()); return group; }

Target:
public AccountGroup createGroup() throws OrmException, NameAlreadyUsedException, PermissionDeniedException { if (!currentUser.getCapabilities().canCreateGroup()) { throw new PermissionDeniedException(String.format( "%s does not have \"Create Group\" capability.", currentUser.getUserName())); } AccountGroup.Id groupId = new AccountGroup.Id(db.nextAccountGroupId()); AccountGroup.UUID uuid = GroupUUID.make( createGroupArgs.getGroupName(), currentUser.newCommitterIdent( serverIdent.getWhen(), serverIdent.getTimeZone())); AccountGroup group = new AccountGroup(createGroupArgs.getGroup(), groupId, uuid); group.setVisibleToAll(createGroupArgs.visibleToAll); if (createGroupArgs.ownerGroupId != null) { AccountGroup ownerGroup = groupCache.get(createGroupArgs.ownerGroupId); if (ownerGroup != null) { group.setOwnerGroupUUID(ownerGroup.getGroupUUID()); } } if (createGroupArgs.groupDescription != null) { group.setDescription(createGroupArgs.groupDescription); } AccountGroupName gn = new AccountGroupName(group); try { db.accountGroupNames().insert(Collections.singleton(gn)); } catch (OrmDuplicateKeyException e) { throw new NameAlreadyUsedException(createGroupArgs.getGroupName()); } db.accountGroups().insert(Collections.singleton(group)); addMembers(groupId, createGroupArgs.initialMembers); if (createGroupArgs.initialGroups != null) { addGroups(groupId, createGroupArgs.initialGroups); groupIncludeCache.evictSubgroupsOf(uuid); } groupCache.onCreateGroup(createGroupArgs.getGroup()); return group; }
Source:
private void onConnectionResumed(HueBridge bridge) throws IOException, ApiException { logger.debug("Bridge connection resumed. Updating thing status to ONLINE."); FullConfig fullConfig = bridge.getFullConfig(); Config config = fullConfig.getConfig(); if (config != null) { Map<String, String> properties = editProperties(); properties.put(Thing.PROPERTY_SERIAL_NUMBER, config.getMACAddress().replaceAll(":", "").toLowerCase()); properties.put(Thing.PROPERTY_FIRMWARE_VERSION, config.getSoftwareVersion()); updateProperties(properties); } updateStatus(ThingStatus.ONLINE); }

Target:
private void onConnectionResumed(HueBridge bridge) throws IOException, ApiException { logger.debug("Bridge connection resumed. Updating thing status to ONLINE."); if (!propertiesInitializedSuccessfully) { FullConfig fullConfig = bridge.getFullConfig(); Config config = fullConfig.getConfig(); if (config != null) { Map<String, String> properties = editProperties(); properties.put(Thing.PROPERTY_SERIAL_NUMBER, config.getMACAddress().replaceAll(":", "").toLowerCase()); properties.put(Thing.PROPERTY_FIRMWARE_VERSION, config.getSoftwareVersion()); updateProperties(properties); propertiesInitializedSuccessfully = true; } } updateStatus(ThingStatus.ONLINE); }
Source:
public void onEntityDeath(EntityDeathEvent event) { if (event instanceof PlayerDeathEvent) { onPlayerDeath((PlayerDeathEvent) event, (Player) event.getEntity()); } else if (monsters.hasPet(event.getEntity())) { monsters.removePet(event.getEntity()); } else if (monsters.removeMonster(event.getEntity())) { onMonsterDeath(event); } else if (monsters.removeMount(event.getEntity())) { onMountDeath(event); } else if (monsters.removeGolem(event.getEntity())) { arena.announce(Msg.GOLEM_DIED); } else if (event.getEntity() instanceof Projectile) { arena.getProjectileManager().removeProjectile((Projectile) event.getEntity()); } }

Target:
public void onEntityDeath(EntityDeathEvent event) { if (event instanceof PlayerDeathEvent) { onPlayerDeath((PlayerDeathEvent) event, (Player) event.getEntity()); } else if (monsters.hasPet(event.getEntity())) { monsters.removePet(event.getEntity()); } else if (monsters.removeMonster(event.getEntity())) { onMonsterDeath(event); } else if (monsters.removeMount(event.getEntity())) { onMountDeath(event); } else if (monsters.removeGolem(event.getEntity())) { arena.announce(Msg.GOLEM_DIED); } else if (event.getEntity() instanceof Projectile) { Projectile projectile = (Projectile) event.getEntity(); if(projectile.getShooter() instanceof Player) { Player player = (Player) projectile.getShooter(); if(!arena.isRunning()) return; if(!arena.inArena(player) && !arena.inLobby(player)) return; arena.getProjectileManager().removeProjectile(projectile); } } }