auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void start(final ServiceProvider<Service> serviceProvider) { this.cacheManager = serviceProvider.getService(CacheManagerProviderService.class).getCacheManager(); StatisticsService statisticsService = serviceProvider.getService(StatisticsService.class); TimeSourceService timeSourceService = serviceProvider.getService(TimeSourceService.class); addManagementProvider(new EhcacheActionProvider(getConfiguration())); addManagementProvider(new EhcacheStatisticsProvider(getConfiguration(), statisticsService, timeSourceService.getTimeSource())); addManagementProvider(new EhcacheStatisticCollectorProvider(getConfiguration())); addManagementProvider(new EhcacheSettingsProvider(getConfiguration(), cacheManager)); this.cacheManager.registerListener(this); this.clusteringManagementService = serviceProvider.getService(ClusteringManagementService.class); if (this.clusteringManagementService == null && Clustering.isAvailable(serviceProvider)) { this.clusteringManagementService = Clustering.newClusteringManagementService(new DefaultClusteringManagementServiceConfiguration()); this.clusteringManagementService.start(serviceProvider); this.clusteringManagementServiceManuallyStarted = true; } }

Target:
public void start(final ServiceProvider<Service> serviceProvider) { this.cacheManager = serviceProvider.getService(CacheManagerProviderService.class).getCacheManager(); StatisticsService statisticsService = serviceProvider.getService(StatisticsService.class); TimeSourceService timeSourceService = serviceProvider.getService(TimeSourceService.class); addManagementProvider(new EhcacheActionProvider(getConfiguration())); addManagementProvider(new EhcacheStatisticsProvider(getConfiguration(), statisticsService, timeSourceService.getTimeSource())); addManagementProvider(new EhcacheStatisticCollectorProvider(getConfiguration())); addManagementProvider(new EhcacheSettingsProvider(getConfiguration(), cacheManager)); this.cacheManager.registerListener(this); this.clusteringManagementService = serviceProvider.getService(ClusteringManagementService.class); if (this.clusteringManagementService == null && Clustering.isAvailable(serviceProvider)) { this.clusteringManagementService = Clustering.newClusteringManagementService(new DefaultClusteringManagementServiceConfiguration()); this.clusteringManagementService.start(serviceProvider); this.clusteringManagementServiceAutoStarted = true; } else { this.clusteringManagementServiceAutoStarted = false; } }
Source:
public double fxRate(Currency baseCurrency, Currency counterCurrency) { if (baseCurrency.equals(counterCurrency)) { return 1; } Optional<FxRate> rate = marketData.findValue(FxRateKey.of(baseCurrency, counterCurrency)); if (rate.isPresent()) { return rate.get().fxRate(baseCurrency, counterCurrency); } Currency triangularCcy = baseCurrency.getTriangulationCurrency(); Optional<FxRate> rate1 = marketData.findValue(FxRateKey.of(baseCurrency, triangularCcy)); Optional<FxRate> rate2 = marketData.findValue(FxRateKey.of(triangularCcy, counterCurrency)); if(rate1.isPresent() && rate2.isPresent()) { return rate1.get().crossRate(rate2.get()).fxRate(baseCurrency, counterCurrency); } throw new IllegalArgumentException("No market data available for pair " + baseCurrency + "/" + counterCurrency); }

Target:
public double fxRate(Currency baseCurrency, Currency counterCurrency) { if (baseCurrency.equals(counterCurrency)) { return 1; } Optional<FxRate> rate = marketData.findValue(FxRateKey.of(baseCurrency, counterCurrency)); if (rate.isPresent()) { return rate.get().fxRate(baseCurrency, counterCurrency); } Currency triangularBaseCcy = baseCurrency.getTriangulationCurrency(); Optional<FxRate> rateBase1 = marketData.findValue(FxRateKey.of(baseCurrency, triangularBaseCcy)); Optional<FxRate> rateBase2 = marketData.findValue(FxRateKey.of(triangularBaseCcy, counterCurrency)); if (rateBase1.isPresent() && rateBase2.isPresent()) { return rateBase1.get().crossRate(rateBase2.get()).fxRate(baseCurrency, counterCurrency); } Currency triangularCounterCcy = counterCurrency.getTriangulationCurrency(); Optional<FxRate> rateCounter1 = marketData.findValue(FxRateKey.of(baseCurrency, triangularCounterCcy)); Optional<FxRate> rateCounter2 = marketData.findValue(FxRateKey.of(triangularCounterCcy, counterCurrency)); if (rateCounter1.isPresent() && rateCounter2.isPresent()) { return rateCounter1.get().crossRate(rateCounter2.get()).fxRate(baseCurrency, counterCurrency); } if (rateBase1.isPresent() && rateCounter2.isPresent()) { Optional<FxRate> rateTriangular2 = marketData.findValue(FxRateKey.of(triangularBaseCcy, triangularCounterCcy)); if (rateTriangular2.isPresent()) { return rateBase1.get().crossRate(rateTriangular2.get()).crossRate(rateCounter2.get()) .fxRate(baseCurrency, counterCurrency); } } throw new IllegalArgumentException("No market data available for pair " + baseCurrency + "/" + counterCurrency); }
Source:
public void executeAsExample(CommandCall commandCall, Evaluator evaluator, ResultRecorder resultRecorder) { executeCommand.announceBeforeExample(exampleName, detailRow.getElement(), resultRecorder); if (detailRow.getCells().length != tableSupport.getColumnCount()) { throw new RuntimeException("The <table> 'execute' command only supports rows with an equal number of columns."); } System.err.println(evaluator.evaluate("getCounter()")); tableExecuteCommand.setElement(detailRow.getElement()); tableSupport.copyCommandCallsTo(detailRow); tableExecuteCommand.execute(evaluator, resultRecorder); executeCommand.announceAfterExample(exampleName, detailRow.getElement(), resultRecorder); }

Target:
public void executeAsExample(CommandCall commandCall, Evaluator evaluator, ResultRecorder resultRecorder) { executeCommand.announceBeforeExample(exampleName, detailRow.getElement(), resultRecorder); if (detailRow.getCells().length != tableSupport.getColumnCount()) { throw new RuntimeException("The <table> 'execute' command only supports rows with an equal number of columns."); } tableExecuteCommand.setElement(detailRow.getElement()); tableSupport.copyCommandCallsTo(detailRow); ExampleCommand.setupCommandForExample(tableExecuteCommand, resultRecorder, exampleName); tableExecuteCommand.execute(evaluator, resultRecorder); executeCommand.announceAfterExample(exampleName, detailRow.getElement(), resultRecorder); }
Source:
public void injectDependencies(@ComponentName(KnownComponentNames.PERSISTENCE_MARSHALLER) PersistenceMarshaller persistenceMarshaller, @ComponentName(KnownComponentNames.CACHE_NAME) String cacheName, InternalCacheRegistry icr, GlobalConfiguration gcr, EncoderRegistry encoderRegistry, Configuration configuration) { if (this.encoder != null && this.wrapper != null) { return; } boolean internalCache = icr.isInternalCache(cacheName); boolean embeddedMode = Configurations.isEmbeddedMode(gcr); this.storageMediaType = getStorageMediaType(configuration, embeddedMode, internalCache, persistenceMarshaller); lookupEncoder(encoderRegistry); this.wrapper = encoderRegistry.getWrapper(wrapperClass, wrapperId); this.lookupTranscoder(encoderRegistry); }

Target:
public void injectDependencies(@ComponentName(KnownComponentNames.PERSISTENCE_MARSHALLER) PersistenceMarshaller persistenceMarshaller, @ComponentName(KnownComponentNames.CACHE_NAME) String cacheName, InternalCacheRegistry icr, GlobalConfiguration gcr, EncoderRegistry encoderRegistry, Configuration configuration) { this.encoderRegistry = encoderRegistry; if (this.encoder != null && this.wrapper != null) { return; } boolean internalCache = icr.isInternalCache(cacheName); boolean embeddedMode = Configurations.isEmbeddedMode(gcr); this.storageMediaType = getStorageMediaType(configuration, embeddedMode, internalCache, persistenceMarshaller); lookupEncoder(encoderRegistry); this.lookupWrapper(); this.lookupTranscoder(); }
Source:
private static ParameterizedSABRModelDiscreteVolatilityFunctionProvider getDiscreteVolatilityFunctionProvider( MultiCapFloorPricer pricer, DoublesVectorFunctionProvider[] smileModelParameterProviders) { ArgumentChecker.notNull(pricer, "pricer"); ArgumentChecker.noNulls(smileModelParameterProviders, "smileModelParameterProviders"); ArgumentChecker.isTrue(NUM_MODEL_PARMS == smileModelParameterProviders.length, "Require smileModelParameterProviders", NUM_MODEL_PARMS); ForwardCurve fwdCurve = new ForwardCurve(InterpolatedDoublesCurve.from(pricer.getCapletExpiries(), pricer .getCapletForwardRates(), CombinedInterpolatorExtrapolatorFactory.getInterpolator(Interpolator1DFactory.LINEAR, Interpolator1DFactory.FLAT_EXTRAPOLATOR))); return new ParameterizedSABRModelDiscreteVolatilityFunctionProvider(fwdCurve, smileModelParameterProviders); }

Target:
private static ParameterizedSABRModelDiscreteVolatilityFunctionProvider getDiscreteVolatilityFunctionProvider(MultiCapFloorPricer pricer, DoublesVectorFunctionProvider[] smileModelParameterProviders) { ArgumentChecker.notNull(pricer, "pricer"); ArgumentChecker.noNulls(smileModelParameterProviders, "smileModelParameterProviders"); ArgumentChecker.isTrue(NUM_MODEL_PARMS == smileModelParameterProviders.length, "Require smileModelParameterProviders", NUM_MODEL_PARMS); ForwardCurve fwdCurve = new ForwardCurve(InterpolatedDoublesCurve.from(pricer.getCapletExpiries(), pricer.getCapletForwardRates(), CombinedInterpolatorExtrapolatorFactory.getInterpolator(Interpolator1DFactory.LINEAR, Interpolator1DFactory.LINEAR_EXTRAPOLATOR))); return new ParameterizedSABRModelDiscreteVolatilityFunctionProvider(fwdCurve, smileModelParameterProviders); }
Source:
public static void changeCurrentNum(boolean increase) { boolean loopedOnce = false; if (increase) { currentNum++; } else { currentNum--; } if (currentNum < 0 && usedNums.size() > 0) { currentNum = Collections.max(usedNums); } while (!usedNums.contains(currentNum) && usedNums.size()>0) { if (increase) { currentNum++; } else { currentNum--; } if (currentNum > maxNum) { if (!loopedOnce) { currentNum = 0; loopedOnce = true; } else { break; } } else if (currentNum < 0) { currentNum = Collections.max(usedNums); loopedOnce = true; } } }

Target:
public static void changeCurrentNum(boolean increase) { boolean loopedOnce = false; boolean adjusted = false; while ((!adjusted || !usedNums.contains(currentNum)) && usedNums.size()>0) { adjusted = true; if (increase) { currentNum++; } else { currentNum--; } if (currentNum > maxNum) { if (!loopedOnce) { currentNum = 0; loopedOnce = true; } else { break; } } else if (currentNum < 0) { currentNum = Collections.max(usedNums); loopedOnce = true; } } }
Source:
private void addChapters(List<Chapter> chapterList) { Collections.sort(chapterList, mLocationComparator); mChapterForCityName.clear(); mChapterForCityName.addAll(chapterList); autoCompleteSpinnerView.setAdapter(mChapterForCityName); if (mSelectedChapter != null) { int pos = mChapterForCityName.getPosition(mSelectedChapter); autoCompleteSpinnerView.setSelection(pos); } else { if (chapterList.size() > 0) { mSelectedChapter = chapterList.get(0); } } if (mSelectedChapter != null) { autoCompleteSpinnerView.setText(mSelectedChapter.toString(), true); } }

Target:
private void addChapters(List<Chapter> chapterList) { Collections.sort(chapterList, mLocationComparator); mChapterAdapter.clear(); mChapterAdapter.addAll(chapterList); autoCompleteSpinnerView.setAdapter(mChapterAdapter); if (mSelectedChapter == null) { if (App.getInstance().getLastLocation() != null && chapterList.size() > 0) { mSelectedChapter = chapterList.get(0); } } if (mSelectedChapter != null) { autoCompleteSpinnerView.setText(mSelectedChapter.toString(), true); } else { autoCompleteSpinnerView.showDropDown(); } }
Source:
public void addUserComment(String customComment) { if (CommonUtils.isBlank(customComment)) { return; } if (hasComment()) { comment.append("\n\n"); } if (preserveFormatting) { comment.append(String.format("\n%s\n", customComment)); } else { comment.append(String.format("```\n%s\n```\n\n", customComment)); } }

Target:
public void addUserComment(String customComment) { if (CommonUtils.isBlank(customComment)) { return; } if (hasComment()) { comment.append("\n\n"); } if (preserveFormatting) { comment.append(String.format("%s\n", customComment)); } else { comment.append(String.format("```\n%s\n```\n\n", customComment)); } }
Source:
public void run() { final Properties producerConfig = new Properties(); producerConfig.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, CLUSTER.bootstrapServers()); producerConfig.put(ProducerConfig.ACKS_CONFIG, "all"); producerConfig.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class); producerConfig.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class); try (final KafkaProducer<String, String> producer = new KafkaProducer<>(producerConfig, new StringSerializer(), new StringSerializer())) { while (getCurrIteration() < numIterations && !shutdown) { for (final String value : inputValues) { producer.send(new ProducerRecord<>(topic, value)); } incrementIteration(); } producer.flush(); } }

Target:
public void run() { final Properties producerConfig = new Properties(); producerConfig.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, CLUSTER.bootstrapServers()); producerConfig.put(ProducerConfig.ACKS_CONFIG, "all"); producerConfig.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class); producerConfig.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class); try (final KafkaProducer<String, String> producer = new KafkaProducer<>(producerConfig, new StringSerializer(), new StringSerializer())) { while (getCurrIteration() < numIterations && !shutdown) { for (final String value : inputValues) { producer.send(new ProducerRecord<>(topic, value)); } incrementIteration(); } } }
Source:
private SentimentConfidenceScores toSentimentConfidenceScores( AspectConfidenceScoreLabel aspectConfidenceScoreLabel) { return new SentimentConfidenceScores(aspectConfidenceScoreLabel.getNegative(), 0, aspectConfidenceScoreLabel.getPositive()); }

Target:
private SentimentConfidenceScores toSentimentConfidenceScores( AspectConfidenceScoreLabel aspectConfidenceScoreLabel) { return new SentimentConfidenceScores(aspectConfidenceScoreLabel.getNegative(), NEUTRAL_SCORE_ZERO, aspectConfidenceScoreLabel.getPositive()); }
Source:
public String getSyncObjType() { if (getSyncObjId() != null) { return BaseAsyncCmd.migrationSyncObject; } return null; }

Target:
public String getSyncObjType() { return (getSyncObjId() != null) ? BaseAsyncCmd.migrationSyncObject : null; }
Source:
public void review(PendingCertifiedProductDTO listing) { boolean foundSedCriteria = false; boolean attestsToSed = false; for (PendingCertificationResultDTO cert : listing.getCertificationCriterion()) { if (cert.getMeetsCriteria().booleanValue()) { if (cert.getSed() != null && cert.getSed().booleanValue()) { foundSedCriteria = true; } if (cert.getNumber().equalsIgnoreCase(G3_2014)) { attestsToSed = true; } } } if (foundSedCriteria && !attestsToSed) { listing.getErrorMessages().add( msgUtil.getMessage("listing.criteria.foundSedCriteriaWithoutAttestingSed")); } if (!foundSedCriteria && attestsToSed && listing.getIcs() == Boolean.FALSE) { listing.getErrorMessages().add( msgUtil.getMessage("listing.criteria.foundNoSedCriteriaButAttestingSed")); } }

Target:
public void review(PendingCertifiedProductDTO listing) { boolean foundSedCriteria = false; boolean attestsToSed = false; for (PendingCertificationResultDTO cert : listing.getCertificationCriterion()) { if (cert.getMeetsCriteria().booleanValue()) { if (cert.getSed() != null && cert.getSed().booleanValue()) { foundSedCriteria = true; } if (cert.getNumber().equalsIgnoreCase(G3_2014)) { attestsToSed = true; } } } if (foundSedCriteria && !attestsToSed) { listing.getErrorMessages().add( msgUtil.getMessage("listing.criteria.foundSedCriteriaWithoutAttestingSed")); } if (!foundSedCriteria && attestsToSed && !listing.getIcs()) { listing.getErrorMessages().add( msgUtil.getMessage("listing.criteria.foundNoSedCriteriaButAttestingSed")); } }
Source:
public static void main(String[] args) throws InterruptedException { System.out.println(); System.out.println(">>> Logistic regression model over partitioned dataset usage example started."); try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) { System.out.println(">>> Ignite grid started."); IgniteCache<Integer, double[]> dataCache = new TestCache(ignite).fillCacheWith(data); System.out.println(">>> Create new logistic regression trainer object."); LogisticRegressionSGDTrainer<?> trainer = new LogisticRegressionSGDTrainer<>() .withUpdatesStgy(new UpdatesStrategy<>( new SimpleGDUpdateCalculator(0.2), SimpleGDParameterUpdate::sumLocal, SimpleGDParameterUpdate::avg )) .withMaxIterations(100000) .withLocIterations(100) .withBatchSize(10) .withSeed(123L); System.out.println(">>> Perform the training to get the model."); DatasetTrainer< ModelsComposition, Double> baggedTrainer = TrainerTransformers.makeBagged( trainer, 10, 0.6, 4, 3, new OnMajorityPredictionsAggregator()); double[] score = new CrossValidation<ModelsComposition, Double, Integer, double[]>().score( baggedTrainer, new Accuracy<>(), ignite, dataCache, (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)), (k, v) -> v[0], 3 ); System.out.println(">>> ---------------------------------"); Arrays.stream(score).forEach(sc -> { System.out.println("\n>>> Accuracy " + sc); }); System.out.println(">>> Begged logistic regression model over partitioned dataset usage example completed."); } }

Target:
public static void main(String[] args) throws FileNotFoundException { System.out.println(); System.out.println(">>> Logistic regression model over partitioned dataset usage example started."); try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) { System.out.println(">>> Ignite grid started."); IgniteCache<Integer, Vector> dataCache = new SandboxMLCache(ignite) .fillCacheWith(MLSandboxDatasets.TWO_CLASSED_IRIS); System.out.println(">>> Create new logistic regression trainer object."); LogisticRegressionSGDTrainer<?> trainer = new LogisticRegressionSGDTrainer<>() .withUpdatesStgy(new UpdatesStrategy<>( new SimpleGDUpdateCalculator(0.2), SimpleGDParameterUpdate::sumLocal, SimpleGDParameterUpdate::avg )) .withMaxIterations(100000) .withLocIterations(100) .withBatchSize(10) .withSeed(123L); System.out.println(">>> Perform the training to get the model."); DatasetTrainer< ModelsComposition, Double> baggedTrainer = TrainerTransformers.makeBagged( trainer, 10, 0.6, 4, 3, new OnMajorityPredictionsAggregator(), 123L); System.out.println(">>> Perform evaluation of the model."); double[] score = new CrossValidation<ModelsComposition, Double, Integer, Vector>().score( baggedTrainer, new Accuracy<>(), ignite, dataCache, (k, v) -> v.copyOfRange(1, v.size()), (k, v) -> v.get(0), 3 ); System.out.println(">>> ---------------------------------"); Arrays.stream(score).forEach(sc -> { System.out.println("\n>>> Accuracy " + sc); }); System.out.println(">>> Bagged logistic regression model over partitioned dataset usage example completed."); } }
Source:
private void postBulkUpdate(String index, List<Entry> entries) { try (RestClient restClient = RestClient.builder(new HttpHost(hostname, port, "http")).build()) { String newlineDJSON = getNDJSON(entries); String endpoint = "/" + index + "/_doc/_bulk"; HttpEntity bulkEntity = new NStringEntity(newlineDJSON, ContentType.APPLICATION_JSON); Response post = restClient.performRequest("POST", endpoint, Collections.emptyMap(), bulkEntity); if (post.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { throw new CustomWebApplicationException("Could not submit tools index to elastic search", HttpStatus.SC_INTERNAL_SERVER_ERROR); } } catch (IOException e) { LOGGER.error("Could not submit " + index + " index to elastic search. " + e.getMessage(), e); } }

Target:
private void postBulkUpdate(String index, List<Entry> entries) { try (RestClient restClient = RestClient.builder(new HttpHost(hostname, port, "http")).build()) { String newlineDJSON = getNDJSON(entries); String endpoint = "/" + index + "/_doc/_bulk"; HttpEntity bulkEntity = new NStringEntity(newlineDJSON, ContentType.APPLICATION_JSON); Response post = restClient.performRequest("POST", endpoint, Collections.emptyMap(), bulkEntity); if (post.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { throw new CustomWebApplicationException("Could not submit " + index + " index to elastic search", HttpStatus.SC_INTERNAL_SERVER_ERROR); } } catch (IOException e) { LOGGER.error("Could not submit " + index + " index to elastic search. " + e.getMessage(), e); } }
Source:
static void checkK(final int k) { if ((k < MIN_K) || (k > MAX_K) || !isPowerOf2(k)) { throw new SketchesArgumentException( "K must be >= " + MIN_K + " and <= " + MAX_K + " and a power of 2: " + k); } }

Target:
static void checkK(final int k) { if ((k < MIN_K) || (k > MAX_K)) { throw new SketchesArgumentException( "K must be >= " + MIN_K + " and <= " + MAX_K + ": " + k); } }
Source:
public String toString() { final String TEST_SUCCEEDED = "Test Succeeded, "; final String TEST_FAILED = "Test Failed: "; return getIsSucceeded() ? TEST_SUCCEEDED + getStatus() : TEST_FAILED + getMessage(); }

Target:
public String toString() { final String TEST_SUCCEEDED = "Test Succeeded, "; final String TEST_FAILED = "Test Failed, "; return getIsSucceeded() ? TEST_SUCCEEDED + getStatus() : TEST_FAILED + getMessage(); }
Source:
public void run() { JsonRpcRequest request = null; try { request = JsonRpcRequest.fromByteArray(message); ContextHolder.init(); if (client.getRetryPolicy().getIdentifier() != null){ ContextHolder.setServerName(client.getRetryPolicy().getIdentifier()); log.debug("client policy identifier {}", client.getRetryPolicy().getIdentifier()); }else{ ContextHolder.setServerName(Integer.toString(client.hashCode())); log.error("client identifier were not found, using hash"); } setReactorClient(client); ResponseBuilder builder = new ResponseBuilder(request.getId()); String methodName = request.getMethod(); builder = CommandFactory.createCommand(methodName).run(request.getParams(), builder); send(builder.build(), request.getMethod()); } catch (Throwable e) { log.error("Failure in processing request", e); Map<String, Object> error = new HashMap<>(); error.put("code", 100); error.put("message", e.getMessage()); if (request != null) { send(new ResponseBuilder(request.getId()).withError(error).build(), request.getMethod()); } } }

Target:
public void run() { JsonRpcRequest request = null; try { request = JsonRpcRequest.fromByteArray(message); ContextHolder.init(); if (client.getRetryPolicy().getIdentifier() != null){ ContextHolder.setServerName(client.getRetryPolicy().getIdentifier()); log.debug("client policy identifier {}", client.getRetryPolicy().getIdentifier()); }else{ ContextHolder.setServerName(Integer.toString(client.hashCode())); log.error("client identifier were not found, using hash"); } reactorClient = client; ResponseBuilder builder = new ResponseBuilder(request.getId()); String methodName = request.getMethod(); builder = CommandFactory.createCommand(methodName).run(request.getParams(), builder); send(builder.build(), request.getMethod()); } catch (Throwable e) { log.error("Failure in processing request", e); Map<String, Object> error = new HashMap<>(); error.put("code", 100); error.put("message", e.getMessage()); if (request != null) { send(new ResponseBuilder(request.getId()).withError(error).build(), request.getMethod()); } } }
Source:
public Response updateSenseBlackList(@Scope(OAuthScope.ADMINISTRATION_READ) final AccessToken accessToken, @Valid final Set<String> updatedSenseBlackList) { Jedis jedis = jedisPool.getResource(); final Pipeline pipe = jedis.pipelined(); pipe.multi(); try { pipe.rename(BlackListDevicesConfiguration.SENSE_BLACK_LIST_KEY, "old_sense_black_list"); for (final String senseId : updatedSenseBlackList){ pipe.sadd(BlackListDevicesConfiguration.SENSE_BLACK_LIST_KEY, senseId); } pipe.exec(); } catch (Exception e) { jedisPool.returnBrokenResource(jedis); throw new WebApplicationException(Response.status(Response.Status.INTERNAL_SERVER_ERROR) .entity(new JsonError(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), String.format("Failed to update sense black list because %s", e.getMessage()))).build()); } finally { jedisPool.returnResource(jedis); } return Response.noContent().build(); }

Target:
public Response updateSenseBlackList(@Scope(OAuthScope.ADMINISTRATION_READ) final AccessToken accessToken, @Valid final Set<String> updatedSenseBlackList) { Jedis jedis = null; try { jedis = jedisPool.getResource(); final Pipeline pipe = jedis.pipelined(); pipe.multi(); pipe.del(BlackListDevicesConfiguration.SENSE_BLACK_LIST_KEY); for (final String senseId : updatedSenseBlackList){ pipe.sadd(BlackListDevicesConfiguration.SENSE_BLACK_LIST_KEY, senseId); } pipe.exec(); } catch (JedisDataException e) { if (jedis != null) { jedisPool.returnBrokenResource(jedis); } throw new WebApplicationException(Response.status(Response.Status.INTERNAL_SERVER_ERROR) .entity(new JsonError(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), String.format("Failed to get data from redis - %s", e.getMessage()))).build()); } catch (Exception e) { if (jedis != null) { jedisPool.returnBrokenResource(jedis); } throw new WebApplicationException(Response.status(Response.Status.INTERNAL_SERVER_ERROR) .entity(new JsonError(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), String.format("Failed to update sense black list because %s", e.getMessage()))).build()); } finally { if (jedis != null) { jedisPool.returnResource(jedis); } } return Response.noContent().build(); }
Source:
private int getNumberOfTaskStarted(Policy currentPolicy, Map<JobId, JobDescriptor> jobMap, Set<String> freeResources, LinkedList<EligibleTaskDescriptor> fullListOfTaskRetrievedFromPolicy) { int numberOfTaskStarted = selectAndStartTasks(currentPolicy, jobMap, freeResources, fullListOfTaskRetrievedFromPolicy); if (freeResources.isEmpty()) { return numberOfTaskStarted; } if (activeObjectCreationRetryTimeNumber == 0) { return numberOfTaskStarted; } return numberOfTaskStarted; }

Target:
private int getNumberOfTaskStarted(Policy currentPolicy, Map<JobId, JobDescriptor> jobMap, Set<String> freeResources, LinkedList<EligibleTaskDescriptor> fullListOfTaskRetrievedFromPolicy) { return selectAndStartTasks(currentPolicy, jobMap, freeResources, fullListOfTaskRetrievedFromPolicy); }
Source:
public void testSamReaderFromMalformedSeekableStream() throws IOException { final File samFile = new File(TEST_DATA_DIR, "cram_with_bai_index.cram.bai"); final SamReaderFactory factory = SamReaderFactory.makeDefault() .validationStringency(ValidationStringency.SILENT); final SamReader reader = factory.open( SamInputResource.of(new SeekableFileStream(samFile))); Assert.assertEquals(countRecords(reader), 10); }

Target:
public void testSamReaderFromMalformedSeekableStream() throws IOException { final File samFile = new File(TEST_DATA_DIR, "cram_with_bai_index.cram.bai"); final SamReaderFactory factory = SamReaderFactory.makeDefault() .validationStringency(ValidationStringency.SILENT); final SamReader reader = factory.open( SamInputResource.of(new SeekableFileStream(samFile))); countRecords(reader); }
Source:
public Collection<CommandNode<CommandSource>> getUnsortedChildren() { return this.childNodes; }

Target:
public Collection<CommandNode<CommandSource>> getUnsortedChildren() { return this.nodeHolder.getChildren(); }
Source:
public boolean isLeafVolType(Guid storagePoolId, Guid storageDomainId, Guid imageGroupId, Guid imageId) { DiskImage dbImage = getSnapshotLeaf(imageGroupId); DiskImage vdsmImage = getVolumeInfoFromVdsm(storagePoolId, storageDomainId, imageGroupId, imageId); return dbImage.getId().equals(vdsmImage.getId()) ? VolType.LEAF == vdsmImage.getVolType() : true; }

Target:
public boolean isLeafVolType(Guid storagePoolId, Guid storageDomainId, Guid imageGroupId, Guid imageId) { DiskImage dbImage = getSnapshotLeaf(imageGroupId); DiskImage vdsmImage = getVolumeInfoFromVdsm(storagePoolId, storageDomainId, imageGroupId, imageId); return !dbImage.getId().equals(vdsmImage.getId()) || VolType.LEAF == vdsmImage.getVolType(); }
Source:
public Response prepareData(final List<PerfEnforceTableEncoding> tableList) throws PerfEnforceException, DbException, Exception { server.getPerfEnforceDriver().preparePSLA(tableList); return Response.noContent().build(); }

Target:
public Response prepareData(final List<PerfEnforceTableEncoding> tableList) throws PerfEnforceException, DbException, Exception { server.getPerfEnforceDriver().preparePSLA(tableList); return Response.status(201).build(); }
Source:
public void processAction(GameUserActionCode action, UserBean user, String gameId, Map<String, String> params) throws PlayException, GameException { log.debug("{} tries to perform action at game with id and additional params {}", user, action, gameId, params); validateUserNotEmpty(user); GameBean game = gameUtil.getGameById(gameId, ERROR_CODE_ERROR); GameUserBean gameUser = gameUtil.getGameUserJoinedToGame(user, game); validateGameStatusIsPlaying(game); validateActionIsAllowedForUser(gameUser, action); doAction(action, user, game, params); playUtil.takeResources(game.getStage(), gameUser.getResources(), action); playUtil.updateVictoryPoints(gameUser); playUtil.finishGameIfTargetVictoryPointsReached(gameUser, game); playUtil.updateAvailableActionsForAllUsers(game); gameDao.updateGame(game); log.debug("User successfully performed action {}", user.getUsername(), action); }

Target:
public Map<String, String> processAction(GameUserActionCode action, UserBean user, String gameId, Map<String, String> params) throws PlayException, GameException { log.debug("{} tries to perform action at game with id and additional params {}", user, action, gameId, params); Map<String, String> returnedParams = new HashMap<String, String>(); validateUserNotEmpty(user); GameBean game = gameUtil.getGameById(gameId, ERROR_CODE_ERROR); GameUserBean gameUser = gameUtil.getGameUserJoinedToGame(user, game); validateGameStatusIsPlaying(game); validateActionIsAllowedForUser(gameUser, action); doAction(action, user, gameUser, game, params, returnedParams); playUtil.updateVictoryPoints(gameUser); playUtil.finishGameIfTargetVictoryPointsReached(gameUser, game); playUtil.updateAvailableActionsForAllUsers(game); gameDao.updateGame(game); log.debug("User successfully performed action {}", user.getUsername(), action); return returnedParams; }
Source:
public void shouldRemoveConceptDescriptionIfEmptyStringFromUI() throws Exception { ConceptService cs = Context.getConceptService(); Concept concept = cs.getConcept(3); assertNotNull(concept); assertNotNull(concept.getDescription()); ConceptFormController conceptFormController = (ConceptFormController) applicationContext.getBean("conceptForm"); MockHttpServletRequest mockRequest = new MockHttpServletRequest(); MockHttpServletResponse response = new MockHttpServletResponse(); mockRequest.setMethod("POST"); mockRequest.setParameter("action", ""); mockRequest.setParameter("conceptId", concept.getConceptId().toString()); mockRequest.setParameter("descriptionsByLocale[en].description", " "); ModelAndView mav = conceptFormController.handleRequest(mockRequest, response); assertNotNull(mav); assertTrue(mav.getModel().isEmpty()); updateSearchIndex(); Concept actualConcept = cs.getConcept(3); assertNotNull(actualConcept); assertNull(concept.getDescription()); }

Target:
public void shouldRemoveConceptDescriptionIfEmptyStringFromUI() throws Exception { ConceptService cs = Context.getConceptService(); Concept concept = cs.getConcept(3); assertNotNull(concept); assertNotNull(concept.getDescription()); ConceptFormController conceptFormController = (ConceptFormController) applicationContext.getBean("conceptForm"); MockHttpServletRequest mockRequest = new MockHttpServletRequest(); MockHttpServletResponse response = new MockHttpServletResponse(); mockRequest.setMethod("POST"); mockRequest.setParameter("action", ""); mockRequest.setParameter("conceptId", concept.getConceptId().toString()); mockRequest.setParameter("descriptionsByLocale[en].description", " "); ModelAndView mav = conceptFormController.handleRequest(mockRequest, response); assertNotNull(mav); assertTrue(mav.getModel().isEmpty()); Concept actualConcept = cs.getConcept(3); assertNotNull(actualConcept); assertNull(concept.getDescription()); }
Source:
private ReadRowsRequest handleScanTimeout(ScanTimeoutException rte) throws IOException { logger.info("The client could not get a response in %d ms. Retrying the scan.", retryOptions.getReadPartialRowTimeoutMillis()); currentErrorBackoff = null; if (timeoutRetryCount == null) { timeoutRetryCount = new AtomicInteger(); } if (retryOptions.enableRetries() && timeoutRetryCount.incrementAndGet() <= retryOptions.getMaxScanTimeoutRetries()) { return requestManager.getUpdatedRequest(); } else { rpcMetrics.markRetriesExhasted(); throw new BigtableRetriesExhaustedException( "Exhausted streaming retries after too many timeouts", rte); } }

Target:
private ReadRowsRequest handleScanTimeout(ScanTimeoutException rte) throws IOException { logger.info("The client could not get a response in %d ms. Retrying the scan.", retryOptions.getReadPartialRowTimeoutMillis()); currentErrorBackoff = null; if (retryOptions.enableRetries() && ++timeoutRetryCount <= retryOptions.getMaxScanTimeoutRetries()) { return requestManager.buildUpdatedRequest(); } else { rpcMetrics.markRetriesExhasted(); throw new BigtableRetriesExhaustedException( "Exhausted streaming retries after too many timeouts", rte); } }
Source:
public void start() { if (MySql.ID.equals(database.getDialect().getId())) { throw new IllegalStateException("When cluster is activater, the MySQL database is not supported"); } }

Target:
public void start() { if (MySql.ID.equals(database.getDialect().getId())) { throw new IllegalStateException("MySQL is not supported for Data Center Edition. Please connect to a supported database: Oracle, PostgreSQL, Microsoft SQL Server."); } }
Source:
public Ec2EurekaArchaius2InstanceConfig(Config config, AmazonInfoConfig amazonInfoConfig, String namespace) { super(config, namespace); this.amazonInfoConfig = amazonInfoConfig; try { this.amazonInfo = AmazonInfo.Builder .newBuilder() .withAmazonInfoConfig(amazonInfoConfig) .autoBuild(namespace); LOG.info("Datacenter is: " + Name.Amazon); } catch (Exception e) { LOG.error("Cannot initialize amazon info :", e); throw new RuntimeException(e); } if (amazonInfo.get(MetaDataKey.instanceId) == null) { if (config.getBoolean(namespace + ".validateInstanceId", true)) { throw new RuntimeException( "Your datacenter is defined as cloud but we are not able to get the amazon metadata to " + "register. \nSet the property 'eureka.validateInstanceId' to false to ignore the" + "metadata call"); } else { Map<String, String> metadataMap = new HashMap<>(); metadataMap.put(MetaDataKey.instanceId.getName(), super.getIpAddress()); metadataMap.put(MetaDataKey.publicHostname.getName(), super.getHostName(false)); amazonInfo.setMetadata(metadataMap); } } else if ((amazonInfo.get(MetaDataKey.publicHostname) == null) && (amazonInfo.get(MetaDataKey.localIpv4) != null)) { amazonInfo.getMetadata().put(MetaDataKey.publicHostname.getName(), (amazonInfo.get(MetaDataKey.localIpv4))); } DiscoveryManager.getInstance().setEurekaInstanceConfig(this); }

Target:
public Ec2EurekaArchaius2InstanceConfig(Config config, AmazonInfoConfig amazonInfoConfig, String namespace) { super(config, namespace); this.amazonInfoConfig = amazonInfoConfig; try { this.amazonInfo = AmazonInfo.Builder .newBuilder() .withAmazonInfoConfig(amazonInfoConfig) .autoBuild(namespace); LOG.info("Datacenter is: " + Name.Amazon); } catch (Exception e) { LOG.error("Cannot initialize amazon info :", e); throw new RuntimeException(e); } if (amazonInfo.get(MetaDataKey.instanceId) == null) { if (config.getBoolean(namespace + ".validateInstanceId", true)) { throw new RuntimeException( "Your datacenter is defined as cloud but we are not able to get the amazon metadata to " + "register. \nSet the property 'eureka.validateInstanceId' to false to ignore the" + "metadata call"); } else { Map<String, String> metadataMap = new HashMap<>(); metadataMap.put(MetaDataKey.instanceId.getName(), super.getIpAddress()); metadataMap.put(MetaDataKey.publicHostname.getName(), super.getHostName(false)); amazonInfo.setMetadata(metadataMap); } } else if ((amazonInfo.get(MetaDataKey.publicHostname) == null) && (amazonInfo.get(MetaDataKey.localIpv4) != null)) { amazonInfo.getMetadata().put(MetaDataKey.publicHostname.getName(), (amazonInfo.get(MetaDataKey.localIpv4))); } }
Source:
public void doShouldBeThreadsafe() { int threads = 50; ExecutorService service = Executors.newFixedThreadPool(threads); List<Callable<Boolean>> callables = new ArrayList<>(); for (int thread = 0; thread < threads; ++thread) { final int counter = thread; Callable<Boolean> booleanSupplier = () -> { String expectedName = "party like it's 199" + counter%12; String foundName = partyRepository.findByName(expectedName).get(0).getName(); System.out.println("expected = " + expectedName + " found = " + foundName); return expectedName.equals(foundName); }; callables.add(booleanSupplier); } try { List<Future<Boolean>> futures = service.invokeAll(callables); service.shutdown(); service.awaitTermination(5, TimeUnit.SECONDS); for (Future<Boolean> future: futures) { assertThat(future.get()).isTrue(); } } catch (InterruptedException | ExecutionException e) { fail("Threads failed to run " + e.getMessage()); } }

Target:
public void doShouldBeThreadsafe() { int threads = 50; ExecutorService service = Executors.newFixedThreadPool(threads); List<Callable<Boolean>> callables = new ArrayList<>(); for (int thread = 0; thread < threads; ++thread) { final int counter = thread; Callable<Boolean> booleanSupplier = () -> { String expectedName = "party like it's 199" + counter%12; String foundName = partyRepository.findByName(expectedName).get(0).getName(); return expectedName.equals(foundName); }; callables.add(booleanSupplier); } try { List<Future<Boolean>> futures = service.invokeAll(callables); service.shutdown(); service.awaitTermination(5, TimeUnit.SECONDS); for (Future<Boolean> future: futures) { assertThat(future.get()).isTrue(); } } catch (InterruptedException | ExecutionException e) { fail("Threads failed to run " + e.getMessage()); } }
Source:
public static void postAndWait(Handler handler, final Runnable r) { if (checkAccess(handler)) { try { r.run(); return; } catch (Exception e) { throw new RuntimeException(e); } } WaitableRunnable wrapper = new WaitableRunnable(r); if (!handler.post(wrapper)) { throw new RuntimeException("Handler.post() returned false"); } wrapper.join(); }

Target:
public static void postAndWait(Handler handler, final Runnable r) { if (checkThreadAccess(handler)) { try { r.run(); return; } catch (RuntimeException e) { throw new RuntimeException(e); } } WaitableRunnable<Void> wrapper = new WaitableRunnable<Void>() { @Override protected Void onRun() { r.run(); return null; } }; wrapper.invoke(handler); }
Source:
private List<SiriusServerPageDto> getPages(ModelingProject modelingProject, Session session) { return WorkflowHelper.on(session).getPageDescriptions().map(page -> { DAnalysis self = ((DAnalysisSessionImpl) session).allAnalyses().stream().findFirst().orElse(null); Map<String, Object> variables = new HashMap<>(); variables.put(SELF, self); IEvaluationResult result = new SiriusBackendInterpreter(session).evaluateExpression(variables, page.getTitleExpression()); String identifier = page.getName(); String name = result.asString(); return new SiriusServerPageDto(identifier, name); }).collect(Collectors.toList()); }

Target:
private List<SiriusServerPageDto> getPages(ModelingProject modelingProject, Session session) { return WorkflowHelper.on(session).getPageDescriptions().map(page -> { DAnalysis self = ((DAnalysisSession) session).allAnalyses().stream().findFirst().orElse(null); Map<String, Object> variables = new HashMap<>(); variables.put(SELF, self); IEvaluationResult result = new SiriusBackendInterpreter(session).evaluateExpression(variables, page.getTitleExpression()); String identifier = page.getName(); String name = result.asString(); return new SiriusServerPageDto(identifier, name); }).collect(Collectors.toList()); }
Source:
private String prepareQuery() { String query; if (ldapProviderType.equals(LdapProviderType.ipa)) { userName = userName.split("@")[0]; query = "(&(objectClass=posixAccount)(objectClass=krbPrincipalAux)(uid=" + userName + "))"; } else if (ldapProviderType.equals(LdapProviderType.rhds)) { userName = userName.split("@")[0]; query = "(&(objectClass=person)(uid=" + userName + "))"; } else if (ldapProviderType.equals(LdapProviderType.ibm)) { userName = userName.split("@")[0]; query = "(&(objectClass=person)(uid=" + userName + "))"; } else { StringBuilder queryBase = new StringBuilder("(&(sAMAccountType=805306368)("); if (userName.contains("@")) { queryBase.append("userPrincipalName=" + userName); } else { if (userName.length() > 20) { queryBase.append("userPrincipalName=") .append(userName) .append("@") .append(domainName.toUpperCase()); } else { queryBase.append("sAMAccountName=").append(userName); } } query = queryBase.append("))").toString(); } return query; }

Target:
private String prepareQuery() { String query; if (ldapProviderType.equals(LdapProviderType.ipa)) { userName = userName.split("@")[0]; query = "(&(objectClass=posixAccount)(objectClass=krbPrincipalAux)(uid=" + userName + "))"; } else if (ldapProviderType.equals(LdapProviderType.rhds)) { userName = userName.split("@")[0]; query = "(&(objectClass=person)(uid=" + userName + "))"; } else if (ldapProviderType.equals(LdapProviderType.itds)) { userName = userName.split("@")[0]; query = "(&(objectClass=person)(uid=" + userName + "))"; } else { StringBuilder queryBase = new StringBuilder("(&(sAMAccountType=805306368)("); if (userName.contains("@")) { queryBase.append("userPrincipalName=" + userName); } else { if (userName.length() > 20) { queryBase.append("userPrincipalName=") .append(userName) .append("@") .append(domainName.toUpperCase()); } else { queryBase.append("sAMAccountName=").append(userName); } } query = queryBase.append("))").toString(); } return query; }
Source:
public void testCreateAndPublishHttpRedirect() throws Exception { Thread.sleep(3000); Job job = api().scheduleCreate(redirect); assertEquals(job.getStatus(), Status.SUCCESS); assertEquals(api.getJob(job.getId()), job); Zone zone = api.getZoneApi().publish(fqdn); checkZone(zone); getAndVerifyRedirect(redirectName, 302, "Y", "<LINK_0>"); }

Target:
public void testCreateAndPublishHttpRedirect() throws Exception { Thread.sleep(dynectApiDelay); Job job = api().scheduleCreate(redirect); assertEquals(job.getStatus(), Status.SUCCESS); assertEquals(api.getJob(job.getId()), job); Zone zone = api.getZoneApi().publish(fqdn); checkZone(zone); getAndVerifyRedirect(redirectName, 302, "Y", "<LINK_0>"); }
Source:
public void onMapReady(final MapboxMap mapboxMap) { localizationPlugin = new LocalizationPlugin(mapView, mapboxMap); findViewById(R.id.language_one_cardview).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { localizationPlugin.setMapLanguage(MapLocale.ARABIC); } }); findViewById(R.id.language_two_cardview).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { localizationPlugin.setMapLanguage(MapLocale.RUSSIAN); } }); findViewById(R.id.language_three_cardview).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { localizationPlugin.setMapLanguage(MapLocale.SIMPLIFIED_CHINESE); } }); findViewById(R.id.match_map_to_device_language).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, R.string.change_device_language_instruction, Snackbar.LENGTH_LONG).show(); try { localizationPlugin.matchMapLanguageWithDeviceDefault(); CameraPosition position = new CameraPosition.Builder() .target(new LatLng(34.032666, -80.363160)) .zoom(2.038777) .build(); mapboxMap.animateCamera(CameraUpdateFactory .newCameraPosition(position), 1000); } catch (NullPointerException exception) { Snackbar.make(view, exception.toString(), Snackbar.LENGTH_LONG).show(); } } }); }

Target:
public void onMapReady(final MapboxMap mapboxMap) { localizationPlugin = new LocalizationPlugin(mapView, mapboxMap); findViewById(R.id.language_one_cardview).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { localizationPlugin.setMapLanguage(MapLocale.ARABIC); } }); findViewById(R.id.language_two_cardview).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { localizationPlugin.setMapLanguage(MapLocale.RUSSIAN); } }); findViewById(R.id.language_three_cardview).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { localizationPlugin.setMapLanguage(MapLocale.SIMPLIFIED_CHINESE); } }); findViewById(R.id.match_map_to_device_language).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, R.string.change_device_language_instruction, Snackbar.LENGTH_LONG).show(); try { localizationPlugin.matchMapLanguageWithDeviceDefault(); CameraPosition position = new CameraPosition.Builder() .target(new LatLng(34.032666, -80.363160)) .zoom(2.038777) .build(); mapboxMap.animateCamera(CameraUpdateFactory .newCameraPosition(position), 1000); } catch (RuntimeException exception) { Snackbar.make(view, exception.toString(), Snackbar.LENGTH_LONG).show(); } } }); }
Source:
public String convert(final ThriftType type, final boolean ignored) { final String name = ((IdentifierType) type).getName(); if (name.indexOf('.') == -1) { final String javatypeName = TemplateContextGenerator.mangleJavatypeName(name); final ThriftType thriftType = typedefRegistry.findType(defaultNamespace, javatypeName); if (thriftType == null) { final SwiftJavaType javaType = typeRegistry.findType(defaultNamespace, javatypeName); return (javaType == null) ? null : javaType.getSimpleName(); } else { return convertType(thriftType); } } else { final ThriftType thriftType = typedefRegistry.findType(name); if (thriftType == null) { final SwiftJavaType javaType = typeRegistry.findType(name); return (javaType == null) ? null : javaType.getClassName(); } else { return convertType(thriftType); } } }

Target:
public String convert(final ThriftType type, final boolean ignored) { final String name = ((IdentifierType) type).getName(); final String names = StringUtils.split(name, '.'); Preconditions.checkState(names.length > 0 && names.length < 3, "only unqualified and thrift-namespace qualified names are allowed!"); String thriftName = names[0]; String thriftNamespace = namespace; if (names.length == 2) { thriftName = names[1]; thriftNamespace = names[0]; } final String javatypeName = thriftNamespace + "." + TemplateContextGenerator.mangleJavatypeName(thriftName); final ThriftType thriftType = typedefRegistry.findType(javatypeName); if (thriftType == null) { final SwiftJavaType javaType = typeRegistry.findType(javatypeName); return (javaType == null) ? null : javaType.getSimpleName(); } else { return convertType(thriftType); } }
Source:
public void testValidateCodeFoundByCodeWithoutUrl() throws Exception { Parameters inParams = new Parameters(); inParams.addParameter().setName("code").setValue(new CodeType("8452-5")); try { myClient.operation().onType(CodeSystem.class).named("validate-code").withParameters(inParams).execute(); } catch (InvalidRequestException e) { assertEquals("HTTP 400 Bad Request: Either CodeSystem ID or CodeSystem identifier must be provided. Unable to validate.",e.getMessage()); } }

Target:
public void testValidateCodeFoundByCodeWithoutUrl() throws Exception { Parameters inParams = new Parameters(); inParams.addParameter().setName("code").setValue(new CodeType("8452-5")); try { myClient.operation().onType(CodeSystem.class).named("validate-code").withParameters(inParams).execute(); fail(); } catch (InvalidRequestException e) { assertEquals("HTTP 400 Bad Request: Either CodeSystem ID or CodeSystem identifier must be provided. Unable to validate.",e.getMessage()); } }