auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void install() { if(Strings.isNonBlank(getEntity().getConfig(VanillaWindowsProcess.INSTALL_COMMAND)) || Strings.isNonBlank(getEntity().getConfig(VanillaWindowsProcess.INSTALL_POWERSHELL_COMMAND))) { executeCommand(VanillaWindowsProcess.INSTALL_COMMAND, VanillaWindowsProcess.INSTALL_POWERSHELL_COMMAND, true); if (entity.getConfig(VanillaWindowsProcess.INSTALL_REBOOT_REQUIRED)) { rebootAndWait(); } } }

Target:
public void install() { if(Strings.isNonBlank(getEntity().getConfig(VanillaWindowsProcess.INSTALL_COMMAND)) || Strings.isNonBlank(getEntity().getConfig(VanillaWindowsProcess.INSTALL_POWERSHELL_COMMAND))) { executeCommand(VanillaWindowsProcess.INSTALL_COMMAND, VanillaWindowsProcess.INSTALL_POWERSHELL_COMMAND, true); } if (entity.getConfig(VanillaWindowsProcess.INSTALL_REBOOT_REQUIRED)) { rebootAndWait(); } }
Source:
public Optional<BasicAuthUser> authenticate(BasicCredentials basicCredentials) { return gatewayAccountDao.findByNotificationCredentialsUsername(basicCredentials.getUsername()) .filter((gatewayAccountEntity) -> matchCredentials(basicCredentials, gatewayAccountEntity)) .map(gatewayAccountEntity -> Optional.ofNullable(gatewayAccountEntity.getNotificationCredentials().toBasicAuthUser())) .orElseGet(() -> { LOGGER.info(format("Authentication failure: failed for smartpay username %s", basicCredentials)); return Optional.empty(); }); }

Target:
public Optional<BasicAuthUser> authenticate(BasicCredentials basicCredentials) { return gatewayAccountDao.findByNotificationCredentialsUsername(basicCredentials.getUsername()) .filter((gatewayAccountEntity) -> matchCredentials(basicCredentials, gatewayAccountEntity)) .map(gatewayAccountEntity -> Optional.ofNullable(gatewayAccountEntity.getNotificationCredentials().toBasicAuthUser())) .orElseGet(() -> { LOGGER.warn(format("Authentication failure: failed for smartpay username %s", basicCredentials)); return Optional.empty(); }); }
Source:
private void help() { if (welcomeService != null) { welcomeService.displayWelcome(); return; } if (appService != null && textService != null) { final File baseDir = appService.getApp().getBaseDirectory(); final File welcomeFile = new File(baseDir, "WELCOME.md"); if (welcomeFile.exists()) try { final String welcomeText = textService.asHTML(welcomeFile); displayService.createDisplay(welcomeText); return; } catch (final IOException e) { if (log != null) { log.error(e); } else { e.printStackTrace(); } } } if (platformService != null && WELCOME_URL != null) { try { platformService.open(WELCOME_URL); return; } catch (final IOException e) { if (log != null) { log.error(e); } else { e.printStackTrace(); } } } final String message = "No appropriate service found to display the message"; if (uiService != null) { uiService.showDialog(message, MessageType.ERROR_MESSAGE); return; } if (log != null) { log.error(message); } else { System.err.println(message); } }

Target:
private void help() { if (welcomeService != null) { welcomeService.displayWelcome(); return; } if (appService != null && textService != null && displayService != null) { final File baseDir = appService.getApp().getBaseDirectory(); final File welcomeFile = new File(baseDir, "WELCOME.md"); if (welcomeFile.exists()) try { final String welcomeText = textService.asHTML(welcomeFile); displayService.createDisplay(welcomeText); return; } catch (final IOException e) { if (log != null) { log.error(e); } else { e.printStackTrace(); } } } if (platformService != null && WELCOME_URL != null) { try { platformService.open(WELCOME_URL); return; } catch (final IOException e) { if (log != null) { log.error(e); } else { e.printStackTrace(); } } } final String message = "No appropriate service found to display the message"; if (uiService != null) { uiService.showDialog(message, MessageType.ERROR_MESSAGE); return; } if (log != null) { log.error(message); } else { System.err.println(message); } }
Source:
public boolean install(IProgressMonitor progress) throws Exception { TaCoKitCar tckCar = getCar(); String[] carCmd = new String[] { "java", "-jar", "\"" + tckCar.getCarFile().getAbsolutePath() + "\"", "studio-deploy", "\"" + URIUtil.toFile(Platform.getInstallLocation().getURL().toURI()).getAbsolutePath() + "\"" }; Process exec = Runtime.getRuntime().exec(carCmd); while (exec.isAlive()) { Thread.sleep(100); TaCoKitUtil.checkMonitor(progress); } TaCoKitUtil.checkMonitor(progress); return exec.exitValue() == 0; }

Target:
public boolean install(IProgressMonitor progress) throws Exception { TaCoKitCar tckCar = getCar(); String[] carCmd = new String[] { new File(System.getProperty("java.home"), "bin/java" + (System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("win") ? ".exe" : "")) .getAbsolutePath(), "-jar", "\"" + tckCar.getCarFile().getAbsolutePath() + "\"", "studio-deploy", "\"" + URIUtil.toFile(Platform.getInstallLocation().getURL().toURI()).getAbsolutePath() + "\"" }; Process exec = Runtime.getRuntime().exec(carCmd); while (exec.isAlive()) { Thread.sleep(100); TaCoKitUtil.checkMonitor(progress); } TaCoKitUtil.checkMonitor(progress); return exec.exitValue() == 0; }
Source:
public static <E extends Throwable> void assertThrows(Class<E> exc, Runnable runnable) { try { runnable.run(); fail("Expected failure"); } catch (Throwable t) { assertTrue("Expected " + exc + ", " + t.getClass() + " thrown.", exc.isAssignableFrom(t.getClass())); } }

Target:
public static <E extends Throwable> void assertThrows(Class<E> exc, Runnable runnable) { try { runnable.run(); fail("Expected " + exc.getName() + " to be thrown but no exception thrown."); } catch (Throwable t) { if (!exc.isAssignableFrom(t.getClass())) { throw new AssertionError("Expected exception " + exc.getName() + " to be thrown but " + t.getClass().getName() + " was thrown.", t); } } }
Source:
private void getRowViewForLeaf(ViewHolder viewHolder, final SectionRow row) { final CourseComponent unit = row.component; viewHolder.rowType.setVisibility(View.VISIBLE); viewHolder.rowSubtitleIcon.setVisibility(View.GONE); viewHolder.rowSubtitle.setVisibility(View.GONE); viewHolder.rowSubtitlePanel.setVisibility(View.GONE); viewHolder.bulkDownload.setVisibility(View.INVISIBLE); viewHolder.rowTitle.setText(unit.getDisplayName()); if (row.component instanceof VideoBlockModel) { final DownloadEntry videoData = ((VideoBlockModel) row.component).getDownloadEntry(storage); if (null != videoData) { updateUIForVideo(viewHolder, videoData); return; } } if (unit.getType() == BlockType.DISCUSSION) { viewHolder.rowType.setIcon(FontAwesomeIcons.fa_comments_o); checkAccessStatus(viewHolder, unit); } else if (!unit.isMultiDevice()) { viewHolder.bulkDownload.setVisibility(View.INVISIBLE); viewHolder.rowType.setIcon(FontAwesomeIcons.fa_laptop); viewHolder.rowType.setIconColorResource(R.color.edx_grayscale_neutral_base); } else { viewHolder.bulkDownload.setVisibility(View.INVISIBLE); if (unit.getType() == BlockType.PROBLEM) { viewHolder.rowType.setIcon(FontAwesomeIcons.fa_list); } else { viewHolder.rowType.setIcon(FontAwesomeIcons.fa_file_o); } checkAccessStatus(viewHolder, unit); } }

Target:
private void getRowViewForLeaf(ViewHolder viewHolder, final SectionRow row) { final CourseComponent unit = row.component; viewHolder.rowType.setVisibility(View.VISIBLE); viewHolder.rowSubtitleIcon.setVisibility(View.GONE); viewHolder.rowSubtitle.setVisibility(View.GONE); viewHolder.rowSubtitlePanel.setVisibility(View.GONE); viewHolder.bulkDownload.setVisibility(View.INVISIBLE); viewHolder.rowTitle.setText(unit.getDisplayName()); if (row.component instanceof VideoBlockModel) { final DownloadEntry videoData = ((VideoBlockModel) row.component).getDownloadEntry(storage); if (null != videoData) { updateUIForVideo(viewHolder, videoData); return; } } if (row.component instanceof DiscussionBlockModel) { viewHolder.rowType.setIcon(FontAwesomeIcons.fa_comments_o); checkAccessStatus(viewHolder, unit); } else if (!unit.isMultiDevice()) { viewHolder.bulkDownload.setVisibility(View.INVISIBLE); viewHolder.rowType.setIcon(FontAwesomeIcons.fa_laptop); viewHolder.rowType.setIconColorResource(R.color.edx_grayscale_neutral_base); } else { viewHolder.bulkDownload.setVisibility(View.INVISIBLE); if (unit.getType() == BlockType.PROBLEM) { viewHolder.rowType.setIcon(FontAwesomeIcons.fa_list); } else { viewHolder.rowType.setIcon(FontAwesomeIcons.fa_file_o); } checkAccessStatus(viewHolder, unit); } }
Source:
public ZoneTemperatureControlDiscoveryService(BridgeHandler bridgeHandler, ThingTypeUID supportedThingType) throws IllegalArgumentException { super(Sets.newHashSet(supportedThingType), 10, true); BRIDGE_UID = bridgeHandler.getThing().getUID(); this.bridgeHandler = bridgeHandler; THING_TYPE_ID = supportedThingType.getId(); }

Target:
public ZoneTemperatureControlDiscoveryService(BridgeHandler bridgeHandler, ThingTypeUID supportedThingType) throws IllegalArgumentException { super(new HashSet<>(Arrays.asList(supportedThingType)), TIMEOUT, true); bridgeUID = bridgeHandler.getThing().getUID(); this.bridgeHandler = bridgeHandler; thingTypeID = supportedThingType.getId(); }
Source:
public void checkAttributeValue(PerunSessionImpl perunSession, Resource resource, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException { String key = (String) attribute.getValue(); if (key == null) { throw new WrongAttributeValueException(attribute, resource, "sshkey can't be empty"); } Pattern pattern = Pattern.compile("^(?!-)[-_.a-zA-Z0-9]+$"); Matcher match = pattern.matcher(key); if (!match.matches()) { throw new WrongAttributeValueException(attribute, resource, "Bad format of attribute sshkeysTargetUser (only letters, numbers and '.' '_' '-' are allowed. Cannot begin with '-')."); } }

Target:
public void checkAttributeValue(PerunSessionImpl perunSession, Resource resource, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException { String key = (String) attribute.getValue(); if (key == null) { throw new WrongAttributeValueException(attribute, resource, "Name of the user can't be empty"); } Matcher match = pattern.matcher(key); if (!match.matches()) { throw new WrongAttributeValueException(attribute, resource, "Bad format of attribute sshkeysTargetUser (only letters, numbers and '.' '_' '-' are allowed. Cannot begin with '-')."); } }
Source:
public AudioTrackScore(Format format, Parameters parameters, @Capabilities int formatSupport) { this.parameters = parameters; this.language = normalizeUndeterminedLanguageToNull(format.language); isWithinRendererCapabilities = isSupported(formatSupport, false); int bestLanguageScore = 0; for (int i = 0; i < parameters.preferredAudioLanguage.length; i++) { int score = getFormatLanguageScore( format, parameters.preferredAudioLanguage[i], false); score = 1000 * score + parameters.preferredAudioLanguage.length - i; bestLanguageScore = Math.max(bestLanguageScore, score); } preferredLanguageScore = bestLanguageScore; isDefaultSelectionFlag = (format.selectionFlags & C.SELECTION_FLAG_DEFAULT) != 0; channelCount = format.channelCount; sampleRate = format.sampleRate; bitrate = format.bitrate; isWithinConstraints = (format.bitrate == Format.NO_VALUE || format.bitrate <= parameters.maxAudioBitrate) && (format.channelCount == Format.NO_VALUE || format.channelCount <= parameters.maxAudioChannelCount); String[] localeLanguages = Util.getSystemLanguageCodes(); int bestMatchIndex = Integer.MAX_VALUE; int bestMatchScore = 0; for (int i = 0; i < localeLanguages.length; i++) { int score = getFormatLanguageScore( format, localeLanguages[i], false); if (score > 0) { bestMatchIndex = i; bestMatchScore = score; break; } } localeLanguageMatchIndex = bestMatchIndex; localeLanguageScore = bestMatchScore; }

Target:
public AudioTrackScore(Format format, Parameters parameters, @Capabilities int formatSupport) { this.parameters = parameters; this.language = normalizeUndeterminedLanguageToNull(format.language); isWithinRendererCapabilities = isSupported(formatSupport, false); int bestLanguageScore = 0; int bestLanguageIndex = 0; for (int i = 0; i < parameters.preferredAudioLanguages.size(); i++) { int score = getFormatLanguageScore( format, parameters.preferredAudioLanguages.get(i), false); if (score > 0) { bestLanguageIndex = i; bestLanguageScore = score; } } preferredLanguageIndex = bestLanguageIndex; preferredLanguageScore = bestLanguageScore; isDefaultSelectionFlag = (format.selectionFlags & C.SELECTION_FLAG_DEFAULT) != 0; channelCount = format.channelCount; sampleRate = format.sampleRate; bitrate = format.bitrate; isWithinConstraints = (format.bitrate == Format.NO_VALUE || format.bitrate <= parameters.maxAudioBitrate) && (format.channelCount == Format.NO_VALUE || format.channelCount <= parameters.maxAudioChannelCount); String[] localeLanguages = Util.getSystemLanguageCodes(); int bestMatchIndex = Integer.MAX_VALUE; int bestMatchScore = 0; for (int i = 0; i < localeLanguages.length; i++) { int score = getFormatLanguageScore( format, localeLanguages[i], false); if (score > 0) { bestMatchIndex = i; bestMatchScore = score; break; } } localeLanguageMatchIndex = bestMatchIndex; localeLanguageScore = bestMatchScore; }
Source:
private String checkParameters(String variantCoreString, String annotationVepVersion, String annotationVepCacheVersion, String species, String assembly) { if (!variantCoreString.contains(":")) { return "Please describe a variant as 'sequence:location:reference:alternate'"; } if (annotationVepVersion == null ^ annotationVepCacheVersion == null) { return "Please specify either both annotation VEP version and annotation VEP cache version, or neither"; } if (species.isEmpty()) { throw new IllegalArgumentException("Please specify a species"); } if (assembly.isEmpty()) { throw new IllegalArgumentException("Please specify an assembly"); } return null; }

Target:
private void checkParameters(String variantCoreString, String annotationVepVersion, String annotationVepCacheVersion, String species, String assembly) { String[] regionId = variantCoreString.split(":"); if (regionId.length != 4) { throw new IllegalArgumentException("Please describe a variant as 'sequence:location:reference:" + "alternate'"); } try { long position = Long.parseLong(regionId[1]); if (position < 0) { throw new IllegalArgumentException("Please provide a start position equals or greater than zero"); } } catch (NumberFormatException e) { throw new IllegalArgumentException("Please specify a valid integer start position"); } if (annotationVepVersion == null ^ annotationVepCacheVersion == null) { throw new IllegalArgumentException("Please specify either both annotation VEP version and annotation VEP" + " cache version, or neither"); } if (species.isEmpty()) { throw new IllegalArgumentException("Please specify a species"); } if (assembly.isEmpty()) { throw new IllegalArgumentException("Please specify an assembly"); } }
Source:
private void awaitFirstInvocation() throws InterruptedException { awaitInvocationCount( 0 ); }

Target:
private void awaitFirstInvocation() throws InterruptedException { awaitInvocationCount( 1 ); }
Source:
public void testExcludeByRegexInAList() { CSVSeries series = new CSVSeries("pct_sum1_web.csv", null, "EXCLUDE_BY_STRING", Arrays.asList("HTTP_[4,5]\\d{2}", "Hits", "Throughput", "RunId", "Trend Measurement Type"), false); List<PlotPoint> points = series.loadSeries(workspaceRootDir, 0, System.out); LOGGER.info("Got " + points.size() + " plot points"); testPlotPoints(points, 3); }

Target:
public void testExcludeByRegexInAList() { CSVSeries series = new CSVSeries("test_regex_webstatistics.csv", null, "EXCLUDE_BY_STRING", "\"HTTP_[4,5]\\d{2}\",\"Hits\",\"Throughput\",\"RunId\",\"Trend Measurement Type\"", false); List<PlotPoint> points = series.loadSeries(workspaceRootDir, 0, System.out); LOGGER.info("Got " + points.size() + " plot points"); testPlotPoints(points, 3); }
Source:
public void setProcessorConfig(Map<String, Pair<Properties, Set<String>>> config) { Map<String, Properties> configProcessed = new HashMap<>(); for (Entry<String, Pair<Properties, Set<String>>> e : config.entrySet()) { String targetName = e.getKey(); Properties properties = e.getValue().getFirst(); Set<String> tableNames = e.getValue().getSecond(); for (String tableName : tableNames) { tableName = tableName.toLowerCase(); assert(!m_targetsByTableName.containsKey(tableName)); m_targetsByTableName.put(tableName, targetName); } String exportClientClass = properties.getProperty(EXPORT_TO_TYPE); Preconditions.checkNotNull(exportClientClass, "export to type is undefined or custom export plugin class missing."); if(exportClientClass.equals("KafkaExportClient")) { properties.remove(KafkaExportClient.ENCODE_FORMAT); } try { final Class<?> clientClass = Class.forName(exportClientClass); ExportClientBase client = (ExportClientBase) clientClass.newInstance(); client.configure(properties); m_clientsByTarget.put(targetName, client); client.setTargetName(targetName); } catch(Throwable t) { throw new RuntimeException(t); } configProcessed.put(targetName, new Properties(properties)); } }

Target:
public void setProcessorConfig(Map<String, Pair<Properties, Set<String>>> config) { Map<String, Properties> configProcessed = new HashMap<>(); for (Entry<String, Pair<Properties, Set<String>>> e : config.entrySet()) { String targetName = e.getKey(); Properties properties = e.getValue().getFirst(); Set<String> tableNames = e.getValue().getSecond(); for (String tableName : tableNames) { tableName = tableName.toLowerCase(); assert(!m_targetsByTableName.containsKey(tableName)); m_targetsByTableName.put(tableName, targetName); } String exportClientClass = properties.getProperty(EXPORT_TO_TYPE); Preconditions.checkNotNull(exportClientClass, "export to type is undefined or custom export plugin class missing."); try { final Class<?> clientClass = Class.forName(exportClientClass); ExportClientBase client = (ExportClientBase) clientClass.newInstance(); client.configure(properties); m_clientsByTarget.put(targetName, client); client.setTargetName(targetName); } catch(Throwable t) { throw new RuntimeException(t); } configProcessed.put(targetName, new Properties(properties)); } }
Source:
public Entity getControllingPassenger() { List<Entity> _passengers = getPassengers(); if(_passengers.isEmpty()) { setDriverState(false); return null; } else { setDriverState(true); return _passengers.get(0); } }

Target:
public Entity getControllingPassenger() { return getPassengers().isEmpty() ? null : getPassengers().get(0); }
Source:
public void runTest(final String inputExtension) { try { final File input = createInputFile(inputExtension); output = new File(outputDir, "output.sam"); args.add("INPUT=" + input.getAbsoluteFile()); args.add("OUTPUT=" + output.getAbsoluteFile()); if(inputExtension.equals(".cram")){ args.add("REFERENCE_SEQUENCE=input.fasta"); } Assert.assertEquals(runPicardCommandLine(args), 0); test(); } catch (IOException ex) { throw new RuntimeException(ex); } }

Target:
public void runTest(final String inputExtension) { try { final File input = createInputFile(inputExtension); output = new File(outputDir, "output.sam"); args.add("INPUT=" + input.getAbsoluteFile()); args.add("OUTPUT=" + output.getAbsoluteFile()); if (inputExtension.equals(".cram")) { args.add("REFERENCE_SEQUENCE=" + fastaFiles.get(samRecordSetBuilder.getHeader())); } Assert.assertEquals(runPicardCommandLine(args), 0); test(); } catch (IOException ex) { throw new RuntimeException(ex); } }
Source:
protected SplitBrainMergePolicy getMergePolicy(String dataStructureName) { CacheConfig cacheConfig = cacheService.getConfigs().get(dataStructureName); return mergePolicyProvider.getMergePolicy(cacheConfig.getMergePolicyConfig().getPolicy()); }

Target:
protected SplitBrainMergePolicy getMergePolicy(String dataStructureName) { return cacheService.getMergePolicy(dataStructureName); }
Source:
public void setupPipes() throws IOException { try { List<PipeConfiguration> pipeConfList = getPipeConfigList(); for (PipeConfiguration pipeConf : pipeConfList) { FileTailerQueue queue = new FileTailerQueue(pipeConf.getQueueSize()); StreamWriter writer = getStreamWriterForPipe(pipeConf); FileTailerStateProcessor stateProcessor = new FileTailerStateProcessorImpl(pipeConf.getDaemonDir(), pipeConf.getStateFile()); FileTailerMetricsProcessor metricsProcessor = new FileTailerMetricsProcessor(pipeConf.getDaemonDir(), pipeConf.getStatisticsFile(), pipeConf.getStatisticsSleepInterval(), pipeConf.getPipeName(), pipeConf.getSourceConfiguration().getFileName()); pipeList.add(new Pipe(new LogTailer(pipeConf, queue, stateProcessor, metricsProcessor), new FileTailerSink(queue, writer, SinkStrategy.LOADBALANCE, stateProcessor, metricsProcessor, pipeConf.getSinkConfiguration().getPackSize()), metricsProcessor)); } } catch (ConfigurationLoadingException e) { throw new ConfigurationLoadingException("Error during loading configuration from file: " + confPath + e.getMessage()); } }

Target:
private ServiceManager setupPipes() throws IOException { StreamClient client = null; StreamWriter writer = null; try { List<PipeConfiguration> pipeConfList = getPipeConfigs(); for (PipeConfiguration pipeConf : pipeConfList) { FileTailerQueue queue = new FileTailerQueue(pipeConf.getQueueSize()); client = pipeConf.getSinkConfiguration().getStreamClient(); String streamName = pipeConf.getSinkConfiguration().getStreamName(); writer = getStreamWriterForPipe(client, streamName); FileTailerStateProcessor stateProcessor = new FileTailerStateProcessorImpl(pipeConf.getDaemonDir(), pipeConf.getStateFile()); FileTailerMetricsProcessor metricsProcessor = new FileTailerMetricsProcessor(pipeConf.getDaemonDir(), pipeConf.getStatisticsFile(), pipeConf.getStatisticsSleepInterval(), pipeConf.getPipeName(), pipeConf.getSourceConfiguration().getFileName()); pipeList.add(new Pipe(new LogTailer(pipeConf, queue, stateProcessor, metricsProcessor), new FileTailerSink(queue, writer, SinkStrategy.LOADBALANCE, stateProcessor, metricsProcessor, pipeConf.getSinkConfiguration().getPackSize()), metricsProcessor)); client = null; writer = null; } return new ServiceManager(pipeList); } catch (ConfigurationLoadingException e) { throw new ConfigurationLoadingException("Error during loading configuration from file: " + confFile.getAbsolutePath() + e.getMessage()); } finally { if (client != null) { client.close(); } if (writer != null) { writer.close(); } } }
Source:
protected void doStop() throws Exception { if (client != null) { LOG.info("Disconnecting from ElasticSearch cluster: " + configuration.getClusterName()); client.close(); if (sniffer != null) { sniffer.close(); } } super.doStop(); }

Target:
protected void doStop() throws Exception { if (client != null) { LOG.info("Disconnecting from ElasticSearch cluster: {}", configuration.getClusterName()); client.close(); if (sniffer != null) { sniffer.close(); } } super.doStop(); }
Source:
public InternalNodeProbe(boolean withNotifications) throws IOException { super("", 0); this.withNotifications = withNotifications; connect(); }

Target:
public InternalNodeProbe(boolean withNotifications) { this.withNotifications = withNotifications; connect(); }
Source:
private void setRngAvailability() { TModel model = getModel(); Set<VmRngDevice.Source> requiredRngSources = model.getSelectedCluster().getRequiredRngSources(); model.getIsRngEnabled().setIsChangable(!requiredRngSources.isEmpty()); model.getIsRngEnabled().setMessage(constants.rngNotSupportedByCluster()); model.getRngPeriod().setIsChangable(!requiredRngSources.isEmpty()); model.getRngPeriod().setMessage(constants.rngNotSupportedByCluster()); model.getRngBytes().setIsChangable(!requiredRngSources.isEmpty()); model.getRngBytes().setMessage(constants.rngNotSupportedByCluster()); model.getRngSourceRandom().setIsChangable(requiredRngSources.contains(VmRngDevice.Source.RANDOM)); model.getRngSourceRandom().setMessage(messages.rngSourceNotSupportedByCluster(VmRngDevice.Source.RANDOM.toString())); model.getRngSourceHwrng().setIsChangable(requiredRngSources.contains(VmRngDevice.Source.HWRNG)); model.getRngSourceHwrng().setMessage(messages.rngSourceNotSupportedByCluster(VmRngDevice.Source.HWRNG.toString())); }

Target:
private void setRngAvailability() { TModel model = getModel(); Set<VmRngDevice.Source> requiredRngSources = model.getSelectedCluster().getRequiredRngSources(); boolean requiredRngSourcesEmpty = requiredRngSources.isEmpty(); boolean randomSourceAvailable = requiredRngSources.contains(VmRngDevice.Source.RANDOM); boolean hwrngSourceAvailable = requiredRngSources.contains(VmRngDevice.Source.HWRNG); model.getIsRngEnabled().setIsChangable(!requiredRngSourcesEmpty); model.getRngPeriod().setIsChangable(!requiredRngSourcesEmpty); model.getRngBytes().setIsChangable(!requiredRngSourcesEmpty); if (requiredRngSourcesEmpty) { model.getIsRngEnabled().setMessage(constants.rngNotSupportedByCluster()); model.getRngPeriod().setMessage(constants.rngNotSupportedByCluster()); model.getRngBytes().setMessage(constants.rngNotSupportedByCluster()); } model.getRngSourceRandom().setIsChangable(randomSourceAvailable); if (randomSourceAvailable) { model.getRngSourceRandom().setMessage(messages.rngSourceNotSupportedByCluster(VmRngDevice.Source.RANDOM.toString())); } model.getRngSourceHwrng().setIsChangable(hwrngSourceAvailable); if (hwrngSourceAvailable) { model.getRngSourceHwrng().setMessage(messages.rngSourceNotSupportedByCluster(VmRngDevice.Source.HWRNG.toString())); } }
Source:
public VirtualAuthenticator(final String id) { this.id = id; }

Target:
public VirtualAuthenticator(final String id) { this.id = Objects.requireNonNull(id); }
Source:
@Override public void onCheckpointBegin(Context cpCtx) { Set<Integer> completeCandidates = new HashSet<>(); Integer grpId; while ((grpId = cpWaitGrps.poll()) != null) completeCandidates.add(grpId); cpCtx.finishedStateFut().listen( f -> { if (f.error() != null || f.isCancelled()) { cpWaitGrps.addAll(completeCandidates); return; } lock.lock(); try { for (int groupId : completeCandidates) { GroupScanContext scanCtx = grps.remove(groupId); boolean finished = scanCtx.finish(); assert finished : groupId; if (log.isInfoEnabled()) log.info("Cache group reencryption is finished [grpId=" + groupId + "]"); } if (!grps.isEmpty()) return; ((GridCacheDatabaseSharedManager)ctx.cache().context().database()). removeCheckpointListener(this); } finally { lock.unlock(); } } ); }

Target:
@Override public void onCheckpointBegin(Context cpCtx) { }
Source:
private Object createTestUsingFieldInjection() throws Exception { List<FrameworkField> annotatedFieldsByParameter = getAnnotatedFieldsByParameter(); if (annotatedFieldsByParameter.size() != parameters.length) { throw new Exception( "Wrong number of parameters and @Parameter fields." + " @Parameter fields counted: " + annotatedFieldsByParameter.size() + ", available parameters: " + parameters.length + "."); } Object testClassInstance = getTestClass().getJavaClass().newInstance(); for (FrameworkField each : annotatedFieldsByParameter) { Field field = each.getField(); Parameter annotation = field.getAnnotation(Parameter.class); int index = annotation.value(); try { field.set(testClassInstance, parameters[index]); } catch (IllegalAccessException e) { throw new Exception("Cannot set parameter '" + field.getName() + "'. Ensure that the field '" + field.getName() + "' is public."); } catch (IllegalArgumentException iare) { throw new Exception(getTestClass().getName() + ": Trying to set " + field.getName() + " with the value " + parameters[index] + " that is not the right type (" + parameters[index].getClass().getSimpleName() + " instead of " + field.getType().getSimpleName() + ").", iare); } } return testClassInstance; }

Target:
private Object createTestUsingFieldInjection() throws Exception { List<FrameworkField> annotatedFieldsByParameter = getAnnotatedFieldsByParameter(); if (annotatedFieldsByParameter.size() != parameters.length) { throw new Exception( "Wrong number of parameters and @Parameter fields." + " @Parameter fields counted: " + annotatedFieldsByParameter.size() + ", available parameters: " + parameters.length + "."); } Object testClassInstance = getTestClass().getJavaClass().newInstance(); for (FrameworkField each : annotatedFieldsByParameter) { Field field = each.getField(); Parameter annotation = field.getAnnotation(Parameter.class); int index = annotation.value(); try { field.set(testClassInstance, parameters[index]); } catch (IllegalAccessException e) { IllegalAccessException wrappedException = new IllegalAccessException( "Cannot set parameter '" + field.getName() + "'. Ensure that the field '" + field.getName() + "' is public."); wrappedException.initCause(e); throw wrappedException; } catch (IllegalArgumentException iare) { throw new Exception(getTestClass().getName() + ": Trying to set " + field.getName() + " with the value " + parameters[index] + " that is not the right type (" + parameters[index].getClass().getSimpleName() + " instead of " + field.getType().getSimpleName() + ").", iare); } } return testClassInstance; }
Source:
private static synchronized KeyManager[] getDefaultKeyManager(Logger logger) { final String defaultKeyStore = System.getProperty("javax.net.ssl.keyStore", ""); String defaultKeyStoreType = System.getProperty("javax.net.ssl.keyStoreType", KeyStore.getDefaultType()); String defaultKeyStoreProvider = System.getProperty("javax.net.ssl.keyStoreProvider", ""); logger.debug("keyStore is : " + defaultKeyStore); logger.debug("keyStore type is : " + defaultKeyStoreType); logger.debug("keyStore provider is : " + defaultKeyStoreProvider); if (P11KEYSTORE.equals(defaultKeyStoreType) && !NONE.equals(defaultKeyStore)) { throw new IllegalArgumentException("if keyStoreType is " + P11KEYSTORE + ", then keyStore must be " + NONE); } String defaultKeyStorePassword = System.getProperty("javax.net.ssl.keyStorePassword", ""); char[] passwd = defaultKeyStorePassword.isEmpty() ? null : defaultKeyStorePassword.toCharArray(); logger.debug("keyStore password : " + passwd); try { KeyStore ks = initKeyStore(logger, defaultKeyStore, defaultKeyStoreType, defaultKeyStoreProvider, passwd); logger.debug("init keymanager of type " + KeyManagerFactory.getDefaultAlgorithm()); KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); if (P11KEYSTORE.equals(defaultKeyStoreType)) { kmf.init(ks, null); } else { kmf.init(ks, passwd); } return kmf.getKeyManagers(); } catch (Exception e) { throw new IllegalStateException("Unable to initialize key manager", e); } }

Target:
private static synchronized KeyManager[] getDefaultKeyManager(Logger logger) { final String defaultKeyStore = System.getProperty("javax.net.ssl.keyStore", ""); String defaultKeyStoreType = System.getProperty("javax.net.ssl.keyStoreType", KeyStore.getDefaultType()); String defaultKeyStoreProvider = System.getProperty("javax.net.ssl.keyStoreProvider", ""); logger.debug("keyStore is : " + defaultKeyStore); logger.debug("keyStore type is : " + defaultKeyStoreType); logger.debug("keyStore provider is : " + defaultKeyStoreProvider); if (P11KEYSTORE.equals(defaultKeyStoreType) && !NONE.equals(defaultKeyStore)) { throw new IllegalArgumentException("if keyStoreType is " + P11KEYSTORE + ", then keyStore must be " + NONE); } String defaultKeyStorePassword = System.getProperty("javax.net.ssl.keyStorePassword", ""); char[] passwd = defaultKeyStorePassword.isEmpty() ? null : defaultKeyStorePassword.toCharArray(); try { KeyStore ks = initKeyStore(logger, defaultKeyStore, defaultKeyStoreType, defaultKeyStoreProvider, passwd); logger.debug("init keymanager of type " + KeyManagerFactory.getDefaultAlgorithm()); KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); if (P11KEYSTORE.equals(defaultKeyStoreType)) { kmf.init(ks, null); } else { kmf.init(ks, passwd); } return kmf.getKeyManagers(); } catch (Exception e) { throw new IllegalStateException("Unable to initialize key manager", e); } }
Source:
public FileTailerState loadState() throws FileTailerStateProcessorException { if (!new File(stateDirPath + "/" + stateFileName).exists()) { LOG.info("Not found state file: {}", stateDirPath + "/" + stateFileName); return null; } FileTailerState state; LOG.debug("Start loading File Tailer state .."); try { FileInputStream fileIn = new FileInputStream(stateDirPath + "/" + stateFileName); ObjectInputStream in = new ObjectInputStream(fileIn); state = (FileTailerState) in.readObject(); in.close(); fileIn.close(); LOG.debug("File Tailer state loaded successfully"); } catch (IOException e) { LOG.error("Can not load File Tailer state: {}", e.getMessage()); throw new FileTailerStateProcessorException(e.getMessage()); } catch (ClassNotFoundException e) { LOG.error("Can not found class for File Tailer state: {}", e.getMessage()); throw new FileTailerStateProcessorException(e.getMessage()); } return state; }

Target:
public FileTailerState loadState() throws FileTailerStateProcessorException { if (!stateFile.exists()) { LOG.info("Not found state file: {}", stateFile.getAbsolutePath()); return null; } LOG.debug("Start loading File Tailer state .."); try { BufferedReader reader = Files.newReader(stateFile, UTF_8); try { FileTailerState state = GSON.fromJson(reader, FileTailerState.class); LOG.debug("File Tailer state loaded successfully"); return state; } finally { Closeables.closeQuietly(reader); } } catch (IOException e) { LOG.error("Can not load File Tailer state: {}", e); throw new FileTailerStateProcessorException(e.getMessage()); } }
Source:
protected Map<String, Object> decorateReportData(Map<String, Object> reportData) { Map<String, Object> decoratedReportData = new HashMap<>(); decoratedReportData.putAll(reportData); decoratedReportData.put(ReportGeneration.PARAMETER_NAME_SUBREPORT_DIR, new File(System.getProperty("java.io.tmpdir").concat(reportData.get(ReportGeneration.PARAMETER_NAME_SUBREPORT_DIR).toString())).getAbsolutePath().concat(File.separator)); return decoratedReportData; }

Target:
protected Map<String, Object> decorateReportData(Map<String, Object> reportData) { Map<String, Object> decoratedReportData = new ConcurrentHashMap<>(); decoratedReportData.putAll(reportData); decoratedReportData.put(ReportGeneration.PARAMETER_NAME_SUBREPORT_DIR, new File(System.getProperty("java.io.tmpdir").concat(reportData.get(ReportGeneration.PARAMETER_NAME_SUBREPORT_DIR).toString())).getAbsolutePath().concat(File.separator)); return decoratedReportData; }
Source:
public static Object onUtilRunTask(FutureTask<?> task, Logger logger) { GlobalCauseTracker.INSTANCE.switchToPhase(PluginPhase.State.SCHEDULED_TASK, PhaseContext.start() .add(NamedCause.source(task)) .addCaptures() .complete() ); Object value = Util.runTask(task, logger); GlobalCauseTracker.INSTANCE.completePhase(PluginPhase.State.SCHEDULED_TASK); return value; }

Target:
public static Object onUtilRunTask(FutureTask<?> task, Logger logger) { GlobalCauseTracker.getInstance().switchToPhase(PluginPhase.State.SCHEDULED_TASK, PhaseContext.start() .add(NamedCause.source(task)) .addCaptures() .complete() ); Object value = Util.runTask(task, logger); GlobalCauseTracker.getInstance().completePhase(PluginPhase.State.SCHEDULED_TASK); return value; }
Source:
public AMQP.BasicProperties fromMessageProperties(MessageProperties source, String charset) { final TraceeFilterConfiguration filterConfiguration = backend.getConfiguration(profile); if (!backend.isEmpty() && filterConfiguration.shouldProcessContext(OutgoingRequest)) { final Map<String, String> filteredParams = filterConfiguration.filterDeniedParams(backend.copyToMap(), OutgoingRequest); final String contextAsHeader = transportSerialization.render(filteredParams); source.getHeaders().put(TraceeConstants.HTTP_HEADER_NAME, contextAsHeader); } return super.fromMessageProperties(source, charset); }

Target:
public AMQP.BasicProperties fromMessageProperties(MessageProperties source, String charset) { final TraceeFilterConfiguration filterConfiguration = backend.getConfiguration(profile); if (!backend.isEmpty() && filterConfiguration.shouldProcessContext(TraceeFilterConfiguration.Channel.AsyncDispatch)) { final Map<String, String> filteredParams = filterConfiguration.filterDeniedParams(backend.copyToMap(), TraceeFilterConfiguration.Channel.AsyncDispatch); final String contextAsHeader = transportSerialization.render(filteredParams); source.getHeaders().put(TraceeConstants.JMS_HEADER_NAME, contextAsHeader); } return super.fromMessageProperties(source, charset); }
Source:
protected Session noJoinReordering() { return Session.builder(getSession()) .setSystemProperty(JOIN_REORDERING_STRATEGY, JoinReorderingStrategy.NONE.name()) .setSystemProperty(JOIN_DISTRIBUTION_TYPE, JoinDistributionType.REPARTITIONED.name()) .build(); }

Target:
protected Session noJoinReordering() { return Session.builder(getSession()) .setSystemProperty(JOIN_REORDERING_STRATEGY, JoinReorderingStrategy.NONE.name()) .setSystemProperty(JOIN_DISTRIBUTION_TYPE, JoinDistributionType.PARTITIONED.name()) .build(); }
Source:
public CompletableFuture<LogReplicationEntry> send(LogReplicationEntry message) { log.info("Send single log entry for request {}", message.getMetadata()); return client.sendLogEntry(message); }

Target:
public CompletableFuture<LogReplicationEntry> send(LogReplicationEntry message) { log.trace("Send single log entry for request {}", message.getMetadata()); return client.sendLogEntry(message); }
Source:
private Expression badValueFailureExpression(final String columnRef, boolean failureThrowsException) { if (failureThrowsException) { return new Expression() { @Override public boolean writeExpression(JavaFileWriter writer) throws IOException { writer.appendString("throw new IllegalArgumentException(\"Value for upsert logical key column \"" + " + " + columnRef + ".getName() + \" was missing when trying to upsert item of class \"" + " + getClass())"); return true; } }; } else { return Expressions.fromString("null").returnExpr(); } }

Target:
private Expression badValueFailureExpression(final String columnRef, boolean failureThrowsException) { if (failureThrowsException) { return new Expression() { @Override public boolean writeExpression(JavaFileWriter writer) throws IOException { writer.appendString("throw new IllegalStateException(\"Value for upsert logical key column \"" + " + " + columnRef + ".getName() + \" was missing when trying to build upsert criterion " + "for class \" + getClass())"); return true; } }; } else { return Expressions.fromString("null").returnExpr(); } }
Source:
public void testSupportsBad() { AuthenticationToken authenticationToken = mock(AuthenticationToken.class); boolean supports = upRealm.supports(authenticationToken); assertFalse(supports); authenticationToken = mock(BaseAuthenticationToken.class); supports = upRealm.supports(authenticationToken); assertFalse(supports); when(authenticationToken.getCredentials()).thenReturn(new Object()); supports = upRealm.supports(authenticationToken); assertFalse(supports); }

Target:
public void testSupportsBad() { BaseAuthenticationToken authenticationToken = mock(BaseAuthenticationToken.class); boolean supports = upRealm.supports(authenticationToken); assertFalse(supports); when(authenticationToken.getType()).thenReturn(AuthenticationTokenType.PKI); supports = upRealm.supports(authenticationToken); assertFalse(supports); when(authenticationToken.getType()).thenReturn(AuthenticationTokenType.USERNAME); authenticationToken = mock(BaseAuthenticationToken.class); supports = upRealm.supports(authenticationToken); assertFalse(supports); when(authenticationToken.getCredentials()).thenReturn(new Object()); supports = upRealm.supports(authenticationToken); assertFalse(supports); when(authenticationToken.getCredentials()).thenReturn(""); supports = upRealm.supports(authenticationToken); assertFalse(supports); }
Source:
public Ticker getTicker(CurrencyPair currencyPair, Object... objects) throws IOException { OrderBook orderBook = getOrderBook(currencyPair, 1, 1, 1); return new Ticker.Builder() .currencyPair(orderBook.getAsks().get(0).getCurrencyPair()) .ask(orderBook.getAsks().get(0).getLimitPrice()) .bid(orderBook.getBids().get(0).getLimitPrice()) .build(); }

Target:
public Ticker getTicker(CurrencyPair currencyPair, Object... objects) throws IOException { throw new NotAvailableFromExchangeException(); }
Source:
public Map<String,String> getSupportedFunctions() { if ( supportedFunctions == null ) { supportedFunctions = new HashMap(); dialect.registerFunctions(supportedFunctions); } return supportedFunctions; }

Target:
public Map<String, String> getSupportedFunctions() { if (supportedFunctions == null) { supportedFunctions = new HashMap<>(); dialect.registerFunctions(supportedFunctions); } return supportedFunctions; }
Source:
void writeFully(SocketChannel channel, ByteBuffer buffer, boolean forceAsync, DistributionMessage msg) throws IOException, ConnectionException { final DMStats stats = owner.getConduit().getStats(); if (!sharedResource) { stats.incTOSentMsg(); } if (useSyncWrites(forceAsync)) { if (asyncQueuingInProgress) { if (addToQueue(buffer, msg, false)) { return; } } long startLock = stats.startSocketLock(); synchronized (outLock) { stats.endSocketLock(startLock); if (asyncQueuingInProgress) { if (addToQueue(buffer, msg, false)) { return; } } synchronized (ioFilter) { ByteBuffer wrappedBuffer = ioFilter.wrap(buffer); while (wrappedBuffer.remaining() > 0) { int amtWritten = 0; long start = stats.startSocketWrite(true); try { amtWritten = channel.write(wrappedBuffer); } finally { stats.endSocketWrite(true, start, amtWritten, 0); } } } } } else { writeAsync(channel, buffer, forceAsync, msg, stats); } }

Target:
void writeFully(SocketChannel channel, ByteBuffer buffer, boolean forceAsync, DistributionMessage msg) throws IOException, ConnectionException { final DMStats stats = owner.getConduit().getStats(); if (!sharedResource) { stats.incTOSentMsg(); } if (useSyncWrites(forceAsync)) { if (asyncQueuingInProgress) { if (addToQueue(buffer, msg, false)) { return; } } long startLock = stats.startSocketLock(); synchronized (outLock) { stats.endSocketLock(startLock); if (asyncQueuingInProgress) { if (addToQueue(buffer, msg, false)) { return; } } synchronized (ioFilter.getSynchObject()) { ByteBuffer wrappedBuffer = ioFilter.wrap(buffer); while (wrappedBuffer.remaining() > 0) { int amtWritten = 0; long start = stats.startSocketWrite(true); try { amtWritten = channel.write(wrappedBuffer); } finally { stats.endSocketWrite(true, start, amtWritten, 0); } } } } } else { writeAsync(channel, buffer, forceAsync, msg, stats); } }
Source:
public Phone createPhone(CreatePhoneRequest request) { Assert.notNull(request, "Request cannot be null."); final Phone phone = request.getPhone(); String href = getPhones().getHref(); return getDataStore().create(href, phone); }

Target:
public Phone createPhone(CreatePhoneRequest request) { Assert.notNull(request, "Request cannot be null."); final Phone phone = request.getPhone(); String href = getPhones().getHref(); if (request.hasPhoneOptions()) { return getDataStore().create(href, phone, request.getPhoneOptions()); } return getDataStore().create(href, phone); }
Source:
protected void captureTimeline(long currentId) { Paging paging = new Paging(1, 200); List<Status> statuses = null; do { Twitter client = getTwitterClient(); int keepTrying = 0; while (keepTrying < 1) { try { statuses = client.getUserTimeline(currentId, paging); for (Status tStat : statuses) { String json = TwitterObjectFactory.getRawJSON(tStat); while(!providerQueue.offer(new StreamsDatum(json))) { sleep(); } } paging.setPage(paging.getPage() + 1); keepTrying = 10; } catch(TwitterException twitterException) { keepTrying += TwitterErrorHandler.handleTwitterError(client, twitterException); } catch(Exception e) { keepTrying += TwitterErrorHandler.handleTwitterError(client, e); } } } while (shouldContinuePulling(statuses)); }

Target:
protected void captureTimeline(long currentId) { Paging paging = new Paging(1, 200); List<Status> statuses = null; do { Twitter client = getTwitterClient(); int keepTrying = 0; while (keepTrying < 1) { try { statuses = client.getUserTimeline(currentId, paging); for (Status tStat : statuses) { String json = TwitterObjectFactory.getRawJSON(tStat); ComponentUtils.offerUntilSuccess(new StreamsDatum(json), providerQueue); } paging.setPage(paging.getPage() + 1); keepTrying = 10; } catch(TwitterException twitterException) { keepTrying += TwitterErrorHandler.handleTwitterError(client, twitterException); } catch(Exception e) { keepTrying += TwitterErrorHandler.handleTwitterError(client, e); } } } while (shouldContinuePulling(statuses)); }
Source:
private void checkLocationAvailability() { LocationAvailability availability = LocationServices.FusedLocationApi.getLocationAvailability(client); boolean isAvailable = availability.isLocationAvailable(); Toast.makeText(LocationAvailabilityActivity.this, isAvailable ? R.string.location_available : R.string.location_unavailable, Toast.LENGTH_SHORT).show(); }

Target:
private void checkLocationAvailability() { LocationAvailability availability = LocationServices.FusedLocationApi.getLocationAvailability(client); boolean isAvailable = availability.isLocationAvailable(); Toast.makeText(LocationAvailabilityActivity.this, isAvailable ? R.string.location_available : R.string.location_unavailable, Toast.LENGTH_SHORT).show(); final LocationRequest locationRequest = LocationRequest.create() .setPriority(PRIORITY_HIGH_ACCURACY); LocationServices.FusedLocationApi.requestLocationUpdates(client, locationRequest, callback, Looper.myLooper()); }
Source:
public void validateSessionPersistenceProtocolCompatibility(LoadBalancer inLb, LoadBalancer dbLb) throws BadRequestException, UnprocessableEntityException { SessionPersistence inpersist = inLb.getSessionPersistence(); LoadBalancerProtocol dbProtocol = dbLb.getProtocol(); String httpErrMsg = "HTTP_COOKIE Session persistence is only valid with HTTP and HTTP(SSL Termination) protocols. "; String sipErrMsg = "SOURCE_IP Session persistence is only valid with non-HTTP protocols. "; String sslErrMsg = "SSL_ID Session persistence is only valid with HTTP(SSL Termination) protocols. "; LOG.info("Verifying session persistence protocol..." + inpersist); if (inpersist != NONE) { if (inpersist == HTTP_COOKIE && (dbProtocol != HTTP)) { LOG.info(httpErrMsg); throw new BadRequestException(httpErrMsg); } if (inpersist == SOURCE_IP && (dbProtocol == HTTP)) { LOG.info(httpErrMsg); throw new BadRequestException(sipErrMsg); } if (inpersist == SSL_ID && (dbProtocol != HTTPS)) { LOG.info(sslErrMsg); throw new BadRequestException(sslErrMsg); } } LOG.info("Successfully verified session persistence protocol..." + inLb.getSessionPersistence()); }

Target:
public void validateSessionPersistenceProtocolCompatibility(LoadBalancer inLb, LoadBalancer dbLb) throws BadRequestException, UnprocessableEntityException { SessionPersistence persistenceType = inLb.getSessionPersistence(); LoadBalancerProtocol dbProtocol = dbLb.getProtocol(); String httpErrMsg = "HTTP_COOKIE session persistence is only valid with the HTTP protocol."; String sipErrMsg = "SOURCE_IP session persistence is only valid with non-HTTP protocols. "; String sslErrMsg = "SSL_ID session persistence is only valid with the HTTPS protocol. "; LOG.info("Verifying session persistence protocol..." + persistenceType); if (persistenceType != NONE) { if (persistenceType == HTTP_COOKIE && (dbProtocol != HTTP)) { LOG.info(httpErrMsg); throw new BadRequestException(httpErrMsg); } if (persistenceType == SOURCE_IP && (dbProtocol == HTTP)) { LOG.info(httpErrMsg); throw new BadRequestException(sipErrMsg); } if (persistenceType == SSL_ID && (dbProtocol != HTTPS)) { LOG.info(sslErrMsg); throw new BadRequestException(sslErrMsg); } } LOG.info("Successfully verified session persistence protocol..." + inLb.getSessionPersistence()); }