auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Promise<Users> searchUsers(Collection<String> usernames, int offset, int limit) { final ImmutableList.Builder<User> resultBuilder = ImmutableList.builder(); final String baseDn = conf.getBaseDn(); final String uidProp = conf.getUserIdProperty(); InitialLdapContext context = null; NamingEnumeration<SearchResult> searchResultEnumeration = null; try { context = createLdapContext(); Collection<LdapRole> ldapRoles = getAllLdapRoles(context, baseDn); searchResultEnumeration = context.search(baseDn, ALL_USER_QUERY, createSearchControls(limit, ATTRIBUTE_DN, uidProp)); for (final SearchResult searchResult : ImmutableList.copyOf(Iterators.forEnumeration(searchResultEnumeration))) { final Attributes attributes = searchResult.getAttributes(); if (hasAttribute(attributes, uidProp)) { final String userName = (String) attributes.get(uidProp).get(); final List<Role> userRoles = ldapRoles.stream() .filter(role -> role.getUniqueMembers().contains(searchResult.getNameInNamespace())) .map(role -> new Role(role.getName(), role.getPermissions())) .collect(Collectors.toList()); resultBuilder.add(new User(userName, userRoles)); } } ImmutableList<User> users = resultBuilder.build(); return Promise.immediate(new Users(users, offset, limit, users.size())); } catch (final NamingException e) { throw new SnowowlRuntimeException(e); } finally { closeNamingEnumeration(searchResultEnumeration); closeLdapContext(context); } }

Target:
public Promise<Users> searchUsers(Collection<String> usernames, int offset, int limit) { final ImmutableList.Builder<User> resultBuilder = ImmutableList.builder(); final String baseDn = conf.getBaseDn(); final String uidProp = conf.getUserIdProperty(); InitialLdapContext context = null; NamingEnumeration<SearchResult> searchResultEnumeration = null; try { context = createLdapContext(); Collection<LdapRole> ldapRoles = getAllLdapRoles(context, baseDn); searchResultEnumeration = context.search(baseDn, ALL_USER_QUERY, createSearchControls(ATTRIBUTE_DN, uidProp)); for (final SearchResult searchResult : ImmutableList.copyOf(Iterators.forEnumeration(searchResultEnumeration))) { final Attributes attributes = searchResult.getAttributes(); if (hasAttribute(attributes, uidProp)) { final String userName = (String) attributes.get(uidProp).get(); final List<Role> userRoles = ldapRoles.stream() .filter(role -> role.getUniqueMembers().contains(searchResult.getNameInNamespace())) .map(role -> new Role(role.getName(), role.getPermissions())) .collect(Collectors.toList()); resultBuilder.add(new User(userName, userRoles)); } } final List<User> users = resultBuilder.build().stream() .sorted((u1, u2) -> u1.getUsername().compareTo(u2.getUsername())) .filter(user -> usernames.isEmpty() || usernames.contains(user.getUsername())) .skip(offset) .limit(limit) .collect(Collectors.toList()); return Promise.immediate(new Users(users, offset, limit, users.size())); } catch (final NamingException e) { throw new SnowowlRuntimeException(e); } finally { closeNamingEnumeration(searchResultEnumeration); closeLdapContext(context); } }
Source:
private static Collection<EClassifierType> searchEClassifierType(IQueryEnvironment queryEnvironment, TypeName targetTypeName) { Collection<EClassifier> found = Sets.newLinkedHashSet(); if (targetTypeName.getPackagePrefix().some()) { String typeName = targetTypeName.getClassifierName(); String name = targetTypeName.getPackagePrefix().get(); found = queryEnvironment.getEPackageProvider().getType(name, typeName); } else { found.add(queryEnvironment.getEPackageProvider().getType(targetTypeName.getClassifierName())); } Collection<EClassifierType> types = Sets.newLinkedHashSet(); for (EClassifier eClassifier : found) { types.add(new EClassifierType(queryEnvironment, eClassifier)); } return types; }

Target:
private static Collection<EClassifierType> searchEClassifierType(IQueryEnvironment queryEnvironment, TypeName targetTypeName) { Collection<EClassifier> found = Sets.newLinkedHashSet(); if (targetTypeName.getPackagePrefix().some()) { String typeName = targetTypeName.getClassifierName(); String name = targetTypeName.getPackagePrefix().get(); found.addAll(queryEnvironment.getEPackageProvider().getTypes(name, typeName)); } else { found.add(queryEnvironment.getEPackageProvider().getType(targetTypeName.getClassifierName())); } Collection<EClassifierType> types = Sets.newLinkedHashSet(); for (EClassifier eClassifier : found) { types.add(new EClassifierType(queryEnvironment, eClassifier)); } return types; }
Source:
public String getSemanticObjectLabel(Object object) { ISemanticObjectLabelProvider itemStyledLabelProvider = (ISemanticObjectLabelProvider)adapterFactory .adapt(object, ISemanticObjectLabelProvider.class); String result; if (itemStyledLabelProvider != null) { result = itemStyledLabelProvider.getSemanticObjectLabel(object); } else if (object == null) { result = ""; } else { result = getText(object); } return result; }

Target:
public String getSemanticObjectLabel(Object object) { ISemanticObjectLabelProvider itemLabelProvider = (ISemanticObjectLabelProvider)adapterFactory .adapt(object, ISemanticObjectLabelProvider.class); String result; if (itemLabelProvider != null) { result = itemLabelProvider.getSemanticObjectLabel(object); } else if (object == null) { result = ""; } else { result = getText(object); } return result; }
Source:
private Editable smileyConvert(Editable input){ if (containSmiley(input, ":)")) { return convert(input,":)", "\uD83D\uDE42"); } else if (containSmiley(input, ":-)")) { return convert(input,":-)", "\uD83D\uDE42"); } else if (containSmiley(input, ":(")) { return convert(input,":(", "\uD83D\uDE41"); } else if (containSmiley(input, ":-(")) { return convert(input,":-(", "\uD83D\uDE41"); } else if (containSmiley(input, ":'(")) { return convert(input,":'(", "\uD83D\uDE22"); } else return input; }

Target:
private Editable smileyConvert(Editable input){ for (String key:emojiMap.keySet()) { input = convert(input, key, emojiMap.get(key)); } return input; }
Source:
public void test_CreateJobTemplate() throws IOException { try { CreateJobTemplate.createJobTemplate(PROJECT_ID, LOCATION, TEMPLATE_ID); } catch (GoogleJsonResponseException gjre) { } String output = bout.toString(); assertThat(output, containsString(TEMPLATE_NAME)); bout.reset(); }

Target:
public void test_CreateJobTemplate() throws IOException { CreateJobTemplate.createJobTemplate(PROJECT_ID, LOCATION, TEMPLATE_ID); String output = bout.toString(); assertThat(output, containsString(TEMPLATE_NAME)); bout.reset(); }
Source:
public void controller(@FragmentParam("patient") Patient patient, @FragmentParam("complete") Boolean complete, FragmentModel model, @SpringBean CoreContext emr) { Map<String, Object> calculations = new HashMap<String, Object>(); EncounterService encounterService = Context.getEncounterService(); EncounterType encounterType = encounterService.getEncounterTypeByUuid("3ee036d8-7c13-4393-b5d6-036f2fe45126"); Encounter lastMchEncounter = EmrUtils.lastEncounter(patient, encounterType); Obs lmpObs = EmrUtils.firstObsInEncounter(lastMchEncounter, Dictionary.getConcept(Dictionary.LAST_MONTHLY_PERIOD)); if (lmpObs != null) { int daysDiff = Days.daysBetween(new DateTime(lmpObs.getValueDate()), new DateTime(new Date())).getDays(); calculations.put("gestation", Math.ceil(daysDiff / 7)); } calculations.put("onPmtct", "TODO"); calculations.put("onArv", "TODO"); model.addAttribute("calculations", calculations); Concept medSet = emr.getRegimenManager().getMasterSetConcept("TB"); RegimenChangeHistory history = RegimenChangeHistory.forPatient(patient, medSet); model.addAttribute("regimenHistory", history); }

Target:
public void controller(@FragmentParam("patient") Patient patient, @FragmentParam("complete") Boolean complete, FragmentModel model, @SpringBean CoreContext emr) { Map<String, Object> calculations = new HashMap<String, Object>(); EncounterService encounterService = Context.getEncounterService(); EncounterType encounterType = encounterService.getEncounterTypeByUuid(Metadata.MCH_ENROLLMENT); Encounter lastMchEncounter = EmrUtils.lastEncounter(patient, encounterType); Obs lmpObs = EmrUtils.firstObsInEncounter(lastMchEncounter, Dictionary.getConcept(Dictionary.LAST_MONTHLY_PERIOD)); if (lmpObs != null) { Weeks weeks = Weeks.weeksBetween(new DateTime(lmpObs.getValueDate()), new DateTime(new Date())); calculations.put("gestation", weeks.getWeeks()); } calculations.put("onPmtct", "TODO"); calculations.put("onArv", "TODO"); model.addAttribute("calculations", calculations); Concept medSet = emr.getRegimenManager().getMasterSetConcept("TB"); RegimenChangeHistory history = RegimenChangeHistory.forPatient(patient, medSet); model.addAttribute("regimenHistory", history); }
Source:
private List<JSONObject> removeStreetDuplicates(List<JSONObject> results, String lang) { List<JSONObject> filteredItems = Lists.newArrayListWithCapacity(results.size()); final HashSet<String> keys = Sets.newHashSet(); for(JSONObject result : results) { final JSONObject properties = result.getJSONObject(Tags.KEY_PROPERTIES); if(properties.has(Tags.KEY_OSM_KEY) && "highway".equals(properties.getString(Tags.KEY_OSM_KEY))) { if(properties.has(OSMTags.KEY_POSTCODE) && properties.has(OSMTags.KEY_NAME)) { String postcode = properties.getString(OSMTags.KEY_POSTCODE); String name = properties.getString(OSMTags.KEY_NAME); String key = postcode + ":" + name; if(keys.contains(key)) { continue; } else if (lang.equals("nl")) { try { String letterlessPostcode = Utils.stripNonDigits(postcode); int postcodeNumbers = Integer.parseInt(letterlessPostcode); boolean foundMatch = false; for (String keyString : keys) { String letterlessKey = Utils.stripNonDigits(keyString); String keyName = keyString.split(":")[1]; if (postcodeNumbers == Integer.parseInt(letterlessKey) && keyName.equals(name)) { foundMatch = true; break; } } if (foundMatch) { continue; } } catch (NumberFormatException e) } keys.add(key); } } filteredItems.add(result); } return filteredItems; }

Target:
private List<JSONObject> removeStreetDuplicates(List<JSONObject> results, String lang) { List<JSONObject> filteredItems = Lists.newArrayListWithCapacity(results.size()); final HashSet<String> keys = Sets.newHashSet(); for(JSONObject result : results) { final JSONObject properties = result.getJSONObject(Tags.KEY_PROPERTIES); if(properties.has(Tags.KEY_OSM_KEY) && "highway".equals(properties.getString(Tags.KEY_OSM_KEY))) { if(properties.has(OSMTags.KEY_POSTCODE) && properties.has(OSMTags.KEY_NAME)) { String postcode = properties.getString(OSMTags.KEY_POSTCODE); String name = properties.getString(OSMTags.KEY_NAME); String key = postcode + ":" + name; if(keys.contains(key)) { continue; } keys.add(key); } } filteredItems.add(result); } return filteredItems; }
Source:
private boolean leaveWithoutApplyingDaeChangesDialog(String perspectiveName, Shell shell) { return MessageDialog.openQuestion(shell, "Confirm Leaving " + perspectiveName + " Perspective", "You have unapplied changes in the \"Experiment Setup\" tab, are you sure you want to leave " + "the " + perspectiveName + " perspective? \n\nThese changes are highlighted for you to find."); }

Target:
private boolean leaveWithoutApplyingDaeChangesDialog(String perspectiveName, Shell shell) { return MessageDialog.openQuestion(shell, "Confirm Leaving " + perspectiveName + " Perspective", "You have unapplied changes in the \"Experiment Setup\" tab, are you sure you want to leave " + "the perspective? \n\nThese changes will remain but will not be applied."); }
Source:
public Optional<FactoryDto> createFactoryFromDevfile( String devfileLocation, @Nullable Function<String, String> fileUrlProvider) throws BadRequestException, ServerException { if (devfileLocation == null) { return Optional.empty(); } final String devfileYamlContent = urlFetcher.fetch(devfileLocation); if (isNullOrEmpty(devfileYamlContent)) { return Optional.empty(); } try { Devfile devfile = devfileManager.parse(devfileYamlContent, false); WorkspaceConfigImpl wsConfig = devfileManager.createWorkspaceConfig( devfile, local -> fileUrlProvider != null ? urlFetcher.fetch(fileUrlProvider.apply(local)) : null); return Optional.of( newDto(FactoryDto.class) .withV(CURRENT_VERSION) .withWorkspace(DtoConverter.asDto(wsConfig))); } catch (DevfileFormatException | DevfileRecipeFormatException e) { throw new BadRequestException(e.getMessage()); } catch (IOException x) { throw new ServerException(x.getLocalizedMessage(), x); } }

Target:
public Optional<FactoryDto> createFactoryFromDevfile( String devfileLocation, @Nullable Function<String, String> fileUrlProvider) throws BadRequestException, ServerException { if (devfileLocation == null) { return Optional.empty(); } final String devfileYamlContent = urlFetcher.fetchSafely(devfileLocation); if (isNullOrEmpty(devfileYamlContent)) { return Optional.empty(); } try { Devfile devfile = devfileManager.parse(devfileYamlContent, false); WorkspaceConfigImpl wsConfig = devfileManager.createWorkspaceConfig( devfile, filename -> fileUrlProvider != null ? urlFetcher.fetch(fileUrlProvider.apply(filename)) : null); return Optional.of( newDto(FactoryDto.class) .withV(CURRENT_VERSION) .withWorkspace(DtoConverter.asDto(wsConfig))); } catch (DevfileException e) { throw new BadRequestException(e.getMessage()); } catch (IOException x) { throw new ServerException(x.getLocalizedMessage(), x); } }
Source:
public static String getNhinServiceName(List<String> serviceNames) { for (String name : serviceNames) { try { if (StringUtils.isNotBlank(NhincConstants.NHIN_SERVICE_NAMES.fromValueString(name).toString())) { return NhincConstants.NHIN_SERVICE_NAMES.fromValueString(name).getUDDIServiceName(); } } catch(IllegalArgumentException e) { } } return null; }

Target:
public static String getNhinServiceName(List<String> serviceNames) { for (String name : serviceNames) { try { if (StringUtils.isNotBlank(NhincConstants.NHIN_SERVICE_NAMES.fromValueString(name).toString())) { return NhincConstants.NHIN_SERVICE_NAMES.fromValueString(name).getUDDIServiceName(); } } catch(IllegalArgumentException e) { LOG.debug(e.getMessage()); } } return null; }
Source:
protected String cleanQuery(String query) { query = query.trim(); return query.endsWith(";") ? query.substring(0, query.length() - 1) : query; }

Target:
protected String cleanQuery(String query) { query = query.trim(); int idx = query.length() - 1; char currChar = query.charAt(idx); while (idx > 0 && currChar == ';' || Character.isWhitespace(currChar)) { idx--; currChar = query.charAt(idx); } if (idx == 0) { return ""; } return query.substring(0, idx + 1); }
Source:
private boolean canCastFrom(SqlCallBinding callBinding, boolean throwOnFailure, RelDataType inType, RelDataType outType) { if (!SqlTypeUtil.canCastFrom(outType, inType, true)) { if (throwOnFailure) { throw callBinding.newError( RESOURCE.cannotCastValue(inType.toString(), outType.toString())); } return false; } return true; }

Target:
private boolean canCastFrom(SqlCallBinding callBinding, boolean throwOnFailure, RelDataType inType, RelDataType outType) { if (SqlTypeUtil.canCastFrom(outType, inType, true)) { return true; } if (throwOnFailure) { throw callBinding.newError( RESOURCE.cannotCastValue(inType.toString(), outType.toString())); } return false; }
Source:
public void removeLocationUpdates(PendingIntent callbackIntent) { intentToRequest.remove(callbackIntent); if (intentToRequest.isEmpty()) { locationEngine.setRequest(null); } }

Target:
public void removeLocationUpdates(PendingIntent callbackIntent) { intentToRequest.remove(callbackIntent); checkAllListenersAndPendingIntents(); }
Source:
public boolean isSecretSocketSupported() { return this.newerThanEquals(SPARK_2_3_1) || (this.newerThanEquals(SparkVersion.fromVersionString("2.2.2")) && this.olderThan(SparkVersion.fromVersionString("2.3.0"))) || (this.newerThanEquals(SparkVersion.fromVersionString("2.1.3")) && this.olderThan(SparkVersion.fromVersionString("2.2.0"))); }

Target:
public boolean isSecretSocketSupported() { return this.newerThanEquals(SparkVersion.SPARK_2_4_0) || this.newerThanEqualsPatchVersion(SPARK_2_3_1) || this.newerThanEqualsPatchVersion(SparkVersion.fromVersionString("2.2.2")) || this.newerThanEqualsPatchVersion(SparkVersion.fromVersionString("2.1.3")); }
Source:
public Map<String, Object> apply(final Map<String, CustomAttribute> intercomCustomAttributes) { if (intercomCustomAttributes == null) { return null; } final Map<String, Object> customAttributes = new HashMap<>(); intercomCustomAttributes.entrySet().stream().forEach(entry -> { final String key = entry.getKey(); final CustomAttribute value = entry.getValue(); if (value == null || value.getValue() == null) { customAttributes.put(key, null); } else if (value.getValueClass().equals(Boolean.class)) { customAttributes.put(key, (new Boolean(value.booleanValue()))); } else if (value.getValueClass().equals(Integer.class)) { customAttributes.put(key, (new Integer(value.integerValue()))); } else if (value.getValueClass().equals(Double.class)) { customAttributes.put(key, (value.doubleValue())); } else if (value.getValueClass().equals(Long.class)) { customAttributes.put(key, (value.longValue())); } else if (value.getValueClass().equals(Float.class)) { customAttributes.put(key, (value.floatValue())); } else if (value.getValueClass().equals(String.class)) { customAttributes.put(key, (value.textValue())); } else { logger.warn("Unsupported custom attribute class : {}", value.getValueClass().getSimpleName()); } }); return customAttributes; }

Target:
public Map<String, Object> apply(final Map<String, CustomAttribute> intercomCustomAttributes) { if (intercomCustomAttributes == null) { return null; } final Map<String, Object> customAttributes = new HashMap<>(); intercomCustomAttributes.entrySet().stream().forEach(entry -> { final String key = entry.getKey(); final CustomAttribute value = entry.getValue(); if (value == null || value.getValue() == null) { customAttributes.put(key, null); } else if (value.getValueClass().equals(Boolean.class)) { customAttributes.put(key, (value.booleanValue())); } else if (value.getValueClass().equals(Integer.class)) { customAttributes.put(key, (value.integerValue())); } else if (value.getValueClass().equals(Double.class)) { customAttributes.put(key, (value.doubleValue())); } else if (value.getValueClass().equals(Long.class)) { customAttributes.put(key, (value.longValue())); } else if (value.getValueClass().equals(Float.class)) { customAttributes.put(key, (value.floatValue())); } else if (value.getValueClass().equals(String.class)) { customAttributes.put(key, (value.textValue())); } else { logger.warn("Unsupported custom attribute class : {}", value.getValueClass().getSimpleName()); } }); return customAttributes; }
Source:
protected synchronized boolean enterClosedState() { if (!state.equals(Closed)) { try { enterState(null, Closed); } catch (IllegalStateException ignored) { } return true; } else { return false; } }

Target:
protected synchronized boolean enterClosedState() { if (!state.equals(Closed)) { enterState(null, Closed); return true; } else { return false; } }
Source:
public HttpRequestBase formatRequest() { URIBuilder uriBuilder = getRepository().getURIBuilder(fAuthIsRequired); URI uri = null; try { String file = URLEncoder.encode(gettargetFile(), "UTF-8"); String path = new StringBuilder(uriBuilder.getPath()).append("/projects/") .append(getProject_Name()) .append("/branches/") .append(getBranch_id()) .append("/files/") .append(gettargetFile()) .append("/content") .toString(); uriBuilder.setPath(path); uri = new URI(URIUtil.toUnencodedString(uriBuilder.build())); } catch (URISyntaxException | UnsupportedEncodingException e) { EGerritCorePlugin.logError("URI syntax exception", e); } return new HttpGet(uri); }

Target:
public HttpRequestBase formatRequest() { URIBuilder uriBuilder = getRepository().getURIBuilder(fAuthIsRequired); URI uri = null; try { String file = URLEncoder.encode(gettargetFile(), "UTF-8"); String project = URLEncoder.encode(getProject_Name(), "UTF-8"); String path = new StringBuilder(uriBuilder.getPath()).append("/projects/") .append(project) .append("/branches/") .append(getBranch_id()) .append("/files/") .append(file) .append("/content") .toString(); uriBuilder.setPath(path); uri = new URI(URIUtil.toUnencodedString(uriBuilder.build())); } catch (URISyntaxException | UnsupportedEncodingException e) { EGerritCorePlugin.logError("URI syntax exception", e); } return new HttpGet(uri); }
Source:
public boolean containsKey(Object key){ return cache.containsKey(key); }

Target:
public boolean containsKey(Object key){ if(cache != null) return cache.containsKey(key); else return false; }
Source:
public void testEquals() { int size1 = 12345; LongObjectId id1 = LongObjectIdTestUtils.hash("test").toObjectId(); LargeObjectPointer pointer1 = new LargeObjectPointer(id1, size1); assertTrue("pointer should equal itself", pointer1.equals(pointer1)); LargeObjectPointer pointer2 = new LargeObjectPointer(id1, size1); assertEquals("objects should be equals", pointer1, pointer2); LongObjectId id2 = LongObjectIdTestUtils.hash("other").toObjectId(); pointer2 = new LargeObjectPointer(id2, size1); assertNotEquals("objects with different id should be not equal", pointer1, pointer2); pointer2 = new LargeObjectPointer(id1, 54321); assertNotEquals("objects with size id should be not equal", pointer1, pointer2); }

Target:
public void testEquals() { int size1 = 12345; LongObjectId id1 = LongObjectIdTestUtils.hash("test").toObjectId(); LargeObjectPointer pointer1 = new LargeObjectPointer(id1, size1); assertTrue("pointer should equal itself", pointer1.equals(pointer1)); LargeObjectPointer pointer2 = new LargeObjectPointer(id1, size1); assertEquals("objects should be equals", pointer1, pointer2); LongObjectId id2 = LongObjectIdTestUtils.hash("other").toObjectId(); pointer2 = new LargeObjectPointer(id2, size1); assertNotEquals("objects with different id should be not equal", pointer1, pointer2); pointer2 = new LargeObjectPointer(id1, 54321); assertNotEquals("objects with different size should be not equal", pointer1, pointer2); }
Source:
public synchronized void resetMemoryRevokingRequested() { MemoryRevokingRequestedFuture<?> currentFuture = memoryRevokingRequestedFuture; if (!currentFuture.isDone()) { return; } memoryRevokingRequestedFuture.setFuture(SettableFuture.create()); }

Target:
public synchronized void resetMemoryRevokingRequested() { memoryRevokingRequested = false; }
Source:
private boolean isGrantedPersonalPermission(Authentication authentication, Permission permission, boolean isCheckAllowedGrant) { UserInfo principal = (UserInfo) authentication.getPrincipal(); JCUser actualUser = userDao.get(principal.getId()); if (actualUser == null) { LOGGER.warn("{} : User #{} not found", this.getClass().getCanonicalName(), principal.getId()); return !isCheckAllowedGrant; } List<Group> groups = actualUser.getGroups(); for (Group group : groups) { ObjectIdentity groupIdentity = aclUtil.createIdentity(group.getId(), "GROUP"); Sid groupSid = sidFactory.create(group); List<AccessControlEntry> groupAces; try { groupAces = ExtendedMutableAcl.castAndCreate( mutableAclService.readAclById(groupIdentity)).getEntries(); } catch (NotFoundException nfe) { groupAces = new ArrayList<>(); } if (isGrantedForSid(groupSid, groupAces, permission, isCheckAllowedGrant)) { return true; } } return false; }

Target:
private boolean isGrantedPersonalPermission(Authentication authentication, Permission permission, boolean isCheckAllowedGrant) { JCUser jcUser = securityService.getFullUserInfoFrom(authentication); if (jcUser == null) return false; List<Group> groups = jcUser.getGroups(); for (Group group : groups) { ObjectIdentity groupIdentity = aclUtil.createIdentity(group.getId(), "GROUP"); Sid groupSid = sidFactory.create(group); List<AccessControlEntry> groupAces; try { groupAces = ExtendedMutableAcl.castAndCreate( mutableAclService.readAclById(groupIdentity)).getEntries(); } catch (NotFoundException nfe) { groupAces = new ArrayList<>(); } if (isGrantedForSid(groupSid, groupAces, permission, isCheckAllowedGrant)) { return true; } } return false; }
Source:
public COREEnvelopeBatchSubmissionResponse batchSubmitTransaction(COREEnvelopeBatchSubmission msg, AssertionType assertion, NhinTargetSystemType targetSystem, NhincConstants.GATEWAY_API_LEVEL apiLevel) { COREEnvelopeBatchSubmissionResponse response; try { String url = proxyHelper.getUrlFromTargetSystemByGatewayAPILevel(targetSystem, getServiceName(), apiLevel); if (url != null && !url.isEmpty()) { X12LargePayloadUtils.convertFileLocationToDataIfEnabled(msg); ServicePortDescriptor<GenericBatchTransactionPort> portDescriptor = new COREGenericBatchServicePortDescriptor(); CONNECTClient<GenericBatchTransactionPort> client = getCONNECTClientSecured(portDescriptor, assertion, url, targetSystem, getServiceName()); client.enableMtom(); response = (COREEnvelopeBatchSubmissionResponse) client.invokePort(GenericBatchTransactionPort.class, "batchSubmitTransaction", msg); if (response != null && response.getPayload() != null) { X12LargePayloadUtils.convertDataToFileLocationIfEnabled(response); } } else { String targetHCID = null; if (targetSystem != null && targetSystem.getHomeCommunity() != null && targetSystem.getHomeCommunity().getHomeCommunityId() != null) { targetHCID = targetSystem.getHomeCommunity().getHomeCommunityId(); } return X12EntityExceptionBuilder.getInstance().createErrorResponse(msg, targetHCID); } } catch (Exception ex) { LOG.error("Error calling batchSubmitTransaction: {}", ex.getLocalizedMessage(), ex); return X12EntityExceptionBuilder.getInstance().createWebServiceErrorResponse(msg, ex.getMessage()); } finally { X12LargePayloadUtils.releaseFileLock(msg); } return response; }

Target:
public COREEnvelopeBatchSubmissionResponse batchSubmitTransaction(COREEnvelopeBatchSubmission msg, AssertionType assertion, NhinTargetSystemType targetSystem, NhincConstants.GATEWAY_API_LEVEL apiLevel) { COREEnvelopeBatchSubmissionResponse response; try { String url = proxyHelper.getUrlFromTargetSystemByGatewayAPILevel(targetSystem, getServiceName(), apiLevel); if (url != null && !url.isEmpty()) { X12LargePayloadUtils.convertFileLocationToDataIfEnabled(msg); ServicePortDescriptor<GenericBatchTransactionPort> portDescriptor = new COREGenericBatchServicePortDescriptor(); CONNECTClient<GenericBatchTransactionPort> client = getCONNECTClientSecured(portDescriptor, assertion, url, targetSystem, getServiceName()); client.enableMtom(); response = (COREEnvelopeBatchSubmissionResponse) client.invokePort(GenericBatchTransactionPort.class, "batchSubmitTransaction", msg); if (response != null && response.getPayload() != null) { X12LargePayloadUtils.convertDataToFileLocationIfEnabled(response); } } else { String targetHCID = HomeCommunityMap.getCommunityIdFromTargetSystem(targetSystem); return X12EntityExceptionBuilder.getInstance().createErrorResponse(msg, targetHCID); } } catch (Exception ex) { LOG.error("Error calling batchSubmitTransaction: {}", ex.getLocalizedMessage(), ex); return X12EntityExceptionBuilder.getInstance().createWebServiceErrorResponse(msg, ex.getMessage()); } finally { X12LargePayloadUtils.releaseFileLock(msg); } return response; }
Source:
public MailConfig(JsonObject config) { hostname = config.getString("hostname", DEFAULT_HOST); port = config.getInteger("port", DEFAULT_PORT); String starttlsOption = config.getString("starttls"); if (starttlsOption != null) { starttls = StarttlsOption.valueOf(starttlsOption.toUpperCase(Locale.ENGLISH)); } String loginOption = config.getString("login"); if (loginOption != null) { login = LoginOption.valueOf(loginOption.toUpperCase(Locale.ENGLISH)); } username = config.getString("username"); password = config.getString("password"); Boolean sslOption = config.getBoolean("ssl"); if (sslOption != null) { ssl = sslOption; } }

Target:
public MailConfig(JsonObject config) { hostname = config.getString("hostname", DEFAULT_HOST); port = config.getInteger("port", DEFAULT_PORT); String starttlsOption = config.getString("starttls"); if (starttlsOption != null) { starttls = StarttlsOption.valueOf(starttlsOption.toUpperCase(Locale.ENGLISH)); } String loginOption = config.getString("login"); if (loginOption != null) { login = LoginOption.valueOf(loginOption.toUpperCase(Locale.ENGLISH)); } username = config.getString("username"); password = config.getString("password"); ssl = config.getBoolean("ssl", false); }
Source:
private void sendGarbage() { GarbageBatch garbageBatch = null; try { while ((garbageBatch = garbageSendingDeque.poll()) != null) { garbageBatch.sendToLogUnits(); } } catch (Exception e) { log.error("Caught exception in the write processor.", e); if (garbageBatch != null) { garbageSendingDeque.addFirst(garbageBatch); } } }

Target:
private void sendGarbage() { GarbageBatch garbageBatch = null; try { while ((garbageBatch = garbageSendingDeque.poll()) != null) { sendGarbageBatch(garbageBatch); } } catch (Exception e) { log.error("GarbageInformer: Caught exception in the write processor.", e); if (garbageBatch != null) { garbageSendingDeque.addFirst(garbageBatch); } } }
Source:
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, LivingEntity entityLiving) { Random rand = new Random(); int num = rand.nextInt(10); ItemStack crumbs = new ItemStack(MSItems.BREADCRUMBS, num); if(entityLiving instanceof PlayerEntity && !entityLiving.world.isRemote) { PlayerEntity entityplayer = (PlayerEntity)entityLiving; entityplayer.addItemStackToInventory(crumbs); } return super.onItemUseFinish(stack, worldIn, entityLiving); }

Target:
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, LivingEntity entityLiving) { if(entityLiving instanceof PlayerEntity && !entityLiving.world.isRemote) { Random rand = new Random(); int num = rand.nextInt(10); ItemStack crumbs = new ItemStack(MSItems.BREADCRUMBS, num); PlayerEntity entityplayer = (PlayerEntity)entityLiving; entityplayer.addItemStackToInventory(crumbs); } return super.onItemUseFinish(stack, worldIn, entityLiving); }
Source:
static String getBackupFilenameFromStat(Stat stat) { long mtime = stat.getMtime(); String timestamp = LocalDateTime.ofEpochSecond(mtime / 1000, 0, zoneOffset).format(TIMESTAMP_FORMATTER); String fileName = stat.getVersion() + SEP + timestamp; return fileName; }

Target:
static String getBackupFilenameFromStat(Stat stat) { long mtimeInMs = stat.getMtime(); String timestamp = LocalDateTime.ofEpochSecond(mtimeInMs / 1000, 0, zoneOffset).format(TIMESTAMP_FORMATTER); return stat.getVersion() + SEP + timestamp; }
Source:
private void createProblemAttributes(Composite parent) { new Label(parent, SWT.NONE).setText(MarkerMessages.propertiesDialog_severityLabel); Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginWidth = 0; layout.marginHeight = 0; composite.setLayout(layout); Label severityImage = new Label(composite, SWT.NONE); severityImage.setImage(Util.getImage(marker.getAttribute(IMarker.SEVERITY, -1))); Text severityLabel = new Text(composite, SWT.NONE); severityLabel.setBackground(severityLabel.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); int severity = marker.getAttribute(IMarker.SEVERITY, -1); if (severity == IMarker.SEVERITY_ERROR) { severityLabel.setText(MarkerMessages.propertiesDialog_errorLabel); } else if (severity == IMarker.SEVERITY_WARNING) { severityLabel.setText(MarkerMessages.propertiesDialog_warningLabel); } else if (severity == IMarker.SEVERITY_INFO) { severityLabel.setText(MarkerMessages.propertiesDialog_infoLabel); } else { severityLabel.setText(MarkerMessages.propertiesDialog_noseverityLabel); } }

Target:
private void createProblemAttributes(Composite parent) { new Label(parent, SWT.NONE).setText(MarkerMessages.propertiesDialog_severityLabel); Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginWidth = 0; layout.marginHeight = 0; composite.setLayout(layout); Label severityImage = new Label(composite, SWT.NONE); severityImage.setImage(Util.getImage(marker.getAttribute(IMarker.SEVERITY, -1))); Text severityLabel = createReadOnlyText(composite); int severity = marker.getAttribute(IMarker.SEVERITY, -1); if (severity == IMarker.SEVERITY_ERROR) { severityLabel.setText(MarkerMessages.propertiesDialog_errorLabel); } else if (severity == IMarker.SEVERITY_WARNING) { severityLabel.setText(MarkerMessages.propertiesDialog_warningLabel); } else if (severity == IMarker.SEVERITY_INFO) { severityLabel.setText(MarkerMessages.propertiesDialog_infoLabel); } else { severityLabel.setText(MarkerMessages.propertiesDialog_noseverityLabel); } }
Source:
public User permanentlyDeleteUser(User user) { checkHasId(user); deleteUser(user.getId()); return permanentlyDeleteUser(user.getId()); }

Target:
public User permanentlyDeleteUser(User user) { checkHasId(user); return permanentlyDeleteUser(user.getId()); }
Source:
public int getStreams() { return streams; }

Target:
public Integer getStreams() { return streams; }
Source:
public final void read() throws IOException { final SocketChannel channel = (SocketChannel)key.channel(); final ByteBuffer buffer = buffer(); final int read = channel.read(buffer); if (read > 0) { this.read(read); } else if (read == -1) { try { channel.close(); } finally { disconnected(); unregistered(key); } } else if (buffer.remaining() > 0) { logger.error("{} read bytes into byte buffer {}", this, read, buffer); } else { suspendReadIfResumed(); } }

Target:
public final void read() throws IOException { final SocketChannel channel = (SocketChannel)key.channel(); final ByteBuffer buffer = buffer(); final int read = channel.read(buffer); if (read > 0) { this.read(read); } else if (read == -1) { try { channel.close(); } finally { disconnected(); unregistered(key); } } else { if (buffer.remaining() > 0) { logger.error("{} read bytes into byte buffer {}", this, read, buffer); } else { suspendReadIfResumed(); } } }
Source:
private MapBlock( int startOffset, int positionCount, @Nullable boolean[] mapIsNull, int[] offsets, Block keyBlock, Block valueBlock, @Nullable int[] hashTables, Type keyType, MethodHandle keyBlockNativeEquals, MethodHandle keyNativeHashCode, MethodHandle keyBlockHashCode) { super(keyType, keyNativeHashCode, keyBlockNativeEquals, keyBlockHashCode); if (hashTables != null && hashTables.length < keyBlock.getPositionCount() * HASH_MULTIPLIER) { throw new IllegalArgumentException(format("keyBlock/valueBlock size does not match hash table size: %s %s", keyBlock.getPositionCount(), hashTables.length)); } this.startOffset = startOffset; this.positionCount = positionCount; this.mapIsNull = mapIsNull; this.offsets = offsets; this.keyBlock = keyBlock; this.valueBlock = valueBlock; this.hashTables = hashTables; this.sizeInBytes = -1; this.retainedSizeInBytes = INSTANCE_SIZE + keyBlock.getRetainedSizeInBytes() + valueBlock.getRetainedSizeInBytes() + sizeOf(offsets) + sizeOf(mapIsNull) + sizeOfIntArray(offsets[positionCount] * HASH_MULTIPLIER); }

Target:
private MapBlock( int startOffset, int positionCount, @Nullable boolean[] mapIsNull, int[] offsets, Block keyBlock, Block valueBlock, @Nullable int[] hashTables, Type keyType, MethodHandle keyBlockNativeEquals, MethodHandle keyNativeHashCode, MethodHandle keyBlockHashCode) { super(keyType, keyNativeHashCode, keyBlockNativeEquals, keyBlockHashCode); if (hashTables != null && hashTables.length < keyBlock.getPositionCount() * HASH_MULTIPLIER) { throw new IllegalArgumentException(format("keyBlock/valueBlock size does not match hash table size: %s %s", keyBlock.getPositionCount(), hashTables.length)); } this.startOffset = startOffset; this.positionCount = positionCount; this.mapIsNull = mapIsNull; this.offsets = offsets; this.keyBlock = keyBlock; this.valueBlock = valueBlock; this.hashTables = hashTables; this.sizeInBytes = -1; this.retainedSizeInBytes = INSTANCE_SIZE + keyBlock.getRetainedSizeInBytes() + valueBlock.getRetainedSizeInBytes() + sizeOf(offsets) + sizeOf(mapIsNull) + sizeOfIntArray(keyBlock.getPositionCount() * HASH_MULTIPLIER); }
Source:
boolean displayVersion(CommandSender sender) { final PluginManager pm = Bukkit.getServer().getPluginManager(); List<String> hooks = plugin.getDescription().getSoftDepend(); String tardisversion = plugin.getPM().getPlugin("TARDIS").getDescription().getVersion(); String chunkversion = plugin.getPM().getPlugin("TARDISChunkGenerator").getDescription().getVersion(); String cb = Bukkit.getVersion(); String bv = Bukkit.getBukkitVersion(); sender.sendMessage(plugin.getPluginName() + "Server version: " + ChatColor.AQUA + bv + " " + cb); sender.sendMessage(plugin.getPluginName() + "TARDIS version: " + ChatColor.AQUA + tardisversion); sender.sendMessage(plugin.getPluginName() + "TARDISChunkGenerator version: " + ChatColor.AQUA + chunkversion); for (Plugin hook : pm.getPlugins()) { final PluginDescriptionFile desc = hook.getDescription(); String name = desc.getName(); String version = desc.getVersion(); if(hooks.contains(name) && !name.equals("TARDISChunkGenerator")) { sender.sendMessage(plugin.getPluginName() + name + " version: " + ChatColor.AQUA + version); } } return true; }

Target:
boolean displayVersion(CommandSender sender) { String pluginName = plugin.getPluginName(); List<String> hooks = plugin.getDescription().getSoftDepend(); String tardisversion = plugin.getDescription().getVersion(); String chunkversion = plugin.getPM().getPlugin("TARDISChunkGenerator").getDescription().getVersion(); String cb = Bukkit.getVersion(); String bv = Bukkit.getBukkitVersion(); sender.sendMessage(pluginName + "Server version: " + ChatColor.AQUA + bv + " " + cb); sender.sendMessage(pluginName + "TARDIS version: " + ChatColor.AQUA + tardisversion); sender.sendMessage(pluginName + "TARDISChunkGenerator version: " + ChatColor.AQUA + chunkversion); for (Plugin hook : plugin.getPM().getPlugins()) { PluginDescriptionFile desc = hook.getDescription(); String name = desc.getName(); String version = desc.getVersion(); if(hooks.contains(name)) { sender.sendMessage(pluginName + name + " version: " + ChatColor.AQUA + version); } } return true; }
Source:
private void handleVmDeviceChange() { List<String> vmsToUpdate = new ArrayList<String>(); for (java.util.Map.Entry<VmDynamic, VmStatistics> vm_helper : _runningVms.values()) { VmDynamic vm = vm_helper.getKey(); String dbHash = _vmDict.get(vm.getId()).getHash(); if ((dbHash == null && vm.getHash() != null) || !dbHash.equals(vm.getHash())) { vmsToUpdate.add(vm.getId().toString()); vm.setHash(vm.getHash()); AddVmDynamicToList(vm); } } if (vmsToUpdate.size() > 0) { updateVmDevices(vmsToUpdate); } }

Target:
private void handleVmDeviceChange() { List<String> vmsToUpdate = new ArrayList<String>(); for (Map.Entry<VmDynamic, VmStatistics> vmHelper : _runningVms.values()) { VmDynamic vmDynamic = vmHelper.getKey(); if (vmDynamic != null) { VM vm = _vmDict.get(vmDynamic.getId()); if (vm != null) { String dbHash = vm.getHash(); if ((dbHash == null && vmDynamic.getHash() != null) || !dbHash.equals(vmDynamic.getHash())) { vmsToUpdate.add(vmDynamic.getId().toString()); if (_vmDynamicToSave.containsKey(vm.getId())) { _vmDynamicToSave.get(vm.getId()).setHash(vmDynamic.getHash()); } else { vmDynamic.setHash(vmDynamic.getHash()); AddVmDynamicToList(vmDynamic); } } } } } if (vmsToUpdate.size() > 0) { updateVmDevices(vmsToUpdate); } }
Source:
public List<NodeTopologyEntity> getNodeTopologyEntities() { final OnmsCriteria criteria = new OnmsCriteria(OnmsNode.class); criteria.createAlias("ipInterfaces","iface", OnmsCriteria.LEFT_JOIN); criteria.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY); criteria.resultsOfType(OnmsNode.class); final HibernateCallback<List<OnmsNode>> callback = new HibernateCallback<List<OnmsNode>>() { @Override public List<OnmsNode> doInHibernate(final Session session) throws HibernateException, SQLException { final Criteria attachedCrit = criteria.getDetachedCriteria().getExecutableCriteria(session); if (criteria.getFirstResult() != null) attachedCrit.setFirstResult(criteria.getFirstResult()); if (criteria.getMaxResults() != null) attachedCrit.setMaxResults(criteria.getMaxResults()); return (List<OnmsNode>)attachedCrit.list(); } }; return getHibernateTemplate().execute(callback).stream().map(NodeTopologyEntity::create).collect(Collectors.toList()); }

Target:
public List<NodeTopologyEntity> getNodeTopologyEntities() { return (List<NodeTopologyEntity>)getHibernateTemplate().find( "select new org.opennms.netmgt.enlinkd.model.NodeTopologyEntity(n.id, n.type, n.sysObjectId, n.label, n.location) from org.opennms.netmgt.model.OnmsNode n"); }
Source:
private Map<TopicPartition, Long> checkpointableOffsets() { if (state() == State.RESTORING) { return Collections.emptyMap(); } final Map<TopicPartition, Long> checkpointableOffsets = new HashMap<>(recordCollector.offsets()); for (final Map.Entry<TopicPartition, Long> entry : consumedOffsets.entrySet()) { checkpointableOffsets.putIfAbsent(entry.getKey(), entry.getValue()); } return checkpointableOffsets; }

Target:
private Map<TopicPartition, Long> checkpointableOffsets() { final Map<TopicPartition, Long> checkpointableOffsets = new HashMap<>(recordCollector.offsets()); for (final Map.Entry<TopicPartition, Long> entry : consumedOffsets.entrySet()) { checkpointableOffsets.putIfAbsent(entry.getKey(), entry.getValue()); } return checkpointableOffsets; }
Source:
public FormValidation doSendTestMail( @QueryParameter String smtpHost, @QueryParameter String adminAddress, @QueryParameter boolean authentication, @QueryParameter String username, @QueryParameter Secret password, @QueryParameter boolean useSsl, @QueryParameter boolean useTls, @QueryParameter String smtpPort, @QueryParameter String charset, @QueryParameter String sendTestMailTo) throws IOException { try { Jenkins.get().checkPermission(Jenkins.ADMINISTER); if (!authentication) { username = null; password = null; } MimeMessage msg = new MimeMessage(createSession(smtpHost, smtpPort, useSsl, useTls, username, password)); msg.setSubject(Messages.Mailer_TestMail_Subject(testEmailCount.incrementAndGet()), charset); msg.setText(Messages.Mailer_TestMail_Content(testEmailCount.get(), Jenkins.get().getDisplayName()), charset); msg.setFrom(stringToAddress(adminAddress, charset)); if (StringUtils.isNotBlank(replyToAddress)) { msg.setReplyTo(new Address[]{stringToAddress(replyToAddress, charset)}); } msg.setSentDate(new Date()); msg.setRecipient(Message.RecipientType.TO, stringToAddress(sendTestMailTo, charset)); Transport.send(msg); return FormValidation.ok(Messages.Mailer_EmailSentSuccessfully()); } catch (MessagingException e) { return FormValidation.errorWithMarkup("<p>"+Messages.Mailer_FailedToSendEmail()+"</p><pre>"+Util.escape(Functions.printThrowable(e))+"</pre>"); } }

Target:
public FormValidation doSendTestMail( @QueryParameter String smtpHost, @QueryParameter String adminAddress, @QueryParameter boolean authentication, @QueryParameter String username, @QueryParameter Secret password, @QueryParameter boolean useSsl, @QueryParameter boolean useTls, @QueryParameter String smtpPort, @QueryParameter String charset, @QueryParameter String sendTestMailTo) throws IOException { try { Jenkins.get().checkPermission(DescriptorImpl.getJenkinsManageOrAdmin()); if (!authentication) { username = null; password = null; } MimeMessage msg = new MimeMessage(createSession(smtpHost, smtpPort, useSsl, useTls, username, password)); msg.setSubject(Messages.Mailer_TestMail_Subject(testEmailCount.incrementAndGet()), charset); msg.setText(Messages.Mailer_TestMail_Content(testEmailCount.get(), Jenkins.get().getDisplayName()), charset); msg.setFrom(stringToAddress(adminAddress, charset)); if (StringUtils.isNotBlank(replyToAddress)) { msg.setReplyTo(new Address[]{stringToAddress(replyToAddress, charset)}); } msg.setSentDate(new Date()); msg.setRecipient(Message.RecipientType.TO, stringToAddress(sendTestMailTo, charset)); Transport.send(msg); return FormValidation.ok(Messages.Mailer_EmailSentSuccessfully()); } catch (MessagingException e) { return FormValidation.errorWithMarkup("<p>"+Messages.Mailer_FailedToSendEmail()+"</p><pre>"+Util.escape(Functions.printThrowable(e))+"</pre>"); } }
Source:
public TelephonePaymentResponse create(CreateTelephonePaymentRequest createTelephonePaymentRequest){ Supplemental supplemental = createTelephonePaymentRequest.getPaymentOutcome().getSupplemental() .map(s -> new Supplemental( s.getErrorCode(), s.getErrorMessage() )).orElse(null); PaymentOutcome paymentOutcome = new PaymentOutcome( createTelephonePaymentRequest.getPaymentOutcome().getStatus(), createTelephonePaymentRequest.getPaymentOutcome().getCode(), supplemental ); State state = new State( "Success", true, "Hello, world!", "P0010" ); TelephonePaymentResponse telephonePaymentResponse = new TelephonePaymentResponse( createTelephonePaymentRequest.getAmount(), createTelephonePaymentRequest.getReference(), createTelephonePaymentRequest.getDescription(), createTelephonePaymentRequest.getCreatedDate(), createTelephonePaymentRequest.getAuthorisedDate(), createTelephonePaymentRequest.getProcessorId(), createTelephonePaymentRequest.getProviderId(), createTelephonePaymentRequest.getAuthCode(), paymentOutcome, createTelephonePaymentRequest.getCardType(), createTelephonePaymentRequest.getNameOnCard(), createTelephonePaymentRequest.getEmailAddress(), createTelephonePaymentRequest.getCardExpiry(), createTelephonePaymentRequest.getLastFourDigits(), createTelephonePaymentRequest.getFirstSixDigits(), createTelephonePaymentRequest.getTelephoneNumber(), "DUMMY API - RECORD NOT PERSISTED", state ); return telephonePaymentResponse; }

Target:
public TelephonePaymentResponse create(CreateTelephonePaymentRequest createTelephonePaymentRequest){ State state = new State( "success", true, "Created", "P0010" ); return new TelephonePaymentResponse( createTelephonePaymentRequest.getAmount(), createTelephonePaymentRequest.getReference(), createTelephonePaymentRequest.getDescription(), createTelephonePaymentRequest.getCreatedDate(), createTelephonePaymentRequest.getAuthorisedDate(), createTelephonePaymentRequest.getProcessorId(), createTelephonePaymentRequest.getProviderId(), createTelephonePaymentRequest.getAuthCode(), createTelephonePaymentRequest.getPaymentOutcome(), createTelephonePaymentRequest.getCardType(), createTelephonePaymentRequest.getNameOnCard(), createTelephonePaymentRequest.getEmailAddress(), createTelephonePaymentRequest.getCardExpiry(), createTelephonePaymentRequest.getLastFourDigits(), createTelephonePaymentRequest.getFirstSixDigits(), createTelephonePaymentRequest.getTelephoneNumber(), "DUMMY API - RECORD NOT PERSISTED", state ); }
Source:
public void testGetPercentage() { assertEquals(99,Ratio.create(249,250).getPercentage()); }

Target:
public void testGetPercentage() { assertEquals(98, Ratio.create(246, 250).getPercentage()); assertEquals(99, Ratio.create(247, 250).getPercentage()); assertEquals(99, Ratio.create(248, 250).getPercentage()); assertEquals(99, Ratio.create(249, 250).getPercentage()); assertEquals(100, Ratio.create(250, 250).getPercentage()); }
Source:
private void init() { hostedEngineVm = dbFacade.getVmDao().get(dbFacade.getVmStaticDao().getAllByName("HostedEngine").get(0).getId()); VmHandler.updateDisksFromDb(hostedEngineVm); sd = dbFacade.getStorageDomainStaticDao() .getByName(Config.<String>getValue(ConfigValues.HostedEngineStorageDomainName)); sdConnection = dbFacade.getStorageServerConnectionDao() .getAllForDomain(getStorageDomainStatic().getId()) .get(0); }

Target:
private void init() { VmStatic vmStatic = dbFacade.getVmStaticDao().getAllByName( Config.<String>getValue(ConfigValues.HostedEngineVmName)).get(0); if (vmStatic != null) { hostedEngineVm = dbFacade.getVmDao().get(vmStatic.getId()); VmHandler.updateDisksFromDb(hostedEngineVm); sd = dbFacade.getStorageDomainStaticDao().getByName( Config.<String>getValue(ConfigValues.HostedEngineStorageDomainName)); if (sd != null) { sdConnection = dbFacade.getStorageServerConnectionDao() .getAllForDomain(getStorageDomainStatic().getId()).get(0); } } }
Source:
public Set<Descriptor> getIndexDescriptors() { Set<SchemaIndexProvider.Descriptor> fromProviders = new HashSet<>(); for ( IndexProxy indexProxy : indexMapRef.getAllIndexProxies() ) { Descriptor providerDescriptor = indexProxy.getProviderDescriptor(); fromProviders.add( providerDescriptor ); } return fromProviders; }

Target:
public Set<IndexDescriptor> getIndexDescriptors() { Set<IndexDescriptor> indexDescriptors = new HashSet<>(); for ( IndexProxy indexProxy : indexMapRef.getAllIndexProxies() ) { indexDescriptors.add( indexProxy.getDescriptor() ); } return indexDescriptors; }