auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static <T> T coalesce(T... values) { if ( values == null ) { return null; } for ( T value : values ) { if ( value != null ) { if ( String.class.isInstance( value ) ) { <START> if ( StringHelper.isNotEmpty( (String) value ) ) { <END> return value; } } else { return value; } } } return null; }</code><technical_language>Minor nitpicking, removing of "unnecessary helpers": "value" is null, is reason StringHelper. ((String) value).isEmpty()</technical_language>

Target:
public static <T> T coalesce(T... values) { if ( values == null ) { return null; } for ( T value : values ) { if ( value != null ) { if ( String.class.isInstance( value ) ) { if ( !( (String) value ).isEmpty() ) { return value; } } else { return value; } } } return null; }
Source:
<code>public String getInstance( @ApiParam(value = "Instance name", required = true, example = "Server_a.b.com_20000 | Broker_my.broker.com_30000") @PathParam("instanceName") String instanceName) { InstanceConfig instanceConfig = pinotHelixResourceManager.getHelixInstanceConfig(instanceName); if (instanceConfig == null) { throw new ControllerApplicationException(LOGGER, "Instance " + instanceName + " not found", Response.Status.NOT_FOUND); } ObjectNode response = JsonUtils.newObjectNode(); response.put("instanceName", instanceConfig.getInstanceName()); response.put("hostName", instanceConfig.getHostName()); response.put("enabled", instanceConfig.getInstanceEnabled()); response.put("port", instanceConfig.getPort()); response.set("tags", JsonUtils.objectToJsonNode(instanceConfig.getTags())); response.set("pools", JsonUtils.objectToJsonNode(instanceConfig.getRecord().getMapField(InstanceUtils.POOL_KEY))); <START> response.put("grpcPort", instanceConfig.getRecord().getSimpleField(InstanceUtils.GRPC_PORT_KEY)); <END> return response.toString(); }</code><technical_language>related this PR, want provide a new API return Instance in-sync setter API</technical_language>

Target:
public String getInstance( @ApiParam(value = "Instance name", required = true, example = "Server_a.b.com_20000 | Broker_my.broker.com_30000") @PathParam("instanceName") String instanceName) { InstanceConfig instanceConfig = pinotHelixResourceManager.getHelixInstanceConfig(instanceName); if (instanceConfig == null) { throw new ControllerApplicationException(LOGGER, "Instance " + instanceName + " not found", Response.Status.NOT_FOUND); } ObjectNode response = JsonUtils.newObjectNode(); response.put("instanceName", instanceConfig.getInstanceName()); response.put("hostName", instanceConfig.getHostName()); response.put("enabled", instanceConfig.getInstanceEnabled()); response.put("port", instanceConfig.getPort()); response.set("tags", JsonUtils.objectToJsonNode(instanceConfig.getTags())); response.set("pools", JsonUtils.objectToJsonNode(instanceConfig.getRecord().getMapField(InstanceUtils.POOL_KEY))); response.put("grpcPort", getGrpcPort(instanceConfig)); return response.toString(); }
Source:
<code>public void postUpdateHost(Iterable<VDS> hosts) { hosts = Linq.where(hosts, new Linq.HostStatusPredicate(VDSStatus.Up)); ArrayList<VDS> list = new ArrayList<VDS>(); if (getSelectedItem() != null && getSelectedItem().getRole() == StorageDomainType.ImportExport) { for (VDS host : hosts) { if (host.getVdsGroupCompatibilityVersion().compareTo(new Version("2.2")) >= 0) { list.add(host); } } hosts = list; } VDS oldSelectedItem = (VDS) getHost().getSelectedItem(); VDS selectedItem = null; if (getStorage() != null && getStorage().getStatus() != StorageDomainStatus.Maintenance) { VDS spm = getSPM(hosts); <START> hosts = spm != null ? Collections.singletonList(spm) : new ArrayList<VDS>(); <END> } if (oldSelectedItem != null) { selectedItem = Linq.firstOrDefault(hosts, new Linq.HostPredicate(oldSelectedItem.getId())); } if (selectedItem == null) { VDS spm = getSPM(hosts); selectedItem = spm == null ? Linq.firstOrDefault(hosts) : spm; } getHost().setItems(hosts); getHost().setSelectedItem(selectedItem); }</code><technical_language>return Collections.emptyList()</technical_language>

Target:
public void postUpdateHost(Iterable<VDS> hosts) { hosts = Linq.where(hosts, new Linq.HostStatusPredicate(VDSStatus.Up)); ArrayList<VDS> list = new ArrayList<VDS>(); if (getSelectedItem() != null && getSelectedItem().getRole() == StorageDomainType.ImportExport) { for (VDS host : hosts) { if (host.getVdsGroupCompatibilityVersion().compareTo(new Version("2.2")) >= 0) { list.add(host); } } hosts = list; } VDS oldSelectedItem = (VDS) getHost().getSelectedItem(); VDS selectedItem = null; if (getStorage() != null && getStorage().getStatus() != StorageDomainStatus.Maintenance) { VDS spm = getSPM(hosts); hosts = spm != null ? Collections.singletonList(spm) : Collections.<VDS> emptyList(); } if (oldSelectedItem != null) { selectedItem = Linq.firstOrDefault(hosts, new Linq.HostPredicate(oldSelectedItem.getId())); } if (selectedItem == null) { VDS spm = getSPM(hosts); selectedItem = spm == null ? Linq.firstOrDefault(hosts) : spm; } getHost().setItems(hosts); getHost().setSelectedItem(selectedItem); }
Source:
<code><START> public Collection<LabelItem> getLabels() { <END> return new ArrayList<LabelItem>(labels); }</code><technical_language>if Getter returns a Collection, this creates ArrayList first</technical_language>

Target:
public List<LabelItem<?>> getLabels() { return new ArrayList<LabelItem<?>>(labels); }
Source:
<code>public static File createTempFile(@Nonnull String prefix, @Nonnull String suffix) throws CannotCreateFileException, CannotChangePermissionException { String tmpdir = System.getProperty("java.io.tmpdir"); assert tmpdir != null; Directory baseDir; try { baseDir = new Directory( tmpdir, null, Existence.MUST_EXIST, Permission.READ | Permission.WRITE, ChangePermission.NOCHANGE); return createTempFile(prefix, suffix, baseDir); } catch (NotDirectoryException | WrongPermissionException | NoSuchFileException | <START> FileAlreadyExistsException e) { <END> throw new CannotCreateFileException( new FileLocation(tmpdir + File.separator + prefix + "*" + suffix), e); } }</code><technical_language>AssertionError</technical_language>

Target:
public static File createTempFile(@Nonnull String prefix, @Nonnull String suffix) throws CannotCreateFileException, CannotChangePermissionException { String tmpdir = System.getProperty("java.io.tmpdir"); assert tmpdir != null; Directory baseDir; try { baseDir = new Directory( tmpdir, null, Existence.MUST_EXIST, Permission.READ | Permission.WRITE, ChangePermission.NOCHANGE); } catch (NotDirectoryException | WrongPermissionException | NoSuchFileException e) { throw new CannotCreateFileException( new FileLocation(tmpdir + File.separator + prefix + "*" + suffix), e); } catch (FileAlreadyExistsException e) { throw new AssertionError(e); } return createTempFile(prefix, suffix, baseDir); }
Source:
<code>public HadoopPigJob(String jobid, Props sysProps, Props jobProps, Logger log) throws IOException { super(jobid, sysProps, jobProps, log); if (jobProps.containsKey(JOB_ENABLE_TUNING) && jobProps.containsKey(PIG_ENABLE_TUNING)) { enableTuning = jobProps.getBoolean(JOB_ENABLE_TUNING) && jobProps.getBoolean(PIG_ENABLE_TUNING); }else { enableTuning = false; } if(enableTuning) { <START> HADOOP_SECURE_PIG_WRAPPER = HadoopTuningSecurePigWrapper.class.getName(); <END> }else { HADOOP_SECURE_PIG_WRAPPER = HadoopSecurePigWrapper.class.getName(); } getJobProps().put(CommonJobProperties.JOB_ID, jobid); shouldProxy = getSysProps().getBoolean(HadoopSecurityManager.ENABLE_PROXYING, false); getJobProps().put(HadoopSecurityManager.ENABLE_PROXYING, Boolean.toString(shouldProxy)); obtainTokens = getSysProps().getBoolean(HadoopSecurityManager.OBTAIN_BINARY_TOKEN, false); userPigJar = getJobProps().getBoolean("use.user.pig.jar", false); if (shouldProxy) { getLog().info("Initiating hadoop security manager."); try { hadoopSecurityManager = HadoopJobUtils.loadHadoopSecurityManager(getSysProps(), log); } catch (RuntimeException e) { throw new RuntimeException("Failed to get hadoop security manager!" + e); } } }</code><technical_language>modifying a static variable here. IIUC this affect other running jobs. HADOOP_SECURE_PIG_WRAPPER a constant (final), a new field private final String securePigWrapper contains wrapper for this specific instance</technical_language>

Target:
public HadoopPigJob(String jobid, Props sysProps, Props jobProps, Logger log) throws IOException { super(jobid, sysProps, jobProps, log); if (jobProps.containsKey(JOB_ENABLE_TUNING) && jobProps.containsKey(PIG_ENABLE_TUNING)) { enableTuning = jobProps.getBoolean(JOB_ENABLE_TUNING) && jobProps.getBoolean(PIG_ENABLE_TUNING); } else { enableTuning = false; } if (enableTuning) { securePigWrapper = HadoopTuningSecurePigWrapper.class.getName(); } else { securePigWrapper = HadoopSecurePigWrapper.class.getName(); } getJobProps().put(CommonJobProperties.JOB_ID, jobid); shouldProxy = getSysProps().getBoolean(HadoopSecurityManager.ENABLE_PROXYING, false); getJobProps().put(HadoopSecurityManager.ENABLE_PROXYING, Boolean.toString(shouldProxy)); obtainTokens = getSysProps().getBoolean(HadoopSecurityManager.OBTAIN_BINARY_TOKEN, false); userPigJar = getJobProps().getBoolean("use.user.pig.jar", false); if (shouldProxy) { getLog().info("Initiating hadoop security manager."); try { hadoopSecurityManager = HadoopJobUtils.loadHadoopSecurityManager(getSysProps(), log); } catch (RuntimeException e) { throw new RuntimeException("Failed to get hadoop security manager!" + e); } } }
Source:
<code>public void bulkRead(LinkedHashSet cuedCases, HashMap recordMap, Abandonable abandonable) { List<Pair<String, String[]>> whereParamList = TableBuilder.sqlList(cuedCases); for (Pair<String, String[]> querySet : whereParamList) { Cursor c = helper.getHandle().query(table, new String[]{DatabaseHelper.ID_COL, DatabaseHelper.DATA_COL}, DatabaseHelper.ID_COL + " IN " + querySet.first, querySet.second, null, null, null); try { if (c.getCount() == 0) { return; } else { c.moveToFirst(); int index = c.getColumnIndexOrThrow(DatabaseHelper.DATA_COL); while (!c.isAfterLast()) { <START> LifecycleSignaler.AssertNotAbandoned(abandonable); <END> byte[] data = c.getBlob(index); recordMap.put(c.getInt(c.getColumnIndexOrThrow(DatabaseHelper.ID_COL)), newObject(data, c.getInt(c.getColumnIndexOrThrow(DatabaseHelper.ID_COL)))); c.moveToNext(); } } } finally { c.close(); } } }</code><technical_language>making understanding-- this is line stop background thread for badge calculations if context marked abandoned? If so, missing something. In case this throws exception.. program crash? in code catches/handles a RequestAbandonedException</technical_language>

Target:
public void bulkRead(LinkedHashSet cuedCases, HashMap recordMap, Abandonable abandonable) throws RequestAbandonedException { List<Pair<String, String[]>> whereParamList = TableBuilder.sqlList(cuedCases); for (Pair<String, String[]> querySet : whereParamList) { Cursor c = helper.getHandle().query(table, new String[]{DatabaseHelper.ID_COL, DatabaseHelper.DATA_COL}, DatabaseHelper.ID_COL + " IN " + querySet.first, querySet.second, null, null, null); try { if (c.getCount() == 0) { return; } else { c.moveToFirst(); int index = c.getColumnIndexOrThrow(DatabaseHelper.DATA_COL); while (!c.isAfterLast()) { LifecycleSignaler.AssertNotAbandoned(abandonable); byte[] data = c.getBlob(index); recordMap.put(c.getInt(c.getColumnIndexOrThrow(DatabaseHelper.ID_COL)), newObject(data, c.getInt(c.getColumnIndexOrThrow(DatabaseHelper.ID_COL)))); c.moveToNext(); } } } finally { c.close(); } } }
Source:
<code>public Entity addNode(Location loc, Map<?,?> extraFlags) { Map<?,?> createFlags = MutableMap.builder() .putAll(getCustomChildFlags()) .putAll(extraFlags) .build(); if (LOG.isDebugEnabled()) { LOG.debug("Creating and adding a node to cluster {}({}) with properties {}", new Object[] { this, getId(), createFlags }); } Entity entity = createNode(loc, createFlags); entity.sensors().set(CLUSTER_MEMBER, true); entity.sensors().set(CLUSTER, this); int nextClusterMemberId = getConfig(NEXT_CLUSTER_MEMBER_ID); <START> entity.sensors().set(CLUSTER_MEMBER_ID, nextClusterMemberId); <END> config().set(NEXT_CLUSTER_MEMBER_ID, nextClusterMemberId + 1); Entities.manage(entity); addMember(entity); return entity; }</code><technical_language>Is this wrong - set config new member memberId, a sensor cluster next id be? alternatively sensors (to CLUSTER CLUSTER_MEMBER sensors set member)? Is a race if multiple members created concurrently? extract out a protected method int obtainNextMemberId(), do some synchronization increment sensor atomically</technical_language>

Target:
public Entity addNode(Location loc, Map<?,?> extraFlags) { Map<?,?> createFlags = MutableMap.builder() .putAll(getCustomChildFlags()) .putAll(extraFlags) .put(CLUSTER_MEMBER_ID, getAttribute(NEXT_CLUSTER_MEMBER_ID).get()) .build(); if (LOG.isDebugEnabled()) { LOG.debug("Creating and adding a node to cluster {}({}) with properties {}", new Object[] { this, getId(), createFlags }); } Entity entity = createNode(loc, createFlags); entity.sensors().set(CLUSTER_MEMBER, true); entity.sensors().set(CLUSTER, this); Entities.manage(entity); addMember(entity); return entity; }
Source:
<code>public void initialise() { setAnimationSystem(MenuAnimationSystems.createDefaultSwipeAnimation()); WidgetUtil.trySubscribe(this, "back", button -> triggerBackAnimation()); creditsScroll = find("creditsScroll", UIScrollingText.class); if (creditsScroll != null) { ClassLoader classloader = getClass().getClassLoader(); <START> InputStream is = classloader.getResourceAsStream("Credits.md"); <END> try (BufferedReader br = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) { StringBuilder credits = new StringBuilder(); String line; while ((line = br.readLine()) != null) { line = line.replaceAll("\\[([^]]*)]\\(([^)]+)\\)", "$1").trim(); if (line.startsWith("* ")) { if (line.endsWith(":")) { credits.append(System.lineSeparator()); credits.append(line, 2, line.length() - 1); credits.append(System.lineSeparator()); credits.append(System.lineSeparator()); } else { credits.append(line, 2, line.length()); credits.append(System.lineSeparator()); } } else { credits.append(line); credits.append(System.lineSeparator()); } } creditsScroll.setText(credits.toString()); creditsScroll.setAutoReset(false); creditsScroll.setScrollingSpeed(1); creditsScroll.startScrolling(); } catch (IOException e) { Logger logger = LoggerFactory.getLogger(CreditsScreen.class); logger.info("Could not open Credits file"); } } }</code><technical_language>add a check for this resulting in a valid file? if show a simple warning message credits screen. possibly due running source credits unavailable a related note please throw entry .gitignore cover this file end up</technical_language>

Target:
public void initialise() { setAnimationSystem(MenuAnimationSystems.createDefaultSwipeAnimation()); WidgetUtil.trySubscribe(this, "back", button -> triggerBackAnimation()); creditsScroll = find("creditsScroll", UIScrollingText.class); if (creditsScroll != null) { StringBuilder credits = new StringBuilder(); ClassLoader classloader = getClass().getClassLoader(); InputStream is = classloader.getResourceAsStream("Credits.md"); if (is == null) { credits.append("${engine:menu#error-credits-not-found}"); } else { try (BufferedReader br = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) { String line; while ((line = br.readLine()) != null) { line = line.replaceAll("\\[([^]]*)]\\(([^)]+)\\)", "$1").trim(); if (line.startsWith("* ")) { if (line.endsWith(":")) { credits.append(System.lineSeparator()); credits.append(line, 2, line.length() - 1); credits.append(System.lineSeparator()); credits.append(System.lineSeparator()); } else { credits.append(line, 2, line.length()); credits.append(System.lineSeparator()); } } else { credits.append(line); credits.append(System.lineSeparator()); } } } catch (IOException e) { Logger logger = LoggerFactory.getLogger(CreditsScreen.class); logger.info("Could not open Credits file"); credits = new StringBuilder("${engine:menu#error-credits-open"); } } creditsScroll.setText(credits.toString()); creditsScroll.setAutoReset(false); creditsScroll.setScrollingSpeed(1); creditsScroll.startScrolling(); } }
Source:
<code>protected boolean canDoAction() { SnapshotsValidator snapshotsValidator = new SnapshotsValidator(); if (!validate(snapshotsValidator.snapshotExists(getSnapshot())) || !validate(snapshotsValidator.snapshotNotBroken(getSnapshot()))) { return false; } vmFromConfiguration = getVmFromConfiguration(); if (vmFromConfiguration == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_SNAPSHOT_HAS_NO_CONFIGURATION); addCanDoActionMessage(String.format("$VmName %1$s", getVmName())); addCanDoActionMessage(String.format("$SnapshotName %1$s", getSnapshotName())); return false; } <START> <END> if (!ImagesHandler.checkImagesLocked(getSourceVmFromDb(), getReturnValue().getCanDoActionMessages())) { return false; } if (!super.canDoAction()) { return false; } if (!canLockSnapshot()) { return false; } return true; }</code><technical_language>getSourceVmFromDb return null.</technical_language>

Target:
protected boolean canDoAction() { SnapshotsValidator snapshotsValidator = new SnapshotsValidator(); if (!validate(snapshotsValidator.snapshotExists(getSnapshot())) || !validate(snapshotsValidator.snapshotNotBroken(getSnapshot()))) { return false; } vmFromConfiguration = getVmFromConfiguration(); if (vmFromConfiguration == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_SNAPSHOT_HAS_NO_CONFIGURATION); addCanDoActionMessage(String.format("$VmName %1$s", getVmName())); addCanDoActionMessage(String.format("$SnapshotName %1$s", getSnapshotName())); return false; } if (getSourceVmFromDb() != null && !ImagesHandler.checkImagesLocked(getSourceVmFromDb(), getReturnValue().getCanDoActionMessages())) { return false; } if (!super.canDoAction()) { return false; } if (!canLockSnapshot()) { return false; } return true; }
Source:
<code>public PagedMessage[] getMessages() { long currentSize; <START> while ((currentSize = producerIndex) == RESIZING) { <END> Thread.yield(); } if (currentSize == 0) { return noMessages(); } assert currentSize <= Integer.MAX_VALUE; final int size = (int) currentSize; final PagedMessage[] messages = new PagedMessage[size]; final int jumps = size > chunkSize ? size >> chunkSizeLog2 : 0; AtomicChunk<PagedMessage> buffer = consumerBuffer; int messageNumber = 0; for (int i = 0; i < jumps; i++) { drainMessages(buffer, messages, messageNumber, chunkSize); messageNumber += chunkSize; buffer = buffer.next; } final int remaining = jumps > 0 ? (size & chunkMask) : size; drainMessages(buffer, messages, messageNumber, remaining); return messages; }</code><technical_language>sections of code duplication getMessage(int)</technical_language>

Target:
public PagedMessage[] getMessages() { return messages.toArray(PagedMessage[]::new); }
Source:
<code>protected ObjectId getSelectedCommitId(ExecutionEvent event) throws ExecutionException { IStructuredSelection selection = getSelection(event); if (selection.isEmpty()) throw new ExecutionException( UIText.AbstractHistoryCommandHandler_CouldNotGetSelectedCommitMessage); <START> RevCommit commit = (RevCommit) selection.getFirstElement(); <END> return commit.getId(); }</code><technical_language>This behave getSelectedCommit multiple commits selected</technical_language>

Target:
protected ObjectId getSelectedCommitId(ExecutionEvent event) throws ExecutionException { IStructuredSelection selection = getSelection(event); if (selection.size() != 1) throw new ExecutionException( UIText.AbstractHistoryCommandHandler_ActionRequiresOneSelectedCommitMessage); RevCommit commit = (RevCommit) selection.getFirstElement(); return commit.getId(); }
Source:
<code>public Consumer createConsumer(Processor processor) throws Exception { <START> return delegate.createConsumer(processor); <END> }</code><technical_language>need do configureConsumer(consumer)</technical_language>

Target:
public Consumer createConsumer(Processor processor) throws Exception { Consumer consumer = delegate.createConsumer(processor); configureConsumer(consumer); return consumer; }
Source:
<code>private void sendToEnd(String column) { int index = -1; for (int i = 0; i < remap.size(); ++i) if (data.getColumnNames()[remap.get(i)].equals(column)) { index = i; break; } if (index == -1) return; int saved = remap.get(index); for (int i = index; i < remap.size()-1; ++i) remap.set(i, remap.get(i+1)); <START> remap.set(remap.size()-1, saved); <END> }</code><technical_language>I replace 4 lines with: // Move element end of list remap.add(remap.remove(index));</technical_language>

Target:
private void sendToEnd(String column) { int index = -1; for (int i = 0; i < remap.size(); ++i) if (data.getColumnNames()[remap.get(i)].equals(column)) { index = i; break; } if (index == -1) return; remap.add(remap.remove(index)); }
Source:
<code>private static SslContext getServerSslContext(SSLConfig config) throws GeneralSecurityException, IOException { return SslContextBuilder.forServer(getKeyManagerFactory(config)) .trustManager(getTrustManagerFactory(config)) .sslProvider(SslProvider.JDK) .ciphers(getCipherSuites(config)) .protocols(getEnabledProtocols(config)) <START> .clientAuth(ClientAuth.REQUIRE) <END> .build(); }</code><technical_language>a config for this in SSLConfig</technical_language>

Target:
private static SslContext getServerSslContext(SSLConfig config) throws GeneralSecurityException, IOException { logger.info("Using provider for server SslContext", SslContext.defaultServerProvider()); return SslContextBuilder.forServer(getKeyManagerFactory(config)) .trustManager(getTrustManagerFactory(config)) .ciphers(getCipherSuites(config)) .protocols(getEnabledProtocols(config)) .clientAuth(getClientAuth(config)) .build(); }
Source:
<code><START> public String getSqlQueryLine(ObjectMapper objectMapper) throws JsonProcessingException <END> { return "# " + String.valueOf(timestamp) + " " + remoteAddr + " " + objectMapper.writeValueAsString(queryStats) + "\n" + sql; }</code><technical_language>Alternatively, this: java return JOINER.join( Arrays.asList( timestamp, remoteAddr, "", objectMapper.writeValueAsString(queryStats), objectMapper.writeValueAsString(ImmutableMap.of("sql", sql)) ) ); leaves native-query field blank, adds a new field end of TSV for sql query. a JSON object emitting SQL as-is for reasons: (1) extend more info if want; (2) SQL query newlines in it, objectMapper.writeValueAsString get rid of those</technical_language>

Target:
public String getSqlQueryLine(ObjectMapper objectMapper) throws JsonProcessingException { return JOINER.join( Arrays.asList( timestamp, remoteAddr, "", objectMapper.writeValueAsString(queryStats), objectMapper.writeValueAsString(ImmutableMap.of("query", sql, "context", sqlQueryContext)) ) ); }
Source:
<code>public StateTransitionException failed(Throwable t) { if (st.done()) { if (t != null) { <START> throw new AssertionError("Throwable cannot be thrown if Transition is done: " + t.getMessage()); <END> } return null; } st.failed(); if (t == null) { return null; } logger.error("{} failed.", action); if(t instanceof StateTransitionException) { return (StateTransitionException) t; } return new StateTransitionException(t); }</code><technical_language>init too</technical_language>

Target:
public StateTransitionException failed(Throwable t) { if (st.done()) { if (t != null) { throw (AssertionError) new AssertionError("Throwable cannot be thrown if Transition is done.").initCause(t); } return null; } st.failed(); if (t == null) { return null; } logger.error("{} failed.", action); if(t instanceof StateTransitionException) { return (StateTransitionException) t; } return new StateTransitionException(t); }
Source:
<code>public static List<Properties> fromParameterToContents(String contentsParameter) { List<Properties> contents = new ArrayList<Properties>(); if (StringUtils.isBlank(contentsParameter)) { return contents; } <START> String parse0 = contentsParameter .replaceAll(", contentId=", ",contentId=") .replaceAll(", modelId=", ",modelId=") .replaceAll("\\}, \\{", "\\},\\{"); String parse1 = (parse0.startsWith("[")) ? parse0.substring(1) : parse0; <END> String parse2 = (parse1.endsWith("]")) ? parse1.substring(0, parse1.length()-1) : parse1; if (!StringUtils.isBlank(parse2)) { String parse11 = (parse2.startsWith("{")) ? parse2.substring(1) : parse2; String parse22 = (parse11.endsWith("}")) ? parse11.substring(0, parse11.length()-1) : parse11; String[] split = parse22.split(Pattern.quote("},{")); for (int i = 0; i < split.length; i++) { String[] keysAndValues = split[i].split(","); if (keysAndValues.length > 0) { Properties properties = new Properties(); for (int j = 0; j < keysAndValues.length; j++) { String[] entry = keysAndValues[j].split("="); if (entry.length == 2) { properties.put(entry[0], entry[1]); } } contents.add(properties); } } } return contents; }</code><technical_language>correct place fix this. Please check WidgetConfigPropertiesDeserializer</technical_language>

Target:
public static List<Properties> fromParameterToContents(String contentsParameter) { List<Properties> contents = new ArrayList<Properties>(); if (StringUtils.isBlank(contentsParameter)) { return contents; } String parse1 = (contentsParameter.startsWith("[")) ? contentsParameter.substring(1) : contentsParameter; String parse2 = (parse1.endsWith("]")) ? parse1.substring(0, parse1.length()-1) : parse1; if (!StringUtils.isBlank(parse2)) { String parse11 = (parse2.startsWith("{")) ? parse2.substring(1) : parse2; String parse22 = (parse11.endsWith("}")) ? parse11.substring(0, parse11.length()-1) : parse11; String[] split = parse22.split(Pattern.quote("},{")); for (int i = 0; i < split.length; i++) { String[] keysAndValues = split[i].split(","); if (keysAndValues.length > 0) { Properties properties = new Properties(); for (int j = 0; j < keysAndValues.length; j++) { String[] entry = keysAndValues[j].split("="); if (entry.length == 2) { properties.put(entry[0].trim(), entry[1].trim()); } } contents.add(properties); } } } return contents; }
Source:
<code><START> public synchronized void waitUntilAllOperationsAreDone() throws InterruptedException { <END> while(!pendingOperationsWithSize.isEmpty()) { wait(MAX_WAIT_MILLIS); } }</code><technical_language>potentially long-running operations synchronized leaves a good chance for deadlock. waitUntilAllOperationsAreDone completes if empty, able call operationComplete(), no</technical_language>

Target:
public synchronized void waitUntilAllOperationsAreDone() throws InterruptedException { while(!pendingOperationsWithSize.isEmpty()) { if (lastOperationChange + MAX_UNCHANGED_WAIT_MS < System.currentTimeMillis()) { long lastUpdated = (System.currentTimeMillis() - lastOperationChange) / 1000; String message = String.format("No operations completed within the last %d seconds." + "There are still %d operations in progress.", lastUpdated, pendingOperationsWithSize.size()); throw new IllegalStateException(message); } wait(WAIT_MILLIS); } }
Source:
<code>private Location getLocationFromURI(String uri) { <START> String pattern = "\\d+$"; <END> RegExp p = RegExp.compile(pattern); MatchResult m = p.exec(uri); Location uriLoc = new Location(); uriLoc.setUri(createWorkableURI(uri)); Position uriPos = new Position(); if (m != null && m.getGroupCount() > 0) { String lastMatch = m.getGroup(m.getGroupCount() - 1); Integer lineNumber = Integer.parseInt(lastMatch); if (lineNumber > 0) { uriPos.setLine(lineNumber - 1); } else { uriPos.setLine(lineNumber); } } else { uriPos.setLine(0); } uriLoc.setRange(new Range(uriPos, uriPos)); return uriLoc; }</code><technical_language>If of form uri#lineNumber, a simple uri.lastIndexOf('#') do trick</technical_language>

Target:
private Location getLocationFromURI(String uri) { Location uriLoc = new Location(); uriLoc.setUri(createWorkableURI(uri)); Position uriPos = new Position(); int lineIndex = uri.lastIndexOf('#'); if (lineIndex != -1) { String lastMatch = uri.substring(lineIndex + 1); Integer lineNumber = Integer.parseInt(lastMatch); if (lineNumber > 0) { uriPos.setLine(lineNumber - 1); } else { uriPos.setLine(lineNumber); } } else { uriPos.setLine(0); } uriLoc.setRange(new Range(uriPos, uriPos)); return uriLoc; }
Source:
<code>private static Resource inferConfigDirectory(ResourceStore resourceStore, String providedConfigDirectory) { <START> String configDirectoryPath = System.getProperty(GEOWEBCACHE_CONFIG_DIR_PROPERTY); <END> if (configDirectoryPath == null) { configDirectoryPath = System.getProperty(GEOWEBCACHE_CACHE_DIR_PROPERTY); if (configDirectoryPath == null) { configDirectoryPath = providedConfigDirectory; } else { LOGGER.info(String.format( "Property GEOWEBCACHE_CACHE_DIR is set with value '%s.'", configDirectoryPath)); } } else { LOGGER.info(String.format( "Property GEOWEBCACHE_CONFIG_DIR is set with value '%s.'", configDirectoryPath)); } if (configDirectoryPath == null) { configDirectoryPath = DEFAULT_CONFIGURATION_DIR_NAME; } File configurationDirectory = new File(configDirectoryPath); if (configurationDirectory.isAbsolute()) { return Resources.fromPath(configurationDirectory.getAbsolutePath()); } return resourceStore.get(configDirectoryPath); }</code><technical_language>Yes, this done GeoServerExtensions.getProperty GWCVars.findEnvVar. XMLFileResourceProvider usesGWCVars.findEnvVar config dir attribute delegates DefaultStorageLocator if undefined slightly implementation of lookup algorithm find cache dir. <LINK_0> <LINK_1></technical_language>

Target:
private static Resource inferConfigDirectory(ResourceStore resourceStore, String providedConfigDirectory) { String configDirectoryPath = findFirstDefined( GEOWEBCACHE_CONFIG_DIR_PROPERTY, GEOWEBCACHE_CACHE_DIR_PROPERTY) .orElse(providedConfigDirectory); if (configDirectoryPath == null) { configDirectoryPath = DEFAULT_CONFIGURATION_DIR_NAME; } File configurationDirectory = new File(configDirectoryPath); if (configurationDirectory.isAbsolute()) { return Resources.fromPath(configurationDirectory.getAbsolutePath()); } return resourceStore.get(configDirectoryPath); }
Source:
<code><START> public SubordinateTransaction importTransaction(Xid xid, int timeout) <END> throws XAException { if (xid == null) throw new IllegalArgumentException(); return addImportedTransaction(xid, timeout); }</code><technical_language>superfluous formatting change</technical_language>

Target:
public SubordinateTransaction importTransaction(Xid xid, int timeout) throws XAException { if (xid == null) throw new IllegalArgumentException(); return addImportedTransaction(null, convertXid(xid), xid, timeout); }
Source:
<code>public boolean pollSocketsInfo() { if (!mIsTcpInfoParsingSupported) return false; boolean result = false; FileDescriptor fd = null; <START> synchronized (mTcpStats) { <END> try { long time = SystemClock.elapsedRealtime(); fd = connectToKernel(); mTcpStats.clear(); for (int family : ADDRESS_FAMILIES) { if (!sendPollingRequest(fd, family)) continue; StructNlMsgHdr nlmsghdr = new StructNlMsgHdr(); do { final ByteBuffer bytes = recvMesssage(fd); log("pollSocketsInfo: recv size=" + bytes.limit()); int curPos = 0; while (isValidNlMsg(bytes)) { nlmsghdr = StructNlMsgHdr.parse(bytes); int nlmsgLen = nlmsghdr.nlmsg_len; log("pollSocketsInfo: nlmsgLen=" + nlmsgLen); if (isValidInetDiagMsg(nlmsgLen)) { long cookie = locateSocketCookie(bytes, curPos); final SocketInfo info = parseSockInfo(bytes, curPos, family, nlmsgLen, time); mTcpStats.put(cookie, makeTcpStat(info, mSockInfo.get(cookie))); updateSockInfo(time, info, cookie); } bytes.position(curPos + nlmsgLen); curPos = bytes.position(); } } while (nlmsghdr.nlmsg_type != NLMSG_DONE); } updateSockInfo(time, null, SocketInfo.NONEXISTENT_COOKIE); result = true; } catch (ErrnoException | SocketException | InterruptedIOException e) { Log.e(TAG, "Fail to get TCP info via netlink.", e); } finally { NetworkStackUtils.closeSocketQuietly(fd); } } return result; }</code><technical_language>do need lock if this called thread</technical_language>

Target:
public boolean pollSocketsInfo() { if (!isTcpInfoSupported()) return false; boolean result = false; FileDescriptor fd = null; try { long time = SystemClock.elapsedRealtime(); fd = connectToKernel(); mTcpStats.clear(); for (int family : ADDRESS_FAMILIES) { if (!sendPollingRequest(fd, family)) continue; StructNlMsgHdr nlmsghdr = new StructNlMsgHdr(); do { final ByteBuffer bytes = recvMesssage(fd); log("pollSocketsInfo: recv size=" + bytes.limit()); int curPos = 0; while (isValidNlMsg(bytes)) { nlmsghdr = StructNlMsgHdr.parse(bytes); final int nlmsgLen = nlmsghdr.nlmsg_len; log("pollSocketsInfo: nlmsgLen=" + nlmsgLen); if (isValidInetDiagMsgSize(nlmsgLen)) { final int cookiePos = curPos + SOCKDIAG_MSG_HEADER_SIZE - 2 * Integer.BYTES; final long cookie = getSocketCookie(bytes, cookiePos); bytes.position(cookiePos + 2 * Integer.BYTES); final SocketInfo info = parseSockInfo(bytes, curPos, family, nlmsgLen, time); mTcpStats.put(cookie, makeTcpStat(info, mSocketInfos.get(cookie))); storeSocketInfo(cookie, info); } bytes.position(curPos + nlmsgLen); curPos = bytes.position(); } } while (nlmsghdr.nlmsg_type != NLMSG_DONE); } cleanupSocketInfo(time); result = true; } catch (ErrnoException | SocketException | InterruptedIOException e) { Log.e(TAG, "Fail to get TCP info via netlink.", e); } finally { NetworkStackUtils.closeSocketQuietly(fd); } return result; }
Source:
<code>private void runAnsibleRemovePlaybook() { VDS vds = getVds(); AuditLogable auditable = new AuditLogableImpl(); auditable.setVdsName(vds.getName()); auditable.setVdsId(vds.getId()); auditable.setCorrelationId(getCorrelationId()); try { AnsibleCommandConfig commandConfig = new AnsibleCommandConfig() .hosts(vds) .playbook(AnsibleConstants.HOST_REMOVE_PLAYBOOK); auditLogDirector.log(auditable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_STARTED); AnsibleReturnValue ansibleReturnValue = ansibleExecutor.runCommand(commandConfig); auditable.addCustomValue("LogFile", ansibleReturnValue.getLogFile().toString()); AnsibleReturnCode ansibleReturnCode = ansibleReturnValue.getAnsibleReturnCode(); if (ansibleReturnCode == AnsibleReturnCode.OK || isUnreachableHostDown(vds.getStatus(), ansibleReturnCode)) { auditLogDirector.log(auditable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_FINISHED); } else { auditLogDirector.log(auditable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_FAILED); } if <START> (isUnreachableHostDown(vds.getStatus(), <END> ansibleReturnCode)) { auditLogDirector.log(auditable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_NO_SUCCESS); } } catch (Exception e) { auditable.addCustomValue("Message", e.getMessage()); auditLogDirector.log(auditable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_EXECUTION_FAILED); } }</code><technical_language>unreachable while down? if host is in 'not responding' user moves MAINT in order remove it, unreachable event is returned ansible this condition misses it</technical_language>

Target:
private void runAnsibleRemovePlaybook() { VDS vds = getVds(); AuditLogable auditable = new AuditLogableImpl(); auditable.setVdsName(vds.getName()); auditable.setVdsId(vds.getId()); auditable.setCorrelationId(getCorrelationId()); try { AnsibleCommandConfig commandConfig = new AnsibleCommandConfig() .hosts(vds) .playbook(AnsibleConstants.HOST_REMOVE_PLAYBOOK); auditLogDirector.log(auditable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_STARTED); AnsibleReturnValue ansibleReturnValue = ansibleExecutor.runCommand(commandConfig); auditable.addCustomValue("LogFile", ansibleReturnValue.getLogFile().toString()); AnsibleReturnCode ansibleReturnCode = ansibleReturnValue.getAnsibleReturnCode(); if (ansibleReturnCode == AnsibleReturnCode.OK || isUnreachableHostDown(vds.getStatus(), ansibleReturnCode)) { auditLogDirector.log(auditable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_FINISHED); } else { auditLogDirector.log(auditable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_FAILED); } if (ansibleReturnCode == AnsibleReturnCode.UNREACHABLE && clusterUtils.isOvsCluster(vds.getClusterId())) { auditLogDirector.log(auditable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_NO_SUCCESS); } } catch (Exception e) { auditable.addCustomValue("Message", e.getMessage()); auditLogDirector.log(auditable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_EXECUTION_FAILED); } }
Source:
<code>public void initializeShouldCallTheCallback() { <START> when(thing.getConfiguration()).thenReturn(new demo1Configuration()); <END> handler.initialize(); ArgumentCaptor<ThingStatusInfo> statusInfoCaptor = ArgumentCaptor.forClass(ThingStatusInfo.class); verify(callback).statusUpdated(eq(thing), statusInfoCaptor.capture()); ThingStatusInfo thingStatusInfo = statusInfoCaptor.getValue(); assertThat(thingStatusInfo.getStatus(), is(equalTo(ThingStatus.ONLINE))); }</code><technical_language>demo1 a left</technical_language>

Target:
public void initializeShouldCallTheCallback() { when(thing.getConfiguration()).thenReturn(new ${bindingIdCamelCase}Configuration()); handler.initialize(); ArgumentCaptor<ThingStatusInfo> statusInfoCaptor = ArgumentCaptor.forClass(ThingStatusInfo.class); verify(callback).statusUpdated(eq(thing), statusInfoCaptor.capture()); ThingStatusInfo thingStatusInfo = statusInfoCaptor.getValue(); assertThat(thingStatusInfo.getStatus(), is(equalTo(ThingStatus.ONLINE))); }
Source:
<code>protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) { if (flushCache) { lines.clear(); } Object owner = composite.getData(AbstractPartRenderer.OWNING_ME); if (owner instanceof MTrimBar) { <START> MTrimBar bar = (MTrimBar) owner; <END> for (MTrimElement te : bar.getChildren()) { hideManagedTB(te); } } int totalMajor = horizontal ? wHint - (marginLeft + marginRight) : hHint - (marginTop + marginBottom); int totalMinor = 0; int spaceLeft = totalMajor; TrimLine curLine = new TrimLine(); Control[] kids = composite.getChildren(); for (int i = 0; i < kids.length; i++) { Control ctrl = kids[i]; TrimLine segment = new TrimLine(); segment.addControl(ctrl); while (i < (kids.length - 2) && isGlue(kids[i + 1])) { segment.addControl(kids[i + 1]); segment.addControl(kids[i + 2]); i += 2; } if (segment.major <= spaceLeft) { curLine.mergeSegment(segment); spaceLeft -= segment.major; } else { curLine.extraSpace = spaceLeft; lines.add(curLine); totalMinor += curLine.minor; curLine = segment; spaceLeft = totalMajor - segment.major; } } if (curLine.ctrls.size() > 0) { curLine.extraSpace = spaceLeft; lines.add(curLine); totalMinor += curLine.minor; } int totalWrapSpacing = (lines.size() - 1) * wrapSpacing; totalMinor += horizontal ? (marginTop + marginBottom) + totalWrapSpacing : (marginLeft + marginRight) + totalWrapSpacing; Point calcSize = horizontal ? new Point(wHint, totalMinor) : new Point(totalMinor, hHint); return calcSize; }</code><technical_language>This nicer: if (bar instanceof MTrimBar) { ((MTrimBar) bar).getChildren().forEach(this::hideManagedTB); } Do agree</technical_language>

Target:
protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) { if (flushCache) { lines.clear(); } Object bar = composite.getData(AbstractPartRenderer.OWNING_ME); if (bar instanceof MTrimBar) { ((MTrimBar) bar).getChildren().forEach(this::hideManagedTB); } int totalMajor = horizontal ? wHint - (marginLeft + marginRight) : hHint - (marginTop + marginBottom); int totalMinor = 0; int spaceLeft = totalMajor; TrimLine curLine = new TrimLine(); Control[] kids = composite.getChildren(); for (int i = 0; i < kids.length; i++) { Control ctrl = kids[i]; TrimLine segment = new TrimLine(); segment.addControl(ctrl); while (i < (kids.length - 2) && isGlue(kids[i + 1])) { segment.addControl(kids[i + 1]); segment.addControl(kids[i + 2]); i += 2; } if (segment.major <= spaceLeft) { curLine.mergeSegment(segment); spaceLeft -= segment.major; } else { curLine.extraSpace = spaceLeft; lines.add(curLine); totalMinor += curLine.minor; curLine = segment; spaceLeft = totalMajor - segment.major; } } if (curLine.ctrls.size() > 0) { curLine.extraSpace = spaceLeft; lines.add(curLine); totalMinor += curLine.minor; } int totalWrapSpacing = (lines.size() - 1) * wrapSpacing; totalMinor += horizontal ? (marginTop + marginBottom) + totalWrapSpacing : (marginLeft + marginRight) + totalWrapSpacing; Point calcSize = horizontal ? new Point(wHint, totalMinor) : new Point(totalMinor, hHint); return calcSize; }
Source:
<code>protected void executeCommand() { <START> setSucceeded(false); <END> if (getSession().getStatus() != GeoRepSessionStatus.ACTIVE) { Future<VdcReturnValueBase> geoRepCmd = CommandCoordinatorUtil.executeAsyncCommand(VdcActionType.StartGlusterVolumeGeoRep, new GlusterVolumeGeoRepSessionParameters(getSession().getMasterVolumeId(), getSession().getId()), cloneContext()); VdcReturnValueBase result; try { result = geoRepCmd.get(); if (!result.getSucceeded()) { propagateFailure(result); return; } } catch (InterruptedException | ExecutionException e) { log.error("Exception", e); return; } } GlusterVolumeGeoRepSessionConfigParameters configParams = new GlusterVolumeGeoRepSessionConfigParameters(getSession().getMasterVolumeId(), getSession().getId(), GlusterConstants.GEOREP_CHECKPOINT_OPTION, GlusterConstants.GEOREP_CHECKPOINT_VALUE); VdcReturnValueBase result = runInternalAction(VdcActionType.SetGeoRepConfig, configParams); if (!result.getSucceeded()) { propagateFailure(result); return; } setSucceeded(true); }</code><technical_language>default is 'false' required</technical_language>

Target:
protected void executeCommand() { if (getSession().getStatus() != GeoRepSessionStatus.ACTIVE) { Future<VdcReturnValueBase> geoRepCmd = CommandCoordinatorUtil.executeAsyncCommand(VdcActionType.StartGlusterVolumeGeoRep, new GlusterVolumeGeoRepSessionParameters(getSession().getMasterVolumeId(), getSession().getId()), cloneContext()); VdcReturnValueBase result; try { result = geoRepCmd.get(); if (!result.getSucceeded()) { propagateFailure(result); return; } } catch (InterruptedException | ExecutionException e) { log.error("Exception", e); return; } } GlusterVolumeGeoRepSessionConfigParameters configParams = new GlusterVolumeGeoRepSessionConfigParameters(getSession().getMasterVolumeId(), getSession().getId(), GlusterConstants.GEOREP_CHECKPOINT_OPTION, GlusterConstants.GEOREP_CHECKPOINT_VALUE); VdcReturnValueBase result = runInternalAction(VdcActionType.SetGeoRepConfig, configParams); if (!result.getSucceeded()) { propagateFailure(result); return; } setSucceeded(true); }
Source:
<code>private boolean isDeletingOrExpired(Datastream stream) { boolean isExpired = false; if (stream.getMetadata().containsKey(TTL_MS) && stream.getMetadata().containsKey(CREATION_MS)) { <START> long ttlMs = Long.parseLong(stream.getMetadata().get(TTL_MS)); <END> long creationMs = Long.parseLong(stream.getMetadata().get(CREATION_MS)); if (System.currentTimeMillis() - creationMs >= ttlMs) { isExpired = true; } } return isExpired || stream.getStatus() == DatastreamStatus.DELETING; }</code><technical_language>catch NumberFormatException</technical_language>

Target:
private boolean isDeletingOrExpired(Datastream stream) { boolean isExpired = false; if (stream.getMetadata().containsKey(TTL_MS) && stream.getMetadata().containsKey(CREATION_MS)) { try { long ttlMs = Long.parseLong(stream.getMetadata().get(TTL_MS)); long creationMs = Long.parseLong(stream.getMetadata().get(CREATION_MS)); if (System.currentTimeMillis() - creationMs >= ttlMs) { isExpired = true; } } catch (NumberFormatException e) { _log.error("Ignoring TTL as some metadata is not numeric, CREATION_MS={}, TTL_MS={}", stream.getMetadata().get(CREATION_MS), stream.getMetadata().get(TTL_MS), e); } } return isExpired || stream.getStatus() == DatastreamStatus.DELETING; }
Source:
<code>public void autonomousMain() throws AutonomousModeOverException, InterruptedException { try { float currentClampHeight = Clamp.height.get(); if (currentClampHeight < clampHeightThreshold.get()) { setClampHeight(clampHeightThreshold.get()); } <START> Elevator.setTop.event(); <END> try { waitUntil(Elevator.atTop); boolean running = Rollers.running.get(); boolean direction = Rollers.direction.get(); boolean closed = Rollers.closed.get(); try { Rollers.direction.set(Rollers.REVERSE); Rollers.running.set(true); Rollers.closed.set(true); waitUntil(crateInPosition); waitForTime(timeout); } finally { Rollers.running.set(running); Rollers.direction.set(direction); Rollers.closed.set(closed); } } finally { Elevator.setBottom.event(); } waitUntil(Elevator.atBottom); waitForTime(1000); } finally { running.set(false); } }</code><technical_language>moving elevator while moving clamp</technical_language>

Target:
public void autonomousMain() throws AutonomousModeOverException, InterruptedException { try { Elevator.setTop.event(); float currentClampHeight = Clamp.heightReadout.get(); if (currentClampHeight < clampHeightThreshold.get()) { Clamp.mode.set(Clamp.MODE_HEIGHT); Clamp.height.set(clampHeightThreshold.get()); waitUntil(BooleanMixing.andBooleans(Clamp.atDesiredHeight, Elevator.atTop)); } else { waitUntil(Elevator.atTop); } try { boolean running = Rollers.running.get(); boolean direction = Rollers.direction.get(); boolean closed = Rollers.closed.get(); try { Rollers.direction.set(Rollers.REVERSE); Rollers.running.set(true); Rollers.closed.set(true); waitUntil(crateInPosition); waitForTime(timeout); } finally { Rollers.running.set(running); Rollers.direction.set(direction); Rollers.closed.set(closed); } } finally { Elevator.setBottom.event(); } waitUntil(Elevator.atBottom); waitForTime(1000); } finally { running.set(false); } }
Source:
<code>private void setLDAPSearchParamters(List<ExpressionCondition> expressionConditions) throws UserStoreException { List<String> returnedAttributes = new ArrayList<>(); if (isGroupFiltering) { checkForMemberOfAttribute(expressionConditions, returnedAttributes); if (!isMemberOfPropertyFound) { checkForMembershipAttribute(returnedAttributes); } } else { this.searchBases = realmConfig.getUserStoreProperty(LDAPConstants.USER_SEARCH_BASE); returnedAttributes.add(realmConfig.getUserStoreProperty(LDAPConstants.USER_NAME_ATTRIBUTE)); returnedAttributes.add("sn"); } <START> if (returnedAttributes != null && returnedAttributes.size() > 0) { <END> this.searchControls.setReturningAttributes(returnedAttributes.toArray(new String[0])); } searchFilterBuilder(isGroupFiltering, isMultiGroupFiltering, expressionConditions); }</code><technical_language>ListUtils.isNotEmpty</technical_language>

Target:
private void setLDAPSearchParamters(List<ExpressionCondition> expressionConditions) throws UserStoreException { List<String> returnedAttributes = new ArrayList<>(); if (isGroupFiltering) { checkForMemberOfAttribute(expressionConditions, returnedAttributes); if (!isMemberOfPropertyFound) { checkForMembershipAttribute(returnedAttributes); } } else { this.searchBases = realmConfig.getUserStoreProperty(LDAPConstants.USER_SEARCH_BASE); returnedAttributes.add(realmConfig.getUserStoreProperty(LDAPConstants.USER_NAME_ATTRIBUTE)); returnedAttributes.add(SERVICE_NAME_ATTRIBUTE); } if (CollectionUtils.isNotEmpty(returnedAttributes)) { this.searchControls.setReturningAttributes(returnedAttributes.toArray(new String[0])); } searchFilterBuilder(isGroupFiltering, isMultiGroupFiltering, expressionConditions); }