auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static <T> Iterable<T> loadService(Class<T> service, ClassLoader loader) { final Iterable<T> i = ServiceLoader.load(service, loader); return new Iterable<T>() { @Override public Iterator<T> iterator() { return new Iterator<T>() { Iterator<T> a = i.iterator(); T next; @Override public boolean hasNext() { while (a != null && a.hasNext()) { try { next = a.next(); if(next != null) { return true; } } catch (Exception e) { } } return next != null; } @Override public T next() { if(next != null) { T tmp = next; next = null; return tmp; } else if (!hasNext()) { throw new NoSuchElementException(); } else { T tmp = next; next = null; return tmp; } } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; }

Target:
public static <T> Iterable<T> loadService(Class<T> service, ClassLoader loader) { return ServiceLoader.load(service, loader); }
Source:
public IndexManager createIndexManagerByName(String indexManagerImplementationName) { if ( StringHelper.isEmpty( indexManagerImplementationName ) ) { return createDefaultIndexManager(); } else { indexManagerImplementationName = indexManagerImplementationName.trim(); IndexManager indexManager = fromAlias( indexManagerImplementationName ); if ( indexManager == null ) { indexManagerImplementationName = aliasToFQN( indexManagerImplementationName ); Class<?> indexManagerClass = classLoaderService.classForName( indexManagerImplementationName ); indexManager = ClassLoaderHelper.instanceFromClass( IndexManager.class, indexManagerClass, "index manager" ); } log.indexManagerAliasResolved( indexManagerImplementationName, indexManager.getClass() ); return indexManager; } }

Target:
public IndexManager createIndexManagerByName(String indexManagerImplementationName) { if ( StringHelper.isEmpty( indexManagerImplementationName ) ) { return createDefaultIndexManager(); } else { indexManagerImplementationName = indexManagerImplementationName.trim(); IndexManager indexManager = fromAlias( indexManagerImplementationName ); if ( indexManager == null ) { indexManagerImplementationName = aliasToFQN( indexManagerImplementationName ); Class<?> indexManagerClass = ClassLoaderHelper.classForName( indexManagerImplementationName, serviceManager ); indexManager = ClassLoaderHelper.instanceFromClass( IndexManager.class, indexManagerClass, "index manager" ); } log.indexManagerAliasResolved( indexManagerImplementationName, indexManager.getClass() ); return indexManager; } }
Source:
public static void setup() throws Exception { String methodName = "makeBucket(MakeBucketArgs args)"; long startTime = System.currentTimeMillis(); try { client.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build()); } catch (Exception e) { handleException(methodName, null, startTime, e); } }

Target:
public static void setup() throws Exception { long startTime = System.currentTimeMillis(); try { client.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build()); } catch (Exception e) { handleException("makeBucket(MakeBucketArgs args)", null, startTime, e); } }
Source:
private Set<Person> executeSoundexOnePersonNameQuery(String name, Integer birthyear, boolean includeVoided , String gender) { String matchMode = Context.getAdministrationService().getGlobalProperty(OpenmrsConstants.GLOBAL_PROPERTY_PATIENT_SEARCH_MATCH_MODE); Context.getAdministrationService().setGlobalProperty(OpenmrsConstants.GLOBAL_PROPERTY_PATIENT_SEARCH_MATCH_MODE, OpenmrsConstants.GLOBAL_PROPERTY_PATIENT_SEARCH_MATCH_SOUNDEX); PersonLuceneQuery personLuceneQuery = new PersonLuceneQuery(sessionFactory); String query = LuceneQuery.escapeQuery(name); int maxResults = HibernatePersonDAO.getMaximumSearchResults(); LinkedHashSet<Person> people = new LinkedHashSet<>(); LuceneQuery<PersonName> luceneQuery = personLuceneQuery.getSoundexPersonNameQuery(query, birthyear, false, gender);; ListPart<Object[]> names = luceneQuery.listPartProjection(0, maxResults, "person.personId"); names.getList().forEach(x-> people.add(getPerson((Integer) x[0]))); Context.getAdministrationService().setGlobalProperty(OpenmrsConstants.GLOBAL_PROPERTY_PATIENT_SEARCH_MATCH_MODE, matchMode); return people; }

Target:
private Set<Person> executeSoundexOnePersonNameQuery(String name, Integer birthyear, boolean includeVoided , String gender) { PersonLuceneQuery personLuceneQuery = new PersonLuceneQuery(sessionFactory); String query = LuceneQuery.escapeQuery(name); int maxResults = HibernatePersonDAO.getMaximumSearchResults(); LinkedHashSet<Person> people = new LinkedHashSet<>(); LuceneQuery<PersonName> luceneQuery = personLuceneQuery.getSoundexPersonNameQuery(query, birthyear, false, gender);; ListPart<Object[]> names = luceneQuery.listPartProjection(0, maxResults, "person.personId"); names.getList().forEach(x -> people.add(getPerson((Integer) x[0]))); return people; }
Source:
void lockOutputFiles() throws InterruptedException; boolean speculating(); Duration getTimeout(); FileOutErr getFileOutErr(); SortedMap<PathFragment, ActionInput> getInputMapping(boolean expandTreeArtifactsInRunfiles) throws IOException; void report(ProgressStatus state, String name); default MetadataInjector getMetadataInjector() { throw new UnsupportedOperationException(); }

Target:
void lockOutputFiles() throws InterruptedException; boolean speculating(); Duration getTimeout(); FileOutErr getFileOutErr(); SortedMap<PathFragment, ActionInput> getInputMapping(boolean expandTreeArtifactsInRunfiles) throws IOException; void report(ProgressStatus state, String name); MetadataInjector getMetadataInjector(); } default FutureSpawn execAsync(Spawn spawn, SpawnExecutionContext context) throws InterruptedException, IOException, ExecException { return FutureSpawn.immediate(exec(spawn, context)); }
Source:
@Test public void testSimplifyCoalesceWithConstant() { RexNode inputRef1 = rexBuilder.makeInputRef( typeFactory.createTypeWithNullability( typeFactory.createSqlType(SqlTypeName.VARCHAR), true), 0); RexNode inputRef2 = rexBuilder.makeInputRef( typeFactory.createTypeWithNullability( typeFactory.createSqlType(SqlTypeName.VARCHAR), true), 1); RexCall coalesceNode = (RexCall) coalesce(inputRef2, inputRef1); ImmutableList.Builder<RexNode> newOperands = ImmutableList.builder(); newOperands.add(rexBuilder.makeLiteral("S")).add(coalesceNode.operands.get(1)); coalesceNode = coalesceNode.clone(coalesceNode.getType(), newOperands.build()); RexNode result = simplify.simplify(coalesceNode); assertThat(result.getType().isNullable(), is(true)); assertThat(result.getType().getSqlTypeName(), is(SqlTypeName.VARCHAR)); }

Target:
@Test public void testSimplifyCoalesceWithConstant() { RexNode inputRef1 = rexBuilder.makeInputRef( typeFactory.createTypeWithNullability( typeFactory.createSqlType(SqlTypeName.VARCHAR), true), 0); RexNode inputRef2 = rexBuilder.makeInputRef( typeFactory.createTypeWithNullability( typeFactory.createSqlType(SqlTypeName.VARCHAR), true), 1); RexCall coalesceNode = (RexCall) coalesce(inputRef2, inputRef1); ImmutableList.Builder<RexNode> newOperands = ImmutableList.builder(); newOperands.add(rexBuilder.makeLiteral("S")).add(coalesceNode.operands.get(1)); coalesceNode = coalesceNode.clone(coalesceNode.getType(), newOperands.build()); RexNode result = simplify.simplify(coalesceNode); assertThat("simplify of " + coalesceNode + " is Nullable", result.getType().isNullable(), is(true)); assertThat("simplify of " + coalesceNode + " is VARCHAR type", result.getType().getSqlTypeName(), is(SqlTypeName.VARCHAR)); RexNode result1 = simplify.simplifyPreservingType(coalesceNode); assertThat("simplify of " + coalesceNode + " is Nullable", result1.getType().isNullable(), is(true)); assertThat("simplify of " + coalesceNode + " is VARCHAR type", result1.getType().getSqlTypeName(), is(SqlTypeName.VARCHAR)); }
Source:
ForwardedHeaderExtractingRequest(HttpServletRequest request, UrlPathHelper pathHelper) { super(request); HttpRequest httpRequest = new ServletServerHttpRequest(request); UriComponents uriComponents = UriComponentsBuilder.fromHttpRequest(httpRequest).build(); int port = uriComponents.getPort(); this.scheme = uriComponents.getScheme(); this.secure = "https".equals(this.scheme); this.host = uriComponents.getHost(); this.port = (port == -1 ? (this.secure ? 443 : 80) : port); UriComponents remoteUriComponents = UriComponentsBuilder.newInstance() .host(request.getRemoteHost()) .port(request.getRemotePort()) .adaptFromForwardedForHeader(httpRequest.getHeaders()) .build(); this.remoteHost = remoteUriComponents.getHost(); this.remoteAddr = ((this.remoteHost != null && !this.remoteHost.equals(request.getRemoteHost())) ? this.remoteHost : request.getRemoteAddr()); this.remotePort = remoteUriComponents.getPort(); String baseUrl = this.scheme + "://" + this.host + (port == -1 ? "" : ":" + port); Supplier<HttpServletRequest> delegateRequest = () -> (HttpServletRequest) getRequest(); this.forwardedPrefixExtractor = new ForwardedPrefixExtractor(delegateRequest, pathHelper, baseUrl); }

Target:
ForwardedHeaderExtractingRequest(HttpServletRequest request, UrlPathHelper pathHelper) { super(request); HttpRequest httpRequest = new ServletServerHttpRequest(request); UriComponents uriComponents = UriComponentsBuilder.fromHttpRequest(httpRequest).build(); int port = uriComponents.getPort(); this.scheme = uriComponents.getScheme(); this.secure = "https".equals(this.scheme); this.host = uriComponents.getHost(); this.port = (port == -1 ? (this.secure ? 443 : 80) : port); HttpHeaders headers = httpRequest.getHeaders(); boolean hasForwardedFor = StringUtils.hasText(headers.getFirst(X_FORWARDED_FOR_HEADER)) || (StringUtils.hasText(headers.getFirst(FORWARDED_HEADER)) && FORWARDED_FOR_PATTERN.matcher(headers.getFirst(FORWARDED_HEADER)).matches()); if (hasForwardedFor) { UriComponents remoteUriComponents = UriComponentsBuilder.newInstance() .host(request.getRemoteHost()) .port(request.getRemotePort()) .adaptFromForwardedForHeader(headers) .build(); this.remoteHost = remoteUriComponents.getHost(); this.remoteAddr = this.remoteHost; this.remotePort = remoteUriComponents.getPort(); } else { this.remoteHost = request.getRemoteHost(); this.remoteAddr = request.getRemoteAddr(); this.remotePort = request.getRemotePort(); } String baseUrl = this.scheme + "://" + this.host + (port == -1 ? "" : ":" + port); Supplier<HttpServletRequest> delegateRequest = () -> (HttpServletRequest) getRequest(); this.forwardedPrefixExtractor = new ForwardedPrefixExtractor(delegateRequest, pathHelper, baseUrl); }
Source:
private Map<String, EnvVar> jnlpEnvVars(String workingDir) { if (workingDir == null) { workingDir = ContainerTemplate.DEFAULT_WORKING_DIR; } HashMap<String, String> env = new HashMap<>(); if (slave != null) { SlaveComputer computer = slave.getComputer(); if (computer != null) { env.put("JENKINS_SECRET", computer.getJnlpMac()); env.put("JENKINS_NAME", computer.getName()); env.put("JENKINS_AGENT_NAME", computer.getName()); } else { LOGGER.log(Level.INFO, "Computer is null for agent: {0}", slave.getNodeName()); } env.put("JENKINS_AGENT_WORKDIR", workingDir); KubernetesCloud cloud = slave.getKubernetesCloud(); if (!StringUtils.isBlank(cloud.getJenkinsTunnel())) { env.put("JENKINS_TUNNEL", cloud.getJenkinsTunnel()); } if (!cloud.isDirectConnection()) { env.put("JENKINS_URL", cloud.getJenkinsUrlOrDie()); } else { Jenkins jenkins = Jenkins.getInstanceOrNull(); if(jenkins == null) throw new IllegalStateException("Jenkins instance null"); String host; try { host = new URL(jenkins.getRootUrl()).getHost(); } catch (MalformedURLException e) { throw new IllegalStateException("Could not get Jenkins host name", e); } int port = jenkins.getTcpSlaveAgentListener().getPort(); env.put("JENKINS_DIRECT_CONNECTION", host + ":" + port); env.put("JENKINS_PROTOCOLS", "JNLP4-connect"); env.put("JENKINS_INSTANCE_IDENTITY", jenkins.getTcpSlaveAgentListener().getIdentityPublicKey()); } } Map<String, EnvVar> envVarsMap = new HashMap<>(); env.entrySet().forEach(item -> envVarsMap.put(item.getKey(), new EnvVar(item.getKey(), item.getValue(), null)) ); return envVarsMap; }

Target:
private Map<String, EnvVar> jnlpEnvVars(String workingDir) { if (workingDir == null) { workingDir = ContainerTemplate.DEFAULT_WORKING_DIR; } HashMap<String, String> env = new HashMap<>(); if (slave != null) { SlaveComputer computer = slave.getComputer(); if (computer != null) { env.put("JENKINS_SECRET", computer.getJnlpMac()); env.put("JENKINS_NAME", computer.getName()); env.put("JENKINS_AGENT_NAME", computer.getName()); } else { LOGGER.log(Level.INFO, "Computer is null for agent: {0}", slave.getNodeName()); } env.put("JENKINS_AGENT_WORKDIR", workingDir); KubernetesCloud cloud = slave.getKubernetesCloud(); if (!StringUtils.isBlank(cloud.getJenkinsTunnel())) { env.put("JENKINS_TUNNEL", cloud.getJenkinsTunnel()); } if (!cloud.isDirectConnection()) { env.put("JENKINS_URL", cloud.getJenkinsUrlOrDie()); } else { String host = getAdvertisedHost(); int port = Jenkins.get().getTcpSlaveAgentListener().getAdvertisedPort(); env.put("JENKINS_DIRECT_CONNECTION", host + ":" + port); env.put("JENKINS_PROTOCOLS", "JNLP4-connect"); env.put("JENKINS_INSTANCE_IDENTITY", Jenkins.get().getTcpSlaveAgentListener().getIdentityPublicKey()); } } Map<String, EnvVar> envVarsMap = new HashMap<>(); env.entrySet().forEach(item -> envVarsMap.put(item.getKey(), new EnvVar(item.getKey(), item.getValue(), null)) ); return envVarsMap; }
Source:
private static SortAlgorithm getSortAlgorithm(QueryContext context, SortSpec[] sortSpecs) { if (Arrays.stream(sortSpecs) .filter(sortSpec -> !RadixSort.isApplicableType(sortSpec)).count() > 0) { return SortAlgorithm.TIM_SORT; } String sortAlgorithm = context.get(SessionVars.SORT_ALGORITHM, "TIM"); if (sortAlgorithm.equalsIgnoreCase("TIM")) { return SortAlgorithm.TIM_SORT; } else if (sortAlgorithm.equalsIgnoreCase("MSD_RADIX")) { return SortAlgorithm.MSD_RADIX_SORT; } else { throw new TajoRuntimeException(new UnsupportedException(sortAlgorithm)); } }

Target:
private static SortAlgorithm getSortAlgorithm(QueryContext context, SortSpec[] sortSpecs) { String sortAlgorithm = context.get(SessionVars.SORT_ALGORITHM, SortAlgorithm.TIM.name()); if (Arrays.stream(sortSpecs) .filter(sortSpec -> !RadixSort.isApplicableType(sortSpec)).count() > 0) { if (sortAlgorithm.equalsIgnoreCase(SortAlgorithm.MSD_RADIX.name())) { LOG.warn("Non-applicable types exist. Falling back to " + SortAlgorithm.TIM.name() + " sort"); } return SortAlgorithm.TIM; } if (sortAlgorithm.equalsIgnoreCase(SortAlgorithm.TIM.name())) { return SortAlgorithm.TIM; } else if (sortAlgorithm.equalsIgnoreCase(SortAlgorithm.MSD_RADIX.name())) { return SortAlgorithm.MSD_RADIX; } else { LOG.warn("Unknown sort type: " + sortAlgorithm); LOG.warn("Falling back to " + SortAlgorithm.TIM.name() + " sort"); return SortAlgorithm.TIM; } }
Source:
public void run() { List<AttestationValue> values; if (trustedHostsNames.size() > FIRST_STAGE_QUERY_SIZE) { values = AttestationService.getInstance().attestHosts(trustedHostsNames.subList(0, FIRST_STAGE_QUERY_SIZE)); handleValues(values); for (int i = FIRST_STAGE_QUERY_SIZE; i < trustedHostsNames.size(); i+= SECOND_STAGE_QUERY_SIZE) { values = AttestationService.getInstance() .attestHosts(trustedHostsNames.subList(i, i + SECOND_STAGE_QUERY_SIZE)); handleValues(values); } } else { values = AttestationService.getInstance().attestHosts(trustedHostsNames); handleValues(values); } }

Target:
public void run() { List<AttestationValue> values; if (trustedHostsNames.size() > FIRST_STAGE_QUERY_SIZE) { values = AttestationService.getInstance().attestHosts(trustedHostsNames.subList(0, FIRST_STAGE_QUERY_SIZE)); handleValues(values); for (int from = FIRST_STAGE_QUERY_SIZE; from < trustedHostsNames.size(); from+= SECOND_STAGE_QUERY_SIZE) { int to = (from + SECOND_STAGE_QUERY_SIZE < trustedHostsNames.size()) ? from + SECOND_STAGE_QUERY_SIZE : trustedHostsNames.size(); values = AttestationService.getInstance(). attestHosts(trustedHostsNames.subList(from, to)); handleValues(values); } } else { values = AttestationService.getInstance().attestHosts(trustedHostsNames); handleValues(values); } }
Source:
private static void handleIfStatement(IfStatement ifStmt, SubscriptionContext ctx) { if (ifStmt.elseBranch() == null) { return; } StatementList body = ifStmt.body(); for (IfStatement elifBranch : ifStmt.elifBranches()) { StatementList elifBody = elifBranch.body(); if (!CheckUtils.areEquivalent(body, elifBody)) { return; } } if (!CheckUtils.areEquivalent(body, ifStmt.elseBranch().body())) { return; } PreciseIssue issue = ctx.addIssue(ifStmt.keyword(), "Remove this if statement or edit its code blocks so that they're not all the same."); List<Token> ifBodyTokens = TreeUtils.nonWhitespaceTokens(ifStmt.body()); issue.secondary(IssueLocation.preciseLocation(ifBodyTokens.get(0), ifBodyTokens.get(ifBodyTokens.size() - 1), null)); ifStmt.elifBranches().forEach(e -> { List<Token> elifBodyTokens = TreeUtils.nonWhitespaceTokens(e.body()); issue.secondary(IssueLocation.preciseLocation(elifBodyTokens.get(0), elifBodyTokens.get(ifBodyTokens.size() - 1), null)); }); List<Token> elseBodyTokens = TreeUtils.nonWhitespaceTokens(ifStmt.elseBranch().body()); issue.secondary(IssueLocation.preciseLocation(elseBodyTokens.get(0), elseBodyTokens.get(ifBodyTokens.size() - 1), null)); }

Target:
private static void handleIfStatement(IfStatement ifStmt, SubscriptionContext ctx) { if (ifStmt.elseBranch() == null) { return; } StatementList body = ifStmt.body(); for (IfStatement elifBranch : ifStmt.elifBranches()) { StatementList elifBody = elifBranch.body(); if (!CheckUtils.areEquivalent(body, elifBody)) { return; } } if (!CheckUtils.areEquivalent(body, ifStmt.elseBranch().body())) { return; } PreciseIssue issue = ctx.addIssue(ifStmt.keyword(), "Remove this if statement or edit its code blocks so that they're not all the same."); issue.secondary(issueLocation(ifStmt.body())); ifStmt.elifBranches().forEach(e -> issue.secondary(issueLocation(e.body()))); issue.secondary(issueLocation(ifStmt.elseBranch().body())); }
Source:
public Repository openRepository(Project.NameKey name) throws RepositoryNotFoundException { if (isUnreasonableName(name)) { throw new RepositoryNotFoundException("Invalid name: " + name); } if (!names.contains(name)) { File f = new File(basePath, name.get().endsWith( Constants.DOT_GIT_EXT) ? name.get() : name.get() + Constants.DOT_GIT_EXT); if (FileKey.isGitRepository(f, FS.DETECTED)) { onCreateProject(name); } else { throw new RepositoryNotFoundException(gitDirOf(name)); } } final FileKey loc = FileKey.lenient(gitDirOf(name), FS.DETECTED); try { return RepositoryCache.open(loc); } catch (IOException e1) { final RepositoryNotFoundException e2; e2 = new RepositoryNotFoundException("Cannot open repository " + name); e2.initCause(e1); throw e2; } }

Target:
public Repository openRepository(Project.NameKey name) throws RepositoryNotFoundException { if (isUnreasonableName(name)) { throw new RepositoryNotFoundException("Invalid name: " + name); } if (!names.contains(name)) { if (FileKey.resolve(gitDirOf(name), FS.DETECTED) != null) { onCreateProject(name); } else { throw new RepositoryNotFoundException(gitDirOf(name)); } } final FileKey loc = FileKey.lenient(gitDirOf(name), FS.DETECTED); try { return RepositoryCache.open(loc); } catch (IOException e1) { final RepositoryNotFoundException e2; e2 = new RepositoryNotFoundException("Cannot open repository " + name); e2.initCause(e1); throw e2; } }
Source:
default void setExitMessage(@Nullable Text message) { setExitMessage(message, null); }

Target:
default void setExitMessage(@Nullable Text message) { setExitMessage(message, ChatTypes.CHAT); }
Source:
public static void main(String[] args) throws RunnerException { String benchmarkName = CorfuTableBenchmark.class.getSimpleName(); Options opt = new OptionsBuilder() .include(benchmarkName) .mode(Mode.Throughput) .timeUnit(TimeUnit.SECONDS) .warmupIterations(1) .warmupTime(TimeValue.seconds(3)) .measurementIterations(3) .measurementTime(TimeValue.seconds(10)) .threads(1) .forks(1) .param(DATA_SIZE_FIELD, DATA_SIZE) .param(TABLE_SIZE_FIELD, TABLE_SIZE) .param(IN_MEM_TABLE_SIZE_FIELD, SMALL_TABLE_SIZE) .shouldFailOnError(true) .jvmArgsAppend("-Xms8g", "-Xmx8g") .resultFormat(ResultFormatType.CSV) .result("target/" + benchmarkName + ".csv") .build(); new Runner(opt).run(); }

Target:
public static void main(String[] args) throws RunnerException { String benchmarkName = CorfuTableBenchmark.class.getSimpleName(); int warmUpIterations = 1; TimeValue warmUpTime = TimeValue.seconds(3); int measurementIterations = 3; TimeValue measurementTime = TimeValue.seconds(10); int threads = 1; int forks = 1; Options opt = new OptionsBuilder() .include(benchmarkName) .mode(Mode.Throughput) .timeUnit(TimeUnit.SECONDS) .warmupIterations(warmUpIterations) .warmupTime(warmUpTime) .measurementIterations(measurementIterations) .measurementTime(measurementTime) .threads(threads) .forks(forks) .param(DATA_SIZE_FIELD, DATA_SIZE) .param(TABLE_SIZE_FIELD, TABLE_SIZE) .param(IN_MEM_TABLE_SIZE_FIELD, SMALL_TABLE_SIZE) .shouldFailOnError(true) .jvmArgsAppend("-Xms4g", "-Xmx4g") .resultFormat(ResultFormatType.CSV) .result("target/" + benchmarkName + ".csv") .build(); new Runner(opt).run(); }
Source:
public void testThumbLargeRouteForceNoFileExists() throws Exception { createContext(largeThumbRoute); getMockEndpoint("mock:exec:/bin/sh").expectedMessageCount(1); Map<String, Object> headers = createEvent(fileID, eventTypes, "true"); template.sendBodyAndHeaders("", headers); doThrow(Exception.class).when(addLargeThumbnailProcessor).process(any(Exchange.class)); verify(addLargeThumbnailProcessor).process(any(Exchange.class)); assertMockEndpointsSatisfied(); }

Target:
public void testThumbLargeRouteForceNoFileExists() throws Exception { createContext(largeThumbRoute); getMockEndpoint("mock:exec:/bin/sh").expectedMessageCount(1); Map<String, Object> headers = createEvent(fileID, eventTypes, "true"); template.sendBodyAndHeaders("", headers); doNothing().when(addLargeThumbnailProcessor).process(any(Exchange.class)); verify(addLargeThumbnailProcessor).process(any(Exchange.class)); assertMockEndpointsSatisfied(); }
Source:
protected NetworkOperationCommandTarget getTarget() { return new NetworkOperationCommandTarget() { @Override protected void executeNetworkCommand(NetworkItemModel<?> op1, NetworkItemModel<?> op2, DataFromHostSetupNetworksModel dataFromHostSetupNetworksModel, Object... params) { assert op1 instanceof NetworkInterfaceModel; assert op2 == null; NetworkInterfaceModel nicModel = (NetworkInterfaceModel) op1; VdsNetworkInterface slaveNic = nicModel.getIface(); slaveNic.setBondName(null); BondNetworkInterfaceModel bondModel = nicModel.getBond(); Bond bond = bondModel.getIface(); if (bondModel.getBonded().size() == 2) { BREAK_BOND.getCommand(bondModel, null, dataFromHostSetupNetworksModel).execute(); } else { bond.getSlaves().remove(nicModel.getName()); String bondName = bond.getName(); Map<String, Bond> bondsMap = Entities.entitiesByName(dataFromHostSetupNetworksModel.newOrModifiedBonds); boolean bondWasAlreadyUpdated = bondsMap.containsKey(bondName); if (!bondWasAlreadyUpdated) { addBondToParams(dataFromHostSetupNetworksModel, bond); } } } }; }

Target:
protected NetworkOperationCommandTarget getTarget() { return new NetworkOperationCommandTarget() { @Override protected void executeNetworkCommand(NetworkItemModel<?> op1, NetworkItemModel<?> op2, DataFromHostSetupNetworksModel dataFromHostSetupNetworksModel, Object... params) { assert op1 instanceof BondNetworkInterfaceModel; assert op2 == null; BondNetworkInterfaceModel bondModel = (BondNetworkInterfaceModel) op1; dataFromHostSetupNetworksModel .removeBondFromParameters(bondModel.getCreateOrUpdateBond()); detachAllNetworks(bondModel, dataFromHostSetupNetworksModel); detachAllLabels(bondModel, dataFromHostSetupNetworksModel); } }; }
Source:
private boolean producerOfCorrectType(EventEnvelope event) { EventContext context = event.getEventContext(); Any anyId = context.getProducerId(); boolean idTypeMatches = anyId.is(EntityHistoryId.class); if (!idTypeMatches) { _warn("Event %s is produced by an entity with ID %s.", event.getMessageClass(), unpack(anyId)); return false; } else { EntityHistoryId producerId = unpack(anyId); String typeUrlRaw = producerId.getTypeUrl(); TypeUrl typeUrl = TypeUrl.parse(typeUrlRaw); return typeUrl.equals(targetType); } }

Target:
private boolean producerOfCorrectType(EventEnvelope event) { EventContext context = event.getEventContext(); Any anyId = context.getProducerId(); Object producerId = Identifier.unpack(anyId); EntityHistoryId historyId = (EntityHistoryId) producerId; String typeUrlRaw = historyId.getTypeUrl(); return typeUrlRaw.equals(targetType.value()); }
Source:
public final void onError(final SocketSession erroredSession, final Throwable cause) { if (cause instanceof java.io.EOFException || cause instanceof java.net.SocketTimeoutException) { reachedEof = true; LOG.info("This websocket timed out!"); } if (erroredSession == null) { LOG.error("Socket: Error: {}", this.getClass().getSimpleName(), cause); if (cause instanceof java.net.ConnectException) { if (cause.getMessage().trim().equalsIgnoreCase("Connection refused")) { refusedConnection = true; LOG.error("Connection was refused"); } LOG.error("Connection had issues!"); } } else { LOG.error("Socket: {}Session Error: {}", this.getClass().getSimpleName(), cause); } }

Target:
public final void onError(final SocketSession erroredSession, final Throwable cause) { if (cause instanceof java.io.EOFException || cause instanceof java.net.SocketTimeoutException) { reachedEof = true; LOG.info("This websocket timed out!"); } if (erroredSession == null) { LOG.error("Socket threw an error, Socket: Error: {}", this.getClass().getSimpleName(), cause); if (cause instanceof java.net.ConnectException) { if (cause.getMessage().trim().equalsIgnoreCase("Connection refused")) { refusedConnection = true; LOG.error("Connection was refused"); } LOG.error("Connection had issues!"); } } else { LOG.error("Socket: {}Session Error: {}", this.getClass().getSimpleName(), cause); } }
Source:
protected void sendAndReceive( HttpMessage message, boolean isFollowRedirect, boolean handleAntiCSRF) throws IOException { if (parent.handleAntiCsrfTokens() && handleAntiCSRF) { if (extAntiCSRF == null) { extAntiCSRF = Control.getSingleton() .getExtensionLoader() .getExtension(ExtensionAntiCSRF.class); } if (extAntiCSRF != null) { if (!isRegenCsrfCalled) { isRegenCsrfCalled = true; extAntiCSRF.regenerateAntiCsrfToken(message, this::sendAndReceive); } isRegenCsrfCalled = false; } } if (this.parent.getScannerParam().isInjectPluginIdInHeader()) { this.msg .getRequestHeader() .setHeader(HttpHeader.X_ZAP_SCAN_ID, Integer.toString(getId())); } message.getRequestHeader().setHeader(HttpHeader.IF_MODIFIED_SINCE, null); message.getRequestHeader().setHeader(HttpHeader.IF_NONE_MATCH, null); message.getRequestHeader().setContentLength(message.getRequestBody().length()); if (this.getDelayInMs() > 0) { try { Thread.sleep(this.getDelayInMs()); } catch (InterruptedException e) { } } parent.performScannerHookBeforeScan(message, this); if (isFollowRedirect) { parent.getHttpSender().sendAndReceive(message, getParent().getRedirectRequestConfig()); } else { parent.getHttpSender().sendAndReceive(message, false); } parent.notifyNewMessage(this, message); parent.performScannerHookAfterScan(message, this); }

Target:
protected void sendAndReceive( HttpMessage message, boolean isFollowRedirect, boolean handleAntiCSRF) throws IOException { if (parent.handleAntiCsrfTokens() && handleAntiCSRF) { if (extAntiCSRF == null) { extAntiCSRF = Control.getSingleton() .getExtensionLoader() .getExtension(ExtensionAntiCSRF.class); } if (extAntiCSRF != null) { extAntiCSRF.regenerateAntiCsrfToken( message, tokenMsg -> sendAndReceive(tokenMsg, true, false)); } } if (this.parent.getScannerParam().isInjectPluginIdInHeader()) { this.msg .getRequestHeader() .setHeader(HttpHeader.X_ZAP_SCAN_ID, Integer.toString(getId())); } message.getRequestHeader().setHeader(HttpHeader.IF_MODIFIED_SINCE, null); message.getRequestHeader().setHeader(HttpHeader.IF_NONE_MATCH, null); message.getRequestHeader().setContentLength(message.getRequestBody().length()); if (this.getDelayInMs() > 0) { try { Thread.sleep(this.getDelayInMs()); } catch (InterruptedException e) { } } parent.performScannerHookBeforeScan(message, this); if (isFollowRedirect) { parent.getHttpSender().sendAndReceive(message, getParent().getRedirectRequestConfig()); } else { parent.getHttpSender().sendAndReceive(message, false); } parent.notifyNewMessage(this, message); parent.performScannerHookAfterScan(message, this); }
Source:
public void encodeLink(String link, HierarchicalStreamWriter writer) { String path = request.getRequestURI(); if (path.contains("script")) { try { link = URLDecoder.decode(link, "UTF-8"); writer.startNode("href"); writer.setValue(hrefNoExt(link)); writer.endNode(); } catch (UnsupportedEncodingException e) { } } else { writer.startNode("href"); writer.setValue(href(link)); writer.endNode(); } }

Target:
public void encodeLink(String link, HierarchicalStreamWriter writer) { if (checkPath(request)) { try { link = URLDecoder.decode(link, "UTF-8"); writer.startNode("href"); writer.setValue(hrefNoExt(link)); writer.endNode(); } catch (UnsupportedEncodingException e) { throw new RestException(e.getMessage().toString(), HttpStatus.INTERNAL_SERVER_ERROR); } } else { writer.startNode("href"); writer.setValue(href(link)); writer.endNode(); } }
Source:
public void verifySourceEditorContentIsEmpty(){ waitForElementByElement(sourceModeTextArea); Assert.assertEquals(sourceModeTextArea.getText().isEmpty(), true); PageObjectLogging.log("verifySourceEditorContentIsEmpty", "Source editor content was cleaned", true); }

Target:
public void verifySourceEditorContentIsEmpty(){ waitForElementByElement(sourceModeTextArea); Assertion.assertEquals(sourceModeTextArea.getText().isEmpty(), true); PageObjectLogging.log("verifySourceEditorContentIsEmpty", "Source editor content was cleaned", true); }
Source:
public void afterPropertiesSet() throws Exception { this.initialized = true; }

Target:
public void afterPropertiesSet() throws Exception { this.initialized = true; if (this.cacheMode == CacheMode.CHANNEL) { Assert.isTrue(this.connectionCacheSize == 1, "When the cache mode is 'CHANNEL', the connection cache size cannot be configured."); } }
Source:
private void compareMaxInactiveIntervals() { cluster.getVM(1).invoke(() -> { for (int j = 0; j < 113; j++) { InternalCache cache = ClusterStartupRule.getCache(); PartitionedRegion region = (PartitionedRegion) cache.getRegion("__REDIS_DATA"); List<BucketDump> buckets = region.getAllBucketEntries(j); if (buckets.isEmpty()) { continue; } assertThat(buckets.size()).isEqualTo(2); Map<Object, Object> bucket1 = buckets.get(0).getValues(); Map<Object, Object> bucket2 = buckets.get(1).getValues(); bucket1.keySet().forEach(key -> { if (bucket1.get(key) instanceof RedisHash) { RedisHash value1 = (RedisHash) bucket1.get(key); RedisHash value2 = (RedisHash) bucket2.get(key); assertThat(getIntFromBytes(value1)).isEqualTo(getIntFromBytes(value2)); } }); } }); }

Target:
private void compareMaxInactiveIntervals() { cluster.getVM(1).invoke(() -> { InternalCache cache = ClusterStartupRule.getCache(); PartitionedRegion region = (PartitionedRegion) cache.getRegion("__REDIS_DATA"); for (int j = 0; j < region.getTotalNumberOfBuckets(); j++) { List<BucketDump> buckets = region.getAllBucketEntries(j); if (buckets.isEmpty()) { continue; } assertThat(buckets.size()).isEqualTo(2); Map<Object, Object> bucket1 = buckets.get(0).getValues(); Map<Object, Object> bucket2 = buckets.get(1).getValues(); bucket1.keySet().forEach(key -> { if (bucket1.get(key) instanceof RedisHash) { RedisHash value1 = (RedisHash) bucket1.get(key); RedisHash value2 = (RedisHash) bucket2.get(key); assertThat(getIntFromBytes(value1)).isEqualTo(getIntFromBytes(value2)); } }); } }); }
Source:
public void execute(Context context) throws SQLException { context.execute(new AlterColumnsBuilder(getDialect(), TABLE_WEBHOOK_DELIVERIES) .updateColumn(VarcharColumnDef.newVarcharColumnDefBuilder() .setColumnName("ce_task_uuid") .setLimit(40) .setIsNullable(true) .build()) .build()); context.execute(new AlterColumnsBuilder(getDialect(), TABLE_WEBHOOK_DELIVERIES) .updateColumn(VarcharColumnDef.newVarcharColumnDefBuilder() .setColumnName("analysis_uuid") .setLimit(40) .setIsNullable(false) .build()) .build()); }

Target:
public void execute(Context context) throws SQLException { context.execute(new AlterColumnsBuilder(getDialect(), TABLE_WEBHOOK_DELIVERIES) .updateColumn(VarcharColumnDef.newVarcharColumnDefBuilder() .setColumnName("ce_task_uuid") .setLimit(40) .setIsNullable(true) .build()) .build()); }
Source:
public void preparePreselectedViews() { preselectedViews = new ArrayList<>(); List<Pair<MediaUnit, IncludedStructuralElement>> selectedMedia = dataEditor.getSelectedMedia(); for (Pair<MediaUnit, IncludedStructuralElement> pair : selectedMedia) { for (View view : pair.getValue().getViews()) { if (Objects.equals(view.getMediaUnit(), pair.getKey())) { preselectedViews.add(view); } } } preselectedViews = preselectedViews.stream().sorted(Comparator.comparingInt(v -> v.getMediaUnit().getOrder())) .collect(Collectors.toList()); }

Target:
public void preparePreselectedViews() { preselectedViews = new ArrayList<>(); List<Pair<MediaUnit, IncludedStructuralElement>> selectedMedia = dataEditor.getSelectedMedia(); for (Pair<MediaUnit, IncludedStructuralElement> pair : selectedMedia) { for (View view : pair.getValue().getViews()) { if (Objects.equals(view.getMediaUnit(), pair.getKey())) { preselectedViews.add(view); } } } preselectedViews.sort(Comparator.comparingInt(v -> v.getMediaUnit().getOrder())); }
Source:
private void updateRecords(String query) { if (searcher != null) { searcher.cancel(true); } if (query.length() == 0) { if (prefs.getBoolean("history-hide", false)) { searcher = new NullSearcher(this); ((LinearLayout)findViewById(R.id.main_empty)).setVisibility(View.INVISIBLE); } else { searcher = new HistorySearcher(this); ((LinearLayout)findViewById(R.id.main_empty)).setVisibility(View.VISIBLE); } } else { searcher = new QuerySearcher(this, query); } searcher.execute(); }

Target:
private void updateRecords(String query) { if (searcher != null) { searcher.cancel(true); } if (query.length() == 0) { if (prefs.getBoolean("history-hide", false)) { searcher = new NullSearcher(this); findViewById(R.id.main_empty).setVisibility(View.INVISIBLE); } else { searcher = new HistorySearcher(this); findViewById(R.id.main_empty).setVisibility(View.VISIBLE); } } else { searcher = new QuerySearcher(this, query); } searcher.execute(); }
Source:
public void testMechanism() { DocumentModel folder = session.createDocumentModel("/", "folder", "Folder"); DocumentModel file1 = session.createDocumentModel("/folder", "file1", "File"); DocumentModel file2 = session.createDocumentModel("/folder", "file2", "File"); folder = session.createDocument(folder); file1 = session.createDocument(file1); file2 = session.createDocument(file2); session.save(); TrashService trashService = Framework.getService(TrashService.class); trashService.trashDocument(file1); txFeature.nextTransaction(); file1 = session.getDocument(file1.getRef()); assertTrue(session.isTrashed(file1.getRef())); Boolean isTrashed = session.getDocumentSystemProp(file1.getRef(), SYSPROP_IS_TRASHED, Boolean.class); assertTrue(isTrashed != null && isTrashed.booleanValue()); assertTrue(trashService.isMangledName(file1.getName())); trashService.trashDocument(folder); txFeature.nextTransaction(); folder = session.getDocument(folder.getRef()); file1 = session.getDocument(file1.getRef()); file2 = session.getDocument(file2.getRef()); assertTrue(session.isTrashed(folder.getRef())); assertTrue(session.isTrashed(file1.getRef())); assertTrue(session.isTrashed(file2.getRef())); assertTrue(trashService.isMangledName(folder.getName())); assertFalse(trashService.isMangledName(file2.getName())); trashService.untrashDocument(folder); txFeature.nextTransaction(); folder = session.getDocument(folder.getRef()); file1 = session.getDocument(file1.getRef()); file2 = session.getDocument(file2.getRef()); assertFalse(session.isTrashed(folder.getRef())); assertFalse(session.isTrashed(file1.getRef())); assertFalse(session.isTrashed(file2.getRef())); assertFalse(trashService.isMangledName(folder.getName())); assertFalse(trashService.isMangledName(file1.getName())); assertFalse(trashService.isMangledName(file2.getName())); }

Target:
public void testMechanism() { DocumentModel doc = session.createDocumentModel("/", "file001", "File"); doc = session.createDocument(doc); session.save(); session.followTransition(doc, LifeCycleConstants.DELETE_TRANSITION); coreFeature.waitForAsyncCompletion(); assertTrue(session.isTrashed(doc.getRef())); Boolean isTrashed = session.getDocumentSystemProp(doc.getRef(), SYSPROP_IS_TRASHED, Boolean.class); assertTrue(isTrashed != null && isTrashed.booleanValue()); }
Source:
public double availability() { LeaseImpl lease = leaseManager.getLease(); return lease.isValid() ? lease.getAllowedRequests() / (double) lease.getStartingAllowedRequests() : 0.0; }

Target:
public double availability() { LeaseImpl lease = leaseManager.getLease(); double leaseAvailability = lease.isValid() ? lease.getAllowedRequests() / (double) lease.getStartingAllowedRequests() : 0.0; return Math.min(leaseAvailability, super.availability()); }
Source:
public void waitForInitialRemoteData() { SyncCredentials credentials = SyncCredentials.usernamePassword(UUID.randomUUID().toString(), "password", true); SyncUser user = SyncUser.login(credentials, Constants.AUTH_URL); SyncConfiguration config = new SyncConfiguration.Builder(user, Constants.USER_REALM) .waitForInitialRemoteData() .build(); Realm realm = null; try { realm = Realm.getInstance(config); assertTrue(realm.isEmpty()); } finally { if (realm != null) { realm.close(); } } }

Target:
public void waitForInitialRemoteData() { String username = UUID.randomUUID().toString(); String password = "password"; SyncUser user = SyncUser.login(SyncCredentials.usernamePassword(username, password, true), Constants.AUTH_URL); final SyncConfiguration configOld = configurationFactory.createSyncConfigurationBuilder(user, Constants.USER_REALM) .schema(StringOnly.class) .build(); Realm realm = Realm.getInstance(configOld); realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { for (int i = 0; i < 10; i++) { realm.createObject(StringOnly.class).setChars("Foo" + i); } } }); SystemClock.sleep(TimeUnit.SECONDS.toMillis(10)); realm.close(); user.logout(); Realm.deleteRealm(configOld); user = SyncUser.login(SyncCredentials.usernamePassword(username, password), Constants.AUTH_URL); SyncConfiguration config = new SyncConfiguration.Builder(user, Constants.USER_REALM) .schema(StringOnly.class) .waitForInitialRemoteData() .build(); realm = Realm.getInstance(config); realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { for (int i = 0; i < 10; i++) { realm.createObject(StringOnly.class).setChars("Foo 1" + i); } } }); try { assertEquals(20, realm.where(StringOnly.class).count()); } finally { realm.close(); } }
Source:
protected final void put( ReuseBag bag, final long dataId, final long dataPage, final long dataAddr, int bucket) throws IgniteCheckedException { assert bag == null ^ dataAddr == 0L; for (int lockAttempt = 0; ;) { Stripe stripe = getPageForPut(bucket, bag); final long tailId = stripe.tailId; final long tailPage = acquirePage(tailId); try { long tailAddr = writeLockPage(tailId, tailPage, bucket, lockAttempt++, bag); if (bag != null && bag.isEmpty()) { if (tailAddr != 0L) writeUnlock(tailId, tailPage, tailAddr, false); return; } if (tailAddr == 0L) continue; assert PageIO.getPageId(tailAddr) == tailId : "pageId = " + PageIO.getPageId(tailAddr) + ", tailId = " + tailId; assert PageIO.getType(tailAddr) == PageIO.T_PAGE_LIST_NODE; boolean ok = false; try { PagesListNodeIO io = PageIO.getPageIO(tailAddr); ok = bag != null ? putReuseBag(tailId, tailPage, tailAddr, io, bag, bucket) : putDataPage(tailId, tailPage, tailAddr, io, dataId, dataPage, dataAddr, bucket); if (ok) { stripe.empty = false; return; } } finally { writeUnlock(tailId, tailPage, tailAddr, ok); } } finally { releasePage(tailId, tailPage); } } }

Target:
protected final void put( ReuseBag bag, final long dataId, final long dataPage, final long dataAddr, int bucket) throws IgniteCheckedException { assert bag == null ^ dataAddr == 0L; for (int lockAttempt = 0; ;) { Stripe stripe = getPageForPut(bucket, bag); if (bag != null && bag.isEmpty()) return; final long tailId = stripe.tailId; final long tailPage = acquirePage(tailId); try { long tailAddr = writeLockPage(tailId, tailPage, bucket, lockAttempt++, bag); if (tailAddr == 0L) { if (bag != null && bag.isEmpty()) return; else continue; } assert PageIO.getPageId(tailAddr) == tailId : "pageId = " + PageIO.getPageId(tailAddr) + ", tailId = " + tailId; assert PageIO.getType(tailAddr) == PageIO.T_PAGE_LIST_NODE; boolean ok = false; try { PagesListNodeIO io = PageIO.getPageIO(tailAddr); ok = bag != null ? putReuseBag(tailId, tailPage, tailAddr, io, bag, bucket) : putDataPage(tailId, tailPage, tailAddr, io, dataId, dataPage, dataAddr, bucket); if (ok) { stripe.empty = false; return; } } finally { writeUnlock(tailId, tailPage, tailAddr, ok); } } finally { releasePage(tailId, tailPage); } } }
Source:
public void generateResults() { try { CStressFeatureVector cs = new CStressFeatureVector(datastreams); PuffMarker pm = new PuffMarker(datastreams); } catch (NotANumberException e) { System.err.println("Generate result error"); } }

Target:
public void generateResults() { try { CStressFeatureVector cs = new CStressFeatureVector(datastreams); } catch (NotANumberException e) { System.err.println("Generate result error"); } try { PuffMarker pm = new PuffMarker(datastreams); } catch (NotANumberException e) { System.err.println("PuffMarker: Generate result error"); } }
Source:
protected void starting(Description description) { String methodName = description.getMethodName(); String className = description.getClassName(); baseDir = "target/" + className + "/" + methodName; recoveryDir = "recovery"; try { FileUtils.deleteDirectory(new File(baseDir + "/" + "recovery")); } catch (IOException e) { throw new RuntimeException(e); } }

Target:
protected void starting(Description description) { String methodName = description.getMethodName(); String className = description.getClassName(); baseDir = "target/" + className + "/" + methodName; recoveryDir = "recovery"; try { FileUtils.deleteDirectory(new File(baseDir, "recovery")); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
public boolean exists(String name) { return get(name).isPresent(); }

Target:
public boolean exists(String name) { return dao.exists(FileBlob.getStorableKey(name)); }
Source:
public NodeConnectivity getLocalNodeConnectivity() { Optional<NodeState> maybeNodeState = getNode(localEndpoint); if (!maybeNodeState.isPresent()) { throw new IllegalArgumentException("Node not found: " + localEndpoint); } return maybeNodeState.get().getConnectivity(); }

Target:
public NodeConnectivity getLocalNodeConnectivity() { NodeState nodeState = getNode(localEndpoint) .orElseThrow(() -> new IllegalArgumentException("Node not found: " + localEndpoint)); return nodeState.getConnectivity(); }
Source:
public Matrix4 setToRotation(double x, double y, double z, double angle) { if (angle == 0) return identity(); return setAll(mQuat.fromAngleAxis(x, y, z, angle)); }

Target:
public Matrix4 setToRotation(double x, double y, double z, double angle) { return angle == 0 ? identity() : setAll(mQuat.fromAngleAxis(x, y, z, angle)); }
Source:
public Void decommissionModel(String modelId) { return digitalTwinsAsyncClient.decommissionModel(modelId).block(); }

Target:
public void decommissionModel(String modelId) { decommissionModelWithResponse(modelId, Context.NONE); }
Source:
public void reschedulePersistedMessages() { for (ScheduledFuture<?> scheduledFuture : this.delayTasks.values()) { scheduledFuture.cancel(true); } this.delayTasks.clear(); MessageGroup messageGroup = this.messageStore.getMessageGroup(this.messageGroupId); for (final Message<?> message : messageGroup.getMessages()) { this.getTaskScheduler().schedule(new Runnable() { @Override public void run() { long delay = determineDelayForMessage(message); if (delay > 0) { releaseMessageAfterDelay(message, delay); } else { releaseMessage(message); } } }, new Date()); } }

Target:
public synchronized void reschedulePersistedMessages() { MessageGroup messageGroup = this.messageStore.getMessageGroup(this.messageGroupId); for (final Message<?> message : messageGroup.getMessages()) { this.getTaskScheduler().schedule(new Runnable() { @Override public void run() { long delay = determineDelayForMessage(message); if (delay > 0) { releaseMessageAfterDelay(message, delay); } else { releaseMessage(message); } } }, new Date()); } }
Source:
protected R retrieve(File d) throws IOException { if(new File(d,"build.xml").exists()) { try { R b = cons.create(d); b.onLoad(); if (LOGGER.isLoggable(FINEST)) { LOGGER.log(FINEST, "Loaded " + b.getFullDisplayName() + " in " + Thread.currentThread().getName(), new ThisIsHowItsLoaded()); } return b; } catch (IOException e) { LOGGER.log(Level.WARNING, "could not load " + d, e); throw new IOException(); } catch (InstantiationError e) { LOGGER.log(Level.WARNING, "could not load " + d, e); } catch (Exception e) { LOGGER.log(Level.WARNING, "could not load " + d, e); } } return null; }

Target:
protected R retrieve(File d) throws IOException { if(new File(d,"build.xml").exists()) { try { R b = cons.create(d); b.onLoad(); if (LOGGER.isLoggable(FINEST)) { LOGGER.log(FINEST, "Loaded " + b.getFullDisplayName() + " in " + Thread.currentThread().getName(), new ThisIsHowItsLoaded()); } return b; } catch (IOException e) { LOGGER.log(Level.WARNING, "could not load " + d, e); } catch (InstantiationError e) { LOGGER.log(Level.WARNING, "could not load " + d, e); } catch (Exception e) { LOGGER.log(Level.WARNING, "could not load " + d, e); } } return null; }
Source:
public static void setup() { @SuppressWarnings("UnusedDeclaration") Class<?> clazz = org.codehaus.janino.CompilerFactory.class; try { cluster = Cluster.builder().addContactPoint(NODE).build(); session = cluster.connect(KEYSPACE); String createMetaTable = "CREATE TABLE IF NOT EXISTS " + KEYSPACE + "." + CassandraTransactionalStore.DEFAULT_META_TABLE + " ( " + CassandraTransactionalStore.DEFAULT_APP_ID_COL + " TEXT, " + CassandraTransactionalStore.DEFAULT_OPERATOR_ID_COL + " INT, " + CassandraTransactionalStore.DEFAULT_WINDOW_COL + " BIGINT, " + "PRIMARY KEY (" + CassandraTransactionalStore.DEFAULT_APP_ID_COL + ", " + CassandraTransactionalStore.DEFAULT_OPERATOR_ID_COL + ") " + ");"; session.execute(createMetaTable); String createTable = "CREATE TABLE IF NOT EXISTS " + KEYSPACE + "." + TABLE_NAME + " (id uuid PRIMARY KEY,age int,lastname text,test boolean,floatvalue float,doubleValue double,set1 set<int>,list1 list<int>,map1 map<text,int>,last_visited timestamp);"; session.execute(createTable); } catch (Throwable e) { DTThrowable.rethrow(e); } }

Target:
public static void setup() { try { cluster = Cluster.builder().addContactPoint(NODE).build(); session = cluster.connect(KEYSPACE); String createMetaTable = "CREATE TABLE IF NOT EXISTS " + KEYSPACE + "." + CassandraTransactionalStore.DEFAULT_META_TABLE + " ( " + CassandraTransactionalStore.DEFAULT_APP_ID_COL + " TEXT, " + CassandraTransactionalStore.DEFAULT_OPERATOR_ID_COL + " INT, " + CassandraTransactionalStore.DEFAULT_WINDOW_COL + " BIGINT, " + "PRIMARY KEY (" + CassandraTransactionalStore.DEFAULT_APP_ID_COL + ", " + CassandraTransactionalStore.DEFAULT_OPERATOR_ID_COL + ") " + ");"; session.execute(createMetaTable); String createTable = "CREATE TABLE IF NOT EXISTS " + KEYSPACE + "." + TABLE_NAME + " (id uuid PRIMARY KEY,age int,lastname text,test boolean,floatvalue float,doubleValue double,set1 set<int>,list1 list<int>,map1 map<text,int>,last_visited timestamp);"; session.execute(createTable); } catch (Throwable e) { DTThrowable.rethrow(e); } }