id
stringlengths
7
14
text
stringlengths
1
37.2k
42050815_55
@Override BuildResult execute(SonarRunner build, Configuration config, Map<String, String> adjustedProperties, CommandExecutor create) { return execute(build, config, adjustedProperties, new SonarScannerInstaller(config.locators()), create); }
42054620_2
static long gcd(long num, long den) { long left, right; if (num < den) { left = den; right = num; } else { left = num; right = den; } Function<LongBiFunction, LongBiFunction> lf = f -> (l, r) -> r == 0? l : f.apply(r ,l % r); LongBiFunction fun = zComb(lf); re...
42057361_181
@Override public boolean equals(Object other) { if (other instanceof TIntArrayList) { return delegate.equals(((TIntArrayList) other).delegate); } return false; }
42089429_26
@Override public HttpStatus checkAuth(final AuthConfig authConfig) { return checkAuthObs(authConfig).onErrorReturn(e -> { if (e instanceof ServiceException) { logger.info("checkAuth threw RestServiceCommunicationException"); ServiceException restException = (ServiceException) e; ...
42098141_0
public static Builder builder(DoubleColumnId id) { return new Builder(id); }
42109069_17
public String authenticatingAuthority() { return federatedUser().getAuthenticatingAuthority(); }
42171410_68
public Searcher searchEndword(final String word) throws EBException { if (!hasEndwordSearch() || StringUtils.isBlank(word)) { return new NullSearcher(); } byte[] b = _unescapeExtFontCode(word); if (b.length == 0) { return new NullSearcher(); } int type = ALPHABET; if (_book....
42175803_8
public Optional<Map<AngelixLocation, Node>> repair(Map<AngelixLocation, Expression> original, AngelicForest angelicForest, Map<AngelixLocation, Multiset<Node>> components, ...
42182481_0
@Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { Map<PersistentUnit, List<? extends AnnotationMirror>> units = new HashMap<PersistentUnit, List<? extends AnnotationMirror>>(); for (Element elem : roundEnv.getElementsAnnotatedWith(PersistentUnit.class)) { ...
42186064_2
@Override public Parameter[] getParameters(InvokeTarget target) { return getParameters(target, null); }
42191480_0
@Override public void onDrawOver(Canvas canvas, RecyclerView parent, RecyclerView.State state) { if (positionAdapter == null) { positionAdapter = new PositionAdapter(parent.getLayoutManager(), offset); } int childCount = parent.getChildCount(); for (int i = 0; i < childCount; i++) { View child = parent...
42201162_17
public static <T> T callDefaultConstructor(Class<T> klass) throws Throwable{ //TODO: not only should be atMostOnce in a test, but in the whole suite/archive if(klass == null){ throw new IllegalArgumentException("No specified class"); } //RuntimeSettings Constructor<T> constructor; tr...
42250911_1
@SafeVarargs public static <T> Optional<T> firstPresent(Supplier<Optional<T>>... optionals) { return Arrays.stream(optionals) .map(Supplier::get) .flatMap(Utils::stream) .findFirst(); }
42251014_14
public static <E extends Exception> void perform(Class<E> cls, PerformAction action) throws E { try { action.action(); } catch (Exception e) { throw prepareException(cls, e.getMessage(), e); } }
42256650_0
public static int compareVersions(String v1, String v2) { if (v1 == null && v2 == null) { return 0; } else if (v1 == null) { return -1; } else if (v2 == null) { return 1; } String[] v1Parts = v1.split("[.]"); String[] v2Parts = v2.split("[.]"); int maxLength = Math.max(v1Parts.length, v2Parts.length); ...
42271567_0
public Toolbar getToolbar() { return toolbar; }
42273328_17
public static byte[] sign(String toSign, String secret) throws NoSuchAlgorithmException, InvalidKeySpecException, InvalidKeyException, UnsupportedEncodingException { validateParameters(toSign, secret); String password = secret; PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray()); SecretKeyFactory kf = Secre...
42290369_549
public static List<String> listDirs(Configuration hadoopConf, String pathname) throws IOException { return Arrays .stream(FileSystem.get(hadoopConf).listStatus(new Path(pathname))) .filter(FileStatus::isDirectory) .map(x -> x.getPath().toString()) .collect(Collectors....
42304749_177
public void removeJobNodeIfExisted(final String node) { if (isJobNodeExisted(node)) { regCenter.remove(jobNodePath.getFullPath(node)); } }
42324543_6
public static Topic getTopic(String name) { return new TopicImpl(new String[] {name}); }
42427904_0
public BaseFilter(Map config) { super(config); this.config = config; this.nextFilter = null; this.outputs = new ArrayList<BaseOutput>(); final List<String> ifConditions = (List<String>) this.config.get("if"); if (ifConditions != null) { IF = new ArrayList<TemplateRender>(ifConditions.s...
42441098_103
public static Object getAppropriateFieldValue(Class<?> type, String fieldValue) throws ODataUnmarshallingException { Class<?> wrappedType = PrimitiveUtil.wrap(type); if (String.class.isAssignableFrom(wrappedType)) { return fieldValue; } if (wrappedType == byte[].class) { return Base64.ge...
42446819_0
@SuppressWarnings("unchecked") @Override public KVOperation<K, V> copy(KVOperation<K, V> from, KVOperation<K, V> to) { KVOperationType type = from.type; to.type = from.type; to.queryID = from.queryID; to.isPartOfTransaction = from.isPartOfTransaction; if (to.isPartOfTransaction) { to.transactionID = from.transa...
42452274_0
public static boolean isValidEmail(String email){ if (null==email || "".equals(email)) return false; //Pattern p = Pattern.compile("\\w+@(\\w+.)+[a-z]{2,3}"); //简单匹配 Pattern p = Pattern.compile("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");//复杂匹配 Matcher m = p.matcher(email); return m.match...
42510870_0
public SpringCloudBlobStoreContext create(S3ServiceInfo serviceInfo, ServiceConnectorConfig serviceConnectorConfig) { Properties storeProviderInitProperties = new Properties(); storeProviderInitProperties.put(PROPERTY_S3_VIRTUAL_HOST_BUCKETS, serviceInfo.isVirtualHostBuckets()); this.loadProxy(storeProvider...
42525744_6
public boolean readRequest() throws IOException { checkProtocolVersion(); boolean correct = true; command = Command.fromCommandNumber(in.read()); if (command == null) { correct = false; } if (in.read() != 0x00) { correct = false; } int atype = in.read(); if (atype...
42537834_1
@Override public Integer reduce(Integer state, Object action) { return action instanceof Action ? reduce(state, (Action) action) : state; }
42548113_1
@Override public void close() { assertIsOpen(); flush(); compactor.close(); segments.close(); open = false; }
42572544_4
public static Map<String, Object> deBencode(byte[] data) throws IOException { ByteArrayInputStream in = new ByteArrayInputStream(data); BencodeInputStream bencode = new BencodeInputStream(in); Type type = bencode.nextType(); // Returns Type.DICTIONARY try { Map<String, Object> dict = bencode.r...
42591563_14
public static List<Pattern> toStartsWithPatternList(List<String> list) { return toStartsWithPatternList(list.stream()); }
42615957_109
public static boolean isAppDebuggable(Context context){ return ( 0 != ( context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE ) ); }
42624467_4
@Override public String toString() { return String.format("%s#%s", this.getClass().getSimpleName(), value); }
42658356_25
@SuppressWarnings("unchecked") public List<T> list() { return HibernateSessionFactory.doInTransaction(new IRequest<List<T>>() { @Override public List<T> doInTransaction(Session session) { return tuneCriteriaForList(createCriteria(session)).list(); } }); }
42676588_2
public static <K, V> Builder<K, V> newBuilder(Class<K> keyType, Class<V> valueType) { return new Builder<K, V>().setKeyType(keyType).setValueType(valueType); }
42678647_4
public List<String> extractIssuesFromMessage(String message) { List<String> issues = Lists.newArrayList(); Matcher matcher = ISSUE_PATTERN.matcher(message); while (matcher.find()) { issues.add(matcher.group(1)); } return issues; }
42691991_170
public void sendPushReceiptStatusInBackground(String pushId, ExecuteServiceCallback callback) { try { //null check if (pushId == null) { throw new NCMBException(NCMBException.INVALID_JSON, "pushId is must not be null."); } JSONObject params; try { par...
42725725_31
public static String createPassword(String rawPass, String salt) { Preconditions.checkNotNull(rawPass); String oldPW = createMD5Password(rawPass); return updateOldEncPass(oldPW, salt); }
42741668_0
public static Request GET(String path) { return Requests.GET(path); }
42742666_46
@Nullable public String getAuthorizationUrl() throws UnsupportedEncodingException { String authorizationCodeRequestUrl = authorizationCodeFlow.newAuthorizationUrl().setScopes(scopes).build(); if (redirectUri != null) { authorizationCodeRequestUrl += "&redirect_uri=" + URLEncoder.encode(redir...
42751387_138
public InputStream getProjectArchive(Id projId, String revision) { WebTarget webTarget = target("/api/projects/{id}/archive") .resolveTemplate("id", projId) .queryParam("revision", revision); webTarget = addDisableDirectDownloadParam(webTarget); return withFollowingRedirect(webTarget...
42751554_195
public User getByEmail(String email) throws NotFoundException { User user = userRepository.findOneByEmail(email); if (user == null) { throw new NotFoundException("Could not find the user with the email '" + email + "'!"); } return user; }
42774632_5
public SortNodeList parse(String sortExpression) { try { return createParser(sortExpression).parse(); } catch (ParseException | Error e) { throw new SortParsingException(e); } }
42776453_23
public OverpassQuery output(int limit) { return output(BODY, CENTER, QT, limit); }
42781657_9
public static int firstDayOfMonth(int dint) { return compose(year(dint), month(dint), 1); }
42785683_13
public Delivery getDelivery() { return delivery; }
42792977_13
public void start() { // Schedule a periodic group tracking job result = executorService.scheduleWithFixedDelay(new Runnable() { public void run() { try { // Publish the metric track events to subscriber metricPubSubEventHandler.getPubSubEventHandler().onNext(new MetricTrackEvent()); ...
42810825_0
@Override public void execute(Session session, Message msg) { if (session.getSessionUser() != null) { log.info("User {} already logged in.", session.getSessionUser()); return; } else { LoginMessage loginMsg = (LoginMessage) msg; User user = userStore.getUser(loginMsg.getLogin(),...
42830433_0
@Override public FileMetrics analyzeFile(String filepath, byte[] fileContent) { File fileToAnalyze = null; try { fileToAnalyze = createTempFile(fileContent, filepath); auditListener.reset(); checker.process(Collections.singletonList(fileToAnalyze)); return auditListener.getMetrics(); } catch (Chec...
42854263_0
@SuppressWarnings("unchecked") public <T> T retain(int id, OnCreate<T> onCreate) { if (state == null) { state = new SparseArray<>(); } T item = (T) state.get(id); if (item == null) { item = onCreate.onCreate(); if (item instanceof RetainState) { ((RetainState) item).s...
42866769_2
public boolean isValidExperimentID(String experimentID) { logger.info("isValidExperimentID: " + experimentID); String objectName = minioCompatibleID(experimentID) + MINIO_ID_DELIMITER + BenchFlowConstants.PT_PE_DEFINITION_FILE_NAME; try { return Failsafe.with(minioConnectionRetryPolicy).get(() -> { ...
42899767_43
public static RegistryClient createZookeeperClient(Config config) throws IOException { CuratorFramework client = CuratorFrameworkFactory.builder() .connectString(getZookeeperConnectionString(config)) .retryPolicy(new RetryOneTime(1000)) .build(); client.start(); return new ZookeeperR...
42946549_0
static void checkNotSupportedOperation(String operation, TypeName typeName) { if (operation == null || operation.length() == 0) { throw new ProcessingException(typeName + " is not supported type."); } }
42985510_2
public Path getPath() { return path; }
43027635_10
public static OperatorDefBuilder newInstance ( final String id, final Class<? extends Operator> clazz ) { failIfEmptyOperatorId( id ); checkArgument( clazz != null, "clazz must be provided" ); final OperatorSpec spec = getOperatorSpecOrFail( clazz ); final OperatorSchema schema = getOperatorSchema( cla...
43031095_30
@Before("classAnnotatedWithRxLogSubscriber(joinPoint) && onCompletedMethodExecution()") public void beforeOnCompletedExecution(JoinPoint joinPoint) { stopWatch.stop(); messageManager.printSubscriberOnCompleted(joinPoint.getTarget().getClass().getSimpleName(), stopWatch.getTotalTimeMillis(), counter.tally()); ...
43075480_113
public synchronized void setDefaultEndpoint(Endpoint newEndpoint) { if (null == newEndpoint) { throw new NullPointerException("endpoint required!"); } URI uri = newEndpoint.getUri(); if (null == uri) { throw new IllegalArgumentException("Endpoint protocol not supported!"); } String uriScheme = uri.getScheme()...
43077304_2
public static List<String> parseFunction(String str) { FunctionState state = FunctionState.START; ArrayList<String> list = new ArrayList<>(2); field.setLength(0); boolean parameters_ok = false; int quoteCount_InParentheses = 0; int leftNotMatchCount_InParentheses = 0; for (char c : str.to...
43088077_48
@Override public Object decode(Response response, Type type) throws IOException, FeignException { if (type.equals(InputStream.class)) { byte[] body = response.body() != null ? Util.toByteArray(response.body().asInputStream()) : new byte[0]; return new ByteArrayInputStream(body); ...
43089983_1
@Override public boolean matches(Header header) { return "Authorization".equals(header.name()) && header.value().startsWith("Basic"); }
43092584_0
private List<Snapshot> snapshots(Workout workout) throws IOException { List<Snapshot> snapshots = new ArrayList<>(); if (navigator.descent("Track")) { while (navigator.descent("Trackpoint")) { if (snapshots.size() == 0) { workout.location.set(location()); } snapshots.add(snapshot()); navigator.asc...
43098270_0
public String computeCDM(String jsonStr, Map<String, byte[]> inputModels) throws Exception { Input input = null; try { input = mapper.readValue(jsonStr, Input.class); } catch (Exception e) { throw new Exception("Trying to read the json input:"+jsonStr, e); } CDM_TimeSeries current...
43105609_64
public void text(String openId, String text) { text(openId, text, null); }
43115247_7
public static JNumber jNumber(BigDecimal value) { return new JNumber(value); }
43140254_0
public void setCellState(int row, int col, int state) { if (!areValidCoordinates(row, col)) { throw new IllegalArgumentException(row + ", " + col + " are not valid coordinates"); } board[row][col] = state; }
43193480_1
public String getMessage() { return message; }
43246449_65
@Transactional(readOnly = true) @Override public StateDTO getStateDtoByName(String name) { Assert.notNull(name); return converterService.convert(statesRepository.findByName(name), StateDTO.class); }
43254843_4
public void flush(Ingester ingester, boolean force) throws IOException { LOG.trace("flush(): force={}, bufferUsage={}", force, getBufferUsage()); flushInternal(ingester, force); }
43287559_81
public VerificationErrorCode getErrorCode() { return VerificationErrorCode.INT_02; }
43294683_52
public static Term findTerm(String termName) { // normalise termName String normTermName; if (termName == null || StringUtils.isBlank(normTermName = normaliseTerm(termName))) { return null; } // try known term enums first Term term = findTermInEnum(normTermName, DwcTerm.values(), new String[] {DwcTerm.PREFIX...
43300131_6
@Override public void showResult(float result) { resultEditText.setText(String.valueOf(result)); }
43342956_3
public CheckError toCheckError(CONTEXT context) { return CheckError.of(errorType,errorCode,message(context)); }
43356615_97
Tracker setParam(String key, Closure value) { return processSetParam(key, value); }
43357646_0
public void getProducts(Action<List<Product>> completion) { Objects.requireNonNull(completion); if (products != null) { ActionWrapper.WRAPPER.invoke(completion, products); } else { api.products().enqueue(new Callback<ProductsResponse>() { @Override public void onResp...
43367865_1
public String LRS(String query) { String[] suffixes = new String[query.length()]; for(int i = 0; i < query.length(); i++) { suffixes[i] = query.substring(i); } Arrays.sort(suffixes); Pair answer = new Pair(); answer.count = 0; for(int i = 0; i < suffixes.length - 1; i++) { Pair candidate = lcp(suffixes[i...
43368910_4
public static Class<?> getRawType(Type type) { if (type instanceof Class<?>) { // Type is a normal class. return (Class<?>) type; } else if (type instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) type; // I'm not exactly sure why getRawTy...
43388015_0
@Override public int compare(String o1, String o2) { return compareStrings(o1, o2); }
43398044_198
@Override public void getTasksForProjectAsync(final String projectId, final FutureCallback<ResourceList<Task>> responseCallback) throws IOException { final String path = String.format("%s/%s/tasks", getBasePath(), projectId); ResourceList<Task> taskResourceList = new ResourceList<>(); FutureCallback<...
43430328_1
public void requestReadContactsPermission() { checkAndRequestPermission(Action.READ_CONTACTS); }
43502922_10
public Task translate(InternalTask in) { Task out = null; if (in != null) { out = new Task(); out.uuid = in.uuid; out.description = in.description; out.done = in.status == InternalTask.Status.Completed; out.urgency = in.urgency; } return out; }
43504026_27
public String getAjaxProcessingTextOnRequest() { return ajaxProcessingTextOnRequest; }
43504166_2
public static ConnectionOptionBuilder builder(){ return new ConnectionOptionBuilder(); }
43528666_3
public static SpyResult<Object> spy(String spyPointName) { return new Observation().spy(spyPointName); }
43563629_9
@Override public boolean shouldAllowFeedbackPrompt(@NonNull final IEnvironment environment) { return environment.isAmazonAppStoreInstalled(); }
43568553_0
public int compareTo(SchemaVersion other) { if(this.version.equalsIgnoreCase(other.version) || this.version == V_ANY.version || other.version == V_ANY.version) { return 0; } String[] v1Splits = this.version.split("\\."); String[] v2Splits = other.version.split("\\."); int v1 = 0; for(S...
43569889_0
static long getLong(final byte[] bytes) { return new BigInteger(bytes).longValue(); }
43591538_6
@Override public Observable<Boolean> fetchAllPlaces() { return mPlacesApi.placesResult() .map(googleSearchResult -> { allPlaces = googleSearchResult.results; mPlaces.onNext(googleSearchResult.results); return true; }) .timeout(TIME_...
43598554_0
public static void main(String[] args) { if (args.length != 0) { StringBuilder sb = new StringBuilder() .append( "No argument is expected. All parameters should be passed through java system properties.\n") .append(PROPERTY_IN_JARS_DIR + " : jars input directory\n")...
43645816_99
public <Message extends PMessage<Message, Field>, Field extends PField> String format(Message message) { ByteArrayOutputStream out = new ByteArrayOutputStream(); formatTo(out, message); return new String(out.toByteArray(), StandardCharsets.UTF_8); }
43682339_3
@VisibleForTesting protected File findImageFile(String imageFile) { File foundImageFile = findImageFile(folderToScan, imageFile); // creating non existing file to avoid NPE return foundImageFile == null ? new File(imageFile) : foundImageFile; }
43688721_56
@Override public UpdateServiceInstanceResponse updateServiceInstance( UpdateServiceInstanceRequest request) throws ServiceInstanceUpdateNotSupportedException, ServiceBrokerException, ServiceInstanceDoesNotExistException { String spaceEnrollerConfigId = request.getServiceInstanceId(); log.debug("...
43734923_111
public Set<StatementPattern> getConsequents() { return consequentStatementPatterns; }
43792695_1
static byte[] makePongIfPing(byte[] line) { // Skip prefix, if any int i = 0; if (line.length >= 1 && line[i] == ':') { i++; while (i < line.length && line[i] != ' ') i++; while (i < line.length && line[i] == ' ') i++; } // Check that next 4 characters are "PING" case-insensitively, followed by space...
43826822_0
public boolean embarkTourists(int n) throws RiverServiceException { processInstance = ksession.startProcess("com.yahoo.sorelmitra.EmbarkTourists"); int state = processInstance.getState(); LOG.info("Process state is " + state); if (state != ProcessInstance.STATE_COMPLETED) { throw new RiverServic...
43829671_3
public List<DNCWorkCoordinate> getCoordinates() { SessionWrapper session = getCurrentSourceSession(); try { Query getCoordinates = session.getNamedQuery("getCoordinates"); List<DNCWorkCoordinate> coordinateList = getCoordinates .setResultTransformer(Transformers.aliasToBean(DNCWo...
43832779_133
@SuppressWarnings("unchecked") @RequestMapping("/{token}*") public String userFront(@PathVariable String token, @RequestParam(required = false) String tag, @RequestParam(required = false) String q, @RequestParam(required = false) Integer page, @RequestParam(required = false) Integer size...
43901081_9
public Task get(int index) { return taskManager.get(index); }
43913943_40
public void onLoginClick() { logger.debug("onLoginClick() called"); getView().showProgress(); call = loginModule.login(login, password); call.enqueue( data -> getView().advance(), error -> { if (error instanceof LoginException) { hasLoginError ...
43923787_43
public static Properties load(final String path) { try { InputStream input = null; try { final Resource resource = new ClassPathResource(path); input = resource.getInputStream(); } catch (final IOException e) { // ignore } final Properties...
43952556_16
public void createDatabase() throws StorageExistsException { this.fileStructure.initializeStorage(storage, attributes, ATTRIBUTE_VERSION); }
44007584_141
public static Map<String, String> convertSubscribe(Map<String, String> subscribe) { Map<String, String> newSubscribe = new HashMap<String, String>(); for (Map.Entry<String, String> entry : subscribe.entrySet()) { String serviceName = entry.getKey(); String serviceQuery = entry.getValue(); ...