auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void subscribe(PropertyChangeListener listener) { if (subscribers == null) { <START> subscribers = Lists.newArrayList(); <END> } subscribers.add(listener); }</code><technical_language>thought of here. this a set? listener registered twice</technical_language>

Target:
public boolean subscribe(PropertyChangeListener listener) { if (subscribers == null) { subscribers = Sets.newHashSet(); } if (listener == null) { LOGGER.warn(MessageFormat.format(this.warningFormatString, "A null subscriber cannot be added")); return false; } if (subscribers.contains(listener)) { LOGGER.warn(MessageFormat.format(this.warningFormatString, "The listener has already been subscribed")); return false; } subscribers.add(listener); return true; }
Source:
<code><START> DistributedMember getOneMemberForRegion(InternalCache cache, String regionName) { <END> String regionNameWithSeparator = regionName; if (!regionName.startsWith(SEPARATOR)) { regionNameWithSeparator = SEPARATOR + regionName; } return RebalanceOperationPerformer.getAssociatedMembers(regionNameWithSeparator, cache); }</code><technical_language>getOneMemberForRegion private need @VisibleForTesting. Currently test method though</technical_language>

Target:
private DistributedMember getOneMemberForRegion(InternalCache cache, String regionName) { String regionNameWithSeparator = regionName; if (!regionName.startsWith(SEPARATOR)) { regionNameWithSeparator = SEPARATOR + regionName; } return RebalanceOperationPerformer.getAssociatedMembers(regionNameWithSeparator, cache); }
Source:
<code>public void updateAccountDetailsByUsername(User userToUpdate) { UserEntry user = findByUserName(userToUpdate.getUsername()); <START> if (user == null) { <END> throw new UsernameNotFoundException(userToUpdate.getUsername()); } if (!StringUtils.isBlank(userToUpdate.getPassword())) { user.setPassword(userToUpdate.getPassword()); } if (StringUtils.isNotBlank(userToUpdate.getSecurityTokenKey())) { user.setSecurityTokenKey(userToUpdate.getSecurityTokenKey()); } save(user); }</code><technical_language>Cosmetic: Braces a new line, please. :)</technical_language>

Target:
public void updateAccountDetailsByUsername(User userToUpdate) { UserEntry user = findByUsername(userToUpdate.getUsername()); if (user == null) { throw new UsernameNotFoundException(userToUpdate.getUsername()); } if (!StringUtils.isBlank(userToUpdate.getPassword())) { user.setPassword(userToUpdate.getPassword()); } if (StringUtils.isNotBlank(userToUpdate.getSecurityTokenKey())) { user.setSecurityTokenKey(userToUpdate.getSecurityTokenKey()); } save(user); }
Source:
<code>public Long evaluate(TransactionContext txnCtx, Input<Object>... args) { Object fst = args[0].value(); Object snd = args[1].value(); if (fst == null || snd == null) { return null; } final Long timestamp; final Period period; if (fst instanceof Long && snd instanceof Period) { <START> timestamp = (Long) args[0].value(); <END> period = (Period) args[1].value(); } else { timestamp = (Long) args[1].value(); period = (Period) args[0].value(); } return operation.apply(new DateTime(timestamp, DateTimeZone.UTC), period).toInstant().getMillis(); }</code><technical_language>I missed this earlier, interval - timestamp sense. (In PostgreSQL is unsupported)</technical_language>

Target:
public Long evaluate(TransactionContext txnCtx, Input<Object>... args) { final Long timestamp = (Long) args[timestampIdx].value(); final Period period = (Period) args[periodIdx].value(); if (period == null || timestamp == null) { return null; } return operation.apply(new DateTime(timestamp, DateTimeZone.UTC), period).toInstant().getMillis(); }
Source:
<code>public static boolean isDynamicFilter(Expression expression) { if (!(expression instanceof ComparisonExpression)) { return false; } ComparisonExpression comparison = (ComparisonExpression) expression; <START> checkState(!(comparison.getLeft() instanceof DeferredSymbolReference && comparison.getRight() instanceof DeferredSymbolReference), "Dynamic filter cannot have DeferredSymbolReferences"); <END> return comparison.getLeft() instanceof DeferredSymbolReference || comparison.getRight() instanceof DeferredSymbolReference; }</code><technical_language>Message more expressive, e.g: Dynamic filter DeferredSymbolReferences</technical_language>

Target:
public static boolean isDynamicFilter(Expression expression) { return expression instanceof DynamicFilterExpression; }
Source:
<code>public WatcherCleaner(IDeadWatcherListener listener, int watcherCleanThreshold, int watcherCleanIntervalInSeconds, int watcherCleanThreadsNum, int maxInProcessingDeadWatchers) { this.listener = listener; this.watcherCleanThreshold = watcherCleanThreshold; this.watcherCleanIntervalInSeconds = watcherCleanIntervalInSeconds; int suggestedMaxInProcessingThreshold = watcherCleanThreshold * watcherCleanThreadsNum; if (maxInProcessingDeadWatchers > 0 && maxInProcessingDeadWatchers < suggestedMaxInProcessingThreshold) { maxInProcessingDeadWatchers = suggestedMaxInProcessingThreshold; LOG.info( "The maxInProcessingDeadWatchers config is smaller than the suggested one, change it to use {}", maxInProcessingDeadWatchers); } this.maxInProcessingDeadWatchers = maxInProcessingDeadWatchers; this.deadWatchers = new HashSet<Integer>(); this.cleaners = new WorkerService("DeadWatcherCleanner", watcherCleanThreadsNum, false); <START> LOG.info( <END> "watcherCleanThreshold={}, watcherCleanIntervalInSeconds={}, watcherCleanThreadsNum={}, maxInProcessingDeadWatchers={}", watcherCleanThreshold, watcherCleanIntervalInSeconds, watcherCleanThreadsNum, maxInProcessingDeadWatchers); }</code><technical_language>This a "+" need keep</technical_language>

Target:
public WatcherCleaner(IDeadWatcherListener listener, int watcherCleanThreshold, int watcherCleanIntervalInSeconds, int watcherCleanThreadsNum, int maxInProcessingDeadWatchers) { this.listener = listener; this.watcherCleanThreshold = watcherCleanThreshold; this.watcherCleanIntervalInSeconds = watcherCleanIntervalInSeconds; int suggestedMaxInProcessingThreshold = watcherCleanThreshold * watcherCleanThreadsNum; if (maxInProcessingDeadWatchers > 0 && maxInProcessingDeadWatchers < suggestedMaxInProcessingThreshold) { maxInProcessingDeadWatchers = suggestedMaxInProcessingThreshold; LOG.info( "The maxInProcessingDeadWatchers config is smaller than the suggested one, change it to use {}", maxInProcessingDeadWatchers); } this.maxInProcessingDeadWatchers = maxInProcessingDeadWatchers; this.deadWatchers = new HashSet<Integer>(); this.cleaners = new WorkerService("DeadWatcherCleanner", watcherCleanThreadsNum, false); LOG.info( "watcherCleanThreshold={}, watcherCleanIntervalInSeconds={}" + ", watcherCleanThreadsNum={}, maxInProcessingDeadWatchers={}", watcherCleanThreshold, watcherCleanIntervalInSeconds, watcherCleanThreadsNum, maxInProcessingDeadWatchers); }
Source:
<code>private void pollStorageAccountCreation(AuthenticatedContext ac, StorageAccountCheckerContext checkerContext) { PollTask<Boolean> storageAccountCreationStatusCheckerTask = azurePollTaskFactory.storageAccountCheckerTask(ac, checkerContext); try { LOGGER.info("Start polling storage account creation: {}", checkerContext.getStorageAccountName()); syncPollingScheduler.schedule(storageAccountCreationStatusCheckerTask, STORAGE_ACCOUNT_CREATION_CHECKING_INTERVAL, <START> STORAGE_ACCOUNT_CREATION_CHECKING_MAX_ATTEMPT, 1); <END> } catch (Exception e) { LOGGER.debug("Storage account creation failed.", e); } }</code><technical_language>Do want tolerate 1 failure</technical_language>

Target:
private void pollStorageAccountCreation(AuthenticatedContext ac, StorageAccountCheckerContext checkerContext) { PollTask<Boolean> storageAccountCreationStatusCheckerTask = azurePollTaskFactory.storageAccountCheckerTask(ac, checkerContext); try { LOGGER.info("Start polling storage account creation: {}", checkerContext.getStorageAccountName()); syncPollingScheduler.schedule(storageAccountCreationStatusCheckerTask, STORAGE_ACCOUNT_CREATION_CHECKING_INTERVAL, STORAGE_ACCOUNT_CREATION_CHECKING_MAX_ATTEMPT, MAX_FAILURE_TOLERANT); } catch (Exception e) { LOGGER.debug("Storage account creation failed.", e); } }
Source:
<code>private PlannerResult planWithDruidConvention( final SqlExplain explain, final RelRoot root ) throws RelConversionException { final RelNode wrappedRootRel = possiblyWrapRootWithOuterLimitFromContext(root); final DruidRel<?> druidRel; <START> if (wrappedRootRel == null) { <END> druidRel = (DruidRel<?>) planner.transform( Rules.DRUID_CONVENTION_RULES, planner.getEmptyTraitSet() .replace(DruidConvention.instance()) .plus(root.collation), root.rel ); } else { druidRel = (DruidRel<?>) planner.transform( Rules.DRUID_CONVENTION_RULES, planner.getEmptyTraitSet() .replace(DruidConvention.instance()) .plus(root.collation), wrappedRootRel ); } final Set<String> dataSourceNames = ImmutableSet.copyOf(druidRel.getDataSourceNames()); if (explain != null) { return planExplanation(druidRel, explain, dataSourceNames); } else { final Supplier<Sequence<Object[]>> resultsSupplier = new Supplier<Sequence<Object[]>>() { @Override public Sequence<Object[]> get() { if (root.isRefTrivial()) { return druidRel.runQuery(); } else { return Sequences.map( druidRel.runQuery(), new Function<Object[], Object[]>() { @Override public Object[] apply(final Object[] input) { final Object[] retVal = new Object[root.fields.size()]; for (int i = 0; i < root.fields.size(); i++) { retVal[i] = input[root.fields.get(i).getKey()]; } return retVal; } } ); } } }; return new PlannerResult(resultsSupplier, root.validatedRowType, dataSourceNames); } }</code><technical_language>possiblyWrapRootWithOuterLimitFromContext return root.rel instead of null collapse identical planner transform blocks</technical_language>

Target:
private PlannerResult planWithDruidConvention( final SqlExplain explain, final RelRoot root ) throws RelConversionException { final RelNode possiblyWrappedRootRel = possiblyWrapRootWithOuterLimitFromContext(root); final DruidRel<?> druidRel = (DruidRel<?>) planner.transform( Rules.DRUID_CONVENTION_RULES, planner.getEmptyTraitSet() .replace(DruidConvention.instance()) .plus(root.collation), possiblyWrappedRootRel ); final Set<String> dataSourceNames = ImmutableSet.copyOf(druidRel.getDataSourceNames()); if (explain != null) { return planExplanation(druidRel, explain, dataSourceNames); } else { final Supplier<Sequence<Object[]>> resultsSupplier = new Supplier<Sequence<Object[]>>() { @Override public Sequence<Object[]> get() { if (root.isRefTrivial()) { return druidRel.runQuery(); } else { return Sequences.map( druidRel.runQuery(), new Function<Object[], Object[]>() { @Override public Object[] apply(final Object[] input) { final Object[] retVal = new Object[root.fields.size()]; for (int i = 0; i < root.fields.size(); i++) { retVal[i] = input[root.fields.get(i).getKey()]; } return retVal; } } ); } } }; return new PlannerResult(resultsSupplier, root.validatedRowType, dataSourceNames); } }
Source:
<code>String[][] extractGroupingValues(DataColumn groupsColumn, DataColumn valuesColumn) { int n = groupsColumn.getValues().size(); String[][] output = new String[n][2]; for (int i = 0; i < n; i++) { Object group = groupsColumn.getValues().get(i); Object value = valuesColumn.getValues().get(i); String groupStr = "", valueStr = ""; if (group != null) { groupStr = group.toString(); <START> } else { <END> } if (value != null) { valueStr = value.toString(); } output[i][0] = groupStr; output[i][1] = valueStr; } return output; }</code><technical_language>Forgotten empty else here? consider ternary operator a bit more readable here: String groupStr = group == null ? "" : group.toString(); private helper 3x in this class. java private String toString(String mightBeNull) { return mightBeNull == null ? "" : mightBeNull.toString(); } this is a matter of taste. Leaving decision you</technical_language>

Target:
String[][] extractGroupingValues(DataColumn groupsColumn, DataColumn valuesColumn) { int n = groupsColumn.getValues().size(); String[][] output = new String[n][2]; for (int i = 0; i < n; i++) { Object group = groupsColumn.getValues().get(i); Object value = valuesColumn.getValues().get(i); output[i][0] = columnValueToString(group); output[i][1] = columnValueToString(value); } return output; }
Source:
<code>protected void handleGroupedCounterAspect(ITmfEvent event, ITmfStateSystemBuilder ss, CounterAspect aspect, int rootQuark) { int quark = rootQuark; <START> for (Class<? extends ITmfEventAspect<?>> group : aspect.getGroups()) { <END> ITmfEventAspect<?> groupAspect = (ITmfEventAspect<?>) TmfTraceUtils.resolveEventAspectOfClassForEvent(event.getTrace(), group, event); if (groupAspect != null) { quark = ss.getQuarkRelativeAndAdd(quark, group.getName()); quark = ss.getQuarkRelativeAndAdd(quark, String.valueOf(groupAspect.resolve(event))); quark = ss.getQuarkRelativeAndAdd(quark, aspect.getName()); } } Long eventContent = aspect.resolve(event); ss.modifyAttribute(event.getTimestamp().toNanos(), eventContent, quark); }</code><technical_language>aspectClass</technical_language>

Target:
protected void handleGroupedCounterAspect(ITmfEvent event, ITmfStateSystemBuilder ss, CounterAspect aspect, int rootQuark) { int quark = rootQuark; for (Class<? extends ITmfEventAspect<?>> groupClass : aspect.getGroups()) { ITmfEventAspect<?> groupAspect = (ITmfEventAspect<?>) TmfTraceUtils.resolveEventAspectOfClassForEvent(event.getTrace(), groupClass, event); if (groupAspect != null) { quark = ss.getQuarkRelativeAndAdd(quark, groupClass.getName()); quark = ss.getQuarkRelativeAndAdd(quark, String.valueOf(groupAspect.resolve(event))); } } handleCounterAspect(event, ss, aspect, quark); }
Source:
<code><START> public void startForEach(LeastRecentlyUsedCache.Predicate<Connection> handler) { <END> nextForEach(connectionStore.iterator(), handler); }</code><technical_language>forEach</technical_language>

Target:
public Future<Void> startForEach(LeastRecentlyUsedCache.Predicate<Connection> handler) { if (handler == null) { throw new NullPointerException("handler must not be null!"); } ForEachFuture result = new ForEachFuture(); nextForEach(connectionStore.iterator(), handler, result); return result; }
Source:
<code>public void appendWebDavMessages_sendsRequestUsingStore() throws MessagingException, IOException { List<Message> existingMessages = new ArrayList<>(); Message existingMessage = mock(Message.class); existingMessages.add(existingMessage); String messageUid = "testMessageUid"; when(existingMessage.getUid()).thenReturn(messageUid); folder.appendWebDavMessages(existingMessages); verify(mockStore).sendRequest(urlCaptor.capture(), eq("PUT"), entityCaptor.capture(), Matchers.<Map<String, String>>eq(null), eq(true)); <START> assertTrue(urlCaptor.getValue().startsWith(storeUrl+"/"+storeName+"/"+messageUid)); <END> assertTrue(urlCaptor.getValue().endsWith(".eml")); }</code><technical_language>Code style: missing spaces</technical_language>

Target:
public void appendWebDavMessages_sendsRequestUsingStore() throws MessagingException, IOException { List<Message> existingMessages = new ArrayList<>(); Message existingMessage = mock(Message.class); existingMessages.add(existingMessage); String messageUid = "testMessageUid"; when(existingMessage.getUid()).thenReturn(messageUid); folder.appendWebDavMessages(existingMessages); verify(mockStore).sendRequest(urlCaptor.capture(), eq("PUT"), entityCaptor.capture(), Matchers.<Map<String, String>>eq(null), eq(true)); assertTrue(urlCaptor.getValue().startsWith(storeUrl + "/" + folderName + "/" + messageUid)); assertTrue(urlCaptor.getValue().endsWith(".eml")); }
Source:
<code>public Response add(Quota <START> quota) { <END> org.ovirt.engine.core.common.businessentities.Quota entity = map(quota); entity.setStoragePoolId(dataCenterId); return performCreate(VdcActionType.AddQuota, new QuotaCRUDParameters(entity), new QueryIdResolver<Guid>(VdcQueryType.GetQuotaByQuotaId, IdQueryParameters.class)); }</code><technical_language>add call validateParameters() method list mandatory parameters</technical_language>

Target:
public Response add(Quota quota) { validateParameters(quota, "name"); org.ovirt.engine.core.common.businessentities.Quota entity = map(quota); entity.setStoragePoolId(dataCenterId); return performCreate(VdcActionType.AddQuota, new QuotaCRUDParameters(entity), new QueryIdResolver<Guid>(VdcQueryType.GetQuotaByQuotaId, IdQueryParameters.class)); }
Source:
<code>public List<String> getJobLinks() { <START> return null; <END> }</code><technical_language>empty ArrayList is a null</technical_language>

Target:
public List<String> getJobLinks() { List<String> list = new ArrayList<String>(); StringBuilder familyListcmd = new StringBuilder(); familyListcmd.append(EcsContext.composeFamilyName(config)); familyListcmd.append(EcsContext.topologyName(config)); LOG.info(String.format("final list cmd: %s", familyListcmd)); StringBuilder stdout = new StringBuilder(); StringBuilder stderr = new StringBuilder(); List<String> familyString; int status = ShellUtils.runProcess(familyListcmd.toString(), stdout); if (status != 0) { LOG.severe(String.format( "Failed to run process. Command=%s, STDOUT=%s, STDERR=%s", familyListcmd.toString(), stdout, stderr)); } else { String listjsonString = stdout.toString(); try { familyString = parseJsonName(listjsonString, EcsContext.composeListby(config)); for (String familyName : familyString) { StringBuilder listout = new StringBuilder(); StringBuilder listerr = new StringBuilder(); StringBuilder taskListcmd = new StringBuilder(); taskListcmd.append(EcsContext.composeListCmd(config)); taskListcmd.append(" "); taskListcmd.append(familyName); int jobListstatus = ShellUtils.runProcess(taskListcmd.toString(), listout); if (jobListstatus != 0) { LOG.severe(String.format( "Failed to run process. Command=%s, STDOUT=%s, STDERR=%s", taskListcmd.toString(), listout, listerr)); } else { List<String> taskString = parseJsonName(listout.toString(), EcsContext.composeTaskTag(config)); for (String taskId : taskString) { list.add(taskId); } } } } catch (JsonParseException e) { LOG.severe("Unable to get list due to Parsing issues"); } catch (IOException ioe) { LOG.severe("Unable to get list due to IO issues"); } } return list; }
Source:
<code>public DesiredCapabilities getCapabilities(DesiredCapabilities capabilities) { logger.entering(capabilities); if (isNonSauceLabsRun()) { return capabilities; } <START> DesiredCapabilities dc = new DesiredCapabilities(); <END> dc = appendSauceLabsCredentials(capabilities); dc = appendSeleniumVersion(capabilities); dc = appendSauceLabsCapabilities(capabilities); logger.exiting(dc); return dc; }</code><technical_language>This solve problem I suspect codacy reporting do capabilities a parameter re-assigned. call appendSauceLabsCredentials, return a new set of capabiltiies dc receive .. need result of calls merge/append previous capabilities new ones. java DesiredCapabilities dc = capabilities.merge(appendSauceLabsCredentials(capabilities)) .merge(appendSeleniumVersion(capabilities)) .merge(appendSauceLabsCapabilities(capabilities)); //... return dc;</technical_language>

Target:
public DesiredCapabilities getCapabilities(DesiredCapabilities capabilities) { logger.entering(capabilities); if (isNonSauceLabsRun()) { return capabilities; } DesiredCapabilities dc = capabilities.merge(appendSauceLabsCredentials(capabilities)) .merge(appendSeleniumVersion(capabilities)).merge(appendSauceLabsCapabilities(capabilities)); logger.exiting(dc); return dc; }
Source:
<code>protected int doWork() { IOUtil.assertFileIsReadable(INPUT); IOUtil.assertFileIsWritable(OUTPUT); final SamReader reader = SamReaderFactory.makeDefault().referenceSequence(REFERENCE_SEQUENCE).open(INPUT); if (reader.getFileHeader().getSortOrder() != SAMFileHeader.SortOrder.coordinate) { throw new SAMException("Input must be coordinate-sorted for this program to run. Found: " + reader.getFileHeader().getSortOrder()); } final SAMFileWriter writer = new SAMFileWriterFactory().makeSAMOrBAMWriter(reader.getFileHeader(), true, OUTPUT); writer.setProgressLogger( new ProgressLogger(log, (int) 1e7, "Wrote", "records")); final ReferenceSequenceFileWalker refSeq = new ReferenceSequenceFileWalker(REFERENCE_SEQUENCE); StreamSupport.stream(reader.spliterator(), false) .peek(rec -> { if (!rec.getReadUnmappedFlag()) { <START> if (SET_ONLY_UQ) <END> AbstractAlignmentMerger.fixUq(rec, refSeq, IS_BISULFITE_SEQUENCE); else AbstractAlignmentMerger.fixNmMdAndUq(rec, refSeq, IS_BISULFITE_SEQUENCE); } }) .forEach(writer::addAlignment); CloserUtil.close(reader); writer.close(); return 0; }</code><technical_language>This is complicated enough I advocate moving non-lambda format. needs { } in if/else</technical_language>

Target:
protected int doWork() { IOUtil.assertFileIsReadable(INPUT); IOUtil.assertFileIsWritable(OUTPUT); final SamReader reader = SamReaderFactory.makeDefault().referenceSequence(REFERENCE_SEQUENCE).open(INPUT); if (reader.getFileHeader().getSortOrder() != SAMFileHeader.SortOrder.coordinate) { throw new SAMException("Input must be coordinate-sorted for this program to run. Found: " + reader.getFileHeader().getSortOrder()); } final SAMFileWriter writer = new SAMFileWriterFactory().makeSAMOrBAMWriter(reader.getFileHeader(), true, OUTPUT); writer.setProgressLogger( new ProgressLogger(log, (int) 1e7, "Wrote", "records")); final ReferenceSequenceFileWalker refSeqWalker = new ReferenceSequenceFileWalker(REFERENCE_SEQUENCE); StreamSupport.stream(reader.spliterator(), false) .peek(rec -> fixRecord(rec, refSeqWalker)) .forEach(writer::addAlignment); CloserUtil.close(reader); writer.close(); return 0; }
Source:
<code>private void checkWithVarsToResolve(boolean fromFile) throws Exception { <START> String content = "KEY1 =${VAR1_TO_RESOLVE}\nKEY2=<LINK_0>\nKEY3=${VAR3_TO_RESOLVE}\\\\otherContent"; <END> Map<String, String> currentEnvVars = new HashMap<String, String>(); currentEnvVars.put("VAR1_TO_RESOLVE", "NEW_VALUE1 "); currentEnvVars.put("VAR3_TO_RESOLVE", "C:\\Bench"); Map<String, String> gatherVars = gatherEnvVars(fromFile, content, currentEnvVars); assertNotNull(gatherVars); assertEquals(3, gatherVars.size()); assertEquals("NEW_VALUE1", gatherVars.get("KEY1")); assertEquals("<LINK_0>", gatherVars.get("KEY2")); assertEquals("C:\\Bench\\otherContent", gatherVars.get("KEY3")); }</code><technical_language>This change some implied regressions</technical_language>

Target:
private void checkWithVarsToResolve(boolean fromFile) throws Exception { String content = "KEY1 =${VAR1_TO_RESOLVE}\nKEY2=https\\://github.com\nKEY3=${VAR3_TO_RESOLVE}\\\\otherContent"; Map<String, String> currentEnvVars = new HashMap<String, String>(); currentEnvVars.put("VAR1_TO_RESOLVE", "NEW_VALUE1 "); currentEnvVars.put("VAR3_TO_RESOLVE", "C:\\Bench"); Map<String, String> gatherVars = gatherEnvVars(fromFile, content, currentEnvVars); assertNotNull(gatherVars); assertEquals(3, gatherVars.size()); assertEquals("NEW_VALUE1", gatherVars.get("KEY1")); assertEquals("<LINK_0>", gatherVars.get("KEY2")); assertEquals("C:\\Bench\\otherContent", gatherVars.get("KEY3")); }
Source:
<code>public FunctionManager(TypeManager typeManager, BlockEncodingSerde blockEncodingSerde, FeaturesConfig featuresConfig) { operatorNamespace = new StaticFunctionNamespace(typeManager, blockEncodingSerde, featuresConfig); functionNamespaces = ImmutableMap.of(); <START> this.typeManager = typeManager; <END> this.blockEncodingSerde = blockEncodingSerde; this.featuresConfig = featuresConfig; }</code><technical_language>Please add requireNonNull for args</technical_language>

Target:
public FunctionManager(TypeManager typeManager, BlockEncodingSerde blockEncodingSerde, FeaturesConfig featuresConfig) { functionNamespaces = ImmutableMap.of(); this.typeManager = requireNonNull(typeManager, "typeManager is null"); this.blockEncodingSerde = requireNonNull(blockEncodingSerde, "blockEncodingSerde is null"); this.featuresConfig = requireNonNull(featuresConfig, "featuresConfig is null"); operatorNamespace = new StaticFunctionNamespace(typeManager, blockEncodingSerde, featuresConfig); }
Source:
<code>@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); FifoEvictionPolicyFactory<String, String> plc = new FifoEvictionPolicyFactory<>(); plc.setMaxSize(100); plc.setBatchSize(10); plc.setMaxMemorySize(20); CacheConfiguration cache1 = defaultCacheConfiguration(); cache1.setName("cache1"); cache1.setOnheapCacheEnabled(true); cache1.setEvictionPolicyFactory(plc); NearCacheConfiguration ncf = new NearCacheConfiguration<>(); LruEvictionPolicy lep = new LruEvictionPolicy(); lep.setBatchSize(10); lep.setMaxMemorySize(500); lep.setMaxSize(40); <START> ncf.setNearEvictionPolicy(lep); <END> cache1.setNearConfiguration(ncf); CacheConfiguration cache2 = defaultCacheConfiguration(); lep = new LruEvictionPolicy(); lep.setBatchSize(10); lep.setMaxMemorySize(125); lep.setMaxSize(30); cache2.setEvictionPolicy(lep); cache2.setOnheapCacheEnabled(true); cache2.setName("cache2"); cfg.setCacheConfiguration(cache1,cache2); return cfg; }</code><technical_language>setNearEvictionPolicyFactory here. I need 4 cases here: setEvictionPolicyFactory, setNearEvictionPolicyFactory, setEvictionPolicy setNearEvictionPolicy. factories in cache1 plain policies in cache2</technical_language>

Target:
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); FifoEvictionPolicyFactory<String, String> plc = new FifoEvictionPolicyFactory<>(); plc.setMaxSize(100); plc.setBatchSize(10); plc.setMaxMemorySize(20); CacheConfiguration cache1 = defaultCacheConfiguration(); cache1.setName("cache1"); cache1.setOnheapCacheEnabled(true); cache1.setEvictionPolicyFactory(plc); NearCacheConfiguration ncf = new NearCacheConfiguration<>(); ncf.setNearEvictionPolicyFactory(new LruEvictionPolicyFactory<>(40, 10, 500)); cache1.setNearConfiguration(ncf); CacheConfiguration cache2 = defaultCacheConfiguration(); cache2.setName("cache2"); cache2.setOnheapCacheEnabled(true); LruEvictionPolicy lep = new LruEvictionPolicy(); lep.setBatchSize(10); lep.setMaxMemorySize(125); lep.setMaxSize(30); cache2.setEvictionPolicy(lep); ncf = new NearCacheConfiguration<>(); lep = new LruEvictionPolicy(); lep.setBatchSize(10); lep.setMaxMemorySize(500); lep.setMaxSize(40); ncf.setNearEvictionPolicy(lep); cache2.setNearConfiguration(ncf); cfg.setCacheConfiguration(cache1, cache2); return cfg; }
Source:
<code>private JmsTemplate jmsTemplate() { final JmsTemplate jmsTemplate = new JmsTemplate(); jmsTemplate.setDefaultDestination(this.destinationQueue); jmsTemplate.setExplicitQosEnabled(this.property(PROPERTY_EXPLICIT_QOS_ENABLED, boolean.class)); <START> jmsTemplate.setTimeToLive(this.property(PROPERTY_TIME_TO_LIVE, int.class)); <END> jmsTemplate.setDeliveryPersistent(this.property(PROPERTY_DELIVERY_PERSISTENT, boolean.class)); jmsTemplate.setConnectionFactory(JmsConfigurationFactory.this.pooledConnectionFactory); return jmsTemplate; }</code><technical_language>This error in mu Eclipse workspace: Description Resource Path Location Type Type mismatch: convert Integer long JmsConfigurationFactory.java /shared/src/main/java/com/alliander/osgp/shared/application/config/jms line 161 Java Problem applies for others</technical_language>

Target:
private JmsTemplate jmsTemplate() { final JmsTemplate jmsTemplate = new JmsTemplate(); jmsTemplate.setDefaultDestination(this.destinationQueue); jmsTemplate.setExplicitQosEnabled(this.property(PROPERTY_EXPLICIT_QOS_ENABLED, boolean.class)); jmsTemplate.setTimeToLive(this.property(PROPERTY_TIME_TO_LIVE, long.class)); jmsTemplate.setDeliveryPersistent(this.property(PROPERTY_DELIVERY_PERSISTENT, boolean.class)); jmsTemplate.setConnectionFactory(JmsConfigurationFactory.this.pooledConnectionFactory); return jmsTemplate; }
Source:
<code>private AccountAttributes createInvalidAccountAttributesObject() { String googleId = "invalid google id"; String name = ""; boolean isInstructor = false; String email = "invalid@email@com"; String institute = StringHelperExtension.generateStringOfLength(FieldValidator.INSTITUTE_NAME_MAX_LENGTH + 1); StudentProfileAttributes studentProfile = StudentProfileAttributes.builder().build(); return AccountAttributes.builder() .withGoogleId(googleId) .withName(name) .withEmail(email) .withInstitute(institute) .withIsInstructor(isInstructor) <START> .withStudentProfileAttributes(studentProfile) <END> .build(); }</code><technical_language>reason for this change? I this is relevant issue</technical_language>

Target:
private AccountAttributes createInvalidAccountAttributesObject() { String googleId = "invalid google id"; String name = ""; boolean isInstructor = false; String email = "invalid@email@com"; String institute = StringHelperExtension.generateStringOfLength(FieldValidator.INSTITUTE_NAME_MAX_LENGTH + 1); StudentProfileAttributes studentProfile = StudentProfileAttributes.builder(googleId).build(); return AccountAttributes.builder() .withGoogleId(googleId) .withName(name) .withEmail(email) .withInstitute(institute) .withIsInstructor(isInstructor) .withStudentProfileAttributes(studentProfile) .build(); }
Source:
<code>public LeadViewDetail(WebDriver driver) { super.driver = driver; super.wait = DriverManager.getInstance().getWait(); PageFactory.initElements(driver, this); try { wait.withTimeout(10, TimeUnit.SECONDS) .until(ExpectedConditions.visibilityOf(viewSelected)); } catch (WebDriverException e) { throw new WebDriverException(e); } finally { <START> wait.withTimeout(15, TimeUnit.SECONDS); <END> } }</code><technical_language>Magic number <LINK_0> Try a constant for timeout. Review constants in project</technical_language>

Target:
public LeadViewDetail(WebDriver driver) { super.driver = driver; super.wait = DriverManager.getInstance().getWait(); PageFactory.initElements(driver, this); try { wait.withTimeout(DriverManager.getInstance().getTimeoutNormal(), TimeUnit.SECONDS) .until(ExpectedConditions.visibilityOf(viewSelected)); } catch (WebDriverException e) { throw new WebDriverException(e); } finally { wait.withTimeout(DriverManager.getInstance().getTimeoutNormal(), TimeUnit.SECONDS); } }
Source:
<code>public int hashCode() { <START> return Objects.hash(name, code, offsetAsDouble); <END> }</code><technical_language>In equals method offsetAsString in hashCode offsetAsDouble intentionally? special GWT compatible hashcode combine hash codes. like: java HashUtil.combineHashCodes(Objects.hash(name), Objects.hash(code), Objects.hash(offsetAsDouble) );</technical_language>

Target:
public int hashCode() { return HashUtil.combineHashCodes(Objects.hash(name), Objects.hash(code), Objects.hash(offsetAsString)); }
Source:
<code><START> private static MetaDataMutationResult checkSchemaKeyInRegion(byte[] key, Region region) { <END> byte[] startKey = region.getRegionInfo().getStartKey(); byte[] endKey = region.getRegionInfo().getEndKey(); if (Bytes.compareTo(startKey, key) <= 0 && (Bytes.compareTo(HConstants.LAST_ROW, endKey) == 0 || Bytes.compareTo(key, endKey) < 0)) { return null; } return new MetaDataMutationResult(MutationCode.SCHEMA_NOT_IN_REGION, EnvironmentEdgeManager.currentTimeMillis(), null); }</code><technical_language>reuse checkTableKeyInRegion rename checkKeyInRegion. pass MutationCode include in result extra parameter key is in region. While it, please remove method checkFunctionKeyInRegion callers call instead checkKeyInRegion</technical_language>

Target:
private static MetaDataMutationResult checkSchemaKeyInRegion(byte[] key, Region region) { return checkKeyInRegion(key, region, MutationCode.SCHEMA_NOT_IN_REGION); }
Source:
<code>@Test public void givesAllArgsAChanceToShrink() { assertThat(testResult(GivesAllArgsAChanceToShrink.class), failureCountIs(2)); <START> assertThat(Others.shrinkAttempts, greaterThan(0)); <END> }</code><technical_language>shrinkAttempts greaterThan(1) (equal 2), I misunderstand that</technical_language>

Target:
@Test public void givesAllArgsAChanceToShrink() { assertThat(testResult(GivesAllArgsAChanceToShrink.class), failureCountIs(2)); assertThat(Others.shrinkAttempts, greaterThan(1)); }
Source:
<code><START> public synchronized void unsubscribe(String tenant, String metricId, <END> Set<Subscription.SubscriptionOwner> subscriptionOwners) { TenantsSubscriptionsHolder tenantSubscriptions = subscriptions.get(tenant); if (tenantSubscriptions == null) { throw new SubscriptionNotFoundException(tenant, metricId); } Subscription model = tenantSubscriptions.getSubscriptions().get(metricId); if (model == null) { throw new SubscriptionNotFoundException(tenant, metricId); } subscriptionOwners.forEach(model::removeSubscriptionOwner); if (model.getSubscriptionOwners().isEmpty()) { tenantSubscriptions.getSubscriptions().remove(metricId); Logger.LOGGER.debugf("Unsubscribed tenant: %s, metric: %s", tenant, metricId); } }</code><technical_language>Again, subscribe synchronize subscriptions this</technical_language>

Target:
public void unsubscribe(String tenant, String metricId, Set<Subscription.SubscriptionOwner> subscriptionOwners) { TenantsSubscriptionsHolder tenantSubscriptions = subscriptions.get(tenant); if (tenantSubscriptions == null) { throw new SubscriptionNotFoundException(tenant, metricId); } Subscription subscription = tenantSubscriptions.getSubscriptions().get(metricId); if (subscription == null) { throw new SubscriptionNotFoundException(tenant, metricId); } subscriptionOwners.forEach(subscription::removeSubscriptionOwner); if (subscription.getSubscriptionOwners().isEmpty()) { tenantSubscriptions.getSubscriptions().remove(metricId); Logger.LOGGER.debugf("Unsubscribed tenant: %s, metric: %s", tenant, metricId); } }
Source:
<code>protected DiskImage getImage() { switch (getActionState()) { case END_SUCCESS: case END_FAILURE: if (_diskImage == null) { if (getVm() != null) { VmHandler.updateDisksFromDb(getVm()); _diskImage = LinqUtils.firstOrNull(getVm().getDiskMap().values(), new Predicate<DiskImage>() { @Override public boolean eval(DiskImage a) { return a.getimage_group_id().equals(getImageGroupId()); } }); } else if (getVmTemplate() != null) { VmTemplateHandler.UpdateDisksFromDb(getVmTemplate()); <START> Collection<DiskImage> templateDisks = getVmTemplate().getDiskMap().values(); <END> _diskImage = LinqUtils.firstOrNull(templateDisks, new Predicate<DiskImage>() { @Override public boolean eval(DiskImage a) { return a.getimage_group_id().equals(getImageGroupId()); } }); } } return _diskImage; default: return super.getImage(); } }</code><technical_language>Instead, query DiskImageDao.getAllSnapshotsForImageGroup get (or null if result is empty). apply this logic vm case (above). This save time DB call correct image, saves loop, code is more readable</technical_language>

Target:
protected DiskImage getImage() { switch (getActionState()) { case END_SUCCESS: case END_FAILURE: if (_diskImage == null) { List<DiskImage> diskImages = DbFacade.getInstance().getDiskImageDAO().getAllSnapshotsForImageGroup(getImageGroupId()); _diskImage = (diskImages.isEmpty()) ? null:diskImages.get(0); } return _diskImage; default: return super.getImage(); } }
Source:
<code><START> public String getText(final Object element) { <END> String returnedValue = ""; final ILabelProviderContextElementWrapper wrapper = (ILabelProviderContextElementWrapper) element; final Object value = getWrappedValue(wrapper); if (value instanceof IAxis && !((IAxis) value).getAlias().isEmpty()) { returnedValue = ((IAxis) value).getAlias(); } else { String axisValue = (String) AxisUtils.getRepresentedElement(value); String axisId = axisValue.substring(StereotypeDisplayTreeTableConstants.PREFIX.length()); switch (axisId) { case StereotypeDisplayTreeTableConstants.IN_BRACE: returnedValue = "in Brace"; break; case StereotypeDisplayTreeTableConstants.IN_COMMENT: returnedValue = "In Comment"; break; case StereotypeDisplayTreeTableConstants.IN_COMPARTMENT: returnedValue = "In Compartment"; break; case StereotypeDisplayTreeTableConstants.IS_DISPLAYED: returnedValue = "Visible"; break; case StereotypeDisplayTreeTableConstants.NAME_DEPTH: returnedValue = "Name Depth"; break; default: break; } } return returnedValue; }</code><technical_language>constant StereotypeDisplayTreeTableConstants.IN_BRACE</technical_language>

Target:
public String getText(final Object element) { String returnedValue = ""; final ILabelProviderContextElementWrapper wrapper = (ILabelProviderContextElementWrapper) element; final Object value = getWrappedValue(wrapper); if (value instanceof IAxis && !((IAxis) value).getAlias().isEmpty()) { returnedValue = ((IAxis) value).getAlias(); } else { String axisValue = (String) AxisUtils.getRepresentedElement(value); String axisId = axisValue.substring(StereotypeDisplayTreeTableConstants.PREFIX.length()); switch (axisId) { case StereotypeDisplayTreeTableConstants.IN_BRACE: returnedValue = StereotypeDisplayTreeTableConstants.IN_BRACE_LABEL; break; case StereotypeDisplayTreeTableConstants.IN_COMMENT: returnedValue = StereotypeDisplayTreeTableConstants.IN_COMMENT_LABEL; break; case StereotypeDisplayTreeTableConstants.IN_COMPARTMENT: returnedValue = StereotypeDisplayTreeTableConstants.IN_COMPARTMENT_LABEL; break; case StereotypeDisplayTreeTableConstants.IS_DISPLAYED: returnedValue = StereotypeDisplayTreeTableConstants.IS_DISPLAYED_LABEL; break; case StereotypeDisplayTreeTableConstants.NAME_DEPTH: returnedValue = StereotypeDisplayTreeTableConstants.NAME_DEPTH_LABEL; break; default: break; } } return returnedValue; }
Source:
<code>void updateMetricsStore(boolean memstoreRead) { if (memstoreRead) { getRequestsFromMemstore.increment(); } else { getRequestsFromFile.increment(); } if (metricsStore != null) { if (memstoreRead) { metricsStore.updateMemstoreGet(); } <START> metricsStore.updateFileGet(); <END> } }</code><technical_language>This else statement</technical_language>

Target:
void updateMetricsStore(boolean memstoreRead) { if (memstoreRead) { memstoreOnlyRowReadsCount.increment(); } else { mixedRowReadsCount.increment(); } }
Source:
<code>public static Object convertToCorrectClass(Class<?> type, Object value) { if (type.isInstance(value)) { return value; } if (type.isEnum()) { type.getEnumConstants(); for (Object object : type.getEnumConstants()) { if (object.toString().equals(value)) { return object; } } } if (type.equals(Date.class) && String.class.isInstance(value)) { try { DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); <START> return formatter.parse((String) value); <END> } catch (ParseException e) { throw new RuntimeException(e); } } if (type.equals(Boolean.class) && String.class.isInstance(value)) { return Boolean.parseBoolean((String) value); } if (String.class.isInstance(value)) { Constructor<?> constructor = getStringOnlyConstructor(type); if (constructor != null) { try { return constructor.newInstance(value); } catch (IllegalArgumentException e) { throw new RuntimeException(e); } catch (InstantiationException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { throw new RuntimeException(e); } } } return null; }</code><technical_language>formatter reinstantiated call</technical_language>

Target:
public static Object convertToCorrectClass(Class<?> type, Object value) { if (type.isInstance(value)) { return value; } if (type.isEnum()) { type.getEnumConstants(); for (Object object : type.getEnumConstants()) { if (object.toString().equals(value)) { return object; } } } if (type.equals(Date.class) && String.class.isInstance(value)) { try { return dateFormatter.parse((String) value); } catch (ParseException e) { throw new RuntimeException(e); } } if (type.equals(Boolean.class) && String.class.isInstance(value)) { return Boolean.parseBoolean((String) value); } if (String.class.isInstance(value)) { Constructor<?> constructor = getStringOnlyConstructor(type); if (constructor != null) { try { return constructor.newInstance(value); } catch (IllegalArgumentException e) { throw new RuntimeException(e); } catch (InstantiationException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { throw new RuntimeException(e); } } } return null; }
Source:
<code>public void visitToken(DetailAST token) { if (!hasServiceClientAnnotation) { return; } switch (token.getType()) { case TokenTypes.CLASS_DEF: hasServiceClientAnnotation = hasServiceClientAnnotation(token); checkServiceClientNaming(token); break; case TokenTypes.CTOR_DEF: <START> checkConstructor(token); <END> break; case TokenTypes.METHOD_DEF: checkMethodName(token); break; case TokenTypes.OBJBLOCK: checkClassField(token); break; default: break; } }</code><technical_language>I add pre-emptive checks constructor method_def checks that: java if (hasServiceClientAnnotation) { // do check. Otherwise, check classes serviceclients. }</technical_language>

Target:
public void visitToken(DetailAST token) { if (isImplPackage) { return; } switch (token.getType()) { case TokenTypes.PACKAGE_DEF: String packageName = FullIdent.createFullIdent(token.findFirstToken(TokenTypes.DOT)).getText(); isImplPackage = packageName.contains(".implementation"); break; case TokenTypes.CLASS_DEF: hasServiceClientAnnotation = hasServiceClientAnnotation(token); if (hasServiceClientAnnotation) { checkServiceClientNaming(token); } break; case TokenTypes.CTOR_DEF: if (hasServiceClientAnnotation) { checkConstructor(token); } break; case TokenTypes.METHOD_DEF: if (hasServiceClientAnnotation) { checkMethodName(token); } break; case TokenTypes.OBJBLOCK: if (hasServiceClientAnnotation) { checkClassField(token); } break; default: break; } }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.photos); setTitle(R.string.photos_view_name); LinearLayout lView = (LinearLayout) findViewById(R.id.photos_list); Person user = new Person(); user.put("points", 0); user.put("levelAt", 1); user.put("stateAt", 0); user.put("puzzleID", 101); user.put("currentItem", "coffee"); <START> user.put("currentIngredient", "water"); <END> ArrayList<String> characters = new ArrayList<String>(Arrays.asList("BeachBoy", "Granny")); user.put("charactersCollected", characters); user.saveInBackground(); user.add("charactersCollected", "Pusheen"); user.add("charactersCollected", "Baby"); user.saveInBackground(); ArrayList<String> charactersCollected = user.getCollectedCharacters(); for (int i = 0; i < charactersCollected.size(); i++){ currentCharacter = new TextView(this); currentCharacter.setText(charactersCollected.get(i)); lView.addView(currentCharacter); } addListenerOnMainMenuButton(); }</code><technical_language>of put statements handled in constructor method of Person</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.photos); setTitle(R.string.photos_view_name); LinearLayout lView = (LinearLayout) findViewById(R.id.photos_list); ParseUser currentUser = ParseUser.getCurrentUser(); ArrayList<String> charactersCollected = null; if (currentUser != null) { charactersCollected = (ArrayList<String>) currentUser.get("charactersCollected"); } else { Intent i = new Intent(this, SignUpOrLogInActivity.class); startActivity(i); } for (int i = 0; i < charactersCollected.size(); i++){ currentCharacter = new TextView(this); currentCharacter.setText(charactersCollected.get(i)); lView.addView(currentCharacter); } addListenerOnMainMenuButton(); addListenerOnTrophiesButton(); }
Source:
<code><START> public SliceInput getDelegate() <END> { if (delegate == null) { delegate = requireNonNull(loader.get(), "loader returned a null stream"); verify(delegate.length() == globalLength, "loader returned stream of length %s, but length %s was expected", delegate.length(), globalLength); delegate.setPosition(initialPosition); } return delegate; }</code><technical_language>This private</technical_language>

Target:
private SliceInput getDelegate() { if (delegate == null) { delegate = requireNonNull(loader.get(), "loader returned a null stream"); verify(delegate.length() == globalLength, "loader returned stream of length %s, but length %s was expected", delegate.length(), globalLength); delegate.setPosition(initialPosition); } return delegate; }
Source:
<code>private boolean updateCost(AppAggregationKey appAggKey, HTable aggTable, JobDetails jobDetails) throws IOException { byte[] rowKey = aggConv.toBytes(appAggKey); Get g = new Get(rowKey); g.addColumn(AggregationConstants.INFO_FAM_BYTES, AggregationConstants.JOBCOST_BYTES); Result r = aggTable.get(g); <START> Double existingCost = 0.0; <END> byte[] existingCostBytes = null; KeyValue columnLatest = r.getColumnLatest(AggregationConstants.INFO_FAM_BYTES, AggregationConstants.JOBCOST_BYTES); if (columnLatest != null) { existingCost = Bytes.toDouble(columnLatest.getValue()); existingCostBytes = Bytes.toBytes(existingCost); } Double newCost = existingCost + jobDetails.getCost(); LOG.trace(" total app aggregated cost " + newCost); return executeCheckAndPut(aggTable, rowKey, existingCostBytes, Bytes.toBytes(newCost), AggregationConstants.INFO_FAM_BYTES, AggregationConstants.JOBCOST_BYTES); }</code><technical_language>Double -> double</technical_language>

Target:
private boolean updateCost(AppAggregationKey appAggKey, HTable aggTable, JobDetails jobDetails) throws IOException { byte[] rowKey = aggConv.toBytes(appAggKey); Get g = new Get(rowKey); g.addColumn(AggregationConstants.INFO_FAM_BYTES, AggregationConstants.JOBCOST_BYTES); Result r = aggTable.get(g); double existingCost = 0.0; byte[] existingCostBytes = null; KeyValue columnLatest = r.getColumnLatest(AggregationConstants.INFO_FAM_BYTES, AggregationConstants.JOBCOST_BYTES); if (columnLatest != null) { existingCost = Bytes.toDouble(columnLatest.getValue()); existingCostBytes = Bytes.toBytes(existingCost); } double newCost = existingCost + jobDetails.getCost(); if (LOG.isTraceEnabled()) { LOG.trace(" total app aggregated cost " + newCost); } return executeCheckAndPut(aggTable, rowKey, existingCostBytes, Bytes.toBytes(newCost), AggregationConstants.INFO_FAM_BYTES, AggregationConstants.JOBCOST_BYTES); }
Source:
<code>public MongoClient getConnection() throws UnknownHostException{ <START> return new MongoClient("localhost", immsAnnotation.port()); <END> }</code><technical_language>caching a client instead of creating a new time? I assume unit tests this method in-line instead of saving a local copy</technical_language>

Target:
public MongoClient getConnection() throws UnknownHostException{ if(client == null){ client = new MongoClient("localhost", immsAnnotation.port()); } return client; }
Source:
<code>public void testMultithreadPutSingle() throws InterruptedException { final int numThreads = 8; final int putsPerThread = 100000; final int totalNumberOfObjects = numThreads * putsPerThread; final CountDownLatch countDownLatch = new CountDownLatch(numThreads); final Runnable[] threads = new Runnable[numThreads]; for (int index = 0; index < numThreads; index++) { threads[index] = new PutThread( countDownLatch, memoryStore, index, numThreads, putsPerThread, 1, IndexParity.ALL_INDEX); } ThreadUtils.runConcurrently(threads); <START> final boolean allThreadsFinished = countDownLatch.await(90, TimeUnit.SECONDS); <END> assertTrue(MSG_THREADS_NOT_FINISHED, allThreadsFinished); assertEquals(MSG_SIZE_ASSERTION, totalNumberOfObjects, memoryStore.getAll(DATA_TYPE).size()); }</code><technical_language>out of curiosity: this test fail 60 seconds timeout</technical_language>

Target:
public void testMultithreadPutSingle() throws InterruptedException { final int numThreads = 8; final int putsPerThread = 100000; final int totalNumberOfObjects = numThreads * putsPerThread; final CountDownLatch countDownLatch = new CountDownLatch(numThreads); final Runnable[] threads = new Runnable[numThreads]; for (int index = 0; index < numThreads; index++) { threads[index] = new PutThread( countDownLatch, memoryStore, index, numThreads, putsPerThread, 1, IndexParity.ALL_INDEX); } ThreadUtils.runConcurrently(threads); final boolean allThreadsFinished = countDownLatch.await(60, TimeUnit.SECONDS); assertTrue(MSG_THREADS_NOT_FINISHED, allThreadsFinished); assertEquals(MSG_SIZE_ASSERTION, totalNumberOfObjects, memoryStore.getAll(DATA_TYPE).size()); }