auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected List<IssueEventHolder> doLoadInBackground() throws IOException { IssueService issueService = (IssueService) Gh4Application.get().getService(Gh4Application.ISSUE_SERVICE); List<Comment> comments = issueService.getComments( new RepositoryId(mRepoOwner, mRepoName), mIssueNumber); List<IssueEvent> events = issueService.getIssueEvents(mRepoOwner, mRepoName, mIssueNumber); List<IssueEventHolder> result = new ArrayList<>(); boolean isPullRequest = this instanceof PullRequestCommentListLoader; for (Comment comment : comments) { result.add(new IssueEventHolder(comment, isPullRequest)); } for (IssueEvent event : events) { if (INTERESTING_EVENTS.contains(event.getEvent())) { result.add(new IssueEventHolder(event, isPullRequest)); } } Collections.sort(result, SORTER); return result; }

Target:
protected List<IssueEventHolder> doLoadInBackground() throws IOException { IssueService issueService = (IssueService) Gh4Application.get().getService(Gh4Application.ISSUE_SERVICE); List<Comment> comments = issueService.getComments( new RepositoryId(mRepoOwner, mRepoName), mIssueNumber); List<IssueEvent> events = issueService.getIssueEvents(mRepoOwner, mRepoName, mIssueNumber); List<IssueEventHolder> result = new ArrayList<>(); for (Comment comment : comments) { result.add(new IssueEventHolder(comment, mIsPullRequest)); } for (IssueEvent event : events) { if (INTERESTING_EVENTS.contains(event.getEvent())) { result.add(new IssueEventHolder(event, mIsPullRequest)); } } Collections.sort(result, SORTER); return result; }
Source:
public SysprepVmTemplateParameters(Guid vmTemplateId) { this.vmTemplateId = vmTemplateId; }

Target:
public SysprepVmTemplateParameters(Guid vmTemplateId) { super(vmTemplateId); }
Source:
public Map<String, String> getRemoteSymbolicReferences(String url, String pattern) throws GitException, InterruptedException { ArgumentListBuilder args = new ArgumentListBuilder("ls-remote"); args.add("--symref"); args.add(url); if (pattern != null) { args.add(pattern); } StandardCredentials cred = credentials.get(url); if (cred == null) cred = defaultCredentials; String result = launchCommandWithCredentials(args, null, cred, url); Map<String, String> references = new HashMap<>(); String[] lines = result.split("\n"); Pattern symRefPattern = Pattern.compile("^ref:\\s+([^ ]+)\\s+([^ ]+)$"); for (String line : lines) { Matcher matcher = symRefPattern.matcher(line); if (matcher.matches()) { references.put(matcher.group(2), matcher.group(1)); } else if (line.length() < 41) { throw new GitException("unexpected ls-remote output " + line); } } return references; }

Target:
public Map<String, String> getRemoteSymbolicReferences(String url, String pattern) throws GitException, InterruptedException { Map<String, String> references = new HashMap<>(); if (isAtLeastVersion(2, 8, 0, 0)) { ArgumentListBuilder args = new ArgumentListBuilder("ls-remote"); args.add("--symref"); args.add(url); if (pattern != null) { args.add(pattern); } StandardCredentials cred = credentials.get(url); if (cred == null) cred = defaultCredentials; String result = launchCommandWithCredentials(args, null, cred, url); String[] lines = result.split("\n"); Pattern symRefPattern = Pattern.compile("^ref:\\s+([^ ]+)\\s+([^ ]+)$"); for (String line : lines) { Matcher matcher = symRefPattern.matcher(line); if (matcher.matches()) { references.put(matcher.group(2), matcher.group(1)); } } } return references; }
Source:
public InputStream getAttachmentData(String attachmentId, IProgressMonitor monitor) throws IOException, CoreException { String url = repositoryUrl + IBugzillaConstants.URL_GET_ATTACHMENT_DOWNLOAD + attachmentId; GetMethod method = getConnect(url, monitor); try { if (method.getStatusCode() == HttpStatus.SC_OK) { return method.getResponseBodyAsStream(); } else { parseHtmlError(method.getResponseBodyAsStream()); WebUtil.releaseConnection(method, monitor); } } catch (Exception e) { WebUtil.releaseConnection(method, monitor); throw new CoreException(new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, "Unable to retrieve attachment", e)); } return null; }

Target:
public InputStream getAttachmentData(String attachmentId, IProgressMonitor monitor) throws IOException, CoreException { String url = repositoryUrl + IBugzillaConstants.URL_GET_ATTACHMENT_DOWNLOAD + attachmentId; GetMethod method = getConnect(url, monitor); try { if (method.getStatusCode() == HttpStatus.SC_OK) { Header contentDisposition = method.getResponseHeader("Content-disposition"); if (contentDisposition == null) { parseHtmlError(method.getResponseBodyAsStream()); throw new CoreException( new Status( IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, "No Exception from parseHtmlError, should throw an Exception" + method.getResponseBodyAsStream())); } return method.getResponseBodyAsStream(); } else { parseHtmlError(method.getResponseBodyAsStream()); throw new CoreException( new Status( IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, "No Exception from parseHtmlError, should throw an Exception" + method.getResponseBodyAsStream())); } } catch (Exception e) { WebUtil.releaseConnection(method, monitor); throw new CoreException(new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, "Unable to retrieve attachment", e)); } }
Source:
private String formProfileUrl(String clusterId, String volumeId, boolean isBrickProfileSelected) { String url = "/ovirt-engine/api/clusters/" + clusterId + "/glustervolumes/" + volumeId + "/profilestatistics"; if (!isBrickProfileSelected) { url += ";nfsStatistics=true"; } return url + ".pdf"; }

Target:
private String formProfileUrl(String clusterId, String volumeId, boolean isBrickProfileSelected) { String apiMatrixParam = ((!isBrickProfileSelected) ? ";nfsStatistics=true" : ""); return StringFormat.format("/ovirt-engine/api/clusters/%s/glustervolumes/%s/profilestatistics%s?accept=application/pdf", clusterId, volumeId, apiMatrixParam); }
Source:
public void addLife() { lives++; addToLog("The player earned a life, total lives is now: " + lives); }

Target:
public void addLife() { lives++; addToLog("[PLAYER]\t Player earned a life, total lives is now: " + lives); }
Source:
private String sumTimes(NodeList testCaseNodes) { double totalDurationSecondsForAllTimes = 0.0d; for( int i = 0; i < testCaseNodes.getLength(); i++ ) { try { double testCaseTime = Double.parseDouble(testCaseNodes.item(i).getAttributes().getNamedItem("time").getNodeValue()); totalDurationSecondsForAllTimes += testCaseTime; } catch ( NumberFormatException e ) { e.printStackTrace(); } catch ( NullPointerException e ) { e.printStackTrace(); } } DecimalFormat nfmt = (DecimalFormat) NumberFormat.getNumberInstance(Locale.US); nfmt.applyPattern("0.######"); return nfmt.format(totalDurationSecondsForAllTimes); }

Target:
private String sumTimes(NodeList testCaseNodes) { double totalDurationSecondsForAllTimes = 0.0d; for( int i = 0; i < testCaseNodes.getLength(); i++ ) { try { double testCaseTime = Double.parseDouble(testCaseNodes.item(i).getAttributes().getNamedItem("time").getNodeValue()); totalDurationSecondsForAllTimes += testCaseTime; } catch ( NumberFormatException e ) { throw new CucumberException(e); } catch ( NullPointerException e ) { throw new CucumberException(e); } } DecimalFormat nfmt = (DecimalFormat) NumberFormat.getNumberInstance(Locale.US); nfmt.applyPattern("0.######"); return nfmt.format(totalDurationSecondsForAllTimes); }
Source:
public void close() throws IOException { transactionAwareHTable.close(); secondaryIndexTable.close(); }

Target:
public void close() throws IOException { try { transactionAwareHTable.close(); } catch (IOException e) { try { secondaryIndexTable.close(); } catch (IOException ex) { e.addSuppressed(e); } throw e; } secondaryIndexTable.close(); }
Source:
public static void assertAllowHeaders(HttpEntity<?> response, HttpMethod... methods) { HttpHeaders headers = response.getHeaders(); assertThat(headers.getAllow(), hasSize(methods.length)); assertThat(headers.getAllow(), hasItems(methods)); }

Target:
public static void assertAllowHeaders(HttpEntity<?> response, HttpMethod... methods) { HttpHeaders headers = response.getHeaders(); assertThat(headers.getAllow()).containsExactly(methods); }
Source:
private javax.persistence.Query createJpaQuery(Query query, CdiQueryInvocationContext context) { EntityManager entityManager = context.getEntityManager(); Parameters params = context.getParams(); javax.persistence.Query result = null; if (isNotEmpty(query.named())) { if (!context.hasQueryStringPostProcessors()) { result = params.applyTo(entityManager.createNamedQuery(query.named())); } else { javax.persistence.Query namedQuery = entityManager.createNamedQuery(query.named()); String named = factory.extract(namedQuery); String jpqlQuery = context.applyQueryStringPostProcessors(named); result = params.applyTo(entityManager.createQuery(jpqlQuery)); } } else if (query.isNative()) { String jpqlQuery = context.applyQueryStringPostProcessors(query.value()); Class<?> resultType = getQueryResultType(context.getMethod()); if (isEntityType(resultType)) { result = params.applyTo(entityManager.createNativeQuery(jpqlQuery, resultType)); } else { result = params.applyTo(entityManager.createNativeQuery(jpqlQuery)); } } else { String jpqlQuery = context.applyQueryStringPostProcessors(query.value()); context.setQueryString(jpqlQuery); result = params.applyTo(entityManager.createQuery(jpqlQuery)); } return context.applyRestrictions(result); }

Target:
private javax.persistence.Query createJpaQuery(Query query, CdiQueryInvocationContext context) { EntityManager entityManager = context.getEntityManager(); Parameters params = context.getParams(); javax.persistence.Query result = null; if (isNotEmpty(query.named())) { if (context.hasQueryStringPostProcessors()) { javax.persistence.Query namedQuery = entityManager.createNamedQuery(query.named()); String named = factory.extract(namedQuery); String jpqlQuery = context.applyQueryStringPostProcessors(named); result = params.applyTo(entityManager.createQuery(jpqlQuery)); } else { result = params.applyTo(entityManager.createNamedQuery(query.named())); } } else if (query.isNative()) { String jpqlQuery = context.applyQueryStringPostProcessors(query.value()); Class<?> resultType = getQueryResultType(context.getMethod()); if (isEntityType(resultType)) { result = params.applyTo(entityManager.createNativeQuery(jpqlQuery, resultType)); } else { result = params.applyTo(entityManager.createNativeQuery(jpqlQuery)); } } else { String jpqlQuery = context.applyQueryStringPostProcessors(query.value()); context.setQueryString(jpqlQuery); result = params.applyTo(entityManager.createQuery(jpqlQuery)); } return context.applyRestrictions(result); }
Source:
SweepResults runOneIteration(TableReference tableRef, byte[] startRow, SweepBatchConfig batchConfig) { try { SweepResults results = sweepRunner.runWithMetricsUpdate(tableRef, batchConfig, startRow, this::updateMetricsDeleteBatch); logSweepPerformance(tableRef, startRow, results); return results; } catch (RuntimeException e) { logSweepError(tableRef, startRow, batchConfig, e); throw e; } }

Target:
SweepResults runOneIteration(TableReference tableRef, byte[] startRow, SweepBatchConfig batchConfig) { try { SweepResults results = sweepRunner.run(tableRef, batchConfig, startRow); logSweepPerformance(tableRef, startRow, results); return results; } catch (RuntimeException e) { logSweepError(tableRef, startRow, batchConfig, e); throw e; } }
Source:
protected void addClassPathEntries() throws MalformedURLException { super.addClassPathEntries(); addFileUrl(new File(ROOT + File.separator + LIB + File.separator + "core" + File.separator + "WEB-INF" + File.separator + LIB + File.separator)); addJarFileUrls(new File(ROOT + File.separator + LIB + File.separator + "core" + File.separator + "WEB-INF" + File.separator + LIB)); addFileUrl(new File(ROOT + File.separator + LIB + File.separator + "api" + File.separator)); addJarFileUrls(new File(ROOT + File.separator + LIB + File.separator + "api")); addFileUrl(new File(ROOT + File.separator + REPOSITORY + File.separator + LIB + File.separator)); addJarFileUrls(new File(ROOT + File.separator + REPOSITORY + File.separator + LIB)); addFileUrl(new File(ROOT + File.separator + REPOSITORY + File.separator + COMPONENTS + File.separator + "plugins" + File.separator)); addJarFileUrls(new File(ROOT + File.separator + REPOSITORY + File.separator + COMPONENTS + File.separator + "plugins")); addFileUrl(new File(ROOT + File.separator + REPOSITORY + File.separator + COMPONENTS + File.separator + LIB + File.separator)); addJarFileUrls(new File(ROOT + File.separator + REPOSITORY + File.separator + COMPONENTS + File.separator + LIB)); addFileUrl(new File(ROOT + File.separator + LIB + File.separator + "checkin-client" + File.separator + "log4j.properties")); String internalLibPath = System.getProperty("components.repo"); if (internalLibPath != null) { addFileUrl(new File(internalLibPath + File.separator)); addJarFileUrls(new File(internalLibPath)); } }

Target:
protected void addClassPathEntries() throws MalformedURLException { super.addClassPathEntries(); addFileUrl(new File(ROOT + File.separator + LIB + File.separator + "core" + File.separator + "WEB-INF" + File.separator + LIB + File.separator)); addJarFileUrls(new File(ROOT + File.separator + LIB + File.separator + "core" + File.separator + "WEB-INF" + File.separator + LIB)); addFileUrl(new File(ROOT + File.separator + LIB + File.separator + "api" + File.separator)); addJarFileUrls(new File(ROOT + File.separator + LIB + File.separator + "api")); addFileUrl(new File(ROOT + File.separator + REPOSITORY + File.separator + LIB + File.separator)); addJarFileUrls(new File(ROOT + File.separator + REPOSITORY + File.separator + LIB)); addFileUrl(new File(ROOT + File.separator + REPOSITORY + File.separator + COMPONENTS + File.separator + "plugins" + File.separator)); addJarFileUrls(new File(ROOT + File.separator + REPOSITORY + File.separator + COMPONENTS + File.separator + "plugins")); addFileUrl(new File(ROOT + File.separator + REPOSITORY + File.separator + COMPONENTS + File.separator + LIB + File.separator)); addJarFileUrls(new File(ROOT + File.separator + REPOSITORY + File.separator + COMPONENTS + File.separator + LIB)); addFileUrl(new File(ROOT + File.separator + LIB + File.separator + "checkin-client" + File.separator + "log4j.properties")); String internalLibPath = System.getProperty(COMPONENT_PLUGINS_DIR_PATH); if (internalLibPath != null) { File pluginsFile = new File(internalLibPath); addFileUrl(pluginsFile); addJarFileUrls(pluginsFile); } }
Source:
public void compute() { List<Element> eventEls = getDocument().getRootElement().getChildren("event", PREMIS_V2_NS); for (Element eventEl: eventEls) { List<String> eventTypes = getEventTypes(eventEl); if (eventTypes.isEmpty()) { log.error("No type present on event for object {}", pid); continue; } if (eventTypes.contains(VIRUS_CHECK_TYPE)) { addVirusCheckEvent(eventEl); } else if (eventTypes.contains(VALIDATION_TYPE)) { transformValidationEvent(eventEl); } else if (eventTypes.contains(INGESTION_TYPE)) { addIngestionEvent(eventEl); } else if (eventTypes.contains(ACCESSION_TYPE)) { transformAccessionEvent(eventEl); } else if (eventTypes.contains(MIGRATION_TYPE)) { transformMigrationEvent(eventEl); } else if (eventTypes.contains(CREATION_TYPE)) { transformCreationEvent(eventEl); } else if (eventTypes.contains(DELETION_TYPE)) { transformDeletionEvent(eventEl); } else if (eventTypes.contains(REPLICATION_TYPE)) { transformReplicationEvent(eventEl); } else if (eventTypes.contains(FIXITY_CHECK_TYPE)) { transformFixityEvent(eventEl); } else { log.error("Unknown event types for {}: {}", pid, eventTypes); } } }

Target:
public void compute() { List<Element> eventEls = getDocument().getRootElement().getChildren("event", PREMIS_V2_NS); for (Element eventEl: eventEls) { List<String> eventTypes = getEventTypes(eventEl); if (eventTypes.isEmpty()) { log.error("No type present on event for object {}", pid); continue; } if (eventTypes.contains(VIRUS_CHECK_TYPE)) { addVirusCheckEvent(eventEl); } else if (eventTypes.contains(VALIDATION_TYPE)) { transformValidationEvent(eventEl); } else if (eventTypes.contains(INGESTION_TYPE)) { addIngestionEvent(eventEl); } else if (eventTypes.contains(NORMALIZATION_TYPE)) { transformNormalizationEvent(eventEl); } else if (eventTypes.contains(MIGRATION_TYPE)) { transformMigrationEvent(eventEl); } else if (eventTypes.contains(CREATION_TYPE)) { transformCreationEvent(eventEl); } else if (eventTypes.contains(DELETION_TYPE)) { transformDeletionEvent(eventEl); } else if (eventTypes.contains(REPLICATION_TYPE)) { transformReplicationEvent(eventEl); } else if (eventTypes.contains(FIXITY_CHECK_TYPE)) { transformFixityEvent(eventEl); } else { log.error("Unknown event types for {}: {}", pid, eventTypes); } } }
Source:
public EurekaInstanceConfigBean eurekaInstanceConfigBean() { EurekaInstanceConfigBean config = new EurekaInstanceConfigBean(inetUtils); RelaxedPropertyResolver springPropertyResolver = new RelaxedPropertyResolver(env, "spring.application."); String springAppName = springPropertyResolver.getProperty("name"); int port = this.sidecarProperties.getPort(); config.setNonSecurePort(port); config.setInstanceId(getDefaultInstanceId(this.env)); if (StringUtils.hasText(springAppName)) { config.setAppname(springAppName); config.setVirtualHostName(springAppName); config.setSecureVirtualHostName(springAppName); } String hostname = this.sidecarProperties.getHostname(); String ipAddress = this.sidecarProperties.getIpAddress(); if (!StringUtils.hasText(hostname) && StringUtils.hasText(this.hostname)) { hostname = this.hostname; } if (StringUtils.hasText(hostname)) { if (!StringUtils.hasText(ipAddress)) { try { ipAddress = inetUtils.convertAddress(InetAddress.getByName(hostname)).getIpAddress(); } catch (UnknownHostException e) { throw new IllegalStateException( "Could not resolve IP address of sidecar application using hostname: " + hostname); } } config.setHostname(hostname); } if (!StringUtils.hasText(ipAddress)) { config.setIpAddress(ipAddress); } String scheme = config.getSecurePortEnabled() ? "https" : "http"; config.setStatusPageUrl(scheme + "://" + config.getHostname() + ":" + this.managementPort + config.getStatusPageUrlPath()); config.setHealthCheckUrl(scheme + "://" + config.getHostname() + ":" + this.managementPort + config.getHealthCheckUrlPath()); config.setHomePageUrl(scheme + "://" + config.getHostname() + ":" + port + config.getHomePageUrlPath()); return config; }

Target:
public EurekaInstanceConfigBean eurekaInstanceConfigBean() { EurekaInstanceConfigBean config = new EurekaInstanceConfigBean(inetUtils); RelaxedPropertyResolver springPropertyResolver = new RelaxedPropertyResolver(env, "spring.application."); String springAppName = springPropertyResolver.getProperty("name"); int port = this.sidecarProperties.getPort(); config.setNonSecurePort(port); config.setInstanceId(getDefaultInstanceId(this.env)); if (StringUtils.hasText(springAppName)) { config.setAppname(springAppName); config.setVirtualHostName(springAppName); config.setSecureVirtualHostName(springAppName); } String hostname = this.sidecarProperties.getHostname(); String ipAddress = this.sidecarProperties.getIpAddress(); if (!StringUtils.hasText(hostname) && StringUtils.hasText(this.hostname)) { hostname = this.hostname; } if (StringUtils.hasText(hostname)) { config.setHostname(hostname); } if (StringUtils.hasText(ipAddress)) { config.setIpAddress(ipAddress); } String scheme = config.getSecurePortEnabled() ? "https" : "http"; config.setStatusPageUrl(scheme + "://" + config.getHostname() + ":" + this.managementPort + config.getStatusPageUrlPath()); config.setHealthCheckUrl(scheme + "://" + config.getHostname() + ":" + this.managementPort + config.getHealthCheckUrlPath()); config.setHomePageUrl(scheme + "://" + config.getHostname() + ":" + port + config.getHomePageUrlPath()); return config; }
Source:
private void exportBigAsImageFromProjectExplorerView(String imageExtension) throws Exception { SWTBotTree tree = bot.viewByTitle("Model Explorer").bot().tree(); SWTBotTreeItem airdFile = tree.expandNode(designerProject.getName()).select(BIG_SESSION); SWTBotUtils.clickContextMenu(airdFile, Messages.ExportRepresentationsAction_label); SWTBotUtils.waitAllUiEvents(); bot.waitUntil(Conditions.shellIsActive(Messages.ExportSeveralRepresentationsAsImagesDialog_dialogTitle)); bot.comboBox(1).setSelection(imageExtension); bot.button("OK").click(); SWTBotUtils.waitAllUiEvents(); Session opennedSession = localSession.getOpenedSession(); assertNotNull("The session should be opened", opennedSession); assertTrue("The session should be opened", opennedSession.isOpen()); }

Target:
private void exportBigAsImageFromProjectExplorerView(String imageExtension) throws Exception { SWTBotTree tree = bot.viewByTitle("Model Explorer").bot().tree(); SWTBotTreeItem airdFile = tree.expandNode(designerProject.getName()).select(BIG_SESSION); SWTBotUtils.clickContextMenu(airdFile, Messages.ExportRepresentationsAction_label); SWTBotUtils.waitAllUiEvents(); bot.waitUntil(Conditions.shellIsActive(Messages.ExportSeveralRepresentationsAsImagesDialog_dialogTitle)); bot.comboBox(1).setSelection(imageExtension); bot.button("OK").click(); SWTBotUtils.waitAllUiEvents(); Session openedSession = localSession.getOpenedSession(); assertNotNull("The session should be opened", openedSession); assertTrue("The session should be opened", openedSession.isOpen()); }
Source:
private Object readResolve() { if (jdks == null) { jdks = new ArrayList<>(); } slaveAgentPort = SystemProperties.getInteger(Jenkins.class.getName()+".slaveAgentPort", slaveAgentPort); return this; }

Target:
private Object readResolve() { if (jdks == null) { jdks = new ArrayList<>(); } if (SLAVE_AGENT_PORT_ENFORCE) { slaveAgentPort = getSlaveAgentPortInitialValue(slaveAgentPort); } return this; }
Source:
public DefaultCacheManager(ConfigurationBuilderHolder holder, boolean start) { try { globalConfiguration = holder.getGlobalConfigurationBuilder().build(); defaultConfiguration = holder.getDefaultConfigurationBuilder().build(); for (Entry<String, ConfigurationBuilder> entry : holder.getNamedConfigurationBuilders().entrySet()) { ConfigurationBuilder builder = entry.getValue(); builder.validate(globalConfiguration); org.infinispan.configuration.cache.Configuration c = builder.build(); configurationOverrides.put(entry.getKey(), c); } globalComponentRegistry = new GlobalComponentRegistry(globalConfiguration, this, caches.keySet()); authzHelper = new AuthorizationHelper(globalConfiguration.security(), AuditContext.CACHEMANAGER, globalConfiguration.globalJmxStatistics().cacheManagerName()); } catch (CacheConfigurationException ce) { throw ce; } catch (RuntimeException re) { throw new CacheConfigurationException(re); } if (start) start(); }

Target:
public DefaultCacheManager(ConfigurationBuilderHolder holder, boolean start) { try { globalConfiguration = holder.getGlobalConfigurationBuilder().build(); defaultConfiguration = holder.getDefaultConfigurationBuilder().build(globalConfiguration); for (Entry<String, ConfigurationBuilder> entry : holder.getNamedConfigurationBuilders().entrySet()) { ConfigurationBuilder builder = entry.getValue(); org.infinispan.configuration.cache.Configuration c = builder.build(globalConfiguration); configurationOverrides.put(entry.getKey(), c); } globalComponentRegistry = new GlobalComponentRegistry(globalConfiguration, this, caches.keySet()); authzHelper = new AuthorizationHelper(globalConfiguration.security(), AuditContext.CACHEMANAGER, globalConfiguration.globalJmxStatistics().cacheManagerName()); } catch (CacheConfigurationException ce) { throw ce; } catch (RuntimeException re) { throw new CacheConfigurationException(re); } if (start) start(); }
Source:
public void initialise() { playerCamera = worldRenderer.getActiveCamera(); addDesiredStateChange(new LookThroughNormalized(playerCamera)); initSkysphere(playerCamera.getzFar() < RADIUS ? playerCamera.getzFar() : RADIUS); wireframeStateChange = new SetWireframe(true); RenderingDebugConfig renderingDebugConfig = config.getRendering().getDebug(); new WireframeTrigger(renderingDebugConfig, this); addDesiredStateChange(new SetViewportToSizeOf(new ResourceUrn("engine:sceneOpaquePingPong"), displayResolutionDependentFBOs)); addDesiredStateChange(new EnableMaterial("engine:prog.sky")); addDesiredStateChange(new DisableDepthWriting()); addDesiredStateChange(new EnableFaceCulling()); addDesiredStateChange(new SetFacesToCull(GL_FRONT)); }

Target:
public void initialise() { playerCamera = worldRenderer.getActiveCamera(); addDesiredStateChange(new LookThroughNormalized(playerCamera)); initSkysphere(playerCamera.getzFar() < RADIUS ? playerCamera.getzFar() : RADIUS); wireframeStateChange = new SetWireframe(true); RenderingDebugConfig renderingDebugConfig = config.getRendering().getDebug(); new WireframeTrigger(renderingDebugConfig, this); addDesiredStateChange(new SetViewportToSizeOf(WRITEONLY_GBUFFER, displayResolutionDependentFBOs)); sceneOpaqueFbo = displayResolutionDependentFBOs.get(READONLY_GBUFFER); addDesiredStateChange(new EnableMaterial("engine:prog.sky")); addDesiredStateChange(new DisableDepthWriting()); addDesiredStateChange(new EnableFaceCulling()); addDesiredStateChange(new SetFacesToCull(GL_FRONT)); }
Source:
public APIResult submit( @PathParam("extension-name") String extensionName, @Context HttpServletRequest request, @DefaultValue("") @QueryParam("doAs") String doAsUser, @QueryParam("jobName") String jobName, @FormDataParam("processes") List<FormDataBodyPart> processForms, @FormDataParam("feeds") List<FormDataBodyPart> feedForms, @FormDataParam("config") InputStream config) { checkIfExtensionServiceIsEnabled(); List<Process> processes = getProcesses(processForms); List<Feed> feeds = getFeeds(feedForms); Pair<List<Feed>, List<Process>> entityPairs; try { entityPairs = getEntityList(extensionName, feeds, processes, config); submitEntities(extensionName, doAsUser, jobName, entityPairs.first, entityPairs.second, config); } catch (FalconException | IOException e) { LOG.error("Error while submitting extension job: ", e); throw FalconWebException.newAPIException(e, Response.Status.INTERNAL_SERVER_ERROR); } return new APIResult(APIResult.Status.SUCCEEDED, "Extension job submitted successfully" + jobName); }

Target:
public APIResult submit( @PathParam("extension-name") String extensionName, @Context HttpServletRequest request, @DefaultValue("") @QueryParam("doAs") String doAsUser, @QueryParam("jobName") String jobName, @FormDataParam("processes") List<FormDataBodyPart> processForms, @FormDataParam("feeds") List<FormDataBodyPart> feedForms, @FormDataParam("config") InputStream config) { checkIfExtensionServiceIsEnabled(); Map<EntityType, List<Entity>> entityMap; try { entityMap = getEntityList(extensionName, jobName, feedForms, processForms, config); submitEntities(extensionName, doAsUser, jobName, entityMap, config); } catch (FalconException | IOException e) { LOG.error("Error while submitting extension job: ", e); throw FalconWebException.newAPIException(e, Response.Status.INTERNAL_SERVER_ERROR); } return new APIResult(APIResult.Status.SUCCEEDED, "Extension job submitted successfully" + jobName); }
Source:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { Expression expression = getExpression(); if (!expression.evaluate(tuple, ptr) || ptr.getLength() == 0) { return false; } PDataType type = expression.getDataType(); String hexStr = (String) type.toObject(ptr, expression.getColumnModifier()); byte[] out = new byte[hexStr.length() / 2]; for (int i = 0; i < hexStr.length(); i = i + 2) { out[i / 2] = (byte) Integer.parseInt(hexStr.substring(i, i + 2), 16); } ptr.set(PDataType.BINARY.toBytes(out)); return true; }

Target:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { Expression expression = getExpression(); if (!expression.evaluate(tuple, ptr)) { return false; } if (ptr.getLength() == 0) { return true; } PDataType type = expression.getDataType(); String hexStr = (String) type.toObject(ptr, expression.getColumnModifier()); byte[] out = new byte[hexStr.length() / 2]; for (int i = 0; i < hexStr.length(); i = i + 2) { try { out[i / 2] = (byte) Integer.parseInt(hexStr.substring(i, i + 2), 16); } catch (NumberFormatException ex) { throw new IllegalDataException("Value " + hexStr.substring(i, i + 2) + " cannot be cast to hex number"); } catch (StringIndexOutOfBoundsException ex) { throw new IllegalDataException("Invalid value length, cannot cast to hex number (" + hexStr + ")"); } } ptr.set(out); return true; }
Source:
public CandidateWidget(Candidate candidate, int nbOfVotes) { widget = binder.createAndBindUi(this); company.setInnerHTML(candidate.getCompany()); name.setInnerHTML(candidate.getName()); if(candidate.getPicture() != null) { image.setResource(candidate.getPicture()); } nbVotes.setInnerHTML(String.valueOf(nbOfVotes)); }

Target:
public CandidateWidget(Candidate candidate, int nbOfVotes) { widget = binder.createAndBindUi(this); company.setInnerText(candidate.getCompany()); name.setInnerText(candidate.getName()); if (candidate.getPicture() != null) { image.setResource(candidate.getPicture()); } nbVotes.setInnerText(String.valueOf(nbOfVotes)); }
Source:
public void setOnCancelListener(DialogInterface.OnCancelListener listener) { isCancelable = true; dialog.setOnCancelListener(listener); cancelListener = listener; }

Target:
public void setOnCancelListener(DialogInterface.OnCancelListener listener) { isCancelable = true; cancelListener = listener; }
Source:
private final void updateMatchedLabels(String keyword) { List<TurboLabel> newMatchedLabels = TurboLabel.getMatchedLabels(allLabels, keyword); if (keyword.isEmpty() || newMatchedLabels.isEmpty()) { currentSuggestionIndex = OptionalInt.empty(); } else { currentSuggestionIndex = OptionalInt.of(0); } matchedLabels = TurboLabel.getLabelsNameList(newMatchedLabels); }

Target:
private final void updateMatchedLabels(String keyword) { List<TurboLabel> newMatchedLabels = TurboLabel.getMatchedLabels(allLabels, keyword); matchedLabels = TurboLabel.getLabelsNameList(newMatchedLabels); }
Source:
private String indexPurposeString() { switch (m_windowFunctionUsesIndex) { case SubPlanAssembler.STATEMENT_LEVEL_ORDER_BY_INDEX: return "Statement Level Order By"; case WindowFunctionScoreboard.NO_INDEX_USE: return "No Indexing Used"; default: if (0 <= m_windowFunctionUsesIndex) { return "Window function plan node " + m_windowFunctionUsesIndex; } } assert(false); return ""; }

Target:
private String indexPurposeString() { switch (m_windowFunctionUsesIndex) { case WindowFunctionScoreboard.STATEMENT_LEVEL_ORDER_BY_INDEX: return "Statement Level Order By"; case WindowFunctionScoreboard.NO_INDEX_USE: return "No Indexing Used"; default: if (0 <= m_windowFunctionUsesIndex) { return "Window function plan node " + m_windowFunctionUsesIndex; } } assert(false); return ""; }
Source:
public void connect( String channelConfig ) throws IOException { if ( !canUse( channelConfig ) ) { throw new MalformedURLException( "Unknown chanel string " + channelConfig ); } try { URI uri = new URI( channelConfig ); InetSocketAddress hostAddress = new InetSocketAddress( uri.getHost(), uri.getPort() ); clientSocketChannel = open( withFixedThreadPool( 2, newDaemonThreadFactory() ) ); setTrueOptions( SO_REUSEADDR, TCP_NODELAY, SO_KEEPALIVE ); clientSocketChannel.connect( hostAddress ).get(); UUID sessionId = parseAuth( uri ); if ( sessionId != null ) { ByteBuffer buff = ByteBuffer.wrap( sessionId.toString().getBytes( US_ASCII ) ); clientSocketChannel.write( buff ); } } catch ( URISyntaxException | InterruptedException e ) { throw new IOException( e.getLocalizedMessage(), e ); } catch ( ExecutionException e ) { throw new IOException( e.getLocalizedMessage(), e.getCause() ); } }

Target:
public void connect( String channelConfig ) throws IOException { if ( !canUse( channelConfig ) ) { throw new MalformedURLException( "Unknown chanel string " + channelConfig ); } try { URI uri = new URI( channelConfig ); InetSocketAddress hostAddress = new InetSocketAddress( uri.getHost(), uri.getPort() ); clientSocketChannel = open( withFixedThreadPool( 2, newDaemonThreadFactory() ) ); setTrueOptions( SO_REUSEADDR, TCP_NODELAY, SO_KEEPALIVE ); clientSocketChannel.connect( hostAddress ).get(); String sessionId = extractSessionId( uri ); if ( sessionId != null ) { ByteBuffer buff = ByteBuffer.wrap( sessionId.getBytes( US_ASCII ) ); clientSocketChannel.write( buff ); } } catch ( URISyntaxException | InterruptedException e ) { throw new IOException( e.getLocalizedMessage(), e ); } catch ( ExecutionException e ) { throw new IOException( e.getLocalizedMessage(), e.getCause() ); } }
Source:
public Object call(Object... args) { try { cpsClosure.call(args); } catch (CpsCallableInvocation inv) { Continuable continuable = new Continuable(inv.asBlock()); Outcome o = continuable.run0(new Outcome(null, null), Continuable.categories); if (o.isSuccess()) { return o.getNormal(); } else { throw new RuntimeException(o.getAbnormal()); } } return null; }

Target:
public Object call(Object... args) { try { return cpsClosure.call(args); } catch (CpsCallableInvocation inv) { Continuable continuable = new Continuable(inv.asBlock()); Outcome o = continuable.run0(new Outcome(null, null), Continuable.categories); if (o.isSuccess()) { return o.getNormal(); } else { throw new RuntimeException(o.getAbnormal()); } } }
Source:
private void analyzeAlgorithm(Algorithm algorithm) { if (!alg.contains(algorithm.getName())) { uniqueoperands += 1; } alg.add(algorithm.getName()); String algo = algorithm.toString(); int count = 0; for (String op : ST_OPERATORS) { int lastIndex = 0; while (lastIndex != -1) { lastIndex = algo.indexOf(op, lastIndex); if (lastIndex != -1) { operatorst++; opcount[count] += 1; operandst += ST_OPERANDS_WEIGHT[count]; String sub1 = algo.substring(0, lastIndex); String sub2 = algo.substring(lastIndex + op.length(), algo.length()); algo = sub1.concat(sub2); } } count++; } }

Target:
private void analyzeAlgorithm(Algorithm algorithm) { if (!alg.contains(algorithm.getName())) { uniqueOperands += 1; } alg.add(algorithm.getName()); String algo = algorithm.toString(); int count = 0; for (String op : ST_OPERATORS) { int lastIndex = 0; while (-1 != lastIndex) { lastIndex = algo.indexOf(op, lastIndex); if (-1 != lastIndex) { operatorST++; opCount[count] += 1; operandST += ST_OPERANDS_WEIGHT[count]; String sub1 = algo.substring(0, lastIndex); String sub2 = algo.substring(lastIndex + op.length(), algo.length()); algo = sub1.concat(sub2); } } count++; } }
Source:
public void update(Partition partition) throws IOException { Partition original = containerDao.getPartitionById(partition.getId()); authorizationManager.throwIfNotWritable(original.getSequencerPartitionContainer()); Pool pool = partition.getPool() == null ? null : poolService.get(partition.getPool().getId()); original.setPool(pool); original.getSequencerPartitionContainer().setLastModifier(authorizationManager.getCurrentUser()); containerDao.save(original.getSequencerPartitionContainer()); containerDao.update(original); }

Target:
public void update(Partition partition) throws IOException { Partition original = containerDao.getPartitionById(partition.getId()); authorizationManager.throwIfNotWritable(original.getSequencerPartitionContainer()); Pool pool = partition.getPool() == null ? null : poolService.get(partition.getPool().getId()); original.setPool(pool); original.getSequencerPartitionContainer().setLastModifier(authorizationManager.getCurrentUser()); containerDao.save(original.getSequencerPartitionContainer()); }
Source:
private ObjectId triggerUpdate(String ref) throws Exception { new Git(serverDb).checkout().setName(ref).call(); new FileWriter("foo.txt").append('U').close(); RevCommit commit = new Git(serverDb).commit() .setAll(true).setMessage("pubsub push").call(); ObjectId parent; try { parent = commit.getParent(0); } catch (ArrayIndexOutOfBoundsException e) { parent = ObjectId.zeroId(); } List<ReceiveCommand> updates = new ArrayList<ReceiveCommand>(); updates.add(new ReceiveCommand(parent, commit.getId(), ref)); publisher.onPush(serverDb, updates); return commit.getId(); }

Target:
private ObjectId triggerUpdate(String ref) throws Exception { serverGit.checkout().setName(ref).call(); new FileWriter("foo.txt").append('U').close(); RevCommit commit = new Git(serverDb).commit() .setAll(true).setMessage("pubsub push").call(); ObjectId parent = commit.getParentCount() > 0 ? commit.getParent(0) : ObjectId.zeroId(); List<ReceiveCommand> updates = new ArrayList<ReceiveCommand>(); updates.add(new ReceiveCommand(parent, commit.getId(), ref)); publisher.onPush(serverDb, updates); return commit.getId(); }
Source:
public PostsCreator clearOpenGraph() { getEditor().findElement(getOpenGraphContainer()).findElement(By.className("og-close")).click(); return this; }

Target:
public PostsCreator clearOpenGraph() { getOpenGraphDeleteButton().click(); return this; }
Source:
public void sessionDestroyed(final HttpSession session) { if(!started) { return; } final HttpSessionEvent sre = new HttpSessionEvent(session); for (int i = httpSessionListeners.length - 1; i >= 0; --i) { ManagedListener listener = httpSessionListeners[i]; try { this.<HttpSessionListener> get(listener).sessionDestroyed(sre); } catch (Exception e) { UndertowLogger.ROOT_LOGGER.debugf(e, "Exception happens in sessionDestroyed for session %s ", session); } } }

Target:
public void sessionDestroyed(final HttpSession session) { if(!started) { return; } final HttpSessionEvent sre = new HttpSessionEvent(session); for (int i = httpSessionListeners.length - 1; i >= 0; --i) { ManagedListener listener = httpSessionListeners[i]; try { this.<HttpSessionListener> get(listener).sessionDestroyed(sre); } catch (Exception e) { UndertowServletLogger.REQUEST_LOGGER.errorInvokingListener("sessionDestroyed", listener.getListenerInfo().getListenerClass(), e); } } }
Source:
protected RulesCache ( @GerritServerConfig Config config, SitePaths site) { this.cacheDir = site.resolve( config.getString("cache", null, "directory")); if (this.cacheDir != null) { this.rulesDir = new File(cacheDir, "rules"); } else { this.rulesDir = null; } }

Target:
protected RulesCache (@GerritServerConfig Config config, SitePaths site) { cacheDir = site.resolve( config.getString("cache", null, "directory")); if (cacheDir != null) { rulesDir = new File(cacheDir, "rules"); } else { rulesDir = null; } }
Source:
@Test public void shouldBePayiQForm() throws IOException { String authBookingFormJson = IOUtils.toString(getClass(). getResourceAsStream("/auth-payiq-form.json"), Charset.defaultCharset()); JsonReader reader = new JsonReader(new StringReader(authBookingFormJson)); reader.setLenient(true); BookingForm bookingForm = gson.fromJson(reader, BookingForm.class); assertThat(bookingForm.isPayIQAuthForm()).isTrue(); }

Target:
@Test public void shouldBePayiQForm() throws IOException { String authBookingFormJson = IOUtils.toString(getClass(). getResourceAsStream("/auth-payiq-form.json"), Charset.defaultCharset()); JsonReader reader = new JsonReader(new StringReader(authBookingFormJson)); BookingForm bookingForm = gson.fromJson(reader, BookingForm.class); assertThat(bookingForm.isPayIQAuthForm()).isTrue(); }
Source:
private void addSuiteByRunAndNode(SuiteResult s) { if (suitesByRunAndNode.get(s.getRunId()) == null) { suitesByRunAndNode.put(s.getRunId(), new HashMap<String, List<SuiteResult>>()); } if (suitesByRunAndNode.get(s.getRunId()).get(s.getNodeId()) == null) { suitesByRunAndNode.get(s.getRunId()).put(s.getNodeId(), new ArrayList<SuiteResult>()); } suitesByRunAndNode.get(s.getRunId()).get(s.getNodeId()).add(s); }

Target:
private void addSuiteByRunAndNode(SuiteResult s) { String runId = s.getRunId(); String nodeId = s.getNodeId(); if (runId != null && nodeId != null) { if (suitesByRunAndNode.get(runId) == null) { suitesByRunAndNode.put(runId, new HashMap<String, List<SuiteResult>>()); } if (suitesByRunAndNode.get(runId).get(nodeId) == null) { suitesByRunAndNode.get(runId).put(nodeId, new ArrayList<SuiteResult>()); } suitesByRunAndNode.get(runId).get(nodeId).add(s); List<String> enclosingBlocks = new ArrayList<>(s.getEnclosingBlocks()); if (!enclosingBlocks.isEmpty()) { populateBlocks(runId, enclosingBlocks, nodeId, null); } } }
Source:
private static String getProjectId(String projectName, String token) { String projectId = null; HttpsURLConnection connection = null; InputStream inputStream = null; JsonParser jsonParser = null; try { String path = "api/v1/namespaces/" + projectName; URL url = new URL(NamespaceHandler.KUBERNETES_MASTER_URL + "/" + path); connection = (HttpsURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setRequestProperty("Accept", "application/json"); connection.setRequestProperty("Authorization", "Bearer " + token); connection.connect(); int responseCode = connection.getResponseCode(); if (responseCode == 200) { JsonFactory jsonFactory = new JsonFactory(); jsonFactory.setCodec(new ObjectMapper()); inputStream = connection.getInputStream(); jsonParser = jsonFactory.createParser(inputStream); JsonNode jsonNode = jsonParser.readValueAsTree(); if (jsonNode != null) { JsonNode metadata = jsonNode.get("metadata"); projectId = metadata.get("uid").asText(); } } else { log.warnf("Error getting project metadata. Code %s: %s", responseCode, connection.getResponseMessage()); } } catch (IOException io) { log.error(io); } finally { try { if (jsonParser != null) { jsonParser.close(); } if (inputStream != null) { inputStream.close(); } } catch (IOException io) { log.error(io); } if (connection != null) { connection.disconnect(); } } return projectId; }

Target:
private static String getProjectId(String projectName, String token) { String projectId = null; HttpsURLConnection connection = null; InputStream inputStream = null; JsonParser jsonParser = null; try { String path = "api/v1/namespaces/" + projectName; URL url = new URL(NamespaceHandler.KUBERNETES_MASTER_URL + "/" + path); connection = (HttpsURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setRequestProperty("Accept", "application/json"); connection.setRequestProperty("Authorization", "Bearer " + token); connection.connect(); int responseCode = connection.getResponseCode(); if (responseCode == 200) { JsonFactory jsonFactory = new JsonFactory(); jsonFactory.setCodec(new ObjectMapper()); inputStream = connection.getInputStream(); jsonParser = jsonFactory.createParser(inputStream); JsonNode jsonNode = jsonParser.readValueAsTree(); if (jsonNode != null) { JsonNode metadata = jsonNode.get("metadata"); projectId = metadata.get("uid").asText(); } } else { log.warnf("Error getting project metadata. Code %s: %s", responseCode, connection.getResponseMessage()); } } catch (IOException io) { log.error(io); } finally { try { if (jsonParser != null) { jsonParser.close(); } } catch (IOException io) { log.error(io); } try { if (inputStream != null) { inputStream.close(); } } catch (IOException io) { log.error(io); } if (connection != null) { connection.disconnect(); } } return projectId; }
Source:
public boolean install(Resource r, ResourceLocation location, Reference ref, ResourceTable table, CommCareInstance instance, boolean upgrade) throws UnresolvedResourceException, UnfullfilledRequirementsException { try { OfflineUserRestore offlineUserRestore = OfflineUserRestore.buildInMemoryUserRestore(ref.getStream()); storage().write(offlineUserRestore); if (upgrade) { table.commit(r, Resource.RESOURCE_STATUS_INSTALLED); } else { table.commit(r, Resource.RESOURCE_STATUS_UPGRADE); } cacheLocation = offlineUserRestore.getID(); } catch (IOException e) { throw new UnresolvedResourceException(r, e.getMessage()); } return true; }

Target:
public boolean install(Resource r, ResourceLocation location, Reference ref, ResourceTable table, CommCareInstance instance, boolean upgrade) throws UnresolvedResourceException, UnfullfilledRequirementsException { try { OfflineUserRestore offlineUserRestore = OfflineUserRestore.buildInMemoryUserRestore(ref.getStream()); storage().write(offlineUserRestore); if (upgrade) { table.commit(r, Resource.RESOURCE_STATUS_INSTALLED); } else { table.commit(r, Resource.RESOURCE_STATUS_UPGRADE); } cacheLocation = offlineUserRestore.getID(); } catch (IOException | XmlPullParserException | InvalidStructureException e) { throw new UnresolvedResourceException(r, e.getMessage()); } return true; }
Source:
public void testSerialization() throws Exception { final Subscription subscription = new Subscription( Arrays.asList(new TimerEvent("0 * * * * *"), new TimerEvent("1 * * * * *")), new Condition("true"), new Template("test message"), Arrays.asList("/gdc/account/profile/876ec68f5630b38de65852ed5d6236ff/channelConfigurations/59dca8f160b2c601f3c72e1b"), new Meta("test subscription")); assertThat(subscription, jsonEquals(resource("notification/subscriptionToCreate.json"))); }

Target:
public void testSerialization() throws Exception { final Subscription subscription = new Subscription( Arrays.asList(new TimerEvent("0 * * * * *"), new TimerEvent("1 * * * * *")), new TriggerCondition("true"), new MessageTemplate("test message"), singletonList("/gdc/account/profile/876ec68f5630b38de65852ed5d6236ff/channelConfigurations/59dca62e60b2c601f3c72e18"), new Meta("test subscription")); assertThat(subscription, jsonEquals(resource("notification/subscriptionToCreate.json"))); }
Source:
public void testMultiThreadedShared() throws Exception { secureHttpClientFactory.activate(createConfigMap(10, 200, 60, 5, 10, 60)); ThreadPoolExecutor workers = new ThreadPoolExecutor(20, 80, 60, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(50 * 50), new NamedThreadFactory("workers")); List<HttpClientFacade> clients = new ArrayList<>(); final int CLIENTS = 2; final int REQUESTS = 2; for (int i = 0; i < CLIENTS; i++) { HttpClientFacade httpClient = secureHttpClientFactory.getHttpClient(); clients.add(httpClient); } final List<String> failures = new ArrayList<>(); for (int i = 0; i < REQUESTS; i++) { for (final HttpClientFacade client : clients) { workers.execute(new Runnable() { @Override public void run() { try { ContentResponse response = client.GET("<LINK_0>"); if (response.getStatus() != 200) { System.out.println(response.getStatus()); failures.add("Statuscode != 200"); } } catch (InterruptedException | ExecutionException | TimeoutException e) { failures.add("Unexpected exception:" + e.getMessage()); } } }); } } workers.shutdown(); workers.awaitTermination(120, TimeUnit.SECONDS); if (!failures.isEmpty()) { fail(failures.toString()); } secureHttpClientFactory.deactivate(); }

Target:
public void testMultiThreadedShared() throws Exception { secureHttpClientFactory.activate(createConfigMap(10, 200, 60, 5, 10, 60)); ThreadPoolExecutor workers = new ThreadPoolExecutor(20, 80, 60, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(50 * 50)); List<CommonHttpClient> clients = new ArrayList<>(); final int CLIENTS = 2; final int REQUESTS = 2; for (int i = 0; i < CLIENTS; i++) { CommonHttpClient httpClient = secureHttpClientFactory.getCommonHttpClient(); clients.add(httpClient); } final List<String> failures = new ArrayList<>(); for (int i = 0; i < REQUESTS; i++) { for (final CommonHttpClient client : clients) { workers.execute(new Runnable() { @Override public void run() { try { ContentResponse response = client.GET(TEST_URL); if (response.getStatus() != 200) { System.out.println(response.getStatus()); failures.add("Statuscode != 200"); } } catch (InterruptedException | ExecutionException | TimeoutException e) { failures.add("Unexpected exception:" + e.getMessage()); } } }); } } workers.shutdown(); workers.awaitTermination(120, TimeUnit.SECONDS); if (!failures.isEmpty()) { fail(failures.toString()); } secureHttpClientFactory.deactivate(); }
Source:
public int compareTo( Item item ) { if ( item == null ) { return ( value == 0 ) ? 0 : 1; } switch ( item.getType() ) { case INT_ITEM: { int itemValue = ( (IntItem) item ).value; return ( value < itemValue ) ? -1 : ( ( value == itemValue ) ? 0 : 1 ); } case LONG_ITEM: { long itemValue = ( (LongItem) item ).value; return ( value < itemValue ) ? -1 : ( ( value == itemValue ) ? 0 : 1 ); } case BIGINTEGER_ITEM: return BigInteger.valueOf( value ).compareTo( ( (BigIntegerItem) item ).value ); case STRING_ITEM: return 1; case LIST_ITEM: return 1; default: throw new RuntimeException( "invalid item: " + item.getClass() ); } }

Target:
public int compareTo( Item item ) { if ( item == null ) { return ( value == 0 ) ? 0 : 1; } switch ( item.getType() ) { case INT_ITEM: int itemValue = ( (IntItem) item ).value; return ( value < itemValue ) ? -1 : ( ( value == itemValue ) ? 0 : 1 ); case LONG_ITEM: case BIGINTEGER_ITEM: return -1; case STRING_ITEM: return 1; case LIST_ITEM: return 1; default: throw new IllegalStateException( "invalid item: " + item.getClass() ); } }