id
stringlengths
7
14
text
stringlengths
1
37.2k
190267909_31
@Override public int partition(Object messageKey, List<PartitionInfo> partitions) { if (localPartitions == null || isTimeToRefresh()) { checkAndAssignLocalPartitions(partitions); // set next refresh time updateNextRefreshTime(); } // we supply on local partitions to this base partitioner return loca...
190303335_18
public String getKey() { return key; }
190335075_411
public AbstractInsnNode[] toArray() { int currentInsnIndex = 0; AbstractInsnNode currentInsn = firstInsn; AbstractInsnNode[] insnNodeArray = new AbstractInsnNode[size]; while (currentInsn != null) { insnNodeArray[currentInsnIndex] = currentInsn; currentInsn.index = currentInsnIndex++; currentInsn = ...
190419065_18
public static String appendPathOntoUrl(Object urlString, Object... pathSection) { String[] args = new String[pathSection.length]; for (int i = 0; i < pathSection.length; ++i) { requireNonNull(pathSection[i]); args[i] = pathSection[i].toString(); } return appendPathOntoUrl(urlString.toStr...
190664284_131
@Override public int getNumRunningWorkers() { if(logger.isDebugEnabled()) { logger.debug("In getNumRunningWorkers"); } int cnt = jobToWorkerInfoMap.values().stream() .map(workerList -> workerList.stream() .filter(wm -> WorkerState.isRunningState(wm.getState())) ...
190686426_1
public int add(int n1,int n2) { return n1+n2; }
190690143_17
public JsApiCache buildFrom(Map<String, Object> registeredApis) { JsApiCache.Builder builder = new JsApiCache.Builder(); for(String apiBaseName : registeredApis.keySet()) { appendObject(builder, apiBaseName, registeredApis.get(apiBaseName)); } return builder.build(); }
190718318_3
public void addProduct(String name, int price) throws WarehouseException { if (price < 0) { throw new IllegalArgumentException("The product's price cannot be negative."); } Product product = new Product(name, price); productDao.addProduct(product); }
190783541_11
@Override public void startUploading(IDicomWebClient webClient, BackupState backupState) throws IBackupUploader.BackupException { scheduleUploadWithDelay(webClient, backupState); }
191232069_5
@Override public PerfIssue verifyPerfIssue(ExpectMaxHeapAllocation annotation, Allocation measuredAllocation) { Allocation maxExpectedAllocation = new Allocation(annotation.value(), annotation.unit()); if(maxExpectedAllocation.isLessThan(measuredAllocation)) { String assertionMessage = ...
191478424_0
@Override public boolean visit(MySqlSelectQueryBlock block) { String from = block.getFrom().toString(); for (String tableName : targetTableNames) { // 在tableName后加上“.”,定位表名,防止定位到子串 // 例如:esd包括了es StringBuilder sb = new StringBuilder(tableName); sb.append("."); String tabl...
191553604_1044
@Override public void onAddedJobGraph(final JobID jobId) { runAsync( () -> { if (!jobManagerRunnerFutures.containsKey(jobId)) { // IMPORTANT: onAddedJobGraph can generate false positives and, thus, we must expect that // the specified job is already removed from the SubmittedJobGraphStore. In this case, ...
191586445_1
@OnClose public void onClose(Session session, @PathParam("username") String username) { sessions.remove(username); broadcaster.removeSession(session); broadcaster.broadcast("#User: " + username + " left"); LOGGER.info(username + " is offline!"); }
192009782_4
public static RSAPrivateKey encryptedKeyPemStringToRsaPrivateKey(String encryptedPrivateKeyPemString, String privateKeyPassword) throws PopPrivateKeyParseException { if (StringUtils.isBlank(encryptedPrivateKeyPemString)) { throw new IllegalArgumentException("The encryptedPrivateKeyPemString should ...
192381473_43
public static boolean isIndexRequest(@NonNull Request esRequest) { // the path should contain /index/type/ or /index/type/id // type shouldn't be _search String[] pathFields = esRequest.getEndpoint().substring(1).split("/"); return (pathFields.length == Constants.INDEX_PATH_LENGTH || pathFi...
192457111_9
;
192508383_59
@Override public void execute(SensorContext context) { if (shouldExecuteOnProject()) { for (RuleViolation violation : executor.execute()) { pmdViolationRecorder.saveViolation(violation, context); } } }
192537952_91
@PostMapping("/permission/remove") @AdminRequired @RouteMeta(permission = "删除多个权限", module = "管理员") public UnifyResponseVO removePermissions(@RequestBody @Validated RemovePermissionsDTO validator) { adminService.removePermissions(validator); return ResponseUtil.generateUnifyResponse(8); }
192931477_1
public static IProviderServer getProviderServer() { String protocol = Property.Rpc.protocol; IProviderServer extension = ExtensionLoader.getExtensionLoader(IProviderServer.class).getExtension(protocol); return extension; }
192942452_46
public void ensureStopped() throws InterruptedException { for (int i = 0; i < 30; i++) { ApplicationStatus currentStatus = detailSupplier.get().applicationStatus(); switch (currentStatus) { case RUNNING: stop(); break; case STOPPING: ...
193047220_40
@Override public List<ComponentsValidator> create(FactoryOptions options) { List<ComponentsValidator> validators = new ArrayList<>(); // skeletons validators.add(new ComponentsHeadersValuesValidator(headerValidatorFactory.create(options))); validators.add(new ComponentsParametersValuesValidator(parameterValida...
193065376_4
@Substitute public static Object simpleDeepCopy(Object toCopy) { return JsonUtils.cloneJson(toCopy); }
193085253_6
public Optional<LeaveRequest> approve(UUID id) { Optional<LeaveRequest> found = repo.findById(id); found.ifPresent(lr -> lr.setStatus(Status.APPROVED)); return found; }
193109862_14
public boolean sameAs(DENOPTIMEdge other, StringBuilder reason) { if (this.getSourceDAP() != other.getSourceDAP()) { reason.append("Different source atom ("+this.getSourceDAP()+":" +other.getSourceDAP()+"); "); return false; } if (this.getTargetDAP() != other.getTargetDAP()) { reason.append("Different ...
193272759_264
public synchronized void addTrainingSet(TrainingSet trainingSet) { trainingSet.setTrainingSetID(trainingSetIDCounter++); trainingSets.add(trainingSet); }
193500053_6
static Map<String, List<String>> stripDuplicatePrefixes(Map<String, List<String>> fullList) { // Create a prefix tree var trie = mapToTrie(fullList); // Prune it var pruned = pruneEntry(trie); // Restore the map from the tree return trieToMap(pruned, ""); }
193582925_57
public static void testMain(String[] args) { new StorageCli(args, true).processCmd(); }
193657959_5
@Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; String jwt = resolveToken(httpServletRequest); if (StringUtils.hasTe...
193855481_2
@Override public void decrypt(final String passphrase, final Path targetPath) { try { final byte[] clearBytes = decrypt(this.getPath(), passphrase, targetPath); final String clearText = new String(clearBytes, StandardCharsets.ISO_8859_1); } catch (final GeneralSecurityException | IOException ex)...
193945625_21
protected ProgressEvent<ResourceModel, CallbackContext> handleRequest( final AmazonWebServicesClientProxy proxy, final ResourceHandlerRequest<ResourceModel> request, final CallbackContext callbackContext, final ProxyClient<CloudFormationClient> proxyClient, final Logger logger) { final Resource...
194059614_0
@Override public AuthorizedAppDTO apply(OAuthConsumerAppDTO oAuthConsumerAppDTO) { AuthorizedAppDTO authorizedAppDTO = new AuthorizedAppDTO(); authorizedAppDTO.setAppId(oAuthConsumerAppDTO.getApplicationName()); authorizedAppDTO.setClientId(oAuthConsumerAppDTO.getOauthConsumerKey()); return authorized...
194304228_11
public static String unicodeCodePoint2PercentHexString(int codePoint, String charsetName) { if (!Character.isDefined(codePoint)) throw new IllegalArgumentException( String.format("Given code point [U+%1$04X - %1$d] not assigned to an abstract character.", codePoint)); if (Character.getType(codePoint) ==...
194333585_127
static String constructMetadataParamQuery(List<String> metadataSelectCols) { String pkColsCsv = getPksCsv(); String query = QueryUtil.constructSelectStatement(OUTPUT_METADATA_TABLE_NAME, metadataSelectCols, pkColsCsv, null, true); String inClause = " IN " + QueryUtil.constructPar...
194654807_4
public Path install(BuildahConfiguration buildahConfiguration) throws IOException { final LocationResolver locationResolver = this.locationResolverChain.getLocationResolver(buildahConfiguration); return install(locationResolver.getBuildahName(), locationResolver.loadBuildahResource(), buildahConfiguration); }
194726816_0
public static MultiSignaturePublicKey create(List<PublicKey> publicKeys, int threshold) { byte[] multiSigPublicKeyBytes = new byte[publicKeys.size() * PUBLIC_KEY_LENGTH + 1]; int counter = 0; for (PublicKey pk : publicKeys) { byte[] pkBytes = pk.toArray(); System.arraycopy(pkBytes, 0, multiS...
194776722_7
public boolean isVertical() { return this.isVerticalLine; }
194907949_1
@NotNull @Override public Ore getOre() { return this.ore; }
195077933_15
@GetMapping(path = "/list") @Authorize(value = { AuthConstant.AUTHORIZATION_SUPPORT_USER }) public ListAccountResponse listAccounts(@RequestParam int offset, @RequestParam @Min(0) int limit) { AccountList accountList = accountService.list(offset, limit); ListAccountResponse listAccountResponse = new Lis...
195192171_1
public Map<String,String> transferMapValue(Map<String, String> params){ Map<String,String> postmap=new HashMap<String,String>(); Iterator entries = params.entrySet().iterator(); while (entries.hasNext()) { Map.Entry entry = (Map.Entry) entries.next(); String paramkey = (String)entry.getKey(); String paramv...
195288202_0
@PostMapping ResponseEntity<?> post(@Valid @RequestBody Car car) throws URISyntaxException { /** * TODO: Use the `save` method from the Car Service to save the input car. * TODO: Use the `assembler` on that saved car and return as part of the response. * Update the first line as part of the above i...
195297601_0
public BigDecimal convert(BigDecimal amount, String currencyFrom, String currencyTo) { BigDecimal exchangeRate = currencyDto.getExchangeRate(currencyFrom, currencyTo); return amount.multiply(exchangeRate); }
195330123_50
@Override public Status scan(String table, String startkey, int recordcount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) { // if this is a "new" table, init HTable object. Else, use existing one if (!tableName.equals(table)) { currentTable = null; try { getHTable(table); ...
195429957_0
public static Span getSpan() { Context c = Vertx.currentContext(); return c == null ? null : c.getLocal(ACTIVE_SPAN); }
195506596_11
public ResponseEntity<InlineResponse200> grantUserTokenPost(@ApiParam(value = "") @Valid @RequestBody GrantInfo body) { String accept = request.getHeader("Accept"); if (accept != null && accept.contains("application/json")) { try { return new ResponseEntity<InlineResponse200>(objectMapper.re...
195650526_707
static String toJavaName(String opensslName) { if (opensslName == null) { return null; } Matcher matcher = PATTERN.matcher(opensslName); if (matcher.matches()) { String group2 = matcher.group(2); if (group2 != null) { return group2.toUpperCase(Locale.ROOT) + "with" + ...
195708935_5
public ParsedOutput parse(List<String> args) { final Command commandName = this.findCommand(args); fillShortAndLongOptions(commandName); final Map<CommandFlag, Object> options = this.findOptions(args); return new ParsedOutput(commandName, args, options); }
196110471_5
public static StringBuilder appendByteArrayAsHex(StringBuilder sb, byte[] ab, int of, int cb) { sb.ensureCapacity(sb.length() + cb * 2); while (--cb >= 0) { int n = ab[of++]; sb.append(nibbleToChar(n >> 4)) .append(nibbleToChar(n)); } return sb; }
196320779_0
public CasterClient(ServerInfo serverInfo) { this.serverInfo = serverInfo; }
197006279_77
public static Entry entry(String name) throws BlockException { return Env.sph.entry(name, EntryType.OUT, 1, OBJECTS0); }
197111529_1
public static void park(Object blocker) { Thread t = Thread.currentThread(); setBlocker(t, blocker); UNSAFE.park(false, 0L); setBlocker(t, null); }
197192301_6
public static ArtifactType discoverType(ContentHandle content, String contentType) throws InvalidArtifactTypeException { boolean triedProto = false; // If the content-type suggests it's protobuf, try that first. if (contentType == null || contentType.toLowerCase().contains("proto")) { triedProto = ...
197277844_0
static String getPayload(String token) { int first = token.indexOf('.'); int last = token.lastIndexOf('.'); return token.substring(first+1, last); }
197569657_35
public long count(String sql, Collection params) { return this.get(Number.class, getDialect().count(sql, params)) .longValue(); }
197729287_0
@Bindable public String getTitle() { return title; }
197782274_0
@Override public int compareTo(Contact contact) { String givenName1 = this.givenName == null ? "" : this.givenName.toLowerCase(); String givenName2 = contact == null ? "" : (contact.givenName == null ? "" : contact.givenName.toLowerCase()); return givenName1.compareTo(givenName2); }
198181246_11
public List<ServiceInstance> getInstances(Microservice microservice, String revision) { List<ServiceInstance> instanceList = new ArrayList<>(); Response response = null; try { Map<String, String> heades = Maps.newHashMap(); String CONSUMER_HEADER = "X-ConsumerId"; heades.put(CONSUMER_HEADER, RegisterC...
198181508_0
public static String getComputerIdentifier() { SystemInfo systemInfo = new SystemInfo(); OperatingSystem operatingSystem = systemInfo.getOperatingSystem(); HardwareAbstractionLayer hardwareAbstractionLayer = systemInfo.getHardware(); CentralProcessor centralProcessor = hardwareAbstractionLayer.getProces...
198220069_27
public List<ByteBuffer> filter(Consumer consumer, List<ByteBuffer> byteBuffers, FilterCallback filterCallback) throws JoyQueueException { FilterPipeline<MessageFilter> filterPipeline = filterRuleCache.get(consumer.getId()); if (filterPipeline == null) { filterPipeline = createFilterPipeline(consumer.get...
198222234_67
@Override public <I, O> ProcessingStage<I, O> create(Engine engine, Stage.FlatMapIterable stage) { Function<I, Iterable<O>> mapper = Casts.cast(stage.getMapper()); return new FlatMapIterable<>(mapper); }
198238470_474
public void assertAllowedForProject(SecHubConfiguration configuration) { List<URI> allowed = fetchAllowedUris(configuration); Optional<SecHubInfrastructureScanConfiguration> infrascanOpt = configuration.getInfraScan(); if (infrascanOpt.isPresent()) { SecHubInfrastructureScanConfiguration infraconf = infrascanOpt....
198355705_9
public ElasticSqlParseResult parse(String sql) throws ElasticSql2DslException{ Walker walker=new Walker(sql); ElasticsearchParser.SqlContext sqlContext = walker.buildAntlrTree(); ElasticDslContext elasticDslContext=new ElasticDslContext(sqlContext); for(QueryParser parser:buildSqlParserChain()){ ...
198569702_7
@Override public byte[] decrypt(byte[] encryptData) { try { javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(KEY_ALGORITHM); cipher.init(javax.crypto.Cipher.DECRYPT_MODE, privateKey); byte[] result = cipher.doFinal(Base64.getDecoder().decode(encryptData)); return result; ...
198857750_2
public RemoteWebDriver start() { driver = createRemoteWebDriver(getSauceUrl(), sauceOptions.toCapabilities()); return driver; }
198950692_148
public PageResultPlus<CommonLog> getCommonLogList(CommonLogParams commonLogParams) { Long commonLogCount = this.baseMapper.getCommonLogCount(); if (commonLogParams.getGtValue() == null) { commonLogParams.setGtValue(commonLogCount); } List<CommonLog> commonLogList = this.baseMapper.getCommonLog...
199027540_43
public long getTime() { return time; }
199046636_39
@PutMapping("/admin/tag/update") public Response updateOne(@RequestParam("id") Long id, @RequestParam("name") String name) { return ResponseUtil.success(tagService.update(id, name)); }
199262429_198
public boolean isEmpty() { return root == null; }
199309560_3
public OpenAPI generate() { return generate(OpenApiGeneratorConfigBuilder.defaultConfig().build()); }
199431217_0
public void recover(Path path, long min, Properties properties) throws IOException { Files.createDirectories(path); this.base = path.toFile(); this.config = toConfig(properties); bufferPool.addPreLoad(config.getFileDataSize(), config.getCachedFileCoreCount(), config.getCachedFileMaxCount()); recov...
199491032_2
Result<? extends Record> run() { // Pull the latest state from the DB model.updateData(); // Run the solver and return the virtual machines table with solver-identified values for the // controllable__physical_machines column return model.solve(VIRTUAL_MACHINES_TABLE); }
199626064_3
@Override public int read() throws IOException { char[] buffer = new char[1]; int read = read(buffer); if (read < 0) { return read; } else { return buffer[0]; } }
199703640_0
@SuppressWarnings("unchecked") @Override public <T extends Actor> Collection<Class<? extends T>> findActorInterfaces(final Predicate<Class<T>> predicate) { List<Class<? extends T>> interfaces = null; for (Class<?> concreteInterface : concreteImplementations.keySet()) { if (predicate.test((Class<T>) ...
199829201_0
@Override public Result<NewCustomerPartResponse> partNewCustomerActivity(NewCustomerPartRequest request) { ContextParam contextParam = new ContextParam(FunctionCodeEnum.ACTIVITY_PARTICIPATE, request, ActivityTypeEnum.NEW_CUSTOMER_GIFT.getType()); return activityDispatcher.dispatcher(contextParam); }
199902324_0
@POST @ApiOperation(value = "Create a new Card", notes = "Create a card using json") public Response createCard(Card card){ card = cardService.createCard(card); return Response.created(getGetUri(card)).build(); }
200004447_0
public FullState getCurrentFullState(int pid) { try { CpuState cpuState = StatParser.getInstance().parseCpuInfo(); File processFile = new File("/proc", String.valueOf(pid)); ProcessState processState = StatParser.getInstance().parseProcessInfo(pid); File taskFile = new File(processFi...
200044570_0
public static byte[] bytesFromHexString(String s) { if ((s.length() % 2) != 0) { throw new IllegalArgumentException( "Converting to bytes requires even number of characters, got " + s.length()); } int len = s.length(); byte[] data = new byte[len / 2]; for (int i = 0; i < len;...
200053873_12
@ReactMethod public void enableVerboseLogging() { MarketingCloudSdk.setLogLevel(MCLogListener.VERBOSE); MarketingCloudSdk.setLogListener(new MCLogListener.AndroidLogListener()); }
200062847_31
@Nonnull @Override public CompletionItemKind getKind() { return CompletionItemKind.Method; }
200492090_13
@Override public Behavior<DssRestChannelHandlerCommand> create() { if (initializeBehavior.get()) { throw new DssUserActorDuplicateBehaviorCreateException("Cannot setup twice for one object"); } initializeBehavior.set(true); return Behaviors.setup(this::dssRestHandler); }
200539506_37
public GenericResponse deleteModel(Integer printId) { GenericResponse response = new GenericResponse(); response.setSuccess(false); response.setMessage("File could not be deleted"); response.setHttpStatus(HttpStatus.BAD_REQUEST); PrintJob printJob = printJobRepo.findPrintJobById(printId); if(p...
200620451_122
@Override public List<Place> findAll() { log.info(LogMessage.IN_FIND_ALL); return placeRepo.findAll(); }
200642013_0
public Response validateAndAdd(ProductFormData productData) { if ("".equals(productData.getName())) { return new Response(0, -2, "Missing Name"); } if ("".equals(productData.getType()) ) { return new Response(0, -2, "Missing Type"); } Product product = new Product(productData.getName...
200703047_38
public AccountsCreateResponse accounts(List<String> accounts) { this.accounts = accounts; return this; }
200725818_0
@Override public OperationResult transform(Transaction transaction) { String error = validateOperation(transaction); if (error != null) { return new OperationResult(false, transaction, null, error); } BigDecimal creditAmount = transaction.getCreditAmount(); if (Transaction.Type.EXCHANGE.equals(transaction.getT...
200810412_178
@Override public void run(ApplicationArguments args) { log.warn("Do not run this tool at the same time as replicating to the target table!"); if (isDryRun) { log.warn("Dry-run only!"); } try { metastore = clientSupplier.get(); housekeepingPaths = fetchHousekeepingPaths(beekeeperRepository); vacu...
200980523_46
public void gameStateChanged(GameState newState) { Set<Listener> listenersForNewState = recalculateListenersForNewState(newState); this.registerNew(listenersForNewState); }
201021482_12
@Override public void describe(SensorDescriptor descriptor) { descriptor.name("OpenAPI Scanner Sensor") .onlyOnFileType(InputFile.Type.MAIN) .onlyOnLanguage(OpenApi.KEY); }
201080381_1239
public Quotation companyAddress2(String companyAddress2) { this.companyAddress2 = companyAddress2; return this; }
201179882_3
public float getTilt() { return mTilt; }
201185153_17
HttpStatus exceptionToStatus(final Exception exc) { if (exc instanceof BankService.ClientNotFoundExc) { return HttpStatus.NOT_FOUND; } if (exc instanceof Client.NotManagedAccountExc) { return HttpStatus.NOT_FOUND; } if (exc instanceof Client.NotOwnerExc) { return HttpStatus.FORBIDDEN; } if (exc instanceof ...
201194795_9
@Override public String getLanguageVersion() { return System.getProperty("java.version"); }
201285390_53
@Override public boolean cleanUnusedTopic(String cluster) throws RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException, MQClientException, InterruptedException { return defaultMQAdminExtImpl.cleanUnusedTopicByAddr(cluster); }
201327708_0
public static ProtoString parse(String encoded) { // Since this string is coming from the lexer/parser, it should be guaranteed to be // non-null, not empty (at least 1 quote), and start with either a single or double quote. if (encoded.isEmpty()) { throw new IllegalArgumentException("String must not be empty...
201347287_2
@Nullable public String getString(int id) { final String result = strings.get(id); if (result == null) { // String not loaded or doesn't exist. return loadString(id); } else { return result; } }
201427469_11
public static Action pickProvider(PackageManager pm) { // Setting the Intent Data as seen at // https://cs.android.com/android/platform/superproject/+/fd994cf9ef8207ad03dc3a1d831e9263ddfd4469:packages/apps/PermissionController/src/com/android/packageinstaller/role/model/BrowserRoleBehavior.java Intent query...
201612522_16
@Override public ScriptEngine getScriptEngine() { return new JShellScriptEngine(); }
201655283_0
public String Execute(String sql) { this.generateStatements(sql); return parseStatements(); }
202008893_71
public static void updatePromLookup(final int envId, int compId, String httpPath){ Session session = HibernateConfig.getSessionFactory().getCurrentSession(); Transaction txn = session.beginTransaction(); Query query = session.createQuery(HQLConstants.UPDATE_PROM_LOOKUP_DETAILS); query.setString("httpPath", httpPat...
202089894_59
public static AsymmetricKeyPair initAsymmetricKeyPair() { return RSACoder.initKey(); }
202309300_0
public static String createSignedJwt(String user, PrivateKey privateKey) throws Exception { Calendar c = Calendar.getInstance(); c.add(Calendar.MINUTE, 1); Date d = c.getTime(); return createSignedJwt(user, d.getTime() / 1000, privateKey); }