auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void propagateMetadataFromProps(Map<String, String> metaData, Props inputProps, String nodeType, String nodeName, Logger logger) { if (null == metaData || null == inputProps || null == logger || Strings.isNullOrEmpty(nodeType) || Strings.isNullOrEmpty(nodeName)) { throw new IllegalArgumentException("Input params should not be null or empty."); } final String propsToPropagate = inputProps.getString(AZKABAN_EVENT_REPORTING_PROPERTIES_TO_PROPAGATE); if (Strings.isNullOrEmpty(propsToPropagate)) { logger.info(String.format("No properties to propagate to metadata for %s: %s", nodeType, nodeName)); return; } else { logger.info(String.format("Propagating: %s to metadata for %s: %s", propsToPropagate, nodeType, nodeName)); } final List<String> propsToPropagateList = SPLIT_ON_COMMA.splitToList(propsToPropagate); for (String propKey : propsToPropagateList) { if (!inputProps.containsKey(propKey)) { logger.warn(String.format("%s does not contains: %s property; " + "skipping propagation to metadata", nodeName, propKey)); continue; } metaData.put(propKey, inputProps.getString(propKey)); } }

Target:
static void propagateMetadataFromProps(Map<String, String> metaData, Props inputProps, String nodeType, String nodeName, Logger logger) { if (!inputProps.containsKey(AZKABAN_EVENT_REPORTING_PROPERTIES_TO_PROPAGATE)) { return; } if (null == metaData || null == inputProps || null == logger || Strings.isNullOrEmpty(nodeType) || Strings.isNullOrEmpty(nodeName)) { throw new IllegalArgumentException("Input params should not be null or empty."); } final String propsToPropagate = inputProps.getString(AZKABAN_EVENT_REPORTING_PROPERTIES_TO_PROPAGATE); if (Strings.isNullOrEmpty(propsToPropagate)) { logger.info(String.format("No properties to propagate to metadata for %s: %s", nodeType, nodeName)); return; } else { logger.info(String.format("Propagating: %s to metadata for %s: %s", propsToPropagate, nodeType, nodeName)); } final List<String> propsToPropagateList = SPLIT_ON_COMMA.splitToList(propsToPropagate); for (String propKey : propsToPropagateList) { if (!inputProps.containsKey(propKey)) { logger.warn(String.format("%s does not contains: %s property; " + "skipping propagation to metadata", nodeName, propKey)); continue; } metaData.put(propKey, inputProps.getString(propKey)); } }
Source:
public String getHost() { String[] hosts = _host.split(","); if (_hostCounter >= hosts.length) { _hostCounter = 0; } s_logger.info("Connecting to host: " + hosts[_hostCounter % hosts.length]); return hosts[_hostCounter++ % hosts.length]; }

Target:
public String getHost() { final String[] hosts = _host.split(","); if (_hostCounter >= hosts.length) { _hostCounter = 0; } final String host = hosts[_hostCounter % hosts.length]; _hostCounter++; return host; }
Source:
public static CreateTableRequest adapt(HTableDescriptor desc, byte[][] splitKeys) { CreateTableRequest createTableRequest = CreateTableRequest.of(desc.getTableName().getNameAsString()); adapt(createTableRequest, desc); addSplitKeys(createTableRequest, splitKeys); return createTableRequest; }

Target:
public static CreateTableRequest adapt(HTableDescriptor desc, byte[][] splitKeys) { CreateTableRequest request = CreateTableRequest.of(desc.getTableName().getNameAsString()); adapt(desc, request); addSplitKeys(splitKeys, request); return request; }
Source:
public void parseAccountId() { AccountId accountId = BridgeUtils.parseAccountId("test", "identifier"); assertEquals("test", accountId.getStudyId()); assertEquals("identifier", accountId.getId()); accountId = BridgeUtils.parseAccountId("test", "externalid:identifier"); assertEquals("test", accountId.getStudyId()); assertEquals("identifier", accountId.getExternalId()); accountId = BridgeUtils.parseAccountId("test", "externalId:identifier"); assertEquals("test", accountId.getStudyId()); assertEquals("identifier", accountId.getExternalId()); accountId = BridgeUtils.parseAccountId("test", "healthcode:identifier"); assertEquals("test", accountId.getStudyId()); assertEquals("identifier", accountId.getHealthCode()); accountId = BridgeUtils.parseAccountId("test", "healthCode:identifier"); assertEquals("test", accountId.getStudyId()); assertEquals("identifier", accountId.getHealthCode()); accountId = BridgeUtils.parseAccountId("test", "unk:identifier"); assertEquals("test", accountId.getStudyId()); assertEquals("unk:identifier", accountId.getId()); }

Target:
public void parseAccountId() { AccountId accountId = BridgeUtils.parseAccountId("test", "IdentifierA9"); assertEquals("test", accountId.getStudyId()); assertEquals("IdentifierA9", accountId.getId()); accountId = BridgeUtils.parseAccountId("test", "externalid:IdentifierA9"); assertEquals("test", accountId.getStudyId()); assertEquals("IdentifierA9", accountId.getExternalId()); accountId = BridgeUtils.parseAccountId("test", "externalId:IdentifierA9"); assertEquals("test", accountId.getStudyId()); assertEquals("IdentifierA9", accountId.getExternalId()); accountId = BridgeUtils.parseAccountId("test", "healthcode:IdentifierA9"); assertEquals("test", accountId.getStudyId()); assertEquals("IdentifierA9", accountId.getHealthCode()); accountId = BridgeUtils.parseAccountId("test", "healthCode:IdentifierA9"); assertEquals("test", accountId.getStudyId()); assertEquals("IdentifierA9", accountId.getHealthCode()); accountId = BridgeUtils.parseAccountId("test", "unk:IdentifierA9"); assertEquals("test", accountId.getStudyId()); assertEquals("unk:IdentifierA9", accountId.getId()); }
Source:
public void start(C configuration, EmbeddedCacheManager cacheManager) { if (log.isDebugEnabled()) { log.debugf("Starting server with configuration: %s", configuration); } this.configuration = configuration; this.cacheManager = cacheManager; BasicComponentRegistry bcr = SecurityActions.getGlobalComponentRegistry(cacheManager).getComponent(BasicComponentRegistry.class.getName()); cacheIgnore = bcr.getComponent(CacheIgnoreManager.class).running(); if (cacheIgnore == null) { throw new IllegalStateException("CacheIgnoreManager is a required component"); } executor = bcr.getComponent(KnownComponentNames.BLOCKING_EXECUTOR, ExecutorService.class).running(); if (executor instanceof BlockingTaskAwareExecutorServiceImpl) { manageableThreadPoolExecutorService = new ManageableThreadPoolExecutorService( ((BlockingTaskAwareExecutorServiceImpl) executor).getExecutorService()); } else { manageableThreadPoolExecutorService = new ManageableThreadPoolExecutorService(executor); } try { startInternal(); } catch (RuntimeException t) { stop(); throw t; } }

Target:
public void start(C configuration, EmbeddedCacheManager cacheManager) { if (log.isDebugEnabled()) { log.debugf("Starting server with configuration: %s", configuration); } this.configuration = configuration; this.cacheManager = cacheManager; BasicComponentRegistry bcr = SecurityActions.getGlobalComponentRegistry(cacheManager).getComponent(BasicComponentRegistry.class.getName()); cacheIgnore = bcr.getComponent(CacheIgnoreManager.class).running(); if (cacheIgnore == null) { throw new IllegalStateException("CacheIgnoreManager is a required component"); } executor = bcr.getComponent(KnownComponentNames.BLOCKING_EXECUTOR, ExecutorService.class).running(); manageableThreadPoolExecutorService = new ManageableThreadPoolExecutorService(executor); try { startInternal(); } catch (RuntimeException t) { stop(); throw t; } }
Source:
public InvokeCancel(BigInteger jobId) { super(); this.jobId = jobId; this.userName = ""; }

Target:
public InvokeCancel(BigInteger jobId) { super(); this.jobId = jobId; this.userName = null; }
Source:
protected synchronized void processGetNodeData(GetNodeDataMessage msg) { if (logger.isTraceEnabled()) logger.trace( "Peer {}: processing GetNodeData, size [{}]", channel.getPeerIdShort(), msg.getStateRoots().size() ); List<Value> states = new ArrayList<>(); RepositoryRoot repositoryRoot = ((RepositoryRoot) repository); for (byte[] stateRoot : msg.getStateRoots()) { Value value = repositoryRoot.getState(stateRoot); if (value != null) { states.add(value); logger.trace("Eth63: " + Hex.toHexString(stateRoot).substring(0, 8) + " -> " + value); } else { } } sendMessage(new NodeDataMessage(states)); }

Target:
protected synchronized void processGetNodeData(GetNodeDataMessage msg) { if (logger.isTraceEnabled()) logger.trace( "Peer {}: processing GetNodeData, size [{}]", channel.getPeerIdShort(), msg.getNodeKeys().size() ); List<Value> nodeValues = new ArrayList<>(); for (byte[] nodeKey : msg.getNodeKeys()) { byte[] rawNode = stateSource.get(nodeKey); if (rawNode != null) { Value value = new Value(rawNode); nodeValues.add(value); logger.trace("Eth63: " + Hex.toHexString(nodeKey).substring(0, 8) + " -> " + value); } } sendMessage(new NodeDataMessage(nodeValues)); }
Source:
public static BluetoothGattDescriptor getClientCharacteristicConfigurationDescriptor() { BluetoothGattDescriptor descriptor = new BluetoothGattDescriptor( CLIENT_CHARACTERISTIC_CONFIGURATION_UUID, (BluetoothGattDescriptor.PERMISSION_READ | BluetoothGattDescriptor.PERMISSION_WRITE)); try { descriptor.setValue(new byte[]{0, 0}); } finally { return descriptor; } }

Target:
public static BluetoothGattDescriptor getClientCharacteristicConfigurationDescriptor() { BluetoothGattDescriptor descriptor = new BluetoothGattDescriptor( CLIENT_CHARACTERISTIC_CONFIGURATION_UUID, (BluetoothGattDescriptor.PERMISSION_READ | BluetoothGattDescriptor.PERMISSION_WRITE)); descriptor.setValue(new byte[]{0, 0}); return descriptor; }
Source:
public void equal_shouldReturnFalseIfOnlyStartDateOfOneObjectIsNull() { CohortMembership cohortMembershipOne = new CohortMembership(13); CohortMembership cohortMembershipTwo = new CohortMembership(12); Date startDate1 = null; Date endDate1 = new Date(1577836801); Date startDate2 = new Date(1545140935); Date endDate2 = null; cohortMembershipOne.setEndDate(endDate1); cohortMembershipOne.setStartDate(startDate1); cohortMembershipTwo.setStartDate(startDate2); cohortMembershipTwo.setEndDate(endDate2); assertFalse(cohortMembershipOne.equals(cohortMembershipTwo)); }

Target:
public void equal_shouldReturnFalseIfOnlyStartDateOfOneObjectIsNull() { final int PATIENT_ID = 12; CohortMembership cohortMembershipOne = new CohortMembership(PATIENT_ID); CohortMembership cohortMembershipTwo = new CohortMembership(PATIENT_ID); final int TIMESTAMP_END_DATE = 1577836801; Date startDate1 = null; Date endDate1 = new Date(TIMESTAMP_END_DATE); Date startDate2 = new Date(1545140935); Date endDate2 = new Date(TIMESTAMP_END_DATE); cohortMembershipOne.setEndDate(endDate1); cohortMembershipOne.setStartDate(startDate1); cohortMembershipTwo.setStartDate(startDate2); cohortMembershipTwo.setEndDate(endDate2); assertFalse(cohortMembershipOne.equals(cohortMembershipTwo)); }
Source:
private synchronized Text[] getCutPoints() throws IOException { if (cutPointArray == null) { String cutFileName = conf.get(CUTFILE_KEY); Path[] cf = DistributedCacheHelper.getLocalCacheFiles(conf); if (cf != null) { for (Path path : cf) { if (path.toUri().getPath() .endsWith(cutFileName.substring(cutFileName.lastIndexOf('/')))) { TreeSet<Text> cutPoints = new TreeSet<>(); try (Scanner in = new Scanner(new BufferedReader( new InputStreamReader(new FileInputStream(path.toString()), UTF_8)))) { while (in.hasNextLine()) cutPoints.add(new Text(Base64.getDecoder().decode(in.nextLine()))); } cutPointArray = cutPoints.toArray(new Text[cutPoints.size()]); break; } } } if (cutPointArray == null) throw new FileNotFoundException(cutFileName + " not found in distributed cache"); } return cutPointArray; }

Target:
private synchronized Text[] getCutPoints() throws IOException { if (cutPointArray == null) { String cutFileName = conf.get(CUTFILE_KEY); Path[] cf = Job.getInstance().getLocalCacheFiles(); if (cf != null) { for (Path path : cf) { if (path.toUri().getPath() .endsWith(cutFileName.substring(cutFileName.lastIndexOf('/')))) { TreeSet<Text> cutPoints = new TreeSet<>(); try (Scanner in = new Scanner(new BufferedReader( new InputStreamReader(new FileInputStream(path.toString()), UTF_8)))) { while (in.hasNextLine()) cutPoints.add(new Text(Base64.getDecoder().decode(in.nextLine()))); } cutPointArray = cutPoints.toArray(new Text[cutPoints.size()]); break; } } } if (cutPointArray == null) throw new FileNotFoundException(cutFileName + " not found in distributed cache"); } return cutPointArray; }
Source:
public boolean touch(ResourceLoader resourceLoader, ContainerContext context) throws Exception { ServletContext sc = context.getServletContext(); return "DecoratingListener".equals(sc.getAttribute("org.eclipse.jetty.cdi")); }

Target:
public boolean touch(ResourceLoader resourceLoader, ContainerContext context) throws Exception { ServletContext sc = context.getServletContext(); return sc.getAttribute(JETTY_DECORATING_ATTRIBUTE) instanceof String || JETTY_CDI_VALUE.equals(sc.getAttribute(JETTY_CDI_ATTRIBUTE)); }
Source:
private Image getReviewStateImage(int reviewScore) { switch (reviewScore) { case -2: return CommonImages.getImage(ReviewsImages.RED_NOT); case -1: return CommonImages.getImage(ReviewsImages.MINUS_ONE); case 1: return CommonImages.getImage(ReviewsImages.PLUS_ONE); case 2: return CommonImages.getImage(ReviewsImages.GREEN_CHECK); } return null; }

Target:
private Image getReviewStateImage(int reviewScore) { switch (reviewScore) { case MINUS_TWO: return CommonImages.getImage(ReviewsImages.RED_NOT); case MINUS_ONE: return CommonImages.getImage(ReviewsImages.MINUS_ONE); case PLUS_ONE: return CommonImages.getImage(ReviewsImages.PLUS_ONE); case PLUS_TWO: return CommonImages.getImage(ReviewsImages.GREEN_CHECK); } return null; }
Source:
static MapSettings.Builder builder() { return Sponge.getGame().getRegistry().createBuilder(Builder.class); }

Target:
static Builder builder() { return Sponge.getGame().getRegistry().createBuilder(Builder.class); }
Source:
public void makeOnCreationCallbackListBoxMultipleSelect() { setupMultipleSelectTest(CallbackFactory.MAX_VISIBLE_ROWS, true); final Callback callback = CallbackFactory.makeOnCreationCallback(factory, cell, enumLookups); callback.callback(multiValueDOMElement); verifyMultipleSelectTest(CallbackFactory.MAX_VISIBLE_ROWS); }

Target:
public void makeOnCreationCallbackListBoxMultipleSelect() { setupMultipleSelectTest(CallbackFactory.MAX_VISIBLE_ROWS, true); final Callback callback = CallbackFactory.makeOnCreationCallback(factory, cell, enumLookups); callback.callback(multiValueDOMElement); verifyMultipleSelectTest(CallbackFactory.MAX_VISIBLE_ROWS); verify(multiValueWidget).setVisibleItemCount(eq(CallbackFactory.MAX_VISIBLE_ROWS)); }
Source:
public CompletableFuture<Void> visitRemoveCommand(InvocationContext ctx, RemoveCommand command) throws Throwable { ctx.onReturn((ctx1, command1, rv, throwable) -> { if (throwable != null) throw throwable; if (!isStoreEnabled(command) || ctx.isInTxScope() || !command.isSuccessful()) return null; if (!isProperWriter(ctx, command, command.getKey())) return null; Object key = command.getKey(); boolean resp = persistenceManager.deleteFromAllStores(key, BOTH); if (trace) getLog().tracef("Removed entry under key %s and got response %s from CacheStore", key, resp); return null; }); return ctx.continueInvocation(); }

Target:
public CompletableFuture<Void> visitRemoveCommand(InvocationContext ctx, RemoveCommand command) throws Throwable { return ctx.onReturn((rCtx, rCommand, rv, throwable) -> { if (throwable != null) throw throwable; RemoveCommand removeCommand = (RemoveCommand) rCommand; if (!isStoreEnabled(removeCommand) || rCtx.isInTxScope() || !removeCommand.isSuccessful()) return null; if (!isProperWriter(rCtx, removeCommand, removeCommand.getKey())) return null; Object key = removeCommand.getKey(); boolean resp = persistenceManager.deleteFromAllStores(key, BOTH); if (trace) getLog().tracef("Removed entry under key %s and got response %s from CacheStore", key, resp); return null; }); }
Source:
public void onResume() { super.onResume(); authWebView.onResume(); swipeContainer.setEnabled(false); if (hasComponentCallback != null) { final CourseComponent component = hasComponentCallback.getComponent(); if (component != null && component.equals(unit)) { authWebView.loadUrl(false, unit.getBlockUrl()); } } }

Target:
public void onResume() { super.onResume(); authWebView.onResume(); if (hasComponentCallback != null) { final CourseComponent component = hasComponentCallback.getComponent(); if (component != null && component.equals(unit)) { authWebView.loadUrl(false, unit.getBlockUrl()); } } }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/finalPostProcessing"); ocUndistorted = dynamicFBM.getFBO(OC_UNDISTORTED_URN); sceneFinal = dynamicFBM.getFBO(DefaultDynamicFBOs.Final.getResourceUrn()); sceneOpaque = dynamicFBM.getFBO(DefaultDynamicFBOs.ReadOnlyGBuffer.getResourceUrn()); fullScale = sceneOpaque.dimensions(); if (!renderingDebugConfig.isEnabled()) { finalPost.enable(); } else { debug.enable(); } if (!renderingConfig.isOculusVrSupport()) { renderFinalMonoImage(); } else { renderFinalStereoImage(worldRenderer.getCurrentRenderStage()); } PerformanceMonitor.endActivity(); }

Target:
public void process() { PerformanceMonitor.startActivity("rendering/finalPostProcessing"); ocUndistorted = displayResolutionDependentFBOs.get(OC_UNDISTORTED); fullScale = READ_ONLY_GBUFFER.dimensions(); if (!renderingDebugConfig.isEnabled()) { finalPost.enable(); } else { debug.enable(); } if (!renderingConfig.isOculusVrSupport()) { renderFinalMonoImage(); } else { renderFinalStereoImage(worldRenderer.getCurrentRenderStage()); } PerformanceMonitor.endActivity(); }
Source:
private void processTCD(Attribution attribution, WebResourceImpl wRes) { Map<String, List<String>> creatorMap = new HashMap<>(); if (creatorMap.size() == 0 && isNotBlank(wRes.getDcCreator())) { creatorMap.putAll(createCreatorMap(wRes.getDcCreator())); } checkProxy(((AggregationImpl) wRes.getParentAggregation()).getParentBean().getProxies(), attribution, creatorMap); if (attribution.getTitle().size() == 0 && ArrayUtils.isNotEmpty(((AggregationImpl) wRes.getParentAggregation()).getParentBean().getTitle())) { attribution.getTitle().put("", collectListInLines(Arrays.asList(stripEmptyStrings(((AggregationImpl) wRes.getParentAggregation()).getParentBean().getTitle())))); } checkEuropeanaAggregration(attribution, ((AggregationImpl) wRes.getParentAggregation()).getParentBean().getEuropeanaAggregation(), creatorMap); checkCreatorLabel(attribution, (List<Agent>) ((AggregationImpl) wRes.getParentAggregation()).getParentBean().getAgents(), creatorMap); }

Target:
private void processTCD(Attribution attribution, WebResourceImpl wRes) { Map<String, List<String>> creatorMap = new HashMap<>(); if (isNotBlank(wRes.getDcCreator())) { creatorMap.putAll(createCreatorMap(wRes.getDcCreator())); } checkProxy(((AggregationImpl) wRes.getParentAggregation()).getParentBean().getProxies(), attribution, creatorMap); if (attribution.getTitle().isEmpty() && ArrayUtils.isNotEmpty( ((AggregationImpl) wRes.getParentAggregation()).getParentBean().getTitle())) { attribution.getTitle().put("", collectListInLines(Arrays.asList( stripEmptyStrings(((AggregationImpl) wRes.getParentAggregation()).getParentBean().getTitle())))); } checkEuropeanaAggregration(attribution, ((AggregationImpl) wRes.getParentAggregation()).getParentBean() .getEuropeanaAggregation(), creatorMap); checkCreatorLabel(attribution, (List<Agent>) ((AggregationImpl) wRes.getParentAggregation()).getParentBean().getAgents(), creatorMap); }
Source:
private DateTime calc(DateTime current, long periodMs) { return new DateTime(getNextTimeAdjustedByDay( current.getMillis(), periodMs, current.getZone()) ); }

Target:
private DateTime calc(DateTime current, long periodMs) { return new DateTime(DateTimeUtils.getNextTimeAdjustedByDay( current.getMillis(), periodMs, current.getZone()) ); }
Source:
public void testNotLogUserExceptionsAsMissingProperties() { OgnlValueStack vs = createValueStack(); vs.setLogMissingProperties("true"); Dog dog = new Dog(); vs.push(dog); TestAppender testAppender = new TestAppender(); Logger logger = (Logger) LogManager.getLogger(OgnlValueStack.class); logger.addAppender(testAppender); testAppender.start(); try { vs.setValue("exception", "exceptionValue", false); vs.findValue("exception", false); vs.findValue("exception", String.class, false); vs.findValue("getException()", false); vs.findValue("getException()", String.class, false); vs.findValue("bite", false); vs.findValue("bite", void.class, false); vs.findValue("getBite()", false); vs.findValue("getBite()", void.class, false); assertEquals(0, testAppender.logEvents.size()); } finally { testAppender.stop(); logger.removeAppender(testAppender); } }

Target:
public void testNotLogUserExceptionsAsMissingProperties() { OgnlValueStack vs = createValueStack(); vs.setLogMissingProperties("true"); Dog dog = new Dog(); vs.push(dog); TestAppender testAppender = new TestAppender(); Logger logger = (Logger) LogManager.getLogger(OgnlValueStack.class); logger.addAppender(testAppender); testAppender.start(); try { vs.setValue("exception", "exceptionValue", false); vs.findValue("exception", false); vs.findValue("exception", String.class, false); vs.findValue("getException()", false); vs.findValue("getException()", String.class, false); vs.findValue("bite", false); vs.findValue("bite", void.class, false); vs.findValue("getBite()", false); vs.findValue("getBite()", void.class, false); vs.setLogMissingProperties("false"); vs.setValue("exception", "exceptionValue", false); vs.findValue("exception", false); vs.findValue("exception", String.class, false); vs.findValue("getException()", false); vs.findValue("getException()", String.class, false); vs.findValue("bite", false); vs.findValue("bite", void.class, false); vs.findValue("getBite()", false); vs.findValue("getBite()", void.class, false); assertEquals(0, testAppender.logEvents.size()); } finally { testAppender.stop(); logger.removeAppender(testAppender); } }
Source:
public LinkedList<NavigatorLink> getNavigatorLinks(@RequestParam("entity") String entityTypeId) { LinkedList<NavigatorLink> result = new LinkedList<>(); EntityType entityType = dataService.getEntityType(entityTypeId); if (entityType != null) { Package pack = entityType.getPackage(); getNavigatorLinks(result, pack); result.add(NavigatorLink.create(menuReaderService.getMenu().findMenuItemPath(NAVIGATOR) + "/", "glyphicon-home")); Collections.reverse(result); } return result; }

Target:
public List<NavigatorLink> getNavigatorLinks(@RequestParam("entity") String entityTypeId) { List<NavigatorLink> result = new LinkedList<>(); EntityType entityType = dataService.getEntityType(entityTypeId); String navigatorPath = menuReaderService.getMenu().findMenuItemPath(NAVIGATOR); if (entityType != null) { Package pack = entityType.getPackage(); getNavigatorLinks(result, pack, navigatorPath); result.add(NavigatorLink.create(navigatorPath + "/", "glyphicon-home")); Collections.reverse(result); } return result; }
Source:
public boolean updateChannelInfoFromDatabase() { ChannelDao cd = DaoFactory.getInstance().getChannelDao(context, DaoFactory.DaoType.SQLITE_DAO, null); List<Channel> channelList = cd.findAll(); if (null == channelList) return false; for (Channel aChannel : channelList) { channelMap.put(aChannel.getChannelIdentifier(), aChannel); } return true; }

Target:
public boolean updateChannelInfoFromDatabase() { ChannelDao cd = DaoFactory.getInstance().getChannelDao(context, DaoFactory.DaoType.SQLITE_DAO, null); if (null == cd) return false; List<Channel> channelList = cd.findAll(); for (Channel aChannel : channelList) { channelMap.put(aChannel.getChannelIdentifier(), aChannel); } return true; }
Source:
public void process(final KeyFilter filter, final CacheLoaderTask task, Executor executor, boolean fetchValue, boolean fetchMetadata) { scanForUnknownDirectories(); ExecutorAllCompletionService eacs = new ExecutorAllCompletionService(executor); final TaskContextImpl taskContext = new TaskContextImpl(); for (final DirectoryLoaderAdaptor dir : openDirectories.values()) { eacs.submit(new Callable<Void>() { @Override public Void call() throws Exception { try { final HashSet<MarshalledEntry> allInternalEntries = new HashSet<MarshalledEntry>(); dir.loadAllEntries(allInternalEntries, Integer.MAX_VALUE, ctx.getMarshaller()); for (MarshalledEntry me : allInternalEntries) { if (taskContext.isStopped()) break; if (filter == null || filter.shouldLoadKey(me.getKey())) { task.processEntry(me, taskContext); } } return null; } catch (Exception e) { log.errorExecutingParallelStoreTask(e); throw e; } } }); } eacs.waitUntilAllCompleted(); if (eacs.isExceptionThrown()) { throw new CacheLoaderException("Execution exception!"); } }

Target:
public void process(final KeyFilter filter, final CacheLoaderTask task, Executor executor, boolean fetchValue, boolean fetchMetadata) { scanForUnknownDirectories(); ExecutorAllCompletionService eacs = new ExecutorAllCompletionService(executor); final TaskContextImpl taskContext = new TaskContextImpl(); for (final DirectoryLoaderAdaptor dir : openDirectories.values()) { eacs.submit(new Callable<Void>() { @Override public Void call() throws Exception { try { final HashSet<MarshalledEntry> allInternalEntries = new HashSet<MarshalledEntry>(); dir.loadAllEntries(allInternalEntries, Integer.MAX_VALUE, ctx.getMarshaller()); for (MarshalledEntry me : allInternalEntries) { if (taskContext.isStopped()) break; if (filter == null || filter.shouldLoadKey(me.getKey())) { task.processEntry(me, taskContext); } } return null; } catch (Exception e) { log.errorExecutingParallelStoreTask(e); throw e; } } }); } eacs.waitUntilAllCompleted(); if (eacs.isExceptionThrown()) { throw new CacheLoaderException("Execution exception!", eacs.getFirstException()); } }
Source:
public void registerDefaults() { register((Criterion) IScoreCriteria.DUMMY); register((Criterion) IScoreCriteria.TRIGGER); register((Criterion) IScoreCriteria.HEALTH); register((Criterion) IScoreCriteria.PLAYER_KILL_COUNT); register((Criterion) IScoreCriteria.TOTAL_KILL_COUNT); register((Criterion) IScoreCriteria.DEATH_COUNT); register((Criterion) IScoreCriteria.FOOD); register((Criterion) IScoreCriteria.AIR); register((Criterion) IScoreCriteria.ARMOR); register((Criterion) IScoreCriteria.XP); register((Criterion) IScoreCriteria.LEVEL); for (Map.Entry<TextFormatting, SpongeTextColor> entry : TextColorRegistryModule.enumChatColor.entrySet()) { final int colorIndex = entry.getKey().getColorIndex(); if (colorIndex < 0) { continue; } final String id = entry.getValue().getId(); final Criterion teamKillCriterion = (Criterion) IScoreCriteria.TEAM_KILL[colorIndex]; register(teamKillCriterion); teamKillMappings.put(id, teamKillCriterion); final Criterion killedByTeamCriterion = (Criterion) IScoreCriteria.KILLED_BY_TEAM[colorIndex]; register(killedByTeamCriterion); killedByTeamMappings.put(id, killedByTeamCriterion); } }

Target:
public void registerDefaults() { IScoreCriteria.INSTANCES.values().forEach(scoreCriterion -> { final Criterion criterion = (Criterion) scoreCriterion; this.register(criterion); criterion.getTeamColor().ifPresent(color -> { this.teamKillMappings.put(color.getId(), criterion); this.killedByTeamMappings.put(color.getId(), criterion); }); }); }
Source:
public DBObject convertStats(VariantStats variantStats) { BasicDBObject mongoStats = new BasicDBObject(MAF_FIELD, variantStats.getMaf()); mongoStats.append(MGF_FIELD, variantStats.getMgf()); mongoStats.append(MAFALLELE_FIELD, variantStats.getMafAllele()); mongoStats.append(MGFGENOTYPE_FIELD, variantStats.getMgfGenotype()); mongoStats.append(MISSALLELE_FIELD, variantStats.getMissingAlleles()); mongoStats.append(MISSGENOTYPE_FIELD, variantStats.getMissingGenotypes()); BasicDBObject genotypes = new BasicDBObject(); for (Map.Entry<Genotype, Integer> g : variantStats.getGenotypesCount().entrySet()) { String genotypeStr = g.getKey().toString().replace(".", "-1"); genotypes.append(genotypeStr, g.getValue()); } mongoStats.append(NUMGT_FIELD, genotypes); return mongoStats; }

Target:
private DBObject convertStats(VariantStats variantStats) { BasicDBObject mongoStats = new BasicDBObject(MAF_FIELD, variantStats.getMaf()); mongoStats.append(MGF_FIELD, variantStats.getMgf()); mongoStats.append(MAFALLELE_FIELD, variantStats.getMafAllele()); mongoStats.append(MGFGENOTYPE_FIELD, variantStats.getMgfGenotype()); mongoStats.append(MISSALLELE_FIELD, variantStats.getMissingAlleles()); mongoStats.append(MISSGENOTYPE_FIELD, variantStats.getMissingGenotypes()); BasicDBObject genotypes = new BasicDBObject(); for (Map.Entry<Genotype, Integer> g : variantStats.getGenotypesCount().entrySet()) { String genotypeStr = g.getKey().toString().replace(".", "-1"); genotypes.append(genotypeStr, g.getValue()); } mongoStats.append(NUMGT_FIELD, genotypes); return mongoStats; }
Source:
public static ExecutionFailureInfo toFailure(Throwable failure) { return toFailure(failure, new HashSet<>()); }

Target:
public static ExecutionFailureInfo toFailure(Throwable failure) { return toFailure(failure, newIdentityHashSet()); }
Source:
public Job<?,?> getProject() { return project; }

Target:
public AbstractProject getProject() { return project instanceof AbstractProject ? (AbstractProject)project : null; }
Source:
private void initPreApplicationState() { logger.info(Utility.version(VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)); UI.events = this; Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> logger.error(throwable.getMessage(), throwable)); TestController.setUI(this, getParameters()); prefs = new Preferences(TestController.getTestConfigFile(false)); KeyboardShortcuts.loadKeyboardShortcuts(prefs); eventBus = new EventBus(); if (TestController.isTestMode()) { registerTestEvents(); } registerEvent((UnusedStoredReposChangedEventHandler) e -> onRepoOpened()); registerEvent((UsedReposChangedEventHandler) e -> removeUnusedModelsAndUpdate()); uiManager = new UIManager(this); status = new HTStatusBar(this); }

Target:
private void initPreApplicationState() { logger.info(Utility.version(VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)); UI.events = this; Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> logger.error(throwable.getMessage(), throwable)); TestController.setUI(this, getParameters()); prefs = TestController.createApplicationPreference(); KeyboardShortcuts.loadKeyboardShortcuts(prefs); eventBus = new EventBus(); if (TestController.isTestMode()) { registerTestEvents(); } registerEvent((UnusedStoredReposChangedEventHandler) e -> onRepoOpened()); registerEvent((UsedReposChangedEventHandler) e -> removeUnusedModelsAndUpdate()); uiManager = new UIManager(this); status = new HTStatusBar(this); }
Source:
private void persistGrillServiceState() throws IOException { FileSystem fs = persistDir.getFileSystem(conf); for (GrillService service : grillServices) { LOG.info("Persisting state of service:" + service.getName()); Path serviceWritePath = new Path(persistDir, service.getName() + ".out"); ObjectOutputStream out = null; try { out = new ObjectOutputStream(fs.create(serviceWritePath)); service.writeExternal(out); } finally { out.close(); } Path servicePath = getServicePersistPath(service); fs.rename(serviceWritePath, servicePath); } }

Target:
private void persistGrillServiceState() throws IOException { if (conf.getBoolean(GrillConfConstants.GRILL_SERVER_RESTART_ENABLED, GrillConfConstants.DEFAULT_GRILL_SERVER_RESTART_ENABLED)) { FileSystem fs = persistDir.getFileSystem(conf); for (GrillService service : grillServices) { LOG.info("Persisting state of service:" + service.getName()); Path serviceWritePath = new Path(persistDir, service.getName() + ".out"); ObjectOutputStream out = null; try { out = new ObjectOutputStream(fs.create(serviceWritePath)); service.writeExternal(out); } finally { if (out != null) { out.close(); } } Path servicePath = getServicePersistPath(service); fs.rename(serviceWritePath, servicePath); LOG.info("Persisted service " + service.getName() + " to " + servicePath); } } }
Source:
private void addPendingDatumIdExtra(Intent i, CommCareSession session) { String pendingDatumId = session.getNeededDatum().getDataId(); i.putExtra(KEY_PENDING_SESSION_DATUM_ID, pendingDatumId); }

Target:
private static void addPendingDatumIdExtra(Intent i, CommCareSession session) { i.putExtra(KEY_PENDING_SESSION_DATUM_ID, session.getNeededDatum().getDataId()); }
Source:
public void addContents(@NonNull Container container) { Jenkins jenkins = Jenkins.getInstance(); add(container, "unlabeled", jenkins.unlabeledLoad); add(container, "overall", jenkins.overallLoad); for (Label l: jenkins.getLabels()) { try { add(container, String.format("label/%s", URLEncoder.encode(l.getName(), "UTF-8")), l.loadStatistics); } catch (UnsupportedEncodingException e) { } } }

Target:
public void addContents(@NonNull Container container) { Jenkins jenkins = Jenkins.getInstance(); add(container, "no-label", jenkins.unlabeledLoad); add(container, "overall", jenkins.overallLoad); for (Label l : jenkins.getLabels()) { try { add(container, String.format("label/%s", URLEncoder.encode(l.getName(), "UTF-8")), l.loadStatistics); } catch (UnsupportedEncodingException e) { } } }
Source:
private void detach() { if (getWindow() != null) { return; } ConfirmationModel model = new ConfirmationModel(); setWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().detachStorageTitle()); model.setHelpTag(HelpTag.detach_storage); model.setHashName("detach_storage"); model.setMessage(ConstantsManager.getInstance().getConstants().areYouSureYouWantDetachStorageFromDcsMsg()); ArrayList<String> items = new ArrayList<String>(); boolean shouldAddressWarnning = false; for (Object item : getSelectedItems()) { StorageDomain a = (StorageDomain) item; items.add(a.getStoragePoolName()); if (a.getStorageDomainType() == StorageDomainType.Data) { shouldAddressWarnning = true; } } model.setItems(items); if (containsLocalStorage(model)) { model.getLatch().setIsAvailable(true); model.getLatch().setIsChangable(true); shouldAddressWarnning = false; model.setNote(ConstantsManager.getInstance().getMessages().detachNote(getLocalStoragesFormattedString())); } if (shouldAddressWarnning) { model.setNote(ConstantsManager.getInstance().getConstants().detachWarnningNote()); } UICommand tempVar = new UICommand("OnDetach", this); tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok()); tempVar.setIsDefault(true); model.getCommands().add(tempVar); UICommand tempVar2 = new UICommand("Cancel", this); tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel()); tempVar2.setIsCancel(true); model.getCommands().add(tempVar2); }

Target:
private void detach() { if (getWindow() != null) { return; } ConfirmationModel model = new ConfirmationModel(); setWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().detachStorageTitle()); model.setHelpTag(HelpTag.detach_storage); model.setHashName("detach_storage"); model.setMessage(ConstantsManager.getInstance().getConstants().areYouSureYouWantDetachStorageFromDcsMsg()); ArrayList<String> items = new ArrayList<String>(); boolean shouldAddressWarnning = false; for (Object item : getSelectedItems()) { StorageDomain a = (StorageDomain) item; items.add(a.getStoragePoolName()); if (a.getStorageDomainType().isDataDomain()) { shouldAddressWarnning = true; break; } } model.setItems(items); if (containsLocalStorage(model)) { model.getLatch().setIsAvailable(true); model.getLatch().setIsChangable(true); shouldAddressWarnning = false; model.setNote(ConstantsManager.getInstance().getMessages().detachNote(getLocalStoragesFormattedString())); } if (shouldAddressWarnning) { model.setNote(ConstantsManager.getInstance().getConstants().detachWarnningNote()); } UICommand tempVar = new UICommand("OnDetach", this); tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok()); tempVar.setIsDefault(true); model.getCommands().add(tempVar); UICommand tempVar2 = new UICommand("Cancel", this); tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel()); tempVar2.setIsCancel(true); model.getCommands().add(tempVar2); }
Source:
MockSelector(MockServerLayout serverLayout, AtomicReference<MockSelectorState> state, Time time) throws IOException { super(new NetworkMetrics(new MetricRegistry()), time, null); super.close(); this.serverLayout = serverLayout; this.state = state == null ? new AtomicReference<MockSelectorState>(MockSelectorState.Good) : state; this.time = time; }

Target:
MockSelector(MockServerLayout serverLayout, AtomicReference<MockSelectorState> state, Time time) throws IOException { super(new NetworkMetrics(new MetricRegistry()), time, null); super.close(); this.serverLayout = serverLayout; this.state = state == null ? new AtomicReference(MockSelectorState.Good) : state; this.time = time; }
Source:
public void testRefreshWorkflowsByOrg() throws IOException { usersURLPrefix = "http://localhost:%d/users/" + id; checkInitialDB(); testRefreshWorkflowsByOrg1(); assertThat(getWorkflows().size()).isGreaterThanOrEqualTo(14); testRefreshWorkflowsByOrg2(); assertThat(getWorkflows().size()).isGreaterThanOrEqualTo(14); testRefreshWorkflowsByOrg3(); assertThat(getWorkflows().size()).isGreaterThanOrEqualTo(14); testRefreshWorkflowsByOrg4(); assertThat(getWorkflows().size()).isGreaterThanOrEqualTo(15); testRefreshWorkflowsByOrg5(); assertThat(getWorkflows().size()).isGreaterThanOrEqualTo(16); }

Target:
public void testRefreshWorkflowsByOrg() throws IOException { usersURLPrefix = "http://localhost:%d/users/" + id; checkInitialDB(); testRefreshWorkflowsByOrg1(); List<Workflow> currentWorkflows = getWorkflows(); assertThat(currentWorkflows.size() - previousWorkflows.size()).isGreaterThanOrEqualTo(newDockstoreTestUser2Workflows.size()); previousWorkflows = currentWorkflows; testRefreshWorkflowsByOrg2(); currentWorkflows = getWorkflows(); assertThat(currentWorkflows.size() - previousWorkflows.size()).isEqualTo(0); previousWorkflows = currentWorkflows; testRefreshWorkflowsByOrg3(); currentWorkflows = getWorkflows(); assertThat(currentWorkflows.size() - previousWorkflows.size()).isEqualTo(0); previousWorkflows = currentWorkflows; testRefreshWorkflowsByOrg4(); currentWorkflows = getWorkflows(); assertThat(currentWorkflows.size() - previousWorkflows.size()).isGreaterThanOrEqualTo(newDockstore_TestUser2Workflows.size()); previousWorkflows = currentWorkflows; testRefreshWorkflowsByOrg5(); currentWorkflows = getWorkflows(); assertThat(currentWorkflows.size() - previousWorkflows.size()).isGreaterThanOrEqualTo(newDockstoreDotTestDotUser2Workflows.size()); }
Source:
public void tearDown() { if (InstanceManager.containsDefault(ShutDownManager.class)) { ShutDownManager sm = InstanceManager.getDefault(jmri.ShutDownManager.class); List<Runnable> rlist = sm.getRunnables(); while (!rlist.isEmpty()) { if (rlist.get(0) instanceof jmri.jmrit.logix.WarrantShutdownTask) { sm.deregister((ShutDownTask)rlist.get(0)); rlist = sm.getRunnables(); } } } InstanceManager.getDefault(WarrantManager.class).dispose(); JUnitUtil.tearDown(); }

Target:
public void tearDown() { if (InstanceManager.containsDefault(ShutDownManager.class)) { List<ShutDownTask> list = new ArrayList<>(); ShutDownManager sm = InstanceManager.getDefault(jmri.ShutDownManager.class); for (Runnable r : sm.getRunnables()) { if (r instanceof jmri.jmrit.logix.WarrantShutdownTask) { list.add((ShutDownTask)r); } } for ( ShutDownTask t : list) { sm.deregister(t); } } JUnitUtil.clearShutDownManager(); JUnitUtil.tearDown(); }
Source:
public Builder(GraphQLDirective existing) { this.name = existing.getName(); this.description = existing.getDescription(); this.onOperation = existing.isOnOperation(); this.onFragment = existing.isOnFragment(); this.onField = existing.isOnField(); this.onVariableDefinition=existing.isOnVariableDefinition(); this.locations = existing.validLocations(); this.arguments.putAll(getByName(existing.getArguments(), GraphQLArgument::getName)); }

Target:
public Builder(GraphQLDirective existing) { this.name = existing.getName(); this.description = existing.getDescription(); this.onOperation = existing.isOnOperation(); this.onFragment = existing.isOnFragment(); this.onField = existing.isOnField(); this.locations = existing.validLocations(); this.arguments.putAll(getByName(existing.getArguments(), GraphQLArgument::getName)); }
Source:
protected Date determineStartDateByFrequency() { if (lastBilledDate == null) { LOG.error("determineStartDateByFrequency, unable to calculate start date by frequency when the last billed date iis NULL"); throw new IllegalStateException("Can not calculate the start date when the last billed date is NULL"); } LocalDate localDateLastBilledDate = new LocalDate(lastBilledDate.getTime(), DateTimeZone.UTC); LocalDate localDateNextStartDate = localDateLastBilledDate.plusDays(1); Date sqlDateNextStartDate = new Date(localDateNextStartDate.toDate().getTime()); if (LOG.isDebugEnabled()) { LOG.debug("determineStartDateByFrequency, lastBilledDate is: " + lastBilledDate + " and next start date is: " + sqlDateNextStartDate); } return sqlDateNextStartDate; }

Target:
protected Date determineStartDateByFrequency() { if (lastBilledDate == null) { LOG.info("determineStartDateByFrequency, no previous billed date, so award start date is the next start date"); return awardStartDate; } return calculateNextDay(lastBilledDate); }
Source:
public void cache(String value) { if (cache == null) cache = new ArrayTernaryTrie.Growing<>(false, 64, 64); cache.put("\"" + value + "\"", value); }

Target:
public boolean cache(String value) { if (cache == null) cache = new ArrayTernaryTrie.Growing<>(false, 64, 64); CachedString cached = new CachedString(value); if (cached.isCacheable()) { cache.put(cached.encoded, cached); return true; } return false; }
Source:
public static Job createSystem(String name, final ICoreRunnable runnable) { Job job = create(name == null ? "" : name, runnable); job.setSystem(true); return job; }

Target:
public static Job createSystem(String name, final ICoreRunnable runnable) { Job job = create(name, runnable); job.setSystem(true); return job; }
Source:
private CreateLinkedTable parseCreateLinkedTable(boolean temp, boolean globalTemp, boolean force) { read(TABLE); boolean ifNotExists = readIfNotExists(); String tableName = readIdentifierWithSchema(); CreateLinkedTable command = new CreateLinkedTable(session, getSchema()); command.setTemporary(temp); command.setGlobalTemporary(globalTemp); command.setForce(force); command.setIfNotExists(ifNotExists); command.setTableName(tableName); command.setComment(readCommentIf()); read(OPEN_PAREN); command.setDriver(readString()); read(COMMA); command.setUrl(readString()); read(COMMA); command.setUser(readString()); read(COMMA); command.setPassword(readString()); read(COMMA); String originalTable = readString(); if (readIf(COMMA)) { command.setOriginalSchema(originalTable); originalTable = readString(); } command.setOriginalTable(originalTable); read(CLOSE_PAREN); if(readIf("FETCH_SIZE")){ command.setFetchSize(readExpression().optimize(session)); } else if (readIf("EMIT")) { read("UPDATES"); command.setEmitUpdates(true); if(readIf("FETCH_SIZE")){ command.setFetchSize(readExpression().optimize(session)); } } else if (readIf("READONLY")) { command.setReadOnly(true); if(readIf("FETCH_SIZE")){ command.setFetchSize(readExpression().optimize(session)); } } return command; }

Target:
private CreateLinkedTable parseCreateLinkedTable(boolean temp, boolean globalTemp, boolean force) { read(TABLE); boolean ifNotExists = readIfNotExists(); String tableName = readIdentifierWithSchema(); CreateLinkedTable command = new CreateLinkedTable(session, getSchema()); command.setTemporary(temp); command.setGlobalTemporary(globalTemp); command.setForce(force); command.setIfNotExists(ifNotExists); command.setTableName(tableName); command.setComment(readCommentIf()); read(OPEN_PAREN); command.setDriver(readString()); read(COMMA); command.setUrl(readString()); read(COMMA); command.setUser(readString()); read(COMMA); command.setPassword(readString()); read(COMMA); String originalTable = readString(); if (readIf(COMMA)) { command.setOriginalSchema(originalTable); originalTable = readString(); } command.setOriginalTable(originalTable); read(CLOSE_PAREN); if (readIf("EMIT")) { read("UPDATES"); command.setEmitUpdates(true); } else if (readIf("READONLY")) { command.setReadOnly(true); } if (readIf("FETCH_SIZE")) { command.setFetchSize(readNonNegativeInt()); } return command; }
Source:
protected boolean isTokenRequest(final HttpServletRequest request) { return CommonUtils.isNotBlank(CommonUtils.safeGetParameter(request, this.artifactParameterName, this.safeParameters)); }

Target:
private boolean isTokenRequest(final HttpServletRequest request) { return CommonUtils.isNotBlank(CommonUtils.safeGetParameter(request, this.artifactParameterName, this.safeParameters)); }
Source:
public ElasticSearchAdminImpl(ElasticSearchLocalConfig localConfig, ElasticSearchRemoteConfig remoteConfig, Map<String, ElasticSearchIndexConfig> indexConfig) { this.remoteConfig = remoteConfig; this.localConfig = localConfig; this.indexConfig = indexConfig; this.clientInitService = null; connect(); initializeIndexes(); }

Target:
public ElasticSearchAdminImpl(ElasticSearchLocalConfig localConfig, ElasticSearchRemoteConfig remoteConfig, Map<String, ElasticSearchIndexConfig> indexConfig) { this(localConfig, remoteConfig, indexConfig, null); }
Source:
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) { if (adapterType == IToggleBreakpointsTarget.class && adaptableObject instanceof ExtensionBasedTextEditor || adaptableObject instanceof TextEditor) { return (T) new DSPBreakpointAdapter(); } return null; }

Target:
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) { if (adapterType == IToggleBreakpointsTarget.class && (adaptableObject instanceof ExtensionBasedTextEditor || adaptableObject instanceof TextEditor)) { return (T) new DSPBreakpointAdapter(); } return null; }
Source:
public void damage(double amount, Block block, DamageCause cause) { if (!canTakeDamage() || !canTakeDamage(cause)) { return; } else { noDamageTicks = maximumNoDamageTicks; } amount = getEffectiveDamage(amount); EntityDamageByBlockEvent event = EventFactory.getInstance().onEntityDamage( new EntityDamageByBlockEvent(block, this, cause, amount)); if (event.isCancelled()) { return; } amount = event.getFinalDamage(); lastDamage = amount; setHealth(health - amount); playEffectKnownAndSelf(EntityEffect.HURT); if (health > 0) { Sound hurtSound = getHurtSound(); if (hurtSound != null && !isSilent()) { world.playSound(location, hurtSound, getSoundVolume(), getSoundPitch()); } } }

Target:
public void damage(double amount, Block block, DamageCause cause) { if (noDamageTicks > 0 || health <= 0 || isInvulnerable() || !canTakeDamage(cause)) { return; } else { noDamageTicks = maximumNoDamageTicks; } amount = getEffectiveDamage(amount); EntityDamageByBlockEvent event = EventFactory.getInstance().onEntityDamage( new EntityDamageByBlockEvent(block, this, cause, amount)); if (callDamageEvent(event)) { return; } amount = event.getFinalDamage(); lastDamage = amount; setHealth(health - amount); playEffectKnownAndSelf(EntityEffect.HURT); if (health > 0) { Sound hurtSound = getHurtSound(); if (hurtSound != null && !isSilent()) { world.playSound(location, hurtSound, getSoundVolume(), getSoundPitch()); } } }
Source:
public void addSubTask() { AbstractTask task = spy(new TaskTask("kind", "repoUrl", "parent")); AbstractTask subTask = spy(new TaskTask("kind", "repoUrl", "child")); lazyList.addTask(subTask); lazyList.addTask(task); lazyList.addTask(subTask, task); verify(taskList, times(1)).addTask(task); verify(taskList, times(1)).addTask(subTask, task); lazyList.commit(); verify(taskList, never()).addTask(subTask); verify(taskList, times(1)).addTask(task); }

Target:
public void addSubTask() { AbstractTask task = spy(new TaskTask("kind", "repoUrl", "parent")); AbstractTask subTask = spy(new TaskTask("kind", "repoUrl", "child")); lazyList.addTask(subTask); lazyList.addTask(task); lazyList.addTask(subTask, task); verify(taskList).addTask(task); verify(taskList).addTask(subTask, task); verifyNoMoreInteractions(taskList); lazyList.commit(); verifyNoMoreInteractions(taskList); }
Source:
public boolean shortCircuit() { return size() == 4; }

Target:
public boolean shortCircuit() { return size() == TreeReference.CONTEXT_TYPES.length; }
Source:
public void poll() { if (getLogCount() > 0 && !inBank()) { burn(); } else if (!inBank()){ walkToBank(); } else if (inBank() && getLogCount() > 0) { leaveBank(); } else { bank(); } }

Target:
public void poll() { if (getLogCount() > 0 && !inBank()) { burn(); } else if (!inBank() && getLogCount() == 0){ walkToBank(); } else if (inBank() && getLogCount() > 0) { leaveBank(); } else if (inBank() && getLogCount() == 0){ bank(); } }