auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void describeTo(final Description description) { description.appendText("header: ") .appendDescriptionOf(this.headerm) .appendText(VALUES_STR) .appendDescriptionOf(this.valuem); }

Target:
public void describeTo(final Description description) { description.appendText("header: ") .appendDescriptionOf(this.header) .appendText(HmRsHeader.VALUES_STR) .appendDescriptionOf(this.value); }
Source:
public synchronized Transaction beginTransaction( String bookmark ) { setLastBookmark( bookmark ); return beginTransaction(); }

Target:
public synchronized Transaction beginTransaction( String bookmark ) { lastBookmark = bookmark; return beginTransaction(); }
Source:
private ChatScriptMessage createMessage(String message) throws InvalidInputMessage { ChatScriptMessage ret = null; try { ret = mapper.readValue(message, ChatScriptMessage.class); } catch (Exception e) { e.printStackTrace(); throw new InvalidInputMessage("Unable to parse the input message. Error Message" + e.getMessage()); } return ret; }

Target:
private ChatScriptMessage createMessage(String message) throws Exception { ChatScriptMessage ret = null; try { ret = mapper.readValue(message, ChatScriptMessage.class); } catch (Exception e) { e.printStackTrace(); throw new Exception("Unable to parse the input message. Error Message" + e.getMessage()); } return ret; }
Source:
@Test public void testJsonType() { check("select json_type(ename) from emp"); checkExp("json_type('{\"foo\":\"bar\"}')"); checkExpType("json_type('{\"foo\":\"bar\"}')", "VARCHAR(20) NOT NULL"); }

Target:
@Test public void testJsonType() { check("select json_type(ename) from emp"); checkExp("json_type('{\"foo\":\"bar\"}')"); checkExpType("json_type('{\"foo\":\"bar\"}')", "VARCHAR(20) NOT NULL"); checkFails("select json_type(^1^) from emp", "(.*)JSON_VALUE_EXPRESSION(.*)"); }
Source:
public AsyncJobStatusDTO populate(ModelTranslator translator, AsyncJobStatus source, AsyncJobStatusDTO destination) { if (source == null) { throw new IllegalArgumentException("source is null"); } if (destination == null) { throw new IllegalArgumentException("destination is null"); } Date created = source.getCreated(); destination.setCreated(created != null ? created.toInstant().atOffset(ZoneOffset.UTC) : null); Date updated = source.getUpdated(); destination.setUpdated(updated != null ? updated.toInstant().atOffset(ZoneOffset.UTC) : null); destination.setId(source.getId()); destination.setKey(source.getJobKey()); destination.setName(source.getName()); destination.setGroup(source.getGroup()); destination.setOrigin(source.getOrigin()); destination.setExecutor(source.getExecutor()); destination.setPrincipal(source.getPrincipalName()); JobState state = source.getState(); destination.setState(state != null ? state.name() : null); JobState pstate = source.getPreviousState(); destination.setPreviousState(pstate != null ? pstate.name() : null); Date startTime = source.getStartTime(); destination.setStartTime(startTime != null ? startTime.toInstant().atOffset(ZoneOffset.UTC) : null); Date endTime = source.getEndTime(); destination.setEndTime(endTime != null ? endTime.toInstant().atOffset(ZoneOffset.UTC) : null); destination.setAttempts(source.getAttempts()); destination.setMaxAttempts(source.getMaxAttempts()); destination.setStatusPath("/jobs/" + source.getId()); destination.setResultData(source.getJobResult()); return destination; }

Target:
public AsyncJobStatusDTO populate(ModelTranslator translator, AsyncJobStatus source, AsyncJobStatusDTO destination) { if (source == null) { throw new IllegalArgumentException("source is null"); } if (destination == null) { throw new IllegalArgumentException("destination is null"); } destination.created(source.getCreated() != null ? source.getCreated().toInstant().atOffset(ZoneOffset.UTC) : null) .updated(source.getUpdated() != null ? source.getUpdated().toInstant().atOffset(ZoneOffset.UTC) : null) .id(source.getId()) .key(source.getJobKey()) .name(source.getName()) .group(source.getGroup()) .origin(source.getOrigin()) .executor(source.getExecutor()) .principal(source.getPrincipalName()) .state(source.getState() != null ? source.getState().name() : null) .previousState(source.getPreviousState() != null ? source.getPreviousState().name() : null) .startTime(source.getStartTime() != null ? source.getStartTime().toInstant().atOffset(ZoneOffset.UTC) : null) .endTime(source.getEndTime() != null ? source.getEndTime().toInstant().atOffset(ZoneOffset.UTC) : null) .attempts(source.getAttempts()) .maxAttempts(source.getMaxAttempts()) .statusPath(source.getId() != null ? String.format("/jobs/%s", source.getId()) : null) .resultData(source.getJobResult()); return destination; }
Source:
public static void setUpBeforeClass() throws IOException { final Set<Class<?>> checks = CheckUtil.getCheckstyleChecks() .stream() .filter(check -> !AbstractJavadocCheck.class.isAssignableFrom(check)) .collect(Collectors.toSet()); simpleCheckNames = CheckUtil.getSimpleNames(checks); allowedDirectoryAndChecks = simpleCheckNames .stream() .collect(Collectors.toMap(id -> id.toLowerCase(Locale.ENGLISH), id -> id)); }

Target:
public static void setUpBeforeClass() throws IOException { simpleCheckNames = CheckUtil.getSimpleNames(CheckUtil.getCheckstyleChecks()); allowedDirectoryAndChecks = simpleCheckNames .stream() .collect(Collectors.toMap(id -> id.toLowerCase(Locale.ENGLISH), id -> id)); }
Source:
public void getUserCardsShouldReturnTheRequest() throws Exception { final AtomicReference<Request> bodyRef = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); final RestAdapter adapter = new RestAdapter.Builder().setEndpoint(MOCK_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { bodyRef.set(request); latch.countDown(); return null; } }).build(); final UserCardService userCardService = adapter.create(UserCardService.class); userCardService.getUserCards(new RetrofitPromise<List<Card>>()); latch.await(); Assert.assertEquals(bodyRef.get().getUrl(), String.format("%s/v0/me/cards", MOCK_URL)); Assert.assertEquals(bodyRef.get().getMethod(), "GET"); }

Target:
public void getUserCardsShouldReturnTheRequest() throws Exception { final AtomicReference<Request> bodyRef = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); final RestAdapter adapter = new RestAdapter.Builder().setEndpoint(MOCK_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { bodyRef.set(request); latch.countDown(); return null; } }).build(); final UserCardService userCardService = adapter.create(UserCardService.class); userCardService.getUserCards(new RetrofitPromise<List<Card>>()); latch.await(); Assert.assertEquals(bodyRef.get().getMethod(), "GET"); Assert.assertEquals(bodyRef.get().getUrl(), String.format("%s/v0/me/cards", MOCK_URL)); }
Source:
public boolean checkAccess(File f, int access) { final int mode; switch (access) { case FileSystem.ACCESS_OK: mode = OsConstants.F_OK; break; case FileSystem.ACCESS_READ: mode = OsConstants.R_OK; break; case FileSystem.ACCESS_WRITE: mode = OsConstants.W_OK; break; case FileSystem.ACCESS_EXECUTE: mode = OsConstants.X_OK; break; default: throw new IllegalArgumentException(); } try { return Libcore.os.access(f.getPath(), mode); } catch (ErrnoException e) { return false; } }

Target:
public boolean checkAccess(File f, int access) { final int mode; switch (access) { case FileSystem.ACCESS_OK: mode = OsConstants.F_OK; break; case FileSystem.ACCESS_READ: mode = OsConstants.R_OK; break; case FileSystem.ACCESS_WRITE: mode = OsConstants.W_OK; break; case FileSystem.ACCESS_EXECUTE: mode = OsConstants.X_OK; break; default: throw new IllegalArgumentException("Bad access mode: " + access); } try { return Libcore.os.access(f.getPath(), mode); } catch (ErrnoException e) { return false; } }
Source:
public T setBody(Publisher<ByteBuffer> publisher) { return setBody(new ReactiveStreamsBodyGenerator(publisher)); }

Target:
public T setBody(Publisher<ByteBuffer> publisher) { return setBody(publisher, -1L); }
Source:
private Map<StoreKey, ReplicationStatus> getBlobStatusByReplica(File[] replicas, Map<File, DumpIndexTool.IndexProcessingResults> results) throws Exception { Map<StoreKey, ReplicationStatus> keyReplicationStatusMap = new HashMap<>(); Map<StoreKey, StoreKey> convertMap = createConversionKeyMap(replicas, results); for (File replica : replicas) { DumpIndexTool.IndexProcessingResults result = results.get(replica); for (Map.Entry<StoreKey, DumpIndexTool.Info> entry : result.getKeyToState().entrySet()) { StoreKey key = entry.getKey(); StoreKey newKey = convertMap.get(key); boolean isDeprecated = false; if (newKey == null) { newKey = key; isDeprecated = true; } if (!keyReplicationStatusMap.containsKey(newKey)) { keyReplicationStatusMap.put(newKey, new ReplicationStatus(replicas)); } ReplicationStatus status = keyReplicationStatusMap.get(newKey); DumpIndexTool.Info info = entry.getValue(); status.setBelongsToRecentIndexSegment(info.isInRecentIndexSegment()); if (!isDeprecated && info.getStates().contains(DumpIndexTool.BlobState.Valid)) { status.addAvailable(replica); } else { status.addDeletedOrExpired(replica); } } } return keyReplicationStatusMap; }

Target:
private Map<StoreKey, ReplicationStatus> getBlobStatusByReplica(File[] replicas, Map<File, DumpIndexTool.IndexProcessingResults> results) throws Exception { Map<StoreKey, ReplicationStatus> keyReplicationStatusMap = new HashMap<>(); Map<StoreKey, StoreKey> convertMap = dumpIndexTool.createConversionKeyMap(replicas, results); for (File replica : replicas) { DumpIndexTool.IndexProcessingResults result = results.get(replica); for (Map.Entry<StoreKey, DumpIndexTool.Info> entry : result.getKeyToState().entrySet()) { StoreKey key = entry.getKey(); StoreKey newKey = convertMap.get(key); boolean isDeprecated = false; if (newKey == null) { newKey = key; isDeprecated = true; } ReplicationStatus status = keyReplicationStatusMap.computeIfAbsent(newKey, k -> new ReplicationStatus(replicas)); DumpIndexTool.Info info = entry.getValue(); status.setBelongsToRecentIndexSegment(info.isInRecentIndexSegment()); if (!isDeprecated && info.getStates().contains(DumpIndexTool.BlobState.Valid)) { status.addAvailable(replica); } else { status.addDeletedOrExpired(replica); } } } return keyReplicationStatusMap; }
Source:
public boolean containsDate(LocalDate date) { if (isEmpty() || date.isBefore(startDate) ) { return false; } else { if (dateCalculation == SKIP_WEEKENDS && isWeekend(date)) { return false; } int position = dateCalculation.calculatePosition(startDate, date); return position < points.length && isValidPoint(points[position]); } }

Target:
public boolean containsDate(LocalDate date) { return get(date).isPresent(); }
Source:
protected ContainerScheduler createContainerScheduler(Context cntxt) { return new ContainerScheduler(cntxt); }

Target:
protected ContainerScheduler createContainerScheduler(Context cntxt) { return new ContainerScheduler(cntxt, dispatcher, metrics); }
Source:
public long add( Object id ) { String string = (String) id; byte[] bytes = UTF8.encode( string ); int length = bytes.length; if ( length > 0xFFFF ) { throw new IllegalArgumentException( string ); } long endOffset = offset + 2 + bytes.length; ByteArray end = cache.at( endOffset ); if ( end != current ) { offset = endOffset; current = end; } long startOffset = offset; current.setByte( offset++, 0, (byte) (length & 0xFF) ); current.setByte( offset++, 0, (byte) ((length >>> 8) & 0xFF) ); for ( byte charByte : bytes ) { current.setByte( offset++, 0, charByte ); } return startOffset; }

Target:
public long add( Object id ) { String string = (String) id; byte[] bytes = UTF8.encode( string ); int length = bytes.length; if ( length > 0xFFFF ) { throw new IllegalArgumentException( string ); } if ( offset % chunkSize >= chunkSize - 2 ) { offset += chunkSize - (offset % chunkSize); current = cache.at( offset ); } long startOffset = offset; current.setShort( offset, 0, (short) length ); offset += 2; for ( int i = 0; i < length; ) { int bytesLeftToWrite = length - i; int bytesLeftInChunk = (int) (chunkSize - offset % chunkSize); int bytesToWriteInThisChunk = min( bytesLeftToWrite, bytesLeftInChunk ); for ( int j = 0; j < bytesToWriteInThisChunk; j++ ) { current.setByte( offset++, 0, bytes[i++] ); } if ( length > i ) { current = cache.at( offset ); } } return startOffset; }
Source:
protected void handleMessageInternal(Message<?> message) throws Exception { String topic = this.determineTopic(message); Object value = this.messageConverter.fromMessage(message); if (value instanceof byte[]) { this.template.convertAndSend(topic, value); } else { this.template.convertAndSend(topic, ((RedisSerializer<Object>) this.serializer).serialize(value)); } }

Target:
protected void handleMessageInternal(Message<?> message) throws Exception { String topic = this.topicExpression.getValue(this.evaluationContext, message, String.class); Object value = this.messageConverter.fromMessage(message); if (value instanceof byte[]) { this.template.convertAndSend(topic, value); } else { this.template.convertAndSend(topic, ((RedisSerializer<Object>) this.serializer).serialize(value)); } }
Source:
public static void main(String[] args) { String url = args[0]; String sampleNumber = args[1]; String filePath = args[2]; log.info("Starting WSO2 Soap Client"); ServiceClient serviceClient; try { serviceClient = new ServiceClient(); Options options = new Options(); options.setTo(new EndpointReference(url)); serviceClient.setOptions(options); if (serviceClient != null) { filePath = SoapUtil.getMessageFilePath(sampleNumber, filePath, url); readMsg(filePath); OMElement omElement1; try { System.out.println("Starting sending of events..."); omElement1 = AXIOMUtil.stringToOM(message.toString()); serviceClient.fireAndForget(omElement1); log.info("Message sent"); } catch (XMLStreamException e) { e.printStackTrace(); } catch (AxisFault axisFault) { axisFault.printStackTrace(); } } } catch (Throwable t) { t.printStackTrace(); } }

Target:
public static void main(String[] args) { String url = args[0]; String sampleNumber = args[1]; String filePath = args[2]; log.info("Starting WSO2 Soap Client"); ServiceClient serviceClient; try { serviceClient = new ServiceClient(); Options options = new Options(); options.setTo(new EndpointReference(url)); serviceClient.setOptions(options); if (serviceClient != null) { filePath = SoapUtil.getMessageFilePath(sampleNumber, filePath, url); readMsg(filePath); OMElement omElement1; try { System.out.println("Starting sending of events..."); omElement1 = AXIOMUtil.stringToOM(message.toString()); serviceClient.fireAndForget(omElement1); log.info("Message sent"); } catch (XMLStreamException e) { log.error("Error occurred when sending message " + message.toString(), e); } catch (AxisFault axisFault) { log.error("Error occurred when sending message " + message.toString(), axisFault); } } } catch (Throwable t) { log.error("Error occurred when connecting to endpoint " + url, t); } }
Source:
public void refresh(HelixDataAccessor accessor) { long startTime = System.currentTimeMillis(); PropertyKey.Builder keyBuilder = accessor.keyBuilder(); Set<PropertyKey> currentPropertyKeys = new HashSet<>(); List<String> resources = accessor.getChildNames(externalViewsKey(keyBuilder)); for (String resource : resources) { currentPropertyKeys.add(externalViewKey(keyBuilder, resource)); } Set<PropertyKey> cachedKeys = new HashSet<>(); Map<PropertyKey, ExternalView> cachedExternalViewMap = Maps.newHashMap(); for (String resource : _externalViewCache.keySet()) { PropertyKey key = externalViewKey(keyBuilder, resource); cachedKeys.add(key); cachedExternalViewMap.put(key, _externalViewCache.get(resource)); } cachedKeys.retainAll(currentPropertyKeys); Set<PropertyKey> reloadKeys = new HashSet<>(currentPropertyKeys); reloadKeys.removeAll(cachedKeys); Map<PropertyKey, ExternalView> updatedMap = refreshProperties(accessor, reloadKeys, new ArrayList<>(cachedKeys), cachedExternalViewMap, reloadKeys); Map<String, ExternalView> newExternalViewMap = Maps.newHashMap(); for (ExternalView externalView : updatedMap.values()) { newExternalViewMap.put(externalView.getResourceName(), externalView); } _externalViewCache = new HashMap<>(newExternalViewMap); _externalViewMap = new HashMap<>(newExternalViewMap); long endTime = System.currentTimeMillis(); LOG.info("Refresh " + _externalViewMap.size() + " ExternalViews for cluster " + _clusterName + ", took " + (endTime - startTime) + " ms"); }

Target:
public void refresh(HelixDataAccessor accessor) { long startTime = System.currentTimeMillis(); PropertyKey.Builder keyBuilder = accessor.keyBuilder(); Set<PropertyKey> currentPropertyKeys = new HashSet<>(); List<String> resources = accessor.getChildNames(externalViewsKey(keyBuilder)); for (String resource : resources) { currentPropertyKeys.add(externalViewKey(keyBuilder, resource)); } Set<PropertyKey> cachedKeys = new HashSet<>(); Map<PropertyKey, ExternalView> cachedExternalViewMap = Maps.newHashMap(); for (String resource : _externalViewCache.keySet()) { PropertyKey key = externalViewKey(keyBuilder, resource); cachedKeys.add(key); cachedExternalViewMap.put(key, _externalViewCache.get(resource)); } cachedKeys.retainAll(currentPropertyKeys); Set<PropertyKey> reloadKeys = new HashSet<>(currentPropertyKeys); reloadKeys.removeAll(cachedKeys); Map<PropertyKey, ExternalView> updatedMap = refreshProperties(accessor, reloadKeys, new ArrayList<>(cachedKeys), cachedExternalViewMap, new HashSet<>()); Map<String, ExternalView> newExternalViewMap = Maps.newHashMap(); for (ExternalView externalView : updatedMap.values()) { newExternalViewMap.put(externalView.getResourceName(), externalView); } _externalViewCache = new HashMap<>(newExternalViewMap); _externalViewMap = new HashMap<>(newExternalViewMap); long endTime = System.currentTimeMillis(); LOG.info("Refresh " + _externalViewMap.size() + " ExternalViews for cluster " + _clusterName + ", took " + (endTime - startTime) + " ms"); }
Source:
protected void runChild(final FrameworkMethod method, RunNotifier notifier) { Description description = describeChild(method); if (isIgnored(method)) { notifier.fireTestIgnored(description); } else { Object test = null; try { test = new ReflectiveCallable() { @Override protected Object runReflectiveCall() throws Throwable { return createTest(); } }.run(); } catch (Throwable e) { StatusHandler.log(new Status(IStatus.ERROR, "org.eclipse.mylyn.commons.sdk.util", NLS.bind("TestClassRunnerForFixture: Testclass {0} has no public constructor", getTestClass().getName()), e)); return; } boolean skipped = false; if (test != null) { List<TestRule> testRules = getTestRules(test); for (TestRule testRule : testRules) { Class<? extends TestRule> klass = testRule.getClass(); klass.getCanonicalName(); if (klass == ConditionalIgnoreRule.class) { Statement statement = testRule.apply(null, description); if (statement != null) { skipped = true; break; } } } if (skipped) { notifier.fireTestIgnored(description); } else { runTest(methodBlock(method), description, notifier); } } } }

Target:
protected void runChild(final FrameworkMethod method, RunNotifier notifier) { Description description = describeChild(method); if (isIgnored(method)) { notifier.fireTestIgnored(description); } else { Object test = null; try { test = new ReflectiveCallable() { @Override protected Object runReflectiveCall() throws Throwable { return createTest(); } }.run(); } catch (Throwable e) { StatusHandler.log(new Status(IStatus.ERROR, "org.eclipse.mylyn.commons.sdk.util", NLS.bind("TestClassRunnerForFixture: Testclass {0} has no public constructor", getTestClass().getName()), e)); return; } boolean skipped = false; if (test != null) { List<TestRule> testRules = getTestRules(test); for (TestRule testRule : testRules) { if (testRule instanceof ConditionalIgnoreRule) { Statement statement = testRule.apply(null, description); if (statement instanceof IgnoreStatement) { skipped = true; break; } } } if (skipped) { notifier.fireTestIgnored(description); } else { runTest(methodBlock(method), description, notifier); } } } }
Source:
ValidationResult validateNotRemovingUsedNetworkByVms() { Collection<String> removedNetworks = new HashSet<>(); for (NetworkAttachment removedAttachment : removedNetworkAttachments) { removedNetworks.add(existingNetworkRelatedToAttachment(removedAttachment).getName()); } final List<String> vmNames = getVmInterfaceManager().findActiveVmsUsingNetworks(host.getId(), removedNetworks); final List<String> sortedRemovedNetworks = new ArrayList<>(removedNetworks); Collections.sort(sortedRemovedNetworks); if (vmNames.isEmpty()) { return ValidationResult.VALID; } else if (vmNames.size() > 1 && sortedRemovedNetworks.size() > 1) { return new ValidationResult(EngineMessage.MULTIPLE_NETWORKS_CANNOT_DETACH_NETWORKS_USED_BY_VMS, LinqUtils.concat(ReplacementUtils.replaceWith(VAR_NETWORK_NAMES, sortedRemovedNetworks), ReplacementUtils.replaceWith(VAR_VM_NAMES, vmNames))); } else if (vmNames.size() > 1) { return new ValidationResult(EngineMessage.NETWORK_CANNOT_DETACH_NETWORK_USED_BY_VMS, LinqUtils.concat( ReplacementUtils.replaceWith(VAR_NETWORK_NAME, sortedRemovedNetworks), ReplacementUtils.replaceWith(VAR_VM_NAMES, vmNames))); } else if (vmNames.size() == 1 && sortedRemovedNetworks.size() > 1) { return new ValidationResult(EngineMessage.MULTIPLE_NETWORKS_CANNOT_DETACH_NETWORKS_USED_BY_SINGLE_VM, LinqUtils.concat( ReplacementUtils.replaceWith(VAR_NETWORK_NAMES, sortedRemovedNetworks), ReplacementUtils.replaceWith(VAR_VM_NAME, vmNames))); } else { return new ValidationResult(EngineMessage.NETWORK_CANNOT_DETACH_NETWORK_USED_BY_SINGLE_VM, LinqUtils.concat( ReplacementUtils.replaceWith(VAR_NETWORK_NAME, sortedRemovedNetworks), ReplacementUtils.replaceWith(VAR_VM_NAME, vmNames))); } }

Target:
ValidationResult validateNotRemovingUsedNetworkByVms() { Collection<String> removedNetworks = new HashSet<>(); for (NetworkAttachment removedAttachment : removedNetworkAttachments) { removedNetworks.add(existingNetworkRelatedToAttachment(removedAttachment).getName()); } final List<String> vmsNames = getVmInterfaceManager().findActiveVmsUsingNetworks(host.getId(), removedNetworks); final List<String> sortedRemovedNetworks = new ArrayList<>(removedNetworks); Collections.sort(sortedRemovedNetworks); DetachNetworkUsedByVmValidator detachNetworkUsedByVmValidator = new DetachNetworkUsedByVmValidator(vmsNames, sortedRemovedNetworks); return detachNetworkUsedByVmValidator.validate(); }
Source:
public void postCollectionDefaultItemReadGroupCreateDefaultItemReadGroupUnProcessablePermanent() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); groupRest.setPermanent(true); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/itemReadGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnprocessableEntity()); }

Target:
public void postCollectionDefaultItemReadGroupCreateDefaultItemReadGroupUnProcessablePermanent() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); groupRest.setPermanent(true); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/itemReadGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnprocessableEntity()); Group anon = groupService.findByName(context, Group.ANONYMOUS); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/itemReadGroup")) .andExpect(status().isOk()) .andExpect( jsonPath("$", GroupMatcher.matchGroupEntry(anon.getID(), anon.getName()))); }
Source:
public synchronized EurekaClientConfig get() { return namespace == null ? new DefaultEurekaClientConfig() : new DefaultEurekaClientConfig(namespace); }

Target:
public synchronized EurekaClientConfig get() { if (config == null) { config = (namespace == null) ? new DefaultEurekaClientConfig() : new DefaultEurekaClientConfig(namespace); DiscoveryManager.getInstance().setEurekaClientConfig(config); } return config; }
Source:
private String buildQuery(String folderId, String formattedDateTimeFrom) { return "'"+folderId+"' in parents and mimeType != '" + FOLDER_MIME_TYPE + "' and modifiedTime <= '" + formattedDateTimeFrom + "'"; }

Target:
static String buildQuery(String folderId, String formattedDateTimeFrom) { return String.format("'%s' in parents and mimeType != '%s' and modifiedTime <= '%s'", folderId, FOLDER_MIME_TYPE, formattedDateTimeFrom); }
Source:
public void testGetAllByRLSId() { List<RecordLocatorService> result = RecordLocationServiceDAO.getAllPatientsBy("111222"); assertEquals(2, result.size()); result = RecordLocationServiceDAO.getAllPatientsBy("111223"); assertEquals(1, result.size()); result = RecordLocationServiceDAO.getAllPatientsBy("111224"); assertEquals(1, result.size()); result = RecordLocationServiceDAO.getAllPatientsBy("111225"); assertEquals(1, result.size()); result = RecordLocationServiceDAO.getAllPatientsBy("N0n-Ex!sT@nT"); assertEquals(0, result.size()); }

Target:
public void testGetAllByRLSId() { List<RecordLocatorService> result = RecordLocationServiceDAO.getAllPatientsBy("38273N234"); assertEquals(2, result.size()); result = RecordLocationServiceDAO.getAllPatientsBy("38273N233"); assertEquals(1, result.size()); result = RecordLocationServiceDAO.getAllPatientsBy("38273N244"); assertEquals(2, result.size()); result = RecordLocationServiceDAO.getAllPatientsBy("N0n-Ex!sT@nT"); assertEquals(0, result.size()); }
Source:
public void pull(final PullFilters filters, final IPullControllerCallback callback) { conversionLocalDataSource.wipeDataBase(); PULL_IS_ACTIVE = true; this.callback = callback; if (filters.isDemo()) { callback.onStep(PullStep.DEMO); LocalAsyncPull localAsyncPull = new LocalAsyncPull(); localAsyncPull.execute(); return; } conversionLocalDataSource = new ConversionLocalDataSource(callback); pullRemoteDataSource = new PullDhisSDKDataSource(); pullRemoteDataSource.wipeDataBase(); callback.onStep(PullStep.PROGRAMS); pullRemoteDataSource.pullMetadata(new IPullSourceCallback() { @Override public void onComplete() { if (!PULL_IS_ACTIVE) { callback.onCancel(); return; } callback.onStep(PullStep.EVENTS); pullData(filters); } @Override public void onError(Throwable throwable) { throwable.printStackTrace(); callback.onError(throwable); } }); }

Target:
public void pull(final PullFilters filters, final IPullControllerCallback callback) { conversionLocalDataSource.wipeDataBase(); PULL_IS_ACTIVE = true; this.callback = callback; conversionLocalDataSource = new ConversionLocalDataSource(callback); pullRemoteDataSource = new PullDhisSDKDataSource(); pullRemoteDataSource.wipeDataBase(); callback.onStep(PullStep.PROGRAMS); pullRemoteDataSource.pullMetadata(new IPullSourceCallback() { @Override public void onComplete() { if (!PULL_IS_ACTIVE) { callback.onCancel(); return; } callback.onStep(PullStep.EVENTS); pullData(filters); } @Override public void onError(Throwable throwable) { throwable.printStackTrace(); callback.onError(throwable); } }); }
Source:
void clean() throws IOException { Project rootProject = getProject(); Path rootProjectPath = rootProject.getProjectDir().toPath(); File okbuckState = rootProject.file(OkBuckGradlePlugin.OKBUCK_STATE); Set<String> lastProjectPaths; if (okbuckState.exists()) { try (Stream<String> lines = Files.lines(okbuckState.toPath())) { lastProjectPaths = lines.map(String::trim) .filter(s -> s.length() > 0) .collect(MoreCollectors.toImmutableSet()); } } else { lastProjectPaths = ImmutableSet.of(); okbuckState.getParentFile().mkdirs(); okbuckState.createNewFile(); } Set<String> currentProjectPaths = projects .stream() .filter(project -> ProjectUtil.getType(project) != ProjectType.UNKNOWN) .map(project -> rootProjectPath.relativize(project.getProjectDir().toPath()).toString()) .collect(MoreCollectors.toImmutableSet()); Sets.SetView<String> difference = Sets.difference(lastProjectPaths, currentProjectPaths); difference .stream() .map(p -> rootProjectPath.resolve(p).resolve(OkBuckGradlePlugin.BUCK)) .forEach(FileUtil::deleteQuietly); Files.write( okbuckState.toPath(), currentProjectPaths.stream().sorted().collect(MoreCollectors.toImmutableList())); }

Target:
void clean() throws IOException { Project rootProject = getProject(); Path rootProjectPath = rootProject.getProjectDir().toPath(); File okbuckState = rootProject.file(OkBuckGradlePlugin.OKBUCK_STATE); Set<String> lastProjectPaths; if (okbuckState.exists()) { try (Stream<String> lines = Files.lines(okbuckState.toPath())) { lastProjectPaths = lines .map(String::trim) .filter(s -> !Strings.isNullOrEmpty(s)) .collect(MoreCollectors.toImmutableSet()); } } else { lastProjectPaths = ImmutableSet.of(); okbuckState.getParentFile().mkdirs(); okbuckState.createNewFile(); } Set<String> currentProjectPaths = projects .stream() .filter(project -> ProjectUtil.getType(project) != ProjectType.UNKNOWN) .map(project -> rootProjectPath.relativize(project.getProjectDir().toPath()).toString()) .collect(MoreCollectors.toImmutableSet()); Sets.SetView<String> difference = Sets.difference(lastProjectPaths, currentProjectPaths); difference .stream() .map(p -> rootProjectPath.resolve(p).resolve(OkBuckGradlePlugin.BUCK)) .forEach(FileUtil::deleteQuietly); Files.write( okbuckState.toPath(), currentProjectPaths.stream().sorted().collect(MoreCollectors.toImmutableList())); }
Source:
default <T> Optional<T> get(String key, Function<String, T> transformer) { return get(key).map(input -> { try { return transformer.apply(input); } catch (Exception ex) { String message = String.format("Failed to convert configuration parameter with key '%s' for input: %s", key, input); throw new JUnitException(message, ex); } }); }

Target:
default <T> Optional<T> get(String key, Function<String, T> transformer) { Preconditions.notNull(transformer, "transformer must not be null"); return get(key).map(input -> { try { return transformer.apply(input); } catch (Exception ex) { String message = String.format( "Failed to transform configuration parameter with key '%s' and initial value '%s'", key, input); throw new JUnitException(message, ex); } }); }
Source:
public static <T extends CharSequence> Predicate<T> containsAllLiterals(final String... fragments) { return Predicates.and(Iterables.transform(Arrays.asList(fragments), new ConvertStringToContainsLiteralPredicate())); }

Target:
public static <T extends CharSequence> Predicate<T> containsAllLiterals(final String... fragments) { List<Predicate<CharSequence>> fragmentPredicates = Lists.newArrayList(); for (String fragment : fragments) { fragmentPredicates.add(containsLiteral(fragment)); } return Predicates.and(fragmentPredicates); }
Source:
public void testGeneratePasswordFromPassPhrase() throws Exception { final String algorithm = ALGORITHM_OTP_SHA1; final SaslClientFactory clientFactory = obtainSaslClientFactory(OTPSaslClientFactory.class); assertNotNull(clientFactory); PasswordFactory passwordFactory = PasswordFactory.getInstance(algorithm); final Password password = passwordFactory.generatePassword(new OneTimePasswordSpec(CodePointIterator.ofString("103029b112deb117").hexDecode().drain(), "TeSt".getBytes(StandardCharsets.US_ASCII), 100)); OneTimePasswordAlgorithmSpec otpSpec = new OneTimePasswordAlgorithmSpec(algorithm, "TeSt", 100); EncryptablePasswordSpec passwordSpec = new EncryptablePasswordSpec("This is a test.".toCharArray(), otpSpec); OneTimePassword generatedOTPassword = (OneTimePassword) passwordFactory.generatePassword(passwordSpec); assertTrue(password.equals(generatedOTPassword)); }

Target:
public void testGeneratePasswordFromPassPhrase() throws Exception { final String algorithm = ALGORITHM_OTP_SHA1; PasswordFactory passwordFactory = PasswordFactory.getInstance(algorithm); final Password password = passwordFactory.generatePassword(new OneTimePasswordSpec(CodePointIterator.ofString("103029b112deb117").hexDecode().drain(), "TeSt", 100)); OneTimePasswordAlgorithmSpec otpSpec = new OneTimePasswordAlgorithmSpec(algorithm, "TeSt", 100); EncryptablePasswordSpec passwordSpec = new EncryptablePasswordSpec("This is a test.".toCharArray(), otpSpec); OneTimePassword generatedOTPassword = (OneTimePassword) passwordFactory.generatePassword(passwordSpec); assertTrue(password.equals(generatedOTPassword)); }
Source:
public static String escape(Object content) { return escapeAttributeValue(Objects.toString(content, null)); }

Target:
public static String escape(Object content) { return escape(Objects.toString(content, null)); }
Source:
private static String getNormalizedPointsListColorizedDescending(int[] subs, int index){ List<String> result = new ArrayList<String>(); for(int i=0 ; i<subs.length ; i++){ if(i==index){ continue; } result.add(getPointsAsColorizedHtml(subs[i])); } if (result.isEmpty()) { return "<span class=\"color_neutral\" data-toggle=\"tooltip\" data-placement=\"top\" " + "title=\"Not Available: There is no data for this or the data is not enough\">N/A</span>"; } Collections.sort(result); Collections.reverse(result); String resultString = ""; for(String s : result){ if(!resultString.isEmpty()){ resultString+=", "; } resultString += s; } return resultString; }

Target:
private static String getNormalizedPointsListColorizedDescending(int[] subs, int index){ List<String> result = new ArrayList<String>(); for(int i=0 ; i<subs.length ; i++){ if(i==index){ continue; } result.add(getPointsAsColorizedHtml(subs[i])); } if (result.isEmpty()) { return getPointsAsColorizedHtml(Const.POINTS_NOT_SUBMITTED); } Collections.sort(result); Collections.reverse(result); String resultString = ""; for(String s : result){ if(!resultString.isEmpty()){ resultString+=", "; } resultString += s; } return resultString; }
Source:
public static List<String> getValidFenceAgentTypes(String clusterCompatibilityVersion) { return Arrays.asList(FenceConfigHelper.getFenceConfigurationValue( ConfigValues.VdsFenceType.name(), clusterCompatibilityVersion).split(",")); }

Target:
public static Set<String> getValidFenceAgentTypes(String clusterCompatibilityVersion) { return new HashSet<>(Arrays.asList(FenceConfigHelper.getFenceConfigurationValue( ConfigValues.VdsFenceType.name(), clusterCompatibilityVersion).split(COMMA))); }
Source:
NonBlockingRouter(RouterConfig routerConfig, NonBlockingRouterMetrics routerMetrics, NetworkClientFactory networkClientFactory, NotificationSystem notificationSystem, ClusterMap clusterMap, Time time) throws IOException { this.routerConfig = routerConfig; this.routerMetrics = routerMetrics; this.networkClientFactory = networkClientFactory; this.notificationSystem = notificationSystem; this.clusterMap = clusterMap; responseHandler = new ResponseHandler(clusterMap); this.time = time; ocCount = routerConfig.routerScalingUnitCount; ocList = new ArrayList<>(); for (int i = 0; i < ocCount; i++) { ocList.add(new OperationController(Integer.toString(i))); } backgroundDeleter = new BackgroundDeleter(); ocList.add(backgroundDeleter); routerMetrics.initializeNumActiveOperationsMetrics(currentOperationsCount); }

Target:
NonBlockingRouter(RouterConfig routerConfig, NonBlockingRouterMetrics routerMetrics, NetworkClientFactory networkClientFactory, NotificationSystem notificationSystem, ClusterMap clusterMap, Time time) throws IOException { this.routerConfig = routerConfig; this.routerMetrics = routerMetrics; this.networkClientFactory = networkClientFactory; this.notificationSystem = notificationSystem; this.clusterMap = clusterMap; responseHandler = new ResponseHandler(clusterMap); this.time = time; ocCount = routerConfig.routerScalingUnitCount; ocList = new ArrayList<>(); for (int i = 0; i < ocCount; i++) { ocList.add(new OperationController(Integer.toString(i))); } backgroundDeleter = new BackgroundDeleter(); ocList.add(backgroundDeleter); routerMetrics.initializeNumActiveOperationsMetrics(currentOperationsCount, currentBackgroundOperationsCount); }
Source:
public List<CommunicationDetails> getById(String tenantId, String id) { QueryFactory<?> queryFactory = Search.getQueryFactory(communicationDetails); Query query = queryFactory.from(CommunicationDetails.class) .having("id") .eq(id) .toBuilder().build(); return query.list(); }

Target:
public List<CommunicationDetails> getById(String tenantId, String id) { if (id == null) { throw new NullPointerException("Id should not be null!"); } QueryFactory<?> queryFactory = Search.getQueryFactory(communicationDetails); Query query = queryFactory.from(CommunicationDetails.class) .having("id") .eq(id) .toBuilder().build(); return query.list(); }
Source:
private void refreshLunSize(StorageDomain incoming, StorageDomain storageDomain, StorageType storageType) { if (incoming.getStorage() == null) { return; } List<LogicalUnit> incomingLuns = getIncomingLuns(incoming.getStorage()); if (!incomingLuns.isEmpty()) { List<LogicalUnit> lunsToResize = new ArrayList<>(); for(LogicalUnit logicalUnit: incomingLuns){ if(logicalUnit.isSetRefreshSize() && logicalUnit.isRefreshSize()){ lunsToResize.add(logicalUnit); } } if(!lunsToResize.isEmpty()){ ExtendSANStorageDomainParameters params = createParameters(guid, lunsToResize, false); performAction(VdcActionType.RefreshLunsSize, params); } } }

Target:
private void refreshLunSize(StorageDomain incoming, StorageDomain storageDomain, StorageType storageType) { if (incoming.getStorage() == null) { return; } List<LogicalUnit> incomingLuns = getIncomingLuns(incoming.getStorage()); List<LogicalUnit> lunsToResize = new ArrayList<>(); for (LogicalUnit logicalUnit : incomingLuns) { if (logicalUnit.isSetNeedsResize() && logicalUnit.isNeedsResize()) { lunsToResize.add(logicalUnit); } } if (!lunsToResize.isEmpty()) { ExtendSANStorageDomainParameters params = createParameters(guid, lunsToResize, false); performAction(VdcActionType.RefreshLunsSize, params); } }
Source:
public boolean containsElementWithId(String plotId) { if (layout == Layout.ONE_COLUMN) { for (int i = 0; i < getWidgetCount(); i ++) { HorizontalPanel hp = (HorizontalPanel) getWidget(i); if (plotId.equals(hp.getWidget(0).getElement().getId())) { return true; } } } else { for (int i = 0; i < getWidgetCount(); i ++) { HorizontalPanel hp = (HorizontalPanel) getWidget(i); for (int j = 0; j < hp.getWidgetCount(); j++) { if (plotId.equals(hp.getWidget(j).getElement().getId())) { return true; } } } } return false; }

Target:
public boolean containsElementWithId(String plotId) { for (int i = 0; i < getWidgetCount(); i ++) { HorizontalPanel hp = (HorizontalPanel) getWidget(i); for (int j = 0; j < hp.getWidgetCount(); j++) { if (plotId.equals(hp.getWidget(j).getElement().getId())) { return true; } } } return false; }
Source:
private Observation getObservation(String lookupName, Map<String, String> lookupFields, String configName) { ObservationListResult observations; Observation latestObservation = null; switch(lookupName) { case BY_PATIENT_UUID_AND_CONCEPT_UUID: observations = observationService.getObservationByPatientUUIDAndConceptUUID(configName, lookupFields.get(PATIENT_UUID), lookupFields.get(CONCEPT_UUID)); if (CollectionUtils.isNotEmpty(observations.getResults())) { latestObservation = observationService.getObservationByUuid(configName, observations.getResults().get(0).getUuid()); latestObservation.setNumberOfObservations("1"); } break; default: LOGGER.error("Lookup with name doesn't exist for observation object", lookupName); break; } if (latestObservation == null) { latestObservation = new Observation(); latestObservation.setNumberOfObservations("0"); } return latestObservation; }

Target:
private Observation getObservation(String lookupName, Map<String, String> lookupFields, String configName) { ObservationListResult observations; Observation latestObservation = null; switch(lookupName) { case BY_PATIENT_UUID_AND_CONCEPT_UUID: observations = observationService.getObservationByPatientUUIDAndConceptUUID(configName, lookupFields.get(PATIENT_UUID), lookupFields.get(CONCEPT_UUID)); latestObservation = getLatestObservation(configName, observations); break; default: LOGGER.error("Lookup with name doesn't exist for observation object", lookupName); break; } return latestObservation; }
Source:
public void saveDraftShouldDeleteDraftIfTitleAndBodyAreEmptyAndRecipientIsNotExists() throws Exception { mockMvc = MockMvcBuilders.standaloneSetup(controller).build(); saveDraft(EMPTY, EMPTY, null).andExpect(model() .attributeHasErrors("privateMessageDto")) .andExpect(view().name("redirect:/drafts")) .andExpect(status().isMovedTemporarily()); verify(pmService).delete(anyList()); }

Target:
public void saveDraftShouldDeleteDraftIfTitleAndBodyAreEmptyAndRecipientIsNotExists() throws Exception { saveDraft("", "", null) .andExpect(model() .attributeHasErrors("privateMessageDto")) .andExpect(view().name("redirect:/drafts")) .andExpect(status().isMovedTemporarily()); verify(pmService).delete(anyList()); }
Source:
protected IFile getFile(IResource resource) { if (resource instanceof IFile) { return (IFile) resource; } return Adapters.getAdapter(resource, IFile.class, true); }

Target:
protected IFile getFile(IResource resource) { return Adapters.getAdapter(resource, IFile.class, true); }
Source:
public QueryTranslator(SamzaSqlApplicationConfig sqlConfig) { this.sqlConfig = sqlConfig; schemaResolversBySystem = sqlConfig.getSchemaResolversBySystem(); samzaToRelMsgConvertersBySystem = sqlConfig.getSamzaToRelMsgConvertersBySystem(); relToSamzaMsgConvertersBySystem = sqlConfig.getRelToSamzaMsgConvertersBySystem(); schemaConvertersBySystem = sqlConfig.getSchemaConvertersBySystem(); scanTranslator = new ScanTranslator(samzaToRelMsgConvertersBySystem); }

Target:
public QueryTranslator(SamzaSqlApplicationConfig sqlConfig) { this.sqlConfig = sqlConfig; scanTranslator = new ScanTranslator(sqlConfig.getSamzaRelConverters()); }
Source:
public void export(OutputStream os) throws TableException { ExcelWriter excelWriter = new ExcelWriter(os); try { int colOffset = tupleTable.getColOffset(); int colLimit = tupleTable.getColLimit(); int rowOffset = tupleTable.getOffset(); int rowLimit = tupleTable.getLimit(); tupleTable.setColOffset(0); tupleTable.setColLimit(0); tupleTable.setOffset(0); tupleTable.setLimit(0); TupleWriter tupleWriter = excelWriter.createTupleWriter("Sheet1"); try { tupleWriter.writeColNames(Iterables.transform(tupleTable.getColumns(), new Function<Field, String>() { @Override @Nullable public String apply(Field field) { return field.getName(); } })); for (Iterator<Tuple> it = tupleTable.iterator(); it.hasNext();) tupleWriter.write(it.next()); } finally { IOUtils.closeQuietly(tupleWriter); tupleTable.setColOffset(colOffset); tupleTable.setColLimit(colLimit); tupleTable.setOffset(rowOffset); tupleTable.setLimit(rowLimit); } } catch (IOException e) { throw new TableException(e); } finally { IOUtils.closeQuietly(excelWriter); } }

Target:
public void export(OutputStream os) throws TableException { ExcelWriter excelWriter = new ExcelWriter(os); try { int colOffset = tupleTable.getColOffset(); int colLimit = tupleTable.getColLimit(); int rowOffset = tupleTable.getOffset(); int rowLimit = tupleTable.getLimit(); tupleTable.setColOffset(0); tupleTable.setColLimit(0); tupleTable.setOffset(0); tupleTable.setLimit(0); TupleWriter tupleWriter = excelWriter.createTupleWriter("Sheet1"); try { tupleWriter.writeColNames(Iterables.transform(tupleTable.getColumns(), new Function<Field, String>() { @Override @Nullable public String apply(@Nullable Field field) { return field != null ? field.getName() : null; } })); for (Iterator<Tuple> it = tupleTable.iterator(); it.hasNext();) tupleWriter.write(it.next()); } finally { IOUtils.closeQuietly(tupleWriter); tupleTable.setColOffset(colOffset); tupleTable.setColLimit(colLimit); tupleTable.setOffset(rowOffset); tupleTable.setLimit(rowLimit); } } catch (IOException e) { throw new TableException(e); } finally { IOUtils.closeQuietly(excelWriter); } }
Source:
public QueryControlResult sendBatchQueries(final AvroOperatorChainDag chainDag, final int batchSize) throws AvroRemoteException { final List<String> queryIdList = new LinkedList<>(); for (int i = 0; i < batchSize; i++) { queryIdList.add(queryIdGenerator.generate(chainDag)); } return queryManager.batchCreate(new Tuple<>(queryIdList, chainDag)); }

Target:
public QueryControlResult sendBatchQueries(final AvroOperatorChainDag chainDag, final int batchSize) throws AvroRemoteException { final List<String> queryIdList = new ArrayList<>(); for (int i = 0; i < batchSize; i++) { queryIdList.add(queryIdGenerator.generate(chainDag)); } return queryManager.createBatch(new Tuple<>(queryIdList, chainDag)); }
Source:
private void populate(ApplicationDTO verbs) { final VBox verbsPane = new VBox(); final Text title = new TextWithStyle(tr("Verbs"), TITLE_CSS_CLASS); verbsPane.getStyleClass().add(CONFIGURATION_PANE_CSS_CLASS); verbsPane.getChildren().add(title); final TilePane verbsContentPane = new TilePane(); verbsContentPane.setPrefColumns(3); verbsContentPane.getStyleClass().add("grid"); for (ScriptDTO verb : verbs.getScripts()) { Button verbButton = new Button(verb.getScriptName()); verbButton.getStyleClass().addAll("toolButton"); verbButton.setStyle("-fx-background-image: url('" + verb.getIcon() + "');"); verbButton.setOnMouseClicked(event -> { this.lockAll(); this.verbsManager.installVerb(container.getEngine().toLowerCase(), container.getName(), verb.getId(), this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show())); }); this.lockableElements.add(verbButton); verbsContentPane.getChildren().add(verbButton); } verbsPane.getChildren().add(verbsContentPane); final ScrollPane scrollPane = new ScrollPane(); scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); verbsContentPane.prefWidthProperty().bind(scrollPane.widthProperty()); verbsContentPane.prefHeightProperty().bind(scrollPane.heightProperty()); scrollPane.setBackground(verbsContentPane.getBackground()); scrollPane.setContent(verbsPane); this.setContent(scrollPane); }

Target:
private void populate(ApplicationDTO verbs) { final VBox verbsPane = new VBox(); final Text title = new TextWithStyle(tr("Verbs"), "title"); verbsPane.getStyleClass().add("containerConfigurationPane"); verbsPane.getChildren().add(title); final TilePane verbsContentPane = new TilePane(); verbsContentPane.setPrefColumns(3); verbsContentPane.getStyleClass().add("grid"); for (ScriptDTO verb : verbs.getScripts()) { Button verbButton = new Button(verb.getScriptName()); verbButton.getStyleClass().addAll("toolButton"); verbButton.setStyle("-fx-background-image: url('" + verb.getIcon() + "');"); verbButton.setOnMouseClicked(event -> { this.lockAll(); this.verbsManager.installVerb(container.getEngine().toLowerCase(), container.getName(), verb.getId(), this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show())); }); this.lockableElements.add(verbButton); verbsContentPane.getChildren().add(verbButton); } verbsPane.getChildren().add(verbsContentPane); final ScrollPane scrollPane = new ScrollPane(); scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); verbsContentPane.prefWidthProperty().bind(scrollPane.widthProperty()); verbsContentPane.prefHeightProperty().bind(scrollPane.heightProperty()); scrollPane.setBackground(verbsContentPane.getBackground()); scrollPane.setContent(verbsPane); this.setContent(scrollPane); }