A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/commit/4e29b793d260570ccd71e36876833e4f6a67f2d4 below:

Fix ConcurrentModificationException on designer · pmd/pmd@4e29b79 · GitHub

File tree Expand file treeCollapse file tree 3 files changed

+11

-4

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+11

-4

lines changed Original file line number Diff line number Diff line change

@@ -115,6 +115,7 @@ public void free() {

115 115

backingDescriptor.ifPresent(PropertyDescriptorSpec::unbind);

116 116

backingDescriptor.setValue(null);

117 117

backingDescriptorList.setValue(null);

118 +

this.nameProperty().setValue(""); // necessary to get the validator to reevaluate each time

118 119

}

119 120 120 121 Original file line number Diff line number Diff line change

@@ -157,14 +157,13 @@ public static synchronized List<LanguageVersion> getSupportedLanguageVersions()

157 157

*/

158 158

public static <T> void rewire(Property<T> underlying, ObservableValue<? extends T> ui, Consumer<? super T> setter) {

159 159

setter.accept(underlying.getValue());

160 -

underlying.unbind();

161 -

underlying.bind(ui); // Bindings are garbage collected after the popup dies

160 +

rewire(underlying, ui);

162 161

}

163 162 164 163

/** Like rewire, with no initialisation. */

165 164

public static <T> void rewire(Property<T> underlying, ObservableValue<? extends T> source) {

166 165

underlying.unbind();

167 -

underlying.bind(source);

166 +

underlying.bind(source); // Bindings are garbage collected after the popup dies

168 167

}

169 168 170 169 Original file line number Diff line number Diff line change

@@ -6,9 +6,11 @@

6 6 7 7

import java.beans.PropertyDescriptor;

8 8

import java.lang.reflect.InvocationTargetException;

9 +

import java.util.ArrayList;

9 10

import java.util.Arrays;

10 11

import java.util.Collection;

11 12

import java.util.Iterator;

13 +

import java.util.List;

12 14

import java.util.Map;

13 15

import java.util.Map.Entry;

14 16

import java.util.stream.Collectors;

@@ -90,6 +92,9 @@ public void visit(BeanModelNodeSeq<?> model, SettingsOwner target) {

90 92 91 93

Iterator<SettingsOwner> existingItems = container.iterator();

92 94

Class<?> itemType = null;

95 +

// use a buffer to avoid concurrent modification

96 +

List<SettingsOwner> itemsToAdd = new ArrayList<>();

97 + 93 98

for (SimpleBeanModelNode child : model.getChildrenNodes()) {

94 99

SettingsOwner item;

95 100

if (existingItems.hasNext()) {

@@ -108,9 +113,11 @@ public void visit(BeanModelNodeSeq<?> model, SettingsOwner target) {

108 113

}

109 114 110 115

child.accept(this, item);

111 -

container.add(item);

116 +

itemsToAdd.add(item);

112 117

}

113 118 119 +

container.addAll(itemsToAdd);

120 + 114 121

try {

115 122

PropertyUtils.setProperty(target, model.getPropertyName(), container);

116 123

} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4