id stringlengths 7 14 | text stringlengths 1 37.2k |
|---|---|
102705073_0 | public static boolean isDate(String date) {
return isDate(date, PATTERN_HAVE_TIME);
} |
102846466_8 | static int checkFilename(String binlogFilename) {
try {
return Integer.parseInt(binlogFilename.split("\\.")[1]);
} catch (NumberFormatException | ArrayIndexOutOfBoundsException e) {
throw new InvalidBinlogException(e, binlogFilename, 0);
}
} |
102874275_21 | @Override
public Sail getSail(SailImplConfig config) throws SailConfigException {
if (!SAIL_TYPE.equals(config.getType())) {
throw new SailConfigException("Invalid Sail type: " + config.getType());
}
ShaclSail sail = new ShaclSail();
if (config instanceof ShaclSailConfig) {
ShaclSailConfig shaclSailConfig = (... |
102874374_19 | @Override
public void execute(String... parameters) throws IOException {
if (parameters.length < 4) {
consoleIO.writeln(getHelpLong());
} else {
LinkedList<String> plist = new LinkedList<>(Arrays.asList(parameters));
plist.remove(); // "federate"
boolean distinct = getOptionalParamValue(plist, "distinct", fal... |
102955709_23 | public long startTransfer(final String xferId, final String transferSpecStr) {
log.info("Starting transfer with xferId [" + xferId + "]");
if (log.isDebugEnabled()) {
log.debug("Transfer Spec for Session with xferId [" + xferId + "]");
log.debug(AsperaTransferManagerUtils.getRedactedJsonString(
transferSp... |
102960162_2 | public String getRouteString() {
return routeString;
} |
103009179_4 | @Override
public boolean canHandle(final HttpServletRequest request, final HttpServletResponse response) {
final String openIdMode = request.getParameter(OpenIdConstants.OPENID_MODE);
if (StringUtils.equals(openIdMode, OpenIdConstants.ASSOCIATE)) {
logger.info("Handling request. openid.mode : {}", openI... |
103023961_0 | private static Function composition(Context context) {
return args -> {
final Composition composition;
switch (args.length) {
case 0:
composition = new Composition();
break;
case 1:
double frameRate = args[0].asDouble();
... |
103027757_19 | public String getPackageName() {
if (!TextUtils.isEmpty(mPackageName)) {
return mPackageName;
}
String manifestPath = null;
// AndroidManifest.xml 可能目录(不同gradle版本,不同目录,蛋疼)
List<String> manifestPaths = Arrays.asList(
"build/intermediates/manifests/aapt/debug/AndroidManifest.xml"... |
103047907_17 | @Override
; |
103109633_0 | protected Optional<Dependency> sharedSpanDependency(Set<Span> sharedSpans) {
String clientService = null;
String serverService = null;
for (Span span: sharedSpans) {
for (KeyValue tag: span.getTags()) {
if (Tags.SPAN_KIND_CLIENT.equals(tag.getValueString()) || Tags.SPAN_KIND_PRODUCER.equ... |
103139287_0 | @RequestMapping("/")
public String sayHello() {
return "Hello,World!";
} |
103151406_0 | @Override
protected String buildUrl() {
return mUrl + "/rest/events?topics=" + buildTopic();
} |
103155862_90 | public List<JSON2DSources> getSources() {
return sources;
} |
103232734_56 | static void putNumberParam(Bundle bundle, String key, String number) {
String[] types = {"int", "long", "double", "float"};
boolean found = false;
for (String type : types) {
try {
if (type.equals("int") && !number.toLowerCase().endsWith("l")) {
int value = Integer.parseI... |
103259097_1 | @Override
public boolean isLogined() {
return KeyManager.getToken() != null;
} |
103286363_0 | @Override
public String translate(String key) {
return rb.getString(key);
} |
103328683_2 | 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 = findPr... |
103377081_14 | public int add(String input) {
if ("".equals(input))
return 0;
String delimiter = extractDelimiter(input);
String[] numberArray = extractNumbers(input, delimiter);
return sumNumberArray(numberArray);
} |
103384901_13 | public static List<String> parseStringList(Object object) {
if (object == null) {
return null;
}
return Splitter.onPattern("(?:\r?\n)+")
.splitToList(object.toString())
.stream()
.map(String::trim)
.filter(s -> !s.isEmpty())
.collect(Collec... |
103464837_5 | public static Map<String, String> getJsonPathsForTemplating(Set<Map.Entry<String, JsonElement>> root) {
Map<String, String> paths = new HashMap<>();
searchJsonForTemplate(root, paths, "$");
return paths;
} |
103522601_0 | public static void printOpCode(InstructionHandle insHandle, ConstantPoolGen cpg) {
System.out.print("[" + String.format("%02d", insHandle.getPosition()) + "] ");
printOpCode(insHandle.getInstruction(),cpg);
} |
103558693_18 | public Specification<Category> byUser(User user) {
return (root, query, criteriaBuilder) -> criteriaBuilder.equal(root.get(Category_.masterCategory).get(MasterCategory_.user), user);
} |
103560333_112 | @Override
public boolean betterThan(Num criterionValue1, Num criterionValue2) {
return criterionValue1.isGreaterThan(criterionValue2);
} |
103602142_0 | public static void print(String title, String message, int type) {
switch (type) {
case Log.DEBUG:
Log.d("EntireNews (" + title + ")", message);
break;
case Log.ERROR:
Log.e("EntireNews (" + title + ")", message);
break;
case Log.INFO:
... |
103613782_3 | @RequestMapping(value = {"/"}, method = RequestMethod.GET)
public String rootRedirect() {
return "index";
} |
103616209_94 | protected Xml getAndStoreResultToDatabase(URI uri, IndexerApiAccessType apiAccessType) throws IndexerAccessException {
Xml response = getAndStoreResultToDatabase(uri, Xml.class, apiAccessType);
if (response instanceof NewznabXmlError) {
//Base class doesn't know any RssErrors so we must handle this case... |
103630840_15 | public List<UserTeam> listUserTeamsAgree(Team team) throws ShepherException {
if (team == null) {
throw ShepherException.createIllegalParameterException();
}
return userTeamBiz.listByTeam(team.getId(), Status.AGREE);
} |
103653841_10 | public URI toHierarchicalUri() {
final URI hierarchical = this.hierarchical;
return null != hierarchical
? hierarchical
: (this.hierarchical = uri.isOpaque()
? path.toHierarchicalUri()
: uri);
} |
103694377_1 | public static PrivateKey readPrivateKey(String pemResName) throws Exception {
InputStream contentIS = TokenUtils.class.getResourceAsStream(pemResName);
byte[] tmp = new byte[4096];
int length = contentIS.read(tmp);
PrivateKey privateKey = decodePrivateKey(new String(tmp, 0, length));
return privateK... |
103698172_4 | @Override
public boolean send(Span span) throws ClientException {
final byte[] spanBytes = format.format(span).toByteArray();
return super.send(spanBytes);
} |
103700346_53 | @ApiOperation(value = "This API returns Latest Events per Scenario present in Elastic Search for given App Name", response = ResponseEntity.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Returned Latest Events per Scenario for given App Name"),
@ApiResponse(code = 401, message = "User is not autho... |
103728471_1 | @PostMapping("/addresses")
public Address createAddress(@RequestBody Address address) {
return addressRepository.save(address);
} |
103760642_1 | } |
103764705_39 | public static boolean isPrime(int x) {
if (x <= 1) {
return false;
}
int i = 2;
while (i <= x && x % i != 0) {
i++;
}
return i == x;
} |
103962048_4 | @Override
public Human find(int id) {
try {
return template.queryForObject(SQL_SELECT_USER_BY_ID, humanRowMapper, id);
} catch (EmptyResultDataAccessException e) {
throw new IllegalArgumentException("User with id <" + id + "> not found");
}
} |
103989411_2 | @VisibleForTesting
void extract(SqlNodeList query) {
for (SqlNode n : query) {
if (n instanceof SqlSetOption) {
extract((SqlSetOption) n);
} else if (n instanceof SqlCreateFunction) {
extract((SqlCreateFunction) n);
}
}
} |
104092353_0 | public static String getTomcatVersion(String serverInfo) {
String result = null;
if (serverInfo != null && !serverInfo.isEmpty()) {
Debug.log("TomcatVersionValidator.getTomcatVersion() - validating ServerInfo:" + serverInfo);
// Parse the output looking for the Server number string, for examp... |
104094274_11 | public static <T> Set<T>
load(
Function<Model, Set<Resource>> resourceSelector,
Class<T> clazz,
Model model
) {
return load(resourceSelector, clazz, model, m -> m, c -> {}, m -> {});
} |
104141068_182 | @Override
public boolean hasVersionAttribute() {
throw new UnsupportedOperationException();
} |
104154908_0 | public static String escape(String s) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
// These characters are part of the query syntax and must be escaped
if (c == '=' || c == '\\' || c == '+' || c == '-' || c == '!' || c == '(' || c == ')' || c == ':'
... |
104169114_0 | @Override
public void onChannelClose(String remoteAddr, Channel channel) {
this.namesrvController.getRouteInfoManager().onChannelDestroy(remoteAddr, channel);
} |
104249541_2 | @CheckingMethodType
public int getTypeCheck() {
return mTypeCheck;
} |
104262301_52 | public long getRTokenExpirationTime() {
// expiration time should come in seconds, that's why the * 1000 and extra-zeros for 2592000 seconds
return sc.getRTokenExpirationTime() > 0
? (sc.getRTokenExpirationTime() * THOUSAND)
: DEFAULT_REFRESH_TOKEN_EXPIRATION_TIME; // set 30 days if an i... |
104316906_13 | public static ExcelWrite build(InputStream inputStream, String fileName) {
Objects.requireNonNull(inputStream);
Objects.requireNonNull(fileName);
return new CopyInputStreamExcelWrite(inputStream, fileName, new FileExcelWrite());
} |
104490112_1 | public void changePassword(char[] password) throws KeyStoreException {
try {
for (String alias : Collections.list(ks.aliases())) {
Entry entry = ks.getEntry(alias, new PasswordProtection(this.password)); // read
ks.setEntry(alias, entry, new PasswordProtection(password)); // override... |
104512497_44 | @Override
@ThreadSafe(enableChecks = false)
public boolean getSnapshot(DeviceBatteryMetrics snapshot) {
checkNotNull(snapshot, "Null value passed to getSnapshot!");
snapshot.batteryLevelPct = getBatteryLevel(getBatteryIntent());
long now = SystemClock.elapsedRealtime();
synchronized (this) {
if (mIsCurrentl... |
104515879_0 | UndertowEndpoint createEndpoint(WebSocketChannel channel) {
final UndertowEndpoint endpoint = new UndertowEndpoint(this, channel);
try {
channel.setOption(Options.TCP_NODELAY, NODELAY);
} catch (IOException e) {
throw new OptionAssignmentException("Error setting option", e);
}
channel.getReceiveSetter... |
104516152_0 | public static boolean updatePomVersions(List<PomUpdateStatus> pomsToChange, List<DependencyVersionChange> changes) throws IOException {
Map<String, String> propertyChanges = new TreeMap<>();
for (PomUpdateStatus status : pomsToChange) {
status.updateVersions(changes, propertyChanges);
}
if (!pr... |
104654714_3 | @Override
public void onTrigger(final ReportingContext context) {
final String metricsCollectorUrl = context.getProperty(METRICS_COLLECTOR_URL)
.evaluateAttributeExpressions().getValue()
.replace("http://", "");
final String applicationId = context.getProperty(APPLICATION_ID).evaluateAt... |
104670115_42 | @Override public String name() {
return "camel";
} |
104705553_29 | @Override
public <T> T clone(T object) {
if (object instanceof Collection) {
Object firstElement = findFirstNonNullElement((Collection) object);
if (firstElement != null && !(firstElement instanceof Serializable)) {
JavaType type = TypeFactory.defaultInstance().constructParametricType(ob... |
104718236_8 | @Override
public synchronized boolean checkValid(String clientId, String username, byte[] password) {
// Check Username / Password in DB using sqlQuery
if (username == null || password == null) {
LOG.info("username or password was null");
return false;
}
ResultSet r = null;
try {
... |
104718330_8 | @Override
public boolean canHandle(final HttpServletRequest request, final HttpServletResponse response) {
String openIdMode = request.getParameter("openid.mode");
if (openIdMode != null && openIdMode.equals("associate")) {
logger.info("Handling request. openid.mode : {}", openIdMode);
return tr... |
104770714_18 | public static <T, P extends ObservableValue<T>> void whenPropertyIsSet(P property, Consumer<T> doWhenSet) {
whenPropertyIsSet(property, () -> doWhenSet.accept(property.getValue()));
} |
104872758_8 | public String build(String type, String key, String value){
StringBuilder sb = new StringBuilder();
sb.append("-D");
sb.append(type);
sb.append('.');
sb.append(key);
sb.append('=');
sb.append(value);
return sb.toString();
} |
104883492_14 | @Override
public List<SeasonData> fetchAllByYear(Integer year) {
List<SeasonData> ret = null;
String sql = "SELECT t.* FROM " + TABLE_NAME + " t WHERE t.year = ?";
Object[] args = { year };
// Run the query
ret = getJdbcTemplate().query(sql, args, new SeasonDataRowMapper());
return ret;
} |
104889165_120 | public static String toStringPartialJson(SpecificRecordBase... records) {
return toPartialJson(records).toString();
} |
104974693_54 | public Session open(IOFSwitch sw) {
return open(new MessageContext(), sw);
} |
104984928_109 | @POST
@Path("/{connector}/restart")
public void restartConnector(final @PathParam("connector") String connector,
final @QueryParam("forward") Boolean forward) throws Throwable {
FutureCallback<Void> cb = new FutureCallback<>();
herder.restartConnector(connector, cb);
completeOrF... |
104999768_0 | public Car manufactureCar(Specification spec) {
Car car = carFactory.createCar(spec);
entityManager.merge(car);
return car;
} |
105010160_279 | static String unescape(String string) {
return unescape(string, false);
} |
105032211_6 | @Override
@Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED)
public List<ProviderUserModel> getUsersByProviderConfigId(Long providerConfigId) {
if (null == providerConfigId) {
return List.of();
}
return providerUserRepository.findByProviderConfigId(providerConfigId)
... |
105079548_0 | public linkedList()
{
start = null;
end = null;
size = 0;
} |
105089121_1005 | public static String resolvePassword( VariableSpace variables, String password ) {
String resolvedPassword = variables.environmentSubstitute( password );
if ( resolvedPassword != null ) {
// returns resolved decrypted password
return Encr.decryptPasswordOptionallyEncrypted( resolvedPassword );
} else {
... |
105094044_21 | public boolean rollback(Block block) {
int length = chain.getAllBlockList().size();
if (block == null || length == 0) {
return false;
}
Block bestBlock = chain.getBestBlock();
if (!block.getHeader().getHash().equals(bestBlock.getHeader().getHash())) {
Log.warn("rollbackTransaction bl... |
105104598_8 | @Override
public void run(byte[] bytes) {
float temperature = decodeTemperature(bytes[1], bytes[0]);
float humidity = decodeHumidity(bytes[3], bytes[2]);
SensorLog sensorLog = new SensorLog(config.getId(), ImmutableMap.of(HUMIDITY_VALUE_ID, humidity, TEMPERATURE_VALUE_ID, temperature));
processor.onNex... |
105110479_3 | @Override
public <T> T bind(final PropertyName name, final BindData<T> target, final Binder.Env env, final PropertyBinder propertyBinder) {
boolean hasKnownBindableProperties = env.getSource().containsDescendantOf(name);
Bean<T> bean = Bean.get(target, hasKnownBindableProperties);
if (bean == null) {
... |
105195850_1 | @Override
public long getFirstContainingTime(long Tl, long Tr, long T) {
assert 0 <= Tl && Tl <= Tr && Tr < T;
long l = T-1 - Tr, r = T-1 - Tl, length = Tr - Tl + 1;
if (!addWindowsUntilLength(length)) {
return -1;
}
long firstMarker = firstWindowOfLength.ceilingEntry(length).getValue();
... |
105200994_7 | @Nullable
public static Location worldlessBlockLocationFromConfig(@NotNull ConfigurationSection conf) {
try {
int x = Integer.parseInt(conf.getString(X));
int y = Integer.parseInt(conf.getString(Y));
int z = Integer.parseInt(conf.getString(Z));
return new Location(null, x, y, z);
... |
105203803_1 | @Override
public void onViewResumed() {
getView().showData("This is some awesome data");
getView().showError(new RuntimeException("Exceptional Error"));
} |
105218129_201 | public SortedSet<Card> spades()
{
return this.cardsBySuit.get(Suit.SPADES);
} |
105238970_124 | @EventListener
public void handle(final RequestFundedEvent event) {
final Request request = requestRepository.findOne(event.getRequestId())
.orElseThrow(() -> new RuntimeException("Unable to find request"));
request.setLastModifiedDate(LocalDateTime.now());
reque... |
105269391_1 | public Boolean connectionToKafkaTopicsIsSuccess() {
if (nonNull(metricTopics) && nonNull(connectionTimeoutTopic)) {
StopWatch executionTime = StopWatch.createStarted();
DescribeTopicsOptions describeTopicsOptions = new DescribeTopicsOptions().timeoutMs(
connectionTimeoutTopic);
t... |
105288171_6 | public synchronized Class loadModule(String moduleName, String className)
throws LazyLoadingException {
try {
return mLoaderAlgorithm.loadModule(moduleName, className);
} catch (Throwable t) {
throw new LazyLoadingException(t);
}
} |
105357633_1 | @GET
@PermitAll
public APIRootResponse get(@Context SecurityContext context) {
final Map<String, APIRestLink> links = new HashMap<>();
links.put("v1", new APIRestLink(URI.create(Constants.HTTP_V1_ROOT)));
return new APIRootResponse(links);
} |
105537880_0 | static public Props props() {
return Props.create(MyFirstActor.class, () -> new MyFirstActor());
} |
105551486_0 | @Override
public String add(int... values) {
int sum = 0;
for (int value : values) {
sum += value;
}
return format(sum);
} |
105563335_413 | @Override
protected final String determineConnectorName(final ConnectorTemplate connectorTemplate, final ConnectorSettings connectorSettings) {
final OpenApiModelInfo modelInfo = parseSpecification(connectorSettings, APIValidationContext.NONE);
if (!modelInfo.getErrors().isEmpty()) {
throw new IllegalAr... |
105571183_39 | @Override
public ERE derive(Symbol s) {
return empty;
} |
105585951_4 | static UUID decode(String id) {
BigInteger decoded = Base62.decode(id);
return UuidConverter.toUuid(decoded);
} |
105662144_0 | public static String getPreview(String text, int linesCount, boolean ignoreEmptyLines, Integer maxLength) {
if (maxLength != null && maxLength < 0) {
throw new IllegalArgumentException("maxLength can't be negative");
}
if (text == null) {
return "<null>";
}
if (text.isEmpty() || li... |
105692222_4 | public static Siteswap mergeCompatible(Siteswap s1, Siteswap s2) {
Siteswap i1 = s1.toInterface().toPattern();
Siteswap i2 = s2.toInterface().toPattern();
if (!s2.rotateToInterface(i1)) {
return null;
}
int length = 2 * s1.period_length();
Siteswap mergedSiteswap = new Siteswap(new byte[length]);
mergedSiteswa... |
105770301_1 | public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
try {
RequiredParameterValidator.validate(this.getClass(), workItem);
String shellScriptLocation = (String) workItem.getParameter("ShellScriptLocation");
String tout = (String) workItem.getParameter("TimeoutInMillis"... |
105789039_1 | @Override
public MutationInterceptor createInterceptor(InterceptorParameters params) {
Optional<String> path = params.getString(fileParameter);
return new DiffMutationFilter(DiffInfo.fromFile(path.orElse(defaultPath)));
} |
105860042_127 | public ApplicationColor detectSingularDeployedApplicationColor(DeployedMta deployedMta) {
if (deployedMta == null) {
return null;
}
ApplicationColor deployedApplicationColor = null;
for (DeployedMtaApplication deployedMtaApplication : deployedMta.getApplications()) {
ApplicationColor app... |
105940648_2 | public static boolean isZookeeperReady(String zkConnectString, int timeoutMs) {
log.debug("Check if Zookeeper is ready: {} ", zkConnectString);
ZooKeeper zookeeper = null;
try {
CountDownLatch waitForConnection = new CountDownLatch(1);
boolean isSaslEnabled = false;
if (System.getProperty(JAVA_SECUR... |
105987593_7 | List<String> draw(List<String> emails) {
System.out.println("Draw for the seed: " + getSeed());
Random rnd = new Random(getSeed());
Set<String> winners = new HashSet<>();
while (winners.size() < Math.min(winnersCount, emails.size())) {
int index = rnd.nextInt(emails.size());
System.out.p... |
105995602_13 | public static void setObjectMapper(@NonNull ObjectMapper objectMapper) {
if (objectMapper == null) {
throw new IllegalArgumentException("Object mapper should not be null");
}
SpitfireManager.objectMapper = objectMapper;
} |
106015269_215 | @Override
public TemporaryTopic createTemporaryTopic() {
try {
return getSession().createTemporaryTopic();
} catch (JMSException jmse) {
throw JMSExceptionSupport.createRuntimeException(jmse);
}
} |
106200322_8 | public V1beta1Note getOccurrenceNote(String name) throws ApiException {
ApiResponse<V1beta1Note> resp = getOccurrenceNoteWithHttpInfo(name);
return resp.getData();
} |
106213935_0 | @Override
public void extractFeature(ComplexProof proof, Evidence evidence) {
List<Pattern> patterns = searcher.querySolrIndex(evidence.getModel().getPropertyUri(), 20, 0, proof.getLanguage());
float score = (float) 0.0;
String patternString = "";
for ( Pattern p : patterns ) {
if ( p.getNormalized().trim().isEm... |
106220562_1 | @Override
public ReadStream<HttpServerRequest> requestStream() {
return null;
} |
106371845_8 | public boolean login(UserForm userForm) {
System.out.println("LoginService.login " + userForm);
// Preconditions
checkForm(userForm);
// Same user cannot be logged twice
String username = userForm.getUsername();
if (usersLogged.contains(username)) {
throw new LoginException(username + ... |
106416016_0 | public synchronized void useCommonsLogging() {
setImplementation(JakartaCommonsLoggingImpl.class);
} |
106459683_1 | static void applySystemProperties(final Map<String, String> opts) {
opts.forEach((key, value) -> {
if (key.startsWith("-D")) System.setProperty(key.substring(2), value);
});
} |
106559097_0 | public Observable<Result> processAction(Observable<Action> actions) {
return actions.compose(transformActionIntoResults);
} |
106559436_73 | static boolean uninstall() {
boolean uninstalled = false;
synchronized (lock) {
if (locationCollectionClient != null) {
locationCollectionClient.locationEngineController.onDestroy();
locationCollectionClient.settingsChangeHandlerThread.quit();
locationCollectionClient.sharedPreferences.unregis... |
106613119_506 | @Override
public String toString() {
return "DefaultAtlasModuleInfo [name=" + name + ", uri=" + uri + ", sourceSupported=" + sourceSupported
+ ", targetSupported=" + targetSupported + ", moduleClass=" + moduleClass + ", constructor="
+ constructor + ", formats=" + formats + ", packageNames="... |
106668916_1 | public List<JsonExpectationInput> list() {
return list;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.