id stringlengths 7 14 | text stringlengths 1 37.2k |
|---|---|
135676228_1 | @Override
public Pair<T, U> build(ConfigurationSourceProvider provider, String path) throws IOException, ConfigurationException {
try (InputStream input = provider.open(requireNonNull(path))) {
final JsonNode node = objectMapper.readTree(createParser(input));
if (node == null) {
throw Co... |
135694690_2 | public static void createWithBorders(String filename, String content) throws IOException {
// Blank Document
XWPFDocument document = new XWPFDocument();
// Write the Document in file system
FileOutputStream out = new FileOutputStream(new File(filename));
// create paragraph
XWPFParagraph parag... |
135796936_4 | @PostMapping
public ResponseEntity<Void> createNewBook(@Valid @RequestBody BookRequest bookRequest, UriComponentsBuilder uriComponentsBuilder) {
Long primaryKey = bookService.createNewBook(bookRequest);
UriComponents uriComponents = uriComponentsBuilder.path("/api/books/{id}").buildAndExpand(primaryKey);
HttpHea... |
135928914_9 | @Override
public int serviceTicketCount() {
if (this.ticketRegistry instanceof TicketRegistryState) {
return ((TicketRegistryState) this.ticketRegistry).serviceTicketCount();
}
logger.debug("Ticket registry {} does not support report the serviceTicketCount() operation of the registry state.",
... |
135972985_19 | public static GanderIMDB getInstance() {
return INSTANCE;
} |
136013354_0 | public MavlinkPacket next() throws IOException {
while (in.next()) {
byte[] frame = in.frame();
switch (frame[0] & 0xff) {
case MavlinkPacket.MAGIC_V1:
return MavlinkPacket.fromV1Bytes(frame);
case MavlinkPacket.MAGIC_V2:
return MavlinkPacket.f... |
136173345_53 | @Override
public void process() {
if (snapshotMode == CassandraConnectorConfig.SnapshotMode.ALWAYS) {
snapshot();
}
else if (snapshotMode == CassandraConnectorConfig.SnapshotMode.INITIAL && initial) {
snapshot();
initial = false;
}
else {
LOGGER.debug("Skipping snapsh... |
136324618_13 | public static boolean keyExists(String key) {
return rulesKeyset.contains(key);
} |
136395597_4 | @Override
public void updateMessageAttachment(String channelId, long messageId, Attachment attachment) {
logger.debug(channelId + "/" + messageId + ": updating message attachment");
PreparedStatement segmentCountStatement = null;
ResultSet segmentCountResult = null;
PreparedStatement updateStatement = ... |
136437189_3 | protected boolean canOverwrite(final IvIndex ivIndex, final Calendar updatedAt,
final boolean ivRecoveryActive,
final boolean isTestMode,
final boolean ivRecoveryOver42Allowed) {
// IV Index must increase, or, in case it's ... |
136439284_6 | public static Sink<ZMsg, NotUsed> publishServerSink(String addresses) {
return Flow.fromGraph(new ZmqPublishStage(true, addresses)).to(Sink.ignore());
} |
136447306_0 | public String getImgAlign() {
return imgAlign;
} |
136463642_29 | public static List<ParamValidationError> checkNoFieldsOfType(final DatasetSchema schema,
final Class<? extends AbstractValueSchema> fieldClass) {
final ImmutableList.Builder<ParamValidationError> errors = ImmutableList.builder();
schema.getPredictive... |
136544584_3 | @Override
public int run(String[] args) throws Exception {
if (args.length != 2) {
System.err.printf("Usage: %s [generic options] <input> <output>\n",
getClass().getSimpleName());
ToolRunner.printGenericCommandUsage(System.err);
return -1;
}
Job job = new Job(getConf(), "Max temperature");
... |
136567454_1 | @PostMapping
public Holding[] saveHoldings(@RequestBody Holding[] holdings, Principal principal) {
User user = getUser(principal);
try {
String json = mapper.writeValueAsString(holdings);
user.getProfile().put(HOLDINGS_ATTRIBUTE_NAME, json);
user.update();
} catch (JsonProcessingExc... |
136645456_2 | @Nullable
@Override
public Request authenticate(@NonNull Route route, @NonNull Response response)
throws IOException {
if (response.priorResponse() != null) {
return null; // Give up, we've already attempted to refresh.
}
final String invalidAccessToken = parseHeaderAccessToken(response);
... |
136723677_8 | @Override
public List<Brand> queryBrands(int typeId) {
String sql = "SELECT * FROM brand WHERE type_id = ?";
SqlRowSet row = template.queryForRowSet(sql, new Object[]{typeId});
List<Brand> list = new ArrayList<>();
Brand brand = null;
while (row.next()) {
brand = new Brand();
brand.s... |
136895157_2 | @Override
public boolean isQuorum() {
return isQuorum.get();
} |
136936588_1 | public static String dateToString(Date d) {
return dateToString("dd/MM/yyyy", d);
} |
136938960_0 | private static List<Domain> parseProtocol(String protocolFileName) {
InputStream resourceStream = Generator.class.getResourceAsStream(protocolFileName);
return parseProtocol(resourceStream);
} |
136978154_0 | public void notifyUser(String text, int duration, String id){
if(duration == Snackbar.LENGTH_SHORT)
duration = 2000;
else if (duration == Snackbar.LENGTH_LONG)
duration = 3500;
displayMessage(text, duration, id);
} |
137041394_4 | @Override
public int classify(final Instance instance) {
// The Python API supports an array of instances and returns an array of results, we need to adapt to a
// single result.
final String classValue = invokeFunction(instance, this.classifyFunctionName, "str(%s[0])");
final int asNotNullable;
tr... |
137085185_16 | @Override
public ProcessBuilder createProcessBuilder( JobDefinition od ) {
Objects.requireNonNull( od.getPartitionKey(), "PartitionKey is null" );
List<String> partitionVal = Lists.newArrayList();
String partitionValue = od.getPartitionValue();
if ( partitionValue.contains( JobProcessorConstants.DOUBLE_UNDERSCORE... |
137178358_1 | ; |
137390788_12 | @Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
if (!supports(authentication.getClass())) {
return null;
}
JwtAuthentication jwt = (JwtAuthentication) authentication;
try {
final Authentication jwtAuth = jwt.verify(jwtVerifier... |
137437971_1 | @Override
protected void scan(String[] sources, Map<String, VelocityTool> velocityToolsMap) {
viewToolManager = ViewToolManagerInitializer.getViewToolManager(servletContext);
ToolboxFactoryAdapter toolboxFactory = new ToolboxFactoryAdapter(velocityToolsMap);
viewToolManager.setToolboxFactory(toolboxFacto... |
137445556_1 | @Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
Optional<Account> accountOptional = accountRepository.findByEmail(username);
Account account = accountOptional.orElseThrow(() -> new UsernameNotFoundException("user not found"));
// TODO 4-19 AccountDetailsをn... |
137451403_39 | public String toJson() {
return JacksonUtils.toJson(this);
} |
137528592_190 | @Override
public int readInt(int bitLength) {
checkArgument(bitLength % 8 == 0, "bitLength must be a multiple of 8");
int byteLength = bitLength / 8;
ensureBytes(byteLength, () -> "SSZ encoded data has insufficient length to read a " + bitLength + "-bit integer");
Bytes bytes = content.slice(index, byteLength);... |
137565180_2 | @Override
public Optional<OrderDto> get(String id) {
try {
return getOpenOrderById(id);
} catch (HttpClientErrorException ex) {
if (ex.getStatusCode() != HttpStatus.BAD_REQUEST) {
throw ex;
}
return getClosedOrderById(id);
}
} |
137570946_52 | public boolean onReceiveAppendEntriesResult(AppendEntriesResultMessage resultMessage, int nextLogIndex) {
NewNodeCatchUpTask task = taskMap.get(resultMessage.getSourceNodeId());
if (task == null) {
return false;
}
task.onReceiveAppendEntriesResult(resultMessage, nextLogIndex);
return true;
} |
137728198_47 | public Query getQuery() {
return query;
} |
137728458_1 | public Channel reconstructChannel()
{
checkConfig();
try
{
org.apache.log4j.Level setTo = null;
setTo = org.apache.log4j.Level.DEBUG;
org.apache.log4j.Logger.getLogger("org.hyperledger.fabric").setLevel(setTo);
Channel newChannel = null;
client.setUserContext(user);
... |
137746205_1 | @Nonnull
public static Next<AddEditTaskModel, AddEditTaskEffect> update(
AddEditTaskModel model, AddEditTaskEvent event) {
return event.map(
taskDefinitionCompleted -> onTaskDefinitionCompleted(model, taskDefinitionCompleted),
taskCreatedSuccessfully -> exitWithSuccess(),
taskCreationFailed -> e... |
137762067_28 | public BentenHandlerResponse handle(BentenMessage bentenMessage) {
String issueKey = BentenMessageHelper.getParameterAsString(bentenMessage,JiraActionParameters.PARAMETER_ISSUE_KEY);
String status = BentenMessageHelper.getParameterAsString(bentenMessage,JiraActionParameters.PARAMETER_STATUS);
String assigne... |
137771260_2 | @Override
public String toXml() {
final StringBuilder ret = new StringBuilder(
"<" + getXMLTag() + " " + getColumnLabel(SIZEIDX) + "=\"" + size + "\" >");
for (int i = 0; i < size; i++) {
ret.append(tuples[i].toXml());
}
ret.append("</" + getXMLTag() + ">");
return ret.toString();
} |
137793178_1 | public void reinitialize() {
runMapLock.writeLock().lock();
try {
for (TestEntry testEntry : runMap.values()) {
testEntry.init();
testEntry.reinitTime();
}
clearCurrentTestResults();
} finally {
runMapLock.writeLock().unlock();
}
} |
137794579_2 | public String convertDateTime(Date date) {
return iso8601DateFormat.format(date);
} |
137843879_33 | public static String buildSchema(List<Field> fields)
{
StringBuilder sb = new StringBuilder("message row { ");
for (Field field : fields) {
String fieldName = field.getName();
Class<?> type = field.getJavaTypeClass();
switch (type.getSimpleName()) {
case "String":
... |
137988099_78 | @Override
protected ImageView initComponentHostView(@NonNull Context context) {
WXImageView view = new WXImageView(context);
view.setScaleType(ScaleType.FIT_XY);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
view.setCropToPadding(true);
}
view.holdComponent(this);
return view;
} |
138077755_37 | @Override
public Range clone() {
return new Range(start.clone(), end.clone());
} |
138123418_32 | public List<Derivation> parseSyntactic(String input){
List<String> tokens = tokenizer.tokenize(input);
List<String> tokensLower = new ArrayList<>(tokens.size());
for(String token: tokens)
tokensLower.add(token.toLowerCase());
int N = tokens.size();
Chart chart = new Chart(N+1);
for(int... |
138216750_32 | public String getTelemetryTopic() {
return mTelemetryTopic;
} |
138267988_0 | public static Food getFood(String type) {
Food food = null;
try {
food = (Food) Class.forName("com.hks.factory." + type).newInstance();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessEx... |
138269161_17 | @Override
public RequestSpecificRetryHandler getRequestSpecificRetryHandler(TcpRequest request, IClientConfig requestConfig) {
if (!request.isRetriable()) {
return new RequestSpecificRetryHandler(false, false, this.getRetryHandler(), requestConfig);
}
if (this.icc != null && this.icc.get(CommonCli... |
138315669_64 | public static Scanner createScanner(String input) {
return createScanner(input, false);
} |
138608373_5 | public JSONObject read(IAMIndex index) {
return readFromSelection(index, null);
} |
138623536_35 | @Override
public void run(SlingHttpServletRequest request, PostResponse response, SlingPostProcessor[] processors) {
final List<Modification> changes = new ArrayList<>();
try {
String name = request.getParameter(SlingPostConstants.RP_NODE_NAME);
ResourceResolver resolver = request.getResourceR... |
138787569_1 | public static <T> PersistentList<T> generate(
IntFunction<? extends T[]> arrayCreator, int size, IntFunction<? extends T> generator) {
var array = arrayCreator.apply(0);
if (array.length != 0) {
throw new IllegalArgumentException("array creator not implemented correctly");
}
var newArray = Arrays.copyOf... |
138890589_49 | public static Set<FieldSpecGroup> createGroups(RowSpec rowSpec) {
List<FieldPair> pairs = rowSpec.getRelations().stream()
.map(relation -> new FieldPair(relation.main(), relation.other()))
.collect(Collectors.toList());
return findGroups(rowSpec.getFields().asList(), pairs)
.stream().ma... |
138907954_6 | public static <T> T nonNull(final T object, final Supplier<String> message) {
if (object != null) {
return object;
}
throw new IllegalArgumentException(message.get());
} |
138952078_0 | public static <ID> Dot<ID> dot(Graph<ID> graph) {
return new Dot<>(graph);
} |
138967647_1 | @QueryHandler
public UserView find(UserByIdQuery query) {
String userId = query.getUserId().getIdentifier();
return Optional.ofNullable(userRepository.findByIdentifier(userId))
.orElseGet(() -> {
logger.warn("Tried to retrieve a User query model with a non existent user... |
139051087_2 | @Override
protected String buildTryLockSql(TableConfig tableConfig) {
return new StringBuilder()
.append("INSERT INTO ")
.append(getSafeName(tableConfig.getSchema()))
.append(".")
.append(getSafeName(tableConfig.getTable()))
.append(" (")
.append(getSafeName(tableConfig.getName()))... |
139102120_2 | @Override
public void delStr(String key) {
logger.info("删除 Redis 数据。入参:key:{}", key);
ValueOperations<String, String> operations = stringRedisTemplate.opsForValue();
operations.getOperations().delete(key);
} |
139143101_10 | public static byte[] toByteArray(BigInteger value) {
return toByteArray(value, -1);
} |
139242712_9 | public String message(String s, Object... objects) {
return messageSource.getMessage(s, objects, nativeLocale);
} |
139299365_25 | private long getFrequency(NGramField field) throws IOException
{
return getFrequency(field, null);
} |
139344139_1 | public NumarComplex add(NumarComplex z)
{
this.setReal(this.real + z.getReal());
this.setImg(this.img + z.getImg());
return this;
} |
139520942_65 | static Utf8String decodeUtf8String(String input, int offset) {
DynamicBytes dynamicBytesResult = decodeDynamicBytes(input, offset);
byte[] bytes = dynamicBytesResult.getValue();
return new Utf8String(new String(bytes, StandardCharsets.UTF_8));
} |
139621153_94 | public static Vector2 fromXY(final double x, final double y)
{
return new Vector2(x, y);
} |
139713744_0 | public void findAccountName(String accountName) {
Single.fromCallable(() -> {
AccountRequest request = new AccountRequest();
request.accountName = accountName;
return request;
})
.flatMap(request -> mEosManager.findAccountByName(request))
.subscribeOn(mRxJavaSchedulers.getIo())
... |
139879729_5 | public double getDistance(
double latitude1, double longitude1, double latitude2,
double longitude2) {
double latitudeDifference = Math.toRadians(latitude2 - latitude1);
double longitudeDifference = Math.toRadians(longitude2 - longitude1);
latitude1 = Math.toRadians(latitude1);
latitude2 = Math.toRadians(latitu... |
139898859_32 | public static Arg parse(String[] inputArgs) {
Options options = setupOptions();
CommandLineParser parser = new DefaultParser();
Arg argument = new Arg();
try {
CommandLine commandLine = parser.parse(options, inputArgs);
if (commandLine.hasOption("h") || commandLine.hasOption("help")) {... |
139914932_102 | @Override
public HealthCheckResponse call() {
HealthCheckResponseBuilder builder = HealthCheckResponse.named("Kafka Streams topics health check").up();
try {
Set<String> missingTopics = manager.getMissingTopics(trimmedTopics);
List<String> availableTopics = new ArrayList<>(trimmedTopics);
... |
139927346_48 | public static <K, V> HashMap<K, V> newHashMap() {
return new HashMap<K, V>();
} |
139940514_67 | public static WxPayOrderNotifyResult fromXML(String xmlString) {
XStream xstream = XStreamInitializer.getInstance();
xstream.processAnnotations(WxPayOrderNotifyResult.class);
xstream.registerConverter(new WxPayOrderNotifyResultConverter(xstream.getMapper(), xstream.getReflectionProvider()));
WxPayOrderNotifyRes... |
140008964_0 | @Override
public void sleep(long dt, TimeUnit timeUnit) throws InterruptedException {
Thread.sleep((long) (timeUnit.toMillis(dt) / speedMultiplier));
} |
140073232_0 | @Override
public Optional<User> findOne(Long id) {
try {
PreparedStatement statement = connection.prepareStatement(SQL_FIND_BY_ID);
statement.setLong(1, id);
ResultSet resultSet = statement.executeQuery();
User result = null;
while (resultSet.next()) {
result = ro... |
140083500_1 | public void register(Class<?> cls) {
if (cls == null) {
throw new IllegalArgumentException("null is not a valid Language Driver");
}
if (!LANGUAGE_DRIVER_MAP.containsKey(cls)) {
try {
LANGUAGE_DRIVER_MAP.put(cls, (LanguageDriver) cls.newInstance());
} catch (Exception ex) {
throw new Scrip... |
140255413_6 | public CreateUserResponse createUser(CreateUserRequest request) {
try {
final String url = baseUrl + "/users";
return restTemplate.postForObject(url, request, CreateUserResponse.class);
} catch (HttpStatusCodeException cause) {
throw errorFactory.fromResponseBody(cause.getResponseBodyAsString(), cause.g... |
140269650_6 | public int getWithFirstString(Chord chord) {
int string = 1;
int[] frets = chord.getFrets();
int[] fingers = chord.getFingers();
while (frets[frets.length - 1] == frets[frets.length - 1 - string]) {
if(fingers!=null){
if(fingers[fingers.length-1]== fingers[fingers.length-1-string]){
... |
140540897_44 | @Override
public void processPayment(Payment payment, PaymentOperationData data) throws WirecardPaymenException {
String pares = data.getPares();
ThreeD threeD = objectFactory.createThreeD();
threeD.getContent().add(objectFactory.createThreeDPares(pares));
payment.setThreeD(threeD);
} |
140791705_1 | @Override
public CommonPager<LogVO> listByPage(final ConditionQuery query) {
CommonPager<LogVO> voCommonPager = new CommonPager<>();
final int currentPage = query.getPageParameter().getCurrentPage();
final int pageSize = query.getPageParameter().getPageSize();
int start = (currentPage - 1) * pageSize;
... |
140874933_5 | void generateServiceDispatcher(Writer output) throws IOException, TemplateException {
configuration.getTemplate("ServiceDispatcherTemplate.ftl").process(dispatcherContext, output);
} |
141102600_0 | public String toJsonString() throws JsonProcessingException {
return ObjectMapperProvider.get().writeValueAsString(this);
} |
141151532_1 | public ResultSet invoke(String from, String to, int amount) {
InvokeProposal proposal = ProposalBuilder.invoke();
proposal.clientUser("user1");
return accountRepo.invoke(proposal, "move", from, to, amount);
} |
141169138_0 | public String getMessage() {
return message;
} |
141267788_13 | String getApplicationId() {
return configuration.get(APPLICATION_ID).orElseThrow(() -> new IllegalArgumentException("Application ID is missing"));
} |
141270248_1 | public static boolean createUserFolder(final String folder) throws IOException {
final String tempPath = FileManager.libDir + OsUtils.getSeparator() + LibPaths.USER.getDirName()
+ OsUtils.getSeparator() + folder.replaceAll("\\s+", "_");
return FileManager.createDirectory(tempPath);
} |
141304234_0 | @Override
public int read(char[] cbuf, int off, int len) throws IOException {
if (off < 0) throw new IllegalArgumentException("off < 0");
if (off >= cbuf.length) throw new IllegalArgumentException("off >= cbuf.length");
if (len <= 0) throw new IllegalArgumentException("len <= 0");
if (!this.preparedToR... |
141384267_4 | public static VariableProfileTableBuilder builder() throws MenohException {
final PointerByReference ref = new PointerByReference();
checkError(MenohNative.INSTANCE.menoh_make_variable_profile_table_builder(ref));
return new VariableProfileTableBuilder(ref.getValue());
} |
141402922_2 | private Absence(Function<T, ?> toBeAbsent) {
super("Absence of " + (isLoggable(toBeAbsent) ? toBeAbsent.toString() : "<not described value>"),
o -> ofNullable(o)
.map(o1 -> {
Class<?> clazz = o1.getClass();
if (Boolean.class.isAssignabl... |
141550213_24 | public INDArray scoreArray(INDArray labels, INDArray preOutput, IActivation activationFn, INDArray mask) {
INDArray scoreArr;
INDArray output = activationFn.getActivation(preOutput.dup(), true);
INDArray mPluss = Nd4j.zeros(output.shape()).addi(mPlus);
INDArray mMinuss = Nd4j.zeros(output.shape()).addi(mMinus)... |
141573898_0 | @Override
public List<SysRole> SelectAll() {
return sysRoleMapper.selectAll();
} |
141591175_0 | @Override
public void define(Context context) {
NewRepository repository = context
.createRepository(REPOSITORY_KEY, Java.KEY)
.setName("Sonar Secrets Java");
List<Class> checks = RulesList.getChecks();
new RulesDefinitionAnnotationLoader().load(repository, Iterables.toArray(checks, Class.class));
for... |
141626961_1 | @Override
public DateTime getNextAlarmDate(DateTime executionDate) {
return getBuildingStrategy().getNextAlarmDate(executionDate);
} |
141633330_19 | @Override
public boolean isWritable() {
return true;
} |
141671109_207 | public T send() throws IOException {
return web3jService.send(this, responseType);
} |
141752763_0 | @Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
HeaderMap responseHeaders = exchange.getResponseHeaders();
responseHeaders.add(HttpString.tryFromString("Access-Control-Allow-Origin"), "*");
handler.handleRequest(exchange);
} |
142015901_2 | public static Builder route() {
return new RouterFunctionBuilder();
} |
142037766_2 | public static void greedyPartition(Collection<TestTime> testTimes, Set<TestContainer> testContainers) {
if(testContainers.isEmpty()) {
throw new IllegalArgumentException("Queue must be populated with a partition for each host");
}
List<TestTime> sortedList = testTimes.stream()
.sorted(C... |
142085119_2 | @VisibleForTesting
static String cleanVhost(String hostname) {
// Clean out any anything after any zero bytes (this includes BungeeCord forwarding and the
// legacy Forge handshake indicator).
String cleaned = hostname;
int zeroIdx = cleaned.indexOf('\0');
if (zeroIdx > -1) {
cleaned = hostname.substring(... |
142101199_0 | @FunctionName("HttpTrigger-Java")
public HttpResponseMessage run(
@HttpTrigger(name = "req", methods = {HttpMethod.GET, HttpMethod.POST}, authLevel = AuthorizationLevel.FUNCTION) HttpRequestMessage<Optional<String>> request,
final ExecutionContext context) {
context.getLogger().info("Java HTTP trigg... |
142141420_42 | @Override
public Response urlValidate(Map<String, Object> asset, String field) {
IURLManager urlManager = getURLManager(getProvider(asset));
Map<String, Object> fieldMap = urlManager.validateURL(getUrl(asset), field);
Response response = new Response();
response.getResult().put(field, fieldMap);
return response;
... |
142195981_33 | private Pattern3() {
this(Pattern1.build());
} |
142735552_0 | public SelectionManager(LauncherConfiguration conf, StatusManager statusManager, RequestManager requestManager) {
this.conf = conf;
this.statusManager = statusManager;
this.requestManager = requestManager;
} |
142747385_9 | public long[] getLon() {
return new long[]{minLon, maxLon};
} |
142758232_6 | public OrderList getAllCachedOrderHistory() {
return cachedOrderList;
} |
142763963_24 | public List<Integer> decompress(int riceParameter, byte[] data) {
BitSet bits = new BitSet(data.length * 8);
for (int i = 0; i < data.length; i++) {
BitSet bitsOfByte = BitSet.valueOf(makeArrayOfByte(data[i]));
for (int j = 0; j < bitsOfByte.size(); j++) {
bits.set(i * BYTE_BITS_SIZ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.