auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void processValidationSet(GroupDescription processedDescription, GroupDescription currentDescription, TransformationCache cache) { if (currentDescription.eIsSet(VALIDATIONSET_FEATURE)) { if (processedDescription.getValidationSet() == null) { GroupValidationSetDescription validationSet = PropertiesFactory.eINSTANCE.createGroupValidationSetDescription(); processedDescription.setValidationSet(validationSet); } List<SemanticValidationRule> newSemanticValidationRules = new ArrayList<>(); for (SemanticValidationRule rule : currentDescription.getValidationSet().getSemanticValidationRules()) { newSemanticValidationRules.add(EcoreUtil.copy(rule)); } newSemanticValidationRules.addAll(processedDescription.getValidationSet().getSemanticValidationRules()); processedDescription.getValidationSet().getSemanticValidationRules().clear(); processedDescription.getValidationSet().getSemanticValidationRules().addAll(newSemanticValidationRules); List<PropertyValidationRule> newPropertyValidationRules = new ArrayList<>(); for (PropertyValidationRule rule : currentDescription.getValidationSet().getPropertyValidationRules()) { newPropertyValidationRules.add(EcoreUtil.copy(rule)); } newPropertyValidationRules.addAll(processedDescription.getValidationSet().getPropertyValidationRules()); processedDescription.getValidationSet().getPropertyValidationRules().clear(); processedDescription.getValidationSet().getPropertyValidationRules().addAll(newPropertyValidationRules); } }

Target:
private void processValidationSet(GroupDescription processedDescription, GroupDescription currentDescription, TransformationCache cache) { if (currentDescription.eIsSet(VALIDATIONSET_FEATURE)) { GroupValidationSetDescription validationSet = Optional.ofNullable(processedDescription.getValidationSet()).orElse(PropertiesFactory.eINSTANCE.createGroupValidationSetDescription()); processedDescription.setValidationSet(validationSet); List<SemanticValidationRule> newSemanticValidationRules = new ArrayList<>(); currentDescription.getValidationSet().getSemanticValidationRules().forEach(rule -> newSemanticValidationRules.add(EcoreUtil.copy(rule))); newSemanticValidationRules.addAll(processedDescription.getValidationSet().getSemanticValidationRules()); processedDescription.getValidationSet().getSemanticValidationRules().clear(); processedDescription.getValidationSet().getSemanticValidationRules().addAll(newSemanticValidationRules); List<PropertyValidationRule> newPropertyValidationRules = new ArrayList<>(); currentDescription.getValidationSet().getPropertyValidationRules().forEach(rule -> newPropertyValidationRules.add(EcoreUtil.copy(rule))); newPropertyValidationRules.addAll(processedDescription.getValidationSet().getPropertyValidationRules()); processedDescription.getValidationSet().getPropertyValidationRules().clear(); processedDescription.getValidationSet().getPropertyValidationRules().addAll(newPropertyValidationRules); } }
Source:
private void addIndicationsRepresentation(final StringBuilder stringBuilder, final IndicationUrlBuilder indicationUrlBuilder, final List<FoundIndication> indications, final int indentLevel) { final int nextIndentLevel = indentLevel + ITEM_INCREMENT; if (useHtmlFormat) { stringBuilder.append("<ul>"); for (int i = 0, size = indications.size(); i < size; ++i) { final FoundIndication indication = indications.get(i); indicationUrlBuilder.setIndication(indication); final int indicationNumber = i + 1; addIndicationRepresentation(stringBuilder, indicationUrlBuilder, indication, indicationNumber, nextIndentLevel); } stringBuilder.append("</ul>"); } else { for (int i = 0, size = indications.size(); i < size; ++i) { final FoundIndication indication = indications.get(i); indicationUrlBuilder.setIndication(indication); final int indicationNumber = i + 1; addIndicationRepresentation(stringBuilder, indicationUrlBuilder, indication, indicationNumber, nextIndentLevel); } } for (int i = 0, size = indications.size(); i < size; ++i) { final FoundIndication indication = indications.get(i); } }

Target:
private void addIndicationsRepresentation(final StringBuilder stringBuilder, final IndicationUrlBuilder indicationUrlBuilder, final List<FoundIndication> indications, final int indentLevel) { final int nextIndentLevel = indentLevel + ITEM_INCREMENT; if (useHtmlFormat) { stringBuilder.append("<ul>"); for (int i = 0, size = indications.size(); i < size; ++i) { final FoundIndication indication = indications.get(i); indicationUrlBuilder.setIndication(indication); final int indicationNumber = i + 1; addIndicationRepresentation(stringBuilder, indicationUrlBuilder, indication, indicationNumber, nextIndentLevel); } stringBuilder.append("</ul>"); } else { for (int i = 0, size = indications.size(); i < size; ++i) { final FoundIndication indication = indications.get(i); indicationUrlBuilder.setIndication(indication); final int indicationNumber = i + 1; addIndicationRepresentation(stringBuilder, indicationUrlBuilder, indication, indicationNumber, nextIndentLevel); } } }
Source:
private void blockUntilReady() { try { readyForEvents.await(); } catch (InterruptedException e) { } }

Target:
private void blockUntilReady() { try { readyForEvents.await(); } catch (InterruptedException e) { Thread.interrupted(); throw new RuntimeException(e); } }
Source:
public void setup() throws NoSuchFieldException, IllegalAccessException { instanceCountField = OpenHelperManager.class.getDeclaredField("instanceCount"); instanceCountField.setAccessible(true); setInstanceCountToZero(); controller = Robolectric.buildActivity(OrmLiteOnDestroyActivity_.class).create(); }

Target:
public void setup() throws NoSuchFieldException, IllegalAccessException { staticField("helper").ofType(OrmLiteSqliteOpenHelper.class).in(OpenHelperManager.class).set(null); staticField("helperClass").ofType(Class.class).in(OpenHelperManager.class).set(null); staticField("wasClosed").ofType(boolean.class).in(OpenHelperManager.class).set(false); instanceCountInvoker = staticField("instanceCount").ofType(int.class).in(OpenHelperManager.class); instanceCountInvoker.set(0); controller = Robolectric.buildActivity(OrmLiteOnDestroyActivity_.class).create(); }
Source:
private ElementRecord getElement(String id) { try { return sxe.getDocumentRecord().getElementRecordById(id); } catch (MissingRecordException e) { LOG.error("trying to set access an element that does NOT" + " exist, the changes will be ignored.", e); return null; } }

Target:
private ElementRecord getElement(String id) { try { return sxe.getDocumentRecord().getElementRecordById(id); } catch (MissingRecordException e) { LOG.error("trying to access an element that does NOT" + " exist, the changes will be ignored.", e); return null; } }
Source:
public void setSubscriptions(List<String> subscriptions) { this.subscriptions.clear(); if(subscriptions == null) return; for(String currentSubscription: subscriptions) { if (this.getNotifierName().equals(AlertService.SupportedNotifier.GUS.getName())) { if (currentSubscription.length() < 10) throw new IllegalArgumentException("GUS subjectId is incorrect."); } else if (this.getNotifierName().equals(AlertService.SupportedNotifier.EMAIL.getName())) { if (!currentSubscription.matches(EMAILREGEX)) { String errorMessage = MessageFormat.format("Email Address is incorrect. {0}", currentSubscription); throw new IllegalArgumentException(errorMessage); } } } if (subscriptions != null && !subscriptions.isEmpty()) { this.subscriptions.addAll(subscriptions); } }

Target:
public void setSubscriptions(List<String> subscriptions) { this.subscriptions.clear(); if(subscriptions == null) return; for(String currentSubscription: subscriptions) { if (this.getNotifierName().equals(AlertService.SupportedNotifier.GUS.getName())) { if (currentSubscription.length() < 10) throw new IllegalArgumentException("GUS subjectId is incorrect."); } else if (this.getNotifierName().equals(AlertService.SupportedNotifier.EMAIL.getName())) { if (!currentSubscription.matches(EMAILREGEX)) { String errorMessage = MessageFormat.format("Email Address {0} is not allowed according to Regex {1}.", currentSubscription, EMAILREGEX); throw new IllegalArgumentException(errorMessage); } } } if (subscriptions != null && !subscriptions.isEmpty()) { this.subscriptions.addAll(subscriptions); } }
Source:
public <T> Collection<Binding<T>> bindConsumer(T input, String inputName) { String bindingTarget = this.channelBindingServiceProperties .getBindingDestination(inputName); String[] bindingTargets = StringUtils .commaDelimitedListToStringArray(bindingTarget); Collection<Binding<T>> bindings = new ArrayList<>(); Binder<T, ConsumerProperties, ?> binder = (Binder<T, ConsumerProperties, ?>) getBinder( inputName, input.getClass()); ConsumerProperties consumerProperties = this.channelBindingServiceProperties .getConsumerProperties(inputName); if (binder instanceof ExtendedPropertiesBinder) { Object extension = ((ExtendedPropertiesBinder) binder) .getExtendedConsumerProperties(inputName); ExtendedConsumerProperties extendedConsumerProperties = new ExtendedConsumerProperties( extension); BeanUtils.copyProperties(consumerProperties, extendedConsumerProperties); consumerProperties = extendedConsumerProperties; } validate(consumerProperties); for (String target : bindingTargets) { Binding<T> binding = binder.bindConsumer(target, channelBindingServiceProperties.getGroup(inputName), input, consumerProperties); bindings.add(binding); } bindings = Collections.unmodifiableCollection(bindings); this.consumerBindings.put(inputName, new ArrayList<Binding<?>>(bindings)); return Collections.unmodifiableCollection(bindings); }

Target:
public <T> Collection<Binding<T>> bindConsumer(T input, String inputName) { String bindingTarget = this.channelBindingServiceProperties .getBindingDestination(inputName); String[] bindingTargets = StringUtils .commaDelimitedListToStringArray(bindingTarget); Collection<Binding<T>> bindings = new ArrayList<>(); Binder<T, ConsumerProperties, ?> binder = (Binder<T, ConsumerProperties, ?>) getBinder( inputName, input.getClass()); ConsumerProperties consumerProperties = this.channelBindingServiceProperties .getConsumerProperties(inputName); if (binder instanceof ExtendedPropertiesBinder) { Object extension = ((ExtendedPropertiesBinder) binder) .getExtendedConsumerProperties(inputName); ExtendedConsumerProperties extendedConsumerProperties = new ExtendedConsumerProperties( extension); BeanUtils.copyProperties(consumerProperties, extendedConsumerProperties); consumerProperties = extendedConsumerProperties; } validate(consumerProperties); for (String target : bindingTargets) { Binding<T> binding = binder.bindConsumer(target, channelBindingServiceProperties.getGroup(inputName), input, consumerProperties); bindings.add(binding); } bindings = Collections.unmodifiableCollection(bindings); this.consumerBindings.put(inputName, new ArrayList<Binding<?>>(bindings)); return bindings; }
Source:
public boolean exists(URI uri, Map<?, ?> options) { boolean exists = false; try { IStorageProvider storageProvider = storageAccessor.getStorageProvider(getResourceFromURI(uri), side); if (storageProvider != null) { exists = storageProvider.getStorage(new NullProgressMonitor()) != null; } else { exists = super.exists(uri, options); } } catch (CoreException e) { EMFCompareIDEUIPlugin.getDefault().log(IStatus.ERROR, e.getMessage()); } return exists; }

Target:
public boolean exists(URI uri, Map<?, ?> options) { boolean exists = false; try { final URI normalizedUri = normalize(uri); IStorageProvider storageProvider = storageAccessor.getStorageProvider( getResourceFromURI(normalizedUri), side); if (storageProvider != null) { exists = storageProvider.getStorage(new NullProgressMonitor()) != null; } else { exists = super.exists(normalizedUri, options); } } catch (CoreException e) { EMFCompareIDEUIPlugin.getDefault().log(IStatus.ERROR, e.getMessage()); } return exists; }
Source:
private boolean isSupportedExternalType(ProviderNetwork providerNetwork) { return BaseNetworkProviderProxy.FLAT_NETWORK.equals(providerNetwork.getProviderNetworkType()) || BaseNetworkProviderProxy.VLAN_NETWORK.equals(providerNetwork.getProviderNetworkType()); }

Target:
private boolean isSupportedExternalType(ProviderNetwork providerNetwork) { return providerNetwork.isProviderNetworkFlat() || providerNetwork.isProviderNetworkVlan(); }
Source:
private void testPreserveOldPacks() throws Exception { BranchBuilder bb = tr.branch("refs/heads/master"); bb.commit().message("P").add("P", "P").create(); gc.setExpireAgeMillis(0); gc.gc(); File oldPackfile = tr.getRepository().getObjectDatabase().getPacks() .iterator().next().getPackFile(); assertEquals(true, oldPackfile.exists()); fsTick(); bb.commit().message("B").add("B", "Q").create(); gc.setPackExpireAgeMillis(0); configureGc(gc, false).setPreserveOldPacks(true); gc.gc(); File oldPackDir = repo.getObjectDatabase().getPreservedDirectory(); String oldPackFileName = oldPackfile.getName(); String oldPackName = oldPackFileName.substring(0, oldPackFileName.lastIndexOf('.')) + ".old-pack"; File preservePackFile = new File(oldPackDir, oldPackName); assertEquals(true, preservePackFile.exists()); }

Target:
private void testPreserveOldPacks() throws Exception { BranchBuilder bb = tr.branch("refs/heads/master"); bb.commit().message("P").add("P", "P").create(); gc.setExpireAgeMillis(0); gc.gc(); File oldPackfile = tr.getRepository().getObjectDatabase().getPacks() .iterator().next().getPackFile(); assertTrue(oldPackfile.exists()); fsTick(); bb.commit().message("B").add("B", "Q").create(); gc.setPackExpireAgeMillis(0); configureGc(gc, false).setPreserveOldPacks(true); gc.gc(); File oldPackDir = repo.getObjectDatabase().getPreservedDirectory(); String oldPackFileName = oldPackfile.getName(); String oldPackName = oldPackFileName.substring(0, oldPackFileName.lastIndexOf('.')) + ".old-pack"; File preservePackFile = new File(oldPackDir, oldPackName); assertTrue(preservePackFile.exists()); }
Source:
public void testMediate() { final String EVENT_SOURCE_NAME = "testEventStore"; SynapseEnvironment synapseEnvironment = Mockito.mock(SynapseEnvironment.class); MessageContext messageContext = new TestMessageContext(); messageContext.setEnvironment(synapseEnvironment); SynapseConfiguration synapseConfiguration = new SynapseConfiguration(); SynapseEventSource synapseEventSource = Mockito.mock(SynapseEventSource.class); Mockito.doNothing().when(synapseEventSource).dispatchEvents(Mockito.any(MessageContext.class)); Map<String,SynapseEventSource> eventStoreMap = new HashMap<>(); eventStoreMap.put(EVENT_SOURCE_NAME,synapseEventSource); synapseConfiguration.setEventSources(eventStoreMap); messageContext.setConfiguration(synapseConfiguration); eventPublisherMediator.setEventSourceName(EVENT_SOURCE_NAME); Assert.assertTrue("mediation successful",eventPublisherMediator.mediate(messageContext)); }

Target:
public void testMediate() { final String EventSourceName = "testEventStore"; SynapseEnvironment synapseEnvironment = Mockito.mock(SynapseEnvironment.class); MessageContext messageContext = new TestMessageContext(); messageContext.setEnvironment(synapseEnvironment); SynapseConfiguration synapseConfiguration = new SynapseConfiguration(); SynapseEventSource synapseEventSource = Mockito.mock(SynapseEventSource.class); Mockito.doNothing().when(synapseEventSource).dispatchEvents(Mockito.any(MessageContext.class)); Map<String, SynapseEventSource> eventStoreMap = new HashMap<>(); eventStoreMap.put(EventSourceName, synapseEventSource); synapseConfiguration.setEventSources(eventStoreMap); messageContext.setConfiguration(synapseConfiguration); eventPublisherMediator.setEventSourceName(EventSourceName); Assert.assertTrue("mediation successful", eventPublisherMediator.mediate(messageContext)); }
Source:
public Iterable<DataCenter> listLocations() { logger.trace("<< fetching locations.."); Iterable<DataCenter> all = api.dataCenterApi().list(new DepthOptions().depth(4)); logger.trace(">> done fetching locations.."); return all; }

Target:
public Iterable<Location> listLocations() { throw new UnsupportedOperationException("Locations are configured in jclouds properties"); }
Source:
public void testGetRefsByPrefixes() throws IOException { List<Ref> refs = db.getRefDatabase().getRefsByPrefix(); List<Ref> allRefs = db.getRefDatabase().getRefs(); assertEquals(allRefs.size(), refs.size()); refs = db.getRefDatabase().getRefsByPrefix("refs/heads/p", "refs/tags/A"); assertEquals(3, refs.size()); checkContainsRef(refs, db.exactRef("refs/heads/prefix/a")); checkContainsRef(refs, db.exactRef("refs/heads/pa")); checkContainsRef(refs, db.exactRef("refs/tags/A")); }

Target:
public void testGetRefsByPrefixes() throws IOException { List<Ref> refs = db.getRefDatabase().getRefsByPrefix("refs/heads/p", "refs/tags/A"); assertEquals(3, refs.size()); checkContainsRef(refs, db.exactRef("refs/heads/prefix/a")); checkContainsRef(refs, db.exactRef("refs/heads/pa")); checkContainsRef(refs, db.exactRef("refs/tags/A")); }
Source:
Builder setCanonicalHeaders(Map<String, String> canonicalHeaders) { this.canonicalHeaders = canonicalHeaders; return this; }

Target:
Builder setCanonicalHeaders(Map<String, String> canonicalHeaders) { this.canonicalHeaders = new HashMap<>(canonicalHeaders); return this; }
Source:
public void putResource(String targetPath, InputStream sourceStream) throws InfrastructureException { try { docker.putResource(PutResourceParams.create(container, targetPath, sourceStream)); } catch (IOException e) { throw new InfrastructureException(e.getMessage(), e); } }

Target:
public void putResource(String targetPath, InputStream sourceStream) throws InfrastructureException { try { docker.putResource(PutResourceParams.create(container, targetPath, sourceStream)); } catch (IOException e) { throw new InternalInfrastructureException(e.getMessage(), e); } }
Source:
public void run() { Class c = null; try { c = Class.forName("org.apache.harmony.jpda.tests.jdwp.ObjectReference.InvokeMethodDefaultDebuggee$TestClass"); } catch (ClassNotFoundException e) { e.printStackTrace(); } synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY); logWriter.println("InvokeMethodDefaultDebuggee"); synchronizer.receiveMessageWithoutException("org.apache.harmony.jpda.tests.jdwp.ObjectReference.InvokeMethodDefaultDebuggee(#1)"); execMethod(); synchronizer.receiveMessageWithoutException("org.apache.harmony.jpda.tests.jdwp.ObjectReference.InvokeMethodDefaultDebuggee(#2)"); }

Target:
public void run() { Class c = null; String packageName = "org.apache.harmony.jpda.tests.jdwp."; try { c = Class.forName( packageName + "ObjectReference.InvokeMethodDefaultDebuggee$TestClass"); } catch (ClassNotFoundException e) { e.printStackTrace(); } synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY); logWriter.println("InvokeMethodDefaultDebuggee"); synchronizer.receiveMessageWithoutException( packageName + "ObjectReference.InvokeMethodDefaultDebuggee(#1)"); execMethod(); synchronizer.receiveMessageWithoutException( packageName + "ObjectReference.InvokeMethodDefaultDebuggee(#2)"); }
Source:
private Map<String, String> getStructureViewerAliases() { if (fStructureViewerAliases == null) { fStructureViewerAliases= new Hashtable<String, String>(10); String aliases= getPreferenceStore().getString(STRUCTUREVIEWER_ALIASES_PREFERENCE_NAME); if (aliases != null && aliases.length() > 0) { StringTokenizer st= new StringTokenizer(aliases, " "); while (st.hasMoreTokens()) { String pair= st.nextToken(); int pos= pair.indexOf('.'); if (pos > 0) { String key= pair.substring(0, pos); String alias= pair.substring(pos+1); fStructureViewerAliases.put(key, alias); } } } } return fStructureViewerAliases; }

Target:
private Map<String, String> getStructureViewerAliases() { if (fStructureViewerAliases == null) { fStructureViewerAliases= new Hashtable<>(10); String aliases= getPreferenceStore().getString(STRUCTUREVIEWER_ALIASES_PREFERENCE_NAME); if (aliases != null && aliases.length() > 0) { StringTokenizer st= new StringTokenizer(aliases, " "); while (st.hasMoreTokens()) { String pair= st.nextToken(); int pos= pair.indexOf('.'); if (pos > 0) { String key= pair.substring(0, pos); String alias= pair.substring(pos+1); fStructureViewerAliases.put(key, alias); } } } } return fStructureViewerAliases; }
Source:
void archiveEntityViaMigration() { ProjectId id = createId(42); TestProjection projection = createEntity(id); repository().store(projection); repository().applyMigration(id, new MarkProjectionArchived<>()); Optional<TestProjection> found = repository().find(id); Truth8.assertThat(found).isPresent(); assertThat(found.get().isArchived()).isTrue(); }

Target:
void archiveEntityViaMigration() { ProjectId id = createId(42); TestProjection projection = createEntity(id); repository().store(projection); repository().applyMigration(id, new MarkProjectionArchived<>()); Optional<TestProjection> found = repository().find(id); assertThat(found).isPresent(); assertThat(found.get() .isArchived()).isTrue(); }
Source:
public void updateMoveAndCopyCommandAvailability(List<DiskImage> disks, UICommand moveCommand, UICommand copyCommand) { boolean isCopyAllowed = true; boolean isMoveAllowed = true; if ( moveCommand == null || copyCommand == null ) { return; } if (disks == null || disks.isEmpty() || disks.get(0).getDiskStorageType() != DiskStorageType.IMAGE) { disableMoveAndCopyCommands(copyCommand, moveCommand); return; } Guid dataCenterId = disks.get(0).getStoragePoolId(); boolean foundTemplateDisk = false; boolean foundVmDisk = false; boolean foundUnattachedDisk = false; for (DiskImage disk : disks) { if ((!isCopyAllowed && !isMoveAllowed) || disk.getDiskStorageType() != DiskStorageType.IMAGE) { disableMoveAndCopyCommands(moveCommand, copyCommand); return; } if (disk.getImageStatus() != ImageStatus.OK || !dataCenterId.equals(disk.getStoragePoolId()) || disk.isOvfStore()) { disableMoveAndCopyCommands(moveCommand, copyCommand); return; } VmEntityType vmEntityType = disk.getVmEntityType(); if (vmEntityType == null) { foundUnattachedDisk = true; } else if (vmEntityType.isTemplateType()) { foundTemplateDisk = true; } else if (vmEntityType.isVmType()) { foundVmDisk = true; } if (foundTemplateDisk && (foundUnattachedDisk || foundVmDisk)) { isCopyAllowed = false; } if (vmEntityType != null && vmEntityType.isTemplateType()) { isMoveAllowed = false; } } copyCommand.setIsExecutionAllowed(isCopyAllowed); moveCommand.setIsExecutionAllowed(isMoveAllowed); }

Target:
public void updateMoveAndCopyCommandAvailability(List<DiskImage> disks, UICommand moveCommand, UICommand copyCommand) { boolean isCopyAllowed = true; boolean isMoveAllowed = true; if ( moveCommand == null || copyCommand == null ) { return; } if (disks == null || disks.isEmpty() || disks.get(0).getDiskStorageType() != DiskStorageType.IMAGE) { disableMoveAndCopyCommands(copyCommand, moveCommand); return; } Guid dataCenterId = disks.get(0).getStoragePoolId(); boolean foundTemplateDisk = false; boolean foundVmDisk = false; boolean foundUnattachedDisk = false; for (DiskImage disk : disks) { if ( (!isCopyAllowed && !isMoveAllowed) || (disk.getDiskStorageType() != DiskStorageType.IMAGE) || (disk.getImageStatus() != ImageStatus.OK ) || (!dataCenterId.equals(disk.getStoragePoolId())) || (disk.isOvfStore())) { disableMoveAndCopyCommands(moveCommand, copyCommand); return; } VmEntityType vmEntityType = disk.getVmEntityType(); if (vmEntityType == null) { foundUnattachedDisk = true; } else if (vmEntityType.isTemplateType()) { foundTemplateDisk = true; } else if (vmEntityType.isVmType()) { foundVmDisk = true; } if (foundTemplateDisk && (foundUnattachedDisk || foundVmDisk)) { isCopyAllowed = false; } if (vmEntityType != null && vmEntityType.isTemplateType()) { isMoveAllowed = false; } } copyCommand.setIsExecutionAllowed(isCopyAllowed); moveCommand.setIsExecutionAllowed(isMoveAllowed); }
Source:
public void testSimpleSchemaMerge() throws Exception { String jsonSample = "{\"id\": 1}\n{\"id\": 2}"; Schema schema = Schema.createRecord("Test", null, null, false); schema.setFields(ImmutableList.of( new Schema.Field("id", Schema.create(Schema.Type.INT), null, null) )); Assert.assertEquals("Should match expected schema", schema, mergeSchemas(jsonSample)); }

Target:
public void testSimpleSchemaMerge() throws Exception { String jsonSample = "{\"id\": 1}\n{\"id\": 2}"; Schema schema = SchemaBuilder.record("Test").fields() .requiredInt("id") .endRecord(); Assert.assertEquals("Should match expected schema", schema, mergeSchemas(jsonSample)); }
Source:
public String run( ReportInfo ri ) { String ret = ""; int tot_cnt = 0; try { for (Map.Entry<String, Integer> name_count : Core.getCommunities()) { ret += String.format("Collection [%s]: %d\n", name_count.getKey(), name_count.getValue()); tot_cnt += name_count.getValue(); } } catch (SQLException e) { error(e); } try { ret += "\nCollection sizes:\n"; ret += Core.getCollectionSizesInfo(); } catch (SQLException e) { error(e); } ret += String.format( "\nPublished items (archived, not withdrawn): %d\n", tot_cnt); try { ret += String.format( "Withdrawn items: %d\n", Core.getWithdrawnItemsCount()); ret += String.format( "Not published items (in workspace or workflow mode): %d\n", Core.getNotArchivedItemsCount()); for (TableRow row : Core.getWorkspaceItemsRows()) { ret += String.format("\tIn Stage %s: %s\n", row.getIntColumn("stage_reached"), row.getLongColumn("cnt")); } ret += String.format( "\tWaiting for approval (workflow items): %d\n", Core.getWorkflowItemsCount()); } catch (SQLException e) { error(e); } try { ret += Core.getObjectSizesInfo(); } catch (SQLException e) { error(e); } return ret; }

Target:
public String run( ReportInfo ri ) { String ret = ""; int tot_cnt = 0; Context context = new Context(); try { for (Map.Entry<String, Integer> name_count : getCommunities(context)) { ret += String.format("Community [%s]: %d\n", name_count.getKey(), name_count.getValue()); tot_cnt += name_count.getValue(); } } catch (SQLException e) { error(e); } try { ret += "\nCollection sizes:\n"; ret += getCollectionSizesInfo(context); } catch (SQLException e) { error(e); } ret += String.format( "\nPublished items (archived, not withdrawn): %d\n", tot_cnt); try { ret += String.format( "Withdrawn items: %d\n", itemService.countWithdrawnItems(context)); ret += String.format( "Not published items (in workspace or workflow mode): %d\n", itemService.getNotArchivedItemsCount(context)); for (Map.Entry<Integer, Long> row : workspaceItemService.getStageReachedCounts(context)) { ret += String.format("\tIn Stage %s: %s\n", row.getKey(), row.getValue() ); } ret += String.format( "\tWaiting for approval (workflow items): %d\n", basicWorkflowItemService.countTotal(context)); } catch (SQLException e) { error(e); } try { ret += getObjectSizesInfo(context); context.complete(); } catch (SQLException e) { error(e); } return ret; }
Source:
public void shouldUseIgnoreAbove(){ elasticsearchTemplate.createIndex(IgnoreAboveEntity.class); elasticsearchTemplate.putMapping(IgnoreAboveEntity.class); Map mapping = elasticsearchTemplate.getMapping(IgnoreAboveEntity.class); Map properties = (Map) mapping.get("properties"); Map message = (Map) properties.get("message"); java.lang.reflect.Field field = ReflectionUtils.findField(IgnoreAboveEntity.class, "message"); assertThat(field).isNotNull(); Field fieldAnnotation = AnnotationUtils.getAnnotation(field, Field.class); assertThat(fieldAnnotation).isNotNull(); assertThat(message.get("ignore_above")).isEqualTo(fieldAnnotation.ignoreAbove()); }

Target:
public void shouldUseIgnoreAbove() throws IOException, JSONException { String expected = "{\"ignore-above-type\":{\"properties\":{\"message\":{\"store\":false,\"type\":\"keyword\",\"ignore_above\":10}}}}"; String mapping = getMappingBuilder().buildPropertyMapping(IgnoreAboveEntity.class); assertEquals(expected, mapping, false); }
Source:
public void worked(final int work) { Display.getDefault().syncExec(new Runnable() { @Override public void run() { if (progressBar.getSelection() >= 100) { progressBar.setSelection(0); System.out.println("reset"); } else { progressBar.setSelection(progressBar.getSelection() + work); System.out.println("sel=" + progressBar.getSelection() + work); } } }); }

Target:
public void worked(final int work) { Display.getDefault().syncExec(new Runnable() { @Override public void run() { if (progressBar.getSelection() >= 100) { progressBar.setSelection(0); } else { progressBar.setSelection(progressBar.getSelection() + work); } } }); }
Source:
public void checkGoToSymbolFeature() { menu.runCommand(ASSISTANT, FIND_DEFINITION); try { assistantFindPanel.waitActionNodeContainsText("Main(string[] args)"); } catch (TimeoutException ex) { fail("Known permanent failure: <LINK_0>", ex); } }

Target:
public void checkGoToSymbolFeature() { menu.runCommand(ASSISTANT, GO_TO_SYMBOL); try { assistantFindPanel.waitActionNodeContainsText("Main(string[] args)"); } catch (TimeoutException ex) { fail("Known permanent failure: <LINK_0>", ex); } }
Source:
private void writeController(VmDevice device) { writer.writeStartElement("controller"); writer.writeAttributeString("type", device.getDevice()); Object model = device.getSpecParams().get(VdsProperties.Model); if (model != null) { writer.writeAttributeString("model", model.toString()); } Object index = device.getSpecParams().get(VdsProperties.Index); if (index != null) { writer.writeAttributeString("index", index.toString()); } Object ports = device.getSpecParams().get("ports"); if (ports != null) { writer.writeAttributeString("ports", ports.toString()); } if (device.getSpecParams().containsKey(VdsProperties.ioThreadId)) { writer.writeStartElement("driver"); writer.writeAttributeString("iothread", device.getSpecParams().get(VdsProperties.ioThreadId).toString()); writer.writeEndElement(); } if (!VmDeviceType.USB.getName().equals(device.getDevice())) { writeAlias(device); } writeAddress(device); writer.writeEndElement(); }

Target:
private void writeController(VmDevice device) { writer.writeStartElement("controller"); writer.writeAttributeString("type", device.getDevice()); Object model = device.getSpecParams().get(VdsProperties.Model); if (model != null) { writer.writeAttributeString("model", model.toString()); } Object index = device.getSpecParams().get(VdsProperties.Index); if (index != null) { writer.writeAttributeString("index", index.toString()); } Object ports = device.getSpecParams().get("ports"); if (ports != null) { writer.writeAttributeString("ports", ports.toString()); } Object ioThreadId = device.getSpecParams().get(VdsProperties.ioThreadId); if (ioThreadId != null) { writer.writeStartElement("driver"); writer.writeAttributeString("iothread", ioThreadId.toString()); writer.writeEndElement(); } if (!VmDeviceType.USB.getName().equals(device.getDevice())) { writeAlias(device); } writeAddress(device); writer.writeEndElement(); }
Source:
private void fillNextCycle(int numUpdates, boolean expect) { for (int ii = 0; ii < numUpdates; ii++) { Random m_random = new Random(); int maxStreamSuffix = m_expectedValues.lastKey() + 1; int targetSuffix; do { targetSuffix = m_random.nextInt(maxStreamSuffix); } while (!m_expectedValues.containsKey(targetSuffix)); changeCursor(targetSuffix, getRandomPartitionId(), Math.abs(m_random.nextLong()), expect); } }

Target:
private void fillNextCycle(int numUpdates, boolean expect) { for (int ii = 0; ii < numUpdates; ii++) { int maxStreamSuffix = m_expectedValues.lastKey() + 1; int targetSuffix; do { targetSuffix = m_random.nextInt(maxStreamSuffix); } while (!m_expectedValues.containsKey(targetSuffix)); changeCursor(targetSuffix, getRandomPartitionId(), Math.abs(m_random.nextLong()), expect); } }
Source:
protected final void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { CurrentUser user = currentUser.get(); if (user instanceof IdentifiedUser) { Account.Id userId = ((IdentifiedUser) user).getAccountId(); String token = ")]}'\n{token:\"" + verifier.encode(userId, getReqUrl(req)) + "\"}"; res.setContentType(JSON_TYPE); res.setCharacterEncoding("UTF-8"); send(req, res, token.getBytes("UTF-8")); } else { res.sendError(HttpServletResponse.SC_UNAUTHORIZED); } }

Target:
protected final void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { CurrentUser user = currentUser.get(); if (user instanceof IdentifiedUser) { Account.Id userId = ((IdentifiedUser) user).getAccountId(); TokenInfo info = new TokenInfo(); info._authKey = verifier.sign(userId, getReqUrl(req)); ByteArrayOutputStream buf = new ByteArrayOutputStream(); buf.write(JSON_MAGIC); buf.write(new Gson().toJson(info).getBytes("UTF-8")); res.setContentType(JSON_TYPE); res.setCharacterEncoding("UTF-8"); send(req, res, buf.toByteArray()); } else { res.sendError(HttpServletResponse.SC_UNAUTHORIZED); } }
Source:
List<String> fetchGradeFromDatabase(int grade) { if (!database.containsKey(grade)) { database.put(grade, new LinkedList<>()); } Collections.sort(database.get(grade)); return database.get(grade); }

Target:
private List<String> fetchGradeFromDatabase(int grade) { if (!database.containsKey(grade)) { database.put(grade, new LinkedList<>()); } Collections.sort(database.get(grade)); return database.get(grade); }
Source:
LegacyProtocolResourceDefinition(String name, String targetName, JGroupsModel deprecation, Consumer<ResourceDescriptor> descriptorConfigurator, ResourceServiceBuilderFactory<ChannelFactory> parentBuilderFactory) { super(pathElement(name), descriptorConfigurator.andThen(descriptor -> descriptor.setAddOperationTransformation(new OperationTransformation(targetName)).setOperationTransformation(new OperationTransformation(targetName))), null, parentBuilderFactory); this.setDeprecated(deprecation.getVersion()); }

Target:
LegacyProtocolResourceDefinition(String name, String targetName, JGroupsModel deprecation, Consumer<ResourceDescriptor> descriptorConfigurator, ResourceServiceBuilderFactory<ChannelFactory> parentBuilderFactory) { super(pathElement(name), descriptorConfigurator.andThen(new OperationTransformation(targetName)), null, parentBuilderFactory); this.setDeprecated(deprecation.getVersion()); }
Source:
private void publishPost(final PostModel post) { if (!NetworkUtils.isNetworkAvailable(getActivity())) { ToastUtils.showToast(getActivity(), R.string.error_publish_no_network, ToastUtils.Duration.SHORT); return; } if (!PostUtils.isPublishable(post)) { ToastUtils.showToast(getActivity(), R.string.error_publish_empty_post, ToastUtils.Duration.SHORT); return; } PostUtils.updatePublishDateIfShouldBePublishedImmediately(post); post.setStatus(PostStatus.PUBLISHED.toString()); UploadService.addPostToUpload(getActivity(), post); PostUtils.trackSavePostAnalytics(post, mSite); }

Target:
private void publishPost(final PostModel post) { if (!NetworkUtils.isNetworkAvailable(getActivity())) { ToastUtils.showToast(getActivity(), R.string.error_publish_no_network, ToastUtils.Duration.SHORT); return; } if (!PostUtils.isPublishable(post)) { ToastUtils.showToast(getActivity(), R.string.error_publish_empty_post, ToastUtils.Duration.SHORT); return; } PostUtils.updatePublishDateIfShouldBePublishedImmediately(post); post.setStatus(PostStatus.PUBLISHED.toString()); mDispatcher.dispatch(PostActionBuilder.newUpdatePostAction(post)); UploadService.uploadPost(getActivity(), post); PostUtils.trackSavePostAnalytics(post, mSite); }
Source:
public Annotation getFirstAnnotationForOffset(int offset) { for (CommentAnnotation annotation : Iterables.filter(annotations, CommentAnnotation.class)) { if (annotation instanceof CommentAnnotation) { if (annotation.getPosition().offset <= offset && (annotation.getPosition().length + annotation.getPosition().offset) >= offset) { return annotation; } } } return null; }

Target:
public Annotation getFirstAnnotationForOffset(int offset) { for (CommentAnnotation annotation : Iterables.filter(annotations, CommentAnnotation.class)) { if (annotation.getPosition().offset <= offset && (annotation.getPosition().length + annotation.getPosition().offset) >= offset) { return annotation; } } return null; }
Source:
public AuthRequest authenticate(final AuthRequest who) throws AccountException { try { DirContext ctx = null; AuthType authType = authConfig.getAuthType(); String username = who.getLocalUser(); String password = who.getPassword(); if (this.username != null) { ctx = open(); if (authType == AuthType.LDAP) { ctx = authenticate(username, password); } } else if (authType == AuthType.LDAP) { ctx = authenticate(username, password); } else { ctx = open(); } try { final LdapQuery.Result m = findAccount(ctx, username); who.setDisplayName(apply(accountFullName, m)); who.setUserName(apply(accountSshUserName, m)); if (accountEmailAddress != null) { who.setEmailAddress(apply(accountEmailAddress, m)); } else if (emailExpander.canExpand(username)) { who.setEmailAddress(emailExpander.expand(username)); } membershipCache.put(username, queryForGroups(ctx, username, m)); return who; } finally { try { ctx.close(); } catch (NamingException e) { log.warn("Cannot close LDAP query handle", e); } } } catch (NamingException e) { log.error("Cannot query LDAP to autenticate user", e); throw new AccountException("Cannot query LDAP for account", e); } }

Target:
public AuthRequest authenticate(final AuthRequest who) throws AccountException { try { DirContext ctx; AuthType authType = authConfig.getAuthType(); String username = who.getLocalUser(); String password = who.getPassword(); if (this.username != null) { if (authType == AuthType.LDAP) { authenticate(username, password).close(); } ctx = open(); } else if (authType == AuthType.LDAP) { ctx = authenticate(username, password); } else { ctx = open(); } try { final LdapQuery.Result m = findAccount(ctx, username); who.setDisplayName(apply(accountFullName, m)); who.setUserName(apply(accountSshUserName, m)); if (accountEmailAddress != null) { who.setEmailAddress(apply(accountEmailAddress, m)); } else if (emailExpander.canExpand(username)) { who.setEmailAddress(emailExpander.expand(username)); } membershipCache.put(username, queryForGroups(ctx, username, m)); return who; } finally { try { ctx.close(); } catch (NamingException e) { log.warn("Cannot close LDAP query handle", e); } } } catch (NamingException e) { log.error("Cannot query LDAP to autenticate user", e); throw new AccountException("Cannot query LDAP for account", e); } }
Source:
protected Injector setupInjector() { return Initialization.makeInjectorWithModules( GuiceInjectors.makeStartupInjector(), ImmutableList.<Module>of( new Module() { @Override public void configure(Binder binder) { JsonConfigProvider.bindInstance( binder, Key.get(DruidNode.class, Self.class), new DruidNode("test", "localhost", null, null, new ServerConfig()) ); binder.bind(JettyServerInitializer.class).to(ProxyJettyServerInit.class).in(LazySingleton.class); binder.bind(AuthorizationManager.class).toInstance(new AuthorizationManager() { @Override public Access authorize( String identity, Resource resource, Action action ) { return new Access(true); } }); Jerseys.addResource(binder, SlowResource.class); Jerseys.addResource(binder, ExceptionResource.class); Jerseys.addResource(binder, DefaultResource.class); LifecycleModule.register(binder, Server.class); } } ) ); }

Target:
protected Injector setupInjector() { return Initialization.makeInjectorWithModules( GuiceInjectors.makeStartupInjector(), ImmutableList.<Module>of( new Module() { @Override public void configure(Binder binder) { JsonConfigProvider.bindInstance( binder, Key.get(DruidNode.class, Self.class), new DruidNode("test", "localhost", null, null, new ServerConfig()) ); binder.bind(JettyServerInitializer.class).to(ProxyJettyServerInit.class).in(LazySingleton.class); binder.bind(AuthorizerMapper.class).toInstance( new AuthorizerMapper(null) { @Override public Authorizer getAuthorizer(String name) { return new AllowAllAuthorizer(); } } ); Jerseys.addResource(binder, SlowResource.class); Jerseys.addResource(binder, ExceptionResource.class); Jerseys.addResource(binder, DefaultResource.class); LifecycleModule.register(binder, Server.class); } } ) ); }
Source:
ByteBuffer decrypt(ByteBuffer toDecrypt, T key) throws GeneralSecurityException; default ByteBuf decrypt(ByteBuf toDecrypt, T key) throws GeneralSecurityException { if (toDecrypt.nioBufferCount() == 1) { return Unpooled.wrappedBuffer(decrypt(toDecrypt.nioBuffer(), key)); } else { ByteBuf temp = ByteBufAllocator.DEFAULT.heapBuffer(toDecrypt.readableBytes()); try { temp.writeBytes(toDecrypt); return Unpooled.wrappedBuffer(decrypt(temp.nioBuffer(), key)); } finally { temp.release(); } } }

Target:
ByteBuffer decrypt(ByteBuffer toDecrypt, T key) throws GeneralSecurityException; default ByteBuf decrypt(ByteBuf toDecrypt, T key) throws GeneralSecurityException { return Utils.applyByteBufferFunctionToByteBuf(toDecrypt, (buffer) -> { return decrypt(buffer, key); }); }
Source:
public synchronized void store(AuthorizationConfigDto configuration) throws IOException { Map<SystemRole, String> changed = getChangedRestrictedRoles(configuration); if (changed.size() > 0) { String message = String.join("; ", changed.values()); throw new RuntimeException(message); } super.store(configuration); }

Target:
public synchronized void store(AuthorizationConfigDto configuration) throws IOException { Set<SystemRole> changed = getChangedRestrictedRoles(configuration); if (changed.size() > 0) { String changedNames = changed.stream() .map(SystemRole::toString) .collect(Collectors.joining(", ")); String message = String.format("System roles %s cannot be changed.", changedNames); throw new IOException(message); } super.store(configuration); }
Source:
private void number(String type, StringBuilder b, int wholeDigits, int fractions) { int requestedwholeDigits = wholeDigits; while (wholeDigits > 0) { b.append(random.nextInt(10)); wholeDigits--; } if (fractions > 0) { b.append('.'); while (fractions > 0) { b.append(random.nextInt(10)); fractions--; } } if (type.equals("number") && requestedwholeDigits > 1 && (b.charAt(0)) == '0') { b.replace(0, 1, "1"); } }

Target:
private void number(String type, StringBuilder b, int wholeDigits, int fractions) { int requestedwholeDigits = wholeDigits; while (wholeDigits > 0) { b.append(random.nextInt(10)); wholeDigits--; } if (fractions > 0) { b.append('.'); while (fractions > 0) { b.append(random.nextInt(10)); fractions--; } } if (type.equals("number") && requestedwholeDigits > 1 && (b.charAt(0)) == '0') { b.replace(0, 1, new Integer((random.nextInt(9) + 1)).toString()); } }
Source:
private boolean switchSource() throws IOException { if (!source.isCurrent()) { source = source.getNewDataSource(); try { if (iter != null) { iter.close(); } } catch (Exception e) { throw new IOException(e); } iter = source.iterator(); return true; } return false; }

Target:
private boolean switchSource() throws IOException { if (!source.isCurrent()) { source = source.getNewDataSource(); iter = source.iterator(); return true; } return false; }
Source:
public GlusterHookContentInfoReturnForXmlRpc(Map<String, Object> innerMap) { super(innerMap); Map<String, Object> content = (Map<String, Object>) innerMap.get(CONTENT); if (content != null) { hookContent = (String) content.get(0); } }

Target:
public GlusterHookContentInfoReturnForXmlRpc(Map<String, Object> innerMap) { super(innerMap); String content = (String) innerMap.get(CONTENT); if (content != null) { hookContent = StringUtils.newStringUtf8(Base64.decodeBase64(content)); } }
Source:
private int getCheckTimeoutInSeconds(ConfigurationGenerator cg) { int checkTimeout = DEFAULT_CHECK_TIMEOUT_IN_SECONDS; try { checkTimeout = Integer.parseInt(cg.getUserConfig().getProperty(PARAM_MONGODB_CHECK_TIMEOUT, DEFAULT_CHECK_TIMEOUT_IN_SECONDS.toString())); } catch (NumberFormatException e) { log.warn(String.format("Invalid format for %s parameter, using default value instead", PARAM_MONGODB_CHECK_TIMEOUT), e); } return checkTimeout; }

Target:
private int getCheckTimeoutInSeconds(ConfigurationGenerator cg) { int checkTimeout = DEFAULT_CHECK_TIMEOUT_IN_SECONDS; try { checkTimeout = Integer.parseInt(cg.getUserConfig().getProperty(PARAM_MONGODB_CHECK_TIMEOUT, String.valueOf(DEFAULT_CHECK_TIMEOUT_IN_SECONDS))); } catch (NumberFormatException e) { log.warn(String.format("Invalid format for %s parameter, using default value instead", PARAM_MONGODB_CHECK_TIMEOUT), e); } return checkTimeout; }
Source:
private boolean isAliasedClassOrInterface(TypedVar symbol, JSType type) { return !((type.isConstructor() || type.isInterface()) && symbol.getName().equals(type.getDisplayName())); }

Target:
private boolean isAliasedClassOrInterface(TypedVar symbol, JSType type) { if (!type.isConstructor() && !type.isInterface()) return false; return !symbol.getName().equals(type.getDisplayName()); }
Source:
public TraceCompletionInformation processOneToOne(String tenantId, Trace item) throws RetryAttemptException { if (!item.getNodes().isEmpty()) { Node n = item.getNodes().get(0); if (n.getClass() != Consumer.class || n.getCorrelationIds().isEmpty()) { TraceCompletionInformation ci = new TraceCompletionInformation(); CompletionTime ct = new CompletionTime(); ct.setId(item.getId()); ct.setUri(n.getUri()); ct.setOperation(n.getOperation()); if (n.getClass() == Consumer.class) { ct.setEndpointType(((Consumer) n).getEndpointType()); } ct.setBusinessTransaction(item.getBusinessTransaction()); ct.setDuration(item.calculateDuration()); ct.setPrincipal(item.getPrincipal()); ct.setFault(n.getFault()); ct.setProperties(item.allProperties()); ct.setTimestamp(item.getStartTime()); ci.setCompletionTime(ct); TraceCompletionInformationUtil.initialiseLinks(ci, item.getNodes().get(0).getBaseTime(), 0, n); if (log.isLoggable(Level.FINEST)) { log.finest("Creating initial completion time information = " + ci); } return ci; } } if (log.isLoggable(Level.FINEST)) { log.finest("No completion information initiated for trace fragment = " + item); } return null; }

Target:
public TraceCompletionInformation processOneToOne(String tenantId, Trace item) throws RetryAttemptException { if (!item.getNodes().isEmpty()) { Node n = item.getNodes().get(0); if (n.getClass() != Consumer.class || n.getCorrelationIds().isEmpty()) { TraceCompletionInformation ci = new TraceCompletionInformation(); CompletionTime ct = new CompletionTime(); ct.setId(item.getId()); ct.setUri(n.getUri()); ct.setOperation(n.getOperation()); if (n.getClass() == Consumer.class) { ct.setEndpointType(((Consumer) n).getEndpointType()); } ct.setBusinessTransaction(item.getBusinessTransaction()); ct.setDuration(item.calculateDuration()); ct.setPrincipal(item.getPrincipal()); ct.setFault(n.getFault()); ct.setProperties(item.allProperties()); ct.setTimestamp(item.getStartTime()); ci.setCompletionTime(ct); TraceCompletionInformationUtil.initialiseLinks(ci, n.getBaseTime(), n); if (log.isLoggable(Level.FINEST)) { log.finest("Creating initial completion time information = " + ci); } return ci; } } if (log.isLoggable(Level.FINEST)) { log.finest("No completion information initiated for trace fragment = " + item); } return null; }
Source:
void appendApproval(ApprovalCategory category, short value, Account user) { sb.append(category.getName()); sb.append(value < 0 ? "-" : "+").append(value).append(": "); appendUserData(user); sb.append("\n"); }

Target:
void appendApproval(ApprovalCategory category, short value, Account user) { sb.append(category.getName().replace(' ', '-')); sb.append(value < 0 ? "-" : "+").append(Math.abs(value)).append(": "); appendUserData(user); sb.append("\n"); }
Source:
private boolean networkIpAddressUsedByBrickChanged(VdsNetworkInterface iface, Network network) { if (iface.getBootProtocol() == NetworkBootProtocol.STATIC_IP) { List<GlusterBrickEntity> bricks = getDbFacade().getGlusterBrickDao() .getAllByClusterAndNetworkId(vds.getVdsGroupId(), network.getId()); if (bricks.isEmpty()) { return false; } VdsNetworkInterface existingIface = getExistingIfaceByNetwork(iface.getNetworkName()); if (existingIface != null) { String oldAddress = existingIface.getAddress(); return !StringUtils.isEmpty(oldAddress) && !StringUtils.equals(oldAddress, iface.getAddress()); } } return false; }

Target:
private boolean networkIpAddressUsedByBrickChanged(VdsNetworkInterface iface, Network network) { if (iface.getBootProtocol() == NetworkBootProtocol.STATIC_IP) { List<GlusterBrickEntity> bricks = getDbFacade().getGlusterBrickDao() .getAllByClusterAndNetworkId(vds.getVdsGroupId(), network.getId()); if (bricks.isEmpty()) { return false; } VdsNetworkInterface existingIface = getExistingIfaceByNetwork(iface.getNetworkName()); if (existingIface != null) { String oldAddress = existingIface.getAddress(); return StringUtils.isNotEmpty(oldAddress) && !StringUtils.equals(oldAddress, iface.getAddress()); } } return false; }