auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void start() { boolean isOnSonarCloud = configuration.getBoolean(ProcessProperties.Property.SONARCLOUD_ENABLED.getKey()).orElse(false); this.globalDispatchers = notificationCenter.getDispatcherKeysForProperty(GLOBAL_NOTIFICATION, "true") .stream() .filter(dispatcher -> !(isOnSonarCloud && GLOBAL_DISPATCHERS_NOT_FOR_SONAR_CLOUD.contains(dispatcher))) .sorted() .collect(toList()); this.projectDispatchers = notificationCenter.getDispatcherKeysForProperty(PER_PROJECT_NOTIFICATION, "true") .stream() .sorted() .collect(toList()); }

Target:
public void start() { boolean isOnSonarCloud = configuration.getBoolean(ProcessProperties.Property.SONARCLOUD_ENABLED.getKey()).orElse(false); this.globalDispatchers = notificationCenter.getDispatcherKeysForProperty(GLOBAL_NOTIFICATION, "true") .stream() .filter(filterDispatcherForSonarCloud(isOnSonarCloud)) .sorted() .collect(toList()); this.projectDispatchers = notificationCenter.getDispatcherKeysForProperty(PER_PROJECT_NOTIFICATION, "true") .stream() .sorted() .collect(toList()); }
Source:
public String toHtml(CustomDatatype<T> datatype, String valueReference) { return valueReference; }

Target:
public String toHtml(CustomDatatype<T> datatype, String valueReference) { SerializingCustomDatatype<T> dt = (SerializingCustomDatatype<T>) datatype; String result = ((OpenmrsMetadata) dt.deserialize(valueReference)).getName(); return result; }
Source:
public void testExistingTargetFileButWithoutReadAccess() throws Exception { exit.expectSystemExitWithStatus(-1); exit.checkAssertionAfterwards(() -> { assertEquals("Unexpected output log", "Files to process must be specified, found 0." + System.lineSeparator(), systemOut.getLog()); assertEquals("Unexpected system error log", "", systemErr.getLog()); }); final Path path = Files.createTempFile("", ""); path.toFile().setReadable(false); Main.main("-c", "/google_checks.xml", path.toString()); Files.delete(path); }

Target:
public void testExistingTargetFileButWithoutReadAccess() throws Exception { exit.expectSystemExitWithStatus(-1); exit.checkAssertionAfterwards(() -> { assertEquals("Unexpected output log", "Files to process must be specified, found 0." + System.lineSeparator(), systemOut.getLog()); assertEquals("Unexpected system error log", "", systemErr.getLog()); }); final File file = temporaryFolder.newFile("testExistingTargetFileButWithoutReadAccess"); file.setReadable(false); Main.main("-c", "/google_checks.xml", file.getCanonicalPath()); }
Source:
public static String getJSON(String url) { StringBuilder builder = new StringBuilder(); HttpClient client = new DefaultHttpClient(); HttpGet siteHttp = new HttpGet(url); try { HttpResponse response = client.execute(siteHttp); StatusLine statusLine = response.getStatusLine(); int statusCode = statusLine.getStatusCode(); if (statusCode == 200) { HttpEntity entity = response.getEntity(); InputStream content = entity.getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader(content)); String line; while ((line = reader.readLine() )!= null) { builder.append(line); } } else { System.out.println("Failed to Access Json!"); } } catch (ClientProtocolException e ) { e.printStackTrace(); } catch ( IOException e) { e.printStackTrace(); } return builder.toString(); }

Target:
public static String getJSON(String url) { StringBuilder builder = new StringBuilder(); HttpClient client = new DefaultHttpClient(); HttpGet siteHttp = new HttpGet(url); try { HttpResponse response = client.execute(siteHttp); StatusLine statusLine = response.getStatusLine(); int statusCode = statusLine.getStatusCode(); if (statusCode == 200) { HttpEntity entity = response.getEntity(); InputStream content = entity.getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader(content)); String line; while ((line = reader.readLine() )!= null) { builder.append(line); } } else { System.out.println("Failed to Access Json!"); return null; } } catch (ClientProtocolException e ) { e.printStackTrace(); } catch ( IOException e) { e.printStackTrace(); } return builder.toString(); }
Source:
public GHAuthorization createOAuthTokenWebFlowStepTwo( @Nonnull String OAuthApplicationclient_id,@Nonnull String OAuthApplicationSecret, @Nonnull String temp_OAuth_Code, String state, java.net.URL redirect_after_auth) throws IOException { Requester requester = createRequest() .setRawUrlPath("<LINK_0>") .with("client_id", OAuthApplicationclient_id) .with("client_secret", OAuthApplicationSecret) .with("code", temp_OAuth_Code) ; if(state!=null) requester.with("state", state); if(redirect_after_auth!=null) requester.with("redirect_uri", redirect_after_auth); return requester.method("POST").fetch(GHAuthorization.class).wrap(this); }

Target:
public GHAuthorization createOAuthTokenWebFlowStepTwo(@Nonnull String OAuthApplicationclient_id, @Nonnull String OAuthApplicationSecret, @Nonnull String temp_OAuth_Code, String state, java.net.URL redirect_after_auth) throws IOException { Requester requester = createRequest().method("POST") .setRawUrlPath("<LINK_0>") .with("client_id", OAuthApplicationclient_id) .with("client_secret", OAuthApplicationSecret) .with("code", temp_OAuth_Code) ; if (state != null) requester.with("state", state); if (redirect_after_auth != null) requester.with("redirect_uri", redirect_after_auth); return requester.method("POST").fetch(GHAuthorization.class).wrap(this); }
Source:
public void addAlert(String authId, String journalKey, String subjectName) throws IOException { String nedId = getUserIdFromAuthId(authId); if (nedId == null) { throw new RuntimeException("failed to get NED ID"); } JsonArray alerts = userApi.requestObject(String.format("individuals/%s/alerts", nedId), JsonArray.class); JsonObject alert = findMatchingAlert(alerts, journalKey); if (alert != null) { addSubjectToAlert(alert, subjectName); } else { alert = createAlertForSubject(journalKey, subjectName); } if (alert.has("id")) { String alertId = String.valueOf(alert.getAsJsonPrimitive("id").getAsLong()); userApi.putObject(String.format("individuals/%s/alerts/%s", nedId, alertId), alert); } else { userApi.postObject(String.format("individuals/%s/alerts", nedId), alert); } }

Target:
public void addAlert(String authId, String journalKey, String subjectName) throws IOException { String userId = userApi.getUserIdFromAuthId(authId); List<Alert> alerts = fetchAlerts(userId); Alert alert = findMatchingAlert(alerts, journalKey) .map(a -> addSubjectToAlert(a, subjectName)) .orElseGet(() -> createAlertForSubject(journalKey, subjectName)); if (alert.getId() != null) { String alertId = alert.getId().toString(); userApi.putObject(String.format("individuals/%s/alerts/%s", userId, alertId), alert); } else { userApi.postObject(String.format("individuals/%s/alerts", userId), alert); } }
Source:
public static Repository getRepository(final ServletRequest req) { Repository db = (Repository) req.getAttribute(ATTRIBUTE_REPOSITORY); if (db == null) throw new IllegalStateException(HttpServerText.get().expectedrepositoryAttribute); return db; }

Target:
public static Repository getRepository(final ServletRequest req) { Repository db = (Repository) req.getAttribute(ATTRIBUTE_REPOSITORY); if (db == null) throw new IllegalStateException(HttpServerText.get().expectedRepositoryAttribute); return db; }
Source:
public Object perform(InvocationContext ctx) throws Throwable { if (valueMatcher == ValueMatcher.MATCH_NEVER) { successful = false; return null; } MVCCEntry e = (MVCCEntry) ctx.lookupEntry(key); if (e == null) { throw new IllegalStateException("Not wrapped"); } Object prevValue = e.getValue(); if (!valueMatcher.matches(prevValue, null, value, valueEquivalence)) { successful = false; return prevValue; } else if (hasFlag(Flag.COMMAND_RETRY) && putIfAbsent) { e.setValue(null); } return performPut(e, ctx); }

Target:
public Object perform(InvocationContext ctx) throws Throwable { if (valueMatcher == ValueMatcher.MATCH_NEVER) { successful = false; return null; } MVCCEntry<Object, Object> e = (MVCCEntry) ctx.lookupEntry(key); if (e == null) { throw new IllegalStateException("Not wrapped"); } Object prevValue = e.getValue(); if (!valueMatcher.matches(prevValue, null, value, valueEquivalence)) { successful = false; return prevValue; } return performPut(e, ctx); }
Source:
public Map<String, Map<String, String>> readContainerLocality() { Map<String, Map<String, String>> allMappings = new HashMap<>(); metadataStore.all().forEach((containerId, valueBytes) -> { if (valueBytes != null) { String locationId = valueSerde.fromBytes(valueBytes); if (StringUtils.isNotBlank(locationId)) { Map<String, String> values = new HashMap<>(); values.put(SetContainerHostMapping.HOST_KEY, locationId); allMappings.put(containerId, values); } } }); if (LOG.isDebugEnabled()) { for (Map.Entry<String, Map<String, String>> entry : allMappings.entrySet()) { LOG.debug(String.format("Locality for container %s: %s", entry.getKey(), entry.getValue())); } } return Collections.unmodifiableMap(allMappings); }

Target:
public Map<String, Map<String, String>> readContainerLocality() { Map<String, Map<String, String>> allMappings = new HashMap<>(); metadataStore.all().forEach((containerId, valueBytes) -> { if (valueBytes != null) { String locationId = valueSerde.fromBytes(valueBytes); Map<String, String> values = new HashMap<>(); values.put(SetContainerHostMapping.HOST_KEY, locationId); allMappings.put(containerId, values); } }); if (LOG.isDebugEnabled()) { for (Map.Entry<String, Map<String, String>> entry : allMappings.entrySet()) { LOG.debug(String.format("Locality for container %s: %s", entry.getKey(), entry.getValue())); } } return Collections.unmodifiableMap(allMappings); }
Source:
public FirmwareInfo getFirmwareDeviceList(@Scope(OAuthScope.ADMINISTRATION_READ) final AccessToken accessToken, @QueryParam("firmware_version") final Long firmwareVersion) { if(firmwareVersion == null) { LOGGER.error("Missing firmwareVersion parameter"); throw new WebApplicationException(Response.Status.BAD_REQUEST); } final Jedis jedis = jedisPool.getResource(); final String fwVersion = firmwareVersion.toString(); Set<String> allFWDevices = new HashSet<>(); try { allFWDevices = jedis.zrange(fwVersion, 0L, 100L); } catch (Exception e) { LOGGER.error("Failed retrieving firmware device count.", e.getMessage()); } finally { jedisPool.returnResource(jedis); } return new FirmwareInfo(fwVersion, allFWDevices); }

Target:
public FirmwareInfo getFirmwareDeviceList(@Scope(OAuthScope.ADMINISTRATION_READ) final AccessToken accessToken, @QueryParam("firmware_version") final Long firmwareVersion) { if(firmwareVersion == null) { LOGGER.error("Missing firmwareVersion parameter"); throw new WebApplicationException(Response.Status.BAD_REQUEST); } final Jedis jedis = jedisPool.getResource(); final String fwVersion = firmwareVersion.toString(); Set<String> allFWDevices = new HashSet<>(); try { allFWDevices = jedis.zrevrange(fwVersion, 0, -1); } catch (Exception e) { LOGGER.error("Failed retrieving firmware device count.", e.getMessage()); } finally { jedisPool.returnResource(jedis); } return new FirmwareInfo(fwVersion, allFWDevices); }
Source:
public float[][] initDist(String fromWhat) { float[][] distArr = new float[size][size]; if (fromWhat.equals("water")) { for (int width = 0; width < size; width++) { for (int height = 0; height < size; height++) { float heightFactor = heightmap[height][width] - 1; if (heightFactor < 0) { distArr[height][width] = 0; } else { distArr[height][width] = size; } } } } else if (fromWhat.equals("poles")) { for (int width = 0; width < size; width++) { for (int height = 0; height < size; height++) { if (height == 0) { distArr[height][width] = 0; } else { distArr[height][width] = size; } } } } else if (fromWhat.equals("equator")) { for (int width = 0; width < size; width++) { for (int height = 0; height < size; height++) { if (height == size / 2) { distArr[height][width] = 0; } else { distArr[height][width] = size; } } } } return distArr; }

Target:
public float[][] initDist(String fromWhat) { float[][] distArr = new float[size][size]; switch(fromWhat) { case "water": distanceFromWater(distArr); break; case "poles": distanceFromPoles(distArr); break; case "equator": distanceFromEquator(distArr); break; } return distArr; }
Source:
public void getOrganization() throws Exception { final String login = "github"; final Github github = RtOrganizationsITCase.github(); final Organizations orgs = github.users().self().organizations(); final Organization org = orgs.get(login); MatcherAssert.assertThat(org.login(), Matchers.equalTo(login)); }

Target:
public void getOrganization() throws Exception { final String login = "github"; final Organization org = github() .users().self().organizations().get(login); MatcherAssert.assertThat(org.login(), Matchers.equalTo(login)); }
Source:
public void onCurrentThemeFetched(ThemeStore.OnCurrentThemeFetched event) { if (event.isError()) { AppLog.e(T.THEMES, "Error fetching current theme: " + event.error.message); ToastUtils.showToast(this, R.string.theme_fetch_failed, ToastUtils.Duration.SHORT); if (mCurrentTheme != null && mThemeBrowserFragment != null) { if (mThemeBrowserFragment.getCurrentThemeTextView() != null) { mThemeBrowserFragment.getCurrentThemeTextView().setText(mCurrentTheme.getName()); mThemeBrowserFragment.setCurrentThemeId(mCurrentTheme.getThemeId()); } } } else { AppLog.d(T.THEMES, "Current Theme fetch successful!"); mCurrentTheme = event.theme; if (mThemeBrowserFragment != null) { if (mThemeBrowserFragment.getCurrentThemeTextView() != null) { mThemeBrowserFragment.getCurrentThemeTextView().setText(mCurrentTheme.getName()); mThemeBrowserFragment.setCurrentThemeId(mCurrentTheme.getThemeId()); } } if (mThemeSearchFragment != null && mThemeSearchFragment.isVisible()) { mThemeSearchFragment.setRefreshing(false); } } }

Target:
public void onCurrentThemeFetched(ThemeStore.OnCurrentThemeFetched event) { if (event.isError()) { AppLog.e(T.THEMES, "Error fetching current theme: " + event.error.message); ToastUtils.showToast(this, R.string.theme_fetch_failed, ToastUtils.Duration.SHORT); if (mCurrentTheme != null && mThemeBrowserFragment != null) { if (mThemeBrowserFragment.getCurrentThemeTextView() != null) { mThemeBrowserFragment.getCurrentThemeTextView().setText(mCurrentTheme.getName()); mThemeBrowserFragment.setCurrentThemeId(mCurrentTheme.getThemeId()); } } } else { AppLog.d(T.THEMES, "Current Theme fetch successful!"); mCurrentTheme = mThemeStore.getActiveThemeForSite(event.site); AppLog.d(T.THEMES, "Current theme is " + mCurrentTheme.getName()); updateCurrentThemeView(); if (mThemeSearchFragment != null && mThemeSearchFragment.isVisible()) { mThemeSearchFragment.setRefreshing(false); } } }
Source:
public static boolean updateServiceUrl(String serviceName, String url) throws Exception { String sHomeCommunityId = HELPER.getHomeCommunityFromPropFile(); OrganizationType newOrganization = getInstance().getOrganization(sHomeCommunityId); if (null == newOrganization) { return false; } EndpointConfigurationType endpointUrl = HELPER.getEndPointConfigBasedOnSpecVersion( HELPER.getServiceEndpointType(newOrganization, serviceName), NhincConstants.ADAPTER_API_LEVEL.LEVEL_a0.name()); endpointUrl.setUrl(url); ExchangeInfoType exchangeInfo = getExchangeInfo(); List<OrganizationType> organizations = HELPER.getOrganizationTypeBy(exchangeInfo); OrganizationType oldOrganization = HELPER.findOrganizationTypeBy(organizations, sHomeCommunityId); if (null == oldOrganization) { return false; } organizations.remove(oldOrganization); organizations.add(newOrganization); getExchangeInfoDAO().saveExchangeInfo(exchangeInfo); return true; }

Target:
public boolean updateServiceUrl(String serviceName, String url) throws Exception { if (null == exInfo) { loadExchangeInfo(); } OrganizationType updateOrganization = getOrganization(HELPER.getHomeCommunityFromPropFile()); if (null == updateOrganization) { return false; } EndpointConfigurationType endpointUrl = HELPER.getEndPointConfigBasedOnSpecVersion( HELPER.getServiceEndpointType(updateOrganization, serviceName), NhincConstants.ADAPTER_API_LEVEL.LEVEL_a0.name()); endpointUrl.setUrl(url); getExchangeInfoDAO().saveExchangeInfo(exInfo); return true; }
Source:
public void andThenSingleError() { TestSubscriber<String> ts = new TestSubscriber<String>(0); final AtomicBoolean hasRun = new AtomicBoolean(false); final Exception e = new Exception(); Completable.create(new CompletableOnSubscribe() { @Override public void call(CompletableSubscriber cs) { cs.onError(e); } }) .andThen(Single.<String>create(new Single.OnSubscribe<String>() { @Override public void call(SingleSubscriber<? super String> s) { hasRun.set(true); s.onSuccess("foo"); } })) .subscribe(ts); ts.assertNoValues(); ts.assertError(e); ts.assertUnsubscribed(); Assert.assertFalse("Should not have subscribed to single when completable errors", hasRun.get()); }

Target:
public void andThenSingleError() { TestSubscriber<String> ts = new TestSubscriber<String>(0); final AtomicBoolean hasRun = new AtomicBoolean(false); final Exception e = new Exception(); Completable.error(e) .andThen(Single.<String>create(new Single.OnSubscribe<String>() { @Override public void call(SingleSubscriber<? super String> s) { hasRun.set(true); s.onSuccess("foo"); } })) .subscribe(ts); ts.assertNoValues(); ts.assertError(e); ts.assertUnsubscribed(); Assert.assertFalse("Should not have subscribed to single when completable errors", hasRun.get()); }
Source:
private Map<String, List<Object>> toStreamLineEvents(Map<FieldName, ?> predScores) { Map<String, List<Object>> streamsToEvents = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>(); predScores.forEach((k, v) -> resultMap.put(k.getValue(), v)); for (Stream stream : outputStreams) { streamsToEvents.put(stream.getId(), Arrays.asList(new StreamlineEventImpl(resultMap, modelId))); } return streamsToEvents; }

Target:
private Map<String, List<Object>> toStreamLineEvents(Map<FieldName, ?> predScores) { Map<String, List<Object>> streamsToEvents = new HashMap<>(); final Map<String, Object> scoredVals = new HashMap<>(); for (FieldName predictedField : getPredictedFields()) { Object targetValue = predScores.get(predictedField); scoredVals.put(predictedField.getValue(), EvaluatorUtil.decode(targetValue)); } for (FieldName outputField : getOutputFields()) { Object targetValue = predScores.get(outputField); scoredVals.put(outputField.getValue(), EvaluatorUtil.decode(targetValue)); }; for (Stream stream : outputStreams) { streamsToEvents.put(stream.getId(), Arrays.asList(new StreamlineEventImpl(scoredVals, modelId))); } return streamsToEvents; }
Source:
private void updateMemoryUsage() { long memorySize = pageBuilder.getRetainedSizeInBytes(); for (Aggregator aggregator : aggregates) { memorySize += aggregator.getEstimatedSize(); } if (step.isOutputPartial()) { systemMemoryContext.setBytes(memorySize); } else { userMemoryContext.setBytes(memorySize); } }

Target:
private void updateMemoryUsage() { long memorySize = pageBuilder.getRetainedSizeInBytes(); for (Page output : outputPages) { memorySize += output.getRetainedSizeInBytes(); } for (Aggregator aggregator : aggregates) { memorySize += aggregator.getEstimatedSize(); } if (currentGroup != null) { memorySize += currentGroup.getRetainedSizeInBytes(); } if (step.isOutputPartial()) { systemMemoryContext.setBytes(memorySize); } else { userMemoryContext.setBytes(memorySize); } }
Source:
public void testCommandLine() throws IOException { final File tnCoverageFile = LOG2_TN_COVERAGE_FILE; final File snpFile = ALLELIC_COUNTS_FILE; final File outputSegmentFile = createTempFile("segments", ".seg"); final int initialNumCRStates = 10; final int initialNumAFStates = 10; final String[] arguments = { "-" + ExomeStandardArgumentDefinitions.TANGENT_NORMALIZED_COUNTS_FILE_SHORT_NAME, tnCoverageFile.getAbsolutePath(), "-" + ExomeStandardArgumentDefinitions.TUMOR_ALLELIC_COUNTS_FILE_SHORT_NAME, snpFile.getAbsolutePath(), "-" + PerformJointSegmentation.INITIAL_NUM_COPY_RATIO_STATES_SHORT_NAME, Integer.toString(initialNumCRStates), "-" + PerformJointSegmentation.INITIAL_NUM_ALLELE_FRACTION_STATES_SHORT_NAME, Integer.toString(initialNumAFStates), "-" + ExomeStandardArgumentDefinitions.SEGMENT_FILE_SHORT_NAME, outputSegmentFile.getAbsolutePath(), }; runCommandLine(arguments); final List<ACNVModeledSegment> segments = SegmentUtils.readACNVModeledSegmentFile(outputSegmentFile); }

Target:
public void testCommandLine() throws IOException { final File tnCoverageFile = LOG2_TN_COVERAGE_FILE; final File snpFile = ALLELIC_COUNTS_FILE; final File outputSegmentFile = createTempFile("segments", ".seg"); final int initialNumCRStates = 3; final int initialNumAFStates = 3; final String[] arguments = { "-" + ExomeStandardArgumentDefinitions.TANGENT_NORMALIZED_COUNTS_FILE_SHORT_NAME, tnCoverageFile.getAbsolutePath(), "-" + ExomeStandardArgumentDefinitions.TUMOR_ALLELIC_COUNTS_FILE_SHORT_NAME, snpFile.getAbsolutePath(), "-" + PerformJointSegmentation.INITIAL_NUM_COPY_RATIO_STATES_SHORT_NAME, Integer.toString(initialNumCRStates), "-" + PerformJointSegmentation.INITIAL_NUM_ALLELE_FRACTION_STATES_SHORT_NAME, Integer.toString(initialNumAFStates), "-" + ExomeStandardArgumentDefinitions.SEGMENT_FILE_SHORT_NAME, outputSegmentFile.getAbsolutePath() }; runCommandLine(arguments); final List<ACNVModeledSegment> segments = SegmentUtils.readACNVModeledSegmentFile(outputSegmentFile); }
Source:
public void testNullInCommand() { ProcessBuilder pb = new ProcessBuilder("command", "with\u0000inside"); try { pb.start(); fail(); } catch(IOException expected) }

Target:
public void testNullInCommand() { ProcessBuilder pb = new ProcessBuilder("ls", "with\u0000inside"); try { pb.start(); fail(); } catch(IOException expected) }
Source:
private List<String> parseFieldDescription(String fieldDescription) { if (fieldDescription == null || fieldDescription.equals("")) { throw new IllegalArgumentException("Invalid query: field name is empty"); } int lastDotIndex = fieldDescription.lastIndexOf("."); if (lastDotIndex == fieldDescription.length() - 1) { throw new IllegalArgumentException("Invalid query: field name must not end with a period ('.')"); } if (lastDotIndex > -1) { return Arrays.asList(FIELD_SEPARATOR.split(fieldDescription)); } else { ArrayList<String> result = new ArrayList<>(1); result.add(fieldDescription); return result; } }

Target:
private List<String> parseFieldDescription(String fieldDescription) { if (fieldDescription == null || fieldDescription.equals("")) { throw new IllegalArgumentException("Invalid query: field name is empty"); } int lastDotIndex = fieldDescription.lastIndexOf("."); if (lastDotIndex == fieldDescription.length() - 1) { throw new IllegalArgumentException("Invalid query: field name must not end with a period ('.')"); } if (lastDotIndex > -1) { return Arrays.asList(FIELD_SEPARATOR.split(fieldDescription)); } else { return Collections.singletonList(fieldDescription); } }
Source:
public SimpleCertificateResponseMessageType deleteTemporaryKeystore( DeleteTemporaryKeystoreRequestMessageType request) { File deleteFile = new File(FILE_JKS_GATEWAY_NEW); if (deleteFile.exists() && deleteFile.delete()) { return buildSimpleResponse(true, "gateway-new delete successful."); } return buildSimpleResponse(false, "gateway-new doesn't exist."); }

Target:
public SimpleCertificateResponseMessageType deleteTemporaryKeystore( DeleteTemporaryKeystoreRequestMessageType request) { File deleteFile = new File(FILE_JKS_GATEWAY_NEW); if (deleteFile.exists() && deleteFile.delete()) { return buildSimpleResponse(true, "Temporary Keystore delete successful."); } return buildSimpleResponse(false, "Temporary Keystore doesn't exist."); }
Source:
public Converter getConverter() { if (clazz == char.class) { if (fieldIfPresent != null) { return new PrimitiveConverters.CharFieldSettingConverter(parentContainerIfPresent, fieldIfPresent); } return new PrimitiveConverters.CharConverter(); } else if (clazz == Character.class) { if (fieldIfPresent != null) { return new PrimitiveConverters.CharRefFieldSettingConverter(parentContainerIfPresent, fieldIfPresent); } } else if (clazz == short.class) { if (fieldIfPresent != null) { return new PrimitiveConverters.ShortFieldSettingConverter(parentContainerIfPresent, fieldIfPresent); } return new PrimitiveConverters.ShortConverter(); } else if (clazz == Short.class) { if (fieldIfPresent != null) { return new PrimitiveConverters.ShortRefFieldSettingConverter(parentContainerIfPresent, fieldIfPresent); } } else if (clazz == String.class) { if (fieldIfPresent != null) { return new PrimitiveConverters.StringFieldSettingConverter(parentContainerIfPresent, fieldIfPresent); } return new PrimitiveConverters.StringConverter(); } else if (clazz.isEnum()) { if (fieldIfPresent != null) { return new PrimitiveConverters.EnumFieldSettingConverter( clazz, parentContainerIfPresent, fieldIfPresent ); } return new PrimitiveConverters.EnumConverter(clazz); } else if (clazz == byte.class) { if (fieldIfPresent != null) { return new PrimitiveConverters.ByteFieldSettingConverter(parentContainerIfPresent, fieldIfPresent); } return new PrimitiveConverters.ByteConverter(); } else if (clazz == Byte.class) { if (fieldIfPresent != null) { return new PrimitiveConverters.ByteRefFieldSettingConverter(parentContainerIfPresent, fieldIfPresent); } } if (fieldIfPresent != null) { return new PrimitiveConverters.RefFieldSettingConverter(parentContainerIfPresent, fieldIfPresent); } return new PrimitiveConverters.PrimitivePojoConverter(); }

Target:
public Converter getConverter() { if(fieldIfPresent != null) { if(fieldIfPresent.getType().isEnum()) { return new PrimitiveConverters.EnumFieldSettingConverter(fieldIfPresent.getType(), parentContainerIfPresent, fieldIfPresent); } try { Constructor converterConstructor = typeToFieldSettingConverters.get(fieldIfPresent.getType()); if(converterConstructor == null) { return new PrimitiveConverters.RefFieldSettingConverter(parentContainerIfPresent, fieldIfPresent); } return (Converter) converterConstructor.newInstance(parentContainerIfPresent, fieldIfPresent); } catch (Exception e) { throw new RuntimeException(e); } } else { if(clazz.isEnum()) { return new PrimitiveConverters.EnumConverter(clazz); } Converter converter = typeToConverters.get(clazz); if(converter == null) { converter = new PrimitiveConverters.PrimitivePojoConverter(); } return converter; } }
Source:
private void cancelRxCommands() { for (CommandHandle commandHandle : fRxCommands.values()) { if (commandHandle.getRequestMonitor() == null) continue; commandHandle.getRequestMonitor().setStatus(genStatus( "Connection is shut down")); commandHandle.getRequestMonitor().done(); } fRxCommands.clear(); }

Target:
private synchronized void cancelRxCommands() { for (CommandHandle commandHandle : fRxCommands.values()) { if (commandHandle.getRequestMonitor() == null) continue; commandHandle.getRequestMonitor().setStatus(genStatus( "Connection is shut down")); commandHandle.getRequestMonitor().done(); } fRxCommands.clear(); }
Source:
public void createPartControl(Composite parent) { super.createPartControl(parent); createActions(); configureToolBar(getViewSite().getActionBars().getToolBarManager()); IConsole[] consoles = getConsoleManager().getConsoles(); consolesAdded(consoles); getConsoleManager().addConsoleListener(this); getViewSite().getActionBars().updateActionBars(); initPageSwitcher(); }

Target:
public void createPartControl(Composite parent) { super.createPartControl(parent); createActions(); configureToolBar(getViewSite().getActionBars().getToolBarManager()); IConsole[] consoles = getConsoleManager().getConsoles(); consolesAdded(consoles); getConsoleManager().addConsoleListener(this); getViewSite().getPage().addPartListener((IPartListener2) this); getViewSite().getActionBars().updateActionBars(); initPageSwitcher(); }
Source:
public Object[] getElements(Object inputElement) { if (inputElement instanceof IBuild) { return getChildren(inputElement); } if (inputElement instanceof String) { return new Object[] { inputElement }; } return NO_ELEMENTS; }

Target:
public Object[] getElements(Object inputElement) { if (inputElement instanceof IBuild) { return getChildren(inputElement); } return NO_ELEMENTS; }
Source:
public void shouldDecomposeListWithNonEmptyTail() { final List<Option<? extends Number>> numberOptionList = List.of(Option.some(1), Option.some(2.0)); final String actual = Match(numberOptionList).of( Case($Cons($Some($(1)), $Cons($Some($(2.0)), $())), (x, xs) -> { final Some<? extends Number> head = x; final List<Some<? extends Number>> tail = xs; return head + "::" + tail; }) ); assertThat(actual).isEqualTo("Some(1)::List(Some(2.0))"); }

Target:
public void shouldDecomposeListWithNonEmptyTail() { final List<Option<Number>> numberOptionList = List.of(Option.some(1), Option.some(2.0)); final String actual = Match(numberOptionList).of( Case($Cons($Some($(1)), $Cons($Some($(2.0)), $())), (Some<Number> x, List<Option<Number>> xs) -> { final Some<Number> head = x; final List<Option<Number>> tail = xs; return head + "::" + tail; }) ); assertThat(actual).isEqualTo("Some(1)::List(Some(2.0))"); }
Source:
protected JdbcDeserializationConverter createInternalConverter(LogicalType type) { switch (type.getTypeRoot()) { case NULL: return v -> null; case BOOLEAN: return v -> (boolean) v; case TINYINT: return v -> (byte) v; case SMALLINT: return v -> (Integer.valueOf(v.toString())).shortValue(); case INTEGER: case INTERVAL_YEAR_MONTH: return v -> (int) v; case BIGINT: case INTERVAL_DAY_TIME: return v -> (long) v; case DATE: return v -> (int) (((Date) v).toLocalDate().toEpochDay()); case TIME_WITHOUT_TIME_ZONE: return v -> ((Time) v).toLocalTime().toSecondOfDay() * 1000; case TIMESTAMP_WITH_TIME_ZONE: case TIMESTAMP_WITHOUT_TIME_ZONE: return v -> TimestampData.fromTimestamp((Timestamp) v); case FLOAT: return v -> (float) v; case DOUBLE: return v -> (double) v; case CHAR: case VARCHAR: return v -> StringData.fromString((String) v); case BINARY: case VARBINARY: return v -> (byte[]) v; case DECIMAL: final int precision = ((DecimalType) type).getPrecision(); final int scale = ((DecimalType) type).getScale(); return v -> DecimalData.fromBigDecimal((BigDecimal) v, precision, scale); case ARRAY: final JdbcDeserializationConverter arrayConverter = createToInternalArrayConverter((ArrayType) type); return v -> arrayConverter.deserialize(v); case ROW: case MAP: case MULTISET: case RAW: default: throw new UnsupportedOperationException("Not support to parse type: " + type); } }

Target:
protected JdbcDeserializationConverter createInternalConverter(LogicalType type) { switch (type.getTypeRoot()) { case NULL: return v -> null; case BOOLEAN: case TINYINT: case FLOAT: case DOUBLE: case INTEGER: case INTERVAL_YEAR_MONTH: case BIGINT: case INTERVAL_DAY_TIME: return v -> v; case SMALLINT: return v -> (Integer.valueOf(v.toString())).shortValue(); case DATE: return v -> (int) (((Date) v).toLocalDate().toEpochDay()); case TIME_WITHOUT_TIME_ZONE: return v -> (int) (((Time) v).toLocalTime().toNanoOfDay() / 1_000_000L); case TIMESTAMP_WITH_TIME_ZONE: case TIMESTAMP_WITHOUT_TIME_ZONE: return v -> TimestampData.fromTimestamp((Timestamp) v); case CHAR: case VARCHAR: return v -> StringData.fromString((String) v); case BINARY: case VARBINARY: return v -> (byte[]) v; case DECIMAL: final int precision = ((DecimalType) type).getPrecision(); final int scale = ((DecimalType) type).getScale(); return v -> DecimalData.fromBigDecimal((BigDecimal) v, precision, scale); case ARRAY: case ROW: case MAP: case MULTISET: case RAW: default: throw new UnsupportedOperationException("Unsupported type:" + type); } }
Source:
protected KijiMapCellIterator(String family, HBaseKijiRowData rowdata) throws IOException { mFamily = family; mColumnNameTranslator = new ColumnNameTranslator(rowdata.mTableLayout); mDecoder = rowdata.getDecoder(family, null); KijiDataRequest.Column columnRequest = rowdata.mDataRequest.getColumn(family, null); mMaxVersions = columnRequest.getMaxVersions(); mKVs = rowdata.mResult.list().iterator(); mNumVersions = mKVs.hasNext() ? mMaxVersions : 0; }

Target:
protected KijiMapCellIterator(String family, HBaseKijiRowData rowdata) throws IOException { mFamily = family; mColumnNameTranslator = new ColumnNameTranslator(rowdata.mTableLayout); mDecoder = rowdata.getDecoder(family, null); KijiDataRequest.Column columnRequest = rowdata.mDataRequest.getColumn(family, null); mMaxVersions = columnRequest.getMaxVersions(); mKVs = new ArrayIterator(rowdata.mResult.raw()); mNumVersions = mKVs.hasNext() ? mMaxVersions : 0; }
Source:
public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final CpioArchiveEntry other = (CpioArchiveEntry) obj; if (name == null) { return other.name == null; } else return name.equals(other.name); }

Target:
public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final CpioArchiveEntry other = (CpioArchiveEntry) obj; if (name == null) { return other.name == null; } else { return name.equals(other.name); } }
Source:
public static IntervalList fromPath(final Path path) { final BufferedReader reader = IOUtil.openFileForBufferedReading(path); final IntervalList list = fromReader(reader); try { reader.close(); } catch (final IOException e) { throw new SAMException(String.format("Failed to close file %s after reading", path)); } return list; }

Target:
public static IntervalList fromPath(final Path path) { final BufferedReader reader = IOUtil.openFileForBufferedReading(path); final IntervalList list = fromReader(reader); try { reader.close(); } catch (final IOException e) { throw new SAMException(String.format("Failed to close file %s after reading", path.toUri().toString())); } return list; }
Source:
private boolean internalValidateAndSetQuota() { if ((isInternalExecution() && !isQuotaInternalDependent()) || !isQuotaDependant()) { return true; } QuotaConsumptionParametersWrapper quotaConsumptionParametersWrapper = new QuotaConsumptionParametersWrapper(this, getReturnValue().getCanDoActionMessages()); quotaConsumptionParametersWrapper.setParameters(getQuotaConsumptionParameters()); List<QuotaConsumptionParameter> quotaParams = quotaConsumptionParametersWrapper.getParameters(); if (quotaParams == null) { throw new InvalidQuotaParametersException("Command: " + this.getClass().getName() + ". No Quota parameters available."); } if (quotaParams.isEmpty()) { return true; } if (getStoragePool() == null) { throw new InvalidQuotaParametersException("Command: " + this.getClass().getName() + ". Storage pool is not available for quota calculation. "); } boolean result = getQuotaManager().consume(quotaConsumptionParametersWrapper); setQuotaChanged(result); return result; }

Target:
private boolean internalValidateAndSetQuota() { if (!isQuotaDependant()) { return true; } QuotaConsumptionParametersWrapper quotaConsumptionParametersWrapper = new QuotaConsumptionParametersWrapper(this, getReturnValue().getCanDoActionMessages()); quotaConsumptionParametersWrapper.setParameters(getQuotaConsumptionParameters()); List<QuotaConsumptionParameter> quotaParams = quotaConsumptionParametersWrapper.getParameters(); if (quotaParams == null) { throw new InvalidQuotaParametersException("Command: " + this.getClass().getName() + ". No Quota parameters available."); } if (quotaParams.isEmpty()) { return true; } if (getStoragePool() == null) { throw new InvalidQuotaParametersException("Command: " + this.getClass().getName() + ". Storage pool is not available for quota calculation. "); } boolean result = getQuotaManager().consume(quotaConsumptionParametersWrapper); setQuotaChanged(result); return result; }
Source:
public DataRegistration.Builder key(Key<?> key, Key<?>... others) { this.keys.add(key); this.keys.addAll(Arrays.asList(others)); return this; }

Target:
public DataRegistration.Builder key(Key<?> key, Key<?>... others) { this.keys.add(key); Collections.addAll(this.keys, others); return this; }
Source:
private static void logJSError(WebDriver driver){ if (Global.JS_ERROR_ENABLED){ JavascriptExecutor js = (JavascriptExecutor) driver; ArrayList<String> error = (ArrayList<String>) js.executeScript("return window.JSErrorCollector_errors.pump()"); if (!error.isEmpty()) { StringBuilder builder = new StringBuilder(); builder.append("<tr class=\"error\"><td>click</td><td>"+error+"</td><td> <br/> &nbsp;</td></tr>"); CommonUtils.appendTextToFile(logPath, builder.toString()); } } }

Target:
private static void logJSError(WebDriver driver){ if (Global.JS_ERROR_ENABLED){ JavascriptExecutor js = (JavascriptExecutor) driver; ArrayList<String> error = (ArrayList<String>) js.executeScript( "return window.JSErrorCollector_errors.pump()" ); if (!error.isEmpty()) { StringBuilder builder = new StringBuilder(); builder.append( "<tr class=\"error\">" + "<td>click</td>" + "<td>"+error+"</td>" + "<td> <br/> &nbsp;</td></tr>"); CommonUtils.appendTextToFile(logPath, builder.toString()); } } }
Source:
public static void unregisterLoggingContext() { MDC.remove(SESSIONID_LOG_KEY); MDC.remove(QUERYID_LOG_KEY); MDC.remove(OPERATIONLOG_LEVEL_KEY); l4j.info("Unregistered logging context."); if (MDC.get(OPERATIONLOG_LEVEL_KEY) != null) { throw new RuntimeException("Keys removal failed from thread context MDC"); } }

Target:
public static void unregisterLoggingContext() { MDC.remove(SESSIONID_LOG_KEY); MDC.remove(QUERYID_LOG_KEY); MDC.remove(OPERATIONLOG_LEVEL_KEY); l4j.info("Unregistered logging context."); }
Source:
static String safeName(String name) { if (name == null) { return null; } boolean prevCharIsUnderscore = false; StringBuilder safeNameBuilder = new StringBuilder(); for (char nameChar : name.toCharArray()) { boolean isUnsafeChar = !(Character.isLetterOrDigit(nameChar) || nameChar == ':' || nameChar == '_'); if ((isUnsafeChar || nameChar == '_') && !prevCharIsUnderscore) { safeNameBuilder.append("_"); prevCharIsUnderscore = true; } else if (nameChar == '_' || isUnsafeChar) { continue; } else { safeNameBuilder.append(nameChar); prevCharIsUnderscore = false; } } return safeNameBuilder.toString(); }

Target:
static String safeName(String name) { if (name == null) { return null; } boolean prevCharIsUnderscore = false; StringBuilder safeNameBuilder = new StringBuilder(name.length()); for (char nameChar : name.toCharArray()) { boolean isUnsafeChar = !(Character.isLetterOrDigit(nameChar) || nameChar == ':' || nameChar == '_'); if ((isUnsafeChar || nameChar == '_')) { if (prevCharIsUnderscore) { continue; } else { safeNameBuilder.append("_"); prevCharIsUnderscore = true; } } else { safeNameBuilder.append(nameChar); prevCharIsUnderscore = false; } } return safeNameBuilder.toString(); }
Source:
private boolean isInitBooleanFalse(LiteralTree initTree) { if (initTree.symbolType().isPrimitive(Primitives.BOOLEAN) && !Boolean.parseBoolean(initTree.value())) { return true; } return false; }

Target:
private static boolean isInitBooleanFalse(LiteralTree initTree) { return initTree.is(Tree.Kind.BOOLEAN_LITERAL) && !Boolean.parseBoolean(initTree.value()); }
Source:
void writeWithThrowable(StringBuilder buf, Throwable t) { if (t != null) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); t.printStackTrace(pw); buf.append(sw.toString()); pw.close(); } System.out.println(buf.toString()); }

Target:
void writeWithThrowable(StringBuilder buf, Throwable t) { if (t != null) { StringWriter sw = new StringWriter(); try (PrintWriter pw = new PrintWriter(sw)) { t.printStackTrace(pw); buf.append(sw.toString()); } } System.out.println(buf.toString()); }
Source:
public PeriodicMeterReadsResponse getPeriodicMeterReadsResponse( @OrganisationIdentification final String organisationIdentification, @RequestPayload final PeriodicMeterReadsAsyncRequest request) throws OsgpException { LOGGER.debug("Incoming PeriodicMeterReadsAsyncRequest for meter: {}.", request.getDeviceIdentification()); PeriodicMeterReadsResponse response = null; try { final MeterResponseData meterResponseData = this.monitoringService .dequeuePeriodicMeterReadsResponse(request.getCorrelationUid()); if (OsgpResultType.NOT_OK == OsgpResultType.fromValue(meterResponseData.getResultType().getValue())) { if (meterResponseData.getMessageData() instanceof String) { throw new TechnicalException(ComponentType.WS_SMART_METERING, (String) meterResponseData.getMessageData(), null); } else { throw new TechnicalException(ComponentType.WS_SMART_METERING, "An exception occurred retrieving the periodic meter reads.", null); } } response = this.monitoringMapper.map(meterResponseData.getMessageData(), com.alliander.osgp.adapter.ws.schema.smartmetering.monitoring.PeriodicMeterReadsResponse.class); } catch (final Exception e) { this.handleRetrieveException(e, request, organisationIdentification); } return response; }

Target:
public PeriodicMeterReadsResponse getPeriodicMeterReadsResponse( @OrganisationIdentification final String organisationIdentification, @RequestPayload final PeriodicMeterReadsAsyncRequest request) throws OsgpException { LOGGER.debug("Incoming PeriodicMeterReadsAsyncRequest for meter: {}.", request.getDeviceIdentification()); PeriodicMeterReadsResponse response = null; try { final MeterResponseData meterResponseData = this.monitoringService .dequeuePeriodicMeterReadsResponse(request.getCorrelationUid()); this.throwExceptionIfResultNotOk(meterResponseData, "retrieving the periodic meter reads"); response = this.monitoringMapper.map(meterResponseData.getMessageData(), com.alliander.osgp.adapter.ws.schema.smartmetering.monitoring.PeriodicMeterReadsResponse.class); } catch (final Exception e) { this.handleRetrieveException(e, request, organisationIdentification); } return response; }
Source:
private static EdgeType resolveIRQ(int vec) { EdgeType ret = EdgeType.UNKNOWN; switch (vec) { case 0: ret = EdgeType.INTERRUPTED; break; case 19: case 23: ret = EdgeType.USER_INPUT; break; default: ret = EdgeType.UNKNOWN; break; } return ret; }

Target:
private static EdgeType resolveIRQ(int vec) { EdgeType ret = EdgeType.UNKNOWN; switch (vec) { case IRQ_TIMER: ret = EdgeType.INTERRUPTED; break; default: ret = EdgeType.UNKNOWN; break; } return ret; }
Source:
public void checkShareWorkspaceTab() { workspaceShare.waitMemberNameInShareList(systemAdminName); assertEquals(workspaceShare.getMemberPermissions(systemAdminName), ADMIN_PERMISSIONS); workspaceShare.clickOnMemberCheckbox(systemAdminName); assertTrue(workspaceShare.isMemberCheckedInList(systemAdminName)); workspaceShare.clickOnMemberCheckbox(systemAdminName); assertFalse(workspaceShare.isMemberCheckedInList(systemAdminName)); workspaceShare.clickOnBulk(); assertTrue(workspaceShare.isMemberCheckedInList(systemAdminName)); workspaceShare.clickOnBulk(); assertFalse(workspaceShare.isMemberCheckedInList(systemAdminName)); }

Target:
public void checkShareWorkspaceTab() { workspaceShare.waitMemberNameInShareList(systemAdminName); assertEquals(workspaceShare.getMemberPermissions(systemAdminName), ADMIN_PERMISSIONS); }
Source:
public void convert(JsonElement value, ColumnVector vect, int row) { if (value == null || value.isJsonNull()) { vect.noNulls = false; vect.isNull[row] = true; } else { MapColumnVector vector = (MapColumnVector) vect; JsonObject obj = value.getAsJsonObject(); Set<String> keySet = obj.keySet(); vector.lengths[row] = obj.size(); vector.offsets[row] = row > 0 ? vector.offsets[row - 1] + vector.lengths[row - 1] : 0; vector.keys.ensureSize(keySet.size(), true); int i = 0; for (String key : obj.keySet()) { childrenConverters[0].convert(new JsonPrimitive(key), vector.keys, (int) vector.offsets[row] + i); childrenConverters[1].convert(obj.get(key), vector.values, (int) vector.offsets[row] + i); i++; } } }

Target:
public void convert(JsonElement value, ColumnVector vect, int row) { if (value == null || value.isJsonNull()) { vect.noNulls = false; vect.isNull[row] = true; } else { MapColumnVector vector = (MapColumnVector) vect; JsonObject obj = value.getAsJsonObject(); vector.lengths[row] = obj.size(); vector.offsets[row] = row > 0 ? vector.offsets[row - 1] + vector.lengths[row - 1] : 0; vector.keys.ensureSize((int) vector.offsets[row] + obj.size(), true); vector.values.ensureSize((int) vector.offsets[row] + obj.size(), true); int i = 0; for (String key : obj.keySet()) { childrenConverters[0].convert(new JsonPrimitive(key), vector.keys, (int) vector.offsets[row] + i); childrenConverters[1].convert(obj.get(key), vector.values, (int) vector.offsets[row] + i); i++; } } }
Source:
protected void initButtons(IObservableList list) { initAddButton(addButton, list); initRemoveButton(removeButton, list); initUpButton(upButton, list); initDownButton(downButton, list); getTableViewer().addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { final boolean emptySelection = event.getSelection().isEmpty(); final boolean enabledElement = getVElement().isEffectivelyEnabled(); final boolean enable = !emptySelection && enabledElement; if (removeButton != null) { removeButton.setEnabled(enable); } if (upButton != null) { upButton.setEnabled(enable); } if (downButton != null) { downButton.setEnabled(enable); } } }); }

Target:
protected void initButtons(IObservableList list) { initAddButton(addButton, list); initRemoveButton(removeButton, list); initUpButton(upButton, list); initDownButton(downButton, list); getTableViewer().addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { updateButtonEnabling(); } }); updateButtons(); }
Source:
protected MemcachedClientCallback createMemcachedClientCallback() { return new MemcachedClientCallback() { @Override public byte[] get(final String key) throws IOException { return _memcached.get(_memcachedNodesManager.getStorageKeyFormat().format( key )); } }; }

Target:
protected MemcachedClientCallback createMemcachedClientCallback() { return new MemcachedClientCallback() { @Override public byte[] get(final String key) { return _memcached.get(_memcachedNodesManager.getStorageKeyFormat().format( key )); } }; }
Source:
private static void calculatePLIndexToAlleleIndices(final int altAlleles, final int ploidy, final List<List<Integer>> anyploidPLIndexToAlleleIndices, final List<Integer> genotype) { for (int a=0; a <= altAlleles; a++) { final List<Integer> gt = new ArrayList<Integer>(Arrays.asList(a)); gt.addAll(genotype); if ( ploidy == 1 ) anyploidPLIndexToAlleleIndices.add(gt); else if ( ploidy > 1 ) calculatePLIndexToAlleleIndices(a, ploidy-1, anyploidPLIndexToAlleleIndices, gt); } }

Target:
private static void calculatePLIndexToAlleleIndices(final int altAlleles, final int ploidy, final List<List<Integer>> anyploidPLIndexToAlleleIndices, final List<Integer> genotype) { for (int a=0; a <= altAlleles; a++) { final List<Integer> gt = new ArrayList<Integer>(Arrays.asList(a)); gt.addAll(genotype); if ( ploidy == 1 ) { anyploidPLIndexToAlleleIndices.add(gt); } else if ( ploidy > 1 ) { calculatePLIndexToAlleleIndices(a, ploidy - 1, anyploidPLIndexToAlleleIndices, gt); } } }
Source:
public boolean isAuthorized(final WebContext context, final List<CommonProfile> profiles) { final boolean checkRequest = !onlyCheckPostRequest || ContextHelper.isPost(context); if (checkRequest) { final String parameterToken = context.getRequestParameter(parameterName).orElse(null); final String headerToken = context.getRequestHeader(headerName).orElse(null); final Optional<String> sessionToken = context.getSessionStore().get(context, Pac4jConstants.CSRF_TOKEN); return sessionToken.isPresent() && (sessionToken.get().equals(parameterToken) || sessionToken.get().equals(headerToken)); } else { return true; } }

Target:
public boolean isAuthorized(final WebContext context, final List<CommonProfile> profiles) { final boolean checkRequest = !onlyCheckPostRequest || ContextHelper.isPost(context); if (checkRequest) { final Optional<String> parameterToken = context.getRequestParameter(parameterName); final Optional<String> headerToken = context.getRequestHeader(headerName); final Optional<String> sessionToken = context.getSessionStore().get(context, Pac4jConstants.CSRF_TOKEN); return sessionToken.map( sessionTokenValue -> parameterToken.map( pt -> sessionToken.equals(pt)).orElse(false) || headerToken.map( ht -> sessionToken.equals(ht)).orElse(false) ).orElse(false); } else { return true; } }
Source:
public String resolve(PartyContact contact) { return getResolver(contact.getClass()).getPresentationValue(contact); }

Target:
public String resolve(PartyContact contact) { ContactResolver contactResolver = getResolver(contact.getClass()); return contactResolver != null ? contactResolver.getPresentationValue(contact) : contact.getPresentationValue(); }