auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static VdcParameter deserialize(String key) { String[] tokens = key.split(";"); switch (Integer.parseInt(getValue(tokens[0]))) { case 0: synchronized (parametersMap) { return parametersMap.get(new Guid(getValue(tokens[1]))); } } return null; }

Target:
public static VdcParameter deserialize(String key) { Map<String, String> map = new HashMap<String, String>(); for (String token : key.split(";")) { String[] keyVal = token.split("="); map.put(keyVal[0], keyVal[1]); } switch (Integer.parseInt(map.get(VERSION_KEY))) { case 0: synchronized (parametersMap) { return parametersMap.get(new Guid(map.get(GUID_KEY))); } default: throw new InvalidParameterKeyException(key); } }
Source:
Object buildObjectValue(ObjectValue defaultValue, GraphQLInputObjectType objectType) { Map<String, Object> map = new LinkedHashMap<>(); objectType.getFieldDefinitions().forEach( f -> { final Value<?> fieldValueFromDefaultObjectValue = defaultValue.getObjectFields().stream() .filter(dvf -> dvf.getName().equals(f.getName())).map(ObjectField::getValue).findFirst().orElse(null); map.put(f.getName(), fieldValueFromDefaultObjectValue != null ? buildValue(fieldValueFromDefaultObjectValue, f.getType()): f.getDefaultValue()); } ); return map; }

Target:
Object buildObjectValue(ObjectValue defaultValue, GraphQLInputObjectType objectType) { Map<String, Object> map = new LinkedHashMap<>(); objectType.getFieldDefinitions().forEach( f -> { final Value<?> fieldValueFromDefaultObjectValue = getFieldValueFromObjectValue(defaultValue, f.getName()); map.put(f.getName(), fieldValueFromDefaultObjectValue != null ? buildValue(fieldValueFromDefaultObjectValue, f.getType()) : f.getDefaultValue()); } ); return map; }
Source:
public void securityServiceDenialTest() throws Exception { String msg = "@@expected"; securityServiceFactory.exceptionToReturn = new IllegalStateException(msg); securityServiceFactory.mode = FrontendTestSecurityServiceFactory.Mode.ProcessRequest; verifyFailureWithMsg(msg); securityServiceFactory.mode = FrontendTestSecurityServiceFactory.Mode.PostProcessRequest; verifyFailureWithMsg(msg); securityServiceFactory.mode = FrontendTestSecurityServiceFactory.Mode.ProcessResponse; verifyFailureWithMsg(msg); securityServiceFactory.exceptionToThrow = new IllegalStateException(msg); securityServiceFactory.exceptionToReturn = null; verifyFailureWithMsg(msg); securityServiceFactory.mode = FrontendTestSecurityServiceFactory.Mode.PostProcessRequest; verifyFailureWithMsg(msg); securityServiceFactory.mode = FrontendTestSecurityServiceFactory.Mode.ProcessRequest; verifyFailureWithMsg(msg); }

Target:
public void securityServiceDenialTest() throws Exception { String msg = "@@expected"; securityServiceFactory.exceptionToReturn = new IllegalStateException(msg); securityServiceFactory.mode = FrontendTestSecurityServiceFactory.Mode.ProcessRequest; verifyFailureWithMsg(msg); securityServiceFactory.mode = FrontendTestSecurityServiceFactory.Mode.PostProcessRequest; verifyFailureWithMsg(msg); securityServiceFactory.mode = FrontendTestSecurityServiceFactory.Mode.ProcessResponse; verifyFailureWithMsg(msg); securityServiceFactory.exceptionToThrow = new IllegalStateException(msg); securityServiceFactory.exceptionToReturn = null; securityServiceFactory.mode = FrontendTestSecurityServiceFactory.Mode.ProcessRequest; verifyFailureWithMsg(msg); securityServiceFactory.mode = FrontendTestSecurityServiceFactory.Mode.PostProcessRequest; verifyFailureWithMsg(msg); securityServiceFactory.mode = FrontendTestSecurityServiceFactory.Mode.ProcessResponse; verifyFailureWithMsg(msg); }
Source:
protected List<VM> getVmsFromExportDomain() { GetAllFromExportDomainQueryParameters p = new GetAllFromExportDomainQueryParameters (getParameters().getStoragePoolId(), getParameters().getSourceDomainId()); VdcQueryReturnValue qretVal = getBackend().runInternalQuery(VdcQueryType.GetVmsFromExportDomain, p); if (!qretVal.getSucceeded()) { return null; } return (List<VM>) qretVal.getReturnValue(); }

Target:
protected List<VM> getVmsFromExportDomain() { GetAllFromExportDomainQueryParameters p = new GetAllFromExportDomainQueryParameters (getParameters().getStoragePoolId(), getParameters().getSourceDomainId()); VdcQueryReturnValue qRetVal = getBackend().runInternalQuery(VdcQueryType.GetVmsFromExportDomain, p); if (!qRetVal.getSucceeded()) { return null; } return (List<VM>) qRetVal.getReturnValue(); }
Source:
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 ( StringHelper.isNotEmpty( (String) value ) ) { return value; } } else { return value; } } } return null; }

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:
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", instanceConfig.getRecord().getSimpleField(InstanceUtils.GRPC_PORT_KEY)); return response.toString(); }

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:
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) : new ArrayList<VDS>(); } 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); }

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:
public Collection<LabelItem> getLabels() { return new ArrayList<LabelItem>(labels); }

Target:
public List<LabelItem<?>> getLabels() { return new ArrayList<LabelItem<?>>(labels); }
Source:
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 | FileAlreadyExistsException e) { throw new CannotCreateFileException( new FileLocation(tmpdir + File.separator + prefix + "*" + suffix), e); } }

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:
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) { HADOOP_SECURE_PIG_WRAPPER = HadoopTuningSecurePigWrapper.class.getName(); }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); } } }

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:
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()) { 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(); } } }

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:
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); entity.sensors().set(CLUSTER_MEMBER_ID, nextClusterMemberId); config().set(NEXT_CLUSTER_MEMBER_ID, nextClusterMemberId + 1); Entities.manage(entity); addMember(entity); return entity; }

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:
public void initialise() { setAnimationSystem(MenuAnimationSystems.createDefaultSwipeAnimation()); WidgetUtil.trySubscribe(this, "back", button -> triggerBackAnimation()); creditsScroll = find("creditsScroll", UIScrollingText.class); if (creditsScroll != null) { ClassLoader classloader = getClass().getClassLoader(); InputStream is = classloader.getResourceAsStream("Credits.md"); 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"); } } }

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:
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 (!ImagesHandler.checkImagesLocked(getSourceVmFromDb(), getReturnValue().getCanDoActionMessages())) { return false; } if (!super.canDoAction()) { return false; } if (!canLockSnapshot()) { return false; } return true; }

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:
public PagedMessage[] getMessages() { long currentSize; while ((currentSize = producerIndex) == RESIZING) { 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; }

Target:
public PagedMessage[] getMessages() { return messages.toArray(PagedMessage[]::new); }
Source:
protected ObjectId getSelectedCommitId(ExecutionEvent event) throws ExecutionException { IStructuredSelection selection = getSelection(event); if (selection.isEmpty()) throw new ExecutionException( UIText.AbstractHistoryCommandHandler_CouldNotGetSelectedCommitMessage); RevCommit commit = (RevCommit) selection.getFirstElement(); return commit.getId(); }

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:
public Consumer createConsumer(Processor processor) throws Exception { return delegate.createConsumer(processor); }

Target:
public Consumer createConsumer(Processor processor) throws Exception { Consumer consumer = delegate.createConsumer(processor); configureConsumer(consumer); return consumer; }
Source:
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)); remap.set(remap.size()-1, saved); }

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:
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)) .clientAuth(ClientAuth.REQUIRE) .build(); }

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:
public String getSqlQueryLine(ObjectMapper objectMapper) throws JsonProcessingException { return "# " + String.valueOf(timestamp) + " " + remoteAddr + " " + objectMapper.writeValueAsString(queryStats) + "\n" + sql; }

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:
public StateTransitionException failed(Throwable t) { if (st.done()) { if (t != null) { throw new AssertionError("Throwable cannot be thrown if Transition is done: " + t.getMessage()); } return null; } st.failed(); if (t == null) { return null; } logger.error("{} failed.", action); if(t instanceof StateTransitionException) { return (StateTransitionException) t; } return new StateTransitionException(t); }

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:
public static List<Properties> fromParameterToContents(String contentsParameter) { List<Properties> contents = new ArrayList<Properties>(); if (StringUtils.isBlank(contentsParameter)) { return contents; } String parse0 = contentsParameter .replaceAll(", contentId=", ",contentId=") .replaceAll(", modelId=", ",modelId=") .replaceAll("\\}, \\{", "\\},\\{"); String parse1 = (parse0.startsWith("[")) ? parse0.substring(1) : parse0; 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; }

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:
public synchronized void waitUntilAllOperationsAreDone() throws InterruptedException { while(!pendingOperationsWithSize.isEmpty()) { wait(MAX_WAIT_MILLIS); } }

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:
private Location getLocationFromURI(String uri) { String pattern = "\\d+$"; 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; }

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:
private static Resource inferConfigDirectory(ResourceStore resourceStore, String providedConfigDirectory) { String configDirectoryPath = System.getProperty(GEOWEBCACHE_CONFIG_DIR_PROPERTY); 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); }

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:
public SubordinateTransaction importTransaction(Xid xid, int timeout) throws XAException { if (xid == null) throw new IllegalArgumentException(); return addImportedTransaction(xid, timeout); }

Target:
public SubordinateTransaction importTransaction(Xid xid, int timeout) throws XAException { if (xid == null) throw new IllegalArgumentException(); return addImportedTransaction(null, convertXid(xid), xid, timeout); }
Source:
public boolean pollSocketsInfo() { if (!mIsTcpInfoParsingSupported) return false; boolean result = false; FileDescriptor fd = null; synchronized (mTcpStats) { 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; }

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:
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 (isUnreachableHostDown(vds.getStatus(), 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); } }

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:
public void initializeShouldCallTheCallback() { when(thing.getConfiguration()).thenReturn(new demo1Configuration()); 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))); }

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:
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) { MTrimBar bar = (MTrimBar) owner; 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; }

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:
protected void executeCommand() { setSucceeded(false); 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); }

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:
private boolean isDeletingOrExpired(Datastream stream) { boolean isExpired = false; if (stream.getMetadata().containsKey(TTL_MS) && stream.getMetadata().containsKey(CREATION_MS)) { 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; } } return isExpired || stream.getStatus() == DatastreamStatus.DELETING; }

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:
public void autonomousMain() throws AutonomousModeOverException, InterruptedException { try { float currentClampHeight = Clamp.height.get(); if (currentClampHeight < clampHeightThreshold.get()) { setClampHeight(clampHeightThreshold.get()); } Elevator.setTop.event(); 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); } }

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:
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"); } if (returnedAttributes != null && returnedAttributes.size() > 0) { this.searchControls.setReturningAttributes(returnedAttributes.toArray(new String[0])); } searchFilterBuilder(isGroupFiltering, isMultiGroupFiltering, expressionConditions); }

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); }
Source:
private boolean confInvocationPassed(ITestNGMethod method, ITestNGMethod currentTestMethod, IClass testClass, Object instance) { boolean result = true; Class<?> cls = testClass.getRealClass(); if(m_suiteState.isFailed()) { result = false; } else { boolean hasConfigurationFailures = classConfigurationFailed(cls); if (hasConfigurationFailures) { if (! m_continueOnFailedConfiguration) { result = !hasConfigurationFailures; } else { Set<Object> set = getInvocationResults(testClass); result = !set.contains(instance); } return result; } if (m_continueOnFailedConfiguration && hasConfigFailure(currentTestMethod)) { Object key = TestNgMethodUtils.getMethodInvocationToken(currentTestMethod, instance); result = !m_methodInvocationResults.get(currentTestMethod).contains(key); } else if (! m_continueOnFailedConfiguration) { for (Class<?> clazz : m_classInvocationResults.keySet()) { if (clazz.isAssignableFrom(cls)) { result = false; break; } } } } String[] groups = method.getGroups(); for (String group : groups) { if (m_beforegroupsFailures.containsKey(group)) { result = false; break; } } return result; }

Target:
private boolean confInvocationPassed(ITestNGMethod method, ITestNGMethod currentTestMethod, IClass testClass, Object instance) { boolean result = true; Class<?> cls = testClass.getRealClass(); if(m_suiteState.isFailed()) { result = false; } else { boolean hasConfigurationFailures = classConfigurationFailed(cls); if (hasConfigurationFailures) { if (! m_continueOnFailedConfiguration) { result = false; } else { Set<Object> set = getInvocationResults(testClass); result = !set.contains(instance); } return result; } if (m_continueOnFailedConfiguration && hasConfigFailure(currentTestMethod)) { Object key = TestNgMethodUtils.getMethodInvocationToken(currentTestMethod, instance); result = !m_methodInvocationResults.get(currentTestMethod).contains(key); } else if (! m_continueOnFailedConfiguration) { for (Class<?> clazz : m_classInvocationResults.keySet()) { if (clazz.isAssignableFrom(cls)) { result = false; break; } } } } String[] groups = method.getGroups(); for (String group : groups) { if (m_beforegroupsFailures.containsKey(group)) { result = false; break; } } return result; }