id stringlengths 7 14 | text stringlengths 1 37.2k |
|---|---|
23003065_38 | public static FlumeSpoutConfiguration from(Configuration config) throws F2SConfigurationException {
FlumeSpoutConfiguration result = new FlumeSpoutConfiguration();
try {
result.setLocationServiceFactoryClassName(config.getString(LOCATION_SERVICE_FACTORY_CLASS,
LOCATION_SERVICE_FACTORY_CLASS_DEFAULT));
... |
23020824_110 | static Stock toStock(yahoofinance.Stock yahooFinanceStock) {
StockQuote quote = yahooFinanceStock.getQuote();
return new Stock(
yahooFinanceStock.getSymbol(),
yahooFinanceStock.getName(),
new PriceInfo(
quote.getPrice(),
quote.getChangeInPercent(),
nullSafe(quote.getAvgVolume())),
new Book(
quote.... |
23040996_0 | @Override
public int hashCode() {
JobKey key = getKey();
return key == null ? 0 : getKey().hashCode();
} |
23043801_3 | public static void init(DebugOutput... outputs) {
final DebugOutput out;
final int length = outputs != null
? outputs.length
: 0;
if (length == 0) {
out = null;
} else {
if (length == 1) {
out = outputs[0];
} else {
out = DebugOut... |
23054806_1 | public String getIdentity(String clientId, String clientSecret, File refreshTokenFile, String requesterIdentity) throws IOException, InterruptedException {
ThreadContext.push("getIdentity");
Marker m = new Marker("getIdentity");
try {
// VT: FIXME: Add sanity checks for clientId
// VT: FI... |
23062279_875 | @Nonnull
public String createPasswordHash (@Nonnull final IPasswordSalt aSalt, @Nonnull final String sPlainTextPassword)
{
ValueEnforcer.notNull (aSalt, "Salt");
ValueEnforcer.isInstanceOf (aSalt, PasswordSaltBCrypt.class, "Salt");
ValueEnforcer.notNull (sPlainTextPassword, "PlainTextPassword");
return BCrypt.... |
23063531_1 | public WxCpXmlOutMessage route(final WxCpXmlMessage wxMessage) {
if (isDuplicateMessage(wxMessage)) {
// 如果是重复消息,那么就不做处理
return null;
}
final List<WxCpMessageRouterRule> matchRules = new ArrayList<WxCpMessageRouterRule>();
// 收集匹配的规则
for (final WxCpMessageRouterRule rule : rules) {
if (rule.test(... |
23068086_0 | public Node parse(String xml) {
Document doc = parseXml(xml);
org.w3c.dom.Node sourceNode = doc.getDocumentElement();
Node targetNode = transform(sourceNode);
return targetNode;
} |
23088989_8 | public static List<IndexMetadata> parseIndexMetadata(String serializedIndexMetadata) throws IOException {
ObjectMapper jsonMapper = new DefaultIndexMapper();
TypeReference<List<IndexMetadata>> typeRef = new TypeReference<List<IndexMetadata>>() {};
return jsonMapper.readValue(serializedIndexMetadata, typeRef... |
23092563_5 | void render(Canvas canvas, SlidrPosition position, Paint paint) {
switch (position) {
case LEFT:
renderLeft(canvas, paint);
break;
case RIGHT:
renderRight(canvas, paint);
break;
case TOP:
renderTop(canvas, paint);
break;... |
23095954_4 | @Override
@SuppressLint("NewApi") // Async will only be true when the API is available to call.
public Disposable scheduleDirect(Runnable run, long delay, TimeUnit unit) {
if (run == null) throw new NullPointerException("run == null");
if (unit == null) throw new NullPointerException("unit == null");
run =... |
23112526_19 | public void execute(DisposableObserver<T> observer, Params params) {
Preconditions.checkNotNull(observer);
final Observable<T> observable = this.buildUseCaseObservable(params)
.subscribeOn(Schedulers.from(threadExecutor))
.observeOn(postExecutionThread.getScheduler());
addDisposable(observable.subscri... |
23123512_33 | public static List<CtField> getAllInjectedFieldsForAnnotation(CtClass clazz,
Class<? extends Annotation> annotationClazz) {
List<CtField> result = new ArrayList<CtField>();
CtField[] allFields = clazz.getDeclaredFields();
for (CtField field : allFields) {
if (field.hasAnnotation(annotationClazz)) {
... |
23127683_0 | public static void main(String[] args) {
ApplicationContext ctx = SpringApplication.run(Application.class, args);
} |
23175652_9 | Filters getFilters() {
turn this.filters
computeIfAbsent(
this.getClass(),
(klass) -> {
final FilterScanner scanner = new FilterScanner();
scanner.scan(klass);
return scanner.build();
});
} |
23192978_2 | @Override
public ConsumptionEndPoint getConsumptionEndPoint(final String endPointName) {
throw new NotImplementedException("LogFile consumption endpoint is not supported");
} |
23206290_28 | public static Applier fromSource(CharSequence source, EndPosTable endPositions) {
return new Applier(source, endPositions);
} |
23227907_129 | @Override
public PagedMetadata<LanguageDto> getLanguages(RestListRequest requestList) {
try {
List<Lang> sysLangs = this.getLangManager().getAssignableLangs();
List<LanguageDto> langs = this.getLanguageDtoBuilder().convert(sysLangs);
langs = new LanguageRequestListProcessor(requestL... |
23229174_0 | public boolean isMD5(String test) {
return test.matches("[a-fA-F0-9]{32}");
} |
23234361_0 | public String process(final Reader is) throws RecognitionException,
IOException, Exception {
CommonTokenStream tokenStream = createTokenStream(is);
if (this.numSyntaxErrors > 0) {
throw new Exception("Errors for Lexer. Translation aborted.");
}
CommonTree tree = parse(tokenStream);
if (this.numSynt... |
23254327_3 | public int nextToken() throws IOException {
if (mPushBack) {
mPushBack = false;
return ttype;
}
read();
return ttype;
} |
23257998_5 | @Override
public String getProperty(String key) {
return (String) mConfiguration.getProperty(key);
} |
23260390_75 | public void setProperty(Object target, String property, Object value) {
NestedResolver resolver = new NestedResolver(target, property);
if (value instanceof String) {
convertStringValue(resolver.getNestedTarget(), resolver.getProperty(), (String) value);
} else {
setObjectValue(resolver.getNestedTarget(), resol... |
23292541_0 | public String sayHello(final String name) {
return "Hello, " + name;
} |
23304527_39 | @Nullable
public static CSSSimpleValueWithUnit getValueWithUnit (@Nullable final String sCSSValue)
{
return getValueWithUnit (sCSSValue, true);
} |
23338118_10 | @Override
public void shutdown() {
queueCallBackHandler.queueShutdown();
} |
23342644_5 | protected int plusMonths() {
return 6;
} |
23357238_13 | public static rx.functions.Func1<Event, Boolean> parse(String query) {
QueryLexer tokenSource = new QueryLexer(new ANTLRStringStream(query));
QueryParser queryParser = new QueryParser(new CommonTokenStream(tokenSource));
try {
CommonTree tree = (CommonTree) queryParser.expr().getTree();
retu... |
23358011_19 | @Nullable
public static SchematronOutputType applySchematron (@Nonnull final ISchematronResource aSchematron, @Nonnull final IReadableResource aXML)
{
ValueEnforcer.notNull (aSchematron, "SchematronResource");
ValueEnforcer.notNull (aXML, "XMLSource");
try
{
// Apply Schematron on XML
return aSchematro... |
23374263_2 | public IConstr[] it(int y, int x1, int x2) throws ContradictionException {
IConstr[] constrs = new IConstr[3];
IVecInt clause = new VecInt(5);
// y <=> (x1 -> x2)
// y -> (x1 -> x2)
clause.push(-y).push(-x1).push(x2);
constrs[0] = processClause(clause);
clause.clear();
// y <- (x1 ... |
23425317_3 | public Optional<String> render(final Job job) {
final Map<String, Object> vals = getValues();
vals.put("job", job);
return render("job.ftl", vals);
} |
23437032_19 | @Override
public Object convert(String value, Context context) {
return Short.valueOf(value);
} |
23441735_17 | public static void onNHPCHandleMaps(NetHandlerPlayClient sender,
SPacketMaps packet) {
listener.onNHPCHandleMaps(sender, packet);
} |
23442872_21 | public void addListener(MessageListener<T> messageListener, int limit) {
if (DEBUG) {
log.info("Adding listener.");
}
synchronized (mutex) {
EventDispatcher<MessageListener<T>> eventDispatcher =
messageListeners.add(messageListener, limit);
if (latchMode && latchedMessage != null) {
even... |
23466307_61 | protected String getParam(String param)
{
if (hasParam(param))
{
return param;
}//end if
else
{
return null;
}//end else
} |
23479380_0 | public static boolean bitSet(final AtomicBuffer buffer, final int offset, final int bitIndex)
{
return 0 != (buffer.getByte(offset) & (1 << bitIndex));
} |
23487016_12 | @Override
public <BEAN, R, P> Getter<BEAN, R, P> buildGetter(final Field field, ValueProcessor<R, P> valueProcessor) {
return new MethodHandlerGetter<>(field, valueProcessor);
} |
23491281_1 | public static String getEmail(String accessToken) throws Exception {
final String response = get("https://api.github.com/user/emails?access_token", accessToken);
ObjectMapper objectMapper = new ObjectMapper();
final ArrayList<Map<String, Object>> emailList = objectMapper.readValue(response, ArrayList.class)... |
23502577_223 | @NonNull
public static List<Object> unmodifiableNonNullList(@Nullable Object[] args) {
return args == null || args.length == 0
? emptyList()
: unmodifiableList(asList(args));
} |
23505879_79 | @Override
public double getDouble(long i) {
return super.getFloat(i);
} |
23556341_8 | public static boolean shouldSync(Rp rp) {
if (rp == null || !rp.isSyncClientFromOp())
return false;
if (rp.getLastSynced() == null)
return true;
if ((Utils.addTimeToDate(rp.getLastSynced(), rp.getSyncClientPeriodInSeconds(), Calendar.SECOND).getTime() < new Date().getTime()))
retur... |
23597915_2 | public void renameFile(File orig, File dest) throws MojoExecutionException {
try {
Files.move(orig.toPath(), dest.toPath(), REPLACE_EXISTING);
} catch (IOException e) {
throw new MojoExecutionException(String.format("Could not rename %1s to %2s",
orig.getAbsolutePath(), dest.getA... |
23610469_295 | public static boolean isArray(Type type)
{
Utils.checkNotNull(type, "type");
boolean array;
if (type instanceof Class)
{
array = ((Class<?>) type).isArray();
}
else if (type instanceof GenericArrayType)
{
array = true;
}
else
{
array = false;
}
return array;
} |
23615757_18 | @Override
public void clear() {
entryTimes.clear();
keys.clear();
entries.clear();
} |
23623214_56 | public static LightblueClientConfiguration fromObject(Properties properties) {
LightblueClientConfiguration config = new LightblueClientConfiguration();
config.setCaFilePath(properties.getProperty(CA_FILE_PATH_KEY));
config.setCertFilePath(properties.getProperty(CERT_FILE_PATH_KEY));
config.setCertPass... |
23626591_5 | public static boolean isPK(Filter filter) {
return pkFilters.containsAll(filter.getOperations());
} |
23653549_0 | public void initialize(final int appId, final String appSecret, final String bridgeId,
final ServerInfo serverInfo, final CallStatsInitListener callStatsInitListener) {
if (StringUtils.isBlank(appSecret)) {
logger.error("intialize: Arguments cannot be null ");
throw new IllegalArgumentException("intialize... |
23680695_16 | public void optimizeIndecies(@Nonnull final List<String> intFields,
@Nonnull final List<String> stringFields,
@Nonnull final FlamdexWriter w) throws IOException,
ImhotepOutOfMemoryException {
final ... |
23686634_8 | @Override
public final T get() {
try {
previous = load();
} catch (Exception e) {
LoggerFactory.getLogger(LoadingSupplier.class).error("Error looking up supplier value!", e);
}
return previous;
} |
23703244_2 | public String getCurrentItem() {
if (monitor == null) {
return null;
}
Object currentItem = monitor.getCurrentItem();
if (currentItem == null) {
return null;
}
return currentItem.toString();
} |
23714731_0 | public boolean hasNDistinctWitnesses(P predicate, Integer numOfWitnesses) {
// generate as many witnesses as requested
for (int witnessID = 0; witnessID < numOfWitnesses; witnessID++) {
try {
// generate a witness for the predicate
S witness = generateWitness(predicate);
... |
23737510_18 | public PartialUriTemplateComponents expand(Object... parameters) {
List<String> variableNames = getVariableNames();
Map<String, Object> parameterMap = new LinkedHashMap<String, Object>();
int i = 0;
for (String variableName : variableNames) {
if (i < parameters.length) {
parameterMa... |
23744385_373 | public Number getValue(int index) {
return getRawDataItem(index).getValue();
} |
23750297_2 | @Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletResponse httpServletResponse = (HttpServletResponse)response;
HttpServletRequest httpServletRequest = (HttpServletRequest)request;
MainError mainError = null;
Local... |
23771701_0 | @Override
public Object readItem() {
while (parser.hasNext()) {
Auction auction = new Auction();
if (readAuctionItem(auction)) {
return auction;
}
}
return null;
} |
23786714_6 | protected void handleDeeplink(Bundle bundle) {
if (bundle != null) {
String url = bundle.getString(SWRVE_FB_TARGET_URL);
if (SwrveHelper.isNotNullOrEmpty(url)) {
Uri data = Uri.parse(url);
this.handleDeeplink(data, SWRVE_AD_REENGAGE);
return;
}
St... |
23803268_8 | public DataState readFuzzySnapshot() throws CRCValidationException, IOException {
DataTree dt = new DataTree();
Map<Long, Integer> sessions = new HashMap<Long, Integer>();
InputStream snapIS = null;
CheckedInputStream crcIn = null;
try {
logger.info("Reading snapshot " + snapshotFile);
... |
23813195_25 | public static String friendlyName(Enum<?>[] arguments) {
return friendlyName(arguments, new Annotation[0][0]);
} |
23813803_2 | @Doc("Sign up a user")
@GET
@Path("/signup")
@HandleErrors({
@HandleError(code = 20000,
exception = UsernameDuplicateException.class,
description = "Username duplicate")
})
public User signup(
@QueryParam("username") @Required String username,
@QueryParam("password") @Required String passwor... |
23831132_127 | public static <K, V extends Comparable<? super V>> Map<K, V> sortByValue(
Map<K, V> map) {
return sortByValue(map, false);
} |
23878754_5 | public HelloWorldResponse sayHello(HelloWorldRequest request) throws InvalidObjectException {
HelloWorldEndpoint endpoint = isCxfBeanFactory ? resolveEndpoint() : resolveByBareBones();
return endpoint.sayHello(request);
} |
23892158_12 | Object getData() {
return data;
} |
23907761_7 | public JsonValue apply(final JsonValue logic, final JsonValue args) {
if (logic.getValueType() != JsonValue.ValueType.OBJECT) {
return logic;
}
final JsonObject object = logic.asJsonObject();
if (object.size() > 1) {
return object;
}
final Set<String> keys = object.keySet();
... |
23912550_0 | protected StringEditor getStringEditor(String key) {
TypeEditor typeEditor = TYPE_EDITOR_MAP.get(key);
if (typeEditor == null) {
typeEditor = new StringEditor(this, sharedPreferences, key);
TYPE_EDITOR_MAP.put(key, typeEditor);
} else if (!(typeEditor instanceof StringEditor)) {
thro... |
23930639_297 | @Override
public <T extends Metric> T register(String name, T metric) throws IllegalArgumentException {
checkNameIsNotNullOrEmpty(name);
return register(Metadata.builder().withName(name).build(), true, metric);
} |
23952595_0 | public V get(K key, Callable<V> callable) {
Future<V> future = concurrentMap.get(key);
if (future == null) {
FutureTask<V> futureTask = new FutureTask<V>(callable);
future = concurrentMap.putIfAbsent(key, futureTask);
if (future == null) {
future = futureTask;
fut... |
23963494_27 | public static ImList<GuideProbeTargets> sortByGuider(final ImList<GuideProbeTargets> lst) {
return lst.sort(GuiderComparator.instance);
} |
23972840_3 | @Override
public HttpResponse execute(HttpRequest request) throws HttpRuntimeException {
return execute(Preconditions.checkNotNull(request), Options.DEFAULT);
} |
23995230_9 | public void addToSent(Short transmissionId, Segment segment) {
// add to pending map
dataMap.put(transmissionId, segment);
} |
23996364_10 | @Nonnull
public static Archive with(@CheckForNull final List<Person> persons) {
checkArgument((persons != null) && !persons.isEmpty(),
"Argument 'persons' must not be null or empty.");
return new AutoValue_Archive(randomUUID().toString(), persons, now());
} |
24005183_2 | public static String arrayToJson(String[] array) {
if (null == array) {return EMPTY_JSON_ARRAY;}
StringWriter stringWriter = new StringWriter();
JSONWriter jsonWriter = new JSONWriter(stringWriter);
try {
jsonWriter.array();
for (String item: array) {
jsonWriter.value(item... |
24012863_2 | public void replaceFragment(Fragment fragment) {
getSupportFragmentManager().beginTransaction().replace(R.id.container, fragment).commit();
} |
24016861_0 | @Override
public Geometry next() {
if (! hasNext()) {
return null;
}
try {
recordNumber = inputStream.readInt();//1 based
int recLength = inputStream.readInt();
position += 8;
int recordSizeBytes = (recLength * 2);
byte[] bytes = new byte[recordSizeBytes];
... |
24041094_6 | @Override
public DriverInfo getInfo() {
return info;
} |
24049909_1 | public void setPlaybackPosition(int position) {
if (mModCount != mLastUpdateModCount) {
// Update the timeline list if cues have been added or removed
// We check the mod count here to avoid an unnecessary function call
updateCueList();
}
// Create a new iterator, ...
ListIterat... |
24084730_0 | private static List<String> listFiles(final PluginTask task) {
// This |pathPrefixResolved| can still be a relative path from the working directory.
// The path should not be normalized by Path#normalize to eliminate redundant name elements like "." and "..".
final Path pathPrefixResolved = WORKING_DIRECTOR... |
24114062_3 | static int getFrequency(String note) throws EV3ScriptException {
String cleanNote = note.trim().toUpperCase();
int length = cleanNote.length();
if ((length >= 2) && (length <= 5)) {
char last = cleanNote.charAt(length - 1);
// Sharp or not ?
boolean isSharp = (last == '#');
// Octave
char oc... |
24137102_1 | public void close() {
queue.execute(new Runnable() {
@Override
public void run() {
disconnect(currentServerChannel, currentAcceptSelectionKey, null);
}
});
} |
24145690_8 | @Override
public PagedMetadata<ComponentUsageEntity> getComponentUsageDetails(String componentCode, RestListRequest restListRequest) {
RestContentListRequest contentListRequest = new RestContentListRequest();
contentListRequest.setFilters(restListRequest.getFilters());
contentListRequest.setSort("typeCode"... |
24155908_0 | public static Builder forRegistryAndIndexPrefix(MetricRegistry registry,
String elasticsearchIndexPrefix) {
return new Builder(registry, elasticsearchIndexPrefix);
} |
24167016_1 | public Collection<ViolationOccurrence> check(ClassReader classReader)
throws IOException {
ModernizerClassVisitor classVisitor = new ModernizerClassVisitor(
javaVersion, violations, exclusions, exclusionPatterns,
ignorePackages, ignoreClassNames, ignoreFullClassNamePatterns);
cla... |
24224646_14 | public AnnotationInfo get(String annotationName) {
return classAnnotations.get(annotationName);
} |
24272313_41 | public Status status(){
return status;
} |
24283381_1 | MatrixData getMatrixData() {
assert model != null;
return model.matrixData;
} |
24335430_9 | @Override
protected void delete(TableName tableName, Collection<Filter> whereClauses,
Connection<IStratioStreamingAPI> connection) throws UnsupportedException, ExecutionException {
throw new UnsupportedException("Delete is not supported");
} |
24338315_29 | public ResultCode registerUser(String email, String name, String password, boolean registrationConfirmed) {
ResultCode checkResult = checkRegistrationPreconditions(email, name);
if (checkResult != ResultCode.OK) {
return checkResult;
}
String controlCode = generateRandomMD5Hash();
UserPassword userPassword = ... |
24350958_6 | public static Value<Method> method(Class<?> clazz, String method, Object... args) {
Conditions.nonNull(clazz, "clazz");
Conditions.nonNullOrEmpty(method, "method");
try {
if (args != null && args.length > 0) {
Class<?>[] types = Stream.of(args).map(Object::getClass).toArray(Class<?>[]::n... |
24366887_1 | public static LunchParser getInstance() {
if(instance == null) {
instance = new LunchParser();
}
return instance;
} |
24384638_0 | public static String getWordAtIndex(String text, Integer position) {
int start = position;
for (; start > 0; start--) {
if (Character.isWhitespace(text.charAt(start - 1))) {
break;
}
}
if (start == position) {
return StringUtils.EMPTY;
}
return text.substring(start, position);
} |
24384732_31 | private static byte[] toByteArray(ByteBuffer buffer) {
buffer = buffer.duplicate();
// We can only return the array directly if:
// 1. The ByteBuffer exposes an array
// 2. The ByteBuffer starts at the beginning of the array
// 3. The ByteBuffer uses the entire array
if (buffer.hasArray() && buf... |
24394186_4 | public static String[] getCNs(X509Certificate cert) {
try {
final String subjectPrincipal = cert.getSubjectX500Principal().getName(X500Principal.RFC2253);
final LinkedList<String> cnList = new LinkedList<String>();
final LdapName subjectDN = new LdapName(subjectPrincipal);
for (final... |
24404221_752 | public static void setToAddressFromDestination(AmqpJmsMessageFacade message, JmsDestination destination) {
message.setToAddress(getDestinationAddress(destination, message.getConnection()));
// Clear any previous annotations about destination type, we will add proper annotations on send
message.removeMessag... |
24405282_0 | @GET
@Path("{identifier}")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response getFileByIdentifier(@PathParam("identifier") String identifier) {
ResponseBuilder response;
File file = new File(FileUtils.getTempDirectory() + File.separator + "downloads");
try {
HBaseFile hbf = HBaseFile.Factory.buildHBaseF... |
24409108_3 | public static UserPermanentDeleteResponse permanentDelete(String id)
throws AuthorizationException, ClientException, ServerException, InvalidException, RateLimitException {
final URI uri = UriBuilder.newBuilder()
.path("user_delete_requests")
.build();
return new HttpClient(uri)
... |
24416383_24 | @Override
public boolean matches(String s1, String s2) {
if (s1 == null && s2 == null) return true;
String no1 = removeNumbers.transform(s1);
String no2 = removeNumbers.transform(s2);
if (noNumbersRequireRestMatch && no1.length() == 0 && no2.length() == 0) {
return (s1.equals(s2));
}
else {
return super.match... |
24417776_49 | public static Map<String, Object> createShellContext(ApplicationContext applicationContext,
Log4JPrintStream output) {
final Map<String, Object> shellContext = new HashMap<>();
// hybris 5
shellContext.put("ctx", applicationContext);
// hybris 6
... |
24468283_0 | public String generatePayload(String name, String email, String message, String category) throws Exception {
if (email == null) email = "";
if (name == null) name = "";
String userEmail = email;
String userName = name;
if (userEmail.isEmpty()) {
userEmail = helpDeskEmail;
userName = ... |
24477567_28 | @Override
public QuorumConfigurationWithSeqNum getLastQuorumConfig() {
if (configMap.isEmpty()) {
return new QuorumConfigurationWithSeqNum(QuorumConfiguration.EMPTY, 0);
} else {
final Map.Entry<Long, QuorumConfiguration> lastEntry = configMap.lastEntry();
return new QuorumConfigurationWithSeqNum(lastEn... |
24478161_3 | void verifyCaller(Callable<?> callable) {
Method callMethod = getCallableMethod(callable.getClass());
for (Class<?> exceptionOrError : callMethod.getExceptionTypes()) {
Preconditions.checkArgument(Exception.class.isAssignableFrom(exceptionOrError),
"Callable method exceptions must be dervied from Except... |
24499046_11 | public void doRun(Properties properties) {
ServerSetup[] serverSetup = new PropertiesBasedServerSetupBuilder().build(properties);
if (serverSetup.length == 0) {
printUsage(System.out);
} else {
greenMail = new GreenMail(serverSetup);
log.info("Starting GreenMail standalone v{} usin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.