auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public PageableResult search(RequestContext context) throws ResponseException { String source = context.getParameter("source"); String code = context.getParameter("code"); String name = context.getParameter("name"); String searchType = context.getParameter("searchType"); ConceptSource conceptSource = conceptService.getConceptSourceByUuid(source); if (conceptSource == null) { conceptSource = conceptService.getConceptSourceByName(source); } if (conceptSource == null) { return new EmptySearchResult(); } if (code != null || name != null) { if(SEARCH_TYPE_STARTS_WITH.equals(searchType)){ return searchStartsWith(context, code, name, conceptSource); } else { return searchEquals(context, code, name, conceptSource); } } else { List<ConceptReferenceTerm> terms = conceptService.getConceptReferenceTerms(null, conceptSource, context.getStartIndex(), context.getLimit(), context.getIncludeAll()); int count = conceptService.getCountOfConceptReferenceTerms(null, conceptSource, context.getIncludeAll()); boolean hasMore = count > (context.getStartIndex() + context.getLimit()); return new AlreadyPaged<ConceptReferenceTerm>(context, terms, hasMore); } }

Target:
public PageableResult search(RequestContext context) throws ResponseException { String source = context.getParameter("source"); String code = context.getParameter("code"); String name = context.getParameter("name"); String searchType = context.getParameter("searchType"); if(searchType!=null&&!SEARCH_TYPE_EQUALS.equals(searchType)&&!SEARCH_TYPE_STARTS_WITH.equals(searchType)){ throw new InvalidSearchException("Invalid searchType parameter"); } ConceptSource conceptSource = conceptService.getConceptSourceByUuid(source); if (conceptSource == null) { conceptSource = conceptService.getConceptSourceByName(source); } if (conceptSource == null) { return new EmptySearchResult(); } if (code != null || name != null) { if(SEARCH_TYPE_STARTS_WITH.equals(searchType)){ return searchStartsWith(context, code, name, conceptSource); } else { return searchEquals(context, code, name, conceptSource); } } else { List<ConceptReferenceTerm> terms = conceptService.getConceptReferenceTerms(null, conceptSource, context.getStartIndex(), context.getLimit(), context.getIncludeAll()); int count = conceptService.getCountOfConceptReferenceTerms(null, conceptSource, context.getIncludeAll()); boolean hasMore = count > (context.getStartIndex() + context.getLimit()); return new AlreadyPaged<ConceptReferenceTerm>(context, terms, hasMore); } }
Source:
private void setScreenOrientationProperty(String text) { if (hasProperty(PROPERTY_NAME_WIDTH) && hasProperty(PROPERTY_NAME_HEIGHT) && hasProperty(PROPERTY_NAME_SCROLLABLE)) { if (text.equalsIgnoreCase("landscape")) { screenWidth = LANDSCAPE_WIDTH; screenHeight = LANDSCAPE_HEIGHT; landscape = true; phoneWidget.setStyleName("ode-SimpleMockFormPhoneLandscape"); } else { screenWidth = PORTRAIT_WIDTH; screenHeight = PORTRAIT_HEIGHT; landscape = false; phoneWidget.setStyleName("ode-SimpleMockFormPhonePortrait"); } usableScreenHeight = screenHeight - PhoneBar.HEIGHT - titleBar.getHeight() - NavigationBar.HEIGHT; resizePanel(screenWidth, screenHeight); changeProperty(PROPERTY_NAME_WIDTH, "" + screenWidth); boolean scrollable = Boolean.parseBoolean(getPropertyValue(PROPERTY_NAME_SCROLLABLE)); if (!scrollable) { changeProperty(PROPERTY_NAME_HEIGHT, "" + usableScreenHeight); } } }

Target:
private void setScreenOrientationProperty(String text) { if (hasProperty(PROPERTY_NAME_WIDTH) && hasProperty(PROPERTY_NAME_HEIGHT) && hasProperty(PROPERTY_NAME_SCROLLABLE)) { if (text.equalsIgnoreCase("landscape")) { screenWidth = LANDSCAPE_WIDTH; screenHeight = LANDSCAPE_HEIGHT; landscape = true; setPhoneStyle(); } else { screenWidth = PORTRAIT_WIDTH; screenHeight = PORTRAIT_HEIGHT; landscape = false; setPhoneStyle(); } usableScreenHeight = screenHeight - PhoneBar.HEIGHT - titleBar.getHeight() - NavigationBar.HEIGHT; resizePanel(screenWidth, screenHeight); changeProperty(PROPERTY_NAME_WIDTH, "" + screenWidth); boolean scrollable = Boolean.parseBoolean(getPropertyValue(PROPERTY_NAME_SCROLLABLE)); if (!scrollable) { changeProperty(PROPERTY_NAME_HEIGHT, "" + usableScreenHeight); } } }
Source:
public static void validateTimestampFieldMapping(String timestampFieldName, MapperService mapperService) { MappedFieldType timestampFieldMapper = mapperService.fieldType(timestampFieldName); if (timestampFieldMapper == null) { throw new IllegalArgumentException("expected timestamp field [" + timestampFieldName + "], but found no timestamp field"); } String type = timestampFieldMapper.typeName(); if (ALLOWED_TIMESTAMPFIELD_TYPES.contains(type) == false) { throw new IllegalArgumentException("expected timestamp field [" + timestampFieldName + "] to be of types [" + ALLOWED_TIMESTAMPFIELD_TYPES + "], but instead found type [" + type + "]"); } }

Target:
public static void validateTimestampFieldMapping(String timestampFieldName, MapperService mapperService) { MappedFieldType timestampFieldMapper = mapperService.fieldType(timestampFieldName); if (timestampFieldMapper == null) { throw new IllegalArgumentException("expected timestamp field [" + timestampFieldName + "], but found no timestamp field"); } String type = timestampFieldMapper.typeName(); if (ALLOWED_TIMESTAMPFIELD_TYPES.contains(type) == false) { throw new IllegalArgumentException("expected timestamp field [" + timestampFieldName + "] to be of types " + ALLOWED_TIMESTAMPFIELD_TYPES + ", but instead found type [" + type + "]"); } }
Source:
protected ClusterManager(String zkAddr, String clusterName, String instanceName, InstanceType type) { super(clusterName, instanceName, type, zkAddr); _clusterName = clusterName; _instanceName = instanceName; _type = type; _uid = UID.getAndIncrement(); LOG.info("ClusterManager_watcher_{}_{}_{}_{} created, stacktrace {}", _clusterName, _instanceName, _type.name(), _uid, Thread.currentThread().getStackTrace()); }

Target:
protected ClusterManager(String zkAddr, String clusterName, String instanceName, InstanceType type) { super(clusterName, instanceName, type, zkAddr); _clusterName = clusterName; _instanceName = instanceName; _type = type; _uid = UID.getAndIncrement(); }
Source:
private static CliOptions convertCliToPojo(CommandLine cmdLine, List<File> filesToProcess) { final CliOptions conf = new CliOptions(); conf.format = cmdLine.getOptionValue(OPTION_F_NAME); if (conf.format == null) { conf.format = PLAIN_FORMAT_NAME; } conf.outputLocation = cmdLine.getOptionValue(OPTION_O_NAME); conf.configLocation = cmdLine.getOptionValue(OPTION_C_NAME); conf.propertiesLocation = cmdLine.getOptionValue(OPTION_P_NAME); conf.files = filesToProcess; conf.omitIgnoredModules = !cmdLine.hasOption(OPTION_EXECUTE_IGNORED_MODULES_NAME); return conf; }

Target:
private static CliOptions convertCliToPojo(CommandLine cmdLine, List<File> filesToProcess) { final CliOptions conf = new CliOptions(); conf.format = cmdLine.getOptionValue(OPTION_F_NAME); if (conf.format == null) { conf.format = PLAIN_FORMAT_NAME; } conf.outputLocation = cmdLine.getOptionValue(OPTION_O_NAME); conf.configLocation = cmdLine.getOptionValue(OPTION_C_NAME); conf.propertiesLocation = cmdLine.getOptionValue(OPTION_P_NAME); conf.files = filesToProcess; conf.executeIgnoredModules = cmdLine.hasOption(OPTION_EXECUTE_IGNORED_MODULES_NAME); return conf; }
Source:
private static Repository getRepositoryOfProjects(Collection<?> collection, boolean single) { Repository repo = null; for (Object element : collection) { IProject project = AdapterUtils.adapt(element, IProject.class); if (project != null) { Repository r = getRepositoryOfMapping(project); if (single && r != null && repo != null && r != repo) { return null; } else if (r != null) { repo = r; } } else { IContainer container = AdapterUtils.adapt(element, IContainer.class); RepositoryMapping mapping = null; if (container != null) { mapping = RepositoryMapping.getMapping(container); } if (container != null && mapping != null && container.equals(mapping.getContainer())) { Repository r = mapping.getRepository(); if (single && r != null && repo != null && r != repo) { return null; } else if (r != null) { repo = r; } } else { IWorkingSet workingSet = AdapterUtils.adapt(element, IWorkingSet.class); if (workingSet != null) { for (IAdaptable adaptable : workingSet.getElements()) { Repository r = getRepositoryOfProject(adaptable); if (single && r != null && repo != null && r != repo) { return null; } else if (r != null) { repo = r; } } } } } } return repo; }

Target:
private static Repository getRepositoryOfProjects(Collection<?> collection, boolean single) { Repository repo = null; for (Object element : collection) { IContainer container = AdapterUtils.adapt(element, IContainer.class); RepositoryMapping mapping = null; if (container != null) { mapping = RepositoryMapping.getMapping(container); } if (container != null && mapping != null && container.equals(mapping.getContainer())) { Repository r = mapping.getRepository(); if (single && r != null && repo != null && r != repo) { return null; } else if (r != null) { repo = r; } } else { IWorkingSet workingSet = AdapterUtils.adapt(element, IWorkingSet.class); if (workingSet != null) { for (IAdaptable adaptable : workingSet.getElements()) { Repository r = getRepositoryOfProject(adaptable); if (single && r != null && repo != null && r != repo) { return null; } else if (r != null) { repo = r; } } } } } return repo; }
Source:
BaseHandler(LttngKernelExecGraphProvider provider) { fProvider = provider; fHasEventSchedTTWU = new HashMap<>(); ITmfTrace trace = getProvider().getTrace(); LttngEventLayout layout = getProvider().getEventLayout(); Collection<@NonNull ITmfTrace> traceSet = TmfTraceManager.getTraceSet(trace); for (ITmfTrace traceItem : traceSet) { if (traceItem instanceof ITmfTraceWithPreDefinedEvents) { Set<@NonNull ? extends ITmfEventType> content = ((ITmfTraceWithPreDefinedEvents) traceItem).getContainedEventTypes(); Set<@NonNull String> traceEvents = TmfEventTypeCollectionHelper.getEventNames(content); boolean hasEvent = traceEvents.contains(layout.eventSchedProcessTTWU()); fHasEventSchedTTWU.put(traceItem, hasEvent); } } }

Target:
BaseHandler(LttngKernelExecGraphProvider provider) { fProvider = provider; fHasEventSchedTTWU = new HashMap<>(); ITmfTrace trace = getProvider().getTrace(); LttngEventLayout layout = getProvider().getEventLayout(); Collection<ITmfTrace> traceSet = TmfTraceManager.getTraceSet(trace); for (ITmfTrace traceItem : traceSet) { if (traceItem instanceof ITmfTraceWithPreDefinedEvents) { Set<? extends ITmfEventType> content = ((ITmfTraceWithPreDefinedEvents) traceItem).getContainedEventTypes(); Set<String> traceEvents = TmfEventTypeCollectionHelper.getEventNames(content); boolean hasEvent = traceEvents.contains(layout.eventSchedProcessTTWU()); fHasEventSchedTTWU.put(traceItem, hasEvent); } } }
Source:
public <T extends Collector> T register() { if (registered.contains(CollectorRegistry.defaultRegistry)) { return (T) this; } else { registered.add(CollectorRegistry.defaultRegistry); return super.register(); } }

Target:
public <T extends Collector> T register() { synchronized (registered) { if (registered.contains(CollectorRegistry.defaultRegistry)) { return (T) this; } else { registered.add(CollectorRegistry.defaultRegistry); return super.register(); } } }
Source:
public VdsStatic() { serverSslEnabled = false; vdsStrength = 100; this.setPmOptions(""); this.setPmSecondaryOptions(""); this.vdsSpmPriority = HOST_DEFAULT_SPM_PRIORITY; this.sshPort = DEFAULT_SSH_PORT; this.sshUsername = DEFAULT_SSH_USERNAME; name = ""; comment = ""; vdsType = VDSType.VDS; autoRecoverable = true; disablePowerManagementPolicy = false; pmKdumpDetection = true; this.protocol = VdsProtocol.XML; this.hostProviderId = Guid.Empty; }

Target:
public VdsStatic() { serverSslEnabled = false; vdsStrength = 100; this.setPmOptions(""); this.setPmSecondaryOptions(""); this.vdsSpmPriority = HOST_DEFAULT_SPM_PRIORITY; this.sshPort = DEFAULT_SSH_PORT; this.sshUsername = DEFAULT_SSH_USERNAME; name = ""; comment = ""; vdsType = VDSType.VDS; autoRecoverable = true; disablePowerManagementPolicy = false; pmKdumpDetection = true; this.protocol = VdsProtocol.XML; this.hostProviderId = null; }
Source:
private boolean alignmentsMatch(final SAMRecord s1, final SAMRecord s2) { return ((s1.getReferenceName().equals(s2.getReferenceName()) && s1.getAlignmentStart() == s2.getAlignmentStart() && s1.getReadNegativeStrandFlag() == s1.getReadNegativeStrandFlag()) || (mq0Match && s1.getMappingQuality() <= 3 && s2.getMappingQuality() <= 3)); }

Target:
private boolean alignmentsMatch(final SAMRecord s1, final SAMRecord s2) { return ((s1.getReferenceName().equals(s2.getReferenceName()) && s1.getAlignmentStart() == s2.getAlignmentStart() && s1.getReadNegativeStrandFlag() == s1.getReadNegativeStrandFlag()) || (samComparisonArgumentCollection.LENIENT_LOW_MQ_ALIGNMENT && s1.getMappingQuality() <= samComparisonArgumentCollection.LOW_MQ_THRESHOLD && s2.getMappingQuality() <= samComparisonArgumentCollection.LOW_MQ_THRESHOLD) || (samComparisonArgumentCollection.LENIENT_UNKNOWN_MQ_ALIGNMENT && s1.getMappingQuality() == SAMRecord.UNKNOWN_MAPPING_QUALITY && s2.getMappingQuality() == SAMRecord.UNKNOWN_MAPPING_QUALITY)); }
Source:
public ServiceBuilder<PersistenceConfiguration> build(ServiceTarget target) { ServiceBuilder<PersistenceConfiguration> builder = super.build(target); this.remoteCacheContainer.register(builder); return builder; }

Target:
public ServiceBuilder<PersistenceConfiguration> build(ServiceTarget target) { return this.remoteCacheContainer.register(super.build(target)); }
Source:
public void close() throws DataStoreException { }

Target:
public void close() throws DataStoreException { Iterator<DataStore> iter = delegateHandler.getAllDelegatesIterator(); DataStoreException aggregateException = null; while (iter.hasNext()) { try { DataStore ds = iter.next(); if (null != ds) { ds.close(); } } catch (DataStoreException dse) { if (null == aggregateException) { aggregateException = new DataStoreException( "Aggregate data store exception created in close", dse); } aggregateException.addSuppressed(dse); } } if (null != aggregateException) { throw aggregateException; } }
Source:
public ChangePasswordResponse changePassword(Token userToken, String newPassword, URL authenticationUrl) { try { String requestBody = ChangePasswordRequest.create(userToken, newPassword).toJson(); return changePassword(buildActionUrl(authenticationUrl, ACTION_CHANGE_PASSWORD), requestBody); } catch (Exception e) { return ChangePasswordResponse.createFailure(new ObjectServerError(ErrorCode.UNKNOWN, e)); } }

Target:
public ChangePasswordResponse changePassword(Token userToken, String newPassword, URL authenticationUrl) { try { String requestBody = ChangePasswordRequest.create(userToken, newPassword).toJson(); return changePassword(buildActionUrl(authenticationUrl, ACTION_CHANGE_PASSWORD), requestBody); } catch (Throwable e) { return ChangePasswordResponse.createFailure(new ObjectServerError(ErrorCode.UNKNOWN, e)); } }
Source:
public void init(EObject original, EditingDomain editingDomain) { List<EStructuralFeature> features = featuresProvider .getFeatures(original); initControlFactory(editingDomain, original); for (final EStructuralFeature feature : features) { if(!featuresProvider.getClass().equals(FeaturesProvider.class) || isToBeRendered(feature) ){ createControlForFeature(feature); } } this.layout(); }

Target:
public void init(EObject original, EditingDomain editingDomain) { List<EStructuralFeature> features = featuresProvider .getFeatures(original); initControlFactory(editingDomain, original); for (final EStructuralFeature feature : features) { createControlForFeature(feature); } this.layout(); }
Source:
public void visit(DataChartDurationDescriptor<?, ? extends Number> desc) { setType(EnumSet.of(DescriptorType.NUMERICAL, DescriptorType.DURATION)); }

Target:
public void visit(DataChartDurationDescriptor<?, ? extends Number> desc) { fType.add(DescriptorType.DURATION); }
Source:
private String updateKeeIfRequired(Context context, @Nullable String kee) throws SQLException { if (kee == null || kee.length() <=40) { return kee; } String newKee = uuidFactory.create(); context.prepareUpsert("update permission_templates set kee=? where kee=?") .setString(1, kee) .setString(2, newKee) .execute(); return newKee; }

Target:
private String updateKeeIfRequired(Context context, @Nullable String kee) throws SQLException { if (kee == null || kee.length() <= VarcharColumnDef.UUID_SIZE) { return kee; } String newKee = uuidFactory.create(); context.prepareUpsert("update permission_templates set kee=? where kee=?") .setString(1, newKee) .setString(2, kee) .execute(); return newKee; }
Source:
private static void closeSettingsChangedShell() { new WaitUntil(new ShellIsAvailable("Validator Settings Changed"), TimePeriod.LONG); DefaultShell shell = new DefaultShell("Validator Settings Changed"); String shellText = shell.getText(); new PushButton("Yes").click(); new WaitWhile(new ShellIsActive(shellText), TimePeriod.LONG); }

Target:
private static void closeSettingsChangedShell() { new WaitUntil(new ShellIsAvailable("Validator Settings Changed"), TimePeriod.LONG); DefaultShell shell = new DefaultShell("Validator Settings Changed"); String shellText = shell.getText(); new PushButton("Yes").click(); new WaitWhile(new ShellIsAvailable(shellText), TimePeriod.LONG); }
Source:
public void addSteps(MigrationStepRegistry registry) { registry .add(1900, "Add QUALITY_GATES.IS_BUILT_IN", AddIsBuiltInToQualityGates.class) .add(1901, "Populate QUALITY_GATES.IS_BUILT_IN", PopulateQualityGatesIsBuiltIn.class) .add(1902, "Make QUALITY_GATES.IS_BUILT_IN not null", MakeQualityGatesIsBuiltInNotNullable.class) .add(1903, "Remove quality gates loaded templates", RemoveQualityGateLoadedTemplates.class) .add(1904, "Drop LOADED_TEMPLATES table", DropLoadedTemplatesTable.class); }

Target:
public void addSteps(MigrationStepRegistry registry) { registry .add(1900, "Add QUALITY_GATES.IS_BUILT_IN", AddIsBuiltInToQualityGates.class) .add(1901, "Populate QUALITY_GATES.IS_BUILT_IN", PopulateQualityGatesIsBuiltIn.class) .add(1902, "Make QUALITY_GATES.IS_BUILT_IN not null", MakeQualityGatesIsBuiltInNotNullable.class) .add(1903, "Remove quality gates loaded templates", RemoveQualityGateLoadedTemplates.class) .add(1904, "Rename quality gate \"SonarQube way\" to \"Sonar way\"", RenameOldSonarQubeWayQualityGate.class) .add(1905, "Drop LOADED_TEMPLATES table", DropLoadedTemplatesTable.class); }
Source:
public void run() { if (Policy.DEBUG_AUTO_REFRESH) Policy.debug(DEBUG_PREFIX + "poller started"); while (running) { WatchKey watchKey = null; try { watchKey = watchService.poll(5, TimeUnit.SECONDS); } catch (ClosedWatchServiceException | InterruptedException e) { return; } if (watchKey == null || !watchKey.isValid() || !(watchKey.watchable() instanceof Path)) { continue; } final Path watchedPath = (Path) watchKey.watchable(); for (WatchEvent<?> event : watchKey.pollEvents()) { handleEvent(event, watchedPath); } if (!watchKey.reset()) { if (Policy.DEBUG_AUTO_REFRESH) Policy.debug(DEBUG_PREFIX + "watch key of '" + watchedPath + "' was no longer valid at the time it was reset"); } } if (Policy.DEBUG_AUTO_REFRESH) Policy.debug(DEBUG_PREFIX + "poller stopped"); }

Target:
public void run() { if (Policy.DEBUG_AUTO_REFRESH) Policy.debug(DEBUG_PREFIX + "poller started"); try { while (running) { WatchKey watchKey = null; try { watchKey = watchService.poll(5, TimeUnit.SECONDS); } catch (ClosedWatchServiceException | InterruptedException e) { return; } if (watchKey == null || !watchKey.isValid() || !(watchKey.watchable() instanceof Path)) { continue; } final Path watchedPath = (Path) watchKey.watchable(); for (WatchEvent<?> event : watchKey.pollEvents()) { handleEvent(event, watchedPath); } if (!watchKey.reset()) { if (Policy.DEBUG_AUTO_REFRESH) Policy.debug(DEBUG_PREFIX + "watch key of '" + watchedPath + "' was no longer valid at the time it was reset"); } } } catch (Throwable e) { Nio2RefreshProvider.log(e); } if (Policy.DEBUG_AUTO_REFRESH) Policy.debug(DEBUG_PREFIX + "poller stopped"); }
Source:
public Iterable<String> iterate() throws IOException { final RestResponse response = this.github().entry().uri() .path("/gitignore/templates").back().fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK); final List<JsonString> list = response.as(JsonResponse.class) .json().readArray().getValuesAs(JsonString.class); final List<String> templates = new ArrayList<String>(list.size()); for (JsonString value : list) { templates.add(value.getString()); } return templates; }

Target:
public Iterable<String> iterate() throws IOException { final RestResponse response = this.request.fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK); final List<JsonString> list = response.as(JsonResponse.class) .json().readArray().getValuesAs(JsonString.class); final List<String> templates = new ArrayList<String>(list.size()); for (JsonString value : list) { templates.add(value.getString()); } return templates; }
Source:
if (System.getProperty( PLUGINS_PATH_PROPERTY ) == null) { Class<?> thisClass = StandaloneUMLRTCodeGenerator.class; URL url = thisClass.getResource( "StandaloneUMLRTCodeGenerator.class" ); String thisClassPathStr = url.getPath(); Path thisClassPath = Paths.get( thisClassPathStr ); Path base = thisClassPath.getParent().getParent().getParent().getParent().getParent().getParent().getParent().getParent(); System.setProperty( PLUGINS_PATH_PROPERTY, base.toString()); }

Target:
if (System.getProperty( PLUGINS_PATH_PROPERTY ) == null) { Class<?> thisClass = StandaloneUMLRTCodeGenerator.class; URL url = thisClass.getResource( "StandaloneUMLRTCodeGenerator.class" ); int foldersUp = 7; if (url.getProtocol().equals("jar")) foldersUp--; Path thisClassPath = Paths.get( url.getPath() ); Path base = thisClassPath; for (int i = 0; i < foldersUp; i++) { if (base == null || base.endsWith( "plugins" )) break; base = base.getParent(); } if (base != null) System.setProperty( PLUGINS_PATH_PROPERTY, base.toString() ); }
Source:
public void purgeMemberships(List<CohortMembership> cohortMembershipList) { List<CohortMembership> membersToPurge = getMemberships().stream() .filter(m -> cohortMembershipList.stream() .anyMatch(c -> m.getPatient().getPatientId().equals(c.getPatient().getPatientId()))) .collect(Collectors.toList()); membersToPurge.forEach(m -> getMemberships().remove(m)); }

Target:
public boolean purgeMemberships(List<CohortMembership> cohortMembershipList) { List<CohortMembership> membershipsToPurge = getMemberships().stream() .filter(m -> cohortMembershipList.stream() .anyMatch(c -> m.getPatientId().equals(c.getPatientId()))) .collect(Collectors.toList()); if (membershipsToPurge != null) { membershipsToPurge.forEach(m -> getMemberships().remove(m)); return true; } return false; }
Source:
private Map<SAMReadGroupRecord,FastqQualityFormat> createReadGroupFormatMap(RevertSamSorter sorter, boolean restoreOriginalQualities) { final Map<SAMReadGroupRecord, FastqQualityFormat> readGroupToFormat = new HashMap<>(); List<PeekableIterator<SAMRecord>> iterators = sorter.iterators(); for (PeekableIterator<SAMRecord> iterator : iterators) { SAMReadGroupRecord readGroup = iterator.peek().getReadGroup(); if (readGroup == null) { continue; } readGroupToFormat.put( readGroup, QualityEncodingDetector.detect( QualityEncodingDetector.DEFAULT_MAX_RECORDS_TO_ITERATE, iterator, restoreOriginalQualities) ); } for (final SAMReadGroupRecord r : readGroupToFormat.keySet()) { log.info("Detected quality format for " + r.getReadGroupId() + ": " + readGroupToFormat.get(r)); } if (readGroupToFormat.values().contains(FastqQualityFormat.Solexa)) { throw new PicardException("No quality score encoding conversion implemented for " + FastqQualityFormat.Solexa); } return readGroupToFormat; }

Target:
private Map<SAMReadGroupRecord,FastqQualityFormat> createReadGroupFormatMap(RevertSamSorter sorter, boolean restoreOriginalQualities) { final Map<SAMReadGroupRecord, FastqQualityFormat> readGroupToFormat = new HashMap<>(); final List<PeekableIterator<SAMRecord>> iterators = sorter.iterators(); for (final PeekableIterator<SAMRecord> iterator : iterators) { final SAMReadGroupRecord readGroup = iterator.peek().getReadGroup(); if (readGroup == null) { continue; } readGroupToFormat.put( readGroup, QualityEncodingDetector.detect( QualityEncodingDetector.DEFAULT_MAX_RECORDS_TO_ITERATE, iterator, restoreOriginalQualities) ); } for (final SAMReadGroupRecord r : readGroupToFormat.keySet()) { log.info("Detected quality format for " + r.getReadGroupId() + ": " + readGroupToFormat.get(r)); } if (readGroupToFormat.values().contains(FastqQualityFormat.Solexa)) { throw new PicardException("No quality score encoding conversion implemented for " + FastqQualityFormat.Solexa); } return readGroupToFormat; }
Source:
default void deleteAll(Collection<K> keys) { deleteAllAsync(keys).toCompletableFuture().join(); }

Target:
default void deleteAll(Collection<K> keys) { try { deleteAllAsync(keys).toCompletableFuture().join(); } catch (CompletionException e) { throw new SamzaException("DELETE failed for " + keys, e); } }
Source:
private boolean renderQueryOutput(PrintStream out, OutputFormat outputFormat, boolean interactive) { StatusPrinter statusPrinter = null; @SuppressWarnings("resource") PrintStream errorChannel = interactive ? out : System.err; if (interactive) { statusPrinter = new StatusPrinter(client, out, debug); statusPrinter.printInitialStatusUpdates(); } else { waitForData(); } if (client.isRunning() || (client.isFinished() && client.finalStatusInfo().getError() == null)) { QueryStatusInfo results = client.isRunning() ? client.currentStatusInfo() : client.finalStatusInfo(); if (results.getUpdateType() != null) { renderUpdate(errorChannel, results); } else if (results.getColumns() == null) { errorChannel.printf("Query %s has no columns\n", results.getId()); return false; } else { renderResults(out, outputFormat, interactive, results.getColumns()); } } checkState(!client.isRunning()); if (statusPrinter != null) { statusPrinter.printFinalInfo(); } if (client.isAborted()) { errorChannel.println("Query aborted by user"); return false; } if (client.isCommunicationFailure()) { errorChannel.println("Query is gone (server restarted?)"); return false; } verify(client.isFinished()); if (client.finalStatusInfo().getError() != null) { renderFailure(errorChannel); return false; } return true; }

Target:
private boolean renderQueryOutput(PrintStream out, OutputFormat outputFormat, boolean interactive) { StatusPrinter statusPrinter = null; @SuppressWarnings("resource") PrintStream errorChannel = interactive ? out : System.err; if (interactive) { statusPrinter = new StatusPrinter(client, out, debug); statusPrinter.printInitialStatusUpdates(); } else { waitForData(); } if (client.isRunning() || (client.isFinished() && client.finalStatusInfo().getError() == null)) { QueryStatusInfo results = client.isRunning() ? client.currentStatusInfo() : client.finalStatusInfo(); if (results.getUpdateType() != null) { renderUpdate(errorChannel, results); } else if (results.getColumns() == null) { errorChannel.printf("Query %s has no columns\n", results.getId()); return false; } else { renderResults(out, outputFormat, interactive, results.getColumns()); } } checkState(!client.isRunning()); if (statusPrinter != null) { statusPrinter.printFinalInfo(); } if (client.isClientAborted()) { errorChannel.println("Query aborted by user"); return false; } if (client.isClientError()) { errorChannel.println("Query is gone (server restarted?)"); return false; } verify(client.isFinished()); if (client.finalStatusInfo().getError() != null) { renderFailure(errorChannel); return false; } return true; }
Source:
private void adjustSliderWithKey(int key) { int oldSliderValue = hoverOption.getIntegerValue(); if (key == Input.KEY_RIGHT) { hoverOption.setValue(hoverOption.getIntegerValue() + 1); } else if (key == Input.KEY_LEFT) { hoverOption.setValue(hoverOption.getIntegerValue() - 1); } if (hoverOption.getIntegerValue() != oldSliderValue && sliderSoundDelay == 0) { sliderSoundDelay = SLIDER_SOUND_INTERVAL; SoundController.playSound(SoundEffect.MENUCLICK); } }

Target:
private void adjustSliderWithKey(int key) { int oldSliderValue = hoverOption.getIntegerValue(); if (key == Input.KEY_RIGHT) { hoverOption.setValue(oldSliderValue + 1); } else if (key == Input.KEY_LEFT) { hoverOption.setValue(oldSliderValue - 1); } if (hoverOption.getIntegerValue() != oldSliderValue && sliderSoundDelay == 0) { sliderSoundDelay = SLIDER_SOUND_INTERVAL; SoundController.playSound(SoundEffect.MENUCLICK); } }
Source:
protected void executeCommand() { VdcReturnValueBase result = runInternalActionWithTasksContext( VdcActionType.UpdateVmVersion, new UpdateVmVersionParameters(getVmId())); if (!result.getSucceeded() && !result.isValid()) { log.warn("Couldn't update VM '{}' ({}) version from it's template, continue with restoring stateless snapshot.", getVm().getName(), getVmId()); setSucceeded(restoreInitialState()); } else { setSucceeded(result.getSucceeded()); } }

Target:
protected void executeCommand() { VdcReturnValueBase result = runInternalActionWithTasksContext( VdcActionType.UpdateVmVersion, buildUpdateVmVersionParameters()); if (!result.getSucceeded() && !result.isValid()) { log.warn("Couldn't update VM '{}' ({}) version from it's template, continue with restoring stateless snapshot.", getVm().getName(), getVmId()); setSucceeded(restoreInitialState()); } else { setSucceeded(result.getSucceeded()); } }
Source:
public ScreenshotFormat get() { switch (config.getScreenshotFormat()) { case PNG: return PNG; case JPEG: return JPEG; default: return PNG; } }

Target:
public ScreenshotFormat get() { if(config.getScreenshotFormat() != null) { return config.getScreenshotFormat(); } else { return ScreenshotFormat.PNG; } }
Source:
public synchronized IterableStream<ServiceBusReceivedMessageContext> receive(int maxMessages, Duration maxWaitTime) { if (maxMessages <= 0) { throw logger.logExceptionAsError(new IllegalArgumentException( "'maxMessages' cannot be less than or equal to 0. maxMessages: " + maxMessages)); } else if (Objects.isNull(maxWaitTime)) { throw logger.logExceptionAsError( new NullPointerException("'maxWaitTime' cannot be null.")); } else if (maxWaitTime.isNegative() || maxWaitTime.isZero()) { throw logger.logExceptionAsError( new IllegalArgumentException("'maxWaitTime' cannot be zero or less. maxWaitTime: " + maxWaitTime)); } final Flux<ServiceBusReceivedMessageContext> messages = Flux.create(emitter -> queueWork(maxMessages, maxWaitTime, emitter)); return new IterableStream<>(messages); }

Target:
public IterableStream<ServiceBusReceivedMessageContext> receive(int maxMessages, Duration maxWaitTime) { if (maxMessages <= 0) { throw logger.logExceptionAsError(new IllegalArgumentException( "'maxMessages' cannot be less than or equal to 0. maxMessages: " + maxMessages)); } else if (Objects.isNull(maxWaitTime)) { throw logger.logExceptionAsError( new NullPointerException("'maxWaitTime' cannot be null.")); } else if (maxWaitTime.isNegative() || maxWaitTime.isZero()) { throw logger.logExceptionAsError( new IllegalArgumentException("'maxWaitTime' cannot be zero or less. maxWaitTime: " + maxWaitTime)); } final Flux<ServiceBusReceivedMessageContext> messages = Flux.create(emitter -> queueWork(maxMessages, maxWaitTime, emitter)); return new IterableStream<>(messages); }
Source:
public void getSurveyInstancesReturnsFilteredData() { Survey form1 = createForm(); Survey form2 = createForm(); Device device = createDevice(); SurveyedLocale dataPoint = createDataPoint(); List<Long> dataPointIds = Arrays.asList(dataPoint.getKey().getId()); List<SurveyInstance> allFormInstances = createFormInstances(dataPoint, randomInt(), form1, form2); List<SurveyInstance> form1Instances = allFormInstances.stream() .filter(surveyInstance -> surveyInstance.getSurveyId().equals(form1.getKey().getId())) .collect(Collectors.toList()); SurveyAssignment assignment = createAssignment(dataPoint.getSurveyGroupId(), Arrays.asList(device.getKey().getId()), Arrays.asList(form1.getKey().getId())); DataPointUtil dpu = new DataPointUtil(); Map<Long, List<SurveyInstance>> foundInstances = dpu.getSurveyInstances(dataPointIds, dataPoint.getSurveyGroupId(), device); Set<Long> expectedIds = getIds(form1Instances); Set<Long> resultIds = getIds(foundInstances.get(dataPoint.getKey().getId())); assertEquals(expectedIds, resultIds); }

Target:
public void getSurveyInstancesReturnsFilteredData() { Survey form1 = createForm(); Survey form2 = createForm(); Device device = createDevice(); SurveyedLocale dataPoint = createDataPoint(); List<SurveyInstance> allFormInstances = createFormInstances(dataPoint, form1, form2); List<SurveyInstance> form1Instances = new ArrayList<>(); for (SurveyInstance surveyInstance : allFormInstances) { if (surveyInstance.getSurveyId().equals(form1.getKey().getId())) { form1Instances.add(surveyInstance); } } createAssignment(dataPoint.getSurveyGroupId(), Collections.singletonList(device.getKey().getId()), Collections.singletonList(form1.getKey().getId())); DataPointUtil dpu = new DataPointUtil(); List<SurveyedLocaleDto> datapointList = dpu.getSurveyedLocaleDtosList(Collections.singletonList(dataPoint), dataPoint.getSurveyGroupId(), device); Set<String> expected = uuidsFromFormInstances(form1Instances); Set<String> actual = uuidsFromDataPoints(datapointList); assertEquals(expected, actual); }
Source:
public SystemType getOS () { String os = java.lang.System.getProperty("os.name").toLowerCase(); if(os.indexOf("win") >= 0) return SystemType.Windows; else if(os.indexOf("mac") >= 0) return SystemType.OSX; else if(os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0 || os.indexOf("aix") > 0) return SystemType.Linux; else return null; }

Target:
public SystemType getOS() { return SystemType.parseDesktopOS(); }
Source:
private String subString(final String marshal, final String from, final String to) { final StringBuilder builder = new StringBuilder(); boolean found = false; for (String row : marshal.split("\\r?\\n")) { if (found && Objects.equals(row.trim(), to)) { break; } if (found) { final String trim = row.trim(); if (!trim.isEmpty()) { builder.append(trim); builder.append("\n"); } } if (!found && Objects.equals(row.trim(), from)) { found = true; } } return builder.toString(); }

Target:
private String subString(final String marshal, final String from, final String to) { final Pattern regex = Pattern.compile("\\s*" + from + "\\s*(.*)" + to, Pattern.DOTALL); final Matcher regexMatcher = regex.matcher(marshal); if (regexMatcher.find()) { return regexMatcher.group(1); } else { throw new IllegalStateException(String.format("No substring between '%s' and '%s' found", from, to)); } }
Source:
public Aggregator factorize(ColumnSelectorFactory metricFactory) { return new LongFirstAggregator( name, metricFactory.makeLongColumnSelector(fieldName), metricFactory.makeLongColumnSelector(Column.TIME_COLUMN_NAME) ); }

Target:
public Aggregator factorize(ColumnSelectorFactory metricFactory) { return new LongFirstAggregator( name, metricFactory.makeLongColumnSelector(Column.TIME_COLUMN_NAME), metricFactory.makeLongColumnSelector(fieldName) ); }
Source:
public boolean chkAuthorizationByRole(String userName, String[] userRoles) throws QuadrigaStorageException, QuadrigaAccessException { ArrayList<String> roles; if (projectSecurityManager.ownsAtLeastOneProject(userName)) { return true; } else { if (userRoles.length > 0) { roles = getAccessRoleList(userRoles); for (String role : roles) { if (projectSecurityManager.collaboratesOnAtLeastOneProject(userName, role)) { return true; } } } } return false; }

Target:
public boolean chkAuthorizationByRole(String userName, String[] userRoles) throws QuadrigaStorageException, QuadrigaAccessException { if (projectSecurityManager.ownsAtLeastOneProject(userName)) { return true; } else { if (userRoles.length > 0) { List<String> roles = Arrays.asList(userRoles); for (String role : roles) { if (projectSecurityManager.collaboratesOnAtLeastOneProject(userName, role)) { return true; } } } } return false; }
Source:
public boolean isActivated() { return false; }

Target:
public boolean isActivated() { return true; }
Source:
@Override public Response execute(Command command) throws WebDriverException { if (DriverCommand.NEW_SESSION.equals(command.getName())) { ofNullable(service).ifPresent(driverService -> { try { driverService.start(); } catch (IOException e) { throw new WebDriverException(e.getMessage(), e); } }); } try { return super.execute(command); } catch (Throwable t) { Throwable rootCause = Throwables.getRootCause(t); if (rootCause instanceof ConnectException && rootCause.getMessage().contains("Connection refused")) { throw ofNullable(service).map((Function<DriverService, WebDriverException>) service -> { if (service.isRunning()) { return new WebDriverException("The session is closed!", rootCause); } return new WebDriverException("The appium server has accidentally died!", rootCause); }).orElse(new WebDriverException(rootCause.getMessage(), rootCause)); } throwIfUnchecked(t); throw new WebDriverException(t); } finally { if (DriverCommand.QUIT.equals(command.getName()) && service != null) { service.stop(); } } }

Target:
@Override public Response execute(Command command) throws WebDriverException { if (DriverCommand.NEW_SESSION.equals(command.getName())) { serviceOptional.ifPresent(driverService -> { try { driverService.start(); } catch (IOException e) { throw new WebDriverException(e.getMessage(), e); } }); } try { return super.execute(command); } catch (Throwable t) { Throwable rootCause = Throwables.getRootCause(t); if (rootCause instanceof ConnectException && rootCause.getMessage().contains("Connection refused")) { throw serviceOptional.map(service -> { if (service.isRunning()) { return new WebDriverException("The session is closed!", rootCause); } return new WebDriverException("The appium server has accidentally died!", rootCause); }).orElseGet((Supplier<WebDriverException>) () -> new WebDriverException(rootCause.getMessage(), rootCause)); } throwIfUnchecked(t); throw new WebDriverException(t); } finally { if (DriverCommand.QUIT.equals(command.getName())) { serviceOptional.ifPresent(DriverService::stop); } } }
Source:
public Map<DiskImage, DiskImage> mapChainToNewIDs(Guid sourceImageGroupID, Guid newImageGroupID, Guid targetStorageDomainID) { List<DiskImage> oldChain = diskImageDao.getAllSnapshotsForImageGroup(sourceImageGroupID); Map<DiskImage, DiskImage> oldToNewChain = new HashMap<>(oldChain.size()); Guid nextParentId = Guid.Empty; sortImageList(oldChain); for (DiskImage diskImage : oldChain) { DiskImage newImage = DiskImage.copyOf(diskImage); newImage.setParentId(nextParentId); newImage.setId(newImageGroupID); newImage.setStorageIds(List.of(targetStorageDomainID)); nextParentId = Guid.newGuid(); newImage.setImageId(nextParentId); newImage.setVmSnapshotId(null); oldToNewChain.put(diskImage, newImage); } log.info("New image group {}", newImageGroupID); log.info("mapped old chain to new chain {}", ImagesHandler.getDiskImageIds(oldChain), oldToNewChain); return oldToNewChain; }

Target:
public Map<DiskImage, DiskImage> mapChainToNewIDs(Guid sourceImageGroupID, Guid newImageGroupID, Guid targetStorageDomainID) { List<DiskImage> oldChain = diskImageDao.getAllSnapshotsForImageGroup(sourceImageGroupID); Map<DiskImage, DiskImage> oldToNewChain = new HashMap<>(oldChain.size()); Guid nextParentId = Guid.Empty; sortImageList(oldChain); for (DiskImage diskImage : oldChain) { DiskImage newImage = DiskImage.copyOf(diskImage); newImage.setParentId(nextParentId); newImage.setId(newImageGroupID); newImage.setStorageIds(List.of(targetStorageDomainID)); nextParentId = Guid.newGuid(); newImage.setImageId(nextParentId); newImage.setVmSnapshotId(null); oldToNewChain.put(diskImage, newImage); } return oldToNewChain; }
Source:
public StringBuffer format(@Nullable Object obj, @Nullable StringBuffer toAppendTo, @Nullable FieldPosition pos) { if (!(obj instanceof Number) || toAppendTo == null) { throw new IllegalArgumentException("Cannot format given Object as a Number: " + obj); } @Nullable LamiGraphRange internalRange = fInternalRange; @Nullable LamiGraphRange externalRange = fExternalRange; if (internalRange == null || externalRange == null) { StringBuffer buffer = super.format(obj, toAppendTo, pos); return buffer == null ? new StringBuffer() : buffer; } if (internalRange.getDelta().compareTo(BigDecimal.ZERO) == 0) { StringBuffer buffer = super.format(externalRange.getMinimum().doubleValue(), toAppendTo, pos); return buffer == null ? new StringBuffer() : buffer; } if (externalRange.getDelta().compareTo(BigDecimal.ZERO) == 0) { StringBuffer buffer = super.format(externalRange.getMinimum().doubleValue(), toAppendTo, pos); return buffer == null ? new StringBuffer() : buffer; } BigDecimal externalValue = (new BigDecimal(obj.toString())) .subtract(internalRange.getMinimum()) .multiply(externalRange.getDelta()) .divide(internalRange.getDelta(), BIG_DECIMAL_DIVISION_SCALE, BigDecimal.ROUND_DOWN) .add(externalRange.getMinimum()); Double value = externalValue.doubleValue(); StringBuffer buffer = super.format(value, toAppendTo, pos); return buffer == null ? new StringBuffer() : buffer; }

Target:
public StringBuffer format(@Nullable Object obj, @Nullable StringBuffer toAppendTo, @Nullable FieldPosition pos) { if (!(obj instanceof Number) || toAppendTo == null) { throw new IllegalArgumentException("Cannot format given Object as a Number: " + obj); } @Nullable LamiGraphRange internalRange = fInternalRange; @Nullable LamiGraphRange externalRange = fExternalRange; if (internalRange == null || externalRange == null) { StringBuffer buffer = super.format(obj, toAppendTo, pos); return (buffer == null ? new StringBuffer() : buffer); } if (internalRange.getDelta().compareTo(BigDecimal.ZERO) == 0) { StringBuffer buffer = super.format(externalRange.getMinimum().doubleValue(), toAppendTo, pos); return (buffer == null ? new StringBuffer() : buffer); } if (externalRange.getDelta().compareTo(BigDecimal.ZERO) == 0) { StringBuffer buffer = super.format(externalRange.getMinimum().doubleValue(), toAppendTo, pos); return (buffer == null ? new StringBuffer() : buffer); } BigDecimal externalValue = (new BigDecimal(obj.toString())) .subtract(internalRange.getMinimum()) .multiply(externalRange.getDelta()) .divide(internalRange.getDelta(), BIG_DECIMAL_DIVISION_SCALE, BigDecimal.ROUND_DOWN) .add(externalRange.getMinimum()); Double value = externalValue.doubleValue(); StringBuffer buffer = super.format(value, toAppendTo, pos); return (buffer == null ? new StringBuffer() : buffer); }
Source:
public Container readContainerHeader(final int major, final InputStream inputStream) { final byte[] peek = new byte[4]; try { int character = inputStream.read(); if (character == -1) return readContainerHeader(new ByteArrayInputStream((major >= 3 ? CramIO.ZERO_F_EOF_MARKER : CramIO.ZERO_B_EOF_MARKER))); peek[0] = (byte) character; for (int i = 1; i < peek.length; i++) { character = inputStream.read(); if (character == -1) throw new RuntimeException("Incomplete or broken stream."); peek[i] = (byte) character; } } catch (final IOException e) { throw new RuntimeIOException(e); } final int containerByteSize = CramInt.readInt32(peek); final ReferenceContext refContext = new ReferenceContext(ITF8.readUnsignedITF8(inputStream)); final Container container = new Container(refContext); container.containerByteSize = containerByteSize; container.alignmentStart = ITF8.readUnsignedITF8(inputStream); container.alignmentSpan = ITF8.readUnsignedITF8(inputStream); container.nofRecords = ITF8.readUnsignedITF8(inputStream); container.globalRecordCounter = LTF8.readUnsignedLTF8(inputStream); container.bases = LTF8.readUnsignedLTF8(inputStream); container.blockCount = ITF8.readUnsignedITF8(inputStream); container.landmarks = CramIntArray.array(inputStream); if (major >= 3) container.checksum = CramInt.readInt32(inputStream); return container; }

Target:
public static Container readContainerHeader(final int major, final InputStream inputStream) { final byte[] peek = new byte[4]; try { int character = inputStream.read(); if (character == -1) { final int majorVersionForEOF = 2; final byte[] eofMarker = major >= 3 ? CramIO.ZERO_F_EOF_MARKER : CramIO.ZERO_B_EOF_MARKER; try (final ByteArrayInputStream eofBAIS = new ByteArrayInputStream(eofMarker)) { return readContainerHeader(majorVersionForEOF, eofBAIS); } } peek[0] = (byte) character; for (int i = 1; i < peek.length; i++) { character = inputStream.read(); if (character == -1) throw new RuntimeException("Incomplete or broken stream."); peek[i] = (byte) character; } } catch (final IOException e) { throw new RuntimeIOException(e); } final int containerByteSize = CramInt.readInt32(peek); final ReferenceContext refContext = new ReferenceContext(ITF8.readUnsignedITF8(inputStream)); final Container container = new Container(refContext); container.containerByteSize = containerByteSize; container.alignmentStart = ITF8.readUnsignedITF8(inputStream); container.alignmentSpan = ITF8.readUnsignedITF8(inputStream); container.nofRecords = ITF8.readUnsignedITF8(inputStream); container.globalRecordCounter = LTF8.readUnsignedLTF8(inputStream); container.bases = LTF8.readUnsignedLTF8(inputStream); container.blockCount = ITF8.readUnsignedITF8(inputStream); container.landmarks = CramIntArray.array(inputStream); if (major >= 3) container.checksum = CramInt.readInt32(inputStream); return container; }
Source:
public static void createTable(Connection c, String storageKey, Persistable p) { String sqlStatement = DatabaseHelper.getTableCreateString(storageKey, p); PreparedStatement preparedStatement = null; try { preparedStatement = c.prepareStatement(sqlStatement); preparedStatement.execute(); } catch (SQLException e) { } finally { if (preparedStatement != null) { try { preparedStatement.close(); } catch (SQLException e) { } } } }

Target:
public static void createTable(Connection c, String storageKey, Persistable p) { String sqlStatement = DatabaseHelper.getTableCreateString(storageKey, p); PreparedStatement preparedStatement = null; try { preparedStatement = c.prepareStatement(sqlStatement); preparedStatement.execute(); } catch (SQLException e) { throw new RuntimeException(e); } finally { if (preparedStatement != null) { try { preparedStatement.close(); } catch (SQLException e) { e.printStackTrace(); } } } }
Source:
private static RedisSentinelConfiguration getSentinelConfig(final BaseRedisProperties redis) { LOGGER.trace("Setting Redis with Sentinel configuration on master '{}'", redis.getSentinel().getMaster()); val sentinelConfig = new RedisSentinelConfiguration().master(redis.getSentinel().getMaster()); LOGGER.trace("Sentinel nodes configured are '{}'", redis.getSentinel().getNode()); sentinelConfig.setSentinels(createRedisNodesForProperties(redis)); sentinelConfig.setDatabase(redis.getDatabase()); if (StringUtils.hasText(redis.getPassword())) { sentinelConfig.setPassword(RedisPassword.of(redis.getPassword())); } return sentinelConfig; }

Target:
private static RedisSentinelConfiguration getSentinelConfig(final BaseRedisProperties redis) { LOGGER.debug("Setting Redis with Sentinel configuration on master [{}]", redis.getSentinel().getMaster()); val sentinelConfig = new RedisSentinelConfiguration().master(redis.getSentinel().getMaster()); LOGGER.debug("Sentinel nodes configured are [{}]", redis.getSentinel().getNode()); sentinelConfig.setSentinels(createRedisNodesForProperties(redis)); sentinelConfig.setDatabase(redis.getDatabase()); if (StringUtils.hasText(redis.getPassword())) { sentinelConfig.setPassword(RedisPassword.of(redis.getPassword())); } return sentinelConfig; }
Source:
public AttributionView findByEntryNumber(@PathParam("entry-number") int entryNumber) { try { Optional<Entry> entry = entryDAO.findByEntryNumber(entryNumber); return entry.map(viewFactory::getNewEntryView).orElseThrow(NotFoundException::new); } catch (Throwable e) { if (e.getCause() instanceof PSQLException && ((PSQLException) e.getCause()).getSQLState().equals("42P01")) { return findBySerial(Optional.of(entryNumber)); } throw e; } }

Target:
public AttributionView findByEntryNumber(@PathParam("entry-number") int entryNumber) { try { Optional<Entry> entry = entryDAO.findByEntryNumber(entryNumber); return entry.map(viewFactory::getNewEntryView).orElseThrow(NotFoundException::new); } catch (Throwable e) { if (e.getCause() instanceof PSQLException && ((PSQLException) e.getCause()).getSQLState().equals(POSTGRES_TABLE_NOT_EXIST_ERROR_CODE)) { return findBySerial(Optional.of(entryNumber)); } throw e; } }