idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,363,233 | public double volatilityBetaNonZero(double forward, double strike, double timeToExpiry, double alpha, double beta, double rho, double nu) {<NEW_LINE>ArgChecker.isTrue(forward > 0.0d, "forward must be positive");<NEW_LINE>ArgChecker.isTrue(strike > 0.0d, "strike must be positive");<NEW_LINE>ArgChecker.isTrue(<MASK><NEW_LINE>ArgChecker.isTrue(rho > -1.0d + RHO_EPS, "rho must be above -1 and not too close to -1");<NEW_LINE>double logfK = Math.log(forward / strike);<NEW_LINE>double logfK2 = logfK * logfK;<NEW_LINE>double logfK4 = logfK2 * logfK2;<NEW_LINE>double fK = forward * strike;<NEW_LINE>double oneminusbeta = 1.0 - beta;<NEW_LINE>double fKoneminusbeta = Math.pow(fK, oneminusbeta);<NEW_LINE>double oneminusbeta2 = oneminusbeta * oneminusbeta;<NEW_LINE>double oneminusbeta4 = oneminusbeta2 * oneminusbeta2;<NEW_LINE>double zeta = nu / alpha * Math.pow(fK, 0.5d * oneminusbeta) * logfK;<NEW_LINE>double term1 = alpha * Math.pow(fK, 0.5 * beta);<NEW_LINE>double term2 = (1.0d + logfK2 / 24.0d + logfK4 / 1920.0d) / (1.0d + oneminusbeta2 * logfK2 / 24.0d + oneminusbeta4 * logfK4 / 1920.0d);<NEW_LINE>double term3 = zetaOverXhat(zeta, rho);<NEW_LINE>double term4 = 1.0d + (-beta * (2.0d - beta) * alpha * alpha / (24.0d * fKoneminusbeta) + rho * alpha * nu * beta / (4.0d * Math.sqrt(fKoneminusbeta)) + (2.0d - 3.0 * rho * rho) / 24.0d * nu * nu) * timeToExpiry;<NEW_LINE>return term1 * term2 * term3 * term4;<NEW_LINE>} | rho < 1.0d - RHO_EPS, "rho must be below 1 and not too close to 1"); |
368,098 | // </editor-fold>//GEN-END:initComponents<NEW_LINE>private void btnBrowseActionPerformed(java.awt.event.ActionEvent evt) {<NEW_LINE>// GEN-FIRST:event_btnBrowseActionPerformed<NEW_LINE>File oldFile = new File(tfRootPath.getText());<NEW_LINE>// NOI18N<NEW_LINE>JFileChooser fileChooser = new AccessibleJFileChooser(NbBundle.getMessage(CreatePanel.class, "ACSD_BrowseFolder"), oldFile);<NEW_LINE>// NOI18N<NEW_LINE>fileChooser.setDialogTitle(NbBundle.getMessage(CreatePanel.class, "Browse_title"));<NEW_LINE>fileChooser.setMultiSelectionEnabled(false);<NEW_LINE>FileFilter[] old = fileChooser.getChoosableFileFilters();<NEW_LINE>for (int i = 0; i < old.length; i++) {<NEW_LINE>FileFilter fileFilter = old[i];<NEW_LINE>fileChooser.removeChoosableFileFilter(fileFilter);<NEW_LINE>}<NEW_LINE>fileChooser.addChoosableFileFilter(new FileFilter() {<NEW_LINE><NEW_LINE>public boolean accept(File f) {<NEW_LINE>return f.isDirectory();<NEW_LINE>}<NEW_LINE><NEW_LINE>public String getDescription() {<NEW_LINE>// NOI18N<NEW_LINE>return NbBundle.getMessage(CreatePanel.class, "Folders");<NEW_LINE>}<NEW_LINE>});<NEW_LINE>fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);<NEW_LINE>// NOI18N<NEW_LINE>fileChooser.showDialog(this, NbBundle.getMessage<MASK><NEW_LINE>File f = fileChooser.getSelectedFile();<NEW_LINE>if (f != null) {<NEW_LINE>tfRootPath.setText(f.getAbsolutePath());<NEW_LINE>}<NEW_LINE>} | (CreatePanel.class, "OK_Button")); |
512,428 | public MetricDimension unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>MetricDimension metricDimension = new MetricDimension();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><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("Name", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>metricDimension.setName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("Value", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>metricDimension.setValue(context.getUnmarshaller(String.class).unmarshall(context));<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 metricDimension;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
325,877 | private void promptForMultipleChoicePlay(int page, int startSura, int startAyah, List<Integer> startingSuraList) {<NEW_LINE>ArrayAdapter<String> adapter = new ArrayAdapter<>(this, <MASK><NEW_LINE>for (Integer integer : startingSuraList) {<NEW_LINE>String suraName = quranDisplayData.getSuraName(this, integer, false);<NEW_LINE>adapter.add(suraName);<NEW_LINE>}<NEW_LINE>if (startSura != startingSuraList.get(0)) {<NEW_LINE>adapter.insert(getString(R.string.starting_page_label), 0);<NEW_LINE>startingSuraList.add(0, startSura);<NEW_LINE>}<NEW_LINE>AlertDialog.Builder builder = new AlertDialog.Builder(this).setTitle(getString(R.string.playback_prompt_title)).setAdapter(adapter, (dialog, i) -> {<NEW_LINE>if (i == 0) {<NEW_LINE>playFromAyah(page, startSura, startAyah);<NEW_LINE>} else {<NEW_LINE>playFromAyah(page, startingSuraList.get(i), 1);<NEW_LINE>}<NEW_LINE>dialog.dismiss();<NEW_LINE>promptDialog = null;<NEW_LINE>});<NEW_LINE>promptDialog = builder.create();<NEW_LINE>promptDialog.show();<NEW_LINE>} | android.R.layout.select_dialog_item); |
1,568,122 | private void upload(Set<TransferFile> forUpload, FileObject sources, FileObject[] filesToUpload, InputOutput remoteLog, RemoteClient remoteClient) {<NEW_LINE>TransferInfo transferInfo = null;<NEW_LINE>try {<NEW_LINE>if (forUpload.size() > 0) {<NEW_LINE>final boolean askSync = !remoteClient.listFiles(getRemoteRoot(remoteClient, sources)).isEmpty();<NEW_LINE>ProgressHandle progressHandle = ProgressHandle.createHandle(NbBundle.getMessage(UploadCommand.class, "MSG_UploadingFiles", getProject().getName()), remoteClient);<NEW_LINE>DefaultOperationMonitor uploadOperationMonitor = new DefaultOperationMonitor(progressHandle, forUpload);<NEW_LINE>remoteClient.setOperationMonitor(uploadOperationMonitor);<NEW_LINE>transferInfo = remoteClient.upload(forUpload);<NEW_LINE>remoteClient.setOperationMonitor(null);<NEW_LINE>StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(UploadCommand.class, "MSG_UploadFinished", getProject<MASK><NEW_LINE>if (isSourcesSelected(sources, filesToUpload) && !remoteClient.isCancelled() && transferInfo.hasAnyTransfered()) {<NEW_LINE>// #153406<NEW_LINE>PhpProject project = getProject();<NEW_LINE>storeLastUpload(project);<NEW_LINE>storeLastSync(project, remoteClient, sources, askSync);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (RemoteException ex) {<NEW_LINE>RemoteUtils.processRemoteException(ex);<NEW_LINE>} finally {<NEW_LINE>try {<NEW_LINE>remoteClient.disconnect(true);<NEW_LINE>} catch (RemoteException ex) {<NEW_LINE>RemoteUtils.processRemoteException(ex);<NEW_LINE>}<NEW_LINE>if (transferInfo != null) {<NEW_LINE>processTransferInfo(transferInfo, remoteLog);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ().getName())); |
1,515,439 | private void syncForPolarDbX() {<NEW_LINE>synchronized (OptimizerContext.getContext(schemaName)) {<NEW_LINE>GmsTableMetaManager oldSchemaManager = (GmsTableMetaManager) OptimizerContext.getContext(schemaName).getLatestSchemaManager();<NEW_LINE>TableMeta currentMeta = oldSchemaManager.getTableWithNull(primaryTableName);<NEW_LINE>// Lock and unlock MDL on primary table to clear cross status transaction.<NEW_LINE>final MdlContext context = MdlManager.addContext(schemaName, false);<NEW_LINE>SQLRecorderLogger.ddlLogger.warn(MessageFormat.format("{0} {1}.addContext({2})", Thread.currentThread().getName(), this.hashCode(), schemaName));<NEW_LINE>try {<NEW_LINE>final MdlTicket ticket;<NEW_LINE>ticket = context.acquireLock(new MdlRequest(1L, MdlKey.getTableKeyWithLowerTableName(schemaName, currentMeta.getDigest()), MdlType.MDL_EXCLUSIVE, MdlDuration.MDL_TRANSACTION));<NEW_LINE>if (primaryTableName != null) {<NEW_LINE>oldSchemaManager.tonewversion(primaryTableName);<NEW_LINE>if (testMode) {<NEW_LINE>clearShadowTablePlanCache();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>SQLRecorderLogger.ddlLogger.warn(MessageFormat.format("[Mdl write lock acquired table[{0}]]", primaryTableName));<NEW_LINE><MASK><NEW_LINE>// There should be no transaction on tmp table<NEW_LINE>if (tmpPrimaryTableName != null) {<NEW_LINE>oldSchemaManager.tonewversion(tmpPrimaryTableName);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>context.releaseAllTransactionalLocks();<NEW_LINE>MdlManager.removeContext(context);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | context.releaseLock(1L, ticket); |
1,577,706 | @Produces(APPLICATION_JSON)<NEW_LINE>@Path("/{subscriptionName}/retransmission")<NEW_LINE>@RolesAllowed({ Roles.ADMIN, Roles.TOPIC_OWNER, Roles.SUBSCRIPTION_OWNER })<NEW_LINE>@ApiOperation(value = "Update subscription offset", httpMethod = HttpMethod.PUT)<NEW_LINE>public Response retransmit(@PathParam("topicName") String qualifiedTopicName, @PathParam("subscriptionName") String subscriptionName, @DefaultValue("false") @QueryParam("dryRun") boolean dryRun, @Valid OffsetRetransmissionDate offsetRetransmissionDate, @Context SecurityContext securityContext) {<NEW_LINE>MultiDCOffsetChangeSummary summary = multiDCAwareService.moveOffset(topicService.getTopicDetails(TopicName.fromQualifiedName(qualifiedTopicName)), subscriptionName, offsetRetransmissionDate.getRetransmissionDate().toInstant().toEpochMilli(), dryRun<MASK><NEW_LINE>return Response.status(OK).entity(summary).build();<NEW_LINE>} | , RequestUser.fromSecurityContext(securityContext)); |
539,460 | final GetDocumentResult executeGetDocument(GetDocumentRequest getDocumentRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getDocumentRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetDocumentRequest> request = null;<NEW_LINE>Response<GetDocumentResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetDocumentRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getDocumentRequest));<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(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SSM");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetDocument");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetDocumentResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetDocumentResultJsonUnmarshaller());<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>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
1,133,929 | private // to a corresponding instance node with path /{cluster}/instances/{hostname}-{sequenceNumber}<NEW_LINE>String createLiveInstanceNode() {<NEW_LINE>// make sure the live instance path exists<NEW_LINE>_zkclient.ensurePath(KeyBuilder.liveInstances(_cluster));<NEW_LINE>// default name in case of UnknownHostException<NEW_LINE>_hostname = "UnknownHost-" + randomGenerator.nextInt(10000);<NEW_LINE>try {<NEW_LINE>_hostname = InetAddress.getLocalHost().getHostName();<NEW_LINE>} catch (UnknownHostException uhe) {<NEW_LINE>LOG.error(uhe.getMessage());<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// create an ephemeral sequential node under /{cluster}/liveinstances for leader election<NEW_LINE>//<NEW_LINE>String electionPath = KeyBuilder.liveInstance(_cluster, "");<NEW_LINE>LOG.info("Creating ephemeral node on path: {}", electionPath);<NEW_LINE>String liveInstancePath = _zkclient.create(electionPath, _hostname, CreateMode.EPHEMERAL_SEQUENTIAL);<NEW_LINE>_liveInstanceName = liveInstancePath.substring(electionPath.length());<NEW_LINE><MASK><NEW_LINE>//<NEW_LINE>// create instance node /{cluster}/instance/{instanceName} for keeping instance<NEW_LINE>// states, including instance assignments and errors<NEW_LINE>//<NEW_LINE>String instanceName = formatZkInstance(_hostname, _liveInstanceName);<NEW_LINE>_zkclient.ensurePath(KeyBuilder.instance(_cluster, instanceName));<NEW_LINE>_zkclient.ensurePath(KeyBuilder.instanceAssignments(_cluster, instanceName));<NEW_LINE>_zkclient.ensurePath(KeyBuilder.instanceErrors(_cluster, instanceName));<NEW_LINE>return formatZkInstance(_hostname, _liveInstanceName);<NEW_LINE>} | LOG.info("Getting live instance name as: {}", _liveInstanceName); |
1,438,255 | private void initializeFiles() {<NEW_LINE>File file;<NEW_LINE>while ((file = getFileToInitialize()) != null) {<NEW_LINE>// NOI18N<NEW_LINE>Git.STATUS_LOG.log(Level.FINEST, "GitFolderEventsHandler.initializeFiles: {0}", file.getAbsolutePath());<NEW_LINE>// select repository root for the file and finds it's .git folder<NEW_LINE>File repositoryRoot = Git.getInstance().getRepositoryRoot(file);<NEW_LINE>if (repositoryRoot != null) {<NEW_LINE>if (addSeenRoot(repositoryRoot, file)) {<NEW_LINE>// this means the repository has not yet been scanned, so scan it<NEW_LINE>// NOI18N<NEW_LINE>Git.STATUS_LOG.log(Level.FINE, "initializeFiles: planning a scan for {0} - {1}", new Object[] { repositoryRoot.getAbsolutePath(), file.getAbsolutePath() });<NEW_LINE>reScheduleRefresh(4000, Collections.singleton(file), false);<NEW_LINE>File gitFolder = GitUtils.getGitFolderForRoot(repositoryRoot);<NEW_LINE>boolean refreshNeeded = false;<NEW_LINE>synchronized (timestamps) {<NEW_LINE>if (!timestamps.containsKey(gitFolder)) {<NEW_LINE>File metadataFolder = translateToMetadataFolder(gitFolder);<NEW_LINE>if (new File(metadataFolder, INDEX_FILE_NAME).canRead()) {<NEW_LINE>timestamps.put(gitFolder, null);<NEW_LINE>refreshNeeded = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (refreshNeeded) {<NEW_LINE>refreshIndexFileTimestamp(scanGitFolderTimestamps(gitFolder));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>Git.STATUS_LOG.<MASK><NEW_LINE>} | log(Level.FINEST, "GitFolderEventsHandler.initializeFiles: finished"); |
1,723,167 | private static void writeGraph(final servletProperties prop, final HyperlinkGraph hlg, final int maxdepth) {<NEW_LINE>int c = 0;<NEW_LINE>for (HyperlinkEdge e : hlg) {<NEW_LINE>prop.putJSON("edges_" + c + "_source", e.source.getPath());<NEW_LINE>prop.putJSON("edges_" + c + "_target", e.target.type.equals(HyperlinkType.Outbound) ? e.target.toNormalform(true) : e.target.getPath());<NEW_LINE>prop.putJSON("edges_" + c + "_type", e.target.type.name());<NEW_LINE>Integer depth_source = hlg.getDepth(e.source);<NEW_LINE>Integer depth_target = <MASK><NEW_LINE>prop.put("edges_" + c + "_depthSource", depth_source == null ? -1 : depth_source.intValue());<NEW_LINE>prop.put("edges_" + c + "_depthTarget", depth_target == null ? -1 : depth_target.intValue());<NEW_LINE>c++;<NEW_LINE>}<NEW_LINE>prop.put("edges", c);<NEW_LINE>prop.put("maxdepth", maxdepth);<NEW_LINE>} | hlg.getDepth(e.target); |
1,609,486 | protected void onCreate(Bundle savedInstanceState) {<NEW_LINE>setTheme(android.R.style.Theme_Translucent_NoTitleBar);<NEW_LINE>Window window = getWindow();<NEW_LINE>WindowManager.LayoutParams params = window.getAttributes();<NEW_LINE>params.flags &= ~WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;<NEW_LINE>params.flags |= WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;<NEW_LINE>if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {<NEW_LINE>params.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;<NEW_LINE>}<NEW_LINE>window.setAttributes(params);<NEW_LINE>window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);<NEW_LINE>window.setElevation(0);<NEW_LINE>window.setStatusBarColor(Color.TRANSPARENT);<NEW_LINE>window.setBackgroundDrawable(null);<NEW_LINE><MASK><NEW_LINE>int option = decorView.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;<NEW_LINE>decorView.setSystemUiVisibility(option);<NEW_LINE>window.setStatusBarColor(Color.TRANSPARENT);<NEW_LINE>window.setNavigationBarColor(Color.TRANSPARENT);<NEW_LINE>requestWindowFeature(android.view.Window.FEATURE_NO_TITLE);<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>} | View decorView = window.getDecorView(); |
1,358,281 | public static void main(String[] args) throws Exception {<NEW_LINE>final ConfigBuilder configBuilder = new ConfigBuilder();<NEW_LINE>configBuilder.withWatchReconnectInterval(500);<NEW_LINE>configBuilder.withWatchReconnectLimit(5);<NEW_LINE>try (KubernetesClient client = new KubernetesClientBuilder().withConfig(configBuilder.build()).build()) {<NEW_LINE>String namespace = "default";<NEW_LINE>CustomResourceDefinition prometheousRuleCrd = client.apiextensions().v1beta1().customResourceDefinitions().load(GenericKubernetesResourceExample.class.getResourceAsStream("/prometheous-rule-crd.yml")).get();<NEW_LINE>client.apiextensions().v1beta1().<MASK><NEW_LINE>logger.info("Successfully created Prometheous custom resource definition");<NEW_LINE>// Creating Custom Resources Now:<NEW_LINE>ResourceDefinitionContext crdContext = CustomResourceDefinitionContext.fromCrd(prometheousRuleCrd);<NEW_LINE>client.load(GenericKubernetesResourceExample.class.getResourceAsStream("/prometheous-rule-cr.yml")).inNamespace(namespace).createOrReplace();<NEW_LINE>logger.info("Created Custom Resource successfully too");<NEW_LINE>// Listing all custom resources in given namespace:<NEW_LINE>NonNamespaceOperation<GenericKubernetesResource, GenericKubernetesResourceList, Resource<GenericKubernetesResource>> resourcesInNamespace = client.genericKubernetesResources(crdContext).inNamespace(namespace);<NEW_LINE>GenericKubernetesResourceList list = resourcesInNamespace.list();<NEW_LINE>List<GenericKubernetesResource> items = list.getItems();<NEW_LINE>logger.info("Custom Resources :- ");<NEW_LINE>for (GenericKubernetesResource customResource : items) {<NEW_LINE>ObjectMeta metadata = customResource.getMetadata();<NEW_LINE>final String name = metadata.getName();<NEW_LINE>logger.info(name);<NEW_LINE>}<NEW_LINE>// Watching custom resources now<NEW_LINE>logger.info("Watching custom resources now");<NEW_LINE>final CountDownLatch closeLatch = new CountDownLatch(1);<NEW_LINE>resourcesInNamespace.watch(new Watcher<GenericKubernetesResource>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void eventReceived(Action action, GenericKubernetesResource resource) {<NEW_LINE>logger.info("{}: {}", action, resource);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClose(WatcherException e) {<NEW_LINE>logger.debug("Watcher onClose");<NEW_LINE>closeLatch.countDown();<NEW_LINE>if (e != null) {<NEW_LINE>logger.error(e.getMessage(), e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>closeLatch.await(10, TimeUnit.MINUTES);<NEW_LINE>// Cleanup<NEW_LINE>logger.info("Deleting custom resources...");<NEW_LINE>resourcesInNamespace.withName("prometheus-example-rules").delete();<NEW_LINE>client.apiextensions().v1beta1().customResourceDefinitions().withName(prometheousRuleCrd.getMetadata().getName()).delete();<NEW_LINE>} catch (KubernetesClientException e) {<NEW_LINE>logger.error("Could not create resource: {}", e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | customResourceDefinitions().createOrReplace(prometheousRuleCrd); |
977,594 | public void appendColumns(final int count) {<NEW_LINE>// add the headers<NEW_LINE>final String[] newHeaders = new String[getHeaderCount() + count];<NEW_LINE>System.arraycopy(this.headers, 0, newHeaders, 0, getHeaderCount());<NEW_LINE>for (int i = 0; i < count; i++) {<NEW_LINE>newHeaders[i + getHeaderCount()] = "new";<NEW_LINE>}<NEW_LINE>this.headers = newHeaders;<NEW_LINE>// add the data<NEW_LINE>for (int rowIndex = 0; rowIndex < size(); rowIndex++) {<NEW_LINE>final Object[] originalRow = <MASK><NEW_LINE>final Object[] newRow = new Object[getHeaderCount()];<NEW_LINE>System.arraycopy(originalRow, 0, newRow, 0, originalRow.length);<NEW_LINE>for (int i = 0; i < count; i++) {<NEW_LINE>newRow[getHeaderCount() - 1 - i] = (double) 0;<NEW_LINE>}<NEW_LINE>this.data.remove(rowIndex);<NEW_LINE>this.data.add(rowIndex, newRow);<NEW_LINE>}<NEW_LINE>} | this.data.get(rowIndex); |
925,082 | static String asString(Object stringObject) {<NEW_LINE>checkNotNull(stringObject, "stringObject");<NEW_LINE>Instance instance = (Instance) stringObject;<NEW_LINE>List<ClassInstance.FieldValue> values = classInstanceValues(instance);<NEW_LINE>Integer count = fieldValue(values, "count");<NEW_LINE>checkNotNull(count, "count");<NEW_LINE>if (count == 0) {<NEW_LINE>return "";<NEW_LINE>}<NEW_LINE>Object value = fieldValue(values, "value");<NEW_LINE>checkNotNull(value, "value");<NEW_LINE>Integer offset;<NEW_LINE>ArrayInstance array;<NEW_LINE>if (isCharArray(value)) {<NEW_LINE>array = (ArrayInstance) value;<NEW_LINE>offset = 0;<NEW_LINE>// < API 23<NEW_LINE>// As of Marshmallow, substrings no longer share their parent strings' char arrays<NEW_LINE>// eliminating the need for String.offset<NEW_LINE>// https://android-review.googlesource.com/#/c/83611/<NEW_LINE>if (hasField(values, "offset")) {<NEW_LINE><MASK><NEW_LINE>checkNotNull(offset, "offset");<NEW_LINE>}<NEW_LINE>char[] chars = array.asCharArray(offset, count);<NEW_LINE>return new String(chars);<NEW_LINE>} else if (isByteArray(value)) {<NEW_LINE>// In API 26, Strings are now internally represented as byte arrays.<NEW_LINE>array = (ArrayInstance) value;<NEW_LINE>// HACK - remove when HAHA's perflib is updated to https://goo.gl/Oe7ZwO.<NEW_LINE>try {<NEW_LINE>Method asRawByteArray = ArrayInstance.class.getDeclaredMethod("asRawByteArray", int.class, int.class);<NEW_LINE>asRawByteArray.setAccessible(true);<NEW_LINE>byte[] rawByteArray = (byte[]) asRawByteArray.invoke(array, 0, count);<NEW_LINE>return new String(rawByteArray, Charset.forName("UTF-8"));<NEW_LINE>} catch (NoSuchMethodException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>} catch (IllegalAccessException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>} catch (InvocationTargetException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new UnsupportedOperationException("Could not find char array in " + instance);<NEW_LINE>}<NEW_LINE>} | offset = fieldValue(values, "offset"); |
1,332,948 | public static boolean addressIsAllowedToProduceNextBlock(final Address candidate, final ProtocolContext protocolContext, final BlockHeader parent) {<NEW_LINE>final ValidatorProvider validatorProvider = protocolContext.getConsensusContext(CliqueContext.class).getValidatorProvider();<NEW_LINE>if (!isSigner(candidate, protocolContext, parent)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>final int minimumUnsignedPastBlocks = minimumBlocksSincePreviousSigning(parent, validatorProvider);<NEW_LINE>final Blockchain blockchain = protocolContext.getBlockchain();<NEW_LINE>int unsignedBlockCount = 0;<NEW_LINE>BlockHeader localParent = parent;<NEW_LINE>while (unsignedBlockCount < minimumUnsignedPastBlocks) {<NEW_LINE>if (localParent.getNumber() == 0) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>final Address parentSigner = CliqueHelpers.getProposerOfBlock(localParent);<NEW_LINE>if (parentSigner.equals(candidate)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>unsignedBlockCount++;<NEW_LINE>localParent = blockchain.getBlockHeader(localParent.getParentHash()).orElseThrow((<MASK><NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | ) -> new IllegalStateException("The block was on a orphaned chain.")); |
944,986 | static Bitmap decodeStream(InputStream stream, Request request) throws IOException {<NEW_LINE>MarkableInputStream markStream = new MarkableInputStream(stream);<NEW_LINE>stream = markStream;<NEW_LINE>// TODO fix this crap.<NEW_LINE>long mark = markStream.savePosition(65536);<NEW_LINE>final BitmapFactory.Options <MASK><NEW_LINE>final boolean calculateSize = RequestHandler.requiresInSampleSize(options);<NEW_LINE>boolean isWebPFile = Utils.isWebPFile(stream);<NEW_LINE>markStream.reset(mark);<NEW_LINE>// When decode WebP network stream, BitmapFactory throw JNI Exception and make app crash.<NEW_LINE>// Decode byte array instead<NEW_LINE>if (isWebPFile) {<NEW_LINE>byte[] bytes = Utils.toByteArray(stream);<NEW_LINE>if (calculateSize) {<NEW_LINE>BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options);<NEW_LINE>RequestHandler.calculateInSampleSize(request.targetWidth, request.targetHeight, options, request);<NEW_LINE>}<NEW_LINE>return BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options);<NEW_LINE>} else {<NEW_LINE>if (calculateSize) {<NEW_LINE>BitmapFactory.decodeStream(stream, null, options);<NEW_LINE>RequestHandler.calculateInSampleSize(request.targetWidth, request.targetHeight, options, request);<NEW_LINE>markStream.reset(mark);<NEW_LINE>}<NEW_LINE>Bitmap bitmap = BitmapFactory.decodeStream(stream, null, options);<NEW_LINE>if (bitmap == null) {<NEW_LINE>// Treat null as an IO exception, we will eventually retry.<NEW_LINE>throw new IOException("Failed to decode stream.");<NEW_LINE>}<NEW_LINE>return bitmap;<NEW_LINE>}<NEW_LINE>} | options = RequestHandler.createBitmapOptions(request); |
143,830 | public void marshall(AudioDescription audioDescription, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (audioDescription == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(audioDescription.getAudioChannelTaggingSettings(), AUDIOCHANNELTAGGINGSETTINGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(audioDescription.getAudioNormalizationSettings(), AUDIONORMALIZATIONSETTINGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(audioDescription.getAudioSourceName(), AUDIOSOURCENAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(audioDescription.getAudioType(), AUDIOTYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(audioDescription.getAudioTypeControl(), AUDIOTYPECONTROL_BINDING);<NEW_LINE>protocolMarshaller.marshall(audioDescription.getCodecSettings(), CODECSETTINGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(audioDescription.getLanguageCode(), LANGUAGECODE_BINDING);<NEW_LINE>protocolMarshaller.marshall(audioDescription.getLanguageCodeControl(), LANGUAGECODECONTROL_BINDING);<NEW_LINE>protocolMarshaller.marshall(audioDescription.getRemixSettings(), REMIXSETTINGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(audioDescription.getStreamName(), STREAMNAME_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | audioDescription.getCustomLanguageCode(), CUSTOMLANGUAGECODE_BINDING); |
1,321,478 | public void visit(FileVisitor visitor) {<NEW_LINE>File zipFile = fileProvider.get();<NEW_LINE>if (!zipFile.exists()) {<NEW_LINE>throw new InvalidUserDataException(format("Cannot expand %s as it does not exist.", getDisplayName()));<NEW_LINE>}<NEW_LINE>if (!zipFile.isFile()) {<NEW_LINE>throw new InvalidUserDataException(format("Cannot expand %s as it is not a file.", getDisplayName()));<NEW_LINE>}<NEW_LINE>AtomicBoolean stopFlag = new AtomicBoolean();<NEW_LINE>File expandedDir = getExpandedDir();<NEW_LINE>try (ZipFile zip = new ZipFile(zipFile)) {<NEW_LINE>// The iteration order of zip.getEntries() is based on the hash of the zip entry. This isn't much use<NEW_LINE>// to us. So, collect the entries in a map and iterate over them in alphabetical order.<NEW_LINE>Iterator<ZipEntry> sortedEntries = entriesSortedByName(zip);<NEW_LINE>while (!stopFlag.get() && sortedEntries.hasNext()) {<NEW_LINE><MASK><NEW_LINE>DetailsImpl details = new DetailsImpl(zipFile, expandedDir, entry, zip, stopFlag, chmod);<NEW_LINE>if (entry.isDirectory()) {<NEW_LINE>visitor.visitDir(details);<NEW_LINE>} else {<NEW_LINE>visitor.visitFile(details);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new GradleException(format("Could not expand %s.", getDisplayName()), e);<NEW_LINE>}<NEW_LINE>} | ZipEntry entry = sortedEntries.next(); |
1,599,299 | protected Outline parseOutline(final Element e, final boolean validate, final Locale locale) throws FeedException {<NEW_LINE>final Outline outline = super.<MASK><NEW_LINE>final Iterator<Attribute> iterator = outline.getAttributes().iterator();<NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>final Attribute attribute = iterator.next();<NEW_LINE>final String name = attribute.getName();<NEW_LINE>final String value = attribute.getValue();<NEW_LINE>if (Arrays.asList("created", "category").contains(name)) {<NEW_LINE>if ("created".equals(name)) {<NEW_LINE>outline.setCreated(DateParser.parseRFC822(value, locale));<NEW_LINE>} else if ("category".equals(name)) {<NEW_LINE>final List<String> categories = Arrays.asList(value.split(","));<NEW_LINE>outline.setCategories(categories);<NEW_LINE>}<NEW_LINE>// remove attribute after processing<NEW_LINE>iterator.remove();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return outline;<NEW_LINE>} | parseOutline(e, validate, locale); |
337,651 | // MInOut<NEW_LINE>private void copyAdditionalCols(final Object order) {<NEW_LINE>final IPOService poService = <MASK><NEW_LINE>poService.copyValue(order, this, I_M_InOut.COLUMNNAME_C_Incoterms_ID);<NEW_LINE>poService.copyValue(order, this, I_M_InOut.COLUMNNAME_IncotermLocation);<NEW_LINE>poService.copyValue(order, this, I_M_InOut.COLUMNNAME_DescriptionBottom);<NEW_LINE>poService.setValue(this, I_M_InOut.COLUMNNAME_BPartnerAddress, poService.getValue(order, de.metas.adempiere.model.I_C_Order.COLUMNNAME_BPartnerAddress));<NEW_LINE>poService.setValue(this, I_M_InOut.COLUMNNAME_IsUseBPartnerAddress, poService.getValue(order, de.metas.adempiere.model.I_C_Order.COLUMNNAME_IsUseBPartnerAddress));<NEW_LINE>} | Services.get(IPOService.class); |
1,231,128 | void dispatchOnExitedRangeIfNeeded(WorkingRangeStatusHandler statusHandler) {<NEW_LINE>if (mWorkingRanges == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (String key : mWorkingRanges.keySet()) {<NEW_LINE>final RangeTuple rangeTuple = Preconditions.checkNotNull(mWorkingRanges.get(key));<NEW_LINE>for (int i = 0, size = rangeTuple.mScopedComponentInfos.size(); i < size; i++) {<NEW_LINE>final ScopedComponentInfo scopedComponentInfo = rangeTuple.mScopedComponentInfos.get(i);<NEW_LINE>final ComponentContext scopedContext = scopedComponentInfo.getContext();<NEW_LINE>Component component = scopedComponentInfo.getComponent();<NEW_LINE>String globalKey = scopedContext.getGlobalKey();<NEW_LINE>if (statusHandler.isInRange(rangeTuple.mName, component, globalKey)) {<NEW_LINE>try {<NEW_LINE>component.<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>ComponentUtils.handle(scopedContext, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | dispatchOnExitedRange(scopedContext, rangeTuple.mName); |
1,276,585 | private Polygon bufferPolylinePath_(Polyline polyline, int ipath, boolean bfilter) {<NEW_LINE>assert (m_distance != 0);<NEW_LINE>generateCircleTemplate_();<NEW_LINE>MultiPath input_multi_path = polyline;<NEW_LINE>MultiPathImpl mp_impl = (MultiPathImpl) (input_multi_path._getImpl());<NEW_LINE>if (mp_impl.getPathSize(ipath) < 1)<NEW_LINE>return null;<NEW_LINE>if (isDegeneratePath_(mp_impl, ipath) && m_distance > 0) {<NEW_LINE>// if a path<NEW_LINE>// is<NEW_LINE>// degenerate<NEW_LINE>// (almost a<NEW_LINE>// point),<NEW_LINE>// then we<NEW_LINE>// can draw<NEW_LINE>// a circle<NEW_LINE>// instead<NEW_LINE>// of it as<NEW_LINE>// a buffer<NEW_LINE>// and<NEW_LINE>// nobody<NEW_LINE>// would<NEW_LINE>// notice :)<NEW_LINE>Point point = new Point();<NEW_LINE>mp_impl.getPointByVal(mp_impl.getPathStart(ipath), point);<NEW_LINE>Envelope2D env2D = new Envelope2D();<NEW_LINE><MASK><NEW_LINE>point.setXY(env2D.getCenter());<NEW_LINE>return (Polygon) (bufferPoint_(point));<NEW_LINE>}<NEW_LINE>Polyline result_polyline = new Polyline(polyline.getDescription());<NEW_LINE>MultiPathImpl result_mp = (MultiPathImpl) result_polyline._getImpl();<NEW_LINE>boolean b_closed = mp_impl.isClosedPathInXYPlane(ipath);<NEW_LINE>if (b_closed) {<NEW_LINE>bufferClosedPath_(input_multi_path, ipath, result_mp, bfilter, 1);<NEW_LINE>bufferClosedPath_(input_multi_path, ipath, result_mp, bfilter, -1);<NEW_LINE>} else {<NEW_LINE>Polyline tmpPoly = new Polyline(input_multi_path.getDescription());<NEW_LINE>tmpPoly.addPath(input_multi_path, ipath, false);<NEW_LINE>((MultiPathImpl) tmpPoly._getImpl()).addSegmentsFromPath((MultiPathImpl) input_multi_path._getImpl(), ipath, 0, input_multi_path.getSegmentCount(ipath), false);<NEW_LINE>bufferClosedPath_(tmpPoly, 0, result_mp, bfilter, 1);<NEW_LINE>}<NEW_LINE>return bufferCleanup_(result_polyline, false);<NEW_LINE>} | mp_impl.queryPathEnvelope2D(ipath, env2D); |
18,599 | public Long addImageAndMediaLegends(final WikidataItem wikidataItem, final String fileName, final Map<String, String> captions) {<NEW_LINE>final Snak_partial p18 = new Snak_partial("value", WikidataProperties.IMAGE.getPropertyName(), new ValueString(fileName.replace("File:", "")));<NEW_LINE>final List<Snak_partial> snaks = new ArrayList<>();<NEW_LINE>for (final Map.Entry<String, String> entry : captions.entrySet()) {<NEW_LINE>snaks.add(new Snak_partial("value", WikidataProperties.MEDIA_LEGENDS.getPropertyName(), new DataValue.MonoLingualText(new WikiBaseMonolingualTextValue(entry.getValue(), entry.getKey()))));<NEW_LINE>}<NEW_LINE>final String id = wikidataItem.getId() + "$" + UUID.randomUUID().toString();<NEW_LINE>final Statement_partial claim = new Statement_partial(p18, "statement", "normal", id, Collections.singletonMap(WikidataProperties.MEDIA_LEGENDS.getPropertyName(), snaks), Arrays.asList(WikidataProperties.MEDIA_LEGENDS.getPropertyName()));<NEW_LINE>return wikidataClient.setClaim(<MASK><NEW_LINE>} | claim, COMMONS_APP_TAG).blockingSingle(); |
49,521 | private void createSessions(SessionSettings settings, boolean continueInitOnError) throws ConfigError {<NEW_LINE>Map<SessionID, Session> <MASK><NEW_LINE>for (Iterator<SessionID> i = settings.sectionIterator(); i.hasNext(); ) {<NEW_LINE>SessionID sessionID = i.next();<NEW_LINE>try {<NEW_LINE>String connectionType = null;<NEW_LINE>if (settings.isSetting(sessionID, SessionFactory.SETTING_CONNECTION_TYPE)) {<NEW_LINE>connectionType = settings.getString(sessionID, SessionFactory.SETTING_CONNECTION_TYPE);<NEW_LINE>}<NEW_LINE>if (SessionFactory.ACCEPTOR_CONNECTION_TYPE.equals(connectionType)) {<NEW_LINE>boolean isTemplate = false;<NEW_LINE>if (settings.isSetting(sessionID, Acceptor.SETTING_ACCEPTOR_TEMPLATE)) {<NEW_LINE>try {<NEW_LINE>isTemplate = settings.getBool(sessionID, Acceptor.SETTING_ACCEPTOR_TEMPLATE);<NEW_LINE>} catch (FieldConvertError | ConfigError ex) {<NEW_LINE>// ignore and use default<NEW_LINE>}<NEW_LINE>}<NEW_LINE>setupSession(settings, sessionID, isTemplate, allSessions);<NEW_LINE>}<NEW_LINE>} catch (Throwable t) {<NEW_LINE>if (continueInitOnError) {<NEW_LINE>log.warn("error during session initialization for {}, continuing...", sessionID, t);<NEW_LINE>} else {<NEW_LINE>throw t instanceof ConfigError ? (ConfigError) t : new ConfigError("error during session initialization", t);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>setSessions(allSessions);<NEW_LINE>if (socketDescriptorForAddress.isEmpty()) {<NEW_LINE>throw new ConfigError("No acceptor sessions found in settings.");<NEW_LINE>}<NEW_LINE>} | allSessions = new HashMap<>(); |
1,476,640 | void start() throws IOException {<NEW_LINE>if (compactedLogFile != null && compactedLogFile.exists()) {<NEW_LINE>File dir = compactedLogFile.getParentFile();<NEW_LINE><MASK><NEW_LINE>// create a hard link "x.log" for file "x.log.y.compacted"<NEW_LINE>this.newEntryLogFile = new File(dir, compactedFilename.substring(0, compactedFilename.indexOf(".log") + 4));<NEW_LINE>if (!newEntryLogFile.exists()) {<NEW_LINE>HardLink.createHardLink(compactedLogFile, newEntryLogFile);<NEW_LINE>}<NEW_LINE>if (isInRecovery) {<NEW_LINE>recoverEntryLocations(EntryLogger.fileName2LogId(newEntryLogFile.getName()));<NEW_LINE>}<NEW_LINE>if (!offsets.isEmpty()) {<NEW_LINE>// update entry locations and flush index<NEW_LINE>ledgerStorage.updateEntriesLocations(offsets);<NEW_LINE>ledgerStorage.flushEntriesLocationsIndex();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new IOException("Failed to find compacted log file in UpdateIndexPhase");<NEW_LINE>}<NEW_LINE>} | String compactedFilename = compactedLogFile.getName(); |
1,418,370 | public void marshall(PutPlaybackConfigurationRequest putPlaybackConfigurationRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (putPlaybackConfigurationRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(putPlaybackConfigurationRequest.getAdDecisionServerUrl(), ADDECISIONSERVERURL_BINDING);<NEW_LINE>protocolMarshaller.marshall(putPlaybackConfigurationRequest.getAvailSuppression(), AVAILSUPPRESSION_BINDING);<NEW_LINE>protocolMarshaller.marshall(putPlaybackConfigurationRequest.getBumper(), BUMPER_BINDING);<NEW_LINE>protocolMarshaller.marshall(putPlaybackConfigurationRequest.getCdnConfiguration(), CDNCONFIGURATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(putPlaybackConfigurationRequest.getConfigurationAliases(), CONFIGURATIONALIASES_BINDING);<NEW_LINE>protocolMarshaller.marshall(putPlaybackConfigurationRequest.getDashConfiguration(), DASHCONFIGURATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(putPlaybackConfigurationRequest.getLivePreRollConfiguration(), LIVEPREROLLCONFIGURATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(putPlaybackConfigurationRequest.getManifestProcessingRules(), MANIFESTPROCESSINGRULES_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(putPlaybackConfigurationRequest.getPersonalizationThresholdSeconds(), PERSONALIZATIONTHRESHOLDSECONDS_BINDING);<NEW_LINE>protocolMarshaller.marshall(putPlaybackConfigurationRequest.getSlateAdUrl(), SLATEADURL_BINDING);<NEW_LINE>protocolMarshaller.marshall(putPlaybackConfigurationRequest.getTags(), TAGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(putPlaybackConfigurationRequest.getTranscodeProfileName(), TRANSCODEPROFILENAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(putPlaybackConfigurationRequest.getVideoContentSourceUrl(), VIDEOCONTENTSOURCEURL_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | putPlaybackConfigurationRequest.getName(), NAME_BINDING); |
610,984 | public GpuDeviceInfo unmarshall(StaxUnmarshallerContext context) throws Exception {<NEW_LINE>GpuDeviceInfo gpuDeviceInfo = new GpuDeviceInfo();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>if (context.isStartOfDocument())<NEW_LINE>targetDepth += 1;<NEW_LINE>while (true) {<NEW_LINE>XMLEvent xmlEvent = context.nextEvent();<NEW_LINE>if (xmlEvent.isEndDocument())<NEW_LINE>return gpuDeviceInfo;<NEW_LINE>if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {<NEW_LINE>if (context.testExpression("name", targetDepth)) {<NEW_LINE>gpuDeviceInfo.setName(StringStaxUnmarshaller.getInstance<MASK><NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("manufacturer", targetDepth)) {<NEW_LINE>gpuDeviceInfo.setManufacturer(StringStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("count", targetDepth)) {<NEW_LINE>gpuDeviceInfo.setCount(IntegerStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("memoryInfo", targetDepth)) {<NEW_LINE>gpuDeviceInfo.setMemoryInfo(GpuDeviceMemoryInfoStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>} else if (xmlEvent.isEndElement()) {<NEW_LINE>if (context.getCurrentDepth() < originalDepth) {<NEW_LINE>return gpuDeviceInfo;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ().unmarshall(context)); |
1,684,059 | final ListDatastoresResult executeListDatastores(ListDatastoresRequest listDatastoresRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listDatastoresRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListDatastoresRequest> request = null;<NEW_LINE>Response<ListDatastoresResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListDatastoresRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listDatastoresRequest));<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, "IoTAnalytics");<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<ListDatastoresResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListDatastoresResultJsonUnmarshaller());<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, "ListDatastores"); |
1,267,596 | private void populateOptionItemsFromDatasource() {<NEW_LINE>if (StringUtils.isBlank(datasourceRT)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// build the options by running the datasource code (the list is set as a request attribute)<NEW_LINE>RequestDispatcherOptions opts = new RequestDispatcherOptions();<NEW_LINE>opts.setForceResourceType(datasourceRT);<NEW_LINE>RequestDispatcher dispatcher = request.getRequestDispatcher(resource, opts);<NEW_LINE>try {<NEW_LINE>if (dispatcher != null) {<NEW_LINE>dispatcher.include(request, response);<NEW_LINE>} else {<NEW_LINE>LOGGER.error("Failed to include the datasource at " + datasourceRT);<NEW_LINE>}<NEW_LINE>} catch (IOException | ServletException | RuntimeException e) {<NEW_LINE>LOGGER.<MASK><NEW_LINE>}<NEW_LINE>// retrieve the datasource from the request and adapt it to form options<NEW_LINE>SimpleDataSource dataSource = (SimpleDataSource) request.getAttribute(DataSource.class.getName());<NEW_LINE>if (dataSource != null) {<NEW_LINE>Iterator<Resource> itemIterator = dataSource.iterator();<NEW_LINE>if (itemIterator != null) {<NEW_LINE>while (itemIterator.hasNext()) {<NEW_LINE>Resource itemResource = itemIterator.next();<NEW_LINE>OptionItem optionItem = new OptionItemImpl(request, resource, itemResource);<NEW_LINE>if ((optionItem.isDisabled() || StringUtils.isNotBlank(optionItem.getValue()))) {<NEW_LINE>optionItems.add(optionItem);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | error("Failed to include the datasource at " + datasourceRT, e); |
132,439 | public AuthenticationMethod loadMethodFromSession(Session session, int contextId) throws DatabaseException {<NEW_LINE>HttpAuthenticationMethod method = createAuthenticationMethod(contextId);<NEW_LINE>List<String> hostnames = session.getContextDataStrings(contextId, RecordContext.TYPE_AUTH_METHOD_FIELD_1);<NEW_LINE>if (hostnames != null && hostnames.size() > 0) {<NEW_LINE>method.<MASK><NEW_LINE>}<NEW_LINE>List<String> realms = session.getContextDataStrings(contextId, RecordContext.TYPE_AUTH_METHOD_FIELD_2);<NEW_LINE>if (realms != null && realms.size() > 0) {<NEW_LINE>method.realm = realms.get(0);<NEW_LINE>}<NEW_LINE>List<String> ports = session.getContextDataStrings(contextId, RecordContext.TYPE_AUTH_METHOD_FIELD_3);<NEW_LINE>if (ports != null && ports.size() > 0) {<NEW_LINE>try {<NEW_LINE>method.port = Integer.parseInt(ports.get(0));<NEW_LINE>} catch (Exception ex) {<NEW_LINE>log.error("Unable to load HttpAuthenticationMethod. ", ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return method;<NEW_LINE>} | hostname = hostnames.get(0); |
1,078,325 | public void verifySessionRows(String[][] sessionsCells, boolean[] expectedSessionShownStatus) {<NEW_LINE>assertEquals(sessionsCells.length, expectedSessionShownStatus.length);<NEW_LINE>boolean[] actualSessionShownStatus <MASK><NEW_LINE>List<WebElement> ongoingSessionRows = getOngoingSessionsRows();<NEW_LINE>for (WebElement sessionRow : ongoingSessionRows) {<NEW_LINE>List<WebElement> cells = sessionRow.findElements(By.tagName("td"));<NEW_LINE>// Only validate for the preset ongoing sessions<NEW_LINE>// This is because the page will display all ongoing sessions in the database, which is not predictable<NEW_LINE>for (int i = 0; i < sessionsCells.length; i++) {<NEW_LINE>String[] sessionCells = sessionsCells[i];<NEW_LINE>if (sessionCells[1].equals(cells.get(1).getText())) {<NEW_LINE>verifyTableRowValues(sessionRow, sessionCells);<NEW_LINE>actualSessionShownStatus[i] = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (int i = 0; i < expectedSessionShownStatus.length; i++) {<NEW_LINE>assertEquals(expectedSessionShownStatus[i], actualSessionShownStatus[i]);<NEW_LINE>}<NEW_LINE>} | = new boolean[expectedSessionShownStatus.length]; |
1,058,305 | public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints) {<NEW_LINE>return new PaintContext() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void dispose() {<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public ColorModel getColorModel() {<NEW_LINE>return ColorModel.getRGBdefault();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Raster getRaster(int x, int y, int w, int h) {<NEW_LINE>WritableRaster raster = getColorModel(<MASK><NEW_LINE>Random r = new Random();<NEW_LINE>for (int x2 = x; x2 < x + w; x++) {<NEW_LINE>for (int y2 = y; y2 < y + h; y++) {<NEW_LINE>RGBColor color = new RGBColor(r.nextInt(256), r.nextInt(256), r.nextInt(256), 0);<NEW_LINE>raster.setPixel(x2, y2, color.toArray());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return raster;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | ).createCompatibleWritableRaster(w, h); |
516,483 | public LookupDeveloperIdentityResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>LookupDeveloperIdentityResult lookupDeveloperIdentityResult = new LookupDeveloperIdentityResult();<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 lookupDeveloperIdentityResult;<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("IdentityId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>lookupDeveloperIdentityResult.setIdentityId(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("DeveloperUserIdentifierList", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>lookupDeveloperIdentityResult.setDeveloperUserIdentifierList(new ListUnmarshaller<String>(context.getUnmarshaller(String.class)).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("NextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>lookupDeveloperIdentityResult.setNextToken(context.getUnmarshaller(String.class).unmarshall(context));<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 lookupDeveloperIdentityResult;<NEW_LINE>} | class).unmarshall(context)); |
682,753 | public void loadlist(final String providedPath, final boolean back, final OpenMode providedOpenMode) {<NEW_LINE>if (mainFragmentViewModel == null) {<NEW_LINE>Log.w(getClass().getSimpleName(), "Viewmodel not available to load the data");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (getMainActivity() != null && getMainActivity().getActionModeHelper() != null && getMainActivity().getActionModeHelper().getActionMode() != null) {<NEW_LINE>getMainActivity().getActionModeHelper().getActionMode().finish();<NEW_LINE>}<NEW_LINE>mSwipeRefreshLayout.setRefreshing(true);<NEW_LINE>if (loadFilesListTask != null && loadFilesListTask.getStatus() == AsyncTask.Status.RUNNING) {<NEW_LINE>Log.w(getClass().getSimpleName(), "Existing load list task running, cancel current");<NEW_LINE>loadFilesListTask.cancel(true);<NEW_LINE>}<NEW_LINE>OpenMode openMode = providedOpenMode;<NEW_LINE>String actualPath = FileProperties.remapPathForApi30OrAbove(providedPath, false);<NEW_LINE>if (!providedPath.equals(actualPath) && SDK_INT >= Q) {<NEW_LINE>openMode = <MASK><NEW_LINE>} else // Monkeypatch :( to fix problems with unexpected non content URI path while openMode is still<NEW_LINE>// OpenMode.DOCUMENT_FILE<NEW_LINE>if (actualPath.startsWith("/") && OpenMode.DOCUMENT_FILE.equals(openMode)) {<NEW_LINE>openMode = OpenMode.FILE;<NEW_LINE>}<NEW_LINE>loadFilesListTask = new LoadFilesListTask(getActivity(), actualPath, this, openMode, getBoolean(PREFERENCE_SHOW_THUMB), getBoolean(PREFERENCE_SHOW_HIDDENFILES), (data) -> {<NEW_LINE>mSwipeRefreshLayout.setRefreshing(false);<NEW_LINE>if (data != null && data.second != null) {<NEW_LINE>boolean isPathLayoutGrid = DataUtils.getInstance().getListOrGridForPath(providedPath, DataUtils.LIST) == DataUtils.GRID;<NEW_LINE>setListElements(data.second, back, providedPath, data.first, false, isPathLayoutGrid);<NEW_LINE>} else {<NEW_LINE>Log.w(getClass().getSimpleName(), "Load list operation cancelled");<NEW_LINE>}<NEW_LINE>});<NEW_LINE>loadFilesListTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);<NEW_LINE>} | loadPathInQ(actualPath, providedPath, providedOpenMode); |
1,121,600 | final GetDeviceMethodsResult executeGetDeviceMethods(GetDeviceMethodsRequest getDeviceMethodsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getDeviceMethodsRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetDeviceMethodsRequest> request = null;<NEW_LINE>Response<GetDeviceMethodsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetDeviceMethodsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getDeviceMethodsRequest));<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, "IoT 1Click Devices Service");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetDeviceMethods");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetDeviceMethodsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetDeviceMethodsResultJsonUnmarshaller());<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(); |
1,630,388 | private void configure() {<NEW_LINE>try {<NEW_LINE>Files.createDirectories(configFile.getParent());<NEW_LINE>Files.createDirectories(confPathRepo);<NEW_LINE>Files.createDirectories(confPathData);<NEW_LINE>Files.createDirectories(confPathLogs);<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new UncheckedIOException(e);<NEW_LINE>}<NEW_LINE>LinkedHashMap<String, String> config = new LinkedHashMap<>();<NEW_LINE>String nodeName = safeName(name);<NEW_LINE>config.put("cluster.name", nodeName);<NEW_LINE>config.put("node.name", nodeName);<NEW_LINE>config.put("path.repo", confPathRepo.toAbsolutePath().toString());<NEW_LINE>config.put("path.data", confPathData.toAbsolutePath().toString());<NEW_LINE>config.put("path.logs", confPathLogs.toAbsolutePath().toString());<NEW_LINE>config.put("path.shared_data", workingDir.resolve("sharedData").toString());<NEW_LINE>config.put("node.attr.testattr", "test");<NEW_LINE>config.put("node.portsfile", "true");<NEW_LINE>config.put("http.port", "0");<NEW_LINE>config.put("transport.tcp.port", "0");<NEW_LINE>// Default the watermarks to absurdly low to prevent the tests from failing on nodes without enough disk space<NEW_LINE>config.put("cluster.routing.allocation.disk.watermark.low", "1b");<NEW_LINE>config.put("cluster.routing.allocation.disk.watermark.high", "1b");<NEW_LINE>// increase script compilation limit since tests can rapid-fire script compilations<NEW_LINE>config.put("script.max_compilations_rate", "2048/1m");<NEW_LINE>if (Version.fromString(version).getMajor() >= 6) {<NEW_LINE>config.put("cluster.routing.allocation.disk.watermark.flood_stage", "1b");<NEW_LINE>}<NEW_LINE>if (Version.fromString(version).getMajor() >= 7) {<NEW_LINE>config.put("cluster.initial_master_nodes", "[" + nodeName + "]");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Files.write(configFile, config.entrySet().stream().map(entry -> entry.getKey() + ": " + entry.getValue()).collect(Collectors.joining("\n")).getBytes(StandardCharsets.UTF_8));<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new UncheckedIOException("Could not write config file: " + configFile, e);<NEW_LINE>}<NEW_LINE>logger.<MASK><NEW_LINE>} | info("Written config file:{} for {}", configFile, this); |
1,553,077 | public int findElement(int ordinal, Object... hashKey) {<NEW_LINE>sampler().recordGet();<NEW_LINE>recordStackTrace();<NEW_LINE>if (keyMatcher == null)<NEW_LINE>return -1;<NEW_LINE>if (!ordinalIsPresent(ordinal))<NEW_LINE>return ((HollowSetTypeDataAccess) dataAccess.getTypeDataAccess(getSchema().getName(), ordinal)).findElement(ordinal, hashKey);<NEW_LINE>ordinal = ordinalRemap.get(ordinal);<NEW_LINE>HollowSetTypeReadState removedRecords = (HollowSetTypeReadState) getRemovedRecords();<NEW_LINE>int hashTableSize = HashCodes.hashTableSize(removedRecords.size(ordinal));<NEW_LINE>int hash = SetMapKeyHasher.hash(hashKey, keyMatcher.getFieldTypes());<NEW_LINE>int bucket = hash & (hashTableSize - 1);<NEW_LINE>int bucketOrdinal = removedRecords.relativeBucketValue(ordinal, bucket);<NEW_LINE>while (bucketOrdinal != -1) {<NEW_LINE>if (keyMatcher.keyMatches(bucketOrdinal, hashKey))<NEW_LINE>return bucketOrdinal;<NEW_LINE>bucket++;<NEW_LINE>bucket &= (hashTableSize - 1);<NEW_LINE>bucketOrdinal = <MASK><NEW_LINE>}<NEW_LINE>return -1;<NEW_LINE>} | removedRecords.relativeBucketValue(ordinal, bucket); |
962,895 | private void createPrintPackage(final I_C_Print_Job_Instructions printjobInstructions) {<NEW_LINE>final IPrintPackageBL printPackageBL = Services.get(IPrintPackageBL.class);<NEW_LINE>final Properties ctx = InterfaceWrapperHelper.getCtx(printjobInstructions);<NEW_LINE>final I_C_Print_Package printPackage = InterfaceWrapperHelper.create(ctx, I_C_Print_Package.class, ITrx.TRXNAME_ThreadInherited);<NEW_LINE>// Creating the Print Package template (request):<NEW_LINE>final String transactionId = UUID.randomUUID().toString();<NEW_LINE>printPackage.setTransactionID(transactionId);<NEW_LINE>InterfaceWrapperHelper.save(printPackage, ITrx.TRXNAME_ThreadInherited);<NEW_LINE>final PrintPackageCtx printCtx = (PrintPackageCtx) printPackageBL.createEmptyInitialCtx();<NEW_LINE>printCtx.<MASK><NEW_LINE>printCtx.setTransactionId(printPackage.getTransactionID());<NEW_LINE>printPackageBL.addPrintingDataToPrintPackage(printPackage, printjobInstructions, printCtx);<NEW_LINE>} | setHostKey(printjobInstructions.getHostKey()); |
1,717,168 | public List<Execution> lockAndFetch(JdbcTaskRepositoryContext ctx, Instant now, int limit) {<NEW_LINE>final JdbcTaskRepository.UnresolvedFilter unresolvedFilter = new JdbcTaskRepository.UnresolvedFilter(ctx.taskResolver.getUnresolved());<NEW_LINE>String selectForUpdateQuery = " UPDATE " + ctx.tableName + " st1 SET picked = ?, picked_by = ?, last_heartbeat = ?, version = version + 1 " + " WHERE (st1.task_name, st1.task_instance) IN (" + " SELECT st2.task_name, st2.task_instance FROM " + ctx.tableName + " st2 " + " WHERE picked = ? and execution_time <= ? " + unresolvedFilter.andCondition() + " order by execution_time asc FOR UPDATE SKIP LOCKED LIMIT ?)" + " RETURNING st1.*";<NEW_LINE>return ctx.jdbcRunner.query(selectForUpdateQuery, ps -> {<NEW_LINE>int index = 1;<NEW_LINE>// Update<NEW_LINE>// picked (new)<NEW_LINE>ps.setBoolean(index++, true);<NEW_LINE>// picked_by<NEW_LINE>ps.setString(index++, truncate(ctx.schedulerName<MASK><NEW_LINE>// last_heartbeat<NEW_LINE>setInstant(ps, index++, now);<NEW_LINE>// Inner select<NEW_LINE>// picked (old)<NEW_LINE>ps.setBoolean(index++, false);<NEW_LINE>// execution_time<NEW_LINE>setInstant(ps, index++, now);<NEW_LINE>index = unresolvedFilter.setParameters(ps, index);<NEW_LINE>// limit<NEW_LINE>ps.setInt(index++, limit);<NEW_LINE>}, ctx.resultSetMapper.get());<NEW_LINE>} | .getName(), 50)); |
1,622,905 | public HttpHeaders filter(HttpHeaders input, ServerWebExchange exchange) {<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("Will instrument the HTTP request headers [" + exchange.getRequest().getHeaders() + "]");<NEW_LINE>}<NEW_LINE>ServerHttpClientRequest request = new ServerHttpClientRequest(exchange.getRequest(), input);<NEW_LINE>Span <MASK><NEW_LINE>Span span = injectedSpan(request, currentSpan);<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("Client span " + span + " created for the request. New headers are " + request.filteredHeaders.toSingleValueMap());<NEW_LINE>}<NEW_LINE>exchange.getAttributes().put(SPAN_ATTRIBUTE, span);<NEW_LINE>HttpHeaders headersWithInput = new HttpHeaders();<NEW_LINE>headersWithInput.addAll(input);<NEW_LINE>addHeadersWithInput(request.filteredHeaders, headersWithInput);<NEW_LINE>if (headersWithInput.containsKey("b3") || headersWithInput.containsKey("B3")) {<NEW_LINE>headersWithInput.keySet().remove("b3");<NEW_LINE>headersWithInput.keySet().remove("B3");<NEW_LINE>}<NEW_LINE>return headersWithInput;<NEW_LINE>} | currentSpan = currentSpan(exchange, request); |
743,167 | public Object dateAdd(Object thisObj, Object dateObj, Object durationObj, Object optionsParam, @Cached("create(getContext())") ToTemporalDurationNode toTemporalDurationNode, @Cached("createKeys(getContext())") EnumerableOwnPropertyNamesNode namesNode) {<NEW_LINE>JSTemporalCalendarObject calendar = requireTemporalCalendar(thisObj);<NEW_LINE>assert calendar.getId().equals(ISO8601);<NEW_LINE>JSTemporalPlainDateObject date = (JSTemporalPlainDateObject) toTemporalDate(dateObj, Undefined.instance);<NEW_LINE>JSTemporalDurationObject duration = (JSTemporalDurationObject) toTemporalDurationNode.executeDynamicObject(durationObj);<NEW_LINE>JSDynamicObject options = getOptionsObject(optionsParam);<NEW_LINE>Overflow overflow = toTemporalOverflow(options);<NEW_LINE>JSTemporalDurationRecord balanceResult = TemporalUtil.balanceDuration(getContext(), namesNode, duration.getDays(), duration.getHours(), duration.getMinutes(), duration.getSeconds(), duration.getMilliseconds(), duration.getMicroseconds(), duration.getNanoseconds(), Unit.DAY);<NEW_LINE>JSTemporalDateTimeRecord result = TemporalUtil.addISODate(date.getYear(), date.getMonth(), date.getDay(), dtoiConstrain(duration.getYears()), dtoiConstrain(duration.getMonths()), dtoiConstrain(duration.getWeeks()), dtoiConstrain(balanceResult.getDays()), overflow);<NEW_LINE>return JSTemporalPlainDate.create(getContext(), result.getYear(), result.getMonth(), result.<MASK><NEW_LINE>} | getDay(), calendar, errorBranch); |
1,625,203 | private String wsImport(URL wsdlLocation) throws IOException {<NEW_LINE>File classesDir = new File(System.getProperty("java.io.tmpdir"));<NEW_LINE>// create a dumy file to have a unique temporary name for a directory<NEW_LINE>classesDir = File.createTempFile("jax-ws", "tester", classesDir);<NEW_LINE>if (!classesDir.delete()) {<NEW_LINE>logger.log(Level.WARNING, LogUtils.DELETE_DIR_FAILED, classesDir);<NEW_LINE>}<NEW_LINE>if (!classesDir.mkdirs()) {<NEW_LINE>logger.log(Level.SEVERE, LogUtils.CREATE_DIR_FAILED, classesDir);<NEW_LINE>}<NEW_LINE>String[] wsimportArgs = new String[8];<NEW_LINE>if (JDK.getMajor() >= 9) {<NEW_LINE>wsimportArgs = new String[14];<NEW_LINE>}<NEW_LINE>wsimportArgs[0] = "-d";<NEW_LINE>wsimportArgs[1] = classesDir.getAbsolutePath();<NEW_LINE>wsimportArgs[2] = "-keep";<NEW_LINE>wsimportArgs[3] = wsdlLocation.toExternalForm();<NEW_LINE>wsimportArgs[4] = "-Xendorsed";<NEW_LINE>wsimportArgs[5] = "-target";<NEW_LINE>wsimportArgs[6] = "2.1";<NEW_LINE>wsimportArgs[7] = "-extension";<NEW_LINE>// If JDK version is 9 or higher, we need to add the JWS and related JARs<NEW_LINE>if (JDK.getMajor() >= 9) {<NEW_LINE>String modulesDir = System.getProperty("com.sun.aas.installRoot") + File.separator + "modules" + File.separator;<NEW_LINE>wsimportArgs[8] = modulesDir + "jakarta.jws-api.jar";<NEW_LINE><MASK><NEW_LINE>wsimportArgs[10] = modulesDir + "webservices-osgi.jar";<NEW_LINE>wsimportArgs[11] = modulesDir + "jaxb-osgi.jar";<NEW_LINE>wsimportArgs[12] = modulesDir + "jakarta.xml.ws-api.jar";<NEW_LINE>wsimportArgs[13] = modulesDir + "jakarta.activation-api.jar";<NEW_LINE>}<NEW_LINE>WSToolsObjectFactory tools = WSToolsObjectFactory.newInstance();<NEW_LINE>logger.log(Level.INFO, LogUtils.WSIMPORT_INVOKE, wsdlLocation);<NEW_LINE>boolean success = tools.wsimport(System.out, wsimportArgs);<NEW_LINE>if (success) {<NEW_LINE>logger.log(Level.INFO, LogUtils.WSIMPORT_OK);<NEW_LINE>} else {<NEW_LINE>logger.log(Level.SEVERE, LogUtils.WSIMPORT_FAILED);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return classesDir.getAbsolutePath();<NEW_LINE>} | wsimportArgs[9] = modulesDir + "jakarta.xml.rpc-api.jar"; |
391,880 | final SendUsersMessagesResult executeSendUsersMessages(SendUsersMessagesRequest sendUsersMessagesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(sendUsersMessagesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<SendUsersMessagesRequest> request = null;<NEW_LINE>Response<SendUsersMessagesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new SendUsersMessagesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(sendUsersMessagesRequest));<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, "Pinpoint");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "SendUsersMessages");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<SendUsersMessagesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new SendUsersMessagesResultJsonUnmarshaller());<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); |
1,377,222 | // Helpers<NEW_LINE>private void updateTitle() {<NEW_LINE>if (mUid == 0) {<NEW_LINE>// Get statistics<NEW_LINE>long count = 0;<NEW_LINE>long restricted = 0;<NEW_LINE>double persec = 0;<NEW_LINE>try {<NEW_LINE>@SuppressWarnings("rawtypes")<NEW_LINE>Map statistics = PrivacyService.getClient().getStatistics();<NEW_LINE>count = (Long) statistics.get("restriction_count");<NEW_LINE>restricted = (Long) statistics.get("restriction_restricted");<NEW_LINE>long uptime = (Long) statistics.get("uptime_milliseconds");<NEW_LINE>persec = (double) count / (uptime / 1000);<NEW_LINE>} catch (Throwable ex) {<NEW_LINE>Util.bug(null, ex);<NEW_LINE>}<NEW_LINE>// Set sub title<NEW_LINE>getSupportActionBar().setSubtitle(String.format("%d/%d %.2f/s", restricted, count, persec));<NEW_LINE>} else<NEW_LINE>getSupportActionBar().setSubtitle(TextUtils.join(", ", new ApplicationInfoEx(this, <MASK><NEW_LINE>} | mUid).getApplicationName())); |
1,259,975 | public static void vertical11(Kernel1D_S32 kernel, GrayS32 src, GrayS32 dst, int divisor, @Nullable GrowArray<DogArray_I32> workspaces) {<NEW_LINE>final int[] dataSrc = src.data;<NEW_LINE>final int[] dataDst = dst.data;<NEW_LINE>final int k1 = kernel.data[0];<NEW_LINE>final int k2 = kernel.data[1];<NEW_LINE>final int k3 = kernel.data[2];<NEW_LINE>final int k4 = kernel.data[3];<NEW_LINE>final int k5 = kernel.data[4];<NEW_LINE>final int k6 = kernel.data[5];<NEW_LINE>final int k7 = kernel.data[6];<NEW_LINE>final int k8 = kernel.data[7];<NEW_LINE>final int k9 = kernel.data[8];<NEW_LINE>final int k10 = kernel.data[9];<NEW_LINE>final int k11 = kernel.data[10];<NEW_LINE>final int radius = kernel.getRadius();<NEW_LINE>final int imgWidth = dst.getWidth();<NEW_LINE>final int imgHeight = dst.getHeight();<NEW_LINE>final int halfDivisor = divisor / 2;<NEW_LINE>final int yEnd = imgHeight - radius;<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(radius, yEnd, y -> {<NEW_LINE>for (int y = radius; y < yEnd; y++) {<NEW_LINE>int indexDst = dst.startIndex + y * dst.stride;<NEW_LINE>int i = src.startIndex + (y - radius) * src.stride;<NEW_LINE>final int iEnd = i + imgWidth;<NEW_LINE>for (; i < iEnd; i++) {<NEW_LINE>int indexSrc = i;<NEW_LINE>int total = <MASK><NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc]) * k2;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc]) * k3;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc]) * k4;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc]) * k5;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc]) * k6;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc]) * k7;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc]) * k8;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc]) * k9;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc]) * k10;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc]) * k11;<NEW_LINE>dataDst[indexDst++] = ((total + halfDivisor) / divisor);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} | (dataSrc[indexSrc]) * k1; |
1,053,896 | private static <L> MXCIFQuadTreeNode<Object> subdivide(MXCIFQuadTreeNodeLeaf<Object> leaf, MXCIFQuadTree<Object> tree) {<NEW_LINE>double w = (leaf.getBb().getMaxX() - leaf.getBb().getMinX()) / 2d;<NEW_LINE>double h = (leaf.getBb().getMaxY() - leaf.getBb().getMinY()) / 2d;<NEW_LINE>double minx = leaf.getBb().getMinX();<NEW_LINE>double miny = leaf.getBb().getMinY();<NEW_LINE>BoundingBox bbNW = new BoundingBox(minx, miny, minx + w, miny + h);<NEW_LINE>BoundingBox bbNE = new BoundingBox(minx + w, miny, leaf.getBb().getMaxX(), miny + h);<NEW_LINE>BoundingBox bbSW = new BoundingBox(minx, miny + h, minx + w, leaf.getBb().getMaxY());<NEW_LINE>BoundingBox bbSE = new BoundingBox(minx + w, miny + h, leaf.getBb().getMaxX(), leaf.<MASK><NEW_LINE>MXCIFQuadTreeNode<Object> nw = new MXCIFQuadTreeNodeLeaf<>(bbNW, leaf.getLevel() + 1, null, 0);<NEW_LINE>MXCIFQuadTreeNode<Object> ne = new MXCIFQuadTreeNodeLeaf<>(bbNE, leaf.getLevel() + 1, null, 0);<NEW_LINE>MXCIFQuadTreeNode<Object> sw = new MXCIFQuadTreeNodeLeaf<>(bbSW, leaf.getLevel() + 1, null, 0);<NEW_LINE>MXCIFQuadTreeNode<Object> se = new MXCIFQuadTreeNodeLeaf<>(bbSE, leaf.getLevel() + 1, null, 0);<NEW_LINE>MXCIFQuadTreeNodeBranch<Object> branch = new MXCIFQuadTreeNodeBranch<>(leaf.getBb(), leaf.getLevel(), null, 0, nw, ne, sw, se);<NEW_LINE>Object rectangles = leaf.getData();<NEW_LINE>if (rectangles instanceof XYWHRectangleWValue) {<NEW_LINE>XYWHRectangleWValue rectangle = (XYWHRectangleWValue<L>) rectangles;<NEW_LINE>subdivide(rectangle, branch, tree);<NEW_LINE>} else {<NEW_LINE>Collection<XYWHRectangleWValue<L>> collection = (Collection<XYWHRectangleWValue<L>>) rectangles;<NEW_LINE>for (XYWHRectangleWValue<L> rectangle : collection) {<NEW_LINE>subdivide(rectangle, branch, tree);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return branch;<NEW_LINE>} | getBb().getMaxY()); |
345,815 | private void transferAssetAsync() throws EndorseException, SubmitException, CommitStatusException {<NEW_LINE>System.out.println("\n--> Async Submit Transaction: TransferAsset, updates existing asset owner");<NEW_LINE>SubmittedTransaction commit = contract.newProposal("TransferAsset").addArguments(assetId, "Saptha").build().endorse().submitAsync();<NEW_LINE>byte[] result = commit.getResult();<NEW_LINE>String oldOwner = new String(result, StandardCharsets.UTF_8);<NEW_LINE>System.out.println("*** Successfully submitted transaction to transfer ownership from " + oldOwner + " to Saptha");<NEW_LINE>System.out.println("*** Waiting for transaction commit");<NEW_LINE><MASK><NEW_LINE>if (!status.isSuccessful()) {<NEW_LINE>throw new RuntimeException("Transaction " + status.getTransactionId() + " failed to commit with status code " + status.getCode());<NEW_LINE>}<NEW_LINE>System.out.println("*** Transaction committed successfully");<NEW_LINE>} | Status status = commit.getStatus(); |
49,315 | private Node createBullet(Indent in) {<NEW_LINE>Node result;<NEW_LINE>switch(in.level) {<NEW_LINE>case 1:<NEW_LINE>{<NEW_LINE>Circle c = new Circle(2.5);<NEW_LINE>c.setFill(Color.BLACK);<NEW_LINE>c.setStroke(Color.BLACK);<NEW_LINE>result = c;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case 2:<NEW_LINE>{<NEW_LINE>Circle c = new Circle(2.5);<NEW_LINE>c.setFill(Color.WHITE);<NEW_LINE>c.setStroke(Color.BLACK);<NEW_LINE>result = c;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case 3:<NEW_LINE>{<NEW_LINE>Rectangle r = new Rectangle(5, 5);<NEW_LINE>r.setFill(Color.BLACK);<NEW_LINE>r.setStroke(Color.BLACK);<NEW_LINE>result = r;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>{<NEW_LINE>Rectangle r = new Rectangle(5, 5);<NEW_LINE>r.setFill(Color.WHITE);<NEW_LINE>r.setStroke(Color.BLACK);<NEW_LINE>result = r;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>Label bullet <MASK><NEW_LINE>bullet.setPadding(new Insets(0, 0, 0, in.level * in.width));<NEW_LINE>bullet.setContentDisplay(ContentDisplay.LEFT);<NEW_LINE>return bullet;<NEW_LINE>} | = new Label(" ", result); |
818,047 | private static RelationshipGroupRecord readRelationshipGroupRecord(long id, ReadableChannel channel) throws IOException {<NEW_LINE>byte flags = channel.get();<NEW_LINE>boolean inUse = bitFlag(flags, Record.IN_USE.byteValue());<NEW_LINE>boolean requireSecondaryUnit = bitFlag(flags, Record.REQUIRE_SECONDARY_UNIT);<NEW_LINE>boolean hasSecondaryUnit = bitFlag(flags, Record.HAS_SECONDARY_UNIT);<NEW_LINE>boolean usesFixedReferenceFormat = <MASK><NEW_LINE>boolean hasExternalDegreesOut = bitFlag(flags, Record.ADDITIONAL_FLAG_1);<NEW_LINE>boolean hasExternalDegreesIn = bitFlag(flags, Record.ADDITIONAL_FLAG_2);<NEW_LINE>boolean hasExternalDegreesLoop = bitFlag(flags, Record.ADDITIONAL_FLAG_3);<NEW_LINE>int type = unsignedShortToInt(channel.getShort());<NEW_LINE>long next = channel.getLong();<NEW_LINE>long firstOut = channel.getLong();<NEW_LINE>long firstIn = channel.getLong();<NEW_LINE>long firstLoop = channel.getLong();<NEW_LINE>long owningNode = channel.getLong();<NEW_LINE>RelationshipGroupRecord record = new RelationshipGroupRecord(id).initialize(inUse, type, firstOut, firstIn, firstLoop, owningNode, next);<NEW_LINE>record.setHasExternalDegreesOut(hasExternalDegreesOut);<NEW_LINE>record.setHasExternalDegreesIn(hasExternalDegreesIn);<NEW_LINE>record.setHasExternalDegreesLoop(hasExternalDegreesLoop);<NEW_LINE>record.setRequiresSecondaryUnit(requireSecondaryUnit);<NEW_LINE>if (hasSecondaryUnit) {<NEW_LINE>record.setSecondaryUnitIdOnLoad(channel.getLong());<NEW_LINE>}<NEW_LINE>record.setUseFixedReferences(usesFixedReferenceFormat);<NEW_LINE>return record;<NEW_LINE>} | bitFlag(flags, Record.USES_FIXED_REFERENCE_FORMAT); |
49,349 | public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {<NEW_LINE>if (evt instanceof SslHandshakeCompletionEvent) {<NEW_LINE>SslHandshakeCompletionEvent handshakeEvent = (SslHandshakeCompletionEvent) evt;<NEW_LINE>try {<NEW_LINE>if (handshakeEvent.isSuccess()) {<NEW_LINE>SslHandler sslHandler = ctx.pipeline().get(SslHandler.class);<NEW_LINE>if (sslHandler == null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>String protocol = sslHandler.applicationProtocol();<NEW_LINE>configurePipeline(ctx, protocol != null ? protocol : fallbackProtocol);<NEW_LINE>} else {<NEW_LINE>// if the event is not produced because of an successful handshake we will receive the same<NEW_LINE>// exception in exceptionCaught(...) and handle it there. This will allow us more fine-grained<NEW_LINE>// control over which exception we propagate down the ChannelPipeline.<NEW_LINE>//<NEW_LINE>// See https://github.com/netty/netty/issues/10342<NEW_LINE>}<NEW_LINE>} catch (Throwable cause) {<NEW_LINE>exceptionCaught(ctx, cause);<NEW_LINE>} finally {<NEW_LINE>// Handshake failures are handled in exceptionCaught(...).<NEW_LINE>if (handshakeEvent.isSuccess()) {<NEW_LINE>removeSelfIfPresent(ctx);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (evt instanceof ChannelInputShutdownEvent) {<NEW_LINE>fireBufferedMessages();<NEW_LINE>}<NEW_LINE>ctx.fireUserEventTriggered(evt);<NEW_LINE>} | throw new IllegalStateException("cannot find an SslHandler in the pipeline (required for " + "application-level protocol negotiation)"); |
342,286 | public boolean onInterceptTouchEvent(MotionEvent ev) {<NEW_LINE>final int actionMasked = ev.getAction() & MotionEvent.ACTION_MASK;<NEW_LINE>// initiate the dragStartLocation and flags<NEW_LINE>if (actionMasked == MotionEvent.ACTION_DOWN) {<NEW_LINE>this.dragStartLocation = new PointF(ev.getX(<MASK><NEW_LINE>resetTouchEventFlags();<NEW_LINE>// detect whether we targeted scrollable child, if so we will not intercapte the touch<NEW_LINE>int targetChildTag = findTargetTagForTouch(ev.getX(), ev.getY(), this);<NEW_LINE>View targetChild = (View) findViewById(targetChildTag);<NEW_LINE>if (targetChild != null && targetChild.isScrollContainer()) {<NEW_LINE>isChildIsScrollContainer = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (actionMasked == MotionEvent.ACTION_MOVE) {<NEW_LINE>float delX = ev.getX() - dragStartLocation.x;<NEW_LINE>float delY = ev.getY() - dragStartLocation.y;<NEW_LINE>boolean isHSwipe = Math.abs(delX) > mTouchSlop;<NEW_LINE>boolean isVSwipe = Math.abs(delY) > mTouchSlop;<NEW_LINE>this.isSwiping = this.isSwiping || isHSwipe || isVSwipe;<NEW_LINE>if (!isChildIsScrollContainer && dragEnabled && (horizontalOnly && isHSwipe || verticalOnly && isVSwipe || !horizontalOnly && !verticalOnly)) {<NEW_LINE>// we are giving opportunity intercept the action to the ChildrenViews<NEW_LINE>if (!skippedOneInterception) {<NEW_LINE>skippedOneInterception = true;<NEW_LINE>} else {<NEW_LINE>startDrag(ev);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return super.onInterceptTouchEvent(ev);<NEW_LINE>} | ), ev.getY()); |
1,623,217 | protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {<NEW_LINE>builder.getRawBeanDefinition().setBeanClass(RedisClient.class);<NEW_LINE>if (helper.hasAttribute(element, HOST_ATTRIBUTE)) {<NEW_LINE>helper.addConstructorArgs(element, HOST_ATTRIBUTE, String.class, builder);<NEW_LINE>helper.addConstructorArgs(element, PORT_ATTRIBUTE, int.class, builder);<NEW_LINE>helper.addConstructorArgs(element, <MASK><NEW_LINE>helper.addConstructorArgs(element, COMMAND_TIMEOUT_ATTRIBUTE, int.class, builder);<NEW_LINE>} else {<NEW_LINE>BeanDefinitionBuilder b = helper.createBeanDefinitionBuilder(element, parserContext, RedisClientConfig.class);<NEW_LINE>String configId = helper.getId(null, b, parserContext);<NEW_LINE>helper.parseAttributes(element, parserContext, b);<NEW_LINE>BeanComponentDefinition def = helper.registerBeanDefinition(b, configId, null, parserContext);<NEW_LINE>helper.addConstructorArgs(def, RedisClientConfig.class, builder);<NEW_LINE>}<NEW_LINE>builder.setDestroyMethodName("shutdown");<NEW_LINE>parserContext.getDelegate().parseQualifierElements(element, builder.getRawBeanDefinition());<NEW_LINE>} | CONNECTION_TIMEOUT_ATTRIBUTE, int.class, builder); |
1,253,137 | protected void preLoad(BuildCraftJsonGui json) {<NEW_LINE>TypedKeyMap<String, Object> properties = json.properties;<NEW_LINE>FunctionContext context = json.context;<NEW_LINE>properties.put("filler.inventory", new InventorySlotHolder(container, container.tile.invResources));<NEW_LINE>properties.put("statement.container", container.tile);<NEW_LINE>properties.put("controllable", container.tile);<NEW_LINE>properties.put("controllable.sprite", SPRITE_CONTROL_MODE);<NEW_LINE>context.put_o("controllable.mode", Mode.class, container.tile::getControlMode);<NEW_LINE>context.put_b("filler.is_finished", container.tile::isFinished);<NEW_LINE>context.put_b(<MASK><NEW_LINE>context.put_l("filler.to_break", container.tile::getCountToBreak);<NEW_LINE>context.put_l("filler.to_place", container.tile::getCountToPlace);<NEW_LINE>properties.put("filler.possible", FillerStatementContext.CONTEXT_ALL);<NEW_LINE>properties.put("filler.pattern", container.getPatternStatementClient());<NEW_LINE>properties.put("filler.pattern.sprite", SPRITE_PATTERN);<NEW_LINE>context.put_b("filler.invert", container::isInverted);<NEW_LINE>properties.put("filler.invert", IButtonBehaviour.TOGGLE);<NEW_LINE>properties.put("filler.invert", container.isInverted());<NEW_LINE>properties.put("filler.invert", (IButtonClickEventListener) (b, k) -> container.sendInverted(b.isButtonActive()));<NEW_LINE>context.put_b("filler.excavate", container.tile::canExcavate);<NEW_LINE>properties.put("filler.excavate", IButtonBehaviour.TOGGLE);<NEW_LINE>properties.put("filler.excavate", container.tile.canExcavate());<NEW_LINE>properties.put("filler.excavate", (IButtonClickEventListener) (b, k) -> container.tile.sendCanExcavate(b.isButtonActive()));<NEW_LINE>} | "filler.is_locked", container.tile::isLocked); |
1,532,147 | private PsiMethod rebuildMethodFromString() {<NEW_LINE>PsiMethod result;<NEW_LINE>try {<NEW_LINE>final StringBuilder methodTextDeclaration = new StringBuilder();<NEW_LINE>methodTextDeclaration.append(getAllModifierProperties((LightModifierList) getModifierList()));<NEW_LINE>PsiType returnType = getReturnType();<NEW_LINE>if (null != returnType && returnType.isValid()) {<NEW_LINE>methodTextDeclaration.append(returnType.getCanonicalText()).append(' ');<NEW_LINE>}<NEW_LINE>methodTextDeclaration.append(getName());<NEW_LINE>methodTextDeclaration.append('(');<NEW_LINE>if (getParameterList().getParametersCount() > 0) {<NEW_LINE>for (PsiParameter parameter : getParameterList().getParameters()) {<NEW_LINE>methodTextDeclaration.append(parameter.getType().getCanonicalText()).append(' ').append(parameter.getName<MASK><NEW_LINE>}<NEW_LINE>methodTextDeclaration.deleteCharAt(methodTextDeclaration.length() - 1);<NEW_LINE>}<NEW_LINE>methodTextDeclaration.append(')');<NEW_LINE>methodTextDeclaration.append('{').append(" ").append('}');<NEW_LINE>final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(getManager().getProject());<NEW_LINE>result = elementFactory.createMethodFromText(methodTextDeclaration.toString(), getContainingClass());<NEW_LINE>if (null != getBody()) {<NEW_LINE>result.getBody().replace(getBody());<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>result = null;<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | ()).append(','); |
49,101 | private void ensureExistence() {<NEW_LINE>if (sketch.getFolder().exists())<NEW_LINE>return;<NEW_LINE>Base.showWarning(tr("Sketch Disappeared"), tr("The sketch folder has disappeared.\n " + "Will attempt to re-save in the same location,\n" + "but anything besides the code will be lost."), null);<NEW_LINE>try {<NEW_LINE>sketch<MASK><NEW_LINE>for (SketchFile file : sketch.getFiles()) {<NEW_LINE>// this will force a save<NEW_LINE>file.save();<NEW_LINE>}<NEW_LINE>calcModified();<NEW_LINE>} catch (Exception e) {<NEW_LINE>Base.showWarning(tr("Could not re-save sketch"), tr("Could not properly re-save the sketch. " + "You may be in trouble at this point,\n" + "and it might be time to copy and paste " + "your code to another text editor."), e);<NEW_LINE>}<NEW_LINE>} | .getFolder().mkdirs(); |
471,104 | public boolean applies(GameEvent event, Ability source, Game game) {<NEW_LINE>if (!super.applies(event, source, game)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>boolean catched = false;<NEW_LINE>if (event.getTargetId().equals(source.getControllerId())) {<NEW_LINE>catched = true;<NEW_LINE>} else {<NEW_LINE>Permanent targetPermanent = game.getPermanent(event.getTargetId());<NEW_LINE>if (targetPermanent != null && targetPermanent.isControlledBy(source.getControllerId()) && targetPermanent.isPlaneswalker(game)) {<NEW_LINE>catched = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (catched) {<NEW_LINE>MageObject damageSource = game.getObject(event.getSourceId());<NEW_LINE>if (damageSource instanceof StackObject) {<NEW_LINE>return !((StackObject) damageSource).isControlledBy(source.getControllerId());<NEW_LINE>} else if (damageSource instanceof Permanent) {<NEW_LINE>return !((Permanent) damageSource).isControlledBy(source.getControllerId());<NEW_LINE>} else if (damageSource instanceof Card) {<NEW_LINE>return !((Card) damageSource).isOwnedBy(source.getControllerId());<NEW_LINE>}<NEW_LINE>Logger.getLogger(Comeuppance.class).error("Comeuppance: could not define source objects controller - " + (damageSource != null ? damageSource<MASK><NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | .getName() : "null")); |
370,779 | public Object decode(List<Object> parts, State state) {<NEW_LINE>if (parts.get(0) instanceof List) {<NEW_LINE>Map<ClusterSlotRange, Set<String>> <MASK><NEW_LINE>List<List<Object>> rows = (List<List<Object>>) (Object) parts;<NEW_LINE>for (List<Object> row : rows) {<NEW_LINE>Iterator<Object> iterator = row.iterator();<NEW_LINE>Long startSlot = (Long) iterator.next();<NEW_LINE>Long endSlot = (Long) iterator.next();<NEW_LINE>ClusterSlotRange range = new ClusterSlotRange(startSlot.intValue(), endSlot.intValue());<NEW_LINE>Set<String> addresses = new HashSet<>();<NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>List<Object> addressParts = (List<Object>) iterator.next();<NEW_LINE>addresses.add(addressParts.get(0) + ":" + addressParts.get(1));<NEW_LINE>}<NEW_LINE>result.put(range, addresses);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>return parts;<NEW_LINE>} | result = new HashMap<>(); |
1,418,221 | private boolean sameCompoundModel(CompoundModelSpecification first, CompoundModelSpecification second, MultiValueMap<ModelKey, ModelKey> referenceKeyToEffectiveKey, HashMap<List<ModelKey>, Boolean> seen) {<NEW_LINE>if (first == second) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (first == null || second == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>LOGGER.trace("Comparing compound specs {} and {}", first, second);<NEW_LINE>seen.put(Arrays.asList(first.getModelKey(), second.getModelKey()), true);<NEW_LINE>boolean sameProperties = sameProperties(first.getProperties(), second.getProperties(), referenceKeyToEffectiveKey, seen);<NEW_LINE>seen.put(Arrays.asList(first.getModelKey(), second.getModelKey()), sameProperties);<NEW_LINE>return sameProperties && Objects.equals(first.getMaxProperties(), second.getMaxProperties()) && Objects.equals(first.getMinProperties(), second.getMinProperties()) && Objects.equals(first.getDiscriminator(<MASK><NEW_LINE>} | ), second.getDiscriminator()); |
437,162 | private void logNode(DefaultMutableTreeNode theTreeNode, String message) {<NEW_LINE>if (!LOGGER.isDebugEnabled()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) theTreeNode.getParent();<NEW_LINE>Node theNode = (Node) theTreeNode.getUserObject();<NEW_LINE>Node theParentNode = parentNode == null ? null : (Node) parentNode.getUserObject();<NEW_LINE>@SuppressWarnings({ "unchecked" })<NEW_LINE>Enumeration<TreeNode> children = theTreeNode.children();<NEW_LINE>LOGGER.debug(message + ": " + theNode + ", " + theNode.type + ", parent " + theParentNode + (theParentNode == null ? "" : ", " + theParentNode.type));<NEW_LINE>while (children.hasMoreElements()) {<NEW_LINE>DefaultMutableTreeNode treeNode = <MASK><NEW_LINE>Node child = (Node) treeNode.getUserObject();<NEW_LINE>LOGGER.debug("\t" + child.toString() + ", " + child.type);<NEW_LINE>}<NEW_LINE>} | (DefaultMutableTreeNode) children.nextElement(); |
1,379,239 | public TerminologyDataLocation unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>TerminologyDataLocation terminologyDataLocation = new TerminologyDataLocation();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><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("RepositoryType", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>terminologyDataLocation.setRepositoryType(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("Location", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>terminologyDataLocation.setLocation(context.getUnmarshaller(String.class).unmarshall(context));<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 terminologyDataLocation;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
1,024,111 | public void testCriteriaQuery_JavaUtilDate(TestExecutionContext testExecCtx, TestExecutionResources testExecResources, Object managedComponentObject) throws Throwable {<NEW_LINE>final String testName = getTestName();<NEW_LINE>// Verify parameters<NEW_LINE>if (testExecCtx == null || testExecResources == null) {<NEW_LINE>Assert.fail(testName + ": Missing context and/or resources. Cannot execute the test.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final JPAResource jpaResource = testExecResources.getJpaResourceMap().get("test-jpa-resource");<NEW_LINE>if (jpaResource == null) {<NEW_LINE>Assert.fail("Missing JPAResource 'test-jpa-resource'). Cannot execute the test.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Process Test Properties<NEW_LINE>final Map<String, Serializable> testProps = testExecCtx.getProperties();<NEW_LINE>if (testProps != null) {<NEW_LINE>for (String key : testProps.keySet()) {<NEW_LINE>System.out.println("Test Property: " + key + " = " + testProps.get(key));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>EntityManager em = jpaResource.getEm();<NEW_LINE>TransactionJacket tx = jpaResource.getTj();<NEW_LINE>// Execute Test Case<NEW_LINE>try {<NEW_LINE>tx.beginTransaction();<NEW_LINE>if (jpaResource.getPcCtxInfo().getPcType() == PersistenceContextType.APPLICATION_MANAGED_JTA)<NEW_LINE>em.joinTransaction();<NEW_LINE>CriteriaBuilder cb = em.getCriteriaBuilder();<NEW_LINE>CriteriaQuery<Entity0018> cq = cb.createQuery(Entity0018.class);<NEW_LINE>Root<Entity0018> root = cq.from(Entity0018.class);<NEW_LINE>cq.select(root);<NEW_LINE>TypedQuery<Entity0018> tq = em.createQuery(cq);<NEW_LINE>Entity0018 findEntity = tq.getSingleResult();<NEW_LINE>System.out.println("Object returned by query: " + findEntity);<NEW_LINE>assertNotNull("Did not find entity in criteria query", findEntity);<NEW_LINE>assertTrue("Entity returned by find was not contained in the persistence context.", em.contains(findEntity));<NEW_LINE>assertEquals(new java.util.Date(18, 18, 18<MASK><NEW_LINE>assertEquals("Entity0018_STRING01", findEntity.getEntity0018_string01());<NEW_LINE>assertEquals("Entity0018_STRING02", findEntity.getEntity0018_string02());<NEW_LINE>assertEquals("Entity0018_STRING03", findEntity.getEntity0018_string03());<NEW_LINE>tx.commitTransaction();<NEW_LINE>} finally {<NEW_LINE>System.out.println(testName + ": End");<NEW_LINE>}<NEW_LINE>} | ), findEntity.getEntity0018_id()); |
1,770,777 | public IRubyObject initialize(ThreadContext context, ProtocolFamily family) {<NEW_LINE>Ruby runtime = context.runtime;<NEW_LINE>try {<NEW_LINE>this.family = family;<NEW_LINE>DatagramChannel channel = DatagramChannel.open(family);<NEW_LINE>initSocket(newChannelFD(runtime, channel));<NEW_LINE>} catch (ConnectException e) {<NEW_LINE>throw runtime.newErrnoECONNREFUSEDError();<NEW_LINE>} catch (UnknownHostException e) {<NEW_LINE>throw <MASK><NEW_LINE>} catch (UnsupportedOperationException uoe) {<NEW_LINE>if (uoe.getMessage().contains("IPv6 not available")) {<NEW_LINE>throw runtime.newErrnoEAFNOSUPPORTError("socket(2) - udp");<NEW_LINE>}<NEW_LINE>throw sockerr(runtime, "UnsupportedOperationException: " + uoe.getLocalizedMessage(), uoe);<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw sockerr(runtime, "initialize: name or service not known", e);<NEW_LINE>}<NEW_LINE>return this;<NEW_LINE>} | SocketUtils.sockerr(runtime, "initialize: name or service not known"); |
1,592,148 | public static void partialReduceDoubleMin(double[] inputArray, double[] outputArray, int gidx) {<NEW_LINE>int <MASK><NEW_LINE>int localGroupSize = SPIRVOCLIntrinsics.get_local_size(0);<NEW_LINE>int groupID = SPIRVOCLIntrinsics.get_group_id(0);<NEW_LINE>double[] localArray = (double[]) NewArrayNode.newUninitializedArray(double.class, LOCAL_WORK_GROUP_SIZE);<NEW_LINE>localArray[localIdx] = inputArray[gidx];<NEW_LINE>for (int stride = (localGroupSize / 2); stride > 0; stride /= 2) {<NEW_LINE>SPIRVOCLIntrinsics.localBarrier();<NEW_LINE>if (localIdx < stride) {<NEW_LINE>localArray[localIdx] = TornadoMath.min(localArray[localIdx], localArray[localIdx + stride]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>SPIRVOCLIntrinsics.globalBarrier();<NEW_LINE>if (localIdx == 0) {<NEW_LINE>outputArray[groupID + 1] = localArray[0];<NEW_LINE>}<NEW_LINE>} | localIdx = SPIRVOCLIntrinsics.get_local_id(0); |
1,405,442 | public static String printMethod(DexMethodData mth) {<NEW_LINE>SmaliCodeWriter codeWriter = new SmaliCodeWriter();<NEW_LINE>codeWriter.startLine(".method ");<NEW_LINE>codeWriter.add(AccessFlags.format(mth.getAccessFlags(), METHOD));<NEW_LINE><MASK><NEW_LINE>methodRef.load();<NEW_LINE>codeWriter.add(methodRef.getName());<NEW_LINE>codeWriter.add('(').addArgs(methodRef.getArgTypes()).add(')');<NEW_LINE>codeWriter.add(methodRef.getReturnType());<NEW_LINE>codeWriter.incIndent();<NEW_LINE>ICodeReader codeReader = mth.getCodeReader();<NEW_LINE>if (codeReader != null) {<NEW_LINE>codeWriter.startLine(".registers ").add(codeReader.getRegistersCount());<NEW_LINE>SmaliInsnFormat insnFormat = SmaliInsnFormat.getInstance();<NEW_LINE>InsnFormatterInfo formatterInfo = new InsnFormatterInfo(codeWriter, mth);<NEW_LINE>codeReader.visitInstructions(insn -> {<NEW_LINE>codeWriter.startLine();<NEW_LINE>formatterInfo.setInsn(insn);<NEW_LINE>insnFormat.format(formatterInfo);<NEW_LINE>});<NEW_LINE>codeWriter.decIndent();<NEW_LINE>}<NEW_LINE>codeWriter.startLine(".end method");<NEW_LINE>return codeWriter.getCode();<NEW_LINE>} | DexMethodRef methodRef = mth.getMethodRef(); |
1,428,387 | private static byte[] createCheckpointBytes(Path checkpointFile, Checkpoint checkpoint) throws IOException {<NEW_LINE>final ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream(V3_FILE_SIZE) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public synchronized byte[] toByteArray() {<NEW_LINE>// don't clone<NEW_LINE>return buf;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>final String resourceDesc = "checkpoint(path=\"" + checkpointFile + "\", gen=" + checkpoint + ")";<NEW_LINE>try (OutputStreamIndexOutput indexOutput = new OutputStreamIndexOutput(resourceDesc, checkpointFile.toString(), byteOutputStream, V3_FILE_SIZE)) {<NEW_LINE>CodecUtil.writeHeader(indexOutput, CHECKPOINT_CODEC, CURRENT_VERSION);<NEW_LINE>checkpoint.write(indexOutput);<NEW_LINE>CodecUtil.writeFooter(indexOutput);<NEW_LINE>assert indexOutput.getFilePointer() == V3_FILE_SIZE : "get you numbers straight; bytes written: " + indexOutput.getFilePointer() + ", buffer size: " + V3_FILE_SIZE;<NEW_LINE>assert indexOutput.getFilePointer() < 512 <MASK><NEW_LINE>}<NEW_LINE>return byteOutputStream.toByteArray();<NEW_LINE>} | : "checkpoint files have to be smaller than 512 bytes for atomic writes; size: " + indexOutput.getFilePointer(); |
994,255 | public void batchUpdateBlobs(BatchUpdateBlobsRequest request, StreamObserver<BatchUpdateBlobsResponse> responseObserver) {<NEW_LINE>try {<NEW_LINE>ImmutableList<UploadResult> uploadResults = storage.batchUpdateBlobs(request.getRequestsList().stream().map(blobRequest -> UploadDataSupplier.of(blobRequest.toString(), new GrpcDigest(blobRequest.getDigest()), () -> new ByteArrayInputStream(blobRequest.getData().toByteArray()))).collect(ImmutableList.toImmutableList()));<NEW_LINE>BatchUpdateBlobsResponse.Builder responseBuilder = BatchUpdateBlobsResponse.newBuilder();<NEW_LINE>for (UploadResult uploadResult : uploadResults) {<NEW_LINE>Builder statusBuilder = com.google.rpc.Status.newBuilder();<NEW_LINE>statusBuilder.setCode(uploadResult.status);<NEW_LINE>if (uploadResult.status != 0) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>responseBuilder.addResponses(Response.newBuilder().setDigest(GrpcProtocol.get(uploadResult.digest)).setStatus(statusBuilder.build()).build());<NEW_LINE>}<NEW_LINE>responseObserver.onNext(responseBuilder.build());<NEW_LINE>responseObserver.onCompleted();<NEW_LINE>} catch (Exception e) {<NEW_LINE>// idk how this should be done<NEW_LINE>e.printStackTrace();<NEW_LINE>responseObserver.onError(new StatusRuntimeException(Status.fromThrowable(e)));<NEW_LINE>}<NEW_LINE>} | statusBuilder.setMessage(uploadResult.message); |
270,638 | private static void copyUniqueAttribute(FileObject source, FileObject dest, String attrName) throws IOException {<NEW_LINE>Object <MASK><NEW_LINE>if (value == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>FileObject parent = dest.getParent();<NEW_LINE>if (parent == null || !(value instanceof String)) {<NEW_LINE>dest.setAttribute(attrName, value);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String valueBase = (String) value;<NEW_LINE>FileObject[] ch = parent.getChildren();<NEW_LINE>int i = 0;<NEW_LINE>while (true) {<NEW_LINE>boolean isValueInChildren = false;<NEW_LINE>for (int j = 0; j < ch.length; j++) {<NEW_LINE>Object v = ch[j].getAttribute(attrName);<NEW_LINE>if (value.equals(v)) {<NEW_LINE>isValueInChildren = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!isValueInChildren) {<NEW_LINE>dest.setAttribute(attrName, value);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>value = valueBase + " " + (++i);<NEW_LINE>}<NEW_LINE>} | value = source.getAttribute(attrName); |
1,183,678 | public void close(TaskAttemptContext attempt) throws IOException {<NEW_LINE>log.debug(<MASK><NEW_LINE>if (simulate)<NEW_LINE>return;<NEW_LINE>try {<NEW_LINE>mtbw.close();<NEW_LINE>} catch (MutationsRejectedException e) {<NEW_LINE>if (!e.getSecurityErrorCodes().isEmpty()) {<NEW_LINE>HashMap<String, Set<SecurityErrorCode>> tables = new HashMap<>();<NEW_LINE>e.getSecurityErrorCodes().forEach((tabletId, codes) -> tables.computeIfAbsent(tabletId.getTable().canonical(), k -> new HashSet<>()).addAll(codes));<NEW_LINE>log.error("Not authorized to write to tables : " + tables);<NEW_LINE>}<NEW_LINE>if (!e.getConstraintViolationSummaries().isEmpty()) {<NEW_LINE>log.error("Constraint violations : " + e.getConstraintViolationSummaries().size());<NEW_LINE>}<NEW_LINE>throw new IOException(e);<NEW_LINE>} finally {<NEW_LINE>client.close();<NEW_LINE>}<NEW_LINE>} | "mutations written: " + mutCount + ", values written: " + valCount); |
1,499,064 | public static NotificationHook fromInner(ClientLogger logger, HookInfo innerHook) {<NEW_LINE>if (innerHook instanceof EmailHookInfo) {<NEW_LINE>EmailHookInfo innerEmailHook = (EmailHookInfo) innerHook;<NEW_LINE>EmailNotificationHook emailHook = new EmailNotificationHook(innerEmailHook.getHookName(), innerEmailHook.<MASK><NEW_LINE>emailHook.setDescription(innerEmailHook.getDescription());<NEW_LINE>emailHook.setExternalLink(innerEmailHook.getExternalLink());<NEW_LINE>HookHelper.setId(emailHook, innerEmailHook.getHookId().toString());<NEW_LINE>emailHook.setAdmins(innerEmailHook.getAdmins());<NEW_LINE>return emailHook;<NEW_LINE>} else if (innerHook instanceof WebhookHookInfo) {<NEW_LINE>WebhookHookInfo innerWebHook = (WebhookHookInfo) innerHook;<NEW_LINE>WebNotificationHook webHook = new WebNotificationHook(innerWebHook.getHookName(), innerWebHook.getHookParameter().getEndpoint());<NEW_LINE>webHook.setDescription(innerWebHook.getDescription());<NEW_LINE>webHook.setExternalLink(innerWebHook.getExternalLink());<NEW_LINE>webHook.setUserCredentials(innerWebHook.getHookParameter().getUsername(), innerWebHook.getHookParameter().getPassword());<NEW_LINE>webHook.setClientCertificate(innerWebHook.getHookParameter().getCertificateKey(), innerWebHook.getHookParameter().getCertificatePassword());<NEW_LINE>Map<String, String> innerHeaders = innerWebHook.getHookParameter().getHeaders();<NEW_LINE>if (innerHeaders == null) {<NEW_LINE>innerHeaders = new HashMap<>();<NEW_LINE>}<NEW_LINE>webHook.setHttpHeaders(new HttpHeaders(innerHeaders));<NEW_LINE>HookHelper.setId(webHook, innerWebHook.getHookId().toString());<NEW_LINE>webHook.setAdmins(innerWebHook.getAdmins());<NEW_LINE>return webHook;<NEW_LINE>} else {<NEW_LINE>throw logger.logExceptionAsError(Exceptions.propagate(new RuntimeException(String.format("The hook type %s not supported", innerHook.getClass().getCanonicalName()))));<NEW_LINE>}<NEW_LINE>} | getHookParameter().getToList()); |
675,508 | private static void validateTopicConfig(final String name, final KsqlConfig ksqlConfig, final KafkaTopicClient topicClient) {<NEW_LINE>final TopicDescription description = topicClient.describeTopic(name);<NEW_LINE>final int actualPartitionCount = description.partitions().size();<NEW_LINE>if (actualPartitionCount != INTERNAL_TOPIC_PARTITION_COUNT) {<NEW_LINE>throw new IllegalStateException("Invalid partition count on topic " + "'" + name + "'. " + <MASK><NEW_LINE>}<NEW_LINE>final short replicationFactor = ksqlConfig.getShort(KsqlConfig.KSQL_INTERNAL_TOPIC_REPLICAS_PROPERTY);<NEW_LINE>final int actualRf = description.partitions().get(0).replicas().size();<NEW_LINE>if (actualRf < replicationFactor) {<NEW_LINE>throw new IllegalStateException("Invalid replication factor on topic " + "'" + name + "'. " + "Expected: " + replicationFactor + ", but was: " + actualRf);<NEW_LINE>}<NEW_LINE>if (replicationFactor < 2) {<NEW_LINE>log.warn("Topic {} has replication factor of {} which is less than 2. " + "This is not advisable in a production environment. ", name, replicationFactor);<NEW_LINE>}<NEW_LINE>final Map<String, String> existingConfig = topicClient.getTopicConfig(name);<NEW_LINE>if (topicClient.addTopicConfig(name, INTERNAL_TOPIC_CONFIG)) {<NEW_LINE>log.warn("Topic {} was created with or modified to have an invalid configuration: {} " + "- overriding the following configurations: {}", name, existingConfig, INTERNAL_TOPIC_CONFIG);<NEW_LINE>}<NEW_LINE>} | "Expected: " + INTERNAL_TOPIC_PARTITION_COUNT + ", but was: " + actualPartitionCount); |
146,674 | protected Component createAppFoldersPane() {<NEW_LINE>if (!webConfig.getFoldersPaneEnabled())<NEW_LINE>return null;<NEW_LINE>List<AppFolder> appFolders = foldersService.loadAppFolders();<NEW_LINE>if (appFolders.isEmpty())<NEW_LINE>return null;<NEW_LINE><MASK><NEW_LINE>appFoldersTree.setCubaId("appFoldersTree");<NEW_LINE>appFoldersTree.setDataProvider(createTreeDataProvider());<NEW_LINE>appFoldersTree.setGridSelectionModel(new CubaSingleSelectionModel<>());<NEW_LINE>appFoldersTree.setStyleGenerator(new FolderTreeStyleProvider<>());<NEW_LINE>appFoldersTree.addExpandListener(event -> {<NEW_LINE>AppFolder folder = event.getExpandedItem();<NEW_LINE>if (StringUtils.isBlank(folder.getQuantityScript())) {<NEW_LINE>folder.setQuantity(null);<NEW_LINE>folder.setItemStyle(null);<NEW_LINE>appFoldersTree.repaint();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>appFoldersTree.addCollapseListener(event -> {<NEW_LINE>AppFolder folder = event.getCollapsedItem();<NEW_LINE>if (StringUtils.isBlank(folder.getQuantityScript())) {<NEW_LINE>reloadSingleParentFolder(folder, null);<NEW_LINE>appFoldersTree.repaint();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>fillTree(appFoldersTree, appFolders);<NEW_LINE>appFoldersTree.addItemClickListener(new FolderClickListener<>());<NEW_LINE>appFoldersTree.setItemCaptionGenerator(this::getFolderTreeItemCaption);<NEW_LINE>initAppFoldersContextMenu();<NEW_LINE>appFoldersTree.expand(appFoldersTree.getItems().collect(Collectors.toList()));<NEW_LINE>return appFoldersTree;<NEW_LINE>} | appFoldersTree = new CubaTree<>(); |
1,818,441 | public void deleteById(String id) {<NEW_LINE>String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups");<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));<NEW_LINE>}<NEW_LINE>String resourceName = Utils.getValueFromIdByName(id, "signalR");<NEW_LINE>if (resourceName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'signalR'.", id)));<NEW_LINE>}<NEW_LINE>String certificateName = Utils.getValueFromIdByName(id, "customCertificates");<NEW_LINE>if (certificateName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'customCertificates'.", id)));<NEW_LINE>}<NEW_LINE>this.deleteWithResponse(resourceGroupName, <MASK><NEW_LINE>} | resourceName, certificateName, Context.NONE); |
955,762 | public void removeSubRecords(Class<? extends Model> klass, JsonContext jsonContext) throws ClassNotFoundException {<NEW_LINE>for (Property prop : Mapper.of(klass).getProperties()) {<NEW_LINE>if (prop.getTarget() == null || prop.isCollection()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String simpleModelName = StringUtils.substringAfterLast(prop.getTarget().getName(), ".");<NEW_LINE>String field = inflector.camelize(simpleModelName, true) + "Set";<NEW_LINE>if (!jsonContext.containsKey(field)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>List<Object> recList = (List<Object>) jsonContext.get(field);<NEW_LINE>String ids = recList.stream().map(obj -> {<NEW_LINE>Map<String, Object> recordMap = Mapper.toMap<MASK><NEW_LINE>return recordMap.get("id").toString();<NEW_LINE>}).collect(Collectors.joining(","));<NEW_LINE>JpaRepository<? extends Model> modelRepo = JpaRepository.of((Class<? extends Model>) Class.forName(prop.getTarget().getName()));<NEW_LINE>modelRepo.all().filter("self.id IN (" + ids + ")").delete();<NEW_LINE>}<NEW_LINE>} | (EntityHelper.getEntity(obj)); |
45,242 | protected ECKeyGenerationParameters createKeyGenParamsJCE(java.security.spec.ECParameterSpec p, SecureRandom r) {<NEW_LINE>if (p instanceof ECNamedCurveSpec) {<NEW_LINE>String curveName = ((ECNamedCurveSpec) p).getName();<NEW_LINE>X9ECParameters x9 = <MASK><NEW_LINE>if (null != x9) {<NEW_LINE>return createKeyGenParamsJCE(x9, r);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ECCurve curve = EC5Util.convertCurve(p.getCurve());<NEW_LINE>ECPoint g = EC5Util.convertPoint(curve, p.getGenerator());<NEW_LINE>BigInteger n = p.getOrder();<NEW_LINE>BigInteger h = BigInteger.valueOf(p.getCofactor());<NEW_LINE>ECDomainParameters dp = new ECDomainParameters(curve, g, n, h);<NEW_LINE>return new ECKeyGenerationParameters(dp, r);<NEW_LINE>} | ECUtils.getDomainParametersFromName(curveName, configuration); |
1,584,945 | public static void main(String[] args) {<NEW_LINE>Scanner s = new Scanner(System.in);<NEW_LINE>System.out.println("Of First Matrix");<NEW_LINE>System.out.println(" Enter number of rows ");<NEW_LINE>int rows_first = s.nextInt();<NEW_LINE><MASK><NEW_LINE>int columns_first = s.nextInt();<NEW_LINE>int[][] matrix1 = new int[rows_first][columns_first];<NEW_LINE>System.out.println("Of Second Matrix");<NEW_LINE>System.out.println(" Enter number of rows ");<NEW_LINE>int rows_second = s.nextInt();<NEW_LINE>System.out.println(" Enter number of columns ");<NEW_LINE>int columns_second = s.nextInt();<NEW_LINE>int[][] matrix2 = new int[rows_second][columns_second];<NEW_LINE>if (columns_first != columns_second || rows_first != rows_second) {<NEW_LINE>System.out.println(" Addition of matrix is not possible ");<NEW_LINE>} else {<NEW_LINE>System.out.println(" Enter elements of 1st matrix ");<NEW_LINE>for (int i = 0; i < rows_first; i++) {<NEW_LINE>for (int j = 0; j < columns_first; j++) {<NEW_LINE>matrix1[i][j] = s.nextInt();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>System.out.println(" Enter elements of 2nd matrix ");<NEW_LINE>for (int i = 0; i < rows_first; i++) {<NEW_LINE>for (int j = 0; j < columns_first; j++) {<NEW_LINE>matrix2[i][j] = s.nextInt();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>add_matrices(matrix1, matrix2);<NEW_LINE>}<NEW_LINE>} | System.out.println(" Enter number of columns "); |
18,148 | public static DescribeVirtualBorderRoutersResponse unmarshall(DescribeVirtualBorderRoutersResponse describeVirtualBorderRoutersResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeVirtualBorderRoutersResponse.setRequestId(_ctx.stringValue("DescribeVirtualBorderRoutersResponse.RequestId"));<NEW_LINE>describeVirtualBorderRoutersResponse.setPageNumber(_ctx.integerValue("DescribeVirtualBorderRoutersResponse.PageNumber"));<NEW_LINE>describeVirtualBorderRoutersResponse.setPageSize(_ctx.integerValue("DescribeVirtualBorderRoutersResponse.PageSize"));<NEW_LINE>describeVirtualBorderRoutersResponse.setTotalCount(_ctx.integerValue("DescribeVirtualBorderRoutersResponse.TotalCount"));<NEW_LINE>List<VirtualBorderRouterType> virtualBorderRouterSet = new ArrayList<VirtualBorderRouterType>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeVirtualBorderRoutersResponse.VirtualBorderRouterSet.Length"); i++) {<NEW_LINE>VirtualBorderRouterType virtualBorderRouterType = new VirtualBorderRouterType();<NEW_LINE>virtualBorderRouterType.setVlanInterfaceId(_ctx.stringValue("DescribeVirtualBorderRoutersResponse.VirtualBorderRouterSet[" + i + "].VlanInterfaceId"));<NEW_LINE>virtualBorderRouterType.setStatus(_ctx.stringValue("DescribeVirtualBorderRoutersResponse.VirtualBorderRouterSet[" + i + "].Status"));<NEW_LINE>virtualBorderRouterType.setCreationTime(_ctx.stringValue("DescribeVirtualBorderRoutersResponse.VirtualBorderRouterSet[" + i + "].CreationTime"));<NEW_LINE>virtualBorderRouterType.setCircuitCode(_ctx.stringValue("DescribeVirtualBorderRoutersResponse.VirtualBorderRouterSet[" + i + "].CircuitCode"));<NEW_LINE>virtualBorderRouterType.setPhysicalConnectionOwnerUid(_ctx.stringValue("DescribeVirtualBorderRoutersResponse.VirtualBorderRouterSet[" + i + "].PhysicalConnectionOwnerUid"));<NEW_LINE>virtualBorderRouterType.setLocalGatewayIp(_ctx.stringValue("DescribeVirtualBorderRoutersResponse.VirtualBorderRouterSet[" + i + "].LocalGatewayIp"));<NEW_LINE>virtualBorderRouterType.setActivationTime(_ctx.stringValue("DescribeVirtualBorderRoutersResponse.VirtualBorderRouterSet[" + i + "].ActivationTime"));<NEW_LINE>virtualBorderRouterType.setPhysicalConnectionBusinessStatus(_ctx.stringValue("DescribeVirtualBorderRoutersResponse.VirtualBorderRouterSet[" + i + "].PhysicalConnectionBusinessStatus"));<NEW_LINE>virtualBorderRouterType.setPeeringSubnetMask(_ctx.stringValue("DescribeVirtualBorderRoutersResponse.VirtualBorderRouterSet[" + i + "].PeeringSubnetMask"));<NEW_LINE>virtualBorderRouterType.setRouteTableId(_ctx.stringValue("DescribeVirtualBorderRoutersResponse.VirtualBorderRouterSet[" + i + "].RouteTableId"));<NEW_LINE>virtualBorderRouterType.setDescription(_ctx.stringValue("DescribeVirtualBorderRoutersResponse.VirtualBorderRouterSet[" + i + "].Description"));<NEW_LINE>virtualBorderRouterType.setPhysicalConnectionStatus(_ctx.stringValue("DescribeVirtualBorderRoutersResponse.VirtualBorderRouterSet[" + i + "].PhysicalConnectionStatus"));<NEW_LINE>virtualBorderRouterType.setRecoveryTime(_ctx.stringValue<MASK><NEW_LINE>virtualBorderRouterType.setTerminationTime(_ctx.stringValue("DescribeVirtualBorderRoutersResponse.VirtualBorderRouterSet[" + i + "].TerminationTime"));<NEW_LINE>virtualBorderRouterType.setPeerGatewayIp(_ctx.stringValue("DescribeVirtualBorderRoutersResponse.VirtualBorderRouterSet[" + i + "].PeerGatewayIp"));<NEW_LINE>virtualBorderRouterType.setName(_ctx.stringValue("DescribeVirtualBorderRoutersResponse.VirtualBorderRouterSet[" + i + "].Name"));<NEW_LINE>virtualBorderRouterType.setAccessPointId(_ctx.stringValue("DescribeVirtualBorderRoutersResponse.VirtualBorderRouterSet[" + i + "].AccessPointId"));<NEW_LINE>virtualBorderRouterType.setVbrId(_ctx.stringValue("DescribeVirtualBorderRoutersResponse.VirtualBorderRouterSet[" + i + "].VbrId"));<NEW_LINE>virtualBorderRouterType.setPhysicalConnectionId(_ctx.stringValue("DescribeVirtualBorderRoutersResponse.VirtualBorderRouterSet[" + i + "].PhysicalConnectionId"));<NEW_LINE>virtualBorderRouterType.setVlanId(_ctx.integerValue("DescribeVirtualBorderRoutersResponse.VirtualBorderRouterSet[" + i + "].VlanId"));<NEW_LINE>virtualBorderRouterSet.add(virtualBorderRouterType);<NEW_LINE>}<NEW_LINE>describeVirtualBorderRoutersResponse.setVirtualBorderRouterSet(virtualBorderRouterSet);<NEW_LINE>return describeVirtualBorderRoutersResponse;<NEW_LINE>} | ("DescribeVirtualBorderRoutersResponse.VirtualBorderRouterSet[" + i + "].RecoveryTime")); |
700,740 | public int onBackPressed() {<NEW_LINE>logDebug("onBackPressed");<NEW_LINE>cancelSearch();<NEW_LINE>int levelSearch = ((ManagerActivity) context).levelsSearch;<NEW_LINE>if (levelSearch >= 0) {<NEW_LINE>if (levelSearch > 0) {<NEW_LINE>MegaNode node = megaApi.getNodeByHandle(((ManagerActivity) context).getParentHandleSearch());<NEW_LINE>if (node == null) {<NEW_LINE>((ManagerActivity) context).setParentHandleSearch(-1);<NEW_LINE>} else {<NEW_LINE>MegaNode <MASK><NEW_LINE>if (parentNode == null) {<NEW_LINE>((ManagerActivity) context).setParentHandleSearch(-1);<NEW_LINE>} else {<NEW_LINE>((ManagerActivity) context).setParentHandleSearch(parentNode.getHandle());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>((ManagerActivity) context).setParentHandleSearch(-1);<NEW_LINE>}<NEW_LINE>((ManagerActivity) context).levelsSearch--;<NEW_LINE>clickAction();<NEW_LINE>int lastVisiblePosition = 0;<NEW_LINE>if (!lastPositionStack.empty()) {<NEW_LINE>lastVisiblePosition = lastPositionStack.pop();<NEW_LINE>logDebug("Pop of the stack " + lastVisiblePosition + " position");<NEW_LINE>}<NEW_LINE>logDebug("Scroll to " + lastVisiblePosition + " position");<NEW_LINE>if (lastVisiblePosition >= 0) {<NEW_LINE>if (((ManagerActivity) context).isList) {<NEW_LINE>mLayoutManager.scrollToPositionWithOffset(lastVisiblePosition, 0);<NEW_LINE>} else {<NEW_LINE>gridLayoutManager.scrollToPositionWithOffset(lastVisiblePosition, 0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return 2;<NEW_LINE>}<NEW_LINE>logDebug("levels == -1");<NEW_LINE>resetSelectedItems();<NEW_LINE>((ManagerActivity) context).showFabButton();<NEW_LINE>return 0;<NEW_LINE>} | parentNode = megaApi.getParentNode(node); |
1,278,637 | public void init() {<NEW_LINE>Panel topp = <MASK><NEW_LINE>string = new TextField("G%");<NEW_LINE>topp.add(string, BorderLayout.CENTER);<NEW_LINE>btn = new Button("Go7");<NEW_LINE>btn.addActionListener(this);<NEW_LINE>topp.add(btn, BorderLayout.EAST);<NEW_LINE>outp = new TextArea("", 20, 80, TextArea.SCROLLBARS_BOTH);<NEW_LINE>// setLayout (new BorderLayout());<NEW_LINE>// add (topp, BorderLayout.NORTH);<NEW_LINE>// add (outp, BorderLayout.CENTER);<NEW_LINE>url = getDocumentBase();<NEW_LINE>try {<NEW_LINE>String host = url.getHost();<NEW_LINE>if (host == null || host.length() < 1)<NEW_LINE>url = new URL("http", "localhost", 6666, "/SOAP");<NEW_LINE>else<NEW_LINE>url = new URL("http", url.getHost(), url.getPort(), "/SOAP");<NEW_LINE>} catch (Exception e) {<NEW_LINE>try {<NEW_LINE>url = new URL("http://localhost:6666/SOAP");<NEW_LINE>} catch (Exception e1) {<NEW_LINE>}<NEW_LINE>;<NEW_LINE>}<NEW_LINE>System.out.println(url.toString());<NEW_LINE>org.xmlsoap.rt.SoapTypeMapper.getCurrentTypeMapper().bindClassToTypeName(fishselect.class, "urn:openlinksw-com:virtuoso", "fishselect", false);<NEW_LINE>org.xmlsoap.rt.SoapTypeMapper.getCurrentTypeMapper().bindClassToTypeName(fishselectResponse.class, "urn:openlinksw-com:virtuoso", "fishselectResponse", false);<NEW_LINE>} | new Panel(new BorderLayout()); |
1,192,769 | public boolean permit(ReqContext context, String operation, Map topology_conf) {<NEW_LINE>if (!context.isImpersonating()) {<NEW_LINE>LOG.debug("Not an impersonation attempt.");<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>String impersonatingPrincipal = context.realPrincipal().getName();<NEW_LINE>String impersonatingUser = _ptol.toLocal(context.realPrincipal());<NEW_LINE>String userBeingImpersonated = _ptol.toLocal(context.principal());<NEW_LINE>InetAddress remoteAddress = context.remoteAddress();<NEW_LINE>LOG.info("user = {}, principal = {} is attmepting to impersonate user = {} for operation = {} from host = {}", impersonatingUser, impersonatingPrincipal, userBeingImpersonated, operation, remoteAddress);<NEW_LINE>if (!userImpersonationACL.containsKey(impersonatingPrincipal) && !userImpersonationACL.containsKey(impersonatingUser)) {<NEW_LINE>LOG.info("user = {}, principal = {} is trying to impersonate user {}, but config {} does not have entry for impersonating user or principal." + "Please see SECURITY.MD to learn how to configure users for impersonation.", impersonatingUser, impersonatingPrincipal, userBeingImpersonated, Config.NIMBUS_IMPERSONATION_ACL);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>ImpersonationACL principalACL = userImpersonationACL.get(impersonatingPrincipal);<NEW_LINE>ImpersonationACL userACL = userImpersonationACL.get(impersonatingUser);<NEW_LINE>Set<String> authorizedHosts = new HashSet<String>();<NEW_LINE>Set<String> authorizedGroups <MASK><NEW_LINE>if (principalACL != null) {<NEW_LINE>authorizedHosts.addAll(principalACL.authorizedHosts);<NEW_LINE>authorizedGroups.addAll(principalACL.authorizedGroups);<NEW_LINE>}<NEW_LINE>if (userACL != null) {<NEW_LINE>authorizedHosts.addAll(userACL.authorizedHosts);<NEW_LINE>authorizedGroups.addAll(userACL.authorizedGroups);<NEW_LINE>}<NEW_LINE>LOG.debug("user = {}, principal = {} is allowed to impersonate groups = {} from hosts = {} ", impersonatingUser, impersonatingPrincipal, authorizedGroups, authorizedHosts);<NEW_LINE>if (!isAllowedToImpersonateFromHost(authorizedHosts, remoteAddress)) {<NEW_LINE>LOG.info("user = {}, principal = {} is not allowed to impersonate from host {} ", impersonatingUser, impersonatingPrincipal, remoteAddress);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (!isAllowedToImpersonateUser(authorizedGroups, userBeingImpersonated)) {<NEW_LINE>LOG.info("user = {}, principal = {} is not allowed to impersonate any group that user {} is part of.", impersonatingUser, impersonatingPrincipal, userBeingImpersonated);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>LOG.info("Allowing impersonation of user {} by user {}", userBeingImpersonated, impersonatingUser);<NEW_LINE>return true;<NEW_LINE>} | = new HashSet<String>(); |
1,594,279 | private synchronized void updateAllNodes(AllNodes allNodes) {<NEW_LINE>if (includeCoordinator) {<NEW_LINE>currentWorkerCount = allNodes.getActiveNodes().size();<NEW_LINE>} else {<NEW_LINE>currentWorkerCount = Sets.difference(Sets.difference(allNodes.getActiveNodes(), allNodes.getActiveCoordinators()), allNodes.getActiveResourceManagers()).size();<NEW_LINE>}<NEW_LINE>currentCoordinatorCount = allNodes.getActiveCoordinators().size();<NEW_LINE>currentResourceManagerCount = allNodes.getActiveResourceManagers().size();<NEW_LINE>if (currentWorkerCount >= workerMinCount) {<NEW_LINE>List<SettableFuture<?>> listeners = ImmutableList.copyOf(workerSizeFutures);<NEW_LINE>workerSizeFutures.clear();<NEW_LINE>executor.submit(() -> listeners.forEach(listener -> listener.set(null)));<NEW_LINE>}<NEW_LINE>if (currentCoordinatorCount >= coordinatorMinCount) {<NEW_LINE>List<SettableFuture<?>> listeners = ImmutableList.copyOf(coordinatorSizeFutures);<NEW_LINE>coordinatorSizeFutures.clear();<NEW_LINE>executor.submit(() -> listeners.forEach(listener -> <MASK><NEW_LINE>}<NEW_LINE>} | listener.set(null))); |
451,375 | public JsonElement serialize(VersionSetting src, Type typeOfSrc, JsonSerializationContext context) {<NEW_LINE>if (src == null)<NEW_LINE>return JsonNull.INSTANCE;<NEW_LINE>JsonObject obj = new JsonObject();<NEW_LINE>obj.addProperty("usesGlobal", src.isUsesGlobal());<NEW_LINE>obj.addProperty("javaArgs", src.getJavaArgs());<NEW_LINE>obj.addProperty("minecraftArgs", src.getMinecraftArgs());<NEW_LINE>obj.addProperty("maxMemory", src.getMaxMemory() <= 0 ? OperatingSystem.SUGGESTED_MEMORY : src.getMaxMemory());<NEW_LINE>obj.addProperty("minMemory", src.getMinMemory());<NEW_LINE>obj.addProperty("autoMemory", src.isAutoMemory());<NEW_LINE>obj.addProperty("permSize", src.getPermSize());<NEW_LINE>obj.addProperty("width", src.getWidth());<NEW_LINE>obj.addProperty("height", src.getHeight());<NEW_LINE>obj.addProperty("javaDir", src.getJavaDir());<NEW_LINE>obj.addProperty("precalledCommand", src.getPreLaunchCommand());<NEW_LINE>obj.addProperty("postExitCommand", src.getPostExitCommand());<NEW_LINE>obj.addProperty("serverIp", src.getServerIp());<NEW_LINE>obj.addProperty("java", src.getJava());<NEW_LINE>obj.addProperty("wrapper", src.getWrapper());<NEW_LINE>obj.addProperty("fullscreen", src.isFullscreen());<NEW_LINE>obj.addProperty("noJVMArgs", src.isNoJVMArgs());<NEW_LINE>obj.addProperty(<MASK><NEW_LINE>obj.addProperty("notCheckJVM", src.isNotCheckJVM());<NEW_LINE>obj.addProperty("showLogs", src.isShowLogs());<NEW_LINE>obj.addProperty("gameDir", src.getGameDir());<NEW_LINE>obj.addProperty("launcherVisibility", src.getLauncherVisibility().ordinal());<NEW_LINE>obj.addProperty("processPriority", src.getProcessPriority().ordinal());<NEW_LINE>obj.addProperty("useNativeGLFW", src.isUseNativeGLFW());<NEW_LINE>obj.addProperty("useNativeOpenAL", src.isUseNativeOpenAL());<NEW_LINE>obj.addProperty("gameDirType", src.getGameDirType().ordinal());<NEW_LINE>obj.addProperty("defaultJavaPath", src.getDefaultJavaPath());<NEW_LINE>obj.addProperty("nativesDir", src.getNativesDir());<NEW_LINE>obj.addProperty("nativesDirType", src.getNativesDirType().ordinal());<NEW_LINE>obj.addProperty("versionIcon", src.getVersionIcon().ordinal());<NEW_LINE>return obj;<NEW_LINE>} | "notCheckGame", src.isNotCheckGame()); |
842,473 | protected List<String> validateHandshake(BitToUserHandshake inbound) throws RpcException {<NEW_LINE>// logger.debug("Handling handshake from bit to user. {}", inbound);<NEW_LINE>List<String> serverAuthMechanisms = null;<NEW_LINE>if (inbound.hasServerInfos()) {<NEW_LINE>serverInfos = inbound.getServerInfos();<NEW_LINE>}<NEW_LINE>supportedMethods = Sets.immutableEnumSet(inbound.getSupportedMethodsList());<NEW_LINE>switch(inbound.getStatus()) {<NEW_LINE>case SUCCESS:<NEW_LINE>break;<NEW_LINE>case AUTH_REQUIRED:<NEW_LINE>serverAuthMechanisms = ImmutableList.<MASK><NEW_LINE>setAuthComplete(false);<NEW_LINE>connection.setEncryption(inbound.hasEncrypted() && inbound.getEncrypted());<NEW_LINE>if (inbound.hasMaxWrappedSize()) {<NEW_LINE>connection.setMaxWrappedSize(inbound.getMaxWrappedSize());<NEW_LINE>}<NEW_LINE>logger.trace(String.format("Server requires authentication with encryption context %s before proceeding.", connection.getEncryptionCtxtString()));<NEW_LINE>break;<NEW_LINE>case AUTH_FAILED:<NEW_LINE>case RPC_VERSION_MISMATCH:<NEW_LINE>case UNKNOWN_FAILURE:<NEW_LINE>final String errMsg = String.format("Status: %s, Error Id: %s, Error message: %s", inbound.getStatus(), inbound.getErrorId(), inbound.getErrorMessage());<NEW_LINE>logger.error(errMsg);<NEW_LINE>throw new NonTransientRpcException(errMsg);<NEW_LINE>}<NEW_LINE>// Before starting SASL handshake validate if both client and server are compatible in their security<NEW_LINE>// requirements for the connection<NEW_LINE>validateSaslCompatibility(properties, serverAuthMechanisms);<NEW_LINE>return serverAuthMechanisms;<NEW_LINE>} | copyOf(inbound.getAuthenticationMechanismsList()); |
1,009,349 | private void doInvoke(Request request) {<NEW_LINE>Params p = toParams(request.parameters());<NEW_LINE>// allow garbage collection of request parameters<NEW_LINE>request.discardParameters();<NEW_LINE>// Make sure that the owner understands the protocol.<NEW_LINE>Protocol protocol = net.getOwner().getProtocol(p.protocolName);<NEW_LINE>if (protocol == null) {<NEW_LINE>replyError(request, p.version, protocol, p.traceLevel, new Error(ErrorCode.UNKNOWN_PROTOCOL, "Protocol '" + p.protocolName + "' is not known by " + serverIdent + "."));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Routable routable = protocol.decode(p.version, p.payload);<NEW_LINE>if (routable == null) {<NEW_LINE>replyError(request, p.version, protocol, p.traceLevel, new Error(ErrorCode.DECODE_ERROR, "Protocol '" + protocol.getName() + "' failed to decode routable."));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (routable instanceof Reply) {<NEW_LINE>replyError(request, p.version, protocol, p.traceLevel, new Error(ErrorCode.DECODE_ERROR, "Payload decoded to a reply when expecting a message."));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Message msg = (Message) routable;<NEW_LINE>if (p.route != null && p.route.length() > 0) {<NEW_LINE>msg.setRoute(net.getRoute(p.route));<NEW_LINE>}<NEW_LINE>msg.setContext(new ReplyContext(request, p.version, protocol));<NEW_LINE>msg.pushHandler(this);<NEW_LINE>msg.setRetryEnabled(p.retryEnabled);<NEW_LINE>msg.setRetry(p.retry);<NEW_LINE>msg.setTimeReceivedNow();<NEW_LINE>msg.setTimeRemaining(p.timeRemaining);<NEW_LINE>msg.getTrace(<MASK><NEW_LINE>if (msg.getTrace().shouldTrace(TraceLevel.SEND_RECEIVE)) {<NEW_LINE>msg.getTrace().trace(TraceLevel.SEND_RECEIVE, "Message (type " + msg.getType() + ") received at " + serverIdent + " for session '" + p.session + "'.");<NEW_LINE>}<NEW_LINE>net.getOwner().deliverMessage(msg, p.session);<NEW_LINE>} | ).setLevel(p.traceLevel); |
1,620,082 | public void accept(String key, float[] value) {<NEW_LINE>if (allowedPredicate.test(key)) {<NEW_LINE>double score = rescoreFn.applyAsDouble(key, scoreFn.applyAsDouble(value));<NEW_LINE>// Only proceed if score can possibly exceed (cached) minimum score in the queue.<NEW_LINE>if (score > topScoreLowerBound) {<NEW_LINE>// If full,<NEW_LINE>if (topN.size() >= howMany) {<NEW_LINE>// Must double-check against next value because new one may still not be bigger<NEW_LINE>if (score > (topScoreLowerBound = topN.peek().getSecond())) {<NEW_LINE>// Swap in new, larger value for old smallest one<NEW_LINE>topN.poll();<NEW_LINE>topN.add(new Pair<MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>topN.add(new Pair<>(key, score));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | <>(key, score)); |
1,685,146 | public static ClientMessage encodeRequest(java.lang.String name, java.util.Collection<com.hazelcast.internal.serialization.Data> keys, boolean replaceExistingValues) {<NEW_LINE>ClientMessage clientMessage = ClientMessage.createForEncode();<NEW_LINE>clientMessage.setRetryable(false);<NEW_LINE>clientMessage.setOperationName("Cache.LoadAll");<NEW_LINE>ClientMessage.Frame initialFrame = new ClientMessage.Frame(new byte[REQUEST_INITIAL_FRAME_SIZE], UNFRAGMENTED_MESSAGE);<NEW_LINE>encodeInt(initialFrame.content, TYPE_FIELD_OFFSET, REQUEST_MESSAGE_TYPE);<NEW_LINE>encodeInt(initialFrame.content, PARTITION_ID_FIELD_OFFSET, -1);<NEW_LINE>encodeBoolean(initialFrame.content, REQUEST_REPLACE_EXISTING_VALUES_FIELD_OFFSET, replaceExistingValues);<NEW_LINE>clientMessage.add(initialFrame);<NEW_LINE><MASK><NEW_LINE>ListMultiFrameCodec.encode(clientMessage, keys, DataCodec::encode);<NEW_LINE>return clientMessage;<NEW_LINE>} | StringCodec.encode(clientMessage, name); |
1,370,416 | private Object convert(String arg, Class<?> ctorArgClass, String pluginString, Class<?> pluginClass) throws IOException, URISyntaxException {<NEW_LINE>if (ctorArgClass.equals(URI.class)) {<NEW_LINE>return makeURL(arg).toURI();<NEW_LINE>}<NEW_LINE>if (ctorArgClass.equals(URL.class)) {<NEW_LINE>return makeURL(arg);<NEW_LINE>}<NEW_LINE>if (ctorArgClass.equals(File.class)) {<NEW_LINE>return new File(arg);<NEW_LINE>}<NEW_LINE>if (ctorArgClass.equals(String.class)) {<NEW_LINE>return arg;<NEW_LINE>}<NEW_LINE>if (ctorArgClass.equals(OutputStream.class)) {<NEW_LINE>if (arg == null) {<NEW_LINE>return defaultOutOrFailIfAlreadyUsed(pluginString);<NEW_LINE>} else {<NEW_LINE>return openStream(arg);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (ctorArgClass.equals(Appendable.class)) {<NEW_LINE>String recommendedParameters = Arrays.stream(CTOR_PARAMETERS).filter(c -> c != Appendable.class).map(Class::getName).collect(Collectors.joining(", "));<NEW_LINE>log.error(() -> String.format("The %s plugin class takes a java.lang.Appendable in its constructor, which is deprecated and will be removed in the next major release. It should be changed to accept one of %s", pluginClass.getName(), recommendedParameters));<NEW_LINE>return new UTF8OutputStreamWriter(openStream(arg));<NEW_LINE>}<NEW_LINE>throw new CucumberException(String.format("Cannot convert %s into a %s to pass to the %s plugin"<MASK><NEW_LINE>} | , arg, ctorArgClass, pluginString)); |
1,647,253 | private Object handleDateTime(Object value, MColumn column, MEXPFormatLine formatLine) throws ParseException {<NEW_LINE>String valueString = null;<NEW_LINE>// We are sure that value is not null<NEW_LINE>valueString = value.toString();<NEW_LINE>Object result = value;<NEW_LINE>if (DisplayType.Date == column.getAD_Reference_ID()) {<NEW_LINE>if (valueString != null) {<NEW_LINE>if (formatLine.getDateFormat() != null && !Util.isEmpty(formatLine.getDateFormat())) {<NEW_LINE>// "MM/dd/yyyy"; MM/dd/yyyy hh:mm:ss<NEW_LINE>customDateFormat = new SimpleDateFormat(formatLine.getDateFormat());<NEW_LINE>result = new Timestamp(customDateFormat.parse(valueString).getTime());<NEW_LINE>log.info("Custom Date Format; Parsed value = " + result.toString());<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (DisplayType.DateTime == column.getAD_Reference_ID()) {<NEW_LINE>if (valueString != null) {<NEW_LINE>if (formatLine.getDateFormat() != null && !Util.isEmpty(formatLine.getDateFormat())) {<NEW_LINE>// "MM/dd/yyyy"<NEW_LINE>customDateFormat = new SimpleDateFormat(formatLine.getDateFormat());<NEW_LINE>result = new Timestamp(customDateFormat.parse(valueString).getTime());<NEW_LINE>log.info("Custom Date Format; Parsed value = " + result.toString());<NEW_LINE>} else {<NEW_LINE>// NOW Using Standard Japanese Format yyyy-mm-dd hh:mi:ss.mil so don't care about formats....<NEW_LINE>result = Timestamp.valueOf(valueString);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | result = Timestamp.valueOf(valueString); |
1,790,715 | public static void removeProjectNature(IProject project, String nature, IProgressMonitor monitor) throws CoreException {<NEW_LINE>if (project != null && nature != null) {<NEW_LINE>if (project.exists() && project.hasNature(nature)) {<NEW_LINE>// first remove all problem markers (including the<NEW_LINE>// inherited ones) from Spring beans project<NEW_LINE>if (nature.equals(NATURE_ID)) {<NEW_LINE>project.deleteMarkers(MARKER_ID, true, IResource.DEPTH_INFINITE);<NEW_LINE>}<NEW_LINE>// now remove project nature<NEW_LINE>IProjectDescription desc = project.getDescription();<NEW_LINE>String[<MASK><NEW_LINE>String[] newNatures = new String[oldNatures.length - 1];<NEW_LINE>int newIndex = oldNatures.length - 2;<NEW_LINE>for (int i = oldNatures.length - 1; i >= 0; i--) {<NEW_LINE>if (!oldNatures[i].equals(nature)) {<NEW_LINE>newNatures[newIndex--] = oldNatures[i];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>desc.setNatureIds(newNatures);<NEW_LINE>project.setDescription(desc, monitor);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ] oldNatures = desc.getNatureIds(); |
797,356 | protected void updateStructure(boolean fromRoot, @Nonnull Set<? extends VirtualFile> updatedFiles) {<NEW_LINE>if (fromRoot) {<NEW_LINE>updateAll(null);<NEW_LINE>} else {<NEW_LINE>long time = System.currentTimeMillis();<NEW_LINE>LOG.debug("found ", <MASK><NEW_LINE>TreeCollector<VirtualFile> collector = TreeCollector.VirtualFileRoots.create();<NEW_LINE>for (VirtualFile file : updatedFiles) {<NEW_LINE>if (!file.isDirectory())<NEW_LINE>file = file.getParent();<NEW_LINE>if (file != null && findArea(file, project) != null)<NEW_LINE>collector.add(file);<NEW_LINE>}<NEW_LINE>List<VirtualFile> roots = collector.get();<NEW_LINE>LOG.debug("found ", roots.size(), " roots in ", System.currentTimeMillis() - time, "ms");<NEW_LINE>myStructureTreeModel.getInvoker().runOrInvokeLater(() -> roots.forEach(root -> updateByFile(root, true)));<NEW_LINE>}<NEW_LINE>} | updatedFiles.size(), " changed files"); |
8,851 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {<NEW_LINE>View view = inflater.inflate(R.layout.fragment_entry_list_view, container, false);<NEW_LINE>_progressBar = view.findViewById(R.id.progressBar);<NEW_LINE>_groupChip = view.findViewById(R.id.chip_group);<NEW_LINE>initializeGroupChip();<NEW_LINE>// set up the recycler view<NEW_LINE>_recyclerView = view.findViewById(R.id.rvKeyProfiles);<NEW_LINE>_recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onScrolled(RecyclerView recyclerView, int dx, int dy) {<NEW_LINE>super.onScrolled(recyclerView, dx, dy);<NEW_LINE>_listener.onScroll(dx, dy);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// set up icon preloading<NEW_LINE>_preloadSizeProvider = new ViewPreloadSizeProvider<>();<NEW_LINE>IconPreloadProvider modelProvider = new IconPreloadProvider();<NEW_LINE>RecyclerViewPreloader<VaultEntry> preloader = new RecyclerViewPreloader<>(Glide.with(this), modelProvider, _preloadSizeProvider, 10);<NEW_LINE>_recyclerView.addOnScrollListener(preloader);<NEW_LINE>LinearLayoutManager layoutManager = new LinearLayoutManager(view.getContext());<NEW_LINE>_recyclerView.setLayoutManager(layoutManager);<NEW_LINE>_touchCallback = new SimpleItemTouchHelperCallback(_adapter);<NEW_LINE>_touchHelper = new ItemTouchHelper(_touchCallback);<NEW_LINE>_touchHelper.attachToRecyclerView(_recyclerView);<NEW_LINE>_recyclerView.setAdapter(_adapter);<NEW_LINE>int resId = R.anim.layout_animation_fall_down;<NEW_LINE>LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(getContext(), resId);<NEW_LINE>_recyclerView.setLayoutAnimation(animation);<NEW_LINE>_refresher = new UiRefresher(new UiRefresher.Listener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onRefresh() {<NEW_LINE>refresh(false);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public long getMillisTillNextRefresh() {<NEW_LINE>return TotpInfo.<MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>_emptyStateView = view.findViewById(R.id.vEmptyList);<NEW_LINE>return view;<NEW_LINE>} | getMillisTillNextRotation(_adapter.getMostFrequentPeriod()); |
181,443 | public DeploymentReadyOption unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>DeploymentReadyOption deploymentReadyOption = new DeploymentReadyOption();<NEW_LINE><MASK><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("actionOnTimeout", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>deploymentReadyOption.setActionOnTimeout(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("waitTimeInMinutes", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>deploymentReadyOption.setWaitTimeInMinutes(context.getUnmarshaller(Integer.class).unmarshall(context));<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 deploymentReadyOption;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,299,826 | private short calcChecksum(InetAddress srcAddr, InetAddress dstAddr, byte[] header, byte[] payload) {<NEW_LINE>byte[] data;<NEW_LINE>int destPos;<NEW_LINE>int totalLength <MASK><NEW_LINE>boolean lowerLayerIsIpV4 = srcAddr instanceof Inet4Address;<NEW_LINE>int pseudoHeaderSize = lowerLayerIsIpV4 ? IPV4_PSEUDO_HEADER_SIZE : IPV6_PSEUDO_HEADER_SIZE;<NEW_LINE>if ((totalLength % 2) != 0) {<NEW_LINE>data = new byte[totalLength + 1 + pseudoHeaderSize];<NEW_LINE>destPos = totalLength + 1;<NEW_LINE>} else {<NEW_LINE>data = new byte[totalLength + pseudoHeaderSize];<NEW_LINE>destPos = totalLength;<NEW_LINE>}<NEW_LINE>System.arraycopy(header, 0, data, 0, header.length);<NEW_LINE>System.arraycopy(payload, 0, data, header.length, payload.length);<NEW_LINE>// pseudo header<NEW_LINE>System.arraycopy(srcAddr.getAddress(), 0, data, destPos, srcAddr.getAddress().length);<NEW_LINE>destPos += srcAddr.getAddress().length;<NEW_LINE>System.arraycopy(dstAddr.getAddress(), 0, data, destPos, dstAddr.getAddress().length);<NEW_LINE>destPos += dstAddr.getAddress().length;<NEW_LINE>if (lowerLayerIsIpV4) {<NEW_LINE>// data[destPos] = (byte)0;<NEW_LINE>destPos++;<NEW_LINE>} else {<NEW_LINE>destPos += 3;<NEW_LINE>}<NEW_LINE>data[destPos] = IpNumber.UDP.value();<NEW_LINE>destPos++;<NEW_LINE>System.arraycopy(ByteArrays.toByteArray((short) totalLength), 0, data, destPos, SHORT_SIZE_IN_BYTES);<NEW_LINE>destPos += SHORT_SIZE_IN_BYTES;<NEW_LINE>return ByteArrays.calcChecksum(data);<NEW_LINE>} | = payload.length + length(); |
506,215 | void refreshStorageBreakdown(@NonNull Context context) {<NEW_LINE>SignalExecutors.BOUNDED.execute(() -> {<NEW_LINE>MediaDatabase.StorageBreakdown breakdown = SignalDatabase.media().getStorageBreakdown();<NEW_LINE>StorageGraphView.StorageBreakdown latestStorageBreakdown = new StorageGraphView.StorageBreakdown(Arrays.asList(new StorageGraphView.Entry(ContextCompat.getColor(context, R.color.storage_color_photos), breakdown.getPhotoSize()), new StorageGraphView.Entry(ContextCompat.getColor(context, R.color.storage_color_videos), breakdown.getVideoSize()), new StorageGraphView.Entry(ContextCompat.getColor(context, R.color.storage_color_files), breakdown.getDocumentSize()), new StorageGraphView.Entry(ContextCompat.getColor(context, R.color.storage_color_audio), <MASK><NEW_LINE>storageBreakdown.postValue(latestStorageBreakdown);<NEW_LINE>});<NEW_LINE>} | breakdown.getAudioSize()))); |
1,150,105 | public void encodeColumnFooter(FacesContext context, DataTable table, UIColumn column) throws IOException {<NEW_LINE>if (!column.isRendered()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ColumnMeta columnMeta = table.getColumnMeta().get(column.getColumnKey());<NEW_LINE><MASK><NEW_LINE>int responsivePriority = column.getResponsivePriority();<NEW_LINE>String style = column.getStyle();<NEW_LINE>String styleClass = column.getStyleClass();<NEW_LINE>styleClass = styleClass == null ? DataTable.COLUMN_FOOTER_CLASS : DataTable.COLUMN_FOOTER_CLASS + " " + styleClass;<NEW_LINE>boolean columnVisible = column.isVisible();<NEW_LINE>if (columnMeta != null && columnMeta.getVisible() != null) {<NEW_LINE>columnVisible = columnMeta.getVisible();<NEW_LINE>}<NEW_LINE>if (!columnVisible) {<NEW_LINE>styleClass = styleClass + " " + DataTable.HIDDEN_COLUMN_CLASS;<NEW_LINE>}<NEW_LINE>if (responsivePriority > 0) {<NEW_LINE>styleClass = styleClass + " ui-column-p-" + responsivePriority;<NEW_LINE>}<NEW_LINE>writer.startElement("td", null);<NEW_LINE>writer.writeAttribute("class", styleClass, null);<NEW_LINE>if (style != null) {<NEW_LINE>writer.writeAttribute("style", style, null);<NEW_LINE>}<NEW_LINE>if (column.getRowspan() != 1) {<NEW_LINE>writer.writeAttribute("rowspan", column.getRowspan(), null);<NEW_LINE>}<NEW_LINE>if (column.getColspan() != 1) {<NEW_LINE>writer.writeAttribute("colspan", column.getColspan(), null);<NEW_LINE>}<NEW_LINE>// Footer content<NEW_LINE>UIComponent facet = column.getFacet("footer");<NEW_LINE>String text = column.getFooterText();<NEW_LINE>if (ComponentUtils.shouldRenderFacet(facet, table.isRenderEmptyFacets())) {<NEW_LINE>facet.encodeAll(context);<NEW_LINE>} else if (text != null) {<NEW_LINE>if (table.isEscapeText()) {<NEW_LINE>writer.writeText(text, "footerText");<NEW_LINE>} else {<NEW_LINE>writer.write(text);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>writer.endElement("td");<NEW_LINE>} | ResponseWriter writer = context.getResponseWriter(); |
1,248,169 | public FunctionalIterator<Map<Identifier.Variable, Concept>> materialise(ConceptMap whenConcepts, TraversalEngine traversalEng, ConceptManager conceptMgr) {<NEW_LINE>Identifier.Variable relationTypeIdentifier = isa()<MASK><NEW_LINE>RelationType relationType = relationType(whenConcepts, conceptMgr);<NEW_LINE>FunctionalIterator<com.vaticle.typedb.core.concept.thing.Relation> existingRelations = matchRelation(relationType, whenConcepts, traversalEng, conceptMgr);<NEW_LINE>if (existingRelations.hasNext()) {<NEW_LINE>return existingRelations.map(rel -> {<NEW_LINE>Map<Identifier.Variable, Concept> thenConcepts = new HashMap<>();<NEW_LINE>thenConcepts.put(relationTypeIdentifier, relationType);<NEW_LINE>thenConcepts.put(isa().owner().id(), rel);<NEW_LINE>relation().players().forEach(rp -> {<NEW_LINE>thenConcepts.putIfAbsent(rp.roleType().get().id(), getRole(rp, relationType, whenConcepts));<NEW_LINE>thenConcepts.putIfAbsent(rp.player().id(), whenConcepts.get(rp.player().id()));<NEW_LINE>});<NEW_LINE>return thenConcepts;<NEW_LINE>});<NEW_LINE>} else {<NEW_LINE>return insert(relationType, whenConcepts, conceptMgr);<NEW_LINE>}<NEW_LINE>} | .type().id(); |
1,544,090 | static JsonNode convertToTree(MatchResult result, boolean elevation, boolean pointsEncoded) {<NEW_LINE>ObjectNode root = JsonNodeFactory.instance.objectNode();<NEW_LINE>ObjectNode diary = root.putObject("diary");<NEW_LINE>ArrayNode entries = diary.putArray("entries");<NEW_LINE>ObjectNode route = entries.addObject();<NEW_LINE>ArrayNode links = route.putArray("links");<NEW_LINE>for (int emIndex = 0; emIndex < result.getEdgeMatches().size(); emIndex++) {<NEW_LINE>ObjectNode link = links.addObject();<NEW_LINE>EdgeMatch edgeMatch = result.<MASK><NEW_LINE>PointList pointList = edgeMatch.getEdgeState().fetchWayGeometry(emIndex == 0 ? FetchMode.ALL : FetchMode.PILLAR_AND_ADJ);<NEW_LINE>final ObjectNode geometry = link.putObject("geometry");<NEW_LINE>if (pointList.size() < 2) {<NEW_LINE>geometry.putPOJO("coordinates", pointsEncoded ? WebHelper.encodePolyline(pointList, elevation) : pointList.toLineString(elevation));<NEW_LINE>geometry.put("type", "Point");<NEW_LINE>} else {<NEW_LINE>geometry.putPOJO("coordinates", pointsEncoded ? WebHelper.encodePolyline(pointList, elevation) : pointList.toLineString(elevation));<NEW_LINE>geometry.put("type", "LineString");<NEW_LINE>}<NEW_LINE>link.put("id", edgeMatch.getEdgeState().getEdge());<NEW_LINE>ArrayNode wpts = link.putArray("wpts");<NEW_LINE>for (State extension : edgeMatch.getStates()) {<NEW_LINE>ObjectNode wpt = wpts.addObject();<NEW_LINE>wpt.put("x", extension.getSnap().getSnappedPoint().lon);<NEW_LINE>wpt.put("y", extension.getSnap().getSnappedPoint().lat);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return root;<NEW_LINE>} | getEdgeMatches().get(emIndex); |
1,224,053 | protected void startUp() {<NEW_LINE>long traceId = LoggerHelpers.traceEnterWithContext(log, this.objectId, "startUp");<NEW_LINE>try {<NEW_LINE>log.info("Attempting to start all event processors in {}", this.toString());<NEW_LINE>eventProcessorMap.entrySet().forEach(entry -> entry.getValue().startAsync());<NEW_LINE>eventProcessorMap.entrySet().forEach(entry -> entry.getValue().awaitStartupComplete());<NEW_LINE>log.info("All event processors in {} started successfully.", this.toString());<NEW_LINE>if (rebalancePeriodMillis > 0 && rebalanceExecutor != null) {<NEW_LINE>rebalanceFuture = rebalanceExecutor.scheduleWithFixedDelay(this::rebalance, <MASK><NEW_LINE>} else {<NEW_LINE>rebalanceFuture = null;<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>LoggerHelpers.traceLeave(log, this.objectId, "startUp", traceId);<NEW_LINE>}<NEW_LINE>} | rebalancePeriodMillis, rebalancePeriodMillis, TimeUnit.MILLISECONDS); |
1,050,741 | private void configureLogLevelForPrefix(final String loggerPrefix, final Object levelValue) {<NEW_LINE>final LogLevel newLevel;<NEW_LINE>if (levelValue instanceof Boolean && !((boolean) levelValue)) {<NEW_LINE>// SnakeYAML converts OFF (without quotations) to a boolean false value, hence we need to handle that here...<NEW_LINE>newLevel = LogLevel.OFF;<NEW_LINE>} else {<NEW_LINE>newLevel = toLogLevel(levelValue.toString());<NEW_LINE>}<NEW_LINE>if (newLevel == null) {<NEW_LINE>throw new ConfigurationException("Invalid log level: '" + levelValue + "' for logger: '" + loggerPrefix + "'");<NEW_LINE>}<NEW_LINE>if (LOGGER.isDebugEnabled()) {<NEW_LINE>LOGGER.<MASK><NEW_LINE>}<NEW_LINE>LOGGER.info("Setting log level '{}' for logger: '{}'", newLevel, loggerPrefix);<NEW_LINE>for (LoggingSystem loggingSystem : loggingSystems) {<NEW_LINE>loggingSystem.setLogLevel(loggerPrefix, newLevel);<NEW_LINE>}<NEW_LINE>} | debug("Setting log level '{}' for logger: '{}'", newLevel, loggerPrefix); |
1,851,104 | private void removeInput(int index, int oldCount) {<NEW_LINE>// force an Entry column of each row.input to 'x', then remove it<NEW_LINE>// _0001000<NEW_LINE>final var b = (1 << (oldCount - 1 - index));<NEW_LINE>final var changed = new boolean[columns.size()];<NEW_LINE>// loop rows by index to avoid java.util.ConcurrentModificationException<NEW_LINE>// noinspection ForLoopReplaceableByForEach<NEW_LINE>for (var i = 0; i < rows.size(); ++i) {<NEW_LINE>final var <MASK><NEW_LINE>if (r.inputs[index] == Entry.DONT_CARE)<NEW_LINE>continue;<NEW_LINE>// mutates row<NEW_LINE>setDontCare(r, b, true, changed);<NEW_LINE>}<NEW_LINE>// _0000111<NEW_LINE>final var mask = b - 1;<NEW_LINE>final var ret = new ArrayList<Row>(rows.size());<NEW_LINE>for (final var r : rows) {<NEW_LINE>final var i = r.baseIndex();<NEW_LINE>final var dc = r.dcMask();<NEW_LINE>// __xxxyyy<NEW_LINE>final var idx0 = ((i >> 1) & ~mask) | (i & mask);<NEW_LINE>// wwww0zzz<NEW_LINE>final var dc0 = ((dc >> 1) & ~mask) | (dc & mask);<NEW_LINE>ret.add(new Row(idx0, oldCount - 1, dc0));<NEW_LINE>}<NEW_LINE>ret.sort(sortByInputs);<NEW_LINE>rows = ret;<NEW_LINE>} | r = rows.get(i); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.