auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onAccountChanged(OnAccountChanged event) { if (mAccountStore.hasAccessToken()) { mBottomNav.showNoteBadge(mAccountStore.getAccount().getHasUnseenNotes()); if (AppPrefs.getShouldTrackMagicLinkSignup()) { AccountModel account = mAccountStore.getAccount(); if (!TextUtils.isEmpty(account.getUserName()) && !TextUtils.isEmpty(account.getEmail())) { mLoginAnalyticsListener.trackCreatedAccount(account.getUserName(), account.getEmail()); mLoginAnalyticsListener.trackSignupMagicLinkSucceeded(); AppPrefs.removeShouldTrackMagicLinkSignup(); } } } }

Target:
public void onAccountChanged(OnAccountChanged event) { if (mAccountStore.hasAccessToken()) { mBottomNav.showNoteBadge(mAccountStore.getAccount().getHasUnseenNotes()); if (AppPrefs.getShouldTrackMagicLinkSignup()) { trackMagicLinkSignupIfNeeded(); } } }
Source:
public static Map<String, Object> createVmMemoryDeviceMap(VmDevice vmDevice) { Map<String, Object> memDeviceData = new HashMap<>(); memDeviceData.put(VdsProperties.Type, vmDevice.getType().getValue()); memDeviceData.put(VdsProperties.Device, vmDevice.getDevice()); if (StringUtils.isNotBlank(vmDevice.getAddress())) { memDeviceData.put(VdsProperties.Address, StringMapUtils.string2Map(vmDevice.getAddress())); } memDeviceData.put(VdsProperties.SpecParams, vmDevice.getSpecParams()); memDeviceData.put(VdsProperties.DeviceId, vmDevice.getId().getDeviceId().toString()); if (!vmDevice.getAlias().equals("")) { memDeviceData.put(VdsProperties.Alias, vmDevice.getAlias()); } memDeviceData.put("size", VmDeviceCommonUtils.getSizeOfMemoryDeviceMb(vmDevice).orElse(0)); memDeviceData.put("node", VmDeviceCommonUtils.getSpecParamsIntValue(vmDevice, VmDeviceCommonUtils.SPEC_PARAM_NODE) .orElse(0)); return memDeviceData; }

Target:
public static Map<String, Object> createVmMemoryDeviceMap(VmDevice vmDevice) { Map<String, Object> memDeviceData = new HashMap<>(); memDeviceData.put(VdsProperties.Type, vmDevice.getType().getValue()); memDeviceData.put(VdsProperties.Device, vmDevice.getDevice()); if (StringUtils.isNotBlank(vmDevice.getAddress())) { memDeviceData.put(VdsProperties.Address, StringMapUtils.string2Map(vmDevice.getAddress())); } memDeviceData.put(VdsProperties.SpecParams, vmDevice.getSpecParams()); memDeviceData.put(VdsProperties.DeviceId, vmDevice.getId().getDeviceId().toString()); if (!vmDevice.getAlias().isEmpty()) { memDeviceData.put(VdsProperties.Alias, vmDevice.getAlias()); } memDeviceData.put("size", VmDeviceCommonUtils.getSizeOfMemoryDeviceMb(vmDevice).orElse(0)); memDeviceData.put("node", VmDeviceCommonUtils.getSpecParamsIntValue(vmDevice, VmDeviceCommonUtils.SPEC_PARAM_NODE) .orElse(0)); return memDeviceData; }
Source:
public final ImageSegmentImpl parse(final NitfReader nitfReader, final ParseStrategy parseStrategy, final long dataLength) throws NitfFormatException { reader = nitfReader; segment = new ImageSegmentImpl(); segment.setDataLength(dataLength); parsingStrategy = parseStrategy; segment.setFileType(nitfReader.getFileType()); readIM(); readIID1(); readIDATIM(); readTGTID(); readIID2(); segment.setSecurityMetadata(new SecurityMetadataParser().parseSecurityMetadata(reader)); readENCRYP(); readISORCE(); readNROWS(); readNCOLS(); readPVTYPE(); readIREP(); readICAT(); readABPP(); readPJUST(); readICORDS(); if ((segment.getImageCoordinatesRepresentation() != ImageCoordinatesRepresentation.UNKNOWN) && (segment.getImageCoordinatesRepresentation() != ImageCoordinatesRepresentation.NONE)) { readIGEOLO(); } readNICOM(); for (int i = 0; i < numImageComments; ++i) { segment.addImageComment(reader.readTrimmedBytes(ICOM_LENGTH)); } readIC(); if (segment.hasCOMRAT()) { readCOMRAT(); } readNBANDS(); if ((reader.getFileType() != FileType.NITF_TWO_ZERO) && (numBands == 0)) { readXBANDS(); } for (int i = 0; i < numBands; ++i) { ImageBandImpl imageBand = new ImageBandImpl(); new ImageBandParser(reader, imageBand); segment.addImageBand(imageBand); } readISYNC(); readIMODE(); readNBPR(); readNBPC(); readNPPBH(); readNPPBV(); readNBPP(); readIDLVL(); readIALVL(); readILOC(); readIMAG(); readUDIDL(); if (userDefinedImageDataLength > 0) { readUDOFL(); readUDID(); } readIXSHDL(); if (imageExtendedSubheaderDataLength > 0) { readIXSOFL(); readIXSHD(); } return segment; }

Target:
public final ImageSegment parse(final NitfReader nitfReader, final ParseStrategy parseStrategy, final long dataLength) throws NitfFormatException { reader = nitfReader; segment = new ImageSegmentImpl(); segment.setDataLength(dataLength); parsingStrategy = parseStrategy; segment.setFileType(nitfReader.getFileType()); readIM(); readIID1(); readIDATIM(); readTGTID(); readIID2(); segment.setSecurityMetadata(new SecurityMetadataParser().parseSecurityMetadata(reader)); readENCRYP(); readISORCE(); readNROWS(); readNCOLS(); readPVTYPE(); readIREP(); readICAT(); readABPP(); readPJUST(); readICORDS(); if ((segment.getImageCoordinatesRepresentation() != ImageCoordinatesRepresentation.UNKNOWN) && (segment.getImageCoordinatesRepresentation() != ImageCoordinatesRepresentation.NONE)) { readIGEOLO(); } readNICOM(); for (int i = 0; i < numImageComments; ++i) { segment.addImageComment(reader.readTrimmedBytes(ICOM_LENGTH)); } readIC(); if (segment.hasCOMRAT()) { readCOMRAT(); } readNBANDS(); if ((reader.getFileType() != FileType.NITF_TWO_ZERO) && (numBands == 0)) { readXBANDS(); } for (int i = 0; i < numBands; ++i) { ImageBandImpl imageBand = new ImageBandImpl(); new ImageBandParser(reader, imageBand); segment.addImageBand(imageBand); } readISYNC(); readIMODE(); readNBPR(); readNBPC(); readNPPBH(); readNPPBV(); readNBPP(); readIDLVL(); readIALVL(); readILOC(); readIMAG(); readUDIDL(); if (userDefinedImageDataLength > 0) { readUDOFL(); readUDID(); } readIXSHDL(); if (imageExtendedSubheaderDataLength > 0) { readIXSOFL(); readIXSHD(); } return segment; }
Source:
public void testPreserveContentTypeHeader() throws Exception { String proxyServiceUrl = getProxyServiceURLHttp("PreserveContentTypeHeaderCharSetTest"); String requestPayload = "<soapenv:Envelope xmlns:soapenv=\"<LINK_0>\">\n" + " <soapenv:Header/>\n" + " <soapenv:Body>\n" + " <p:getSimpleQuote xmlns:p=\"http://services.samples\">\n" + " <xs:symbol xmlns:xs=\"http://services.samples\">IBM</xs:symbol>\n" + " </p:getSimpleQuote>\n" + " </soapenv:Body>\n" + "</soapenv:Envelope>"; Map<String, String> headers = new HashMap<String, String>(); headers.put("SOAPAction", "urn:mediate"); headers.put("Content-type", "text/xml;charset=UTF-8"); HttpRequestUtil.doPost(new URL(proxyServiceUrl), requestPayload, headers); String wireResponse = wireMonitorServer.getCapturedMessage(); String[] wireResponseList = wireResponse.split(System.lineSeparator()); Assert.assertTrue(wireResponse.contains("Content-Type")); boolean isCharSetPreserved = false; for (String line : wireResponseList) { if (line.contains("Content-Type")) { if (line.contains("text/xml; charset=UTF-8")) { isCharSetPreserved = true; } } } Assert.assertTrue(isCharSetPreserved, "Charset has been dropped from Content-Type header"); }

Target:
public void testPreserveContentTypeHeader() throws Exception { String proxyServiceUrl = getProxyServiceURLHttp("PreserveContentTypeHeaderCharSetTest"); String requestPayload = "<soapenv:Envelope xmlns:soapenv=\"<LINK_0>\">\n" + " <soapenv:Header/>\n" + " <soapenv:Body>\n" + " <p:getSimpleQuote xmlns:p=\"http://services.samples\">\n" + " <xs:symbol xmlns:xs=\"http://services.samples\">IBM</xs:symbol>\n" + " </p:getSimpleQuote>\n" + " </soapenv:Body>\n" + "</soapenv:Envelope>"; Map<String, String> headers = new HashMap<String, String>(); headers.put("SOAPAction", "urn:mediate"); headers.put("Content-type", "text/xml;charset=UTF-8"); HttpRequestUtil.doPost(new URL(proxyServiceUrl), requestPayload, headers); String wireResponse = wireMonitorServer.getCapturedMessage(); String[] wireResponseList = wireResponse.split(System.lineSeparator()); Assert.assertTrue(wireResponse.contains("Content-Type"), "Request to the backend doesn't contain Content-Type header"); boolean isCharSetPreserved = false; for (String line : wireResponseList) { if (line.contains("Content-Type")) { if (line.contains("text/xml; charset=UTF-8")) { isCharSetPreserved = true; } } } Assert.assertTrue(isCharSetPreserved, "Charset has been dropped from Content-Type header"); }
Source:
public long getAgedQueuedFlowSize() { logger.error("Unsupported Function: getQueuedFlowSize() - Retrieving of Aged flows that are " + "waiting in queue"); return 0; }

Target:
public long getAgedQueuedFlowSize() { logger.error("Unsupported Function: getAgedQueuedFlowSize() - Retrieving of Aged flows that are" + " waiting in queue"); return 0; }
Source:
public boolean nextKeyValue() throws IOException, InterruptedException { if (currentRecordReader == null) { if (recordReaders.isEmpty()) { return false; } currentRecordReader = recordReaders.remove().createRecordReader(); } while (!currentRecordReader.nextKeyValue()) { if (currentRecordReader != null) { currentRecordReader.close(); } if (recordReaders.isEmpty()) { currentRecordReader = null; return false; } currentRecordReader = recordReaders.remove().createRecordReader(); currentRecordReaderIndex++; setKeyValue(key, value); } return true; }

Target:
public boolean nextKeyValue() throws IOException, InterruptedException { while (true) { if (currentRecordReader == null && recordReaders.isEmpty()) { return false; } else if (currentRecordReader != null) { if (currentRecordReader.nextKeyValue()) { return true; } currentRecordReader.close(); currentRecordReader = null; } if (recordReaders.isEmpty()) { return false; } currentRecordReader = recordReaders.remove().createRecordReader(); currentRecordReaderIndex++; setKeyValue(key, value); } }
Source:
public Task<AuthResult> then(@NonNull Task<AuthResult> task) throws Exception { mAuthResult = task.getResult(); FirebaseUser firebaseUser = mAuthResult.getUser(); String name = firebaseUser.getDisplayName(); Uri photoUri = firebaseUser.getPhotoUrl(); if (!TextUtils.isEmpty(name) && photoUri != null) { return Tasks.forResult(mAuthResult); } User user = mIdpResponse.getUser(); if (TextUtils.isEmpty(name)) { name = user.getName(); } if (photoUri == null) { photoUri = user.getPhotoUri(); } firebaseUser.updateProfile( new UserProfileChangeRequest.Builder() .setDisplayName(name) .setPhotoUri(photoUri) .build()) .addOnCompleteListener(this) .addOnFailureListener(new TaskFailureLogger(TAG, "Error updating profile")); return mProfileUpdateCompleteTask.getTask(); }

Target:
public Task<AuthResult> then(@NonNull Task<AuthResult> task) throws Exception { final AuthResult authResult = task.getResult(); FirebaseUser firebaseUser = authResult.getUser(); String name = firebaseUser.getDisplayName(); Uri photoUri = firebaseUser.getPhotoUrl(); if (!TextUtils.isEmpty(name) && photoUri != null) { return Tasks.forResult(authResult); } User user = mIdpResponse.getUser(); if (TextUtils.isEmpty(name)) { name = user.getName(); } if (photoUri == null) { photoUri = user.getPhotoUri(); } return firebaseUser.updateProfile( new UserProfileChangeRequest.Builder() .setDisplayName(name) .setPhotoUri(photoUri) .build()) .addOnFailureListener(new TaskFailureLogger(TAG, "Error updating profile")) .continueWithTask(new Continuation<Void, Task<AuthResult>>() { @Override public Task<AuthResult> then(@NonNull Task<Void> task) throws Exception { return Tasks.forResult(authResult); } }); }
Source:
static String filesystemFriendlyNameOf(ExtensionContext context) { String displayName = context.getDisplayName(); if (isBlank(displayName)) { return UNKNOWN_NAME; } return replaceIllegalCharacters(displayName.trim()); }

Target:
static String filesystemFriendlyNameOf(ExtensionContext context) { String contextId = context.getUniqueId(); try { return (isBlank(contextId)) ? UNKNOWN_NAME : URLEncoder.encode(contextId, UTF_8.toString()); } catch (UnsupportedEncodingException e) { return UNKNOWN_NAME; } }
Source:
public void addCurrentReviewers(ChangeAttribute a, Change change) throws OrmException { a.currentReviewers = Lists.newArrayList(); ArrayList<Object> accountIdlist = Lists.newArrayList(); PatchSet.Id psid = change.currentPatchSetId(); for (PatchSetApproval psa : db.get().patchSetApprovals().byPatchSet(psid)) { Account.Id accountId = psa.getAccountId(); if (!accountIdlist.contains(accountId)) { accountIdlist.add(accountId); a.currentReviewers.add(asAccountAttribute(psa.getAccountId())); } } if (a.currentReviewers.isEmpty()) { a.currentReviewers = null; } }

Target:
public void addCurrentReviewers(ChangeAttribute a, Change change) throws OrmException { ResultSet<PatchSetApproval> approvals = db.get().patchSetApprovals().byChange(change.getId()); if (approvals.iterator().hasNext()) { a.currentReviewers = Lists.newArrayList(); ArrayList<Object> accountIdlist = Lists.newArrayList(); for (PatchSetApproval psa : approvals) { Account.Id accountId = psa.getAccountId(); if (!accountIdlist.contains(accountId)) { accountIdlist.add(accountId); a.currentReviewers.add(asAccountAttribute(psa.getAccountId())); } } } }
Source:
public void visit(NodeTraversal t, Node n, Node parent) { if (n.isExprResult()) { ClassMemberDeclaration declaration = ClassMemberDeclaration.newDeclarationOnThis(n); if (declaration == null || declarationHasBeenAdded(declaration)) { return; } Node fnNode = NodeUtil.getEnclosingFunction(n); String fnName = getFnName(fnNode); if ("constructor".equals(fnName) && declaration.jsDoc != null && declaration.jsDoc.getType() != null && declaration.rhsEqualToField()) { JSTypeExpression declarationType = declaration.jsDoc.getType(); Node params = fnNode.getSecondChild(); JSDocInfo constructorJsDoc = NodeUtil.getBestJSDocInfo(fnNode); for (Node param : params.children()) { JSTypeExpression paramType = constructorJsDoc.getParameterType(param.getString()); if (declaration.memberName.equals(param.getString()) && declarationType.equals(paramType)) { moveAccessModifier(declaration, param); markAsConst(declaration, param); n.detachFromParent(); compiler.reportCodeChange(); return; } } } moveFieldsIntoClasses(declaration); registerDeclaration(declaration); } }

Target:
public void visit(NodeTraversal t, Node n, Node parent) { if (n.isExprResult()) { ClassMemberDeclaration declaration = ClassMemberDeclaration.newDeclarationOnThis(n); if (declaration == null || declarationHasBeenAdded(declaration)) { return; } Node fnNode = NodeUtil.getEnclosingFunction(n); String fnName = getEnclosingFunctionName(fnNode); if ("constructor".equals(fnName) && declaration.jsDoc != null && declaration.jsDoc.getType() != null && declaration.rhsEqualToField()) { JSTypeExpression declarationType = declaration.jsDoc.getType(); Node params = fnNode.getSecondChild(); JSDocInfo constructorJsDoc = NodeUtil.getBestJSDocInfo(fnNode); for (Node param : params.children()) { JSTypeExpression paramType = constructorJsDoc.getParameterType(param.getString()); if (declaration.memberName.equals(param.getString()) && declarationType.equals(paramType)) { moveAccessModifier(declaration, param); markAsConst(declaration, param); n.detachFromParent(); compiler.reportCodeChange(); return; } } } moveFieldsIntoClasses(declaration); registerDeclaration(declaration); } }
Source:
private boolean isAuthorized(String method, String token, String projectId) { try { String verb = getVerb(method); String pod_namespace = System.getenv("POD_NAMESPACE"); if (pod_namespace == null) { pod_namespace = "default"; } String path = "/oapi/v1/namespaces/" + pod_namespace + "/subjectaccessreviews"; URL url = new URL(KUBERNETES_MASTER_URL + path); HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); connection.setRequestMethod("POST"); connection.setDoOutput(true); connection.setRequestProperty("Accept", "application/json"); connection.setRequestProperty("Authorization", token); OutputStream outputStream = connection.getOutputStream(); for (byte b : generateSubjectAccessReview(projectId, verb).getBytes()) { outputStream.write(b); } outputStream.flush(); outputStream.close(); connection.connect(); int responseCode = connection.getResponseCode(); if (responseCode == 201) { ObjectMapper objectMapper = new ObjectMapper(); JsonNode jsonNode = objectMapper.readTree(connection.getInputStream()); if (jsonNode.get("allowed").asText().equals("true")) { return true; } } else { return false; } } catch (IOException e) { logger.error("Error trying to authenticate against the OpenShift server", e); } return false; }

Target:
private boolean isAuthorized(String method, String token, String projectId) { try { String verb = getVerb(method); String pod_namespace = System.getenv("POD_NAMESPACE"); if (pod_namespace == null) { pod_namespace = "default"; } String path = "/oapi/v1/namespaces/" + pod_namespace + "/subjectaccessreviews"; URL url = new URL(KUBERNETES_MASTER_URL + path); HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); connection.setRequestMethod("POST"); connection.setDoOutput(true); connection.setRequestProperty("Accept", "application/json"); connection.setRequestProperty("Authorization", token); try ( OutputStream outputStream = connection.getOutputStream(); ) { for (byte b : generateSubjectAccessReview(projectId, verb).getBytes()) { outputStream.write(b); } } connection.connect(); int responseCode = connection.getResponseCode(); if (responseCode == 201) { ObjectMapper objectMapper = new ObjectMapper(); JsonNode jsonNode = objectMapper.readTree(connection.getInputStream()); if (jsonNode.get("allowed").asText().equals("true")) { return true; } } else { return false; } } catch (IOException e) { logger.error("Error trying to authenticate against the OpenShift server", e); } return false; }
Source:
void linkvisit(Long patientid, String formname, Encounter encounter, Encountercreate encountercreate) { VisitDAO visitDAO = new VisitDAO(); Long visitid = visitDAO.getVisitsIDByUUID(encounter.getVisit().getUuid()).toBlocking().first(); visitDAO.getVisitByID(visitid) .observeOn(AndroidSchedulers.mainThread()) .subscribe(visit -> { encounter.setEncounterType(new EncounterType(formname)); for (int i=0;i<encountercreate.getObservations().size();i++) { encounter.getObservations().get(i).setDisplayValue (encountercreate.getObservations().get(i).getValue()); } List<Encounter> encounterList=visit.getEncounters(); encounterList.add(encounter); visitDAO.updateVisit(visit,visit.getId(),patientid); ToastUtil.success(formname+" data saved successfully"); }); }

Target:
private void linkvisit(Long patientid, String formname, Encounter encounter, Encountercreate encountercreate) { VisitDAO visitDAO = new VisitDAO(); visitDAO.getVisitByUuid(encounter.getVisit().getUuid()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(visit -> { encounter.setEncounterType(new EncounterType(formname)); for (int i=0;i<encountercreate.getObservations().size();i++) { encounter.getObservations().get(i).setDisplayValue (encountercreate.getObservations().get(i).getValue()); } List<Encounter> encounterList=visit.getEncounters(); encounterList.add(encounter); visitDAO.saveOrUpdate(visit, patientid) .observeOn(AndroidSchedulers.mainThread()) .subscribe(id -> ToastUtil.success(formname+" data saved successfully")); }); }
Source:
private URL makeWorkerURL(Worker worker, String path) { Preconditions.checkArgument(path.startsWith("/"), "path must start with '/': %s", path); try { return new URL(StringUtils.format("%s://%s/druid/worker/v1%s", worker.getScheme() == null ? "http": worker.getScheme(), worker.getHost(), path)); } catch (MalformedURLException e) { throw Throwables.propagate(e); } }

Target:
private URL makeWorkerURL(Worker worker, String path) { Preconditions.checkArgument(path.startsWith("/"), "path must start with '/': %s", path); try { return new URL(StringUtils.format("%s://%s/druid/worker/v1%s", worker.getScheme(), worker.getHost(), path)); } catch (MalformedURLException e) { throw Throwables.propagate(e); } }
Source:
public void testStreamWithMissedKeyInTransaction() throws Exception { AdvancedCache<Object, String> cache = advancedCache(0, CACHE_NAME); TransactionManager tm = TestingUtil.extractComponent(cache, TransactionManager.class); tm.begin(); try { Object localMissingKey = new MagicKey("key1", cache); Object remoteMissingKey = new MagicKey("key2", cache(1, CACHE_NAME)); assertFalse(cache.containsKey(localMissingKey)); assertFalse(cache.containsKey(remoteMissingKey)); Iterator<CacheEntry<Object, String>> iterator = cache.getAdvancedCache().cacheEntrySet().stream().iterator(); Map<Object, String> results = mapFromIterator(iterator); assertEquals(Collections.emptyMap(), results); assertEquals(0, cache.size()); } finally { tm.rollback(); } }

Target:
public void testStreamWithMissedKeyInTransaction() throws Exception { AdvancedCache<Object, String> cache = advancedCache(0, CACHE_NAME); TransactionManager tm = tm(cache); tm.begin(); try { Object localMissingKey = new MagicKey("key1", cache); Object remoteMissingKey = new MagicKey("key2", cache(1, CACHE_NAME)); assertFalse(cache.containsKey(localMissingKey)); assertFalse(cache.containsKey(remoteMissingKey)); Iterator<CacheEntry<Object, String>> iterator = cache.getAdvancedCache().cacheEntrySet().stream().iterator(); Map<Object, String> results = mapFromIterator(iterator); assertEquals(Collections.emptyMap(), results); assertEquals(0, cache.size()); } finally { tm.rollback(); } }
Source:
public void run() { if (checkAndReportInvalidState()) { return; } matchingOffers = managementRealm.where(PermissionOffer.class) .equalTo("token", offerToken) .findAllAsync(); matchingOffers.addChangeListener(new RealmChangeListener<RealmResults<PermissionOffer>>() { @Override public void onChange(final RealmResults<PermissionOffer> offers) { if (offers.size() == 1) { managementRealm.executeTransactionAsync(new Realm.Transaction() { @Override public void execute(Realm realm) { PermissionOffer offer = realm.where(PermissionOffer.class) .equalTo("token", offerToken) .findFirst(); if (offer != null) { RealmObject.deleteFromRealm(offer); } } }, new Realm.Transaction.OnSuccess() { @Override public void onSuccess() { matchingOffers.removeAllChangeListeners(); notifyCallbackWithSuccess(); } }, new Realm.Transaction.OnError() { @Override public void onError(Throwable error) { matchingOffers.removeAllChangeListeners(); notifyCallbackError(new ObjectServerError(ErrorCode.UNKNOWN, error)); } }); } } }); }

Target:
public void run() { if (checkAndReportInvalidState()) { return; } matchingOffers = managementRealm.where(PermissionOffer.class) .equalTo("token", offerToken) .findAllAsync(); matchingOffers.addChangeListener(new RealmChangeListener<RealmResults<PermissionOffer>>() { @Override public void onChange(final RealmResults<PermissionOffer> offers) { if (checkAndReportInvalidState()) { return; } if (!offers.isEmpty()) { managementRealm.executeTransactionAsync(new Realm.Transaction() { @Override public void execute(Realm realm) { if (checkAndReportInvalidState()) { return; } RealmResults<PermissionOffer> offers = realm.where(PermissionOffer.class) .equalTo("token", offerToken) .findAll(); if (!offers.isEmpty()) { offers.deleteAllFromRealm(); } } }, new Realm.Transaction.OnSuccess() { @Override public void onSuccess() { matchingOffers.removeAllChangeListeners(); if (checkAndReportInvalidState()) { return; } final SyncSession session = SyncManager.getSession(managementRealmConfig); session.addUploadProgressListener(ProgressMode.CURRENT_CHANGES, new ProgressListener() { @Override public void onChange(Progress progress) { if (progress.isTransferComplete()) { session.removeProgressListener(this); handler.post(new Runnable() { @Override public void run() { if (checkAndReportInvalidState()) { return; } notifyCallbackWithSuccess(); } }); } } }); } }, new Realm.Transaction.OnError() { @Override public void onError(Throwable error) { matchingOffers.removeAllChangeListeners(); notifyCallbackError(new ObjectServerError(ErrorCode.UNKNOWN, error)); } }); } } }); }
Source:
public List<String> getUsages() { return Arrays.asList(new String[] { buildCommandUsage(SUBCMD_SAY + " <sink> <text>", "speaks a text through the given audio sink"), buildCommandUsage(SUBCMD_INTERPRET + " <command>", "interprets a human language command"), buildCommandUsage(SUBCMD_VOICES, "lists available voices of the active TTS service") }); }

Target:
public List<String> getUsages() { return Arrays.asList(new String[] { buildCommandUsage(SUBCMD_SAY + " <voice> <sink> <text>", "speaks a text, with a given voice, through the given audio sink"), buildCommandUsage(SUBCMD_INTERPRET + " <command>", "interprets a human language command"), buildCommandUsage(SUBCMD_VOICES, "lists available voices of the active TTS service") }); }
Source:
private FeatureVector estimateRelevanceModel(ScoredDocuments docs, IndexReader reader, boolean tweetsearch, boolean useRf) { FeatureVector f = new FeatureVector(); Set<String> vocab = new HashSet<>(); int numdocs; if (useRf){ numdocs = docs.documents.length; } else{ numdocs = docs.documents.length < fbDocs ? docs.documents.length : fbDocs; } FeatureVector[] docvectors = new FeatureVector[numdocs]; for (int i = 0; i < numdocs; i++) { try { FeatureVector docVector = createdFeatureVector( reader.getTermVector(docs.ids[i], field), reader, tweetsearch); docVector.pruneToSize(fbTerms); vocab.addAll(docVector.getFeatures()); docvectors[i] = docVector; } catch (IOException e) { e.printStackTrace(); return f; } } float[] norms = new float[docvectors.length]; for (int i = 0; i < docvectors.length; i++) { norms[i] = (float) docvectors[i].computeL1Norm(); } for (String term : vocab) { float fbWeight = 0.0f; for (int i = 0; i < docvectors.length; i++) { if (norms[i] > 0.001f) { fbWeight += (docvectors[i].getFeatureWeight(term) / norms[i]) * docs.scores[i]; } } f.addFeatureWeight(term, fbWeight); } f.pruneToSize(fbTerms); f.scaleToUnitL1Norm(); return f; }

Target:
private FeatureVector estimateRelevanceModel(ScoredDocuments docs, IndexReader reader, boolean tweetsearch, boolean useRf) { FeatureVector f = new FeatureVector(); Set<String> vocab = new HashSet<>(); int numdocs; if (useRf) { numdocs = docs.documents.length; } else { numdocs = docs.documents.length < fbDocs ? docs.documents.length : fbDocs; } List<FeatureVector> docvectors = new ArrayList<>(); List<Float> docScores = new ArrayList<>(); for (int i = 0; i < numdocs; i++) { if (useRf && docs.scores[i] <= .0) { continue; } try { FeatureVector docVector = createdFeatureVector( reader.getTermVector(docs.ids[i], field), reader, tweetsearch); docVector.pruneToSize(fbTerms); vocab.addAll(docVector.getFeatures()); docvectors.add(docVector); docScores.add(Float.valueOf(docs.scores[i])); } catch (IOException e) { e.printStackTrace(); return f; } } float[] norms = new float[docvectors.size()]; for (int i = 0; i < docvectors.size(); i++) { norms[i] = (float) docvectors.get(i).computeL1Norm(); } for (String term : vocab) { float fbWeight = 0.0f; for (int i = 0; i < docvectors.size(); i++) { if (norms[i] > 0.001f) { fbWeight += (docvectors.get(i).getFeatureWeight(term) / norms[i]) * docScores.get(i); } } f.addFeatureWeight(term, fbWeight); } f.pruneToSize(fbTerms); f.scaleToUnitL1Norm(); return f; }
Source:
public static Container initializeFromSlices(final List<Slice> containerSlices, final CompressionHeader compressionHeader, final long containerByteOffset) { final Set<ReferenceContext> sliceRefContexts = containerSlices.stream() .map(Slice::getReferenceContext) .collect(Collectors.toSet()); if (sliceRefContexts.isEmpty()) { throw new CRAMException("Cannot construct a Container without any Slices"); } else if (sliceRefContexts.size() > 1) { throw new CRAMException("Cannot construct a Container from Slices with conflicting types or sequence IDs"); } final ReferenceContext commonRefContext = sliceRefContexts.iterator().next(); final Container container = new Container(commonRefContext); container.setSlices(containerSlices, containerByteOffset); container.compressionHeader = compressionHeader; if (commonRefContext.isMappedSingleRef()) { int start = Integer.MAX_VALUE; int endPlusOne = Integer.MIN_VALUE; for (final Slice slice : containerSlices) { start = Math.min(start, slice.alignmentStart); endPlusOne = Math.max(endPlusOne, slice.alignmentStart + slice.alignmentSpan); } container.alignmentStart = start; container.alignmentSpan = endPlusOne - start; } else { container.alignmentStart = Slice.NO_ALIGNMENT_START; container.alignmentSpan = Slice.NO_ALIGNMENT_SPAN; } container.setByteOffset(containerByteOffset); return container; }

Target:
public static Container initializeFromSlices(final List<Slice> containerSlices, final CompressionHeader compressionHeader, final long containerByteOffset) { final Set<ReferenceContext> sliceRefContexts = containerSlices.stream() .map(Slice::getReferenceContext) .collect(Collectors.toSet()); if (sliceRefContexts.isEmpty()) { throw new CRAMException("Cannot construct a Container without any Slices"); } else if (sliceRefContexts.size() > 1) { throw new CRAMException("Cannot construct a Container from Slices with conflicting types or sequence IDs"); } final ReferenceContext commonRefContext = sliceRefContexts.iterator().next(); final Container container = new Container(commonRefContext); container.setSlicesAndByteOffset(containerSlices, containerByteOffset); container.compressionHeader = compressionHeader; if (commonRefContext.isMappedSingleRef()) { int start = Integer.MAX_VALUE; int endPlusOne = Integer.MIN_VALUE; for (final Slice slice : containerSlices) { start = Math.min(start, slice.alignmentStart); endPlusOne = Math.max(endPlusOne, slice.alignmentStart + slice.alignmentSpan); } container.alignmentStart = start; container.alignmentSpan = endPlusOne - start; } else { container.alignmentStart = Slice.NO_ALIGNMENT_START; container.alignmentSpan = Slice.NO_ALIGNMENT_SPAN; } return container; }
Source:
private boolean isFidesmoDevice() { if (isNfcConnected()) { try { byte[] selectResponse = mIsoCard.transceive(Apdu.select(FIDESMO_APPS_AID_PREFIX)); return Apdu.hasStatus(selectResponse, Apdu.OK_APDU); } catch (IOException e) { e.printStackTrace(); } } return false; }

Target:
private boolean isFidesmoDevice() { if (isNfcConnected()) { try { byte[] mSelectResponse = mIsoCard.transceive(Apdu.select(FIDESMO_APPS_AID_PREFIX)); return Apdu.hasStatus(mSelectResponse, Apdu.OK_APDU); } catch (IOException e) { Log.e(Constants.TAG, "Card communication failed!", e); } } return false; }
Source:
private MessageSource getMessageSource(UUID id) { return MessageSource.getRepository().findOne(id); }

Target:
private MessageSource getMessageSource(UUID id) { return messageSourceRepository.findOne(id); }
Source:
public static File getConfigurationFile(String filename) { File file = new File(filename).getAbsoluteFile(); if (file.exists()) { return file.getAbsoluteFile(); } else { return newFile(getSimulatorHome(), "conf", filename).getAbsoluteFile(); } }

Target:
public static File getConfigurationFile(String filename) { File file = new File(filename).getAbsoluteFile(); if (file.exists()) { return file; } else { return newFile(getSimulatorHome(), "conf", filename).getAbsoluteFile(); } }
Source:
public Response export(Action action) { org.ovirt.engine.core.common.businessentities.VM vm = getEntity( org.ovirt.engine.core.common.businessentities.VM.class, QueryType.GetVmByVmId, new IdQueryParameters(guid), "VM: id=" + guid); String clonedVmName = action.getVmname(); if (StringUtils.isEmpty(action.getVmname())) { clonedVmName = String.format("%s-cloned", vm.getName()); } CloneVmParameters params = new CloneVmParameters(vm, clonedVmName); params.setDestStorageDomainId(getStorageDomainId(action)); ActionType actionType = ActionType.CloneVmNoCollapse; if (action.isSetDiscardSnapshots() && action.isDiscardSnapshots()) { actionType = ActionType.CloneVm; } return doAction(actionType, params, action); }

Target:
public Response export(Action action) { org.ovirt.engine.core.common.businessentities.VM vm = getEntity( org.ovirt.engine.core.common.businessentities.VM.class, QueryType.GetVmByVmId, new IdQueryParameters(guid), "VM: id=" + guid); String clonedVmName = action.getExportedVmName(); if (StringUtils.isEmpty(action.getExportedVmName())) { clonedVmName = String.format("%s-cloned", vm.getName()); } CloneVmParameters params = new CloneVmParameters(vm, clonedVmName); params.setDestStorageDomainId(getStorageDomainId(action)); ActionType actionType = ActionType.CloneVmNoCollapse; if (action.isSetDiscardSnapshots() && action.isDiscardSnapshots()) { actionType = ActionType.CloneVm; } return doAction(actionType, params, action); }
Source:
private void addAuditLogForPartialVMs() { String missingEntities = ""; if (getParameters().isAllowPartialImport() && !failedDisksToImportForAuditLog.isEmpty()) { missingEntities += StringUtils.join(failedDisksToImportForAuditLog.values(), ", ") + " "; } if (getParameters().isAllowPartialImport() && !missingAffinityGroups.isEmpty()) { missingEntities += StringUtils.join(missingAffinityGroups, ", ") + " "; } if (getParameters().isAllowPartialImport() && !missingAffinityLabels.isEmpty()) { missingEntities += StringUtils.join(missingAffinityLabels, ", ") + " "; } if (getParameters().isAllowPartialImport() && !missingUsers.isEmpty()) { missingEntities += StringUtils.join(missingUsers, ", ") + " "; } if (getParameters().isAllowPartialImport() && !missingRoles.isEmpty()) { missingEntities += StringUtils.join(missingRoles, ", ") + " "; } addCustomValue("MissingEntities", missingEntities); auditLogDirector.log(this, AuditLogType.IMPORTEXPORT_PARTIAL_VM_MISSING_ENTITIES); }

Target:
private void addAuditLogForPartialVMs() { StringBuilder missingEntities = new StringBuilder(); if (getParameters().isAllowPartialImport() && !failedDisksToImportForAuditLog.isEmpty()) { missingEntities.append("Disks: "); missingEntities.append(StringUtils.join(failedDisksToImportForAuditLog.values(), ", ") + " "); } if (getParameters().isAllowPartialImport() && !missingAffinityGroups.isEmpty()) { missingEntities.append("Affinity groups: "); missingEntities.append(StringUtils.join(missingAffinityGroups, ", ") + " "); } if (getParameters().isAllowPartialImport() && !missingAffinityLabels.isEmpty()) { missingEntities.append("Affinity labels: "); missingEntities.append(StringUtils.join(missingAffinityLabels, ", ") + " "); } if (getParameters().isAllowPartialImport() && !missingUsers.isEmpty()) { missingEntities.append("Users: "); missingEntities.append(StringUtils.join(missingUsers, ", ") + " "); } if (getParameters().isAllowPartialImport() && !missingRoles.isEmpty()) { missingEntities.append("Roles: "); missingEntities.append(StringUtils.join(missingRoles, ", ") + " "); } addCustomValue("MissingEntities", missingEntities.toString()); auditLogDirector.log(this, AuditLogType.IMPORTEXPORT_PARTIAL_VM_MISSING_ENTITIES); }
Source:
public Method getOnBinaryMessageMethod(Object webSocketEndpoint) { Method[] methods = webSocketEndpoint.getClass().getMethods(); if (methods == null) { return null; } for (Method method : methods) { if (method.isAnnotationPresent(OnMessage.class)) { Class<?>[] paraTypes = method.getParameterTypes(); List<Class<?>> paraList = Arrays.asList(paraTypes); if (paraList.contains(byte[].class) || paraList.contains(ByteBuffer.class)) { return method; } } } return null; }

Target:
public Optional<Method> getOnBinaryMessageMethod(Object webSocketEndpoint) { Method[] methods = webSocketEndpoint.getClass().getMethods(); Method returnMethod = null; for (Method method : methods) { if (method.isAnnotationPresent(OnMessage.class)) { Class<?>[] paraTypes = method.getParameterTypes(); List<Class<?>> paraList = Arrays.asList(paraTypes); if (paraList.contains(byte[].class) || paraList.contains(ByteBuffer.class)) { returnMethod = method; } } } return Optional.ofNullable(returnMethod); }
Source:
public void testTriggerTaskInCanceledCase() throws Exception { String caseId = startUserTaskCase(USER_YODA, USER_JOHN); assertNotNull(caseId); assertTrue(caseId.startsWith(CASE_HR_ID_PREFIX)); List<TaskSummary> caseTasks = caseClient.findCaseTasksAssignedAsPotentialOwner(caseId, USER_YODA, 0, 10); assertNotNull(caseTasks); assertEquals(1, caseTasks.size()); caseClient.cancelCaseInstance(CONTAINER_ID, caseId); try { caseClient.triggerAdHocFragment(CONTAINER_ID, caseId, HELLO_2_TASK, Collections.EMPTY_MAP); fail("AdHoc Task was trigged from canceled case."); } catch (KieServicesHttpException ex) { assertTrue(ex.getMessage().startsWith("Unexpected HTTP response code")); assertEquals(Integer.valueOf(404), ex.getHttpCode()); } catch (KieServicesException e) { assertEquals("Case with id " + caseId + " was not found", e.getMessage()); } caseClient.destroyCaseInstance(CONTAINER_ID, caseId); }

Target:
public void testTriggerTaskInCanceledCase() throws Exception { String caseId = startUserTaskCase(USER_YODA, USER_JOHN); assertNotNull(caseId); assertTrue(caseId.startsWith(CASE_HR_ID_PREFIX)); List<TaskSummary> caseTasks = caseClient.findCaseTasksAssignedAsPotentialOwner(caseId, USER_YODA, 0, 10); assertNotNull(caseTasks); assertEquals(1, caseTasks.size()); caseClient.cancelCaseInstance(CONTAINER_ID, caseId); assertClientException( () -> caseClient.triggerAdHocFragment(CONTAINER_ID, caseId, HELLO_2_TASK, Collections.EMPTY_MAP), 404, "Could not find case instance \"" + caseId + "\"", "Case with id " + caseId + " was not found"); caseClient.destroyCaseInstance(CONTAINER_ID, caseId); }
Source:
protected void initCounters() { metricRegistry.register(MetricRegistry.name(QueryExecutionService.class, QUEUED_QUERIES), new Gauge<Long>() { @Override public Long getValue() { return getQuerySvc().getQueuedQueriesCount(); } }); metricRegistry.register(MetricRegistry.name(QueryExecutionService.class, RUNNING_QUERIES), new Gauge<Long>() { @Override public Long getValue() { return getQuerySvc().getRunningQueriesCount(); } }); metricRegistry.register(MetricRegistry.name(QueryExecutionService.class, FINISHED_QUERIES), new Gauge<Long>() { @Override public Long getValue() { return getQuerySvc().getFinishedQueriesCount(); } }); totalAcceptedQueries = metricRegistry.counter(MetricRegistry.name(QueryExecutionService.class, "total-" + ACCEPTED_QUERIES)); totalSuccessfulQueries = metricRegistry.counter(MetricRegistry.name(QueryExecutionService.class, "total-success-queries")); totalFinishedQueries = metricRegistry.counter(MetricRegistry.name(QueryExecutionService.class, "total-" + FINISHED_QUERIES)); totalFailedQueries = metricRegistry.counter(MetricRegistry.name(QueryExecutionService.class, "total-" + FAILED_QUERIES)); totalCancelledQueries = metricRegistry.counter(MetricRegistry.name(QueryExecutionService.class, "total-" + CANCELLED_QUERIES)); metricRegistry.register("gc", new GarbageCollectorMetricSet()); metricRegistry.register("memory", new MemoryUsageGaugeSet()); metricRegistry.register("threads", new ThreadStatesGaugeSet()); metricRegistry.register("jvm", new JvmAttributeGaugeSet()); }

Target:
protected void initCounters() { queuedQueries = metricRegistry.register(MetricRegistry.name(QueryExecutionService.class, QUEUED_QUERIES), new Gauge<Long>() { @Override public Long getValue() { return getQuerySvc().getQueuedQueriesCount(); } }); runningQueries = metricRegistry.register(MetricRegistry.name(QueryExecutionService.class, RUNNING_QUERIES), new Gauge<Long>() { @Override public Long getValue() { return getQuerySvc().getRunningQueriesCount(); } }); finishedQueries = metricRegistry.register(MetricRegistry.name(QueryExecutionService.class, FINISHED_QUERIES), new Gauge<Long>() { @Override public Long getValue() { return getQuerySvc().getFinishedQueriesCount(); } }); totalAcceptedQueries = metricRegistry.counter(MetricRegistry.name(QueryExecutionService.class, "total-" + ACCEPTED_QUERIES)); totalSuccessfulQueries = metricRegistry.counter(MetricRegistry.name(QueryExecutionService.class, "total-success-queries")); totalFinishedQueries = metricRegistry.counter(MetricRegistry.name(QueryExecutionService.class, "total-" + FINISHED_QUERIES)); totalFailedQueries = metricRegistry.counter(MetricRegistry.name(QueryExecutionService.class, "total-" + FAILED_QUERIES)); totalCancelledQueries = metricRegistry.counter(MetricRegistry.name(QueryExecutionService.class, "total-" + CANCELLED_QUERIES)); metricRegistry.register("gc", new GarbageCollectorMetricSet()); metricRegistry.register("memory", new MemoryUsageGaugeSet()); metricRegistry.register("threads", new ThreadStatesGaugeSet()); metricRegistry.register("jvm", new JvmAttributeGaugeSet()); }
Source:
public POSSample produce(JCas aJCas) { Sentence sentence = sentences.next(); if (!sentences.hasNext()) { documentComplete(); } List<String> words = new ArrayList<>(); List<String> tags = new ArrayList<>(); for (Token t : selectCovered(Token.class, sentence)) { words.add(t.getCoveredText()); POS pos = t.getPos(); if (pos == null) { throw new IllegalStateException("Token +t.getCoveredText()+ has no POS"); } if (pos.getPosValue() != null) { tags.add(pos.getPosValue()); } else { tags.add(pos.getType().getShortName().substring(4)); } } return new POSSample(words, tags); }

Target:
public POSSample produce(JCas aJCas) { Sentence sentence = sentences.next(); if (!sentences.hasNext()) { documentComplete(); } List<String> words = new ArrayList<>(); List<String> tags = new ArrayList<>(); for (Token t : selectCovered(Token.class, sentence)) { words.add(t.getCoveredText()); if (t.getPos() == null) { throw new IllegalStateException("Token +t.getCoveredText()+ has no POS"); } tags.add(t.getPos().getPosValue()); } return new POSSample(words, tags); }
Source:
private ElementTag createButton(String content, String buttonClass, String id, String href, String title, String dataToggle, String onClick, boolean isDisabled){ ElementTag button = new ElementTag(content); if ((buttonClass != null) && (!buttonClass.equals(""))) { button.setAttribute("class", buttonClass); } if ((id != null) && (!id.equals(""))) { button.setAttribute("id", id); } if ((href != null) && (!href.equals(""))) { button.setAttribute("href", href); } if (title != null) { button.setAttribute("title", title); button.setAttribute("data-placement", "top"); } if (dataToggle != null) { button.setAttribute("data-toggle", dataToggle); } if ((onClick != null) && (!onClick.equals(""))) { button.setAttribute("onclick", onClick); } if (isDisabled) { button.setAttribute("disabled", "disabled"); } return button; }

Target:
private ElementTag createButton(String content, String buttonClass, String id, String href, String title, String dataToggle, String onClick, boolean isDisabled){ ElementTag button = new ElementTag(content); if (buttonClass != null) { button.setAttribute("class", buttonClass); } if (id != null) { button.setAttribute("id", id); } if (href != null) { button.setAttribute("href", href); } if (title != null) { button.setAttribute("title", title); button.setAttribute("data-placement", "top"); } if (dataToggle != null) { button.setAttribute("data-toggle", dataToggle); } if (onClick != null) { button.setAttribute("onclick", onClick); } if (isDisabled) { button.setAttribute("disabled", "disabled"); } return button; }
Source:
@Override final String doReadUtf8(int length) { String result = new String(buf, pos, length, UTF_8); pos += length; return result; }

Target:
@Override final String doReadUtf8(int length) { String result = new String(buf, offset, length, UTF_8); offset += length; return result; }
Source:
public Practitioner createFHIRPractitioner(Practitioner practitioner) { Provider provider=null; if (practitioner.getGender().equalsIgnoreCase(String.valueOf(AdministrativeGenderEnum.UNKNOWN))&&practitioner.getBirthDate()==null){ provider=new Provider(); HumanNameDt humanNameDt= practitioner.getName(); if (humanNameDt.getUse() != null) { String getUse = humanNameDt.getUse(); if (String.valueOf(NameUseEnum.USUAL).equalsIgnoreCase(getUse)) { List<StringDt> givenNames = humanNameDt.getGiven(); StringDt givenName = givenNames.get(0); provider.setName(valueOf(givenName)); } } List<IdentifierDt> identifiers=practitioner.getIdentifier(); IdentifierDt idnt=identifiers.get(0); provider.setIdentifier(idnt.getValue()); Provider omrsProvider = Context.getProviderService().saveProvider(provider); return FHIRPractitionerUtil.generatePractitioner(omrsProvider); }else{ Person person=FHIRPractitionerUtil.generateOpenMRSPerson(practitioner); provider = new Provider(); List<IdentifierDt> identifiers=practitioner.getIdentifier(); if (identifiers != null) { IdentifierDt idnt=identifiers.get(0); provider.setIdentifier(idnt.getValue()); } return FHIRPractitionerUtil.generatePractitioner(provider); } }

Target:
public Practitioner createFHIRPractitioner(Practitioner practitioner) { Provider provider = new Provider(); Person prsnProvider = FHIRPractitionerUtil.generateOpenMRSPerson(practitioner); List<IdentifierDt> identifiers = practitioner.getIdentifier(); if (!identifiers.isEmpty()) { IdentifierDt idnt = identifiers.get(0); provider.setIdentifier(idnt.getValue()); } provider.setPerson(prsnProvider); Provider omrsProvider = Context.getProviderService().saveProvider(provider); return FHIRPractitionerUtil.generatePractitioner(omrsProvider); }
Source:
public static double lgmultivariategamma(int p, double x) { double ret = Math.log(Math.PI) * p * (p - 1) * 0.25; for (int i = 1; i <= p; i++) { ret += Gamma.lgamma(x + (1 - i) * 0.5); } return ret; }

Target:
private static double lgmultivariategamma(int p, double x) { double ret = Math.log(Math.PI) * p * (p - 1) * 0.25; for (int i = 1; i <= p; i++) { ret += Gamma.lgamma(x + (1 - i) * 0.5); } return ret; }
Source:
public void testRandomMethodSorter() { List<String> original = Arrays.asList(ALPHA, BETA, DELTA, EPSILON, GAMMA_VOID, GAMMA_BOOLEAN); List<String> result1 = getDeclaredMethodNames(DummySortRandom.class); assertNotEquals(original, result1); List<String> result2 = getDeclaredMethodNames(DummySortRandom.class); assertNotEquals(result1, result2); }

Target:
public void testRandomMethodSorter() { List<String> original = Arrays.asList(ALPHA, BETA, DELTA, EPSILON, GAMMA_VOID, GAMMA_BOOLEAN); List<String> result1; do{ result1 = getDeclaredMethodNames(DummySortRandom.class); } while(original.equals(result1)); List<String> result2; do { result2 = getDeclaredMethodNames(DummySortRandom.class); } while(result1.equals(result2)); }
Source:
protected void onResume() { super.onResume(); if (getIntent().getBooleanExtra("FROM_LOG_OUT_BUTTON", false)) { Log.d("LandingActivity", "onResume: FROM_LOG_OUT_BUTTON == false"); } else if (getIntent().getAction().equals(Intent.ACTION_VIEW)) { Log.d("LandingActivity", "onResume: getIntent().getAction().equals(Intent.ACTION_VIEW"); Uri uri = getIntent().getData(); String error = uri.getQueryParameter("error"); if (error != null) { showErrorDialog(); Log.d("LandingActivity", "onResume: error = " + error); AnalyticsTracker.getInstance(getApplicationContext()).trackEvent( "Error in LandingActivity onResume()", loggedIn); } else { String authCode = uri.getQueryParameter("code"); Intent intent = new Intent(this, AccountRetrievalService.class); intent.putExtra("AUTHCODE", authCode); intent.putExtra("REDIRECT_URI", REDIRECT_URI); intent.putExtra("CLIENT_ID", CLIENT_ID); startService(intent); Intent loadingActivityIntent = new Intent(this, LoadingActivity.class); startActivity(loadingActivityIntent); } } }

Target:
protected void onResume() { super.onResume(); if (getIntent().getBooleanExtra("FROM_LOG_OUT_BUTTON", false)) { Toast.makeText(getApplicationContext(), R.string.log_out_toast_confirm, Toast.LENGTH_LONG).show(); } else if (getIntent().getAction().equals(Intent.ACTION_VIEW)) { Uri uri = getIntent().getData(); String error = uri.getQueryParameter("error"); if (error != null) { showErrorDialog(); } else { String authCode = uri.getQueryParameter("code"); Intent intent = new Intent(this, AccountRetrievalService.class); intent.putExtra(AUTHCODE_KEY, authCode); intent.putExtra(REDIRECT_URI_KEY, REDIRECT_URI); intent.putExtra(CLIENT_ID_KEY, CLIENT_ID); startService(intent); Intent loadingActivityIntent = new Intent(this, LoadingActivity.class); startActivity(loadingActivityIntent); } } }
Source:
public Map<String, Object> getConstants() { final Map<String, Object> constants = new HashMap<>(); constants.put(ANY.jsName(), ANY.name()); constants.put(SECURE_SOFTWARE.jsName(), SECURE_SOFTWARE.name()); constants.put(SECURE_HARDWARE.jsName(), SECURE_HARDWARE.name()); return constants; }

Target:
public Map<String, Object> getConstants() { final Map<String, Object> constants = new HashMap<>(); constants.put(SecurityLevel.ANY.jsName(), SecurityLevel.ANY.name()); constants.put(SecurityLevel.SECURE_SOFTWARE.jsName(), SecurityLevel.SECURE_SOFTWARE.name()); constants.put(SecurityLevel.SECURE_HARDWARE.jsName(), SecurityLevel.SECURE_HARDWARE.name()); return constants; }