auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public List<String> generateErrorMessages(List<ValidationError> errorsList, String syntaxErrorMessage, Map<ValidationFailureReason, String> failureReasonsToVdcBllMessagesMap, Map<ValidationFailureReason, String> failureReasonsToParameterFormatStrings) { if (errorsList == null || errorsList.isEmpty()) { return Collections.emptyList(); } if (errorsList.size() == 1 && errorsList.get(0).getReason() == ValidationFailureReason.SYNTAX_ERROR) { return Arrays.asList(syntaxErrorMessage); } if (errorsList.size() == 1 && errorsList.get(0).getReason() == ValidationFailureReason.UNSUPPORTED_VERSION) { return Arrays.asList(syntaxErrorMessage); } List<String> result = new ArrayList<String>(); Map<ValidationFailureReason, List<ValidationError>> resultMap = new HashMap<CustomPropertiesUtils.ValidationFailureReason, List<ValidationError>>(); separateValidationErrorsList(errorsList, resultMap); for (Map.Entry<ValidationFailureReason, String> entry : failureReasonsToVdcBllMessagesMap.entrySet()) { List<ValidationError> errorsListForReason = resultMap.get(entry.getKey()); String vdcBllMessage = entry.getValue(); String formatString = failureReasonsToParameterFormatStrings.get(entry.getKey()); addMessage(result, vdcBllMessage, formatString, errorsListForReason); } return result; }

Target:
public List<String> generateErrorMessages(List<ValidationError> errorsList, String syntaxErrorMessage, Map<ValidationFailureReason, String> failureReasonsToVdcBllMessagesMap, Map<ValidationFailureReason, String> failureReasonsToParameterFormatStrings) { if (errorsList == null || errorsList.isEmpty()) { return Collections.emptyList(); } if (errorsList.size() == 1 && errorsList.get(0).getReason() == ValidationFailureReason.SYNTAX_ERROR) { return Arrays.asList(syntaxErrorMessage); } List<String> result = new ArrayList<String>(); Map<ValidationFailureReason, List<ValidationError>> resultMap = new HashMap<CustomPropertiesUtils.ValidationFailureReason, List<ValidationError>>(); separateValidationErrorsList(errorsList, resultMap); for (Map.Entry<ValidationFailureReason, String> entry : failureReasonsToVdcBllMessagesMap.entrySet()) { List<ValidationError> errorsListForReason = resultMap.get(entry.getKey()); String vdcBllMessage = entry.getValue(); String formatString = failureReasonsToParameterFormatStrings.get(entry.getKey()); addMessage(result, vdcBllMessage, formatString, errorsListForReason); } return result; }
Source:
Mono<Response<AreaCodes>> getAllAreaCodesWithResponse( String locationType, String countryCode, String phonePlanId, List<LocationOptionsQuery> locationOptions, Context context) { LocationOptionsQueries locationOptionsQueries = new LocationOptionsQueries(); locationOptionsQueries.setLocationOptions(locationOptions); if (locationOptions == null) { Mono.error(new NullPointerException("'locationType' cannot be null.")); } if (countryCode == null) { Mono.error(new NullPointerException("'countryCode' cannot be null.")); } if (phonePlanId == null) { Mono.error(new NullPointerException("'phonePlanId' cannot be null.")); } try { if (context == null) { return phoneNumberAdministrations.getAllAreaCodesWithResponseAsync( locationType, countryCode, phonePlanId, locationOptionsQueries); } else { return phoneNumberAdministrations.getAllAreaCodesWithResponseAsync( locationType, countryCode, phonePlanId, locationOptionsQueries, context); } } catch (RuntimeException ex) { return monoError(logger, ex); } }

Target:
Mono<Response<AreaCodes>> getAllAreaCodesWithResponse( String locationType, String countryCode, String phonePlanId, List<LocationOptionsQuery> locationOptions, Context context) { LocationOptionsQueries locationOptionsQueries = new LocationOptionsQueries(); locationOptionsQueries.setLocationOptions(locationOptions); try { Objects.requireNonNull(locationType, "'locationType' cannot be null."); Objects.requireNonNull(countryCode, "'countryCode' cannot be null."); Objects.requireNonNull(phonePlanId, "'phonePlanId' cannot be null."); if (context == null) { return phoneNumberAdministrations.getAllAreaCodesWithResponseAsync( locationType, countryCode, phonePlanId, locationOptionsQueries); } else { return phoneNumberAdministrations.getAllAreaCodesWithResponseAsync( locationType, countryCode, phonePlanId, locationOptionsQueries, context); } } catch (RuntimeException ex) { return monoError(logger, ex); } }
Source:
private static int compare(int a, int b) { return a < b ? -1 : a > b ? 1 : 0; }

Target:
private static int compare(int a, int b) { return (a-b); }
Source:
public static SetMultimap<String, String> getRequirementValuesMap(Iterable<IAnalysisRequirementProvider> providers) { SetMultimap<String, String> valuesByType = NonNullUtils.checkNotNull(HashMultimap.create()); for (IAnalysisRequirementProvider provider : providers) { for (TmfAnalysisRequirement requirement : provider.getAnalysisRequirements()) { valuesByType.putAll(requirement.getType(), requirement.getValues()); } } return valuesByType; }

Target:
public static SetMultimap<String, String> getRequirementValuesMap(Iterable<IAnalysisRequirementProvider> providers) { SetMultimap<String, String> valuesByType = HashMultimap.create(); for (IAnalysisRequirementProvider provider : providers) { for (TmfAnalysisRequirement requirement : provider.getAnalysisRequirements()) { valuesByType.putAll(requirement.getType(), requirement.getValues()); } } return valuesByType; }
Source:
public void updateUsbSlots(VmBase oldVm, VmBase newVm) { Objects.requireNonNull(oldVm); Objects.requireNonNull(newVm); final UsbPolicy oldUsbPolicy = oldVm.getUsbPolicy(); final UsbPolicy newUsbPolicy = newVm.getUsbPolicy(); final int oldNumberOfSlots = getUsbSlots(oldVm.getId()).size(); final int newNumberOfUsbSlots = Config.<Integer> getValue(ConfigValues.NumberOfUSBSlots); if (UsbPolicy.DISABLED == oldUsbPolicy && UsbPolicy.ENABLED_NATIVE == newUsbPolicy) { disableNormalUsb(newVm.getId()); enableSpiceUsb(newVm.getId(), newNumberOfUsbSlots); return; } if (UsbPolicy.ENABLED_NATIVE == oldUsbPolicy && UsbPolicy.ENABLED_NATIVE == newUsbPolicy) { updateSpiceUsb(newVm.getId(), oldNumberOfSlots, newNumberOfUsbSlots); return; } if (UsbPolicy.ENABLED_NATIVE == oldUsbPolicy && UsbPolicy.DISABLED == newUsbPolicy) { disableSpiceUsb(newVm.getId()); enableNormalUsb(newVm); return; } if (UsbPolicy.DISABLED == oldUsbPolicy && UsbPolicy.DISABLED == newUsbPolicy) { updateNormalUsb(newVm); return; } throw new RuntimeException( format("Unexpected state: oldUsbPolicy=%s, newUsbPolicy=%s", oldUsbPolicy, newUsbPolicy)); }

Target:
public void updateUsbSlots(VmBase oldVm, VmBase newVm) { final UsbPolicy oldUsbPolicy = oldVm.getUsbPolicy(); final UsbPolicy newUsbPolicy = newVm.getUsbPolicy(); final int oldNumberOfSlots = getUsbSlots(oldVm.getId()).size(); final int newNumberOfUsbSlots = Config.<Integer> getValue(ConfigValues.NumberOfUSBSlots); if (UsbPolicy.DISABLED == oldUsbPolicy && UsbPolicy.ENABLED_NATIVE == newUsbPolicy) { disableNormalUsb(newVm.getId()); enableSpiceUsb(newVm.getId(), newNumberOfUsbSlots); return; } if (UsbPolicy.ENABLED_NATIVE == oldUsbPolicy && UsbPolicy.ENABLED_NATIVE == newUsbPolicy) { updateSpiceUsb(newVm.getId(), oldNumberOfSlots, newNumberOfUsbSlots); return; } if (UsbPolicy.ENABLED_NATIVE == oldUsbPolicy && UsbPolicy.DISABLED == newUsbPolicy) { disableSpiceUsb(newVm.getId()); enableNormalUsb(newVm); return; } if (UsbPolicy.DISABLED == oldUsbPolicy && UsbPolicy.DISABLED == newUsbPolicy) { updateNormalUsb(newVm); return; } throw new RuntimeException( format("Unexpected state: oldUsbPolicy=%s, newUsbPolicy=%s", oldUsbPolicy, newUsbPolicy)); }
Source:
public void setInput(Object input) { Assert.isLegal(input == null || input instanceof String || input instanceof BrowserInformationControlInput, input != null ? input.getClass().getName() : null); if (input instanceof String) { setInformation((String)input); return; } fInput= (BrowserInformationControlInput)input; String content= null; if (fInput != null) content= fInput.getHtml(); fBrowserHasContent= content != null && content.length() > 0; if (!fBrowserHasContent) content= "<html><body ></html>"; boolean RTL= (getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0; boolean resizable= isResizable(); String[] styles= null; if (RTL && resizable) styles= new String[] { "direction:rtl;", "overflow:scroll;", "word-wrap:break-word;" }; else if (RTL && !resizable) styles= new String[] { "direction:rtl;", "overflow:hidden;", "word-wrap:break-word;" }; else if (!resizable) styles= new String[] { "overflow:hidden;" }; else styles= new String[] { "overflow:scroll;" }; StringBuffer buffer= new StringBuffer(content); HTMLPrinter.insertStyles(buffer, styles); content= buffer.toString(); fCompleted= false; fBrowser.setText(content); for (IInputChangedListener listener : fInputChangeListeners) { listener.inputChanged(fInput); } }

Target:
public void setInput(Object input) { Assert.isLegal(input == null || input instanceof String || input instanceof BrowserInformationControlInput, input != null ? input.getClass().getName() : "null"); if (input instanceof String) { setInformation((String)input); return; } fInput= (BrowserInformationControlInput)input; String content= null; if (fInput != null) content= fInput.getHtml(); fBrowserHasContent= content != null && content.length() > 0; if (!fBrowserHasContent) content= "<html><body ></html>"; boolean RTL= (getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0; boolean resizable= isResizable(); String[] styles= null; if (RTL && resizable) styles= new String[] { "direction:rtl;", "overflow:scroll;", "word-wrap:break-word;" }; else if (RTL && !resizable) styles= new String[] { "direction:rtl;", "overflow:hidden;", "word-wrap:break-word;" }; else if (!resizable) styles= new String[] { "overflow:hidden;" }; else styles= new String[] { "overflow:scroll;" }; StringBuffer buffer= new StringBuffer(content); HTMLPrinter.insertStyles(buffer, styles); content= buffer.toString(); fCompleted= false; fBrowser.setText(content); for (IInputChangedListener listener : fInputChangeListeners) { listener.inputChanged(fInput); } }
Source:
protected Object handleRequestMessage(Message<?> requestMessage) { Collection<ConditionalStreamListenerHandler> matchingHandlers = findMatchingHandlers(requestMessage); if (matchingHandlers.size() == 0) { if (logger.isWarnEnabled()) { logger.warn("Cannot find a @StreamListener matching " + requestMessage); } return null; } else if (matchingHandlers.size() > 1) { for (ConditionalStreamListenerHandler matchingHandler : matchingHandlers) { if (!matchingHandler.isVoid()) { throw new MessagingException( "Multiple matching methods cannot return values for " + requestMessage); } } for (ConditionalStreamListenerHandler matchingMethod : matchingHandlers) { matchingMethod.handleMessage(requestMessage); } return null; } else { final ConditionalStreamListenerHandler singleMatchingHandler = matchingHandlers.iterator().next(); singleMatchingHandler.handleMessage(requestMessage); return null; } }

Target:
protected Object handleRequestMessage(Message<?> requestMessage) { Collection<ConditionalStreamListenerHandler> matchingHandlers = findMatchingHandlers(requestMessage); if (matchingHandlers.size() == 0) { if (logger.isWarnEnabled()) { logger.warn("Cannot find a @StreamListener matching for message with id: " + requestMessage.getHeaders().getId()); } return null; } else if (matchingHandlers.size() > 1) { for (ConditionalStreamListenerHandler matchingMethod : matchingHandlers) { matchingMethod.handleMessage(requestMessage); } return null; } else { final ConditionalStreamListenerHandler singleMatchingHandler = matchingHandlers.iterator().next(); singleMatchingHandler.handleMessage(requestMessage); return null; } }
Source:
public static AbstractCalledFunction create(long start, long end, int depth, String value, @Nullable ICalledFunction parent) { if (start > end) { throw new IllegalArgumentException(Messages.TimeError + '[' + start + ',' + end + ']'); } return new CalledStringFunction(start, end, value, depth, parent); }

Target:
private static CalledStringFunction create(long start, long end, int depth, String value, @Nullable ICalledFunction parent) { if (start > end) { throw new IllegalArgumentException(Messages.TimeError + '[' + start + ',' + end + ']'); } return new CalledStringFunction(start, end, value, depth, parent); }
Source:
public void test() { JavaCheckVerifier.verify("src/test/files/checks/security/PasswordEncoder.java", new PasswordEncoderCheck()); }

Target:
public void test() { JavaCheckVerifier.verify("src/test/files/checks/security/PasswordEncoder.java", new PasswordEncoderCheck()); JavaCheckVerifier.verifyNoIssueWithoutSemantic("src/test/files/checks/security/PasswordEncoder.java", new PasswordEncoderCheck()); }
Source:
protected void validate() throws AxonConfigurationException { assertNonNull(repository, "The Repository is a hard requirement and should be provided"); assertNonNull(commandTargetResolver, "The CommandTargetResolver is a hard requirement and should be provided"); if (aggregateModel == null) { assertNonNull( aggregateType, "No AggregateModel is set, whilst either it or the aggregateType is a hard requirement" ); return; } assertNonNull( aggregateModel, "No aggregateType is set, whilst either it or the AggregateModel is a hard requirement" ); }

Target:
protected void validate() throws AxonConfigurationException { assertNonNull(repository, "The Repository is a hard requirement and should be provided"); if (aggregateModel == null) { assertNonNull( aggregateType, "No AggregateModel is set, whilst either it or the aggregateType is a hard requirement" ); return; } assertNonNull( aggregateModel, "No aggregateType is set, whilst either it or the AggregateModel is a hard requirement" ); }
Source:
public FilterStatsCalculator(Metadata metadata, ScalarStatsCalculator scalarStatsCalculator, StatsNormalizer normalizer) { this.metadata = requireNonNull(metadata, "metadata is null"); this.scalarStatsCalculator = requireNonNull(scalarStatsCalculator, "scalarStatsCalculator is null"); this.normalizer = requireNonNull(normalizer, "normalizer is null"); this.literalEncoder = new LiteralEncoder(metadata.getBlockEncodingSerde()); this.resolution = new StandardFunctionResolution(metadata.getFunctionManager()); }

Target:
public FilterStatsCalculator(Metadata metadata, ScalarStatsCalculator scalarStatsCalculator, StatsNormalizer normalizer) { this.metadata = requireNonNull(metadata, "metadata is null"); this.scalarStatsCalculator = requireNonNull(scalarStatsCalculator, "scalarStatsCalculator is null"); this.normalizer = requireNonNull(normalizer, "normalizer is null"); this.literalEncoder = new LiteralEncoder(metadata.getBlockEncodingSerde()); this.functionResolution = new StandardFunctionResolution(metadata.getFunctionManager()); }
Source:
protected void stopListeningForIOSamples(IIOSampleReceiveListener listener) { if (dataReader == null) return; dataReader.removeIOSampleReceiveListener(listener); }

Target:
protected void stopListeningForIOSamples(IIOSampleReceiveListener listener) { if (listener == null) throw new NullPointerException("Listener cannot be null."); if (dataReader == null) return; dataReader.removeIOSampleReceiveListener(listener); }
Source:
public MetricSchemaRecordList deserialize(JsonParser jp, DeserializationContext context) throws IOException, JsonProcessingException { String scrollID = null; List<MetricSchemaRecord> records = Collections.emptyList(); JsonNode rootNode = jp.getCodec().readTree(jp); if(rootNode.has("_scroll_id")) { scrollID = rootNode.get("_scroll_id").asText(); } JsonNode hits = rootNode.get("hits").get("hits"); if(JsonNodeType.ARRAY.equals(hits.getNodeType())) { records = new ArrayList<>(hits.size()); Iterator<JsonNode> iter = hits.elements(); while(iter.hasNext()) { JsonNode hit = iter.next(); JsonNode source = hit.get("_source"); JsonNode namespaceNode = source.get(RecordType.NAMESPACE.getName()); JsonNode scopeNode = source.get(RecordType.SCOPE.getName()); JsonNode metricNode = source.get(RecordType.METRIC.getName()); JsonNode tagkNode = source.get(RecordType.TAGK.getName()); JsonNode tagvNode = source.get(RecordType.TAGV.getName()); JsonNode retentionNode = source.get(RecordType.RETENTIONDISCOVERY.getName()); records.add(new MetricSchemaRecord(namespaceNode == null ? null : namespaceNode.asText(), scopeNode.asText(), metricNode.asText(), tagkNode == null ? null : tagkNode.asText(), tagvNode == null ? null : tagvNode.asText(), retentionNode == null? null : retentionNode.asInt())); } } return new MetricSchemaRecordList(records, scrollID); }

Target:
public MetricSchemaRecordList deserialize(JsonParser jp, DeserializationContext context) throws IOException, JsonProcessingException { String scrollID = null; List<MetricSchemaRecord> records = Collections.emptyList(); JsonNode rootNode = jp.getCodec().readTree(jp); if(rootNode.has("_scroll_id")) { scrollID = rootNode.get("_scroll_id").asText(); } JsonNode hits = rootNode.get("hits").get("hits"); if(JsonNodeType.ARRAY.equals(hits.getNodeType())) { records = new ArrayList<>(hits.size()); Iterator<JsonNode> iter = hits.elements(); while(iter.hasNext()) { JsonNode hit = iter.next(); JsonNode source = hit.get("_source"); JsonNode namespaceNode = source.get(RecordType.NAMESPACE.getName()); JsonNode scopeNode = source.get(RecordType.SCOPE.getName()); JsonNode metricNode = source.get(RecordType.METRIC.getName()); JsonNode tagkNode = source.get(RecordType.TAGK.getName()); JsonNode tagvNode = source.get(RecordType.TAGV.getName()); JsonNode retentionNode = source.get(RecordType.RETENTION_DISCOVERY.getName()); records.add(new MetricSchemaRecord(namespaceNode == null ? null : namespaceNode.asText(), scopeNode.asText(), metricNode.asText(), tagkNode == null ? null : tagkNode.asText(), tagvNode == null ? null : tagvNode.asText(), retentionNode == null? null : retentionNode.asInt())); } } return new MetricSchemaRecordList(records, scrollID); }
Source:
public void banUser(String userName, WebDriver driver) { clickBanUser(userName, driver); chatBanModalButton.click(); waitForElementNotVisibleByElement(chatBanModal); PageObjectLogging.log("clickBanUser", userName+" ban modal is closed", true, driver); }

Target:
public void banUser(String userName, WebDriver driver) { clickBanUser(userName, driver); chatBanModalButton.click(); waitForElementNotVisibleByElement(chatBanModal); PageObjectLogging.log("clickBanUser", userName+" ban modal is closed", true); }
Source:
public static void removeCustomTraceType(Class<? extends ITmfTrace> traceClass, String category, String definitionName) { String traceTypeId = null; if (traceClass.equals(CustomTxtTrace.class)) { CustomTxtTraceDefinition def = CustomTxtTraceDefinition.load(category, definitionName); if (def != null) { traceTypeId = CustomTxtTrace.buildTraceTypeId(category, definitionName); } } else if (traceClass.equals(CustomXmlTrace.class)) { CustomXmlTraceDefinition def = CustomXmlTraceDefinition.load(category, definitionName); if (def != null) { traceTypeId = CustomXmlTrace.buildTraceTypeId(category, definitionName); } } if (traceTypeId != null) { TraceTypeHelper helper = TRACE_TYPES.remove(traceTypeId); if (helper != null) { helper.getTrace().dispose(); } } }

Target:
public static void removeCustomTraceType(Class<? extends ITmfTrace> traceClass, String category, String definitionName) { String traceTypeId = null; if (traceClass.equals(CustomTxtTrace.class)) { traceTypeId = CustomTxtTrace.buildTraceTypeId(category, definitionName); } else if (traceClass.equals(CustomXmlTrace.class)) { traceTypeId = CustomXmlTrace.buildTraceTypeId(category, definitionName); } if (traceTypeId != null) { TraceTypeHelper helper = TRACE_TYPES.remove(traceTypeId); if (helper != null) { helper.getTrace().dispose(); } } }
Source:
public BigtableOptions toBigtableOptions() { return new BigtableOptions.Builder() .setProjectId(getProjectId()) .setZoneId(getZoneId()) .setClusterId(getClusterId()) .setUserAgent("CloudBigtableGrpcIO") .build(); }

Target:
public BigtableOptions toBigtableOptions() { return new BigtableOptions.Builder() .setProjectId(getProjectId()) .setZoneId(getZoneId()) .setClusterId(getClusterId()) .setUserAgent("CloudBigtableDataflow") .build(); }
Source:
private boolean isNewDeveloperCode(final String chplProductNumber) { String devCode = chplProductNumberUtil.getDeveloperCode(chplProductNumber); return !StringUtils.isEmpty(devCode) && devCode.contentEquals(NEW_DEVELOPER_CODE); }

Target:
private boolean isNewDeveloperCode(final String chplProductNumber) { String devCode = chplProductNumberUtil.getDeveloperCode(chplProductNumber); return StringUtils.equals(devCode, NEW_DEVELOPER_CODE); }
Source:
public static <E> Set<E> asSet(Optional<E> opt) { return opt.map(v -> ImmutableSet.of(v)).orElseGet(() -> ImmutableSet.of()); }

Target:
public static <E> Collection<E> asSet(Optional<E> opt) { if (opt.isPresent()) { return Collections.singleton(opt.get()); } return Collections.emptySet(); }
Source:
public void run() { plumber = initPlumber(); try { plumber.startJob(); firehose = initFirehose(); final CommitterMaker committerMaker = CommitterMakers.fromFirehose(firehose); while (firehose.hasMore()) { final InputRow inputRow; try { inputRow = firehose.nextRow(); if (inputRow == null) { log.debug("thrown away null input row, considering unparseable"); metrics.incrementUnparseable(); continue; } } catch (ParseException e) { log.debug(e, "thrown away line due to exception, considering unparseable"); metrics.incrementUnparseable(); continue; } boolean lateEvent = false; boolean indexLimitExceeded = false; try { lateEvent = plumber.add(inputRow, committerMaker) == -1; } catch (IndexSizeExceededException e) { log.info("Index limit exceeded: %s", e.getMessage()); indexLimitExceeded = true; } if (indexLimitExceeded || lateEvent) { metrics.incrementThrownAway(); log.debug("Throwing away event[%s]", inputRow); if (indexLimitExceeded) { plumber.persist(committerMaker.makeCommitter()); } continue; } metrics.incrementProcessed(); } } catch (RuntimeException e) { log.makeAlert( e, "RuntimeException aborted realtime processing[%s]", fireDepartment.getDataSchema().getDataSource() ).emit(); normalExit = false; throw e; } catch (Error e) { log.makeAlert(e, "Exception aborted realtime processing[%s]", fireDepartment.getDataSchema().getDataSource()) .emit(); normalExit = false; throw e; } finally { CloseQuietly.close(firehose); if (normalExit) { plumber.finishJob(); plumber = null; firehose = null; } } }

Target:
public void run() { plumber = initPlumber(); try { Object metadata = plumber.startJob(); if (fireDepartment.checkFirehoseV2()) { firehoseV2 = initFirehoseV2(metadata); runFirehoseV2(firehoseV2); } else { firehose = initFirehose(); runFirehose(firehose); } } catch (RuntimeException e) { log.makeAlert( e, "RuntimeException aborted realtime processing[%s]", fireDepartment.getDataSchema().getDataSource() ).emit(); normalExit = false; throw e; } catch (Error e) { log.makeAlert(e, "Exception aborted realtime processing[%s]", fireDepartment.getDataSchema().getDataSource()) .emit(); normalExit = false; throw e; } finally { CloseQuietly.close(firehose); if (normalExit) { plumber.finishJob(); plumber = null; firehose = null; } } }
Source:
public static ZonedDateTime toZonedDateTime(Calendar calendar) { if (calendar == null) { return null; } return ofInstant(calendar.toInstant(), ZoneId.of("UTC")); }

Target:
public static ZonedDateTime toZonedDateTime(Calendar calendar) { if (calendar == null) { return null; } return ZonedDateTime.ofInstant(calendar.toInstant(), ZoneOffset.UTC); }
Source:
public static MapParser create(File file) throws IOException { String name = file.getName(); Matcher stuff = SESSION_PATTERN.matcher(name); stuff.matches(); long sessionId = new BigInteger(stuff.group(1), 16).longValue(); LineIterator iter = FileUtils.lineIterator(file); NavigableMap<Long, MapEntry> entries = new TreeMap<>(); while (iter.hasNext()) { String line = iter.next(); Matcher matcher = MAPFILE_PATTERN.matcher(line); matcher.matches(); long addrLow = Long.parseUnsignedLong(matcher.group(1), 16); long addrHigh = Long.parseUnsignedLong(matcher.group(2), 16); Perms perms = Perms.create(matcher.group(3)); long offset = Long.parseLong(matcher.group(4), 16); char deviceHigh = (char) Integer.parseInt(matcher.group(5), 16); char deviceLow = (char) Integer.parseInt(matcher.group(6), 16); long iNode = Long.parseLong(matcher.group(7), 16); String pathName = matcher.group(8); entries.put(addrLow, new MapEntry(addrLow, addrHigh, perms, offset, deviceLow, deviceHigh, iNode, pathName)); } return new MapParser(sessionId, entries); }

Target:
public static MapParser create(File file) throws IOException { String name = file.getName(); Matcher stuff = SESSION_PATTERN.matcher(name); stuff.matches(); long sessionId = Long.parseUnsignedLong(stuff.group(1), 16); LineIterator iter = FileUtils.lineIterator(file); NavigableMap<Long, MapEntry> entries = new TreeMap<>(); while (iter.hasNext()) { String line = iter.next(); Matcher matcher = MAPFILE_PATTERN.matcher(line); matcher.matches(); long addrLow = Long.parseUnsignedLong(matcher.group(1), 16); long addrHigh = Long.parseUnsignedLong(matcher.group(2), 16); Perms perms = Perms.create(matcher.group(3)); long offset = Long.parseLong(matcher.group(4), 16); char deviceHigh = (char) Integer.parseInt(matcher.group(5), 16); char deviceLow = (char) Integer.parseInt(matcher.group(6), 16); long iNode = Long.parseLong(matcher.group(7), 16); String pathName = matcher.group(8); entries.put(addrLow, new MapEntry(addrLow, addrHigh, perms, offset, deviceLow, deviceHigh, iNode, pathName)); } return new MapParser(sessionId, entries); }
Source:
public String getConnectionUrl() { StringBuilder stringBuilder = new StringBuilder(); String account = this.account.getStringValue(); if (account == null || account.isEmpty()) { throw new IllegalArgumentException(i18nMessages.getMessage("error.missingAccount")); } String warehouse = this.warehouse.getStringValue(); String db = this.db.getStringValue(); String schema = this.schemaName.getStringValue(); String role = this.role.getStringValue(); String tracing = this.tracing.getStringValue(); appendProperty("warehouse", warehouse, stringBuilder); appendProperty("db", db, stringBuilder); appendProperty("schema", schema, stringBuilder); appendProperty("role", role, stringBuilder); appendProperty("tracing", tracing, stringBuilder); Provider prov = this.provider.getValue(); String azure = ""; if (prov == Provider.AZURE) { String region = this.azureRegion.getValue().getRegion(); azure = "." + region + ".azure"; } String url = new StringBuilder().append("jdbc:snowflake://") .append(account) .append(azure) .append(".snowflakecomputing.com") .append("/?") .append(stringBuilder) .toString(); if (LOGGER.isDebugEnabled()) LOGGER.debug("Snowflake connection jdbc URL : " + url); return url; }

Target:
public String getConnectionUrl() { StringBuilder connectionParams = new StringBuilder(); String account = this.account.getStringValue(); if (account == null || account.isEmpty()) { throw new IllegalArgumentException(i18nMessages.getMessage("error.missingAccount")); } String regionID = useCustomRegion.getValue() ? this.customRegionID.getValue() : this.region.getValue().getRegionID(); String warehouse = this.warehouse.getStringValue(); String db = this.db.getStringValue(); String schema = this.schemaName.getStringValue(); String role = this.role.getStringValue(); String tracing = this.tracing.getStringValue(); appendProperty("warehouse", warehouse, connectionParams); appendProperty("db", db, connectionParams); appendProperty("schema", schema, connectionParams); appendProperty("role", role, connectionParams); appendProperty("tracing", tracing, connectionParams); StringBuilder url = new StringBuilder() .append("jdbc:snowflake://") .append(account); if (!StringUtils.isEmpty(regionID)) { url.append(".").append(regionID); } url.append(".snowflakecomputing.com") .append("/?") .append(connectionParams); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Snowflake connection jdbc URL : " + url); } return url.toString(); }
Source:
private static boolean shouldBeAloneOnLine(RightCurlyOption bracePolicy, Details details) { final int tokenLambda = details.lcurly.getParent().getType(); return bracePolicy == RightCurlyOption.ALONE && tokenLambda != TokenTypes.LAMBDA && !isAloneOnLine(details) && !isEmptyBody(details.lcurly) || shouldBeAloneInLambda(bracePolicy, details) || shouldBeAloneOrSingleLine(bracePolicy, details); }

Target:
private static boolean shouldBeAloneOnLine(RightCurlyOption bracePolicy, Details details) { final int tokenLambda = details.lcurly.getParent().getType(); return bracePolicy == RightCurlyOption.ALONE && tokenLambda != TokenTypes.LAMBDA && !isAloneOnLine(details) && !isEmptyBody(details.lcurly) || bracePolicy == RightCurlyOption.ALONE_OR_SINGLELINE && !isAloneOnLine(details) && !isSingleLineBlock(details) && !isAnonInnerClassInit(details.lcurly) && !isEmptyBody(details.lcurly) || bracePolicy == RightCurlyOption.ALONE && tokenLambda == TokenTypes.LAMBDA && !isAloneLambda(details); }
Source:
public DataContainer toContainer() { return new MemoryDataContainer() .set(Keys.BOOK_AUTHOR.getQuery(), this.getValue()); }

Target:
public DataContainer toContainer() { return new MemoryDataContainer() .set(Keys.BOOK_AUTHOR.getQuery(), Texts.json().to(this.getValue())); }
Source:
public Multimap<String, String> createHttpHeadersForResource(final UriInfo uriInfo, final FedoraResource resource) { final Session internalSession = sessionFactory.getInternalSession(); final IdentifierConverter<Resource, FedoraResource> translator = new DefaultIdentifierTranslator(internalSession); final Model model = createDefaultModel(); final ListMultimap<String, String> headers = ArrayListMultimap.create(); LOGGER.debug("Adding WebAC Link Header for Resource: {}", resource); final Optional<Pair<URI, FedoraResource>> acls = WebACRolesProvider.getEffectiveAcl(resource); if (acls.isPresent()) { nodeService.find(internalSession, acls.get().getRight().getPath()) .getTriples(translator, PropertiesRdfContext.class) .filter(t -> model.asStatement(t).getPredicate().hasURI(WEBAC_ACCESS_CONTROL_VALUE)) .filter(t -> t.getObject().isURI()) .forEachRemaining(t -> { headers.put("Link", Link.fromUri(uriInfo.getBaseUriBuilder() .path(translator.convert(model.asStatement(t).getObject().asResource()).getPath()) .toString()).rel("acl").build().toString()); }); } return headers; }

Target:
public Multimap<String, String> createHttpHeadersForResource(final UriInfo uriInfo, final FedoraResource resource) { final Session internalSession = sessionFactory.getInternalSession(); final IdentifierConverter<Resource, FedoraResource> translator = new DefaultIdentifierTranslator(internalSession); final ListMultimap<String, String> headers = ArrayListMultimap.create(); LOGGER.debug("Adding WebAC Link Header for Resource: {}", resource); WebACRolesProvider.getEffectiveAcl(resource).ifPresent(acls -> { nodeService.find(internalSession, acls.resource.getPath()) .getTriples(translator, PropertiesRdfContext.class) .asModel().listObjectsOfProperty(createProperty(WEBAC_ACCESS_CONTROL_VALUE)) .forEachRemaining(linkObj -> { if (linkObj.isURIResource()) { final Resource acl = linkObj.asResource(); final String aclPath = translator.convert(acl).getPath(); final URI aclUri = uriInfo.getBaseUriBuilder().path(aclPath).build(); headers.put("Link", Link.fromUri(aclUri).rel("acl").build().toString()); } }); }); return headers; }
Source:
public void securityTokenDiscovered(final Transport transport) { if (!mTagHandlingEnabled) return; new AsyncTask<Void, Void, IOException>() { @Override protected void onPreExecute() { super.onPreExecute(); onSecurityTokenPreExecute(); } @Override protected IOException doInBackground(Void... params) { try { handleSmartcard(transport); } catch (IOException e) { return e; } return null; } @Override protected void onPostExecute(IOException exception) { super.onPostExecute(exception); if (exception != null) { handleSmartcardError(exception); return; } onSecurityTokenPostExecute(); } }.execute(); }

Target:
public void securityTokenDiscovered(final Transport transport) { if (!mTagHandlingEnabled) return; new AsyncTask<Void, Void, IOException>() { @Override protected void onPreExecute() { super.onPreExecute(); onSecurityTokenPreExecute(); } @Override protected IOException doInBackground(Void... params) { try { handleSecurityToken(transport); } catch (IOException e) { return e; } return null; } @Override protected void onPostExecute(IOException exception) { super.onPostExecute(exception); if (exception != null) { handleSecurityTokenError(exception); return; } onSecurityTokenPostExecute(); } }.execute(); }
Source:
@Override protected void beforeTestsStarted() throws Exception { super.beforeTestsStarted(); ctx = new AnnotationConfigApplicationContext(); ctx.register(ApplicationConfiguration.class); ctx.refresh(); repo = ctx.getBean(PersonRepository.class); repo2 = ctx.getBean(PersonSecondRepository.class); for (int i = 0; i < CACHE_SIZE; i++) repo.save(i, new Person("person" + Integer.toHexString(i), "lastName" + Integer.toHexString((i + 16) % 256))); }

Target:
@Override protected void beforeTestsStarted() throws Exception { super.beforeTestsStarted(); ctx = new AnnotationConfigApplicationContext(); ctx.register(ApplicationConfiguration.class); ctx.refresh(); repo = ctx.getBean(PersonRepository.class); repo2 = ctx.getBean(PersonSecondRepository.class); for (int i = 0; i < CACHE_SIZE; i++) { repo.save(i, new Person("person" + Integer.toHexString(i), "lastName" + Integer.toHexString((i + 16) % 256))); } }
Source:
public Build extract(NpmProject npmProject) throws Exception { String resolutionRepository = npmProject.getResolutionRepository(); List<String> installationArgs = npmProject.getInstallationArgs(); Path workingDir = npmProject.getWorkingDir(); preparePrerequisites(resolutionRepository, workingDir); createTempNpmrc(workingDir, installationArgs); runInstall(workingDir, installationArgs); restoreNpmrc(workingDir); List<Dependency> dependencies = collectDependencies(workingDir); String moduleId = org.apache.commons.lang.StringUtils.isNotBlank(module) ? module : npmPackageInfo.toString(); return createBuild(dependencies,moduleId); }

Target:
public Build extract(NpmProject npmProject) throws Exception { String resolutionRepository = npmProject.getResolutionRepository(); List<String> installationArgs = npmProject.getInstallationArgs(); Path workingDir = npmProject.getWorkingDir(); preparePrerequisites(resolutionRepository, workingDir); createTempNpmrc(workingDir, installationArgs); runInstall(workingDir, installationArgs); restoreNpmrc(workingDir); List<Dependency> dependencies = collectDependencies(workingDir); String moduleId = StringUtils.isNotBlank(module) ? module : npmPackageInfo.toString(); return createBuild(dependencies,moduleId); }
Source:
public void tearDown() throws Exception { Intents.release(); baseActivityTestRule.finishActivity(); StorageOperations.deleteDir(tmpPath); try { StorageOperations.deleteDir(new File(PathBuilder.buildProjectPath(projectName))); } catch (IOException e) { Log.d(getClass().getSimpleName(), "couldnt clean up project"); } TestUtils.deleteProjects(this.getClass().getSimpleName()); }

Target:
public void tearDown() throws Exception { Intents.release(); baseActivityTestRule.finishActivity(); StorageOperations.deleteDir(tmpPath); TestUtils.deleteProjects(this.getClass().getSimpleName()); }
Source:
public static Uri getUriForFile(Context context, File file) { return FileProvider.getUriForFile(context, "net.osmand.plus.fileprovider", file); }

Target:
public static Uri getUriForFile(Context context, File file) { return FileProvider.getUriForFile(context, context.getPackageName() + ".fileprovider", file); }
Source:
public static SQLDialect getDialect(String type) { if (type.equalsIgnoreCase(H2_DIALECT.getDialectType())) { return H2_DIALECT; } else if (type.equalsIgnoreCase(HIVE_DIALECT.getDialectType())) { return HIVE_DIALECT; } else if (type.equalsIgnoreCase(PRESTO_DIALECT.getDialectType())) { return PRESTO_DIALECT; } else { throw new IllegalArgumentException("Unsupported SQL Dialect Type: " + type); } }

Target:
public static SQLDialect getDialect(String type) { if (type.equalsIgnoreCase(H2_DIALECT.getDialectType())) { return H2_DIALECT; } else if (type.equalsIgnoreCase(HIVE_DIALECT.getDialectType())) { return HIVE_DIALECT; } else if (type.equalsIgnoreCase(PRESTODB_DIALECT.getDialectType())) { return PRESTODB_DIALECT; } else { try { return (SQLDialect) Class.forName(type).getConstructor().newInstance(); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("Unsupported SQL Dialect: " + type, e); } catch (Exception e) { throw new IllegalArgumentException("Failed to instantiate SQL Dialect: " + type, e); } } }
Source:
public static Slice currentPath(ConnectorSession session) { return utf8Slice(requireNonNull(session.getPath(), "session path is null")); }

Target:
public static Slice currentPath(ConnectorSession session) { if (session.getPath() == null) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Session path is null"); } return utf8Slice(session.getPath()); }
Source:
public IpPermission(IpProtocol ipProtocol, int fromPort, int toPort, Multimap<String, String> tenantIdGroupNamePairs, Iterable<String> groupIds, Iterable<String> cidrBlocks, RangeSet<Integer> ports) { this.fromPort = fromPort; this.toPort = toPort; this.tenantIdGroupNamePairs = ImmutableMultimap.copyOf(checkNotNull(tenantIdGroupNamePairs, "tenantIdGroupNamePairs")); this.ipProtocol = checkNotNull(ipProtocol, "ipProtocol"); this.groupIds = ImmutableSet.copyOf(checkNotNull(groupIds, "groupIds")); this.cidrBlocks = ImmutableSet.copyOf(checkNotNull(cidrBlocks, "cidrBlocks")); this.ports = ports == null ? TreeRangeSet.<Integer>create() : ports; }

Target:
public IpPermission(IpProtocol ipProtocol, int fromPort, int toPort, Multimap<String, String> tenantIdGroupNamePairs, Iterable<String> groupIds, Iterable<String> cidrBlocks, RangeSet<Integer> ports) { this.fromPort = fromPort; this.toPort = toPort; this.tenantIdGroupNamePairs = ImmutableMultimap.copyOf(checkNotNull(tenantIdGroupNamePairs, "tenantIdGroupNamePairs")); this.ipProtocol = checkNotNull(ipProtocol, "ipProtocol"); this.groupIds = ImmutableSet.copyOf(checkNotNull(groupIds, "groupIds")); this.cidrBlocks = ImmutableSet.copyOf(checkNotNull(cidrBlocks, "cidrBlocks")); this.ports = ImmutableRangeSet.copyOf(checkNotNull(ports, "ports")); }
Source:
private Map<String, Object> convertOssToW3C(Map<String, Object> capabilities) { if (capabilities == null) { return null; } Map<String, Object> toReturn = new TreeMap<>(); toReturn.putAll(capabilities); if (capabilities.containsKey(PLATFORM) && !capabilities.containsKey(PLATFORM_NAME)) { toReturn.put(PLATFORM_NAME, String.valueOf(capabilities.get(PLATFORM))); } return toReturn; }

Target:
private @Nullable Map<String, Object> convertOssToW3C(Map<String, Object> capabilities) { if (capabilities == null) { return null; } Map<String, Object> toReturn = new TreeMap<>(); toReturn.putAll(capabilities); if (capabilities.containsKey(PLATFORM) && !capabilities.containsKey(PLATFORM_NAME)) { toReturn.put(PLATFORM_NAME, String.valueOf(capabilities.get(PLATFORM))); } return toReturn; }
Source:
public void TestMakeClassifiersWithNoInferredFieldsKey() { Parameters p = Parameters.getAllDefaultParameters(); MultiEncoder me = MultiEncoder.builder().name("").build(); Layer<Map<String, Object>> l = new Layer<>( p, me, new SpatialPooler(), new TemporalMemory(), true, null ); try { NamedTuple nt = l.makeClassifiers(l.getEncoder()); } catch (IllegalStateException e) { assertTrue(e.getMessage().contains("KEY.INFERRED_FIELDS")); assertTrue(e.getMessage().contains("null")); assertTrue(e.getMessage().contains("empty")); } }

Target:
public void TestMakeClassifiersWithNoInferredFieldsKey() { Parameters p = Parameters.getAllDefaultParameters(); MultiEncoder me = MultiEncoder.builder().name("").build(); Layer<Map<String, Object>> l = new Layer<>( p, me, new SpatialPooler(), new TemporalMemory(), true, null ); try { l.makeClassifiers(l.getEncoder()); } catch (IllegalStateException e) { assertTrue(e.getMessage().contains("KEY.INFERRED_FIELDS")); assertTrue(e.getMessage().contains("null")); assertTrue(e.getMessage().contains("empty")); } }
Source:
public URN urn() { try { return URN.create( new JdkRequest(UriBuilder.fromUri(this.home).build()) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .method(Request.GET) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .assertXPath("/page/identity") .xml() .xpath("/page/identity/urn/text()") .get(0) ); } catch (IOException ex) { throw new IllegalStateException(ex); } }

Target:
public URN urn() { try { return URN.create( new JdkRequest(this.home) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .assertXPath("/page/identity") .xml() .xpath("/page/identity/urn/text()") .get(0) ); } catch (IOException ex) { throw new IllegalStateException(ex); } }
Source:
public void actionPerformed(ActionEvent actionEvent) { int result = chooser.showOpenDialog(FittingMainView.this); if (result == JFileChooser.APPROVE_OPTION) { try { controller.save(new FileOutputStream(chooser.getSelectedFile())); } catch(FileNotFoundException ex) { NarrowOptionPane.showMessageDialog(FittingMainView.this, ex.getMessage(), "Error", NarrowOptionPane.ERROR_MESSAGE); } } }

Target:
public void actionPerformed(ActionEvent actionEvent) { int result = chooser.showSaveDialog(FittingMainView.this); if (result == JFileChooser.APPROVE_OPTION) { try { controller.save(new FileOutputStream(chooser.getSelectedFile())); } catch(FileNotFoundException ex) { NarrowOptionPane.showMessageDialog(FittingMainView.this, ex.getMessage(), "Error", NarrowOptionPane.ERROR_MESSAGE); } } }
Source:
private BackendProperties getBackendProperties(String backend) { BackendProperties properties = backends.get(backend); if(properties.getSharedConfigName() != null && !properties.getSharedConfigName().isEmpty() ) { return getSharedConfigProperties(properties.getSharedConfigName()); } return properties; }

Target:
private BackendProperties getBackendProperties(String backend) { BackendProperties backendProperties = backends.get(backend); if(!StringUtils.isEmpty(backendProperties.getSharedConfigName())) { return getSharedConfigProperties(backendProperties.getSharedConfigName()); } return backendProperties; }
Source:
private void setResultsVisibleFromTime(FeedbackSessionAttributes newSession) { String type = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_RESULTSVISIBLEBUTTON); switch (type) { case Const.INSTRUCTOR_FEEDBACK_RESULTS_VISIBLE_TIME_CUSTOM: newSession.setResultsVisibleFromTime(TimeHelper.combineDateTime( getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_PUBLISHDATE), getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_PUBLISHTIME))); break; case Const.INSTRUCTOR_FEEDBACK_RESULTS_VISIBLE_TIME_ATVISIBLE: newSession.setResultsVisibleFromTime(Const.TIME_REPRESENTS_FOLLOW_VISIBLE); break; case Const.INSTRUCTOR_FEEDBACK_RESULTS_VISIBLE_TIME_LATER: newSession.setResultsVisibleFromTime(Const.TIME_REPRESENTS_LATER); break; case Const.INSTRUCTOR_FEEDBACK_RESULTS_VISIBLE_TIME_NEVER: newSession.setResultsVisibleFromTime(Const.TIME_REPRESENTS_NEVER); break; default: log.severe("Invalid resultsVisibleFrom setting in creating" + newSession.getIdentificationString()); break; } }

Target:
private void setResultsVisibleFromTime(FeedbackSessionAttributes newSession) { switch (getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_RESULTSVISIBLEBUTTON)) { case Const.INSTRUCTOR_FEEDBACK_RESULTS_VISIBLE_TIME_CUSTOM: newSession.setResultsVisibleFromTime(TimeHelper.combineDateTime( getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_PUBLISHDATE), getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_PUBLISHTIME))); break; case Const.INSTRUCTOR_FEEDBACK_RESULTS_VISIBLE_TIME_ATVISIBLE: newSession.setResultsVisibleFromTime(Const.TIME_REPRESENTS_FOLLOW_VISIBLE); break; case Const.INSTRUCTOR_FEEDBACK_RESULTS_VISIBLE_TIME_LATER: newSession.setResultsVisibleFromTime(Const.TIME_REPRESENTS_LATER); break; case Const.INSTRUCTOR_FEEDBACK_RESULTS_VISIBLE_TIME_NEVER: newSession.setResultsVisibleFromTime(Const.TIME_REPRESENTS_NEVER); break; default: log.severe("Invalid resultsVisibleFrom setting in creating" + newSession.getIdentificationString()); break; } }
Source:
public void setNoScroll(boolean value) { if (value) { contentScrollPanel.getElement().getStyle().setOverflow(Overflow.VISIBLE); } }

Target:
public void setNoScroll(boolean value) { if (value) { contentScrollPanel.getElement().getStyle().setOverflow(Overflow.VISIBLE); } else { contentScrollPanel.getElement().getStyle().setOverflow(Overflow.AUTO); } }
Source:
private static Map<AbstractProject,DependencyChange> getDependencyChanges(Run<?,?> run) { AbstractBuild<?,?> build = null; if(run instanceof AbstractBuild) return ((AbstractBuild) run).getDependencyChanges((AbstractBuild)run); else return Maps.newHashMap(); }

Target:
private static Map<AbstractProject,DependencyChange> getDependencyChanges(Run<?,?> run) { if(run instanceof AbstractBuild) return ((AbstractBuild) run).getDependencyChanges((AbstractBuild)run); else return Maps.newHashMap(); }
Source:
public void customAuthoritiesMappingFunction() { populator.setAuthorityMapper(record -> { String dn = record.get(SpringSecurityLdapTemplate.DN_KEY).get(0); String role = record.get(populator.getGroupRoleAttribute()).get(0); return new LdapAuthority(role, dn); }); DirContextAdapter ctx = new DirContextAdapter(new DistinguishedName( "cn=mouse\\, jerry,ou=people,dc=springframework,dc=org")); Set<String> authorities = AuthorityUtils.authorityListToSet(populator .getGrantedAuthorities(ctx, "notused")); assertThat(authorities).allMatch(LdapAuthority.class::isInstance); }

Target:
public void customAuthoritiesMappingFunction() { populator.setAuthorityMapper(record -> { String dn = record.get(SpringSecurityLdapTemplate.DN_KEY).get(0); String role = record.get(populator.getGroupRoleAttribute()).get(0); return new LdapAuthority(role, dn); }); DirContextAdapter ctx = new DirContextAdapter(new DistinguishedName( "cn=mouse\\, jerry,ou=people,dc=springframework,dc=org")); Collection<GrantedAuthority> authorities = populator.getGrantedAuthorities(ctx, "notused"); assertThat(authorities).allMatch(LdapAuthority.class::isInstance); }
Source:
public static ErlangSpecification getSpecification(@Nullable ErlangFunction function) { if (function == null) return null; List<ErlangSpecification> specifications = ((ErlangFile) function.getContainingFile()).getSpecifications(); for (ErlangSpecification spec : specifications) { ErlangSpecFun specFun = spec != null ? PsiTreeUtil.findChildOfType(spec, ErlangSpecFun.class) : null; String funName = specFun != null ? getAtomName(specFun.getQAtom()) : null; if (function.getName().equals(funName)) return spec; } return null; }

Target:
public static ErlangSpecification getSpecification(@Nullable ErlangFunction function) { function = getOriginalErlangFunction(function); if (function == null) return null; List<ErlangSpecification> specifications = ((ErlangFile) function.getContainingFile()).getSpecifications(); for (ErlangSpecification spec : specifications) { ErlangSpecFun specFun = spec != null ? PsiTreeUtil.findChildOfType(spec, ErlangSpecFun.class) : null; if (specFun != null && specFun.getReference() != null && specFun.getReference().isReferenceTo(function)) { return spec; } } return null; }
Source:
protected void readGeneralData(XmlNode content) { XmlNode node = content.SelectSingleNode("Name"); if (node != null) { _vmTemplate.setname(node.InnerText); name = _vmTemplate.getname(); } node = content.SelectSingleNode("TemplateId"); if (node != null) { if (!StringHelper.isNullOrEmpty(node.InnerText)) { _vmTemplate.setId(new Guid(node.InnerText)); } } node = content.SelectSingleNode("IsDisabled"); if (node != null) { if (!StringUtils.isEmpty(node.InnerText)) { _vmTemplate.setDisabled(Boolean.parseBoolean(node.InnerText)); } } }

Target:
protected void readGeneralData(XmlNode content) { XmlNode node = content.SelectSingleNode("Name"); if (node != null) { _vmTemplate.setname(node.InnerText); name = _vmTemplate.getname(); } node = content.SelectSingleNode("TemplateId"); if (node != null) { if (!StringHelper.isNullOrEmpty(node.InnerText)) { _vmTemplate.setId(new Guid(node.InnerText)); } } node = content.SelectSingleNode("IsDisabled"); if (node != null) { _vmTemplate.setDisabled(Boolean.parseBoolean(node.InnerText)); } }