id stringlengths 7 14 | text stringlengths 1 106k |
|---|---|
459348_79 | @Override
public void onPurchasesUpdated(BillingResult result, @Nullable List<Purchase> purchases) {
log("onPurchasesUpdated(" + result + ", " + purchases + ")");
String message;
switch (result.getResponseCode()) {
case OK:
if (purchases != null) {
for (Purchase p : purc... |
459348_80 | @Override
public void onPurchasesUpdated(BillingResult result, @Nullable List<Purchase> purchases) {
log("onPurchasesUpdated(" + result + ", " + purchases + ")");
String message;
switch (result.getResponseCode()) {
case OK:
if (purchases != null) {
for (Purchase p : purc... |
459348_81 | public String getSku() {
return sku;
} |
459348_82 | @StringRes int getTitleRes(String preferenceKey) {
final Integer res = titleResources.get(preferenceKey);
return res == null ? 0 : res;
} |
459348_83 | @StringRes int getTitleRes(String preferenceKey) {
final Integer res = titleResources.get(preferenceKey);
return res == null ? 0 : res;
} |
459348_84 | public boolean invalidateToken(String token) {
if (accountManager != null) {
// USE_CREDENTIALS permission should be enough according to docs
// but some systems require MANAGE_ACCOUNTS
// java.lang.SecurityException: caller uid 10051 lacks android.permission.MANAGE_ACCOUNTS
try {
... |
459348_85 | public boolean invalidateToken(String token) {
if (accountManager != null) {
// USE_CREDENTIALS permission should be enough according to docs
// but some systems require MANAGE_ACCOUNTS
// java.lang.SecurityException: caller uid 10051 lacks android.permission.MANAGE_ACCOUNTS
try {
... |
459348_86 | public void refreshOAuth2Token() throws TokenRefreshException{
final String token = authPreferences.getOauth2Token();
final String refreshToken = authPreferences.getOauth2RefreshToken();
final String name = authPreferences.getOauth2Username();
if (isEmpty(token)) {
throw new TokenRefreshExceptio... |
459348_87 | public void refreshOAuth2Token() throws TokenRefreshException{
final String token = authPreferences.getOauth2Token();
final String refreshToken = authPreferences.getOauth2RefreshToken();
final String name = authPreferences.getOauth2Username();
if (isEmpty(token)) {
throw new TokenRefreshExceptio... |
459348_88 | public static OAuth2Token fromJSON(String string) throws IOException {
try {
Object value = new JSONTokener(string).nextValue();
if (value instanceof JSONObject) {
return fromJSON((JSONObject) value);
} else {
throw new IOException("Invalid JSON data: "+value);
... |
459348_89 | public static OAuth2Token fromJSON(String string) throws IOException {
try {
Object value = new JSONTokener(string).nextValue();
if (value instanceof JSONObject) {
return fromJSON((JSONObject) value);
} else {
throw new IOException("Invalid JSON data: "+value);
... |
459348_90 | public static OAuth2Token fromJSON(String string) throws IOException {
try {
Object value = new JSONTokener(string).nextValue();
if (value instanceof JSONObject) {
return fromJSON((JSONObject) value);
} else {
throw new IOException("Invalid JSON data: "+value);
... |
459348_91 | public String getEmail() {
return isEmailUnknown() ? getUnknownEmail(number) : email;
} |
459348_92 | public String getName() {
return !TextUtils.isEmpty(name) ? name : getNumber();
} |
459348_93 | public String getNumber() {
return (TextUtils.isEmpty(number) || "-1".equals(number) || "-2".equals(number)) ? "Unknown" : number;
} |
459348_94 | public boolean isUnknown() {
return _id <= 0;
} |
459348_95 | public boolean isUnknown() {
return _id <= 0;
} |
459348_96 | public String getNumber() {
return (TextUtils.isEmpty(number) || "-1".equals(number) || "-2".equals(number)) ? "Unknown" : number;
} |
459348_97 | public String getEmail() {
return isEmailUnknown() ? getUnknownEmail(number) : email;
} |
459348_98 | public void setHeaders(final Message message,
final Map<String, String> msgMap,
final DataType dataType,
final String address,
final @NonNull PersonRecord contact,
final Date sentDate,
... |
459348_99 | public void setHeaders(final Message message,
final Map<String, String> msgMap,
final DataType dataType,
final String address,
final @NonNull PersonRecord contact,
final Date sentDate,
... |
4597158_0 | public static <V, E> UndirectedGraph<V, E> undirectedSubgraph(Graph<V, E> sup, Collection<V> nodes)
{
UndirectedGraph<V, E> sub = new UndirectedSparseGraph<V, E>();
List<V> nList = new ArrayList<V> (nodes);
for (int i = 0; i < nList.size(); i++)
for (int j = i + 1; j < nList.size(); j++)
if (sup.isNeighbor(... |
4597158_1 | public static <V, E> double clusteringCoefficient(Graph<V, E> graph)
{
long numPaths = 0, numClosed = 0;
List<V> path = new ArrayList<V>(2);
for(V one : graph.getVertices())
{
path.clear();
path.add(null);
path.add(null);
path.add(null);
path.set(0, one);
for(V two : graph.getNeighbors(one))
{... |
4597158_2 | public static <L> DirectedGraph<Vertex<L>, Edge<L>> copyDirectedGraph(DirectedGraph<Vertex<L>, Edge<L>> graph) {
DirectedGraph<Vertex<L>, Edge<L>> newGraph = new DirectedSparseMultigraph<Vertex<L>, Edge<L>>();
Map<Vertex<L>, Vertex<L>> nodes = new HashMap<Vertex<L>, Vertex<L>>();
for (Vertex<L> vertex : graph.getVer... |
4597760_0 | String addHandlerParamJson( JClassType type ) {
StringBuilder json = new StringBuilder( 128 );
json.append( '"' ).append( '{' );
JMethod[] methods = type.getMethods();
for ( JMethod eventMethod : methods ) {
if ( eventMethod.isPublic()
&& !eventMethod.isStatic()
&& ( eventMethod.isConstructor() ... |
4597760_1 | String addHandlerParamJson( JClassType type ) {
StringBuilder json = new StringBuilder( 128 );
json.append( '"' ).append( '{' );
JMethod[] methods = type.getMethods();
for ( JMethod eventMethod : methods ) {
if ( eventMethod.isPublic()
&& !eventMethod.isStatic()
&& ( eventMethod.isConstructor() ... |
4597760_2 | public static boolean start( RootDoc root ) {
final String outputPath = getOutputPath( root.options() );
final DocProcessorWrapper docProcessor = new DocProcessorWrapper();
final ResourceDocType result = new ResourceDocType();
final ClassDoc[] classes = root.classes();
for ( ClassDoc classDoc : classes ) {
... |
4597760_3 | public DataProperty( final String name, final Object value, final DataPropertyType type ) {
this.name = name;
this.value = value;
this.type = type;
} |
4597760_4 | public DataNode( final String name ) {
super();
this.name = name;
} |
4597760_5 | public RepositoryFile( Serializable id, String name, boolean folder, Boolean hidden, Boolean schedulable,
boolean versioned,
Serializable versionId, String path, Date createdDate, Date lastModifiedDate, boolean locked, String lockOwner,
String lockMessage, Date lockDate, String locale, String title, String ... |
4597760_6 | @Override
public boolean equals( Object obj ) {
if ( this == obj ) {
return true;
}
if ( obj == null ) {
return false;
}
if ( getClass() != obj.getClass() ) {
return false;
}
RepositoryFile other = (RepositoryFile) obj;
if ( id == null ) {
if ( other.id != null ) {
return false;
... |
4597760_7 | public VersionSummary( final Serializable id, final Serializable versionedFileId, final boolean aclOnlyChange,
final Date date, final String author, final String message, final List<String> labels ) {
super();
notNull( id );
notNull( versionedFileId );
notNull( date );
hasText( author );
notNull( labels... |
4597760_8 | @Override
public boolean equals( Object obj ) {
if ( this == obj ) {
return true;
}
if ( obj == null ) {
return false;
}
if ( getClass() != obj.getClass() ) {
return false;
}
VersionSummary other = (VersionSummary) obj;
if ( id == null ) {
if ( other.id != null ) {
return false;
... |
4597760_9 | public RepositoryRequest() {
} |
4600110_0 | public static FsSettings fromJson(String json) throws IOException {
return prettyMapper.readValue(json, FsSettings.class);
} |
4600110_1 | public static FsSettings fromYaml(String yaml) throws IOException {
return ymlMapper.readValue(yaml, FsSettings.class);
} |
4600110_2 | public static FsSettings fromJson(String json) throws IOException {
return prettyMapper.readValue(json, FsSettings.class);
} |
4600110_3 | public static FsSettings fromYaml(String yaml) throws IOException {
return ymlMapper.readValue(yaml, FsSettings.class);
} |
4600110_4 | public static boolean validateSettings(Logger logger, FsSettings settings, boolean rest) {
if (settings.getFs() == null || settings.getFs().getUrl() == null) {
logger.warn("`url` is not set. Please define it. Falling back to default: [{}].", Fs.DEFAULT_DIR);
if (settings.getFs() == null) {
... |
4600110_5 | public static String getOwnerName(final File file) {
try {
final Path path = Paths.get(file.getAbsolutePath());
final FileOwnerAttributeView ownerAttributeView = Files.getFileAttributeView(path, FileOwnerAttributeView.class);
return ownerAttributeView != null ? ownerAttributeView.getOwner().... |
4600110_6 | public static String getGroupName(final File file) {
if (OsValidator.WINDOWS) {
logger.trace("Determining 'group' is skipped for file [{}] on [{}]", file, OsValidator.OS);
return null;
}
try {
final Path path = Paths.get(file.getAbsolutePath());
final PosixFileAttributes posi... |
4600110_7 | public static int getFilePermissions(final File file) {
if (OsValidator.WINDOWS) {
logger.trace("Determining 'group' is skipped for file [{}] on [{}]", file, OsValidator.OS);
return -1;
}
try {
final Path path = Paths.get(file.getAbsolutePath());
PosixFileAttributes attrs = F... |
4600110_8 | public static boolean isFileSizeUnderLimit(ByteSizeValue limit, long fileSizeAsBytes) {
boolean result = true;
if (limit != null) {
// We check the file size to avoid indexing too big files
ByteSizeValue fileSize = new ByteSizeValue(fileSizeAsBytes);
int compare = fileSize.compareTo(limi... |
4600110_9 | public static String extractMajorVersion(String version) {
return version.split("\\.")[0];
} |
4603135_0 | public java.util.Map<String,Object> getParameters() {
return (_parameters);
} |
4603135_1 | public java.util.Map<String,Object> getParameters() {
return (_parameters);
} |
4603135_2 | public java.io.Serializable process(String source,
java.io.Serializable event, int retriesLeft) throws Exception {
java.io.Serializable ret=null;
if (LOG.isLoggable(Level.FINEST)) {
LOG.finest("Process event '"+event+" from source '"+source
+"' on MVEL Event Processor '"... |
4603135_3 | public List<ActivityType> getActivityTypes(Context context) throws Exception {
if (context == null) {
throw new Exception(java.util.PropertyResourceBundle.getBundle(
"activity-store-elasticsearch.Messages").getString("ACTIVITY-STORE-ELASTICSEARCH-4"));
}
RefreshRequ... |
4603135_4 | public List<ActivityType> query(QuerySpec query) throws Exception {
if (LOG.isLoggable(Level.FINEST)) {
LOG.finest("Query=" + query);
}
if (query.getFormat() == null || !query.getFormat().equalsIgnoreCase("jpql")) {
throw new IllegalArgumentException(MessageFormat.format(java.util.PropertyRe... |
4603135_5 | public List<ActivityType> query(QuerySpec query) throws Exception {
if (LOG.isLoggable(Level.FINEST)) {
LOG.finest("Query=" + query);
}
if (query.getFormat() == null || !query.getFormat().equalsIgnoreCase("jpql")) {
throw new IllegalArgumentException(MessageFormat.format(java.util.PropertyRe... |
4603135_6 | protected static boolean evaluate(ActivityType activity, QuerySpec query) {
boolean ret=false;
if (query.getFormat() != null
&& query.getFormat().equalsIgnoreCase("mvel")) {
Object result=MVEL.eval(query.getExpression(), activity);
if (result instanceof Boolean... |
4603135_7 | protected static boolean evaluate(ActivityType activity, QuerySpec query) {
boolean ret=false;
if (query.getFormat() != null
&& query.getFormat().equalsIgnoreCase("mvel")) {
Object result=MVEL.eval(query.getExpression(), activity);
if (result instanceof Boolean... |
4603135_8 | public static byte[] serializeActivityUnit(ActivityUnit act) throws Exception {
byte[] ret=null;
java.io.ByteArrayOutputStream baos=new java.io.ByteArrayOutputStream();
MAPPER.writeValue(baos, act);
ret = baos.toByteArray();
baos.close();
return (ret);
} |
4603135_9 | public static byte[] serializeActivityUnitList(java.util.List<ActivityUnit> activities) throws Exception {
byte[] ret=null;
java.io.ByteArrayOutputStream baos=new java.io.ByteArrayOutputStream();
MAPPER.writeValue(baos, activities);
ret = baos.toByteArray();
baos.close();
... |
4604367_0 | public static StreamingOutput buildResponseOfDomLR(final File storagePath,
final List<String> availableRes) {
final StreamingOutput sOutput = new StreamingOutput() {
@Override
public void write(final OutputStream output) throws IOException,
WebApplicationException {
Document document;
try {
documen... |
4604367_1 | public static boolean checkExistingResource(final File storagePath,
final String resource) {
final File resourceFile = new File(new File(storagePath,
DatabaseConfiguration.Paths.DATA.getFile().getName()), resource);
boolean isExisting;
if (resourceFile.getTotalSpace() > 0) {
isExisting = true;
} else {
isE... |
4604367_2 | public StringBuilder createStringBuilderObject() {
return new StringBuilder();
} |
4604367_3 | public static XMLSerializer serializeXML(final Session session,
final OutputStream out, final boolean serializeXMLDec,
final boolean serializeRest, final Integer revision) {
final XMLSerializerBuilder builder;
if (revision == null) builder = new XMLSerializerBuilder(session, out);
else builder = new XMLSerialize... |
4604367_4 | public static void shredInputStream(final NodeWriteTrx wtx,
final InputStream value, final Insert child) {
final XMLInputFactory factory = XMLInputFactory.newInstance();
factory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
XMLEventReader parser;
try {
parser = factory.createXMLEventReader(value);
} catch (... |
4604367_5 | public static XMLEventReader createReader(
final InputStream inputStream) throws IOException,
XMLStreamException {
final XMLInputFactory factory = XMLInputFactory.newInstance();
factory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
return factory.createXMLEventReader(inputStream);
} |
4604367_6 | public RestXPathProcessor(final File pStoragePath) {
mStoragePath = pStoragePath;
} |
4604367_7 | public OutputStream getXpathResource(final String resourceName,
final String xpath, final boolean nodeid, final Integer revision,
final OutputStream output, final boolean wrapResult) throws IOException,
SirixException {
// work around because of query root char '/'
String qQuery = xpath;
if (xpath.charAt(0) ==... |
4604367_8 | public OutputStream getXpathResource(final String resourceName,
final String xpath, final boolean nodeid, final Integer revision,
final OutputStream output, final boolean wrapResult) throws IOException,
SirixException {
// work around because of query root char '/'
String qQuery = xpath;
if (xpath.charAt(0) ==... |
4604367_9 | public StartServer(final int sPort) throws Exception {
System.setProperty("org.jaxrx.systemPath",
"org.sirix.service.jaxrx.implementation.sirixMediator");
System.setProperty("org.jaxrx.systemName", "sirix");
jetty = new JettyServer(sPort);
} |
4605969_0 | public static Point2D.Double convertToLatLon(double x, double y) {
return convertToLatLon(x, y, new Point2D.Double());
} |
4605969_1 | public static Point2D.Double convertFromLatLon(double lat, double lon) {
return convertFromLatLon(lat, lon, new Point2D.Double());
} |
4605969_2 | public boolean isDirectlyLinked(BerthStepIdentifier next) {
if (toBerthId.equals(next.getFromBerthId())) {
return true;
}
Id fromA = parseId(fromBerthId);
Id fromB = parseId(toBerthId);
Id toA = parseId(next.fromBerthId);
Id toB = parseId(next.toBerthId);
if (fromA.areaId.equals(toA.areaId)) {
ret... |
4605969_3 | public boolean isDirectlyLinked(BerthStepIdentifier next) {
if (toBerthId.equals(next.getFromBerthId())) {
return true;
}
Id fromA = parseId(fromBerthId);
Id fromB = parseId(toBerthId);
Id toA = parseId(next.fromBerthId);
Id toB = parseId(next.toBerthId);
if (fromA.areaId.equals(toA.areaId)) {
ret... |
4605969_4 | public void updateLocation(Map<Location, Integer> locationsAndWeights,
Location location, double epsilon) {
if (locationsAndWeights.size() <= 1) {
return;
}
computeCentroid(locationsAndWeights.keySet(), location);
Location maxLocation = null;
int maxWeight = 0;
for (Map.Entry<Location, Integer> entr... |
4605969_5 | public void updateLocation(Map<Location, Integer> locationsAndWeights,
Location location, double epsilon) {
if (locationsAndWeights.size() <= 1) {
return;
}
computeCentroid(locationsAndWeights.keySet(), location);
Location maxLocation = null;
int maxWeight = 0;
for (Map.Entry<Location, Integer> entr... |
4606342_0 | @Override
public boolean isValid(String str, ConstraintValidatorContext constraintValidatorContext) {
//ldap(s)://address:port
/*
^ldap(s?)\:\/\/
[0-9a-zA-Z]
([-.\w]*[0-9a-zA-Z])*
(:(0-9)*)*(\/?)$
*/
return StringUtil.isNullOrWhitespace(str) || pattern.matcher(str).matches();
} |
4606342_1 | public static boolean validateVcResourceName(final String input) {
return match(input, Constants.VC_RESOURCE_NAME_PATTERN);
} |
4606342_2 | public static boolean validateResourceName(final String input) {
return match(input, Constants.RESOURCE_NAME_PATTERN);
} |
4606342_3 | public static boolean validateDistroName(final String input) {
return match(input, Constants.DISTRO_NAME_PATTERN);
} |
4606342_4 | public static boolean validateClusterName(final String input) {
return match(input, Constants.CLUSTER_NAME_PATTERN);
} |
4606342_5 | public static boolean validateNodeGroupName(final String input) {
return match(input, Constants.NODE_GROUP_NAME_PATTERN);
} |
4606342_6 | public static boolean validataPathInfo(final String input) {
return match(input, Constants.REST_REQUEST_PATH_INFO_PATTERN);
} |
4606342_7 | public static boolean validateVcDataStoreNames(List<String> names) {
if (names == null || names.isEmpty()) {
return false;
}
for (String name : names) {
if (!validateVcDataStoreName(name)) {
return false;
}
}
return true;
} |
4606342_8 | public static String getDatastoreJavaPattern(String pattern) {
return escapePattern(pattern).replace("?", ".").replace("*", ".*");
} |
4606342_9 | public static long makeVmMemoryDivisibleBy4(long memory) {
if ((memory % 4) == 0) {
return memory;
} else {
long temp = memory / 4;
return temp * 4;
}
} |
4610430_0 | @Override
public Optional<String> getLanguage(Context context, Optional<Result> result) {
Cookie defaultCookie = generateNinjaLanguageCookie();
// Step 1: Determine language from result.
// Result always has priority over context and will overwrite context.
if (result.isPresent()) {
... |
4610430_1 | @Override
public Result setLanguage(String locale, Result result) {
Cookie defaultLangCookie = generateNinjaLanguageCookie();
Cookie cookie = Cookie.builder(defaultLangCookie).setValue(locale).build();
result.addCookie(cookie);
return result;
} |
4610430_2 | @Override
public void clearLanguage(Result result) {
Cookie defaultLangCookie = generateNinjaLanguageCookie();
result.unsetCookie(defaultLangCookie.getName());
} |
4610430_3 | @Override
public boolean isLanguageDirectlySupportedByThisApplication(String language) {
String applicationLanguages = ninjaProperties.get(NinjaConstant.applicationLanguages);
Iterable<String> languages = Splitter.on(",").trimResults().split(applicationLanguages);
for (String applicationLanguage :... |
4610430_4 | @Override
public Locale getLocaleFromStringOrDefault(Optional<String> language) {
if (language.isPresent()) {
return Locale.forLanguageTag(language.get());
} else {
return Locale.forLanguageTag(DEFAULT_LANGUAGE);
}
} |
4610430_5 | @Override
public Locale getLocaleFromStringOrDefault(Optional<String> language) {
if (language.isPresent()) {
return Locale.forLanguageTag(language.get());
} else {
return Locale.forLanguageTag(DEFAULT_LANGUAGE);
}
} |
4610430_6 | @Override
public Optional<String> get(String key,
Context context,
Optional<Result> result,
Object... parameter) {
Optional<String> language = lang.getLanguage(context, result);
return get(key, language, parameter);
} |
4610430_7 | @Override
public Optional<String> get(String key,
Context context,
Optional<Result> result,
Object... parameter) {
Optional<String> language = lang.getLanguage(context, result);
return get(key, language, parameter);
} |
4610430_8 | @Override
public Optional<String> get(String key,
Context context,
Optional<Result> result,
Object... parameter) {
Optional<String> language = lang.getLanguage(context, result);
return get(key, language, parameter);
} |
4610430_9 | @Override
public String getWithDefault(String key,
String defaultMessage,
Context context,
Optional<Result> result,
Object... params) {
Optional<String> language = lang.getLanguage(context, resul... |
4614129_0 | public static byte[] toByteArray(String oid) throws TLVException {
{
return new ASN1ObjectIdentifier(oid).getEncoded();
atch (IllegalArgumentException | IOException ex) {
throw new TLVException("Failed to parse OID.", ex);
} |
4614129_1 | public static String toString(byte[] oid) throws TLVException {
{
TLV obj;
try {
j = TLV.fromBER(oid);
} catch (TLVException ex) {
read as plain value
j = new TLV();
j.setTagNum(0x06);
j.setValue(oid);
}
return ASN1ObjectIdentifier.getInstance(obj.toBER()).getId();
atch (IllegalArgumentException ex) {
throw new... |
4614129_2 | public static String toString(byte[] oid) throws TLVException {
{
TLV obj;
try {
j = TLV.fromBER(oid);
} catch (TLVException ex) {
read as plain value
j = new TLV();
j.setTagNum(0x06);
j.setValue(oid);
}
return ASN1ObjectIdentifier.getInstance(obj.toBER()).getId();
atch (IllegalArgumentException ex) {
throw new... |
4614129_3 | public static byte[] getValue(String oid) throws TLVException {
{
ASN1ObjectIdentifier oidObj = new ASN1ObjectIdentifier(oid);
TLV oidTlv = TLV.fromBER(oidObj.getEncoded());
return oidTlv.getValue();
atch (IllegalArgumentException | IOException ex) {
throw new TLVException("Failed to parse OID.", ex);
} |
4614129_4 | public static CertificateDescription getInstance(Object obj) throws CertificateException {
(obj instanceof CertificateDescription) {
return (CertificateDescription) obj;
lse if (obj instanceof ASN1Set) {
return new CertificateDescription((ASN1Sequence) obj);
lse if (obj instanceof byte[]) {
try {
turn new Certificat... |
4614129_5 | public static void verfiy(CHAT firstCHAT, CHAT secondCHAT) throws GeneralSecurityException {
{
byte[] firstCHATBytes = firstCHAT.toByteArray();
byte[] secondCHATBytes = secondCHAT.toByteArray();
for (int i = 0; i < firstCHATBytes.length * 8; i++) {
(ByteUtils.isBitSet(i, secondCHATBytes) && !ByteUtils.isBitSet(i, ... |
4614129_6 | public static void verfiy(CHAT firstCHAT, CHAT secondCHAT) throws GeneralSecurityException {
{
byte[] firstCHATBytes = firstCHAT.toByteArray();
byte[] secondCHATBytes = secondCHAT.toByteArray();
for (int i = 0; i < firstCHATBytes.length * 8; i++) {
(ByteUtils.isBitSet(i, secondCHATBytes) && !ByteUtils.isBitSet(i, ... |
4614129_7 | ; |
4614129_8 | ; |
4614129_9 | ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.