idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
165,503 | public Void visitClass(ClassTree node, Void p) {<NEW_LINE>final SourcePositions sourcePositions = wc.getTrees().getSourcePositions();<NEW_LINE>final <MASK><NEW_LINE>List<Tree> members = new LinkedList<Tree>();<NEW_LINE>ClassTree classTree = node;<NEW_LINE>for (Tree member : node.getMembers()) {<NEW_LINE>int s = (int) sourcePositions.getStartPosition(wc.getCompilationUnit(), member);<NEW_LINE>int e = (int) sourcePositions.getEndPosition(wc.getCompilationUnit(), member);<NEW_LINE>if (s >= start && e <= end) {<NEW_LINE>classTree = make.removeClassMember(classTree, member);<NEW_LINE>members.add(member);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>classTree = GeneratorUtils.insertClassMembers(wc, classTree, members, start);<NEW_LINE>wc.rewrite(node, classTree);<NEW_LINE>return super.visitClass(classTree, p);<NEW_LINE>} | TreeMaker make = wc.getTreeMaker(); |
498,837 | public void performInstrospect(HttpServletRequest req, HttpServletResponse resp, StringBuffer sb) {<NEW_LINE>sb.append("\n\nPreparing Introspect Data:");<NEW_LINE>String clientId = req.getParameter("clientId");<NEW_LINE>String clientSecret = req.getParameter("clientSecret");<NEW_LINE>sb.append("\n***clientID:" + clientId + " clientSecret:" + clientSecret);<NEW_LINE>sb.append("\n***Calling API PropagationHelp:" + bCallApi);<NEW_LINE>String encodedOpUrl = req.getParameter("opUrl");<NEW_LINE>String opUrl = encodedOpUrl;<NEW_LINE>try {<NEW_LINE>opUrl = URLDecoder.decode(encodedOpUrl, "UTF8");<NEW_LINE>} catch (UnsupportedEncodingException e) {<NEW_LINE>// TODO Auto-generated catch block<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>sb.append("\n***encodedOpUrl:" + encodedOpUrl + "\n opUrl:" + opUrl);<NEW_LINE>Hashtable<String, Object> <MASK><NEW_LINE>// debugHashtable( hashTable, sb);<NEW_LINE>String accessToken = bCallApi ? PropagationHelper.getAccessToken() : (String) hashTable.get("access_token");<NEW_LINE>String tokenType = bCallApi ? PropagationHelper.getAccessTokenType() : (String) hashTable.get("token_type");<NEW_LINE>long expiresAt = bCallApi ? PropagationHelper.getAccessTokenExpirationTime() : (Long) hashTable.get("expires_in");<NEW_LINE>sb.append("\n***access_token:" + accessToken + " token_type:" + tokenType + " expires_at/in:" + expiresAt + "***");<NEW_LINE>if (bCallApi) {<NEW_LINE>IdToken idToken = PropagationHelper.getIdToken();<NEW_LINE>sb.append("\n***IdToken-JsonString:" + idToken.getAllClaimsAsJson());<NEW_LINE>}<NEW_LINE>manual_IntrospectRequester introspectRequester = new manual_IntrospectRequester(req, resp, clientId, clientSecret, opUrl, accessToken, tokenType);<NEW_LINE>try {<NEW_LINE>introspectRequester.submitIntrospect(sb);<NEW_LINE>} catch (WebTrustAssociationFailedException e) {<NEW_LINE>// TODO Auto-generated catch block<NEW_LINE>e.printStackTrace();<NEW_LINE>sb.append("\nGet Exception:" + e);<NEW_LINE>}<NEW_LINE>} | hashTable = getProperties(runAsSubject, sb); |
1,803,713 | public void updateSuperset() throws IOException {<NEW_LINE>StructureReader reader = null;<NEW_LINE>if ((structureBytes.length > 2) && (structureBytes[0] == SUPERSET_ID[0]) && (structureBytes[1] == SUPERSET_ID[1])) {<NEW_LINE>// creating a reader using an input stream treats it as a superset input i.e. text<NEW_LINE><MASK><NEW_LINE>reader = new StructureReader(in);<NEW_LINE>} else {<NEW_LINE>// using an image input stream to the reader indicates that is in binary blob format<NEW_LINE>ImageInputStream inputStream = new MemoryCacheImageInputStream(new ByteArrayInputStream(structureBytes));<NEW_LINE>reader = new StructureReader(inputStream);<NEW_LINE>}<NEW_LINE>for (StructureDescriptor structure : reader.getStructures()) {<NEW_LINE>String structureHeader = structure.deflate();<NEW_LINE>HashSet<String> structureContents = superset.get(structureHeader);<NEW_LINE>if (structureContents == null) {<NEW_LINE>structureContents = new HashSet<String>();<NEW_LINE>superset.put(structureHeader, structureContents);<NEW_LINE>}<NEW_LINE>for (FieldDescriptor field : structure.getFields()) {<NEW_LINE>addFieldToSuperset(structureContents, field);<NEW_LINE>}<NEW_LINE>for (ConstantDescriptor constant : structure.getConstants()) {<NEW_LINE>String constantHeader = constant.deflate();<NEW_LINE>structureContents.add(constantHeader);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>writeSuperset();<NEW_LINE>} | InputStream in = new ByteArrayInputStream(structureBytes); |
1,755,992 | final AddAttachmentsToSetResult executeAddAttachmentsToSet(AddAttachmentsToSetRequest addAttachmentsToSetRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(addAttachmentsToSetRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<AddAttachmentsToSetRequest> request = null;<NEW_LINE>Response<AddAttachmentsToSetResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new AddAttachmentsToSetRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(addAttachmentsToSetRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Support");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "AddAttachmentsToSet");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<AddAttachmentsToSetResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new AddAttachmentsToSetResultJsonUnmarshaller());<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
776,536 | public void addPeer(String ip_address, int tcp_port, int udp_port, boolean use_crypto, Map user_data) {<NEW_LINE>final byte type = use_crypto ? PeerItemFactory.HANDSHAKE_TYPE_CRYPTO : PeerItemFactory.HANDSHAKE_TYPE_PLAIN;<NEW_LINE>final PeerItem peer_item = PeerItemFactory.createPeerItem(ip_address, tcp_port, PeerItem.convertSourceID(PEPeerSource.PS_PLUGIN), type, udp_port, PeerItemFactory.CRYPTO_LEVEL_1, 0);<NEW_LINE>byte crypto_level = PeerItemFactory.CRYPTO_LEVEL_1;<NEW_LINE>boolean force = false;<NEW_LINE>if (user_data != null) {<NEW_LINE>Boolean f = (Boolean) user_data.get(Peer.PR_FORCE_CONNECTION);<NEW_LINE>if (f != null) {<NEW_LINE>force = f;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (force || !isAlreadyConnected(peer_item)) {<NEW_LINE>String fail_reason;<NEW_LINE>boolean tcp_ok <MASK><NEW_LINE>boolean udp_ok = UDPNetworkManager.UDP_OUTGOING_ENABLED && udp_port > 0;<NEW_LINE>if (tcp_ok && !((prefer_udp || prefer_udp_default) && udp_ok)) {<NEW_LINE>fail_reason = // directly inject the the imported peer<NEW_LINE>makeNewOutgoingConnection(// directly inject the the imported peer<NEW_LINE>PEPeerSource.PS_PLUGIN, // directly inject the the imported peer<NEW_LINE>ip_address, // directly inject the the imported peer<NEW_LINE>tcp_port, // directly inject the the imported peer<NEW_LINE>udp_port, // directly inject the the imported peer<NEW_LINE>true, // directly inject the the imported peer<NEW_LINE>use_crypto, // directly inject the the imported peer<NEW_LINE>crypto_level, user_data);<NEW_LINE>} else if (udp_ok) {<NEW_LINE>fail_reason = // directly inject the the imported peer<NEW_LINE>makeNewOutgoingConnection(// directly inject the the imported peer<NEW_LINE>PEPeerSource.PS_PLUGIN, // directly inject the the imported peer<NEW_LINE>ip_address, // directly inject the the imported peer<NEW_LINE>tcp_port, // directly inject the the imported peer<NEW_LINE>udp_port, // directly inject the the imported peer<NEW_LINE>false, // directly inject the the imported peer<NEW_LINE>use_crypto, // directly inject the the imported peer<NEW_LINE>crypto_level, user_data);<NEW_LINE>} else {<NEW_LINE>fail_reason = "No usable protocol";<NEW_LINE>}<NEW_LINE>if (fail_reason != null)<NEW_LINE>Debug.out("Injected peer " + ip_address + ":" + tcp_port + " was not added - " + fail_reason);<NEW_LINE>}<NEW_LINE>} | = TCPNetworkManager.TCP_OUTGOING_ENABLED && tcp_port > 0; |
248,043 | public AggregationMultiFunctionMethodDesc validateAggregationMethod(ExprValidationContext validationContext, String aggMethodName, ExprNode[] params) throws ExprValidationException {<NEW_LINE>aggMethodName = aggMethodName.toLowerCase(Locale.ENGLISH);<NEW_LINE>if (aggMethodName.equals("countevents") || aggMethodName.equals("listreference")) {<NEW_LINE>if (params.length > 0) {<NEW_LINE>throw new ExprValidationException("Invalid number of parameters");<NEW_LINE>}<NEW_LINE>Class provider = AggregationMethodLinearCount.class;<NEW_LINE>EPTypeClass result = EPTypePremade.INTEGERBOXED.getEPType();<NEW_LINE>if (aggMethodName.equals("listreference")) {<NEW_LINE>provider = AggregationMethodLinearListReference.class;<NEW_LINE>result = EPTypeClassParameterized.from(List.class, EventBean.EPTYPE);<NEW_LINE>}<NEW_LINE>return new AggregationMultiFunctionMethodDesc(new AggregationMethodLinearNoParamForge(provider, result), null, null, null);<NEW_LINE>}<NEW_LINE>AggregationAccessorLinearType methodType = AggregationAccessorLinearType.fromString(aggMethodName);<NEW_LINE>if (methodType == AggregationAccessorLinearType.FIRST || methodType == AggregationAccessorLinearType.LAST) {<NEW_LINE>return <MASK><NEW_LINE>} else {<NEW_LINE>return handleMethodWindow(params, validationContext);<NEW_LINE>}<NEW_LINE>} | handleMethodFirstLast(params, methodType, validationContext); |
166,419 | public void updateRouteArticlePointsFilter() {<NEW_LINE>if (!app.getPoiTypes().isInit()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>PoiUIFilter routeArticlePointsFilter = app.getPoiFilters().getFilterById(PoiUIFilter.STD_PREFIX + ROUTE_ARTICLE_POINT);<NEW_LINE>if (routeArticlePointsFilter != null) {<NEW_LINE>Set<String> selectedCategories = new HashSet<>();<NEW_LINE>List<String> categories = app.getResourceManager(<MASK><NEW_LINE>for (String category : categories) {<NEW_LINE>CommonPreference<Boolean> prop = getRoutePointCategoryProperty(category);<NEW_LINE>if (prop.get()) {<NEW_LINE>selectedCategories.add(category.replace('_', ':').toLowerCase());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>routeArticlePointsFilter.setFilterByName(TextUtils.join(" ", selectedCategories));<NEW_LINE>}<NEW_LINE>this.routeArticlePointsFilter = routeArticlePointsFilter;<NEW_LINE>} | ).searchPoiSubTypesByPrefix(MapPoiTypes.CATEGORY); |
5,940 | static void mainProgram() {<NEW_LINE>Scanner sc = new Scanner(System.in);<NEW_LINE>while (true) {<NEW_LINE>int N = sc.nextInt();<NEW_LINE><MASK><NEW_LINE>if (N == 0 && K == 0)<NEW_LINE>break;<NEW_LINE>gallery = new int[N][2];<NEW_LINE>dp = new Integer[K + 1][N][2];<NEW_LINE>int sum = 0;<NEW_LINE>for (int i = 0; i < N; i++) {<NEW_LINE>// Input the gallery values in reverse to simulate walking from the<NEW_LINE>// bottom to the top of the gallery. This makes debugging easier and<NEW_LINE>// shouldn't affect the final result.<NEW_LINE>int index = N - i - 1;<NEW_LINE>gallery[index][LEFT] = sc.nextInt();<NEW_LINE>gallery[index][RIGHT] = sc.nextInt();<NEW_LINE>sum += gallery[index][LEFT] + gallery[index][RIGHT];<NEW_LINE>}<NEW_LINE>System.out.printf("%d\n", sum - f(K, N - 1));<NEW_LINE>}<NEW_LINE>} | int K = sc.nextInt(); |
1,094,628 | public void updateProgress() {<NEW_LINE>if (mTimeBarView != null && mTimeTextView != null && !mReleased) {<NEW_LINE>final long durationMs = mVideoPlayer.getDuration();<NEW_LINE>if (durationMs > 0) {<NEW_LINE>final long currentPositionMs = mVideoPlayer.getCurrentPosition();<NEW_LINE>mTimeBarView.setDuration(durationMs);<NEW_LINE>mTimeBarView.setPosition(currentPositionMs);<NEW_LINE>mTimeBarView.<MASK><NEW_LINE>final String newText = RRTime.msToMinutesAndSecondsString(currentPositionMs) + " / " + RRTime.msToMinutesAndSecondsString(durationMs);<NEW_LINE>if (!newText.contentEquals(mTimeTextView.getText())) {<NEW_LINE>mTimeTextView.setText(newText);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>mTimeBarView.setDuration(0);<NEW_LINE>mTimeBarView.setPosition(0);<NEW_LINE>mTimeBarView.setBufferedPosition(0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | setBufferedPosition(mVideoPlayer.getBufferedPosition()); |
503,661 | protected void onCreate(Bundle savedInstanceState) {<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>setContentView(R.layout.activity_media_player);<NEW_LINE>mVideoPath = getIntent().getStringExtra("videoPath");<NEW_LINE>boolean isLiveStreaming = getIntent().getIntExtra("liveStreaming", 1) == 1;<NEW_LINE>Button pauseBtn = findViewById(R.id.BtnPause);<NEW_LINE>Button resumeBtn = findViewById(R.id.BtnResume);<NEW_LINE>mLoadingView = findViewById(R.id.LoadingView);<NEW_LINE>mSurfaceView = <MASK><NEW_LINE>mSurfaceView.getHolder().addCallback(mCallback);<NEW_LINE>mStatInfoTextView = findViewById(R.id.StatInfoTextView);<NEW_LINE>mSurfaceWidth = getResources().getDisplayMetrics().widthPixels;<NEW_LINE>mSurfaceHeight = getResources().getDisplayMetrics().heightPixels;<NEW_LINE>if (isLiveStreaming) {<NEW_LINE>pauseBtn.setEnabled(false);<NEW_LINE>resumeBtn.setEnabled(false);<NEW_LINE>}<NEW_LINE>mAVOptions = new AVOptions();<NEW_LINE>mAVOptions.setInteger(AVOptions.KEY_PREPARE_TIMEOUT, 10 * 1000);<NEW_LINE>// 1 -> hw codec enable, 0 -> disable [recommended]<NEW_LINE>int codec = getIntent().getIntExtra("mediaCodec", AVOptions.MEDIA_CODEC_SW_DECODE);<NEW_LINE>mAVOptions.setInteger(AVOptions.KEY_MEDIACODEC, codec);<NEW_LINE>mAVOptions.setInteger(AVOptions.KEY_LIVE_STREAMING, isLiveStreaming ? 1 : 0);<NEW_LINE>boolean cache = getIntent().getBooleanExtra("cache", false);<NEW_LINE>if (!isLiveStreaming && cache) {<NEW_LINE>mAVOptions.setString(AVOptions.KEY_CACHE_DIR, Config.DEFAULT_CACHE_DIR);<NEW_LINE>}<NEW_LINE>mDisableLog = getIntent().getBooleanExtra("disable-log", false);<NEW_LINE>mAVOptions.setInteger(AVOptions.KEY_LOG_LEVEL, mDisableLog ? 5 : 0);<NEW_LINE>if (!isLiveStreaming) {<NEW_LINE>int startPos = getIntent().getIntExtra("start-pos", 0);<NEW_LINE>mAVOptions.setInteger(AVOptions.KEY_START_POSITION, startPos * 1000);<NEW_LINE>}<NEW_LINE>AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);<NEW_LINE>audioManager.requestAudioFocus(null, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);<NEW_LINE>} | findViewById(R.id.SurfaceView); |
342,200 | public static void initDrawer(NavigationView navView, @NonNull RepositoriesFragment.RepositoriesType type) {<NEW_LINE>if (navView == null)<NEW_LINE>return;<NEW_LINE>if (RepositoriesFragment.RepositoriesType.OWNED.equals(type)) {<NEW_LINE>// do nothing<NEW_LINE>} else if (RepositoriesFragment.RepositoriesType.PUBLIC.equals(type)) {<NEW_LINE>navView.getMenu().findItem(R.id.nav_private).setVisible(false);<NEW_LINE>navView.getMenu().findItem(R.id.nav_public).setVisible(false);<NEW_LINE>} else if (RepositoriesFragment.RepositoriesType.STARRED.equals(type)) {<NEW_LINE>navView.getMenu().findItem(R.id<MASK><NEW_LINE>navView.getMenu().findItem(R.id.nav_full_name_asc).setVisible(false);<NEW_LINE>navView.getMenu().findItem(R.id.nav_full_name_desc).setVisible(false);<NEW_LINE>navView.getMenu().findItem(R.id.nav_most_pushed).setVisible(false);<NEW_LINE>navView.getMenu().findItem(R.id.nav_fewest_pushed).setVisible(false);<NEW_LINE>navView.getMenu().findItem(R.id.nav_full_name_asc).setChecked(false);<NEW_LINE>navView.getMenu().findItem(R.id.nav_recently_created).setChecked(true);<NEW_LINE>navView.getMenu().findItem(R.id.nav_recently_created).setTitle(R.string.recently_starred);<NEW_LINE>navView.getMenu().findItem(R.id.nav_previously_created).setTitle(R.string.previously_starred);<NEW_LINE>}<NEW_LINE>} | .nav_type_chooser).setVisible(false); |
54,696 | public List<FieldChange> cleanup(BibEntry entry) {<NEW_LINE>// Query entries for their timestamp field entries<NEW_LINE>if (entry.getField(timeStampField).isPresent()) {<NEW_LINE>Optional<String> formattedTimeStamp = formatTimeStamp(entry.getField(timeStampField).get());<NEW_LINE>if (formattedTimeStamp.isEmpty()) {<NEW_LINE>// In case the timestamp could not be parsed, do nothing to not lose data<NEW_LINE>return Collections.emptyList();<NEW_LINE>}<NEW_LINE>// Setting the EventSource is necessary to circumvent the update of the modification date during timestamp migration<NEW_LINE>entry.clearField(timeStampField, EntriesEventSource.CLEANUP_TIMESTAMP);<NEW_LINE>List<FieldChange> <MASK><NEW_LINE>FieldChange changeTo;<NEW_LINE>// Add removal of timestamp field<NEW_LINE>changeList.add(new FieldChange(entry, StandardField.TIMESTAMP, formattedTimeStamp.get(), ""));<NEW_LINE>entry.setField(StandardField.MODIFICATIONDATE, formattedTimeStamp.get(), EntriesEventSource.CLEANUP_TIMESTAMP);<NEW_LINE>changeTo = new FieldChange(entry, StandardField.MODIFICATIONDATE, entry.getField(StandardField.MODIFICATIONDATE).orElse(""), formattedTimeStamp.get());<NEW_LINE>changeList.add(changeTo);<NEW_LINE>return changeList;<NEW_LINE>}<NEW_LINE>return Collections.emptyList();<NEW_LINE>} | changeList = new ArrayList<>(); |
889,804 | private static DescribeModelResponse createModelResponse(ModelManager modelManager, String modelName, Model model) {<NEW_LINE>DescribeModelResponse resp = new DescribeModelResponse();<NEW_LINE>resp.setModelName(modelName);<NEW_LINE>resp.setModelUrl(model.getModelUrl());<NEW_LINE>resp.setBatchSize(model.getBatchSize());<NEW_LINE>resp.setMaxBatchDelay(model.getMaxBatchDelay());<NEW_LINE>resp.setMaxWorkers(model.getMaxWorkers());<NEW_LINE>resp.setMinWorkers(model.getMinWorkers());<NEW_LINE>resp.setLoadedAtStartup(modelManager.getStartupModels().contains(modelName));<NEW_LINE>Manifest manifest = model.getModelArchive().getManifest();<NEW_LINE>resp.setModelVersion(manifest.getModel().getModelVersion());<NEW_LINE>resp.setRuntime(manifest.getRuntime().getValue());<NEW_LINE>List<WorkerThread> workers = modelManager.getWorkers(model.getModelVersionName());<NEW_LINE>for (WorkerThread worker : workers) {<NEW_LINE>String workerId = worker.getWorkerId();<NEW_LINE>long startTime = worker.getStartTime();<NEW_LINE><MASK><NEW_LINE>int gpuId = worker.getGpuId();<NEW_LINE>long memory = worker.getMemory();<NEW_LINE>int pid = worker.getPid();<NEW_LINE>String gpuUsage = worker.getGpuUsage();<NEW_LINE>resp.addWorker(workerId, startTime, isRunning, gpuId, memory, pid, gpuUsage);<NEW_LINE>}<NEW_LINE>return resp;<NEW_LINE>} | boolean isRunning = worker.isRunning(); |
41,510 | final ListVirtualMachinesResult executeListVirtualMachines(ListVirtualMachinesRequest listVirtualMachinesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listVirtualMachinesRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListVirtualMachinesRequest> request = null;<NEW_LINE>Response<ListVirtualMachinesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListVirtualMachinesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listVirtualMachinesRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Backup Gateway");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListVirtualMachines");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListVirtualMachinesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListVirtualMachinesResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
907,428 | public void run() {<NEW_LINE>try {<NEW_LINE>final JSONObject result = actFmInvoker.authenticate(email, firstName, lastName, provider, secret);<NEW_LINE>final String token = actFmInvoker.getToken();<NEW_LINE>if (result.optBoolean("new")) {<NEW_LINE>// Report new user statistic<NEW_LINE>StatisticsService.reportEvent(StatisticsConstants.ACTFM_NEW_USER, "provider", provider);<NEW_LINE>}<NEW_LINE>// Successful login, create outstanding entries<NEW_LINE>// Preferences.getLong(ActFmPreferenceService.PREF_USER_ID, 0);<NEW_LINE>String lastId = ActFmPreferenceService.userId();<NEW_LINE>if (!TextUtils.isEmpty(token) && !RemoteModel.isValidUuid(lastId)) {<NEW_LINE>constructOutstandingTables();<NEW_LINE>}<NEW_LINE>runOnUiThread(new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>DialogUtilities.<MASK><NEW_LINE>progressDialog = null;<NEW_LINE>postAuthenticate(result, token);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} catch (IOException e) {<NEW_LINE>handleError(e);<NEW_LINE>} finally {<NEW_LINE>runOnUiThread(new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>if (progressDialog != null) {<NEW_LINE>DialogUtilities.dismissDialog(ActFmLoginActivity.this, progressDialog);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | dismissDialog(ActFmLoginActivity.this, progressDialog); |
903,135 | private void putValidatedConfig(DataFrameAnalyticsConfig config, TimeValue masterNodeTimeout, ActionListener<PutDataFrameAnalyticsAction.Response> listener) {<NEW_LINE>DataFrameAnalyticsConfig preparedForPutConfig = new DataFrameAnalyticsConfig.Builder(config, maxModelMemoryLimitSupplier.get()).setCreateTime(Instant.now()).setVersion(Version.CURRENT).build();<NEW_LINE>if (securityContext != null) {<NEW_LINE>useSecondaryAuthIfAvailable(securityContext, () -> {<NEW_LINE>final String username = securityContext.getUser().principal();<NEW_LINE>RoleDescriptor.IndicesPrivileges sourceIndexPrivileges = RoleDescriptor.IndicesPrivileges.builder().indices(preparedForPutConfig.getSource().getIndex()).privileges("read").build();<NEW_LINE>RoleDescriptor.IndicesPrivileges destIndexPrivileges = RoleDescriptor.IndicesPrivileges.builder().indices(preparedForPutConfig.getDest().getIndex()).privileges("read", <MASK><NEW_LINE>HasPrivilegesRequest privRequest = new HasPrivilegesRequest();<NEW_LINE>privRequest.applicationPrivileges(new RoleDescriptor.ApplicationResourcePrivileges[0]);<NEW_LINE>privRequest.username(username);<NEW_LINE>privRequest.clusterPrivileges(Strings.EMPTY_ARRAY);<NEW_LINE>privRequest.indexPrivileges(sourceIndexPrivileges, destIndexPrivileges);<NEW_LINE>ActionListener<HasPrivilegesResponse> privResponseListener = ActionListener.wrap(r -> handlePrivsResponse(username, preparedForPutConfig, r, masterNodeTimeout, listener), listener::onFailure);<NEW_LINE>client.execute(HasPrivilegesAction.INSTANCE, privRequest, privResponseListener);<NEW_LINE>});<NEW_LINE>} else {<NEW_LINE>updateDocMappingAndPutConfig(preparedForPutConfig, threadPool.getThreadContext().getHeaders(), masterNodeTimeout, ActionListener.wrap(unused -> listener.onResponse(new PutDataFrameAnalyticsAction.Response(preparedForPutConfig)), listener::onFailure));<NEW_LINE>}<NEW_LINE>} | "index", "create_index").build(); |
308,729 | Future<ReconciliationState> kafkaPersistentClaimDeletion() {<NEW_LINE>Promise<ReconciliationState> resultPromise = Promise.promise();<NEW_LINE>Future<List<PersistentVolumeClaim>> futurePvcs = pvcOperations.listAsync(namespace, kafkaCluster.getSelectorLabels());<NEW_LINE>futurePvcs.onComplete(res -> {<NEW_LINE>if (res.succeeded() && res.result() != null) {<NEW_LINE>List<String> maybeDeletePvcs = res.result().stream().map(pvc -> pvc.getMetadata().getName()).collect(Collectors.toList());<NEW_LINE>List<String> desiredPvcs = kafkaCluster.generatePersistentVolumeClaims(kafkaCluster.getStorage()).stream().map(pvc -> pvc.getMetadata().getName()).collect(Collectors.toList());<NEW_LINE>persistentClaimDeletion(maybeDeletePvcs, desiredPvcs).onComplete(resultPromise);<NEW_LINE>} else {<NEW_LINE>resultPromise.<MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>return resultPromise.future();<NEW_LINE>} | fail(res.cause()); |
903,232 | public static void addSelectedInstancesToDeploymentGroup(HandlerContext handlerCtx) {<NEW_LINE>String[] instances = (String[]) handlerCtx.getInputValue("instances");<NEW_LINE>String[] selected = (String[]) handlerCtx.getInputValue("selected");<NEW_LINE>String deploymentGroup = (String) handlerCtx.getInputValue("deploymentGroup");<NEW_LINE>String endpoint = (String) handlerCtx.getInputValue("endpoint");<NEW_LINE>Boolean quiet = (Boolean) handlerCtx.getInputValue("quiet");<NEW_LINE>Boolean throwException = (Boolean) handlerCtx.getInputValue("throwException");<NEW_LINE>List<String> enabledDeploymentGroups = Arrays.asList(selected);<NEW_LINE>if (selected.length > 0) {<NEW_LINE>HashMap<String, Object> attributes = new HashMap<>();<NEW_LINE>attributes.put("deploymentGroup", deploymentGroup);<NEW_LINE>for (String selectedInstance : instances) {<NEW_LINE>if (enabledDeploymentGroups.contains(selectedInstance)) {<NEW_LINE><MASK><NEW_LINE>RestUtil.restRequest(endpoint, attributes, "post", handlerCtx, quiet, throwException);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | attributes.put("instance", selectedInstance); |
663,562 | public ActivityListItem unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ActivityListItem activityListItem = new ActivityListItem();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("activityArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>activityListItem.setActivityArn(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("name", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>activityListItem.setName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("creationDate", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>activityListItem.setCreationDate(DateJsonUnmarshallerFactory.getInstance(<MASK><NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return activityListItem;<NEW_LINE>} | "unixTimestamp").unmarshall(context)); |
1,104,828 | void showScanOrCopyLayout() {<NEW_LINE>scanOrCopyIsShown = true;<NEW_LINE><MASK><NEW_LINE>confirmContainer.setVisibility(View.GONE);<NEW_LINE>scrollContainer2FA.setVisibility(View.GONE);<NEW_LINE>scrollContainerVerify.setVisibility(View.VISIBLE);<NEW_LINE>scrollContainerVerify.setBackgroundColor(ContextCompat.getColor(this, R.color.white_grey_700));<NEW_LINE>scrollContainer2FAEnabled.setVisibility(View.GONE);<NEW_LINE>if (seed != null) {<NEW_LINE>logDebug("Seed not null");<NEW_LINE>setSeed();<NEW_LINE>if (qr != null) {<NEW_LINE>logDebug("QR not null");<NEW_LINE>qrImage.setImageBitmap(qr);<NEW_LINE>} else {<NEW_LINE>generate2FAQR();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>megaApi.multiFactorAuthGetCode(this);<NEW_LINE>}<NEW_LINE>if (isNoAppsDialogShown) {<NEW_LINE>showAlertNotAppAvailable();<NEW_LINE>}<NEW_LINE>if (isHelpDialogShown) {<NEW_LINE>showAlertHelp();<NEW_LINE>}<NEW_LINE>} | qrSeedContainer.setVisibility(View.VISIBLE); |
224,737 | private void createDropAllData(PrintWriter pw, Collection<TableDefinition> tableDefinitions, DaoGenConfig config) {<NEW_LINE>pw.println(" /** Delete all table data */");<NEW_LINE>pw.println(" public void dropAllData() {");<NEW_LINE>pw.println(" String[] sqls = new String[" + <MASK><NEW_LINE>int count = 0;<NEW_LINE>for (TableDefinition tableDefinition : tableDefinitions) {<NEW_LINE>String sql = "TRUNCATE TABLE " + tableDefinition.getTable_name() + ";";<NEW_LINE>pw.println(" sqls[" + count + "] = \"" + sql + "\";");<NEW_LINE>count++;<NEW_LINE>}<NEW_LINE>pw.println(" for (String sql : sqls) {");<NEW_LINE>pw.println(" LOG.debug(sql);");<NEW_LINE>pw.println(" executeUpdate(sql);");<NEW_LINE>pw.println(" }");<NEW_LINE>pw.println(" }");<NEW_LINE>} | tableDefinitions.size() + "];"); |
1,731,864 | private boolean compareNumber(Number valueObj, String value1, String value2) {<NEW_LINE>BigDecimal valueObjB = null;<NEW_LINE>BigDecimal value1B = null;<NEW_LINE>BigDecimal value2B = null;<NEW_LINE>try {<NEW_LINE>if (valueObj instanceof BigDecimal)<NEW_LINE>valueObjB = (BigDecimal) valueObj;<NEW_LINE>else if (valueObj instanceof Integer)<NEW_LINE>valueObjB = new BigDecimal(((Integer) valueObj).intValue());<NEW_LINE>else<NEW_LINE>valueObjB = new BigDecimal(String.valueOf(valueObj));<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.debug("compareNumber - valueObj=" + valueObj + " - " + e.toString());<NEW_LINE>return compareString(valueObj, value1, value2);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>value1B = new BigDecimal(value1);<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.debug("compareNumber - value1=" + value1 + " - " + e.toString());<NEW_LINE>return compareString(valueObj, value1, value2);<NEW_LINE>}<NEW_LINE>String op = getOperation();<NEW_LINE>if (OPERATION_Eq.equals(op))<NEW_LINE>return valueObjB.compareTo(value1B) == 0;<NEW_LINE>else if (OPERATION_Gt.equals(op))<NEW_LINE>return valueObjB.compareTo(value1B) > 0;<NEW_LINE>else if (OPERATION_GtEq.equals(op))<NEW_LINE>return valueObjB.compareTo(value1B) >= 0;<NEW_LINE>else if (OPERATION_Le.equals(op))<NEW_LINE>return valueObjB.compareTo(value1B) < 0;<NEW_LINE>else if (OPERATION_LeEq.equals(op))<NEW_LINE>return <MASK><NEW_LINE>else if (OPERATION_Like.equals(op))<NEW_LINE>return valueObjB.compareTo(value1B) == 0;<NEW_LINE>else if (OPERATION_NotEq.equals(op))<NEW_LINE>return valueObjB.compareTo(value1B) != 0;<NEW_LINE>else //<NEW_LINE>if (OPERATION_Sql.equals(op))<NEW_LINE>throw new IllegalArgumentException("SQL not Implemented");<NEW_LINE>else //<NEW_LINE>if (OPERATION_X.equals(op)) {<NEW_LINE>if (valueObjB.compareTo(value1B) < 0)<NEW_LINE>return false;<NEW_LINE>// To<NEW_LINE>try {<NEW_LINE>value2B = new BigDecimal(String.valueOf(value2));<NEW_LINE>return valueObjB.compareTo(value2B) <= 0;<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.debug("compareNumber - value2=" + value2 + " - " + e.toString());<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>//<NEW_LINE>throw new IllegalArgumentException("Unknown Operation=" + op);<NEW_LINE>} | valueObjB.compareTo(value1B) <= 0; |
1,789,566 | protected Answer execute(final CheckRouterCommand cmd) {<NEW_LINE>final String command = String.format("%s%s", "/opt/cloud/bin/", VRScripts.RVR_CHECK);<NEW_LINE>if (s_logger.isDebugEnabled()) {<NEW_LINE>s_logger.debug("Executing resource CheckRouterCommand: " + s_gson.toJson(cmd));<NEW_LINE>s_logger.debug("Run command on domR " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + command);<NEW_LINE>}<NEW_LINE>Pair<Boolean, String> result;<NEW_LINE>try {<NEW_LINE>final String controlIp = getRouterSshControlIp(cmd);<NEW_LINE>result = SshHelper.sshExecute(controlIp, DEFAULT_DOMR_SSHPORT, "root", getSystemVMKeyFile(), null, command);<NEW_LINE>if (!result.first()) {<NEW_LINE>s_logger.error("check router command on domR " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + " failed, message: " + result.second());<NEW_LINE>return new CheckRouterAnswer(cmd, <MASK><NEW_LINE>}<NEW_LINE>if (s_logger.isDebugEnabled()) {<NEW_LINE>s_logger.debug("check router command on domain router " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + " completed");<NEW_LINE>}<NEW_LINE>} catch (final Throwable e) {<NEW_LINE>final String msg = "CheckRouterCommand failed due to " + e.getMessage();<NEW_LINE>s_logger.error(msg, e);<NEW_LINE>return new CheckRouterAnswer(cmd, msg);<NEW_LINE>}<NEW_LINE>return new CheckRouterAnswer(cmd, result.second(), true);<NEW_LINE>} | "CheckRouter failed due to " + result.second()); |
235,831 | static Request multiSearch(MultiSearchRequest multiSearchRequest) throws IOException {<NEW_LINE>Request request = new <MASK><NEW_LINE>Params params = new Params(request);<NEW_LINE>params.putParam(RestSearchAction.TYPED_KEYS_PARAM, "true");<NEW_LINE>params.putParam(RestSearchAction.TOTAL_HIT_AS_INT_PARAM, "true");<NEW_LINE>if (multiSearchRequest.maxConcurrentSearchRequests() != MultiSearchRequest.MAX_CONCURRENT_SEARCH_REQUESTS_DEFAULT) {<NEW_LINE>params.putParam("max_concurrent_searches", Integer.toString(multiSearchRequest.maxConcurrentSearchRequests()));<NEW_LINE>}<NEW_LINE>XContent xContent = REQUEST_BODY_CONTENT_TYPE.xContent();<NEW_LINE>byte[] source = MultiSearchRequest.writeMultiLineFormat(multiSearchRequest, xContent);<NEW_LINE>request.setEntity(new NByteArrayEntity(source, createContentType(xContent.type())));<NEW_LINE>return request;<NEW_LINE>} | Request(HttpPost.METHOD_NAME, "/_msearch"); |
442,271 | private static void generics(LexerfulGrammarBuilder b) {<NEW_LINE>b.rule(cliGenericDeclaration).is("generic", "<", cliGenericParameterList, ">", b.optional(cliConstraintClauseList), declaration);<NEW_LINE>b.rule(cliGenericParameterList).is(cliGenericParameter, b.zeroOrMore(",", cliGenericParameter));<NEW_LINE>b.rule(cliGenericParameter).is(b.optional(attribute), b.firstOf(CxxKeyword.CLASS, CxxKeyword.TYPENAME), IDENTIFIER);<NEW_LINE>b.rule(cliGenericId).is(cliGenericName, "<", cliGenericArgumentList, ">");<NEW_LINE>b.rule(cliGenericName).is(b.firstOf(IDENTIFIER, operatorFunctionId));<NEW_LINE>b.rule(cliGenericArgumentList).is(cliGenericArgument, b.zeroOrMore(",", cliGenericArgument));<NEW_LINE>b.rule(cliGenericArgument).is(typeId);<NEW_LINE>b.rule(cliConstraintClauseList).is(cliConstraintClause, b.zeroOrMore(cliConstraintClause));<NEW_LINE>b.rule(cliConstraintClause).is("where", IDENTIFIER, ":", cliConstraintItemList);<NEW_LINE>b.rule(cliConstraintItemList).is(cliConstraintItem, b<MASK><NEW_LINE>b.rule(cliConstraintItem).is(b.firstOf(typeId, b.sequence(b.firstOf("ref", "value"), b.firstOf(CxxKeyword.CLASS, CxxKeyword.STRUCT)), "gcnew"));<NEW_LINE>} | .zeroOrMore(",", cliConstraintItem)); |
1,374,846 | private void loadNode805() {<NEW_LINE>PropertyTypeNode node = new PropertyTypeNode(this.context, Identifiers.ConditionType_ConditionClassId, new QualifiedName(0, "ConditionClassId"), new LocalizedText("en", "ConditionClassId"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), new DataValue(Variant.NULL_VALUE), Identifiers.NodeId, -1, new UInteger[] {}, UByte.valueOf(1), UByte.valueOf(1), 0.0, false);<NEW_LINE>node.addReference(new Reference(Identifiers.ConditionType_ConditionClassId, Identifiers.HasTypeDefinition, Identifiers.PropertyType<MASK><NEW_LINE>node.addReference(new Reference(Identifiers.ConditionType_ConditionClassId, Identifiers.HasModellingRule, Identifiers.ModellingRule_Mandatory.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.ConditionType_ConditionClassId, Identifiers.HasProperty, Identifiers.ConditionType.expanded(), false));<NEW_LINE>this.nodeManager.addNode(node);<NEW_LINE>} | .expanded(), true)); |
1,545,186 | public List<Article> query(String title, Logger logger) {<NEW_LINE>for (String titleForm : cookedTitles(title)) {<NEW_LINE>List<Article> fuzzyLookupEntities;<NEW_LINE>List<Article> crossWikiEntities;<NEW_LINE>while (true) {<NEW_LINE>try {<NEW_LINE>fuzzyLookupEntities = queryFuzzyLookup(titleForm, logger);<NEW_LINE>crossWikiEntities = queryCrossWikiLookup(titleForm, logger);<NEW_LINE>// Success!<NEW_LINE>break;<NEW_LINE>} catch (IOException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>System.err.println("*** " + <MASK><NEW_LINE>try {<NEW_LINE>TimeUnit.SECONDS.sleep(10);<NEW_LINE>} catch (InterruptedException e2) {<NEW_LINE>// oof...<NEW_LINE>e2.printStackTrace();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<Article> entities = mergeResults(fuzzyLookupEntities, crossWikiEntities, logger);<NEW_LINE>List<Article> results = new ArrayList<>();<NEW_LINE>for (Article a : entities) {<NEW_LINE>results.addAll(queryArticle(a, logger));<NEW_LINE>}<NEW_LINE>results = deduplicateResults(results);<NEW_LINE>if (!results.isEmpty())<NEW_LINE>return results;<NEW_LINE>}<NEW_LINE>return new ArrayList<Article>();<NEW_LINE>} | fuzzyLookupUrl + " or " + crossWikiLookupUrl + " label lookup query (temporarily?) failed, retrying in a moment..."); |
602,246 | private void initEditing(Bundle savedInstanceState) {<NEW_LINE>mStateInsert = false;<NEW_LINE>findViewById(android.R.id.button2).setOnClickListener(this);<NEW_LINE>findViewById(android.R.id.button3).setOnClickListener(this);<NEW_LINE>setTitle(R.string.activity_edit_list_title);<NEW_LINE>if (savedInstanceState == null) {<NEW_LINE>Cursor cursor = getContentResolver().query(mTaskListUri, new String[] { TaskContract.TaskLists._ID, TaskContract.TaskLists.LIST_NAME, TaskContract.TaskLists.LIST_COLOR, TaskContract.TaskLists.ACCOUNT_NAME <MASK><NEW_LINE>if (cursor == null || cursor.getCount() < 1) {<NEW_LINE>setResult(Activity.RESULT_CANCELED);<NEW_LINE>finish();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>cursor.moveToNext();<NEW_LINE>if (mListName == null) {<NEW_LINE>mListName = cursor.getString(cursor.getColumnIndex(TaskContract.TaskLists.LIST_NAME));<NEW_LINE>}<NEW_LINE>if (mListColor == NO_COLOR) {<NEW_LINE>mListColor = cursor.getInt(cursor.getColumnIndex(TaskContract.TaskLists.LIST_COLOR));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>mNameView.setText(mListName);<NEW_LINE>mColorView.setBackgroundColor(mListColor);<NEW_LINE>} | }, null, null, null); |
524,519 | public Function<Object, Object> updater(PropertyBean bean) {<NEW_LINE>if (myComponent == null)<NEW_LINE>return null;<NEW_LINE>String name = bean.propertyName.trim();<NEW_LINE>try {<NEW_LINE>try {<NEW_LINE>Method getter;<NEW_LINE>try {<NEW_LINE>getter = myComponent.getClass().getMethod("get" + StringUtil.capitalize(name));<NEW_LINE>} catch (Exception e) {<NEW_LINE>getter = myComponent.getClass().getMethod("is" <MASK><NEW_LINE>}<NEW_LINE>final Method finalGetter = getter;<NEW_LINE>final Method setter = myComponent.getClass().getMethod("set" + StringUtil.capitalize(name), getter.getReturnType());<NEW_LINE>setter.setAccessible(true);<NEW_LINE>return o -> {<NEW_LINE>try {<NEW_LINE>setter.invoke(myComponent, fromObject(o, finalGetter.getReturnType()));<NEW_LINE>return finalGetter.invoke(myComponent);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} catch (Exception e) {<NEW_LINE>final Field field = ReflectionUtil.findField(myComponent.getClass(), null, name);<NEW_LINE>if (Modifier.isFinal(field.getModifiers()) || Modifier.isStatic(field.getModifiers())) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return o -> {<NEW_LINE>try {<NEW_LINE>field.set(myComponent, fromObject(o, field.getType()));<NEW_LINE>return field.get(myComponent);<NEW_LINE>} catch (Exception e1) {<NEW_LINE>throw new RuntimeException(e1);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>}<NEW_LINE>} catch (Exception ignored) {<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | + StringUtil.capitalize(name)); |
1,681,933 | static FetchStats fromBencoded(Map<String, Object> map) {<NEW_LINE>Key k = typedGet(map, "k", byte[].class).map(Key::new).orElseThrow(() -> new IllegalArgumentException("missing key in serialized form"));<NEW_LINE>return new FetchStats(k, fs -> {<NEW_LINE>fs.recentSources = typedGet(map, "sources", List.class).map((List l) -> {<NEW_LINE>List<Map<String, Object>> typedList = l;<NEW_LINE>return typedList.stream().map(KBucketEntry::fromBencoded).collect(Collectors.toCollection(ArrayList::new));<NEW_LINE>}).orElse(new ArrayList<>());<NEW_LINE>typedGet(map, "state", byte[].class).map(b -> new String(b, StandardCharsets.ISO_8859_1)).map(str -> {<NEW_LINE>try {<NEW_LINE>return State.valueOf(str);<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}).ifPresent(st -> fs.state = st);<NEW_LINE>typedGet(map, "created", Long.class).ifPresent(time -> fs.creationTime = time);<NEW_LINE>typedGet(map, "cnt", Long.class).ifPresent(cnt -> fs.insertCount = cnt.intValue());<NEW_LINE>typedGet(map, "fetchtime", Long.class).ifPresent(time -> fs.lastFetchTime = time);<NEW_LINE>typedGet(map, "fetchcount", Long.class).ifPresent(i -> fs.<MASK><NEW_LINE>});<NEW_LINE>} | fetchCount = i.intValue()); |
100,661 | // ///////////////////////////////////////////////////<NEW_LINE>// ///////////// API Implementation///////////////////<NEW_LINE>// ///////////////////////////////////////////////////<NEW_LINE>@Override<NEW_LINE>public void execute() {<NEW_LINE>if (StringUtils.isEmpty(getCsr()) && getDomains().isEmpty()) {<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>final Certificate certificate = caManager.issueCertificate(getCsr(), getDomains(), getAddresses(), getValidityDuration(), getProvider());<NEW_LINE>if (certificate == null) {<NEW_LINE>throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to issue client certificate with given provider");<NEW_LINE>}<NEW_LINE>final CertificateResponse certificateResponse = new CertificateResponse();<NEW_LINE>try {<NEW_LINE>certificateResponse.setCertificate(CertUtils.x509CertificateToPem(certificate.getClientCertificate()));<NEW_LINE>if (certificate.getPrivateKey() != null) {<NEW_LINE>certificateResponse.setPrivateKey(CertUtils.privateKeyToPem(certificate.getPrivateKey()));<NEW_LINE>}<NEW_LINE>if (certificate.getCaCertificates() != null) {<NEW_LINE>certificateResponse.setCaCertificate(CertUtils.x509CertificatesToPem(certificate.getCaCertificates()));<NEW_LINE>}<NEW_LINE>} catch (final IOException e) {<NEW_LINE>LOG.error("Failed to generate and convert client certificate(s) to PEM due to error: ", e);<NEW_LINE>throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to process and return client certificate");<NEW_LINE>}<NEW_LINE>certificateResponse.setResponseName(getCommandName());<NEW_LINE>setResponseObject(certificateResponse);<NEW_LINE>} | ServerApiException(ApiErrorCode.PARAM_ERROR, "Please provide the domains or the CSR, none of them are provided"); |
1,061,521 | final CreateBatchPredictionJobResult executeCreateBatchPredictionJob(CreateBatchPredictionJobRequest createBatchPredictionJobRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createBatchPredictionJobRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateBatchPredictionJobRequest> request = null;<NEW_LINE>Response<CreateBatchPredictionJobResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateBatchPredictionJobRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createBatchPredictionJobRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "FraudDetector");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateBatchPredictionJob");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateBatchPredictionJobResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateBatchPredictionJobResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); |
357,738 | private TemplateLiteralExpressionTree parseTemplateLiteral(ParseTree operand) {<NEW_LINE>SourcePosition start = operand == null ? getTreeStartLocation() : operand.location.start;<NEW_LINE>Token token = nextToken();<NEW_LINE>if (!(token instanceof TemplateLiteralToken)) {<NEW_LINE>reportError(token, "Unexpected template literal token %s.", token.type.toString());<NEW_LINE>}<NEW_LINE>boolean isTaggedTemplate = operand != null;<NEW_LINE>TemplateLiteralToken templateToken = (TemplateLiteralToken) token;<NEW_LINE>if (!isTaggedTemplate) {<NEW_LINE>reportTemplateErrorIfPresent(templateToken);<NEW_LINE>}<NEW_LINE>ImmutableList.Builder<ParseTree> elements = ImmutableList.builder();<NEW_LINE>elements.add(new TemplateLiteralPortionTree<MASK><NEW_LINE>if (templateToken.type == TokenType.NO_SUBSTITUTION_TEMPLATE) {<NEW_LINE>return new TemplateLiteralExpressionTree(getTreeLocation(start), operand, elements.build());<NEW_LINE>}<NEW_LINE>// `abc${<NEW_LINE>ParseTree expression = parseExpression();<NEW_LINE>elements.add(new TemplateSubstitutionTree(expression.location, expression));<NEW_LINE>while (!errorReporter.hadError()) {<NEW_LINE>templateToken = nextTemplateLiteralToken();<NEW_LINE>if (templateToken.type == TokenType.ERROR || templateToken.type == TokenType.END_OF_FILE) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (!isTaggedTemplate) {<NEW_LINE>reportTemplateErrorIfPresent(templateToken);<NEW_LINE>}<NEW_LINE>elements.add(new TemplateLiteralPortionTree(templateToken.location, templateToken));<NEW_LINE>if (templateToken.type == TokenType.TEMPLATE_TAIL) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>expression = parseExpression();<NEW_LINE>elements.add(new TemplateSubstitutionTree(expression.location, expression));<NEW_LINE>}<NEW_LINE>return new TemplateLiteralExpressionTree(getTreeLocation(start), operand, elements.build());<NEW_LINE>} | (templateToken.location, templateToken)); |
1,699,165 | void assembleMessageParameters() {<NEW_LINE>mAid = SecureUtils.calculateK4(mAppKey.getKey());<NEW_LINE>final ByteBuffer paramsBuffer;<NEW_LINE>LOG.info("Level: " + mLevel);<NEW_LINE>if (mTransitionSteps == null || mTransitionResolution == null || mDelay == null) {<NEW_LINE>paramsBuffer = ByteBuffer.allocate(GENERIC_LEVEL_SET_PARAMS_LENGTH).order(ByteOrder.LITTLE_ENDIAN);<NEW_LINE>paramsBuffer.putShort((short) mLevel);<NEW_LINE>paramsBuffer.put((byte) tId);<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>LOG.info("Transition step resolution: " + mTransitionResolution);<NEW_LINE>paramsBuffer = ByteBuffer.allocate(GENERIC_LEVEL_SET_TRANSITION_PARAMS_LENGTH).order(ByteOrder.LITTLE_ENDIAN);<NEW_LINE>paramsBuffer.putShort((short) (mLevel));<NEW_LINE>paramsBuffer.put((byte) tId);<NEW_LINE>paramsBuffer.put((byte) (mTransitionResolution << 6 | mTransitionSteps));<NEW_LINE>final int delay = mDelay;<NEW_LINE>paramsBuffer.put((byte) delay);<NEW_LINE>}<NEW_LINE>mParameters = paramsBuffer.array();<NEW_LINE>} | LOG.info("Transition steps: " + mTransitionSteps); |
52,462 | private static Converter<org.springframework.data.redis.connection.RedisZSetCommands.Range, Range.Boundary<?>> rangeToBoundaryArgumentConverter(boolean upper, boolean convertNumberToBytes) {<NEW_LINE>return (source) -> {<NEW_LINE>Boundary sourceBoundary = upper ? source.getMax() : source.getMin();<NEW_LINE>if (sourceBoundary == null || sourceBoundary.getValue() == null) {<NEW_LINE>return Range.Boundary.unbounded();<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>Object value = sourceBoundary.getValue();<NEW_LINE>if (value instanceof Number) {<NEW_LINE>if (convertNumberToBytes) {<NEW_LINE>value = value.toString();<NEW_LINE>} else {<NEW_LINE>return inclusive ? Range.Boundary.including((Number) value) : Range.Boundary.excluding((Number) value);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (value instanceof String) {<NEW_LINE>if (!StringUtils.hasText((String) value) || ObjectUtils.nullSafeEquals(value, "+") || ObjectUtils.nullSafeEquals(value, "-")) {<NEW_LINE>return Range.Boundary.unbounded();<NEW_LINE>}<NEW_LINE>return inclusive ? Range.Boundary.including(value.toString().getBytes(StandardCharsets.UTF_8)) : Range.Boundary.excluding(value.toString().getBytes(StandardCharsets.UTF_8));<NEW_LINE>}<NEW_LINE>return inclusive ? Range.Boundary.including((byte[]) value) : Range.Boundary.excluding((byte[]) value);<NEW_LINE>};<NEW_LINE>} | boolean inclusive = sourceBoundary.isIncluding(); |
525,493 | public StreamInfo<Object, Object> decode(List<Object> parts, State state) {<NEW_LINE>Map<String, Object> map = IntStream.range(0, parts.size()).filter(i -> i % 2 == 0).mapToObj(i -> parts.subList(i, i + 2)).filter(p -> p.get(1) != null).collect(Collectors.toMap(e -> (String) e.get(0), e -> e.get(1)));<NEW_LINE>StreamInfo<Object, Object> info = new StreamInfo<>();<NEW_LINE>info.setLength(((Long) map.get(LENGTH_KEY)).intValue());<NEW_LINE>info.setRadixTreeKeys(((Long) map.get(RADIX_TREE_KEYS_KEY)).intValue());<NEW_LINE>info.setRadixTreeNodes(((Long) map.get(RADIX_TREE_NODES_KEY)).intValue());<NEW_LINE>info.setGroups(((Long) map.get(GROUPS_KEY)).intValue());<NEW_LINE>info.setLastGeneratedId(StreamIdConvertor.INSTANCE.convert(map.get(LAST_GENERATED_ID_KEY)));<NEW_LINE>List<?> firstEntry = (List<?>) map.get(FIRST_ENTRY_KEY);<NEW_LINE>if (firstEntry != null) {<NEW_LINE>StreamInfo.Entry<Object, Object> first = createStreamInfoEntry(firstEntry);<NEW_LINE>info.setFirstEntry(first);<NEW_LINE>}<NEW_LINE>List<?> lastEntry = (List<?>) map.get(LAST_ENTRY_KEY);<NEW_LINE>if (lastEntry != null) {<NEW_LINE>StreamInfo.Entry<Object, <MASK><NEW_LINE>info.setLastEntry(last);<NEW_LINE>}<NEW_LINE>return info;<NEW_LINE>} | Object> last = createStreamInfoEntry(lastEntry); |
1,620,156 | public void undoCommand() {<NEW_LINE>if (getUndoCommand() == null) {<NEW_LINE>throw new IllegalStateException("Can't undo command");<NEW_LINE>}<NEW_LINE>List<CommandInfo> processedCommands = new ArrayList<>();<NEW_LINE>synchronized (commands) {<NEW_LINE>CommandInfo lastCommand = commands.get(commands.size() - 1);<NEW_LINE>if (!lastCommand.command.isUndoable()) {<NEW_LINE>throw new IllegalStateException("Last executed command is not undoable");<NEW_LINE>}<NEW_LINE>// Undo command batch<NEW_LINE>while (lastCommand != null) {<NEW_LINE>commands.remove(lastCommand);<NEW_LINE>undidCommands.add(lastCommand);<NEW_LINE>processedCommands.add(lastCommand);<NEW_LINE>lastCommand = lastCommand.prevInBatch;<NEW_LINE>}<NEW_LINE>clearCommandQueues();<NEW_LINE>getCommandQueues();<NEW_LINE>}<NEW_LINE>refreshCommandState();<NEW_LINE>// Undo UI changes (always because undo doesn't make sense in atomic contexts)<NEW_LINE>for (CommandInfo cmd : processedCommands) {<NEW_LINE>if (cmd.reflector != null && !atomic) {<NEW_LINE>cmd.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | reflector.undoCommand(cmd.command); |
43,543 | public void run() {<NEW_LINE>// Ensure no listener is left watching for events<NEW_LINE>EventManager.get().clear();<NEW_LINE>// Clear<NEW_LINE>editorPropertiesPanel.removeAll();<NEW_LINE>influencerBox.removeAllItems();<NEW_LINE>controllerPropertiesPanel.removeAll();<NEW_LINE>// Editor props<NEW_LINE>addRow(editorPropertiesPanel, new NumericPanel(FlameMain.this, fovValue, "Field of View", ""));<NEW_LINE>addRow(editorPropertiesPanel, new NumericPanel(FlameMain.this, deltaMultiplier, "Delta multiplier", ""));<NEW_LINE>addRow(editorPropertiesPanel, new GradientPanel(FlameMain.this, backgroundColor, "Background color", "", true));<NEW_LINE>addRow(editorPropertiesPanel, new DrawPanel(FlameMain.this, "Draw", ""));<NEW_LINE>addRow(editorPropertiesPanel, new TextureLoaderPanel(FlameMain.this, "Texture", ""));<NEW_LINE>addRow(editorPropertiesPanel, new BillboardBatchPanel(FlameMain.this, renderer<MASK><NEW_LINE>addRow(editorPropertiesPanel, new PointSpriteBatchPanel(FlameMain.this, renderer.pointSpriteBatch), 1, 1);<NEW_LINE>editorPropertiesPanel.repaint();<NEW_LINE>// Controller props<NEW_LINE>ParticleController controller = getEmitter();<NEW_LINE>if (controller != null) {<NEW_LINE>// Reload available influencers<NEW_LINE>DefaultComboBoxModel model = (DefaultComboBoxModel) influencerBox.getModel();<NEW_LINE>ControllerType type = getControllerType();<NEW_LINE>if (type != null) {<NEW_LINE>for (Object value : type.wrappers) model.addElement(value);<NEW_LINE>}<NEW_LINE>JPanel panel = null;<NEW_LINE>addRow(controllerPropertiesPanel, getPanel(controller.emitter));<NEW_LINE>for (int i = 0, c = controller.influencers.size; i < c; ++i) {<NEW_LINE>Influencer influencer = (Influencer) controller.influencers.get(i);<NEW_LINE>panel = getPanel(influencer);<NEW_LINE>if (panel != null)<NEW_LINE>addRow(controllerPropertiesPanel, panel, 1, i == c - 1 ? 1 : 0);<NEW_LINE>}<NEW_LINE>for (Component component : controllerPropertiesPanel.getComponents()) if (component instanceof EditorPanel)<NEW_LINE>((EditorPanel) component).update(FlameMain.this);<NEW_LINE>}<NEW_LINE>controllerPropertiesPanel.repaint();<NEW_LINE>} | .billboardBatch), 1, 1); |
1,321,733 | public void marshall(SendDataPoint _sendDataPoint, Request<?> request, String _prefix) {<NEW_LINE>String prefix;<NEW_LINE>if (_sendDataPoint.getTimestamp() != null) {<NEW_LINE>prefix = _prefix + "Timestamp";<NEW_LINE>java.util.Date timestamp = _sendDataPoint.getTimestamp();<NEW_LINE>request.addParameter(prefix, StringUtils.fromDate(timestamp));<NEW_LINE>}<NEW_LINE>if (_sendDataPoint.getDeliveryAttempts() != null) {<NEW_LINE>prefix = _prefix + "DeliveryAttempts";<NEW_LINE>Long deliveryAttempts = _sendDataPoint.getDeliveryAttempts();<NEW_LINE>request.addParameter(prefix, StringUtils.fromLong(deliveryAttempts));<NEW_LINE>}<NEW_LINE>if (_sendDataPoint.getBounces() != null) {<NEW_LINE>prefix = _prefix + "Bounces";<NEW_LINE>Long bounces = _sendDataPoint.getBounces();<NEW_LINE>request.addParameter(prefix, StringUtils.fromLong(bounces));<NEW_LINE>}<NEW_LINE>if (_sendDataPoint.getComplaints() != null) {<NEW_LINE>prefix = _prefix + "Complaints";<NEW_LINE><MASK><NEW_LINE>request.addParameter(prefix, StringUtils.fromLong(complaints));<NEW_LINE>}<NEW_LINE>if (_sendDataPoint.getRejects() != null) {<NEW_LINE>prefix = _prefix + "Rejects";<NEW_LINE>Long rejects = _sendDataPoint.getRejects();<NEW_LINE>request.addParameter(prefix, StringUtils.fromLong(rejects));<NEW_LINE>}<NEW_LINE>} | Long complaints = _sendDataPoint.getComplaints(); |
1,689,064 | public void close() throws IOException {<NEW_LINE>if (mClosed.getAndSet(true)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>mLocalOutputStream.close();<NEW_LINE>try (BufferedInputStream in = new BufferedInputStream(new FileInputStream(mFile))) {<NEW_LINE>ObjectMetadata objMeta = new ObjectMetadata();<NEW_LINE>objMeta.setContentLength(mFile.length());<NEW_LINE>if (mHash != null) {<NEW_LINE>byte[] hashBytes = mHash.digest();<NEW_LINE>objMeta.setContentMD5(new String(Base64.encodeBase64(hashBytes)));<NEW_LINE>}<NEW_LINE>mOssClient.putObject(<MASK><NEW_LINE>} catch (ServiceException e) {<NEW_LINE>LOG.error("Failed to upload {}.", mKey);<NEW_LINE>throw new IOException(e);<NEW_LINE>} finally {<NEW_LINE>// Delete the temporary file on the local machine if the OSS client completed the<NEW_LINE>// upload or if the upload failed.<NEW_LINE>if (!mFile.delete()) {<NEW_LINE>LOG.error("Failed to delete temporary file @ {}", mFile.getPath());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | mBucketName, mKey, in, objMeta); |
944,643 | private void loadNode917() {<NEW_LINE>BaseDataVariableTypeNode node = new BaseDataVariableTypeNode(this.context, Identifiers.ServerType_ServerDiagnostics_ServerDiagnosticsSummary_SecurityRejectedRequestsCount, new QualifiedName(0, "SecurityRejectedRequestsCount"), new LocalizedText("en", "SecurityRejectedRequestsCount"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), new DataValue(Variant.NULL_VALUE), Identifiers.UInt32, -1, new UInteger[] {}, UByte.valueOf(1), UByte.valueOf(1), 0.0, false);<NEW_LINE>node.addReference(new Reference(Identifiers.ServerType_ServerDiagnostics_ServerDiagnosticsSummary_SecurityRejectedRequestsCount, Identifiers.HasTypeDefinition, Identifiers.BaseDataVariableType.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.ServerType_ServerDiagnostics_ServerDiagnosticsSummary_SecurityRejectedRequestsCount, Identifiers.HasModellingRule, Identifiers.ModellingRule_Mandatory.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.ServerType_ServerDiagnostics_ServerDiagnosticsSummary_SecurityRejectedRequestsCount, Identifiers.HasComponent, Identifiers.ServerType_ServerDiagnostics_ServerDiagnosticsSummary.expanded(), false));<NEW_LINE><MASK><NEW_LINE>} | this.nodeManager.addNode(node); |
371,089 | final DisassociateFromMasterAccountResult executeDisassociateFromMasterAccount(DisassociateFromMasterAccountRequest disassociateFromMasterAccountRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(disassociateFromMasterAccountRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<DisassociateFromMasterAccountRequest> request = null;<NEW_LINE>Response<DisassociateFromMasterAccountResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DisassociateFromMasterAccountRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(disassociateFromMasterAccountRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Macie2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DisassociateFromMasterAccount");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DisassociateFromMasterAccountResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DisassociateFromMasterAccountResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
91,457 | synchronized public void readMetadata(@NonNull BackupFiles.BackupFile backupFile) throws IOException {<NEW_LINE>String metadata = FileUtils.getFileContent(backupFile.getMetadataFile());<NEW_LINE>if (TextUtils.isEmpty(metadata)) {<NEW_LINE>throw new IOException("Empty JSON string for path " + backupFile.getBackupPath());<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>JSONObject rootObject = new JSONObject(metadata);<NEW_LINE>this.metadata = new Metadata();<NEW_LINE>this.metadata.backupPath = backupFile.getBackupPath();<NEW_LINE>this.metadata.backupName = this.metadata.backupPath.getName();<NEW_LINE>this.metadata.label = rootObject.getString("label");<NEW_LINE>this.metadata.<MASK><NEW_LINE>this.metadata.versionName = rootObject.getString("version_name");<NEW_LINE>this.metadata.versionCode = rootObject.getLong("version_code");<NEW_LINE>this.metadata.dataDirs = JSONUtils.getArray(String.class, rootObject.getJSONArray("data_dirs"));<NEW_LINE>this.metadata.isSystem = rootObject.getBoolean("is_system");<NEW_LINE>this.metadata.isSplitApk = rootObject.getBoolean("is_split_apk");<NEW_LINE>this.metadata.splitConfigs = JSONUtils.getArray(String.class, rootObject.getJSONArray("split_configs"));<NEW_LINE>this.metadata.hasRules = rootObject.getBoolean("has_rules");<NEW_LINE>this.metadata.backupTime = rootObject.getLong("backup_time");<NEW_LINE>this.metadata.checksumAlgo = rootObject.getString("checksum_algo");<NEW_LINE>this.metadata.crypto = rootObject.getString("crypto");<NEW_LINE>readCrypto(rootObject);<NEW_LINE>this.metadata.version = rootObject.getInt("version");<NEW_LINE>this.metadata.apkName = rootObject.getString("apk_name");<NEW_LINE>this.metadata.instructionSet = rootObject.getString("instruction_set");<NEW_LINE>this.metadata.flags = new BackupFlags(rootObject.getInt("flags"));<NEW_LINE>this.metadata.userHandle = rootObject.getInt("user_handle");<NEW_LINE>this.metadata.tarType = rootObject.getString("tar_type");<NEW_LINE>this.metadata.keyStore = rootObject.getBoolean("key_store");<NEW_LINE>this.metadata.installer = JSONUtils.getString(rootObject, "installer", BuildConfig.APPLICATION_ID);<NEW_LINE>} catch (JSONException e) {<NEW_LINE>throw new IOException(e.getMessage() + " for path " + backupFile.getBackupPath());<NEW_LINE>}<NEW_LINE>} | packageName = rootObject.getString("package_name"); |
1,116,709 | public BreakStatement breakStatement() {<NEW_LINE>Token position = consume(BREAK);<NEW_LINE>String target = null;<NEW_LINE>switch(la(false)) {<NEW_LINE>case CR:<NEW_LINE>case NL:<NEW_LINE>case CRNL:<NEW_LINE>case PARAGRAPH_SEPARATOR:<NEW_LINE>case LINE_SEPARATOR:<NEW_LINE>case SEMICOLON:<NEW_LINE>case RIGHT_BRACE:<NEW_LINE>break;<NEW_LINE>case IDENTIFIER:<NEW_LINE>target = consume(IDENTIFIER).getText();<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new SyntaxError(laToken(false), "unexpected token: " + laToken<MASK><NEW_LINE>}<NEW_LINE>if (!isValidBreak(target)) {<NEW_LINE>if (target == null) {<NEW_LINE>throw new SyntaxError(position, "break not allowed");<NEW_LINE>}<NEW_LINE>throw new SyntaxError(position, "break " + target + " not allowed");<NEW_LINE>}<NEW_LINE>semic();<NEW_LINE>return factory.breakStatement(position, target);<NEW_LINE>} | (false).getText()); |
1,613,863 | public synchronized boolean deserialize(ByteBuffer buffer) {<NEW_LINE>long newLastLogIndex = buffer.getLong();<NEW_LINE>if (logger.isDebugEnabled()) {<NEW_LINE>logger.debug("Partition table: lastMetaLogIndex {}, newLastLogIndex {}", lastMetaLogIndex, newLastLogIndex);<NEW_LINE>}<NEW_LINE>// judge whether the partition table of byte buffer is out of date<NEW_LINE>if (lastMetaLogIndex != -1 && lastMetaLogIndex >= newLastLogIndex) {<NEW_LINE>return lastMetaLogIndex == newLastLogIndex;<NEW_LINE>}<NEW_LINE>lastMetaLogIndex = newLastLogIndex;<NEW_LINE>logger.info("Initializing the partition table from buffer");<NEW_LINE>totalSlotNumbers = buffer.getInt();<NEW_LINE><MASK><NEW_LINE>nodeSlotMap = new HashMap<>();<NEW_LINE>Node node;<NEW_LINE>for (int i = 0; i < size; i++) {<NEW_LINE>node = new Node();<NEW_LINE>NodeSerializeUtils.deserialize(node, buffer);<NEW_LINE>RaftNode raftNode = new RaftNode(node, buffer.getInt());<NEW_LINE>List<Integer> slots = new ArrayList<>();<NEW_LINE>SerializeUtils.deserializeIntList(slots, buffer);<NEW_LINE>nodeSlotMap.put(raftNode, slots);<NEW_LINE>for (Integer slot : slots) {<NEW_LINE>slotNodes[slot] = raftNode;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int prevNodeMapSize = buffer.getInt();<NEW_LINE>previousNodeMap = new HashMap<>();<NEW_LINE>for (int i = 0; i < prevNodeMapSize; i++) {<NEW_LINE>node = new Node();<NEW_LINE>NodeSerializeUtils.deserialize(node, buffer);<NEW_LINE>RaftNode raftNode = new RaftNode(node, buffer.getInt());<NEW_LINE>Map<Integer, PartitionGroup> prevHolders = new HashMap<>();<NEW_LINE>int holderNum = buffer.getInt();<NEW_LINE>for (int i1 = 0; i1 < holderNum; i1++) {<NEW_LINE>PartitionGroup group = new PartitionGroup();<NEW_LINE>group.deserialize(buffer);<NEW_LINE>prevHolders.put(buffer.getInt(), group);<NEW_LINE>}<NEW_LINE>previousNodeMap.put(raftNode, prevHolders);<NEW_LINE>}<NEW_LINE>nodeRemovalResult = new SlotNodeRemovalResult();<NEW_LINE>nodeRemovalResult.deserialize(buffer);<NEW_LINE>nodeRing.clear();<NEW_LINE>for (RaftNode raftNode : nodeSlotMap.keySet()) {<NEW_LINE>if (!nodeRing.contains(raftNode.getNode())) {<NEW_LINE>nodeRing.add(raftNode.getNode());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Collections.sort(nodeRing);<NEW_LINE>logger.info("All known nodes: {}", nodeRing);<NEW_LINE>localGroups = getPartitionGroups(thisNode);<NEW_LINE>return true;<NEW_LINE>} | int size = buffer.getInt(); |
1,102,905 | public RoleModel addRealmRole(RealmModel realm, String id, String name) {<NEW_LINE>if (getRealmRole(realm, name) != null) {<NEW_LINE>throw new ModelDuplicateException("Role with the same name exists: " + name + " for realm " + realm.getName());<NEW_LINE>}<NEW_LINE>LOG.tracef("addRealmRole(%s, %s, %s)%s", realm, id, name, getShortStackTrace());<NEW_LINE>MapRoleEntity entity = new MapRoleEntityImpl();<NEW_LINE>entity.setId(id);<NEW_LINE>entity.setRealmId(realm.getId());<NEW_LINE>entity.setName(name);<NEW_LINE>entity.setClientRole(false);<NEW_LINE>if (entity.getId() != null && tx.read(entity.getId()) != null) {<NEW_LINE>throw new ModelDuplicateException("Role exists: " + id);<NEW_LINE>}<NEW_LINE>entity = tx.create(entity);<NEW_LINE>return entityToAdapterFunc<MASK><NEW_LINE>} | (realm).apply(entity); |
111,041 | public Object visit(Object context, StrictEqualityOperatorExpression expr, boolean strict) {<NEW_LINE>LabelNode returnTrue = new LabelNode();<NEW_LINE>LabelNode returnFalse = new LabelNode();<NEW_LINE>LabelNode end = new LabelNode();<NEW_LINE>aload(Arities.EXECUTION_CONTEXT);<NEW_LINE>// context<NEW_LINE>expr.getLhs().accept(context, this, strict);<NEW_LINE>// context obj(lhs)<NEW_LINE>append(jsGetValue());<NEW_LINE>// context val(lhs)<NEW_LINE>expr.getRhs().accept(context, this, strict);<NEW_LINE>// context val(lhs) obj(rhs)<NEW_LINE>append(jsGetValue());<NEW_LINE>// context val(lhs) val(rhs)<NEW_LINE>invokestatic(p(Types.class), "compareStrictEquality", sig(boolean.class, ExecutionContext.class, Object<MASK><NEW_LINE>// bool<NEW_LINE>if (expr.getOp().equals("===")) {<NEW_LINE>iftrue(returnTrue);<NEW_LINE>go_to(returnFalse);<NEW_LINE>} else {<NEW_LINE>iffalse(returnTrue);<NEW_LINE>go_to(returnFalse);<NEW_LINE>}<NEW_LINE>label(returnTrue);<NEW_LINE>getstatic(p(Boolean.class), "TRUE", ci(Boolean.class));<NEW_LINE>go_to(end);<NEW_LINE>label(returnFalse);<NEW_LINE>getstatic(p(Boolean.class), "FALSE", ci(Boolean.class));<NEW_LINE>label(end);<NEW_LINE>nop();<NEW_LINE>return null;<NEW_LINE>} | .class, Object.class)); |
152,889 | public void processOpts() {<NEW_LINE>super.processOpts();<NEW_LINE>if (additionalProperties.containsKey(CLASS_PREFIX)) {<NEW_LINE>setClassPrefix((String) additionalProperties.get(CLASS_PREFIX));<NEW_LINE>}<NEW_LINE>additionalProperties.put(CLASS_PREFIX, classPrefix);<NEW_LINE>if (additionalProperties.containsKey(API_VERSION)) {<NEW_LINE>setApiVersion(toApiVersion((String) <MASK><NEW_LINE>}<NEW_LINE>additionalProperties.put(API_VERSION, apiVersion);<NEW_LINE>if (additionalProperties.containsKey(BUILD_METHOD)) {<NEW_LINE>setBuildMethod((String) additionalProperties.get(BUILD_METHOD));<NEW_LINE>}<NEW_LINE>additionalProperties.put(BUILD_METHOD, buildMethod);<NEW_LINE>if (additionalProperties.containsKey(NAMED_CREDENTIAL)) {<NEW_LINE>setNamedCredential((String) additionalProperties.get(NAMED_CREDENTIAL));<NEW_LINE>}<NEW_LINE>additionalProperties.put(NAMED_CREDENTIAL, namedCredential);<NEW_LINE>postProcessOpts();<NEW_LINE>} | additionalProperties.get(API_VERSION))); |
1,063,245 | private boolean matches(String word, String pattern) {<NEW_LINE>// word -> p<NEW_LINE>Map<Character, Character> map1 = new HashMap<>();<NEW_LINE>// p -> word<NEW_LINE>Map<Character, Character> map2 = new HashMap<>();<NEW_LINE>for (int i = 0; i < pattern.length(); i++) {<NEW_LINE>if (!map1.containsKey(word.charAt(i))) {<NEW_LINE>map1.put(word.charAt(i), pattern.charAt(i));<NEW_LINE>}<NEW_LINE>if (map1.containsKey(word.charAt(i)) && map1.get(word.charAt(i)) != pattern.charAt(i)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (!map2.containsKey(pattern.charAt(i))) {<NEW_LINE>map2.put(pattern.charAt(i)<MASK><NEW_LINE>}<NEW_LINE>if (map2.containsKey(pattern.charAt(i)) && map2.get(pattern.charAt(i)) != word.charAt(i)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | , word.charAt(i)); |
413,968 | private Map<String, Object> toNotation(Pair<String, String> nameAndValue) {<NEW_LINE>String name = nameAndValue.getLeft();<NEW_LINE><MASK><NEW_LINE>Map<String, Object> ret = new HashMap<>();<NEW_LINE>ret.put(NAME_KEY, name);<NEW_LINE>if (value.startsWith(BRANCH_KEYWORD)) {<NEW_LINE>ret.put(BRANCH_KEY, value.substring(BRANCH_KEYWORD.length()));<NEW_LINE>} else if (value.startsWith(TAG_KEYWORD)) {<NEW_LINE>ret.put(TAG_KEY, value.substring(TAG_KEYWORD.length()));<NEW_LINE>} else if (value.startsWith(COMMIT_KEYWORD)) {<NEW_LINE>ret.put(COMMIT_KEY, value.substring(COMMIT_KEYWORD.length()));<NEW_LINE>} else if (isNotBlank(value)) {<NEW_LINE>// it will be treated as file path<NEW_LINE>ret.put(DIR_KEY, value);<NEW_LINE>}<NEW_LINE>return ret;<NEW_LINE>} | String value = nameAndValue.getRight(); |
1,046,826 | final DeleteModelResult executeDeleteModel(DeleteModelRequest deleteModelRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteModelRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteModelRequest> request = null;<NEW_LINE>Response<DeleteModelResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteModelRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteModelRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "FraudDetector");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteModel");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteModelResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteModelResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | endClientExecution(awsRequestMetrics, request, response); |
1,385,867 | public static IRubyObject f_gcd(ThreadContext context, IRubyObject x, IRubyObject y) {<NEW_LINE>if (x instanceof RubyFixnum && y instanceof RubyFixnum && isLongMinValue((RubyFixnum) x)) {<NEW_LINE>return RubyFixnum.newFixnum(context.runtime, i_gcd(((RubyFixnum) x).getLongValue(), ((RubyFixnum) y).getLongValue()));<NEW_LINE>}<NEW_LINE>if (f_negative_p(context, x))<NEW_LINE>x = f_negate(context, x);<NEW_LINE>if (f_negative_p(context, y))<NEW_LINE><MASK><NEW_LINE>if (f_zero_p(context, x))<NEW_LINE>return y;<NEW_LINE>if (f_zero_p(context, y))<NEW_LINE>return x;<NEW_LINE>for (; ; ) {<NEW_LINE>if (x instanceof RubyFixnum && y instanceof RubyFixnum && isLongMinValue((RubyFixnum) x)) {<NEW_LINE>return RubyFixnum.newFixnum(context.runtime, i_gcd(((RubyFixnum) x).getLongValue(), ((RubyFixnum) y).getLongValue()));<NEW_LINE>}<NEW_LINE>IRubyObject z = x;<NEW_LINE>x = f_mod(context, y, x);<NEW_LINE>y = z;<NEW_LINE>}<NEW_LINE>} | y = f_negate(context, y); |
1,405,774 | private void predictLumaTM(VPXMacroblock above, VPXMacroblock left, int aboveLeft) {<NEW_LINE>Subblock[] leftYSb;<NEW_LINE>Subblock[] aboveYSb = new Subblock[4];<NEW_LINE>leftYSb = new Subblock[4];<NEW_LINE>for (int col = 0; col < 4; col++) aboveYSb[col] = above.ySubblocks[3][col];<NEW_LINE>for (int row = 0; row < 4; row++) leftYSb[row] = left.ySubblocks[row][3];<NEW_LINE>for (int row = 0; row < 4; row++) for (int pRow = 0; pRow < 4; pRow++) for (int col = 0; col < 4; col++) {<NEW_LINE>if (ySubblocks[row][col].val == null)<NEW_LINE>ySubblocks[row][col]<MASK><NEW_LINE>for (int pCol = 0; pCol < 4; pCol++) {<NEW_LINE>short pred = (short) (leftYSb[row].val[pRow * 4 + 3] + aboveYSb[col].val[3 * 4 + pCol] - aboveLeft);<NEW_LINE>ySubblocks[row][col].val[pRow * 4 + pCol] = CommonUtils.clipPixel(pred);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .val = new short[16]; |
805,808 | private void mark(NSMutableAttributedString text, PatternSyntaxException e) {<NEW_LINE>if (null == e) {<NEW_LINE>text.removeAttributeInRange(NSAttributedString.ForegroundColorAttributeName, NSRange.NSMakeRange(new NSUInteger(0), text.length()));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// The approximate index in the pattern of the error<NEW_LINE><MASK><NEW_LINE>NSRange range = null;<NEW_LINE>if (-1 == index) {<NEW_LINE>range = NSRange.NSMakeRange(new NSUInteger(0), text.length());<NEW_LINE>}<NEW_LINE>if (index < text.length().intValue()) {<NEW_LINE>// Initializes the NSRange with the range elements of location and length;<NEW_LINE>range = NSRange.NSMakeRange(new NSUInteger(index), new NSUInteger(1));<NEW_LINE>}<NEW_LINE>text.addAttributesInRange(RED_FONT, range);<NEW_LINE>} | int index = e.getIndex(); |
322,411 | public TicketAndCheckInResult registerSponsorScan(String eventShortName, String ticketUid, String notes, SponsorScan.LeadStatus leadStatus, String username) {<NEW_LINE>int userId = userRepository.<MASK><NEW_LINE>Optional<EventAndOrganizationId> maybeEvent = eventRepository.findOptionalEventAndOrganizationIdByShortName(eventShortName);<NEW_LINE>if (maybeEvent.isEmpty()) {<NEW_LINE>return new TicketAndCheckInResult(null, new DefaultCheckInResult(CheckInStatus.EVENT_NOT_FOUND, "event not found"));<NEW_LINE>}<NEW_LINE>EventAndOrganizationId event = maybeEvent.get();<NEW_LINE>Optional<Ticket> maybeTicket = ticketRepository.findOptionalByUUID(ticketUid);<NEW_LINE>if (maybeTicket.isEmpty()) {<NEW_LINE>return new TicketAndCheckInResult(null, new DefaultCheckInResult(CheckInStatus.TICKET_NOT_FOUND, "ticket not found"));<NEW_LINE>}<NEW_LINE>Ticket ticket = maybeTicket.get();<NEW_LINE>if (ticket.getStatus() != Ticket.TicketStatus.CHECKED_IN) {<NEW_LINE>return new TicketAndCheckInResult(new TicketWithCategory(ticket, null), new DefaultCheckInResult(CheckInStatus.INVALID_TICKET_STATE, "not checked-in"));<NEW_LINE>}<NEW_LINE>Optional<ZonedDateTime> existingRegistration = sponsorScanRepository.getRegistrationTimestamp(userId, event.getId(), ticket.getId());<NEW_LINE>if (existingRegistration.isEmpty()) {<NEW_LINE>ZoneId eventZoneId = eventRepository.getZoneIdByEventId(event.getId());<NEW_LINE>sponsorScanRepository.insert(userId, ZonedDateTime.now(clockProvider.withZone(eventZoneId)), event.getId(), ticket.getId(), notes, leadStatus);<NEW_LINE>} else {<NEW_LINE>sponsorScanRepository.updateNotesAndLeadStatus(userId, event.getId(), ticket.getId(), notes, leadStatus);<NEW_LINE>}<NEW_LINE>return new TicketAndCheckInResult(new TicketWithCategory(ticket, null), new DefaultCheckInResult(CheckInStatus.SUCCESS, "success"));<NEW_LINE>} | getByUsername(username).getId(); |
1,730,054 | public static WebDoc createPage(Properties ctx, HttpServletRequest request, int AD_Record_ID, int AD_Table_ID) {<NEW_LINE>// WebDoc doc = WebDoc.createPopup (Msg.translate(ctx, "AD_Attachment_ID"));<NEW_LINE>WebDoc doc = null;<NEW_LINE>String TableName = null;<NEW_LINE>int AD_Window_ID = 0;<NEW_LINE>int PO_Window_ID = 0;<NEW_LINE>String sql = "SELECT TableName, AD_Window_ID, PO_Window_ID FROM AD_Table WHERE AD_Table_ID=?";<NEW_LINE>try {<NEW_LINE>PreparedStatement pstmt = DB.prepareStatement(sql, null);<NEW_LINE>pstmt.setInt(1, AD_Table_ID);<NEW_LINE>ResultSet rs = pstmt.executeQuery();<NEW_LINE>if (rs.next()) {<NEW_LINE>TableName = rs.getString(1);<NEW_LINE>AD_Window_ID = rs.getInt(2);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>rs.close();<NEW_LINE>pstmt.close();<NEW_LINE>} catch (SQLException e) {<NEW_LINE>log.log(Level.SEVERE, sql, e);<NEW_LINE>}<NEW_LINE>if (TableName == null || AD_Window_ID == 0) {<NEW_LINE>doc = WebDoc.createPopup("No Context");<NEW_LINE>doc.addPopupClose(ctx);<NEW_LINE>return doc;<NEW_LINE>}<NEW_LINE>// PO Zoom ?<NEW_LINE>boolean isSOTrx = true;<NEW_LINE>if (PO_Window_ID != 0) {<NEW_LINE>String whereClause = TableName + "_ID=" + AD_Record_ID;<NEW_LINE>isSOTrx = DB.isSOTrx(TableName, whereClause);<NEW_LINE>if (!isSOTrx)<NEW_LINE>AD_Window_ID = PO_Window_ID;<NEW_LINE>}<NEW_LINE>WWindowStatus ws = WWindowStatus.get(request);<NEW_LINE>HttpSession sess = request.getSession();<NEW_LINE>WebSessionCtx wsc = WebSessionCtx.get(request);<NEW_LINE>if (ws != null) {<NEW_LINE>int WindowNo = ws.mWindow.getWindowNo();<NEW_LINE>log.fine("Disposing - WindowNo=" + WindowNo + ", ID=" + ws.mWindow.getAD_Window_ID());<NEW_LINE>ws.mWindow.dispose();<NEW_LINE>Env.clearWinContext(wsc.ctx, WindowNo);<NEW_LINE>}<NEW_LINE>GridWindowVO mWindowVO = GridWindowVO.create(ctx, s_WindowNo++, AD_Window_ID, 0);<NEW_LINE>if (mWindowVO == null) {<NEW_LINE>String msg = Msg.translate(ctx, "AD_Window_ID") + " " + Msg.getMsg(ctx, "NotFound") + ", ID=" + AD_Window_ID + "/" + 0;<NEW_LINE>doc = WebDoc.createPopup(msg);<NEW_LINE>doc.addPopupClose(ctx);<NEW_LINE>return doc;<NEW_LINE>}<NEW_LINE>// Create New Window<NEW_LINE>ws = new WWindowStatus(mWindowVO);<NEW_LINE>sess.setAttribute(WWindowStatus.NAME, ws);<NEW_LINE>// Query<NEW_LINE>ws.mWindow.initTab(ws.curTab.getTabNo());<NEW_LINE>ws.curTab.setQuery(MQuery.getEqualQuery(TableName + "_ID", AD_Record_ID));<NEW_LINE>ws.curTab.query(false);<NEW_LINE>// ws.curTab.navigate(0);<NEW_LINE>// doc = WWindow.getSR_Form (request.getRequestURI(), wsc, ws);<NEW_LINE>return doc;<NEW_LINE>} | PO_Window_ID = rs.getInt(3); |
426,972 | public static void main(String[] args) throws Exception {<NEW_LINE>final Logger logger = LoggerFactory.getLogger(App.class);<NEW_LINE>// Printing the information about the bindings for SLF4J:<NEW_LINE>Configuration config = getConnectorConfiguration(args);<NEW_LINE>final <MASK><NEW_LINE>System.out.println("Logger Binding: " + binder.getLoggerFactory());<NEW_LINE>System.out.println(binder.getLoggerFactoryClassStr());<NEW_LINE>String dbPassword = config.getString("databasePassword");<NEW_LINE>config.clearProperty("databasePassword");<NEW_LINE>logger.info("Configuration for program (with DB password hidden) is: \n{}", ConfigurationUtils.toString(config));<NEW_LINE>config.setProperty("databasePassword", dbPassword);<NEW_LINE>logger.info("GOOGLE_APPLICATION_CREDENTIALS: {}", System.getenv("GOOGLE_APPLICATION_CREDENTIALS"));<NEW_LINE>// Properties to be passed directly to Debezium<NEW_LINE>ImmutableConfiguration debeziumConfig = config.immutableSubset("debezium");<NEW_LINE>startSender(checkParsing(config.getString("databaseName"), "databaseName", logger), checkParsing(config.getString("databaseUsername"), "databaseUsername", logger), checkParsing(config.getString("databasePassword"), "databasePassword", logger), checkParsing(config.getString("databaseAddress"), "databaseAddress", logger), // MySQL default port is 3306<NEW_LINE>checkParsing(// MySQL default port is 3306<NEW_LINE>config.getString("databasePort", "3306"), // MySQL default port is 3306<NEW_LINE>"databasePort", logger), checkParsing(config.getString("gcpProject"), "gcpProject", logger), checkParsing(config.getString("gcpPubsubTopicPrefix"), "gcpPubsubTopicPrefix", logger), checkParsing(config.getString("offsetStorageFile", DEFAULT_OFFSET_STORAGE_FILE), "offsetStorageFile", logger), checkParsing(config.getString("databaseHistoryFile", DEFAULT_DATABASE_HISTORY_FILE), "databaseHistoryFile", logger), config.getBoolean("inMemoryOffsetStorage", false), config.getBoolean("singleTopicMode", false), checkParsing(config.getString("whitelistedTables"), "whitelistedTables", logger), checkParsing(config.getString("databaseManagementSystem", DEFAULT_RDBMS), "databaseManagementSystem", logger), debeziumConfig);<NEW_LINE>} | StaticLoggerBinder binder = StaticLoggerBinder.getSingleton(); |
1,291,121 | public String changePass(@RequestParam String email, @RequestParam(required = false) String newpassword, @RequestParam(required = false) String token, HttpServletRequest req, Model model) {<NEW_LINE>boolean approvedDomain = utils.isEmailDomainApproved(email);<NEW_LINE>boolean validCaptcha = HttpUtils.isValidCaptcha(req.getParameter("g-recaptcha-response"));<NEW_LINE>if (!utils.isAuthenticated(req) && approvedDomain && validCaptcha) {<NEW_LINE>if (StringUtils.isBlank(token)) {<NEW_LINE>generatePasswordResetToken(email, req);<NEW_LINE>return "redirect:" + SIGNINLINK + "/iforgot?verify=true";<NEW_LINE>} else {<NEW_LINE>boolean error = !resetPassword(email, newpassword, token);<NEW_LINE>model.addAttribute("path", "signin.vm");<NEW_LINE>model.addAttribute("title", utils.getLang(req).get("iforgot.title"));<NEW_LINE>model.addAttribute("signinSelected", "navbtn-hover");<NEW_LINE>model.addAttribute("iforgot", true);<NEW_LINE>model.addAttribute("email", email);<NEW_LINE>model.addAttribute("token", token);<NEW_LINE>model<MASK><NEW_LINE>model.addAttribute("captchakey", CONF.captchaSiteKey());<NEW_LINE>if (error) {<NEW_LINE>if (!isPasswordStrongEnough(newpassword)) {<NEW_LINE>model.addAttribute("error", Collections.singletonMap("newpassword", utils.getLang(req).get("msgcode.8")));<NEW_LINE>} else {<NEW_LINE>model.addAttribute("error", Collections.singletonMap("email", utils.getLang(req).get("msgcode.7")));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return "base";<NEW_LINE>}<NEW_LINE>}<NEW_LINE>logger.info("Password reset failed for {} - authenticated={}, approvedDomain={}, validCaptcha={}", email, utils.isAuthenticated(req), approvedDomain, validCaptcha);<NEW_LINE>return "redirect:" + SIGNINLINK + "/iforgot";<NEW_LINE>} | .addAttribute("verified", !error); |
26,100 | // use String to build PushPayload instance<NEW_LINE>public static void testSendPush_fromJSON() {<NEW_LINE>ClientConfig clientConfig = ClientConfig.getInstance();<NEW_LINE>JPushClient jpushClient = new JPushClient(MASTER_SECRET, APP_KEY, null, clientConfig);<NEW_LINE>Gson gson = new GsonBuilder().registerTypeAdapter(PlatformNotification.class, new InterfaceAdapter<PlatformNotification>()).create();<NEW_LINE>// Since the type of DeviceType is enum, thus the value should be uppercase, same with the AudienceType.<NEW_LINE>String payloadString = "{\"platform\":{\"all\":false,\"deviceTypes\":[\"IOS\"]},\"audience\":{\"all\":true,\"targets\":[{\"audienceType\":\"TAG_AND\",\"values\":[\"tag1\",\"tag_all\"]}]},\"notification\":{\"notifications\":[{\"soundDisabled\":false,\"badgeDisabled\":false,\"sound\":\"happy\",\"badge\":\"5\",\"contentAvailable\":false,\"alert\":\"Test from API Example - alert\",\"extras\":{\"from\":\"JPush\"},\"type\":\"cn.jpush.api.push.model.notification.IosNotification\"}]},\"message\":{\"msgContent\":\"Test from API Example - msgContent\"},\"options\":{\"sendno\":1429488213,\"overrideMsgId\":0,\"timeToLive\":-1,\"apnsProduction\":true,\"bigPushDuration\":0}}";<NEW_LINE>PushPayload payload = gson.fromJson(payloadString, PushPayload.class);<NEW_LINE>try {<NEW_LINE>PushResult result = jpushClient.sendPush(payloadString);<NEW_LINE>LOG.info("Got result - " + result);<NEW_LINE>} catch (APIConnectionException e) {<NEW_LINE>LOG.error("Connection error. Should retry later. ", e);<NEW_LINE>// LOG.error("Sendno: " + payload.getSendno());<NEW_LINE>} catch (APIRequestException e) {<NEW_LINE>LOG.error("Error response from JPush server. Should review and fix it. ", e);<NEW_LINE>LOG.info(<MASK><NEW_LINE>LOG.info("Error Code: " + e.getErrorCode());<NEW_LINE>LOG.info("Error Message: " + e.getErrorMessage());<NEW_LINE>LOG.info("Msg ID: " + e.getMsgId());<NEW_LINE>// LOG.error("Sendno: " + payload.getSendno());<NEW_LINE>}<NEW_LINE>} | "HTTP Status: " + e.getStatus()); |
567,041 | public SOAPMessage invoke(SOAPMessage request) {<NEW_LINE>SOAPMessage response = null;<NEW_LINE>try {<NEW_LINE>System.out.println("Incoming Client Request as a SOAPMessage:");<NEW_LINE>request.writeTo(System.out);<NEW_LINE>String hdrText = request.getSOAPHeader().getTextContent();<NEW_LINE>System.out.println("Incoming SOAP Header:" + hdrText);<NEW_LINE>StringReader respMsg = new StringReader("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" + "<soapenv:Header/>" + "<soapenv:Body xmlns=\"http://wsstemplates.wssecfvt.test/types\">" + "<provider>This is WSSTemplateWebSvc3 Web Service.</provider></soapenv:Body></soapenv:Envelope>");<NEW_LINE><MASK><NEW_LINE>MessageFactory factory = MessageFactory.newInstance();<NEW_LINE>response = factory.createMessage();<NEW_LINE>response.getSOAPPart().setContent(src);<NEW_LINE>response.saveChanges();<NEW_LINE>} catch (Exception ex) {<NEW_LINE>ex.printStackTrace();<NEW_LINE>}<NEW_LINE>return response;<NEW_LINE>} | Source src = new StreamSource(respMsg); |
1,111,000 | private DaemonOperationResult executeAdd() throws Exception {<NEW_LINE>// Check all folders<NEW_LINE>for (String watchRoot : options.getWatchRoots()) {<NEW_LINE>File watchRootFolder = new File(watchRoot);<NEW_LINE>File watchRootAppFolder = new File(watchRootFolder, Config.DIR_APPLICATION);<NEW_LINE>if (!watchRootFolder.isDirectory() || !watchRootAppFolder.isDirectory()) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Add them<NEW_LINE>for (String watchRoot : options.getWatchRoots()) {<NEW_LINE>DaemonConfigHelper.addFolder(new File(watchRoot));<NEW_LINE>}<NEW_LINE>// Determine return code<NEW_LINE>loadOrCreateConfig();<NEW_LINE>int watchedMatchingFoldersCount = countWatchedMatchingFolders();<NEW_LINE>if (watchedMatchingFoldersCount == options.getWatchRoots().size()) {<NEW_LINE>return new DaemonOperationResult(DaemonResultCode.OK, daemonConfig.getFolders());<NEW_LINE>} else if (watchedMatchingFoldersCount > 0) {<NEW_LINE>return new DaemonOperationResult(DaemonResultCode.OK_PARTIAL, daemonConfig.getFolders());<NEW_LINE>} else {<NEW_LINE>return new DaemonOperationResult(DaemonResultCode.NOK, daemonConfig.getFolders());<NEW_LINE>}<NEW_LINE>} | throw new Exception("Given argument is not an existing folder, or a valid Syncany folder: " + watchRoot); |
1,370,510 | public void run(RegressionEnvironment env) {<NEW_LINE>String[] fieldsOut = "theString,total".split(",");<NEW_LINE>RegressionPath path = new RegressionPath();<NEW_LINE>env.compileDeploy("@public create table MyTableR1D(pk string primary key, total sum(int))", path);<NEW_LINE>env.compileDeploy("@name('into') into table MyTableR1D insert into MyStreamOne select theString, sum(intPrimitive) as total from SupportBean#length(4) group by rollup(theString)", path).addListener("into");<NEW_LINE>env.compileDeploy("@name('s0') select MyTableR1D[p00].total as c0 from SupportBean_S0"<MASK><NEW_LINE>env.milestone(0);<NEW_LINE>env.sendEventBean(new SupportBean("E1", 10));<NEW_LINE>assertValuesListener(env, new Object[][] { { null, 10 }, { "E1", 10 }, { "E2", null } });<NEW_LINE>env.assertPropsPerRowLastNew("into", fieldsOut, new Object[][] { { "E1", 10 }, { null, 10 } });<NEW_LINE>env.milestone(1);<NEW_LINE>env.sendEventBean(new SupportBean("E2", 200));<NEW_LINE>assertValuesListener(env, new Object[][] { { null, 210 }, { "E1", 10 }, { "E2", 200 } });<NEW_LINE>env.assertPropsPerRowLastNew("into", fieldsOut, new Object[][] { { "E2", 200 }, { null, 210 } });<NEW_LINE>env.milestone(2);<NEW_LINE>env.sendEventBean(new SupportBean("E1", 11));<NEW_LINE>assertValuesListener(env, new Object[][] { { null, 221 }, { "E1", 21 }, { "E2", 200 } });<NEW_LINE>env.assertPropsPerRowLastNew("into", fieldsOut, new Object[][] { { "E1", 21 }, { null, 221 } });<NEW_LINE>env.sendEventBean(new SupportBean("E2", 201));<NEW_LINE>assertValuesListener(env, new Object[][] { { null, 422 }, { "E1", 21 }, { "E2", 401 } });<NEW_LINE>env.assertPropsPerRowLastNew("into", fieldsOut, new Object[][] { { "E2", 401 }, { null, 422 } });<NEW_LINE>env.milestone(3);<NEW_LINE>// {"E1", 10} leaving window<NEW_LINE>env.sendEventBean(new SupportBean("E1", 12));<NEW_LINE>assertValuesListener(env, new Object[][] { { null, 424 }, { "E1", 23 }, { "E2", 401 } });<NEW_LINE>env.assertPropsPerRowLastNew("into", fieldsOut, new Object[][] { { "E1", 23 }, { null, 424 } });<NEW_LINE>env.undeployAll();<NEW_LINE>} | , path).addListener("s0"); |
976,767 | private void notifyDataSetChanged() {<NEW_LINE>View parentLayout = findViewById(R.id.content_frame);<NEW_LINE>String frameworkUpdateVersion = mRepoLoader.getFrameworkUpdateVersion();<NEW_LINE>boolean moduleUpdateAvailable = mRepoLoader.hasModuleUpdates();<NEW_LINE>Fragment currentFragment = getSupportFragmentManager().findFragmentById(R.id.content_frame);<NEW_LINE>if (currentFragment instanceof DownloadDetailsFragment) {<NEW_LINE>if (frameworkUpdateVersion != null) {<NEW_LINE>Snackbar.make(parentLayout, R.string.welcome_framework_update_available + " " + frameworkUpdateVersion, <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>boolean snackBar = getSharedPreferences(getPackageName() + "_preferences", MODE_PRIVATE).getBoolean("snack_bar", true);<NEW_LINE>if (moduleUpdateAvailable && snackBar) {<NEW_LINE>Snackbar.make(parentLayout, R.string.modules_updates_available, Snackbar.LENGTH_LONG).setAction(getString(R.string.view), view -> switchFragment(3)).show();<NEW_LINE>}<NEW_LINE>} | Snackbar.LENGTH_LONG).show(); |
1,173,928 | private static void expandDataFileRules(Path file) throws IOException {<NEW_LINE>boolean modified = false;<NEW_LINE>StringBuilder builder = new StringBuilder();<NEW_LINE>try (InputStream stream = Files.newInputStream(file);<NEW_LINE>InputStreamReader reader = new InputStreamReader(stream, StandardCharsets.UTF_8);<NEW_LINE>BufferedReader bufferedReader = new BufferedReader(reader)) {<NEW_LINE>String line;<NEW_LINE>boolean verbatim = false;<NEW_LINE>int lineNum = 0;<NEW_LINE>while (null != (line = bufferedReader.readLine())) {<NEW_LINE>++lineNum;<NEW_LINE>if (VERBATIM_RULE_LINE_PATTERN.matcher(line).matches()) {<NEW_LINE>verbatim = true;<NEW_LINE>builder.append(line).append("\n");<NEW_LINE>} else {<NEW_LINE>Matcher ruleMatcher = RULE_LINE_PATTERN.matcher(line);<NEW_LINE>if (ruleMatcher.matches()) {<NEW_LINE>verbatim = false;<NEW_LINE>builder.append<MASK><NEW_LINE>try {<NEW_LINE>String leftHandSide = ruleMatcher.group(1).trim();<NEW_LINE>String rightHandSide = ruleMatcher.group(2).trim();<NEW_LINE>expandSingleRule(builder, leftHandSide, rightHandSide);<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>System.err.println("ERROR in " + file.getFileName() + " line #" + lineNum + ":");<NEW_LINE>e.printStackTrace(System.err);<NEW_LINE>System.exit(1);<NEW_LINE>}<NEW_LINE>modified = true;<NEW_LINE>} else {<NEW_LINE>if (BLANK_OR_COMMENT_LINE_PATTERN.matcher(line).matches()) {<NEW_LINE>builder.append(line).append("\n");<NEW_LINE>} else {<NEW_LINE>if (verbatim) {<NEW_LINE>builder.append(line).append("\n");<NEW_LINE>} else {<NEW_LINE>modified = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (modified) {<NEW_LINE>System.err.println("Expanding rules in and overwriting " + file.getFileName());<NEW_LINE>Files.writeString(file, builder.toString(), StandardCharsets.UTF_8);<NEW_LINE>}<NEW_LINE>} | (line).append("\n"); |
407,913 | private void signUsingWallet() throws Exception {<NEW_LINE>WalletLoader loader = new WalletLoader();<NEW_LINE>loader.ensureDoesNotExist(walletID);<NEW_LINE>Service.CommandRequest.Builder builder = Service.CommandRequest.newBuilder();<NEW_LINE>Service.CommandRequest.SignTxRequest.Builder internalBuilder = Service<MASK><NEW_LINE>internalBuilder.setLockTime(0);<NEW_LINE>Common.TxInput.Builder txinputBuilder = Common.TxInput.newBuilder();<NEW_LINE>txinputBuilder.setPrevHash(ByteString.copyFrom(new byte[32]));<NEW_LINE>txinputBuilder.setPrevIndex(1);<NEW_LINE>txinputBuilder.setAmount(10000);<NEW_LINE>Common.Path.Builder pathBuilder = Common.Path.newBuilder();<NEW_LINE>pathBuilder.setIndex(1);<NEW_LINE>pathBuilder.setIsChange(false);<NEW_LINE>txinputBuilder.setPath(pathBuilder);<NEW_LINE>Common.TxOutput.Builder txoutputBuilder = Common.TxOutput.newBuilder();<NEW_LINE>txoutputBuilder.setAmount(9000);<NEW_LINE>txoutputBuilder.setDestination(Common.Destination.GATEWAY);<NEW_LINE>txoutputBuilder.setPath(pathBuilder);<NEW_LINE>List<Common.TxInput> inputlist = new ArrayList<>();<NEW_LINE>inputlist.add(txinputBuilder.build());<NEW_LINE>internalBuilder.addAllInputs(inputlist);<NEW_LINE>List<Common.TxOutput> outputList = new ArrayList<>();<NEW_LINE>outputList.add(txoutputBuilder.build());<NEW_LINE>internalBuilder.addAllOutputs(outputList);<NEW_LINE>builder.setSignTx(internalBuilder.build());<NEW_LINE>builder.setToken("FIXED");<NEW_LINE>builder.setWalletId(walletID);<NEW_LINE>for (int i = 0; i < 4; i++) {<NEW_LINE>Files.deleteIfExists(loader.getWalletPath(walletID));<NEW_LINE>// set the wallet file as per the hsm you are imitating in this iteration.<NEW_LINE>loader.save(walletID, loader.loadNumbered(walletID, i + 1, "finalized"));<NEW_LINE>CommandResponse response = CommandHandler.dispatch(this, new InternalCommandConnector(hostname, port), builder.build());<NEW_LINE>System.out.println("Signature for hsm number " + (i + 1) + ": " + Hex.toHexString(response.getSignTx().getSignatures(0).getDer().toByteArray()));<NEW_LINE>}<NEW_LINE>} | .CommandRequest.SignTxRequest.newBuilder(); |
267,282 | public List<LocationLink> handle(CancelChecker cancelToken, DefinitionParams params) {<NEW_LINE>try {<NEW_LINE>TextDocument doc = server.getTextDocumentService().getLatestSnapshot(params.getTextDocument().getUri());<NEW_LINE>if (doc != null) {<NEW_LINE>int offset = doc.toOffset(params.getPosition());<NEW_LINE>int start = offset;<NEW_LINE>while (Character.isLetter(doc.getSafeChar(start))) {<NEW_LINE>start--;<NEW_LINE>}<NEW_LINE>start = start + 1;<NEW_LINE>int end = offset;<NEW_LINE>while (Character.isLetter(doc.getSafeChar(end))) {<NEW_LINE>end++;<NEW_LINE>}<NEW_LINE>String word = doc.textBetween(start, end);<NEW_LINE>String text = doc.get();<NEW_LINE>int def = text.indexOf(word);<NEW_LINE>if (def >= 0) {<NEW_LINE>Range targetRange = doc.toRange(def, word.length());<NEW_LINE>LocationLink link = new LocationLink(params.getTextDocument().getUri(), targetRange, targetRange, doc.toRange<MASK><NEW_LINE>return ImmutableList.of(link);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.error("", e);<NEW_LINE>}<NEW_LINE>return Collections.emptyList();<NEW_LINE>} | (start, end - start)); |
1,811,670 | public static void checkTagSharing(boolean start_of_day) {<NEW_LINE>UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions();<NEW_LINE>if (uiFunctions != null) {<NEW_LINE>TagManager tm = TagManagerFactory.getTagManager();<NEW_LINE>if (start_of_day) {<NEW_LINE>if (COConfigurationManager.getBooleanParameter("tag.sharing.default.checked", false)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>COConfigurationManager.setParameter("tag.sharing.default.checked", true);<NEW_LINE>List<TagType> tag_types = tm.getTagTypes();<NEW_LINE>boolean prompt_required = false;<NEW_LINE>for (TagType tag_type : tag_types) {<NEW_LINE>List<Tag> tags = tag_type.getTags();<NEW_LINE>for (Tag tag : tags) {<NEW_LINE>if (tag.isPublic()) {<NEW_LINE>prompt_required = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!prompt_required) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String title = MessageText.getString("tag.sharing.enable.title");<NEW_LINE>String text = MessageText.getString("tag.sharing.enable.text");<NEW_LINE>UIFunctionsUserPrompter prompter = uiFunctions.getUserPrompter(title, text, new String[] { MessageText.getString("Button.yes"), MessageText.getString("Button.no") }, 0);<NEW_LINE>prompter.setRemember("tag.share.default", true<MASK><NEW_LINE>prompter.setAutoCloseInMS(0);<NEW_LINE>prompter.open(null);<NEW_LINE>boolean share = prompter.waitUntilClosed() == 0;<NEW_LINE>tm.setTagPublicDefault(share);<NEW_LINE>}<NEW_LINE>} | , MessageText.getString("MessageBoxWindow.nomoreprompting")); |
1,533,352 | private NodeValue calculate(NodeValue v) {<NEW_LINE>Node n = v.asNode();<NEW_LINE>if (!n.isLiteral())<NEW_LINE>throw new ExprEvalException("Not a literal: " + v);<NEW_LINE>if (n.getLiteralLanguage() != null && !n.getLiteralLanguage().equals(""))<NEW_LINE>throw new ExprEvalException("Can't make a digest of an RDF term with a language tag");<NEW_LINE>// Literal, no language tag.<NEW_LINE>if (n.getLiteralDatatype() != null && !XSDDatatype.XSDstring.equals(n.getLiteralDatatype()))<NEW_LINE>throw new ExprEvalException("Not a simple literal nor an XSD string");<NEW_LINE>try {<NEW_LINE>MessageDigest digest = getDigest();<NEW_LINE><MASK><NEW_LINE>byte[] b = x.getBytes(StandardCharsets.UTF_8);<NEW_LINE>byte[] d = digest.digest(b);<NEW_LINE>String y = Bytes.asHexLC(d);<NEW_LINE>NodeValue result = NodeValue.makeString(y);<NEW_LINE>return result;<NEW_LINE>} catch (Exception ex2) {<NEW_LINE>throw new ARQInternalErrorException(ex2);<NEW_LINE>}<NEW_LINE>} | String x = n.getLiteralLexicalForm(); |
680,087 | public Dimension render(Graphics2D graphics) {<NEW_LINE>if (client.isMenuOpen()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final MenuEntry[] menuEntries = client.getMenuEntries();<NEW_LINE>final int last = menuEntries.length - 1;<NEW_LINE>if (last < 0) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>final MenuAction action = menuEntry.getType();<NEW_LINE>final int widgetId = menuEntry.getParam1();<NEW_LINE>final int groupId = WidgetInfo.TO_GROUP(widgetId);<NEW_LINE>final boolean isAlching = menuEntry.getOption().equals("Cast") && menuEntry.getTarget().contains("High Level Alchemy");<NEW_LINE>// Tooltip action type handling<NEW_LINE>switch(action) {<NEW_LINE>case ITEM_USE_ON_WIDGET:<NEW_LINE>if (!config.showWhileAlching() || !isAlching) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case CC_OP:<NEW_LINE>case ITEM_USE:<NEW_LINE>case ITEM_FIRST_OPTION:<NEW_LINE>case ITEM_SECOND_OPTION:<NEW_LINE>case ITEM_THIRD_OPTION:<NEW_LINE>case ITEM_FOURTH_OPTION:<NEW_LINE>case ITEM_FIFTH_OPTION:<NEW_LINE>// Item tooltip values<NEW_LINE>switch(groupId) {<NEW_LINE>case WidgetID.EXPLORERS_RING_ALCH_GROUP_ID:<NEW_LINE>if (!config.showWhileAlching()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>case WidgetID.INVENTORY_GROUP_ID:<NEW_LINE>case WidgetID.POH_TREASURE_CHEST_INVENTORY_GROUP_ID:<NEW_LINE>if (config.hideInventory() && !(config.showWhileAlching() && isAlching)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// intentional fallthrough<NEW_LINE>case WidgetID.BANK_GROUP_ID:<NEW_LINE>case WidgetID.BANK_INVENTORY_GROUP_ID:<NEW_LINE>case WidgetID.SEED_VAULT_GROUP_ID:<NEW_LINE>case WidgetID.SEED_VAULT_INVENTORY_GROUP_ID:<NEW_LINE>// Make tooltip<NEW_LINE>final String text = makeValueTooltip(menuEntry);<NEW_LINE>if (text != null) {<NEW_LINE>tooltipManager.add(new Tooltip(ColorUtil.prependColorTag(text, new Color(238, 238, 238))));<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | final MenuEntry menuEntry = menuEntries[last]; |
1,011,945 | public void onPurchasesUpdated(BillingResult result, @Nullable List<Purchase> purchases) {<NEW_LINE>log("onPurchasesUpdated(" + result + ", " + purchases + ")");<NEW_LINE>String message;<NEW_LINE>switch(result.getResponseCode()) {<NEW_LINE>case OK:<NEW_LINE>if (purchases != null) {<NEW_LINE>for (Purchase p : purchases) {<NEW_LINE>acknowledgePurchase(p);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>message = getString(R.string.ui_donation_success_message);<NEW_LINE>break;<NEW_LINE>case ITEM_UNAVAILABLE:<NEW_LINE>message = getString(R.string.ui_donation_failure_message, getString(R.string.donation_error_unavailable));<NEW_LINE>break;<NEW_LINE>case ITEM_ALREADY_OWNED:<NEW_LINE>message = getString(R.string.ui_donation_failure_message, getString<MASK><NEW_LINE>break;<NEW_LINE>case USER_CANCELED:<NEW_LINE>message = getString(R.string.ui_donation_failure_message, getString(R.string.donation_error_canceled));<NEW_LINE>break;<NEW_LINE>case BILLING_UNAVAILABLE:<NEW_LINE>case FEATURE_NOT_SUPPORTED:<NEW_LINE>case ITEM_NOT_OWNED:<NEW_LINE>case SERVICE_DISCONNECTED:<NEW_LINE>case SERVICE_UNAVAILABLE:<NEW_LINE>case DEVELOPER_ERROR:<NEW_LINE>case ERROR:<NEW_LINE>case SERVICE_TIMEOUT:<NEW_LINE>default:<NEW_LINE>message = getString(R.string.ui_donation_failure_message, getString(R.string.donation_unspecified_error, result.getResponseCode()));<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>Toast.makeText(this, message, LENGTH_LONG).show();<NEW_LINE>finish();<NEW_LINE>} | (R.string.donation_error_already_owned)); |
249,699 | private DdlJob handleRecycleBin(LogicalTruncateTable logicalTruncateTable, ExecutionContext executionContext) {<NEW_LINE>RecycleBin recycleBin = RecycleBinManager.instance.getByAppName(executionContext.getAppName());<NEW_LINE>String tmpBinName = recycleBin.genName();<NEW_LINE>String tableName = logicalTruncateTable.getTableName().toLowerCase();<NEW_LINE>SqlNode tableNameNode = new SqlIdentifier(tableName, SqlParserPos.ZERO);<NEW_LINE>String createTableSql = DdlHelper.genCreateTableSql(tableNameNode, executionContext).toLowerCase();<NEW_LINE>createTableSql = createTableSql.replaceFirst(tableName, tmpBinName);<NEW_LINE>SqlNode newTableNameNode = new SqlIdentifier(tmpBinName, SqlParserPos.ZERO);<NEW_LINE>createTableSql = CDC_RECYCLE_HINTS + createTableSql;<NEW_LINE>SqlCreateTable sqlCreateTable = (SqlCreateTable) new FastsqlParser().parse(createTableSql).get(0);<NEW_LINE>CreateTable createTable = CreateTable.create(logicalTruncateTable.getCluster(), sqlCreateTable, newTableNameNode, null, null);<NEW_LINE>LogicalCreateTable logicalCreateTable = LogicalCreateTable.create(createTable);<NEW_LINE>ExecutableDdlJob truncateWithRecycleBinJob = buildCreateTableJob(logicalCreateTable, executionContext);<NEW_LINE>String binName = recycleBin.genName();<NEW_LINE>TruncateTableRecycleBinTask truncateTableRecycleBinTask = new TruncateTableRecycleBinTask(executionContext.getSchemaName(), tableName, binName, tmpBinName);<NEW_LINE>CdcTruncateWithRecycleMarkTask cdcTask1 = new CdcTruncateWithRecycleMarkTask(executionContext.getSchemaName(), tableName, binName);<NEW_LINE>CdcTruncateWithRecycleMarkTask cdcTask2 = new CdcTruncateWithRecycleMarkTask(executionContext.getSchemaName(), tmpBinName, tableName);<NEW_LINE>truncateWithRecycleBinJob.addTask(truncateTableRecycleBinTask);<NEW_LINE>DdlTask <MASK><NEW_LINE>truncateWithRecycleBinJob.addTaskRelationship(tableSyncTask, cdcTask1);<NEW_LINE>truncateWithRecycleBinJob.addTaskRelationship(cdcTask1, cdcTask2);<NEW_LINE>truncateWithRecycleBinJob.addTaskRelationship(cdcTask2, truncateTableRecycleBinTask);<NEW_LINE>truncateWithRecycleBinJob.labelAsTail(truncateTableRecycleBinTask);<NEW_LINE>recycleBin.add(binName, tableName);<NEW_LINE>return truncateWithRecycleBinJob;<NEW_LINE>} | tableSyncTask = truncateWithRecycleBinJob.getTaskByLabel(CREATE_TABLE_SYNC_TASK); |
1,309,091 | protected List<Attachment> downloadCssAndImages(String endpoint, HttpRequest request) throws MalformedURLException, IOException {<NEW_LINE>HtmlPage htmlPage = client.getPage(endpoint);<NEW_LINE>String xPathExpression = "//*[name() = 'img' or name() = 'link' and @type = 'text/css']";<NEW_LINE>List<?> resultList = htmlPage.getByXPath(xPathExpression);<NEW_LINE>byte[] bytes = null;<NEW_LINE>List<Attachment> attachmentList = new ArrayList<Attachment>();<NEW_LINE>Iterator<?> i = resultList.iterator();<NEW_LINE>while (i.hasNext()) {<NEW_LINE>try {<NEW_LINE>HtmlElement htmlElement = (HtmlElement) i.next();<NEW_LINE>String path = htmlElement.getAttribute("src").equals("") ? htmlElement.getAttribute("href"<MASK><NEW_LINE>if (path == null || path.equals("")) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>URL url = htmlPage.getFullyQualifiedUrl(path);<NEW_LINE>try {<NEW_LINE>bytes = downloadResource(htmlPage, htmlElement, url);<NEW_LINE>} catch (FailingHttpStatusCodeException fhsce) {<NEW_LINE>SoapUI.log.warn(fhsce.getMessage());<NEW_LINE>attachmentList.add(createMissingAttachment(request, url, fhsce));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>attachmentList.add(createAttachment(bytes, url, request));<NEW_LINE>} catch (Exception e) {<NEW_LINE>SoapUI.logError(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>client.removeRequestHeader("Accept");<NEW_LINE>return attachmentList;<NEW_LINE>} | ) : htmlElement.getAttribute("src"); |
489,574 | public void fillBeats(double start) {<NEW_LINE>double prevBeat = 0, nextBeat, currentInterval, beats;<NEW_LINE>ListIterator<Event> list = events.listIterator();<NEW_LINE>if (list.hasNext()) {<NEW_LINE>prevBeat = list.next().keyDown;<NEW_LINE>// alt. to fill from 0:<NEW_LINE>// prevBeat = Math.mod(list.next().keyDown, beatInterval);<NEW_LINE>list.previous();<NEW_LINE>}<NEW_LINE>for (; list.hasNext(); list.next()) {<NEW_LINE>nextBeat = list.next().keyDown;<NEW_LINE>list.previous();<NEW_LINE>// prefer slow<NEW_LINE>beats = Math.round((nextBeat <MASK><NEW_LINE>currentInterval = (nextBeat - prevBeat) / beats;<NEW_LINE>for (; (nextBeat > start) && (beats > 1.5); beats--) {<NEW_LINE>prevBeat += currentInterval;<NEW_LINE>if (debug)<NEW_LINE>System.out.printf("Insert beat at: %8.3f (n=%1.0f)\n", prevBeat, beats - 1.0);<NEW_LINE>// more than once OK??<NEW_LINE>list.add(newBeat(prevBeat, 0));<NEW_LINE>}<NEW_LINE>prevBeat = nextBeat;<NEW_LINE>}<NEW_LINE>} | - prevBeat) / beatInterval - 0.01); |
1,296,841 | private String workWithProperties(HttpServletResponse res, HttpServletRequest req, String operation, String uid) throws IOException {<NEW_LINE>String message = null;<NEW_LINE>if (OP_RMV_PROPERTY.equalsIgnoreCase(operation)) {<NEW_LINE>getFf4j().getPropertiesStore().deleteProperty(uid);<NEW_LINE>LOGGER.info("Property '" + uid + "' has been deleted");<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (OP_READ_PROPERTY.equalsIgnoreCase(operation)) {<NEW_LINE>Property<?> ap = getFf4j().getPropertiesStore().readProperty(uid);<NEW_LINE>res.setContentType(CONTENT_TYPE_JSON);<NEW_LINE>res.getWriter().println(ap.toString());<NEW_LINE>}<NEW_LINE>if (OP_DELETE_FIXEDVALUE.equalsIgnoreCase(operation)) {<NEW_LINE>String fixedValue = req.getParameter(PARAM_FIXEDVALUE);<NEW_LINE>Property<?> ap = getFf4j().getPropertiesStore().readProperty(uid);<NEW_LINE>ap.getFixedValues().remove(fixedValue);<NEW_LINE>getFf4j().getPropertiesStore().updateProperty(ap);<NEW_LINE>}<NEW_LINE>if (OP_ADD_FIXEDVALUE.equalsIgnoreCase(operation)) {<NEW_LINE>String fixedValue = req.getParameter(PARAM_FIXEDVALUE);<NEW_LINE>Property<?> ap = getFf4j().getPropertiesStore().readProperty(uid);<NEW_LINE>ap.add2FixedValueFromString(fixedValue);<NEW_LINE>getFf4j().getPropertiesStore().updateProperty(ap);<NEW_LINE>}<NEW_LINE>return message;<NEW_LINE>} | message = renderMsgProperty(uid, "DELETED"); |
1,608,364 | private void handleDeleteAllSelected() {<NEW_LINE>final DcContext dcContext = DcHelper.getContext(getActivity());<NEW_LINE>int conversationsCount = getListAdapter().getBatchSelections().size();<NEW_LINE>AlertDialog.Builder alert = new AlertDialog.Builder(getActivity());<NEW_LINE>alert.setMessage(getActivity().getResources().getQuantityString(R.plurals.ask_delete_chat, conversationsCount, conversationsCount));<NEW_LINE>alert.setCancelable(true);<NEW_LINE>alert.setPositiveButton(R.string.delete, (dialog, which) -> {<NEW_LINE>final Set<Long> selectedConversations = (getListAdapter()).getBatchSelections();<NEW_LINE>if (!selectedConversations.isEmpty()) {<NEW_LINE>new AsyncTask<Void, Void, Void>() {<NEW_LINE><NEW_LINE>private ProgressDialog dialog;<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected void onPreExecute() {<NEW_LINE>dialog = ProgressDialog.show(getActivity(), "", getActivity().getString(R.string<MASK><NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected Void doInBackground(Void... params) {<NEW_LINE>for (long chatId : selectedConversations) {<NEW_LINE>DcHelper.getNotificationCenter(getContext()).removeNotifications((int) chatId);<NEW_LINE>dcContext.deleteChat((int) chatId);<NEW_LINE>DirectShareUtil.clearShortcut(getContext(), (int) chatId);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected void onPostExecute(Void result) {<NEW_LINE>dialog.dismiss();<NEW_LINE>if (actionMode != null) {<NEW_LINE>actionMode.finish();<NEW_LINE>actionMode = null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>alert.setNegativeButton(android.R.string.cancel, null);<NEW_LINE>alert.show();<NEW_LINE>} | .one_moment), true, false); |
823,142 | private Prediction<MultiLabel> generatePrediction(FloatNdArray predictions, ImmutableOutputInfo<MultiLabel> outputIDInfo, int numUsed, Example<MultiLabel> example) {<NEW_LINE>long[] shape = predictions.shape().asArray();<NEW_LINE>if (shape.length != 1) {<NEW_LINE>throw new IllegalArgumentException("Failed to get scalar predictions. Found " + Arrays.toString(shape));<NEW_LINE>}<NEW_LINE>if (shape[0] > Integer.MAX_VALUE) {<NEW_LINE>throw new IllegalArgumentException<MASK><NEW_LINE>}<NEW_LINE>int length = (int) shape[0];<NEW_LINE>Map<String, MultiLabel> fullLabels = new HashMap<>(outputIDInfo.size());<NEW_LINE>Set<Label> predictedLabels = new HashSet<>();<NEW_LINE>for (int i = 0; i < length; i++) {<NEW_LINE>String labelName = outputIDInfo.getOutput(i).getLabelString();<NEW_LINE>double labelScore = predictions.getFloat(i);<NEW_LINE>Label score = new Label(labelName, labelScore);<NEW_LINE>if (labelScore > THRESHOLD) {<NEW_LINE>predictedLabels.add(score);<NEW_LINE>}<NEW_LINE>fullLabels.put(labelName, new MultiLabel(score));<NEW_LINE>}<NEW_LINE>return new Prediction<>(new MultiLabel(predictedLabels), fullLabels, numUsed, example, true);<NEW_LINE>} | ("More than Integer.MAX_VALUE predictions. Found " + shape[0]); |
306,294 | private boolean onShardLimitBreached(long nodeTotalBytes, long nodeLimit, long requestStartTime, OperationTracker operationTracker, BooleanSupplier increaseShardLimitSupplier) {<NEW_LINE>// Secondary Parameters (i.e. LastSuccessfulRequestDuration and Throughput) is taken into consideration when<NEW_LINE>// the current node utilization is greater than primary_parameter.node.soft_limit of total node limits.<NEW_LINE>if (((double) nodeTotalBytes / nodeLimit) < this.nodeSoftLimit) {<NEW_LINE>boolean isShardLimitsIncreased = increaseShardLimitSupplier.getAsBoolean();<NEW_LINE>if (isShardLimitsIncreased == false) {<NEW_LINE>incrementNodeLimitBreachedRejectionCount(operationTracker.getRejectionTracker());<NEW_LINE>}<NEW_LINE>return !isShardLimitsIncreased;<NEW_LINE>} else {<NEW_LINE>boolean shardLastSuccessfulRequestDurationLimitsBreached = evaluateLastSuccessfulRequestDurationLimitsBreached(operationTracker.getPerformanceTracker(), requestStartTime);<NEW_LINE>if (shardLastSuccessfulRequestDurationLimitsBreached) {<NEW_LINE>operationTracker.getRejectionTracker().incrementLastSuccessfulRequestLimitsBreachedRejections();<NEW_LINE>this.totalLastSuccessfulRequestLimitsBreachedRejections.incrementAndGet();<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>boolean shardThroughputDegradationLimitsBreached = evaluateThroughputDegradationLimitsBreached(operationTracker.getPerformanceTracker(), <MASK><NEW_LINE>if (shardThroughputDegradationLimitsBreached) {<NEW_LINE>operationTracker.getRejectionTracker().incrementThroughputDegradationLimitsBreachedRejections();<NEW_LINE>this.totalThroughputDegradationLimitsBreachedRejections.incrementAndGet();<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>boolean isShardLimitsIncreased = increaseShardLimitSupplier.getAsBoolean();<NEW_LINE>if (isShardLimitsIncreased == false) {<NEW_LINE>incrementNodeLimitBreachedRejectionCount(operationTracker.getRejectionTracker());<NEW_LINE>}<NEW_LINE>return !isShardLimitsIncreased;<NEW_LINE>}<NEW_LINE>} | operationTracker.getStatsTracker(), primaryAndCoordinatingThroughputDegradationLimits); |
994,392 | public FieldInitializers build() throws AttrLookupException {<NEW_LINE>Map<ResourceType, Collection<FieldInitializer>> initializers = new EnumMap<>(ResourceType.class);<NEW_LINE>Map<ResourceType, Integer> typeIdMap = chooseTypeIds();<NEW_LINE>Map<String, Integer> attrAssignments = assignAttrIds(typeIdMap.get(ResourceType.ATTR));<NEW_LINE>for (Map.Entry<ResourceType, SortedMap<String, ResourceLinkageInfo>> fieldEntries : innerClasses.entrySet()) {<NEW_LINE><MASK><NEW_LINE>SortedMap<String, ResourceLinkageInfo> sortedFields = fieldEntries.getValue();<NEW_LINE>ImmutableList<FieldInitializer> fields;<NEW_LINE>if (type == ResourceType.STYLEABLE) {<NEW_LINE>fields = getStyleableInitializers(attrAssignments, sortedFields);<NEW_LINE>} else if (type == ResourceType.ATTR) {<NEW_LINE>fields = getAttrInitializers(attrAssignments, sortedFields);<NEW_LINE>} else {<NEW_LINE>int typeId = typeIdMap.get(type);<NEW_LINE>fields = getResourceInitializers(typeId, sortedFields);<NEW_LINE>}<NEW_LINE>// The maximum number of Java fields is 2^16.<NEW_LINE>// See the JVM reference "4.11. Limitations of the Java Virtual Machine."<NEW_LINE>Preconditions.checkArgument(fields.size() < (1 << 16));<NEW_LINE>initializers.put(type, fields);<NEW_LINE>}<NEW_LINE>return FieldInitializers.copyOf(initializers);<NEW_LINE>} | ResourceType type = fieldEntries.getKey(); |
117,725 | protected boolean tx(Config config, int transactionLevel, IAtom atom) {<NEW_LINE>Connection conn = config.getThreadLocalConnection();<NEW_LINE>if (conn != null) {<NEW_LINE>// Nested transaction support<NEW_LINE>try {<NEW_LINE>if (conn.getTransactionIsolation() < transactionLevel)<NEW_LINE>conn.setTransactionIsolation(transactionLevel);<NEW_LINE>boolean result = atom.run();<NEW_LINE>if (result)<NEW_LINE>return true;<NEW_LINE>// important:can not return false<NEW_LINE>throw new NestedTransactionHelpException("Notice the outer transaction that the nested transaction return false");<NEW_LINE>} catch (SQLException e) {<NEW_LINE>throw new ActiveRecordException(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Boolean autoCommit = null;<NEW_LINE>try {<NEW_LINE>conn = config.getConnection();<NEW_LINE>autoCommit = conn.getAutoCommit();<NEW_LINE>config.setThreadLocalConnection(conn);<NEW_LINE>conn.setTransactionIsolation(transactionLevel);<NEW_LINE>conn.setAutoCommit(false);<NEW_LINE>boolean result = atom.run();<NEW_LINE>if (result)<NEW_LINE>conn.commit();<NEW_LINE>else<NEW_LINE>conn.rollback();<NEW_LINE>return result;<NEW_LINE>} catch (NestedTransactionHelpException e) {<NEW_LINE>if (conn != null)<NEW_LINE>try {<NEW_LINE>conn.rollback();<NEW_LINE>} catch (Exception e1) {<NEW_LINE>LogKit.error(e1.getMessage(), e1);<NEW_LINE>}<NEW_LINE>LogKit.logNothing(e);<NEW_LINE>return false;<NEW_LINE>} catch (Throwable t) {<NEW_LINE>if (conn != null)<NEW_LINE>try {<NEW_LINE>conn.rollback();<NEW_LINE>} catch (Exception e1) {<NEW_LINE>LogKit.error(e1.getMessage(), e1);<NEW_LINE>}<NEW_LINE>throw t instanceof RuntimeException ? (RuntimeException<MASK><NEW_LINE>} finally {<NEW_LINE>try {<NEW_LINE>if (conn != null) {<NEW_LINE>if (autoCommit != null)<NEW_LINE>conn.setAutoCommit(autoCommit);<NEW_LINE>conn.close();<NEW_LINE>}<NEW_LINE>} catch (Throwable t) {<NEW_LINE>// can not throw exception here, otherwise the more important exception in previous catch block can not be thrown<NEW_LINE>LogKit.error(t.getMessage(), t);<NEW_LINE>} finally {<NEW_LINE>// prevent memory leak<NEW_LINE>config.removeThreadLocalConnection();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ) t : new ActiveRecordException(t); |
1,123,736 | private void openNewObject() {<NEW_LINE>IWorkbenchWindow workbenchWindow = UIUtils.getActiveWorkbenchWindow();<NEW_LINE>try {<NEW_LINE>final DBNDatabaseNode newChild = DBWorkbench.getPlatform().getNavigatorModel().findNode(newObject);<NEW_LINE>if (newChild != null) {<NEW_LINE>DatabaseNavigatorView view = UIUtils.findView(workbenchWindow, DatabaseNavigatorView.class);<NEW_LINE>if (view != null) {<NEW_LINE>view.showNode(newChild);<NEW_LINE>}<NEW_LINE>final boolean openEditor = parentObject instanceof DBSObject && (objectMaker.getMakerOptions(((DBSObject) parentObject).getDataSource()<MASK><NEW_LINE>IDatabaseEditor editor = commandTarget.getEditor();<NEW_LINE>if (editor != null) {<NEW_LINE>// Just activate existing editor<NEW_LINE>workbenchWindow.getActivePage().activate(editor);<NEW_LINE>} else if (openEditor) {<NEW_LINE>// Open new one with existing context<NEW_LINE>DatabaseNodeEditorInput editorInput = new DatabaseNodeEditorInput(newChild, commandTarget.getContext());<NEW_LINE>// New object editors must open main editor<NEW_LINE>editorInput.setDefaultPageId(EntityEditorDescriptor.DEFAULT_OBJECT_EDITOR_ID);<NEW_LINE>workbenchWindow.getActivePage().openEditor(editorInput, EntityEditor.class.getName());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new DBException("Can't find node corresponding to new object");<NEW_LINE>}<NEW_LINE>} catch (Throwable e) {<NEW_LINE>DBWorkbench.getPlatformUI().showError("Create object", null, e);<NEW_LINE>}<NEW_LINE>} | ) & DBEObjectMaker.FEATURE_EDITOR_ON_CREATE) != 0; |
1,380,499 | public void start() {<NEW_LINE>if (current != null) {<NEW_LINE>current.show();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Form f = new Form("custom tabs", new BorderLayout());<NEW_LINE>Tabs outerTabs = new Tabs();<NEW_LINE>Tabs tabs = new Tabs();<NEW_LINE>tabs.addTab("inner1", new Label("content1"));<NEW_LINE>tabs.addTab(<MASK><NEW_LINE>tabs.addTab("inner3", new Label("content3"));<NEW_LINE>Container tabsCont = tabs.getTabsContainer();<NEW_LINE>TableLayout newLayout = new TableLayout(1, 2);<NEW_LINE>tabsCont.getComponentAt(0).setHidden(true);<NEW_LINE>tabsCont.setLayout(newLayout);<NEW_LINE>newLayout.addLayoutComponent(newLayout.cc(0, 0).widthPercentage(50), tabsCont.getComponentAt(1), tabsCont);<NEW_LINE>newLayout.addLayoutComponent(newLayout.cc(0, 1).widthPercentage(50), tabsCont.getComponentAt(2), tabsCont);<NEW_LINE>outerTabs.addTab("outer1", new Container());<NEW_LINE>outerTabs.addTab("outer2", tabs);<NEW_LINE>f.addComponent(BorderLayout.CENTER, outerTabs);<NEW_LINE>f.show();<NEW_LINE>} | "inner2", new Label("content2")); |
963,252 | final CreateBusinessReportScheduleResult executeCreateBusinessReportSchedule(CreateBusinessReportScheduleRequest createBusinessReportScheduleRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createBusinessReportScheduleRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateBusinessReportScheduleRequest> request = null;<NEW_LINE>Response<CreateBusinessReportScheduleResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateBusinessReportScheduleRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createBusinessReportScheduleRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Alexa For Business");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateBusinessReportScheduleResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateBusinessReportScheduleResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateBusinessReportSchedule"); |
1,176,128 | public void saveProcessInfoOnly(final ProcessInfo pi) {<NEW_LINE>//<NEW_LINE>// Create/Load the AD_PInstance<NEW_LINE>final I_AD_PInstance adPInstance;<NEW_LINE>if (pi.getPinstanceId() == null) {<NEW_LINE>adPInstance = newInstanceOutOfTrx(I_AD_PInstance.class);<NEW_LINE>setValue(adPInstance, I_AD_PInstance.COLUMNNAME_AD_Client_ID, pi.getAD_Client_ID());<NEW_LINE>adPInstance.setIsProcessing(false);<NEW_LINE>} else {<NEW_LINE>adPInstance = loadOutOfTrx(pi.getPinstanceId(), I_AD_PInstance.class);<NEW_LINE>Check.assumeNotNull(adPInstance, "Parameter adPInstance is not null for {}", pi);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Update the AD_PInstance and save<NEW_LINE>adPInstance.setAD_Org_ID(pi.getAD_Org_ID());<NEW_LINE>adPInstance.setAD_User_ID(pi.getAD_User_ID());<NEW_LINE>adPInstance.setAD_Role_ID(RoleId.toRepoId(pi.getRoleId()));<NEW_LINE>adPInstance.<MASK><NEW_LINE>// TODO: workaround while Record_ID is mandatory and value <= is interpreted as null<NEW_LINE>adPInstance.setRecord_ID(CoalesceUtil.firstGreaterThanZero(pi.getRecord_ID(), 0));<NEW_LINE>adPInstance.setWhereClause(pi.getWhereClause());<NEW_LINE>adPInstance.setAD_Process_ID(pi.getAdProcessId().getRepoId());<NEW_LINE>adPInstance.setAD_Window_ID(pi.getAD_Window_ID());<NEW_LINE>adPInstance.setAD_Scheduler_ID(AdSchedulerId.toRepoId(pi.getInvokedBySchedulerId()));<NEW_LINE>final Language reportingLanguage = pi.getReportLanguage();<NEW_LINE>final String adLanguage = reportingLanguage == null ? null : reportingLanguage.getAD_Language();<NEW_LINE>adPInstance.setAD_Language(adLanguage);<NEW_LINE>saveRecord(adPInstance);<NEW_LINE>//<NEW_LINE>// Update ProcessInfo's AD_PInstance_ID<NEW_LINE>pi.setPInstanceId(PInstanceId.ofRepoId(adPInstance.getAD_PInstance_ID()));<NEW_LINE>} | setAD_Table_ID(pi.getTable_ID()); |
627,187 | static void cleanup() {<NEW_LINE>String tempFolder = getTempDir().getAbsolutePath();<NEW_LINE>File dir = new File(tempFolder);<NEW_LINE>File[] nativeLibFiles = dir.listFiles(new FilenameFilter() {<NEW_LINE><NEW_LINE>private final String searchPattern = "sqlite-" + getVersion();<NEW_LINE><NEW_LINE>public boolean accept(File dir, String name) {<NEW_LINE>return name.startsWith(searchPattern) && !name.endsWith(".lck");<NEW_LINE>}<NEW_LINE>});<NEW_LINE>if (nativeLibFiles != null) {<NEW_LINE>for (File nativeLibFile : nativeLibFiles) {<NEW_LINE>File lckFile = new File(<MASK><NEW_LINE>if (!lckFile.exists()) {<NEW_LINE>try {<NEW_LINE>nativeLibFile.delete();<NEW_LINE>} catch (SecurityException e) {<NEW_LINE>System.err.println("Failed to delete old native lib" + e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | nativeLibFile.getAbsolutePath() + ".lck"); |
1,636,080 | private void outholder(XmlAppendable out, MetaData md, FilterHolder holder) throws IOException {<NEW_LINE>if (LOG.isDebugEnabled())<NEW_LINE>out.openTag("filter", Collections.singletonMap("source", holder.getSource().toString()));<NEW_LINE>else<NEW_LINE>out.openTag("filter");<NEW_LINE>String n = holder.getName();<NEW_LINE>out.tag("filter-name", n);<NEW_LINE>String ot = n + ".filter.";<NEW_LINE>if (holder instanceof FilterHolder) {<NEW_LINE>out.tag("filter-class", origin(md, ot + "filter-class"), holder.getClassName());<NEW_LINE>out.tag("async-supported", origin(md, ot + "async-supported"), holder.<MASK><NEW_LINE>}<NEW_LINE>for (String p : holder.getInitParameters().keySet()) {<NEW_LINE>out.openTag("init-param", origin(md, ot + "init-param." + p)).tag("param-name", p).tag("param-value", holder.getInitParameter(p)).closeTag();<NEW_LINE>}<NEW_LINE>out.closeTag();<NEW_LINE>} | isAsyncSupported() ? "true" : "false"); |
373,225 | private void provider(Clinician provider, String orgId) throws IOException {<NEW_LINE>// Id,ORGANIZATION,NAME,GENDER,SPECIALITY,ADDRESS,CITY,STATE,ZIP,UTILIZATION<NEW_LINE>StringBuilder s = new StringBuilder();<NEW_LINE>s.append(provider.getResourceID()).append(',');<NEW_LINE>s.append(orgId).append(',');<NEW_LINE>for (String attribute : new String[] { Clinician.NAME, Clinician.GENDER, Clinician.SPECIALTY, Clinician.ADDRESS, Clinician.CITY, Clinician.STATE, Clinician.ZIP }) {<NEW_LINE>String value = (String) provider.attributes.getOrDefault(attribute, "");<NEW_LINE>s.append(clean(value)).append(',');<NEW_LINE>}<NEW_LINE>s.append(provider.getY()).append(',');<NEW_LINE>s.append(provider.getX()).append(',');<NEW_LINE>s.append(provider.getEncounterCount());<NEW_LINE>s.append(NEWLINE);<NEW_LINE>write(<MASK><NEW_LINE>} | s.toString(), providers); |
588,081 | public static ProcessedAndroidData processBinaryDataFrom(AndroidDataContext dataContext, RuleErrorConsumer errorConsumer, StampedAndroidManifest manifest, boolean conditionalKeepRules, Map<String, String> manifestValues, AndroidResources resources, AndroidAssets assets, ResourceDependencies resourceDeps, AssetDependencies assetDeps, ResourceFilterFactory resourceFilterFactory, List<String> noCompressExtensions, boolean crunchPng, DataBindingContext dataBindingContext) throws RuleErrorException, InterruptedException {<NEW_LINE>AndroidResourcesProcessorBuilder builder = builderForNonIncrementalTopLevelTarget(dataContext, manifest, manifestValues).setManifestOut(dataContext.createOutputArtifact(AndroidRuleClasses.ANDROID_PROCESSED_MANIFEST)).setMergedResourcesOut(dataContext.createOutputArtifact(AndroidRuleClasses.ANDROID_RESOURCES_ZIP)).setMainDexProguardOut(AndroidBinary.createMainDexProguardSpec(dataContext.getLabel(), dataContext.getActionConstructionContext())).conditionalKeepRules(conditionalKeepRules);<NEW_LINE><MASK><NEW_LINE>return buildActionForBinary(dataContext, dataBindingContext, errorConsumer, builder, manifest, resources, assets, resourceDeps, assetDeps, resourceFilterFactory, noCompressExtensions, crunchPng);<NEW_LINE>} | dataBindingContext.supplyLayoutInfo(builder::setDataBindingInfoZip); |
837,427 | public static Rectangle toBoundingBox(final String geohash) {<NEW_LINE>// bottom left is the coordinate<NEW_LINE>Point bottomLeft = toPoint(geohash);<NEW_LINE>int len = Math.min(12, geohash.length());<NEW_LINE>long ghLong = longEncode(geohash, len);<NEW_LINE>// shift away the level<NEW_LINE>ghLong >>>= 4;<NEW_LINE>// deinterleave<NEW_LINE>long lon = BitUtil.deinterleave(ghLong >>> 1);<NEW_LINE>long lat = BitUtil.deinterleave(ghLong);<NEW_LINE>final int shift = (12 - len) * 5 + 2;<NEW_LINE>if (lat < MAX_LAT_BITS) {<NEW_LINE>// add 1 to lat and lon to get topRight<NEW_LINE>ghLong = BitUtil.interleave((int) (lat + 1), (int) (lon + 1)) << 4 | len;<NEW_LINE>final long mortonHash = BitUtil.flipFlop((ghLong >>> 4) << shift);<NEW_LINE>Point topRight = new Point(decodeLongitude(mortonHash), decodeLatitude(mortonHash));<NEW_LINE>return new Rectangle(bottomLeft.getX(), topRight.getX(), topRight.getY(), bottomLeft.getY());<NEW_LINE>} else {<NEW_LINE>// We cannot go north of north pole, so just using 90 degrees instead of calculating it using<NEW_LINE>// add 1 to lon to get lon of topRight, we are going to use 90 for lat<NEW_LINE>ghLong = BitUtil.interleave((int) lat, (int) (lon <MASK><NEW_LINE>final long mortonHash = BitUtil.flipFlop((ghLong >>> 4) << shift);<NEW_LINE>Point topRight = new Point(decodeLongitude(mortonHash), decodeLatitude(mortonHash));<NEW_LINE>return new Rectangle(bottomLeft.getX(), topRight.getX(), 90D, bottomLeft.getY());<NEW_LINE>}<NEW_LINE>} | + 1)) << 4 | len; |
1,646,787 | final DeleteAutoScalingGroupResult executeDeleteAutoScalingGroup(DeleteAutoScalingGroupRequest deleteAutoScalingGroupRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteAutoScalingGroupRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteAutoScalingGroupRequest> request = null;<NEW_LINE>Response<DeleteAutoScalingGroupResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteAutoScalingGroupRequestMarshaller().marshall(super.beforeMarshalling(deleteAutoScalingGroupRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Auto Scaling");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteAutoScalingGroup");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DeleteAutoScalingGroupResult> responseHandler = new StaxResponseHandler<DeleteAutoScalingGroupResult>(new DeleteAutoScalingGroupResultStaxUnmarshaller());<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
166,811 | private static boolean mayBeGlobalAlias(Ref alias) {<NEW_LINE>// Note: alias.scope is the closest scope in which the aliasing assignment occurred.<NEW_LINE>// So for "if (true) { var alias = aliasedVar; }", the alias.scope would be the IF block<NEW_LINE>// scope.<NEW_LINE>if (alias.scope.isGlobal()) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>// If the scope in which the alias is assigned is not global, look up the LHS of the<NEW_LINE>// assignment.<NEW_LINE>Node aliasParent = alias.getNode().getParent();<NEW_LINE>if (!aliasParent.isAssign() && !aliasParent.isName()) {<NEW_LINE>// Only handle variable assignments and initializing declarations.<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>Node aliasLhsNode = aliasParent.isName() ? aliasParent : aliasParent.getFirstChild();<NEW_LINE>if (!aliasLhsNode.isName()) {<NEW_LINE>// Only handle assignments to simple names, not qualified names or GETPROPs.<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>Var aliasVar = alias.scope.getVar(aliasVarName);<NEW_LINE>if (aliasVar != null) {<NEW_LINE>return aliasVar.isGlobal();<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | String aliasVarName = aliasLhsNode.getString(); |
274,305 | private void applyDashPatternIfNeeded(Matrix parentMatrix) {<NEW_LINE>L.beginSection("StrokeContent#applyDashPattern");<NEW_LINE>if (dashPatternAnimations.isEmpty()) {<NEW_LINE>L.endSection("StrokeContent#applyDashPattern");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>float scale = Utils.getScale(parentMatrix);<NEW_LINE>for (int i = 0; i < dashPatternAnimations.size(); i++) {<NEW_LINE>dashPatternValues[i] = dashPatternAnimations.get(i).getValue();<NEW_LINE>// If the value of the dash pattern or gap is too small, the number of individual sections<NEW_LINE>// approaches infinity as the value approaches 0.<NEW_LINE>// To mitigate this, we essentially put a minimum value on the dash pattern size of 1px<NEW_LINE>// and a minimum gap size of 0.01.<NEW_LINE>if (i % 2 == 0) {<NEW_LINE>if (dashPatternValues[i] < 1f) {<NEW_LINE>dashPatternValues[i] = 1f;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (dashPatternValues[i] < 0.1f) {<NEW_LINE>dashPatternValues[i] = 0.1f;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>dashPatternValues[i] *= scale;<NEW_LINE>}<NEW_LINE>float offset = dashPatternOffsetAnimation == null ? 0f <MASK><NEW_LINE>paint.setPathEffect(new DashPathEffect(dashPatternValues, offset));<NEW_LINE>L.endSection("StrokeContent#applyDashPattern");<NEW_LINE>} | : dashPatternOffsetAnimation.getValue() * scale; |
1,664,033 | private void addDataSourceDetails() {<NEW_LINE>String dataSourceName = dataSourceNames.size() > 1 ? "" : dataSourceNames.iterator().next();<NEW_LINE>if (!dataSourceName.isEmpty()) {<NEW_LINE>javax.swing.JLabel dataSourceDetailsLabel = new javax.swing.JLabel();<NEW_LINE>org.openide.awt.Mnemonics.setLocalizedText(dataSourceDetailsLabel, Bundle.OccurrencePanel_dataSourceDetails_text());<NEW_LINE>dataSourceDetailsLabel.setFont(dataSourceDetailsLabel.getFont().deriveFont(Font.BOLD, dataSourceDetailsLabel.getFont().getSize()));<NEW_LINE>addItemToBag(gridY, 0, TOP_INSET, 0, dataSourceDetailsLabel);<NEW_LINE>gridY++;<NEW_LINE>javax.swing.JLabel dataSourceNameLabel = new javax.swing.JLabel();<NEW_LINE>org.openide.awt.Mnemonics.setLocalizedText(<MASK><NEW_LINE>addItemToBag(gridY, 0, VERTICAL_GAP, VERTICAL_GAP, dataSourceNameLabel);<NEW_LINE>javax.swing.JLabel dataSourceNameValue = new javax.swing.JLabel();<NEW_LINE>dataSourceNameValue.setText(dataSourceName);<NEW_LINE>addItemToBag(gridY, 1, VERTICAL_GAP, VERTICAL_GAP, dataSourceNameValue);<NEW_LINE>gridY++;<NEW_LINE>}<NEW_LINE>} | dataSourceNameLabel, Bundle.OccurrencePanel_dataSourceNameLabel_text()); |
1,701,579 | private void encodeColumn(FacesContext context, int columns, ResponseWriter writer, String[] columnClasses, UIComponent child, int colMod) throws IOException {<NEW_LINE>String columnClass = (colMod < columnClasses.length) ? PanelGrid.CELL_CLASS + " " + columnClasses[colMod].trim() : PanelGrid.CELL_CLASS;<NEW_LINE>if (!columnClass.contains("ui-md-") && !columnClass.contains("ui-g-") && !columnClass.contains("ui-grid-col-")) {<NEW_LINE>columnClass = columnClass + " " + GridLayoutUtils.getColumnClass(columns);<NEW_LINE>}<NEW_LINE>writer.startElement("div", null);<NEW_LINE>Column column = child instanceof Column ? (Column) child : null;<NEW_LINE>if (column != null) {<NEW_LINE>if (column.getId() != null)<NEW_LINE>writer.writeAttribute("id", column<MASK><NEW_LINE>if (column.getStyle() != null)<NEW_LINE>writer.writeAttribute("style", column.getStyle(), null);<NEW_LINE>if (column.getStyleClass() != null)<NEW_LINE>columnClass = PanelGrid.CELL_CLASS + " " + column.getStyleClass();<NEW_LINE>}<NEW_LINE>writer.writeAttribute("class", columnClass, null);<NEW_LINE>child.encodeAll(context);<NEW_LINE>writer.endElement("div");<NEW_LINE>} | .getClientId(context), null); |
1,845,799 | public void start() {<NEW_LINE>registerMetrics();<NEW_LINE>_srcKafkaTopicObserver.start();<NEW_LINE>_destKafkaTopicObserver.start();<NEW_LINE><MASK><NEW_LINE>maybeCreateZkPath(_blacklistedTopicsZPath);<NEW_LINE>// Report current status every one minutes.<NEW_LINE>LOGGER.info("Trying to schedule auto topic whitelisting job at rate {} {} !", _refreshTimeInSec, _timeUnit.toString());<NEW_LINE>_executorService.scheduleAtFixedRate(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>if (_helixMirrorMakerManager.isLeader()) {<NEW_LINE>_numOfAutoWhitelistingRuns.inc();<NEW_LINE>LOGGER.info("Trying to run topic whitelisting job");<NEW_LINE>Set<String> candidateTopicsToWhitelist = null;<NEW_LINE>try {<NEW_LINE>candidateTopicsToWhitelist = getCandidateTopicsToWhitelist();<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error("Failed to get candidate topics: ", e);<NEW_LINE>candidateTopicsToWhitelist = new HashSet<String>();<NEW_LINE>}<NEW_LINE>LOGGER.info("Trying to whitelist topics: {}", Arrays.toString(candidateTopicsToWhitelist.toArray(new String[0])));<NEW_LINE>_numErrorTopics.dec(_numErrorTopics.getCount());<NEW_LINE>whitelistCandiateTopics(candidateTopicsToWhitelist);<NEW_LINE>} else {<NEW_LINE>LOGGER.debug("Not leader, skip auto topic whitelisting!");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}, Math.min(_initWaitTimeInSec, _refreshTimeInSec), _refreshTimeInSec, _timeUnit);<NEW_LINE>} | LOGGER.info("Creating zkpath={} for blacklisted topics", _blacklistedTopicsZPath); |
217,590 | public MegaOffline findbyPathAndName(String path, String name) {<NEW_LINE>String selectQuery = "SELECT * FROM " + TABLE_OFFLINE + " WHERE " + KEY_OFF_PATH + " = '" + encrypt(path) + "'" + "AND " + KEY_OFF_NAME + " = '" + encrypt(name) + "'";<NEW_LINE>MegaOffline mOffline = null;<NEW_LINE>try (Cursor cursor = db.rawQuery(selectQuery, null)) {<NEW_LINE>if (cursor != null && cursor.moveToFirst()) {<NEW_LINE>do {<NEW_LINE>int _id = Integer.parseInt(cursor.getString(0));<NEW_LINE>String _handle = decrypt(cursor.getString(1));<NEW_LINE>String _path = decrypt(cursor.getString(2));<NEW_LINE>String _name = decrypt(cursor.getString(3));<NEW_LINE>int _parent = cursor.getInt(4);<NEW_LINE>String _type = decrypt(cursor.getString(5));<NEW_LINE>int _incoming = cursor.getInt(6);<NEW_LINE>String _handleIncoming = decrypt(cursor.getString(7));<NEW_LINE>mOffline = new MegaOffline(_id, _handle, _path, _name, _parent, _type, _incoming, _handleIncoming);<NEW_LINE>} <MASK><NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>logError("Exception opening or managing DB cursor", e);<NEW_LINE>}<NEW_LINE>return mOffline;<NEW_LINE>} | while (cursor.moveToNext()); |
1,279,727 | public void applyInline(double[] data, int off, int len) {<NEW_LINE>assert off == 0;<NEW_LINE>assert len == data.length;<NEW_LINE>// Compute LPC coefficients and residual<NEW_LINE>LpCoeffs coeffs = <MASK><NEW_LINE>// double gain = coeffs.getGain();<NEW_LINE>double[] residual = ArrayUtils.subarray(new FIRFilter(coeffs.getOneMinusA()).apply(data), 0, len);<NEW_LINE>// Do something fancy with the lpc coefficients and/or the residual<NEW_LINE>processLPC(coeffs, residual);<NEW_LINE>// Resynthesise audio from residual and LPC coefficients<NEW_LINE>double[] newData = new RecursiveFilter(coeffs.getA()).apply(residual);<NEW_LINE>// System.err.println("Sum squared error:"+MathUtils.sumSquaredError(data, newData));<NEW_LINE>System.arraycopy(newData, 0, data, 0, len);<NEW_LINE>} | LpcAnalyser.calcLPC(data, p); |
603,906 | public void exitExtended_access_list_tail(Extended_access_list_tailContext ctx) {<NEW_LINE>LineAction action = toLineAction(ctx.ala);<NEW_LINE>AccessListAddressSpecifier srcAddressSpecifier = toAccessListAddressSpecifier(ctx.srcipr);<NEW_LINE>AccessListAddressSpecifier dstAddressSpecifier = toAccessListAddressSpecifier(ctx.dstipr);<NEW_LINE>AccessListServiceSpecifier serviceSpecifier = computeExtendedAccessListServiceSpecifier(ctx);<NEW_LINE>String name = getFullText(ctx).trim();<NEW_LINE>// reference tracking<NEW_LINE>{<NEW_LINE>int configLine = ctx.getStart().getLine();<NEW_LINE>String qualifiedName = aclLineName(_currentIpv4Acl.getName(), name);<NEW_LINE>_configuration.defineSingleLineStructure(IPV4_ACCESS_LIST_LINE, qualifiedName, configLine);<NEW_LINE>_configuration.referenceStructure(IPV4_ACCESS_LIST_LINE, qualifiedName, IPV4_ACCESS_LIST_LINE_SELF_REF, configLine);<NEW_LINE>}<NEW_LINE>long seq = ctx.num != null ? toLong(ctx.<MASK><NEW_LINE>Ipv4AccessListLine line = _currentIpv4AclLine.setName(name).setSeq(seq).setAction(action).setSrcAddressSpecifier(srcAddressSpecifier).setDstAddressSpecifier(dstAddressSpecifier).setServiceSpecifier(serviceSpecifier).build();<NEW_LINE>if (line.getAction() != LineAction.PERMIT && line.getNexthop1() != null) {<NEW_LINE>warn(ctx, "ACL based forwarding can only be configured on an ACL line with a permit action");<NEW_LINE>} else {<NEW_LINE>_currentIpv4Acl.addLine(line);<NEW_LINE>}<NEW_LINE>_currentIpv4AclLine = null;<NEW_LINE>} | num) : _currentIpv4Acl.getNextSeq(); |
138,678 | private void initInfo(int record_id, String value) {<NEW_LINE>if (!(record_id == 0) && value != null && value.length() > 0) {<NEW_LINE>log.severe("Received both a record_id and a value: " + record_id + " - " + value);<NEW_LINE>}<NEW_LINE>// Set values<NEW_LINE>if (// A record is defined<NEW_LINE>!(record_id == 0)) {<NEW_LINE>fieldID = record_id;<NEW_LINE>String trxName = Trx.createTrxName();<NEW_LINE>MPayment p = new MPayment(Env.getCtx(), record_id, trxName);<NEW_LINE>fCheckReceipt.setSelected(p.isReceipt());<NEW_LINE>fCheckPayment.setSelected(!p.isReceipt());<NEW_LINE>p = null;<NEW_LINE>Trx.get(trxName, false).close();<NEW_LINE>} else // Try to find other criteria in the context<NEW_LINE>{<NEW_LINE>String id;<NEW_LINE>// C_BPartner_ID<NEW_LINE>id = Env.getContext(Env.getCtx(), p_WindowNo, p_TabNo, "C_BPartner_ID", true);<NEW_LINE>if (id != null && id.length() != 0 && (new Integer(id).intValue() > 0))<NEW_LINE>fBPartner_ID.setValue(new Integer(id));<NEW_LINE>// The value passed in from the field<NEW_LINE>if (value != null && value.length() > 0) {<NEW_LINE>fDocumentNo.setValue(value);<NEW_LINE>} else {<NEW_LINE>// C_Payment_ID<NEW_LINE>id = Env.getContext(Env.getCtx(), <MASK><NEW_LINE>if (id != null && id.length() != 0 && (new Integer(id).intValue() > 0)) {<NEW_LINE>fieldID = new Integer(id).intValue();<NEW_LINE>String trxName = Trx.createTrxName();<NEW_LINE>MPayment p = new MPayment(Env.getCtx(), record_id, trxName);<NEW_LINE>fCheckReceipt.setSelected(p.isReceipt());<NEW_LINE>fCheckPayment.setSelected(!p.isReceipt());<NEW_LINE>p = null;<NEW_LINE>Trx.get(trxName, false).close();<NEW_LINE>}<NEW_LINE>// C_BankAccount_ID<NEW_LINE>id = Env.getContext(Env.getCtx(), p_WindowNo, p_TabNo, "C_BankAccount_ID", true);<NEW_LINE>if (id != null && id.length() != 0 && (new Integer(id).intValue() > 0))<NEW_LINE>fBankAccount_ID.setValue(new Integer(id));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | p_WindowNo, p_TabNo, "C_Payment_ID", true); |
370,753 | private Node createHistoryView(History history) {<NEW_LINE>byte[] data = history.peek();<NEW_LINE>boolean isClass = ClassUtil.isClass(data);<NEW_LINE>String type = isClass ? "class" : "file";<NEW_LINE>BorderPane pane = new BorderPane();<NEW_LINE>// Content<NEW_LINE>int count = history.size() - 1;<NEW_LINE>String sub = count > 0 ? "[" + count + " states]" : "[Initial state]";<NEW_LINE>BorderPane display = new BorderPane();<NEW_LINE>display.setTop(new SubLabeled(history.name, sub));<NEW_LINE>display.setCenter(new VBox(new TextArea("Last updated: " + history.getMostRecentUpdate() + "\n" + "Content length: " + data.length + "\n" + "Content hash (MD5): " + DigestUtils.md5Hex(data) + "\n" + "Content hash (SHA1): " + DigestUtils.sha1Hex(data) + "\n" + "Content hash (SHA256): " + DigestUtils<MASK><NEW_LINE>display.getCenter().getStyleClass().add("hist-data");<NEW_LINE>pane.setCenter(display);<NEW_LINE>// Buttons<NEW_LINE>HBox horizontal = new HBox();<NEW_LINE>horizontal.getStyleClass().add("hist-buttons");<NEW_LINE>horizontal.getChildren().addAll(new ActionButton(LangUtil.translate("ui.history.pop"), () -> {<NEW_LINE>pop(history, isClass);<NEW_LINE>// Update content sub-text<NEW_LINE>int updatedCount = history.size() - 1;<NEW_LINE>String updatedSub = updatedCount > 0 ? "[" + updatedCount + " states]" : "[Initial state]";<NEW_LINE>display.setTop(new SubLabeled(history.name, updatedSub));<NEW_LINE>// Update content data<NEW_LINE>byte[] updatedData = history.peek();<NEW_LINE>display.setCenter(new VBox(new Label("Last updated: " + history.getMostRecentUpdate()), new Label("Content length: " + updatedData.length), new Label("Content hash (MD5): " + DigestUtils.md5Hex(updatedData)), new Label("Content hash (SHA1): " + DigestUtils.sha1Hex(updatedData))));<NEW_LINE>display.getCenter().getStyleClass().add("monospaced");<NEW_LINE>}), new ActionButton(LangUtil.translate("ui.history.open." + type), () -> open(history, isClass)));<NEW_LINE>pane.setBottom(horizontal);<NEW_LINE>return pane;<NEW_LINE>} | .sha256Hex(data)))); |
346,103 | public static void main(String[] args) throws IOException {<NEW_LINE>List<PainlessContextInfo> contexts = ContextGeneratorCommon.getContextInfos();<NEW_LINE>Path rootDir = resetRootDir();<NEW_LINE>ContextGeneratorCommon.PainlessInfos infos;<NEW_LINE>JavaClassFilesystemResolver jdksrc = getJdkSrc();<NEW_LINE>if (jdksrc != null) {<NEW_LINE>infos = new ContextGeneratorCommon.PainlessInfos(contexts, new JavadocExtractor(jdksrc));<NEW_LINE>} else {<NEW_LINE>infos = new ContextGeneratorCommon.PainlessInfos(contexts);<NEW_LINE>}<NEW_LINE>Path json = rootDir.resolve("painless-common.json");<NEW_LINE>try (PrintStream jsonStream = new PrintStream(Files.newOutputStream(json, StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE), false, StandardCharsets.UTF_8.name())) {<NEW_LINE>XContentBuilder builder = XContentFactory.jsonBuilder(jsonStream);<NEW_LINE>builder.startObject();<NEW_LINE>builder.field(PainlessContextInfo.CLASSES.getPreferredName(), infos.common);<NEW_LINE>builder.endObject();<NEW_LINE>builder.flush();<NEW_LINE>}<NEW_LINE>for (PainlessInfoJson.Context context : infos.contexts) {<NEW_LINE>json = rootDir.resolve("painless-" + context.getName() + ".json");<NEW_LINE>try (PrintStream jsonStream = new PrintStream(Files.newOutputStream(json, StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE), false, StandardCharsets.UTF_8.name())) {<NEW_LINE>XContentBuilder <MASK><NEW_LINE>context.toXContent(builder, null);<NEW_LINE>builder.flush();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | builder = XContentFactory.jsonBuilder(jsonStream); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.