auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static String createTabletDirectoryName(ServerContext context, Text endRow) { if (endRow == null) { return Constants.DEFAULT_TABLET_DIR_NAME; } else { UniqueNameAllocator namer = context.getUniqueNameAllocator(); <START> return Constants.GENERATED_TABLET_DIRECTORY_PREFIX + namer.getNextName(); <END> } }</code><technical_language>is Tablet directory created now? This new method creates name</technical_language>

Target:
private static String createTabletDirectoryName(ServerContext context, Text endRow) { if (endRow == null) { return ServerColumnFamily.DEFAULT_TABLET_DIR_NAME; } else { UniqueNameAllocator namer = context.getUniqueNameAllocator(); return Constants.GENERATED_TABLET_DIRECTORY_PREFIX + namer.getNextName(); } }
Source:
<code>private void initFragmentsWithFile() { if (getAccount() != null && getFile() != null) { OCFileListFragment listOfFiles = getListOfFilesFragment(); if (listOfFiles != null) { listOfFiles.listDirectory(getCurrentDir()); } else { Log_OC.e(TAG, "Still have a chance to lose the initializacion of list fragment >("); } OCFile file = getFile(); Fragment secondFragment = chooseInitialSecondFragment(file); if (secondFragment != null) { setSecondFragment(secondFragment); updateFragmentsVisibility(true); updateActionBarTitleAndHomeButton(file); } else { cleanSecondFragment(); if (file.isDown() && PreviewTextFragment.canBePreviewed(file)) startTextPreview(file); } <START> switchLayout(getFile()); <END> } else { Log_OC.wtf(TAG, "initFragments() called with invalid NULLs!"); if (getAccount() == null) { Log_OC.wtf(TAG, "\t account is NULL"); } if (getFile() == null) { Log_OC.wtf(TAG, "\t file is NULL"); } } }</code><technical_language>is a local variable file set getFile() 13 lines above; I instead of calling getFile() again. EDIT: Indeed, safer instead getCurrentDir(); if I recall correctly, getFile() return selected file in a tablet in landscape, a file is shown in right pane</technical_language>

Target:
private void initFragmentsWithFile() { if (getAccount() != null && getFile() != null) { OCFileListFragment listOfFiles = getListOfFilesFragment(); if (listOfFiles != null) { listOfFiles.listDirectory(getCurrentDir()); } else { Log_OC.e(TAG, "Still have a chance to lose the initializacion of list fragment >("); } OCFile file = getFile(); Fragment secondFragment = chooseInitialSecondFragment(file); if (secondFragment != null) { setSecondFragment(secondFragment); updateFragmentsVisibility(true); updateActionBarTitleAndHomeButton(file); } else { cleanSecondFragment(); if (file.isDown() && PreviewTextFragment.canBePreviewed(file)) startTextPreview(file); } } else { Log_OC.wtf(TAG, "initFragments() called with invalid NULLs!"); if (getAccount() == null) { Log_OC.wtf(TAG, "\t account is NULL"); } if (getFile() == null) { Log_OC.wtf(TAG, "\t file is NULL"); } } }
Source:
<code>public TextEdit formatModuleInfoFile(int kind, String source, int offset, int length, int indentationLevel, String lineSeparator) { boolean tmp = this.isInModuleInfo; this.isInModuleInfo = true; TextEdit edit = format(kind, source, new IRegion[] { new Region(offset, length) }, indentationLevel, lineSeparator); <START> this.isInModuleInfo = tmp; <END> return edit; }</code><technical_language>I suggest putting this a finally block</technical_language>

Target:
public TextEdit formatModuleInfoFile(int kind, String source, int offset, int length, int indentationLevel, String lineSeparator) { boolean tmp = this.isInModuleInfo; try { this.isInModuleInfo = true; return format(kind, source, new IRegion[] { new Region(offset, length) }, indentationLevel, lineSeparator); } finally { this.isInModuleInfo = tmp; } }
Source:
<code>public boolean getRequiredParamBoolean(final String key) throws ActionParamsException { <START> final String errMsg = "Required parameter '" + key + "' missing!"; <END> final String val = getRequiredParam(key, errMsg); try { return Boolean.parseBoolean(val); } catch (Exception e) { throw new ActionParamsException(errMsg); } }</code><technical_language>need give this string (even other similar do) default message for getRequiredParam(key)</technical_language>

Target:
public boolean getRequiredParamBoolean(final String key) throws ActionParamsException { final String val = getRequiredParam(key); try { return Boolean.parseBoolean(val); } catch (Exception e) { throw new ActionParamsException(e.getMessage()); } }
Source:
<code>protected void executeCommand() { List<VDS> hosts = vdsDao.getAllForCluster(getParameters().getClusterId()); List<ActionParametersBase> params = new LinkedList<>(); int i = 0; for (VDS host: hosts) { params.add(i++, new VdsActionParameters(host.getId())); } <START> runInternalMultipleActions(ActionType.SyncAllHostNetworks, params, getExecutionContext()); <END> setSucceeded(true); }</code><technical_language>do need pass executionContext? runInternalMultipleActions(ActionType.SyncAllHostNetworks, params) enough for case</technical_language>

Target:
protected void executeCommand() { List<ActionParametersBase> params = hosts.stream() .map(host -> new VdsActionParameters(host.getId())) .collect(Collectors.toList()); runInternalMultipleActions(ActionType.SyncAllHostNetworks, params); setSucceeded(true); }
Source:
<code>public void close() { read = null; hasChanges = HasChanges.MAYBE; addedNodes = emptySet(); reset(); if ( labelCursor != null ) { labelCursor.close(); labelCursor = null; } if ( pageCursor != null ) { pageCursor.close(); pageCursor = null; <START> if ( pool != null ) <END> { pool.accept( this ); } } }</code><technical_language>this null check? expecting this pool null in some real scenarios? If this check is allow tests pass in null I pass in a no-op consumer instead get rid of this condition. (many similar places too)</technical_language>

Target:
public void close() { read = null; hasChanges = HasChanges.MAYBE; addedNodes = emptySet(); reset(); if ( labelCursor != null ) { labelCursor.close(); labelCursor = null; } if ( pageCursor != null ) { pageCursor.close(); pageCursor = null; pool.accept( this ); } }
Source:
<code>public void preparePaint(final Request request) { <START> doTransform = true; <END> if (doTransform && request instanceof ServletRequest) { HttpServletRequest httpServletRequest = ((ServletRequest) request).getBackingRequest(); String userAgentString = httpServletRequest.getHeader("User-Agent"); if (userAgentString != null && userAgentString.contains(NO_XSLT_FLAG)) { doTransform = false; } } super.preparePaint(request); }</code><technical_language>change doTransform default "true" remove "setting true" "if test". set "false" no_xslt_flag is in header</technical_language>

Target:
public void preparePaint(final Request request) { if (doTransform && request instanceof ServletRequest) { HttpServletRequest httpServletRequest = ((ServletRequest) request).getBackingRequest(); String userAgentString = httpServletRequest.getHeader("User-Agent"); if (userAgentString != null && userAgentString.contains(NO_XSLT_FLAG)) { doTransform = false; } } super.preparePaint(request); }
Source:
<code>private boolean isAcceptedConfigurationAdminEntry(ImportMigrationConfigurationAdminEntry entry) { if (ACCEPTED_ENTRY_PIDS.contains(entry.getPid())) { return true; } for (String entryFactoryPid : ACCEPTED_ENTRY_FACTORY_PIDS) { <START> if (entryFactoryPid.equals(entry.getFactoryPid())) { <END> return true; } } return false; }</code><technical_language>do a contains do ACCEPTED_ENTRY_PIDS</technical_language>

Target:
private boolean isAcceptedConfigurationAdminEntry(ImportMigrationConfigurationAdminEntry entry) { if (ACCEPTED_ENTRY_PIDS.contains(entry.getPid())) { return true; } if (ACCEPTED_ENTRY_FACTORY_PIDS.contains(entry.getFactoryPid())) { return true; } return false; }
Source:
<code>public synchronized TopLevelItem createProject( TopLevelItemDescriptor type, String name, boolean notify ) throws IOException { acl.checkPermission(Item.CREATE); <START> acl.getACL().checkCreatePermission(parent, type); <END> Jenkins.getInstance().getProjectNamingStrategy().checkName(name); if(parent.getItem(name)!=null) throw new IllegalArgumentException("Project of the name "+name+" already exists"); TopLevelItem item = type.newInstance(parent, name); try { callOnCreatedFromScratch(item); } catch (AbstractMethodError e) { } item.save(); add(item); Jenkins.getInstance().rebuildDependencyGraphAsync(); if (notify) ItemListener.fireOnCreated(item); return item; }</code><technical_language>isApplicableIn checked here? (Ditto for copies.)</technical_language>

Target:
public synchronized TopLevelItem createProject( TopLevelItemDescriptor type, String name, boolean notify ) throws IOException { acl.checkPermission(Item.CREATE); type.checkApplicableIn(parent); acl.getACL().checkCreatePermission(parent, type); Jenkins.getInstance().getProjectNamingStrategy().checkName(name); if(parent.getItem(name)!=null) throw new IllegalArgumentException("Project of the name "+name+" already exists"); TopLevelItem item = type.newInstance(parent, name); try { callOnCreatedFromScratch(item); } catch (AbstractMethodError e) { } item.save(); add(item); Jenkins.getInstance().rebuildDependencyGraphAsync(); if (notify) ItemListener.fireOnCreated(item); return item; }
Source:
<code>for (PropertyAccessorFactory factory : ServiceLoader.load(PropertyAccessorFactory.class)) { boolean nonCached = factory instanceof SimpleFeaturePropertyAccessorFactory || factory instanceof DirectPropertyAccessorFactory || factory instanceof NullPropertyAccessorFactory; if (!nonCached) <START> cache.add(factory); <END> }</code><technical_language>Thanks is a clear describe cache condition. tend braces for single line if statements</technical_language>

Target:
for (PropertyAccessorFactory factory : ServiceLoader.load(PropertyAccessorFactory.class)) { boolean nonCached = factory instanceof SimpleFeaturePropertyAccessorFactory || factory instanceof DirectPropertyAccessorFactory || factory instanceof NullPropertyAccessorFactory; if (!nonCached) { cache.add(factory); } }
Source:
<code>public static <TSource, TInner, TKey> Enumerable<TSource> semiJoin( final Enumerable<TSource> outer, final Enumerable<TInner> inner, final Function1<TSource, TKey> outerKeySelector, final Function1<TInner, TKey> innerKeySelector, final EqualityComparer<TKey> comparer) { return new AbstractEnumerable<TSource>() { private Enumerable<TKey> innerLookup = null; <START> private Enumerable<TKey> getInnerLookup() { <END> if (innerLookup == null) { innerLookup = comparer == null ? inner.select(innerKeySelector).distinct() : inner.select(innerKeySelector).distinct(comparer); } return innerLookup; } public Enumerator<TSource> enumerator() { return EnumerableDefaults.where(outer.enumerator(), v0 -> { final TKey key = outerKeySelector.apply(v0); return getInnerLookup().contains(key); }); } }; }</code><technical_language>I if more sense create a generic LazyEnumerable. code : java return Linq4j.lazy(() -> inner.select(innerKeySelector).distinct()); This is similar idea Guava [Supplier.memoize](<LINK_1> [Observable.defer()](<LINK_0></technical_language>

Target:
public static <TSource, TInner, TKey> Enumerable<TSource> semiJoin( final Enumerable<TSource> outer, final Enumerable<TInner> inner, final Function1<TSource, TKey> outerKeySelector, final Function1<TInner, TKey> innerKeySelector, final EqualityComparer<TKey> comparer) { return new AbstractEnumerable<TSource>() { public Enumerator<TSource> enumerator() { final Supplier<Enumerable<TKey>> innerLookup = Suppliers.memoize(() -> comparer == null ? inner.select(innerKeySelector).distinct() : inner.select(innerKeySelector).distinct(comparer)); return EnumerableDefaults.where(outer.enumerator(), v0 -> { final TKey key = outerKeySelector.apply(v0); return innerLookup.get().contains(key); }); } }; }
Source:
<code>private void serveAssetFile(HttpServletRequest requestFromClient, HttpServletResponse responseToClient, String assetId) throws IOException { try (CloseableHttpResponse responseFromService = soaService.requestAsset(assetId, HttpMessageUtil.getRequestHeaders(requestFromClient, ASSET_REQUEST_HEADER_WHITELIST))) { if (responseFromService.getStatusLine().getStatusCode() == HttpStatus.SC_NOT_MODIFIED) { responseToClient.setStatus(HttpStatus.SC_NOT_MODIFIED); } else { HttpMessageUtil.copyResponseWithHeaders(responseFromService, responseToClient, ASSET_RESPONSE_HEADER_FILTER); <START> } <END> } catch (EntityNotFoundException e) { throw new NotFoundException(e); } }</code><technical_language>lambda solution awesome. totally do it</technical_language>

Target:
private void serveAssetFile(HttpServletRequest requestFromClient, HttpServletResponse responseToClient, String assetId) throws IOException { try (CloseableHttpResponse responseFromService = soaService.requestAsset(assetId, HttpMessageUtil.getRequestHeaders(requestFromClient, ASSET_REQUEST_HEADER_WHITELIST))) { forwardAssetResponse(responseFromService, responseToClient); } catch (EntityNotFoundException e) { throw new NotFoundException(e); } }
Source:
<code>private void removeTagsFromChildrenCacheEntries(TagCacheEntry entry, CVSTag[] tags) { for (int i = 0; i < tags.length; i++) { removeTagFromChildrenCacheEntries(entry, tags[i]); } entry.getTags().removeAll(Arrays.asList(tags)); <START> if (entry.getTags().size() == 0 && entry.children.size() == 0) { <END> removeTagCacheEntry(entry); } }</code><technical_language>#isEmpty</technical_language>

Target:
private void removeTagsFromChildrenCacheEntries(TagCacheEntry entry, CVSTag[] tags) { for (int i = 0; i < tags.length; i++) { removeTagFromChildrenCacheEntries(entry, tags[i]); } entry.getTags().removeAll(Arrays.asList(tags)); if (entry.isEmpty()) { removeTagCacheEntry(entry); } }
Source:
<code>private SortedMap getLabelsColumns(ChangeInfo[] loadedReviews) { LinkedHashMap<String, String> mapAcronym = new LinkedHashMap<String, String>(); if (loadedReviews != null && loadedReviews.length > 0) { for (ChangeInfo changeinfo : loadedReviews) { Iterator<Entry<String, LabelInfo>> iterLabels = changeinfo.getLabels().iterator(); while (iterLabels.hasNext()) { Entry<String, LabelInfo> entry = iterLabels.next(); String acr = getAcronymLabel(entry.getKey()); mapAcronym.put(entry.getKey(), acr); LabelInfo labelInfo = entry.getValue(); Iterator<Entry<String, String>> iterValues = labelInfo.getValues().iterator(); <START> while (iterValues.hasNext()) { <END> Entry<String, String> entryVal = iterValues.next(); } } } } SortedMap mapAcronymSorted = new TreeMap<String, String>(); mapAcronymSorted.putAll(mapAcronym); Iterator iterator = mapAcronymSorted.entrySet().iterator(); while (iterator.hasNext()) { Entry<String, String> map = (Entry<String, String>) iterator.next(); } return mapAcronymSorted; }</code><technical_language>while loop do useful</technical_language>

Target:
private SortedMap<String, String> getLabelsColumns(ChangeInfo[] loadedReviews) { if (loadedReviews == null || loadedReviews.length == 0) { return new TreeMap<>(); } SortedMap<String, String> mapAcronym = new TreeMap<String, String>(); for (ChangeInfo changeinfo : loadedReviews) { Collection<String> iterLabels = changeinfo.getLabels().keySet(); for (String label : iterLabels) { mapAcronym.put(label, getAcronymLabel(label)); } } return mapAcronym; }
Source:
<code>protected boolean canDoAction() { <START> if (getParameters().getVdsId() == null) { <END> return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_UPDATE_MOM_POLICY_UPDATE_NULL_HOST); } vds = getVdsDao().get(getParameters().getVdsId()); if (vds == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_UPDATE_MOM_POLICY_UPDATE_NULL_HOST); } if (vds.getStatus() != VDSStatus.Up) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_UPDATE_MOM_POLICY_UPDATE_HOST_DOWN); } return true; }</code><technical_language>This a javax.validations field in parameters, checked explicitly in command</technical_language>

Target:
protected boolean canDoAction() { VdsValidator vdsValidator = new VdsValidator(getVds()); ValidationResult exists = vdsValidator.exists(); if (!exists.isValid()) { return failCanDoAction(exists.getMessage()); } ValidationResult up = vdsValidator.validateStatus(VDSStatus.Up); if (!up.isValid()) { return failCanDoAction(up.getMessage()); } return true; }
Source:
<code>public boolean hasFiveHeroUnits() { <START> return heroMosaic.findElements(By.cssSelector(".clickable-unit")).size() == 5; <END> }</code><technical_language>try: @FindAll({@FindBy(css = "section.hero-block .hero")}) private List<WebElements> heroUnits; I fine this way. I change is selecting .hero, clickable-unit is for tracking necessarily define element itself. CSS class change move another element hero unit</technical_language>

Target:
public boolean hasFiveHeroUnits() { return heroMosaic.findElements(By.cssSelector(".hero")).size() == 5; }
Source:
<code>public void removeRMEventListener() throws RMException { UniqueID id = PAActiveObject.getContext().getCurrentRequest().getSourceBodyID(); String shortId = id.shortString(); if (removeRMEventListener(id)) { logger.debug("Removing the RM listner for " + shortId); } else { <START> throw new RMException("Unknow listener found: " + shortId); <END> } }</code><technical_language>Unknown</technical_language>

Target:
public void removeRMEventListener() throws RMException { UniqueID id = PAActiveObject.getContext().getCurrentRequest().getSourceBodyID(); String shortId = id.shortString(); if (removeRMEventListener(id)) { logger.debug("Removing the RM listener for " + shortId); } else { throw new RMException("Unknown listener found: " + shortId); } }
Source:
<code>protected void executeQueryCommand() { Provider<?> provider = getProvider(); ProviderProxy proxy = ProviderProxyFactory.getInstance().create(provider); List<? extends Certificate> chain = proxy.getCertificateChain(); if (!chain.isEmpty()) { try { <START> getQueryReturnValue().setReturnValue(Arrays.<CertificateInfo> asList(createCertificateInfo(chain.get(chain.size() - 1)))); <END> } catch (CertificateEncodingException e) { getQueryReturnValue().setSucceeded(false); log.error("Error in encoding certificate. Error is " + e.getMessage()); if (log.isDebugEnabled()) { log.debug("", e); } } getQueryReturnValue().setSucceeded(true); } else { getQueryReturnValue().setSucceeded(false); } }</code><technical_language>this query called return entire chain. selection of 1st certificate is caller</technical_language>

Target:
protected void executeQueryCommand() { Provider<?> provider = getProvider(); ProviderProxy proxy = ProviderProxyFactory.getInstance().create(provider); List<? extends Certificate> chain = proxy.getCertificateChain(); getQueryReturnValue().setSucceeded(false); try { if (!chain.isEmpty()) { List<CertificateInfo> results = new ArrayList<CertificateInfo>(); for (Certificate cert : chain) { results.add(createCertificateInfo(cert)); } getQueryReturnValue().setReturnValue(results); getQueryReturnValue().setSucceeded(true); } else { getQueryReturnValue().setSucceeded(false); } } catch (CertificateEncodingException e) { getQueryReturnValue().setSucceeded(false); log.error("Error in encoding certificate. Error is " + e.getMessage()); if (log.isDebugEnabled()) { log.debug("", e); } } }
Source:
<code>public static synchronized @NonNull Map<String, File> listFiles() { IPath pathToFiles = XmlUtils.getXmlFilesPath(); File folder = pathToFiles.toFile(); Map<String, File> fileMap = new HashMap<>(); if ((folder.isDirectory() && folder.exists())) { File[] listOfFiles = getXmlFilesPath().toFile().listFiles(); <START> for (File file : checkNotNull(listOfFiles)) { <END> IPath path = new Path(file.getName()); if (path.getFileExtension().equals(XML_EXTENSION)) { fileMap.put(file.getName(), file); } } } return Collections.unmodifiableMap(fileMap); }</code><technical_language>This get rid of NPE. method checkNotNull throw NPE. fix NPE need do if statement for that</technical_language>

Target:
public static synchronized @NonNull Map<String, File> listFiles() { IPath pathToFiles = XmlUtils.getXmlFilesPath(); File folder = pathToFiles.toFile(); Map<String, File> fileMap = new HashMap<>(); if ((folder.isDirectory() && folder.exists())) { File[] listOfFiles = folder.listFiles(); if (listOfFiles != null) { for (File file : listOfFiles) { IPath path = new Path(file.getName()); if (path.getFileExtension().equals(XML_EXTENSION)) { fileMap.put(file.getName(), file); } } } else { Activator.logError("I/O error occured while accessing files in folder " + folder.getPath()); } } return Collections.unmodifiableMap(fileMap); }
Source:
<code>public <X> X unwrap(Long value, Class<X> type, WrapperOptions options) { <START> log.debug( " unwrap !" ); <END> byte[] bytes = ByteBuffer.allocate( Long.SIZE ).putLong( value ).array(); return (X) new BsonBinary( bytes ); }</code><technical_language>This debug message is useful</technical_language>

Target:
public <X> X unwrap(Long value, Class<X> type, WrapperOptions options) { byte[] bytes = ByteBuffer.allocate( Long.SIZE ).putLong( value ).array(); return (X) new BsonBinary( bytes ); }
Source:
<code>private String getAuthorizationCode() { try { AuthenticationRequestBuilder builder = OAuthClientRequest.authorizationLocation(authorizationLocation.toString()) .setClientId(clientID).setRedirectURI(callbackURL.toString()); if (responseType != null) { builder.setResponseType(responseType); } OAuthClientRequest request = builder.buildQueryMessage(); <START> System.out.println("Paste this URL into a web browser to authorize access:"); <END> System.out.println(request.getLocationUri()); SimpleTalendHttpServer service = new SimpleTalendHttpServer(callbackURL.getHost(), callbackURL.getPort(), 10 * 60 * 1000); service.run(); String code = service.getAuthorizationCode(); service.stop(); return code; } catch (Exception e) { throw new RuntimeException(e); } }</code><technical_language>Slf4J instead of System.out</technical_language>

Target:
private String getAuthorizationCode() { try { AuthenticationRequestBuilder builder = OAuthClientRequest.authorizationLocation(authorizationLocation.toString()) .setClientId(clientID).setRedirectURI(callbackURL.toString()); if (responseType != null) { builder.setResponseType(responseType); } OAuthClientRequest request = builder.buildQueryMessage(); logger.info("Paste this URL into a web browser to authorize access:"); logger.info(request.getLocationUri()); OAuth2ImplicitGrantServer service = new OAuth2ImplicitGrantServer(callbackURL.getHost(), callbackURL.getPort(), 10 * 60 * 1000); service.run(); String code = service.getAuthorizationCode(); service.stop(); return code; } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>public VeluxProductReference(VeluxProductName name, int type) { this.name = name; this.typeId = VeluxProductType.get(type); if (this.typeId == null) { logger.warn( <START> "Please report this to maintainer of the bindung: VeluxProductReference({}) has found an unregistered ProductTypeId.", <END> VeluxBindingConstants.BINDING_ID, type); } }</code><technical_language>"binding"</technical_language>

Target:
public VeluxProductReference(VeluxProductName name, int type) { this.name = name; this.typeId = VeluxProductType.get(type); if (this.typeId == null) { logger.warn( "Please report this to maintainer of the binding: VeluxProductReference({}) has found an unregistered ProductTypeId.", VeluxBindingConstants.BINDING_ID, type); } }
Source:
<code>private ImmutableArray<Entity> registerFamily(Family family) { ImmutableArray<Entity> immutableEntities = immutableFamilies.get(family); if (immutableEntities == null) { <START> Array<Entity> entities = new Array<Entity>(false, 16, Entity.class); <END> immutableEntities = new ImmutableArray<Entity>(entities); families.put(family, entities); immutableFamilies.put(family, immutableEntities); for(Entity e : this.entities){ if(family.matches(e)) { entities.add(e); e.getFamilyBits().set(family.getIndex()); } } } return immutableEntities; }</code><technical_language>is this necessary for PR</technical_language>

Target:
private ImmutableArray<Entity> registerFamily(Family family) { ImmutableArray<Entity> immutableEntities = immutableFamilies.get(family); if (immutableEntities == null) { Array<Entity> entities = new Array<Entity>(false, 16); immutableEntities = new ImmutableArray<Entity>(entities); families.put(family, entities); immutableFamilies.put(family, immutableEntities); for(Entity e : this.entities){ if(family.matches(e)) { entities.add(e); e.getFamilyBits().set(family.getIndex()); } } } return immutableEntities; }
Source:
<code>public Object getAnyAttribute(final String key) { if (key.equals(VCFConstants.GENOTYPE_KEY)) { return getAlleles(); } else if (key.equals(VCFConstants.GENOTYPE_QUALITY_KEY)) { return getGQ(); } else if (key.equals(VCFConstants.GENOTYPE_ALLELE_DEPTHS)) { <START> List<Integer> intList = new ArrayList<Integer>(); <END> for(int i : getAD()) intList.add(i); return intList; } else if (key.equals(VCFConstants.GENOTYPE_PL_KEY)) { List<Integer> intList = new ArrayList<Integer>(); for(int i : getPL()) intList.add(i); return intList; } else if (key.equals(VCFConstants.DEPTH_KEY)) { return getDP(); } else { return getExtendedAttribute(key); } }</code><technical_language>Initialize list size of array</technical_language>

Target:
public Object getAnyAttribute(final String key) { if (key.equals(VCFConstants.GENOTYPE_KEY)) { return getAlleles(); } else if (key.equals(VCFConstants.GENOTYPE_QUALITY_KEY)) { return getGQ(); } else if (key.equals(VCFConstants.GENOTYPE_ALLELE_DEPTHS)) { if(hasAD()) { List<Integer> intList = new ArrayList<Integer>(getAD().length); for(int i : getAD()) intList.add(i); return intList; } return Collections.EMPTY_LIST; } else if (key.equals(VCFConstants.GENOTYPE_PL_KEY)) { if(hasPL()) { List<Integer> intList = new ArrayList<Integer>(getPL().length); for(int i : getPL()) intList.add(i); return intList; } return Collections.EMPTY_LIST; } else if (key.equals(VCFConstants.DEPTH_KEY)) { return getDP(); } else { return getExtendedAttribute(key); } }
Source:
<code>public boolean discoverPatient(final PatientSearchBean patientQuerySearch) { final gov.hhs.fha.nhinc.patientdiscovery.model.Patient patientBean = new gov.hhs.fha.nhinc.patientdiscovery.model.Patient(); patientBean.setOrganization(patientQuerySearch.getOrganization()); final DateFormat df = new SimpleDateFormat(UTCDateUtil.DATE_ONLY_FORMAT); patientBean.setBirthDate(df.format(patientQuerySearch.getDateOfBirth())); patientBean.setFirstName(patientQuerySearch.getFirstName()); patientBean.setLastName(patientQuerySearch.getLastName()); patientBean.setGender(patientQuerySearch.getGender()); try { final PatientSearchResults patientDiscoveryResults = patientService.queryPatient(patientBean); <START> LOG.debug("Patient Discovery call successful. Total number of patients found:" <END> + patientDiscoveryResults.getPatientList().size()); if (patientDiscoveryResults.getPatientList().isEmpty()) { return false; } populatePatientBean(patientDiscoveryResults, patientQuerySearch); return true; } catch (final Exception ex) { LOG.error("Failed to Retrieve Patient Data: {}", ex.getLocalizedMessage(), ex); return false; } }</code><technical_language>Please parametered log u for performance</technical_language>

Target:
public boolean discoverPatient(final PatientSearchBean patientQuerySearch) { final gov.hhs.fha.nhinc.patientdiscovery.model.Patient patientBean = new gov.hhs.fha.nhinc.patientdiscovery.model.Patient(); patientBean.setOrganization(patientQuerySearch.getOrganization()); final DateFormat df = new SimpleDateFormat(UTCDateUtil.DATE_ONLY_FORMAT); patientBean.setBirthDate(df.format(patientQuerySearch.getDateOfBirth())); patientBean.setFirstName(patientQuerySearch.getFirstName()); patientBean.setLastName(patientQuerySearch.getLastName()); patientBean.setGender(patientQuerySearch.getGender()); try { final PatientSearchResults patientDiscoveryResults = patientService.queryPatient(patientBean); LOG.debug("Patient Discovery call successful. Total number of patients found: {}", patientDiscoveryResults.getPatientList().size()); if (patientDiscoveryResults.getPatientList().isEmpty()) { return false; } populatePatientBean(patientDiscoveryResults, patientQuerySearch); return true; } catch (final Exception ex) { LOG.error("Failed to Retrieve Patient Data: {}", ex.getLocalizedMessage(), ex); return false; } }
Source:
<code>private void validate() { <START> if(strategy != null && !StringUtils.isEmpty(strategy) && !VALID_STRATEGIES.contains(strategy)) { <END> logger.warn("Not valid strategy (valid values are \"ledger-only\", \"future-behaviour\" or empty); using the default strategy"); strategy = null; } }</code><technical_language>!StringUtils.isBlank(strategy) instead of checking for null empty string. Also, isEmpty returns false if is whitespace in string</technical_language>

Target:
private void validate() { if(!StringUtils.isBlank(strategy) && !VALID_STRATEGIES.contains(strategy)) { logger.warn("Not valid strategy (valid values are \"ledger-only\", \"future-behaviour\" or empty); using the default strategy"); strategy = null; } }
Source:
<code>private Position decodeLbsWifi(Channel channel, SocketAddress remoteAddress, String sentence) { Parser parser = new Parser(PATTERN_LBSWIFI, sentence); if (!parser.matches()) { return null; } DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next()); if (deviceSession == null) { return null; } Position position = new Position(); position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); decodeType(position, parser.next(), "0"); getLastLocation(position, null); getLastBatteryPower(position); Network network = new Network(); network.addCellTower(CellTower.from( parser.nextInt(), parser.nextInt(), parser.nextInt(), parser.nextInt())); int wifiCount = parser.nextInt(); if (parser.hasNext()) { String[] wifimacs = parser.next().split(","); if (wifimacs.length == wifiCount) { for (int i = 0; i < wifiCount; i++) { String[] wifiinfo = wifimacs[i].split("\\*"); network.addWifiAccessPoint(WifiAccessPoint.from( wifiinfo[0], Integer.parseInt(wifiinfo[1]), Integer.parseInt(wifiinfo[2]))); } } } if (network.getCellTowers() != null || network.getWifiAccessPoints() != null) { position.setNetwork(network); } <START> DateBuilder dateBuilder = new DateBuilder() <END> .setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt()) .setTime(parser.nextInt(), parser.nextInt(), parser.nextInt()); position.setTime(dateBuilder.getDate()); return position; }</code><technical_language>parser.nextDateTime</technical_language>

Target:
private Position decodeLbsWifi(Channel channel, SocketAddress remoteAddress, String sentence) { Parser parser = new Parser(PATTERN_LBSWIFI, sentence); if (!parser.matches()) { return null; } DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next()); if (deviceSession == null) { return null; } Position position = new Position(); position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); decodeType(position, parser.next(), "0"); getLastLocation(position, null); Network network = new Network(); network.addCellTower(CellTower.from( parser.nextInt(), parser.nextInt(), parser.nextInt(), parser.nextInt())); int wifiCount = parser.nextInt(); if (parser.hasNext()) { String[] wifimacs = parser.next().split(","); if (wifimacs.length == wifiCount) { for (int i = 0; i < wifiCount; i++) { String[] wifiinfo = wifimacs[i].split("\\*"); network.addWifiAccessPoint(WifiAccessPoint.from( wifiinfo[0], Integer.parseInt(wifiinfo[1]), Integer.parseInt(wifiinfo[2]))); } } } if (network.getCellTowers() != null || network.getWifiAccessPoints() != null) { position.setNetwork(network); } position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS)); return position; }
Source:
<code>public void registerDataSetContent(DataSetContent content) { try { DataSetContentType contentType = content.getContentType(); switch (contentType) { case CSV: storage.storeCSV(content.getId(), content.getContent()); break; case DEFINITION: registerDataSetDefinition(content); break; default: <START> logger.error("Unknow DataSet Content Type: {}", contentType.name(), null); <END> break; } } catch (Exception e) { logger.error("Error registering dataset", e); } }</code><technical_language>suggestion logger.error("Unknown DataSet Content Type: {}", contentType.name(), null);</technical_language>

Target:
public void registerDataSetContent(DataSetContent content) { try { DataSetContentType contentType = content.getContentType(); switch (contentType) { case CSV: storage.storeCSV(content.getId(), content.getContent()); break; case DEFINITION: registerDataSetDefinition(content); break; default: logger.error("Unknown DataSet Content Type: {}", contentType.name(), null); break; } } catch (Exception e) { logger.error("Error registering dataset", e); } }
Source:
<code>public static List<FileStatus> filterInvalid(FileStatus[] files) { ArrayList<FileStatus> fileList = new ArrayList<>(files.length); for (FileStatus fileStatus : files) { String fname = fileStatus.getPath().getName(); if (fileStatus.isDirectory()) { log.debug("{} is a directory, ignoring.", fileStatus.getPath()); continue; } <START> if (fname.equals("_SUCCESS") || fname.equals("_logs")) { <END> log.debug("Ignoring file likely created by map reduce : {}", fileStatus.getPath()); continue; } if (FileOperations.getWorkingFiles().contains(fname)) { log.debug("{} is an internal working file, ignoring.", fileStatus.getPath()); continue; } if (!FileOperations.getValidExtensions().contains(FilenameUtils.getExtension(fname))) { log.warn("{} does not have a valid extension, ignoring", fileStatus.getPath()); continue; } fileList.add(fileStatus); } return fileList; }</code><technical_language>good add files list of working files</technical_language>

Target:
public static List<FileStatus> filterInvalid(FileStatus[] files) { ArrayList<FileStatus> fileList = new ArrayList<>(files.length); for (FileStatus fileStatus : files) { String fname = fileStatus.getPath().getName(); if (fileStatus.isDirectory()) { log.debug("{} is a directory, ignoring.", fileStatus.getPath()); continue; } if (FileOperations.getBulkWorkingFiles().contains(fname)) { log.debug("{} is an internal working file, ignoring.", fileStatus.getPath()); continue; } if (!FileOperations.getValidExtensions().contains(FilenameUtils.getExtension(fname))) { log.warn("{} does not have a valid extension, ignoring", fileStatus.getPath()); continue; } fileList.add(fileStatus); } return fileList; }
Source:
<code>public void onServingModeChanged(final boolean enabled, Location currentLocation) { serviceHelper.changeServingState(this, selectedTruck.id, enabled, currentLocation); final VendorMapFragment fragment = (VendorMapFragment) getSupportFragmentManager().findFragmentById(R.id.vendor_map_fragment); runOnUiThread(new Runnable() { @Override public void run() { fragment.setMapControlsEnabled(!enabled); } }); if (enabled && sharedPreferences.getBoolean(getString(R.string.setting_item_unavailable_warning), true)) { WhereClause whereClause = new WhereClause.Builder() .where(PublicContract.Menu.TRUCK_ID, EQUALS, selectedTruck.id) .and() <START> .where(PublicContract.Menu.IS_AVAILABLE, EQUALS, 0) <END> .build(); String[] projection = ItemsOutOfStockQuery.PROJECTION; Uri uri = PublicContract.MENU_URI; Cursor cursor = getContentResolver().query(uri, projection, whereClause.selection, whereClause.selectionArgs, null); if (cursor.getCount() > 0 ) { showWarning(cursor.getCount()); } } }</code><technical_language>aside, pass a boolean here. in content values. get converted correctly. need change</technical_language>

Target:
public void onServingModeChanged(final boolean enabled, Location currentLocation) { serviceHelper.changeServingState(this, selectedTruck.id, enabled, currentLocation); final VendorMapFragment fragment = (VendorMapFragment) getSupportFragmentManager().findFragmentById(R.id.vendor_map_fragment); runOnUiThread(new Runnable() { @Override public void run() { fragment.setMapControlsEnabled(!enabled); } }); if (enabled && sharedPreferences.getBoolean(getString(R.string.setting_item_unavailable_warning), true)) { WhereClause whereClause = new WhereClause.Builder() .where(PublicContract.Menu.TRUCK_ID, EQUALS, selectedTruck.id) .and() .where(PublicContract.Menu.IS_AVAILABLE, EQUALS, 0) .build(); String[] projection = ItemsOutOfStockQuery.PROJECTION; Uri uri = PublicContract.MENU_URI; Cursor cursor = getContentResolver().query(uri, projection, whereClause.selection, whereClause.selectionArgs, null); if (cursor.getCount() > 0 ) { showWarning(cursor.getCount()); } cursor.close(); } }
Source:
<code>public SubscriptionInfo createSubscription(SubscriptionInfo sinfo) { if (sinfo == null) { throw new IllegalArgumentException("sinfo is null"); } if (StringUtils.isBlank(sinfo.getId())) { throw new IllegalArgumentException("subscription is lacking an identifier: " + sinfo); } if (this.subscriptionMap.containsKey(sinfo.getId())) { throw new IllegalStateException("subscription already exists: " + sinfo.getId()); } Subscription sdata = new Subscription(); sdata.setId(sinfo.getId()); sdata.setOwner(this.resolveOwner(sinfo.getOwner())); sdata.setProduct(this.resolveProduct(sinfo.getProduct())); if (sdata.getProduct() != null) { sdata.setProvidedProducts(sdata.getProduct().getProvidedProducts()); } sdata.setDerivedProduct(this.resolveProduct(sinfo.getDerivedProduct())); if (sdata.getDerivedProduct() != null) { sdata.setDerivedProvidedProducts( sdata.getDerivedProduct().getProvidedProducts()); <START> } <END> sdata.setQuantity(sinfo.getQuantity()); sdata.setStartDate(sinfo.getStartDate()); sdata.setEndDate(sinfo.getEndDate()); sdata.setModified(sinfo.getLastModified()); sdata.setContractNumber(sinfo.getContractNumber()); sdata.setAccountNumber(sinfo.getAccountNumber()); sdata.setOrderNumber(sinfo.getOrderNumber()); sdata.setUpstreamPoolId(sinfo.getUpstreamPoolId()); sdata.setUpstreamEntitlementId(sinfo.getUpstreamEntitlementId()); sdata.setUpstreamConsumerId(sinfo.getUpstreamConsumerId()); sdata.setCertificate(this.convertSubscriptionCertificate(sinfo.getCertificate())); sdata.setCdn(this.convertCdn(sinfo.getCdn())); this.subscriptionMap.put(sdata.getId(), sdata); this.updateSubscriptionProductMappings(sdata); return sdata; }</code><technical_language>here; subscription updated do redirection forcing manage it</technical_language>

Target:
public SubscriptionInfo createSubscription(SubscriptionInfo sinfo) { if (sinfo == null) { throw new IllegalArgumentException("sinfo is null"); } if (StringUtils.isBlank(sinfo.getId())) { throw new IllegalArgumentException("subscription is lacking an identifier: " + sinfo); } if (this.subscriptionMap.containsKey(sinfo.getId())) { throw new IllegalStateException("subscription already exists: " + sinfo.getId()); } Subscription sdata = new Subscription(); sdata.setId(sinfo.getId()); sdata.setOwner(this.resolveOwner(sinfo.getOwner())); sdata.setProduct(this.resolveProduct(sinfo.getProduct())); sdata.setDerivedProduct(this.resolveProduct(sinfo.getDerivedProduct())); sdata.setQuantity(sinfo.getQuantity()); sdata.setStartDate(sinfo.getStartDate()); sdata.setEndDate(sinfo.getEndDate()); sdata.setModified(sinfo.getLastModified()); sdata.setContractNumber(sinfo.getContractNumber()); sdata.setAccountNumber(sinfo.getAccountNumber()); sdata.setOrderNumber(sinfo.getOrderNumber()); sdata.setUpstreamPoolId(sinfo.getUpstreamPoolId()); sdata.setUpstreamEntitlementId(sinfo.getUpstreamEntitlementId()); sdata.setUpstreamConsumerId(sinfo.getUpstreamConsumerId()); sdata.setCertificate(this.convertSubscriptionCertificate(sinfo.getCertificate())); sdata.setCdn(this.convertCdn(sinfo.getCdn())); this.subscriptionMap.put(sdata.getId(), sdata); this.updateSubscriptionProductMappings(sdata); return sdata; }
Source:
<code>public ParametersDefinitionProperty(@Nonnull List<ParameterDefinition> parameterDefinitions) { <START> if (parameterDefinitions != null) { <END> this.parameterDefinitions = parameterDefinitions; } else { this.parameterDefinitions = Collections.emptyList(); } }</code><technical_language><code>@CheckForNull</code></technical_language>

Target:
public ParametersDefinitionProperty(@Nonnull List<ParameterDefinition> parameterDefinitions) { if (parameterDefinitions == null) { throw new NullPointerException("ParameterDefinitions is null when this is a not valid value"); } this.parameterDefinitions = parameterDefinitions; }
Source:
<code>public ImsSmsDispatcher(Phone phone, SmsDispatchersController smsDispatchersController) { super(phone, smsDispatchersController); mImsManagerConnector = new ImsManager.Connector(mContext, mPhone.getPhoneId(), new ImsManager.Connector.Listener() { @Override public void connectionReady(ImsManager manager) throws ImsException { <START> Rlog.d(TAG, "ImsManager: connection ready."); setListeners(); mIsImsServiceUp = true; <END> } @Override public void connectionUnavailable() { Rlog.d(TAG, "ImsManager: connection unavailable."); mIsImsServiceUp = false; } }); mImsManagerConnector.connect(); }</code><technical_language>version of this a lock it. necessary</technical_language>

Target:
public ImsSmsDispatcher(Phone phone, SmsDispatchersController smsDispatchersController) { super(phone, smsDispatchersController); mImsManagerConnector = new ImsManager.Connector(mContext, mPhone.getPhoneId(), new ImsManager.Connector.Listener() { @Override public void connectionReady(ImsManager manager) throws ImsException { Rlog.d(TAG, "ImsManager: connection ready."); synchronized (mLock) { setListeners(); mIsImsServiceUp = true; } } @Override public void connectionUnavailable() { Rlog.d(TAG, "ImsManager: connection unavailable."); synchronized (mLock) { mIsImsServiceUp = false; } } }); mImsManagerConnector.connect(); }
Source:
<code>public String getColumnText(@Nullable Object element, int columnIndex) { String value = ""; if (element instanceof HiddenTreeViewerEntry) { if (columnIndex == 0) { value = ((HiddenTreeViewerEntry) element).getName(); } } else { <START> SegmentStoreStatisticsEntry obj = (SegmentStoreStatisticsEntry) element; <END> if (obj != null) { if (columnIndex == 0) { return checkNotNull(String.valueOf(obj.getName())); } if (obj.getEntry().getNbSegments() > 0) { if (columnIndex == 1) { value = toFormattedString(obj.getEntry().getMin()); } else if (columnIndex == 2) { value = String.valueOf(toFormattedString(obj.getEntry().getMax())); } else if (columnIndex == 3) { value = String.valueOf(toFormattedString(obj.getEntry().getAverage())); } } } } return checkNotNull(value); }</code><technical_language>rename too</technical_language>

Target:
public String getColumnText(@Nullable Object element, int columnIndex) { String value = ""; if (element instanceof HiddenTreeViewerEntry) { if (columnIndex == 0) { value = ((HiddenTreeViewerEntry) element).getName(); } } else if (element instanceof SegmentStoreStatisticsEntry) { SegmentStoreStatisticsEntry entry = (SegmentStoreStatisticsEntry) element; if (columnIndex == 0) { return checkNotNull(String.valueOf(entry.getName())); } if (entry.getEntry().getNbSegments() > 0) { if (columnIndex == 1) { value = toFormattedString(entry.getEntry().getMin()); } else if (columnIndex == 2) { value = String.valueOf(toFormattedString(entry.getEntry().getMax())); } else if (columnIndex == 3) { value = String.valueOf(toFormattedString(entry.getEntry().getAverage())); } } } return checkNotNull(value); }
Source:
<code>public void test_SSLSocket_ClientGetsAlertDuringHandshake_HasGoodExceptionMessage() throws Exception { TestSSLContext context = TestSSLContext.create(); final ServerSocket listener = ServerSocketFactory.getDefault().createServerSocket(0); final SSLSocket client = (SSLSocket) context.clientContext.getSocketFactory().createSocket( context.host, listener.getLocalPort()); final Socket server = listener.accept(); ExecutorService executor = Executors.newFixedThreadPool(2); Future<Void> c = executor.submit(new Callable<Void>() { public Void call() throws Exception { try { client.startHandshake(); fail("Should receive handshake exception"); } catch (SSLHandshakeException expected) { assertFalse(expected.getMessage().contains("SSL_ERROR_ZERO_RETURN")); assertFalse(expected.getMessage().contains("You should never see this.")); } return null; } }); Future<Void> s = executor.submit(new Callable<Void>() { public Void call() throws Exception { byte[] scratch = new byte[8192]; server.getInputStream().read(scratch); server.getOutputStream().write(new byte[] { 0x15, 0x03, 0x03, 0x00, 0x02, 0x01, 0x46 }); server.getOutputStream().write(new byte[] { 0x15, 0x03, 0x03, 0x00, 0x02, 0x01, 0x00 }); return null; } }); executor.shutdown(); <START> c.get(5, TimeUnit.SECONDS); <END> s.get(5, TimeUnit.SECONDS); client.close(); server.close(); listener.close(); context.close(); }</code><technical_language>is sufficient ? need individual try { } finallies for of close calls (assuming throw IOExceptions)</technical_language>

Target:
public void test_SSLSocket_ClientGetsAlertDuringHandshake_HasGoodExceptionMessage() throws Exception { TestSSLContext context = TestSSLContext.create(); final ServerSocket listener = ServerSocketFactory.getDefault().createServerSocket(0); final SSLSocket client = (SSLSocket) context.clientContext.getSocketFactory().createSocket( context.host, listener.getLocalPort()); final Socket server = listener.accept(); ExecutorService executor = Executors.newFixedThreadPool(2); Future<Void> c = executor.submit(new Callable<Void>() { public Void call() throws Exception { try { client.startHandshake(); fail("Should receive handshake exception"); } catch (SSLHandshakeException expected) { assertFalse(expected.getMessage().contains("SSL_ERROR_ZERO_RETURN")); assertFalse(expected.getMessage().contains("You should never see this.")); } return null; } }); Future<Void> s = executor.submit(new Callable<Void>() { public Void call() throws Exception { byte[] scratch = new byte[8192]; server.getInputStream().read(scratch); server.getOutputStream().write(new byte[] { 0x15, 0x03, 0x03, 0x00, 0x02, 0x01, 0x46 }); server.getOutputStream().write(new byte[] { 0x15, 0x03, 0x03, 0x00, 0x02, 0x01, 0x00 }); return null; } }); executor.shutdown(); try { c.get(5, TimeUnit.SECONDS); s.get(5, TimeUnit.SECONDS); } finally { client.close(); server.close(); listener.close(); context.close(); } }
Source:
<code>static Long extractHighestModSeq(ImapResponse imapResponse) { for (Object token : imapResponse) { if (token instanceof ImapList) { ImapList list = (ImapList) token; if (list.size() < 2 || !(equalsIgnoreCase(list.get(0), Responses.HIGHESTMODSEQ) <START> || equalsIgnoreCase(list.get(1), Responses.NOMODSEQ)) || <END> !list.isString(1)) { continue; } if (equalsIgnoreCase(list.get(0), Responses.HIGHESTMODSEQ)) { return Long.parseLong(list.getString(1)); } } } return null; }</code><technical_language>I understand this. A reply "HIGHESTMODSEQ NOMODSEQ", it? this loop return null if a NOMODSEQ ImapList is though, in case CONDSTORE disabled for this folder's connection</technical_language>

Target:
static Long extractHighestModSeq(ImapResponse imapResponse) { for (Object token : imapResponse) { if (token instanceof ImapList) { ImapList list = (ImapList) token; if (list.size() < 2 || !(ImapResponseParser.equalsIgnoreCase(list.get(0), Responses.HIGHESTMODSEQ) || ImapResponseParser.equalsIgnoreCase(list.get(0), Responses.NOMODSEQ)) || !list.isString(1)) { continue; } if (ImapResponseParser.equalsIgnoreCase(list.get(0), Responses.HIGHESTMODSEQ)) { return Long.parseLong(list.getString(1)); } } } return null; }
Source:
<code>public MailMessage(MailMessage other) { Objects.requireNonNull(other); this.bounceAddress = other.bounceAddress; this.from = other.from; <START> this.to = other.to; <END> this.cc = other.cc; this.bcc = other.bcc; this.subject = other.subject; this.text = other.text; this.html = other.html; if (other.attachment != null) { List<MailAttachment> newList = new ArrayList<MailAttachment>(); for (MailAttachment a : other.attachment) { newList.add(new MailAttachment(a)); } this.attachment = newList; } }</code><technical_language>copy to,cc,bcc fields List of objects in copy constructor</technical_language>

Target:
public MailMessage(MailMessage other) { Objects.requireNonNull(other); this.bounceAddress = other.bounceAddress; this.from = other.from; this.to = copyList(other.to); this.cc = copyList(other.cc); this.bcc = copyList(other.bcc); this.subject = other.subject; this.text = other.text; this.html = other.html; if (other.attachment != null) { List<MailAttachment> newList = new ArrayList<MailAttachment>(other.attachment.size()); for (MailAttachment a : other.attachment) { newList.add(new MailAttachment(a)); } this.attachment = newList; } }