auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testConvert() throws Exception { LjubesicPandzicStemmer stemmer = new LjubesicPandzicStemmer(); <START> assert stemmer.stemWord("abdominalni").equals("abdominaln"); <END> assert stemmer.stemWord("абдоминалне").equals("abdominaln"); assert stemmer.stemWord("zabave").equals("zabav"); assert stemmer.stemWord("забавама").equals("zabav"); assert stemmer.stemWord("Ћаф").equals("Ćaf"); assert stemmer.stemWord("жућкастосмеђим").equals("žućkastosmeđ"); assert stemmer.stemWord("јужночешком").equals("južnočešk"); assert stemmer.stemWord("ђуричковић").equals("đuričković"); assert stemmer.stemWord("βικιπαίδεια").equals("βικιπαίδεια"); assert stemmer.stemWord("ვიკიპედია").equals("ვიკიპედია"); assert stemmer.stemWord("위키백과").equals("위키백과"); }</code><technical_language>junit assertions in unittests, inline assertion useful in code itself</technical_language>

Target:
public void testConvert() throws Exception { LjubesicPandzicStemmer stemmer = new LjubesicPandzicStemmer(); assertEquals(stemmer.stemWord("abdominalni"), "abdominaln"); assertEquals(stemmer.stemWord("абдоминалне"), "abdominaln"); assertEquals(stemmer.stemWord("zabave"), "zabav"); assertEquals(stemmer.stemWord("забавама"), "zabav"); assertEquals(stemmer.stemWord("Ћаф"), "Ćaf"); assertEquals(stemmer.stemWord("жућкастосмеђим"), "žućkastosmeđ"); assertEquals(stemmer.stemWord("јужночешком"), "južnočešk"); assertEquals(stemmer.stemWord("ђуричковић"), "đuričković"); assertEquals(stemmer.stemWord("βικιπαίδεια"), "βικιπαίδεια"); assertEquals(stemmer.stemWord("ვიკიპედია"), "ვიკიპედია"); assertEquals(stemmer.stemWord("위키백과"), "위키백과"); }
Source:
<code>public void visitToken(DetailAST ast) { final DetailAST whitespaceFollowedAst = getWhitespaceFollowedNode(ast); <START> if (!ignoreWhitespaceAfter(whitespaceFollowedAst)) { <END> final int whitespaceColumnNo = getPositionAfter(whitespaceFollowedAst); final int whitespaceLineNo = whitespaceFollowedAst.getLineNo(); if (hasTrailingWhitespace(ast, whitespaceColumnNo, whitespaceLineNo)) { log(ast, MSG_KEY, whitespaceFollowedAst.getText()); } } }</code><technical_language>this condition a positive (do !)</technical_language>

Target:
public void visitToken(DetailAST ast) { final DetailAST whitespaceFollowedAst = getWhitespaceFollowedNode(ast); if (shouldCheckWhitespaceAfter(whitespaceFollowedAst)) { final int whitespaceColumnNo = getPositionAfter(whitespaceFollowedAst); final int whitespaceLineNo = whitespaceFollowedAst.getLineNo(); if (hasTrailingWhitespace(ast, whitespaceColumnNo, whitespaceLineNo)) { log(ast, MSG_KEY, whitespaceFollowedAst.getText()); } } }
Source:
<code>public static CopyState create(@Nullable Package targetPackage, Progress progress) { return new AutoValue_CopyState( targetPackage, progress, newArrayList(), <START> newHashMap(), <END> newHashMap(), newHashMap(), newHashMap(), newHashMap()); }</code><technical_language>new ArrayList<>();</technical_language>

Target:
public static CopyState create(@Nullable Package targetPackage, Progress progress) { return new CopyState(targetPackage, progress); }
Source:
<code>protected VdcReturnValueBase connectStorage() { VdcReturnValueBase result = null; String connectionId = getStorageDomain().getStorage(); StorageServerConnections connection = getStorageServerConnectionDAO().get(connectionId); result = Backend.getInstance().runInternalAction(VdcActionType.ConnectStorageToVds, <START> new StorageServerConnectionParametersBase(connection, getParameters().getVdsId())); <END> return result; }</code><technical_language>org.ovirt.engine.core.bll.storage.StorageHelperBase#connectStorageToDomainByVdsId</technical_language>

Target:
protected Pair<Boolean, Integer> connectStorage() { String connectionId = getStorageDomain().getStorage(); StorageServerConnections connection = getStorageServerConnectionDAO().get(connectionId); java.util.HashMap<String, String> result = (java.util.HashMap<String, String>) runVdsCommand( VDSCommandType.ConnectStorageServer, new StorageServerConnectionManagementVDSParameters(getParameters().getVdsId(), Guid.Empty, connection.getstorage_type(), new java.util.ArrayList<StorageServerConnections>(java.util.Arrays .asList(new StorageServerConnections[] { connection })))) .getReturnValue(); return new Pair<Boolean, Integer>(StorageHelperDirector.getInstance() .getItem(connection.getstorage_type()) .isConnectSucceeded(result, Arrays.asList(connection)), Integer.parseInt(result.values().iterator().next())); }
Source:
<code>public boolean hasNext() { if (buf == null) { <START> request(1); <END> buf = take(); } if (buf.isOnError()) { throw Exceptions.propagate(buf.getThrowable()); } return !buf.isOnCompleted(); }</code><technical_language>problem this approach is cross-thread pipelining thread progress other thread 1 thing. A approach request in bigger batches re-request a proportion of batch received</technical_language>

Target:
public boolean hasNext() { if (buf == null) { buf = take(); received++; if (received >= LIMIT) { request(received); received = 0; } } if (buf.isOnError()) { throw Exceptions.propagate(buf.getThrowable()); } return !buf.isOnCompleted(); }
Source:
<code>public static void main(String[] args) throws Exception { <START> DotNetAPIGenerator dnapi = new DotNetAPIGenerator("../zap-api-dotnet/src/OWASPZAPDotNetAPI/OWASPZAPDotNetAPI/Generated", true); <END> dnapi.generateCSharpFiles(ApiGeneratorUtils.getAllImplementors()); }</code><technical_language>optional parameter false, core APIs available</technical_language>

Target:
public static void main(String[] args) throws Exception { DotNetAPIGenerator dnapi = new DotNetAPIGenerator("../zap-api-dotnet/src/OWASPZAPDotNetAPI/OWASPZAPDotNetAPI/Generated", false); dnapi.generateCSharpFiles(ApiGeneratorUtils.getAllImplementors()); }
Source:
<code>public ScriptEntryData getScriptEntryData() { <START> return new BukkitScriptEntryData(event != null ? EntityTag.getPlayerFrom(event.getPlayer()) : null, null); <END> }</code><technical_language>null check</technical_language>

Target:
public ScriptEntryData getScriptEntryData() { return new BukkitScriptEntryData(EntityTag.getPlayerFrom(event.getPlayer()), null); }
Source:
<code>private void finishInternal() { <START> if (m_leasedThread.get() != null) { <END> return; } if (!isDone()) { return; } if (!m_finished.compareAndSet(false, true)) { return; } finished(); }</code><technical_language>this point, too, AtomicReference bring added compared a volatile variable</technical_language>

Target:
private void finishInternal() { if (m_leasedThread != null) { return; } if (!isDone()) { return; } if (!m_finished.compareAndSet(false, true)) { return; } finished(); }
Source:
<code>public DictionaryConnection openConnection(DataCleanerConfiguration configuration) { <START> final SortedSet<String> connectionValueSet = new TreeSet<>(Comparator.comparingInt(String::length).reversed().thenComparing(String::compareTo)); <END> connectionValueSet.addAll(_valueSet); return new DictionaryConnection() { SortedSet<String> _values = connectionValueSet; @Override public Iterator<String> getAllValues() { return _values.iterator(); } @Override public boolean containsValue(String value) { if (value == null) { return false; } if (!_caseSensitive) { value = value.toLowerCase(); } return _values.contains(value); } @Override public void close() { } }; }</code><technical_language>this part of consuming code - revealed in interface, right takes form of a "hidden implementation detail"</technical_language>

Target:
public DictionaryConnection openConnection(DataCleanerConfiguration configuration) { return new DictionaryConnection() { @Override public Iterator<String> getAllValues() { return _valueSet.iterator(); } @Override public Iterator<String> getLengthSortedValues() { final SortedSet<String> connectionValueSet = new TreeSet<>(Comparator.comparingInt(String::length).reversed().thenComparing(String::compareTo)); connectionValueSet.addAll(_valueSet); return connectionValueSet.iterator(); } @Override public boolean containsValue(String value) { if (value == null) { return false; } if (!_caseSensitive) { value = value.toLowerCase(); } return _valueSet.contains(value); } @Override public void close() { } }; }
Source:
<code>Mono<PollResponse<PhoneNumberSearch>>> createSearchPollOperation() { return pollingContext -> getSearchById(pollingContext.getActivationResponse().getValue().getSearchId()) .flatMap(getSearchResponse -> { if (getSearchResponse.getStatus().equals(SearchStatus.SUCCESS)) { <START> return Mono.just(new PollResponse<>( <END> LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, getSearchResponse)); } if (getSearchResponse.getStatus().equals(SearchStatus.EXPIRED)) { return Mono.just(new PollResponse<>( LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, getSearchResponse)); } if (getSearchResponse.getStatus().equals(SearchStatus.CANCELLED)) { return Mono.just(new PollResponse<>( LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, getSearchResponse)); } if (getSearchResponse.getStatus().equals(SearchStatus.RESERVED)) { return Mono.just(new PollResponse<>( LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, getSearchResponse)); } if (getSearchResponse.getStatus().equals(SearchStatus.ERROR)) { return Mono.just(new PollResponse<>( LongRunningOperationStatus.FAILED, getSearchResponse)); } return Mono.just(new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, getSearchResponse)); }); }</code><technical_language>clean this a bit, get status in a variable set do this for Expired, cancelled, etc.</technical_language>

Target:
createSearchPollOperation() { return pollingContext -> getSearchById(pollingContext.getLatestResponse().getValue().getSearchId()) .flatMap(getSearchResponse -> { SearchStatus status = getSearchResponse.getStatus(); if (status.equals(SearchStatus.EXPIRED) || status.equals(SearchStatus.CANCELLED) || status.equals(SearchStatus.RESERVED)) { return Mono.just(new PollResponse<>( LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, getSearchResponse)); } if (status.equals(SearchStatus.ERROR)) { return Mono.just(new PollResponse<>( LongRunningOperationStatus.FAILED, getSearchResponse)); } return Mono.just(new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, getSearchResponse)); }); }
Source:
<code>public long addUnknownDevice(String uniqueId) { Device device = new Device(); <START> String defaultGroupName = Context.getConfig().getString("database.registerUnknown.defaultGroup", "NOTDEFINED"); <END> device.setName(uniqueId); device.setUniqueId(uniqueId); device.setCategory(Context.getConfig().getString("database.registerUnknown.defaultCategory", "default")); if (!defaultGroupName.equals("NOTDEFINED")) { Group defaultGroup = Context.getDeviceManager().getGroupByName(defaultGroupName); if (defaultGroup != null) { device.setGroupId(defaultGroup.getId()); } } try { Context.getDeviceManager().addDevice(device); Log.info("Automatically registered device " + uniqueId); return device.getId(); } catch (SQLException e) { Log.warning(e); return 0; } }</code><technical_language>I need a default here</technical_language>

Target:
public long addUnknownDevice(String uniqueId) { Device device = new Device(); device.setName(uniqueId); device.setUniqueId(uniqueId); device.setCategory(Context.getConfig().getString("database.registerUnknown.defaultCategory")); long defaultGroupId = Context.getConfig().getLong("database.registerUnknown.defaultGroupId"); if (defaultGroupId != 0) { device.setGroupId(defaultGroupId); } try { Context.getDeviceManager().addDevice(device); Log.info("Automatically registered device " + uniqueId); return device.getId(); } catch (SQLException e) { Log.warning(e); return 0; } }
Source:
<code>private IFile findBuildFile(IContainer parent) { String[] names = AntUtil.getKnownBuildfileNames(); if (names == null) { return null; } IContainer lparent = parent; IResource file = null; while (file == null || file.getType() != IResource.FILE) { for (String <START> string : <END> names) { file = lparent.findMember(string); if (file != null && file.getType() == IResource.FILE) { break; } } lparent = lparent.getParent(); if (lparent == null) { return null; } } return (IFile) file; }</code><technical_language>rename name</technical_language>

Target:
private IFile findBuildFile(IContainer parent) { String[] names = AntUtil.getKnownBuildfileNames(); if (names == null) { return null; } IContainer lparent = parent; IResource file = null; while (file == null || file.getType() != IResource.FILE) { for (String name : names) { file = lparent.findMember(name); if (file != null && file.getType() == IResource.FILE) { break; } } lparent = lparent.getParent(); if (lparent == null) { return null; } } return (IFile) file; }
Source:
<code>public void removeAddress(LinkAddress address) <START> throws IOException { <END> try { mService.removeAddressFromTunnelInterface(mResourceId, address); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }</code><technical_language>really</technical_language>

Target:
public void removeAddress(LinkAddress address) { try { mService.removeAddressFromTunnelInterface(mResourceId, address); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Source:
<code>private void removeListeners() { if (restoreToSavePointListener != null) { restoreToSavePointListener.unregister(); <START> restoreToSavePointListener.dispose(); <END> restoreToSavePointListener = null; } if (this.saveSessionListener != null) { this.saveSessionListener.unregister(); this.saveSessionListener = null; } }</code><technical_language>Instead of unregister() dispose() methods dispose()</technical_language>

Target:
private void removeListeners() { if (restoreToSavePointListener != null) { restoreToSavePointListener.dispose(); restoreToSavePointListener = null; } if (this.saveSessionListener != null) { this.saveSessionListener.unregister(); this.saveSessionListener = null; } }
Source:
<code><START> private void fillInUnsetIpConfigs() { <END> getParameters().getNetworkAttachments().stream().forEach(networkAttachment -> { if (networkAttachment.getIpConfiguration() == null) { IpConfiguration ipConfiguration = NetworkUtils.createDefaultIpConfiguration(); networkAttachment.setIpConfiguration(ipConfiguration); } }); }</code><technical_language>exactly: getParameters().getNetworkAttachments() .stream() .filter(attachment -> attachment.getIpConfiguration() == null) .forEach(attachment -> attachment.setIpConfiguration(NetworkUtils.createDefaultIpConfiguration()));</technical_language>

Target:
private void fillInUnsetIpConfigs() { getParameters().getNetworkAttachments() .stream() .filter(attachment -> attachment.getIpConfiguration() == null) .forEach(attachment -> attachment.setIpConfiguration(NetworkUtils.createDefaultIpConfiguration())); }
Source:
<code>public Subscriber<? super T> call(Subscriber<? super T> child) { final SerializedSubscriber<T> s = new SerializedSubscriber<T>(child); final AtomicReference<Object> value = new AtomicReference<Object>(EMPTY_TOKEN); final AtomicReference<Subscription> main = new AtomicReference<Subscription>(); final Subscriber<U> samplerSub = new Subscriber<U>() { @Override public void onNext(U t) { Object localValue = value.getAndSet(EMPTY_TOKEN); if (localValue != EMPTY_TOKEN) { @SuppressWarnings("unchecked") T v = (T)localValue; s.onNext(v); } } @Override public void onError(Throwable e) { main.get().unsubscribe(); s.onError(e); } @Override public void onCompleted() { <START> main.get().unsubscribe(); <END> s.onCompleted(); } }; Subscriber<T> result = new Subscriber<T>() { @Override public void onNext(T t) { value.set(t); } @Override public void onError(Throwable e) { samplerSub.unsubscribe(); s.onError(e); } @Override public void onCompleted() { samplerSub.unsubscribe(); s.onCompleted(); } }; main.lazySet(result); child.add(result); child.add(samplerSub); sampler.unsafeSubscribe(samplerSub); return result; }</code><technical_language>change order of unsubscribe onCompleted? Is s.onCompleted some resource in main destroyed in unsubscribe</technical_language>

Target:
public Subscriber<? super T> call(Subscriber<? super T> child) { final SerializedSubscriber<T> s = new SerializedSubscriber<T>(child); final AtomicReference<Object> value = new AtomicReference<Object>(EMPTY_TOKEN); final AtomicReference<Subscription> main = new AtomicReference<Subscription>(); final Subscriber<U> samplerSub = new Subscriber<U>() { @Override public void onNext(U t) { Object localValue = value.getAndSet(EMPTY_TOKEN); if (localValue != EMPTY_TOKEN) { @SuppressWarnings("unchecked") T v = (T)localValue; s.onNext(v); } } @Override public void onError(Throwable e) { s.onError(e); main.get().unsubscribe(); } @Override public void onCompleted() { s.onCompleted(); main.get().unsubscribe(); } }; Subscriber<T> result = new Subscriber<T>() { @Override public void onNext(T t) { value.set(t); } @Override public void onError(Throwable e) { s.onError(e); samplerSub.unsubscribe(); } @Override public void onCompleted() { s.onCompleted(); samplerSub.unsubscribe(); } }; main.lazySet(result); child.add(result); child.add(samplerSub); sampler.unsafeSubscribe(samplerSub); return result; }
Source:
<code>public Journal getPublicationJournal(Article article) { String eissn = article.geteIssn(); Journal journal = null; if (eissn == null) { <START> log.warn("eIssn not set for article"); <END> } else { journal = (Journal) DataAccessUtils.uniqueResult((List<?>) hibernateTemplate.findByCriteria(journalCriteria().add(Restrictions.eq("eIssn", eissn)))); if (journal == null) { String msg = "XML contained eIssn that was not matched to a journal: " + eissn; throw new RestClientException(msg, HttpStatus.BAD_REQUEST); } } return journal; }</code><technical_language>this throw exception instead, for consistency case eIssn is unrecognized</technical_language>

Target:
public Journal getPublicationJournal(Article article) { String eissn = article.geteIssn(); if (eissn == null) { String msg = "eIssn not set for article: " + article.getDoi(); throw new RestClientException(msg, HttpStatus.BAD_REQUEST); } else { Journal journal = (Journal) DataAccessUtils.uniqueResult((List<?>) hibernateTemplate.findByCriteria(journalCriteria().add(Restrictions.eq("eIssn", eissn)))); if (journal == null) { String msg = "XML contained eIssn that was not matched to a journal: " + eissn; throw new RestClientException(msg, HttpStatus.BAD_REQUEST); } return journal; } }
Source:
<code>protected ReferencedEnvelope getBoundsInternal(Query query) throws IOException { Filter f = query.getFilter(); <START> if (f != null && f.equals(Filter.INCLUDE)) { <END> try { return new ReferencedEnvelope( CRS.transform(mbtiles.loadMetaData().getBounds(), DEFAULT_CRS)); } catch (TransformException e) { throw new RuntimeException("Unable to retrieve bounds from mbtiles metadata", e); } } else { return null; } }</code><technical_language>suggestion if (f == null || f.equals(Filter.INCLUDE)) {</technical_language>

Target:
protected ReferencedEnvelope getBoundsInternal(Query query) throws IOException { Filter f = query.getFilter(); if (f == null || f.equals(Filter.INCLUDE)) { try { return new ReferencedEnvelope( CRS.transform(mbtiles.loadMetaData().getBounds(), DEFAULT_CRS)); } catch (TransformException e) { throw new RuntimeException("Unable to retrieve bounds from mbtiles metadata", e); } } else { return null; } }
Source:
<code>private void reconstructMasterDomainNotInSync(final Guid storagePoolId, final Guid masterDomainId, final String exceptionMessage, final String logMessage) { <START> ((EventQueue) EjbUtils.findBean(BeanType.EVENTQUEUE_MANAGER, BeanProxyType.LOCAL)).submitEventSync(new Event(_storagePoolId, <END> masterDomainId, EventType.RECONSTRUCT), new Callable<EventResult>() { @Override public EventResult call() { EventResult result = null; log.warnFormat(logMessage); AuditLogableBase logable = new AuditLogableBase(mCurrentVdsId); logable.setStorageDomainId(masterDomainId); AuditLogDirector.log(logable, AuditLogType.SYSTEM_MASTER_DOMAIN_NOT_IN_SYNC); result = ResourceManager.getInstance() .getEventListener() .masterDomainNotOperational(masterDomainId, storagePoolId); return result; } }); throw new IRSNoMasterDomainException(exceptionMessage); }</code><technical_language>hard read, please modularize</technical_language>

Target:
private void reconstructMasterDomainNotInSync(final Guid storagePoolId, final Guid masterDomainId, final String exceptionMessage, final String logMessage) { ((EventQueue) EjbUtils.findBean(BeanType.EVENTQUEUE_MANAGER, BeanProxyType.LOCAL)).submitEventSync(new Event(_storagePoolId, masterDomainId, null, EventType.RECONSTRUCT), new Callable<EventResult>() { @Override public EventResult call() { EventResult result = null; log.warnFormat(logMessage); AuditLogableBase logable = new AuditLogableBase(mCurrentVdsId); logable.setStorageDomainId(masterDomainId); AuditLogDirector.log(logable, AuditLogType.SYSTEM_MASTER_DOMAIN_NOT_IN_SYNC); result = ResourceManager.getInstance() .getEventListener() .masterDomainNotOperational(masterDomainId, storagePoolId); return result; } }); throw new IRSNoMasterDomainException(exceptionMessage); }
Source:
<code>public FunctionSignatureProto getProto() { FunctionSignatureProto.Builder builder = FunctionSignatureProto.newBuilder(); builder.setType(functionType); builder.setName(name); List inputList = new ArrayList<>(); inputList.addAll(Arrays.asList(paramTypes)); <START> builder.addAllParameterTypes(inputList); <END> builder.setReturnType(returnType); return builder.build(); }</code><technical_language>inputList is redundant. replaced Arrays.asList(paramTypes)</technical_language>

Target:
public FunctionSignatureProto getProto() { FunctionSignatureProto.Builder builder = FunctionSignatureProto.newBuilder(); builder.setType(functionType); builder.setName(name); builder.addAllParameterTypes(Arrays.asList(paramTypes)); builder.setReturnType(returnType); return builder.build(); }
Source:
<code>private Object[] _reqForTemplate(JSONObject m, ArrayList<String> flds, JSONObject t) { ArrayList<String> a = new ArrayList<>(); ArrayList<String> b = new ArrayList<>(); for (String f : flds) { a.add("ankiflag"); b.add(""); } Object[] data; Long mid = m.getLong("id"); int ord = t.getInt("ord"); <START> String packedFields = Utils.joinFields(a.toArray(new String[a.size()])); <END> data = new Object[] {1L, 1L, mid, 1L, ord, "", packedFields, 0}; String full = mCol._renderQA(data).get("q"); packedFields = Utils.joinFields(b.toArray(new String[b.size()])); data = new Object[] {1L, 1L, mid, 1L, ord, "", packedFields, 0}; String empty = mCol._renderQA(data).get("q"); if (full.equals(empty)) { return new Object[] { "none", new JSONArray(), new JSONArray() }; } String type = "all"; JSONArray req = new JSONArray(); ArrayList<String> tmp = new ArrayList<>(); for (int i = 0; i < flds.size(); i++) { tmp.clear(); tmp.addAll(a); tmp.set(i, ""); data[6] = Utils.joinFields(tmp.toArray(new String[tmp.size()])); if (!mCol._renderQA(data).get("q").contains("ankiflag")) { req.put(i); } } if (req.length() > 0) { return new Object[] { type, req }; } type = "any"; req = new JSONArray(); for (int i = 0; i < flds.size(); i++) { tmp.clear(); tmp.addAll(b); tmp.set(i, "1"); data[6] = Utils.joinFields(tmp.toArray(new String[tmp.size()])); if (!mCol._renderQA(data).get("q").equals(empty)) { req.put(i); } } return new Object[] { type, req }; }</code><technical_language>String.class faster new String[a.size()] removes array allocation</technical_language>

Target:
private Object[] _reqForTemplate(JSONObject m, ArrayList<String> flds, JSONObject t) { int nbFields = flds.size(); String[] a = new String[nbFields]; String[] b = new String[nbFields]; Arrays.fill(a, "ankiflag"); Arrays.fill(b, ""); Long mid = m.getLong("id"); int ord = t.getInt("ord"); String full = mCol._renderQA(1L, mid, 1L, ord, "", a, 0).get("q"); String empty = mCol._renderQA(1L, mid, 1L, ord, "", b, 0).get("q"); if (full.equals(empty)) { return new Object[] { "none", new JSONArray(), new JSONArray() }; } String type = "all"; JSONArray req = new JSONArray(); for (int i = 0; i < flds.size(); i++) { a[i] = ""; if (!mCol._renderQA(1L, mid, 1L, ord, "", a, 0).get("q").contains("ankiflag")) { req.put(i); } a[i] = "ankiflag"; } if (req.length() > 0) { return new Object[] { type, req }; } type = "any"; req = new JSONArray(); for (int i = 0; i < flds.size(); i++) { b[i] = "1"; if (!mCol._renderQA(1L, mid, 1L, ord, "", b, 0).get("q").equals(empty)) { req.put(i); } b[i] = ""; } return new Object[] { type, req }; }
Source:
<code>public List<Map<String, String>> process(String targetHost) throws AmbariException { KerberosServerAction.KerberosCommandParameters kerberosCommandParameters = new KerberosServerAction.KerberosCommandParameters(executionCommand); try { Map<String, Collection<String>> serviceComponentFilter = getServiceComponentFilter(kerberosCommandParameters.getServiceComponentFilter()); Set<ResolvedKerberosKeytab> keytabsToInject = kerberosKeytabController.getFilteredKeytabs(serviceComponentFilter, kerberosCommandParameters.getHostFilter(), kerberosCommandParameters.getIdentityFilter()); if (serviceComponentFilter != null) { <START> keytabsToInject.addAll(kerberosKeytabController.findKeytabsForServiceIdentities(executionCommand.getClusterName(), serviceComponentFilter)); <END> } for (ResolvedKerberosKeytab resolvedKeytab : keytabsToInject) { for (ResolvedKerberosPrincipal resolvedPrincipal : resolvedKeytab.getPrincipals()) { String hostName = resolvedPrincipal.getHostName(); if (targetHost.equalsIgnoreCase(hostName)) { process(targetHost, resolvedKeytab, resolvedPrincipal, serviceComponentFilter); } } } } catch (IOException e) { throw new AmbariException("Could not inject keytabs to enable kerberos"); } return kcp; }</code><technical_language>this negate host filter. tested regenerating keytab files for a specific host? Also, this break operations related cleaning identities? I testing this for a patch, I kerberosKeytabController.getFilteredKeytabs call service user (headless) principals related a service</technical_language>

Target:
public List<Map<String, String>> process(String targetHost) throws AmbariException { KerberosServerAction.KerberosCommandParameters kerberosCommandParameters = new KerberosServerAction.KerberosCommandParameters(executionCommand); try { Map<String, ? extends Collection<String>> serviceComponentFilter = getServiceComponentFilter(kerberosCommandParameters.getServiceComponentFilter()); final Collection<KerberosIdentityDescriptor> serviceIdentities = serviceComponentFilter == null ? null : kerberosKeytabController.getServiceIdentities(executionCommand.getClusterName(), serviceComponentFilter.keySet()); final Set<ResolvedKerberosKeytab> keytabsToInject = kerberosKeytabController.getFilteredKeytabs(serviceIdentities, kerberosCommandParameters.getHostFilter(), kerberosCommandParameters.getIdentityFilter()); for (ResolvedKerberosKeytab resolvedKeytab : keytabsToInject) { for (ResolvedKerberosPrincipal resolvedPrincipal : resolvedKeytab.getPrincipals()) { String hostName = resolvedPrincipal.getHostName(); if (targetHost.equalsIgnoreCase(hostName)) { process(targetHost, resolvedKeytab, resolvedPrincipal, serviceComponentFilter); } } } } catch (IOException e) { throw new AmbariException("Could not inject keytabs to enable kerberos"); } return kcp; }
Source:
<code>public void onNext(final AggregationMessage msg) { LOG.entering(DriverSideMetricsMsgHandler.class.getSimpleName(), "onNext"); final MetricsMessage metricsMessage = metricsMessageCodec.decode(msg.getData().array()); final SrcType srcType = metricsMessage.getSrcType(); if (SrcType.Worker.equals(srcType)) { final String workerId = msg.getSourceId().toString(); final WorkerMsg workerMsg = metricsMessage.getWorkerMsg(); final Map<String, Double> workerMetrics = getMetricsFromAvro(metricsMessage.getMetrics()); LOG.log(Level.FINE, "Metric from worker: {0}, iteration: {1}, metrics: {2}", new Object[]{workerId, workerMsg.getIteration(), workerMetrics}); metricsHub.storeWorkerMetrics(workerId, workerMsg.getNumDataBlocks(), workerMetrics); } else if (SrcType.Server.equals(srcType)) { final String serverId = msg.getSourceId().toString(); final ServerMsg serverMsg = metricsMessage.getServerMsg(); final Map<String, Double> serverMetrics = getMetricsFromAvro(metricsMessage.getMetrics()); <START> LOG.log(Level.INFO, "Metric from server: {0}, window: {1}, metrics: {2}", new Object[]{serverId, <END> serverMsg.getWindow(), serverMetrics}); metricsHub.storeServerMetrics(serverId, serverMsg.getNumPartitionBlocks(), serverMetrics); } else { throw new RuntimeException("Unknown SrcType " + srcType); } LOG.exiting(DriverSideMetricsMsgHandler.class.getSimpleName(), "onNext"); }</code><technical_language>log level is L64. FINE well</technical_language>

Target:
public void onNext(final AggregationMessage msg) { LOG.entering(DriverSideMetricsMsgHandler.class.getSimpleName(), "onNext"); final MetricsMessage metricsMessage = metricsMessageCodec.decode(msg.getData().array()); final SrcType srcType = metricsMessage.getSrcType(); if (SrcType.Worker.equals(srcType)) { final String workerId = msg.getSourceId().toString(); final WorkerMsg workerMsg = metricsMessage.getWorkerMsg(); final Map<String, Double> workerMetrics = getMetricsFromAvro(metricsMessage.getMetrics()); LOG.log(Level.FINE, "Metric from worker: {0}, iteration: {1}, metrics: {2}", new Object[]{workerId, workerMsg.getIteration(), workerMetrics}); metricsHub.storeWorkerMetrics(workerId, workerMsg.getNumDataBlocks(), workerMetrics); } else if (SrcType.Server.equals(srcType)) { final String serverId = msg.getSourceId().toString(); final ServerMsg serverMsg = metricsMessage.getServerMsg(); final Map<String, Double> serverMetrics = getMetricsFromAvro(metricsMessage.getMetrics()); LOG.log(Level.FINE, "Metric from server: {0}, window: {1}, metrics: {2}", new Object[]{serverId, serverMsg.getWindow(), serverMetrics}); metricsHub.storeServerMetrics(serverId, serverMsg.getNumPartitionBlocks(), serverMetrics); } else { throw new RuntimeException("Unknown SrcType " + srcType); } LOG.exiting(DriverSideMetricsMsgHandler.class.getSimpleName(), "onNext"); }
Source:
<code>public void endWindow() { multiMap.endWindow(); windowToCount.put(windowId, countInWindow); windowToCount.endWindow(); store.endWindow(); if (windowId % 10 == 0) { long startTime = System.currentTimeMillis(); checkData(); <START> logger.info("checkData() took millis.", System.currentTimeMillis() - startTime); <END> } }</code><technical_language>debug consider moving logging checkData()</technical_language>

Target:
public void endWindow() { multiMap.endWindow(); windowToCount.put(windowId, countInWindow); windowToCount.endWindow(); store.endWindow(); if (windowId % 10 == 0) { checkData(); } }
Source:
<code>private Map<String, Serde<Object>> getSerdes() { Map<String, Serde<Object>> retVal = new HashMap<>(); <START> JavaConverters.asJavaCollectionConverter(new SerializerConfig(jobConfig).getSerdeNames()) <END> .asJavaCollection() .stream() .forEach(serdeName -> { Option<String> serdeClassName = new SerializerConfig(jobConfig).getSerdeClass(serdeName); if (serdeClassName.isEmpty()) { serdeClassName = Option.apply(SerializerConfig.getSerdeFactoryName(serdeName)); } Serde serde = Util.getObj(serdeClassName.get(), SerdeFactory.class) .getSerde(serdeName, new SerializerConfig(jobConfig)); retVal.put(serdeName, serde); }); return retVal; }</code><technical_language>refactor conversion a library method ScalatoJavaUtils</technical_language>

Target:
private Map<String, Serde<Object>> getSerdes() { Map<String, Serde<Object>> serdeMap = new HashMap<>(); SerializerConfig serializerConfig = new SerializerConfig(jobConfig); ScalaJavaUtil.toJavaCollection(serializerConfig.getSerdeNames()) .stream() .forEach(serdeName -> { Option<String> serdeClassName = serializerConfig.getSerdeClass(serdeName); if (serdeClassName.isEmpty()) { serdeClassName = Option.apply(SerializerConfig.getSerdeFactoryName(serdeName)); } Serde serde = Util.getObj(serdeClassName.get(), SerdeFactory.class).getSerde(serdeName, serializerConfig); serdeMap.put(serdeName, serde); }); return serdeMap; }
Source:
<code>public boolean schedule() { <START> if (scheduled.get()) { <END> return false; } boolean res = scheduled.compareAndSet(false, true); if (res) { fragmentPool.submit(this); } return res; }</code><technical_language>this check is necessary is covered scheduled.compareAndSet logic</technical_language>

Target:
public boolean schedule() { boolean res = !scheduled.get() && scheduled.compareAndSet(false, true); if (res) { submit(); } return res; }
Source:
<code>public synchronized <T> T newMonitor( Class<T> monitorClass, String... tags ) { requireInterface( monitorClass ); ClassLoader classLoader = monitorClass.getClassLoader(); MonitorInvocationHandler monitorInvocationHandler = new MonitorInvocationHandler( tags ); return monitorClass.cast( Proxy.newProxyInstance( classLoader, new Class<?>[]{monitorClass}, monitorInvocationHandler ) ); <START> } <END></code><technical_language>I newMonitor methods need synchronised</technical_language>

Target:
public <T> T newMonitor( Class<T> monitorClass, String... tags ) { requireInterface( monitorClass ); ClassLoader classLoader = monitorClass.getClassLoader(); MonitorInvocationHandler monitorInvocationHandler = new MonitorInvocationHandler( tags ); return monitorClass.cast( Proxy.newProxyInstance( classLoader, new Class<?>[]{monitorClass}, monitorInvocationHandler ) ); }
Source:
<code>public void reset(OutputStream out) throws IOException { <START> this.out = out; <END> }</code><technical_language>This been: this.out.close();</technical_language>

Target:
public void reset(OutputStream out) throws IOException { this.out.close(); this.out = out; }
Source:
<code>public Collection<Tuple> get(Tuple signature) { Object bucket = matchings.get(signature); if (bucket instanceof MarkedSet<?>) { <START> return (Collection<Tuple>) bucket; <END> } else { if (bucket == null) return null; return Collections.singleton((Tuple)bucket); } }</code><technical_language>This instanceof/cast pair strange. synchronize if (even if bytecode level this is synchronized version)</technical_language>

Target:
public Collection<Tuple> get(Tuple signature) { Object bucket = matchings.get(signature); if (bucket instanceof MarkedSet<?>) { return (MarkedSet<Tuple>) bucket; } else { if (bucket == null) return null; return Collections.singleton((Tuple)bucket); } }
Source:
<code>public Selector(NetworkMetrics metrics, Time time, SSLFactory sslFactory) throws IOException { this.nioSelector = java.nio.channels.Selector.open(); this.time = time; this.keyMap = new HashMap<String, SelectionKey>(); this.completedSends = new ArrayList<NetworkSend>(); this.completedReceives = new ArrayList<NetworkReceive>(); this.connected = new ArrayList<String>(); this.disconnected = new ArrayList<String>(); this.pendingSslTrans = new HashMap<>(); this.metrics = metrics; this.IdGenerator = new AtomicLong(0); this.activeConnections = new AtomicLong(0); this.connectionsPendingHandshakeCount = new AtomicLong(0); <START> this.metrics.initializeSelectorMetricsIfRequired(activeConnections, connectionsPendingHandshakeCount); <END> this.sslFactory = sslFactory; }</code><technical_language>Prefixing this is unnecessary for member variables in this constructor</technical_language>

Target:
public Selector(NetworkMetrics metrics, Time time, SSLFactory sslFactory) throws IOException { this.nioSelector = java.nio.channels.Selector.open(); this.time = time; this.keyMap = new HashMap<String, SelectionKey>(); this.completedSends = new ArrayList<NetworkSend>(); this.completedReceives = new ArrayList<NetworkReceive>(); this.connected = new ArrayList<String>(); this.disconnected = new ArrayList<String>(); this.metrics = metrics; this.IdGenerator = new AtomicLong(0); numActiveConnections = new AtomicLong(0); unreadyConnections = new HashSet<>(); metrics.initializeSelectorMetrics(numActiveConnections); this.sslFactory = sslFactory; }
Source:
<code>public GlowArmorStand(Location location) { super(location); setMaxHealth(2); setHealth(2); for (int i = 0; i < 2; i++) { pose[i] = EulerAngle.ZERO; } double ten = Math.toRadians(10); double fifteen = Math.toRadians(15); double one = Math.toRadians(1); pose[2] = new EulerAngle(-ten, 0, -ten); pose[3] = new EulerAngle(-fifteen, 0, ten); pose[4] = new EulerAngle(-one, 0, -one); <START> pose[5] = new EulerAngle(one, 0, one); <END> for (int i = 0; i < 5; i++) { changedEquip[i] = false; } }</code><technical_language>a static final constant</technical_language>

Target:
public GlowArmorStand(Location location) { super(location, 2); System.arraycopy(defaultPose, 0, pose, 0, 6); for (int i = 0; i < 5; i++) { changedEquip[i] = false; } }
Source:
<code>public void httpProxyIsConfigurableOnClientRequests() { TestResource clientWithHttpProxy = AtlasDbHttpClients.createProxyWithFailover( new MetricRegistry(), ImmutableServerListConfig.builder() .addServers(getUriForPort(availablePort)) .proxyConfiguration(ProxyConfiguration.of(getHostAndPort(proxyPort))) .build(), TestResource.class, AUXILIARY_REMOTING_PARAMETERS_NO_PAYLOAD_LIMIT); clientWithHttpProxy.getTestNumber(); proxyServer.verify(getRequestedFor(urlMatching(GET_ENDPOINT)) <START> .withHeader(AtlasDbInterceptors.USER_AGENT_HEADER, WireMock.equalTo(DEFAULT_USER_AGENT_STRING))); <END> availableServer.verify(0, getRequestedFor(urlMatching(GET_ENDPOINT))); }</code><technical_language>nit, default legacy</technical_language>

Target:
public void httpProxyIsConfigurableOnClientRequests() { TestResource clientWithHttpProxy = AtlasDbHttpClients.createProxyWithFailover( new MetricRegistry(), ImmutableServerListConfig.builder() .addServers(getUriForPort(availablePort1)) .proxyConfiguration(ProxyConfiguration.of(getHostAndPort(proxyPort))) .build(), TestResource.class, AUXILIARY_REMOTING_PARAMETERS_NO_PAYLOAD_LIMIT); clientWithHttpProxy.getTestNumber(); proxyServer.verify(getRequestedFor(urlMatching(GET_ENDPOINT)) .withHeader(AtlasDbInterceptors.USER_AGENT_HEADER, WireMock.equalTo(LEGACY_USER_AGENT_STRING))); availableServer1.verify(0, getRequestedFor(urlMatching(GET_ENDPOINT))); }
Source:
<code>private void setArticleCategories(Article article, List<WeightedTerm> categories) { categories.sort(WeightedTerm.BY_DESCENDING_WEIGHT); List<WeightedTerm> results = new ArrayList<>(categories.size()); Set<String> uniqueLeafs = new HashSet<>(); for (WeightedTerm s : categories) { if (s.getTerm().charAt(0) != '/') { throw new IllegalArgumentException("Bad category: " + s); } <START> if (uniqueLeafs.size() == 8 && <END> !uniqueLeafs.contains(s.getLeafTerm()) ) { break; } else { uniqueLeafs.add(s.getLeafTerm()); results.add(s); } } Map<Category, Integer> categoryEntities = resolveIntoCategoryEntities(results); article.setCategories(categoryEntities); }</code><technical_language>long messing this code, yank out this hard-coded 8</technical_language>

Target:
private void setArticleCategories(Article article, List<WeightedTerm> categories) { categories = WeightedTerm.BY_DESCENDING_WEIGHT.immutableSortedCopy(categories); List<WeightedTerm> results = new ArrayList<>(categories.size()); Set<String> uniqueLeafs = new HashSet<>(); for (WeightedTerm s : categories) { if (s.getPath().charAt(0) != '/') { throw new IllegalArgumentException("Bad category: " + s); } if (uniqueLeafs.size() == CATEGORY_COUNT && !uniqueLeafs.contains(s.getLeafTerm())) { break; } else { uniqueLeafs.add(s.getLeafTerm()); results.add(s); } } Map<Category, Integer> categoryEntities = resolveIntoCategoryEntities(results); article.setCategories(categoryEntities); }
Source:
<code>public void onDestroy() { <START> mMediaUploadHandler.cancelInProgressUploads(); <END> mPostUploadHandler.cancelInProgressUploads(); for (Integer postId : sCompletedMediaByPost.keySet()) { PostModel updatedPost = updatePostWithCurrentlyCompletedUploads(mPostStore.getPostByLocalPostId(postId)); mDispatcher.dispatch(PostActionBuilder.newUpdatePostAction(updatedPost)); } mDispatcher.unregister(this); mMediaUploadHandler.unregister(); mPostUploadHandler.unregister(); AppLog.i(T.MAIN, "UploadService > Destroyed"); super.onDestroy(); }</code><technical_language>check mMediaUpoadHandler != null accessing methods here, created in onStartCommand, I this slight possibility onCreate is called onDestroy called immediately (without onStartCommand called)</technical_language>

Target:
public void onDestroy() { if (mMediaUploadHandler != null) { mMediaUploadHandler.cancelInProgressUploads(); mMediaUploadHandler.unregister(); } if (mPostUploadHandler != null) { mPostUploadHandler.cancelInProgressUploads(); mPostUploadHandler.unregister(); } for (Integer postId : sCompletedMediaByPost.keySet()) { PostModel updatedPost = updatePostWithCurrentlyCompletedUploads(mPostStore.getPostByLocalPostId(postId)); mDispatcher.dispatch(PostActionBuilder.newUpdatePostAction(updatedPost)); } mDispatcher.unregister(this); AppLog.i(T.MAIN, "UploadService > Destroyed"); super.onDestroy(); }
Source:
<code>public void mucDestroyTest() throws TimeoutException, Exception { EntityBareJid mucAddress = JidCreate.entityBareFrom(Localpart.from("smack-inttest-join-leave-" + randomString), mucService.getDomain()); MultiUserChat muc = mucManagerOne.getMultiUserChat(mucAddress); muc.join(Resourcepart.from("nick-one")); final SimpleResultSyncPoint mucDestroyed = new SimpleResultSyncPoint(); <START> UserStatusListener userStatusListener = new UserStatusListener() { <END> @Override public void voiceRevoked() { } @Override public void voiceGranted() { } @Override public void roomDestroyed(MultiUserChat alternateMUC, String reason) { mucDestroyed.signal(); } @Override public void ownershipRevoked() { } @Override public void ownershipGranted() { } @Override public void moderatorRevoked() { } @Override public void moderatorGranted() { } @Override public void membershipRevoked() { } @Override public void membershipGranted() { } @Override public void kicked(Jid actor, String reason) { } @Override public void banned(Jid actor, String reason) { } @Override public void adminRevoked() { } @Override public void adminGranted() { } }; muc.addUserStatusListener(userStatusListener); assertTrue(mucManagerOne.getJoinedRooms().size() == 1); assertTrue(muc.getOccupantsCount() == 1); assertTrue(muc.getNickname() != null); try { muc.destroy("Dummy reason", null); mucDestroyed.waitForResult(timeout); } finally { muc.removeUserStatusListener(userStatusListener); } assertTrue(mucManagerOne.getJoinedRooms().size() == 0); assertTrue(muc.getOccupantsCount() == 0); assertTrue(muc.getNickname() == null); }</code><technical_language>If instantiate a DefaultUserStatusListener omit empty methods</technical_language>

Target:
public void mucDestroyTest() throws TimeoutException, Exception { EntityBareJid mucAddress = JidCreate.entityBareFrom(Localpart.from("smack-inttest-join-leave-" + randomString), mucService.getDomain()); MultiUserChat muc = mucManagerOne.getMultiUserChat(mucAddress); muc.join(Resourcepart.from("nick-one")); final SimpleResultSyncPoint mucDestroyed = new SimpleResultSyncPoint(); @SuppressWarnings("deprecation") DefaultUserStatusListener userStatusListener = new DefaultUserStatusListener() { @Override public void roomDestroyed(MultiUserChat alternateMUC, String reason) { mucDestroyed.signal(); } }; muc.addUserStatusListener(userStatusListener); assertTrue(mucManagerOne.getJoinedRooms().size() == 1); assertTrue(muc.getOccupantsCount() == 1); assertTrue(muc.getNickname() != null); try { muc.destroy("Dummy reason", null); mucDestroyed.waitForResult(timeout); } finally { muc.removeUserStatusListener(userStatusListener); } assertTrue(mucManagerOne.getJoinedRooms().size() == 0); assertTrue(muc.getOccupantsCount() == 0); assertTrue(muc.getNickname() == null); }
Source:
<code>public void testApplyBlockUpdatesToTrainingDataDuringEpoch() { <START> final int numTotalInstances = MINI_BATCH_SIZE * 10; <END> createTrainingData(numTotalInstances); trainingDataProvider.prepareDataForEpoch(); final List <Pair<Integer, Map<Long, Integer>>> addedBlockList = testGetNextTrainingDataWithBlockAdditions(numTotalInstances); assertTrue("Data should be exhausted", trainingDataProvider.getNextTrainingData().isEmpty()); trainingDataProvider.prepareDataForEpoch(); testGetNextTrainingDataWithBlockRemovals(addedBlockList); assertTrue("Data should be exhausted", trainingDataProvider.getNextTrainingData().isEmpty()); }</code><technical_language>10 means what? Number of mini-batches? Please variable</technical_language>

Target:
public void testApplyBlockUpdatesToTrainingDataDuringEpoch() { final int numMiniBatches = 10; final int numTotalInstances = MINI_BATCH_SIZE * numMiniBatches; createTrainingData(numTotalInstances); trainingDataProvider.prepareDataForEpoch(); final List <Pair<Integer, Map<Long, Integer>>> addedBlockList = testGetNextTrainingDataWithBlockAdditions(numTotalInstances); assertTrue("Data should be exhausted", trainingDataProvider.getNextTrainingData().isEmpty()); trainingDataProvider.prepareDataForEpoch(); testGetNextTrainingDataWithBlockRemovals(addedBlockList); assertTrue("Data should be exhausted", trainingDataProvider.getNextTrainingData().isEmpty()); }
Source:
<code>public void euqal_shouldPreventAddingTwoEqualObjectsToACollection() { Set<CohortMembership> cohortMembershipSet = new LinkedHashSet<>(); final int PATIENT_ID = 12; CohortMembership cohortMembershipOne = new CohortMembership(PATIENT_ID); CohortMembership cohortMembershipTwo = new CohortMembership(PATIENT_ID); final int TIMESTAMP_START_DATE = 1545140935; <START> final int TIMESTAMP_END_DATE = 1577836801; <END> Date startDate1 = new Date(TIMESTAMP_START_DATE); Date endDate1 = new Date(TIMESTAMP_END_DATE); Date startDate2 = new Date(TIMESTAMP_START_DATE); Date endDate2 = new Date(TIMESTAMP_END_DATE); cohortMembershipOne.setEndDate(endDate1); cohortMembershipOne.setStartDate(startDate1); cohortMembershipTwo.setStartDate(startDate2); cohortMembershipTwo.setEndDate(endDate2); cohortMembershipSet.add(cohortMembershipOne); cohortMembershipSet.add(cohortMembershipTwo); assertEquals(cohortMembershipSet.size(), 1); }</code><technical_language>If constants referenced in more testcase, class level constants</technical_language>

Target:
public void euqal_shouldPreventAddingTwoEqualObjectsToACollection() { Set<CohortMembership> cohortMembershipSet = new LinkedHashSet<>(); final int PATIENT_ID = 12; CohortMembership cohortMembershipOne = new CohortMembership(PATIENT_ID); CohortMembership cohortMembershipTwo = new CohortMembership(PATIENT_ID); Date startDate1 = new Date(TIMESTAMP_START_DATE); Date endDate1 = new Date(TIMESTAMP_END_DATE); Date startDate2 = new Date(TIMESTAMP_START_DATE); Date endDate2 = new Date(TIMESTAMP_END_DATE); cohortMembershipOne.setEndDate(endDate1); cohortMembershipOne.setStartDate(startDate1); cohortMembershipTwo.setStartDate(startDate2); cohortMembershipTwo.setEndDate(endDate2); cohortMembershipSet.add(cohortMembershipOne); cohortMembershipSet.add(cohortMembershipTwo); assertEquals(cohortMembershipSet.size(), 1); }
Source:
<code>public void handleAnalysisStarted(TmfStartAnalysisSignal signal) { IAnalysisModule module = signal.getAnalysisModule(); if (module instanceof ITmfAnalysisModuleWithStateSystems && !module.isAutomatic()) { if (Iterables.contains(allModules(getTrace()), module)) { synchronized (fStartedAnalysis) { fStartedAnalysis.add((ITmfAnalysisModuleWithStateSystems) module); rebuild(); } } else { for (ITmfTrace trace : TmfTraceManager.getInstance().getOpenedTraces()) { if (Iterables.contains(allModules(trace), module)) { synchronized (fStartedAnalysis) { <START> fStartedAnalysis.add((ITmfAnalysisModuleWithStateSystems) module); <END> resetView(trace); } break; } } } } }</code><technical_language>Here, call a method in provider set started analyses</technical_language>

Target:
public void handleAnalysisStarted(TmfStartAnalysisSignal signal) { IAnalysisModule module = signal.getAnalysisModule(); if (module instanceof ITmfAnalysisModuleWithStateSystems && !module.isAutomatic()) { if (Iterables.contains(allModules(getTrace()), module)) { synchronized (fStartedAnalysis) { fStartedAnalysis.add((ITmfAnalysisModuleWithStateSystems) module); getDataProvider().startedAnalysisSignalHandler((ITmfAnalysisModuleWithStateSystems) module); rebuild(); } } else { for (ITmfTrace trace : TmfTraceManager.getInstance().getOpenedTraces()) { if (Iterables.contains(allModules(trace), module)) { synchronized (fStartedAnalysis) { fStartedAnalysis.add((ITmfAnalysisModuleWithStateSystems) module); resetView(trace); } break; } } } } }