id
stringlengths
7
14
text
stringlengths
1
37.2k
246774970_0
public static String doPost(String urlStr, List<BasicHeader> headers) { return doExecute(urlStr, new HttpPost(check(urlStr)), headers); }
247595825_0
@Bean @ConditionalOnMissingBean @ConditionalOnAvailableEndpoint public RedisDescribeAvailableResourceEndpoint redisDescribeAvailableResourceEndpoint() { return new RedisDescribeAvailableResourceEndpoint(aliCloudProperties, redisProperties); }
248283523_3
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) public RegionsDto getAllRegions() { LOGGER.info("REGION GET ALL API"); var allRegions = service.getAllRegions(); var dtoList = new ArrayList<RegionDto>(); allRegions.forEach(region -> { var dto = new RegionDto(region); dtoList.add...
248529016_1
public static boolean isRetryHandlerMethod(Class<?> targetClass, Method method) { if ("handle".equals(method.getName()) && method.getParameterCount() == 1 && method.isBridge() && method.isSynthetic()) { //RetryHandler接口有泛型,需要特殊处理 return true; } Type interfaceType = getRetryHandlerGenericInte...
248826224_5
public ISBN getIsbn() { return isbn; }
248828585_8
public boolean validateToken(String authToken) { try { Jwts.parser().setSigningKey(key).parseClaimsJws(authToken); return true; } catch (JwtException | IllegalArgumentException e) { log.info("Invalid JWT token."); log.trace("Invalid JWT token trace.", e); } return false; ...
249609964_0
public static boolean checkFileExists(String file) { Path path = Paths.get(file); if (Files.exists(path)) { return true; } return false; }
249842163_0
public static MessageSizeResponse parse(JSONObject obj) throws JSONException { MessageSizeResponse response = new MessageSizeResponse(); if (obj.has("sizeOfQueryResponse")) { response.sizeOfQueryResponse = obj.getInt("sizeOfQueryResponse"); } return response; }
250091476_0
static String getPrincipalFromKeytab(String keytabLocation) { try { return Keytab .read(new File(keytabLocation)) .getEntries().get(0) .getPrincipalName() .split("@")[0] .replace('\\', '/'); } catch (Exception ex) { throw new TokenServiceException(ex.getMessage(), Err...
250721746_0
@Async("gitCloneExecutor") public void clone(GitInfo gitInfo) { log.debug("开始clone,git信息[{}]", gitInfo); //创建临时文件夹 Path tempDirectory; try { tempDirectory = Files.createTempDirectory(gitProxyProperties.getTempDirPath(), gitInfo.getRepositoryName()); } catch (IOException e) { thr...
251049092_17
@Override public List<WeatherCondition> getConditions() { return Collections.unmodifiableList(new ArrayList<WeatherCondition>(this.conditions)); }
251068401_3
public static DateTime withStartOfQuarter(DateTime dateTime) { int monthOfYear = dateTime.getMonthOfYear(); DateTime firstMonthOfQuarter; if (monthOfYear >= DateTimeConstants.OCTOBER) { firstMonthOfQuarter = dateTime.withMonthOfYear(DateTimeConstants.OCTOBER); } else if (monthOfYear >= DateTimeC...
251477582_0
public BigDecimal getBalance(String address) { List<UTXO> unspent = this.getUnspent(Arrays.asList(address)); Long balance = 0L; for (UTXO utxo : unspent) { balance = balance + utxo.getValue().value; } logger.info(unspent.toString()); return new BigDecimal(balance / 100000000.0).setScale(...
252293371_1
public static void generateAllTCNsFromReport(byte[] report, INextTCNCallback callback) { int from = readUShort(report, 64); byte[] bstartTCK = Arrays.copyOfRange(report, 32, 64); TCNProtoGen ratchet = new TCNProtoGen(report[68], getRvkfromReport(report), bstartTCK, from - 1); int to = readUShort(report,...
252902347_4
@Override public void onApplicationEvent(WebServerInitializedEvent event) { File portFile = getPortFile(event.getApplicationContext()); try { String port = String.valueOf(event.getWebServer().getPort()); createParentFolder(portFile); FileCopyUtils.copy(port.getBytes(), portFile); portFile.deleteOnExit(); } ...
253269900_126
List<Atom> getAtomList() { return new ArrayList<Atom>(atomCollection); }
253595061_79
public String validate() { List<String> validationIssues = new LinkedList<>(); if(maximumExecutionSeconds < 0) validationIssues.add("maximumExecutionSeconds must be non-negative"); return validationIssues.size() == 0 ? null : String.join(",", validationIssues); }
254264048_0
public static ASTNode parse(final String sql) { ParseTree parseTree = createParseTree(sql); return new SQLVisitor().visit(parseTree.getChild(0)); }
255469961_50
@ExceptionHandler(RuntimeException.class) public ResponseEntity<Object> handleRuntimeException(RuntimeException exception) { return new ResponseEntity<>(createResponseBody(exception.getMessage(), BAD_REQUEST), new HttpHeaders(), BAD_REQUEST); }
255633533_25
static List<ExecutionNode> sort(List<ExecutionNode> nodes) { // priority is initial order in the list, node earlier in the list // would be always executed earlier if possible Map<String, Integer> priorityMap = new HashMap<>(); Map<String, Integer> degreeMap = new HashMap<>(); Map<String, ExecutionNode> looku...
256285632_3
@Override public void stopScans(@NonNull ScanCallback scanCallback) { try { if (!bluetoothAdapter.isEnabled()) { BeaconLogger.e( "Can't stop the BLE scans since BluetoothAdapter is not enabled, most likely " + "the scans weren't started either (check if Blueto...
257682134_30
public static String createHash(String password, String salt, int iterations, int dkLen) throws NoSuchAlgorithmException, InvalidKeySpecException { byte[] saltBytes = salt.getBytes(StandardCharsets.UTF_8); byte[] hash = pbkdf2(password.toCharArray(), saltBytes, iterations, dkLen); return toHex(hash); }
259639325_11
public void setOnCoord(Object value, int... coords) { checkCoordsLength(coords); if (value != null) { if (this.isScalar()) { this.data = value; } else if (value.getClass().isArray()) { this.setArrayOnCoord(value, coords); } else { this.setSingleOnCoord...
259929534_5
@DeleteMapping() public ResponseEntity<Book> deleteAll() { LOGGER.info("Delete all books"); books.clear(); return ResponseEntity.noContent().build(); }
260172508_9
@Override public void close() { if (!isClosed.compareAndSet(false, true)) { return; } // unmap and close file for (Tuple2<RandomAccessFile, MappedByteBuffer> tuple : memoryMappedFiles) { PlatformDependent.freeDirectBuffer(tuple.f1); IOUtils.closeQuietly(tuple.f0); } // cleanup directories removeCandidate...
261970003_3
public <T> T query(final String baseQuery, final ResultSetHandler<T> resultHandler, final Object... params) throws SQLException { try { return this.queryRunner.query(baseQuery, resultHandler, params); } catch (final SQLException ex) { // todo kunkun-tang: Retry logics should be implemented here. ...
263047969_22
@MainThread public void restoreState(@NonNull S state) { store.restoreState(state); }
263923665_38
public int calculateNOC(String filepath, String analyzerType) throws IOException { if(analyzerType.equals("regex")) { String sourceCode = fileReader.readFileIntoString(filepath); Pattern pattern = Pattern.compile(".*\\s*class\\s+.*"); Matcher classSignatures = pattern.matcher(sourceCode); int cla...
264141019_7
@Override protected Stream<DataPoint> streamDataPoints() { return Utils.getStream(nRows) .mapToObj(this::mapIndexToDataPoint); }
264503046_2
@Nullable protected T initClass() { T instance = null; try { final Constructor<T> constructor = getClazz().getDeclaredConstructor(); constructor.setAccessible(true); instance = constructor.newInstance(); } catch (NoSuchMethodException e) { getLogger().log(Level.SEVERE, e, ()...
265127043_6
public static void PKCS10CertificationRequest2File(PKCS10CertificationRequest request, FileOutputStream stream) { JcaPEMWriter jcaPEMWriter = new JcaPEMWriter(new OutputStreamWriter(stream)); try { jcaPEMWriter.writeObject(request); jcaPEMWriter.close(); } catch (IOException e) { e.p...
265243047_3
public static String convertRegularExpr (String str) { if(str == null){ return ""; } String pattern = "\\\\(\\d{3})"; Pattern r = Pattern.compile(pattern); while(true) { Matcher m = r.matcher(str); if(!m.find()) { break; } String num = m.group(1)...
265564812_1
@SneakyThrows public void destroy() { server.stop(); server.destroy(); }
266285061_0
@Override public ResponseEntity<BlueprintResponse> get(String key) { return ResponseEntity.ok(blueprintService.get(key)); }
266937709_0
public static List<SearchJDResultDTO> parseJd(String keyword) { try { String url = "https://search.jd.com/Search?keyword=" + URLEncoder.encode(keyword, CharsetKit.UTF_8); Document document = Jsoup.connect(url).timeout(5 * 1000).get(); Element elementById = document.getElementById("J_goodsLis...
267134885_4
public PanacheQuery<User> findByFirstName(final String firstName) { return find("firstName", firstName); }
267999301_0
public Document getXmlDocument() { return xmlDocument; }
269759605_7
public void setColumns(int columns) { this.columns = columns; }
271229375_1
public static Time toTime(String s) { try { return new Time(StdDateFormat.getTimeInstance().parse(s).getTime()); } catch (ParseException e) { throw new IllegalArgumentException(s); } }
276117258_29
public static List<NativeQuery> parseJdbcSql(String query, boolean standardConformingStrings, boolean withParameters, boolean splitStatements, boolean isBatchedReWriteConfigured, String... returningColumnNames) throws SQLException { int numOfOverSymble = 0; boolean haveProcedure = false; boolean...
Free AI Image Generator No sign-up. Instant results. Open Now