id
stringlengths
7
14
text
stringlengths
1
37.2k
54082630_311
public FilterFileSystem() { }
54086678_0
private SimpleThreadpool(int threadCount) { // Increment pool count poolCount.incrementAndGet(); this.runnables = new ConcurrentLinkedQueue<>(); this.execute = new AtomicBoolean(true); this.threads = new ArrayList<>(); for (int threadIndex = 0; threadIndex < threadCount; threadIndex++) { ...
54088253_3
public ParaList(List<StoreParas> lists) { if ( lists == null ) throw new RuntimeException("lists can not be null"); this.lists = lists; this.size = lists.size(); }
54102761_87
@Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { final String token = req.getParameter("authToken"); if (token == null) { resp.sendError(HttpServletResponse.SC_BAD_REQUEST, "Token is not set"); return; } HttpSession session = se...
54135763_1
public CaptionManager createCaptionManager(Context context) { if (androidVersion.isMarshmallowOrHigher()) { return ClosedCaptionManagerMarshmallow.newInstance(context); } else if (androidVersion.isKitKatOrHigher()) { return ClosedCaptionManagerKitKat.newInstance(context); } else { re...
54149022_115
@GET @ApiOperation(value = "Get product-baseline by id", response = ProductBaselineDTO.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of ProductBaselineDTO"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "...
54189483_34
@Override public final void removeSessionListener(SessionListener sessionListener) { this.sessionListenerSupport.removeSessionListener(sessionListener); }
54201244_2
@Deprecated public OAuth2RestOperations implicitResourceRestTemplate(String client_id, String client_secret, String authorization_uri, String access_token_uri, String... scope) { // 防止 url 写错 if (!authorization_uri.contains("authorize")) throw new RuntimeException("uri is wrong : authorization_uri" + ...
54218417_0
public byte[] say(VoiceParameter param) { L.debug("#say: param=" + param); if (param == null) { throw new IllegalArgumentException("param is null."); } if (StringUtils.isBlank(param.getText())) { throw new IllegalArgumentException("param.text is blank."); } param.setText(param....
54231507_31
@Override public WebDriver.Window window() { return new Activator<WebDriver.Window>().activate(getTopmostDecorated().createDecorated(getOriginal().window())); }
54240230_0
@CheckResult @NonNull public static Action1<? super Boolean> not(@NonNull final Action1<? super Boolean> a1) { return new Action1<Boolean>() { @Override public void call(Boolean aBoolean) { a1.call(Boolean.FALSE.equals(aBoolean)); } }; }
54252267_125
@Override public void initialize(Properties properties, QueryableStatusAggregator queryableStatusAggregator) { this.queryableStatusAggregator = queryableStatusAggregator; String periodString = properties.getProperty(REPORT_PERIOD_KEY); if (periodString == null) { throw new IllegalStateException(RE...
54297956_1
public void onSaveButtonClick(String note) { if (note.isEmpty()) { return; } mModel.addNoteToList(note); mView.clearNoteEditText(); mView.updateRecyclerView(mModel.getNoteList()); }
54298946_120
private void initSystemContext(final ActorClock clock, final String basePath) { LOG.debug("Initializing system with base path {}", basePath); brokerCfg.init(basePath); validateConfiguration(); stepTimeout = brokerCfg.getStepTimeout(); final var cluster = brokerCfg.getCluster(); final String brokerId = St...
54311516_1
public static float getFloatValueInRange(float fromRangeMin, float fromRangeMax, float toRangeMin, float toRangeMax, float fromRangeValue) { float oldRange = (fromRangeMax - fromRangeMin); float newRange = (toRangeMax - toRangeMin); return (((fromRangeValue - fromRangeMin) * newRange) / oldRange) + toRangeMin...
54370839_7
private void publish(RoutingContext routingContext) { JsonObject json = routingContext.getBodyAsJson(); Record record = new Record(json); discovery.publish(record, ar -> { if (ar.failed()) { routingContext.fail(ar.cause()); } else { routingContext.response().setStatusCode(201) .putHe...
54371579_8
public void add(Subscription subscription) { subscriptions.add(subscription); }
54417824_7
public List<com.nilhcem.devoxxfr.data.app.model.Session> toAppSessions(@Nullable List<Session> from, @NonNull Map<Integer, com.nilhcem.devoxxfr.data.app.model.Speaker> speakersMap) { if (from == null) { return null; } return stream(from).map(session -> new com.nilhcem.devoxxfr.data.app.model.Sessio...
54438413_0
public Observable<List<PokemonItem>> pokemon() { return Observable.concat(nextRequests.map(new Func1<HttpUrl, Observable<Page<PokemonItem>>>() { @Override public Observable<Page<PokemonItem>> call(HttpUrl url) { Single<Page<PokemonItem>> call = url == null ? api.first...
54478052_12
public Observable<Void> execute() { return mRepository.query(new SessionQuery.SignOut()); }
54492045_0
public static boolean intToBool (int i) { return !(i == 0); }
54584892_4
public void setAttributes(List<Attribute> attributes) { attributeNamesMap.clear(); for (Attribute attribute : attributes) { String name = attribute.getName(); if (name == null) { LOG.warn("Attribute name was null, skipping name indexing"); continue; } attributeNamesMap.put(name.toLowe...
54587242_1
public static FilesArchiver createFromURI(String uri) throws IOException { try { URI outputURI = new URI(uri); String scheme = outputURI.getScheme(); logger.info("Got scheme " + scheme + " for URI " + uri); if (scheme == null || scheme.equalsIgnoreCase(EMPTY_STRING)) { ...
54620819_7
@Nonnull @MustNotContainNull public List<Package> getPackages() { return this.packages; }
54636367_72
static String resolveSignatureType(ValidationConclusion validationConclusion) { if (CollectionUtils.isEmpty(validationConclusion.getSignatures()) || isTstTypeContainer(validationConclusion)) { return NA; } String signatureFormat = validationConclusion.getSignatures().get(0).getSignatureFormat(); ...
54650297_55
@Override public ImmutableList<Value> eval(final ParseState parseState, final Encoding encoding) { final ImmutableList<Value> baseList = bases.eval(parseState, encoding); if (baseList.isEmpty()) { return baseList; } return count.evalSingle(parseState, encoding) .filter(countValue -> !cou...
54671444_27
@Override public byte[][] valueIn(String text, Type type) { if (text == null) return null; String[] values = text.split(regexSplitter); if (values.length == 0) return null; byte[][] arrays = new byte[values.length][]; for (int i=0; i<values.length; i++) { arrays[i] = StringUtil.asByteArray(values[i]); if (...
54709439_5
public Principal updateUser(IDTokenClaimsSet idToken, UserInfo userInfo) throws XWikiException, QueryException, OIDCException { // Check allowed/forbidden groups checkAllowedGroups(userInfo); Map<String, String> formatMap = createFormatMap(idToken, userInfo); // Change the default StringSubstitutor...
54712998_14
public String newPost(String blogid, Post post, boolean publish) throws XmlRpcException { if (blogid == null || post == null || post.getDateCreated() == null || post.getDescription() == null || post.getTitle() == null) { throw new IllegalArgumentException( "blogid,post,post.Title...
54755680_10
public static String getITunesId(Uri uri) { if (uri == null) { throw new IllegalArgumentException("uri is null"); } String id = ""; List<String> segments = uri.getPathSegments(); for (int i = 0; segments != null && i < segments.size(); i++) { if (segments.get(i).startsWith("id"))...
54767260_93
boolean allowConnect(String principal) { String allowedPrincipals = conf.get(ServerConfig.ALLOW_CONNECT); if (allowedPrincipals == null) { return false; } String principalShortName; if (KerberosName.hasRulesBeenSet()) { try { KerberosName krbName = new KerberosName(principal); principalSho...
54821190_1
@Override public void loadPackages(boolean refresh) { if (mView != null) { mView.hideContentView(); mView.showWaitDialog(); mPackageInteractor.getInstalledPackages(refresh) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) ...
54830123_3
@Override public Object run() { RequestContext context = RequestContext.getCurrentContext(); context.getResponse().setCharacterEncoding("UTF-8"); String rewrittenResponse = rewriteBasePath(context); context.setResponseBody(rewrittenResponse); return null; }
54853773_0
static Class<?> messageClass(Object message) { final Class<?> messageClass = message.getClass(); if (messageClass.isAnonymousClass() || messageClass.getSimpleName().contains("-$Lambda$") // Jack || messageClass.getSimpleName().contains("$$Lambda$")) // Retrolambda return messa...
54854368_44
@Override public <T> Provider<T> getProvider(Class<T> clazz) { return getProvider(clazz, null); }
54889602_1
public static Set<String> extractRequiredInputColumns(Transformer[] transformers) { Set<String> inputColumns = new HashSet<>(); //Add inputs for each transformer in the input set for(Transformer t : transformers) { inputColumns.addAll(t.getInputKeys()); } //remove non modifying columns of ...
54898732_267
@Override public int applyAsInt(final long value) { final KEY key = keyFunction.apply(value); return computeIfAbsent(key, givenKey -> Integer.valueOf(function.applyAsInt(value))) .intValue(); }
54903613_14
protected void correctFilesImports(final File sourcesFolder, final int level) throws IOException { final File[] listFiles = sourcesFolder.listFiles(); if (listFiles == null) { return; } for (final File file : listFiles) { if (file.isDirectory()) { this.correctFilesImports(file, level + 1); } else if (file....
54904766_6
public static String getPaymentDestination(byte[] scriptPubKey) { if (scriptPubKey==null) { return null; } // test if anyone can spend output if (scriptPubKey.length==0) { return "anyone"; // need to check also ScriptSig for OP_TRUE } // test if standard transaction Bitcoin address (20 byte) including Segwit ...
54905500_2
@Override public JsonLogger list(String key, List list) { try { jsonObject.add(key, gson.toJsonTree(list)); } catch (Exception e) { jsonObject.add(key, gson.toJsonTree(formatException(e))); } return this; }
54914992_6
@Override public Slot find(T listener) { for (Slot slot : list) { if (slot.listener() == listener) { return slot; } } return null; }
54973527_552
@RequestMapping(value = {"/config/sentinel/check/" + CLUSTER_NAME_PATH_VARIABLE + "/stop/{maintainMinutes}", "/config/sentinel/check/" + CLUSTER_NAME_PATH_VARIABLE + "/stop"}, method = RequestMethod.POST) public RetMessage stopSentinelCheck(HttpServletRequest request, @PathVariable String clusterName, ...
54976745_192
public List<Vector3d> samplePoints(final long n) throws RuntimeException { if (!samplingInitialized()) { throw new RuntimeException("Sampling has not been initialized"); } final List<Vector3d> points = isotropicSampling.calculate(new double[] { a, b, c }, n); points.forEach(this::mapToOrientation); points.forE...
54995528_0
public <T extends Resource> JSONApiObject<T> fromJson(String jsonObject) { JSONApiObject jsonApiObject = new JSONApiObject(); try { JSONObject json = new JSONObject(jsonObject); HashMap<String, Resource> includes = new HashMap<>(); if (json.isNull("errors")) { if (!json.isNu...
55090874_3
public static Date calculateNextTermBeginAfter(Date after, Date startDate, boolean excludeFirstTerm, ValidRuntimes runtimes) { if (after == null) { return null; } if (startDate == null) { return null; } if (runtimes == null) { return null; } Calendar afterCal = Calendar.getInstance(); afterCal.setTime(Da...
55091967_9
public void loadDatabaseToStorage(String databaseFolder, String databaseName, IRealmAssetHelperStorageListener listener) throws RuntimeException { mOsUtil.clearCache(); if (mOsUtil.isEmpty(databaseName)) { throw new RuntimeException("The database name is empty"); } if (!mOsUtil.isDatabaseAsset...
55123394_4
@HystrixCommand(ignoreExceptions = RemoteCallException.class) public List<ProductDto> findAllProducts() { List<ProductDto> productDtos = productClient.findAllProducts(); try { Thread.sleep(2000L); } catch (InterruptedException e) { e.printStackTrace(); } return productDtos; }
55133617_5
void verify(TypeElement type) { Validated validatedAnnotation = type.getAnnotation(Validated.class); if (validatedAnnotation == null) { abortWithError("Annotation processor for @" + Validated.class.getSimpleName() + " was invoked with a type that does not have the annotation.", type); ...
55151975_5
public List<MockResponse> enqueue(String... paths) { if (paths == null) { return null; } List<MockResponse> mockResponseList = new ArrayList<>(); for (String path : paths) { Fixture fixture = Fixture.parseFrom(path, parser); MockResponse mockResponse = fixture.toMockResponse(); mockWebServer.enq...
55164975_13
public static Builder create() { return new Builder(); }
55209260_2
public static <T> T toObject(String json, Class<T> clazz) { T object; try { object = mapper.readValue(json, clazz); } catch (Exception e) { LOGGER.error("JSON String Can't covert to Java Object!"); throw new RuntimeException(e); } return object; }
55224431_4
@Override public List<String> getChildren(String path) { try { return client.getChildren().forPath(path); } catch (NoNodeException e) { return null; } catch (Exception e) { throw new IllegalStateException(e.getMessage(), e); } }
55231859_7
@Override public Object run() { RequestContext context = RequestContext.getCurrentContext(); if (!context.getResponseGZipped()) { context.getResponse().setCharacterEncoding("UTF-8"); } String rewrittenResponse = rewriteBasePath(context); context.setResponseBody(rewrittenResponse); retu...
55246521_78
@Override public void createITable(Index index) { logger.info("Creating iTable for index: " + index.toString()); PreparedStatement createStmt = PreparedStatementFactory.getPreparedStatement(generateTableCreationSyntax(index), session); BoundStatement bs = new BoundStatement(createStmt); session.execute(...
55265221_1
public boolean saveSortByPreference(Sort sort) { SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString( PREF_SORT_BY_KEY, sort.toString() ); return editor.commit(); }
55321773_1
@Override public Observable<List<GoTHouse>> getList() { Observable<List<GoTHouse>> observable; if (localDataSource.isExpired()) { observable = networkDataSource.getAll() .doOnNext(houses -> { localDataSource.removeAll(houses); localDataSource.save(houses); }) .retry(...
55332367_37
public KeyTree.Node add(final String path) { KeyTree.Node parent = this.root; String key = path; if (path != null) { final int i = path.lastIndexOf('.'); if (i >= 0) { final String parentPath = path.substring(0, i); key = path.substring(i + 1); parent = th...
55332995_0
public boolean send(final String to, final String body) { // Build a filter for the MessageList final List<NameValuePair> params = new ArrayList<>(); params.add(new BasicNameValuePair("Body", body)); params.add(new BasicNameValuePair("To", to)); params.add(new BasicNameValuePair("From", twilioFrom))...
55380427_12
public boolean isGenerateNumericPrefixes() { return generateNumericPrefixes; }
55391726_0
public static void main(String[] args) throws Exception { Class<YStatementAnnotationDemoClass> obj = YStatementAnnotationDemoClass.class; if (obj.isAnnotationPresent(ArchitecturallySignificant.class)) { Annotation annotation = obj.getAnnotation(ArchitecturallySignificant.class); Architectural...
55402141_1
public void onClickPlus() { if (onPlus) { if (plus > 0) { plus--; } onPlus = false; } else { plus++; onPlus = true; } }
55442225_13
static void checkNoPublicGetters(Class<?> clazz) { final Method[] methods = clazz.getMethods(); for (Method m : methods) { final Class<?> type = m.getReturnType(); check(type == Void.TYPE, format("Method %s must be void, but returns %s.", m.getName(), type.getSimpleName())); } }
55493271_108
public ScaleCategory scaleRawValue(int rawValue) throws EepOutOfRangeException { for(ScaleCategory category : categories) { if(category.fallsIntoCategory(rawValue)) { return category; } } throw new EepOutOfRangeException( "Raw value ''{0}'' is not within the valid scale ranges : {1}", ...
55498563_29
StateConfig getStateConfig(Map stormConf) throws Exception { StateConfig stateConfig = null; String providerConfig = null; ObjectMapper mapper = new ObjectMapper(); mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY); if (stormConf.containsKey(org.apache.storm.Config.TOPOLOGY...
55504627_162
public static Map<String, Object> extract(Xpp3Dom root) { if (root == null) { return new HashMap<>(); } return getElement(root); }
55520127_6
public RuntimeSearchParam getSearchParameterDefinition(String dataType, String path) { return this.getSearchParameterDefinition(dataType, path, (RestSearchParameterTypeEnum)null); }
55524213_0
@Override public Position getPosition() { return position; }
55560812_32
@Override public void validate(AlertTemplate template) throws ValidationException { if (template.getDestination() == null || template.getDestination().trim().isEmpty()) { throw new ValidationException("Alert target can't be empty"); } if (template.getDestination().length() > MAX_LENGTH_ALERT_DESTINATION) { throw...
55576588_20
@NonNull public Where and() { mWhereBuilder.append(" AND "); return this; }
55638412_70
public static double bearing(@NonNull Point point1, @NonNull Point point2) { double lon1 = degreesToRadians(point1.longitude()); double lon2 = degreesToRadians(point2.longitude()); double lat1 = degreesToRadians(point1.latitude()); double lat2 = degreesToRadians(point2.latitude()); double value1 = Math.sin(l...
55668012_0
synchronized int setSendingData(ByteBuffer data) { final int remaining = data.remaining(); sendingStream.write(data.array(), data.position(), data.remaining()); return remaining; }
55673705_10
public void looseConstraints(String stateId) { looseConstraints(stateId, 0f, false); }
55705999_5
public static void shiftItemsWithFixedDistance(List<?> list, int[] indexArray, int offset) { Arrays.sort(indexArray); int unionOffset = computeUnionOffset(list, indexArray, offset); shiftItemsDirectly(list, indexArray, unionOffset); }
55707462_42
@Override public boolean areEqual(@NonNull Movie movie1, @NonNull Movie movie2) { val title1 = movie1.getTitle(); val title2 = movie2.getTitle(); for (StringModifier m1 : modifiers) { for (StringModifier m2 : modifiers) { boolean result = m1.modify(title1).equalsIgnoreCase(m2.modify(tit...
55719869_4
void setFocusListener() { this.focusListener = new MuseDataListener() { @Override public void receiveMuseDataPacket(MuseDataPacket museDataPacket) { if (museDataPacket.getPacketType() == MuseDataPacketType.CONCENTRATION) { mConcentrationManager.addConcentrationValue(muse...
55726733_21
public static ProjectInfo loadProjectInfo(Path projectPath) throws Exception { ProjectInfo projectInfo = null; GradleConnector connector = GradleConnector.newConnector(); connector.forProjectDirectory(projectPath.toFile()); ProjectConnection connection = null; try { connection = connector.connect(); Model...
55800992_1
public AgilentCompounds create() throws IOException { try { if (!Files.exists(path)) { throw new IllegalStateException("File path for Agilent .cef does not exist."); } AgilentCompounds comps = new AgilentCompounds(); // declaring what to parse JAXBContext ctx = JAXBContext.newInstance(CEF.c...
55814679_1
@Override public String getValueFromTheInternet(String id){ return "42"; }
55834606_13
public <T> T convertToLowerVersion(String targetVersion, Object source) { Class<?> sourceType = source.getClass(); SupportedVersion supportedVersion = sourceType.getAnnotation(SupportedVersion.class); if (supportedVersion == null) { throw new IllegalVersionException(targetVersion); } if (targetVersion.equ...
55874962_1
@Override public void onUpdateComplete(RequestResult requestResult, ViewModel.QueryEnum query) { if (query instanceof MainActivityViewModel.QueryEnumMainActivity) { if (requestResult == null) { return; } MainActivityViewModel.WeatherRequestResult weatherRequestResult = (MainAct...
55884057_2
public void startWith(int position) { makeSureOrientationStrategy(); orientationStrategy.startWith(position); }
55912872_9
public static boolean containsUserEstimate(final Collection<Estimate> estimates, final String userName) { return estimates.stream().anyMatch(input -> input.getUserName().equalsIgnoreCase(userName)); }
55965971_1
public boolean isMatch(String s, String p) { return false; }
55970511_3
@Override public Date apply(Date date, String duration) { return add(date, new JbpmDuration(duration)); }
56003224_5
public static Map<String,List<MatchInfoBase>> programUdpFlow(AceIp acl) { Map<String,List<MatchInfoBase>> flowMatchesMap = new HashMap<>(); SourcePortRange sourcePortRange = acl.getSourcePortRange(); DestinationPortRange destinationPortRange = acl.getDestinationPortRange(); if (sourcePortRange == null &...
56003499_35
public boolean isInCache(Uint64 dpnId, String ipAddress, String transportZone) throws TepException { boolean exists = false; final VtepsKey vtepkey = new VtepsKey(dpnId); IpAddress ipAddressObj = IpAddressBuilder.getDefaultInstance(ipAddress); Vteps vtepCli = new VtepsBuilder()...
56008391_27
@VisibleForTesting MethodSpec createEntangleMethod() { MethodSpec.Builder result = MethodSpec.methodBuilder("entangle") .addModifiers(PUBLIC) .addParameter(TypeVariableName.get("T"), "target", FINAL); result.addStatement("this.target = target"); result.addStatement("quantum.Quantum....
56037404_0
@Override public void loadSpinnerData() { mSpinnerData = mMainModel.loadSpinnerData(); if (mSpinnerData == null || mSpinnerData.size() == 0){ mMainView.showErrorMsg(); return; } mMainView.updateSpinnerData(mSpinnerData); }
56039864_3
@ReactMethod /** * @param timeout value of 0 results in no timeout */ public void sendRequest( final ExecutorToken executorToken, String method, String url, final int requestId, ReadableArray headers, ReadableMap data, final boolean useIncrementalUpdates, int timeout) { Request.Build...
56074333_2
public void get(Callback callback) { List<Card> receivedCards = database.getReceivedCards(); callback.onGetReceivedCards(receivedCards); }
56099345_88
@Override public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env) throws IOException { super.init(source, options, env); validateOptions(options); ageoffs = new PatriciaTrie<>(); options.forEach((k, v) -> { if (k.startsWith(AGE_OF...
56108213_42
public boolean hasMangaLibraryEntries() { return mMangaLibraryEntries != null && !mMangaLibraryEntries.isEmpty(); }
56131670_0
@Override public Observable<User> observeLocalChange() { return mSubject; }
56132696_0
public void validate(Object object) throws ValidationException { String fieldName = getFieldName(); // if there is no value - don't do comparison // if a value is required, a required validator should be added to the field if (object == null || object.toString().length() == 0) { return; } ...
56136555_20
@Override public boolean isSpaceAvailable() throws DiskSpaceCheckerException { Map<String, DiskSpace> clusterSpace = clusterManager.getDiskSpace(); boolean withinThreshold = true; for (String server : clusterManager.getServers()) { DiskSpace ds = clusterSpace.get(server); if (ds == null) { LOGGER.warn("No Di...
56200448_0
@NonNull public Observable<Void> fetch() { return processFetchRequest() .doOnNext(response -> { mMotionCategories.set(response.categories); mSequence.set(response.sequence); }) .doOnError(e -> Log.e(TAG, "fetch error")) .doOnCompleted((...
56214716_11
@Inject public HBaseTimestampStorage(Configuration hbaseConfig, HBaseTimestampStorageConfig config) throws IOException { connection = ConnectionFactory.createConnection(hbaseConfig); this.table = connection.getTable(TableName.valueOf(config.getTableName())); this.cfName = config.getFamilyName().getBytes(UTF...
56219850_29
public static boolean same(Object obj1, Object obj2) { return obj1 == obj2; }
56249750_0
public BigDecimal somaPrecosPorTipo(TipoPreco tipoPreco) { TypedQuery<BigDecimal> query = manager .createQuery("select sum(preco.valor) from Produto p " + " join p.precos preco where preco.tipo = :tipoPreco", BigDecimal.class); query.setParameter("tipoPreco", tipoPreco); return query.getSingleResult(); }
56258294_3
@Override protected void saveRate(Rate rate) { String value = ""; try { value = this.objectMapper.writeValueAsString(rate); } catch (JsonProcessingException e) { log.error("Failed to serialize Rate", e); } if (hasText(value)) { this.consulClient.setKVValue(rate.getKey(), val...