method2testcases stringlengths 118 6.63k |
|---|
### Question:
DoubleRangeValidator extends CustomValidator<Double> { public static DoubleRangeValidator exactly(double value, String errorMessage) { return new DoubleRangeValidator(value, value, errorMessage); } private DoubleRangeValidator(double min, double max, String errorMessage); static DoubleRangeValidator betw... |
### Question:
SelectionLengthValidator extends CustomValidator<ObservableList<E>> { public static <T> SelectionLengthValidator<T> between(int min, int max, String errorMessage) { if (min < 0) { throw new IllegalArgumentException("Minimum string length cannot be negative."); } else if (min > max) { throw new IllegalArgu... |
### Question:
SelectionLengthValidator extends CustomValidator<ObservableList<E>> { public static <T> SelectionLengthValidator<T> atLeast(int min, String errorMessage) { if (min < 0) { throw new IllegalArgumentException("Minimum string length cannot be negative."); } return new SelectionLengthValidator<>(min, Integer.M... |
### Question:
SelectionLengthValidator extends CustomValidator<ObservableList<E>> { public static <T> SelectionLengthValidator<T> upTo(int max, String errorMessage) { return new SelectionLengthValidator<>(0, max, errorMessage); } private SelectionLengthValidator(int min, int max, String errorMessage); static Selection... |
### Question:
SelectionLengthValidator extends CustomValidator<ObservableList<E>> { public static <T> SelectionLengthValidator<T> exactly(int value, String errorMessage) { return new SelectionLengthValidator<>(value, value, errorMessage); } private SelectionLengthValidator(int min, int max, String errorMessage); stati... |
### Question:
Octagons extends StructuredArray<Octagon> { public static Octagons newInstance(final long length) { return StructuredArray.newInstance(Octagons.class, Octagon.class, length); } Octagons(); Octagons(Octagons source); static Octagons newInstance(final long length); static Octagons newInstance(
... |
### Question:
Octagon { public PointArray getPoints() { return points; } Octagon(); Octagon(final String color); Octagon(final Octagon source); Octagon(final String color, final long centerX, final long centerY, final long radius); PointArray getPoints(); String getColor(); }### Answer:
@Test public void shouldCons... |
### Question:
StructuredArrayOfAtomicLong extends StructuredArray<AtomicLong> { public static StructuredArrayOfAtomicLong newInstance(final long length) { return StructuredArray.newInstance(StructuredArrayOfAtomicLong.class, AtomicLong.class, length); } static StructuredArrayOfAtomicLong newInstance(final long length)... |
### Question:
SignatureMethodsHMAC256Impl implements SignatureMethod<SymmetricKeyImpl, SymmetricKeyImpl> { @Override public String calculate(String header, String payload, SymmetricKeyImpl signingKey) { StringBuilder sb = new StringBuilder(); sb.append(header).append(".").append(payload); String stringToSign = sb.toStr... |
### Question:
TokenReader extends TokenDecoder { public T read(String base64String) { if (base64String == null || base64String.isEmpty()) { throw new IllegalArgumentException("Impossible to obtain a Token from a null or empty string"); } StringBuilder buffer = new StringBuilder(); BufferedReader reader = new BufferedRe... |
### Question:
OAuthASResponse extends OAuthResponse { public static OAuthAuthorizationResponseBuilder authorizationResponse(HttpServletRequest request,int code) { return new OAuthAuthorizationResponseBuilder(request,code); } protected OAuthASResponse(String uri, int responseStatus); static OAuthAuthorizationResponseBu... |
### Question:
OAuthASResponse extends OAuthResponse { public static OAuthTokenResponseBuilder tokenResponse(int code) { return new OAuthTokenResponseBuilder(code); } protected OAuthASResponse(String uri, int responseStatus); static OAuthAuthorizationResponseBuilder authorizationResponse(HttpServletRequest request,int ... |
### Question:
TokenValidator extends AbstractValidator<HttpServletRequest> { @Override public void validateMethod(HttpServletRequest request) throws OAuthProblemException { String method = request.getMethod(); if (!OAuth.HttpMethod.GET.equals(method) && !OAuth.HttpMethod.POST.equals(method)) { throw OAuthProblemExcepti... |
### Question:
OAuthResponse implements OAuthMessage { public static OAuthErrorResponseBuilder errorResponse(int code) { return new OAuthErrorResponseBuilder(code); } protected OAuthResponse(String uri, int responseStatus); static OAuthResponseBuilder status(int code); static OAuthErrorResponseBuilder errorResponse(int... |
### Question:
AbstractValidator implements OAuthValidator<T> { @Override public void validateContentType(T request) throws OAuthProblemException { String contentType = request.getContentType(); final String expectedContentType = OAuth.ContentType.URL_ENCODED; if (!OAuthUtils.hasContentType(contentType, expectedContentT... |
### Question:
SignatureMethodsHMAC256Impl implements SignatureMethod<SymmetricKeyImpl, SymmetricKeyImpl> { @Override public boolean verify(String signature, String header, String payload, SymmetricKeyImpl verifyingKey) { String signed = calculate(header, payload, verifyingKey); return signed.equals(signature); } @Over... |
### Question:
JSONUtils { public static String buildJSON(Map<String, Object> params) { final StringWriter stringWriter = new StringWriter(); final JsonGenerator generator = GENERATOR_FACTORY.createGenerator(stringWriter); generator.writeStartObject(); for (Map.Entry<String, Object> param : params.entrySet()) { String k... |
### Question:
JSONUtils { public static Map<String, Object> parseJSON(String jsonBody) { final Map<String, Object> params = new HashMap<String, Object>(); StringReader reader = new StringReader(jsonBody); JsonReader jsonReader = Json.createReader(reader); JsonStructure structure = jsonReader.read(); if (structure == nu... |
### Question:
OAuthUtils { public static String format( final Collection<? extends Map.Entry<String, Object>> parameters, final String encoding) { final StringBuilder result = new StringBuilder(); for (final Map.Entry<String, Object> parameter : parameters) { String value = parameter.getValue() == null? null : String.v... |
### Question:
OAuthUtils { public static String saveStreamAsString(InputStream is) throws IOException { return toString(is, ENCODING); } static String format(
final Collection<? extends Map.Entry<String, Object>> parameters,
final String encoding); static String saveStreamAsString(InputStream is); stat... |
### Question:
OAuthUtils { public static OAuthProblemException handleOAuthProblemException(String message) { return OAuthProblemException.error(OAuthError.TokenResponse.INVALID_REQUEST) .description(message); } static String format(
final Collection<? extends Map.Entry<String, Object>> parameters,
fina... |
### Question:
OAuthUtils { public static OAuthProblemException handleMissingParameters(Set<String> missingParams) { StringBuffer sb = new StringBuffer("Missing parameters: "); if (!OAuthUtils.isEmpty(missingParams)) { for (String missingParam : missingParams) { sb.append(missingParam).append(" "); } } return handleOAut... |
### Question:
OAuthUtils { public static OAuthProblemException handleNotAllowedParametersOAuthException( List<String> notAllowedParams) { StringBuffer sb = new StringBuffer("Not allowed parameters: "); if (notAllowedParams != null) { for (String notAllowed : notAllowedParams) { sb.append(notAllowed).append(" "); } } re... |
### Question:
OAuthUtils { public static Map<String, Object> decodeForm(String form) { Map<String, Object> params = new HashMap<String, Object>(); if (!OAuthUtils.isEmpty(form)) { for (String nvp : form.split("\\&")) { int equals = nvp.indexOf('='); String name; String value; if (equals < 0) { name = decodePercent(nvp)... |
### Question:
OAuthUtils { public static boolean isFormEncoded(String contentType) { if (contentType == null) { return false; } int semi = contentType.indexOf(";"); if (semi >= 0) { contentType = contentType.substring(0, semi); } return OAuth.ContentType.URL_ENCODED.equalsIgnoreCase(contentType.trim()); } static Strin... |
### Question:
OAuthUtils { public static String decodePercent(String s) { try { return URLDecoder.decode(s, ENCODING); } catch (java.io.UnsupportedEncodingException wow) { throw new RuntimeException(wow.getMessage(), wow); } } static String format(
final Collection<? extends Map.Entry<String, Object>> paramete... |
### Question:
OAuthUtils { public static String percentEncode(String s) { if (s == null) { return ""; } try { return URLEncoder.encode(s, ENCODING) .replace("+", "%20").replace("*", "%2A") .replace("%7E", "~"); } catch (UnsupportedEncodingException wow) { throw new RuntimeException(wow.getMessage(), wow); } } static S... |
### Question:
OAuthUtils { public static <T> T instantiateClass(Class<T> clazz) throws OAuthSystemException { return instantiateClassWithParameters(clazz, null, null); } static String format(
final Collection<? extends Map.Entry<String, Object>> parameters,
final String encoding); static String saveStr... |
### Question:
OAuthUtils { public static <T> T instantiateClassWithParameters(Class<T> clazz, Class<?>[] paramsTypes, Object[] paramValues) throws OAuthSystemException { try { if (paramsTypes != null && paramValues != null) { if (!(paramsTypes.length == paramValues.length)) { throw new IllegalArgumentException("Number ... |
### Question:
OAuthUtils { public static String getAuthHeaderField(String authHeader) { if (authHeader != null) { Matcher m = OAUTH_HEADER.matcher(authHeader); if (m.matches()) { if (AUTH_SCHEME.equalsIgnoreCase(m.group(1))) { return m.group(2); } } } return null; } static String format(
final Collection<? ext... |
### Question:
OAuthUtils { public static Map<String, String> decodeOAuthHeader(String header) { Map<String, String> headerValues = new HashMap<String, String>(); if (header != null) { Matcher m = OAUTH_HEADER.matcher(header); if (m.matches()) { if (AUTH_SCHEME.equalsIgnoreCase(m.group(1))) { for (String nvp : m.group(2... |
### Question:
OAuthUtils { public static String encodeOAuthHeader(Map<String, Object> entries) { StringBuffer sb = new StringBuffer(); sb.append(OAuth.OAUTH_HEADER_NAME).append(" "); if (entries.get("realm") != null) { String value = String.valueOf(entries.get("realm")); if (!OAuthUtils.isEmpty(value)) { sb.append("rea... |
### Question:
OAuthUtils { public static String encodeAuthorizationBearerHeader(Map<String, Object> entries) { StringBuffer sb = new StringBuffer(); sb.append(OAuth.OAUTH_HEADER_NAME).append(" "); for (Map.Entry<String, Object> entry : entries.entrySet()) { String value = entry.getValue() == null? null: String.valueOf(... |
### Question:
OAuthUtils { private static boolean isEmpty(Set<String> missingParams) { if (missingParams == null || missingParams.size() == 0) { return true; } return false; } static String format(
final Collection<? extends Map.Entry<String, Object>> parameters,
final String encoding); static String s... |
### Question:
OAuthUtils { public static boolean hasEmptyValues(String[] array) { if (array == null || array.length == 0) { return true; } for (String s : array) { if (isEmpty(s)) { return true; } } return false; } static String format(
final Collection<? extends Map.Entry<String, Object>> parameters,
... |
### Question:
OAuthUtils { public static String getAuthzMethod(String header) { if (header != null) { Matcher m = OAUTH_HEADER.matcher(header); if (m.matches()) { return m.group(1); } } return null; } static String format(
final Collection<? extends Map.Entry<String, Object>> parameters,
final String e... |
### Question:
OAuthUtils { public static Set<String> decodeScopes(String s) { Set<String> scopes = new HashSet<String>(); if (!OAuthUtils.isEmpty(s)) { StringTokenizer tokenizer = new StringTokenizer(s, " "); while (tokenizer.hasMoreElements()) { scopes.add(tokenizer.nextToken()); } } return scopes; } static String fo... |
### Question:
OAuthUtils { public static String encodeScopes(Set<String> s) { StringBuffer scopes = new StringBuffer(); for (String scope : s) { scopes.append(scope).append(" "); } return scopes.toString().trim(); } static String format(
final Collection<? extends Map.Entry<String, Object>> parameters,
... |
### Question:
OAuthUtils { public static boolean isMultipart(HttpServletRequest request) { if (!"post".equals(request.getMethod().toLowerCase())) { return false; } String contentType = request.getContentType(); if (contentType == null) { return false; } if (contentType.toLowerCase().startsWith(MULTIPART)) { return true... |
### Question:
OAuthUtils { public static boolean hasContentType(String requestContentType, String requiredContentType) { if (OAuthUtils.isEmpty(requiredContentType) || OAuthUtils.isEmpty(requestContentType)) { return false; } StringTokenizer tokenizer = new StringTokenizer(requestContentType, ";"); while (tokenizer.has... |
### Question:
OAuthUtils { public static String[] decodeClientAuthenticationHeader(String authenticationHeader) { if (isEmpty(authenticationHeader)) { return null; } String[] tokens = authenticationHeader.split(" "); if (tokens.length != 2) { return null; } String authType = tokens[0]; if (!"basic".equalsIgnoreCase(aut... |
### Question:
JSONBodyParametersApplier implements OAuthParametersApplier { public OAuthMessage applyOAuthParameters(OAuthMessage message, Map<String, Object> params) throws OAuthSystemException { String json = null; try { json = JSONUtils.buildJSON(params); message.setBody(json); return message; } catch (Throwable e) ... |
### Question:
BodyURLEncodedParametersApplier implements OAuthParametersApplier { public OAuthMessage applyOAuthParameters(OAuthMessage message, Map<String, Object> params) throws OAuthSystemException { String body = OAuthUtils.format(params.entrySet(), "UTF-8"); message.setBody(body); return message; } OAuthMessage a... |
### Question:
WWWAuthHeaderParametersApplier implements OAuthParametersApplier { public OAuthMessage applyOAuthParameters(OAuthMessage message, Map<String, Object> params) throws OAuthSystemException { String header = OAuthUtils.encodeOAuthHeader(params); message.addHeader(OAuth.HeaderType.WWW_AUTHENTICATE, header); re... |
### Question:
FragmentParametersApplier implements OAuthParametersApplier { public OAuthMessage applyOAuthParameters(OAuthMessage message, Map<String, Object> params) throws OAuthSystemException { String messageUrl = message.getLocationUri(); if (messageUrl != null) { StringBuilder url = new StringBuilder(messageUrl); ... |
### Question:
QueryParameterApplier implements OAuthParametersApplier { public OAuthMessage applyOAuthParameters(OAuthMessage message, Map<String, Object> params) { String messageUrl = message.getLocationUri(); if (messageUrl != null) { boolean containsQuestionMark = messageUrl.contains("?"); StringBuffer url = new Str... |
### Question:
OAuthResourceResponse extends OAuthClientResponse { public InputStream getBodyAsInputStream() { if (bodyRetrieved && inputStream == null) { throw new IllegalStateException("Cannot call getBodyAsInputStream() after getBody()"); } bodyRetrieved = true; return inputStream; } OAuthResourceResponse(); String g... |
### Question:
OAuthResourceResponse extends OAuthClientResponse { public String getBody() { if (bodyRetrieved && body == null) { throw new IllegalStateException("Cannot call getBody() after getBodyAsInputStream()"); } if (body == null) { try { body = OAuthUtils.saveStreamAsString(getBodyAsInputStream()); inputStream = ... |
### Question:
OAuthClientResponseFactory { public static OAuthClientResponse createGitHubTokenResponse(String body, String contentType, int responseCode) throws OAuthProblemException { GitHubTokenResponse resp = new GitHubTokenResponse(); resp.init(body, contentType, responseCode); return resp; } static OAuthClientRes... |
### Question:
OAuthClientResponseFactory { public static OAuthClientResponse createJSONTokenResponse(String body, String contentType, int responseCode) throws OAuthProblemException { OAuthJSONAccessTokenResponse resp = new OAuthJSONAccessTokenResponse(); resp.init(body, contentType, responseCode); return resp; } stati... |
### Question:
OAuthClientResponseFactory { public static <T extends OAuthClientResponse> T createCustomResponse(String body, String contentType, int responseCode, Map<String, List<String>> headers, Class<T> clazz) throws OAuthSystemException, OAuthProblemException { OAuthClientResponse resp = OAuthUtils .instantiateCla... |
### Question:
OAuthJSONAccessTokenResponse extends OAuthAccessTokenResponse { @Override public String getAccessToken() { return getParam(OAuth.OAUTH_ACCESS_TOKEN); } OAuthJSONAccessTokenResponse(); @Override String getAccessToken(); @Override String getTokenType(); @Override Long getExpiresIn(); String getScope(); OAut... |
### Question:
OAuthJSONAccessTokenResponse extends OAuthAccessTokenResponse { @Override public String getTokenType() { return getParam(OAuth.OAUTH_TOKEN_TYPE); } OAuthJSONAccessTokenResponse(); @Override String getAccessToken(); @Override String getTokenType(); @Override Long getExpiresIn(); String getScope(); OAuthTok... |
### Question:
OAuthJSONAccessTokenResponse extends OAuthAccessTokenResponse { @Override public Long getExpiresIn() { String value = getParam(OAuth.OAUTH_EXPIRES_IN); return value == null? null: Long.valueOf(value); } OAuthJSONAccessTokenResponse(); @Override String getAccessToken(); @Override String getTokenType(); @Ov... |
### Question:
OAuthJSONAccessTokenResponse extends OAuthAccessTokenResponse { public String getScope() { return getParam(OAuth.OAUTH_SCOPE); } OAuthJSONAccessTokenResponse(); @Override String getAccessToken(); @Override String getTokenType(); @Override Long getExpiresIn(); String getScope(); OAuthToken getOAuthToken();... |
### Question:
OAuthJSONAccessTokenResponse extends OAuthAccessTokenResponse { public String getRefreshToken() { return getParam(OAuth.OAUTH_REFRESH_TOKEN); } OAuthJSONAccessTokenResponse(); @Override String getAccessToken(); @Override String getTokenType(); @Override Long getExpiresIn(); String getScope(); OAuthToken g... |
### Question:
OAuthJSONAccessTokenResponse extends OAuthAccessTokenResponse { protected void setBody(String body) throws OAuthProblemException { try { this.body = body; parameters = JSONUtils.parseJSON(body); } catch (Throwable e) { throw OAuthProblemException.error(OAuthError.CodeResponse.UNSUPPORTED_RESPONSE_TYPE, "I... |
### Question:
GitHubTokenResponse extends OAuthAccessTokenResponse { @Override public String getAccessToken() { return getParam(OAuth.OAUTH_ACCESS_TOKEN); } @Override String getAccessToken(); @Override String getTokenType(); @Override Long getExpiresIn(); @Override String getRefreshToken(); @Override String getScope()... |
### Question:
GitHubTokenResponse extends OAuthAccessTokenResponse { @Override public Long getExpiresIn() { String value = getParam(OAuth.OAUTH_EXPIRES_IN); return value == null? null: Long.valueOf(value); } @Override String getAccessToken(); @Override String getTokenType(); @Override Long getExpiresIn(); @Override St... |
### Question:
GitHubTokenResponse extends OAuthAccessTokenResponse { @Override public String getRefreshToken() { return getParam(OAuth.OAUTH_REFRESH_TOKEN); } @Override String getAccessToken(); @Override String getTokenType(); @Override Long getExpiresIn(); @Override String getRefreshToken(); @Override String getScope... |
### Question:
GitHubTokenResponse extends OAuthAccessTokenResponse { @Override public String getScope() { return getParam(OAuth.OAUTH_SCOPE); } @Override String getAccessToken(); @Override String getTokenType(); @Override Long getExpiresIn(); @Override String getRefreshToken(); @Override String getScope(); @Override O... |
### Question:
OpenIdConnectResponse extends OAuthJSONAccessTokenResponse { public boolean checkId(String issuer, String audience) { if (idToken.getClaimsSet().getIssuer().equals(issuer) && idToken.getClaimsSet().getAudience().equals(audience) && idToken.getClaimsSet().getExpirationTime() < System .currentTimeMillis()) ... |
### Question:
MessageDecryptVerifier { public static Part findPrimaryEncryptedOrSignedPart(Part part, List<Part> outputExtraParts) { if (isPartEncryptedOrSigned(part)) { return part; } Part foundPart; foundPart = findPrimaryPartInAlternative(part); if (foundPart != null) { return foundPart; } foundPart = findPrimaryPar... |
### Question:
BitcoinUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { Matcher matcher = BITCOIN_URI_PATTERN.matcher(text); if (!matcher.find(startPos) || matcher.start() != startPos) { return startPos; } String bitcoinUri = matcher.group(); outputB... |
### Question:
MessageBuilder { final public void buildAsync(Callback callback) { synchronized (callbackLock) { asyncCallback = callback; queuedMimeMessage = null; queuedException = null; queuedPendingIntent = null; } new AsyncTask<Void,Void,Void>() { @Override protected Void doInBackground(Void... params) { buildMessag... |
### Question:
AttachmentInfoExtractor { @WorkerThread public AttachmentViewInfo extractAttachmentInfo(Part part) throws MessagingException { Uri uri; long size; boolean isContentAvailable; if (part instanceof LocalPart) { LocalPart localPart = (LocalPart) part; String accountUuid = localPart.getAccountUuid(); long mess... |
### Question:
MessagePreviewCreator { public PreviewResult createPreview(@NonNull Message message) { if (encryptionDetector.isEncrypted(message)) { return PreviewResult.encrypted(); } return extractText(message); } MessagePreviewCreator(TextPartFinder textPartFinder, PreviewTextExtractor previewTextExtractor,
... |
### Question:
EncryptionDetector { public boolean isEncrypted(@NonNull Message message) { return isPgpMimeOrSMimeEncrypted(message) || containsInlinePgpEncryptedText(message); } EncryptionDetector(TextPartFinder textPartFinder); boolean isEncrypted(@NonNull Message message); }### Answer:
@Test public void isEncrypted_... |
### Question:
MessageDecryptVerifier { public static List<Part> findSignedParts(Part startPart, MessageCryptoAnnotations messageCryptoAnnotations) { List<Part> signedParts = new ArrayList<>(); Stack<Part> partsToCheck = new Stack<>(); partsToCheck.push(startPart); while (!partsToCheck.isEmpty()) { Part part = partsToCh... |
### Question:
AccountCreator { public static DeletePolicy getDefaultDeletePolicy(Type type) { switch (type) { case IMAP: { return DeletePolicy.ON_DELETE; } case POP3: { return DeletePolicy.NEVER; } case WebDAV: { return DeletePolicy.ON_DELETE; } case EWS: { return DeletePolicy.ON_DELETE; } case SMTP: { throw new Illega... |
### Question:
AccountCreator { public static int getDefaultPort(ConnectionSecurity securityType, Type storeType) { switch (securityType) { case NONE: case STARTTLS_REQUIRED: { return storeType.defaultPort; } case SSL_TLS_REQUIRED: { return storeType.defaultTlsPort; } } throw new AssertionError("Unhandled ConnectionSecu... |
### Question:
MessageDecryptVerifier { public static boolean isPartPgpInlineEncrypted(@Nullable Part part) { if (part == null) { return false; } if (!part.isMimeType(TEXT_PLAIN) && !part.isMimeType(APPLICATION_PGP)) { return false; } String text = MessageExtractor.getTextFromPart(part, TEXT_LENGTH_FOR_INLINE_CHECK); if... |
### Question:
MessageDecryptVerifier { @VisibleForTesting static boolean isPartPgpInlineEncryptedOrSigned(Part part) { if (!part.isMimeType(TEXT_PLAIN) && !part.isMimeType(APPLICATION_PGP)) { return false; } String text = MessageExtractor.getTextFromPart(part, TEXT_LENGTH_FOR_INLINE_CHECK); if (TextUtils.isEmpty(text))... |
### Question:
DeferredFileBody implements RawDataBody, SizeAware { @Override public long getSize() { if (file != null) { return file.length(); } if (data != null) { return data.length; } throw new IllegalStateException("Data must be fully written before it can be read!"); } DeferredFileBody(FileFactory fileFactory, Str... |
### Question:
DeferredFileBody implements RawDataBody, SizeAware { @Override public InputStream getInputStream() throws MessagingException { try { if (file != null) { Timber.d("Decrypted data is file-backed."); return new BufferedInputStream(new FileInputStream(file)); } if (data != null) { Timber.d("Decrypted data is ... |
### Question:
DeferredFileBody implements RawDataBody, SizeAware { public File getFile() throws IOException { if (file == null) { writeMemoryToFile(); } return file; } DeferredFileBody(FileFactory fileFactory, String transferEncoding); @VisibleForTesting DeferredFileBody(int memoryBackedThreshold, FileFactory fileFact... |
### Question:
DeferredFileBody implements RawDataBody, SizeAware { @Override public void writeTo(OutputStream out) throws IOException, MessagingException { InputStream inputStream = getInputStream(); IOUtils.copy(inputStream, out); } DeferredFileBody(FileFactory fileFactory, String transferEncoding); @VisibleForTesting... |
### Question:
DeferredFileBody implements RawDataBody, SizeAware { @Override public void setEncoding(String encoding) throws MessagingException { throw new UnsupportedOperationException("Cannot re-encode a DecryptedTempFileBody!"); } DeferredFileBody(FileFactory fileFactory, String transferEncoding); @VisibleForTesting... |
### Question:
DeferredFileBody implements RawDataBody, SizeAware { @Override public String getEncoding() { return encoding; } DeferredFileBody(FileFactory fileFactory, String transferEncoding); @VisibleForTesting DeferredFileBody(int memoryBackedThreshold, FileFactory fileFactory,
String transferEncoding);... |
### Question:
StoreSchemaDefinition implements LockableDatabase.SchemaDefinition { @Override public int getVersion() { return LocalStore.DB_VERSION; } StoreSchemaDefinition(LocalStore localStore); @Override int getVersion(); @Override void doDbUpgrade(final SQLiteDatabase db); }### Answer:
@Test public void getVersion... |
### Question:
StoreSchemaDefinition implements LockableDatabase.SchemaDefinition { @Override public void doDbUpgrade(final SQLiteDatabase db) { try { upgradeDatabase(db); } catch (Exception e) { if (BuildConfig.DEBUG) { throw new Error("Exception while upgrading database", e); } Timber.e(e, "Exception while upgrading d... |
### Question:
MigrationTo60 { static void migratePendingCommands(SQLiteDatabase db) { List<PendingCommand> pendingCommands = new ArrayList<>(); if (columnExists(db, "pending_commands", "arguments")) { for (OldPendingCommand oldPendingCommand : getPendingCommands(db)) { PendingCommand newPendingCommand = migratePendingC... |
### Question:
AttachmentResolver { @VisibleForTesting static Map<String,Uri> buildCidToAttachmentUriMap(AttachmentInfoExtractor attachmentInfoExtractor, Part rootPart) { HashMap<String,Uri> result = new HashMap<>(); Stack<Part> partsToCheck = new Stack<>(); partsToCheck.push(rootPart); while (!partsToCheck.isEmpty()) {... |
### Question:
AutocryptHeader { String toRawHeaderString() { if (!parameters.isEmpty()) { throw new UnsupportedOperationException("arbitrary parameters not supported"); } StringBuilder builder = new StringBuilder(); builder.append(AutocryptHeader.AUTOCRYPT_HEADER).append(": "); builder.append(AutocryptHeader.AUTOCRYPT_... |
### Question:
AutocryptHeaderParser { @Nullable AutocryptHeader getValidAutocryptHeader(Message currentMessage) { String[] headers = currentMessage.getHeader(AutocryptHeader.AUTOCRYPT_HEADER); ArrayList<AutocryptHeader> autocryptHeaders = parseAllAutocryptHeaders(headers); boolean isSingleValidHeader = autocryptHeaders... |
### Question:
EmailProviderCache { public static synchronized EmailProviderCache getCache(String accountUuid, Context context) { if (sContext == null) { sContext = context.getApplicationContext(); } EmailProviderCache instance = sInstances.get(accountUuid); if (instance == null) { instance = new EmailProviderCache(acco... |
### Question:
EmailProviderCache { public String getValueForMessage(Long messageId, String columnName) { synchronized (mMessageCache) { Map<String, String> map = mMessageCache.get(messageId); return (map == null) ? null : map.get(columnName); } } private EmailProviderCache(String accountUuid); static synchronized Emai... |
### Question:
EmailProviderCache { public String getValueForThread(Long threadRootId, String columnName) { synchronized (mThreadCache) { Map<String, String> map = mThreadCache.get(threadRootId); return (map == null) ? null : map.get(columnName); } } private EmailProviderCache(String accountUuid); static synchronized E... |
### Question:
EmailProviderCache { public boolean isMessageHidden(Long messageId, long folderId) { synchronized (mHiddenMessageCache) { Long hiddenInFolder = mHiddenMessageCache.get(messageId); return (hiddenInFolder != null && hiddenInFolder.longValue() == folderId); } } private EmailProviderCache(String accountUuid)... |
### Question:
IdentityHelper { public static Identity getRecipientIdentityFromMessage(Account account, Message message) { Identity recipient = null; for (Address address : message.getRecipients(Message.RecipientType.X_ORIGINAL_TO)) { Identity identity = account.findIdentity(address); if (identity != null) { recipient =... |
### Question:
K9AlarmManager { public void set(int type, long triggerAtMillis, PendingIntent operation) { if (dozeChecker.isDeviceIdleModeSupported() && dozeChecker.isAppWhitelisted()) { setAndAllowWhileIdle(type, triggerAtMillis, operation); } else { alarmManager.set(type, triggerAtMillis, operation); } } @VisibleForT... |
### Question:
K9AlarmManager { public void cancel(PendingIntent operation) { alarmManager.cancel(operation); } @VisibleForTesting K9AlarmManager(AlarmManager alarmManager, DozeChecker dozeChecker); static K9AlarmManager getAlarmManager(Context context); void set(int type, long triggerAtMillis, PendingIntent operation)... |
### Question:
Utility { public static String stripNewLines(String multiLineString) { return multiLineString.replaceAll("[\\r\\n]", ""); } static boolean arrayContains(Object[] a, Object o); static boolean isAnyMimeType(String o, String... a); static boolean arrayContainsAny(Object[] a, Object... o); static String comb... |
### Question:
MailTo { public static boolean isMailTo(Uri uri) { return uri != null && MAILTO_SCHEME.equals(uri.getScheme()); } private MailTo(Address[] toAddresses, Address[] ccAddresses, Address[] bccAddresses, String subject, String body); static boolean isMailTo(Uri uri); static MailTo parse(Uri uri); Address[] ge... |
### Question:
MailTo { public static MailTo parse(Uri uri) throws NullPointerException, IllegalArgumentException { if (uri == null || uri.toString() == null) { throw new NullPointerException("Argument 'uri' must not be null"); } if (!isMailTo(uri)) { throw new IllegalArgumentException("Not a mailto scheme"); } String s... |
### Question:
MailTo { public String getSubject() { return subject; } private MailTo(Address[] toAddresses, Address[] ccAddresses, Address[] bccAddresses, String subject, String body); static boolean isMailTo(Uri uri); static MailTo parse(Uri uri); Address[] getTo(); Address[] getCc(); Address[] getBcc(); String getSu... |
### Question:
MailTo { public String getBody() { return body; } private MailTo(Address[] toAddresses, Address[] ccAddresses, Address[] bccAddresses, String subject, String body); static boolean isMailTo(Uri uri); static MailTo parse(Uri uri); Address[] getTo(); Address[] getCc(); Address[] getBcc(); String getSubject(... |
### Question:
EmailHelper { public static String getDomainFromEmailAddress(String email) { int separatorIndex = email.lastIndexOf('@'); if (separatorIndex == -1 || separatorIndex + 1 == email.length()) { return null; } return email.substring(separatorIndex + 1); } private EmailHelper(); static String getDomainFromEmai... |
### Question:
MessageHelper { public static CharSequence toFriendly(Address address, Contacts contacts) { return toFriendly(address,contacts, QMail.showCorrespondentNames(), QMail.changeContactNameColor(), QMail.getContactNameColor()); } private MessageHelper(final Context context); synchronized static MessageHelper g... |
### Question:
ReplyToParser { public ReplyToAddresses getRecipientsToReplyTo(Message message, Account account) { Address[] candidateAddress; Address[] replyToAddresses = message.getReplyTo(); Address[] fromAddresses = message.getFrom(); if (replyToAddresses.length > 0) { candidateAddress = replyToAddresses; } else { ca... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.