auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> private HashSet<Account.Id> getWatchers() throws EmailException { <END> HashSet<Account.Id> watchers = new HashSet<Account.Id>(); try { for (AccountProjectWatch p : args.db.get().accountProjectWatches() .byProject(project.getNameKey())) { watchers.add(p.getAccountId()); } } catch (OrmException e) { log.error("Invalid watcher is set", e); } return watchers; }</code><technical_language>"Set"s..</technical_language>

Target:
private Set<Account.Id> getWatchers() throws EmailException { Set<Account.Id> watchers = new HashSet<Account.Id>(); try { for (AccountProjectWatch p : args.db.get().accountProjectWatches() .byProject(project.getNameKey())) { watchers.add(p.getAccountId()); } Project.NameKey parent = project.getParent(); while (parent != null) { for (AccountProjectWatch p : args.db.get().accountProjectWatches() .byProject(parent)) { watchers.add(p.getAccountId()); } parent = args.projectCache.get(parent).getProject().getParent(); } } catch (OrmException e) { log.error("Invalid watcher is set", e); } return watchers; }
Source:
<code>private void setupBrightness() { if (activity == null) { return; } final WindowManager.LayoutParams lp = activity.getWindow().getAttributes(); if (player == null || !player.videoPlayerSelected() || !player.isFullscreen() || bottomSheetState != BottomSheetBehavior.STATE_EXPANDED) { restoreDefaultBrightness(); } else { <START> if (!PlayerHelper.isBrightnessGestureEnabled(getContext())) { <END> return; } final float brightnessLevel = PlayerHelper.getScreenBrightness(activity); if (brightnessLevel == lp.screenBrightness) { return; } lp.screenBrightness = brightnessLevel; activity.getWindow().setAttributes(lp); } }</code><technical_language>replace getContext() activity</technical_language>

Target:
private void setupBrightness() { if (activity == null) { return; } final WindowManager.LayoutParams lp = activity.getWindow().getAttributes(); if (player == null || !player.videoPlayerSelected() || !player.isFullscreen() || bottomSheetState != BottomSheetBehavior.STATE_EXPANDED) { restoreDefaultBrightness(); } else { if (!PlayerHelper.isBrightnessGestureEnabled(activity)) { return; } final float brightnessLevel = PlayerHelper.getScreenBrightness(activity); if (brightnessLevel == lp.screenBrightness) { return; } lp.screenBrightness = brightnessLevel; activity.getWindow().setAttributes(lp); } }
Source:
<code>public static TableLayoutParams getFor(@Nullable View view) { ViewGroup.LayoutParams lp = view == null ? null : view.getLayoutParams(); <START> return lp instanceof TableLayoutParams ? (TableLayoutParams) lp : null; <END> }</code><technical_language>Please expand in if(...) { return lp; } return null;</technical_language>

Target:
public static TableLayoutParams getFor(@Nullable View view) { return getFor(view, false); }
Source:
<code>protected int getOffscreenPageLimit() { <START> return 1; <END> }</code><technical_language>..this change sense. > Changed screen limit for unlocks 1(on unlock 2 activity open report usage of 3 fragments, add more accuracy I moved 1 screen SoldierStats) considering give user a WORSE experience, get a bit more accurate analytics? I for get analytics a misrepresentation (all fragments) a random misreprentation. Example in current implementation: 1. User opens unlocks 1.1. Fragment A B downloaded (A=1,B=1) 2. User scrolls fragment B 2.1. Fragment C is downloaded (A=1, B=1, C=1) 3. User scrolls fragment C 3.1. Fragment A is cleared (A=1, B=1, C=1) 4. User scrolls fragment B 4.1. Fragment A is downloaded (A=2, B=1, C=1) 5. User scrolls fragment C forgot 5.1. Fragment A is unloaded (A=2, B=1, C=1) 6. User scrolls fragment B 6.1. Fragment A is downloaded again, time (A=3, B=1, C=1) So, basically, generate be... hits for A, for B for C. is more accurate? If load fragments time, get for each, is a more viable representation. do stuff app worse for users (and experience). For example, I if ViewPager "hooks" send a "trigger" switch a fragment. way, if A -> B -> C -> B -> C, instead notice user fragment B C twice, A once. This more useful me, instead of causing people re-download information wrong. :+1: @peter-budo</technical_language>

Target:
protected int getOffscreenPageLimit() { return 2; }
Source:
<code>private void updateFormRecord(SqlStorage<FormRecord> formRecordStorage, boolean incomplete) throws FormInstanceTransactionException { String status; if (incomplete || !mMarkCompleted) { status = FormRecord.STATUS_INCOMPLETE; } else { status = FormRecord.STATUS_COMPLETE; } FormRecord formRecord = null; String recordName = mRecordName; if (mFormRecordId != -1) { formRecord = FormRecord.getFormRecord(formRecordStorage, mFormRecordId); } else if (mFormDefId != -1) { formRecord = CommCareApplication.instance().getCurrentSessionWrapper().getFormRecord(); formRecord.setFilePath(mFormRecordPath); if (recordName == null) { FormDefRecord formDefRecord = FormDefRecord.getFormDef( CommCareApplication.instance().getAppStorage(FormDefRecord.class), mFormDefId); recordName = formDefRecord.getDisplayname(); } } if (formRecord != null) { try { formRecord.updateStatus(formRecordStorage, status, recordName); } catch (IllegalStateException e) { throw new FormInstanceTransactionException(e); } } <START> } <END></code><technical_language>FormRecord::update private this change</technical_language>

Target:
private void updateFormRecord(SqlStorage<FormRecord> formRecordStorage, boolean incomplete) throws FormInstanceTransactionException { String status; if (incomplete || !mMarkCompleted) { status = FormRecord.STATUS_INCOMPLETE; } else { status = FormRecord.STATUS_COMPLETE; } FormRecord formRecord = null; String recordName = mRecordName; if (mFormRecordId != -1) { formRecord = FormRecord.getFormRecord(formRecordStorage, mFormRecordId); } else if (mFormDefId != -1) { formRecord = CommCareApplication.instance().getCurrentSessionWrapper().getFormRecord(); formRecord.setFilePath(mFormRecordPath); if (recordName == null) { FormDefRecord formDefRecord = FormDefRecord.getFormDef( CommCareApplication.instance().getAppStorage(FormDefRecord.class), mFormDefId); recordName = formDefRecord.getDisplayname(); } } if (formRecord != null) { try { formRecord.setDisplayName(recordName); formRecord.updateStatus(formRecordStorage, status); } catch (IllegalStateException e) { throw new FormInstanceTransactionException(e); } } }
Source:
<code>public void initialize(FlowletContext context) throws IOException { zkQuorum = Programs.getRequiredArgOrProperty(context, Constants.Realtime.Sink.HBase.ARG_HBASE_ZOOKEEPER_QUORUM); zkClientPort = Integer.valueOf(Programs.getRequiredArgOrProperty(context, Constants.Realtime.Sink.HBase.ARG_HBASE_ZOOKEEPER_CLIENT_PORT)); tableName = Programs.getRequiredArgOrProperty(context, Constants.Realtime.Sink.HBase.ARG_TABLE_NAME); family = Programs.getRequiredArgOrProperty(context, Constants.Realtime.Sink.HBase.ARG_COLFAM); familyBytes = Bytes.toBytes(family); rowKeyField = Programs.getRequiredArgOrProperty(context, Constants.Realtime.Sink.HBase.ARG_ROW_KEY_FIELD); zkParentNode = Programs.getRequiredArgOrProperty(context, Constants.Realtime.Sink.HBase.ARG_HBASE_ZOOKEEPER_PARENT_NODE); Configuration conf = HBaseConfiguration.create(); <START> <LINK_0> <END> conf.setClassLoader(HBaseConfiguration.class.getClassLoader()); conf.set(HConstants.ZOOKEEPER_QUORUM, zkQuorum); conf.setInt(HConstants.ZOOKEEPER_CLIENT_PORT, zkClientPort); conf.set(HConstants.ZOOKEEPER_ZNODE_PARENT, zkParentNode); createTableIfNotExists(tableName, conf); hTable = new HTable(conf, tableName); }</code><technical_language>URL Link</technical_language>

Target:
public void initialize(FlowletContext context) throws IOException { zkQuorum = Programs.getRequiredArgOrProperty(context, Constants.Realtime.Sink.HBase.ARG_HBASE_ZOOKEEPER_QUORUM); zkClientPort = Integer.valueOf(Programs.getRequiredArgOrProperty(context, Constants.Realtime.Sink.HBase.ARG_HBASE_ZOOKEEPER_CLIENT_PORT)); tableName = Programs.getRequiredArgOrProperty(context, Constants.Realtime.Sink.HBase.ARG_TABLE_NAME); family = Programs.getRequiredArgOrProperty(context, Constants.Realtime.Sink.HBase.ARG_COLFAM); familyBytes = Bytes.toBytes(family); rowKeyField = Programs.getRequiredArgOrProperty(context, Constants.Realtime.Sink.HBase.ARG_ROW_KEY_FIELD); zkParentNode = Programs.getRequiredArgOrProperty(context, Constants.Realtime.Sink.HBase.ARG_HBASE_ZOOKEEPER_PARENT_NODE); Configuration conf = HBaseConfiguration.create(); conf.setClassLoader(HBaseConfiguration.class.getClassLoader()); conf.set(HConstants.ZOOKEEPER_QUORUM, zkQuorum); conf.setInt(HConstants.ZOOKEEPER_CLIENT_PORT, zkClientPort); conf.set(HConstants.ZOOKEEPER_ZNODE_PARENT, zkParentNode); createTableIfNotExists(tableName, conf); hTable = new HTable(conf, tableName); }
Source:
<code><START> public E getElement() { <END> return (E)item.getData(); }</code><technical_language>I get a warning for this cast Object</technical_language>

Target:
public E getElement() { @SuppressWarnings("unchecked") E element = (E)item.getData(); return element; }
Source:
<code>void transportFactory() { assertThrows(NullPointerException.class, <START> () -> builder().setTransportFactory(Tests.nullRef())); <END> }</code><technical_language>import nullRef() statically</technical_language>

Target:
void transportFactory() { assertThrows(NullPointerException.class, () -> builder().setTransportFactory(nullRef())); }
Source:
<code>protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (StringUtils.isEmpty(request.getParameter(SSOUtils.POST_ACTION_URL))) { throw new RuntimeException("No post action url found in request."); } boolean enableExternalAuth = (boolean) request.getSession().getServletContext().getAttribute(SSOUtils.ENABLE_EXTERNAL_AUTH); boolean acceptBasicAuth = (boolean) request.getSession().getServletContext().getAttribute(SSOUtils.ACCEPT_BASIC_AUTH_HEADERS); request.getSession(true).setAttribute(SSOUtils.PARAMS_MAP, new HashMap<>(request.getParameterMap())); if (enableExternalAuth) { response.sendRedirect(request.getContextPath() + SSOUtils.LOGIN_EXTERNAL_URI); } else if (acceptBasicAuth) { <START> response.sendRedirect(request.getContextPath() + SSOUtils.LOGIN_BASIC_URI); <END> } else { response.sendRedirect(request.getContextPath() + SSOUtils.LOGIN_PHASE2_URI); } }</code><technical_language>hmmm... bother sequence... but... external basic, if require basic in phase... phase1 external phase2 - new if accept basic accept headers basic - if authenticated require basic phase3 - in phase2 if accept basic accept headers this enable do external magic if prompt for basic</technical_language>

Target:
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (StringUtils.isEmpty(request.getParameter(SSOUtils.POST_ACTION_URL))) { throw new RuntimeException("No post action url found in request."); } boolean enableExternalAuth = (boolean) request.getSession().getServletContext().getAttribute(SSOUtils.ENABLE_EXTERNAL_AUTH); request.getSession(true).setAttribute(SSOUtils.PARAMS_MAP, new HashMap<>(request.getParameterMap())); if (enableExternalAuth) { response.sendRedirect(request.getContextPath() + SSOUtils.LOGIN_EXTERNAL_URI); } else { response.sendRedirect(request.getContextPath() + SSOUtils.LOGIN_PHASE2_URI); } }
Source:
<code>public String declareQueue(final Queue queue) { try { return this.rabbitTemplate.execute(channel -> { DeclareOk[] declared = declareQueues(channel, queue); String declaredName = declared.length > 0 ? declared[0].getQueue() : null; if (StringUtils.hasText(declaredName)) { <START> queue.setDeclaredName(declaredName); <END> } return declaredName; }); } catch (AmqpException e) { logOrRethrowDeclarationException(queue, "queue", e); return null; } }</code><technical_language>this logic is done in delegating declareQueues(). it</technical_language>

Target:
public String declareQueue(final Queue queue) { try { return this.rabbitTemplate.execute(channel -> { DeclareOk[] declared = declareQueues(channel, queue); return declared.length > 0 ? declared[0].getQueue() : null; }); } catch (AmqpException e) { logOrRethrowDeclarationException(queue, "queue", e); return null; } }
Source:
<code>protected String resolvePrincipalInternal(final X509Certificate certificate) { LOGGER.debug("Resolving principal from Subject Alternative Name RFC8222 type (email) for [{}]", certificate); try { val subjectAltNames = certificate.getSubjectAlternativeNames(); val email = getRFC822EmailAddress(subjectAltNames); if (email != null) { return email; } } catch (final CertificateParsingException e) { LOGGER.error("Error is encountered while trying to retrieve subject alternative names collection from certificate", e); <START> return getAlternatePrincipal(certificate); <END> } return getAlternatePrincipal(certificate); }</code><technical_language>This unnecessary, if return end of method anyway</technical_language>

Target:
protected String resolvePrincipalInternal(final X509Certificate certificate) { LOGGER.debug("Resolving principal from Subject Alternative Name RFC8222 type (email) for [{}]", certificate); try { val subjectAltNames = certificate.getSubjectAlternativeNames(); val email = getRFC822EmailAddress(subjectAltNames); if (email != null) { return email; } } catch (final CertificateParsingException e) { LOGGER.error("Error encountered while trying to retrieve subject alternative names collection from certificate [{}]", e.getMessage(), e); } return getAlternatePrincipal(certificate); }
Source:
<code>public boolean equals(EmbeddedServerInfo info) { <START> if (this.serverName.equals(info.serverName) <END> && this.userDir.getAbsolutePath().equals(info.userDir.getAbsolutePath()) && this.outputDir.getAbsolutePath().equals(info.outputDir.getAbsolutePath())) { return true; } return false; }</code><technical_language>Technically I get methods info access variables</technical_language>

Target:
public boolean equals(EmbeddedServerInfo info) { return this.serverName.equals(info.serverName) && this.userDir.getAbsolutePath().equals(info.userDir.getAbsolutePath()) && this.outputDir.getAbsolutePath().equals(info.outputDir.getAbsolutePath()); }
Source:
<code>public List<Member> findMembersInParentGroup(PerunSession sess, Group group, String searchString) throws InternalErrorException, ParentGroupNotExistsException{ List<User> users = getPerunBl().getUsersManagerBl().findUsers(sess, searchString); List<Member> allGroupMembers; if(group.getParentGroupId() == null) { <START> Vo vo; <END> try { vo = getPerunBl().getVosManagerBl().getVoById(sess, group.getVoId()); } catch (VoNotExistsException ex) { throw new ConsistencyErrorException("Vo does not exist."); } allGroupMembers = getPerunBl().getMembersManagerBl().getMembers(sess, vo); } else { allGroupMembers = getPerunBl().getGroupsManagerBl().getParentGroupMembers(sess, group); } List<Member> allFoundMembers = new ArrayList<>(); for(User user: users){ allFoundMembers.addAll(getMembersByUser(sess, user)); } allGroupMembers.retainAll(allFoundMembers); return allGroupMembers; }</code><technical_language>I change this message a bit. I message this: suggestion throw new ConsistencyErrorException("Vo for " + group + " exist.");</technical_language>

Target:
public List<Member> findMembersInParentGroup(PerunSession sess, Group group, String searchString) throws InternalErrorException { List<User> users = getPerunBl().getUsersManagerBl().findUsers(sess, searchString); List<Member> allGroupMembers; if(group.getParentGroupId() == null) { Vo vo; try { vo = getPerunBl().getVosManagerBl().getVoById(sess, group.getVoId()); } catch (VoNotExistsException ex) { throw new ConsistencyErrorException("Vo for group " + group + " does not exist."); } allGroupMembers = getPerunBl().getMembersManagerBl().getMembers(sess, vo); } else { allGroupMembers = getPerunBl().getGroupsManagerBl().getParentGroupMembers(sess, group); } List<Member> allFoundMembers = new ArrayList<>(); for(User user: users){ allFoundMembers.addAll(getMembersByUser(sess, user)); } allGroupMembers.retainAll(allFoundMembers); return allGroupMembers; }
Source:
<code>protected void executeCommand() { if (getDiskImage() != null) { VDSReturnValue vdsReturnValue = performImageVdsmOperation(); getReturnValue().getInternalTaskIdList().add( createTask(vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId())); if (getParameters().getPerformDbOperationsStage() == PerformOperationStage.EXECUTION && getParameters().getParentCommand() != VdcActionType.RemoveVmFromImportExport <START> && getParameters().getParentCommand() != VdcActionType.RemoveVmTemplateFromImportExport) { <END> removeImageFromDB(false); } } else { log.warn("DiskImage is null, nothing to remove"); } setSucceeded(true); }</code><technical_language>do a condition getParentCommand()</technical_language>

Target:
protected void executeCommand() { if (getDiskImage() != null) { VDSReturnValue vdsReturnValue = performImageVdsmOperation(); getReturnValue().getInternalTaskIdList().add( createTask(vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId())); if (getParameters().getPerformDbOperationsStage() == PerformOperationsStage.EXECUTION && getParameters().getParentCommand() != VdcActionType.RemoveVmFromImportExport && getParameters().getParentCommand() != VdcActionType.RemoveVmTemplateFromImportExport) { removeImageFromDB(false); } } else { log.warn("DiskImage is null, nothing to remove"); } setSucceeded(true); }
Source:
<code>public static String dumpCert(ConfigurationContext configurationContext, byte[] cert, String fileName) { if (!verifyCertExistence(fileName, configurationContext)) { String workDir = (String) configurationContext.getProperty(ServerConstants.WORK_DIR); File pubCert = new File(workDir + File.separator + "pub_certs"); if (fileName == null) { fileName = String.valueOf(System.currentTimeMillis() + Math.random()) + ".cert"; } if (!pubCert.exists()) { pubCert.mkdirs(); } String filePath = workDir + File.separator + "pub_certs" + File.separator + fileName; OutputStream outStream = null; try { outStream = new FileOutputStream(filePath); outStream.write(cert); <START> } catch (Exception e) { <END> String msg = "Error when writing the public certificate to a file"; log.error(msg); throw new SecurityException("msg", e); } finally { IdentityIOStreamUtils.closeOutputStream(outStream); } Map fileResourcesMap = (Map) configurationContext.getProperty(WSO2Constants.FILE_RESOURCE_MAP); if (fileResourcesMap == null) { fileResourcesMap = new Hashtable(); configurationContext.setProperty(WSO2Constants.FILE_RESOURCE_MAP, fileResourcesMap); } fileResourcesMap.put(fileName, filePath); } return WSO2Constants.ContextPaths.DOWNLOAD_PATH + "?id=" + fileName; }</code><technical_language>flush() is removed ? flush() find some JDKs swallow exception if flush() is done close(). it</technical_language>

Target:
public static String dumpCert(ConfigurationContext configurationContext, byte[] cert, String fileName) { if (!verifyCertExistence(fileName, configurationContext)) { String workDir = (String) configurationContext.getProperty(ServerConstants.WORK_DIR); File pubCert = new File(workDir + File.separator + "pub_certs"); if (fileName == null) { fileName = String.valueOf(System.currentTimeMillis() + Math.random()) + ".cert"; } if (!pubCert.exists()) { pubCert.mkdirs(); } String filePath = workDir + File.separator + "pub_certs" + File.separator + fileName; OutputStream outStream = null; try { outStream = new FileOutputStream(filePath); outStream.write(cert); } catch (Exception e) { String msg = "Error when writing the public certificate to a file"; log.error(msg); throw new SecurityException("msg", e); } finally { IdentityIOStreamUtils.flushOutputStream(outStream); IdentityIOStreamUtils.closeOutputStream(outStream); } Map fileResourcesMap = (Map) configurationContext.getProperty(WSO2Constants.FILE_RESOURCE_MAP); if (fileResourcesMap == null) { fileResourcesMap = new Hashtable(); configurationContext.setProperty(WSO2Constants.FILE_RESOURCE_MAP, fileResourcesMap); } fileResourcesMap.put(fileName, filePath); } return WSO2Constants.ContextPaths.DOWNLOAD_PATH + "?id=" + fileName; }
Source:
<code><START> public void testNonStaticInnerClasses() { <END> boolean successful = false; try { ReflectData.get().getSchema(Definition.class); } catch (AvroTypeException ex) { if (ex.getMessage().contains("must be a static inner class")) { successful = true; } } assertTrue(successful); }</code><technical_language>prefer annotation: @Test(expected = AvroTypeException.class) do think</technical_language>

Target:
public void testNonStaticInnerClasses() { ReflectData.get().getSchema(Definition.class); }
Source:
<code>public DeltaByteArrayWriter(int initialCapacity, int pageSize, ByteBufferAllocator allocator) { <START> this.allocator=allocator; <END> this.prefixLengthWriter = new DeltaBinaryPackingValuesWriter(128, 4, initialCapacity, pageSize, this.allocator); this.suffixWriter = new DeltaLengthByteArrayValuesWriter(initialCapacity, pageSize, this.allocator); this.previous = new byte[0]; }</code><technical_language>unused field</technical_language>

Target:
public DeltaByteArrayWriter(int initialCapacity, int pageSize, ByteBufferAllocator allocator) { this.prefixLengthWriter = new DeltaBinaryPackingValuesWriter(128, 4, initialCapacity, pageSize, allocator); this.suffixWriter = new DeltaLengthByteArrayValuesWriter(initialCapacity, pageSize, allocator); this.previous = new byte[0]; }
Source:
<code>public final int hashCode() { <START> final int prime = 31; <END> int result = 1; result = prime * result; result += (int) (absEndVar ^ (absEndVar >>> SHIFTDISTANCE)); result = prime * result + (int) (absStartVar ^ (absStartVar >>> SHIFTDISTANCE)); result = prime * result; if (contentVar != null) { result += contentVar.hashCode(); } result = prime * result + (int) (endVar ^ (endVar >>> SHIFTDISTANCE)); result = prime * result; if (mutationVar != null) { result += mutationVar.hashCode(); } result = prime * result; if (sourcesVar != null) { result += sourcesVar.hashCode(); } result = prime * result + (int) (startVar ^ (startVar >>> SHIFTDISTANCE)); return result; }</code><technical_language>is prime in method scope SHIFTDISTANCE a class constant? note SHIFTDISTANCE == prime + 1</technical_language>

Target:
public final int hashCode() { final int prime = 31; int result = 1; result = prime * result; result += (int) (absEndVar ^ (absEndVar >>> prime + 1)); result = prime * result + (int) (absStartVar ^ (absStartVar >>> prime + 1)); result = prime * result; if (contentVar != null) { result += contentVar.hashCode(); } result = prime * result + (int) (endVar ^ (endVar >>> prime + 1)); result = prime * result; if (mutationVar != null) { result += mutationVar.hashCode(); } result = prime * result; if (sourcesVar != null) { result += sourcesVar.hashCode(); } result = prime * result + (int) (startVar ^ (startVar >>> prime + 1)); return result; }
Source:
<code>public void sendPushMessage(Variant variant, Collection<String> clientIdentifiers, UnifiedPushMessage pushMessage, NotificationSenderCallback senderCallback) { if (clientIdentifiers.isEmpty()) { return; } final WindowsVariant windowsVariant = (WindowsVariant) variant; WnsService wnsService = new WnsService(windowsVariant.getSid(), windowsVariant.getClientSecret(), true); WnsToast toast = new WnsToastBuilder().bindingTemplateToastText01(pushMessage.getMessage().getAlert()).build(); try { Set<String> expiredClientIdentifiers = new HashSet<String>(clientIdentifiers.size()); final List<WnsNotificationResponse> responses = wnsService.pushToast(new ArrayList<String>(clientIdentifiers), toast); for (WnsNotificationResponse response : responses) { if (response.code == HttpServletResponse.SC_GONE) { expiredClientIdentifiers.add(response.channelUri); } } if (!expiredClientIdentifiers.isEmpty()) { logger.log(Level.INFO, String.format("Deleting '%d' expired WNS installations", expiredClientIdentifiers.size())); clientInstallationService.removeInstallationsForVariantByDeviceTokens(variant.getVariantID(), expiredClientIdentifiers); } <START> logger.log(Level.INFO, "Message to WNS has been submitted"); <END> senderCallback.onSuccess(); } catch (WnsException exception) { senderCallback.onError(exception.getMessage()); } }</code><technical_language>fine instead of info</technical_language>

Target:
public void sendPushMessage(Variant variant, Collection<String> clientIdentifiers, UnifiedPushMessage pushMessage, NotificationSenderCallback senderCallback) { if (clientIdentifiers.isEmpty()) { return; } final WindowsVariant windowsVariant = (WindowsVariant) variant; WnsService wnsService = new WnsService(windowsVariant.getSid(), windowsVariant.getClientSecret(), true); WnsToast toast = new WnsToastBuilder().bindingTemplateToastText01(pushMessage.getMessage().getAlert()).build(); try { Set<String> expiredClientIdentifiers = new HashSet<String>(clientIdentifiers.size()); final List<WnsNotificationResponse> responses = wnsService.pushToast(new ArrayList<String>(clientIdentifiers), toast); for (WnsNotificationResponse response : responses) { if (response.code == HttpServletResponse.SC_GONE) { expiredClientIdentifiers.add(response.channelUri); } } if (!expiredClientIdentifiers.isEmpty()) { logger.log(Level.INFO, String.format("Deleting '%d' expired WNS installations", expiredClientIdentifiers.size())); clientInstallationService.removeInstallationsForVariantByDeviceTokens(variant.getVariantID(), expiredClientIdentifiers); } logger.log(Level.FINE, "Message to WNS has been submitted"); senderCallback.onSuccess(); } catch (WnsException exception) { senderCallback.onError(exception.getMessage()); } }
Source:
<code>void testSnapshotterTriggeredOnUnitOfWorkCommit() { SnapshotTrigger trigger = testSubject.prepareTrigger(aggregate.rootType()); GenericDomainEventMessage<String> msg = new GenericDomainEventMessage<>("type", aggregateIdentifier, 0, "Mock contents", MetaData.emptyInstance()); trigger.initializationFinished(); trigger.eventHandled(msg); trigger.eventHandled(msg); trigger.eventHandled(msg); trigger.eventHandled(msg); verify(mockSnapshotter, never()).scheduleSnapshot(aggregate.rootType(), aggregateIdentifier); CurrentUnitOfWork.get() .onCommit(uow -> verify(mockSnapshotter) .scheduleSnapshot(aggregate.rootType(), aggregateIdentifier)); <START> CurrentUnitOfWork.commit(); <END> }</code><technical_language>I change this testcase include 2 variants. Move "verify" code of onCommit. unreliable put assertions there. If UoW is rolled back, test passes. variant do a UOW Commit, other a rollback. In case of commit is invocation, in case of rollback,</technical_language>

Target:
void testSnapshotterTriggeredOnUnitOfWorkCommit() { SnapshotTrigger trigger = testSubject.prepareTrigger(aggregate.rootType()); GenericDomainEventMessage<String> msg = new GenericDomainEventMessage<>( "type", aggregateIdentifier, 0, "Mock contents", MetaData.emptyInstance() ); trigger.initializationFinished(); trigger.eventHandled(msg); trigger.eventHandled(msg); trigger.eventHandled(msg); trigger.eventHandled(msg); verify(mockSnapshotter, never()).scheduleSnapshot(aggregate.rootType(), aggregateIdentifier); CurrentUnitOfWork.commit(); verify(mockSnapshotter).scheduleSnapshot(aggregate.rootType(), aggregateIdentifier); }
Source:
<code>public void queueBackwardsCompatibility() { CorfuQueue oldQueueInstance1 = new CorfuQueue(getDefaultRuntime(), "test", Serializers.JSON); CorfuRuntime rt2 = getNewRuntime(getDefaultNode()).connect(); CorfuQueue oldQueueInstance2 = new CorfuQueue(rt2, "test", Serializers.QUEUE_SERIALIZER); final int numItemsToProduce = 10; IntStream.range(0, numItemsToProduce).forEach(itemIdx -> { if (itemIdx % 2 == 0) { oldQueueInstance1.enqueue(getByteString(String.valueOf(itemIdx))); <START> } else { <END> oldQueueInstance2.enqueue(getByteString(String.valueOf(itemIdx))); } }); CorfuRuntime rt3 = getNewRuntime(getDefaultNode()).connect(); CorfuQueue newQueueInstance= new CorfuQueue(rt3, "test"); assertThat(newQueueInstance.size()).isEqualTo(numItemsToProduce); IntStream.range(0, numItemsToProduce).forEach(itemIdx -> { assertThat(newQueueInstance.entryList().get(itemIdx).getEntry().toStringUtf8()) .isEqualTo(String.valueOf(itemIdx)); }); }</code><technical_language>wondering for code coverage of sequence id part this test case wrap enqueue in a transaction</technical_language>

Target:
public void queueBackwardsCompatibility() { CorfuQueue oldQueueInstance1 = new CorfuQueue(getDefaultRuntime(), "test", Serializers.JSON); CorfuRuntime rt2 = getNewRuntime(getDefaultNode()).connect(); CorfuQueue oldQueueInstance2 = new CorfuQueue(rt2, "test", Serializers.QUEUE_SERIALIZER); final int numItemsToProduce = 10; IntStream.range(0, numItemsToProduce).forEach(itemIdx -> { if (itemIdx % 2 == 0) { executeTxn(getDefaultRuntime(), () -> oldQueueInstance1.enqueue(getByteString(String.valueOf(itemIdx)))); } else { executeTxn(rt2, () -> oldQueueInstance2.enqueue(getByteString(String.valueOf(itemIdx)))); } }); CorfuRuntime rt3 = getNewRuntime(getDefaultNode()).connect(); CorfuQueue newQueueInstance= new CorfuQueue(rt3, "test"); assertThat(newQueueInstance.size()).isEqualTo(numItemsToProduce); IntStream.range(0, numItemsToProduce).forEach(itemIdx -> { assertThat(newQueueInstance.entryList().get(itemIdx).getEntry().toStringUtf8()) .isEqualTo(String.valueOf(itemIdx)); }); }
Source:
<code>public void translate(final LogicalFilter filter, final TranslatorContext context) { MessageStream<SamzaSqlRelMessage> inputStream = context.getMessageStream(filter.getInput().getId()); MessageStream<SamzaSqlRelMessage> outputStream = inputStream.filter(message -> { Expression expr = context.getExpressionCompiler().compile(filter.getInputs(), Collections.singletonList(filter.getCondition())); Object[] result = new Object[1]; expr.execute(message.getValue(), result); if (result.length > 0 && result[0] instanceof Boolean) { boolean retVal = (Boolean) result[0]; <START> log.info( <END> String.format("return value for input %s is %s", Arrays.asList(message.getValue()).toString(), retVal)); return retVal; } else { log.error("return value is not boolean"); return false; } }); context.registerMessageStream(filter.getId(), outputStream); }</code><technical_language>log.debug</technical_language>

Target:
public void translate(final LogicalFilter filter, final TranslatorContext context) { MessageStream<SamzaSqlRelMessage> inputStream = context.getMessageStream(filter.getInput().getId()); Expression expr = context.getExpressionCompiler().compile(filter.getInputs(), Collections.singletonList(filter.getCondition())); MessageStream<SamzaSqlRelMessage> outputStream = inputStream.filter(message -> { Object[] result = new Object[1]; expr.execute(context.getExecutionContext(), context.getDataContext(), message.getRelFieldValues().toArray(), result); if (result.length > 0 && result[0] instanceof Boolean) { boolean retVal = (Boolean) result[0]; log.debug( String.format("return value for input %s is %s", Arrays.asList(message.getFieldValues()).toString(), retVal)); return retVal; } else { log.error("return value is not boolean"); return false; } }); context.registerMessageStream(filter.getId(), outputStream); }
Source:
<code>Map<String, Integer> parallelismDelta(Map<String, Integer> componentCounts, Map<String, Integer> changeRequests) { for (String component : changeRequests.keySet()) { if (!componentCounts.containsKey(component)) { throw new IllegalArgumentException( "Invalid component name in update request: " + component); } Integer newValue = changeRequests.get(component); Integer delta = newValue - componentCounts.get(component); if (delta == 0) { changeRequests.remove(component); } else { changeRequests.put(component, delta); } } <START> return changeRequests; <END> }</code><technical_language>input request Map is modified this method. I create a new structure delta avoid confusion</technical_language>

Target:
Map<String, Integer> parallelismDelta(Map<String, Integer> componentCounts, Map<String, Integer> changeRequests) { Map<String, Integer> componentDeltas = new HashMap<>(); for (String component : changeRequests.keySet()) { if (!componentCounts.containsKey(component)) { throw new IllegalArgumentException( "Invalid component name in update request: " + component); } Integer newValue = changeRequests.get(component); Integer delta = newValue - componentCounts.get(component); if (delta != 0) { componentDeltas.put(component, delta); } } return componentDeltas; }
Source:
<code>public boolean shouldExecuteOnProject(Project project) { <START> boolean x1 = fileSystem.hasFiles(fileSystem.predicates().hasLanguage(Python.KEY)), <END> x2 = !profile.getActiveRulesByRepository(PylintRuleRepository.REPOSITORY_KEY).isEmpty(); return fileSystem.hasFiles(fileSystem.predicates().hasLanguage(Python.KEY)) && !profile.getActiveRulesByRepository(PylintRuleRepository.REPOSITORY_KEY).isEmpty(); }</code><technical_language>x1 x2 unused</technical_language>

Target:
public boolean shouldExecuteOnProject(Project project) { FilePredicates p = fileSystem.predicates(); boolean hasFiles = fileSystem.hasFiles(p.and(p.hasType(InputFile.Type.MAIN), p.hasLanguage(Python.KEY))); boolean hasRules = !profile.getActiveRulesByRepository(PylintRuleRepository.REPOSITORY_KEY).isEmpty(); return hasFiles && hasRules && settings.getString(REPORT_PATH_KEY) == null; }
Source:
<code>public Response<Set<String>> apply(ChangeResource req, Input input) throws AuthException, OrmException, IOException, BadRequestException { if (input == null || Strings.isNullOrEmpty(input.hashtags)) { throw new BadRequestException("Hashtags are required"); } ChangeControl control = req.getControl(); ChangeUpdate update = updateFactory.create(control); ChangeNotes notes = control.getNotes().load(); <START> Set<String> hashtags = new HashSet<String>(); Set<String> oldHashtags = notes.getHashtags(); if (oldHashtags != null) { hashtags.addAll(oldHashtags); } <END> hashtags.removeAll(Arrays.asList(input.hashtags.split(","))); update.setHashtags(hashtags); update.commit(); return Response.ok(hashtags); }</code><technical_language>do need sets? do: Set<String> hashtags = notes.getHashtags(); if (hashtags == null) { return Response.ok(); // response indicating do? } hashtags.removeAll(...);</technical_language>

Target:
public Response<Set<String>> apply(ChangeResource req, Input input) throws OrmException, IOException, BadRequestException { if (input == null || Strings.isNullOrEmpty(input.hashtags)) { throw new BadRequestException("Hashtags are required"); } ChangeControl control = req.getControl(); ChangeUpdate update = updateFactory.create(control); ChangeNotes notes = control.getNotes().load(); Set<String> hashtags = new HashSet<String>(); Set<String> oldHashtags = notes.getHashtags(); if (oldHashtags != null) { hashtags.addAll(oldHashtags); } hashtags.removeAll(Arrays.asList(input.hashtags.split(","))); update.setHashtags(hashtags); update.commit(); ChangeUtil.bumpRowVersionNotLastUpdatedOn(req.getChange().getId(), db.get()); return Response.ok(hashtags); }
Source:
<code>public ODataDataHandler createODataHandler() throws ODataServiceFault { <START> return new MongoDataHandler(getConfigId(),getJongo()); <END> }</code><technical_language>Formatting issue. Need space ,</technical_language>

Target:
public ODataDataHandler createODataHandler() { return new MongoDataHandler(getConfigId(), getJongo()); }
Source:
<code>public void onOpen() { final String currentPerspectiveIdentifier = perspectiveManager.getCurrentPerspective().getIdentifier(); final Collection<UberfireDock> stunnerDocks = stunnerDocksHandler.provideDocks(currentPerspectiveIdentifier); stunnerDocks.stream() <START> .filter(dock -> dock.getPlaceRequest().getIdentifier().compareTo(DiagramEditorPropertiesScreen.SCREEN_ID) == 0) <END> .forEach(uberfireDocks::open); super.doOpen(); }</code><technical_language>do sort, I java Objects.equals(dock.getPlaceRequest().getIdentifier(), DiagramEditorPropertiesScreen.SCREEN_ID)</technical_language>

Target:
public void onOpen() { final String currentPerspectiveIdentifier = perspectiveManager.getCurrentPerspective().getIdentifier(); final Collection<UberfireDock> stunnerDocks = stunnerDocksHandler.provideDocks(currentPerspectiveIdentifier); stunnerDocks.stream() .filter(dock -> Objects.equals(dock.getPlaceRequest().getIdentifier(), DiagramEditorPropertiesScreen.SCREEN_ID)) .forEach(uberfireDocks::open); super.doOpen(); }
Source:
<code>private GitUser getCommitCommitter(RevCommit commit) { PersonIdent committerIdentity = commit.getCommitterIdent(); GitUser committer = createDto(GitUser.class).withName(committerIdentity.getName()) .withEmail(committerIdentity.getEmailAddress()); <START> return committer; <END> }</code><technical_language>return newDto(GitUser.class).withName(committerIdentity.getName()) .withEmail(committerIdentity.getEmailAddress());</technical_language>

Target:
private GitUser getCommitCommitter(RevCommit commit) { PersonIdent committerIdentity = commit.getCommitterIdent(); return newDto(GitUser.class).withName(committerIdentity.getName()) .withEmail(committerIdentity.getEmailAddress()); }
Source:
<code>public BinaryResult apply(RevisionResource rsrc) throws BadRequestException, IOException { if (Strings.isNullOrEmpty(format)) { throw new BadRequestException("format is not specified"); } final ArchiveFormat f = allowedFormats.extensions.get("." + format); <START> if (f == null || f == ArchiveFormat.ZIP) { throw new BadRequestException("unknown archive format"); } <END> boolean close = true; final Repository repo = repoManager .openRepository(rsrc.getControl().getProject().getNameKey()); try { final RevWalk rw = new RevWalk(repo); try { final RevCommit commit = rw.parseCommit(ObjectId.fromString(rsrc.getPatchSet() .getRevision().get())); BinaryResult bin = new BinaryResult() { @Override public void writeTo(OutputStream out) throws IOException { try { new ArchiveCommand(repo) .setFormat(f.name()) .setTree(commit.getTree()) .setOutputStream(out).call(); } catch (GitAPIException e) { throw new IOException(e); } } @Override public void close() throws IOException { rw.close(); repo.close(); } }; bin.disableGzip() .setContentType(f.getMimeType()) .setAttachmentName(name(f, rw, commit)); close = false; return bin; } finally { if (close) { rw.close(); } } } finally { if (close) { repo.close(); } } }</code><technical_language>In case of ZIP this error message is wrong. ZIP format is unknown; is allowed/supported. a separate error message for case? a 400 bad request, 405 method allowed? (or else?)</technical_language>

Target:
public BinaryResult apply(RevisionResource rsrc) throws BadRequestException, IOException, MethodNotAllowedException { if (Strings.isNullOrEmpty(format)) { throw new BadRequestException("format is not specified"); } final ArchiveFormat f = allowedFormats.extensions.get("." + format); if (f == null) { throw new BadRequestException("unknown archive format"); } if (f == ArchiveFormat.ZIP) { throw new MethodNotAllowedException("zip format is disabled"); } boolean close = true; final Repository repo = repoManager .openRepository(rsrc.getControl().getProject().getNameKey()); try { final RevWalk rw = new RevWalk(repo); try { final RevCommit commit = rw.parseCommit(ObjectId.fromString(rsrc.getPatchSet() .getRevision().get())); BinaryResult bin = new BinaryResult() { @Override public void writeTo(OutputStream out) throws IOException { try { new ArchiveCommand(repo) .setFormat(f.name()) .setTree(commit.getTree()) .setOutputStream(out).call(); } catch (GitAPIException e) { throw new IOException(e); } } @Override public void close() throws IOException { rw.close(); repo.close(); } }; bin.disableGzip() .setContentType(f.getMimeType()) .setAttachmentName(name(f, rw, commit)); close = false; return bin; } finally { if (close) { rw.close(); } } } finally { if (close) { repo.close(); } } }
Source:
<code>private String rewritePropsFile(String masterHosts, String originalFileName) { Properties kuduConnectionProperties = new Properties(); ClassLoader loader = Thread.currentThread().getContextClassLoader(); InputStream kuduPropsFileAsStream = loader.getResourceAsStream(originalFileName); File tempPropertiesFile = null; try { <START> tempPropertiesFile = File.createTempFile(System.getProperty("java.io.tmpdir"),".properties"); <END> LOG.info(tempPropertiesFile.getAbsolutePath() + " is being used as a temporary props file"); } catch (IOException e) { LOG.error("Not able to create temp file",e); return originalFileName; } if (kuduPropsFileAsStream != null) { try { kuduConnectionProperties.load(kuduPropsFileAsStream); kuduPropsFileAsStream.close(); FileOutputStream toBeModifiedFileHandle = new FileOutputStream(tempPropertiesFile); kuduConnectionProperties.put(BaseKuduOutputOperator.MASTER_HOSTS,masterHosts); kuduConnectionProperties.store(toBeModifiedFileHandle,"updated by unit test"); toBeModifiedFileHandle.close(); } catch (IOException e) { LOG.error(e.getMessage(), e); } } return tempPropertiesFile.getAbsolutePath(); }</code><technical_language>parameter is a temp file prefix, need get system property</technical_language>

Target:
private String rewritePropsFile(String masterHosts, String originalFileName) { Properties kuduConnectionProperties = new Properties(); ClassLoader loader = Thread.currentThread().getContextClassLoader(); InputStream kuduPropsFileAsStream = loader.getResourceAsStream(originalFileName); File tempPropertiesFile = null; try { tempPropertiesFile = File.createTempFile("kuduclusterconfig-" + System.currentTimeMillis(), ".properties"); LOG.info(tempPropertiesFile.getAbsolutePath() + " is being used as a temporary props file"); } catch (IOException e) { LOG.error("Not able to create temp file",e); return originalFileName; } if (kuduPropsFileAsStream != null) { try { kuduConnectionProperties.load(kuduPropsFileAsStream); kuduPropsFileAsStream.close(); FileOutputStream toBeModifiedFileHandle = new FileOutputStream(tempPropertiesFile); kuduConnectionProperties.put(BaseKuduOutputOperator.MASTER_HOSTS,masterHosts); kuduConnectionProperties.store(toBeModifiedFileHandle,"updated by unit test"); toBeModifiedFileHandle.close(); } catch (IOException e) { LOG.error(e.getMessage(), e); } } return tempPropertiesFile.getAbsolutePath(); }
Source:
<code>protected void buildVmNetworkInterfaces() { Boolean useRtl8139_pv = Config.<Boolean> GetValue( ConfigValues.UseRtl8139_pv, vm .getvds_group_compatibility_version() .toString()); for (VmNetworkInterface vmInterface : vm.getInterfaces()) { VmDevice vmDevice = DbFacade.getInstance() .getVmDeviceDAO() .get(new VmDeviceId(vmInterface.getId(), vmInterface.getVmId().getValue())); <START> <END> if (vmDevice.getIsManaged() && vmDevice.getIsPlugged()) { XmlRpcStruct struct = new XmlRpcStruct(); VmInterfaceType ifaceType = VmInterfaceType.rtl8139; if (vmInterface.getType() != null) { ifaceType = VmInterfaceType.forValue(vmInterface.getType()); } if (ifaceType == VmInterfaceType.rtl8139_pv) { if (!useRtl8139_pv) { if (vm.getHasAgent()) { addNetworkInterfaceProperties(struct, vmInterface, vmDevice, VmInterfaceType.pv.name()); } else { addNetworkInterfaceProperties(struct, vmInterface, vmDevice, VmInterfaceType.rtl8139.name()); } } else { addNetworkInterfaceProperties(struct, vmInterface, vmDevice, VmInterfaceType.pv.name()); XmlRpcStruct rtl8139Struct = new XmlRpcStruct(); addNetworkInterfaceProperties(rtl8139Struct, vmInterface, vmDevice, VmInterfaceType.rtl8139.name()); devices.add(rtl8139Struct); } } else { addNetworkInterfaceProperties(struct, vmInterface, vmDevice, ifaceType.toString()); } devices.add(struct); addToManagedDevices(vmDevice); } } }</code><technical_language>Please improve performance of method. Retrieve network interfaces devices db filter them, case query is more efficient</technical_language>

Target:
protected void buildVmNetworkInterfaces() { Boolean useRtl8139_pv = Config.<Boolean> GetValue( ConfigValues.UseRtl8139_pv, vm .getvds_group_compatibility_version() .toString()); Map<VmDeviceId, VmDevice> devicesByDeviceId = Entities.businessEntitiesById(DbFacade.getInstance().getVmDeviceDAO().getVmDeviceByVmId(vm.getId())); for (VmNetworkInterface vmInterface : vm.getInterfaces()) { VmDevice vmDevice = devicesByDeviceId.get(new VmDeviceId(vmInterface.getId(), vmInterface.getVmId().getValue())); if (vmDevice != null && vmDevice.getIsManaged() && vmDevice.getIsPlugged()) { XmlRpcStruct struct = new XmlRpcStruct(); VmInterfaceType ifaceType = VmInterfaceType.rtl8139; if (vmInterface.getType() != null) { ifaceType = VmInterfaceType.forValue(vmInterface.getType()); } if (ifaceType == VmInterfaceType.rtl8139_pv) { if (!useRtl8139_pv) { if (vm.getHasAgent()) { addNetworkInterfaceProperties(struct, vmInterface, vmDevice, VmInterfaceType.pv.name()); } else { addNetworkInterfaceProperties(struct, vmInterface, vmDevice, VmInterfaceType.rtl8139.name()); } } else { addNetworkInterfaceProperties(struct, vmInterface, vmDevice, VmInterfaceType.pv.name()); XmlRpcStruct rtl8139Struct = new XmlRpcStruct(); addNetworkInterfaceProperties(rtl8139Struct, vmInterface, vmDevice, VmInterfaceType.rtl8139.name()); devices.add(rtl8139Struct); } } else { addNetworkInterfaceProperties(struct, vmInterface, vmDevice, ifaceType.toString()); } devices.add(struct); addToManagedDevices(vmDevice); } } }
Source:
<code>private boolean compareSequenceDictionaries(final SAMFileHeader h1, final SAMFileHeader h2) { final List<SAMSequenceRecord> s1 = h1.getSequenceDictionary().getSequences(); final List<SAMSequenceRecord> s2 = h2.getSequenceDictionary().getSequences(); if (s1.size() != s2.size()) { <START> reportDifference(s1.size(), s2.size(), "Length of sequence dictionaries"); <END> return false; } boolean ret = true; for (int i = 0; i < s1.size(); ++i) { ret = compareSequenceRecord(s1.get(i), s2.get(i), i + 1) && ret; } return ret; }</code><technical_language>this compareValues(s1.size(), s2.size(), "...")</technical_language>

Target:
private static boolean compareSequenceDictionaries(final SAMFileHeader h1, final SAMFileHeader h2) { final List<SAMSequenceRecord> s1 = h1.getSequenceDictionary().getSequences(); final List<SAMSequenceRecord> s2 = h2.getSequenceDictionary().getSequences(); if (s1.size() != s2.size()) { reportDifference(s1.size(), s2.size(), "Length of sequence dictionaries"); return false; } boolean ret = true; for (int i = 0; i < s1.size(); ++i) { ret = compareSequenceRecord(s1.get(i), s2.get(i), i + 1) && ret; } return ret; }
Source:
<code>public PoolDTO setBranding(Set<BrandingDTO> branding) { if (branding != null) { if (this.branding == null) { this.branding = new HashSet<BrandingDTO>(); } else { this.branding.clear(); } for (BrandingDTO dto : branding) { if (isNullOrIncomplete(dto)) { <START> throw new IllegalArgumentException("collection contains null " + <END> "or incomplete branding objects"); } } this.branding.addAll(branding); } else { this.branding = null; } return this; }</code><technical_language>Avoid breaking a string this for wrapping if possible, searching for error messages harder. If string fit (and I will, ignore if wrong), this style instead: throw new IllegalArgumentException( "collection contains null incomplete branding objects");</technical_language>

Target:
public PoolDTO setBranding(Set<BrandingDTO> branding) { if (branding != null) { if (this.branding == null) { this.branding = new HashSet<BrandingDTO>(); } else { this.branding.clear(); } for (BrandingDTO dto : branding) { if (isNullOrIncomplete(dto)) { throw new IllegalArgumentException( "collection contains null or incomplete branding objects"); } } this.branding.addAll(branding); } else { this.branding = null; } return this; }