auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Map<Import, String> getImportXML(final Metadata metadata, final List<Import> imports) { final Map<Import, String> importXML = new HashMap<>(); if (imports.size() > 0) { for (final String xml : getOtherDMNDiagramsXML(metadata)) { final Definitions definitions = marshaller.unmarshal(toStringReader(xml)); findImportByDefinitions(definitions, imports).ifPresent(anImport -> { importXML.put(anImport, xml); }); } } return importXML; }

Target:
public Map<Import, String> getImportXML(final Metadata metadata, final List<Import> imports) { final Map<Import, String> importXML = new HashMap<>(); if (imports.size() > 0) { for (final String xml : getOtherDMNDiagramsXML(metadata)) { try (StringReader sr = toStringReader(xml)) { final Definitions definitions = marshaller.unmarshal(sr); findImportByDefinitions(definitions, imports).ifPresent(anImport -> { importXML.put(anImport, xml); }); } } } return importXML; }
Source:
private float getPercenUsedGpus() { List<SchedulerNode> nodes = ((AbstractYarnScheduler) rmContext.getScheduler()).getAllNodes(); long totalGPUs = 0; long usedGPUs = 0; for(SchedulerNode node: nodes){ totalGPUs += node.getTotalResource().getResourceValue(ResourceInformation.GPU_URI); usedGPUs += node.getAllocatedResource().getResourceValue(ResourceInformation.GPU_URI); } return (float) usedGPUs / totalGPUs; }

Target:
private float getPercenUsedGpus() { List<SchedulerNode> nodes = ((AbstractYarnScheduler) rmContext.getScheduler()).getAllNodes(); long totalGPUs = 0; long usedGPUs = 0; for(SchedulerNode node: nodes){ totalGPUs += node.getTotalResource().getResourceValue(ResourceInformation.GPU_URI); usedGPUs += node.getAllocatedResource().getResourceValue(ResourceInformation.GPU_URI); } return totalGPUs == 0 ? 0 : (float) usedGPUs / totalGPUs; }
Source:
private Mono<AmqpSendLink> createCoordinatorSendLink(Duration timeout, AmqpRetryPolicy retry) { if (isDisposed()) { return Mono.error(logger.logExceptionAsError(new IllegalStateException(String.format( "Cannot create coordinator send link '%s' from a closed session.", TRANSACTION_LINK_NAME)))); } final LinkSubscription<AmqpSendLink> existing = coordinatorLink.get(); if (existing != null) { logger.verbose("linkName[{}]: Returning existing coordinator send link.", TRANSACTION_LINK_NAME); return Mono.just(existing.getLink()); } return RetryUtil.withRetry( getEndpointStates().takeUntil(state -> state == AmqpEndpointState.ACTIVE), timeout, retry) .then(Mono.<AmqpSendLink>create(sink -> { try { provider.getReactorDispatcher().invoke(() -> { LinkSubscription<AmqpSendLink> linkLinkSubscription = getCoordinator(TRANSACTION_LINK_NAME, timeout, retry); if (coordinatorLink.compareAndSet(null, linkLinkSubscription)) { logger.info("linkName[{}]: coordinator send link created.", TRANSACTION_LINK_NAME); } else { logger.info("linkName[{}]: Another coordinator send link exists. Disposing of new one.", TRANSACTION_LINK_NAME); linkLinkSubscription.dispose(); } sink.success(coordinatorLink.get().getLink()); }); } catch (IOException e) { sink.error(e); } })); }

Target:
private Mono<AmqpSendLink> createCoordinatorSendLink(Duration timeout, AmqpRetryPolicy retry) { if (isDisposed()) { return Mono.error(logger.logExceptionAsError(new IllegalStateException(String.format( "Cannot create coordinator send link '%s' from a closed session.", TRANSACTION_LINK_NAME)))); } final LinkSubscription<AmqpSendLink> existing = coordinatorLink.get(); if (existing != null) { logger.verbose("linkName[{}]: Returning existing coordinator send link.", TRANSACTION_LINK_NAME); return Mono.just(existing.getLink()); } return RetryUtil.withRetry( getEndpointStates().takeUntil(state -> state == AmqpEndpointState.ACTIVE), timeout, retry) .then(Mono.<AmqpSendLink>create(sink -> { try { provider.getReactorDispatcher().invoke(() -> { LinkSubscription<AmqpSendLink> linkSubscription = getCoordinator(TRANSACTION_LINK_NAME, timeout, retry); if (coordinatorLink.compareAndSet(null, linkSubscription)) { logger.info("linkName[{}]: coordinator send link created.", TRANSACTION_LINK_NAME); } else { logger.info("linkName[{}]: Another coordinator send link exists. Disposing of new one.", TRANSACTION_LINK_NAME); linkSubscription.dispose(); } sink.success(coordinatorLink.get().getLink()); }); } catch (IOException e) { sink.error(e); } })); }
Source:
public @NotNull String getAsString(){ String entries = null; for(StateValue<?> value : this.values){ if(entries == null){ entries = value.getGenerator().getId() + "=" + value.getValueAsString(); }else{ entries = entries + ", " + value.getGenerator().getId() + ": " + value.getValueAsString(); } } if(entries == null) { return "minecraft:" + this.material.name().toLowerCase(); } return "minecraft:" + this.material.name().toLowerCase() + " [" + entries + "]"; }

Target:
public @NotNull String getAsString(){ String entries = null; for(StateValue<?> value : this.values.values()){ if(entries == null){ entries = value.getGenerator().getId() + "=" + value.getValueAsString(); }else{ entries += "," + value.getGenerator().getId() + "=" + value.getValueAsString(); } } if(entries == null) { return "minecraft:" + this.material.name().toLowerCase(); } return "minecraft:" + this.material.name().toLowerCase() + "[" + entries + "]"; }
Source:
public void watch(ListenableFuture<?> future, long timeoutInMillis) { if (future == null || future.isDone()) { return; } Watchdog dog = cachedDogs.get(timeoutInMillis); if (dog == null) { dog = new Watchdog(scheduler, timeoutInMillis, sendInterruptOnFutureCancel); Watchdog exisiting = cachedDogs.putIfAbsent(timeoutInMillis, dog); if (exisiting != null) { dog = exisiting; } } dog.watch(future); if (! cleanerScheduled.get() && cleanerScheduled.compareAndSet(false, true)) { scheduler.schedule(cacheCleaner, INSPECTION_INTERVAL_MILLIS); } }

Target:
public void watch(ListenableFuture<?> future, long timeoutInMillis) { if (future == null || future.isDone()) { return; } Watchdog dog = cachedDogs.get(timeoutInMillis); if (dog == null) { dog = new Watchdog(scheduler, timeoutInMillis, sendInterruptOnFutureCancel); Watchdog exisiting = cachedDogs.putIfAbsent(timeoutInMillis, dog); if (exisiting != null) { dog = exisiting; } } dog.watch(future); maybeScheduleCleaner(); }
Source:
public boolean clickContinue(final boolean key) { final Component c = getContinue(); if (c != null) { if (key) { ctx.input.send(" "); return true; } else { return c.click(); } } return false; }

Target:
public boolean clickContinue(final boolean key) { final Component c = getContinue(); return c != null && (key && ctx.input.send(" ") || c.click()); }
Source:
private Long getSurveillanceAuthority() throws UserPermissionRetrievalException { if (Util.isUserRoleAdmin() || Util.isUserRoleOnc()) { return userPermissionDao.getIdFromAuthority("ROLE_ONC"); } else if (Util.isUserRoleAcbAdmin()) { return userPermissionDao.getIdFromAuthority("ROLE_ACB"); } else { return null; } }

Target:
private Long getSurveillanceAuthority() throws UserPermissionRetrievalException { if (Util.isUserRoleAdmin() || Util.isUserRoleOnc()) { return userPermissionDao.getIdFromAuthority(Authority.ROLE_ONC); } else if (Util.isUserRoleAcbAdmin()) { return userPermissionDao.getIdFromAuthority(Authority.ROLE_ACB); } else { return null; } }
Source:
public synchronized void onEvent(EventUserUpdate event) { User user = event.getUser(); if (user != null) { this.addItem(user); } }

Target:
public synchronized void onEvent(EventUserUpdate event) { User user = event.getUser(); if (user != null) { container.addItem(user); } }
Source:
public void setAsPrimaryObject(AgentPrincipals agent, PID fileObjPid) { aclService.assertHasAccess("Insufficient privileges to set " + fileObjPid.getUUID() + " as primary object", fileObjPid, agent.getPrincipals(), editResourceType); RepositoryObject repoObj = repoObjLoader.getRepositoryObject(fileObjPid); if (!(repoObj instanceof FileObject)) { throw new InvalidOperationForObjectType("Cannot set " + fileObjPid.getUUID() + " as primary object, since objects of type " + repoObj.getClass().getName() + " are not eligible."); } RepositoryObject parent = repoObj.getParent(); if (!(parent instanceof WorkObject)) { throw new InvalidOperationForObjectType("Object of type " + parent.getClass().getName() + " cannot have a primary object."); } WorkObject work = (WorkObject) parent; work.setPrimaryObject(fileObjPid); operationsMessageSender.sendSetAsPrimaryObjectOperation(agent.getUsername(), Arrays.asList(fileObjPid)); }

Target:
public void setAsPrimaryObject(AgentPrincipals agent, PID fileObjPid) { aclService.assertHasAccess("Insufficient privileges to set " + fileObjPid.getUUID() + " as primary object", fileObjPid, agent.getPrincipals(), editResourceType); RepositoryObject repoObj = repoObjLoader.getRepositoryObject(fileObjPid); if (!(repoObj instanceof FileObject)) { throw new InvalidOperationForObjectType("Cannot set " + fileObjPid.getUUID() + " as primary object, since objects of type " + repoObj.getClass().getName() + " are not eligible."); } RepositoryObject parent = repoObj.getParent(); if (!(parent instanceof WorkObject)) { throw new InvalidOperationForObjectType("Object of type " + parent.getClass().getName() + " cannot have a primary object."); } WorkObject work = (WorkObject) parent; work.setPrimaryObject(fileObjPid); operationsMessageSender.sendSetAsPrimaryObjectOperation(agent.getUsername(), Arrays.asList(parent.getPid(), fileObjPid)); }
Source:
public RemoveMembersFromConsumerGroupOptions() { this.members = new HashSet<>(); }

Target:
public RemoveMembersFromConsumerGroupOptions() { this.members = Collections.emptySet(); }
Source:
public void init() throws Exception { super.init(); setContextBaseUrl("/api/configuration/strongbox/storages"); r0 = new RepositoryForm(); r0.setId("repository0"); r0.setAllowsRedeployment(true); r0.setSecured(true); r0.setLayout(Maven2LayoutProvider.ALIAS); r0.setType("hosted"); r0.setPolicy("release"); r0.setImplementation("file-system"); r0.setStatus("In Service"); r1 = new RepositoryForm(); r1.setId("repository1"); r1.setAllowsForceDeletion(true); r1.setTrashEnabled(true); r1.setProxyConfiguration(createProxyConfiguration()); r1.setLayout(Maven2LayoutProvider.ALIAS); r1.setType("hosted"); r1.setPolicy("release"); r1.setImplementation("file-system"); r1.setStatus("In Service"); r1.setGroupRepositories(ImmutableSet.of("repository0")); }

Target:
public void init() throws Exception { super.init(); setContextBaseUrl("/api/configuration/strongbox/storages"); repositoryForm0 = new RepositoryForm(); repositoryForm0.setId("repository0"); repositoryForm0.setAllowsRedeployment(true); repositoryForm0.setSecured(true); repositoryForm0.setLayout(Maven2LayoutProvider.ALIAS); repositoryForm0.setType("hosted"); repositoryForm0.setPolicy("release"); repositoryForm0.setImplementation("file-system"); repositoryForm0.setStatus("In Service"); repositoryForm1 = new RepositoryForm(); repositoryForm1.setId("repository1"); repositoryForm1.setAllowsForceDeletion(true); repositoryForm1.setTrashEnabled(true); repositoryForm1.setProxyConfiguration(createProxyConfiguration()); repositoryForm1.setLayout(Maven2LayoutProvider.ALIAS); repositoryForm1.setType("hosted"); repositoryForm1.setPolicy("release"); repositoryForm1.setImplementation("file-system"); repositoryForm1.setStatus("In Service"); repositoryForm1.setGroupRepositories(ImmutableSet.of("repository0")); }
Source:
private String pickCDN() { List<String> pushClusters = props.getList(VoldemortBuildAndPushJob.PUSH_CLUSTER); if (!props.containsKey(VoldemortBuildAndPushJob.PUSH_CDN_CLUSTER)) { return ""; } List<String> cdnClusters = props.getList(VoldemortBuildAndPushJob.PUSH_CDN_CLUSTER); if (pushClusters.size() != cdnClusters.size()) { warn("Cluster sizes are different! Will bypass CDN for push cluster " + destination); return ""; } int index = pushClusters.indexOf(destination); assert index != -1; String cdnCluster = cdnClusters.get(index); if (cdnCluster.equals("null")) { info("Will bypass CDN for push cluster " + destination); return ""; } if (!cdnCluster.matches(".*hdfs://.*:[0-9]{1,5}/?")) { warn("Invalid URL format! Will bypass CDN for push cluster " + destination); return ""; } return cdnCluster.replaceAll("(?<=:[0-9]{1,5})/", ""); }

Target:
private String pickCDN() throws Exception { String cdnCluster = buildCdnMap().get(removeTrailingSlash(destination)); if (cdnCluster == null) { warn("Cannot find corresponding CDN! Will bypass CDN for push cluster " + destination); return ""; } if (cdnCluster.equals("null")) { info("Will bypass CDN for push cluster " + destination); return ""; } if (!cdnCluster.matches(".*hdfs://.+:[0-9]{1,5}")) { warn("Invalid URL format! Will bypass CDN for push cluster " + destination); return ""; } return cdnCluster; }
Source:
public void testSubCollectionPageTotalsWithJoinFilter() { Author author = new Author(); author.setId(1L); Book book = new Book(); book.setId(2); RelationshipImpl relationship = new RelationshipImpl( Author.class, Book.class, BOOKS, author, Arrays.asList(book) ); List<Path.PathElement> publisherNamePath = Arrays.asList( new Path.PathElement(Book.class, Publisher.class, PUBLISHER), new Path.PathElement(Publisher.class, String.class, "name") ); FilterPredicate publisherNamePredicate = new InPredicate( new Path(publisherNamePath), "Pub1"); EntityProjection entityProjection = EntityProjection.builder().type(Book.class).build(); SubCollectionPageTotalsQueryBuilder builder = new SubCollectionPageTotalsQueryBuilder( entityProjection, relationship, dictionary, new TestSessionWrapper()); TestQueryWrapper query = (TestQueryWrapper) builder .withPossibleFilterExpression(Optional.of(publisherNamePredicate)) .build(); String expected = "SELECT COUNT(DISTINCT example_Author_books) " + "FROM example.Author AS example_Author " + "LEFT JOIN example_Author.books example_Author_books " + "LEFT JOIN example_Author_books.publisher example_Author_books_publisher " + "WHERE (example_Author_books_publisher.name IN (:books_publisher_name_XXX) " + "AND example_Author.id IN (:id_XXX))"; String actual = query.getQueryText(); actual = actual.replaceFirst(":books_publisher_name_\\w+", ":books_publisher_name_XXX"); actual = actual.trim().replaceAll(" +", " "); actual = actual.replaceFirst(":id_\\w+", ":id_XXX"); assertEquals(expected, actual); }

Target:
public void testSubCollectionPageTotalsWithJoinFilter() { Author author = new Author(); author.setId(1L); Book book = new Book(); book.setId(2); List<Path.PathElement> publisherNamePath = Arrays.asList( new Path.PathElement(Book.class, Publisher.class, PUBLISHER), new Path.PathElement(Publisher.class, String.class, "name") ); FilterPredicate publisherNamePredicate = new InPredicate( new Path(publisherNamePath), "Pub1"); EntityProjection entityProjection = EntityProjection.builder() .type(Book.class) .filterExpression(publisherNamePredicate) .build(); Relationship relationshipProjection = Relationship.builder().name(BOOKS).projection(entityProjection).build(); RelationshipImpl relationship = new RelationshipImpl( Author.class, author, relationshipProjection ); SubCollectionPageTotalsQueryBuilder builder = new SubCollectionPageTotalsQueryBuilder( relationship, dictionary, new TestSessionWrapper() ); TestQueryWrapper query = (TestQueryWrapper) builder.build(); String expected = "SELECT COUNT(DISTINCT example_Author_books) " + "FROM example.Author AS example_Author " + "LEFT JOIN example_Author.books example_Author_books " + "LEFT JOIN example_Author_books.publisher example_Author_books_publisher " + "WHERE (example_Author_books_publisher.name IN (:books_publisher_name_XXX) " + "AND example_Author.id IN (:id_XXX))"; String actual = query.getQueryText(); actual = actual.replaceFirst(":books_publisher_name_\\w+", ":books_publisher_name_XXX"); actual = actual.trim().replaceAll(" +", " "); actual = actual.replaceFirst(":id_\\w+", ":id_XXX"); assertEquals(expected, actual); }
Source:
public void handleError(ClientHttpResponse response) throws IOException { HttpStatus status = response.getStatusCode(); AmazonS3Exception e = new AmazonS3Exception(IOUtils.toString(response.getBody())); switch (status) { case BAD_REQUEST: if (e.getErrorCode() == null || e.getErrorCode().equals("RequestTimeout")) { throw new RetryableException(new IOException(IOUtils.toString(response.getBody()))); } case NOT_FOUND: throw new NotRetryableException(new IOException(IOUtils.toString(response.getBody()))); case INTERNAL_SERVER_ERROR: log.warn("Server error. Stop processing: {}", response.getStatusText()); throw new NotResumableException(new IOException(IOUtils.toString(response.getBody()))); case FORBIDDEN: log.warn("FORBIDDEN response code received"); throw new NotRetryableException( new IOException( "Access refused by object store. Confirm client is part of repository cloud and that the download was initiated less than 1 day earlier (7 days for uploads)" + IOUtils.toString(response.getBody()))); default: log.warn("Retryable exception: {}", response.getStatusText()); throw new RetryableException(new IOException(IOUtils.toString(response.getBody()))); } }

Target:
public void handleError(ClientHttpResponse response) throws IOException { HttpStatus status = response.getStatusCode(); AmazonS3Exception e = new AmazonS3Exception(IOUtils.toString(response.getBody())); switch (status) { case BAD_REQUEST: if (e.getErrorCode() == null || e.getErrorCode().equals("RequestTimeout")) { throw retryableException(response); } case NOT_FOUND: throw notRetryableException(response); case INTERNAL_SERVER_ERROR: log.warn("Server error. Stop processing: {}", response.getStatusText()); throw notResumableException(response); case FORBIDDEN: log.warn("FORBIDDEN response code received"); throw notRetryableException( "Access refused by object store. Confirm client is part of repository cloud and that the download was initiated less than 1 day earlier (7 days for uploads)", response); default: log.warn("Retryable exception: {}", response.getStatusText()); throw retryableException(response); } }
Source:
public static void registerUserEmailConfirmed(SignUpUser user) { CloseableHttpClient httpClient = HttpClientBuilder.create().disableAutomaticRetries().build(); URL url = null; String env = Configuration.getEnvType().getKey(); String baseURL = XMLReader.getValue("services_internal." + env + ".base_url"); try { url = new URL(baseURL + "/users/emailconfirmed"); } catch (MalformedURLException e) { PageObjectLogging.logError("Wrong internal services URL",e); } try { HttpPost httpPost = new HttpPost(new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), url.getQuery(), url.getRef())); httpPost.setHeader("X-Client-Ip", "8.8.8.8"); httpPost.setHeader("X-Wikia-Internal-Request", "1"); List<BasicNameValuePair> params = new ArrayList<>(); params.add(new BasicNameValuePair("username", user.getUsername())); params.add(new BasicNameValuePair("password", user.getPassword())); params.add(new BasicNameValuePair("email", user.getEmail())); params.add(new BasicNameValuePair("birthdate", user.getBirthday().toString())); params.add(new BasicNameValuePair("marketingAllowed", "on")); params.add(new BasicNameValuePair("registrationWikiaId", "80433")); httpPost.setEntity(new UrlEncodedFormEntity(params, StandardCharsets.UTF_8)); httpClient.execute(httpPost); } catch (URISyntaxException | IOException e) { PageObjectLogging.logError("Error during registering user",e); } }

Target:
public static void registerUserEmailConfirmed(SignUpUser user) { CloseableHttpClient httpClient = HttpClientBuilder.create().disableAutomaticRetries().build(); URL url = null; String env = Configuration.getEnvType().getKey(); String baseURL = XMLReader.getValue("services_internal." + env + ".base_url"); try { url = new URL(baseURL + "user-registration/users/emailconfirmed"); } catch (MalformedURLException e) { PageObjectLogging.logError("Wrong internal services URL", e); } try { HttpPost httpPost = new HttpPost(new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), url.getQuery(), url.getRef())); httpPost.setHeader("X-Client-Ip", "8.8.8.8"); httpPost.setHeader("X-Wikia-Internal-Request", "1"); List<BasicNameValuePair> params = new ArrayList<>(); params.add(new BasicNameValuePair("username", user.getUsername())); params.add(new BasicNameValuePair("password", user.getPassword())); params.add(new BasicNameValuePair("email", user.getEmail())); params.add(new BasicNameValuePair("birthdate", user.getBirthday().toString())); params.add(new BasicNameValuePair("marketingAllowed", "on")); params.add(new BasicNameValuePair("registrationWikiaId", "80433")); httpPost.setEntity(new UrlEncodedFormEntity(params, StandardCharsets.UTF_8)); httpClient.execute(httpPost); } catch (URISyntaxException | IOException e) { PageObjectLogging.logError("Error during registering user", e); } }
Source:
public final boolean incrementToken() throws IOException { if (input.incrementToken()) { String converted = STEMMER.stemWord(termAtt.toString()); if (converted != null) termAtt.setEmpty().append(converted); return true; } else { return false; } }

Target:
public final boolean incrementToken() throws IOException { if (input.incrementToken()) { String converted = STEMMER.stemWord(termAtt.toString()); if (converted != null) { termAtt.setEmpty().append(converted); } return true; } else { return false; } }
Source:
private String getPostDataByDifferentOption(String postdata, String dataOptionName) { if (dataOptionName.equals("data-urlencode")) { postdata = encodePostdata(postdata); } else { if (postdata.contains("@") && !dataOptionName.equals("data-raw")) { postdata = postdata.replace("@", ""); postdata = readFromFile(postdata); if (!dataOptionName.equals("data-binary")) { postdata = deleteLineBreak(postdata); } } } return postdata; }

Target:
private String getPostDataByDifferentOption(String postdata, String dataOptionName) { if ("data-urlencode".equals(dataOptionName)) { postdata = encodePostdata(postdata); } else { if (postdata.charAt(0) == '@' && !"data-raw".equals(dataOptionName)) { postdata = postdata.substring(1, postdata.length()); postdata = readFromFile(postdata); if (!"data-binary".equals(dataOptionName)) { postdata = deleteLineBreak(postdata); } } } return postdata; }
Source:
public static <T extends PlanNode> Rule<T> checkPlanDoNotMatch(Pattern<T> pattern, String message) { return new Rule<T>() { @Override public Pattern<T> getPattern() { return pattern; } @Override public Result apply(T node, Captures captures, Context context) { throw new IllegalStateException(message); } }; }

Target:
public static <T extends PlanNode> Rule<T> checkPlanDoNotMatch(Pattern<T> pattern, String message) { requireNonNull(pattern, "pattern is null"); requireNonNull(message, "message is null"); return new Rule<T>() { @Override public Pattern<T> getPattern() { return pattern; } @Override public Result apply(T node, Captures captures, Context context) { throw new IllegalStateException(message); } }; }
Source:
private String getSparkMaster(Properties properties) { String master = properties.getProperty("master"); if (master == null) { master = properties.getProperty("spark.master"); if (master == null) { master = System.getenv("SPARK_HOME"); } if (master == null) { master = "local[*]"; } } return master; }

Target:
private String getSparkMaster(Properties properties) { String master = properties.getProperty("master"); if (master == null) { master = properties.getProperty("spark.master"); if (master == null) { master = "local[*]"; } } return master; }
Source:
private void initialDatagramSocket() { if (datagramSocket == null) synchronized (InfluxDBImpl.class) { if (datagramSocket == null) try { datagramSocket = new DatagramSocket(); } catch (SocketException e) { throw new RuntimeException(e); } } }

Target:
private void initialDatagramSocket() { if (datagramSocket == null) { synchronized (InfluxDBImpl.class) { if (datagramSocket == null) { try { datagramSocket = new DatagramSocket(); } catch (SocketException e) { throw new RuntimeException(e); } } } } }
Source:
private static Map<String, String> getLastSegment(String text) { Pattern pattern = Pattern.compile(REGEX_LAST_SEGMENT); Matcher matcher = pattern.matcher(text); Map<String, String> result = new HashMap<String, String>(); if (matcher.find()) { result.put("operator", matcher.group(1)); result.put("segment", matcher.group(2) == null ? "" : matcher.group(2)); } else { result.put("operator", null); result.put("segment", null); } return result; }

Target:
private static LastSegment getLastSegment(String text) { Pattern pattern = Pattern.compile(REGEX_LAST_SEGMENT); Matcher matcher = pattern.matcher(text); if (matcher.find()) { return new LastSegment(matcher.group(1), matcher.group(2) == null ? "" : matcher.group(2)); } else { return new LastSegment(null, null); } }
Source:
public <T> T getConfigurationObject(Class<T> configClass) throws CarbonConfigurationException { String namespace = null; if (configClass.isAnnotationPresent(Configuration.class)) { Configuration configuration = configClass.getAnnotation(Configuration.class); if (!Configuration.NULL.equals(configuration.namespace())) { namespace = configuration.namespace(); } } loadDeploymentConfiguration(configFileReader); if (namespace != null && deploymentConfigs.containsKey(namespace)) { String jsonConfigString = deploymentConfigs.get(namespace); String yamlConfigString = ConfigurationUtils.convertJSONToYAML(jsonConfigString); if (logger.isDebugEnabled()) { logger.debug("class name: " + configClass.getSimpleName() + " | new configurations : \n" + yamlConfigString); } String yamlProcessedString = processPlaceholder(yamlConfigString); yamlProcessedString = org.wso2.carbon.kernel.utils.Utils.substituteVariables(yamlProcessedString); Yaml yaml = new Yaml(new CustomClassLoaderConstructor(configClass, configClass.getClassLoader())); yaml.setBeanAccess(BeanAccess.FIELD); return yaml.loadAs(yamlProcessedString, configClass); } else { if (logger.isDebugEnabled()) { logger.debug("Deployment configuration mapping doesn't exist: " + "creating configuration instance with default values"); } try { return configClass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new CarbonConfigurationException("Error while creating configuration Instance : " + configClass.getSimpleName(), e); } } }

Target:
public <T> T getConfigurationObject(Class<T> configClass) throws CarbonConfigurationException { String namespace = null; if (configClass.isAnnotationPresent(Configuration.class)) { Configuration configuration = configClass.getAnnotation(Configuration.class); if (!Configuration.NULL.equals(configuration.namespace())) { namespace = configuration.namespace(); } } loadDeploymentConfiguration(configFileReader); if (namespace != null && deploymentConfigs.containsKey(namespace)) { String yamlConfigString = deploymentConfigs.get(namespace); if (logger.isDebugEnabled()) { logger.debug("class name: " + configClass.getSimpleName() + " | new configurations: \n" + yamlConfigString); } String yamlProcessedString = processPlaceholder(yamlConfigString); yamlProcessedString = org.wso2.carbon.kernel.utils.Utils.substituteVariables(yamlProcessedString); Yaml yaml = new Yaml(new CustomClassLoaderConstructor(configClass, configClass.getClassLoader())); yaml.setBeanAccess(BeanAccess.FIELD); return yaml.loadAs(yamlProcessedString, configClass); } else { if (logger.isDebugEnabled()) { logger.debug("Deployment configuration mapping doesn't exist: " + "creating configuration instance with default values"); } try { return configClass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new CarbonConfigurationException("Error while creating configuration instance: " + configClass.getSimpleName(), e); } } }
Source:
public Map.Entry<Value, V> next() { left--; do { keysIndex++; if (keys[keysIndex] != null && keys[keysIndex] != ValueNull.DELETED) return new DataUtils.MapEntry<Value, V>(keys[keysIndex], values[keysIndex]); } while (true); }

Target:
public Map.Entry<Value, V> next() { if (left <= 0) throw new NoSuchElementException(); left--; for (;;) { keysIndex++; Value key = keys[keysIndex]; if (key != null && key != ValueNull.DELETED) return new AbstractMap.SimpleImmutableEntry<Value, V>(key, values[keysIndex]); } }
Source:
private boolean isTabAvailable(String tab, Map<String, List<String>> tabAccessMap, Authentication auth) { if (tabAccessMap.get(tab).size() == 0) { return true; } for (String permission : tabAccessMap.get(tab)) { if(auth.getAuthorities().contains(new SimpleGrantedAuthority(permission))) { return true; } } return false; }

Target:
private boolean isTabAvailable(String tab, Map<String, List<String>> tabAccessMap, Authentication auth) { if (tabAccessMap.get(tab) == null || tabAccessMap.get(tab).size() == 0) { return true; } else { for (String permission : tabAccessMap.get(tab)) { if(auth.getAuthorities().contains(new SimpleGrantedAuthority(permission))) { return true; } } } return false; }
Source:
public void setDrmLicenseUrl(String licenseUrl){ Log.d("setDrmLicenseUrl", licenseUrl); this.drmLicenseUrl = licenseUrl; }

Target:
public void setDrmLicenseUrl(String licenseUrl){ this.drmLicenseUrl = licenseUrl; }
Source:
public CommandCallback getCallback() { return getParameters().isUseCinderCommandCallback() ? Injector.injectMembers(new ConcurrentChildCommandsExecutionCallback()) : null; }

Target:
public CommandCallback getCallback() { return getParameters().isUseCinderCommandCallback() ? callbackProvider.get() : null; }
Source:
public void saveFilterIntoPreferences(final FilterSettings filterSettings, final Consumer<Boolean> callback) { saveFilterIntoPreferences(filterSettings, callback, () -> { filterSavedEvent.fire(new SavedFilterAddedEvent(new SavedFilter(filterSettings.getKey(), filterSettings.getTableName(), false))); callback.accept(true); }); }

Target:
public void saveFilterIntoPreferences(final FilterSettings filterSettings, final Consumer<Boolean> callback) { filterSettings.setKey(getNewFilterSettingsKey()); loadMultiGridPreferencesStore(store -> { loadSavedFiltersFromPreferences(store, savedFilters -> { final Optional<SavedFilter> savedFilter = savedFilters.stream().filter(f -> f.getName().equalsIgnoreCase(filterSettings.getTableName())).findFirst(); if (savedFilter.isPresent()) { callback.accept(false); return; } addFilterToPreferencesStore(filterSettings, store); saveMultiGridPreferencesStore(store, () -> { filterSavedEvent.fire(new SavedFilterAddedEvent(new SavedFilter(filterSettings.getKey(), filterSettings.getTableName(), false))); callback.accept(true); }); }); }); }
Source:
byte[] toBytes() { byte[] buf = new byte[Version_Length + Offset_Length + Size_Length + TTL_Length + storeKey.sizeInBytes()]; ByteBuffer bufWrap = ByteBuffer.wrap(buf); bufWrap.putShort(version); bufWrap.putLong(offset.getOffset()); bufWrap.putLong(size); bufWrap.putLong(TTL_Length); bufWrap.put(storeKey.toBytes()); return buf; }

Target:
byte[] toBytes() { byte[] buf = new byte[VERSION_LENGTH + OFFSET_LENGTH + SIZE_LENGTH + EXPIRES_AT_MS_LENGTH + storeKey.sizeInBytes()]; ByteBuffer bufWrap = ByteBuffer.wrap(buf); bufWrap.putShort(VERSION); bufWrap.putLong(offset.getOffset()); bufWrap.putLong(size); bufWrap.putLong(expiresAtMs); bufWrap.put(storeKey.toBytes()); return buf; }
Source:
static String getConsumerClientId(String id, Config config) { if (config.get(JobConfig.JOB_NAME()) == null) { throw new ConfigException("Missing job name"); } String jobName = config.get(JobConfig.JOB_NAME()); String jobId = (config.get(JobConfig.JOB_ID()) != null) ? config.get(JobConfig.JOB_ID()) : "1"; return String.format("%s-%s-%s", id.replaceAll("\\W", "_"), jobName.replaceAll("\\W", "_"), jobId.replaceAll("\\W", "_")); }

Target:
static String getConsumerClientId(String id, Config config) { JobConfig jobConfig = new JobConfig(config); Option jobNameOption = jobConfig.getName(); if (jobNameOption.isEmpty()) { throw new ConfigException("Missing job name"); } String jobName = (String) jobNameOption.get(); Option jobIdOption = jobConfig.getJobId(); String jobId = "1"; if (! jobIdOption.isEmpty()) { jobId = (String) jobIdOption.get(); } return String.format("%s-%s-%s", id.replaceAll("\\W", "_"), jobName.replaceAll("\\W", "_"), jobId.replaceAll("\\W", "_")); }
Source:
public static void addData(final Crosstab<Number> mainCrosstab, final Crosstab<Number> partialCrosstab) { if (partialCrosstab != null) { final CrosstabNavigator<Number> mainNavigator = new CrosstabNavigator<Number>(mainCrosstab); final CrosstabNavigator<Number> nav = new CrosstabNavigator<Number>(partialCrosstab); final List<CrosstabDimension> dimensions = partialCrosstab.getDimensions(); for (CrosstabDimension dimension : dimensions) { final List<String> categories = dimension.getCategories(); for (String category : categories) { final Number categoryValue = nav.where(dimension, category).safeGet(null); final CrosstabNavigator<Number> whereToPut = mainNavigator.where(dimension, category); if (categoryValue != null) { final Number oldValue = whereToPut.safeGet(null); if (oldValue != null) { final Number newValue = new BigDecimal(categoryValue.longValue()).add(new BigDecimal( oldValue.longValue())); whereToPut.put(newValue); } else { whereToPut.put(categoryValue); } } } } } }

Target:
public static void addData(final Crosstab<Number> mainCrosstab, final Crosstab<Number> partialCrosstab) { if (partialCrosstab != null) { final CrosstabNavigator<Number> mainNavigator = new CrosstabNavigator<Number>(mainCrosstab); final CrosstabNavigator<Number> nav = new CrosstabNavigator<Number>(partialCrosstab); final List<CrosstabDimension> dimensions = partialCrosstab.getDimensions(); for (CrosstabDimension dimension : dimensions) { final List<String> categories = dimension.getCategories(); for (String category : categories) { final Number categoryValue = nav.where(dimension, category).safeGet(null); final CrosstabNavigator<Number> whereToPut = mainNavigator.where(dimension, category); if (categoryValue != null) { final Number oldValue = whereToPut.safeGet(null); if (oldValue != null) { final Number newValue = sum(oldValue, categoryValue); whereToPut.put(newValue); } else { whereToPut.put(categoryValue); } } } } } }
Source:
protected Observable<RegistrationChannel> reestablish() { return Observable.create(new Observable.OnSubscribe<RegistrationChannel>() { @Override public void call(Subscriber<? super RegistrationChannel> subscriber) { try { RegistrationChannel newDelegateChannel = channelFactory.call(); InstanceInfo instanceInfo = instanceInfoRef.get(); if (instanceInfo != null) { newDelegateChannel.register(instanceInfo); } subscriber.onNext(newDelegateChannel); subscriber.onCompleted(); } catch (Exception e) { subscriber.onError(e); } } }); }

Target:
protected Observable<RegistrationChannel> reestablish() { return Observable.create(new Observable.OnSubscribe<RegistrationChannel>() { @Override public void call(final Subscriber<? super RegistrationChannel> subscriber) { try { final RegistrationChannel newDelegateChannel = channelFactory.call(); InstanceInfo instanceInfo = instanceInfoRef.get(); if (instanceInfo != null) { newDelegateChannel.register(instanceInfo).subscribe(new Subscriber<Void>() { @Override public void onCompleted() { logger.info("Retry re-registration completed"); subscriber.onNext(newDelegateChannel); subscriber.onCompleted(); } @Override public void onError(Throwable e) { logger.info("Retry re-registration failed"); subscriber.onError(e); } @Override public void onNext(Void aVoid) { } }); } else { logger.info("InstanceInfo is null, no need to re-register"); subscriber.onNext(newDelegateChannel); subscriber.onCompleted(); } } catch (Exception e) { subscriber.onError(e); } } }); }
Source:
private Boolean isEmptyEvidence(Evidence queryEvidence) { EvidenceType evidenceType = queryEvidence.getEvidenceType(); String knownEffect = queryEvidence.getKnownEffect(); LevelOfEvidence level = queryEvidence.getLevelOfEvidence(); String description = queryEvidence.getDescription().trim(); Set<Treatment> treatments = queryEvidence.getTreatments(); Set<NccnGuideline> nccnGuidelines = queryEvidence.getNccnGuidelines(); Set<ClinicalTrial> clinicalTrials = queryEvidence.getClinicalTrials(); List<EvidenceType> therapyEvidenceTypes = Arrays.asList(EvidenceType.STANDARD_THERAPEUTIC_IMPLICATIONS_FOR_DRUG_SENSITIVITY, EvidenceType.STANDARD_THERAPEUTIC_IMPLICATIONS_FOR_DRUG_RESISTANCE, EvidenceType.INVESTIGATIONAL_THERAPEUTIC_IMPLICATIONS_DRUG_RESISTANCE, EvidenceType.INVESTIGATIONAL_THERAPEUTIC_IMPLICATIONS_DRUG_SENSITIVITY); Boolean isEmpty = false; if(evidenceType.equals(EvidenceType.ONCOGENIC) || evidenceType.equals(EvidenceType.MUTATION_EFFECT)) { if(knownEffect.isEmpty() && description.isEmpty()) isEmpty = true; } else if(evidenceType.equals(EvidenceType.NCCN_GUIDELINES)) { Boolean validNccn = false; for(NccnGuideline nccn : nccnGuidelines) { if(!nccn.isEmpty()) { validNccn = true; } } isEmpty = !validNccn; } else if(evidenceType.equals(EvidenceType.CLINICAL_TRIAL)) { if(clinicalTrials.isEmpty()) isEmpty = true; } else if(therapyEvidenceTypes.contains(evidenceType)) { if(treatments == null && description.isEmpty()) isEmpty = true; } else if(description.isEmpty()) { isEmpty = true; } return isEmpty; }

Target:
private Boolean isEmptyEvidence(Evidence queryEvidence) { EvidenceType evidenceType = queryEvidence.getEvidenceType(); String knownEffect = queryEvidence.getKnownEffect(); String description = queryEvidence.getDescription().trim(); Set<Treatment> treatments = queryEvidence.getTreatments(); Set<NccnGuideline> nccnGuidelines = queryEvidence.getNccnGuidelines(); Set<ClinicalTrial> clinicalTrials = queryEvidence.getClinicalTrials(); Boolean isEmpty = false; if(evidenceType.equals(EvidenceType.ONCOGENIC) || evidenceType.equals(EvidenceType.MUTATION_EFFECT)) { if(StringUtils.isNullOrEmpty(knownEffect) && StringUtils.isNullOrEmpty(description)) isEmpty = true; } else if(evidenceType.equals(EvidenceType.NCCN_GUIDELINES)) { Boolean validNccn = false; for(NccnGuideline nccn : nccnGuidelines) { if(!nccn.isEmpty()) { validNccn = true; } } isEmpty = !validNccn; } else if(evidenceType.equals(EvidenceType.CLINICAL_TRIAL)) { if(clinicalTrials == null || clinicalTrials.isEmpty()) isEmpty = true; } else if(MainUtils.getTreatmentEvidenceTypes().contains(evidenceType)) { if(treatments == null && StringUtils.isNullOrEmpty(description)) isEmpty = true; } else if(StringUtils.isNullOrEmpty(description)) { isEmpty = true; } return isEmpty; }
Source:
public void shouldSetStrictOnPlugin() { RuntimeOptions runtimeOptions = new RuntimeOptions("--strict"); Plugins plugins = new Plugins(getSystemClassLoader(), pluginFactory, runtimeOptions); StrictAware plugin = Mockito.mock(StrictAware.class); plugins.addPlugin(plugin); plugins.setSerialEventBusOnEventListenerPlugins(rootEventPublisher); verify(plugin).setStrict(true); }

Target:
public void shouldSetStrictOnPlugin() { RuntimeOptions runtimeOptions = new RuntimeOptions("--strict"); Plugins plugins = new Plugins(getSystemClassLoader(), pluginFactory, runtimeOptions); StrictAware plugin = Mockito.mock(StrictAware.class); plugins.addPlugin(plugin); verify(plugin).setStrict(true); }
Source:
private final T newInstance(K alias, ClassInstanceConfiguration<T> config) { if (config == null) { config = getPreconfigured(alias); if (config == null) { return null; } } T instance; if(config.getInstance() != null) { instance = config.getInstance(); } else { try { instance = invokeConstructor(config.getClazz(), config.getArguments()); instantiated.add(instance); } catch (InstantiationException | InvocationTargetException | NoSuchMethodException | IllegalAccessException e) { throw new RuntimeException(e); } } AtomicInteger currentCount = providedVsCount.putIfAbsent(instance, new AtomicInteger(1)); if(currentCount != null) { currentCount.incrementAndGet(); } return instance; }

Target:
private T newInstance(K alias, ClassInstanceConfiguration<T> config) { if (config == null) { config = getPreconfigured(alias); if (config == null) { return null; } } T instance; if(config.getInstance() != null) { instance = config.getInstance(); } else { try { instance = invokeConstructor(config.getClazz(), config.getArguments()); instantiated.add(instance); } catch (InstantiationException | InvocationTargetException | NoSuchMethodException | IllegalAccessException e) { throw new RuntimeException(e); } } AtomicInteger currentCount = providedVsCount.putIfAbsent(instance, new AtomicInteger(1)); if(currentCount != null) { currentCount.incrementAndGet(); } return instance; }
Source:
public void testRetrieveSnippet() throws GitLabApiException { Snippet snippet = createSnippet (new Snippet( "Xml Snippet", "file.xml", "<parent><data>1</data></parent>", Visibility.INTERNAL, "Description")); SnippetsApi api = gitLabApi.getSnippetApi(); Snippet savedSnippet = api.getSnippet(snippet.getId()); assertEquals("Xml Snippet", savedSnippet.getTitle()); assertEquals("file.xml", savedSnippet.getFileName()); assertEquals("<parent><data>1</data></parent>", savedSnippet.getContent()); assertEquals("Description", savedSnippet.getDescription()); deleteSnippet(savedSnippet); }

Target:
public void testRetrieveSnippet() throws GitLabApiException { Snippet snippet = createSnippet (new Snippet(TEST_SNIPPET_TITLE_1, TEST_SNIPPET_FILE_NAME_1, TEST_SNIPPET_CONTENT_1, Visibility.INTERNAL, TEST_SNIPPET_DESCRIPTION_1)); SnippetsApi api = gitLabApi.getSnippetApi(); Snippet savedSnippet = api.getSnippet(snippet.getId(), true); assertEquals(TEST_SNIPPET_TITLE_1, savedSnippet.getTitle()); assertEquals(TEST_SNIPPET_FILE_NAME_1, savedSnippet.getFileName()); assertEquals(TEST_SNIPPET_CONTENT_1, savedSnippet.getContent()); assertEquals(TEST_SNIPPET_DESCRIPTION_1, savedSnippet.getDescription()); deleteSnippet(savedSnippet); }
Source:
protected void executeQueryCommand() { List<Disk> allDisks = diskDao.getAllFromDisksIncludingSnapshotsByDiskId(getParameters().getId(), getUserID(), getParameters().isFiltered()); if (allDisks.size() == 1 ){ getQueryReturnValue().setReturnValue(allDisks.get(0)); return; } List<Disk> diskWithSnapshots = imagesHandler.fillSnapshotsToDiskImages(allDisks.stream() .map(DiskImage.class::cast) .collect(Collectors.toList())); getQueryReturnValue().setReturnValue(diskWithSnapshots.get(0)); }

Target:
protected void executeQueryCommand() { List<Disk> allDisks = diskDao.getAllFromDisksIncludingSnapshotsByDiskId(getParameters().getId(), getUserID(), getParameters().isFiltered()); if (allDisks.size() == 1){ getQueryReturnValue().setReturnValue(allDisks.get(0)); return; } List<Disk> diskWithSnapshots = (List<Disk>)imagesHandler.aggregateDiskImagesSnapshots(allDisks.stream() .map(DiskImage.class::cast) .collect(Collectors.toList())); getQueryReturnValue().setReturnValue(diskWithSnapshots.get(0)); }
Source:
public void onCreate() { if (existsLoggedUser()) { LoadCredentialsUseCase loadUserAndCredentialsUseCase =new AuthenticationFactory().getloadCredentialsUseCase(loginActivity); loadUserAndCredentialsUseCase.execute(new LoadCredentialsUseCase.Callback() { @Override public void onSuccess(Credentials credentials) { finishAndGo(DashboardActivity.class); } }); } else { loginActivity.runOnUiThread(new Runnable() { public void run() { addDemoButton(); } }); } }

Target:
public void onCreate() { if (existsLoggedUser()) { finishAndGo(DashboardActivity.class); } else { loginActivity.runOnUiThread(new Runnable() { public void run() { addDemoButton(); } }); } }
Source:
public void identifyUser(HttpServletRequest request, HttpServletResponse response) throws IOException, UserIdentityException { String sessionID = RequestUtils.getSessionId(request); if (StringUtils.isEmpty(sessionID)) { Error responseBody = new Error("user not authenticated"); logWarn(responseBody.getMessage()).log(); writeResponse(response, responseBody, SC_UNAUTHORIZED); return; } try { UserIdentity identity = getAuthorisationService().identifyUser(sessionID); logInfo("authenticated user identity confirmed") .sessionID(sessionID) .user(identity.getEmail()) .log(); writeResponse(response, identity, SC_OK); } catch (UserIdentityException e) { writeResponse(response, new Error(e.getMessage()), e.getResponseCode()); } }

Target:
public void identifyUser(HttpServletRequest request, HttpServletResponse response) throws IOException, UserIdentityException { if (StringUtils.isNotBlank(request.getHeader(AUTHORIZATION_HEADER))) { ServiceAccount serviceAccount = findService(request); if (serviceAccount != null) { if (request.getHeader(RequestUtils.TOKEN_HEADER) != null) { findUser(request, response); return; } else { writeResponse(response, new UserIdentity(serviceAccount.getId()), SC_OK); return; } } } writeResponse(response, new Error("service not authenticated"), SC_UNAUTHORIZED); }
Source:
private Set<RulerColumnPlacementConstraint> readIds(IConfigurationElement[] children) throws CoreException { Set<RulerColumnPlacementConstraint> constraints= new LinkedHashSet<>((int) (children.length / 0.75) + 1, 0.75f); for (IConfigurationElement child : children) { String name= child.getName(); ExtensionPointHelper childHelper= new ExtensionPointHelper(child); boolean before; switch (name) { case AFTER: before= false; break; case BEFORE: before= true; break; default: childHelper.fail(RulerColumnMessages.RulerColumnPlacement_illegal_child_msg); continue; } constraints.add(new RulerColumnPlacementConstraint(childHelper.getNonNullAttribute(ID), before)); } return Collections.unmodifiableSet(constraints); }

Target:
private Set<RulerColumnPlacementConstraint> readIds(IConfigurationElement[] children) throws CoreException { Set<RulerColumnPlacementConstraint> constraints= new LinkedHashSet<>((int) (children.length / 0.75) + 1, 0.75f); for (IConfigurationElement child : children) { String name= child.getName(); ExtensionPointHelper childHelper= new ExtensionPointHelper(child); if (name == null) { childHelper.fail(RulerColumnMessages.RulerColumnPlacement_illegal_child_msg); continue; } boolean before; switch (name) { case AFTER: before= false; break; case BEFORE: before= true; break; default: childHelper.fail(RulerColumnMessages.RulerColumnPlacement_illegal_child_msg); continue; } constraints.add(new RulerColumnPlacementConstraint(childHelper.getNonNullAttribute(ID), before)); } return Collections.unmodifiableSet(constraints); }
Source:
public Builder setChannelCount(int channelCount) { this.channelCount = channelCount; return this; }

Target:
public Builder setChannelCount(int channelCount) { Preconditions.checkArgument(channelCount > 0, "Channel count has to be at least 1."); this.channelCount = channelCount; return this; }
Source:
void viaQueueNameWithTopicNotAllowed() { assertThrows(IllegalArgumentException.class, () -> { final ServiceBusClientBuilder builder = new ServiceBusClientBuilder(); builder.connectionString(NAMESPACE_CONNECTION_STRING) .sender() .topicName(TOPIC_NAME) .viaQueueName(VIA_QUEUE_NAME) .buildAsyncClient(); }); }

Target:
void viaQueueNameWithTopicNotAllowed() { ServiceBusSenderClientBuilder builder = new ServiceBusClientBuilder() .connectionString(NAMESPACE_CONNECTION_STRING) .sender() .topicName(TOPIC_NAME) .viaQueueName(VIA_QUEUE_NAME); assertThrows(IllegalStateException.class, () -> builder.buildAsyncClient()); }
Source:
public void run() { long now = timeProvider.getTime(); if (logger.isTraceEnabled()) { logger.trace(hashCode() + " running at " + now); } List<Requester> dueRequesters = getDueRequesters(now); if (logger.isTraceEnabled()) { logger.trace(hashCode() + " has " + dueRequesters.size() + " due requesters"); } List<NACKPacket> nackPackets = createNackPackets(now, dueRequesters); if (logger.isTraceEnabled()) { logger.trace(hashCode() + " injecting " + nackPackets.size() + " nack packets"); } injectNackPackets(nackPackets); }

Target:
public void run() { long now = timeProvider.currentTimeMillis(); if (logger.isTraceEnabled()) { logger.trace(hashCode() + " running at " + now); } List<Requester> dueRequesters = getDueRequesters(now); if (logger.isTraceEnabled()) { logger.trace(hashCode() + " has " + dueRequesters.size() + " due requesters"); } if (!dueRequesters.isEmpty()) { List<NACKPacket> nackPackets = createNackPackets(now, dueRequesters); if (logger.isTraceEnabled()) { logger.trace(hashCode() + " injecting " + nackPackets.size() + " nack packets"); } if (!nackPackets.isEmpty()) { injectNackPackets(nackPackets); } } }