idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
257,002 | protected void internalTransform(Body b, String phaseName, Map<String, String> options) {<NEW_LINE>if (b == null) {<NEW_LINE>throw new NullPointerException();<NEW_LINE>}<NEW_LINE>final Date start;<NEW_LINE>if (Options.v().verbose()) {<NEW_LINE>start = new Date();<NEW_LINE>logger.debug("[TypeAssigner] typing system started on " + start);<NEW_LINE>} else {<NEW_LINE>start = null;<NEW_LINE>}<NEW_LINE>final JBTROptions opt = new JBTROptions(options);<NEW_LINE>final JimpleBody jb = (JimpleBody) b;<NEW_LINE>//<NEW_LINE>// Setting this guard to true enables comparison of the original and new type assigners.<NEW_LINE>// This will be slow since type assignment will always happen twice. The actual types<NEW_LINE>// used for Jimple are determined by the use-old-type-assigner option.<NEW_LINE>//<NEW_LINE>// Each comparison is written as a separate semicolon-delimited line to the standard<NEW_LINE>// output, and the first field is always 'cmp' for use in grep. The format is:<NEW_LINE>//<NEW_LINE>// cmp;Method Name;Stmt Count;Old Inference Time (ms); New Inference Time (ms);Typing Comparison<NEW_LINE>//<NEW_LINE>// The Typing Comparison field compares the old and new typings:<NEW_LINE>// -2 = Old typing contains fewer variables (BAD!)<NEW_LINE>// -1 = Old typing is tighter (BAD!)<NEW_LINE>// 0 = Typings are equal<NEW_LINE>// 1 = New typing is tighter<NEW_LINE>// 2 = New typing contains fewer variables<NEW_LINE>// 3 = Typings are incomparable (inspect manually)<NEW_LINE>//<NEW_LINE>// In a final release this guard, and anything in the first branch, would probably be removed.<NEW_LINE>//<NEW_LINE>if (opt.compare_type_assigners()) {<NEW_LINE>compareTypeAssigners(jb, opt.use_older_type_assigner());<NEW_LINE>} else {<NEW_LINE>if (opt.use_older_type_assigner()) {<NEW_LINE>soot.jimple.toolkits.typing.TypeResolver.resolve(jb, Scene.v());<NEW_LINE>} else {<NEW_LINE>(new soot.jimple.toolkits.typing.fast.TypeResolver<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (Options.v().verbose()) {<NEW_LINE>Date finish = new Date();<NEW_LINE>long runtime = finish.getTime() - start.getTime();<NEW_LINE>long mins = runtime / 60000;<NEW_LINE>long secs = (runtime % 60000) / 1000;<NEW_LINE>logger.debug("[TypeAssigner] typing system ended. It took " + mins + " mins and " + secs + " secs.");<NEW_LINE>}<NEW_LINE>if (!opt.ignore_nullpointer_dereferences()) {<NEW_LINE>replaceNullType(jb);<NEW_LINE>}<NEW_LINE>if (typingFailed(jb)) {<NEW_LINE>throw new RuntimeException("type inference failed!");<NEW_LINE>}<NEW_LINE>} | (jb)).inferTypes(); |
1,791,594 | protected BitSet routeAndBuildPartBitSet(ExecutionContext context, PartPruneStepPruningContext pruningCtx, BitSet allPartBitSet) {<NEW_LINE>ComparisonKind[] cmpKindOutput = new ComparisonKind[1];<NEW_LINE>SearchDatumInfo finalVal = null;<NEW_LINE>try {<NEW_LINE>// Compute the const expr val for part predicate<NEW_LINE>finalVal = buildSearchDatumInfoForPredData(context, pruningCtx, cmpKindOutput);<NEW_LINE>} catch (Throwable ex) {<NEW_LINE>if (ex instanceof InvalidTypeConversionException) {<NEW_LINE>return PartitionPrunerUtils.buildFullScanPartitionsBitSet(this.partInfo);<NEW_LINE>} else {<NEW_LINE>throw ex;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// find the target partition position set<NEW_LINE>PartitionRouter.RouterResult result = router.routePartitions(context, cmpKindOutput[0], finalVal);<NEW_LINE>// Save the pruned result into bitset<NEW_LINE>if (result.strategy != PartitionStrategy.LIST && result.strategy != PartitionStrategy.LIST_COLUMNS) {<NEW_LINE>PartitionPrunerUtils.setPartBitSetByStartEnd(allPartBitSet, result.partStartPosi, result.pasrEndPosi, matchLevel, partCount, subPartCount, true);<NEW_LINE>} else {<NEW_LINE>PartitionPrunerUtils.setPartBitSetForPartList(allPartBitSet, result.partPosiSet, <MASK><NEW_LINE>}<NEW_LINE>return allPartBitSet;<NEW_LINE>} | matchLevel, partCount, subPartCount, true); |
639,806 | final GetTransitGatewayMulticastDomainAssociationsResult executeGetTransitGatewayMulticastDomainAssociations(GetTransitGatewayMulticastDomainAssociationsRequest getTransitGatewayMulticastDomainAssociationsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getTransitGatewayMulticastDomainAssociationsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetTransitGatewayMulticastDomainAssociationsRequest> request = null;<NEW_LINE>Response<GetTransitGatewayMulticastDomainAssociationsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetTransitGatewayMulticastDomainAssociationsRequestMarshaller().marshall(super.beforeMarshalling(getTransitGatewayMulticastDomainAssociationsRequest));<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(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EC2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetTransitGatewayMulticastDomainAssociations");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<GetTransitGatewayMulticastDomainAssociationsResult> responseHandler = new StaxResponseHandler<GetTransitGatewayMulticastDomainAssociationsResult>(new GetTransitGatewayMulticastDomainAssociationsResultStaxUnmarshaller());<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.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); |
1,460,447 | private TreeNode removeHelper(TreeNode subtreeRoot, TreeNode nodeToRemove) {<NEW_LINE>if (subtreeRoot == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (nodeToRemove.compareTo(subtreeRoot) < 0) {<NEW_LINE>subtreeRoot.left = removeHelper(subtreeRoot.left, nodeToRemove);<NEW_LINE>} else if (nodeToRemove.compareTo(subtreeRoot) > 0) {<NEW_LINE>subtreeRoot.right = removeHelper(subtreeRoot.right, nodeToRemove);<NEW_LINE>} else {<NEW_LINE>if (subtreeRoot.left == null) {<NEW_LINE>TreeNode right = subtreeRoot.right;<NEW_LINE>subtreeRoot.clearPointers();<NEW_LINE>return right;<NEW_LINE>} else if (subtreeRoot.right == null) {<NEW_LINE>TreeNode left = subtreeRoot.left;<NEW_LINE>subtreeRoot.clearPointers();<NEW_LINE>return left;<NEW_LINE>}<NEW_LINE>// Cache reference to this subtree root, we will replace its reference<NEW_LINE>TreeNode oldSubtreeRoot = subtreeRoot;<NEW_LINE>TreeNode <MASK><NEW_LINE>subtreeRoot = newSubtreeRoot;<NEW_LINE>// Wire up the right of the 'newSubtreeRoot'<NEW_LINE>newSubtreeRoot.right = removeHelper(oldSubtreeRoot.right, newSubtreeRoot);<NEW_LINE>newSubtreeRoot.left = oldSubtreeRoot.left;<NEW_LINE>oldSubtreeRoot.clearPointers();<NEW_LINE>}<NEW_LINE>return subtreeRoot;<NEW_LINE>} | newSubtreeRoot = minimum(oldSubtreeRoot.right); |
733,935 | public void translate(ProxySession session, ServerEntityRemoveEffectPacket packet) {<NEW_LINE>CachedEntity cachedEntity = session.getEntityCache().getByRemoteId(packet.getEntityId());<NEW_LINE>if (cachedEntity == null) {<NEW_LINE>// log.warn("Cached entity is null");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>EntityEffectTranslator.BedrockEffect effect = EntityEffectTranslator.translateToBedrock(packet.getEffect());<NEW_LINE>if (effect == null) {<NEW_LINE>log.warn("Cannot translate effect: " + packet.getEffect().name());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>MobEffectPacket mobEffectPacket = new MobEffectPacket();<NEW_LINE>mobEffectPacket.setRuntimeEntityId(packet.getEntityId());<NEW_LINE>// We add 1 as enums begin at 0<NEW_LINE>mobEffectPacket.setEffectId(effect.ordinal() + 1);<NEW_LINE>mobEffectPacket.setEvent(MobEffectPacket.Event.REMOVE);<NEW_LINE>mobEffectPacket.setParticles(false);<NEW_LINE>mobEffectPacket.setDuration(0);<NEW_LINE>mobEffectPacket.setAmplifier(0);<NEW_LINE>session.sendPacket(mobEffectPacket);<NEW_LINE>// Remove the effect from the cached entity<NEW_LINE>cachedEntity.<MASK><NEW_LINE>} | getEffects().remove(effect); |
1,814,315 | protected void onResume() {<NEW_LINE>super.onResume();<NEW_LINE>// CameraManager must be initialized here, not in onCreate(). This is necessary because we don't<NEW_LINE>// want to open the camera driver and measure the screen size if we're going to show the help on<NEW_LINE>// first launch. That led to bugs where the scanning rectangle was the wrong size and partially<NEW_LINE>// off screen.<NEW_LINE>cameraManager = new CameraManager(getApplication());<NEW_LINE>viewfinderView = new ViewfinderView(this, null);<NEW_LINE>viewfinderView.setCameraManager(cameraManager);<NEW_LINE>frameLayout.addView(viewfinderView);<NEW_LINE>handler = null;<NEW_LINE>lastResult = null;<NEW_LINE>if (surfaceView == null) {<NEW_LINE>surfaceView = new SurfaceView(this);<NEW_LINE>viewLayout.addView(surfaceView);<NEW_LINE>}<NEW_LINE>SurfaceHolder surfaceHolder = surfaceView.getHolder();<NEW_LINE>if (hasSurface) {<NEW_LINE>// The activity was paused but not stopped, so the surface still exists. Therefore<NEW_LINE>// surfaceCreated() won't be called, so init the camera here.<NEW_LINE>initCamera(surfaceHolder);<NEW_LINE>} else {<NEW_LINE>// Install the callback and wait for surfaceCreated() to init the camera.<NEW_LINE>surfaceHolder.addCallback(this);<NEW_LINE>surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);<NEW_LINE>}<NEW_LINE>surfaceView.setVisibility(View.VISIBLE);<NEW_LINE>Intent intent = getIntent();<NEW_LINE>copyToClipboard = true;<NEW_LINE>source = IntentSource.NONE;<NEW_LINE>decodeFormats = null;<NEW_LINE>characterSet = null;<NEW_LINE>if (intent != null) {<NEW_LINE>String action = intent.getAction();<NEW_LINE>String dataString = intent.getDataString();<NEW_LINE>if (Intents.Scan.ACTION.equals(action)) {<NEW_LINE>// Scan the formats the intent requested, and return the result to the calling activity.<NEW_LINE>source = IntentSource.NATIVE_APP_INTENT;<NEW_LINE>decodeFormats = DecodeFormatManager.parseDecodeFormats(intent);<NEW_LINE>if (intent.hasExtra(Intents.Scan.WIDTH) && intent.hasExtra(Intents.Scan.HEIGHT)) {<NEW_LINE>int width = intent.getIntExtra(<MASK><NEW_LINE>int height = intent.getIntExtra(Intents.Scan.HEIGHT, 0);<NEW_LINE>if (width > 0 && height > 0) {<NEW_LINE>cameraManager.setManualFramingRect(width, height);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>characterSet = intent.getStringExtra(Intents.Scan.CHARACTER_SET);<NEW_LINE>}<NEW_LINE>} | Intents.Scan.WIDTH, 0); |
1,692,525 | public synchronized void purgeInactiveProducers() {<NEW_LINE>long minimumActiveTimestamp = System.currentTimeMillis() - TimeUnit.MINUTES.toMillis(pulsar.getConfiguration().getBrokerDeduplicationProducerInactivityTimeoutMinutes());<NEW_LINE>Iterator<java.util.Map.Entry<String, Long>> mapIterator = inactiveProducers<MASK><NEW_LINE>while (mapIterator.hasNext()) {<NEW_LINE>java.util.Map.Entry<String, Long> entry = mapIterator.next();<NEW_LINE>String producerName = entry.getKey();<NEW_LINE>long lastActiveTimestamp = entry.getValue();<NEW_LINE>mapIterator.remove();<NEW_LINE>if (lastActiveTimestamp < minimumActiveTimestamp) {<NEW_LINE>log.info("[{}] Purging dedup information for producer {}", topic.getName(), producerName);<NEW_LINE>highestSequencedPushed.remove(producerName);<NEW_LINE>highestSequencedPersisted.remove(producerName);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .entrySet().iterator(); |
1,480,487 | final TagResourceResult executeTagResource(TagResourceRequest tagResourceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(tagResourceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<TagResourceRequest> request = null;<NEW_LINE>Response<TagResourceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new TagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(tagResourceRequest));<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, "SESv2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "TagResource");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<TagResourceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new TagResourceResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
1,177,277 | public void onApplicationEvent(ConsumerMetricsCollectedEvent event) {<NEW_LINE>List<ConsumerMetrics> metricsList = event.getMetricsList();<NEW_LINE>if (ValidateUtils.isEmptyList(metricsList)) {<NEW_LINE>LOGGER.warn("produce consumer metrics failed, data is empty.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>TopicNameConfig config = configService.getByKey(ConfigConstant.PRODUCE_CONSUMER_METRICS_CONFIG_KEY, TopicNameConfig.class);<NEW_LINE>if (ValidateUtils.isNull(config) || !config.legal()) {<NEW_LINE>LOGGER.warn("produce consumer metrics failed, config illegal, config:{}.", config);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>for (ConsumerMetrics consumerMetrics : metricsList) {<NEW_LINE>try {<NEW_LINE>convertAndProduceMetrics(consumerMetrics, config, now);<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error("convert and produce failed, metrics:{}.", consumerMetrics);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Long now = System.currentTimeMillis(); |
1,674,040 | public UserIdentityConfiguration unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>UserIdentityConfiguration userIdentityConfiguration = new UserIdentityConfiguration();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("IdentityAttributeName", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>userIdentityConfiguration.setIdentityAttributeName(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return userIdentityConfiguration;<NEW_LINE>} | class).unmarshall(context)); |
1,166,505 | public static void main(String[] args) {<NEW_LINE>StaticBinding obj = new StaticBinding();<NEW_LINE>// "Adding integers" due to auto-boxing from int to Integer<NEW_LINE>obj.sum(2, 3);<NEW_LINE>// "Adding integers" due to exact parameter types<NEW_LINE>obj.sum(Integer.valueOf(2)<MASK><NEW_LINE>// "Adding integers" due to type promotion from byte to int<NEW_LINE>obj.sum(2, 0x1);<NEW_LINE>// "Adding numbers" due to explicit cast to Number<NEW_LINE>obj.sum((Number) 2, (Number) 3);<NEW_LINE>// "Adding numbers" due to auto-boxing from double to Double<NEW_LINE>obj.sum(2.0d, 3.0d);<NEW_LINE>// "Adding numbers" due to polimorphism<NEW_LINE>obj.sum(Float.valueOf(2), Float.valueOf(3));<NEW_LINE>// "Adding objects" due to explicit cast to Object<NEW_LINE>obj.sum((Object) 2, (Object) 3);<NEW_LINE>// "Adding objects" due to polimorphism<NEW_LINE>obj.sum(2, "John");<NEW_LINE>// "Adding variable arguments 2"<NEW_LINE>obj.sum(new Object(), new Object(), new Object());<NEW_LINE>// "Adding variable arguments 1"<NEW_LINE>obj.sum(new Object(), new Object[] { new Object() });<NEW_LINE>} | , Integer.valueOf(3)); |
1,408,664 | private static List<MavenCoordinates> findCompileDependenciesFromManifest(ZipFile zipFile, ZipEntry zipEntry) throws MavenRepoGeneratorException {<NEW_LINE>List<MavenCoordinates> result = new ArrayList<MavenCoordinates>();<NEW_LINE>InputStream inputStream = null;<NEW_LINE>try {<NEW_LINE>inputStream = zipFile.getInputStream(zipEntry);<NEW_LINE>Manifest manifest = new Manifest(inputStream);<NEW_LINE><MASK><NEW_LINE>String subsystemContent = mainAttributes.getValue(Constants.SUBSYSTEM_CONTENT);<NEW_LINE>List<String> lines = ManifestProcessor.split(subsystemContent, ",");<NEW_LINE>for (String line : lines) {<NEW_LINE>if (line.contains(Constants.SUBSYSTEM_MAVEN_COORDINATES)) {<NEW_LINE>List<String> components = ManifestProcessor.split(line, ";");<NEW_LINE>String requiredFeature = components.get(0);<NEW_LINE>String mavenCoordinates = null;<NEW_LINE>for (String component : components) {<NEW_LINE>if (component.startsWith(Constants.SUBSYSTEM_MAVEN_COORDINATES)) {<NEW_LINE>mavenCoordinates = component.substring(Constants.SUBSYSTEM_MAVEN_COORDINATES.length() + 1, component.length());<NEW_LINE>if (mavenCoordinates.startsWith("\"") && mavenCoordinates.endsWith("\"")) {<NEW_LINE>mavenCoordinates = mavenCoordinates.substring(1, mavenCoordinates.length() - 1);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (mavenCoordinates != null) {<NEW_LINE>try {<NEW_LINE>result.add(new MavenCoordinates(mavenCoordinates));<NEW_LINE>System.out.println("Found compile dependency for subsystem content " + requiredFeature + ": " + mavenCoordinates);<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>throw new MavenRepoGeneratorException("Invalid Maven coordinates defined in subsystem content " + requiredFeature + " in the manifest for ESA file " + zipFile.getName(), e);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new MavenRepoGeneratorException("For ESA " + zipFile.getName() + ", found " + Constants.SUBSYSTEM_MAVEN_COORDINATES + " key in manifest but failed to parse it from the string: " + line);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new MavenRepoGeneratorException("Could not read manifest file " + zipEntry.getName() + " from ESA file " + zipFile.getName(), e);<NEW_LINE>} finally {<NEW_LINE>if (inputStream != null) {<NEW_LINE>try {<NEW_LINE>inputStream.close();<NEW_LINE>} catch (IOException e) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | Attributes mainAttributes = manifest.getMainAttributes(); |
1,469,152 | final DescribeBackupsResult executeDescribeBackups(DescribeBackupsRequest describeBackupsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeBackupsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeBackupsRequest> request = null;<NEW_LINE>Response<DescribeBackupsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeBackupsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeBackupsRequest));<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(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "FSx");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeBackups");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeBackupsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeBackupsResultJsonUnmarshaller());<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.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); |
80,313 | ActionResult<Wo> execute(EffectivePerson effectivePerson, String id, String workId) throws Exception {<NEW_LINE>ActionResult<Wo> result = new ActionResult<>();<NEW_LINE>Wo wo = new Wo();<NEW_LINE>String executorSeed = null;<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>TaskCompleted taskCompleted = emc.fetch(id, TaskCompleted.class, ListTools.toList(TaskCompleted.job_FIELDNAME));<NEW_LINE>if (null == taskCompleted) {<NEW_LINE>throw new ExceptionEntityNotExist(id, TaskCompleted.class);<NEW_LINE>}<NEW_LINE>executorSeed = taskCompleted.getJob();<NEW_LINE>}<NEW_LINE>Callable<String> callable = new Callable<String>() {<NEW_LINE><NEW_LINE>public String call() throws Exception {<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>TaskCompleted taskCompleted = emc.find(id, TaskCompleted.class);<NEW_LINE>if (null == taskCompleted) {<NEW_LINE>throw new ExceptionEntityNotExist(id, TaskCompleted.class);<NEW_LINE>}<NEW_LINE>Work work = emc.find(workId, Work.class);<NEW_LINE>if (null == work) {<NEW_LINE>throw new ExceptionEntityNotExist(workId, Work.class);<NEW_LINE>}<NEW_LINE>List<Task> list = emc.listEqual(Task.class, Task.work_FIELDNAME, work.getId());<NEW_LINE>for (Task task : list) {<NEW_LINE>MessageFactory.task_press(<MASK><NEW_LINE>wo.getValueList().add(task.getPerson());<NEW_LINE>}<NEW_LINE>emc.beginTransaction(TaskCompleted.class);<NEW_LINE>if (!StringUtils.equals(taskCompleted.getPressActivityToken(), work.getActivityToken())) {<NEW_LINE>taskCompleted.setPressTime(new Date());<NEW_LINE>taskCompleted.setPressActivityToken(work.getActivityToken());<NEW_LINE>taskCompleted.setPressCount(1);<NEW_LINE>} else {<NEW_LINE>if (taskCompleted.getPressCount() != null && taskCompleted.getPressCount() > 0) {<NEW_LINE>taskCompleted.setPressCount(taskCompleted.getPressCount() + 1);<NEW_LINE>taskCompleted.setPressTime(new Date());<NEW_LINE>} else {<NEW_LINE>taskCompleted.setPressTime(new Date());<NEW_LINE>taskCompleted.setPressActivityToken(work.getActivityToken());<NEW_LINE>taskCompleted.setPressCount(1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>emc.commit();<NEW_LINE>}<NEW_LINE>return "";<NEW_LINE>}<NEW_LINE>};<NEW_LINE>ProcessPlatformExecutorFactory.get(executorSeed).submit(callable).get(300, TimeUnit.SECONDS);<NEW_LINE>result.setData(wo);<NEW_LINE>return result;<NEW_LINE>} | task, taskCompleted.getPerson()); |
1,607,251 | private // and shows the "retry" button.<NEW_LINE>void createTimer(long time) {<NEW_LINE>final TextView textView = findViewById(R.id.timer);<NEW_LINE>if (countDownTimer != null) {<NEW_LINE>countDownTimer.cancel();<NEW_LINE>}<NEW_LINE>countDownTimer = new CountDownTimer(time * 1000, 50) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onTick(long millisUnitFinished) {<NEW_LINE>timeRemaining = ((millisUnitFinished / 1000) + 1);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onFinish() {<NEW_LINE>textView.setText("You Lose!");<NEW_LINE>addCoins(GAME_OVER_REWARD);<NEW_LINE>retryButton.setVisibility(View.VISIBLE);<NEW_LINE>gameOver = true;<NEW_LINE>if (rewardedInterstitialAd == null) {<NEW_LINE>Log.d(TAG, "The rewarded interstitial ad is not ready.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>RewardItem rewardItem = rewardedInterstitialAd.getRewardItem();<NEW_LINE>int rewardAmount = rewardItem.getAmount();<NEW_LINE>String rewardType = rewardItem.getType();<NEW_LINE>Log.d(TAG, "The rewarded interstitial ad is ready.");<NEW_LINE>introduceVideoAd(rewardAmount, rewardType);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>countDownTimer.start();<NEW_LINE>} | textView.setText("seconds remaining: " + timeRemaining); |
416,259 | public final void init() {<NEW_LINE>addDrawableChild(doneButton = new ButtonWidget(width / 2 - 100, height / 4 + 72 + 12, 200, 20, new LiteralText(getDoneButtonText()), b -> pressDoneButton()));<NEW_LINE>addDrawableChild(new ButtonWidget(width / 2 - 100, height / 4 + 120 + 12, 200, 20, new LiteralText("Cancel"), b -> client.setScreen(prevScreen)));<NEW_LINE>addDrawableChild(new ButtonWidget(width / 2 - 100, height / 4 + 96 + 12, 200, 20, new LiteralText("Random Name"), b -> nameOrEmailBox.setText(NameGenerator.generateName())));<NEW_LINE>addDrawableChild(stealSkinButton = new ButtonWidget(width - (width / 2 - 100) / 2 - 64, height - 32, 128, 20, new LiteralText("Steal Skin"), b -> message = stealSkin(getNameOrEmail())));<NEW_LINE>addDrawableChild(new ButtonWidget((width / 2 - 100) / 2 - 64, height - 32, 128, 20, new LiteralText("Open Skin Folder")<MASK><NEW_LINE>nameOrEmailBox = new TextFieldWidget(textRenderer, width / 2 - 100, 60, 200, 20, new LiteralText(""));<NEW_LINE>nameOrEmailBox.setMaxLength(48);<NEW_LINE>nameOrEmailBox.setTextFieldFocused(true);<NEW_LINE>nameOrEmailBox.setText(getDefaultNameOrEmail());<NEW_LINE>addSelectableChild(nameOrEmailBox);<NEW_LINE>passwordBox = new TextFieldWidget(textRenderer, width / 2 - 100, 100, 200, 20, new LiteralText(""));<NEW_LINE>passwordBox.setText(getDefaultPassword());<NEW_LINE>passwordBox.setRenderTextProvider((text, int_1) -> {<NEW_LINE>String stars = "";<NEW_LINE>for (int i = 0; i < text.length(); i++) stars += "*";<NEW_LINE>return OrderedText.styledForwardsVisitedString(stars, Style.EMPTY);<NEW_LINE>});<NEW_LINE>passwordBox.setMaxLength(256);<NEW_LINE>addSelectableChild(passwordBox);<NEW_LINE>setInitialFocus(nameOrEmailBox);<NEW_LINE>} | , b -> openSkinFolder())); |
1,680,558 | public void addFinalSummary(TableBuilder tb) {<NEW_LINE>// Use only minor fragments that have complete profiles<NEW_LINE>// Complete iff the fragment profile has at least one operator profile, and start and end times.<NEW_LINE>final List<MinorFragmentProfile> complete = new ArrayList<>(Collections2.filter(major.getMinorFragmentProfileList(), Filters.hasOperatorsAndTimes));<NEW_LINE>tb.appendCell(new OperatorPathBuilder().setMajor(major).build());<NEW_LINE>tb.appendCell(complete.size() + " / " + major.getMinorFragmentProfileCount());<NEW_LINE>// If there are no stats to aggregate, create an empty row<NEW_LINE>if (complete.size() < 1) {<NEW_LINE>tb.appendRepeated("", NUM_NULLABLE_COMPLETED_OVERVIEW_COLUMNS);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final MinorFragmentProfile firstStart = Collections.min(complete, Comparators.startTime);<NEW_LINE>final MinorFragmentProfile lastStart = Collections.max(complete, Comparators.startTime);<NEW_LINE>tb.appendMillis(firstStart.getStartTime() - start);<NEW_LINE>tb.appendMillis(lastStart.getStartTime() - start);<NEW_LINE>final MinorFragmentProfile firstEnd = Collections.min(complete, Comparators.endTime);<NEW_LINE>final MinorFragmentProfile lastEnd = Collections.max(complete, Comparators.endTime);<NEW_LINE>tb.appendMillis(firstEnd.getEndTime() - start);<NEW_LINE>tb.appendMillis(lastEnd.getEndTime() - start);<NEW_LINE>long totalDuration = 0L;<NEW_LINE>double totalProcessInMillis = 0.0d;<NEW_LINE>double totalWaitInMillis = 0.0d;<NEW_LINE>for (final MinorFragmentProfile p : complete) {<NEW_LINE>totalDuration += p.getEndTime() - p.getStartTime();<NEW_LINE>// Capture Busy & Wait Time<NEW_LINE>List<OperatorProfile> opProfileList = p.getOperatorProfileList();<NEW_LINE>for (OperatorProfile operatorProfile : opProfileList) {<NEW_LINE>totalProcessInMillis += operatorProfile.getProcessNanos() / 1E6;<NEW_LINE>totalWaitInMillis += operatorProfile.getWaitNanos() / 1E6;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final MinorFragmentProfile shortRun = Collections.min(complete, Comparators.runTime);<NEW_LINE>final MinorFragmentProfile longRun = Collections.max(complete, Comparators.runTime);<NEW_LINE>tb.appendMillis(shortRun.getEndTime() - shortRun.getStartTime());<NEW_LINE>tb.appendMillis(totalDuration / complete.size());<NEW_LINE>tb.appendMillis(longRun.getEndTime(<MASK><NEW_LINE>Map<String, String> percBusyAttrMap = new HashMap<>();<NEW_LINE>// #8721 is the summation sign: sum(Busy): ## + sum(Wait): ##<NEW_LINE>percBusyAttrMap.put(HtmlAttribute.TITLE, String.format("∑Busy: %,.2fs + ∑Wait: %,.2fs", totalProcessInMillis / 1E3, totalWaitInMillis / 1E3));<NEW_LINE>tb.appendPercent(totalProcessInMillis / (totalProcessInMillis + totalWaitInMillis), percBusyAttrMap);<NEW_LINE>// TODO(DRILL-3494): Names (maxMem, getMaxMemoryUsed) are misleading; the value is peak memory allocated to fragment<NEW_LINE>final MinorFragmentProfile maxMem = Collections.max(complete, Comparators.fragmentPeakMemory);<NEW_LINE>tb.appendBytes(maxMem.getMaxMemoryUsed());<NEW_LINE>} | ) - longRun.getStartTime()); |
1,754,139 | protected void onCreate(Bundle savedInstanceState) {<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>setContentView(R.layout.activity_flexiblespacewithimagescrollview);<NEW_LINE>mFlexibleSpaceImageHeight = getResources().getDimensionPixelSize(R.dimen.flexible_space_image_height);<NEW_LINE>mFlexibleSpaceShowFabOffset = getResources().getDimensionPixelSize(R.dimen.flexible_space_show_fab_offset);<NEW_LINE>mActionBarSize = getActionBarSize();<NEW_LINE>mImageView = <MASK><NEW_LINE>mOverlayView = findViewById(R.id.overlay);<NEW_LINE>mScrollView = (ObservableScrollView) findViewById(R.id.scroll);<NEW_LINE>mScrollView.setScrollViewCallbacks(this);<NEW_LINE>mTitleView = (TextView) findViewById(R.id.title);<NEW_LINE>mTitleView.setText(getTitle());<NEW_LINE>setTitle(null);<NEW_LINE>mFab = findViewById(R.id.fab);<NEW_LINE>mFab.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>Toast.makeText(FlexibleSpaceWithImageScrollViewActivity.this, "FAB is clicked", Toast.LENGTH_SHORT).show();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>mFabMargin = getResources().getDimensionPixelSize(R.dimen.margin_standard);<NEW_LINE>ViewHelper.setScaleX(mFab, 0);<NEW_LINE>ViewHelper.setScaleY(mFab, 0);<NEW_LINE>ScrollUtils.addOnGlobalLayoutListener(mScrollView, new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>mScrollView.scrollTo(0, mFlexibleSpaceImageHeight - mActionBarSize);<NEW_LINE>// If you'd like to start from scrollY == 0, don't write like this:<NEW_LINE>// mScrollView.scrollTo(0, 0);<NEW_LINE>// The initial scrollY is 0, so it won't invoke onScrollChanged().<NEW_LINE>// To do this, use the following:<NEW_LINE>// onScrollChanged(0, false, false);<NEW_LINE>// You can also achieve it with the following codes.<NEW_LINE>// This causes scroll change from 1 to 0.<NEW_LINE>// mScrollView.scrollTo(0, 1);<NEW_LINE>// mScrollView.scrollTo(0, 0);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | findViewById(R.id.image); |
757,268 | public boolean onCreate() {<NEW_LINE>AndroidInjection.inject(this);<NEW_LINE>if (getContext() == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>String AUTHORITY = getContext().getResources().getString(R.string.users_and_groups_search_authority);<NEW_LINE>setActionShareWith(getContext());<NEW_LINE>DATA_USER = AUTHORITY + ".data.user";<NEW_LINE>DATA_GROUP = AUTHORITY + ".data.group";<NEW_LINE>DATA_ROOM = AUTHORITY + ".data.room";<NEW_LINE>DATA_REMOTE = AUTHORITY + ".data.remote";<NEW_LINE>DATA_EMAIL = AUTHORITY + ".data.email";<NEW_LINE>DATA_CIRCLE = AUTHORITY + ".data.circle";<NEW_LINE>sShareTypes.put(DATA_USER, ShareType.USER);<NEW_LINE>sShareTypes.put(DATA_GROUP, ShareType.GROUP);<NEW_LINE>sShareTypes.put(DATA_ROOM, ShareType.ROOM);<NEW_LINE>sShareTypes.put(DATA_REMOTE, ShareType.FEDERATED);<NEW_LINE>sShareTypes.<MASK><NEW_LINE>sShareTypes.put(DATA_CIRCLE, ShareType.CIRCLE);<NEW_LINE>mUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);<NEW_LINE>mUriMatcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY + "/*", SEARCH);<NEW_LINE>return true;<NEW_LINE>} | put(DATA_EMAIL, ShareType.EMAIL); |
734,768 | public static WikivoyageContentItem parseJsonContents(String contentsJson) {<NEW_LINE>JSONObject jArray;<NEW_LINE>JSONObject reader;<NEW_LINE>try {<NEW_LINE>reader = new JSONObject(contentsJson);<NEW_LINE><MASK><NEW_LINE>} catch (JSONException e) {<NEW_LINE>Log.e(TAG, e.getMessage(), e);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>WikivoyageContentItem topContentItem = new WikivoyageContentItem(HEADERS, null);<NEW_LINE>for (int i = 0; i < jArray.length(); i++) {<NEW_LINE>try {<NEW_LINE>JSONObject header = jArray.getJSONObject(jArray.names().getString(i));<NEW_LINE>String link = header.getString(LINK);<NEW_LINE>WikivoyageContentItem headerItem = new WikivoyageContentItem(jArray.names().getString(i), link, topContentItem);<NEW_LINE>topContentItem.subItems.add(headerItem);<NEW_LINE>JSONObject subheaders = header.getJSONObject(SUBHEADERS);<NEW_LINE>JSONArray subNames = subheaders.names();<NEW_LINE>List<String> subheaderNames = null;<NEW_LINE>for (int j = 0; j < subheaders.length(); j++) {<NEW_LINE>String title = subNames.get(j).toString();<NEW_LINE>JSONObject subheaderLink = subheaders.getJSONObject(title);<NEW_LINE>if (subheaderNames == null) {<NEW_LINE>subheaderNames = new ArrayList<>();<NEW_LINE>}<NEW_LINE>subheaderNames.add(title);<NEW_LINE>link = subheaderLink.getString(LINK);<NEW_LINE>WikivoyageContentItem subheaderItem = new WikivoyageContentItem(title, link, headerItem);<NEW_LINE>headerItem.subItems.add(subheaderItem);<NEW_LINE>}<NEW_LINE>} catch (JSONException e) {<NEW_LINE>Log.e(TAG, e.getMessage(), e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return topContentItem;<NEW_LINE>} | jArray = reader.getJSONObject(HEADERS); |
1,047,149 | public KerasModelBuilder modelHdf5Filename(String modelHdf5Filename) throws UnsupportedKerasConfigurationException, InvalidKerasConfigurationException, IOException {<NEW_LINE>checkForExistence(modelHdf5Filename);<NEW_LINE>synchronized (Hdf5Archive.LOCK_OBJECT) {<NEW_LINE>try {<NEW_LINE>this.weightsArchive = this.trainingArchive = new Hdf5Archive(modelHdf5Filename);<NEW_LINE>this.weightsRoot = config.getTrainingWeightsRoot();<NEW_LINE>if (!this.weightsArchive.hasAttribute(config.getTrainingModelConfigAttribute()))<NEW_LINE>throw new InvalidKerasConfigurationException("Model configuration attribute missing from " + modelHdf5Filename + " archive.");<NEW_LINE>String initialModelJson = this.weightsArchive.readAttributeAsJson(config.getTrainingModelConfigAttribute());<NEW_LINE>String kerasVersion = this.weightsArchive.readAttributeAsFixedLengthString(config.getFieldKerasVersion(), 5);<NEW_LINE>Map<String, Object> modelMapper = KerasModelUtils.parseJsonString(initialModelJson);<NEW_LINE>modelMapper.put(config.getFieldKerasVersion(), kerasVersion);<NEW_LINE>int majorKerasVersion = Character.getNumericValue<MASK><NEW_LINE>if (majorKerasVersion == 2) {<NEW_LINE>String backend = this.weightsArchive.readAttributeAsString(config.getFieldBackend());<NEW_LINE>modelMapper.put(config.getFieldBackend(), backend);<NEW_LINE>}<NEW_LINE>this.modelJson = new ObjectMapper().writeValueAsString(modelMapper);<NEW_LINE>if (this.trainingArchive.hasAttribute(config.getTrainingTrainingConfigAttribute()))<NEW_LINE>this.trainingJson = this.trainingArchive.readAttributeAsJson(config.getTrainingTrainingConfigAttribute());<NEW_LINE>} catch (Throwable t) {<NEW_LINE>close();<NEW_LINE>throw t;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return this;<NEW_LINE>} | (kerasVersion.charAt(0)); |
127,869 | public Object apply(final ActionContext ctx, final Object caller, final Object[] sources) throws FrameworkException {<NEW_LINE>try {<NEW_LINE>assertArrayHasMinLengthAndTypes(sources, 2, <MASK><NEW_LINE>// we can safely cast here because of the assert.. above<NEW_LINE>final DOMNode element = (DOMNode) sources[0];<NEW_LINE>final String css = (String) sources[1];<NEW_LINE>final String elementClasses = element.getProperty(StructrApp.key(DOMElement.class, "_html_class"));<NEW_LINE>if (StringUtils.isNotBlank(css) && StringUtils.isNotBlank(elementClasses)) {<NEW_LINE>final Set<String> elementParts = new LinkedHashSet<>(Arrays.asList(elementClasses.split(" ")));<NEW_LINE>final Set<String> inputParts = new LinkedHashSet<>(Arrays.asList(css.split(" ")));<NEW_LINE>return elementParts.containsAll(inputParts);<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} catch (ArgumentNullException pe) {<NEW_LINE>// silently ignore null arguments<NEW_LINE>} catch (ArgumentCountException pe) {<NEW_LINE>logParameterError(caller, sources, pe.getMessage(), ctx.isJavaScriptContext());<NEW_LINE>return usage(ctx.isJavaScriptContext());<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | DOMNode.class, String.class); |
948,181 | public void visit(Method obj) {<NEW_LINE>try {<NEW_LINE>if (skip(obj)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>JavaClass clazz = getThisClass();<NEW_LINE>XMethod xmethod = XFactory.createXMethod(clazz, obj);<NEW_LINE><MASK><NEW_LINE>String key = obj.getName() + ":" + obj.getSignature();<NEW_LINE>if (!factory.isCalled(xmethod) && (obj.isStatic() || !definedInSuperClassOrInterface(clazz, key))) {<NEW_LINE>int priority = NORMAL_PRIORITY;<NEW_LINE>JavaClass superClass = clazz.getSuperClass();<NEW_LINE>String superClassName = superClass.getClassName();<NEW_LINE>if ("java.lang.Object".equals(superClassName)) {<NEW_LINE>priority = NORMAL_PRIORITY;<NEW_LINE>} else if (definedInClass(superClass).containsAll(definedInClass(clazz))) {<NEW_LINE>priority = NORMAL_PRIORITY;<NEW_LINE>} else {<NEW_LINE>priority = HIGH_PRIORITY;<NEW_LINE>}<NEW_LINE>Code code = null;<NEW_LINE>for (Attribute a : obj.getAttributes()) {<NEW_LINE>if (a instanceof Code) {<NEW_LINE>code = (Code) a;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (code != null && code.getLength() == 1) {<NEW_LINE>priority++;<NEW_LINE>}<NEW_LINE>pendingBug = new BugInstance(this, "UMAC_UNCALLABLE_METHOD_OF_ANONYMOUS_CLASS", priority).addClassAndMethod(this);<NEW_LINE>potentialSuperCall = null;<NEW_LINE>}<NEW_LINE>} catch (ClassNotFoundException e) {<NEW_LINE>bugReporter.reportMissingClass(e);<NEW_LINE>}<NEW_LINE>} | XFactory factory = AnalysisContext.currentXFactory(); |
161,656 | // Returns true if polygon_a touches envelope_b.<NEW_LINE>private static boolean polygonTouchesEnvelope_(Polygon polygon_a, Envelope envelope_b, double tolerance, ProgressTracker progress_tracker) {<NEW_LINE>// Quick rasterize test to see whether the the geometries are disjoint,<NEW_LINE>// or if one is contained in the other.<NEW_LINE>int relation = tryRasterizedContainsOrDisjoint_(polygon_a, envelope_b, tolerance, false);<NEW_LINE>if (relation == Relation.disjoint || relation == Relation.contains || relation == Relation.within)<NEW_LINE>return false;<NEW_LINE>Envelope2D env_a = new Envelope2D(), env_b = new Envelope2D();<NEW_LINE>polygon_a.queryEnvelope2D(env_a);<NEW_LINE>envelope_b.queryEnvelope2D(env_b);<NEW_LINE>if (envelopeInfContainsEnvelope_(env_b, env_a, tolerance))<NEW_LINE>return false;<NEW_LINE>if (env_b.getWidth() <= tolerance && env_b.getHeight() <= tolerance) {<NEW_LINE>// treat<NEW_LINE>// as<NEW_LINE>// point<NEW_LINE>Point2D pt_b = envelope_b.getCenterXY();<NEW_LINE>return polygonTouchesPointImpl_(polygon_a, pt_b, tolerance, progress_tracker);<NEW_LINE>}<NEW_LINE>if (env_b.getWidth() <= tolerance || env_b.getHeight() <= tolerance) {<NEW_LINE>// treat<NEW_LINE>// as<NEW_LINE>// polyline<NEW_LINE>Polyline polyline_b = new Polyline();<NEW_LINE>Point p = new Point();<NEW_LINE>envelope_b.queryCornerByVal(0, p);<NEW_LINE>polyline_b.startPath(p);<NEW_LINE><MASK><NEW_LINE>polyline_b.lineTo(p);<NEW_LINE>return polygonTouchesPolylineImpl_(polygon_a, polyline_b, tolerance, progress_tracker);<NEW_LINE>}<NEW_LINE>// treat as polygon<NEW_LINE>Polygon polygon_b = new Polygon();<NEW_LINE>polygon_b.addEnvelope(envelope_b, false);<NEW_LINE>return polygonTouchesPolygonImpl_(polygon_a, polygon_b, tolerance, progress_tracker);<NEW_LINE>} | envelope_b.queryCornerByVal(2, p); |
1,839,608 | private Test createAotTestTask(Project project, SourceSetContainer sourceSets, Jar generatedTestSourcesJar) {<NEW_LINE>Test test = project.getTasks().create(AOT_TEST_TASK_NAME, Test.class);<NEW_LINE>test.useJUnitPlatform();<NEW_LINE>test.setTestClassesDirs(sourceSets.findByName(SourceSet.TEST_SOURCE_SET_NAME).getOutput().getClassesDirs());<NEW_LINE>// Prepend the generatedTestSourcesJar to the classpath so that generated code<NEW_LINE>// overrides any types already in the classpath -- for example, the standard<NEW_LINE>// SpringFactoriesLoader implementation in spring-core must be overridden by<NEW_LINE>// the SpringFactoriesLoader implementation that uses StaticSpringFactories.<NEW_LINE>FileCollection classpath = project.files(project.files(generatedTestSourcesJar.getArchiveFile()), test.getClasspath());<NEW_LINE>test.setClasspath(classpath);<NEW_LINE><MASK><NEW_LINE>return test;<NEW_LINE>} | test.systemProperty("spring.test.context.default.CacheAwareContextLoaderDelegate", "org.springframework.aot.test.AotCacheAwareContextLoaderDelegate"); |
1,661,996 | private void generateMiddleware(GoWriter writer) {<NEW_LINE>SERIALIZE_STEP_MIDDLEWARE.writeMiddleware(writer, (g, w) -> {<NEW_LINE>Symbol requestSymbol = SymbolUtils.createPointableSymbolBuilder("Request", SmithyGoDependency.SMITHY_HTTP_TRANSPORT).build();<NEW_LINE>w.write("req, ok := in.Request.($P)", requestSymbol);<NEW_LINE>w.openBlock("if !ok {", "}", () -> {<NEW_LINE><MASK><NEW_LINE>w.write("return out, metadata, fmt.Errorf(\"unknown transport type %T\", in.Request)");<NEW_LINE>});<NEW_LINE>w.write("");<NEW_LINE>w.write("const contentType = $S", CONTENT_TYPE_HEADER);<NEW_LINE>w.write("const expectedType = $S", EXPECTED_CONTENT_TYPE);<NEW_LINE>w.write("const targetType = $S", TARGET_CONTENT_TYPE);<NEW_LINE>w.write("");<NEW_LINE>w.addUseImports(SmithyGoDependency.STRINGS);<NEW_LINE>w.openBlock("if strings.EqualFold(req.Header.Get(contentType), expectedType) {", "}", () -> {<NEW_LINE>w.write("req.Header.Set(contentType, targetType)");<NEW_LINE>});<NEW_LINE>w.write("");<NEW_LINE>w.write("return next.$L(ctx, in)", g.getHandleMethodName());<NEW_LINE>});<NEW_LINE>} | w.addUseImports(SmithyGoDependency.FMT); |
1,464,507 | void jsonReadUsingObjectMapper(BeanPropertyAssocMany<?> many, SpiJsonReader readJson, EntityBean parentBean) throws IOException {<NEW_LINE>ObjectMapper mapper = readJson.getObjectMapper();<NEW_LINE>ManyType manyType = many.manyType();<NEW_LINE>Object value;<NEW_LINE>if (manyType.isMap()) {<NEW_LINE>// read map using Jackson object mapper with unknown key type<NEW_LINE>TypeFactory typeFactory = mapper.getTypeFactory();<NEW_LINE>JavaType target = typeFactory.constructType(many.targetType());<NEW_LINE>MapType jacksonType = typeFactory.constructMapType(LinkedHashMap.class, TypeFactory.unknownType(), target);<NEW_LINE>value = mapper.readValue(readJson.getParser(), jacksonType);<NEW_LINE>} else {<NEW_LINE>// read list or set using Jackson object mapper<NEW_LINE>CollectionType jacksonType = mapper.getTypeFactory().constructCollectionType(manyType.getCollectionType(<MASK><NEW_LINE>value = mapper.readValue(readJson.getParser(), jacksonType);<NEW_LINE>}<NEW_LINE>many.setValue(parentBean, value);<NEW_LINE>} | ), many.targetType()); |
1,571,503 | public Iterable<? extends ErrorDescription> analyze() {<NEW_LINE>Preferences settings = context.getSettings();<NEW_LINE>if (settings != null && !settings.getBoolean(PHPStanCustomizerPanel.ENABLED, false)) {<NEW_LINE>return Collections.emptyList();<NEW_LINE>}<NEW_LINE>PHPStan phpStan = getValidPHPStan();<NEW_LINE>if (phpStan == null) {<NEW_LINE>context.reportAnalysisProblem(Bundle.PHPStanAnalyzerImpl_phpStan_error(), Bundle.PHPStanAnalyzerImpl_phpStan_error_description());<NEW_LINE>return Collections.emptyList();<NEW_LINE>}<NEW_LINE>PHPStanParams phpStanParams = new PHPStanParams().setLevel(getValidPHPStanLevel()).setConfiguration(getValidPHPStanConfiguration()).setMemoryLimit(getValidPHPStanMemoryLimit());<NEW_LINE><MASK><NEW_LINE>Map<FileObject, Integer> fileCount = AnalysisUtils.countPhpFiles(scope);<NEW_LINE>int totalCount = 0;<NEW_LINE>for (Integer count : fileCount.values()) {<NEW_LINE>totalCount += count;<NEW_LINE>}<NEW_LINE>context.start(totalCount);<NEW_LINE>try {<NEW_LINE>return doAnalyze(scope, phpStan, phpStanParams, fileCount);<NEW_LINE>} finally {<NEW_LINE>context.finish();<NEW_LINE>}<NEW_LINE>} | Scope scope = context.getScope(); |
1,835,800 | public void update() {<NEW_LINE>for (int i = 0, accelOffset = 0, c = i + controller.particles.size * rotationChannel.strideSize; i < c; i += rotationChannel.strideSize, accelOffset += accellerationChannel.strideSize) {<NEW_LINE>Vector3 axisZ = TMP_V1.set(accellerationChannel.data[accelOffset + ParticleChannels.XOffset], accellerationChannel.data[accelOffset + ParticleChannels.YOffset], accellerationChannel.data[accelOffset + ParticleChannels.ZOffset]).nor(), axisY = TMP_V2.set(TMP_V1).crs(Vector3.Y).nor().crs(TMP_V1).nor(), axisX = TMP_V3.set(axisY).crs(axisZ).nor();<NEW_LINE>TMP_Q.setFromAxes(false, axisX.x, axisY.x, axisZ.x, axisX.y, axisY.y, axisZ.y, axisX.z, axisY.z, axisZ.z);<NEW_LINE>rotationChannel.data[i + ParticleChannels.XOffset] = TMP_Q.x;<NEW_LINE>rotationChannel.data[i + ParticleChannels.YOffset] = TMP_Q.y;<NEW_LINE>rotationChannel.data[i + ParticleChannels.ZOffset] = TMP_Q.z;<NEW_LINE>rotationChannel.data[i + <MASK><NEW_LINE>}<NEW_LINE>} | ParticleChannels.WOffset] = TMP_Q.w; |
1,478,909 | public Object apply(final ActionContext ctx, final Object caller, final Object[] sources) throws FrameworkException {<NEW_LINE>try {<NEW_LINE>assertArrayHasLengthAndAllElementsNotNull(sources, 1);<NEW_LINE>if (sources[0] instanceof Geometry) {<NEW_LINE>final List<List<Double>> result = new LinkedList<>();<NEW_LINE>final Geometry geometry = (Geometry) sources[0];<NEW_LINE>for (final Coordinate c : geometry.getCoordinates()) {<NEW_LINE>result.add(Arrays.asList(c<MASK><NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>if (sources[0] instanceof CoordinateList) {<NEW_LINE>final List<List<Double>> result = new LinkedList<>();<NEW_LINE>final CoordinateList list = (CoordinateList) sources[0];<NEW_LINE>for (final Coordinate c : list.toCoordinateArray()) {<NEW_LINE>result.add(Arrays.asList(c.x, c.y));<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>if (sources[0] instanceof Coordinate[]) {<NEW_LINE>final List<List<Double>> result = new LinkedList<>();<NEW_LINE>final Coordinate[] array = (Coordinate[]) sources[0];<NEW_LINE>for (final Coordinate c : array) {<NEW_LINE>result.add(Arrays.asList(c.x, c.y));<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>if (sources[0] instanceof Coordinate) {<NEW_LINE>final List<Double> result = new LinkedList<>();<NEW_LINE>final Coordinate c = (Coordinate) sources[0];<NEW_LINE>result.add(c.x);<NEW_LINE>result.add(c.y);<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>return "Invalid parameters";<NEW_LINE>} catch (ArgumentNullException pe) {<NEW_LINE>// silently ignore null arguments<NEW_LINE>return "";<NEW_LINE>} catch (ArgumentCountException pe) {<NEW_LINE>logParameterError(caller, sources, pe.getMessage(), ctx.isJavaScriptContext());<NEW_LINE>return usage(ctx.isJavaScriptContext());<NEW_LINE>}<NEW_LINE>} | .x, c.y)); |
479,772 | private void modifyTarget(boolean add, VolumeInfo volumeInfo, long hostId) {<NEW_LINE>StoragePoolVO storagePoolVO = storagePoolDao.findById(volumeInfo.getPoolId());<NEW_LINE>Map<String, String> details = new HashMap<>(3);<NEW_LINE>details.put(ModifyTargetsCommand.IQN, volumeInfo.get_iScsiName());<NEW_LINE>details.put(ModifyTargetsCommand.STORAGE_HOST, storagePoolVO.getHostAddress());<NEW_LINE>details.put(ModifyTargetsCommand.STORAGE_PORT, String.valueOf(storagePoolVO.getPort()));<NEW_LINE>List<Map<String, String>> targets = new ArrayList<>(1);<NEW_LINE>targets.add(details);<NEW_LINE>ModifyTargetsCommand cmd = new ModifyTargetsCommand();<NEW_LINE>cmd.setTargets(targets);<NEW_LINE>cmd.setApplyToAllHostsInCluster(true);<NEW_LINE>cmd.setAdd(add);<NEW_LINE>cmd.<MASK><NEW_LINE>sendModifyTargetsCommand(cmd, hostId);<NEW_LINE>} | setTargetTypeToRemove(ModifyTargetsCommand.TargetTypeToRemove.BOTH); |
238,630 | public final <R extends Record, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21> InsertImpl insertInto(Table<R> into, Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15, Field<T16> field16, Field<T17> field17, Field<T18> field18, Field<T19> field19, Field<T20> field20, Field<T21> field21) {<NEW_LINE>return insertInto(into, Arrays.asList(field1, field2, field3, field4, field5, field6, field7, field8, field9, field10, field11, field12, field13, field14, field15, field16, field17, field18<MASK><NEW_LINE>} | , field19, field20, field21)); |
480,467 | private static void checkEndpointID(X509Certificate certificate, String endpointIDAlg, boolean checkServerTrusted, BCExtendedSSLSession sslSession) throws CertificateException {<NEW_LINE>String peerHost = sslSession.getPeerHost();<NEW_LINE>if (checkServerTrusted) {<NEW_LINE>BCSNIHostName sniHostName = JsseUtils.getSNIHostName(sslSession.getRequestedServerNames());<NEW_LINE>if (null != sniHostName) {<NEW_LINE>String hostname = sniHostName.getAsciiName();<NEW_LINE>if (!hostname.equalsIgnoreCase(peerHost)) {<NEW_LINE>try {<NEW_LINE>checkEndpointID(hostname, certificate, endpointIDAlg);<NEW_LINE>return;<NEW_LINE>} catch (CertificateException e) {<NEW_LINE>// ignore (log only) and continue on to check 'peerHost' instead<NEW_LINE>LOG.log(Level.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>checkEndpointID(peerHost, certificate, endpointIDAlg);<NEW_LINE>} | FINE, "Server's endpoint ID did not match the SNI host_name: " + hostname, e); |
1,153,712 | void increaseWindow() {<NEW_LINE>if (mainProtectedMaximum() == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>long quota = Math.min(adjustment(), mainProtectedMaximum());<NEW_LINE>setMainProtectedMaximum(mainProtectedMaximum() - quota);<NEW_LINE>setWindowMaximum(windowMaximum() + quota);<NEW_LINE>demoteFromMainProtected();<NEW_LINE>for (int i = 0; i < QUEUE_TRANSFER_THRESHOLD; i++) {<NEW_LINE>Node<K, V> candidate = accessOrderProbationDeque().peek();<NEW_LINE>boolean probation = true;<NEW_LINE>if ((candidate == null) || (quota < candidate.getPolicyWeight())) {<NEW_LINE>candidate = accessOrderProtectedDeque().peek();<NEW_LINE>probation = false;<NEW_LINE>}<NEW_LINE>if (candidate == null) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>int weight = candidate.getPolicyWeight();<NEW_LINE>if (quota < weight) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>quota -= weight;<NEW_LINE>if (probation) {<NEW_LINE>accessOrderProbationDeque().remove(candidate);<NEW_LINE>} else {<NEW_LINE>setMainProtectedWeightedSize(mainProtectedWeightedSize() - weight);<NEW_LINE>accessOrderProtectedDeque().remove(candidate);<NEW_LINE>}<NEW_LINE>setWindowWeightedSize(windowWeightedSize() + weight);<NEW_LINE>accessOrderWindowDeque().add(candidate);<NEW_LINE>candidate.makeWindow();<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>setWindowMaximum(windowMaximum() - quota);<NEW_LINE>setAdjustment(quota);<NEW_LINE>} | setMainProtectedMaximum(mainProtectedMaximum() + quota); |
868,064 | private static void updateProjectSettings(Project project, BlazeProjectData blazeProjectData) {<NEW_LINE>KotlinToolchainIdeInfo kotlinToolchainIdeInfo = findToolchain(blazeProjectData.getTargetMap());<NEW_LINE>if (kotlinToolchainIdeInfo == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>LanguageVersion languageLevel = getLanguageVersion(kotlinToolchainIdeInfo);<NEW_LINE>String versionString = languageLevel.getVersionString();<NEW_LINE>CommonCompilerArguments settings = (CommonCompilerArguments) KotlinCommonCompilerArgumentsHolder.Companion.getInstance(project).getSettings().unfrozen();<NEW_LINE>boolean updated = false;<NEW_LINE>String apiVersion = settings.getApiVersion();<NEW_LINE><MASK><NEW_LINE>if (apiVersion == null || !apiVersion.equals(versionString)) {<NEW_LINE>updated = true;<NEW_LINE>settings.setApiVersion(versionString);<NEW_LINE>}<NEW_LINE>if (languageVersion == null || !languageVersion.equals(versionString)) {<NEW_LINE>updated = true;<NEW_LINE>settings.setLanguageVersion(versionString);<NEW_LINE>}<NEW_LINE>if (updated) {<NEW_LINE>KotlinCommonCompilerArgumentsHolder.Companion.getInstance(project).setSettings(settings);<NEW_LINE>}<NEW_LINE>if (setCompilerFlagsExperiment.getValue()) {<NEW_LINE>CompilerSettings compilerSettings = (CompilerSettings) KotlinCompilerSettings.Companion.getInstance(project).getSettings().unfrozen();<NEW_LINE>// Order matters since we have parameter like -jvm-target 1.8 where two parameters must be<NEW_LINE>// aligned in order.<NEW_LINE>// Currently, we list all common compiler flags in settings even though it may be duplicated<NEW_LINE>// with CommonCompilerArguments.languageVersion and K2JVMCompilerArguments.jvmTarget. There<NEW_LINE>// are 2 reasons: 1. they are expected to be identical 2. we do not really use these compiler<NEW_LINE>// arguments when compiling kotlin files. They are for the Kotlin plugin in IDE only.<NEW_LINE>Set<String> commonFlags = new LinkedHashSet<>(kotlinToolchainIdeInfo.getKotlinCompilerCommonFlags());<NEW_LINE>Collections.addAll(commonFlags, compilerSettings.getAdditionalArguments().split(" "));<NEW_LINE>compilerSettings.setAdditionalArguments(String.join(" ", commonFlags));<NEW_LINE>KotlinCompilerSettings.Companion.getInstance(project).setSettings(compilerSettings);<NEW_LINE>}<NEW_LINE>} | String languageVersion = settings.getLanguageVersion(); |
501,063 | public DescriptiveUrl toDownloadUrl(final Path file, final Void options, final PasswordCallback callback) throws BackgroundException {<NEW_LINE>try {<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug(String.format("Create temporary link for %s", file));<NEW_LINE>}<NEW_LINE>// This link will expire in four hours and afterwards you will get 410 Gone.<NEW_LINE>final String link = new DbxUserFilesRequests(session.getClient(file)).getTemporaryLink(containerService.getKey(file)).getLink();<NEW_LINE>// Determine expiry time for URL<NEW_LINE>final Calendar expiry = Calendar.getInstance<MASK><NEW_LINE>expiry.add(Calendar.HOUR, 4);<NEW_LINE>return new DescriptiveUrl(URI.create(link), DescriptiveUrl.Type.signed, MessageFormat.format(LocaleFactory.localizedString("{0} URL"), LocaleFactory.localizedString("Temporary", "S3")) + " (" + MessageFormat.format(LocaleFactory.localizedString("Expires {0}", "S3") + ")", UserDateFormatterFactory.get().getMediumFormat(expiry.getTimeInMillis())));<NEW_LINE>} catch (DbxException e) {<NEW_LINE>throw new DropboxExceptionMappingService().map(e);<NEW_LINE>}<NEW_LINE>} | (TimeZone.getTimeZone("UTC")); |
1,223,225 | private void handleContestedPivotBlock(final long contestedBlockNumber) {<NEW_LINE>if (pivotBlockNumber.compareAndSet(contestedBlockNumber, contestedBlockNumber - pivotBlockNumberResetDelta)) {<NEW_LINE>LOG.info("Received conflicting pivot blocks for {}.", contestedBlockNumber);<NEW_LINE>final <MASK><NEW_LINE>if ((retryCount % SUSPICIOUS_NUMBER_OF_RETRIES) == 0) {<NEW_LINE>LOG.warn("{} attempts have failed to find a fast sync pivot block", retryCount);<NEW_LINE>}<NEW_LINE>if (retryCount > maxPivotBlockResets || pivotBlockNumber.get() <= BlockHeader.GENESIS_BLOCK_NUMBER) {<NEW_LINE>LOG.info("Max retries reached, cancel pivot block download.");<NEW_LINE>// Pivot block selection has failed<NEW_LINE>result.completeExceptionally(new FastSyncException(FastSyncError.PIVOT_BLOCK_HEADER_MISMATCH));<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>LOG.info("Move pivot block back to {} and retry.", pivotBlockNumber);<NEW_LINE>}<NEW_LINE>confirmBlock(pivotBlockNumber.get());<NEW_LINE>}<NEW_LINE>} | int retryCount = confirmationTasks.size(); |
1,373,466 | public static Bundle toBundle(NotificationContent content) {<NEW_LINE>Bundle serializedContent = new Bundle();<NEW_LINE>serializedContent.putString("title", content.getTitle());<NEW_LINE>serializedContent.putString("subtitle", content.getSubtitle());<NEW_LINE>serializedContent.putString("body", content.getText());<NEW_LINE>if (content.getColor() != null) {<NEW_LINE>serializedContent.putString("color", String.format("#%08X", content.getColor().intValue()));<NEW_LINE>}<NEW_LINE>serializedContent.putBundle("data", toBundle(content.getBody()));<NEW_LINE>if (content.getBadgeCount() != null) {<NEW_LINE>serializedContent.putInt("badge", content.getBadgeCount().intValue());<NEW_LINE>} else {<NEW_LINE>serializedContent.putString("badge", null);<NEW_LINE>}<NEW_LINE>if (content.shouldPlayDefaultSound()) {<NEW_LINE><MASK><NEW_LINE>} else if (content.getSound() != null) {<NEW_LINE>serializedContent.putString("sound", "custom");<NEW_LINE>} else {<NEW_LINE>serializedContent.putString("sound", null);<NEW_LINE>}<NEW_LINE>if (content.getPriority() != null) {<NEW_LINE>serializedContent.putString("priority", content.getPriority().getEnumValue());<NEW_LINE>}<NEW_LINE>if (content.getVibrationPattern() != null) {<NEW_LINE>double[] serializedVibrationPattern = new double[content.getVibrationPattern().length];<NEW_LINE>for (int i = 0; i < serializedVibrationPattern.length; i++) {<NEW_LINE>serializedVibrationPattern[i] = content.getVibrationPattern()[i];<NEW_LINE>}<NEW_LINE>serializedContent.putDoubleArray("vibrationPattern", serializedVibrationPattern);<NEW_LINE>}<NEW_LINE>serializedContent.putBoolean("autoDismiss", content.isAutoDismiss());<NEW_LINE>if (content.getCategoryId() != null) {<NEW_LINE>serializedContent.putString("categoryIdentifier", content.getCategoryId());<NEW_LINE>}<NEW_LINE>serializedContent.putBoolean("sticky", content.isSticky());<NEW_LINE>return serializedContent;<NEW_LINE>} | serializedContent.putString("sound", "default"); |
746,997 | public List<Pet> findPetsByStatus(List<String> status) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// verify the required parameter 'status' is set<NEW_LINE>if (status == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/pet/findByStatus".replaceAll("\\{format\\}", "json");<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, String> localVarCookieParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "status", status));<NEW_LINE>final String[<MASK><NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] { "petstore_auth" };<NEW_LINE>GenericType<List<Pet>> localVarReturnType = new GenericType<List<Pet>>() {<NEW_LINE>};<NEW_LINE>return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);<NEW_LINE>} | ] localVarAccepts = { "application/xml", "application/json" }; |
33,454 | public void read(org.apache.thrift.protocol.TProtocol prot, replicateKeyValues_args struct) throws org.apache.thrift.TException {<NEW_LINE>org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;<NEW_LINE>java.util.BitSet incoming = iprot.readBitSet(3);<NEW_LINE>if (incoming.get(0)) {<NEW_LINE>struct.remoteTableId = iprot.readString();<NEW_LINE>struct.setRemoteTableIdIsSet(true);<NEW_LINE>}<NEW_LINE>if (incoming.get(1)) {<NEW_LINE>struct.data = new KeyValues();<NEW_LINE>struct.data.read(iprot);<NEW_LINE>struct.setDataIsSet(true);<NEW_LINE>}<NEW_LINE>if (incoming.get(2)) {<NEW_LINE>struct.credentials = new org.apache.accumulo.core<MASK><NEW_LINE>struct.credentials.read(iprot);<NEW_LINE>struct.setCredentialsIsSet(true);<NEW_LINE>}<NEW_LINE>} | .securityImpl.thrift.TCredentials(); |
549,628 | public void run() {<NEW_LINE>try {<NEW_LINE>entry.incrementRunCount();<NEW_LINE>RuntimeEventLog.cron(taskClassName);<NEW_LINE>if (taskClass != null) {<NEW_LINE>Task task = <MASK><NEW_LINE>logger.debug("Starting task {}", taskClassName);<NEW_LINE>StructrApp.getInstance().processTasks(task);<NEW_LINE>} else {<NEW_LINE>try (final Tx tx = StructrApp.getInstance().tx()) {<NEW_LINE>// check for schema method with the given name<NEW_LINE>Actions.callAsSuperUser(taskClassName, Collections.EMPTY_MAP);<NEW_LINE>tx.success();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (FrameworkException fex) {<NEW_LINE>logger.warn("Exception while executing cron task {}: {}", taskClassName, fex.toString());<NEW_LINE>} catch (Throwable t) {<NEW_LINE>logger.warn("Exception while executing cron task {}: {}", taskClassName, t.getMessage());<NEW_LINE>} finally {<NEW_LINE>entry.decrementRunCount();<NEW_LINE>}<NEW_LINE>} | (Task) taskClass.newInstance(); |
1,217,955 | public Object convert(final Object source) {<NEW_LINE>if (source == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Image img = null;<NEW_LINE>try {<NEW_LINE>if (source instanceof byte[]) {<NEW_LINE>byte[] data = (byte[]) source;<NEW_LINE>MagicMatch match = Magic.getMagicMatch(data);<NEW_LINE>String mimeType = match.getMimeType();<NEW_LINE>if (keyAndClass != null) {<NEW_LINE>img = (Image) ImageHelper.createFile(securityContext, data, mimeType, keyAndClass.getCls());<NEW_LINE>} else {<NEW_LINE>ImageHelper.setImageData((Image) currentObject, data, mimeType);<NEW_LINE>}<NEW_LINE>} else if (source instanceof String) {<NEW_LINE>String sourceString = (String) source;<NEW_LINE>if (StringUtils.isNotBlank(sourceString)) {<NEW_LINE>if (keyAndClass != null) {<NEW_LINE>// UUID?<NEW_LINE>if (sourceString.length() == 32) {<NEW_LINE>img = (Image) ImageHelper.transformFile(securityContext, sourceString, keyAndClass != null ? keyAndClass.getCls() : null);<NEW_LINE>}<NEW_LINE>if (img == null) {<NEW_LINE>img = (Image) ImageHelper.createFileBase64(securityContext, sourceString, keyAndClass != null ? keyAndClass.getCls() : null);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>ImageHelper.decodeAndSetFileData((Image) currentObject, sourceString);<NEW_LINE>ImageHelper<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Throwable t) {<NEW_LINE>logger.warn("Cannot create image node from given data", t);<NEW_LINE>}<NEW_LINE>if (img != null) {<NEW_LINE>// manual indexing of UUID needed here to avoid a 404 in the following setProperty call<NEW_LINE>img.addToIndex();<NEW_LINE>currentObject.setProperties(securityContext, new PropertyMap(keyAndClass.getPropertyKey(), img));<NEW_LINE>}<NEW_LINE>} catch (Throwable t) {<NEW_LINE>logger.warn("Cannot create image node from given data", t);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | .updateMetadata((Image) currentObject); |
8,829 | private void addSegmentsTargetAboveSource(Obstacle source, Obstacle target) {<NEW_LINE>// target located above source<NEW_LINE>Segment seg = null;<NEW_LINE>Segment seg2 = null;<NEW_LINE>if (target.x > source.x) {<NEW_LINE>seg = new Segment(source.topLeft, target.topLeft);<NEW_LINE>if (target.x < source.right() - 1)<NEW_LINE>seg2 = new Segment(source.topRight, target.bottomLeft);<NEW_LINE>else<NEW_LINE>seg2 = new Segment(source.bottomRight, target.topLeft);<NEW_LINE>} else if (source.x == target.x) {<NEW_LINE>seg = new Segment(source.topLeft, target.bottomLeft);<NEW_LINE>seg2 = new Segment(source.topRight, target.bottomLeft);<NEW_LINE>} else {<NEW_LINE>seg = new Segment(source.bottomLeft, target.bottomLeft);<NEW_LINE>seg2 = new Segment(source.topRight, target.bottomLeft);<NEW_LINE>}<NEW_LINE>stack.push(source);<NEW_LINE>stack.push(target);<NEW_LINE>stack.push(seg);<NEW_LINE>stack.push(source);<NEW_LINE>stack.push(target);<NEW_LINE>stack.push(seg2);<NEW_LINE>seg = null;<NEW_LINE>seg2 = null;<NEW_LINE>if (target.right() < source.right()) {<NEW_LINE>seg = new Segment(<MASK><NEW_LINE>if (target.right() - 1 > source.x)<NEW_LINE>seg2 = new Segment(source.topLeft, target.bottomRight);<NEW_LINE>else<NEW_LINE>seg2 = new Segment(source.bottomLeft, target.topRight);<NEW_LINE>} else if (source.right() == target.right()) {<NEW_LINE>seg = new Segment(source.topRight, target.bottomRight);<NEW_LINE>seg2 = new Segment(source.topLeft, target.bottomRight);<NEW_LINE>} else {<NEW_LINE>seg = new Segment(source.bottomRight, target.bottomRight);<NEW_LINE>seg2 = new Segment(source.topLeft, target.bottomRight);<NEW_LINE>}<NEW_LINE>stack.push(source);<NEW_LINE>stack.push(target);<NEW_LINE>stack.push(seg);<NEW_LINE>stack.push(source);<NEW_LINE>stack.push(target);<NEW_LINE>stack.push(seg2);<NEW_LINE>} | source.topRight, target.topRight); |
749,361 | public static ServiceConfig defaultServiceConfig() {<NEW_LINE>ServiceConfig result = new ServiceConfig();<NEW_LINE>// All classes here must have an argument free constructor.<NEW_LINE>result.put(IHttpUtil.class, ServiceConfig.load(HttpUtil.class.getName()));<NEW_LINE>result.put(ISystemClock.class, ServiceConfig.load(SystemClock.class.getName()));<NEW_LINE>result.put(ILocationService.class, ServiceConfig.load(MLSLocationService.class.getName()));<NEW_LINE>result.put(ISimulatorService.class, ServiceConfig.load(SimulatorService.class.getName()));<NEW_LINE>if (BuildConfig.BUILD_TYPE.equals("unittest")) {<NEW_LINE>result.put(ILogger.class, ServiceConfig.load(UnittestLogger<MASK><NEW_LINE>} else if (BuildConfig.BUILD_TYPE.equals("debug")) {<NEW_LINE>result.put(ILogger.class, ServiceConfig.load(DebugLogger.class.getName()));<NEW_LINE>result.put(IOfflineLocationService.class, ServiceConfig.load(LocationService.class.getName()));<NEW_LINE>} else {<NEW_LINE>result.put(ILogger.class, ServiceConfig.load("org.mozilla.mozstumbler.svclocator.services.log.ProductionLogger"));<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | .class.getName())); |
1,285,896 | public void onPublish(InterceptPublishMessage msg) {<NEW_LINE>String clientId = msg.getClientID();<NEW_LINE>ByteBuf payload = msg.getPayload();<NEW_LINE>String topic = msg.getTopicName();<NEW_LINE>String username = msg.getUsername();<NEW_LINE>MqttQoS qos = msg.getQos();<NEW_LINE>LOG.debug("Receive publish message. clientId: {}, username: {}, qos: {}, topic: {}, payload: {}", clientId, username, qos, topic, payload);<NEW_LINE>List<Message> events = payloadFormat.format(payload);<NEW_LINE>if (events == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// since device ids from messages maybe different, so we use the InsertPlan not<NEW_LINE>// InsertTabletPlan.<NEW_LINE>for (Message event : events) {<NEW_LINE>if (event == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>boolean status = false;<NEW_LINE>try {<NEW_LINE>PartialPath path = new PartialPath(event.getDevice());<NEW_LINE>InsertRowPlan plan = new InsertRowPlan(path, event.getTimestamp(), event.getMeasurements().toArray(new String[0]), event.getValues().toArray(new String[0]));<NEW_LINE>TSStatus tsStatus = serviceProvider.checkAuthority(plan, sessionId);<NEW_LINE>if (tsStatus != null) {<NEW_LINE>LOG.warn(tsStatus.message);<NEW_LINE>} else {<NEW_LINE>status = serviceProvider.executeNonQuery(plan);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.warn("meet error when inserting device {}, measurements {}, at time {}, because ", event.getDevice(), event.getMeasurements(), event.getTimestamp(), e);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | LOG.debug("event process result: {}", status); |
1,124,232 | public static IndexOrdinalsFieldData buildEmpty(IndexReader indexReader, IndexOrdinalsFieldData indexFieldData) throws IOException {<NEW_LINE>assert indexReader.leaves().size() > 1;<NEW_LINE>final LeafOrdinalsFieldData[] atomicFD = new LeafOrdinalsFieldData[indexReader.leaves().size()];<NEW_LINE>final SortedSetDocValues[] subs = new SortedSetDocValues[indexReader.leaves().size()];<NEW_LINE>for (int i = 0; i < indexReader.leaves().size(); ++i) {<NEW_LINE>atomicFD[i] = new AbstractLeafOrdinalsFieldData(AbstractLeafOrdinalsFieldData.DEFAULT_SCRIPT_FUNCTION) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public SortedSetDocValues getOrdinalsValues() {<NEW_LINE>return DocValues.emptySortedSet();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public long ramBytesUsed() {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Collection<Accountable> getChildResources() {<NEW_LINE>return Collections.emptyList();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void close() {<NEW_LINE>}<NEW_LINE>};<NEW_LINE>subs[i] = atomicFD[i].getOrdinalsValues();<NEW_LINE>}<NEW_LINE>final OrdinalMap ordinalMap = OrdinalMap.build(null, subs, PackedInts.DEFAULT);<NEW_LINE>return new GlobalOrdinalsIndexFieldData(indexFieldData.getFieldName(), indexFieldData.getValuesSourceType(), atomicFD, <MASK><NEW_LINE>} | ordinalMap, 0, AbstractLeafOrdinalsFieldData.DEFAULT_SCRIPT_FUNCTION); |
459,668 | protected boolean processResponse() {<NEW_LINE>if (manifest == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>result.value = new ArrayList<String>();<NEW_LINE>Map<String, String> filter = new <MASK><NEW_LINE>Iterator<String> keyIterator = manifest.getEntries().keySet().iterator();<NEW_LINE>while (keyIterator.hasNext()) {<NEW_LINE>String k = keyIterator.next();<NEW_LINE>if (// NOI18N<NEW_LINE>!k.contains("address:/"))<NEW_LINE>continue;<NEW_LINE>if (// NOI18N<NEW_LINE>k.contains("address:/wsat-wsat"))<NEW_LINE>continue;<NEW_LINE>if (// NOI18N<NEW_LINE>k.contains("address:/__wstx-services"))<NEW_LINE>continue;<NEW_LINE>// NOI18N<NEW_LINE>String a = k.replaceFirst(".* address:/", "").replaceFirst("\\. .*", "");<NEW_LINE>if (filter.containsKey(a))<NEW_LINE>continue;<NEW_LINE>filter.put(a, a);<NEW_LINE>result.value.add(a);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | HashMap<String, String>(); |
1,377,484 | private void checkTargetIsInstrumentedForCoverage(Instrumentation instrumentation) {<NEW_LINE>checkState(GOOGLE_INSTRUMENTATION_NAMES.contains(instrumentation.getInstrumentationClass()), "Test coverage data can only be generated when GoogleInstrumentationTestRunner is used." + " Do you have an <instrumentation> entry for it in your AndroidManifest.xml?");<NEW_LINE>String targetPackage = instrumentation.getTargetPackage();<NEW_LINE>// Both Emma and Jacoco use this RT class as the entry point for collecting coverage data from<NEW_LINE>// the running VM. Its absence from the APK is definitely a problem.<NEW_LINE>String vladiumClass = "com.vladium.emma.rt.RT";<NEW_LINE>if (skipCoverageFilesCheck) {<NEW_LINE>logger.info(String.format("Skipping check for the existence of %s and related coverage classes", vladiumClass));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!testRepo.targetContainsClass(targetPackage, vladiumClass)) {<NEW_LINE>logger.warning(String.format(APK_MISSING_INSTRUMENTATION, targetPackage, vladiumClass, String.<MASK><NEW_LINE>}<NEW_LINE>String jacocoAgent = "org.jacoco.agent.rt.RT";<NEW_LINE>if (!testRepo.targetContainsClass(targetPackage, jacocoAgent)) {<NEW_LINE>logger.warning(String.format(APK_MISSING_INSTRUMENTATION, targetPackage, jacocoAgent, String.format(PROGUARD_KEEP_JACOCO, "class")));<NEW_LINE>}<NEW_LINE>String jacocoAgentInterface = "org.jacoco.agent.rt.IAgent";<NEW_LINE>if (!testRepo.targetContainsClass(targetPackage, jacocoAgentInterface)) {<NEW_LINE>logger.warning(String.format(APK_MISSING_INSTRUMENTATION, targetPackage, jacocoAgentInterface, String.format(PROGUARD_KEEP_JACOCO, "interface")));<NEW_LINE>}<NEW_LINE>} | format(PROGUARD_KEEP_EMMA, "class"))); |
1,314,930 | public void marshall(Rule rule, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (rule == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(rule.getName(), NAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(rule.getPriority(), PRIORITY_BINDING);<NEW_LINE>protocolMarshaller.marshall(rule.getStatement(), STATEMENT_BINDING);<NEW_LINE>protocolMarshaller.marshall(rule.getAction(), ACTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(rule.getOverrideAction(), OVERRIDEACTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(rule.getRuleLabels(), RULELABELS_BINDING);<NEW_LINE>protocolMarshaller.marshall(rule.getVisibilityConfig(), VISIBILITYCONFIG_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | rule.getCaptchaConfig(), CAPTCHACONFIG_BINDING); |
1,381,120 | private boolean runTestOnce(TestRun run) {<NEW_LINE>Session ws;<NEW_LINE>try {<NEW_LINE>do {<NEW_LINE>ws = wsSessionQueue.poll(1, TimeUnit.SECONDS);<NEW_LINE>} while (ws == null || !ws.isOpen());<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>run.getCallback().error(e);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>int id = idGenerator.incrementAndGet();<NEW_LINE>CountDownLatch latch = new CountDownLatch(1);<NEW_LINE>CallbackWrapper callbackWrapper = new CallbackWrapper(latch, run);<NEW_LINE>awaitingRuns.put(id, callbackWrapper);<NEW_LINE>JsonNodeFactory nf = objectMapper.getNodeFactory();<NEW_LINE><MASK><NEW_LINE>node.set("id", nf.numberNode(id));<NEW_LINE>ArrayNode array = nf.arrayNode();<NEW_LINE>node.set("tests", array);<NEW_LINE>File file = new File(run.getBaseDirectory(), run.getFileName()).getAbsoluteFile();<NEW_LINE>String relPath = baseDir.getAbsoluteFile().toPath().relativize(file.toPath()).toString();<NEW_LINE>ObjectNode testNode = nf.objectNode();<NEW_LINE>testNode.set("type", nf.textNode(type));<NEW_LINE>testNode.set("name", nf.textNode(run.getFileName()));<NEW_LINE>testNode.set("file", nf.textNode("tests/" + relPath));<NEW_LINE>if (run.getArgument() != null) {<NEW_LINE>testNode.set("argument", nf.textNode(run.getArgument()));<NEW_LINE>}<NEW_LINE>array.add(testNode);<NEW_LINE>String message = node.toString();<NEW_LINE>ws.getRemote().sendStringByFuture(message);<NEW_LINE>try {<NEW_LINE>latch.await();<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>// do nothing<NEW_LINE>}<NEW_LINE>if (ws.isOpen()) {<NEW_LINE>wsSessionQueue.offer(ws);<NEW_LINE>}<NEW_LINE>return !callbackWrapper.shouldRepeat;<NEW_LINE>} | ObjectNode node = nf.objectNode(); |
1,747,206 | public List<Migration> resolve() {<NEW_LINE>File location = new File(migrationsLocation);<NEW_LINE>LOGGER.info("Trying migrations at: {} ", location.getAbsolutePath());<NEW_LINE>// assume flat directory of migrations<NEW_LINE>File[] files = location.listFiles();<NEW_LINE>if (files == null || files.length == 0)<NEW_LINE>throw new MigrationException("No migrations are found at: " + location.getAbsolutePath());<NEW_LINE>// filter out garbage<NEW_LINE>List<File> migrationsFiles = new ArrayList<File>();<NEW_LINE>for (File file : files) {<NEW_LINE>if (!file.isDirectory() && MIGRATION_FILE_PATTERN.matcher(file.getName()).matches()) {<NEW_LINE>migrationsFiles.add(file);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>checkDuplicateVersions(migrationsFiles);<NEW_LINE>List<Migration> migrations = new ArrayList<>();<NEW_LINE>// Extract versions and create executable migrations for each resource.<NEW_LINE>for (File migrationFile : migrationsFiles) {<NEW_LINE>String version = extractVersion(migrationFile.getName());<NEW_LINE>if (migrationFile.getName().endsWith("sql")) {<NEW_LINE>migrations.add(new SQLMigration<MASK><NEW_LINE>} else if (migrationFile.getName().endsWith("groovy")) {<NEW_LINE>migrations.add(new GroovyMigration(mavenProject, version, migrationFile, mergeProperties));<NEW_LINE>} else {<NEW_LINE>throw new RuntimeException("file type not supported");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Collections.sort(migrations);<NEW_LINE>return migrations;<NEW_LINE>} | (version, migrationFile, mergeProperties)); |
285,701 | public int compare(Object arg1, Object arg2) {<NEW_LINE>if (arg1 == arg2) {<NEW_LINE>return (0);<NEW_LINE>}<NEW_LINE>PEPeerTransport pt1 = (PEPeerTransport) arg1;<NEW_LINE>PEPeerTransport pt2 = (PEPeerTransport) arg2;<NEW_LINE>Integer m1 = (Integer) block_time_order_peers_metrics.get(pt1);<NEW_LINE>if (m1 == null) {<NEW_LINE>m1 = new Integer(getNextBlockETAFromNow(pt1));<NEW_LINE>block_time_order_peers_metrics.put(pt1, m1);<NEW_LINE>}<NEW_LINE>Integer m2 = (Integer) block_time_order_peers_metrics.get(pt2);<NEW_LINE>if (m2 == null) {<NEW_LINE>m2 = new Integer(getNextBlockETAFromNow(pt2));<NEW_LINE>block_time_order_peers_metrics.put(pt2, m2);<NEW_LINE>}<NEW_LINE>int result = m1.intValue() - m2.intValue();<NEW_LINE>if (result == 0) {<NEW_LINE>Map pr = peer_randomiser[0];<NEW_LINE>if (pr == null) {<NEW_LINE>pr = peer_randomiser[0] = new LightHashMap(bestUploaders.size());<NEW_LINE>}<NEW_LINE>Integer r_1 = (Integer) pr.get(pt1);<NEW_LINE>if (r_1 == null) {<NEW_LINE>r_1 = new Integer(random.nextInt());<NEW_LINE>pr.put(pt1, r_1);<NEW_LINE>}<NEW_LINE>Integer r_2 = (Integer) pr.get(pt2);<NEW_LINE>if (r_2 == null) {<NEW_LINE>r_2 = new Integer(random.nextInt());<NEW_LINE>pr.put(pt2, r_2);<NEW_LINE>}<NEW_LINE>result = r_1.intValue<MASK><NEW_LINE>if (result == 0) {<NEW_LINE>result = pt1.hashCode() - pt2.hashCode();<NEW_LINE>if (result == 0) {<NEW_LINE>// v unlikely - inconsistent but better than losing a peer<NEW_LINE>result = 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return (result);<NEW_LINE>} | () - r_2.intValue(); |
894,109 | public void createPartControl(Composite parent) {<NEW_LINE>Server server = ServerManager.getInstance().getServer(serverId);<NEW_LINE>this.setPartName("Connections[" + <MASK><NEW_LINE>GridLayout layout = new GridLayout(1, true);<NEW_LINE>layout.marginHeight = 5;<NEW_LINE>layout.marginWidth = 5;<NEW_LINE>parent.setLayout(layout);<NEW_LINE>parent.setBackground(ColorUtil.getInstance().getColor(SWT.COLOR_WHITE));<NEW_LINE>parent.setBackgroundMode(SWT.INHERIT_FORCE);<NEW_LINE>canvas = new FigureCanvas(parent);<NEW_LINE>canvas.setLayoutData(new GridData(GridData.FILL_BOTH));<NEW_LINE>canvas.setScrollBarVisibility(FigureCanvas.NEVER);<NEW_LINE>canvas.addControlListener(new ControlListener() {<NEW_LINE><NEW_LINE>public void controlMoved(ControlEvent arg0) {<NEW_LINE>}<NEW_LINE><NEW_LINE>public void controlResized(ControlEvent arg0) {<NEW_LINE>Rectangle r = canvas.getClientArea();<NEW_LINE>xyGraph.setSize(r.width, r.height);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>xyGraph = new XYGraph();<NEW_LINE>xyGraph.setShowLegend(true);<NEW_LINE>xyGraph.setShowTitle(false);<NEW_LINE>canvas.setContents(xyGraph);<NEW_LINE>xyGraph.primaryXAxis.setDateEnabled(true);<NEW_LINE>xyGraph.primaryXAxis.setShowMajorGrid(true);<NEW_LINE>xyGraph.primaryYAxis.setAutoScale(true);<NEW_LINE>xyGraph.primaryYAxis.setShowMajorGrid(true);<NEW_LINE>xyGraph.primaryXAxis.setFormatPattern("HH:mm:ss");<NEW_LINE>xyGraph.primaryYAxis.setFormatPattern("#,##0");<NEW_LINE>xyGraph.primaryXAxis.setTitle("");<NEW_LINE>xyGraph.primaryYAxis.setTitle("");<NEW_LINE>CircularBufferDataProvider totalProvider = new CircularBufferDataProvider(true);<NEW_LINE>totalProvider.setBufferSize(BUFFER_SIZE);<NEW_LINE>totalProvider.setCurrentXDataArray(new double[] {});<NEW_LINE>totalProvider.setCurrentYDataArray(new double[] {});<NEW_LINE>totalTrace = new Trace("Total (SUM)", xyGraph.primaryXAxis, xyGraph.primaryYAxis, totalProvider);<NEW_LINE>totalTrace.setPointStyle(PointStyle.NONE);<NEW_LINE>totalTrace.setLineWidth(PManager.getInstance().getInt(PreferenceConstants.P_CHART_LINE_WIDTH));<NEW_LINE>totalTrace.setTraceType(TraceType.SOLID_LINE);<NEW_LINE>totalTrace.setTraceColor(ColorUtil.getInstance().getColor(SWT.COLOR_DARK_RED));<NEW_LINE>xyGraph.addTrace(totalTrace);<NEW_LINE>CircularBufferDataProvider activeProvider = new CircularBufferDataProvider(true);<NEW_LINE>activeProvider.setBufferSize(BUFFER_SIZE);<NEW_LINE>activeProvider.setCurrentXDataArray(new double[] {});<NEW_LINE>activeProvider.setCurrentYDataArray(new double[] {});<NEW_LINE>activeTrace = new Trace("Running (SUM)", xyGraph.primaryXAxis, xyGraph.primaryYAxis, activeProvider);<NEW_LINE>activeTrace.setPointStyle(PointStyle.NONE);<NEW_LINE>activeTrace.setLineWidth(PManager.getInstance().getInt(PreferenceConstants.P_CHART_LINE_WIDTH));<NEW_LINE>activeTrace.setTraceType(TraceType.SOLID_LINE);<NEW_LINE>activeTrace.setTraceColor(ColorUtil.getInstance().getColor(SWT.COLOR_DARK_GREEN));<NEW_LINE>xyGraph.addTrace(activeTrace);<NEW_LINE>ScouterUtil.addHorizontalRangeListener(xyGraph.getPlotArea(), new OpenDigestTableAction(serverId), true);<NEW_LINE>IToolBarManager man = getViewSite().getActionBars().getToolBarManager();<NEW_LINE>man.add(new OpenDbDailyConnView(serverId));<NEW_LINE>Action fixRangeAct = new Action("Pin Range", IAction.AS_CHECK_BOX) {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>fixRange = isChecked();<NEW_LINE>}<NEW_LINE>};<NEW_LINE>fixRangeAct.setImageDescriptor(ImageUtil.getImageDescriptor(Images.pin));<NEW_LINE>man.add(fixRangeAct);<NEW_LINE>thread = new RefreshThread(this, REFRESH_INTERVAL);<NEW_LINE>thread.start();<NEW_LINE>} | server.getName() + "]"); |
828,084 | private static void runPlay2x(String playVersion, String scalaVersion, String jacksonVersion) throws Exception {<NEW_LINE>String testAppVersion;<NEW_LINE>if (playVersion.equals("2.0")) {<NEW_LINE>testAppVersion = "2.0.x";<NEW_LINE>} else if (playVersion.equals("2.1.0")) {<NEW_LINE>// there are some incompatibilities between 2.1.0 and other 2.1.x<NEW_LINE>testAppVersion = "2.1.0";<NEW_LINE>} else {<NEW_LINE>testAppVersion = playVersion.substring(0, playVersion.lastIndexOf('.')) + ".x";<NEW_LINE>}<NEW_LINE>String scalaMajorVersion = scalaVersion.substring(0, scalaVersion.lastIndexOf('.'));<NEW_LINE>String profile;<NEW_LINE>JavaVersion[] javaVersions;<NEW_LINE>if (playVersion.startsWith("2.0")) {<NEW_LINE>profile = "play-2.0.x";<NEW_LINE>// scala 2.9 doesn't support 1.8<NEW_LINE>javaVersions = new JavaVersion[] { JAVA7, JAVA6 };<NEW_LINE>} else if (playVersion.startsWith("2.1")) {<NEW_LINE>profile = "play-2.1.x";<NEW_LINE>javaVersions = new JavaVersion[] { JAVA8, JAVA7, JAVA6 };<NEW_LINE>} else if (playVersion.startsWith("2.2") || playVersion.startsWith("2.3")) {<NEW_LINE>profile = "play-2.2.x";<NEW_LINE>javaVersions = new JavaVersion[] { JAVA8, JAVA7, JAVA6 };<NEW_LINE>} else {<NEW_LINE>// play version is 2.4+<NEW_LINE>profile = "play-2.4.x";<NEW_LINE>javaVersions = new JavaVersion[] { JAVA8 };<NEW_LINE>}<NEW_LINE>Util.updateLibVersion(MODULE_PATH, "play.version", playVersion);<NEW_LINE>Util.<MASK><NEW_LINE>Util.updateLibVersion(MODULE_PATH, "scala.version", scalaVersion);<NEW_LINE>Util.updateLibVersion(MODULE_PATH, "jackson.version", jacksonVersion);<NEW_LINE>Util.updateLibVersion(MODULE_PATH, "test.app.version", testAppVersion);<NEW_LINE>Util.updateLibVersion(MODULE_PATH, "test.app.language", "scala");<NEW_LINE>Util.runTests(MODULE_PATH, new String[] { "play-2.x", profile }, javaVersions);<NEW_LINE>Util.updateLibVersion(MODULE_PATH, "test.app.language", "java");<NEW_LINE>Util.runTests(MODULE_PATH, new String[] { "play-2.x", profile }, javaVersions);<NEW_LINE>} | updateLibVersion(MODULE_PATH, "scala.major.version", scalaMajorVersion); |
1,292,059 | private List<Object> transformInput(List iLeft, Object iRight, OLuceneFullTextIndex index, MemoryIndex memoryIndex) {<NEW_LINE>Integer collectionIndex = getCollectionIndex(iLeft);<NEW_LINE>if (collectionIndex == -1) {<NEW_LINE>// collection not found;<NEW_LINE>return iLeft;<NEW_LINE>}<NEW_LINE>if (collectionIndex > 1) {<NEW_LINE>throw new UnsupportedOperationException("Index of collection cannot be > 1");<NEW_LINE>}<NEW_LINE>// otherwise the input is [val,[]] or [[],val]<NEW_LINE>Collection collection = (Collection) iLeft.get(collectionIndex);<NEW_LINE>if (iLeft.size() == 1) {<NEW_LINE>return new ArrayList<Object>(collection);<NEW_LINE>}<NEW_LINE>List<Object> transformed = new ArrayList<Object>(collection.size());<NEW_LINE>for (Object o : collection) {<NEW_LINE>List<Object> objects = new ArrayList<Object>();<NEW_LINE>// [[],val]<NEW_LINE>if (collectionIndex == 0) {<NEW_LINE>objects.add(o);<NEW_LINE>objects.add<MASK><NEW_LINE>// [val,[]]<NEW_LINE>} else {<NEW_LINE>objects.add(iLeft.get(0));<NEW_LINE>objects.add(o);<NEW_LINE>}<NEW_LINE>transformed.add(objects);<NEW_LINE>}<NEW_LINE>return transformed;<NEW_LINE>} | (iLeft.get(1)); |
1,343,326 | public com.amazonaws.services.ecr.model.ValidationException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.ecr.model.ValidationException validationException = new com.amazonaws.services.ecr.model.ValidationException(null);<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>} 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 validationException;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
396,300 | private void listSubFiles(File file, String pattern, boolean isAbsolute, boolean isSub, boolean ignoreCase, Context ctx, Sequence result) {<NEW_LINE>if (file == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>File[] subs = file.listFiles();<NEW_LINE>if (subs == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (File sub : subs) {<NEW_LINE>if (sub.isFile()) {<NEW_LINE>if (pattern == null || StringUtils.matches(sub.getName(), pattern, ignoreCase)) {<NEW_LINE>if (isAbsolute) {<NEW_LINE><MASK><NEW_LINE>result.add(LocalFile.removeMainPath(pathName, ctx));<NEW_LINE>} else {<NEW_LINE>result.add(sub.getName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (isSub) {<NEW_LINE>listSubFiles(sub, pattern, isAbsolute, isSub, ignoreCase, ctx, result);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | String pathName = sub.getAbsolutePath(); |
969,729 | public void onInitializeClient() {<NEW_LINE>if (INSTANCE == null) {<NEW_LINE>INSTANCE = this;<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>LOG.info("Initializing Meteor Client");<NEW_LINE>// Global minecraft client accessor<NEW_LINE>mc = MinecraftClient.getInstance();<NEW_LINE>// Register event handlers<NEW_LINE>EVENT_BUS.registerLambdaFactory("meteordevelopment.meteorclient", (lookupInMethod, klass) -> (MethodHandles.Lookup) lookupInMethod.invoke(null, klass, MethodHandles.lookup()));<NEW_LINE>// Pre-load<NEW_LINE>Systems.addPreLoadTask(() -> {<NEW_LINE>if (!FOLDER.exists()) {<NEW_LINE>FOLDER.getParentFile().mkdirs();<NEW_LINE>FOLDER.mkdir();<NEW_LINE>Modules.get().get(<MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>// Pre init<NEW_LINE>init(InitStage.Pre);<NEW_LINE>// Register module categories<NEW_LINE>Categories.init();<NEW_LINE>// Load systems<NEW_LINE>Systems.init();<NEW_LINE>EVENT_BUS.subscribe(this);<NEW_LINE>AddonManager.ADDONS.forEach(MeteorAddon::onInitialize);<NEW_LINE>Modules.get().sortModules();<NEW_LINE>// Load saves<NEW_LINE>Systems.load();<NEW_LINE>// Post init<NEW_LINE>init(InitStage.Post);<NEW_LINE>// Shutdown hook<NEW_LINE>Runtime.getRuntime().addShutdownHook(new Thread(() -> {<NEW_LINE>OnlinePlayers.leave();<NEW_LINE>Systems.save();<NEW_LINE>GuiThemes.save();<NEW_LINE>}));<NEW_LINE>} | DiscordPresence.class).toggle(); |
1,398,308 | public boolean execute() {<NEW_LINE>Progress.start(progress);<NEW_LINE>PreviewController controller = Lookup.getDefault().lookup(PreviewController.class);<NEW_LINE>controller.getModel(workspace).getProperties().putValue(PreviewProperty.VISIBILITY_RATIO, 1.0);<NEW_LINE>controller.refreshPreview(workspace);<NEW_LINE>PreviewProperties props = controller.getModel(workspace).getProperties();<NEW_LINE>Rectangle size = new Rectangle(pageSize);<NEW_LINE>if (landscape) {<NEW_LINE>size = new Rectangle(pageSize.rotate());<NEW_LINE>}<NEW_LINE>Color col = props.getColorValue(PreviewProperty.BACKGROUND_COLOR);<NEW_LINE>size.setBackgroundColor(new BaseColor(col.getRed(), col.getGreen(), col.getBlue()));<NEW_LINE><MASK><NEW_LINE>PdfWriter pdfWriter = null;<NEW_LINE>try {<NEW_LINE>pdfWriter = PdfWriter.getInstance(document, stream);<NEW_LINE>pdfWriter.setPdfVersion(PdfWriter.PDF_VERSION_1_5);<NEW_LINE>pdfWriter.setFullCompression();<NEW_LINE>} catch (DocumentException ex) {<NEW_LINE>Exceptions.printStackTrace(ex);<NEW_LINE>}<NEW_LINE>document.open();<NEW_LINE>PdfContentByte cb = pdfWriter.getDirectContent();<NEW_LINE>cb.saveState();<NEW_LINE>props.putValue(PDFTarget.LANDSCAPE, landscape);<NEW_LINE>props.putValue(PDFTarget.PAGESIZE, size);<NEW_LINE>props.putValue(PDFTarget.MARGIN_TOP, new Float(marginTop));<NEW_LINE>props.putValue(PDFTarget.MARGIN_LEFT, new Float(marginLeft));<NEW_LINE>props.putValue(PDFTarget.MARGIN_BOTTOM, new Float(marginBottom));<NEW_LINE>props.putValue(PDFTarget.MARGIN_RIGHT, new Float(marginRight));<NEW_LINE>props.putValue(PDFTarget.PDF_CONTENT_BYTE, cb);<NEW_LINE>target = (PDFTarget) controller.getRenderTarget(RenderTarget.PDF_TARGET, workspace);<NEW_LINE>if (target instanceof LongTask) {<NEW_LINE>((LongTask) target).setProgressTicket(progress);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>controller.render(target, workspace);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>cb.restoreState();<NEW_LINE>document.close();<NEW_LINE>Progress.finish(progress);<NEW_LINE>props.putValue(PDFTarget.PDF_CONTENT_BYTE, null);<NEW_LINE>props.putValue(PDFTarget.PAGESIZE, null);<NEW_LINE>return !cancel;<NEW_LINE>} | Document document = new Document(size); |
202,183 | private Tensor vectorMatrixProduct(IndexedTensor a, IndexedTensor b, TensorType reducedType, boolean swapped) {<NEW_LINE>if (a.type().dimensions().size() != 1 || b.type().dimensions().size() != 2) {<NEW_LINE>throw new IllegalArgumentException("Wrong dimension sizes for tensors for vector-matrix product");<NEW_LINE>}<NEW_LINE>IndexedTensor.BoundBuilder builder = (IndexedTensor.BoundBuilder) IndexedTensor.Builder.of(reducedType);<NEW_LINE>DimensionSizes sizesA = a.dimensionSizes();<NEW_LINE><MASK><NEW_LINE>Reduce.ValueAggregator agg = Reduce.ValueAggregator.ofType(aggregator);<NEW_LINE>for (int ib = 0; ib < sizesB.size(0); ++ib) {<NEW_LINE>agg.reset();<NEW_LINE>for (int ic = 0; ic < Math.min(sizesA.size(0), sizesB.size(1)); ++ic) {<NEW_LINE>double va = a.get(ic);<NEW_LINE>double vb = b.get(ib * sizesB.size(1) + ic);<NEW_LINE>double result = swapped ? combinator.applyAsDouble(vb, va) : combinator.applyAsDouble(va, vb);<NEW_LINE>agg.aggregate(result);<NEW_LINE>}<NEW_LINE>builder.cellByDirectIndex(ib, agg.aggregatedValue());<NEW_LINE>}<NEW_LINE>return builder.build();<NEW_LINE>} | DimensionSizes sizesB = b.dimensionSizes(); |
1,135,915 | private Map<String, Map<String, String>> reassignSegments(String instancePartitionType, Map<String, Map<String, String>> currentAssignment, InstancePartitions instancePartitions, boolean bootstrap) {<NEW_LINE>Map<String, Map<String, String>> newAssignment;<NEW_LINE>if (bootstrap) {<NEW_LINE>LOGGER.info("Bootstrapping segment assignment for {} segments of table: {}", instancePartitionType, _realtimeTableName);<NEW_LINE>// When bootstrap is enabled, start with an empty assignment and reassign all segments<NEW_LINE>newAssignment = new TreeMap<>();<NEW_LINE>for (String segment : currentAssignment.keySet()) {<NEW_LINE>List<String> assignedInstances = assignCompletedSegment(segment, newAssignment, instancePartitions);<NEW_LINE>newAssignment.put(segment, SegmentAssignmentUtils.getInstanceStateMap(assignedInstances, SegmentStateModel.ONLINE));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (instancePartitions.getNumReplicaGroups() == 1) {<NEW_LINE>// Non-replica-group based assignment<NEW_LINE>List<String> instances = SegmentAssignmentUtils.getInstancesForNonReplicaGroupBasedAssignment(instancePartitions, _replication);<NEW_LINE>newAssignment = SegmentAssignmentUtils.rebalanceTableWithHelixAutoRebalanceStrategy(currentAssignment, instances, _replication);<NEW_LINE>} else {<NEW_LINE>// Replica-group based assignment<NEW_LINE>Map<Integer, List<String>> partitionGroupIdToSegmentsMap = new HashMap<>();<NEW_LINE>for (String segmentName : currentAssignment.keySet()) {<NEW_LINE>int partitionGroupId = SegmentUtils.getRealtimeSegmentPartitionId(segmentName, _realtimeTableName, _helixManager, _partitionColumn);<NEW_LINE>partitionGroupIdToSegmentsMap.computeIfAbsent(partitionGroupId, k -> new ArrayList<>()).add(segmentName);<NEW_LINE>}<NEW_LINE>// NOTE: Shuffle the segments within the current assignment to avoid moving only new segments to the new added<NEW_LINE>// servers, which might cause hotspot servers because queries tend to hit the new segments. Use the table<NEW_LINE>// name hash as the random seed for the shuffle so that the result is deterministic.<NEW_LINE>Random random = new Random(_realtimeTableName.hashCode());<NEW_LINE>for (List<String> segments : partitionGroupIdToSegmentsMap.values()) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>newAssignment = SegmentAssignmentUtils.rebalanceReplicaGroupBasedTable(currentAssignment, instancePartitions, partitionGroupIdToSegmentsMap);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return newAssignment;<NEW_LINE>} | Collections.shuffle(segments, random); |
601,329 | public static void dumpMemoryInfo(Metrics metrics, String logDir) {<NEW_LINE>if (metrics == null || logDir == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Path dir = Paths.get(logDir);<NEW_LINE>Files.createDirectories(dir);<NEW_LINE>Path file = dir.resolve("memory.log");<NEW_LINE>try (BufferedWriter writer = Files.newBufferedWriter(file, StandardOpenOption.CREATE, StandardOpenOption.APPEND)) {<NEW_LINE>List<Metric> list = new ArrayList<>();<NEW_LINE>list.addAll(metrics.getMetric("Heap"));<NEW_LINE>list.addAll<MASK><NEW_LINE>list.addAll(metrics.getMetric("cpu"));<NEW_LINE>list.addAll(metrics.getMetric("rss"));<NEW_LINE>int gpuCount = CudaUtils.getGpuCount();<NEW_LINE>for (int i = 0; i < gpuCount; ++i) {<NEW_LINE>list.addAll(metrics.getMetric("GPU-" + i));<NEW_LINE>}<NEW_LINE>for (Metric metric : list) {<NEW_LINE>writer.append(metric.toString());<NEW_LINE>writer.newLine();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>logger.error("Failed dump memory log", e);<NEW_LINE>}<NEW_LINE>} | (metrics.getMetric("NonHeap")); |
967,650 | static String printRules(AutomationCommandsPluggable autoCommands, Map<String, String> ruleUIDs) {<NEW_LINE>int[] columnWidths = new int[] { COLUMN_ID, COLUMN_RULE_UID, COLUMN_RULE_NAME, COLUMN_RULE_STATUS };<NEW_LINE>List<String> columnValues = new ArrayList<String>();<NEW_LINE>columnValues.add(ID);<NEW_LINE>columnValues.add(UID);<NEW_LINE>columnValues.add(NAME);<NEW_LINE>columnValues.add(STATUS);<NEW_LINE>String titleRow = Utils.getRow(columnWidths, columnValues);<NEW_LINE>List<String> rulesRows = new ArrayList<String>();<NEW_LINE>for (int i = 1; i <= ruleUIDs.size(); i++) {<NEW_LINE>String id = new Integer(i).toString();<NEW_LINE>String uid = ruleUIDs.get(id);<NEW_LINE>columnValues.set(0, id);<NEW_LINE>columnValues.set(1, uid);<NEW_LINE>Rule rule = autoCommands.getRule(uid);<NEW_LINE>columnValues.set(2, rule.getName());<NEW_LINE>columnValues.set(3, autoCommands.getRuleStatus(uid).toString());<NEW_LINE>rulesRows.add(Utils.getRow(columnWidths, columnValues));<NEW_LINE>}<NEW_LINE>return Utils.getTableContent(<MASK><NEW_LINE>} | TABLE_WIDTH, columnWidths, rulesRows, titleRow); |
320,742 | public static <I> I tryPreferredInterfaces(Class<I> cls, Map<REFIID, ? extends Class<?>> preferred, InterfaceSupplier supplier) {<NEW_LINE>PointerByReference ppClient = new PointerByReference();<NEW_LINE>for (Map.Entry<REFIID, ? extends Class<?>> ent : preferred.entrySet()) {<NEW_LINE>try {<NEW_LINE>COMUtils.checkRC(supplier.get(ent.getKey(), ppClient));<NEW_LINE>if (ppClient.getValue() == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Object impl = ent.getValue().getConstructor(Pointer.class).newInstance(ppClient.getValue());<NEW_LINE>Method instanceFor = cls.getMethod("instanceFor", ent.getValue());<NEW_LINE>Object instance = instanceFor.invoke(null, impl);<NEW_LINE>return (I) instance;<NEW_LINE>} catch (COMException e) {<NEW_LINE>Msg.debug(DbgEngUtil.class, e + " (" + ent.getValue() + ")");<NEW_LINE>// TODO: Only try next on E_NOINTERFACE?<NEW_LINE>// Try next<NEW_LINE>} catch (Exception e) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw new DbgEngRuntimeException("None of the preferred interfaces are supported");<NEW_LINE>} | throw new AssertionError("INTERNAL: Unexpected exception", e); |
717,607 | private Binding findImport(char[][] compoundName, int length) {<NEW_LINE>recordQualifiedReference(compoundName);<NEW_LINE>ModuleBinding module = module();<NEW_LINE>Binding binding = this.environment.getTopLevelPackage(compoundName[0]);<NEW_LINE>int i = 1;<NEW_LINE>foundNothingOrType: if (binding != null) {<NEW_LINE>PackageBinding packageBinding = (PackageBinding) binding;<NEW_LINE>while (i < length) {<NEW_LINE>binding = packageBinding.getTypeOrPackage(compoundName[i++], module, i < length);<NEW_LINE>if (binding instanceof ReferenceBinding && binding.problemId() == ProblemReasons.NotAccessible) {<NEW_LINE>return this.environment.convertToRawType((TypeBinding) binding, false);<NEW_LINE>}<NEW_LINE>if (binding == null) {<NEW_LINE>break foundNothingOrType;<NEW_LINE>} else if (!binding.isValidBinding()) {<NEW_LINE>if (binding.problemId() == ProblemReasons.Ambiguous && packageBinding instanceof SplitPackageBinding)<NEW_LINE>// pass the split package to the caller so they can report conflictingPackagesFromModules()<NEW_LINE>return packageBinding;<NEW_LINE>binding = null;<NEW_LINE>break foundNothingOrType;<NEW_LINE>}<NEW_LINE>if (!(binding instanceof PackageBinding)) {<NEW_LINE>// filter out empty parent-packages<NEW_LINE>PackageBinding visibleFor = packageBinding.getVisibleFor(module, false);<NEW_LINE>if (visibleFor instanceof SplitPackageBinding)<NEW_LINE>return visibleFor;<NEW_LINE>break foundNothingOrType;<NEW_LINE>}<NEW_LINE>packageBinding = (PackageBinding) binding;<NEW_LINE>}<NEW_LINE>if (packageBinding.isValidBinding() && !module.canAccess(packageBinding))<NEW_LINE>return new ProblemPackageBinding(compoundName, ProblemReasons.NotAccessible);<NEW_LINE>return packageBinding;<NEW_LINE>}<NEW_LINE>ReferenceBinding type;<NEW_LINE>if (binding == null) {<NEW_LINE>if (compilerOptions().complianceLevel >= ClassFileConstants.JDK1_4)<NEW_LINE>return problemType(compoundName, i, null);<NEW_LINE>type = findType(compoundName[0], this.environment.defaultPackage, this.environment.defaultPackage);<NEW_LINE>if (type == null || !type.isValidBinding())<NEW_LINE>return new ProblemReferenceBinding(CharOperation.subarray(compoundName, 0, i), null, ProblemReasons.NotFound);<NEW_LINE>// reset to look for member types inside the default package type<NEW_LINE>i = 1;<NEW_LINE>} else {<NEW_LINE>type = (ReferenceBinding) binding;<NEW_LINE>}<NEW_LINE>while (i < length) {<NEW_LINE>// type imports are necessarily raw for all except last<NEW_LINE>type = (ReferenceBinding) this.environment.convertToRawType(type, false);<NEW_LINE>if (!type.canBeSeenBy(this.fPackage))<NEW_LINE>return new ProblemReferenceBinding(CharOperation.subarray(compoundName, 0, i<MASK><NEW_LINE>char[] name = compoundName[i++];<NEW_LINE>// does not look for inherited member types on purpose, only immediate members<NEW_LINE>type = type.getMemberType(name);<NEW_LINE>if (type == null)<NEW_LINE>return new ProblemReferenceBinding(CharOperation.subarray(compoundName, 0, i), null, ProblemReasons.NotFound);<NEW_LINE>}<NEW_LINE>// GROOVY edit<NEW_LINE>// if (!type.canBeSeenBy(this.fPackage))<NEW_LINE>if (!canBeSeenBy(type, this.fPackage))<NEW_LINE>// GROOVY end<NEW_LINE>return new ProblemReferenceBinding(compoundName, type, ProblemReasons.NotVisible);<NEW_LINE>return type;<NEW_LINE>} | ), type, ProblemReasons.NotVisible); |
158,760 | public void runRunnablesMulti() {<NEW_LINE>if (runnables == null || runnables.size() == 0) {<NEW_LINE>throw new RuntimeException("No runnable(s) was found to run. You can add one or more runnables using 'addRunnable(Runnable runnable)'");<NEW_LINE>}<NEW_LINE>ExecutorService executorService = newFixedThreadPool(numberOfThreads);<NEW_LINE>try {<NEW_LINE>final AtomicInteger functionIndex = new AtomicInteger();<NEW_LINE>for (int i = 0; i < loopCount; i++) {<NEW_LINE>for (int j = 0; j < numberOfThreads; j++) {<NEW_LINE>try {<NEW_LINE>LOGGER.info("Waiting for the next test flight to adjust the overall ramp up time, " + "waiting time in the transit now = " + delayBetweenTwoThreadsInMilliSecs);<NEW_LINE>sleep(delayBetweenTwoThreadsInMilliSecs.longValue());<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>LOGGER.info(Thread.currentThread().getName() + " Executor - *Start... Time = " + now());<NEW_LINE>executorService.execute(runnables.get<MASK><NEW_LINE>LOGGER.info(Thread.currentThread().getName() + " Executor - *Finished Time = " + now());<NEW_LINE>if (functionIndex.get() == runnables.size()) {<NEW_LINE>functionIndex.set(0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception interruptEx) {<NEW_LINE>throw new RuntimeException(interruptEx);<NEW_LINE>} finally {<NEW_LINE>executorService.shutdown();<NEW_LINE>while (!executorService.isTerminated()) {<NEW_LINE>// --------------------------------------<NEW_LINE>// wait for all tasks to finish execution<NEW_LINE>// --------------------------------------<NEW_LINE>// LOGGER.info("Still waiting for all threads to complete execution...");<NEW_LINE>}<NEW_LINE>LOGGER.warn("** Completed executing all virtual-user scenarios! **");<NEW_LINE>}<NEW_LINE>} | (functionIndex.getAndIncrement())); |
1,033,422 | public static void multTranC(DMatrixRMaj A, DMatrixRMaj B, DMatrixRMaj C, DMatrixRMaj output) {<NEW_LINE>double t11 = A.data[0] * B.data[0] + A.data[1] * B.data[3] + A.data[2] * B.data[6];<NEW_LINE>double t12 = A.data[0] * B.data[1] + A.data[1] * B.data[4] + A.data[2] * B.data[7];<NEW_LINE>double t13 = A.data[0] * B.data[2] + A.data[1] * B.data[5] + A.data[2] * B.data[8];<NEW_LINE>double t21 = A.data[3] * B.data[0] + A.data[4] * B.data[3] + A.data[5] * B.data[6];<NEW_LINE>double t22 = A.data[3] * B.data[1] + A.data[4] * B.data[4] + A.data[5] * B.data[7];<NEW_LINE>double t23 = A.data[3] * B.data[2] + A.data[4] * B.data[5] + A.data[5] * B.data[8];<NEW_LINE>double t31 = A.data[6] * B.data[0] + A.data[7] * B.data[3] + A.data[8] * B.data[6];<NEW_LINE>double t32 = A.data[6] * B.data[1] + A.data[7] * B.data[4] + A.data[8] * B.data[7];<NEW_LINE>double t33 = A.data[6] * B.data[2] + A.data[7] * B.data[5] + A.data[8<MASK><NEW_LINE>output.data[0] = t11 * C.data[0] + t12 * C.data[1] + t13 * C.data[2];<NEW_LINE>output.data[1] = t11 * C.data[3] + t12 * C.data[4] + t13 * C.data[5];<NEW_LINE>output.data[2] = t11 * C.data[6] + t12 * C.data[7] + t13 * C.data[8];<NEW_LINE>output.data[3] = t21 * C.data[0] + t22 * C.data[1] + t23 * C.data[2];<NEW_LINE>output.data[4] = t21 * C.data[3] + t22 * C.data[4] + t23 * C.data[5];<NEW_LINE>output.data[5] = t21 * C.data[6] + t22 * C.data[7] + t23 * C.data[8];<NEW_LINE>output.data[6] = t31 * C.data[0] + t32 * C.data[1] + t33 * C.data[2];<NEW_LINE>output.data[7] = t31 * C.data[3] + t32 * C.data[4] + t33 * C.data[5];<NEW_LINE>output.data[8] = t31 * C.data[6] + t32 * C.data[7] + t33 * C.data[8];<NEW_LINE>} | ] * B.data[8]; |
1,755,308 | public static void synchronizeMonitorWithFlag(TomcatManager tm, boolean alsoSetPort) throws IOException, SAXException {<NEW_LINE>String url = tm.getUri();<NEW_LINE>boolean monitorFlag = getMonitorFlag(url);<NEW_LINE>boolean monitorModuleAvailable = isMonitorEnabled();<NEW_LINE>boolean shouldInstall = monitorModuleAvailable && monitorFlag;<NEW_LINE>// find the web.xml file<NEW_LINE>File webXML = getDefaultWebXML(tm);<NEW_LINE>if (webXML == null) {<NEW_LINE>Logger.getLogger(MonitorSupport.class.getName()).log(Level.INFO, <MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>WebApp webApp = DDProvider.getDefault().getDDRoot(webXML);<NEW_LINE>if (webApp == null) {<NEW_LINE>Logger.getLogger(MonitorSupport.class.getName()).log(Level.INFO, null, new Exception(url));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>boolean needsSave = false;<NEW_LINE>boolean result;<NEW_LINE>if (shouldInstall) {<NEW_LINE>addMonitorJars(tm);<NEW_LINE>result = changeFilterMonitor(webApp, true);<NEW_LINE>needsSave = needsSave || result;<NEW_LINE>if (alsoSetPort) {<NEW_LINE>result = specifyFilterPortParameter(webApp);<NEW_LINE>needsSave = needsSave || result;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>result = changeFilterMonitor(webApp, false);<NEW_LINE>needsSave = needsSave || result;<NEW_LINE>}<NEW_LINE>if (needsSave) {<NEW_LINE>OutputStream os = new FileOutputStream(webXML);<NEW_LINE>try {<NEW_LINE>webApp.write(os);<NEW_LINE>} finally {<NEW_LINE>os.close();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | null, new Exception(url)); |
949,338 | public // layer return the fault response, or should we return the fault from here?<NEW_LINE>EndpointReferenceType register(String globalId, EndpointReferenceType partEpr) throws WSATException {<NEW_LINE>// Get the transaction - this should exist. We should always be registering<NEW_LINE>// into an existing active transaction.<NEW_LINE>WSATCoordinatorTran wsatTran = WSATTransaction.getCoordTran(globalId);<NEW_LINE>if (wsatTran == null) {<NEW_LINE>// Not a known transaction. This should result in the WS-Coor spec<NEW_LINE>// CannotRegisterParticipant fault being returned.<NEW_LINE>throw new WSATFaultException(WSATFault.getCannotRegisterParticipant(Tr.formatMessage(TC, "NO_WSAT_TRAN_CWLIB0201", globalId)));<NEW_LINE>}<NEW_LINE>// Add the new participant and enlist with the transaction manager so it<NEW_LINE>// will take part in 2PC transaction completion.<NEW_LINE>WSATParticipant participant = wsatTran.addParticipant(partEpr);<NEW_LINE>tranService.registerParticipant(globalId, participant);<NEW_LINE>return participant<MASK><NEW_LINE>} | .getCoordinator().getEndpointReference(); |
1,347,421 | 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 factoryName = <MASK><NEW_LINE>if (factoryName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'factories'.", id)));<NEW_LINE>}<NEW_LINE>String triggerName = Utils.getValueFromIdByName(id, "triggers");<NEW_LINE>if (triggerName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'triggers'.", id)));<NEW_LINE>}<NEW_LINE>this.deleteWithResponse(resourceGroupName, factoryName, triggerName, Context.NONE);<NEW_LINE>} | Utils.getValueFromIdByName(id, "factories"); |
1,260,440 | public int _compareTo(final IV o) {<NEW_LINE>final FullyInlineTypedLiteralIV<?> t = ((FullyInlineTypedLiteralIV<?>) o);<NEW_LINE>int ret = termCode - t.termCode;<NEW_LINE>if (ret < 0)<NEW_LINE>return -1;<NEW_LINE>if (ret > 0)<NEW_LINE>return 1;<NEW_LINE>switch(termCode) {<NEW_LINE>case ITermIndexCodes.TERM_CODE_LIT:<NEW_LINE>return IVUnicode.IVUnicodeComparator.INSTANCE.compare(label, t.label);<NEW_LINE>case ITermIndexCodes.TERM_CODE_LCL:<NEW_LINE>ret = IVUnicode.IVUnicodeComparator.INSTANCE.compare(language, t.language);<NEW_LINE>if (ret < 0)<NEW_LINE>return -1;<NEW_LINE>if (ret > 0)<NEW_LINE>return 1;<NEW_LINE>return IVUnicode.IVUnicodeComparator.INSTANCE.compare(label, t.label);<NEW_LINE>case ITermIndexCodes.TERM_CODE_DTL:<NEW_LINE>ret = IVUnicode.IVUnicodeComparator.INSTANCE.compare(datatype.stringValue(), t.datatype.stringValue());<NEW_LINE>// ret = datatype.stringValue().compareTo(t.datatype.stringValue());<NEW_LINE>if (ret < 0)<NEW_LINE>return -1;<NEW_LINE>if (ret > 0)<NEW_LINE>return 1;<NEW_LINE>return IVUnicode.IVUnicodeComparator.INSTANCE.<MASK><NEW_LINE>default:<NEW_LINE>throw new AssertionError();<NEW_LINE>}<NEW_LINE>} | compare(label, t.label); |
821,088 | public void write(org.apache.thrift.protocol.TProtocol prot, SyncValueMessage struct) throws org.apache.thrift.TException {<NEW_LINE>org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;<NEW_LINE>struct.header.write(oprot);<NEW_LINE>struct.store.write(oprot);<NEW_LINE>java.util.BitSet optionals = new java.util.BitSet();<NEW_LINE>if (struct.isSetValues()) {<NEW_LINE>optionals.set(0);<NEW_LINE>}<NEW_LINE>if (struct.isSetResponseTo()) {<NEW_LINE>optionals.set(1);<NEW_LINE>}<NEW_LINE>oprot.writeBitSet(optionals, 2);<NEW_LINE>if (struct.isSetValues()) {<NEW_LINE>{<NEW_LINE>oprot.writeI32(struct.values.size());<NEW_LINE>for (KeyedValues _iter36 : struct.values) {<NEW_LINE>_iter36.write(oprot);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (struct.isSetResponseTo()) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | oprot.writeI32(struct.responseTo); |
119,445 | private OrientDBConfig buildConfig(final Map<OGlobalConfiguration, Object> iProperties) {<NEW_LINE>Map<String, Object> pars = new HashMap<>(preopenProperties);<NEW_LINE>if (iProperties != null) {<NEW_LINE>for (Map.Entry<OGlobalConfiguration, Object> par : iProperties.entrySet()) {<NEW_LINE>pars.put(par.getKey().getKey(), par.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>OrientDBConfigBuilder builder = OrientDBConfig.builder();<NEW_LINE>final String connectionStrategy = pars != null ? (String) pars.get(OGlobalConfiguration.CLIENT_CONNECTION_STRATEGY.getKey()) : null;<NEW_LINE>if (connectionStrategy != null)<NEW_LINE>builder.addConfig(OGlobalConfiguration.CLIENT_CONNECTION_STRATEGY, connectionStrategy);<NEW_LINE>final String compressionMethod = pars != null ? (String) pars.get(OGlobalConfiguration.STORAGE_COMPRESSION_METHOD.getKey()) : null;<NEW_LINE>if (compressionMethod != null)<NEW_LINE>// SAVE COMPRESSION METHOD IN CONFIGURATION<NEW_LINE>builder.addConfig(OGlobalConfiguration.STORAGE_COMPRESSION_METHOD, compressionMethod);<NEW_LINE>final String encryptionMethod = pars != null ? (String) pars.get(OGlobalConfiguration.<MASK><NEW_LINE>if (encryptionMethod != null)<NEW_LINE>// SAVE ENCRYPTION METHOD IN CONFIGURATION<NEW_LINE>builder.addConfig(OGlobalConfiguration.STORAGE_ENCRYPTION_METHOD, encryptionMethod);<NEW_LINE>final String encryptionKey = pars != null ? (String) pars.get(OGlobalConfiguration.STORAGE_ENCRYPTION_KEY.getKey()) : null;<NEW_LINE>if (encryptionKey != null)<NEW_LINE>// SAVE ENCRYPTION KEY IN CONFIGURATION<NEW_LINE>builder.addConfig(OGlobalConfiguration.STORAGE_ENCRYPTION_KEY, encryptionKey);<NEW_LINE>for (Map.Entry<ATTRIBUTES, Object> attr : preopenAttributes.entrySet()) {<NEW_LINE>builder.addAttribute(attr.getKey(), attr.getValue());<NEW_LINE>}<NEW_LINE>builder.addConfig(OGlobalConfiguration.CREATE_DEFAULT_USERS, true);<NEW_LINE>for (ODatabaseListener oDatabaseListener : preopenListener) {<NEW_LINE>builder.addListener(oDatabaseListener);<NEW_LINE>}<NEW_LINE>return builder.build();<NEW_LINE>} | STORAGE_ENCRYPTION_METHOD.getKey()) : null; |
1,042,558 | public double swapRateDx2(double x, DoubleArray discountedCashFlowFixed, DoubleArray alphaFixed, DoubleArray discountedCashFlowIbor, DoubleArray alphaIbor) {<NEW_LINE>int sizeIbor = discountedCashFlowIbor.size();<NEW_LINE>int sizeFixed = discountedCashFlowFixed.size();<NEW_LINE>ArgChecker.isTrue(sizeIbor == alphaIbor.size(), "Length should be equal");<NEW_LINE>ArgChecker.isTrue(sizeFixed == alphaFixed.size(), "Length should be equal");<NEW_LINE>double f = 0.0;<NEW_LINE>double df = 0.0;<NEW_LINE>double df2 = 0.0;<NEW_LINE>double term;<NEW_LINE>for (int loopcf = 0; loopcf < sizeIbor; loopcf++) {<NEW_LINE>term = discountedCashFlowIbor.get(loopcf) * Math.exp(-alphaIbor.get(loopcf) * x - 0.5 * alphaIbor.get(loopcf) * alphaIbor.get(loopcf));<NEW_LINE>f += term;<NEW_LINE>df += -alphaIbor.get(loopcf) * term;<NEW_LINE>df2 += alphaIbor.get(loopcf) * alphaIbor.get(loopcf) * term;<NEW_LINE>}<NEW_LINE>double g = 0.0;<NEW_LINE>double dg = 0.0;<NEW_LINE>double dg2 = 0.0;<NEW_LINE>for (int loopcf = 0; loopcf < sizeFixed; loopcf++) {<NEW_LINE>term = discountedCashFlowFixed.get(loopcf) * Math.exp(-alphaFixed.get(loopcf) * x - 0.5 * alphaFixed.get(loopcf) * alphaFixed.get(loopcf));<NEW_LINE>g += term;<NEW_LINE>dg += -alphaFixed.get(loopcf) * term;<NEW_LINE>dg2 += alphaFixed.get(loopcf) * <MASK><NEW_LINE>}<NEW_LINE>double g2 = g * g;<NEW_LINE>double g3 = g * g2;<NEW_LINE>return -df2 / g + (2 * df * dg + f * dg2) / g2 - 2 * f * dg * dg / g3;<NEW_LINE>} | alphaFixed.get(loopcf) * term; |
445,653 | private void verifyResult(PrintWriter pw, String testName, long executionId, String expectedStatus) throws TestFailureException {<NEW_LINE>JobOperator jobOperator = BatchRuntime.getJobOperator();<NEW_LINE>if (testName.startsWith("recoverLocalJobs")) {<NEW_LINE>try {<NEW_LINE>JobExecution executionInst = jobOperator.getJobExecution(executionId);<NEW_LINE>String exitStatus = executionInst.getExitStatus();<NEW_LINE>String batchStatus = executionInst.getBatchStatus().name();<NEW_LINE>logger.info("verifyResult for " + testName + ", executionId=" + executionId + ",status from DB=" + batchStatus);<NEW_LINE>assertEquals(expectedStatus, batchStatus);<NEW_LINE>if (testName.equals("recoverLocalJobsInStartedWithExitStatusSetTest")) {<NEW_LINE>assertEquals(APP_SET_EXIT_STATUS, exitStatus);<NEW_LINE>} else {<NEW_LINE>assertEquals(expectedStatus, exitStatus);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>String msg = "ERROR: " + e.getMessage();<NEW_LINE>throw new TestFailureException(msg);<NEW_LINE>}<NEW_LINE>} else if (testName.startsWith("recoverStepExecution")) {<NEW_LINE>try {<NEW_LINE>List<StepExecution> stepExecutions = jobOperator.getStepExecutions(executionId);<NEW_LINE>assertEquals("Didn't find exactly one StepExecution for jobExec = " + executionId, 1, stepExecutions.size());<NEW_LINE>for (StepExecution stepExe : stepExecutions) {<NEW_LINE>String exitStatus = stepExe.getExitStatus();<NEW_LINE>String batchStatus = stepExe.getBatchStatus().name();<NEW_LINE>assertEquals(expectedStatus, batchStatus);<NEW_LINE>if (testName.equals("recoverStepExecutionInStartedWithExitStatusSetTest")) {<NEW_LINE>assertEquals(APP_SET_EXIT_STATUS, exitStatus);<NEW_LINE>} else {<NEW_LINE>assertEquals(expectedStatus, exitStatus);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>String msg <MASK><NEW_LINE>throw new TestFailureException(msg);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | = "ERROR: " + e.getMessage(); |
272,297 | public void sendNotification(Check check, Subscription subscription, List<Alert> alerts) throws NotificationFailedException {<NEW_LINE>String hubotUrl = StringUtils.trimToNull(seyrenConfig.getHubotUrl());<NEW_LINE>if (hubotUrl == null) {<NEW_LINE>LOGGER.warn("Hubot URL needs to be set before sending notifications to Hubot");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Map<String, Object> body = new HashMap<String, Object>();<NEW_LINE>body.put("seyrenUrl", seyrenConfig.getBaseUrl());<NEW_LINE>body.put("check", check);<NEW_LINE>body.put("subscription", subscription);<NEW_LINE>body.put("alerts", alerts);<NEW_LINE>body.put("rooms", subscription.getTarget<MASK><NEW_LINE>HttpClient client = HttpClientBuilder.create().useSystemProperties().build();<NEW_LINE>HttpPost post = new HttpPost(hubotUrl + "/seyren/alert");<NEW_LINE>try {<NEW_LINE>HttpEntity entity = new StringEntity(MAPPER.writeValueAsString(body), ContentType.APPLICATION_JSON);<NEW_LINE>post.setEntity(entity);<NEW_LINE>client.execute(post);<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new NotificationFailedException("Sending notification to Hubot at " + hubotUrl + " failed.", e);<NEW_LINE>} finally {<NEW_LINE>HttpClientUtils.closeQuietly(client);<NEW_LINE>}<NEW_LINE>} | ().split(",")); |
922,082 | static void generateEncoderVarData(final StringBuilder sb, final List<Token> tokens, final int level) throws IOException {<NEW_LINE>for (int i = 0, size = tokens.size(); i < size; ) {<NEW_LINE>final Token varDataToken = tokens.get(i);<NEW_LINE>if (varDataToken.signal() != Signal.BEGIN_VAR_DATA) {<NEW_LINE>throw new IllegalStateException("tokens must begin with BEGIN_VAR_DATA: token=" + varDataToken);<NEW_LINE>}<NEW_LINE>final String characterEncoding = characterEncoding(tokens.get(i + 3).encoding());<NEW_LINE>final String propertyName = toLowerSnakeCase(varDataToken.name());<NEW_LINE>final Token lengthToken = tokens.get(i + 2);<NEW_LINE>final Encoding lengthEncoding = lengthToken.encoding();<NEW_LINE>final PrimitiveType lengthType = lengthEncoding.primitiveType();<NEW_LINE>final String varDataType;<NEW_LINE>final String toBytesFn;<NEW_LINE>if (JavaUtil.isUtf8Encoding(characterEncoding)) {<NEW_LINE>varDataType = "&str";<NEW_LINE>toBytesFn = ".as_bytes()";<NEW_LINE>} else {<NEW_LINE>varDataType = "&[u8]";<NEW_LINE>toBytesFn = "";<NEW_LINE>}<NEW_LINE>// function to write slice ... todo - handle character encoding ?<NEW_LINE>indent(sb, level, "/// VAR_DATA ENCODER - character encoding: '%s'\n", characterEncoding);<NEW_LINE>indent(sb, level, "#[inline]\n");<NEW_LINE>indent(sb, level, "pub fn %s(&mut self, value: %s) {\n", propertyName, varDataType);<NEW_LINE>indent(sb, level + 1, "let limit = self.get_limit();\n");<NEW_LINE>indent(<MASK><NEW_LINE>indent(sb, level + 1, "self.set_limit(limit + %d + data_length);\n", lengthType.size());<NEW_LINE>indent(sb, level + 1, "self.get_buf_mut().put_%s_at(limit, data_length as %1$s);\n", rustTypeName(lengthType));<NEW_LINE>indent(sb, level + 1, "self.get_buf_mut().put_slice_at(limit + %d, value%s);\n", lengthType.size(), toBytesFn);<NEW_LINE>indent(sb, level, "}\n\n");<NEW_LINE>i += varDataToken.componentTokenCount();<NEW_LINE>}<NEW_LINE>} | sb, level + 1, "let data_length = value.len();\n"); |
1,539,971 | private void addFileResourceToServer(File file, long fileLength) {<NEW_LINE><MASK><NEW_LINE>fileResource.setFile(file.getAbsolutePath());<NEW_LINE>fileResource.setName(file.getName());<NEW_LINE>fileResource.setId(file.getAbsolutePath().hashCode());<NEW_LINE>fileResource.setLength(fileLength);<NEW_LINE>final String fileMd5 = FetchCoreUtils.getFileMd5String(file.getAbsolutePath());<NEW_LINE>if (fileMd5 != null) {<NEW_LINE>fileResource.setMd5(fileMd5);<NEW_LINE>}<NEW_LINE>final MutableExtras extras = new MutableExtras();<NEW_LINE>extras.putLong("contentLength", fileLength);<NEW_LINE>extras.putString("contentName", file.getName());<NEW_LINE>extras.putString("contentSampleKey", "contentSampleText");<NEW_LINE>fileResource.setExtras(extras);<NEW_LINE>fetchFileServer.addFileResource(fileResource);<NEW_LINE>downloadFileResourceUsingFetch();<NEW_LINE>fetch.getFetchFileServerCatalog(getCatalogRequest(), result -> {<NEW_LINE>Timber.d("Catalog:" + result.toString());<NEW_LINE>}, error -> Timber.d("Catalog Fetch error:" + error.toString()));<NEW_LINE>} | final FileResource fileResource = new FileResource(); |
1,846,864 | private void initEnvironmentVariables() {<NEW_LINE>int statusBarHeight = BarUtils.getStatusBarHeight(this);<NEW_LINE>int deviceWidth = ScreenUtils.getAppScreenWidth(this);<NEW_LINE>int deviceHeight = ScreenUtils.getAppScreenHeight(this);<NEW_LINE>int availableWidth = deviceWidth;<NEW_LINE>int availableHeight = deviceHeight - statusBarHeight;<NEW_LINE>statusBarHeight = DPUtil.px2dp(this, statusBarHeight);<NEW_LINE>deviceWidth = DPUtil.px2dp(this, deviceWidth);<NEW_LINE>deviceHeight = DPUtil.px2dp(this, deviceHeight);<NEW_LINE>availableWidth = DPUtil.px2dp(this, availableWidth);<NEW_LINE>availableHeight = DPUtil.px2dp(this, availableHeight);<NEW_LINE>Map<String, Object> envs = new LinkedHashMap<>();<NEW_LINE>envs.put(ENV_KEY_PLATFORM, "Android");<NEW_LINE>envs.put(ENV_KEY_OS_VERSION, Build.VERSION.RELEASE);<NEW_LINE>envs.put(ENV_KEY_APP_NAME, AppUtils.getAppName(this));<NEW_LINE>envs.put(ENV_KEY_APP_VERSION, AppUtils.getAppVersionName(this));<NEW_LINE>envs.put(ENV_KEY_STATUS_BAR_HEIGHT, statusBarHeight);<NEW_LINE>envs.put(ENV_KEY_SAFE_AREA_BOTTOM, 0);<NEW_LINE>envs.put(ENV_KEY_DEVICE_WIDTH, deviceWidth);<NEW_LINE>envs.put(ENV_KEY_DEVICE_HEIGHT, deviceHeight);<NEW_LINE>envs.put(ENV_KEY_AVAILABLE_WIDTH, availableWidth);<NEW_LINE>envs.put(ENV_KEY_AVAILABLE_HEIGHT, availableHeight);<NEW_LINE>envs.put(ENV_KEY_SCALE<MASK><NEW_LINE>if (!TextUtils.isEmpty(namespace) && !namespace.equals(HummerSDK.NAMESPACE_DEFAULT)) {<NEW_LINE>envs.put(ENV_KEY_NAMESPACE, namespace);<NEW_LINE>}<NEW_LINE>initEnv(envs);<NEW_LINE>} | , ScreenUtils.getScreenDensity(this)); |
491,841 | public Matrix4 absolute() {<NEW_LINE>final Matrix4 r = new Matrix4();<NEW_LINE>final double[] rStorage = r._m4storage;<NEW_LINE>rStorage[0] = Math.abs(_m4storage[0]);<NEW_LINE>rStorage[1] = Math.abs(_m4storage[1]);<NEW_LINE>rStorage[2] = Math.abs(_m4storage[2]);<NEW_LINE>rStorage[3] = Math.abs(_m4storage[3]);<NEW_LINE>rStorage[4] = Math.abs(_m4storage[4]);<NEW_LINE>rStorage[5] = Math.abs(_m4storage[5]);<NEW_LINE>rStorage[6] = Math.abs(_m4storage[6]);<NEW_LINE>rStorage[7] = Math.abs(_m4storage[7]);<NEW_LINE>rStorage[8] = Math.abs(_m4storage[8]);<NEW_LINE>rStorage[9] = Math.abs(_m4storage[9]);<NEW_LINE>rStorage[10] = Math.abs(_m4storage[10]);<NEW_LINE>rStorage[11] = Math.abs(_m4storage[11]);<NEW_LINE>rStorage[12] = Math.abs(_m4storage[12]);<NEW_LINE>rStorage[13] = Math.abs(_m4storage[13]);<NEW_LINE>rStorage[14] = Math.abs(_m4storage[14]);<NEW_LINE>rStorage[15] = Math<MASK><NEW_LINE>return r;<NEW_LINE>} | .abs(_m4storage[15]); |
168,169 | public static ActivateClientResponse unmarshall(ActivateClientResponse activateClientResponse, UnmarshallerContext _ctx) {<NEW_LINE>activateClientResponse.setRequestId(_ctx.stringValue("ActivateClientResponse.RequestId"));<NEW_LINE>activateClientResponse.setSuccess(_ctx.booleanValue("ActivateClientResponse.Success"));<NEW_LINE>activateClientResponse.setCode(_ctx.stringValue("ActivateClientResponse.Code"));<NEW_LINE>activateClientResponse.setMessage(_ctx.stringValue("ActivateClientResponse.Message"));<NEW_LINE>activateClientResponse.setToken<MASK><NEW_LINE>activateClientResponse.setVaultUrl(_ctx.stringValue("ActivateClientResponse.VaultUrl"));<NEW_LINE>activateClientResponse.setClientId(_ctx.stringValue("ActivateClientResponse.ClientId"));<NEW_LINE>activateClientResponse.setAccessCode(_ctx.stringValue("ActivateClientResponse.AccessCode"));<NEW_LINE>activateClientResponse.setVaultId(_ctx.stringValue("ActivateClientResponse.VaultId"));<NEW_LINE>activateClientResponse.setAccountId(_ctx.longValue("ActivateClientResponse.AccountId"));<NEW_LINE>activateClientResponse.setEnvironment(_ctx.stringValue("ActivateClientResponse.Environment"));<NEW_LINE>activateClientResponse.setClusterId(_ctx.stringValue("ActivateClientResponse.ClusterId"));<NEW_LINE>activateClientResponse.setVaultType(_ctx.stringValue("ActivateClientResponse.VaultType"));<NEW_LINE>activateClientResponse.setUseHttps(_ctx.booleanValue("ActivateClientResponse.UseHttps"));<NEW_LINE>List<String> sourceTypes = new ArrayList<String>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ActivateClientResponse.SourceTypes.Length"); i++) {<NEW_LINE>sourceTypes.add(_ctx.stringValue("ActivateClientResponse.SourceTypes[" + i + "]"));<NEW_LINE>}<NEW_LINE>activateClientResponse.setSourceTypes(sourceTypes);<NEW_LINE>MqttInfo mqttInfo = new MqttInfo();<NEW_LINE>mqttInfo.setBroker(_ctx.stringValue("ActivateClientResponse.MqttInfo.Broker"));<NEW_LINE>mqttInfo.setPubTopic(_ctx.stringValue("ActivateClientResponse.MqttInfo.PubTopic"));<NEW_LINE>mqttInfo.setClientId(_ctx.stringValue("ActivateClientResponse.MqttInfo.ClientId"));<NEW_LINE>mqttInfo.setClusterPubTopic(_ctx.stringValue("ActivateClientResponse.MqttInfo.ClusterPubTopic"));<NEW_LINE>mqttInfo.setSubTopic(_ctx.stringValue("ActivateClientResponse.MqttInfo.SubTopic"));<NEW_LINE>mqttInfo.setAuthServer(_ctx.stringValue("ActivateClientResponse.MqttInfo.AuthServer"));<NEW_LINE>mqttInfo.setUsername(_ctx.stringValue("ActivateClientResponse.MqttInfo.Username"));<NEW_LINE>mqttInfo.setPassword(_ctx.stringValue("ActivateClientResponse.MqttInfo.Password"));<NEW_LINE>Brokers brokers = new Brokers();<NEW_LINE>brokers.setVpc(_ctx.stringValue("ActivateClientResponse.MqttInfo.Brokers.Vpc"));<NEW_LINE>brokers.setPub(_ctx.stringValue("ActivateClientResponse.MqttInfo.Brokers.Pub"));<NEW_LINE>brokers.setClassic(_ctx.stringValue("ActivateClientResponse.MqttInfo.Brokers.Classic"));<NEW_LINE>mqttInfo.setBrokers(brokers);<NEW_LINE>activateClientResponse.setMqttInfo(mqttInfo);<NEW_LINE>OtsInfo otsInfo = new OtsInfo();<NEW_LINE>otsInfo.setEndpoint(_ctx.stringValue("ActivateClientResponse.OtsInfo.Endpoint"));<NEW_LINE>otsInfo.setInstanceName(_ctx.stringValue("ActivateClientResponse.OtsInfo.InstanceName"));<NEW_LINE>otsInfo.setHanaMetaTableName(_ctx.stringValue("ActivateClientResponse.OtsInfo.HanaMetaTableName"));<NEW_LINE>activateClientResponse.setOtsInfo(otsInfo);<NEW_LINE>return activateClientResponse;<NEW_LINE>} | (_ctx.stringValue("ActivateClientResponse.Token")); |
1,798,937 | double multiComputeRSS(double[][] seasonMatrix, double[] cResidual, double[] arCoef, double[] maCoef) {<NEW_LINE>this.iterResidualMatrix = new double[seasonMatrix.length][seasonMatrix[0].length];<NEW_LINE>for (int i = 0; i < seasonMatrix.length; i++) {<NEW_LINE>for (int j = 0; j < seasonMatrix[0].length; j++) {<NEW_LINE>this.iterResidualMatrix[i][j] = Double.MAX_VALUE;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>double sumRSS = 0;<NEW_LINE>for (int i = 0; i < seasonMatrix.length; i++) {<NEW_LINE>CSSGradientTarget cssGT = new CSSGradientTarget();<NEW_LINE>double[] data = new TsMethod().seasonMatrixSplit(seasonMatrix, i);<NEW_LINE>sumRSS += cssGT.computeRSS(data, cResidual, 0, arCoef, <MASK><NEW_LINE>System.arraycopy(cssGT.iterResidual, 0, iterResidualMatrix[i], 0, data.length);<NEW_LINE>}<NEW_LINE>return sumRSS;<NEW_LINE>} | maCoef, 0, 1, 0); |
1,699,501 | public Optional<CachedVanityUrl> resolveVanityUrl(final String url, final Host site, final Language language) {<NEW_LINE>// 404 short circuit<NEW_LINE>final Optional<CachedVanityUrl> shortCircuit = cache.getDirectMapping(url, site, language);<NEW_LINE>if (shortCircuit != null) {<NEW_LINE>return shortCircuit;<NEW_LINE>}<NEW_LINE>// tries specific site, language and url<NEW_LINE>Optional<CachedVanityUrl> matched = load(site, language).stream().filter(cachedVanityUrl -> cachedVanityUrl.url.equalsIgnoreCase(url)).findFirst();<NEW_LINE>// tries specific site, language and pattern<NEW_LINE>if (!matched.isPresent()) {<NEW_LINE>matched = load(site, language).stream().filter(cachedVanityUrl -> cachedVanityUrl.pattern.matcher(url).<MASK><NEW_LINE>}<NEW_LINE>// try language fallback<NEW_LINE>if (!matched.isPresent() && !languageAPI.getDefaultLanguage().equals(language) && languageFallback) {<NEW_LINE>matched = resolveVanityUrl(url, site, languageAPI.getDefaultLanguage());<NEW_LINE>}<NEW_LINE>// tries SYSTEM_HOST<NEW_LINE>if (!matched.isPresent() && !APILocator.systemHost().equals(site)) {<NEW_LINE>matched = resolveVanityUrl(url, APILocator.systemHost(), language);<NEW_LINE>}<NEW_LINE>// if this is the /cmsHomePage vanity<NEW_LINE>if (!matched.isPresent() && StringPool.FORWARD_SLASH.equals(url)) {<NEW_LINE>matched = resolveVanityUrl(LEGACY_CMS_HOME_PAGE, site, language);<NEW_LINE>}<NEW_LINE>// whatever we have, stick it into the cache so it can be remembered<NEW_LINE>cache.putDirectMapping(site, language, url, matched);<NEW_LINE>return matched;<NEW_LINE>} | matches()).findFirst(); |
1,661,792 | protected void removeByUserId(String userId) throws SystemException {<NEW_LINE>Session session = null;<NEW_LINE>try {<NEW_LINE>session = openSession();<NEW_LINE>StringBuffer query = new StringBuffer();<NEW_LINE>query.append("FROM PasswordTracker IN CLASS com.liferay.portal.ejb.PasswordTrackerHBM WHERE ");<NEW_LINE>query.append("userId = ?");<NEW_LINE>query.append(" ");<NEW_LINE>query.append("ORDER BY ");<NEW_LINE>query.append("userId DESC").append(", ");<NEW_LINE>query.append("createDate DESC");<NEW_LINE>Query q = session.createQuery(query.toString());<NEW_LINE>int queryPos = 0;<NEW_LINE>q.setString(queryPos++, userId);<NEW_LINE>Iterator itr = q.list().iterator();<NEW_LINE>while (itr.hasNext()) {<NEW_LINE>PasswordTrackerHBM passwordTrackerHBM = <MASK><NEW_LINE>PasswordTrackerPool.remove((String) passwordTrackerHBM.getPrimaryKey());<NEW_LINE>session.delete(passwordTrackerHBM);<NEW_LINE>}<NEW_LINE>session.flush();<NEW_LINE>} catch (HibernateException he) {<NEW_LINE>throw new SystemException(he);<NEW_LINE>} finally {<NEW_LINE>HibernateUtil.closeSession(session);<NEW_LINE>}<NEW_LINE>} | (PasswordTrackerHBM) itr.next(); |
806,929 | final long doWriteOrSendBytes(ByteBuf data, InetSocketAddress remoteAddress, boolean fastOpen) throws IOException {<NEW_LINE>assert !(fastOpen && remoteAddress == null) : "fastOpen requires a remote address";<NEW_LINE>if (data.hasMemoryAddress()) {<NEW_LINE>long memoryAddress = data.memoryAddress();<NEW_LINE>if (remoteAddress == null) {<NEW_LINE>return socket.writeAddress(memoryAddress, data.readerIndex(), data.writerIndex());<NEW_LINE>}<NEW_LINE>return socket.sendToAddress(memoryAddress, data.readerIndex(), data.writerIndex(), remoteAddress.getAddress(), remoteAddress.getPort(), fastOpen);<NEW_LINE>}<NEW_LINE>if (data.nioBufferCount() > 1) {<NEW_LINE>IovArray array = ((EpollEventLoop) eventLoop()).cleanIovArray();<NEW_LINE>array.add(data, data.readerIndex(), data.readableBytes());<NEW_LINE>int cnt = array.count();<NEW_LINE>assert cnt != 0;<NEW_LINE>if (remoteAddress == null) {<NEW_LINE>return socket.writevAddresses(array.memoryAddress(0), cnt);<NEW_LINE>}<NEW_LINE>return socket.sendToAddresses(array.memoryAddress(0), cnt, remoteAddress.getAddress(), remoteAddress.getPort(), fastOpen);<NEW_LINE>}<NEW_LINE>ByteBuffer nioData = data.internalNioBuffer(data.readerIndex(), data.readableBytes());<NEW_LINE>if (remoteAddress == null) {<NEW_LINE>return socket.write(nioData, nioData.position(), nioData.limit());<NEW_LINE>}<NEW_LINE>return socket.sendTo(nioData, nioData.position(), nioData.limit(), remoteAddress.getAddress(), <MASK><NEW_LINE>} | remoteAddress.getPort(), fastOpen); |
923,010 | ActionResult<Wo> execute(EffectivePerson effectivePerson, String id, JsonElement jsonElement) throws Exception {<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>ActionResult<Wo> result = new ActionResult<>();<NEW_LINE>Wi wi = this.convertToWrapIn(jsonElement, Wi.class);<NEW_LINE>Business business = new Business(emc);<NEW_LINE>View view = emc.find(id, View.class);<NEW_LINE>if (null == view) {<NEW_LINE>throw new ExceptionViewNotExist(id);<NEW_LINE>}<NEW_LINE>Query query = emc.find(view.getQuery(), Query.class);<NEW_LINE>if (null == query) {<NEW_LINE>throw new ExceptionQueryNotExist(view.getQuery());<NEW_LINE>}<NEW_LINE>if (!business.editable(effectivePerson, query)) {<NEW_LINE>throw new ExceptionQueryAccessDenied(effectivePerson.getDistinguishedName(), query.getName());<NEW_LINE>}<NEW_LINE>switch(StringUtils.trimToEmpty(wi.getType())) {<NEW_LINE>case View.TYPE_CMS:<NEW_LINE>// view.setData(gson.toJson(gson.fromJson(view.getData(), CmsPlan.class)));<NEW_LINE>break;<NEW_LINE>case View.TYPE_PROCESSPLATFORM:<NEW_LINE>// view.setData(gson.toJson(gson.fromJson(view.getData(), ProcessPlatformPlan.class)));<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new ExceptionTypeValue(wi.getType());<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>Wi.copier.copy(wi, view);<NEW_LINE>view.setQuery(query.getId());<NEW_LINE>if (StringUtils.isNotEmpty(view.getName()) && (!this.idleName(business, view))) {<NEW_LINE>throw new ExceptionNameExist(view.getName());<NEW_LINE>}<NEW_LINE>if (StringUtils.isNotEmpty(view.getAlias()) && (!this.idleAlias(business, view))) {<NEW_LINE>throw new ExceptionAliasExist(view.getName());<NEW_LINE>}<NEW_LINE>emc.check(view, CheckPersistType.all);<NEW_LINE>emc.commit();<NEW_LINE>CacheManager.notify(View.class);<NEW_LINE>Wo wo = new Wo();<NEW_LINE>wo.setId(view.getId());<NEW_LINE>result.setData(wo);<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>} | emc.beginTransaction(View.class); |
579,826 | protected void updateStroke() {<NEW_LINE>float sw = (float) Math.max(1, state.strokeWidth * state.scale);<NEW_LINE>int cap = BasicStroke.CAP_BUTT;<NEW_LINE>if (state.lineCap.equals("round")) {<NEW_LINE>cap = BasicStroke.CAP_ROUND;<NEW_LINE>} else if (state.lineCap.equals("square")) {<NEW_LINE>cap = BasicStroke.CAP_SQUARE;<NEW_LINE>}<NEW_LINE>int join = BasicStroke.JOIN_MITER;<NEW_LINE>if (state.lineJoin.equals("round")) {<NEW_LINE>join = BasicStroke.JOIN_ROUND;<NEW_LINE>} else if (state.lineJoin.equals("bevel")) {<NEW_LINE>join = BasicStroke.JOIN_BEVEL;<NEW_LINE>}<NEW_LINE>float <MASK><NEW_LINE>if (lastStroke == null || lastStrokeWidth != sw || lastCap != cap || lastJoin != join || lastMiterLimit != miterlimit || lastDashed != state.dashed || (state.dashed && lastDashPattern != state.dashPattern)) {<NEW_LINE>float[] dash = null;<NEW_LINE>if (state.dashed) {<NEW_LINE>dash = new float[state.dashPattern.length];<NEW_LINE>for (int i = 0; i < dash.length; i++) {<NEW_LINE>dash[i] = (float) (state.dashPattern[i] * sw);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>lastStroke = new BasicStroke(sw, cap, join, miterlimit, dash, 0);<NEW_LINE>lastStrokeWidth = sw;<NEW_LINE>lastCap = cap;<NEW_LINE>lastJoin = join;<NEW_LINE>lastMiterLimit = miterlimit;<NEW_LINE>lastDashed = state.dashed;<NEW_LINE>lastDashPattern = state.dashPattern;<NEW_LINE>}<NEW_LINE>state.g.setStroke(lastStroke);<NEW_LINE>} | miterlimit = (float) state.miterLimit; |
715,452 | private String generateUrlAndQuery(String url, Map<String, String> params, boolean scrubUrl) throws Exception {<NEW_LINE>if (params == null || params.isEmpty()) {<NEW_LINE>return url;<NEW_LINE>}<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>sb.append(url);<NEW_LINE>String prefix = "?";<NEW_LINE>for (Map.Entry<String, String> entry : params.entrySet()) {<NEW_LINE>sb.append(prefix);<NEW_LINE>prefix = "&";<NEW_LINE>// note: scrubUrlQueryValue could be expensive with many filtered values<NEW_LINE>// consider using it only in only a DEBUG logging context in the future<NEW_LINE>String reportedValue = scrubUrl ? scrubUrlQueryValue(entry.getKey(), entry.getValue(<MASK><NEW_LINE>sb.append(String.format("%s=%s", entry.getKey(), URLEncoder.encode(reportedValue, "UTF-8")));<NEW_LINE>}<NEW_LINE>return sb.toString();<NEW_LINE>} | )) : entry.getValue(); |
1,448,258 | public static Query<Map<String, Integer>> fetchActivityIndexGroupingsOn(long date, long threshold, Collection<UUID> playerUUIDs, List<ServerUUID> serverUUIDs) {<NEW_LINE>String selectActivityIndex = selectActivityIndexSQL(serverUUIDs);<NEW_LINE>String selectIndexes = SELECT + "activity_index" + FROM + UsersTable.TABLE_NAME + " u" + LEFT_JOIN + '(' + selectActivityIndex + ") s on s." + SessionsTable.USER_UUID + "=u." + UsersTable.USER_UUID + WHERE + "u." + UsersTable.REGISTERED + "<=?" + AND + "u." + UsersTable.USER_UUID + " IN ('" + new TextStringBuilder().appendWithSeparators(playerUUIDs, "','").build() + "')";<NEW_LINE>return new QueryStatement<Map<String, Integer>>(selectIndexes) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void prepare(PreparedStatement statement) throws SQLException {<NEW_LINE>setSelectActivityIndexSQLParameters(statement, 1, threshold, date);<NEW_LINE>statement.setLong(9, date);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Map<String, Integer> processResults(ResultSet set) throws SQLException {<NEW_LINE>Map<String, Integer> groups = new HashMap<>();<NEW_LINE>while (set.next()) {<NEW_LINE>double activityIndex = set.getDouble("activity_index");<NEW_LINE>String group = ActivityIndex.getGroup(activityIndex);<NEW_LINE>groups.put(group, groups.getOrDefault<MASK><NEW_LINE>}<NEW_LINE>return groups;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | (group, 0) + 1); |
182,689 | public okhttp3.Call connectPostNamespacedServiceProxyCall(String name, String namespace, String path, final ApiCallback _callback) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/api/v1/namespaces/{namespace}/services/{name}/proxy".replaceAll("\\{" + "name" + "\\}", localVarApiClient.escapeString(name.toString())).replaceAll("\\{" + "namespace" + "\\}", localVarApiClient.escapeString(namespace.toString()));<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();<NEW_LINE>if (path != null) {<NEW_LINE>localVarQueryParams.addAll(localVarApiClient.parameterToPair("path", path));<NEW_LINE>}<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, String> localVarCookieParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>final String[] localVarAccepts = { "*/*" };<NEW_LINE>final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>if (localVarAccept != null) {<NEW_LINE>localVarHeaderParams.put("Accept", localVarAccept);<NEW_LINE>}<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String <MASK><NEW_LINE>localVarHeaderParams.put("Content-Type", localVarContentType);<NEW_LINE>String[] localVarAuthNames = new String[] { "BearerToken" };<NEW_LINE>return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);<NEW_LINE>} | localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); |
1,044,133 | public void selected(MenuItem menu, Object target) {<NEW_LINE>if (target instanceof MdiEntry) {<NEW_LINE>UISWTInputReceiver entry = (UISWTInputReceiver) swt_ui.getInputReceiver();<NEW_LINE>entry.setMessage("devices.restrict_access.msg");<NEW_LINE>entry.setPreenteredText(<MASK><NEW_LINE>entry.maintainWhitespace(false);<NEW_LINE>entry.allowEmptyInput(true);<NEW_LINE>entry.setLocalisedTitle(MessageText.getString("devices.restrict_access.prompt", new String[] { device.getName() }));<NEW_LINE>entry.prompt(new UIInputReceiverListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void UIInputReceiverClosed(UIInputReceiver entry) {<NEW_LINE>if (!entry.hasSubmittedInput()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String input = entry.getSubmittedInput().trim();<NEW_LINE>renderer.setAccessRestriction(input);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | renderer.getAccessRestriction(), false); |
448,050 | public JRPrintElement fill() {<NEW_LINE>JRComponentElement element = fillContext.getComponentElement();<NEW_LINE>JRTemplateImage templateImage = new JRTemplateImage(fillContext.getElementOrigin(), fillContext.getDefaultStyleProvider());<NEW_LINE>templateImage.setStyle(fillContext.getElementStyle());<NEW_LINE><MASK><NEW_LINE>templateImage.setLinkTarget(getLinkTarget());<NEW_LINE>templateImage.setUsingCache(false);<NEW_LINE>templateImage = deduplicate(templateImage);<NEW_LINE>JRTemplatePrintImage image = new JRTemplatePrintImage(templateImage, printElementOriginator);<NEW_LINE>image.setUUID(element.getUUID());<NEW_LINE>image.setX(element.getX());<NEW_LINE>image.setY(fillContext.getElementPrintY());<NEW_LINE>image.setWidth(element.getWidth());<NEW_LINE>image.setHeight(element.getHeight());<NEW_LINE>image.setBookmarkLevel(getBookmarkLevel());<NEW_LINE>if (isEvaluateNow()) {<NEW_LINE>copy(image);<NEW_LINE>} else {<NEW_LINE>fillContext.registerDelayedEvaluation(image, chartComponent.getEvaluationTime(), chartComponent.getEvaluationGroup());<NEW_LINE>}<NEW_LINE>return image;<NEW_LINE>} | templateImage.setLinkType(getLinkType()); |
405,764 | public void focusGained(FocusEvent e) {<NEW_LINE>responseHasFocus = false;<NEW_LINE>statusBar.setTarget(new JEditorStatusBarTargetProxy<MASK><NEW_LINE>if (!splitButton.isEnabled()) {<NEW_LINE>requestTabs.setSelectedIndex(0);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (getModelItem().getSettings().getBoolean(UISettings.NO_RESIZE_REQUEST_EDITOR)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// dont resize if split has been dragged<NEW_LINE>if (requestSplitPane.getUI() instanceof SoapUISplitPaneUI && ((SoapUISplitPaneUI) requestSplitPane.getUI()).hasBeenDragged()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int pos = requestSplitPane.getDividerLocation();<NEW_LINE>if (pos >= 600) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (requestSplitPane.getMaximumDividerLocation() > 700) {<NEW_LINE>requestSplitPane.setDividerLocation(600);<NEW_LINE>} else {<NEW_LINE>requestSplitPane.setDividerLocation(0.8);<NEW_LINE>}<NEW_LINE>} | (sourceEditor.getInputArea())); |
294,289 | 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(<MASK><NEW_LINE>protocolMarshaller.marshall(audioDescription.getAudioSelectorName(), AUDIOSELECTORNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(audioDescription.getAudioType(), AUDIOTYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(audioDescription.getAudioTypeControl(), AUDIOTYPECONTROL_BINDING);<NEW_LINE>protocolMarshaller.marshall(audioDescription.getAudioWatermarkingSettings(), AUDIOWATERMARKINGSETTINGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(audioDescription.getCodecSettings(), CODECSETTINGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(audioDescription.getLanguageCode(), LANGUAGECODE_BINDING);<NEW_LINE>protocolMarshaller.marshall(audioDescription.getLanguageCodeControl(), LANGUAGECODECONTROL_BINDING);<NEW_LINE>protocolMarshaller.marshall(audioDescription.getName(), NAME_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.getAudioNormalizationSettings(), AUDIONORMALIZATIONSETTINGS_BINDING); |
1,522,176 | ActionResult<Wo> execute(EffectivePerson effectivePerson, String id) throws Exception {<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>ActionResult<Wo> result = new ActionResult<>();<NEW_LINE>Business business = new Business(emc);<NEW_LINE>ProcessVersion processVersion = emc.find(id, ProcessVersion.class);<NEW_LINE>if (null == processVersion) {<NEW_LINE>throw new ExceptionEntityNotExist(id, ProcessVersion.class);<NEW_LINE>}<NEW_LINE>Process process = emc.find(processVersion.getProcess(), Process.class);<NEW_LINE>if (null == process) {<NEW_LINE>throw new ExceptionEntityNotExist(processVersion.getProcess(), Process.class);<NEW_LINE>}<NEW_LINE>Application application = emc.find(process.getApplication(), Application.class);<NEW_LINE>if (null == application) {<NEW_LINE>throw new ExceptionEntityNotExist(process.<MASK><NEW_LINE>}<NEW_LINE>if (!business.editable(effectivePerson, application)) {<NEW_LINE>throw new ExceptionAccessDenied(effectivePerson);<NEW_LINE>}<NEW_LINE>Wo wo = Wo.copier.copy(processVersion);<NEW_LINE>result.setData(wo);<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>} | getApplication(), Application.class); |
1,290,415 | public void init(JobProfile jobConf) {<NEW_LINE>super.init(jobConf);<NEW_LINE>metricTagName = SQL_READER_TAG_NAME + "_" + inlongGroupId + "_" + inlongStreamId;<NEW_LINE>int batchSize = jobConf.getInt(JOB_DATABASE_BATCH_SIZE, DEFAULT_JOB_DATABASE_BATCH_SIZE);<NEW_LINE>String userName = jobConf.get(JOB_DATABASE_USER);<NEW_LINE>String password = jobConf.get(JOB_DATABASE_PASSWORD);<NEW_LINE>String hostName = jobConf.get(JOB_DATABASE_HOSTNAME);<NEW_LINE>int port = jobConf.getInt(JOB_DATABASE_PORT);<NEW_LINE>String driverClass = jobConf.get(JOB_DATABASE_DRIVER_CLASS, DEFAULT_JOB_DATABASE_DRIVER_CLASS);<NEW_LINE>separator = jobConf.get(JOB_DATABASE_SEPARATOR, STD_FIELD_SEPARATOR_SHORT);<NEW_LINE>finished = false;<NEW_LINE>try {<NEW_LINE>String databaseType = <MASK><NEW_LINE>String url = String.format("jdbc:%s://%s:%d", databaseType, hostName, port);<NEW_LINE>conn = AgentDbUtils.getConnectionFailover(driverClass, url, userName, password);<NEW_LINE>if (databaseType.equals(MYSQL)) {<NEW_LINE>statement = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);<NEW_LINE>statement.setFetchSize(Integer.MIN_VALUE);<NEW_LINE>resultSet = statement.executeQuery(sql);<NEW_LINE>} else {<NEW_LINE>// better performance in non-mysql server<NEW_LINE>preparedStatement = conn.prepareStatement(sql);<NEW_LINE>preparedStatement.setFetchSize(batchSize);<NEW_LINE>resultSet = preparedStatement.executeQuery();<NEW_LINE>}<NEW_LINE>initColumnMeta();<NEW_LINE>} catch (Exception ex) {<NEW_LINE>LOGGER.error("error create statement", ex);<NEW_LINE>destroy();<NEW_LINE>throw new RuntimeException(ex);<NEW_LINE>}<NEW_LINE>} | jobConf.get(JOB_DATABASE_TYPE, MYSQL); |
1,684,627 | public void handle(Supplier<Context> context) {<NEW_LINE>Context ctx = context.get();<NEW_LINE>ctx.enqueueWork(() -> {<NEW_LINE>ServerPlayer player = ctx.getSender();<NEW_LINE>Level world = player.level;<NEW_LINE>if (toolboxPos == null) {<NEW_LINE>ToolboxHandler.unequip(player, hotbarSlot, false);<NEW_LINE>ToolboxHandler.syncData(player);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>BlockEntity blockEntity = world.getBlockEntity(toolboxPos);<NEW_LINE>double maxRange = ToolboxHandler.getMaxRange(player);<NEW_LINE>if (player.distanceToSqr(toolboxPos.getX() + 0.5, toolboxPos.getY(), toolboxPos.getZ() + 0.5) > maxRange * maxRange)<NEW_LINE>return;<NEW_LINE>if (!(blockEntity instanceof ToolboxTileEntity))<NEW_LINE>return;<NEW_LINE>ToolboxHandler.unequip(player, hotbarSlot, false);<NEW_LINE>if (slot < 0 || slot >= 8) {<NEW_LINE>ToolboxHandler.syncData(player);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ToolboxTileEntity toolboxTileEntity = (ToolboxTileEntity) blockEntity;<NEW_LINE>ItemStack playerStack = player.getInventory().getItem(hotbarSlot);<NEW_LINE>if (!playerStack.isEmpty() && !ToolboxInventory.canItemsShareCompartment(playerStack, toolboxTileEntity.inventory.filters.get(slot))) {<NEW_LINE>toolboxTileEntity.inventory.inLimitedMode(inventory -> {<NEW_LINE>ItemStack remainder = ItemHandlerHelper.insertItemStacked(inventory, playerStack, false);<NEW_LINE>if (!remainder.isEmpty())<NEW_LINE>remainder = ItemHandlerHelper.insertItemStacked(new ItemReturnInvWrapper(player.getInventory()), remainder, false);<NEW_LINE>if (remainder.getCount() != playerStack.getCount())<NEW_LINE>player.getInventory().setItem(hotbarSlot, remainder);<NEW_LINE>});<NEW_LINE>}<NEW_LINE>CompoundTag compound = player.getPersistentData().getCompound("CreateToolboxData");<NEW_LINE>String key = String.valueOf(hotbarSlot);<NEW_LINE>CompoundTag data = new CompoundTag();<NEW_LINE>data.putInt("Slot", slot);<NEW_LINE>data.put("Pos", NbtUtils.writeBlockPos(toolboxPos));<NEW_LINE><MASK><NEW_LINE>player.getPersistentData().put("CreateToolboxData", compound);<NEW_LINE>toolboxTileEntity.connectPlayer(slot, player, hotbarSlot);<NEW_LINE>ToolboxHandler.syncData(player);<NEW_LINE>});<NEW_LINE>ctx.setPacketHandled(true);<NEW_LINE>} | compound.put(key, data); |
837,242 | public static void registerSSAggregationKeyDependencies() {<NEW_LINE>final IAggregationKeyRegistry keyRegistry = Services.get(IAggregationKeyRegistry.class);<NEW_LINE>final String registrationKey = ShipmentScheduleHeaderAggregationKeyBuilder.REGISTRATION_KEY;<NEW_LINE>//<NEW_LINE>// Register Handlers<NEW_LINE>keyRegistry.registerAggregationKeyValueHandler(registrationKey, new ShipmentScheduleKeyValueHandler());<NEW_LINE>//<NEW_LINE>// Register ShipmentScheduleHeaderAggregationKeyBuilder<NEW_LINE>// by adding this, we also cover DateOrdered and POReference<NEW_LINE>keyRegistry.// by adding this, we also cover DateOrdered and POReference<NEW_LINE>registerDependsOnColumnnames(// by adding this, we also cover DateOrdered and POReference<NEW_LINE>registrationKey, // by adding this, we also cover DateOrdered and POReference<NEW_LINE>I_M_ShipmentSchedule.COLUMNNAME_C_DocType_ID, // by adding this, we also cover DateOrdered and POReference<NEW_LINE>I_M_ShipmentSchedule.COLUMNNAME_C_BPartner_ID, // by adding this, we also cover DateOrdered and POReference<NEW_LINE>I_M_ShipmentSchedule.COLUMNNAME_C_BPartner_Override_ID, // by adding this, we also cover DateOrdered and POReference<NEW_LINE>I_M_ShipmentSchedule.COLUMNNAME_C_BPartner_Location_ID, // by adding this, we also cover DateOrdered and POReference<NEW_LINE>I_M_ShipmentSchedule.COLUMNNAME_C_BP_Location_Override_ID, I_M_ShipmentSchedule.COLUMNNAME_C_Order_ID, I_M_ShipmentSchedule.COLUMNNAME_M_Warehouse_ID, I_M_ShipmentSchedule.COLUMNNAME_M_Warehouse_Override_ID, I_M_ShipmentSchedule.COLUMNNAME_AD_User_ID, I_M_ShipmentSchedule.COLUMNNAME_AD_User_Override_ID, <MASK><NEW_LINE>} | I_M_ShipmentSchedule.COLUMNNAME_AD_Org_ID, I_M_ShipmentSchedule.COLUMNNAME_DateOrdered); |
1,236,071 | private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents<NEW_LINE>void initComponents() {<NEW_LINE>configPanel = new javax.swing.JPanel();<NEW_LINE>setPreferredSize(new java.awt.Dimension(569, 300));<NEW_LINE>configPanel.setPreferredSize(new java.awt.Dimension(569, 400));<NEW_LINE>javax.swing.GroupLayout configPanelLayout = new <MASK><NEW_LINE>configPanel.setLayout(configPanelLayout);<NEW_LINE>configPanelLayout.setHorizontalGroup(configPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 609, Short.MAX_VALUE));<NEW_LINE>configPanelLayout.setVerticalGroup(configPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 349, Short.MAX_VALUE));<NEW_LINE>javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);<NEW_LINE>this.setLayout(layout);<NEW_LINE>layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(configPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 609, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(0, 0, Short.MAX_VALUE)));<NEW_LINE>layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(configPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE));<NEW_LINE>} | javax.swing.GroupLayout(configPanel); |
485,107 | private ResponseRef executeWidget(AsyncExecutionRequestRef ref) throws ExternalOperationFailedException {<NEW_LINE>String url = URLUtils.getUrl(getBaseUrl(), URLUtils.WIDGET_DATA_URL_FORMAT, getId(ref));<NEW_LINE>ref.getExecutionRequestRefContext().appendLog("Ready to get result set from " + url);<NEW_LINE>List<Column> columns = Lists.newArrayList();<NEW_LINE>List<TableRecord> tableRecords = Lists.newArrayList();<NEW_LINE>VisualisDownloadAction visualisDownloadAction = new VisualisDownloadAction();<NEW_LINE>visualisDownloadAction.setUser(getUser(ref));<NEW_LINE>SSOUrlBuilderOperation ssoUrlBuilderOperation = ref.getWorkspace().getSSOUrlBuilderOperation().copy();<NEW_LINE>ssoUrlBuilderOperation.setAppName(getAppName());<NEW_LINE>ssoUrlBuilderOperation.setReqUrl(url);<NEW_LINE>ssoUrlBuilderOperation.setWorkspace(ref.getWorkspace().getWorkspaceName());<NEW_LINE>try {<NEW_LINE>visualisDownloadAction.setURL(ssoUrlBuilderOperation.getBuiltUrl());<NEW_LINE>HttpResult httpResult = this.ssoRequestOperation.requestWithSSO(ssoUrlBuilderOperation, visualisDownloadAction);<NEW_LINE>WidgetResultData responseData = BDPJettyServerHelper.gson().fromJson(IOUtils.toString(visualisDownloadAction.getInputStream()), WidgetResultData.class);<NEW_LINE>if (responseData.getData().getColumns().isEmpty()) {<NEW_LINE>ref.getExecutionRequestRefContext().appendLog("Cannot execute an empty Widget!");<NEW_LINE>throw new ExternalOperationFailedException(90176, "Cannot execute an empty Widget!", null);<NEW_LINE>}<NEW_LINE>for (WidgetResultData.Column columnData : responseData.getData().getColumns()) {<NEW_LINE>columns.add(new Column(columnData.getName(), DataType.toDataType(columnData.getType().toLowerCase()), ""));<NEW_LINE>}<NEW_LINE>ResultSetWriter resultSetWriter = ref.getExecutionRequestRefContext().createTableResultSetWriter();<NEW_LINE>resultSetWriter.addMetaData(new TableMetaData(columns.toArray(new Column[0])));<NEW_LINE>for (Map<String, Object> recordMap : responseData.getData().getResultList()) {<NEW_LINE>resultSetWriter.addRecord(new TableRecord(recordMap.values().toArray()));<NEW_LINE>}<NEW_LINE>resultSetWriter.flush();<NEW_LINE>IOUtils.closeQuietly(resultSetWriter);<NEW_LINE>ref.getExecutionRequestRefContext().sendResultSet(resultSetWriter);<NEW_LINE>} catch (Throwable e) {<NEW_LINE>ref.getExecutionRequestRefContext().appendLog("Failed to debug Widget url " + url);<NEW_LINE>ref.getExecutionRequestRefContext().appendLog(e.getMessage());<NEW_LINE><MASK><NEW_LINE>throw new ExternalOperationFailedException(90176, "Failed to debug Widget", e);<NEW_LINE>} finally {<NEW_LINE>IOUtils.closeQuietly(visualisDownloadAction.getInputStream());<NEW_LINE>}<NEW_LINE>return new VisualisCompletedExecutionResponseRef(200);<NEW_LINE>} | logger.error("executeWidget error:", e); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.