auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public IPropertyDescriptor[] getPropertyDescriptors() { return new IPropertyDescriptor[] { new ReadOnlyTextPropertyDescriptor(TRACE_DOMAIN_NAME_PROPERTY_ID, TRACE_DOMAIN_NAME_PROPERTY_NAME), <START> new ReadOnlyTextPropertyDescriptor(BUFFER_TYPE_PROPERTY_ID, BUFER_TYPE_PROPERTY_NAME)}; <END> }</code><technical_language>In older versions (2.1 older) buffer type information is available. is (kernel=shared UST=per PID), need display it. check for BufferTypeConstants.BUFFER_TYPE_UNKNOWN omit for case</technical_language>

Target:
public IPropertyDescriptor[] getPropertyDescriptors() { if (fDomain.getBufferType().equals(BufferTypeConstants.BUFFER_TYPE_UNKNOWN)) { return new IPropertyDescriptor[] { new ReadOnlyTextPropertyDescriptor(TRACE_DOMAIN_NAME_PROPERTY_ID, TRACE_DOMAIN_NAME_PROPERTY_NAME) }; } return new IPropertyDescriptor[] { new ReadOnlyTextPropertyDescriptor(TRACE_DOMAIN_NAME_PROPERTY_ID, TRACE_DOMAIN_NAME_PROPERTY_NAME), new ReadOnlyTextPropertyDescriptor(BUFFER_TYPE_PROPERTY_ID, BUFER_TYPE_PROPERTY_NAME) }; }
Source:
<code>private boolean checkedIfValid(ReadHeadInfo readHead, VKmer neighbor) { int neighborPositionOnRead = getVertexValue().walkSize - getVertexValue().index; <START> return readHead.getThisReadSequence().getGeneCodeAtPosition(neighborPositionOnRead) == neighbor <END> .getGeneCodeAtPosition(kmerSize - 1); }</code><technical_language>this check if letters this position same. I describing this you, I meant information needed neighbor (in terms of sending a msg) a single letter. ReadHeadInfo compare full kmer, single letter</technical_language>

Target:
private boolean checkedIfValid(ReadHeadInfo readHead, VKmer neighbor) { int neighborPositionOnRead = getVertexValue().walkSize - getVertexValue().index; for (int i = 0; i < kmerSize; i++) { if (readHead.getThisReadSequence().getGeneCodeAtPosition(neighborPositionOnRead + i) != neighbor .getGeneCodeAtPosition(i)) { return false; } } return true; }
Source:
<code>public void addChangeListener_returnedObjectOfCopyToRealmOrUpdate() { <START> looperThread.realm.beginTransaction(); <END> looperThread.realm.createObject(AllTypesPrimaryKey.class, 1); AllTypesPrimaryKey allTypesPrimaryKey = new AllTypesPrimaryKey(); allTypesPrimaryKey.setColumnLong(1); allTypesPrimaryKey.setColumnFloat(42f); allTypesPrimaryKey = looperThread.realm.copyToRealmOrUpdate(allTypesPrimaryKey); looperThread.realm.commitTransaction(); allTypesPrimaryKey.addChangeListener(new RealmChangeListener<AllTypesPrimaryKey>() { @Override public void onChange(AllTypesPrimaryKey element) { assertEquals(42.0f, element.getColumnFloat(), 0f); looperThread.testComplete(); } }); }</code><technical_language>In other tests Realm realm = looperThread.realm; test easier read</technical_language>

Target:
public void addChangeListener_returnedObjectOfCopyToRealmOrUpdate() { Realm realm = looperThread.realm; realm.beginTransaction(); realm.createObject(AllTypesPrimaryKey.class, 1); AllTypesPrimaryKey allTypesPrimaryKey = new AllTypesPrimaryKey(); allTypesPrimaryKey.setColumnLong(1); allTypesPrimaryKey.setColumnFloat(42f); allTypesPrimaryKey = realm.copyToRealmOrUpdate(allTypesPrimaryKey); realm.commitTransaction(); allTypesPrimaryKey.addChangeListener(new RealmChangeListener<AllTypesPrimaryKey>() { @Override public void onChange(AllTypesPrimaryKey element) { assertEquals(42.0f, element.getColumnFloat(), 0f); looperThread.testComplete(); } }); }
Source:
<code>private void printScope(final Scope scope) { final Map<String, Set<ContextKey>> grouped = scope.keys().stream() .collect(Collectors.groupingBy(ContextKey::getContext, TreeMap::new, Collectors.toCollection(TreeSet::new))); for (final Map.Entry<String, Set<ContextKey>> group : grouped.entrySet()) { System.out.printf("%s:\n", group.getKey()); for (final ContextKey contextKey : group.getValue()) { <START> System.out.printf(" %s='%s'\n", contextKey.getKey(), scope.get(contextKey).isPresent() ? scope.get(contextKey).get() : ""); <END> } } }</code><technical_language>simplified .orElse("")</technical_language>

Target:
private void printScope(final Scope scope) { final Map<String, Set<ContextKey>> grouped = scope.keys().stream() .collect(Collectors.groupingBy(ContextKey::getContext, TreeMap::new, Collectors.toCollection(TreeSet::new))); for (final Map.Entry<String, Set<ContextKey>> group : grouped.entrySet()) { System.out.printf("%s:\n", group.getKey()); for (final ContextKey contextKey : group.getValue()) { System.out.printf(" %s='%s'\n", contextKey.getKey(), scope.get(contextKey).orElse("")); } } }
Source:
<code>protected void setQcowCompatByQemuImageInfo(Guid storagePoolId, Guid newImageGroupId, Guid newImageId, Guid newStorageDomainID, DiskImage diskImage) { VM vm = vmDao.getVmsWithPlugInfo(diskImage.getId()).stream(). <START> map(Pair::getFirst). <END> findFirst().get(); setQcowCompat(diskImage.getImage(), storagePoolId, newImageGroupId, newImageId, newStorageDomainID, vm.getRunOnVds()); }</code><technical_language>plugged check</technical_language>

Target:
protected void setQcowCompatByQemuImageInfo(Guid storagePoolId, Guid newImageGroupId, Guid newImageId, Guid newStorageDomainID, DiskImage diskImage) { Guid hostIdToExecuteQemuImageInfo = null; List<Pair<VM, VmDevice>> attachedVmsInfo = vmDao.getVmsWithPlugInfo(diskImage.getId()); Optional<Pair<VM, VmDevice>> pair = attachedVmsInfo.stream().findFirst(); if (pair.isPresent()) { VM vm = pair.get().getFirst(); if (Boolean.TRUE.equals(pair.get().getSecond().isPlugged())) { if (!vm.isDown()) { hostIdToExecuteQemuImageInfo = vm.getRunOnVds(); } } } setQcowCompat(diskImage.getImage(), storagePoolId, newImageGroupId, newImageId, newStorageDomainID, hostIdToExecuteQemuImageInfo); }
Source:
<code>private byte[] performKeyDerivationFunction(X509Certificate certificate, byte[] sharedSecret) throws Exception { <START> ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); <END> byteArrayOutputStream.write(COUNTER); byteArrayOutputStream.write(sharedSecret); byteArrayOutputStream.write(ALG_IDENTIFIER_BYTES.length); byteArrayOutputStream.write(ALG_IDENTIFIER_BYTES); byteArrayOutputStream.write(APPLE_OEM); byteArrayOutputStream.write(HexBin.decode(new String((certificate.getExtensionValue("1.2.840.113635.100.6.32")), UTF_8).substring(4))); return MessageDigest.getInstance("SHA256", "BC") .digest(byteArrayOutputStream.toByteArray()); }</code><technical_language>trust this is right (I understand this code is basically copied pasted Apple's examples)</technical_language>

Target:
private byte[] performKeyDerivationFunction(X509Certificate certificate, byte[] sharedSecret) throws Exception { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); byteArrayOutputStream.write(COUNTER); byteArrayOutputStream.write(sharedSecret); byteArrayOutputStream.write(ALG_IDENTIFIER_BYTES.length); byteArrayOutputStream.write(ALG_IDENTIFIER_BYTES); byteArrayOutputStream.write(APPLE_OEM); byteArrayOutputStream.write(Hex.decode(new String((certificate.getExtensionValue(MERCHANT_ID_CERTIFICATE_OID)), UTF_8).substring(4))); return MessageDigest.getInstance("SHA256", "BC") .digest(byteArrayOutputStream.toByteArray()); }
Source:
<code>void doSerializeInternal(ByteBuf buf) { ICorfuPayload.serialize(buf, type); if (type == DataType.DATA) { if (data == null) { int lengthIndex = buf.writerIndex(); buf.writeInt(0); if (hasPayloadCodec()) { ByteBuf serializeBuf = Unpooled.buffer(); Serializers.CORFU.serialize(payload.get(), serializeBuf); ByteBuffer wrappedByteBuf = ByteBuffer.wrap(serializeBuf.array(), 0, serializeBuf.readableBytes()); <START> ByteBuffer compressedBuf = getPayloadCodecType().getInstance().compress(wrappedByteBuf); <END> ICorfuPayload.serialize(buf, Unpooled.wrappedBuffer(compressedBuf)); setCompressedFlag(); } else { Serializers.CORFU.serialize(payload.get(), buf); } int size = buf.writerIndex() - (lengthIndex + 4); buf.writerIndex(lengthIndex); buf.writeInt(size); buf.writerIndex(lengthIndex + size + 4); } else { if (hasPayloadCodec() && !isCompressed()) { ByteBuffer compressedBuf = getPayloadCodecType().getInstance().compress(ByteBuffer.wrap(data)); ICorfuPayload.serialize(buf, Unpooled.wrappedBuffer(compressedBuf)); setCompressedFlag(); } else { ICorfuPayload.serialize(buf, data); } } } if (type.isMetadataAware()) { ICorfuPayload.serialize(buf, metadataMap); } }</code><technical_language>compress takes ByteBuffer instead of ByteBuf, conversion. expose compress instance takes ByteBuf Codec interface</technical_language>

Target:
void doSerializeInternal(ByteBuf buf) { ICorfuPayload.serialize(buf, type); if (type == DataType.DATA) { if (data == null) { int lengthIndex = buf.writerIndex(); buf.writeInt(0); if (hasPayloadCodec()) { ByteBuf serializeBuf = Unpooled.buffer(); Serializers.CORFU.serialize(payload.get(), serializeBuf); doCompressInternal(serializeBuf, buf); } else { Serializers.CORFU.serialize(payload.get(), buf); } int size = buf.writerIndex() - (lengthIndex + 4); buf.writerIndex(lengthIndex); buf.writeInt(size); buf.writerIndex(lengthIndex + size + 4); } else { if (hasPayloadCodec() && !isCompressed()) { doCompressInternal(Unpooled.wrappedBuffer(data), buf); } else { ICorfuPayload.serialize(buf, data); } } } if (type.isMetadataAware()) { ICorfuPayload.serialize(buf, metadataMap); } }
Source:
<code>public synchronized void reportResults(List<Survey> newSurveys, List<InAppNotification> newNotifications, JSONArray eventBindings, JSONArray variants) { boolean newContent = false; mUpdatesFromMixpanel.setEventBindings(eventBindings); for (final Survey s : newSurveys) { final int id = s.getId(); if (! mSurveyIds.contains(id)) { mSurveyIds.add(id); mUnseenSurveys.add(s); newContent = true; } } for (final InAppNotification n : newNotifications) { final int id = n.getId(); if (! mNotificationIds.contains(id)) { mNotificationIds.add(id); mUnseenNotifications.add(n); newContent = true; } } if (variants.length() > 0) { newContent = true; } <START> mVariants = variants; <END> if (MPConfig.DEBUG) { Log.v(LOGTAG, "New Decide content has become available. " + newSurveys.size() + " surveys and " + newNotifications.size() + " notifications and " + variants.length() + " experiments have been added."); } if (newContent && hasUpdatesAvailable() && null != mListener) { mListener.onNewResults(); } }</code><technical_language>please move this line if statement above? this is a function checks if mVariants is null. variants empty string (not null) if variant, breaks this check. public synchronized boolean hasUpdatesAvailable() { return (! mUnseenNotifications.isEmpty()) || (! mUnseenSurveys.isEmpty()) || mVariants != null; }</technical_language>

Target:
public synchronized void reportResults(List<Survey> newSurveys, List<InAppNotification> newNotifications, JSONArray eventBindings, JSONArray variants) { boolean newContent = false; mUpdatesFromMixpanel.setEventBindings(eventBindings); for (final Survey s : newSurveys) { final int id = s.getId(); if (! mSurveyIds.contains(id)) { mSurveyIds.add(id); mUnseenSurveys.add(s); newContent = true; } } for (final InAppNotification n : newNotifications) { final int id = n.getId(); if (! mNotificationIds.contains(id)) { mNotificationIds.add(id); mUnseenNotifications.add(n); newContent = true; } } if (variants.length() > 0) { mVariants = variants; newContent = true; } if (MPConfig.DEBUG) { Log.v(LOGTAG, "New Decide content has become available. " + newSurveys.size() + " surveys and " + newNotifications.size() + " notifications and " + variants.length() + " experiments have been added."); } if (newContent && hasUpdatesAvailable() && null != mListener) { mListener.onNewResults(); } }
Source:
<code>public static Object jsonValueAny(Object input, SqlJsonValueEmptyOrErrorBehavior emptyBehavior, Object defaultValueOnEmpty, SqlJsonValueEmptyOrErrorBehavior errorBehavior, Object defaultValueOnError) { PathContext context = (PathContext) input; Exception exc; if (context.exc != null) { exc = context.exc; } else { Object value = context.pathReturned; if (value == null || context.mode == PathMode.LAX && !isScalarObject(value)) { switch (emptyBehavior) { case ERROR: throw new RuntimeException("empty json value"); case NULL: return null; case DEFAULT: return defaultValueOnEmpty; default: throw new RuntimeException("illegal empty behavior: " + emptyBehavior); } } else if (context.mode == PathMode.STRICT && !isScalarObject(value)) { <START> exc = new RuntimeException("not a json value: " + value); <END> } else { return value; } } switch (errorBehavior) { case ERROR: throw new RuntimeException(exc); case NULL: return null; case DEFAULT: return defaultValueOnError; default: throw new RuntimeException("illegal error behavior: " + errorBehavior); } }</code><technical_language>I if RuntimeExceptions for errors this. CalciteResource used? message user more understand resolve failure? E.g. "strict jsonpath mode requires scalar value, actual is: ..."</technical_language>

Target:
public static Object jsonValueAny(Object input, SqlJsonValueEmptyOrErrorBehavior emptyBehavior, Object defaultValueOnEmpty, SqlJsonValueEmptyOrErrorBehavior errorBehavior, Object defaultValueOnError) { PathContext context = (PathContext) input; Exception exc; if (context.exc != null) { exc = context.exc; } else { Object value = context.pathReturned; if (value == null || context.mode == PathMode.LAX && !isScalarObject(value)) { switch (emptyBehavior) { case ERROR: throw RESOURCE.emptyResultOfJsonValueFuncNotAllowed().ex(); case NULL: return null; case DEFAULT: return defaultValueOnEmpty; default: throw RESOURCE.illegalEmptyBehaviorInJsonValueFunc(emptyBehavior.toString()).ex(); } } else if (context.mode == PathMode.STRICT && !isScalarObject(value)) { exc = RESOURCE.scalarValueRequiredInStrictModeOfJsonValueFunc(value.toString()).ex(); } else { return value; } } switch (errorBehavior) { case ERROR: throw toUnchecked(exc); case NULL: return null; case DEFAULT: return defaultValueOnError; default: throw RESOURCE.illegalErrorBehaviorInJsonValueFunc(errorBehavior.toString()).ex(); } }
Source:
<code>public void setUserMetadata(String userMetadata) { if (userMetadata == null) { <START> throw new IllegalArgumentException("Value cannot be null."); <END> } if (userMetadata.length() > ManagementClientConstants.MAX_USERMETADATA_LENGTH) { throw new IllegalArgumentException("Length cannot cross " + ManagementClientConstants.MAX_USERMETADATA_LENGTH + " characters"); } this.userMetadata = userMetadata; }</code><technical_language>Replace Objects.requireNotNull</technical_language>

Target:
public void setUserMetadata(String userMetadata) { Objects.requireNonNull(userMetadata, "'userMetadata' cannot be null."); if (userMetadata.length() > ManagementClientConstants.MAX_USERMETADATA_LENGTH) { throw new IllegalArgumentException("Length cannot cross " + ManagementClientConstants.MAX_USERMETADATA_LENGTH + " characters"); } this.userMetadata = userMetadata; }
Source:
<code>static public void saveFile(String str, File file) throws IOException { File temp = File.createTempFile(file.getName(), null, file.getParentFile()); PApplet.saveStrings(temp, new String[] { str }); try { File canon = file.getCanonicalFile(); <START> file = canon; <END> } catch (IOException e) { } if (file.exists()) { boolean result = file.delete(); if (!result) { throw new IOException( I18n.format( tr("Could not remove old version of {0}"), file.getAbsolutePath())); } } boolean result = temp.renameTo(file); if (!result) { throw new IOException( I18n.format( tr("Could not replace {0}"), file.getAbsolutePath())); } }</code><technical_language>I this file = file.getCanonicalFile();. If getCanonicalFile() throws, assignment executed</technical_language>

Target:
static public void saveFile(String str, File file) throws IOException { File temp = File.createTempFile(file.getName(), null, file.getParentFile()); PApplet.saveStrings(temp, new String[] { str }); try { file = file.getCanonicalFile(); } catch (IOException e) { } if (file.exists()) { boolean result = file.delete(); if (!result) { throw new IOException( I18n.format( tr("Could not remove old version of {0}"), file.getAbsolutePath())); } } boolean result = temp.renameTo(file); if (!result) { throw new IOException( I18n.format( tr("Could not replace {0}"), file.getAbsolutePath())); } }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_browser); urls = new ArrayList<>(); try { JSONObject payload = new JSONObject(getIntent().getStringExtra("payload")); String href = payload.getString("href"); urls.add(href); JSONArray alt_hrefs = payload.getJSONArray("alt_hrefs"); for(int i=0; i< alt_hrefs.length(); i++) { urls.add(alt_hrefs.getString(i)); } Log.d(TAG, "Message data urls: " + urls); } catch (JSONException e){ <START> System.out.println("JSONException "+ e); <END> } initViews(); setUpWebView(); reloadButtons(); setListeners(); }</code><technical_language>finish(); is</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_browser); urls = new ArrayList<>(); try { JSONObject payload = new JSONObject(getIntent().getStringExtra("payload")); String href = payload.getString("href"); urls.add(href); JSONArray alt_hrefs = payload.getJSONArray("alt_hrefs"); for(int i=0; i< alt_hrefs.length(); i++) { urls.add(alt_hrefs.getString(i)); } Log.d(TAG, "Message data urls: " + urls); } catch (JSONException e){ System.out.println("JSONException "+ e); finish(); } initViews(); setUpWebView(); reloadButtons(); setListeners(); }
Source:
<code>public String generateLogMessage() { return Const.ActivityLog.TEAMMATESLOG + Const.ActivityLog.FIELD_SEPARATOR + actionName + Const.ActivityLog.FIELD_SEPARATOR + actionResponse + Const.ActivityLog.FIELD_SEPARATOR + logToShow + Const.ActivityLog.FIELD_SEPARATOR + userRole + (isMasqueradeUserRole ? "(M)" : "") + Const.ActivityLog.FIELD_SEPARATOR <START> + userName + Const.ActivityLog.FIELD_SEPARATOR + userGoogleId <END> + Const.ActivityLog.FIELD_SEPARATOR + userEmail + Const.ActivityLog.FIELD_SEPARATOR + logMessage + Const.ActivityLog.FIELD_SEPARATOR + actionUrl + Const.ActivityLog.FIELD_SEPARATOR + logId; }</code><technical_language>consider putting userGoogleId next line for consistency</technical_language>

Target:
public String generateLogMessage() { return Const.ActivityLog.TEAMMATESLOG + Const.ActivityLog.FIELD_SEPARATOR + actionName + Const.ActivityLog.FIELD_SEPARATOR + actionResponse + Const.ActivityLog.FIELD_SEPARATOR + logToShow + Const.ActivityLog.FIELD_SEPARATOR + userRole + (isMasqueradeUserRole ? Const.ActivityLog.ROLE_MASQUERADE_POSTFIX : "") + Const.ActivityLog.FIELD_SEPARATOR + userName + Const.ActivityLog.FIELD_SEPARATOR + userGoogleId + Const.ActivityLog.FIELD_SEPARATOR + userEmail + Const.ActivityLog.FIELD_SEPARATOR + logMessage + Const.ActivityLog.FIELD_SEPARATOR + actionUrl + Const.ActivityLog.FIELD_SEPARATOR + logId; }
Source:
<code>protected void onDoneImpl(Exception e) { if (e != null) Exceptions.propagateIfFatal(e); List<Exception> exceptions = Lists.newArrayList(); if (e != null) { exceptions.add(e); } if (danglingRefFailureMode != RebindFailureMode.CONTINUE) { if (missingEntities.size() > 0) { exceptions.add(new IllegalStateException("Missing referenced entit"+(missingEntities.size() == 1 ? "y" : "ies")+": "+missingEntities)); } if (missingLocations.size() > 0) { exceptions.add(new IllegalStateException("Missing referenced location"+(missingEntities.size() == 1 ? "" : "s")+": "+missingLocations)); } } <START> if (rebindFailureMode != RebindFailureMode.CONTINUE) { <END> exceptions.addAll(loadMementoFailures); exceptions.addAll(createLocationFailures.values()); exceptions.addAll(createEntityFailures.values()); exceptions.addAll(createPolicyFailures.values()); exceptions.addAll(rebindLocationFailures.values()); exceptions.addAll(rebindEntityFailures.values()); exceptions.addAll(rebindPolicyFailures.values()); exceptions.addAll(manageLocationFailures.values()); exceptions.addAll(manageEntityFailures.values()); exceptions.addAll(locationNotFoundFailures.values()); exceptions.addAll(entityNotFoundFailures.values()); exceptions.addAll(policyNotFoundFailures.values()); } if (exceptions.isEmpty()) { return; } else { CompoundRuntimeException compoundException = new CompoundRuntimeException("Problem"+(exceptions.size() == 1 ? "" : "s")+" rebinding", exceptions); LOG.info("RebindManager failed (throwing): "+compoundException.toString()); throw compoundException; } }</code><technical_language>Refactor this a single List of exceptions</technical_language>

Target:
protected void onDoneImpl(Exception e) { if (e != null) Exceptions.propagateIfFatal(e); List<Exception> allExceptions = Lists.newArrayList(); if (e != null) { allExceptions.add(e); } if (danglingRefFailureMode != RebindFailureMode.CONTINUE) { if (missingEntities.size() > 0) { allExceptions.add(new IllegalStateException("Missing referenced entit"+(missingEntities.size() == 1 ? "y" : "ies")+": "+missingEntities)); } if (missingLocations.size() > 0) { allExceptions.add(new IllegalStateException("Missing referenced location"+(missingEntities.size() == 1 ? "" : "s")+": "+missingLocations)); } } if (rebindFailureMode != RebindFailureMode.CONTINUE) { allExceptions.addAll(exceptions); } if (allExceptions.isEmpty()) { return; } else { CompoundRuntimeException compoundException = new CompoundRuntimeException("Problem"+(allExceptions.size() == 1 ? "" : "s")+" rebinding", allExceptions); LOG.info("RebindManager failed (throwing): "+compoundException.toString()); throw compoundException; } }
Source:
<code>private boolean matchesAnyCookieName(String cookieString, String... cookieNames) { <START> if (StringUtils.isEmpty(cookieString) || ArrayUtils.isEmpty(cookieNames)) { <END> return false; } return Arrays.stream(cookieNames).anyMatch(name -> matchesCookieName(cookieString, name)); }</code><technical_language>this separate if statement return isEmpty(cookieString) || isEmpty(cookieNames) || Arrays.stream(...</technical_language>

Target:
private boolean matchesAnyCookieName(String cookieString, String... cookieNames) { boolean isEmpty = StringUtils.isEmpty(cookieString) || ArrayUtils.isEmpty(cookieNames); return isEmpty || Arrays.stream(cookieNames) .anyMatch(name -> matchesCookieName(cookieString, name)); }
Source:
<code>public boolean equals(Object other) { <START> return other == this || other instanceof Instance <END> && this.displayName.equals(((Instance) other).displayName) && this.jrFormId.equals(((Instance) other).jrFormId) && this.instanceFilePath.equals(((Instance) other).instanceFilePath); }</code><technical_language>pick subset of fields include here? For example, fields? display name version? instance file path instanceId</technical_language>

Target:
public boolean equals(Object other) { return other == this || other instanceof Instance && this.instanceFilePath.equals(((Instance) other).instanceFilePath); }
Source:
<code>public void testSetPropertiesAndGroups() throws AccumuloSecurityException, AccumuloException, TableExistsException, TableNotFoundException { Connector conn = getConnector(); String tableName = getUniqueNames(2)[0]; NewTableConfiguration ntc = new NewTableConfiguration(); Map<String,String> props = new HashMap<>(); props.put("prop1", "val1"); props.put("prop2", "val2"); ntc.setProperties(props); Map<String,Set<Text>> lgroups = new HashMap<>(); lgroups.put("lg1", ImmutableSet.of(new Text("dog"))); ntc.setLocalityGroups(lgroups); conn.tableOperations().create(tableName, ntc); <START> Map<String,String> ntcProps = ntc.getProperties(); <END> assertEquals(ntcProps.get("prop1"), "val1"); assertEquals(ntcProps.get("prop2"), "val2"); assertEquals(ntcProps.get("table.group.lg1"), "dog"); assertEquals(ntcProps.get("table.groups.enabled"), "lg1"); Map<String,Set<Text>> createdLocalityGroups = conn.tableOperations().getLocalityGroups(tableName); assertEquals(1, createdLocalityGroups.size()); assertEquals(createdLocalityGroups.get("lg1"), ImmutableSet.of(new Text("dog"))); }</code><technical_language>get props table</technical_language>

Target:
public void testSetPropertiesAndGroups() throws AccumuloSecurityException, AccumuloException, TableExistsException, TableNotFoundException { Connector conn = getConnector(); String tableName = getUniqueNames(2)[0]; NewTableConfiguration ntc = new NewTableConfiguration(); Map<String,String> props = new HashMap<>(); props.put(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop1", "val1"); props.put(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop2", "val2"); ntc.setProperties(props); Map<String,Set<Text>> lgroups = new HashMap<>(); lgroups.put("lg1", ImmutableSet.of(new Text("dog"))); ntc.setLocalityGroups(lgroups); conn.tableOperations().create(tableName, ntc); int count = 0; for (Entry<String,String> property : conn.tableOperations().getProperties(tableName)) { if (property.getKey().equals("table.group.lg1")) { assertEquals(property.getValue(), "dog"); count++; } if (property.getKey().equals("table.groups.enabled")) { assertEquals(property.getValue(), "lg1"); count++; } if (property.getKey().equals(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop1")) { assertEquals(property.getValue(), "val1"); count++; } if (property.getKey().equals(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop2")) { assertEquals(property.getValue(), "val2"); count++; } } assertEquals(4, count); Map<String,Set<Text>> createdLocalityGroups = conn.tableOperations().getLocalityGroups(tableName); assertEquals(1, createdLocalityGroups.size()); assertEquals(createdLocalityGroups.get("lg1"), ImmutableSet.of(new Text("dog"))); }
Source:
<code>public void testCanDoAction() { expectGetStoragePool(STORAGE_POOL_ID); expectGetStorageDomain(STORAGE_DOMAIN_ID, STORAGE_POOL_ID, StorageDomainType.Data, StorageType.NFS); expectGetVds(VDS_ID); expectGetIsoMap(STORAGE_DOMAIN_ID); expectBusinessEntitySnapshotDAO(); RemoveStorageDomainCommand<RemoveStorageDomainParameters> cmd = createCommand(true); assertTrue(cmd.canDoAction()); <START> checkSucceeded(cmd, false); <END> cmd.setActionMessageParameters(); checkMessages(cmd, VdcBllMessages.VAR__TYPE__STORAGE__DOMAIN, VdcBllMessages.VAR__ACTION__REMOVE); }</code><technical_language>called automatically</technical_language>

Target:
public void testCanDoAction() { expectGetStoragePool(STORAGE_POOL_ID); expectGetStorageDomain(STORAGE_DOMAIN_ID, STORAGE_POOL_ID, StorageDomainType.Data, StorageType.NFS); expectGetVds(VDS_ID); expectGetIsoMap(STORAGE_DOMAIN_ID); expectBusinessEntitySnapshotDAO(); RemoveStorageDomainCommand<RemoveStorageDomainParameters> cmd = createCommand(true); assertTrue(cmd.canDoAction()); checkSucceeded(cmd, false); assertEquals("Wrong number of messages", 0, cmd.getReturnValue().getCanDoActionMessages().size()); }
Source:
<code>RuntimeException map(ProcessingException e) { if (e.getCause() instanceof SSLException) { String sslExceptionMessage = e.getCause().getMessage(); if (sslExceptionMessage != null && sslExceptionMessage.contains("protocol_version")) { return new ConfigurationException( "Invalid TLS protocol version. This will typically happen if you're running on an older Java version, which doesn't support TLS 1.2. " + "Java 7 needs to be explicitly configured to support TLS 1.2. See 'JSSE tuning parameters' at " + "<LINK_0>", e); } } if (e.getCause() instanceof SSLHandshakeException) { return new SignatureException( "Unable to perform SSL handshake with remote server. Some possible causes (could be others, see underlying error): \n" + <START> "* A certification with the wrong KeyUsage was used. Verify that the certificate's KeyUsage is compliant with the requirements for 2-way TLS. (E.g. KeyUsage should not be 'nonRepudiation')" + <END> "* Erroneous configuration of the trust store\n" + "* Intermediate network devices interfering with traffic (e.g. proxies)\n" + "* An attacker impersonating the server (man in the middle)\n" + "* Wrong TLS version. For Java 7, see 'JSSE tuning parameters' at <LINK_1> for information about enabling the latest TLS versions", e); } return e; }</code><technical_language>Endre til "A certificate wrong KeyUsage" kanskje? :)</technical_language>

Target:
RuntimeException map(ProcessingException e) { if (e.getCause() instanceof SSLException) { String sslExceptionMessage = e.getCause().getMessage(); if (sslExceptionMessage != null && sslExceptionMessage.contains("protocol_version")) { return new ConfigurationException( "Invalid TLS protocol version. This will typically happen if you're running on an older Java version, which doesn't support TLS 1.2. " + "Java 7 needs to be explicitly configured to support TLS 1.2. See 'JSSE tuning parameters' at " + "<LINK_0>", e); } } if (e.getCause() instanceof SSLHandshakeException) { return new SignatureException( "Unable to perform SSL handshake with remote server. Some possible causes (could be others, see underlying error): \n" + "* A certificate with the wrong KeyUsage was used. Verify that the certificate's KeyUsage is compliant with the requirements for 2-way TLS. (E.g. KeyUsage should not be 'nonRepudiation')" + "* Erroneous configuration of the trust store\n" + "* Intermediate network devices interfering with traffic (e.g. proxies)\n" + "* An attacker impersonating the server (man in the middle)\n" + "* Wrong TLS version. For Java 7, see 'JSSE tuning parameters' at <LINK_1> for information about enabling the latest TLS versions", e); } return e; }
Source:
<code>public static <T extends Oaf> JavaPairRDD<Text, Text> mapActionToText(JavaRDD<AtomicAction<T>> actions) { <START> ObjectMapper objectMapper = new ObjectMapper(); <END> return actions.mapToPair(action -> new Tuple2<>(new Text(""), new Text(serializeAction(action, objectMapper)))); }</code><technical_language>ObjectMapper a static variable</technical_language>

Target:
public static <T extends Oaf> JavaPairRDD<Text, Text> mapActionToText(JavaRDD<AtomicAction<T>> actions) { return actions.mapToPair(action -> new Tuple2<>(emptyText, new Text(serializeAction(action, objectMapper)))); }
Source:
<code>private boolean shouldCutPattern(int patternWidth, boolean isLeft) { <START> return isLeft ? patternWidth > articleLeftSideX : <END> patternWidth > viewPortWidth - articleRightSideX; }</code><technical_language>please replace regular if/else</technical_language>

Target:
private boolean shouldCutPattern(int patternWidth, boolean isLeft) { if (isLeft) { return patternWidth > articleLeftSideX; } else { return patternWidth > viewPortWidth - articleRightSideX; } }
Source:
<code>public boolean remove(String id) { <START> return this.id2descriptors.removeAll(id) != null; <END> }</code><technical_language>return "!this.id2descriptors.removeAll(id).isEmpty();" in LegacyPropertyContributorRegistry.java</technical_language>

Target:
public boolean remove(String id) { return !this.id2descriptors.removeAll(id).isEmpty(); }
Source:
<code>private void clickEditInstructorButton(int instrNum) { click(getEditInstructorButton(instrNum)); <START> waitForPageToLoad(true); <END> }</code><technical_language>event is waited for here</technical_language>

Target:
private void clickEditInstructorButton(int instrNum) { click(getEditInstructorButton(instrNum)); }
Source:
<code>public void setNL(String nl) { incrementSequenceNumber(); fNL = nl; if (fRoot != null && nl != null && <START> nl.length() <END> > 0) { Element nlNode = TargetDefinitionDocumentTools.getChildElement(fRoot, TargetDefinitionPersistenceHelper.ENVIRONMENT, TargetDefinitionPersistenceHelper.NL); nlNode.setTextContent(nl); } else { removeElement(TargetDefinitionPersistenceHelper.ENVIRONMENT, TargetDefinitionPersistenceHelper.NL); } }</code><technical_language>Please !string.isEmpty()</technical_language>

Target:
public void setNL(String nl) { incrementSequenceNumber(); fNL = nl; if (fRoot != null && nl != null && !nl.isEmpty()) { Element nlNode = TargetDefinitionDocumentTools.getChildElement(fRoot, TargetDefinitionPersistenceHelper.ENVIRONMENT, TargetDefinitionPersistenceHelper.NL); nlNode.setTextContent(nl); } else { removeElement(TargetDefinitionPersistenceHelper.ENVIRONMENT, TargetDefinitionPersistenceHelper.NL); } }
Source:
<code>private Object ensureNoUnderflow(Object val) { <START> if (val instanceof Double) { <END> if (Math.abs((Double) val) <= 1.0e-131) { return ZERO; } } return val; }</code><technical_language>not: java if (val instanceof Double && Math.abs((Double) val) <= 1.0e-131) { return ZERO; } return val;</technical_language>

Target:
private Object ensureNoUnderflow(Object val) { if (val instanceof Double && Math.abs((Double) val) <= 1.0e-131) { return ZERO; } return val; }
Source:
<code>public void close() { long totalTimeMillis = currentTimeMillis() - startTime; <START> String additionalInformation = getState( DataStatistics.class ).toString(); <END> executionMonitor.done( totalTimeMillis, format( "%n%s%nPeak memory usage: %s", additionalInformation, bytes( peakMemoryUsage ) ) ); log.info( "Import completed successfully, took " + duration( totalTimeMillis ) + ". " + additionalInformation ); if ( nodeRelationshipCache != null ) { nodeRelationshipCache.close(); } if ( nodeLabelsCache != null ) { nodeLabelsCache.close(); } if ( idMapper != null ) { idMapper.close(); } inputCache.close(); }</code><technical_language>test is missing confirms case reporting works expected</technical_language>

Target:
public void close() throws IOException { long totalTimeMillis = currentTimeMillis() - startTime; String additionalInformation = getState( DataStatistics.class ).toString(); executionMonitor.done( totalTimeMillis, format( "%n%s%nPeak memory usage: %s", additionalInformation, bytes( peakMemoryUsage ) ) ); log.info( "Import completed successfully, took " + duration( totalTimeMillis ) + ". " + additionalInformation ); closeAll( nodeRelationshipCache, nodeLabelsCache, idMapper, inputCache ); }
Source:
<code>protected static boolean compareLT(Object l, Object r) { if (l == null) { return false; } else if (!(l instanceof String || l instanceof Number && !(l instanceof Float))) { String msg = String.format("Value in document not a Number or String: %s", l); logger.log(Level.WARNING, msg); return false; } else if (l instanceof String) { if (r instanceof Number) { return false; } String lStr = (String) l; String rStr = (String) r; return lStr.compareTo(rStr) < 0; } else if (r instanceof String) { return true; } else { Number lNum = (Number) l; Number rNum = (Number) r; <START> return lNum.longValue() < rNum.longValue(); <END> } }</code><technical_language>This fails for, e.g., 1.1 < 1.2</technical_language>

Target:
protected static boolean compareLT(Object l, Object r) { if (l == null || r == null) { return false; } else if (!(l instanceof String || l instanceof Number)) { String msg = String.format("Value in document not a Number or String: %s", l); logger.log(Level.WARNING, msg); return false; } else if (l instanceof String) { if (r instanceof Number) { return false; } String lStr = (String) l; String rStr = (String) r; return lStr.compareTo(rStr) < 0; } else if (r instanceof String) { return true; } else { Number lNum = (Number) l; Number rNum = (Number) r; if (l instanceof Float || r instanceof Float) { String msg = String.format("Value in comparison is a Float: %s, %s", l, r); logger.log(Level.WARNING, msg); return false; } else { return lNum.doubleValue() < rNum.doubleValue(); } } }
Source:
<code><START> public void setEnableAcl(Boolean enableAcl) <END> { this.enableAcl = enableAcl; }</code><technical_language>allright reasonable. Preconditions.notNull(enableAcl, "enableAcl") then</technical_language>

Target:
public void setEnableAcl(Boolean enableAcl) { Preconditions.checkNotNull(enableAcl, "enableAcl"); this.enableAcl = enableAcl; }
Source:
<code>public List<InputRow> parseInputRows(String line) throws IOException, ParseException { final Map<String, Object> zipped = parseLine(line); return Collections.singletonList( <START> MapInputRowParser.parse( <END> getInputRowSchema().getTimestampSpec(), getInputRowSchema().getDimensionsSpec(), zipped ) ); }</code><technical_language>add a version of MapInputRowParser.parse takes InputRowSchema providing timestamp dimension specs common</technical_language>

Target:
public List<InputRow> parseInputRows(String line) throws IOException, ParseException { final Map<String, Object> zipped = parseLine(line); return Collections.singletonList(MapInputRowParser.parse(getInputRowSchema(), zipped)); }
Source:
<code>public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getHost() == null) ? 0 : getHost().hashCode()); result = prime * result + ((getPort() == null) ? 0 : getPort().hashCode()); result = prime * result + ((getUsername() == null) ? 0 : getUsername().hashCode()); result = prime * result + ((getPassword() == null) ? 0 : getPassword().hashCode()); result = prime * result + (isUseAuthentication() ? 1231 : 1237); result = prime * result + (isUseSmtps() ? 1231 : 1237); result = prime * result + (isUseStartTls() ? 1231 : 1237); result = prime * result + ((getSslProtocols() == null) ? 0 : getSslProtocols().hashCode()); result = prime * result + ((getAdditionalSessionProperties() == null) ? 0 : getAdditionalSessionProperties().hashCode()); <START> result = prime * result + m_poolSize; <END> return result; }</code><technical_language>Other properties getter, m_poolSize is --> consistent. implementations hand-crafted. generated automatically Eclipse</technical_language>

Target:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((m_additionalSessionProperties == null) ? 0 : m_additionalSessionProperties.hashCode()); result = prime * result + ((m_host == null) ? 0 : m_host.hashCode()); result = prime * result + ((m_password == null) ? 0 : m_password.hashCode()); result = prime * result + m_poolSize; result = prime * result + ((m_port == null) ? 0 : m_port.hashCode()); result = prime * result + ((m_sslProtocols == null) ? 0 : m_sslProtocols.hashCode()); result = prime * result + (m_useAuthentication ? 1231 : 1237); result = prime * result + (m_useSmtps ? 1231 : 1237); result = prime * result + (m_useStartTls ? 1231 : 1237); result = prime * result + ((m_username == null) ? 0 : m_username.hashCode()); return result; }
Source:
<code>private static void registerClusteredLockManager(GlobalComponentRegistry registry, CompletableFuture<CacheHolder> future) { synchronized (registry) { ClusteredLockManager counterManager = registry.getComponent(ClusteredLockManager.class); <START> if (counterManager == null || !(counterManager instanceof EmbeddedClusteredLockManager)) { <END> counterManager = new EmbeddedClusteredLockManager(future); registry.registerComponent(counterManager, ClusteredLockManager.class); registry.getComponent(CacheManagerJmxRegistration.class).start(); } } }</code><technical_language>counterManager</technical_language>

Target:
private static void registerClusteredLockManager(GlobalComponentRegistry registry, CompletableFuture<CacheHolder> future) { synchronized (registry) { ClusteredLockManager clusteredLockManager = registry.getComponent(ClusteredLockManager.class); if (clusteredLockManager == null || !(clusteredLockManager instanceof EmbeddedClusteredLockManager)) { clusteredLockManager = new EmbeddedClusteredLockManager(future); registry.registerComponent(clusteredLockManager, ClusteredLockManager.class); registry.getComponent(CacheManagerJmxRegistration.class).start(); } } }
Source:
<code>public static Type resolveType(Type type, Type contextType) { <START> return resolveType((TypeVariable<? extends Class<?>>) type, contextType); <END> }</code><technical_language>need a backup plan if type a TypeVariable</technical_language>

Target:
public static Type resolveType(Type type, Type contextType) { return GenericTypeReflector.resolveType(type, contextType); }
Source:
<code>private boolean cullCrop(ICrop crop, IFarmLogic provider) { for (IFarmListener listener : farmListeners) { if (listener.beforeCropHarvest(crop)) { return true; } } <START> final int fertilizerConsumption = (int)(provider.getFertilizerConsumption() * Config.fertilizerModifier); <END> IErrorLogic errorLogic = getErrorLogic(); Boolean hasFertilizer = fertilizerManager.hasFertilizer(inventory, fertilizerConsumption); if (errorLogic.setCondition(!hasFertilizer, EnumErrorCode.NO_FERTILIZER)) { return false; } float hydrationModifier = hydrationManager.getHydrationModifier(); int waterConsumption = provider.getWaterConsumption(hydrationModifier); FluidStack requiredLiquid = new FluidStack(FluidRegistry.WATER, waterConsumption); boolean hasLiquid = requiredLiquid.amount == 0 || hasLiquid(requiredLiquid); if (errorLogic.setCondition(!hasLiquid, EnumErrorCode.NO_LIQUID_FARM)) { return false; } NonNullList<ItemStack> harvested = crop.harvest(); if (harvested != null) { fertilizerManager.removeFertilizer(inventory, fertilizerConsumption); removeLiquid(requiredLiquid); for (IFarmListener listener : farmListeners) { listener.afterCropHarvest(harvested, crop); } inventory.stowHarvest(harvested, pendingProduce); } return true; }</code><technical_language>I in some cases important Math.round( instead of casting (int) for these. more correct</technical_language>

Target:
private boolean cullCrop(ICrop crop, IFarmLogic provider) { for (IFarmListener listener : farmListeners) { if (listener.beforeCropHarvest(crop)) { return true; } } final int fertilizerConsumption = Math.round(provider.getFertilizerConsumption() * Config.fertilizerModifier); IErrorLogic errorLogic = getErrorLogic(); Boolean hasFertilizer = fertilizerManager.hasFertilizer(inventory, fertilizerConsumption); if (errorLogic.setCondition(!hasFertilizer, EnumErrorCode.NO_FERTILIZER)) { return false; } float hydrationModifier = hydrationManager.getHydrationModifier(); int waterConsumption = provider.getWaterConsumption(hydrationModifier); FluidStack requiredLiquid = new FluidStack(FluidRegistry.WATER, waterConsumption); boolean hasLiquid = requiredLiquid.amount == 0 || hasLiquid(requiredLiquid); if (errorLogic.setCondition(!hasLiquid, EnumErrorCode.NO_LIQUID_FARM)) { return false; } NonNullList<ItemStack> harvested = crop.harvest(); if (harvested != null) { fertilizerManager.removeFertilizer(inventory, fertilizerConsumption); removeLiquid(requiredLiquid); for (IFarmListener listener : farmListeners) { listener.afterCropHarvest(harvested, crop); } inventory.stowHarvest(harvested, pendingProduce); } return true; }
Source:
<code>public Object visit(PropertyIsEqualTo filter, Object data) { LOGGER.trace("ENTERING: PropertyIsEqualTo filter"); OpenSearchFilterVisitorObject openSearchFilterVisitorObject = getOpenSearchFilterVisitorObjectFromData(data); if (openSearchFilterVisitorObject == null) { return data; } if (openSearchFilterVisitorObject.getCurrentNest() != NestedTypes.NOT) { final Expression expression1 = filter.getExpression1(); if (expression1 instanceof PropertyName) { <START> final String propertyName = ((PropertyName) expression1).getPropertyName(); <END> final String expectedPropertyIsEqualToTerm = Metacard.ID; if (StringUtils.equals(expectedPropertyIsEqualToTerm, propertyName)) { final Expression expression2 = filter.getExpression2(); if (expression2 instanceof Literal) { openSearchFilterVisitorObject.setId((String) ((Literal) expression2).getValue()); } } else { LOGGER.debug( "The OpenSearch Source only supports PropertyIsEqualTo criteria on the term \"{}\", but the property name is \"{}\". Ignoring filter.", expectedPropertyIsEqualToTerm, propertyName); } } } LOGGER.trace("EXITING: PropertyIsEqualTo filter"); return super.visit(filter, data); }</code><technical_language>Is this local variable for clarity</technical_language>

Target:
public Object visit(PropertyIsEqualTo filter, Object data) { LOGGER.trace("ENTERING: PropertyIsEqualTo filter"); OpenSearchFilterVisitorObject openSearchFilterVisitorObject = getOpenSearchFilterVisitorObjectFromData(data); if (openSearchFilterVisitorObject == null) { return data; } if (openSearchFilterVisitorObject.getCurrentNest() != NestedTypes.NOT) { final Expression expression1 = filter.getExpression1(); if (expression1 instanceof PropertyName) { final String propertyName = ((PropertyName) expression1).getPropertyName(); final String expectedPropertyIsEqualToTerm = Metacard.ID; if (expectedPropertyIsEqualToTerm.equals(propertyName)) { final Expression expression2 = filter.getExpression2(); if (expression2 instanceof Literal) { openSearchFilterVisitorObject.setId((String) ((Literal) expression2).getValue()); } } else { LOGGER.debug( "The OpenSearch Source only supports PropertyIsEqualTo criteria on the term \"{}\", but the property name is \"{}\". Ignoring filter.", expectedPropertyIsEqualToTerm, propertyName); } } } LOGGER.trace("EXITING: PropertyIsEqualTo filter"); return super.visit(filter, data); }
Source:
<code>public static Archive createDeplyoment() { final EnterpriseArchive ear = create(EnterpriseArchive.class, "ear-with-rar.ear") .addAsModule(create(JavaArchive.class, "telnet-ra.rar") .addAsManifestResource(TelnetResourceAdapter.class.getPackage(), "ra.xml", "ra.xml") .addPackages(true, TelnetResourceAdapter.class.getPackage(), TelnetListener.class.getPackage(), TelnetServer.class.getPackage())) .addAsModule(create(JavaArchive.class, "mdb.jar") .addClasses(MyMdb.class)); ear.addAsManifestResource(createPermissionsXmlAsset( new PropertyPermission("*", "read,write"), new RuntimePermission("accessDeclaredMembers"), new RuntimePermission("defineClassInPackage." + MyMdb.class.getPackage().getName()), new RuntimePermission("getClassLoader"), new SocketPermission(Utils.getDefaultHost(true), "accept,listen"), <START> new SocketPermission("localhost", "listen")), <END> "permissions.xml"); return ear; }</code><technical_language>91-95 be: new SocketPermission("*", "accept,listen"), TelnetServer is opening a socket listens wildcard address: this.serverSocket = new ServerSocket(port); "*" deal fact in a more robust manner get seemingly bizarre in SecurityManager.checkListen, match localhost</technical_language>

Target:
public static Archive createDeplyoment() { final EnterpriseArchive ear = create(EnterpriseArchive.class, "ear-with-rar.ear") .addAsModule(create(JavaArchive.class, "telnet-ra.rar") .addAsManifestResource(TelnetResourceAdapter.class.getPackage(), "ra.xml", "ra.xml") .addPackages(true, TelnetResourceAdapter.class.getPackage(), TelnetListener.class.getPackage(), TelnetServer.class.getPackage())) .addAsModule(create(JavaArchive.class, "mdb.jar") .addClasses(MyMdb.class)); ear.addAsManifestResource(createPermissionsXmlAsset( new PropertyPermission("*", "read,write"), new RuntimePermission("accessDeclaredMembers"), new RuntimePermission("defineClassInPackage." + MyMdb.class.getPackage().getName()), new RuntimePermission("getClassLoader"), new SocketPermission("*", "accept,listen")), "permissions.xml"); return ear; }
Source:
<code>public void validate(Object object, Errors errors) { ReportData data = (ReportData)object; if (data.getLocalDate() != null && data.getDateTime() != null) { errors.reject("must include a localDate or dateTime, but not both"); } else if (data.getLocalDate() == null && data.getDateTime() == null) { errors.reject("must include a localDate or dateTime"); } if (data.getData() == null) { errors.rejectValue("data", "is required"); } if (existingSubstudies != null && data.getSubstudyIds() != null) { <START> Set<String> diff = Sets.symmetricDifference(existingSubstudies, data.getSubstudyIds()); <END> if (!diff.isEmpty()) { errors.rejectValue("substudyIds", "cannot be changed once created for a report"); } } ReportDataKey key = data.getReportDataKey(); if (key == null) { errors.rejectValue("key", "is required"); } else { ReportDataKeyValidator.INSTANCE.validate(key, errors); } }</code><technical_language>Minor: equals() works String sets, easier read</technical_language>

Target:
public void validate(Object object, Errors errors) { ReportData data = (ReportData)object; if (data.getLocalDate() != null && data.getDateTime() != null) { errors.reject("must include a localDate or dateTime, but not both"); } else if (data.getLocalDate() == null && data.getDateTime() == null) { errors.reject("must include a localDate or dateTime"); } if (data.getData() == null) { errors.rejectValue("data", "is required"); } if (existingSubstudies != null && data.getSubstudyIds() != null) { if (!existingSubstudies.equals(data.getSubstudyIds())) { errors.rejectValue("substudyIds", "cannot be changed once created for a report"); } } ReportDataKey key = data.getReportDataKey(); if (key == null) { errors.rejectValue("key", "is required"); } else { ReportDataKeyValidator.INSTANCE.validate(key, errors); } }