auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public HandlerResult handle(ProcessState state, ProcessInstance process) { final ExternalEvent event = (ExternalEvent) state.getResource(); if (!ExternalEventConstants.KIND_STACK_EVENT.equals(event.getKind())) { return null; } lockManager.lock(new ExternalEventLock(STACK_LOCK_NAME, event.getAccountId(), event.getExternalId()), new LockCallbackNoReturn() { @Override public void doWithLockNoResult() { Map<String, Object> stackData = CollectionUtils .toMap(DataUtils.getFields(event).get(FIELD_STACK)); if (stackData.isEmpty()) { log.warn("Empty stack for externalStackEvent: {}.", event); return; } String kind = stackData.get(ObjectMetaDataManager.KIND_FIELD) != null ? stackData.get(ObjectMetaDataManager.KIND_FIELD).toString() : null; if (StringUtils.isEmpty(kind) || schemaFactory.getSchema(kind) == null) { log.warn("Couldn't find schema for stack type [{}]. Returning.", kind); return; } if (StringUtils.equals(event.getEventType(), TYPE_STACK_DELETE)) { deleteStack(event, stackData); } } }); return null; }

Target:
public HandlerResult handle(ProcessState state, ProcessInstance process) { final ExternalEvent event = (ExternalEvent) state.getResource(); if (!ExternalEventConstants.KIND_STACK_EVENT.equals(event.getKind())) { return null; } lockManager.lock(new ExternalEventLock(STACK_LOCK_NAME, event.getAccountId(), event.getExternalId()), new LockCallbackNoReturn() { @Override public void doWithLockNoResult() { Map<String, Object> stackData = CollectionUtils .toMap(DataUtils.getFields(event).get(FIELD_STACK)); if (stackData.isEmpty()) { log.warn("Empty stack for externalStackEvent: {}.", event); return; } if (StringUtils.equals(event.getEventType(), TYPE_STACK_DELETE)) { deleteStack(event, stackData); } } }); return null; }
Source:
public MarshallableEntry<K, V> loadEntry(Object key) throws PersistenceException { if (configuration.rawValues()) { Object unwrappedKey; if (key instanceof WrappedByteArray) { unwrappedKey = ((WrappedByteArray) key).getBytes(); } else { unwrappedKey = key; } MetadataValue<?> value = remoteCache.getWithMetadata(unwrappedKey); if (value != null) { Metadata metadata = new EmbeddedMetadata.Builder() .version(new NumericVersion(value.getVersion())) .lifespan(value.getLifespan(), TimeUnit.SECONDS) .maxIdle(value.getMaxIdle(), TimeUnit.SECONDS).build(); long created = value.getCreated(); long lastUsed = value.getLastUsed(); Object realValue = value.getValue(); if (realValue instanceof byte[]) { realValue = new WrappedByteArray((byte[]) realValue); } return entryFactory.create(key, realValue, metadata, created, lastUsed); } else { return null; } } else { if (key instanceof WrappedByteArray) { key = ((WrappedByteArray) key).getBytes(); } StoreEntry entry = (StoreEntry) remoteCache.get(key); return entry == null ? null : entryFactory.create(key, entry.getValue(), entry.getMetadata(), entry.getCreated(), entry.getLastUsed()); } }

Target:
public MarshallableEntry<K, V> loadEntry(Object key) throws PersistenceException { if (configuration.rawValues()) { Object unwrappedKey; if (key instanceof WrappedByteArray) { unwrappedKey = ((WrappedByteArray) key).getBytes(); } else { unwrappedKey = key; } MetadataValue<?> value = remoteCache.getWithMetadata(unwrappedKey); if (value != null) { Metadata metadata = new EmbeddedMetadata.Builder() .version(new NumericVersion(value.getVersion())) .lifespan(value.getLifespan(), TimeUnit.SECONDS) .maxIdle(value.getMaxIdle(), TimeUnit.SECONDS).build(); long created = value.getCreated(); long lastUsed = value.getLastUsed(); Object realValue = value.getValue(); if (realValue instanceof byte[]) { realValue = new WrappedByteArray((byte[]) realValue); } return entryFactory.create(key, realValue, metadata, created, lastUsed); } else { return null; } } else { if (key instanceof WrappedByteArray) { key = ((WrappedByteArray) key).getBytes(); } MarshalledValue value = (MarshalledValue) remoteCache.get(key); return value == null ? null : entryFactory.create(key, value); } }
Source:
public AttachedToSurfaceFamily(BlockFamilyDefinition definition, BlockBuilderHelper blockBuilder) { super(definition, blockBuilder); Map<Side, Block> blockMap = Maps.newEnumMap(Side.class); if (definition.getData().hasSection("top")) { Block block = blockBuilder.constructSimpleBlock(definition, "top"); block.setDirection(Side.TOP); blockMap.put(Side.TOP, block); } if (definition.getData().hasSection("front")) { for (Rotation rot : Rotation.horizontalRotations()) { Side side = rot.rotate(Side.FRONT); blockMap.put(side, blockBuilder.constructTransformedBlock(definition, side.toString().toLowerCase(Locale.ENGLISH), rot)); } } if (definition.getData().hasSection("bottom")) { Block block = blockBuilder.constructSimpleBlock(definition, "bottom"); block.setDirection(Side.BOTTOM); blockMap.put(Side.BOTTOM, block); } for (Side side : Side.values()) { Block block = blockMap.get(side); if (block != null) { this.blocks.put(side, block); block.setBlockFamily(this); block.setUri(new BlockUri(definition.getUrn(), new Name(side.name()))); } } if (this.blocks.containsKey(Side.TOP)) { archetype = this.blocks.get(Side.TOP); } else { archetype = this.blocks.get(Side.FRONT); } this.setBlockUri(new BlockUri(definition.getUrn())); this.setCategory(definition.getCategories()); }

Target:
public AttachedToSurfaceFamily(BlockFamilyDefinition definition, BlockBuilderHelper blockBuilder) { super(definition, blockBuilder); Map<Side, Block> blockMap = Maps.newEnumMap(Side.class); if (definition.getData().hasSection("top")) { Block block = blockBuilder.constructSimpleBlock(definition, "top"); block.setDirection(Side.TOP); blockMap.put(Side.TOP, block); } if (definition.getData().hasSection("front")) { for (Rotation rot : Rotation.horizontalRotations()) { Side side = rot.rotate(Side.FRONT); blockMap.put(side, blockBuilder.constructTransformedBlock(definition, side.toString().toLowerCase(Locale.ENGLISH), rot)); } } if (definition.getData().hasSection("bottom")) { Block block = blockBuilder.constructSimpleBlock(definition, "bottom"); block.setDirection(Side.BOTTOM); blockMap.put(Side.BOTTOM, block); } for (Side side : Side.values()) { Block block = blockMap.get(side); if (block != null) { blocks.put(side, block); block.setBlockFamily(this); block.setUri(new BlockUri(definition.getUrn(), new Name(side.name()))); } } if (blocks.containsKey(Side.TOP)) { archetype = blocks.get(Side.TOP); } else { archetype = blocks.get(Side.FRONT); } setBlockUri(new BlockUri(definition.getUrn())); setCategory(definition.getCategories()); }
Source:
public void updateDynamicSetting( String setting, String update ) throws IllegalArgumentException, InvalidSettingException { verifyValidDynamicSetting( setting ); String oldValue; String newValue; if ( update == null || update.isEmpty() ) { boolean hasDefault = overriddenDefaults.containsKey( setting ); oldValue = hasDefault ? params.put( setting, overriddenDefaults.get( setting ) ) : params.remove( setting ); newValue = getDefaultValueOf( setting ); } else { Map<String,String> newEntry = stringMap( setting, update ); List<SettingValidator> settingValidators = configOptions.stream() .map( ConfigOptions::settingGroup ) .collect( Collectors.toList() ); for ( SettingValidator validator : settingValidators ) { validator.validate( newEntry, ignore -> ); } synchronized ( params ) { oldValue = getDefaultValueOf( setting ); params.put( setting, update ); } newValue = update; } log.info( "Setting changed: '%s' changed from '%s' to '%s'", setting, oldValue, newValue ); updateListeners.getOrDefault( setting, emptyList() ).forEach( l -> l.accept( oldValue, newValue ) ); }

Target:
public void updateDynamicSetting( String setting, String update ) throws IllegalArgumentException, InvalidSettingException { verifyValidDynamicSetting( setting ); synchronized ( params ) { String oldValue; String newValue; if ( update == null || update.isEmpty() ) { String overriddenDefault = overriddenDefaults.get( setting ); boolean hasDefault = overriddenDefault != null; oldValue = hasDefault ? params.put( setting, overriddenDefault ) : params.remove( setting ); newValue = getDefaultValueOf( setting ); } else { Map<String,String> newEntry = stringMap( setting, update ); List<SettingValidator> settingValidators = configOptions.stream() .map( ConfigOptions::settingGroup ) .collect( Collectors.toList() ); for ( SettingValidator validator : settingValidators ) { validator.validate( newEntry, ignore -> ); } oldValue = getDefaultValueOf( setting ); params.put( setting, update ); newValue = update; } log.info( "Setting changed: '%s' changed from '%s' to '%s'", setting, oldValue, newValue ); updateListeners.getOrDefault( setting, emptyList() ).forEach( l -> l.accept( oldValue, newValue ) ); } }
Source:
protected boolean isVanityPath(String pathScope, String vanityPath, SlingHttpServletRequest request) throws RepositoryException { final long start = System.currentTimeMillis(); final Map<String, String> params = new HashMap<>(); params.put("path", StringUtils.defaultIfEmpty(pathScope, DEFAULT_PATH_SCOPE)); params.put("property", NameConstants.PN_SLING_VANITY_PATH); params.put("property.value", vanityPath); params.put("p.limit", "1"); params.put("p.guessTotal", "true"); log.debug("Searching for vanity path [ ] under [ ]", vanityPath, pathScope); final Query query = queryBuilder.createQuery(PredicateGroup.create(params), request.getResourceResolver().adaptTo(Session.class)); final SearchResult result = query.getResult(); if (result.getTotalMatches() > 0) { if (log.isDebugEnabled()) { log.debug("Found matching Sling vanity path [ ] on [ ]", vanityPath, result.getHits().get(0).getPath()); } if (result.hasMore()) { log.warn("Found more than 1 resources that match the Sling vanity path [ ]", vanityPath); } return true; } else { log.debug("Could not find a resource with the Sling vanity path [ ]", vanityPath); } log.debug("Look-up of Sling vanity path [ ] took [ ] ms", vanityPath, System.currentTimeMillis() - start); return false; }

Target:
protected boolean isVanityPath(String pathScope, String vanityPath, SlingHttpServletRequest request) throws RepositoryException { final Resource vanityResource = request.getResourceResolver().resolve(vanityPath); if (vanityResource != null) { String targetPath = null; if (vanityResource.isResourceType("sling:redirect")) { targetPath = vanityResource.getValueMap().get("sling:target", String.class); } else if (!StringUtils.equals(vanityPath, vanityResource.getPath())) { targetPath = vanityResource.getPath(); } if (targetPath != null && StringUtils.startsWith(targetPath, StringUtils.defaultIfEmpty(pathScope, DEFAULT_PATH_SCOPE))) { log.debug("Found vanity resource at [ ] for sling:vanityPath [ ]", targetPath, vanityPath); return true; } } return false; }
Source:
private void updateRngDevice() { if (getParameters().isUpdateRngDevice()) { VdcQueryReturnValue query = getBackend().runInternalQuery(VdcQueryType.GetRngDevice, new IdQueryParameters(getParameters().getVmId())); @SuppressWarnings("unchecked") List<VmRngDevice> rngDevs = query.getReturnValue(); VdcReturnValueBase rngCommandResult = null; if (rngDevs.isEmpty()) { if (getParameters().getRngDevice() != null) { RngDeviceParameters params = new RngDeviceParameters(getParameters().getRngDevice(), true); rngCommandResult = getBackend().runInternalAction(VdcActionType.AddRngDevice, params); } } else { if (getParameters().getRngDevice() == null) { RngDeviceParameters params = new RngDeviceParameters(rngDevs.get(0), true); rngCommandResult = getBackend().runInternalAction(VdcActionType.RemoveRngDevice, params); } else { RngDeviceParameters params = new RngDeviceParameters(getParameters().getRngDevice(), true); params.getRngDevice().setDeviceId(rngDevs.get(0).getDeviceId()); rngCommandResult = getBackend().runInternalAction(VdcActionType.UpdateRngDevice, params); } } if (rngCommandResult != null && !rngCommandResult.getSucceeded()) { getReturnValue().setSucceeded(false); } } }

Target:
private boolean updateRngDevice() { if (getParameters().isUpdateRngDevice()) { VdcQueryReturnValue query = getBackend().runInternalQuery(VdcQueryType.GetRngDevice, new IdQueryParameters(getParameters().getVmId())); @SuppressWarnings("unchecked") List<VmRngDevice> rngDevs = query.getReturnValue(); VdcReturnValueBase rngCommandResult = null; if (rngDevs.isEmpty()) { if (getParameters().getRngDevice() != null) { RngDeviceParameters params = new RngDeviceParameters(getParameters().getRngDevice(), true); rngCommandResult = getBackend().runInternalAction(VdcActionType.AddRngDevice, params); } } else { if (getParameters().getRngDevice() == null) { RngDeviceParameters params = new RngDeviceParameters(rngDevs.get(0), true); rngCommandResult = getBackend().runInternalAction(VdcActionType.RemoveRngDevice, params); } else { RngDeviceParameters params = new RngDeviceParameters(getParameters().getRngDevice(), true); params.getRngDevice().setDeviceId(rngDevs.get(0).getDeviceId()); rngCommandResult = getBackend().runInternalAction(VdcActionType.UpdateRngDevice, params); } } if (rngCommandResult != null && !rngCommandResult.getSucceeded()) { return false; } } return true; }
Source:
public ServiceResponse<SolverInstanceList> getSolvers(String containerId) { checkMandatoryParameter( "ContainerID", containerId ); if( config.isRest() ) { String uri = getURI( containerId ); return makeHttpGetRequestAndCreateServiceResponse( uri, SolverInstanceList.class ); } else { return null; } }

Target:
public ServiceResponse<SolverInstanceList> getSolvers(String containerId) { checkMandatoryParameter( "ContainerID", containerId ); if( config.isRest() ) { String uri = getURI( containerId ); return makeHttpGetRequestAndCreateServiceResponse( uri, SolverInstanceList.class ); } else { throw new UnsupportedOperationException( "JMS is not supported at the moment." ); } }
Source:
public String getNamespaceId(String namespaceName) { String namespaceId = namespaces.get(namespaceName); if (namespaceId == null) { log.debug("The namespaceId was not in the namespace map, need to fetch it from the OpenShift Master."); namespaceId = getProjectId(namespaceName); if (namespaceId != null) { namespaces.putIfAbsent(namespaceName, namespaceId); } } return namespaceId; }

Target:
public String getNamespaceId(String namespaceName) { return namespaces.computeIfAbsent(namespaceName, n -> getProjectId(namespaceName, token)); }
Source:
public void revokeOffer_afterOneAcceptedIt() { final String offerToken = createOffer(user, "test", AccessLevel.WRITE, null); final SyncUser user2 = UserFactory.createUniqueUser(); final SyncUser user3 = UserFactory.createUniqueUser(); final PermissionManager pm1 = user.getPermissionManager(); final PermissionManager pm2 = user2.getPermissionManager(); final PermissionManager pm3 = user3.getPermissionManager(); looperThread.closeAfterTest(pm1); looperThread.closeAfterTest(pm2); looperThread.closeAfterTest(pm3); pm2.acceptOffer(offerToken, new PermissionManager.AcceptOfferCallback() { @Override public void onSuccess(String realmUrl, Permission permission) { pm1.revokeOffer(offerToken, new PermissionManager.RevokeOfferCallback() { @Override public void onSuccess() { pm3.acceptOffer(offerToken, new PermissionManager.AcceptOfferCallback() { @Override public void onSuccess(String realmUrl, Permission permission) { fail("Offer should have been revoked"); } @Override public void onError(ObjectServerError error) { assertEquals(ErrorCode.INVALID_PARAMETERS, error.getErrorCode()); looperThread.testComplete(); } }); } @Override public void onError(ObjectServerError error) { fail(error.toString()); } }); } @Override public void onError(ObjectServerError error) { fail(error.toString()); } }); }

Target:
public void revokeOffer_afterOneAcceptedIt() { final String offerToken = createOffer(user, "test", AccessLevel.WRITE, null); SyncUser user2 = UserFactory.createUniqueUser(); SyncUser user3 = UserFactory.createUniqueUser(); final PermissionManager pm1 = user.getPermissionManager(); PermissionManager pm2 = user2.getPermissionManager(); final PermissionManager pm3 = user3.getPermissionManager(); looperThread.closeAfterTest(pm1); looperThread.closeAfterTest(pm2); looperThread.closeAfterTest(pm3); pm2.acceptOffer(offerToken, new PermissionManager.AcceptOfferCallback() { @Override public void onSuccess(String realmUrl, Permission permission) { pm1.revokeOffer(offerToken, new PermissionManager.RevokeOfferCallback() { @Override public void onSuccess() { pm3.acceptOffer(offerToken, new PermissionManager.AcceptOfferCallback() { @Override public void onSuccess(String realmUrl, Permission permission) { fail("Offer should have been revoked"); } @Override public void onError(ObjectServerError error) { assertEquals(ErrorCode.INVALID_PARAMETERS, error.getErrorCode()); looperThread.testComplete(); } }); } @Override public void onError(ObjectServerError error) { fail(error.toString()); } }); } @Override public void onError(ObjectServerError error) { fail(error.toString()); } }); }
Source:
private void sendToKafka(final String topic, MemoryBoundLinkedBlockingQueue<String> recordQueue, Callback callback) { ObjectContainer<String> objectToSend; try { while (true) { objectToSend = recordQueue.take(); producer.send(new ProducerRecord<>(topic, objectToSend.getData()), callback); } } catch (InterruptedException e) { log.warn(e, "Failed to take record from queue!"); } }

Target:
private void sendToKafka(final String topic, MemoryBoundLinkedBlockingQueue<String> recordQueue, Callback callback) { ObjectContainer<String> objectToSend; try { while (true) { objectToSend = recordQueue.take(); producer.send(new ProducerRecord<>(topic, objectToSend.getData()), callback); } } catch (Throwable e) { log.warn(e, "Exception while getting record from queue or producer send, Events would not be emitted anymore."); } }
Source:
private void doAuthAction(@StringRes int messageId, String twoStepCode, boolean shouldSendTwoStepSMS) { if (!NetworkUtils.checkConnection(getActivity())) { return; } mInProgressMessageId = messageId; startProgress(); mOldSitesIDs = SiteUtils.getCurrentSiteIds(mSiteStore, false); if (isSocialLogin2fa && !shouldSendTwoStepSMS) { setAuthCodeTypeAndNonce(twoStepCode); AccountStore.PushSocialAuthPayload payload = new AccountStore.PushSocialAuthPayload(mUserId, mType, mNonce, twoStepCode); mDispatcher.dispatch(AccountActionBuilder.newPushSocialAuthAction(payload)); } else { AccountStore.AuthenticatePayload payload = new AccountStore.AuthenticatePayload(mEmailAddress, mPassword); payload.twoStepCode = twoStepCode; payload.shouldSendTwoStepSms = shouldSendTwoStepSMS; mDispatcher.dispatch(AuthenticationActionBuilder.newAuthenticateAction(payload)); } }

Target:
private void doAuthAction(@StringRes int messageId, String twoStepCode, boolean shouldSendTwoStepSMS) { if (!NetworkUtils.checkConnection(getActivity())) { return; } mInProgressMessageId = messageId; startProgress(); mOldSitesIDs = SiteUtils.getCurrentSiteIds(mSiteStore, false); if (isSocialLogin && !shouldSendTwoStepSMS) { setAuthCodeTypeAndNonce(twoStepCode); AccountStore.PushSocialAuthPayload payload = new AccountStore.PushSocialAuthPayload(mUserId, mType, mNonce, twoStepCode); mDispatcher.dispatch(AccountActionBuilder.newPushSocialAuthAction(payload)); } else { AccountStore.AuthenticatePayload payload = new AccountStore.AuthenticatePayload(mEmailAddress, mPassword); payload.twoStepCode = twoStepCode; payload.shouldSendTwoStepSms = shouldSendTwoStepSMS; mDispatcher.dispatch(AuthenticationActionBuilder.newAuthenticateAction(payload)); } }
Source:
private Flux<ServerSentEvent<String>> circuitBreakerStreamEvents(String s) { WebClient client = WebClient.create("http://localhost:" + randomServerPort); ParameterizedTypeReference<ServerSentEvent<String>> type = new ParameterizedTypeReference<ServerSentEvent<String>>() { }; Flux<ServerSentEvent<String>> eventStream = client.get() .uri(s) .accept(MediaType.TEXT_EVENT_STREAM) .retrieve() .bodyToFlux(type) .take(2); return eventStream; }

Target:
private Flux<ServerSentEvent<String>> circuitBreakerStreamEvents(String s) { Flux<ServerSentEvent<String>> eventStream = webStreamClient.get() .uri(s) .accept(MediaType.TEXT_EVENT_STREAM) .retrieve() .bodyToFlux(type) .take(2); return eventStream; }
Source:
private void updateCpus(VmNumaNode vmNumaNode, int coresPerNode, Integer cpuCount) { List<Integer> coreList = new ArrayList<Integer>(); for (int j = 0; j < coresPerNode; j++, cpuCount++) { coreList.add(cpuCount); } vmNumaNode.setCpuIds(coreList); }

Target:
private Integer updateCpus(VmNumaNode vmNumaNode, int coresPerNode, Integer cpuCount) { List<Integer> coreList = new ArrayList<Integer>(); for (int j = 0; j < coresPerNode; j++, cpuCount++) { coreList.add(cpuCount); } vmNumaNode.setCpuIds(coreList); return cpuCount; }
Source:
public void markContextAsDirtyWhenAnyEvictedPageHaveModificationTransactionHigherThenReader() throws IOException { TestVersionContext cursorContext = new TestVersionContext( () -> 5 ); VersionContextSupplier versionContextSupplier = new ConfiguredVersionContextSupplier( cursorContext ); MuninnPageCache pageCache = createPageCache( fs, 2, 8, PageCacheTracer.NULL, PageCursorTracerSupplier.NULL, versionContextSupplier ); PagedFile pagedFile = pageCache.map( file( "a" ), 8 ); cursorContext.initWrite( 3 ); try ( PageCursor cursor = pagedFile.io( 0, PF_SHARED_WRITE_LOCK ) ) { assertTrue( cursor.next() ); cursor.putLong( 3 ); } cursorContext.initWrite( 13 ); try ( PageCursor cursor = pagedFile.io( 1, PF_SHARED_WRITE_LOCK ) ) { assertTrue( cursor.next() ); cursor.putLong( 4 ); } pageCache.pages.tryEvict( pageCache.grabFreeAndExclusivelyLockedPage( PageFaultEvent.NULL ), EvictionRunEvent.NULL ); cursorContext.initRead(); try ( PageCursor cursor = pagedFile.io( 0, PF_SHARED_READ_LOCK ) ) { assertTrue( cursor.next() ); assertEquals( 3, cursor.getLong() ); assertTrue( cursorContext.isDirty() ); } }

Target:
public void markContextAsDirtyWhenAnyEvictedPageHaveModificationTransactionHigherThenReader() throws IOException { TestVersionContext cursorContext = new TestVersionContext( () -> 5 ); VersionContextSupplier versionContextSupplier = new ConfiguredVersionContextSupplier( cursorContext ); MuninnPageCache pageCache = createPageCache( fs, 2, 8, PageCacheTracer.NULL, PageCursorTracerSupplier.NULL, versionContextSupplier ); PagedFile pagedFile = pageCache.map( file( "a" ), 8 ); cursorContext.initWrite( 3 ); try ( PageCursor cursor = pagedFile.io( 0, PF_SHARED_WRITE_LOCK ) ) { assertTrue( cursor.next() ); cursor.putLong( 3 ); } cursorContext.initWrite( 13 ); try ( PageCursor cursor = pagedFile.io( 1, PF_SHARED_WRITE_LOCK ) ) { assertTrue( cursor.next() ); cursor.putLong( 4 ); } assertEquals( 2, pageCache.evictPages( 2, 0, EvictionRunEvent.NULL ) ); cursorContext.initRead(); try ( PageCursor cursor = pagedFile.io( 0, PF_SHARED_READ_LOCK ) ) { assertTrue( cursor.next() ); assertEquals( 3, cursor.getLong() ); assertTrue( cursorContext.isDirty() ); } }
Source:
public Class<? extends Scanner> getScannerClass(CatalogProtos.StoreType storeType) throws IOException { String handlerName = CatalogUtil.getStoreTypeString(storeType).toLowerCase(); Class<? extends Scanner> scannerClass = SCANNER_HANDLER_CACHE.get(handlerName); if (scannerClass == null) { scannerClass = conf.getClass( String.format("tajo.storage.scanner-handler.%s.class", handlerName), null, Scanner.class); if (scannerClass != null) SCANNER_HANDLER_CACHE.put(handlerName, scannerClass); } if (scannerClass == null) { throw new IOException("Unknown Storage Type: " + storeType.name()); } return scannerClass; }

Target:
public Class<? extends Scanner> getScannerClass(CatalogProtos.StoreType storeType) throws IOException { String handlerName = CatalogUtil.getStoreTypeString(storeType).toLowerCase(); Class<? extends Scanner> scannerClass = SCANNER_HANDLER_CACHE.get(handlerName); if (scannerClass == null) { scannerClass = conf.getClass( String.format("tajo.storage.scanner-handler.%s.class", handlerName), null, Scanner.class); if (scannerClass != null) { SCANNER_HANDLER_CACHE.put(handlerName, scannerClass); } } if (scannerClass == null) { throw new UnsupportedException("Unsupported Storage Type: " + storeType.name()); } return scannerClass; }
Source:
public void deleteMatchingPartitionsByTime(long upperLimit) throws IOException { if (upperLimit > 0 && upperLimit < Long.MAX_VALUE) { PartitionFilter filter = PartitionFilter.builder().addRangeCondition("snapshot", null, upperLimit).build(); Set<PartitionDetail> partitions = files.getPartitions(filter); for (PartitionDetail partition : partitions) { files.dropPartition(partition.getPartitionKey()); } } }

Target:
public void deleteMatchingPartitionsByTime(long upperLimit) throws IOException { if (upperLimit > 0 && upperLimit < Long.MAX_VALUE) { PartitionFilter filter = PartitionFilter.builder().addRangeCondition(SNAPSHOT_FIELD, null, upperLimit).build(); Set<PartitionDetail> partitions = files.getPartitions(filter); for (PartitionDetail partition : partitions) { files.dropPartition(partition.getPartitionKey()); } } }
Source:
public List<EmailWrapper> generateFeedbackSessionClosedEmails(FeedbackSessionAttributes session) { if (session.isPrivateSession()) { return new ArrayList<>(); } CourseAttributes course = coursesLogic.getCourse(session.getCourseId()); boolean isEmailNeededForStudents = false; try { isEmailNeededForStudents = fsLogic.isFeedbackSessionHasQuestionForStudents( session.getFeedbackSessionName(), session.getCourseId()); } catch (EntityDoesNotExistException e) { log.severe("Course " + session.getCourseId() + " does not exist or " + "session " + session.getFeedbackSessionName() + " does not exist"); } List<InstructorAttributes> instructors = instructorsLogic.getInstructorsForCourse(session.getCourseId()); List<StudentAttributes> students = isEmailNeededForStudents ? studentsLogic.getStudentsForCourse(session.getCourseId()) : new ArrayList<StudentAttributes>(); String template = EmailTemplates.USER_FEEDBACK_SESSION; List<EmailWrapper> emails = generateFeedbackSessionEmailBases(course, session, students, instructors, template, EmailType.FEEDBACK_CLOSED.getSubject(), EmailTemplates.FRAGMENT_CLOSED_SESSION_ADDITIONAL_INSTRUCTIONS); for (EmailWrapper email : emails) { email.setContent(email.getContent().replace("${status}", Const.StatusMessages.FEEDBACK_SESSION_CLOSED_MESSAGE)); } return emails; }

Target:
public List<EmailWrapper> generateFeedbackSessionClosedEmails(FeedbackSessionAttributes session) { if (session.isPrivateSession()) { return new ArrayList<>(); } CourseAttributes course = coursesLogic.getCourse(session.getCourseId()); boolean isEmailNeededForStudents = false; try { isEmailNeededForStudents = fsLogic.isFeedbackSessionHasQuestionForStudents( session.getFeedbackSessionName(), session.getCourseId()); } catch (EntityDoesNotExistException e) { log.severe("Course " + session.getCourseId() + " does not exist or " + "session " + session.getFeedbackSessionName() + " does not exist"); } List<InstructorAttributes> instructors = instructorsLogic.getInstructorsForCourse(session.getCourseId()); List<StudentAttributes> students = isEmailNeededForStudents ? studentsLogic.getStudentsForCourse(session.getCourseId()) : new ArrayList<StudentAttributes>(); String template = EmailTemplates.USER_FEEDBACK_SESSION .replace("${status}", FEEDBACK_STATUS_SESSION_CLOSED); return generateFeedbackSessionEmailBases(course, session, students, instructors, template, EmailType.FEEDBACK_CLOSED.getSubject(), EmailTemplates.FRAGMENT_CLOSED_SESSION_ADDITIONAL_INSTRUCTIONS, FEEDBACK_ACTION_VIEW); }
Source:
public URL locate(String resourcePath) throws MalformedURLException { if (StringUtils.isEmpty(resourcePath) || "/".equals(resourcePath)) { resourcePath = "index.html"; } if (resourcePath.startsWith("/")) { resourcePath = resourcePath.substring(1); } URL ret; try { ret = URI.create(swaggerUiRoot + resourcePath).toURL(); } catch (Exception ex) { throw new MalformedURLException(ex.getMessage()); } return ret; }

Target:
public URL locate(String resourcePath) throws MalformedURLException { if (StringUtils.isEmpty(resourcePath) || "/".equals(resourcePath)) { resourcePath = "index.html"; } if (resourcePath.startsWith("/")) { resourcePath = resourcePath.substring(1); } URL ret; try { ret = URI.create(swaggerUiRoot + resourcePath).toURL(); } catch (IllegalArgumentException ex) { throw new MalformedURLException(ex.getMessage()); } return ret; }
Source:
public void close() throws IOException { if (isOpen) { isOpen = false; if (numChunksWrittenOut != numChunksTotal) { abort(new RouterException("The ReadableStreamChannel for blob data has been closed by the user.", RouterErrorCode.ChannelClosed)); } } }

Target:
public void close() throws IOException { if (isOpen.compareAndSet(true, false)) { if (numChunksWrittenOut != numChunksTotal) { setOperationException(new RouterException( "The ReadableStreamChannel for blob data has been closed by the user before all chunks were written out.", RouterErrorCode.ChannelClosed)); } } }
Source:
protected TypedQuery<T> createQuery(String jpql) { return entityManager.createQuery(jpql, getType()).setHint("org.hibernate.cacheable", true); }

Target:
protected TypedQuery<T> createQuery(String jpql) { return entityManager.createQuery(jpql, getType()); }
Source:
public void initializeTaskToolbox() throws S3ServiceException { if (taskToolbox == null) { final RestS3Service s3Client = new RestS3Service( new AWSCredentials( PropUtils.getProperty(props, "com.metamx.aws.accessKey"), PropUtils.getProperty(props, "com.metamx.aws.secretKey") ) ); final SegmentPusher segmentPusher = new S3SegmentPusher( s3Client, configFactory.build(S3SegmentPusherConfig.class), jsonMapper ); final SegmentKiller segmentKiller = new S3SegmentKiller( s3Client ); taskToolbox = new TaskToolbox(config, emitter, s3Client, segmentPusher, segmentKiller, jsonMapper); } }

Target:
public void initializeTaskToolbox() throws S3ServiceException { if (taskToolbox == null) { final RestS3Service s3Client = new RestS3Service( new AWSCredentials( PropUtils.getProperty(props, "com.metamx.aws.accessKey"), PropUtils.getProperty(props, "com.metamx.aws.secretKey") ) ); final SegmentPusher segmentPusher = new S3SegmentPusher( s3Client, configFactory.build(S3SegmentPusherConfig.class), jsonMapper ); final SegmentKiller segmentKiller = new S3SegmentKiller( s3Client ); taskToolbox = new TaskToolbox(taskConfig, emitter, s3Client, segmentPusher, segmentKiller, jsonMapper); } }
Source:
private static boolean shouldPerformDiscovery(final SimpleDescriptor desc) { final String discoveryType = desc.getDiscoveryType(); if (discoveryType != null && !discoveryType.isEmpty()) { return true; } final String address = desc.getDiscoveryAddress(); if (address != null && !address.isEmpty()) { return true; } final String cluster = desc.getCluster(); if (cluster != null && !cluster.isEmpty()) { return true; } final String discoveryUser = desc.getDiscoveryUser(); if (discoveryUser != null && !discoveryUser.isEmpty()) { return true; } final String discoveryPass = desc.getDiscoveryPasswordAlias(); if (discoveryPass != null && !discoveryPass.isEmpty()) { return true; } return false; }

Target:
private static boolean shouldPerformDiscovery(final SimpleDescriptor desc) { final String discoveryType = desc.getDiscoveryType(); if (discoveryType != null && !discoveryType.isEmpty()) { return true; } log.missingDiscoveryTypeInDescriptor(desc.getName()); return false; }
Source:
private static void addBoundedContext(ImmutableMap.Builder<TypeUrl, BoundedContext> mapBuilder, BoundedContext boundedContext) { final ImmutableSet<TypeUrl> availableTypes = boundedContext.getStand() .getAvailableTypes(); for (TypeUrl availableType : availableTypes) { mapBuilder.put(availableType, boundedContext); } }

Target:
private static void addBoundedContext(ImmutableMap.Builder<TypeUrl, BoundedContext> mapBuilder, BoundedContext boundedContext) { final Stand stand = boundedContext.getStand(); final ImmutableSet<TypeUrl> exposedTypes = stand.getExposedTypes(); for (TypeUrl availableType : exposedTypes) { mapBuilder.put(availableType, boundedContext); } }
Source:
protected Map<String, List<String>> doGetInternalRoleListOfUsersWithID(List<String> userIDs, String domainName) throws UserStoreException { if (Boolean.parseBoolean(realmConfig.getUserStoreProperty(MULIPLE_ATTRIBUTE_ENABLE))) { List<String> updatedUserNameList = new ArrayList<>(); for (String userID : userIDs) { String userNameAttribute = realmConfig.getUserStoreProperty(LDAPConstants.USER_NAME_ATTRIBUTE); if (userNameAttribute != null && userNameAttribute.trim().length() > 0) { Map<String, String> map = getUserPropertyValues(userID, new String[] { userNameAttribute }, null); String tempUserName = map.get(userNameAttribute); if (tempUserName != null) { updatedUserNameList.add(tempUserName); if (log.isDebugEnabled()) { log.debug( "Replaced user name : " + userID + " from user property value : " + tempUserName); } } else { updatedUserNameList.add(userID); } } else { updatedUserNameList.add(userID); } } userIDs = updatedUserNameList; } return hybridRoleManager.getHybridRoleListOfUsers(userIDs, domainName); }

Target:
protected Map<String, List<String>> doGetInternalRoleListOfUsersWithID(List<String> userIDs, String domainName) throws UserStoreException { if (Boolean.parseBoolean(realmConfig.getUserStoreProperty(MULIPLE_ATTRIBUTE_ENABLE))) { List<String> updatedUserNameList = new ArrayList<>(); for (String userID : userIDs) { String userNameAttribute = realmConfig.getUserStoreProperty(LDAPConstants.USER_NAME_ATTRIBUTE); if (StringUtils.isNotEmpty(userNameAttribute)) { Map<String, String> map = getUserPropertyValues(userID, new String[] { userNameAttribute }, null); String tempUserName = map.get(userNameAttribute); if (tempUserName != null) { updatedUserNameList.add(tempUserName); if (log.isDebugEnabled()) { log.debug( "Replaced user name : " + userID + " from user property value : " + tempUserName); } } else { updatedUserNameList.add(userID); } } else { updatedUserNameList.add(userID); } } userIDs = updatedUserNameList; } return hybridRoleManager.getHybridRoleListOfUsers(userIDs, domainName); }
Source:
protected SegmentCompletionProtocol.Response commit(String controllerVipUrl, boolean isSplitCommit) { SegmentCompletionProtocol.Request.Params params = new SegmentCompletionProtocol.Request.Params(); params.withSegmentName(_segmentNameStr).withStreamPartitionMsgOffset(_currentOffset.toString()) .withNumRows(_numRowsConsumed).withInstanceId(_instanceId) .withBuildTimeMillis(_segmentBuildDescriptor.getBuildTimeMillis()) .withSegmentSizeBytes(_segmentBuildDescriptor.getSegmentSizeBytes()) .withWaitTimeMillis(_segmentBuildDescriptor.getWaitTimeMillis()); if (_isOffHeap) { params.withMemoryUsedBytes(_memoryManager.getTotalAllocatedBytes()); } SegmentCommitter segmentCommitter; if (isSplitCommit) { SegmentUploader segmentUploader; if (this._tableConfig.getValidationConfig().getPeerSegmentDownloadScheme() != null) { segmentUploader = new PinotFSSegmentUploader(_indexLoadingConfig.getSegmentStoreURI(), PinotFSSegmentUploader.DEFAULT_SEGMENT_UPLOAD_TIMEOUT_MILLIS); segmentCommitter = _segmentCommitterFactory.createPeerSchemeSplitSegmentCommitter(params, segmentUploader); } else { try { segmentUploader = new Server2ControllerSegmentUploader(segmentLogger, _protocolHandler.getFileUploadDownloadClient(), _protocolHandler.getSegmentCommitUploadURL(params, controllerVipUrl), _segmentNameStr, ServerSegmentCompletionProtocolHandler.getSegmentUploadRequestTimeoutMs(), _serverMetrics); } catch (URISyntaxException e) { segmentLogger.error("Segment commit upload url error: ", e); return SegmentCompletionProtocol.RESP_NOT_SENT; } segmentCommitter = _segmentCommitterFactory.createSplitSegmentCommitter(params, segmentUploader); } } else { segmentCommitter = _segmentCommitterFactory.createDefaultSegmentCommitter(params); } return segmentCommitter.commit(_segmentBuildDescriptor); }

Target:
protected SegmentCompletionProtocol.Response commit(String controllerVipUrl, boolean isSplitCommit) { SegmentCompletionProtocol.Request.Params params = new SegmentCompletionProtocol.Request.Params(); params.withSegmentName(_segmentNameStr).withStreamPartitionMsgOffset(_currentOffset.toString()) .withNumRows(_numRowsConsumed).withInstanceId(_instanceId) .withBuildTimeMillis(_segmentBuildDescriptor.getBuildTimeMillis()) .withSegmentSizeBytes(_segmentBuildDescriptor.getSegmentSizeBytes()) .withWaitTimeMillis(_segmentBuildDescriptor.getWaitTimeMillis()); if (_isOffHeap) { params.withMemoryUsedBytes(_memoryManager.getTotalAllocatedBytes()); } SegmentCommitter segmentCommitter; try { segmentCommitter = _segmentCommitterFactory.createSegmentCommitter(isSplitCommit, params, controllerVipUrl); } catch (URISyntaxException e) { segmentLogger.error("Failed to create a segment committer: ", e); return SegmentCompletionProtocol.RESP_NOT_SENT; } return segmentCommitter.commit(_segmentBuildDescriptor); }
Source:
public void getAllPatients_shouldFetchVoidedPatientsWhenGivenIncludeVoidedIsTrue() throws Exception { List<Patient> allPatients = patientService.getAllPatients(true); assertEquals(7, allPatients.size()); }

Target:
public void getAllPatients_shouldFetchVoidedPatientsWhenGivenIncludeVoidedIsTrue() throws Exception { List<Patient> allPatients = patientService.getAllPatients(true); assertEquals(6, allPatients.size()); }
Source:
private void processWebhookPayloadBitBucketSelfHosted(JSONObject payload) { JSONObject repo; if (payload.has("repository")) { repo = payload.getJSONObject("repository"); } else if (payload.has("pullRequest")) { repo = payload.getJSONObject("pullRequest").getJSONObject("toRef").getJSONObject("repository"); } else { LOGGER.log(Level.WARNING, "Not possible to trigger job for event '{0}'. Only PR events and pushes are supported for now.", payload.get("eventKey")); LOGGER.log(Level.FINE, payload.toString()); return; } String user = payload.getJSONObject("actor").getString("name"); String url = repo.getJSONObject("project").getString("key").toLowerCase() + "/" + repo.getString("name"); String scm = "git"; probe.triggerMatchingJobs(user, url, scm, payload.toString()); }

Target:
private void processWebhookPayloadBitBucketSelfHosted(JSONObject payload) { JSONObject repo; if (payload.has("repository")) { repo = payload.getJSONObject("repository"); } else if (payload.has("pullRequest")) { repo = payload.getJSONObject("pullRequest").getJSONObject("toRef").getJSONObject("repository"); } else { LOGGER.log(Level.WARNING, "Not possible to trigger job for event '{0}'. Only PR events and pushes are supported for now.", payload.get("eventKey")); LOGGER.log(Level.FINE, payload.toString()); return; } String user = payload.getJSONObject("actor").getString("name"); String url = repo.getJSONObject("project").getString("key").toLowerCase() + "/" + repo.getString("slug"); String scm = "git"; probe.triggerMatchingJobs(user, url, scm, payload.toString()); }
Source:
public FrontendConfig(VerifiableProperties verifiableProperties) { frontendCacheValiditySeconds = verifiableProperties.getLong("frontend.cache.validity.seconds", 365 * 24 * 60 * 60); frontendIdConverterFactory = verifiableProperties .getString("frontend.id.converter.factory", "com.github.ambry.frontend.AmbryIdConverterFactory"); frontendSecurityServiceFactory = verifiableProperties .getString("frontend.security.service.factory", "com.github.ambry.frontend.AmbrySecurityServiceFactory"); frontendPathPrefixesToRemove = Arrays.asList(verifiableProperties.getString("frontend.path.prefixes.to.remove", "").split(",")); frontendChunkedGetResponseThresholdInBytes = verifiableProperties.getInt("ffrontend.chunked.get.response.threshold.in.bytes", 8192); }

Target:
public FrontendConfig(VerifiableProperties verifiableProperties) { frontendCacheValiditySeconds = verifiableProperties.getLong("frontend.cache.validity.seconds", 365 * 24 * 60 * 60); frontendIdConverterFactory = verifiableProperties .getString("frontend.id.converter.factory", "com.github.ambry.frontend.AmbryIdConverterFactory"); frontendSecurityServiceFactory = verifiableProperties .getString("frontend.security.service.factory", "com.github.ambry.frontend.AmbrySecurityServiceFactory"); frontendPathPrefixesToRemove = Arrays.asList(verifiableProperties.getString("frontend.path.prefixes.to.remove", "").split(",")); frontendChunkedGetResponseThresholdInBytes = verifiableProperties.getInt("frontend.chunked.get.response.threshold.in.bytes", 8192); }
Source:
private static boolean hasClass(String className) { try { Class.forName(className); } catch (Exception e) { return false; } return true; }

Target:
private static boolean hasClass(String className) { try { Class.forName(className); } catch (ClassNotFoundException e) { return false; } return true; }
Source:
public List<Entry> getEntries() { return entries; }

Target:
public List<Entry> getEntries() { return Collections.unmodifiableList(entries); }
Source:
public List<LeaderAndIsrPartitionState> partitionStates() { if (partitionStates == null) { synchronized (data) { if (partitionStates == null) { if (version() >= 2) { List<LeaderAndIsrPartitionState> partitionStates = new ArrayList<>(); for (LeaderAndIsrTopicState topicState : data.topicStates()) { for (LeaderAndIsrPartitionState partitionState : topicState.partitionStates()) { partitionState.setTopicName(topicState.topicName()); partitionStates.add(partitionState); } } this.partitionStates = partitionStates; } else { partitionStates = data.ungroupedPartitionStates(); } } } } return partitionStates; }

Target:
public Iterable<LeaderAndIsrPartitionState> partitionStates() { if (version() >= 2) return () -> new FlattenedIterator<>(data.topicStates().iterator(), topicState -> topicState.partitionStates().iterator()); return data.ungroupedPartitionStates(); }
Source:
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) { xml.rightAngleBracket(); return xml; }

Target:
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) { xml.setEmptyElement(); return xml; }
Source:
private CompletableFuture<List<? extends ICodeMining>> provideCodeMinings(@NonNull IDocument document) { URI docURI = LSPEclipseUtils.toUri(document); IFile file = LSPEclipseUtils.getFile(document); if (docURI != null && file != null) { CodeLensParams param = new CodeLensParams(new TextDocumentIdentifier(docURI.toString())); List<LSPCodeMining> codeLensResults = Collections.synchronizedList(new ArrayList<>()); try { Collection<LanguageServerWrapper> serverWrappers = LanguageServiceAccessor.getLSWrappers(file, capabilities -> capabilities.getCodeLensProvider() != null); CompletableFuture<?>[] futures = serverWrappers.stream().map(wrapper -> { String languageServerId = wrapper.serverDefinition.id; CompletableFuture<LanguageServer> server = wrapper.getInitializedServer(); return server .thenComposeAsync(languageServer -> languageServer.getTextDocumentService().codeLens(param) .thenAcceptAsync(codeLenses -> codeLenses.stream().filter(Objects::nonNull) .map(codeLens -> toCodeMining(document, languageServer, languageServerId, codeLens)) .filter(Objects::nonNull).forEach(codeLensResults::add))); }).toArray(CompletableFuture[]::new); return CompletableFuture.allOf(futures).thenApplyAsync(theVoid -> codeLensResults); } catch (IOException e) { LanguageServerPlugin.logError(e); return null; } } return null; }

Target:
private CompletableFuture<List<? extends ICodeMining>> provideCodeMinings(@NonNull IDocument document) { URI docURI = LSPEclipseUtils.toUri(document); if (docURI != null) { CodeLensParams param = new CodeLensParams(new TextDocumentIdentifier(docURI.toString())); List<LSPCodeMining> codeLensResults = Collections.synchronizedList(new ArrayList<>()); return LanguageServiceAccessor .getLanguageServers(document, capabilities -> capabilities.getCodeLensProvider() != null) .thenComposeAsync(languageServers -> CompletableFuture.allOf(languageServers.stream() .map(languageServer -> languageServer.getTextDocumentService().codeLens(param) .thenAcceptAsync(codeLenses -> codeLenses.stream().filter(Objects::nonNull).map(codeLens -> toCodeMining(document, languageServer, codeLens)).filter(Objects::nonNull).forEach(codeLensResults::add))) .toArray(CompletableFuture[]::new))) .thenApplyAsync(theVoid -> codeLensResults); } else { return null; } }
Source:
public int getParentTransactionDepthInBlocks() { return chainHeight - storedOutput.getHeight() + 1; }

Target:
public int getParentTransactionDepthInBlocks() { return chainHeight - output.getHeight() + 1; }
Source:
private static Properties loadDefaultProperties(Class<? extends Messages> leafClass) throws URISyntaxException, IOException { Properties hierarchyProps = new Properties(); ArrayList<Class<? extends Messages>> hierarchy = new ArrayList<Class<? extends Messages>>(); ArrayList<Class<? extends Messages>> round = new ArrayList<Class<? extends Messages>>(); round.add(leafClass); while (!round.isEmpty()) { ArrayList<Class<? extends Messages>> round2 = new ArrayList<Class<? extends Messages>>(); for (Class<? extends Messages> c : round) { hierarchy.add(c); for (Class<?> up : c.getInterfaces()) { if (Messages.class.isAssignableFrom(up) && Messages.class != up) { round2.add((Class<? extends Messages>)up); } } } round = round2; } Collections.reverse(hierarchy); for (Class<?> theClass : hierarchy) { File classDir = new File(theClass.getResource(".").toURI().toASCIIString().replaceAll("file:", "")); File classPropFile = new File(classDir, theClass.getSimpleName() + ".properties"); Properties classProps = classPropFile.exists() ? loadProperties(classPropFile) : new Properties(); hierarchyProps.putAll(classProps); }; return hierarchyProps; }

Target:
private static Properties loadDefaultProperties(Class<? extends Messages> leafClass) throws URISyntaxException, IOException { Properties hierarchyProps = new Properties(); ArrayList<Class<? extends Messages>> hierarchy = new ArrayList<Class<? extends Messages>>(); ArrayList<Class<? extends Messages>> round = new ArrayList<Class<? extends Messages>>(); round.add(leafClass); while (!round.isEmpty()) { ArrayList<Class<? extends Messages>> round2 = new ArrayList<Class<? extends Messages>>(); for (Class<? extends Messages> c : round) { hierarchy.add(c); for (Class<?> up : c.getInterfaces()) { if (Messages.class.isAssignableFrom(up) && Messages.class != up) { round2.add((Class<? extends Messages>)up); } } } round = round2; } Collections.reverse(hierarchy); System.out.println("message hierarchy: " + hierarchy); for (Class<?> theClass : hierarchy) { String classPropertyFileName = theClass.getName().replace(".", "/") + ".properties"; System.out.println("theClass: " + theClass + ", classPropertyFileName: " + classPropertyFileName); URL theResource = theClass.getResource(classPropertyFileName); if (theResource == null) { theResource = theClass.getResource(theClass.getSimpleName() + ".properties"); } System.out.println("theResource: " + theResource); Properties classProps = new Properties(); try (InputStream input = theResource.openStream()) { classProps.load(input); } hierarchyProps.putAll(classProps); }; return hierarchyProps; }
Source:
public static Optional<Boolean> getInitParameter(MailetConfig config, String name) { Object value = config.getInitParameter(name, Boolean.class); if(value != null){ if(Boolean.class.isInstance(value)){ return Optional.of((Boolean)value); } else throw new ClassCastException(name + " property is not of type " + Boolean.class); } else return Optional.empty(); }

Target:
public static Optional<Boolean> getInitParameter(MailetConfig config, String name) { return Optional.ofNullable(config.getInitParameter(name, Boolean.class)); }
Source:
private boolean hasNonProjects() { for (IResource fResource : fResources) { if (!ReorgUtils.isProject(fResource)) { return true; } } for (IJavaElement fJavaElement : fJavaElements) { if (!ReorgUtils.isProject(fJavaElement)) { return true; } } return false; }

Target:
private boolean hasNonProjects() { for (IResource resource : fResources) { if (!ReorgUtils.isProject(resource)) { return true; } } for (IJavaElement javaElement : fJavaElements) { if (!ReorgUtils.isProject(javaElement)) { return true; } } return false; }
Source:
public void unscheduleTask() { while (true) { if (scheduledFuture == null) { Thread.yield(); } else { scheduledFuture.cancel(false); scheduledFuture = null; } } }

Target:
public void unscheduleTask() { while (true) { if (scheduledFuture == null) { Thread.yield(); } else { scheduledFuture.cancel(false); scheduledFuture = null; return; } } }
Source:
public boolean isEmpty() { fOutputLock.lock(); try { return (fInputBuffer.isEmpty() && fOutputBuffer.isEmpty() && fInnerQueue.isEmpty()); } finally { fOutputLock.unlock(); } }

Target:
public boolean isEmpty() { return fQueueSize.get() == 0; }