auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static String u(String value) { if (value == null || value.isEmpty()) { return ""; } return UriUtils.encodeQueryParam(value, "UTF-8").replace("+", "%2B"); }

Target:
public static String u(String value) { if (value == null || value.isEmpty()) { return ""; } return extraEncodeQuery(UriUtils.encodeQueryParam(value, "UTF-8")); }
Source:
public void onInit(GameInitializationEvent event) { Sponge.getCommandManager().register(this, CommandSpec.builder() .executor((src, args) -> { if (src instanceof Player) { final UUID uuid = ((Player) src).getUniqueId(); if (this.activated.contains(uuid)) { this.activated.remove(uuid); src.sendMessage(Text.of("You have deactivated damage source analysis.")); } else { this.activated.add(uuid); src.sendMessage(Text.of("You have activated damage source analysis.")); } } return CommandResult.success(); }) .build(), "dstest"); final DamageSource damageSource = DamageSource.builder() .type(DamageTypes.CUSTOM) .exhaustion(5) .scalesWithDifficulty() .build(); Sponge.getCommandManager().register(this, CommandSpec.builder() .executor((src, args) -> { if (src instanceof Player) { final Player player = (Player) src; player.damage(args.<Double>getOne("damage").orElse(2.0), damageSource); player.sendMessage(Text.of("You have damaged yourself with the custom damage source.")); } return CommandResult.success(); }) .arguments(GenericArguments.doubleNum(Text.of("damage"))) .build(), "dsdamage"); }

Target:
public void onInit(GameInitializationEvent event) { Sponge.getCommandManager().register(this, CommandSpec.builder() .executor((src, args) -> { if (src instanceof Player) { final UUID uuid = ((Player) src).getUniqueId(); if (this.activated.contains(uuid)) { this.activated.remove(uuid); src.sendMessage(Text.of("You have deactivated damage source analysis.")); } else { this.activated.add(uuid); src.sendMessage(Text.of("You have activated damage source analysis.")); } return CommandResult.success(); } throw new CommandException(Text.of(TextColors.RED, "You must be a player to execute this command!")); }) .build(), "dstest"); final DamageSource damageSource = DamageSource.builder() .type(DamageTypes.CUSTOM) .exhaustion(5) .scalesWithDifficulty() .build(); Sponge.getCommandManager().register(this, CommandSpec.builder() .executor((src, args) -> { if (src instanceof Player) { final Player player = (Player) src; player.damage(args.<Double>getOne("damage").orElse(2.0), damageSource); player.sendMessage(Text.of("You have damaged yourself with the custom damage source.")); return CommandResult.success(); } throw new CommandException(Text.of(TextColors.RED, "You must be a player to execute this command!")); }) .arguments(GenericArguments.doubleNum(Text.of("damage"))) .build(), "dsdamage"); }
Source:
private List<Instructor> getInstructorEntitiesForGoogleId(String googleId, boolean omitArchived) { if (omitArchived) { Query q = getPM().newQuery(Instructor.class); q.declareParameters("String googleIdParam, boolean omitArchivedParam"); q.setFilter("googleId == googleIdParam && isArchived != omitArchivedParam"); @SuppressWarnings("unchecked") List<Instructor> instructorList = (List<Instructor>) q.execute(googleId, omitArchived); System.out.println("1- " + instructorList.size()); System.out.println("2- " + getInstructorEntitiesForGoogleId(googleId).size()); return instructorList; } else { return getInstructorEntitiesForGoogleId(googleId); } }

Target:
private List<Instructor> getInstructorEntitiesForGoogleId(String googleId, boolean omitArchived) { if (!omitArchived) { return getInstructorEntitiesForGoogleId(googleId); } else { Query q = getPM().newQuery(Instructor.class); q.declareParameters("String googleIdParam, boolean omitArchivedParam"); q.setFilter("googleId == googleIdParam && isArchived != omitArchivedParam"); @SuppressWarnings("unchecked") List<Instructor> instructorList = (List<Instructor>) q.execute(googleId, omitArchived); return instructorList; } }
Source:
private NewSymbolTable newSymbolTable(String filename) { File moduleBaseDir = new File("src/test/resources/highlighter/"); sensorContext = SensorContextTester.create(moduleBaseDir); inputFile = new DefaultInputFile("moduleKey", filename) .setModuleBaseDir(moduleBaseDir.toPath()); inputFile.initMetadata(new FileMetadata().readMetadata(inputFile.file(), Charset.defaultCharset())); return sensorContext.newSymbolTable().onFile(inputFile); }

Target:
private NewSymbolTable newSymbolTable(String filename) { File moduleBaseDir = new File("src/test/resources/highlighter/"); sensorContext = SensorContextTester.create(moduleBaseDir); inputFile = new DefaultInputFile("moduleKey", filename) .setModuleBaseDir(moduleBaseDir.toPath()); inputFile.initMetadata(new FileMetadata().readMetadata(inputFile.file(), Charsets.UTF_8)); return sensorContext.newSymbolTable().onFile(inputFile); }
Source:
<R extends RelNode> RelOptRuleOperand( Class<R> clazz, RelTrait trait, Predicate<? super R> predicate, RelOptRuleOperandChildPolicy childPolicy, ImmutableList<RelOptRuleOperand> children) { assert clazz != null; if (clazz == RelSubset.class) { assert children.size() == 0; } switch (childPolicy) { case ANY: break; case LEAF: assert children.size() == 0; break; case UNORDERED: assert children.size() == 1; break; default: assert children.size() > 0; } this.childPolicy = childPolicy; this.clazz = Objects.requireNonNull(clazz); this.trait = trait; this.predicate = Objects.requireNonNull((Predicate) predicate); this.children = children; for (RelOptRuleOperand child : this.children) { assert child.parent == null : "cannot re-use operands"; child.parent = this; } }

Target:
<R extends RelNode> RelOptRuleOperand( Class<R> clazz, RelTrait trait, Predicate<? super R> predicate, RelOptRuleOperandChildPolicy childPolicy, ImmutableList<RelOptRuleOperand> children) { assert clazz != null; switch (childPolicy) { case ANY: break; case LEAF: assert children.size() == 0; break; case UNORDERED: assert children.size() == 1; break; default: assert children.size() > 0; } this.childPolicy = childPolicy; this.clazz = Objects.requireNonNull(clazz); this.trait = trait; this.predicate = Objects.requireNonNull((Predicate) predicate); this.children = children; for (RelOptRuleOperand child : this.children) { assert child.parent == null : "cannot re-use operands"; child.parent = this; } }
Source:
public void testGetRoutingData() { ZNRecord testZnRecord1 = new ZNRecord("testZnRecord1"); List<String> testShardingKeys1 = Arrays.asList("/sharding/key/1/a", "/sharding/key/1/b", "/sharding/key/1/c"); testZnRecord1.setListField(ZNRECORD_LIST_FIELD_KEY, testShardingKeys1); ZNRecord testZnRecord2 = new ZNRecord("testZnRecord2"); List<String> testShardingKeys2 = Arrays.asList("/sharding/key/2/a", "/sharding/key/2/b", "/sharding/key/2/c", "/sharding/key/2/d"); testZnRecord2.setListField(ZNRECORD_LIST_FIELD_KEY, testShardingKeys2); _baseAccessor.create(ROUTING_DATA_PATH + "/testRealmAddress1", testZnRecord1, AccessOption.PERSISTENT); _baseAccessor.create(ROUTING_DATA_PATH + "/testRealmAddress2", testZnRecord2, AccessOption.PERSISTENT); MetadataStoreRoutingDataReader zkRoutingDataReader = new ZkRoutingDataReader(ZK_ADDR); try { Map<String, List<String>> routingData = zkRoutingDataReader.getRoutingData(); Assert.assertEquals(routingData.size(), 2); Assert.assertEquals(routingData.get("testRealmAddress1"), testShardingKeys1); Assert.assertEquals(routingData.get("testRealmAddress2"), testShardingKeys2); } catch (InvalidRoutingDataException e) { Assert.fail("Not expecting InvalidRoutingDataException"); } _baseAccessor.remove(ROUTING_DATA_PATH, AccessOption.PERSISTENT); }

Target:
public void testGetRoutingData() { ZNRecord testZnRecord1 = new ZNRecord("testZnRecord1"); List<String> testShardingKeys1 = Arrays.asList("/sharding/key/1/a", "/sharding/key/1/b", "/sharding/key/1/c"); testZnRecord1.setListField(ZkRoutingDataReader.ZNRECORD_LIST_FIELD_KEY, testShardingKeys1); ZNRecord testZnRecord2 = new ZNRecord("testZnRecord2"); List<String> testShardingKeys2 = Arrays.asList("/sharding/key/2/a", "/sharding/key/2/b", "/sharding/key/2/c", "/sharding/key/2/d"); testZnRecord2.setListField(ZkRoutingDataReader.ZNRECORD_LIST_FIELD_KEY, testShardingKeys2); _baseAccessor.create(ZkRoutingDataReader.ROUTING_DATA_PATH + "/testRealmAddress1", testZnRecord1, AccessOption.PERSISTENT); _baseAccessor.create(ZkRoutingDataReader.ROUTING_DATA_PATH + "/testRealmAddress2", testZnRecord2, AccessOption.PERSISTENT); MetadataStoreRoutingDataReader zkRoutingDataReader = new ZkRoutingDataReader(ZK_ADDR); try { Map<String, List<String>> routingData = zkRoutingDataReader.getRoutingData(); Assert.assertEquals(routingData.size(), 2); Assert.assertEquals(routingData.get("testRealmAddress1"), testShardingKeys1); Assert.assertEquals(routingData.get("testRealmAddress2"), testShardingKeys2); } catch (InvalidRoutingDataException e) { Assert.fail("Not expecting InvalidRoutingDataException"); } }
Source:
public static Command<Void> continueInterceptedRequest(InterceptionId interceptionId, Optional<ErrorReason> errorReason, Optional<String> rawResponse, Optional<String> url, Optional<String> method, Optional<String> postData, Optional<Map<String, String>> headers, Optional<AuthChallengeResponse> authChallengeResponse) { Objects.requireNonNull(interceptionId, "interceptionId must be set."); Map<String, Object> params = new HashMap<>(); params.put("interceptionId", interceptionId); errorReason.ifPresent(reason -> params.put("errorReason", errorReason)); errorReason.ifPresent(string -> params.put("rawResponse", rawResponse)); errorReason.ifPresent(string -> params.put("url", url)); errorReason.ifPresent(string -> params.put("method", method)); errorReason.ifPresent(string -> params.put("postData", postData)); errorReason.ifPresent(map -> params.put("headers", headers)); errorReason.ifPresent(response -> params.put("authChallengeResponse", authChallengeResponse)); return new Command<>(domainName + ".continueInterceptedRequest", params); }

Target:
public static Command<Void> continueInterceptedRequest(InterceptionId interceptionId, Optional<ErrorReason> errorReason, Optional<String> rawResponse, Optional<String> url, Optional<String> method, Optional<String> postData, Optional<Map<String, String>> headers, Optional<AuthChallengeResponse> authChallengeResponse) { Objects.requireNonNull(interceptionId, "interceptionId must be set."); final ImmutableMap.Builder<String, Object> params = ImmutableMap.builder(); params.put("interceptionId", interceptionId.toString()); errorReason.ifPresent(reason -> params.put("errorReason", errorReason.get().name())); rawResponse.ifPresent(string -> params.put("rawResponse", rawResponse.toString())); url.ifPresent(string -> params.put("url", url.toString())); method.ifPresent(string -> params.put("method", method.toString())); postData.ifPresent(string -> params.put("postData", postData.toString())); headers.ifPresent(map -> params.put("headers", headers)); authChallengeResponse.ifPresent(response -> params.put("authChallengeResponse", authChallengeResponse)); return new Command<>(DOMAIN_NAME + ".continueInterceptedRequest", params.build()); }
Source:
public GraphicsProperties() { vendor = "Unknown"; renderer = "Unknown"; openGLVersion = "Unsupported"; vulkanVersion = "Unsupported"; }

Target:
public GraphicsProperties() { this.vendor = "Unknown"; this.renderer = "Unknown"; this.openglVersion = "Unsupported"; this.openglCoreVersion = "Unsupported"; this.vulkanVersion = "Unsupported"; }
Source:
public static Test suite() throws Exception { WysiwygTestSuite suite = new WysiwygTestSuite("WYSIWYG Selenium Tests", ColibriSkinExecutor.class); addTestCase(suite, SubmitTest.class); addTestCase(suite, StandardFeaturesTest.class); addTestCase(suite, HistoryTest.class); addTestCase(suite, LineTest.class); addTestCase(suite, TableTest.class); addTestCase(suite, LinkTest.class); addTestCase(suite, ListTest.class); addTestCase(suite, MacroTest.class); addTestCase(suite, ImageTest.class); addTestCase(suite, TabsTest.class); addTestCase(suite, NativeJavaScriptApiTest.class); addTestCase(suite, ColorTest.class); addTestCase(suite, AlignmentTest.class); addTestCase(suite, RemoveFormattingTest.class); addTestCase(suite, FontTest.class); addTestCase(suite, CacheTest.class); addTestCase(suite, RegularUserTest.class); addTestCase(suite, ImportTest.class); addTestCase(suite, EmbedTest.class); addTestCase(suite, EditInlineTest.class); addTestCase(suite, ShortCutsTest.class); return new XWikiSeleniumTestSetup(new XWikiTestSetup(new WysiwygTestSetup(suite))); }

Target:
public static Test suite() throws Exception { WysiwygTestSuite suite = new WysiwygTestSuite("WYSIWYG Selenium Tests", ColibriSkinExecutor.class); addTestCase(suite, SubmitTest.class); addTestCase(suite, StandardFeaturesTest.class); addTestCase(suite, HistoryTest.class); addTestCase(suite, LineTest.class); addTestCase(suite, TableTest.class); addTestCase(suite, LinkTest.class); addTestCase(suite, ListTest.class); addTestCase(suite, MacroTest.class); addTestCase(suite, ImageTest.class); addTestCase(suite, TabsTest.class); addTestCase(suite, NativeJavaScriptApiTest.class); addTestCase(suite, ColorTest.class); addTestCase(suite, AlignmentTest.class); addTestCase(suite, RemoveFormattingTest.class); addTestCase(suite, FontTest.class); addTestCase(suite, CacheTest.class); addTestCase(suite, RegularUserTest.class); addTestCase(suite, ImportTest.class); addTestCase(suite, EmbedTest.class); addTestCase(suite, EditInlineTest.class); return new XWikiSeleniumTestSetup(new XWikiTestSetup(new WysiwygTestSetup(suite))); }
Source:
public BoltConnectionElementBeanInfo() { super(BoltConnectionElement.class); createPropertyGroup("connection", new String[] { "boltUri", "username", "password" }); PropertyDescriptor propertyDescriptor = property("boltUri"); propertyDescriptor.setValue(NOT_UNDEFINED, Boolean.TRUE); propertyDescriptor.setValue(DEFAULT, "bolt://localhost:7687"); propertyDescriptor = property("username"); propertyDescriptor.setValue(NOT_UNDEFINED, Boolean.TRUE); propertyDescriptor.setValue(DEFAULT, "neo4j"); propertyDescriptor = property("password", TypeEditor.PasswordEditor); propertyDescriptor.setValue(NOT_UNDEFINED, Boolean.TRUE); propertyDescriptor.setValue(DEFAULT, ""); if(log.isDebugEnabled()) { for (PropertyDescriptor pd : getPropertyDescriptors()) { log.debug(pd.getName()); log.debug(pd.getDisplayName()); } } }

Target:
public BoltConnectionElementBeanInfo() { super(BoltConnectionElement.class); createPropertyGroup("connection", new String[] { "boltUri", "username", "password" }); PropertyDescriptor propertyDescriptor = property("boltUri"); propertyDescriptor.setValue(NOT_UNDEFINED, Boolean.TRUE); propertyDescriptor.setValue(DEFAULT, "bolt://localhost:7687"); propertyDescriptor = property("username"); propertyDescriptor.setValue(NOT_UNDEFINED, Boolean.TRUE); propertyDescriptor.setValue(DEFAULT, "neo4j"); propertyDescriptor = property("password", TypeEditor.PasswordEditor); propertyDescriptor.setValue(NOT_UNDEFINED, Boolean.TRUE); propertyDescriptor.setValue(DEFAULT, ""); if(log.isDebugEnabled()) { String descriptorsAsString = Arrays.stream(getPropertyDescriptors()) .map(pd -> pd.getName() + "=" + pd.getDisplayName()) .collect(Collectors.joining(" ,")); log.debug(descriptorsAsString); } }
Source:
public synchronized double getPreviousDisconnectionTimestamp() { return previousDisconnectionTimestamp; }

Target:
public double getPreviousDisconnectionTimestamp() { return previousDisconnectionTimestamp; }
Source:
public List<AbstractProject<?,?>> getJobList(ItemGroup context, EnvVars buildEnvironment) { List<AbstractProject<?,?>> r = new ArrayList<AbstractProject<?,?>>(); String expandedJobs = getExpandedJobs(jobs, buildEnvironment); for (String name : Util.tokenize(expandedJobs,",")) { AbstractProject job = Hudson.getInstance().getItem(name.trim(), context, AbstractProject.class); if(job!=null) r.add(job); } return r; }

Target:
public List<AbstractProject<?,?>> getJobList(ItemGroup context, EnvVars buildEnvironment) { List<AbstractProject<?,?>> r = new ArrayList<AbstractProject<?,?>>(); String expandedJobs = getExpandedJobs(jobs, buildEnvironment); if (expandedJobs == null) return r; for (String name : Util.tokenize(expandedJobs,",")) { AbstractProject job = JenkinsHelper.getInstance().getItem(name.trim(), context, AbstractProject.class); if(job!=null) r.add(job); } return r; }
Source:
public void setCollections(final Set<String> collections) { this.collections = collections != null ? new TreeSet<>(collections) : null; }

Target:
public void setCollections(final Set<String> collections) { this.collections = collections; }
Source:
public void downloadBlob(String container, String name, File destination, ExecutorService executor) { ListeningExecutorService listeningExecutor = MoreExecutors.listeningDecorator(executor); RandomAccessFile raf = null; try { long contentLength = api .getObjectApi(regionId, container) .getWithoutBody(name) .getPayload() .getContentMetadata() .getContentLength(); raf = new RandomAccessFile(destination.getAbsoluteFile(), "rw"); raf.seek(contentLength - 1); raf.write(0); long partSize = getMinimumMultipartPartSize(); long from; long to; List<ListenableFuture<Void>> results = new ArrayList<ListenableFuture<Void>>(); for (from = 0; from < contentLength; from = from + partSize) { to = (from + partSize >= contentLength) ? contentLength - 1 : from + partSize - 1; BlobDownloader b = new BlobDownloader(regionId, container, name, raf, from, to); results.add(listeningExecutor.submit(b)); } Futures.getUnchecked(Futures.allAsList(results)); raf.close(); } catch (IOException e) { if (raf != null) { try { raf.close(); } catch (IOException e1) } destination.delete(); throw new RuntimeException(e); } finally { if (raf != null) { try { raf.close(); } catch (IOException e1) } } }

Target:
public void downloadBlob(String container, String name, File destination, ExecutorService executor) { ListeningExecutorService listeningExecutor = MoreExecutors.listeningDecorator(executor); RandomAccessFile raf = null; try { long contentLength = api .getObjectApi(regionId, container) .getWithoutBody(name) .getPayload() .getContentMetadata() .getContentLength(); raf = new RandomAccessFile(destination.getAbsoluteFile(), "rw"); raf.seek(contentLength - 1); raf.write(0); long partSize = getMinimumMultipartPartSize(); long from; long to; List<ListenableFuture<Void>> results = new ArrayList<ListenableFuture<Void>>(); for (from = 0; from < contentLength; from = from + partSize) { to = (from + partSize >= contentLength) ? contentLength - 1 : from + partSize - 1; BlobDownloader b = new BlobDownloader(regionId, container, name, raf, from, to); results.add(listeningExecutor.submit(b)); } Futures.getUnchecked(Futures.allAsList(results)); } catch (IOException e) { Closeables2.closeQuietly(raf); destination.delete(); throw new RuntimeException(e); } finally { Closeables2.closeQuietly(raf); } }
Source:
public org.infinispan.configuration.cache.Configuration greetingCache() { return new ConfigurationBuilder() .eviction().strategy(EvictionStrategy.LRU).maxEntries(4) .build(); }

Target:
public Configuration greetingCache() { return new ConfigurationBuilder() .eviction().strategy(EvictionStrategy.LRU).maxEntries(4) .build(); }
Source:
public void removeMember(final Group group, final User user) { ArrayList<Role> groupRoles = newArrayList(group.getRoles()); final RoleMembership member = roleMembershipService.getMemberships(groupRoles) .stream() .filter(m -> m.getUser().getId().equals(user.getId())) .findFirst() .orElseThrow(() -> new UnknownEntityException( roleMembershipMetadata, roleMembershipMetadata.getAttribute( RoleMembershipMetadata.USER), user.getUsername())); roleMembershipService.removeMembership(member); }

Target:
public void removeMember(final Group group, final User user) { ArrayList<Role> groupRoles = newArrayList(group.getRoles()); final RoleMembership membership = findRoleMembership(user, groupRoles); roleMembershipService.removeMembership(membership); }
Source:
public static LocalInstance startLocalInstance(String applicationKey, ExecutorService exec) throws IOException { final ServerSocketChannel channel = ServerSocketChannel.open(); channel.configureBlocking(false); channel.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0)); final int port = ((InetSocketAddress) channel.getLocalAddress()).getPort(); Preferences.userNodeForPackage(Main.class).putInt(applicationKey, port); LOG.info("InstanceManager bound to port {}", port); Selector selector = Selector.open(); channel.register(selector, SelectionKey.OP_ACCEPT); LocalInstance instance = new LocalInstance(applicationKey) { @Override public void close() { try { selector.close(); } catch (IOException e) { LOG.error("error closing socket", e); } try { channel.close(); } catch (IOException e) { LOG.error("error closing selector", e); } if (getSavedPort(applicationKey).orElse(-1).equals(port)) { Preferences.userNodeForPackage(Main.class).remove(applicationKey); } } }; exec.submit(() -> { try { final Set<SelectionKey> keysToRemove = new HashSet<>(); while (selector.select() > 0) { final Set<SelectionKey> keys = selector.selectedKeys(); for (SelectionKey key : keys) { if (Thread.interrupted()) { return; } try { if (key.isAcceptable()) { final SocketChannel accepted = channel.accept(); if (accepted != null) { LOG.info("accepted incoming connection"); accepted.configureBlocking(false); accepted.register(selector, SelectionKey.OP_READ | SelectionKey.OP_WRITE); } } instance.handle(key); } catch (IOException | IllegalStateException e) { LOG.error("exception in selector", e); } finally { keysToRemove.add(key); } } keys.removeAll(keysToRemove); } } catch (ClosedSelectorException e) { return; } catch (Throwable e) { LOG.error("error while selecting", e); } }); return instance; }

Target:
public static LocalInstance startLocalInstance(String applicationKey, ExecutorService exec) throws IOException { final ServerSocketChannel channel = ServerSocketChannel.open(); channel.configureBlocking(false); channel.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0)); final int port = ((InetSocketAddress) channel.getLocalAddress()).getPort(); Preferences.userNodeForPackage(Main.class).putInt(applicationKey, port); LOG.info("InstanceManager bound to port {}", port); Selector selector = Selector.open(); channel.register(selector, SelectionKey.OP_ACCEPT); LocalInstance instance = new LocalInstance(applicationKey, channel, selector); exec.submit(() -> { try { instance.port = ((InetSocketAddress) channel.getLocalAddress()).getPort(); } catch (IOException e) { } instance.selectionLoop(); }); return instance; }
Source:
public String getTargetUrl(Class<? extends Component> navigationTarget, RouteParameters parameters) { return iterateUrlTemplates(navigationTarget, urlTemplate -> { try { return getRouteModel().getUrl(urlTemplate, parameters); } catch (IllegalArgumentException e) { return null; } }); }

Target:
public String getTargetUrl(Class<? extends Component> navigationTarget, RouteParameters parameters) { return iterateTemplates(navigationTarget, template -> { try { return getRouteModel().getUrl(template, parameters); } catch (IllegalArgumentException e) { return null; } }); }
Source:
private void beforeInvocation() throws Exception { ActionContext.setContext(invocation.getInvocationContext()); }

Target:
protected void beforeInvocation() throws Exception { ActionContext.setContext(invocation.getInvocationContext()); }
Source:
protected void revertUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName, ModelNode valueToRestore, ModelNode valueToRevert, Void handback) throws OperationFailedException{ Resource resource = context.readResource(PathAddress.EMPTY_ADDRESS); ModelNode model = resource.getModel(); attributeDefinition.validateAndSet(operation, model); JaxrsContextParamHandler.setContextParam(attributeName, valueToRestore); }

Target:
protected void revertUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName, ModelNode valueToRestore, ModelNode valueToRevert, Void handback) throws OperationFailedException{ JaxrsContextParamHandler.setContextParam(attributeName, valueToRestore); }
Source:
public void testName(Method method) throws Exception { Util.print("test name: " + method.getName()); bundles[0] = Util.readELBundles()[0][0]; bundles[0] = new Bundle(bundles[0], cluster.getEnvFileName(), cluster.getPrefix()); bundles[0].generateUniqueBundle(); bundles[0].setInputFeedDataPath(baseHDFSDir + "/${YEAR}/${MONTH}/${DAY}/${HOUR}/${MINUTE}"); bundles[0].setProcessValidity("2010-01-02T01:00Z", "2010-01-02T01:04Z"); bundles[0].setProcessPeriodicity(5, TimeUnit.minutes); bundles[0].setOutputFeedPeriodicity(5, TimeUnit.minutes); bundles[0].setOutputFeedLocationData(baseHDFSDir + "/output-data/${YEAR}/${MONTH}/${DAY}/${HOUR}/${MINUTE}"); bundles[0].setProcessConcurrency(1); bundles[0].setProcessLibPath("/examples/apps/testLib/"); }

Target:
public void testName(Method method) throws Exception { Util.print("test name: " + method.getName()); bundles[0] = Util.readELBundles()[0][0]; bundles[0] = new Bundle(bundles[0], cluster.getEnvFileName(), cluster.getPrefix()); bundles[0].generateUniqueBundle(); bundles[0].setInputFeedDataPath(baseHDFSDir + "/${YEAR}/${MONTH}/${DAY}/${HOUR}/${MINUTE}"); bundles[0].setProcessValidity("2010-01-02T01:00Z", "2010-01-02T01:04Z"); bundles[0].setProcessPeriodicity(5, TimeUnit.minutes); bundles[0].setOutputFeedPeriodicity(5, TimeUnit.minutes); bundles[0].setOutputFeedLocationData(baseHDFSDir + "/output-data/${YEAR}/${MONTH}/${DAY}/${HOUR}/${MINUTE}"); bundles[0].setProcessConcurrency(1); bundles[0].setProcessLibPath(testLibDir); }
Source:
private Ingress generateIngress( String machineName, String serviceName, ServicePort servicePort, Map<String, ServerConfig> ingressesServers) { ExternalServerIngressBuilder bld = new ExternalServerIngressBuilder(); String host = strategy.getIngressHost(serviceName, servicePort); if (host != null) { bld = bld.withHost(host); } return bld.withPath( String.format( pathTransformFmt, ensureEndsWithSlash(strategy.getIngressPath(serviceName, servicePort)))) .withName(strategy.getIngressName(serviceName, servicePort)) .withMachineName(machineName) .withServiceName(serviceName) .withAnnotations(ingressAnnotations) .withServicePort(servicePort.getName()) .withServers(ingressesServers) .build(); }

Target:
private Ingress generateIngress( String machineName, String serviceName, ServicePort servicePort, Map<String, ServerConfig> ingressesServers) { ExternalServerIngressBuilder ingressBuilder = new ExternalServerIngressBuilder(); String host = strategy.getIngressHost(serviceName, servicePort); if (host != null) { ingressBuilder = ingressBuilder.withHost(host); } return ingressBuilder .withPath( String.format( pathTransformFmt, ensureEndsWithSlash(strategy.getIngressPath(serviceName, servicePort)))) .withName(getIngressName(serviceName, servicePort)) .withMachineName(machineName) .withServiceName(serviceName) .withAnnotations(ingressAnnotations) .withServicePort(servicePort.getName()) .withServers(ingressesServers) .build(); }
Source:
protected void processAnnotationOnMethod(MethodMetadata data, Annotation methodAnnotation, Method method) { if(!(methodAnnotation instanceof RequestMapping)) return; RequestMapping mapping = RequestMapping.class.cast(methodAnnotation); if (mapping != null) { checkOne(method, mapping.method(), "method"); data.template().method(mapping.method()[0].name()); StringBuilder path = new StringBuilder(); RequestMapping classMapping = method.getDeclaringClass().getAnnotation(RequestMapping.class); if(classMapping != null && classMapping.value() != null && classMapping.value().length == 1) { path.append(classMapping.value()[0]); } path.append(mapping.value().length == 1 ? mapping.value()[0] : ""); String pathValue = emptyToNull(path.toString()); checkState(pathValue != null, "value was empty on method %s", method.getName()); if (path.charAt(0) != '/' && !data.template().toString().endsWith("/")) { path.insert(0, "/"); } data.template().append(path.toString()); checkAtMostOne(method, mapping.produces(), "produces"); String[] serverProduces = mapping.produces(); String clientAccepts = serverProduces.length == 0 ? null : emptyToNull(serverProduces[0]); if (clientAccepts != null) { data.template().header(ACCEPT, clientAccepts); } checkAtMostOne(method, mapping.consumes(), "consumes"); String[] serverConsumes = mapping.consumes(); String clientProduces = serverConsumes.length == 0 ? null : emptyToNull(serverConsumes[0]); if (clientProduces != null) { data.template().header(CONTENT_TYPE, clientProduces); } if (mapping.headers() != null && mapping.headers().length > 0) { for (String header : mapping.headers()) { int colon = header.indexOf(':'); data.template().header(header.substring(0, colon), header.substring(colon + 2)); } } } }

Target:
protected void processAnnotationOnMethod(MethodMetadata data, Annotation methodAnnotation, Method method) { if (!(methodAnnotation instanceof RequestMapping)) { return; } RequestMapping methodMapping = RequestMapping.class.cast(methodAnnotation); checkOne(method, methodMapping.method(), "method"); data.template().method(methodMapping.method()[0].name()); checkAtMostOne(method, methodMapping.value(), "value"); if(methodMapping.value().length > 0) { String pathValue = emptyToNull(methodMapping.value()[0]); if (pathValue != null) { if (!pathValue.startsWith("/") && !data.template().toString().endsWith("/")) { pathValue = "/" + pathValue; } data.template().append(pathValue); } } parseProduces(data, method, methodMapping); parseConsumes(data, method, methodMapping); parseHeaders(data, method, methodMapping); }
Source:
public static boolean compareItemStacks(@Nonnull ItemStack stack1, @Nonnull ItemStack stack2) { checkNotNull(stack1, "stack1"); checkNotNull(stack2, "stack2"); return stack2.getItem() == stack1.getItem() && (stack2.getMetadata() == 32767 || stack2.getMetadata() == stack1.getMetadata()); }

Target:
public static boolean compareItemStacks(@Nonnull ItemStack stack1, @Nonnull ItemStack stack2) { checkNotNull(stack1, "stack1"); checkNotNull(stack2, "stack2"); return stack2.getItem() == stack1.getItem() && (stack2.getMetadata() == Short.MAX_VALUE || stack2.getMetadata() == stack1.getMetadata()); }
Source:
private void createNotificationChannel(Context context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { CharSequence name = context.getResources().getString(R.string.channel_name); String description = context.getResources().getString(R.string.channel_description); int importance = NotificationManager.IMPORTANCE_DEFAULT; NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance); channel.setDescription(description); channel.enableVibration(false); channel.enableLights(false); channel.setSound(null, null); NotificationManager notificationManager = context.getSystemService(NotificationManager.class); notificationManager.createNotificationChannel(channel); } }

Target:
private void createNotificationChannel(Context context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { CharSequence name = context.getResources().getString(R.string.app_name); String description = context.getResources().getString(R.string.channel_description, name); int importance = NotificationManager.IMPORTANCE_DEFAULT; NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance); channel.setDescription(description); channel.enableVibration(false); channel.enableLights(false); channel.setSound(null, null); NotificationManager notificationManager = context.getSystemService(NotificationManager.class); notificationManager.createNotificationChannel(channel); } }
Source:
public Object execute(ActionContext context) throws Exception { super.execute(context); String filter = createFilter(); if (filter == null) { return null; } int printingMaxRows = this.maxRows != null ? this.maxRows : DEFAULT_MAX_ROWS; if (verbose) { context.out.println("filter is '" + filter + "'"); context.out.println("maxRows='" + printingMaxRows + "'"); } printStats(context, filter, printingMaxRows); return null; }

Target:
public Object execute(ActionContext context) throws Exception { super.execute(context); String filter = createFilter(); if (filter == null) { return null; } if (verbose) { context.out.println("filter is '" + filter + "'"); context.out.println("maxRows='" + maxRows + "'"); } printStats(context, filter); return null; }
Source:
public void setIconConfig(List<String> icons) { Map<String, Map<String, String>> iconMap = new HashMap<>(); icons.forEach( icon -> { String key = icon.split("=")[0]; String[] config = icon.split("=")[1].split(","); Map<String, String> tempMap = new HashMap<>(); tempMap.put("className", config[0]); tempMap.put("code", config[1]); tempMap.put("font", config[2]); tempMap.put("size", config[3]); iconMap.put(key, tempMap); }); this.iconConfig = iconMap; }

Target:
public void setIconConfig(List<String> icons) { Map<String, Map<String, String>> iconMap = new HashMap<>(); icons.forEach( icon -> { String key = icon.split("=")[0]; String[] config = icon.split("=")[1].split(","); if (config.length != 4) { LOGGER.debug("Icon Configuration entry malformed, discarding.", icon); } else { Map<String, String> tempMap = new HashMap<>(); tempMap.put("className", config[0]); tempMap.put("code", config[1]); tempMap.put("font", config[2]); tempMap.put("size", config[3]); iconMap.put(key, tempMap); } }); this.iconConfig = iconMap; }
Source:
public @NonNull Iterable<@NonNull TmfAnalysisRequirement> getAnalysisRequirements() { LttngUstTrace trace = getTrace(); ILttngUstEventLayout layout; if (trace == null) { layout = DefaultLttngUstEventLayout.getInstance(); } else { layout = trace.getEventLayout(); } if (fAnalysisRequirements == null) { @NonNull Set<@NonNull String> requiredEventsFields = ImmutableSet.of( layout.contextProcname(), layout.contextVtid()); @NonNull TmfAnalysisEventFieldRequirement entryReq = new TmfAnalysisEventFieldRequirement( requiredEventsFields, ValuePriorityLevel.MANDATORY, ImmutableSet.of(layout.eventCygProfileFuncEntry(), layout.eventCygProfileFastFuncEntry())); entryReq.addInformation(nullToEmptyString(Messages.LttnUstCallStackAnalysisModule_EventsLoadingInformation)); @NonNull TmfAnalysisEventFieldRequirement exitReq = new TmfAnalysisEventFieldRequirement(requiredEventsFields, ValuePriorityLevel.MANDATORY, ImmutableSet.of(layout.eventCygProfileFuncExit(), layout.eventCygProfileFastFuncExit())); exitReq.addInformation(nullToEmptyString(Messages.LttnUstCallStackAnalysisModule_EventsLoadingInformation)); fAnalysisRequirements = ImmutableSet.of(entryReq, exitReq); } return checkNotNull(fAnalysisRequirements); }

Target:
public @NonNull Iterable<@NonNull TmfAnalysisRequirement> getAnalysisRequirements() { LttngUstTrace trace = getTrace(); ILttngUstEventLayout layout; if (trace == null) { layout = ILttngUstEventLayout.DEFAULT_LAYOUT; } else { layout = trace.getEventLayout(); } Set<@NonNull TmfAnalysisRequirement> requirements = fAnalysisRequirements; if (requirements == null) { @NonNull Set<@NonNull String> requiredEventsFields = checkNotNull(ImmutableSet.of( layout.contextProcname(), layout.contextVtid())); @NonNull TmfAnalysisEventFieldRequirement entryReq = new TmfAnalysisEventFieldRequirement( checkNotNull(ImmutableSet.of(layout.eventCygProfileFuncEntry(), layout.eventCygProfileFastFuncEntry())), requiredEventsFields, ValuePriorityLevel.MANDATORY); @NonNull TmfAnalysisEventFieldRequirement exitReq = new TmfAnalysisEventFieldRequirement( checkNotNull(ImmutableSet.of(layout.eventCygProfileFuncExit(), layout.eventCygProfileFastFuncExit())), requiredEventsFields, ValuePriorityLevel.MANDATORY); exitReq.addInformation(nullToEmptyString(Messages.LttnUstCallStackAnalysisModule_EventsLoadingInformation)); requirements = checkNotNull(ImmutableSet.of(entryReq, exitReq)); fAnalysisRequirements = requirements; } return requirements; }
Source:
private List<String> getIgnorePatterns() { int index = arguments.indexOf(toArg(IOptionKeys.IGNORE_PATTERN)); return this.getValues(index); }

Target:
private List<String> getIgnorePatterns() { int index = arguments.indexOf(toArg(IOptionKeys.IGNORE_PATTERN)) + 1; return this.getValues(index); }
Source:
public int getConnectionIdleTime() { int idleTime = getIntProperty(PassThroughConfigPNames.CONNECTION_IDLE_TIME, getDefaultConnectionIdleTime()); if (idleTime < 0) { return 0; } return idleTime; }

Target:
public int getConnectionIdleTime() { int idleTime; if (isIntPropertyConfigured(PassThroughConfigPNames.CONNECTION_GRACE_TIME)) { idleTime = getIdleTimeFromGraceTime(); } else { idleTime = getIntProperty(PassThroughConfigPNames.CONNECTION_IDLE_TIME, getIdleTimeFromGraceTime()); } if (idleTime < 0) { return 0; } return idleTime; }
Source:
public void triggerNow() { ThreadPoolUtil.execute(this::ovfUpdateTimer); }

Target:
public void triggerNow() { if (updateTimerJobId != null) { SchedulerUtil scheduler = Injector.get(SchedulerUtilQuartzImpl.class); scheduler.triggerJob(updateTimerJobId); } }
Source:
public Map<String, String> allocate(Network network, VmNetworkInterface nic) { deallocate(nic); try { com.woorea.openstack.quantum.model.Network quantumNetwork = getClient().networks().show(network.getProvidedBy().getExternalId()).execute(); PortForCreate port = new PortForCreate(); port.setAdminStateUp(true); port.setName(nic.getName()); port.setTenantId(quantumNetwork.getTenantId()); port.setMacAddress(nic.getMacAddress()); port.setNetworkId(quantumNetwork.getId()); port.setDeviceOwner(DEVICE_OWNER); port.setDeviceId(nic.getId().toString()); Port createdPort = getClient().ports().create(port).execute(); Map<String, String> runtimeProperties = new HashMap<>(); runtimeProperties.put("vnic_id", createdPort.getId()); runtimeProperties.put("provider_type", provider.getType().name()); runtimeProperties.put("plugin_type", provider.getAdditionalProperties().getPluginType().name()); return runtimeProperties; } catch (RuntimeException e) { throw new VdcBLLException(VdcBllErrors.PROVIDER_FAILURE, e); } }

Target:
public Map<String, String> allocate(Network network, VmNetworkInterface nic) { deallocate(nic); try { com.woorea.openstack.quantum.model.Network externalNetwork = getClient().networks().show(network.getProvidedBy().getExternalId()).execute(); PortForCreate port = new PortForCreate(); port.setAdminStateUp(true); port.setName(nic.getName()); port.setTenantId(externalNetwork.getTenantId()); port.setMacAddress(nic.getMacAddress()); port.setNetworkId(externalNetwork.getId()); port.setDeviceOwner(DEVICE_OWNER); port.setDeviceId(nic.getId().toString()); Port createdPort = getClient().ports().create(port).execute(); Map<String, String> runtimeProperties = new HashMap<>(); runtimeProperties.put("vnic_id", createdPort.getId()); runtimeProperties.put("provider_type", provider.getType().name()); runtimeProperties.put("plugin_type", provider.getAdditionalProperties().getPluginType().name()); return runtimeProperties; } catch (RuntimeException e) { throw new VdcBLLException(VdcBllErrors.PROVIDER_FAILURE, e); } }
Source:
public IStatus addComment(IReviewItem item, IComment comment, IProgressMonitor monitor) { short side = RIGHT_SIDE; String id = item.getId(); if (id.startsWith(BASE)) { id = id.substring(BASE.length()); side = LEFT_SIDE; } Patch.Key key = Patch.Key.parse(id); for (ILocation location : comment.getLocations()) { if (location instanceof ILineLocation) { ILineLocation lineLocation = (ILineLocation) location; SaveDraftRequest request = new SaveDraftRequest(key, lineLocation.getRangeMin(), side); request.setMessage(comment.getDescription()); if (comment.getId() != null && !(comment.getId().isEmpty())) { request.setUuid(comment.getId()); } GerritOperation<PatchLineComment> operation = getOperationFactory().createSaveDraftOperation(getTask(), request); IStatus status = operation.run(monitor); PatchLineComment patchLineComment = operation.getOperationResult(); if (patchLineComment != null && patchLineComment.getKey() != null) { comment.setId(patchLineComment.getKey().get()); } return status; } } throw new RuntimeException(Messages.GerritReviewBehavior_Internal_Exception + comment.getId()); }

Target:
public IStatus addComment(IReviewItem item, IComment comment, IProgressMonitor monitor) { short side = RIGHT_SIDE; String id = item.getId(); if (id.startsWith(BASE)) { id = id.substring(BASE.length()); side = LEFT_SIDE; } Patch.Key key = Patch.Key.parse(id); for (ILocation location : comment.getLocations()) { if (location instanceof ILineLocation) { ILineLocation lineLocation = (ILineLocation) location; SaveDraftRequest request = new SaveDraftRequest(key, lineLocation.getRangeMin(), side); request.setMessage(comment.getDescription()); if (!StringUtils.isEmptyOrNull(comment.getId())) { request.setUuid(comment.getId()); } GerritOperation<PatchLineComment> operation = getOperationFactory().createSaveDraftOperation(getTask(), request); IStatus status = operation.run(monitor); PatchLineComment patchLineComment = operation.getOperationResult(); if (patchLineComment != null && patchLineComment.getKey() != null) { comment.setId(patchLineComment.getKey().get()); } return status; } } throw new RuntimeException(NLS.bind(Messages.GerritReviewBehavior_Internal_Exception, comment.getId())); }
Source:
public void indexUseCases(final UseCaseScenariosList useCaseScenariosList, final BuildIdentifier buildIdentifier) { if(!searchAdapter.isEngineRunning()) { LOGGER.info("No search engine running."); return; } searchAdapter.setupNewBuild(buildIdentifier); searchAdapter.indexUseCases(useCaseScenariosList, buildIdentifier); LOGGER.info("Indexed build " + buildIdentifier); }

Target:
public void indexUseCases(final UseCaseScenariosList useCaseScenariosList, final BuildIdentifier buildIdentifier) { if(!searchAdapter.isEngineRunning()) { return; } searchAdapter.setupNewBuild(buildIdentifier); searchAdapter.indexUseCases(useCaseScenariosList, buildIdentifier); LOGGER.info("Indexed use cases for build " + buildIdentifier); }
Source:
public TimeZoneType getTimeZoneType() { VmOsType vmOsType = (VmOsType) getModel().getOSType().getSelectedItem(); return vmOsType == null ? TimeZoneType.GENERAL_TIMEZONE : TimeZoneType.getTimeZoneByOs(vmOsType); }

Target:
public TimeZoneType getTimeZoneType() { VmOsType vmOsType = (VmOsType) getModel().getOSType().getSelectedItem(); return TimeZoneType.getTimeZoneByOs(vmOsType); }
Source:
public void testCreateDocumentUnderPlacelessDoc() { DocumentModel parentFile = session.newDocumentModel(null, "parentFile", "File"); parentFile = session.createDocument(parentFile); assertNull(parentFile.getParentRef()); session.save(); DocumentModel childFile = session.newDocumentModel(parentFile.getRef(), "childFile", "File"); childFile = session.createDocument(childFile); session.save(); reopenSession(); parentFile = session.getDocument(new IdRef(parentFile.getId())); assertNull(parentFile.getParentRef()); childFile = session.getDocument(new IdRef(childFile.getId())); assertEquals(parentFile.getRef(), childFile.getParentRef()); session.removeDocument(parentFile.getRef()); session.save(); assertFalse("parentFile should be removed", session.exists(parentFile.getRef())); assertFalse("childFile should be removed", session.exists(childFile.getRef())); }

Target:
public void testCreateDocumentUnderPlacelessDoc() { DocumentModel parent = session.newDocumentModel(null, "parent", "File"); parent = session.createDocument(parent); assertNull(parent.getParentRef()); session.save(); DocumentModel child = session.newDocumentModel(parent.getRef(), "child", "File"); child = session.createDocument(child); session.save(); reopenSession(); parent = session.getDocument(parent.getRef()); assertNull(parent.getParentRef()); child = session.getDocument(child.getRef()); assertEquals(parent.getRef(), child.getParentRef()); session.removeDocument(parent.getRef()); session.save(); assertFalse(session.exists(parent.getRef())); assertFalse(session.exists(child.getRef())); }
Source:
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving) { if (!(entityLiving instanceof EntityPlayer)) return super.onItemUseFinish(stack, worldIn, entityLiving); EntityPlayer player = (EntityPlayer) entityLiving; if (!player.capabilities.isCreativeMode) stack.shrink(1); if (!worldIn.isRemote) { player.addPotionEffect(new PotionEffect(MobEffects.WITHER, 300, 5)); player.addPotionEffect(new PotionEffect(MobEffects.POISON, 300, 5)); player.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 400, 1)); if (LivingArmour.hasFullSet(player)) { ItemStack chestStack = Iterables.toArray(player.getArmorInventoryList(), ItemStack.class)[2]; LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack); if (armour != null) { if (player.capabilities.isCreativeMode) { if (armour.maxUpgradePoints < 10000) { armour.maxUpgradePoints = 10000; ((ItemLivingArmour) chestStack.getItem()).setLivingArmour(chestStack, armour, true); ItemLivingArmour.setLivingArmour(chestStack, armour); } } if (armour.maxUpgradePoints < 200) { armour.maxUpgradePoints = 200; ((ItemLivingArmour) chestStack.getItem()).setLivingArmour(chestStack, armour, true); ItemLivingArmour.setLivingArmour(chestStack, armour); } } } } return stack; }

Target:
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving) { if (!(entityLiving instanceof EntityPlayer)) return super.onItemUseFinish(stack, worldIn, entityLiving); EntityPlayer player = (EntityPlayer) entityLiving; boolean isCreative = player.capabilities.isCreativeMode; if (!isCreative) stack.shrink(1); if (!worldIn.isRemote) { if (!isCreative) { player.addPotionEffect(new PotionEffect(MobEffects.WITHER, 300, 5)); player.addPotionEffect(new PotionEffect(MobEffects.POISON, 300, 5)); player.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 400, 1)); } if (LivingArmour.hasFullSet(player)) { ItemStack chestStack = Iterables.toArray(player.getArmorInventoryList(), ItemStack.class)[2]; LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack); if (armour != null) { if (armour.maxUpgradePoints < 200) armour.maxUpgradePoints = 200; else if (isCreative && armour.maxUpgradePoints < 10000) armour.maxUpgradePoints = 10000; ((ItemLivingArmour) chestStack.getItem()).setLivingArmour(chestStack, armour, true); ItemLivingArmour.setLivingArmour(chestStack, armour); } } } return stack; }
Source:
private void configureSSLSocket(SSLSocket sslSocket) { SSLParameters sslParameters = sslSocket.getSSLParameters(); sslParameters.setNeedClientAuth(true); if (cipherSuites != null) { sslParameters.setCipherSuites(cipherSuites); } sslSocket.setSSLParameters(sslParameters); }

Target:
private void configureSSLSocket(SSLSocket sslSocket) { SSLParameters sslParameters = sslSocket.getSSLParameters(); LOG.debug("Setup cipher suites for client socket: {}", Arrays.toString(cipherSuites)); sslParameters.setCipherSuites(cipherSuites); sslSocket.setSSLParameters(sslParameters); }
Source:
public void testTimeLine() throws IOException, InterruptedException { String pg = "pulse"; resetTimeRange(); SWTBotTimeGraph timegraph = fTimeGraph; assertEquals(0, timegraph.selection().columnCount()); SWTBotTimeGraphEntry entry = timegraph.getEntry(pg); entry.select(); fBot.waitUntil(ConditionHelpers.timeGraphSelectionContains(timegraph, 0, "pulse")); entry = timegraph.getEntry(pg); Rectangle rect = entry.getBounds(); ImageHelper image = ImageHelper.grabImage(rect); ImmutableMultiset<RGB> ms = Multisets.copyHighestCountFirst(image.getHistogram()); int black = ms.count(new RGB(0,0,0)); RGB bgColor = ms.elementSet().iterator().next(); int bgCount = ms.count(bgColor); assertEquals(0.10f, ((float) black) / (bgCount), 0.2f); }

Target:
public void testTimeLine() { String lines = "pulse"; resetTimeRange(); SWTBotTimeGraph timegraph = fTimeGraph; assertEquals(0, timegraph.selection().columnCount()); ImageHelper currentImage = ImageHelper.grabImage(fBounds); SWTBotTimeGraphEntry entry = timegraph.getEntry(lines); entry = timegraph.getEntry(lines).select(); ImageHelper.waitForNewImage(fBounds, currentImage); Rectangle rect = entry.absoluteLocation(); ImageHelper image = ImageHelper.grabImage(rect); ImmutableMultiset<RGB> ms = Multisets.copyHighestCountFirst(image.getHistogram()); int black = ms.count(new RGB(0, 0, 0)); RGB bgColor = ms.elementSet().iterator().next(); int bgCount = ms.count(bgColor); float actual = ((float) black) / (bgCount); System.out.println(Integer.toString(black) + " " + bgCount + " " + actual * 100); assertEquals(0.113f, actual, 0.05f); }