idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
278,302 | public static Object apply(Object fieldValue) {<NEW_LINE>BytesReference bytesRef = fieldValue == null ? new BytesArray("null") : new BytesArray(fieldValue.toString());<NEW_LINE>try (<MASK><NEW_LINE>XContentParser parser = JsonXContent.jsonXContent.createParser(NamedXContentRegistry.EMPTY, DeprecationHandler.THROW_UNSUPPORTED_OPERATION, stream)) {<NEW_LINE>XContentParser.Token token = parser.nextToken();<NEW_LINE>Object value = null;<NEW_LINE>if (token == XContentParser.Token.VALUE_NULL) {<NEW_LINE>value = null;<NEW_LINE>} else if (token == XContentParser.Token.VALUE_STRING) {<NEW_LINE>value = parser.text();<NEW_LINE>} else if (token == XContentParser.Token.VALUE_NUMBER) {<NEW_LINE>value = parser.numberValue();<NEW_LINE>} else if (token == XContentParser.Token.VALUE_BOOLEAN) {<NEW_LINE>value = parser.booleanValue();<NEW_LINE>} else if (token == XContentParser.Token.START_OBJECT) {<NEW_LINE>value = parser.map();<NEW_LINE>} else if (token == XContentParser.Token.START_ARRAY) {<NEW_LINE>value = parser.list();<NEW_LINE>} else if (token == XContentParser.Token.VALUE_EMBEDDED_OBJECT) {<NEW_LINE>throw new IllegalArgumentException("cannot read binary value");<NEW_LINE>}<NEW_LINE>return value;<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new IllegalArgumentException(e);<NEW_LINE>}<NEW_LINE>} | InputStream stream = bytesRef.streamInput(); |
1,379,336 | public static Properties loadRepoProperties() throws InstallException {<NEW_LINE>Properties repoProperties = null;<NEW_LINE>// Retrieves the Repository Properties file<NEW_LINE>File repoPropertiesFile = new File(getRepoPropertiesFileLocation());<NEW_LINE>// Check if default repository properties file location is overridden<NEW_LINE>boolean isPropsLocationOverridden = System.getProperty(InstallConstants.OVERRIDE_PROPS_LOCATION_ENV_VAR) != null ? true : false;<NEW_LINE>if (repoPropertiesFile.exists() && repoPropertiesFile.isFile()) {<NEW_LINE>// Load repository properties<NEW_LINE>repoProperties = new Properties();<NEW_LINE>FileInputStream repoPropertiesInput = null;<NEW_LINE>try {<NEW_LINE>repoPropertiesInput = new FileInputStream(repoPropertiesFile);<NEW_LINE>repoProperties.load(repoPropertiesInput);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_TOOL_REPOSITORY_PROPS_NOT_LOADED", getRepoPropertiesFileLocation()), InstallException.IO_FAILURE);<NEW_LINE>} finally {<NEW_LINE>InstallUtils.close(repoPropertiesInput);<NEW_LINE>}<NEW_LINE>} else if (isPropsLocationOverridden) {<NEW_LINE>// Checks if the override location is a directory<NEW_LINE>throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage(repoPropertiesFile.isDirectory() ? "ERROR_TOOL_REPOSITORY_PROPS_NOT_FILE" : "ERROR_TOOL_REPOSITORY_PROPS_NOT_EXISTS", getRepoPropertiesFileLocation<MASK><NEW_LINE>}<NEW_LINE>return repoProperties;<NEW_LINE>} | ()), InstallException.IO_FAILURE); |
62,109 | public static DescribeExcelAnalysisResultResponse unmarshall(DescribeExcelAnalysisResultResponse describeExcelAnalysisResultResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeExcelAnalysisResultResponse.setRequestId(_ctx.stringValue("DescribeExcelAnalysisResultResponse.RequestId"));<NEW_LINE>describeExcelAnalysisResultResponse.setSuccess(_ctx.booleanValue("DescribeExcelAnalysisResultResponse.Success"));<NEW_LINE>describeExcelAnalysisResultResponse.setHttpStatusCode(_ctx.integerValue("DescribeExcelAnalysisResultResponse.HttpStatusCode"));<NEW_LINE>ExcelResult excelResult = new ExcelResult();<NEW_LINE>excelResult.setTotal(_ctx.integerValue("DescribeExcelAnalysisResultResponse.ExcelResult.Total"));<NEW_LINE>excelResult.setUpdateCount(_ctx.integerValue("DescribeExcelAnalysisResultResponse.ExcelResult.UpdateCount"));<NEW_LINE>excelResult.setInsertCount(_ctx.integerValue("DescribeExcelAnalysisResultResponse.ExcelResult.InsertCount"));<NEW_LINE>excelResult.setErrorCount(_ctx.integerValue("DescribeExcelAnalysisResultResponse.ExcelResult.ErrorCount"));<NEW_LINE>List<String> errorLine <MASK><NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeExcelAnalysisResultResponse.ExcelResult.ErrorLine.Length"); i++) {<NEW_LINE>errorLine.add(_ctx.stringValue("DescribeExcelAnalysisResultResponse.ExcelResult.ErrorLine[" + i + "]"));<NEW_LINE>}<NEW_LINE>excelResult.setErrorLine(errorLine);<NEW_LINE>describeExcelAnalysisResultResponse.setExcelResult(excelResult);<NEW_LINE>return describeExcelAnalysisResultResponse;<NEW_LINE>} | = new ArrayList<String>(); |
1,094,221 | private boolean handleTimeDependentOpsForNode(final ClusterState currentClusterState, final NodeStateOrHostInfoChangeHandler nodeListener, final long currentTime, final NodeInfo node) {<NEW_LINE>final NodeState currentStateInSystem = currentClusterState.<MASK><NEW_LINE>final NodeState lastReportedState = node.getReportedState();<NEW_LINE>boolean triggeredAnyTimers = false;<NEW_LINE>triggeredAnyTimers = reportDownIfOutdatedSlobrokNode(currentClusterState, nodeListener, currentTime, node, lastReportedState);<NEW_LINE>if (nodeStillUnavailableAfterTransitionTimeExceeded(currentTime, node, currentStateInSystem, lastReportedState)) {<NEW_LINE>triggeredAnyTimers = true;<NEW_LINE>}<NEW_LINE>if (nodeInitProgressHasTimedOut(currentTime, node, currentStateInSystem, lastReportedState)) {<NEW_LINE>eventLog.add(NodeEvent.forBaseline(node, String.format("%d milliseconds without initialize progress. Marking node down. " + "Premature crash count is now %d.", currentTime - node.getInitProgressTime(), node.getPrematureCrashCount() + 1), NodeEvent.Type.CURRENT, currentTime), isMaster);<NEW_LINE>handlePrematureCrash(node, nodeListener);<NEW_LINE>triggeredAnyTimers = true;<NEW_LINE>}<NEW_LINE>if (mayResetCrashCounterOnStableUpNode(currentTime, node, lastReportedState)) {<NEW_LINE>node.setPrematureCrashCount(0);<NEW_LINE>log.log(Level.FINE, () -> "Resetting premature crash count on node " + node + " as it has been up for a long time.");<NEW_LINE>triggeredAnyTimers = true;<NEW_LINE>} else if (mayResetCrashCounterOnStableDownNode(currentTime, node, lastReportedState)) {<NEW_LINE>node.setPrematureCrashCount(0);<NEW_LINE>log.log(Level.FINE, () -> "Resetting premature crash count on node " + node + " as it has been down for a long time.");<NEW_LINE>triggeredAnyTimers = true;<NEW_LINE>}<NEW_LINE>return triggeredAnyTimers;<NEW_LINE>} | getNodeState(node.getNode()); |
1,664,137 | public void read(org.apache.thrift.protocol.TProtocol prot, TAuthenticationKey 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(4);<NEW_LINE>if (incoming.get(0)) {<NEW_LINE>struct.secret = iprot.readBinary();<NEW_LINE>struct.setSecretIsSet(true);<NEW_LINE>}<NEW_LINE>if (incoming.get(1)) {<NEW_LINE>struct<MASK><NEW_LINE>struct.setKeyIdIsSet(true);<NEW_LINE>}<NEW_LINE>if (incoming.get(2)) {<NEW_LINE>struct.expirationDate = iprot.readI64();<NEW_LINE>struct.setExpirationDateIsSet(true);<NEW_LINE>}<NEW_LINE>if (incoming.get(3)) {<NEW_LINE>struct.creationDate = iprot.readI64();<NEW_LINE>struct.setCreationDateIsSet(true);<NEW_LINE>}<NEW_LINE>} | .keyId = iprot.readI32(); |
679,355 | private void registerReflectionForApiResponseSchemaSerialization(BuildProducer<ReflectiveClassBuildItem> reflectiveClass, BuildProducer<ReflectiveHierarchyBuildItem> reflectiveHierarchy, Collection<AnnotationInstance> apiResponseAnnotationInstances) {<NEW_LINE>for (AnnotationInstance apiResponseAnnotationInstance : apiResponseAnnotationInstances) {<NEW_LINE>AnnotationValue contentAnnotationValue = apiResponseAnnotationInstance.value(OPENAPI_RESPONSE_CONTENT);<NEW_LINE>if (contentAnnotationValue == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>AnnotationInstance[] contents = contentAnnotationValue.asNestedArray();<NEW_LINE>for (AnnotationInstance content : contents) {<NEW_LINE>AnnotationValue annotationValue = content.value(OPENAPI_RESPONSE_SCHEMA);<NEW_LINE>if (annotationValue == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>AnnotationInstance schema = annotationValue.asNested();<NEW_LINE>String source = getClass().getSimpleName() + " > " + schema.target();<NEW_LINE>AnnotationValue <MASK><NEW_LINE>if (schemaImplementationClass != null) {<NEW_LINE>produceReflectiveHierarchy(reflectiveHierarchy, schemaImplementationClass.asClass(), source);<NEW_LINE>}<NEW_LINE>AnnotationValue schemaNotClass = schema.value(OPENAPI_SCHEMA_NOT);<NEW_LINE>if (schemaNotClass != null) {<NEW_LINE>reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, schemaNotClass.asString()));<NEW_LINE>}<NEW_LINE>produceReflectiveHierarchy(reflectiveHierarchy, schema.value(OPENAPI_SCHEMA_ONE_OF), source);<NEW_LINE>produceReflectiveHierarchy(reflectiveHierarchy, schema.value(OPENAPI_SCHEMA_ANY_OF), source);<NEW_LINE>produceReflectiveHierarchy(reflectiveHierarchy, schema.value(OPENAPI_SCHEMA_ALL_OF), source);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | schemaImplementationClass = schema.value(OPENAPI_SCHEMA_IMPLEMENTATION); |
1,261,492 | public void enableLedgerReplication() throws ReplicationException.UnavailableException {<NEW_LINE>if (LOG.isDebugEnabled()) {<NEW_LINE>LOG.debug("enableLedegerReplication()");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>zkc.delete(basePath + '/' + BookKeeperConstants.DISABLE_NODE, -1);<NEW_LINE>LOG.info("Resuming automatic ledger re-replication");<NEW_LINE>} catch (KeeperException.NoNodeException ke) {<NEW_LINE>LOG.warn("AutoRecovery is already enabled!", ke);<NEW_LINE>throw new ReplicationException.UnavailableException("AutoRecovery is already enabled!", ke);<NEW_LINE>} catch (KeeperException ke) {<NEW_LINE>LOG.error("Exception while resuming ledger replication", ke);<NEW_LINE>throw new <MASK><NEW_LINE>} catch (InterruptedException ie) {<NEW_LINE>Thread.currentThread().interrupt();<NEW_LINE>throw new ReplicationException.UnavailableException("Interrupted while resuming auto ledger re-replication", ie);<NEW_LINE>}<NEW_LINE>} | ReplicationException.UnavailableException("Exception while resuming auto ledger re-replication", ke); |
482,987 | private IQueryBuilder<I_PP_Order> toSqlQueryBuilder(final ManufacturingOrderQuery query) {<NEW_LINE>final IQueryBuilder<I_PP_Order> queryBuilder = queryBL.createQueryBuilder(I_PP_Order.class).addOnlyActiveRecordsFilter();<NEW_LINE>// Plant<NEW_LINE>if (query.getPlantId() != null) {<NEW_LINE>queryBuilder.addEqualsFilter(I_PP_Order.COLUMN_S_Resource_ID, query.getPlantId());<NEW_LINE>}<NEW_LINE>// Warehouse<NEW_LINE>if (query.getWarehouseId() != null) {<NEW_LINE>queryBuilder.addEqualsFilter(I_PP_Order.<MASK><NEW_LINE>}<NEW_LINE>// Responsible<NEW_LINE>query.getResponsibleId().appendFilter(queryBuilder, I_PP_Order.COLUMNNAME_AD_User_Responsible_ID);<NEW_LINE>// Only Releases Manufacturing orders<NEW_LINE>if (query.isOnlyCompleted()) {<NEW_LINE>queryBuilder.addEqualsFilter(I_PP_Order.COLUMN_Processed, true);<NEW_LINE>queryBuilder.addEqualsFilter(I_PP_Order.COLUMN_DocStatus, DocStatus.Completed);<NEW_LINE>}<NEW_LINE>// Export Status<NEW_LINE>if (query.getExportStatus() != null) {<NEW_LINE>queryBuilder.addEqualsFilter(I_PP_Order.COLUMNNAME_ExportStatus, query.getExportStatus().getCode());<NEW_LINE>}<NEW_LINE>if (query.getCanBeExportedFrom() != null) {<NEW_LINE>queryBuilder.addCompareFilter(I_PP_Order.COLUMN_CanBeExportedFrom, LESS_OR_EQUAL, asTimestamp(query.getCanBeExportedFrom()));<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Order BYs<NEW_LINE>queryBuilder.orderBy(I_PP_Order.COLUMN_DocumentNo);<NEW_LINE>queryBuilder.orderBy(I_PP_Order.COLUMNNAME_PP_Order_ID);<NEW_LINE>// Limit<NEW_LINE>if (query.getLimit().isLimited()) {<NEW_LINE>queryBuilder.setLimit(query.getLimit());<NEW_LINE>}<NEW_LINE>//<NEW_LINE>return queryBuilder;<NEW_LINE>} | COLUMNNAME_M_Warehouse_ID, query.getWarehouseId()); |
461,736 | public void marshall(LustreFileSystemConfiguration lustreFileSystemConfiguration, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (lustreFileSystemConfiguration == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(lustreFileSystemConfiguration.getWeeklyMaintenanceStartTime(), WEEKLYMAINTENANCESTARTTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(lustreFileSystemConfiguration.getDataRepositoryConfiguration(), DATAREPOSITORYCONFIGURATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(lustreFileSystemConfiguration.getPerUnitStorageThroughput(), PERUNITSTORAGETHROUGHPUT_BINDING);<NEW_LINE>protocolMarshaller.marshall(lustreFileSystemConfiguration.getMountName(), MOUNTNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(lustreFileSystemConfiguration.getDailyAutomaticBackupStartTime(), DAILYAUTOMATICBACKUPSTARTTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(lustreFileSystemConfiguration.getAutomaticBackupRetentionDays(), AUTOMATICBACKUPRETENTIONDAYS_BINDING);<NEW_LINE>protocolMarshaller.marshall(lustreFileSystemConfiguration.getCopyTagsToBackups(), COPYTAGSTOBACKUPS_BINDING);<NEW_LINE>protocolMarshaller.marshall(lustreFileSystemConfiguration.getDriveCacheType(), DRIVECACHETYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(lustreFileSystemConfiguration.getDataCompressionType(), DATACOMPRESSIONTYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(lustreFileSystemConfiguration.getLogConfiguration(), LOGCONFIGURATION_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | lustreFileSystemConfiguration.getDeploymentType(), DEPLOYMENTTYPE_BINDING); |
1,269,285 | public String serializeSpanContext() {<NEW_LINE>StringBuilder serializedValue = new StringBuilder();<NEW_LINE>serializedValue.append(TRACE_ID_KET).append(StringUtils.EQUAL).append(traceId).append(StringUtils.AND);<NEW_LINE>serializedValue.append(SPAN_ID_KET).append(StringUtils.EQUAL).append(spanId).append(StringUtils.AND);<NEW_LINE>serializedValue.append(PARENT_SPAN_ID_KET).append(StringUtils.EQUAL).append(parentId).append(StringUtils.AND);<NEW_LINE>serializedValue.append(SAMPLE_KET).append(StringUtils.EQUAL).append(isSampled).append(StringUtils.AND);<NEW_LINE>// system bizBaggage<NEW_LINE>if (this.sysBaggage.size() > 0) {<NEW_LINE>serializedValue.append(StringUtils.mapToStringWithPrefix<MASK><NEW_LINE>}<NEW_LINE>// bizBaggage<NEW_LINE>if (this.bizBaggage.size() > 0) {<NEW_LINE>serializedValue.append(StringUtils.mapToString(bizBaggage));<NEW_LINE>}<NEW_LINE>return serializedValue.toString();<NEW_LINE>} | (this.sysBaggage, SYS_BAGGAGE_PREFIX_KEY)); |
1,078,231 | private synchronized ConnectionI createConnection(Transceiver transceiver, ConnectorInfo ci) {<NEW_LINE>assert (_pending.containsKey(ci.connector) && transceiver != null);<NEW_LINE>//<NEW_LINE>// Create and add the connection to the connection map. Adding the connection to the map<NEW_LINE>// is necessary to support the interruption of the connection initialization and validation<NEW_LINE>// in case the communicator is destroyed.<NEW_LINE>//<NEW_LINE>ConnectionI connection = null;<NEW_LINE>try {<NEW_LINE>if (_destroyed) {<NEW_LINE>throw new com<MASK><NEW_LINE>}<NEW_LINE>connection = new ConnectionI(_communicator, _instance, _monitor, transceiver, ci.connector, ci.endpoint.compress(false), null);<NEW_LINE>} catch (LocalException ex) {<NEW_LINE>try {<NEW_LINE>transceiver.close();<NEW_LINE>} catch (LocalException exc) {<NEW_LINE>// Ignore<NEW_LINE>}<NEW_LINE>throw ex;<NEW_LINE>}<NEW_LINE>_connections.putOne(ci.connector, connection);<NEW_LINE>_connectionsByEndpoint.putOne(connection.endpoint(), connection);<NEW_LINE>_connectionsByEndpoint.putOne(connection.endpoint().compress(true), connection);<NEW_LINE>return connection;<NEW_LINE>} | .zeroc.Ice.CommunicatorDestroyedException(); |
837,607 | public Request<ModifyNetworkInterfaceAttributeRequest> marshall(ModifyNetworkInterfaceAttributeRequest modifyNetworkInterfaceAttributeRequest) {<NEW_LINE>if (modifyNetworkInterfaceAttributeRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>Request<ModifyNetworkInterfaceAttributeRequest> request = new DefaultRequest<ModifyNetworkInterfaceAttributeRequest>(modifyNetworkInterfaceAttributeRequest, "AmazonEC2");<NEW_LINE>request.addParameter("Action", "ModifyNetworkInterfaceAttribute");<NEW_LINE>request.addParameter("Version", "2015-10-01");<NEW_LINE>if (modifyNetworkInterfaceAttributeRequest.getNetworkInterfaceId() != null) {<NEW_LINE>request.addParameter("NetworkInterfaceId", StringUtils.fromString(modifyNetworkInterfaceAttributeRequest.getNetworkInterfaceId()));<NEW_LINE>}<NEW_LINE>if (modifyNetworkInterfaceAttributeRequest.getDescription() != null) {<NEW_LINE>request.addParameter("Description.Value", StringUtils.fromString(modifyNetworkInterfaceAttributeRequest.getDescription()));<NEW_LINE>}<NEW_LINE>if (modifyNetworkInterfaceAttributeRequest.isSourceDestCheck() != null) {<NEW_LINE>request.addParameter("SourceDestCheck.Value", StringUtils.fromBoolean(modifyNetworkInterfaceAttributeRequest.isSourceDestCheck()));<NEW_LINE>}<NEW_LINE>java.util.List<String<MASK><NEW_LINE>int groupsListIndex = 1;<NEW_LINE>for (String groupsListValue : groupsList) {<NEW_LINE>if (groupsListValue != null) {<NEW_LINE>request.addParameter("SecurityGroupId." + groupsListIndex, StringUtils.fromString(groupsListValue));<NEW_LINE>}<NEW_LINE>groupsListIndex++;<NEW_LINE>}<NEW_LINE>NetworkInterfaceAttachmentChanges networkInterfaceAttachmentChangesAttachment = modifyNetworkInterfaceAttributeRequest.getAttachment();<NEW_LINE>if (networkInterfaceAttachmentChangesAttachment != null) {<NEW_LINE>if (networkInterfaceAttachmentChangesAttachment.getAttachmentId() != null) {<NEW_LINE>request.addParameter("Attachment.AttachmentId", StringUtils.fromString(networkInterfaceAttachmentChangesAttachment.getAttachmentId()));<NEW_LINE>}<NEW_LINE>if (networkInterfaceAttachmentChangesAttachment.isDeleteOnTermination() != null) {<NEW_LINE>request.addParameter("Attachment.DeleteOnTermination", StringUtils.fromBoolean(networkInterfaceAttachmentChangesAttachment.isDeleteOnTermination()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | > groupsList = modifyNetworkInterfaceAttributeRequest.getGroups(); |
1,590,533 | static void diffRowValues(RowBuilder rowBuilder, @Nullable Row baseRow, @Nullable Row deltaRow, TableMetadata inputMetadata) {<NEW_LINE>checkArgument(baseRow != null || deltaRow != null, "Both base and delta rows cannot be null");<NEW_LINE><MASK><NEW_LINE>checkArgument(inputMetadata.getColumnMetadata() != null, "columns cannot be null");<NEW_LINE>String keyStatus = baseRow == null ? COL_KEY_STATUS_ONLY_DELTA : deltaRow == null ? COL_KEY_STATUS_ONLY_BASE : COL_KEY_STATUS_BOTH;<NEW_LINE>rowBuilder.put(COL_KEY_PRESENCE, keyStatus);<NEW_LINE>for (ColumnMetadata cm : inputMetadata.getColumnMetadata()) {<NEW_LINE>if (cm.getIsKey()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Object baseValue = baseRow == null ? null : baseRow.get(cm.getName(), cm.getSchema());<NEW_LINE>Object deltaValue = deltaRow == null ? null : deltaRow.get(cm.getName(), cm.getSchema());<NEW_LINE>rowBuilder.put(baseColumnName(cm.getName()), baseValue).put(deltaColumnName(cm.getName()), deltaValue);<NEW_LINE>}<NEW_LINE>} | checkArgument(rowBuilder != null, "rowBuilder cannot be null"); |
177,324 | private static void tryChainedCountSum(RegressionEnvironment env, int numThreads, int numEvents) {<NEW_LINE>// setup statements<NEW_LINE>RegressionPath path = new RegressionPath();<NEW_LINE>env.compileDeploy("@public insert into MyStreamOne select count(*) as cnt from SupportBean", path);<NEW_LINE>env.compileDeploy("@name('s0') insert into MyStreamTwo select sum(cnt) as mysum from MyStreamOne", path);<NEW_LINE>SupportUpdateListener listener = new SupportUpdateListener();<NEW_LINE>env.statement("s0").addListener(listener);<NEW_LINE>// execute<NEW_LINE>ExecutorService threadPool = Executors.newFixedThreadPool(numThreads, new SupportThreadFactory(MultithreadDeterminismInsertInto.class));<NEW_LINE>Future[<MASK><NEW_LINE>ReentrantReadWriteLock sharedStartLock = new ReentrantReadWriteLock();<NEW_LINE>sharedStartLock.writeLock().lock();<NEW_LINE>for (int i = 0; i < numThreads; i++) {<NEW_LINE>future[i] = threadPool.submit(new SendEventRWLockCallable(i, sharedStartLock, env.runtime(), new GeneratorIterator(numEvents)));<NEW_LINE>}<NEW_LINE>SupportCompileDeployUtil.threadSleep(100);<NEW_LINE>sharedStartLock.writeLock().unlock();<NEW_LINE>threadPool.shutdown();<NEW_LINE>SupportCompileDeployUtil.threadpoolAwait(threadPool, 10, TimeUnit.SECONDS);<NEW_LINE>SupportCompileDeployUtil.assertFutures(future);<NEW_LINE>// assert result<NEW_LINE>EventBean[] newEvents = listener.getNewDataListFlattened();<NEW_LINE>for (int i = 0; i < numEvents - 1; i++) {<NEW_LINE>long expected = total(i + 1);<NEW_LINE>assertEquals(expected, newEvents[i].get("mysum"));<NEW_LINE>}<NEW_LINE>env.undeployAll();<NEW_LINE>} | ] future = new Future[numThreads]; |
1,602,855 | public static MDLocalVariable create32(long[] args, Metadata md) {<NEW_LINE>final long lineAndArg = ParseUtil.asInt(args, ARGINDEX_32_LINEARG, md);<NEW_LINE>final long line = lineAndArg & DW_TAG_LOCAL_VARIABLE_LINE_MASK;<NEW_LINE>final long arg = (lineAndArg & DW_TAG_LOCAL_VARIABLE_ARG_MASK) >> DW_TAG_LOCAL_VARIABLE_ARG_SHIFT;<NEW_LINE>final long flags = ParseUtil.asInt(args, ARGINDEX_32_FLAGS, md);<NEW_LINE>final MDLocalVariable localVariable = new MDLocalVariable(line, arg, flags);<NEW_LINE>localVariable.setName(ParseUtil.resolveReference(args, ARGINDEX_32_NAME, localVariable, md));<NEW_LINE>localVariable.setScope(ParseUtil.resolveReference(args<MASK><NEW_LINE>localVariable.setFile(ParseUtil.resolveReference(args, ARGINDEX_32_FILE, localVariable, md));<NEW_LINE>localVariable.setType(ParseUtil.resolveReference(args, ARGINDEX_32_TYPE, localVariable, md));<NEW_LINE>return localVariable;<NEW_LINE>} | , ARGINDEX_32_SCOPE, localVariable, md)); |
609,745 | private // "command=FINALIZE&media_id=601413451156586496"<NEW_LINE>UploadedMedia uploadMediaChunkedFinalize(long mediaId) throws TwitterException {<NEW_LINE>int tries = 0;<NEW_LINE>int maxTries = 20;<NEW_LINE>int lastProgressPercent = 0;<NEW_LINE>int currentProgressPercent = 0;<NEW_LINE>UploadedMedia uploadedMedia = uploadMediaChunkedFinalize0(mediaId);<NEW_LINE>while (tries < maxTries) {<NEW_LINE>if (lastProgressPercent == currentProgressPercent) {<NEW_LINE>tries++;<NEW_LINE>}<NEW_LINE>lastProgressPercent = currentProgressPercent;<NEW_LINE>String state = uploadedMedia.getProcessingState();<NEW_LINE>if (state.equals("failed")) {<NEW_LINE>throw new TwitterException("Failed to finalize the chuncked upload.");<NEW_LINE>}<NEW_LINE>if (state.equals("pending") || state.equals("in_progress")) {<NEW_LINE>currentProgressPercent = uploadedMedia.getProgressPercent();<NEW_LINE>int waitSec = Math.max(uploadedMedia.getProcessingCheckAfterSecs(), 1);<NEW_LINE>logger.<MASK><NEW_LINE>try {<NEW_LINE>Thread.sleep(waitSec * 1000);<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>throw new TwitterException("Failed to finalize the chuncked upload.", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (state.equals("succeeded")) {<NEW_LINE>return uploadedMedia;<NEW_LINE>}<NEW_LINE>uploadedMedia = uploadMediaChunkedStatus(mediaId);<NEW_LINE>}<NEW_LINE>throw new TwitterException("Failed to finalize the chuncked upload, progress has stopped, tried " + tries + 1 + " times.");<NEW_LINE>} | debug("Chunked finalize, wait for:" + waitSec + " sec"); |
1,355,524 | public byte[] decrypt(byte[] cipherTextWithIv) throws Exception {<NEW_LINE>checkHeader(cipherTextWithIv);<NEW_LINE>Cipher cipher = Cipher.getInstance(CIPHER_NAME);<NEW_LINE>int bufferLength = cipherTextWithIv.length - HEADER.length;<NEW_LINE>ByteBuffer buffer = ByteBuffer.wrap(cipherTextWithIv, HEADER.length, bufferLength);<NEW_LINE>int ivLength = IV_LENGTH;<NEW_LINE>if (topping != null) {<NEW_LINE>int mark = buffer.position();<NEW_LINE>// we need the first index, the second is for the actual data<NEW_LINE>boolean found = false;<NEW_LINE>while (buffer.hasRemaining() && !found) {<NEW_LINE>if (buffer.get() == 0x21) {<NEW_LINE>found = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// don't include the splitter itself<NEW_LINE>ivLength = buffer.position() - mark - 1;<NEW_LINE>// don't remove this cast, it'll cause problems if you remove it<NEW_LINE>// reset to the pre-while index<NEW_LINE>((Buffer) buffer).position(mark);<NEW_LINE>}<NEW_LINE>byte[] iv = new byte[ivLength];<NEW_LINE>buffer.get(iv);<NEW_LINE>// don't remove this cast, it'll cause problems if you remove it<NEW_LINE>// skip splitter<NEW_LINE>((Buffer) buffer).position(buffer.position() + 1);<NEW_LINE>byte[] cipherText = new <MASK><NEW_LINE>buffer.get(cipherText);<NEW_LINE>if (topping != null) {<NEW_LINE>iv = topping.decode(iv);<NEW_LINE>cipherText = topping.decode(cipherText);<NEW_LINE>}<NEW_LINE>GCMParameterSpec spec = new GCMParameterSpec(TAG_BIT_LENGTH, iv);<NEW_LINE>cipher.init(Cipher.DECRYPT_MODE, secretKey, spec);<NEW_LINE>return cipher.doFinal(cipherText);<NEW_LINE>} | byte[buffer.remaining()]; |
331,851 | public void init(boolean forEncryption, CipherParameters param) {<NEW_LINE>if (param instanceof ParametersWithRandom) {<NEW_LINE>ParametersWithRandom p = (ParametersWithRandom) param;<NEW_LINE>this.key = <MASK><NEW_LINE>this.random = p.getRandom();<NEW_LINE>} else {<NEW_LINE>this.key = (ElGamalKeyParameters) param;<NEW_LINE>this.random = CryptoServicesRegistrar.getSecureRandom();<NEW_LINE>}<NEW_LINE>this.forEncryption = forEncryption;<NEW_LINE>BigInteger p = key.getParameters().getP();<NEW_LINE>bitSize = p.bitLength();<NEW_LINE>if (forEncryption) {<NEW_LINE>if (!(key instanceof ElGamalPublicKeyParameters)) {<NEW_LINE>throw new IllegalArgumentException("ElGamalPublicKeyParameters are required for encryption.");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (!(key instanceof ElGamalPrivateKeyParameters)) {<NEW_LINE>throw new IllegalArgumentException("ElGamalPrivateKeyParameters are required for decryption.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (ElGamalKeyParameters) p.getParameters(); |
1,069,766 | // This function assumes Python script is located in the "src/main/resources".<NEW_LINE>public List<String> runPython(String pyName) throws Exception {<NEW_LINE>String pyFullName = getFullResourcePath(pyName);<NEW_LINE>LOG.info(String.format("Run python script `%s`", pyFullName));<NEW_LINE>ProcessBuilder pBuilder = new ProcessBuilder("python", pyFullName);<NEW_LINE>pBuilder.redirectErrorStream(true);<NEW_LINE>Process p = pBuilder.start();<NEW_LINE>List<String> results;<NEW_LINE>BufferedReader output = new BufferedReader(new InputStreamReader(p.getInputStream()));<NEW_LINE>results = output.lines().<MASK><NEW_LINE>int exitCode = p.waitFor();<NEW_LINE>for (String result : results) {<NEW_LINE>LOG.info(result);<NEW_LINE>}<NEW_LINE>if (exitCode != 0) {<NEW_LINE>throw new IllegalArgumentException(String.format("Cannot execute '%s'", pyName));<NEW_LINE>}<NEW_LINE>return results;<NEW_LINE>} | collect(Collectors.toList()); |
1,007,828 | final ListComponentsResult executeListComponents(ListComponentsRequest listComponentsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listComponentsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListComponentsRequest> request = null;<NEW_LINE>Response<ListComponentsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListComponentsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listComponentsRequest));<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, "Application Insights");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListComponents");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListComponentsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(<MASK><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>} | false), new ListComponentsResultJsonUnmarshaller()); |
242,255 | public Insn withSourceLiteral() {<NEW_LINE>RegisterSpecList sources = getSources();<NEW_LINE><MASK><NEW_LINE>if (szSources == 0) {<NEW_LINE>return this;<NEW_LINE>}<NEW_LINE>TypeBearer lastType = sources.get(szSources - 1).getTypeBearer();<NEW_LINE>if (!lastType.isConstant()) {<NEW_LINE>// Check for reverse subtraction, where first source is constant<NEW_LINE>TypeBearer firstType = sources.get(0).getTypeBearer();<NEW_LINE>if (szSources == 2 && firstType.isConstant()) {<NEW_LINE>Constant cst = (Constant) firstType;<NEW_LINE>RegisterSpecList newSources = sources.withoutFirst();<NEW_LINE>Rop newRop = Rops.ropFor(getOpcode().getOpcode(), getResult(), newSources, cst);<NEW_LINE>return new PlainCstInsn(newRop, getPosition(), getResult(), newSources, cst);<NEW_LINE>}<NEW_LINE>return this;<NEW_LINE>} else {<NEW_LINE>Constant cst = (Constant) lastType;<NEW_LINE>RegisterSpecList newSources = sources.withoutLast();<NEW_LINE>Rop newRop;<NEW_LINE>try {<NEW_LINE>// Check for constant subtraction and flip it to be addition<NEW_LINE>int opcode = getOpcode().getOpcode();<NEW_LINE>if (opcode == RegOps.SUB && cst instanceof CstInteger) {<NEW_LINE>opcode = RegOps.ADD;<NEW_LINE>cst = CstInteger.make(-((CstInteger) cst).getValue());<NEW_LINE>}<NEW_LINE>newRop = Rops.ropFor(opcode, getResult(), newSources, cst);<NEW_LINE>} catch (IllegalArgumentException ex) {<NEW_LINE>// There's no rop for this case<NEW_LINE>return this;<NEW_LINE>}<NEW_LINE>return new PlainCstInsn(newRop, getPosition(), getResult(), newSources, cst);<NEW_LINE>}<NEW_LINE>} | int szSources = sources.size(); |
1,794,372 | protected boolean checkNullableFieldDereference(Scope scope, FieldBinding field, long sourcePosition, FlowContext flowContext, int ttlForFieldCheck) {<NEW_LINE>if (field != null) {<NEW_LINE>if (ttlForFieldCheck > 0 && scope.compilerOptions().enableSyntacticNullAnalysisForFields)<NEW_LINE>flowContext.recordNullCheckedFieldReference(this, ttlForFieldCheck);<NEW_LINE>// preference to type annotations if we have any<NEW_LINE>if ((field.type.tagBits & TagBits.AnnotationNullable) != 0) {<NEW_LINE>scope.problemReporter().dereferencingNullableExpression(<MASK><NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (field.type.isFreeTypeVariable()) {<NEW_LINE>scope.problemReporter().fieldFreeTypeVariableReference(field, sourcePosition);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if ((field.tagBits & TagBits.AnnotationNullable) != 0) {<NEW_LINE>scope.problemReporter().nullableFieldDereference(field, sourcePosition);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | sourcePosition, scope.environment()); |
366,899 | public static void finish_time_warp() {<NEW_LINE>long completed_ticks = time_warp_scheduled_ticks - time_bias;<NEW_LINE>double milis_to_complete = System.nanoTime() - time_warp_start_time;<NEW_LINE>if (milis_to_complete == 0.0) {<NEW_LINE>milis_to_complete = 1.0;<NEW_LINE>}<NEW_LINE>milis_to_complete /= 1000000.0;<NEW_LINE>int tps = (int<MASK><NEW_LINE>double mspt = (1.0 * milis_to_complete) / completed_ticks;<NEW_LINE>time_warp_scheduled_ticks = 0;<NEW_LINE>time_warp_start_time = 0;<NEW_LINE>if (tick_warp_callback != null) {<NEW_LINE>Commands icommandmanager = tick_warp_sender.getServer().getCommands();<NEW_LINE>try {<NEW_LINE>icommandmanager.performCommand(tick_warp_sender, tick_warp_callback);<NEW_LINE>} catch (Throwable var23) {<NEW_LINE>if (time_advancerer != null) {<NEW_LINE>Messenger.m(time_advancerer, "r Command Callback failed - unknown error: ", "rb /" + tick_warp_callback, "/" + tick_warp_callback);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>tick_warp_callback = null;<NEW_LINE>tick_warp_sender = null;<NEW_LINE>}<NEW_LINE>if (time_advancerer != null) {<NEW_LINE>Messenger.m(time_advancerer, String.format("gi ... Time warp completed with %d tps, or %.2f mspt", tps, mspt));<NEW_LINE>time_advancerer = null;<NEW_LINE>} else {<NEW_LINE>Messenger.print_server_message(CarpetServer.minecraft_server, String.format("... Time warp completed with %d tps, or %.2f mspt", tps, mspt));<NEW_LINE>}<NEW_LINE>time_bias = 0;<NEW_LINE>} | ) (1000.0D * completed_ticks / milis_to_complete); |
961,076 | public void save(JasperPrint jasperPrint, File file) throws JRException {<NEW_LINE>if (!file.getName().toLowerCase().endsWith(EXTENSION_XLS)) {<NEW_LINE>file = new File(file.getAbsolutePath() + EXTENSION_XLS);<NEW_LINE>}<NEW_LINE>if (!file.exists() || JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog(null, MessageFormat.format(getBundleString("file.exists"), new Object[] { file.getName() }), getBundleString("save"), JOptionPane.OK_CANCEL_OPTION)) {<NEW_LINE>JRXlsExporter exporter <MASK><NEW_LINE>exporter.setExporterInput(new SimpleExporterInput(jasperPrint));<NEW_LINE>exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(file));<NEW_LINE>SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration();<NEW_LINE>configuration.setOnePagePerSheet(false);<NEW_LINE>exporter.setConfiguration(configuration);<NEW_LINE>exporter.exportReport();<NEW_LINE>}<NEW_LINE>} | = new JRXlsExporter(getJasperReportsContext()); |
649,647 | public Answer cloneVolumeFromBaseTemplate(final CopyCommand cmd) {<NEW_LINE>final Connection conn = hypervisorResource.getConnection();<NEW_LINE>final DataTO srcData = cmd.getSrcTO();<NEW_LINE>final DataTO destData = cmd.getDestTO();<NEW_LINE>final VolumeObjectTO volume = (VolumeObjectTO) destData;<NEW_LINE>VDI vdi = null;<NEW_LINE>try {<NEW_LINE>VDI tmpltvdi = null;<NEW_LINE>tmpltvdi = getVDIbyUuid(conn, srcData.getPath());<NEW_LINE>vdi = tmpltvdi.createClone(conn, new HashMap<MASK><NEW_LINE>Long virtualSize = vdi.getVirtualSize(conn);<NEW_LINE>if (volume.getSize() > virtualSize) {<NEW_LINE>s_logger.debug("Overriding provided template's size with new size " + toHumanReadableSize(volume.getSize()) + " for volume: " + volume.getName());<NEW_LINE>vdi.resize(conn, volume.getSize());<NEW_LINE>} else {<NEW_LINE>s_logger.debug("Using templates disk size of " + toHumanReadableSize(virtualSize) + " for volume: " + volume.getName() + " since size passed was " + toHumanReadableSize(volume.getSize()));<NEW_LINE>}<NEW_LINE>vdi.setNameLabel(conn, volume.getName());<NEW_LINE>VDI.Record vdir;<NEW_LINE>vdir = vdi.getRecord(conn);<NEW_LINE>s_logger.debug("Successfully created VDI: Uuid = " + vdir.uuid);<NEW_LINE>final VolumeObjectTO newVol = new VolumeObjectTO();<NEW_LINE>newVol.setName(vdir.nameLabel);<NEW_LINE>newVol.setSize(vdir.virtualSize);<NEW_LINE>newVol.setPath(vdir.uuid);<NEW_LINE>return new CopyCmdAnswer(newVol);<NEW_LINE>} catch (final Exception e) {<NEW_LINE>s_logger.warn("Unable to create volume; Pool=" + destData + "; Disk: ", e);<NEW_LINE>return new CopyCmdAnswer(e.toString());<NEW_LINE>}<NEW_LINE>} | <String, String>()); |
899,712 | public Map<String, Boolean> updateConfiguration(Map<String, String> propertiesMap) {<NEW_LINE>Map<String, Boolean> <MASK><NEW_LINE>int successCount = 0;<NEW_LINE>for (Map.Entry<String, String> entry : propertiesMap.entrySet()) {<NEW_LINE>try {<NEW_LINE>PropertyKey key = PropertyKey.fromString(entry.getKey());<NEW_LINE>if (ServerConfiguration.getBoolean(PropertyKey.CONF_DYNAMIC_UPDATE_ENABLED) && key.isDynamic()) {<NEW_LINE>Object oldValue = ServerConfiguration.get(key);<NEW_LINE>ServerConfiguration.set(key, entry.getValue(), Source.RUNTIME);<NEW_LINE>result.put(entry.getKey(), true);<NEW_LINE>successCount++;<NEW_LINE>LOG.info("Property {} has been updated to \"{}\" from \"{}\"", key.getName(), entry.getValue(), oldValue);<NEW_LINE>} else {<NEW_LINE>LOG.debug("Update a non-dynamic property {} is not allowed", key.getName());<NEW_LINE>result.put(entry.getKey(), false);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>result.put(entry.getKey(), false);<NEW_LINE>LOG.error("Failed to update property {} to {}", entry.getKey(), entry.getValue(), e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>LOG.debug("Update {} properties, succeed {}.", propertiesMap.size(), successCount);<NEW_LINE>return result;<NEW_LINE>} | result = new HashMap<>(); |
1,620,471 | public static void addCreatedTorrent(TOTorrent torrent) {<NEW_LINE>synchronized (created_torrents) {<NEW_LINE>try {<NEW_LINE>byte[] hash = torrent.getHash();<NEW_LINE>HashWrapper hw = new HashWrapper(hash);<NEW_LINE>boolean dirty = false;<NEW_LINE>long check = <MASK><NEW_LINE>COConfigurationManager.setParameter("my.created.torrents.check", check + 1);<NEW_LINE>if (check % 200 == 0) {<NEW_LINE>try {<NEW_LINE>List<DownloadManager> dms = CoreFactory.getSingleton().getGlobalManager().getDownloadManagers();<NEW_LINE>Set<HashWrapper> actual_hashes = new HashSet<>();<NEW_LINE>for (DownloadManager dm : dms) {<NEW_LINE>TOTorrent t = dm.getTorrent();<NEW_LINE>if (t != null) {<NEW_LINE>try {<NEW_LINE>actual_hashes.add(t.getHashWrapper());<NEW_LINE>} catch (Throwable e) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Iterator<byte[]> it = created_torrents.iterator();<NEW_LINE>int deleted = 0;<NEW_LINE>while (it.hasNext()) {<NEW_LINE>HashWrapper existing_hw = new HashWrapper(it.next());<NEW_LINE>if (!actual_hashes.contains(existing_hw) && !existing_hw.equals(hw)) {<NEW_LINE>it.remove();<NEW_LINE>created_torrents_set.remove(existing_hw);<NEW_LINE>deleted++;<NEW_LINE>dirty = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Throwable e) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// System.out.println( "addCreated:" + new String(torrent.getName()) + "/" + ByteFormatter.encodeString( hash ));<NEW_LINE>if (created_torrents.size() == 0) {<NEW_LINE>COConfigurationManager.setParameter("my.created.torrents", created_torrents);<NEW_LINE>}<NEW_LINE>if (!created_torrents_set.contains(hw)) {<NEW_LINE>created_torrents.add(hash);<NEW_LINE>created_torrents_set.add(hw);<NEW_LINE>dirty = true;<NEW_LINE>}<NEW_LINE>if (dirty) {<NEW_LINE>COConfigurationManager.setDirty();<NEW_LINE>}<NEW_LINE>} catch (TOTorrentException e) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | COConfigurationManager.getLongParameter("my.created.torrents.check", 0); |
1,579,609 | public Request<DeleteBackupRequest> marshall(DeleteBackupRequest deleteBackupRequest) {<NEW_LINE>if (deleteBackupRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(DeleteBackupRequest)");<NEW_LINE>}<NEW_LINE>Request<DeleteBackupRequest> request = new DefaultRequest<DeleteBackupRequest>(deleteBackupRequest, "AmazonDynamoDB");<NEW_LINE>String target = "DynamoDB_20120810.DeleteBackup";<NEW_LINE>request.addHeader("X-Amz-Target", target);<NEW_LINE>request.setHttpMethod(HttpMethodName.POST);<NEW_LINE>String uriResourcePath = "/";<NEW_LINE>request.setResourcePath(uriResourcePath);<NEW_LINE>try {<NEW_LINE>StringWriter stringWriter = new StringWriter();<NEW_LINE>AwsJsonWriter jsonWriter = JsonUtils.getJsonWriter(stringWriter);<NEW_LINE>jsonWriter.beginObject();<NEW_LINE>if (deleteBackupRequest.getBackupArn() != null) {<NEW_LINE>String backupArn = deleteBackupRequest.getBackupArn();<NEW_LINE>jsonWriter.name("BackupArn");<NEW_LINE>jsonWriter.value(backupArn);<NEW_LINE>}<NEW_LINE>jsonWriter.endObject();<NEW_LINE>jsonWriter.close();<NEW_LINE>String snippet = stringWriter.toString();<NEW_LINE>byte[] content = snippet.getBytes(UTF8);<NEW_LINE>request.setContent(new StringInputStream(snippet));<NEW_LINE>request.addHeader("Content-Length", Integer.toString(content.length));<NEW_LINE>} catch (Throwable t) {<NEW_LINE>throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);<NEW_LINE>}<NEW_LINE>if (!request.getHeaders().containsKey("Content-Type")) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | request.addHeader("Content-Type", "application/x-amz-json-1.0"); |
862,921 | public ServiceResponse serviceImpl(Query call, HttpServletResponse response, Authorization rights, final JsonObjectWithDefault permissions) {<NEW_LINE>// get a database update<NEW_LINE>DAO.observe();<NEW_LINE>String model = call.get("model", "");<NEW_LINE>String group = call.get("group", "");<NEW_LINE>String language = call.get("language", "");<NEW_LINE>JSONObject images = new JSONObject(true);<NEW_LINE>for (Map.Entry<SusiSkill.ID, SusiSkill> entry : DAO.susi.getSkillMetadata().entrySet()) {<NEW_LINE>SusiSkill.ID skill = entry.getKey();<NEW_LINE>if (skill.hasModel(model) && skill.hasGroup(group) && skill.hasLanguage(language)) {<NEW_LINE>images.put(skill.getPath(), entry.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>JSONObject json = new JSONObject(true).put("model", model).put("group", group).put("language", language).put("image", images);<NEW_LINE>json.put("accepted", true);<NEW_LINE>json.put("message", "Success: Fetched Image urls");<NEW_LINE>return new ServiceResponse(json);<NEW_LINE>} | getValue().getImage()); |
672,128 | public boolean processStep(BottlingMachineTileEntity tile) {<NEW_LINE>int energyExtracted = (int) (8 * IEServerConfig.MACHINES.bottlingMachineConfig.energyModifier.get());<NEW_LINE>if (tile.energyStorage.extractEnergy(energyExtracted, true) >= energyExtracted) {<NEW_LINE>tile.energyStorage.extractEnergy(energyExtracted, false);<NEW_LINE>processTick++;<NEW_LINE>float transformationPoint = getTransportTime(maxProcessTick) + getLiftTime(maxProcessTick);<NEW_LINE>if (processTick >= transformationPoint && processTick < 1 + transformationPoint) {<NEW_LINE>FluidStack fs = tile.tanks[0].getFluid();<NEW_LINE>if (!fs.isEmpty()) {<NEW_LINE>BottlingMachineRecipe recipe = BottlingMachineRecipe.findRecipe(items.get(0), fs);<NEW_LINE>if (recipe != null) {<NEW_LINE>if (recipe.fluidInput.test(tile.tanks[0].getFluid())) {<NEW_LINE>items.set(1, recipe.getActualItemOutputs(<MASK><NEW_LINE>tile.tanks[0].drain(recipe.fluidInput.getAmount(), FluidAction.EXECUTE);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>ItemStack ret = FluidUtils.fillFluidContainer(tile.tanks[0], items.get(0), ItemStack.EMPTY, null);<NEW_LINE>if (!ret.isEmpty())<NEW_LINE>items.set(1, ret);<NEW_LINE>}<NEW_LINE>if (items.get(1).isEmpty())<NEW_LINE>items.set(1, items.get(0));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (processTick >= maxProcessTick)<NEW_LINE>processFinished = true;<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | tile).get(0)); |
689,032 | public void search(float cx, float cy) {<NEW_LINE>peakX = cx;<NEW_LINE>peakY = cy;<NEW_LINE>if (radius <= 0) {<NEW_LINE>// can turn off refinement by setting radius to zero<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>float offset = -radius + (weights.isOdd() ? 0 : 0.5f);<NEW_LINE>for (int i = 0; i < maxIterations; i++) {<NEW_LINE>float total = 0;<NEW_LINE><MASK><NEW_LINE>int kernelIndex = 0;<NEW_LINE>// see if it can use fast interpolation otherwise use the safer technique<NEW_LINE>if (interpolate.isInFastBounds(peakX + offset, peakY + offset) && interpolate.isInFastBounds(peakX - offset, peakY - offset)) {<NEW_LINE>for (int yy = 0; yy < width; yy++) {<NEW_LINE>float y = offset + yy;<NEW_LINE>for (int xx = 0; xx < width; xx++) {<NEW_LINE>float x = offset + xx;<NEW_LINE>float w = weights.weightIndex(kernelIndex++);<NEW_LINE>float weight = w * interpolate.get_fast(peakX + x, peakY + y);<NEW_LINE>total += weight;<NEW_LINE>sumX += weight * x;<NEW_LINE>sumY += weight * y;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>for (int yy = 0; yy < width; yy++) {<NEW_LINE>float y = offset + yy;<NEW_LINE>for (int xx = 0; xx < width; xx++) {<NEW_LINE>float x = offset + xx;<NEW_LINE>float w = weights.weightIndex(kernelIndex++);<NEW_LINE>float weight = w * interpolate.get(peakX + x, peakY + y);<NEW_LINE>total += weight;<NEW_LINE>sumX += weight * x;<NEW_LINE>sumY += weight * y;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// avoid divided by zero<NEW_LINE>if (total == 0)<NEW_LINE>break;<NEW_LINE>cx = peakX + sumX / total;<NEW_LINE>cy = peakY + sumY / total;<NEW_LINE>float dx = cx - peakX;<NEW_LINE>float dy = cy - peakY;<NEW_LINE>peakX = cx;<NEW_LINE>peakY = cy;<NEW_LINE>if (Math.abs(dx) < convergenceTol && Math.abs(dy) < convergenceTol) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | float sumX = 0, sumY = 0; |
1,802,482 | public int generateForcastRunLines(MPPForecastRunDetail frd) {<NEW_LINE>List<Object> parameters = new ArrayList<Object>();<NEW_LINE>StringBuffer insertSQL = new StringBuffer();<NEW_LINE>MPPPeriod period = (MPPPeriod) frd.getPP_Period();<NEW_LINE>insertSQL.append("INSERT INTO ").append(MPPForecastRunLine.Table_Name).append(" frl (");<NEW_LINE>insertSQL.append(MPPForecastRunLine.COLUMNNAME_PP_ForecastRunLine_ID).append(",");<NEW_LINE>insertSQL.append(MPPForecastRunLine.COLUMNNAME_PP_ForecastRun_ID).append(",");<NEW_LINE>insertSQL.append(MPPForecastRunLine.COLUMNNAME_PP_ForecastRunDetail_ID).append(",");<NEW_LINE>insertSQL.append(MPPForecastRunLine.COLUMNNAME_AD_Client_ID).append(",");<NEW_LINE>insertSQL.append(MPPForecastRunLine.COLUMNNAME_AD_Org_ID).append(",");<NEW_LINE>insertSQL.append(MPPForecastRunLine.COLUMNNAME_C_SalesHistory_ID).append(",");<NEW_LINE>insertSQL.append(MPPForecastRunLine.COLUMNNAME_PP_Period_ID).append(",");<NEW_LINE>insertSQL.append(MPPForecastRunLine<MASK><NEW_LINE>insertSQL.append(MPPForecastRunLine.COLUMNNAME_CreatedBy).append(",");<NEW_LINE>insertSQL.append(MPPForecastRunLine.COLUMNNAME_Updated).append(",");<NEW_LINE>insertSQL.append(MPPForecastRunLine.COLUMNNAME_UpdatedBy).append(")");<NEW_LINE>insertSQL.append(" SELECT DISTINCT ");<NEW_LINE>insertSQL.append("nextidfunc(").append(MSequence.get(getCtx(), MPPForecastRunLine.Table_Name).get_ID()).append(",'Y')").append(",");<NEW_LINE>insertSQL.append(frd.getPP_ForecastRun_ID()).append(",");<NEW_LINE>insertSQL.append(frd.getPP_ForecastRunDetail_ID()).append(",");<NEW_LINE>insertSQL.append(MSalesHistory.COLUMNNAME_AD_Client_ID).append(",");<NEW_LINE>insertSQL.append(MSalesHistory.COLUMNNAME_AD_Org_ID).append(",");<NEW_LINE>insertSQL.append(MSalesHistory.COLUMNNAME_C_SalesHistory_ID).append(",");<NEW_LINE>insertSQL.append(period.getPP_Period_ID()).append(",");<NEW_LINE>insertSQL.append("SYSDATE").append(",");<NEW_LINE>insertSQL.append(Env.getAD_User_ID(getCtx())).append(",");<NEW_LINE>insertSQL.append("SYSDATE").append(",");<NEW_LINE>insertSQL.append(Env.getAD_User_ID(getCtx()));<NEW_LINE>insertSQL.append(" FROM ").append(MSalesHistory.Table_Name);<NEW_LINE>insertSQL.append(" WHERE ");<NEW_LINE>insertSQL.append(MSalesHistory.COLUMNNAME_M_Product_ID).append("=? AND ");<NEW_LINE>insertSQL.append(MSalesHistory.COLUMNNAME_M_Warehouse_ID).append("=? AND ");<NEW_LINE>insertSQL.append(MSalesHistory.COLUMNNAME_DateInvoiced).append(" BETWEEN ? AND ? ");<NEW_LINE>parameters.add(frd.getPP_ForecastRunMaster().getM_Product_ID());<NEW_LINE>parameters.add(m_run.getM_WarehouseSource_ID());<NEW_LINE>parameters.add(period.getStartDate());<NEW_LINE>parameters.add(period.getEndDate());<NEW_LINE>return DB.executeUpdateEx(insertSQL.toString(), parameters.toArray(), get_TrxName());<NEW_LINE>} | .COLUMNNAME_Created).append(","); |
725,300 | public void createControl(Composite parent) {<NEW_LINE>initializeDialogUnits(parent);<NEW_LINE>SashForm settingsDivider = new SashForm(parent, SWT.VERTICAL);<NEW_LINE>settingsDivider.setLayoutData(new GridData(GridData.FILL_BOTH));<NEW_LINE>{<NEW_LINE>Composite inputFilesGroup = UIUtils.createComposite(settingsDivider, 1);<NEW_LINE>inputFilesGroup.setLayoutData(new GridData(GridData.FILL_BOTH));<NEW_LINE>UIUtils.createControlLabel(inputFilesGroup, DTMessages.data_transfer_wizard_settings_group_input_files);<NEW_LINE>filesTable = new Table(inputFilesGroup, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);<NEW_LINE>filesTable.setLayoutData(new GridData(GridData.FILL_BOTH));<NEW_LINE>filesTable.setHeaderVisible(true);<NEW_LINE>filesTable.setLinesVisible(true);<NEW_LINE>UIUtils.createTableColumn(filesTable, SWT.LEFT, DTUIMessages.data_transfer_wizard_final_column_source);<NEW_LINE>UIUtils.createTableColumn(filesTable, SWT.LEFT, DTUIMessages.data_transfer_wizard_final_column_target);<NEW_LINE>filesTable.addSelectionListener(new SelectionAdapter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void widgetSelected(SelectionEvent e) {<NEW_LINE>if (filesTable.getSelectionIndex() < 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>TableItem item = filesTable.getItem(filesTable.getSelectionIndex());<NEW_LINE>DataTransferPipe pipe = <MASK><NEW_LINE>chooseSourceFile(pipe);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void widgetDefaultSelected(SelectionEvent e) {<NEW_LINE>widgetSelected(e);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>{<NEW_LINE>Composite exporterSettings = UIUtils.createComposite(settingsDivider, 1);<NEW_LINE>UIUtils.createControlLabel(exporterSettings, DTMessages.data_transfer_wizard_settings_group_importer);<NEW_LINE>propsEditor = new PropertyTreeViewer(exporterSettings, SWT.BORDER);<NEW_LINE>}<NEW_LINE>settingsDivider.setWeights(new int[] { 400, 600 });<NEW_LINE>setControl(settingsDivider);<NEW_LINE>updatePageCompletion();<NEW_LINE>} | (DataTransferPipe) item.getData(); |
446,877 | private void readWebSocketFrame() throws IOException {<NEW_LINE>try {<NEW_LINE>Frame frame = Frame.read(this.inputStream);<NEW_LINE>if (frame.getType() == Frame.Type.PING) {<NEW_LINE>writeWebSocketFrame(new Frame(Frame.Type.PONG));<NEW_LINE>} else if (frame.getType() == Frame.Type.CLOSE) {<NEW_LINE>throw new ConnectionClosedException();<NEW_LINE>} else if (frame.getType() == Frame.Type.TEXT) {<NEW_LINE>logger.debug(LogMessage.format("Received LiveReload text frame %s", frame));<NEW_LINE>} else {<NEW_LINE>throw new IOException("Unexpected Frame Type " + frame.getType());<NEW_LINE>}<NEW_LINE>} catch (SocketTimeoutException ex) {<NEW_LINE>writeWebSocketFrame(new Frame(Frame.Type.PING));<NEW_LINE>Frame frame = <MASK><NEW_LINE>if (frame.getType() != Frame.Type.PONG) {<NEW_LINE>throw new IllegalStateException("No Pong");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Frame.read(this.inputStream); |
1,799,517 | private List<DdlTask> createTasksForOneJob(PhysicalPlanData physicalPlanData) {<NEW_LINE>String schemaName = physicalPlanData.getSchemaName();<NEW_LINE>String logicalTableName = physicalPlanData.getLogicalTableName();<NEW_LINE>String indexName = physicalPlanData.getIndexName();<NEW_LINE>boolean isNewPart = DbInfoManager.getInstance().isNewPartitionDb(schemaName);<NEW_LINE>TableGroupConfig tableGroupConfig = isNewPart ? physicalPlanData.getTableGroupConfig() : null;<NEW_LINE>DdlTask validateTask = new DropIndexValidateTask(schemaName, logicalTableName, indexName, tableGroupConfig);<NEW_LINE>DdlTask hideMetaTask = new DropIndexHideMetaTask(schemaName, logicalTableName, indexName);<NEW_LINE>TableSyncTask tableSyncTask = new TableSyncTask(schemaName, logicalTableName);<NEW_LINE>DdlTask phyDdlTask = new DropIndexPhyDdlTask(schemaName, physicalPlanData);<NEW_LINE>DdlTask cdcMarkDdlTask <MASK><NEW_LINE>DdlTask removeMetaTask = new DropIndexRemoveMetaTask(schemaName, logicalTableName, indexName);<NEW_LINE>return Lists.newArrayList(validateTask, hideMetaTask, tableSyncTask, phyDdlTask, cdcMarkDdlTask, removeMetaTask);<NEW_LINE>} | = new CdcDdlMarkTask(schemaName, physicalPlanData); |
1,776,185 | private static void serializeKeyToByteBuffer(final ByteBuffer buffer, final OType type, final Object key) {<NEW_LINE>switch(type) {<NEW_LINE>case BINARY:<NEW_LINE>final byte[] <MASK><NEW_LINE>buffer.putInt(array.length);<NEW_LINE>buffer.put(array);<NEW_LINE>return;<NEW_LINE>case BOOLEAN:<NEW_LINE>buffer.put((Boolean) key ? (byte) 1 : 0);<NEW_LINE>return;<NEW_LINE>case BYTE:<NEW_LINE>buffer.put((Byte) key);<NEW_LINE>return;<NEW_LINE>case DATE:<NEW_LINE>case DATETIME:<NEW_LINE>buffer.putLong(((Date) key).getTime());<NEW_LINE>return;<NEW_LINE>case DECIMAL:<NEW_LINE>final BigDecimal decimal = (BigDecimal) key;<NEW_LINE>buffer.putInt(decimal.scale());<NEW_LINE>final byte[] unscaledValue = decimal.unscaledValue().toByteArray();<NEW_LINE>buffer.putInt(unscaledValue.length);<NEW_LINE>buffer.put(unscaledValue);<NEW_LINE>return;<NEW_LINE>case DOUBLE:<NEW_LINE>buffer.putLong(Double.doubleToLongBits((Double) key));<NEW_LINE>return;<NEW_LINE>case FLOAT:<NEW_LINE>buffer.putInt(Float.floatToIntBits((Float) key));<NEW_LINE>return;<NEW_LINE>case INTEGER:<NEW_LINE>buffer.putInt((Integer) key);<NEW_LINE>return;<NEW_LINE>case LINK:<NEW_LINE>OCompactedLinkSerializer.INSTANCE.serializeInByteBufferObject((ORID) key, buffer);<NEW_LINE>return;<NEW_LINE>case LONG:<NEW_LINE>buffer.putLong((Long) key);<NEW_LINE>return;<NEW_LINE>case SHORT:<NEW_LINE>buffer.putShort((Short) key);<NEW_LINE>return;<NEW_LINE>case STRING:<NEW_LINE>OUTF8Serializer.INSTANCE.serializeInByteBufferObject((String) key, buffer);<NEW_LINE>return;<NEW_LINE>default:<NEW_LINE>throw new OIndexException("Unsupported index type " + type);<NEW_LINE>}<NEW_LINE>} | array = (byte[]) key; |
1,805,621 | public CreatePipelineResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>CreatePipelineResult createPipelineResult = new CreatePipelineResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return createPipelineResult;<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("pipeline", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createPipelineResult.setPipeline(PipelineDeclarationJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("tags", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createPipelineResult.setTags(new ListUnmarshaller<Tag>(TagJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return createPipelineResult;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
820,364 | private boolean handleNonReadyStatus() {<NEW_LINE>synchronized (this.syncObject) {<NEW_LINE>Status nodeStatus = this.node.getStatus();<NEW_LINE>boolean quickFinish = false;<NEW_LINE>final long time = System.currentTimeMillis();<NEW_LINE>if (Status.isStatusFinished(nodeStatus)) {<NEW_LINE>quickFinish = true;<NEW_LINE>} else if (nodeStatus == Status.DISABLED) {<NEW_LINE>nodeStatus = changeStatus(Status.SKIPPED, time);<NEW_LINE>quickFinish = true;<NEW_LINE>} else if (this.isKilled()) {<NEW_LINE>nodeStatus = changeStatus(Status.KILLED, time);<NEW_LINE>quickFinish = true;<NEW_LINE>}<NEW_LINE>if (quickFinish) {<NEW_LINE>this.node.setStartTime(time);<NEW_LINE>fireEvent(Event.create(this, EventType.JOB_STARTED, new EventData(nodeStatus, this.node.getNestedId())));<NEW_LINE><MASK><NEW_LINE>fireEvent(Event.create(this, EventType.JOB_FINISHED, new EventData(nodeStatus, this.node.getNestedId())));<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | this.node.setEndTime(time); |
163,659 | static byte[] toBytes(Object object, JSONWriter.Feature... features) {<NEW_LINE>try (JSONWriter writer = new JSONWriterJSONB(new JSONWriter.Context(JSONFactory.defaultObjectWriterProvider, features), null)) {<NEW_LINE>JSONWriter.Context context = writer.context;<NEW_LINE>if (object == null) {<NEW_LINE>writer.writeNull();<NEW_LINE>} else {<NEW_LINE>writer.rootObject = object;<NEW_LINE>if ((context.features & JSONWriter.Feature.ReferenceDetection.mask) != 0) {<NEW_LINE>writer.refs = new IdentityHashMap(8);<NEW_LINE>writer.refs.put(object, writer.path = JSONWriter.Path.ROOT);<NEW_LINE>}<NEW_LINE>boolean fieldBased = (context.features & JSONWriter.Feature.FieldBased.mask) != 0;<NEW_LINE>Class<?> valueClass = object.getClass();<NEW_LINE>ObjectWriter objectWriter = context.provider.<MASK><NEW_LINE>if ((context.features & JSONWriter.Feature.BeanToArray.mask) != 0) {<NEW_LINE>objectWriter.writeArrayMappingJSONB(writer, object, null, null, 0);<NEW_LINE>} else {<NEW_LINE>objectWriter.writeJSONB(writer, object, null, null, 0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return writer.getBytes();<NEW_LINE>}<NEW_LINE>} | getObjectWriter(valueClass, valueClass, fieldBased); |
1,455,292 | public ConfigData deepcopy() {<NEW_LINE>ConfigData data = new ConfigData();<NEW_LINE>data.serverUrl = serverUrl;<NEW_LINE>data.realm = realm;<NEW_LINE>data.truststore = truststore;<NEW_LINE>data.trustpass = trustpass;<NEW_LINE>data.endpoints = new HashMap<>();<NEW_LINE>for (Map.Entry<String, Map<String, RealmConfigData>> item : endpoints.entrySet()) {<NEW_LINE>Map<String, RealmConfigData> nuitems = new HashMap<>();<NEW_LINE>Map<String, RealmConfigData> curitems = item.getValue();<NEW_LINE>if (curitems != null) {<NEW_LINE>for (Map.Entry<String, RealmConfigData> ditem : curitems.entrySet()) {<NEW_LINE>RealmConfigData nudata = ditem.getValue();<NEW_LINE>if (nudata != null) {<NEW_LINE>nuitems.put(ditem.getKey(), nudata.deepcopy());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>data.endpoints.put(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return data;<NEW_LINE>} | item.getKey(), nuitems); |
998,891 | private List<Node> refreshOrder(Entry entry, Collection<Node> oldNodes, Collection<Node> newNodes) {<NEW_LINE>List<Node> toAdd = new LinkedList<Node>();<NEW_LINE>Set<Node> oldNodesSet = new HashSet<Node>(oldNodes);<NEW_LINE>Set<Node> toProcess = new HashSet<Node>(oldNodesSet);<NEW_LINE>Node[] permArray = new Node[oldNodes.size()];<NEW_LINE>Iterator<Node> it2 = newNodes.iterator();<NEW_LINE>int pos = 0;<NEW_LINE>while (it2.hasNext()) {<NEW_LINE>Node n = it2.next();<NEW_LINE>if (oldNodesSet.remove(n)) {<NEW_LINE>// the node is in the old set => test for permuation<NEW_LINE>permArray[pos++] = n;<NEW_LINE>} else {<NEW_LINE>if (!toProcess.contains(n)) {<NEW_LINE>// if the node has not been processed yet<NEW_LINE>toAdd.add(n);<NEW_LINE>} else {<NEW_LINE>it2.remove();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// JST: If you get IllegalArgumentException in following code<NEW_LINE>// then it can be cause by wrong synchronization between<NEW_LINE>// equals and hashCode methods. First of all check them!<NEW_LINE>int[] perm = NodeOp.computePermutation(oldNodes.toArray(new Node[oldNodes.<MASK><NEW_LINE>if (perm != null) {<NEW_LINE>// apply the permutation<NEW_LINE>clearNodes();<NEW_LINE>// temporarily change the nodes the entry should use<NEW_LINE>findInfo(entry).useNodes(Arrays.asList(permArray));<NEW_LINE>Node p = children.parent;<NEW_LINE>if (p != null) {<NEW_LINE>p.fireReorderChange(perm);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return toAdd;<NEW_LINE>} | size()]), permArray); |
1,039,770 | public GetInsightSelectorsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>GetInsightSelectorsResult getInsightSelectorsResult = new GetInsightSelectorsResult();<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 getInsightSelectorsResult;<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("TrailARN", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getInsightSelectorsResult.setTrailARN(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("InsightSelectors", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getInsightSelectorsResult.setInsightSelectors(new ListUnmarshaller<InsightSelector>(InsightSelectorJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return getInsightSelectorsResult;<NEW_LINE>} | class).unmarshall(context)); |
1,088,684 | final DeleteIdentityResult executeDeleteIdentity(DeleteIdentityRequest deleteIdentityRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteIdentityRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteIdentityRequest> request = null;<NEW_LINE>Response<DeleteIdentityResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new DeleteIdentityRequestMarshaller().marshall(super.beforeMarshalling(deleteIdentityRequest));<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, "SES");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteIdentity");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DeleteIdentityResult> responseHandler = new StaxResponseHandler<DeleteIdentityResult>(new DeleteIdentityResultStaxUnmarshaller());<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.RequestMarshallTime); |
36,711 | public View onCreateDemoView(LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {<NEW_LINE>View view = layoutInflater.inflate(R.layout.cat_navigation_rail_fragment, viewGroup, false);<NEW_LINE>initNavigationRail(getContext(), view);<NEW_LINE>initNavigationRailDemoControls(view);<NEW_LINE>OnItemSelectedListener navigationItemListener = item -> {<NEW_LINE>handleAllNavigationRailSelections(item.getItemId());<NEW_LINE>TextView page1Text = view.findViewById(R.id.page_1);<NEW_LINE>TextView page2Text = view.findViewById(R.id.page_2);<NEW_LINE>TextView page3Text = view.findViewById(R.id.page_3);<NEW_LINE>TextView page4Text = view.<MASK><NEW_LINE>TextView page5Text = view.findViewById(R.id.page_5);<NEW_LINE>TextView page6Text = view.findViewById(R.id.page_6);<NEW_LINE>TextView page7Text = view.findViewById(R.id.page_7);<NEW_LINE>int itemId = item.getItemId();<NEW_LINE>page1Text.setVisibility(itemId == R.id.action_page_1 ? View.VISIBLE : View.GONE);<NEW_LINE>page2Text.setVisibility(itemId == R.id.action_page_2 ? View.VISIBLE : View.GONE);<NEW_LINE>page3Text.setVisibility(itemId == R.id.action_page_3 ? View.VISIBLE : View.GONE);<NEW_LINE>page4Text.setVisibility(itemId == R.id.action_page_4 ? View.VISIBLE : View.GONE);<NEW_LINE>page5Text.setVisibility(itemId == R.id.action_page_5 ? View.VISIBLE : View.GONE);<NEW_LINE>page6Text.setVisibility(itemId == R.id.action_page_6 ? View.VISIBLE : View.GONE);<NEW_LINE>page7Text.setVisibility(itemId == R.id.action_page_7 ? View.VISIBLE : View.GONE);<NEW_LINE>clearAndHideBadge(item.getItemId());<NEW_LINE>return false;<NEW_LINE>};<NEW_LINE>setNavigationRailListeners(navigationItemListener);<NEW_LINE>if (bundle == null) {<NEW_LINE>setupBadging();<NEW_LINE>}<NEW_LINE>return view;<NEW_LINE>} | findViewById(R.id.page_4); |
768,660 | <R> void sendRpc(YRpc<R> rpc) {<NEW_LINE>if (!rpc.deadlineTracker.hasDeadline()) {<NEW_LINE>LOG.warn(getPeerUuidLoggingString() + " sending an rpc without a timeout " + rpc);<NEW_LINE>}<NEW_LINE>if (chan != null) {<NEW_LINE><MASK><NEW_LINE>if (serialized == null) {<NEW_LINE>// Error during encoding.<NEW_LINE>// Stop here. RPC has been failed already.<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Volatile read.<NEW_LINE>final Channel chan = this.chan;<NEW_LINE>if (chan != null) {<NEW_LINE>// Double check if we disconnected during encode().<NEW_LINE>Channels.write(chan, serialized);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>boolean tryagain = false;<NEW_LINE>boolean copyOfDead;<NEW_LINE>synchronized (this) {<NEW_LINE>copyOfDead = this.dead;<NEW_LINE>// Check if we got connected while entering this synchronized block.<NEW_LINE>if (chan != null) {<NEW_LINE>tryagain = true;<NEW_LINE>} else if (!copyOfDead) {<NEW_LINE>if (pending_rpcs == null) {<NEW_LINE>pending_rpcs = new ArrayList<YRpc<?>>();<NEW_LINE>}<NEW_LINE>pending_rpcs.add(rpc);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (copyOfDead) {<NEW_LINE>failOrRetryRpc(rpc, new ConnectionResetException(null));<NEW_LINE>return;<NEW_LINE>} else if (tryagain) {<NEW_LINE>// This recursion will not lead to a loop because we only get here if we<NEW_LINE>// connected while entering the synchronized block above. So when trying<NEW_LINE>// a second time, we will either succeed to send the RPC if we're still<NEW_LINE>// connected, or fail through to the code below if we got disconnected<NEW_LINE>// in the mean time.<NEW_LINE>sendRpc(rpc);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} | final ChannelBuffer serialized = encode(rpc); |
1,448,975 | private void buildMoreTryStatementCompletionContext(TypeReference exceptionRef) {<NEW_LINE>if (this.astLengthPtr > 0 && this.astPtr > 2 && this.astStack[this.astPtr - 1] instanceof Block && this.astStack[this.astPtr - 2] instanceof Argument) {<NEW_LINE>TryStatement tryStatement = new TryStatement();<NEW_LINE>int newAstPtr = this.astPtr - 1;<NEW_LINE>int length = this.astLengthStack[this.astLengthPtr - 1];<NEW_LINE>Block[] bks = (tryStatement.catchBlocks = new Block[length + 1]);<NEW_LINE>Argument[] args = (tryStatement.catchArguments = new Argument[length + 1]);<NEW_LINE>if (length != 0) {<NEW_LINE>while (length-- > 0) {<NEW_LINE>bks[length] = (Block) this.astStack[newAstPtr--];<NEW_LINE>// statements of catch block won't be used<NEW_LINE>bks[length].statements = null;<NEW_LINE>args[length] = (Argument) this.astStack[newAstPtr--];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>bks[bks.length - 1] = new Block(0);<NEW_LINE>if (this.astStack[this.astPtr] instanceof UnionTypeReference) {<NEW_LINE>UnionTypeReference unionTypeReference = (UnionTypeReference) this.astStack[this.astPtr];<NEW_LINE>args[args.length - 1] = new Argument(FAKE_ARGUMENT_NAME, 0, unionTypeReference, 0);<NEW_LINE>} else {<NEW_LINE>args[args.length - 1] = new Argument(FAKE_ARGUMENT_NAME, 0, exceptionRef, 0);<NEW_LINE>}<NEW_LINE>tryStatement.tryBlock = (Block) this.astStack[newAstPtr--];<NEW_LINE>this.assistNodeParent = tryStatement;<NEW_LINE>this.currentElement.add(tryStatement, 0);<NEW_LINE>} else if (this.astLengthPtr > -1 && this.astPtr > 0 && this.astStack[this.astPtr - 1] instanceof Block) {<NEW_LINE>TryStatement tryStatement = new TryStatement();<NEW_LINE>int newAstPtr = this.astPtr - 1;<NEW_LINE>Block[] bks = (tryStatement.catchBlocks = new Block[1]);<NEW_LINE>Argument[] args = (tryStatement.<MASK><NEW_LINE>bks[0] = new Block(0);<NEW_LINE>if (this.astStack[this.astPtr] instanceof UnionTypeReference) {<NEW_LINE>UnionTypeReference unionTypeReference = (UnionTypeReference) this.astStack[this.astPtr];<NEW_LINE>args[0] = new Argument(FAKE_ARGUMENT_NAME, 0, unionTypeReference, 0);<NEW_LINE>} else {<NEW_LINE>args[0] = new Argument(FAKE_ARGUMENT_NAME, 0, exceptionRef, 0);<NEW_LINE>}<NEW_LINE>tryStatement.tryBlock = (Block) this.astStack[newAstPtr--];<NEW_LINE>this.assistNodeParent = tryStatement;<NEW_LINE>this.currentElement.add(tryStatement, 0);<NEW_LINE>} else {<NEW_LINE>this.currentElement = this.currentElement.add(exceptionRef, 0);<NEW_LINE>}<NEW_LINE>} | catchArguments = new Argument[1]); |
1,785,243 | private static DiscreteXYPainter createDiscretePainter(DiscreteXYItemDescriptor descriptor, int itemIndex, PointsComputer c) {<NEW_LINE>double dataFactor = descriptor.getDataFactor();<NEW_LINE>float lineWidth = descriptor.getLineWidth();<NEW_LINE>if (lineWidth == ProbeItemDescriptor.DEFAULT_LINE_WIDTH)<NEW_LINE>lineWidth = 2f;<NEW_LINE>Color lineColor = descriptor.getLineColor();<NEW_LINE>if (lineColor == ProbeItemDescriptor.DEFAULT_COLOR)<NEW_LINE>lineColor = TimelineColorFactory.getColor(itemIndex);<NEW_LINE>Color fillColor = descriptor.getFillColor();<NEW_LINE>if (fillColor == ProbeItemDescriptor.DEFAULT_COLOR) {<NEW_LINE>if (lineColor == null)<NEW_LINE><MASK><NEW_LINE>else<NEW_LINE>fillColor = TimelineColorFactory.getGradient(itemIndex)[0];<NEW_LINE>}<NEW_LINE>return new DiscreteXYPainter(lineWidth, lineColor, fillColor, descriptor.getWidth(), descriptor.isFixedWidth(), descriptor.isTopLineOnly(), descriptor.isOutlineOnly(), dataFactor, c);<NEW_LINE>} | fillColor = TimelineColorFactory.getColor(itemIndex); |
39,834 | private void doStore(Task parentTask, GetResponse response, CreateModelFromSetRequest request, ActionListener<CreateModelFromSetResponse> listener) {<NEW_LINE>if (!response.isExists()) {<NEW_LINE>throw new IllegalArgumentException("Stored feature set [" + request.getFeatureSetName() + "] does not exist");<NEW_LINE>}<NEW_LINE>if (request.getExpectedSetVersion() != null && request.getExpectedSetVersion() != response.getVersion()) {<NEW_LINE>throw new IllegalArgumentException("Stored feature set [" + request.getFeatureSetName() + "]" + " has version [" + response.getVersion() + "] but [" + request.getExpectedSetVersion() + "] was expected.");<NEW_LINE>}<NEW_LINE>final StoredFeatureSet set;<NEW_LINE>try {<NEW_LINE>set = IndexFeatureStore.parse(StoredFeatureSet.class, StoredFeatureSet.TYPE, response.getSourceAsBytesRef());<NEW_LINE>} catch (IOException ioe) {<NEW_LINE>throw new IllegalStateException("Cannot parse stored feature set [" + request.getFeatureSetName() + "]", ioe);<NEW_LINE>}<NEW_LINE>// Model will be parsed & checked by TransportFeatureStoreAction<NEW_LINE>StoredLtrModel model = new StoredLtrModel(request.getModelName(), set, request.getDefinition());<NEW_LINE>FeatureStoreRequest featureStoreRequest = new FeatureStoreRequest(request.getStore(), <MASK><NEW_LINE>featureStoreRequest.setRouting(request.getRouting());<NEW_LINE>featureStoreRequest.setParentTask(clusterService.localNode().getId(), parentTask.getId());<NEW_LINE>featureStoreRequest.setValidation(request.getValidation());<NEW_LINE>featureStoreAction.execute(featureStoreRequest, ActionListener.wrap((r) -> listener.onResponse(new CreateModelFromSetResponse(r.getResponse())), listener::onFailure));<NEW_LINE>} | model, FeatureStoreRequest.Action.CREATE); |
1,754,200 | public double continueToMargin(double[] origin, double[] delta) {<NEW_LINE>assert (delta.length == 2 && origin.length == 2);<NEW_LINE>double factor = Double.POSITIVE_INFINITY;<NEW_LINE>if (delta[0] > 0) {<NEW_LINE>factor = Math.min(factor, (maxx - origin[0]) / delta[0]);<NEW_LINE>} else if (delta[0] < 0) {<NEW_LINE>factor = Math.min(factor, (origin[0] - minx) / -delta[0]);<NEW_LINE>}<NEW_LINE>if (delta[1] > 0) {<NEW_LINE>factor = Math.min(factor, (maxy - origin[1<MASK><NEW_LINE>} else if (delta[1] < 0) {<NEW_LINE>factor = Math.min(factor, (origin[1] - miny) / -delta[1]);<NEW_LINE>}<NEW_LINE>return factor;<NEW_LINE>} | ]) / delta[1]); |
180,075 | public void initBackfillMeta(ExecutionContext ec, long backfillId, String schemaName, String tableName, String indexName, List<BackfillObjectRecord> positionMarks) {<NEW_LINE>final List<BackfillObjectRecord> backfillObjectRecords = positionMarks.stream().map(bfo -> new BackfillObjectRecord(-1, backfillId, schemaName, tableName, schemaName, indexName, bfo.physicalDb, bfo.physicalTable, bfo.columnIndex, bfo.parameterMethod, bfo.lastValue, bfo.maxValue, BackfillStatus.INIT.getValue(), "", bfo.successRowCount, new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime()), new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime()), bfo.extra)).<MASK><NEW_LINE>final BackfillObjectRecord bfo = backfillObjectRecords.get(0);<NEW_LINE>final BackfillObjectRecord logicalBfo = bfo.copy();<NEW_LINE>logicalBfo.setPhysicalDb(null);<NEW_LINE>logicalBfo.setPhysicalTable(null);<NEW_LINE>backfillObjectRecords.add(0, logicalBfo);<NEW_LINE>insertBackfillMeta(ec, backfillObjectRecords, true);<NEW_LINE>} | collect(Collectors.toList()); |
523,167 | protected void run() {<NEW_LINE>try {<NEW_LINE>runInterceptHook();<NEW_LINE>var preparedDelayedPayoutTx = processModel.getPreparedDelayedPayoutTx();<NEW_LINE>TradeDataValidation.validateDelayedPayoutTx(trade, preparedDelayedPayoutTx, processModel.getDaoFacade(), processModel.getBtcWalletService());<NEW_LINE>// If the deposit tx is non-malleable, we already know its final ID, so should check that now<NEW_LINE>// before sending any further data to the seller, to provide extra protection for the buyer.<NEW_LINE>if (isDepositTxNonMalleable()) {<NEW_LINE>var preparedDepositTx = processModel.getBtcWalletService().getTxFromSerializedTx(processModel.getPreparedDepositTx());<NEW_LINE>TradeDataValidation.validatePayoutTxInput(preparedDepositTx, checkNotNull(preparedDelayedPayoutTx));<NEW_LINE>} else {<NEW_LINE>log.info("Deposit tx is malleable, so we skip preparedDelayedPayoutTx input validation.");<NEW_LINE>}<NEW_LINE>complete();<NEW_LINE>} catch (TradeDataValidation.ValidationException e) {<NEW_LINE><MASK><NEW_LINE>} catch (Throwable t) {<NEW_LINE>failed(t);<NEW_LINE>}<NEW_LINE>} | failed(e.getMessage()); |
480,883 | protected Password unlockEntry(String alias, KeyStoreState state) {<NEW_LINE>try {<NEW_LINE>KeyStore keyStore = state.getKeyStore();<NEW_LINE>DGetPassword dGetPassword = new DGetPassword(frame, MessageFormat.format(res.getString("KeyStoreExplorerAction.UnlockEntry.Title"), alias));<NEW_LINE>dGetPassword.setLocationRelativeTo(frame);<NEW_LINE>dGetPassword.setVisible(true);<NEW_LINE>Password password = dGetPassword.getPassword();<NEW_LINE>if (password == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// Test password is correct<NEW_LINE>keyStore.getKey(alias, password.toCharArray());<NEW_LINE>state.setEntryPassword(alias, password);<NEW_LINE>kseFrame.updateControls(true);<NEW_LINE>return password;<NEW_LINE>} catch (GeneralSecurityException ex) {<NEW_LINE>String problemStr = MessageFormat.format(res.getString("KeyStoreExplorerAction.NoUnlockEntry.Problem"), alias);<NEW_LINE>String[] causes = new String[] { res.getString("KeyStoreExplorerAction.PasswordIncorrectEntry.Cause") };<NEW_LINE>Problem problem = new Problem(problemStr, causes, ex);<NEW_LINE>DProblem dProblem = new DProblem(frame, res<MASK><NEW_LINE>dProblem.setLocationRelativeTo(frame);<NEW_LINE>dProblem.setVisible(true);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | .getString("KeyStoreExplorerAction.ProblemUnlockingEntry.Title"), problem); |
1,680,817 | public void marshall(ThingDocument thingDocument, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (thingDocument == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(thingDocument.getThingName(), THINGNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(thingDocument.getThingId(), THINGID_BINDING);<NEW_LINE>protocolMarshaller.marshall(thingDocument.getThingTypeName(), THINGTYPENAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(thingDocument.getThingGroupNames(), THINGGROUPNAMES_BINDING);<NEW_LINE>protocolMarshaller.marshall(thingDocument.getAttributes(), ATTRIBUTES_BINDING);<NEW_LINE>protocolMarshaller.marshall(thingDocument.getShadow(), SHADOW_BINDING);<NEW_LINE>protocolMarshaller.marshall(thingDocument.getDeviceDefender(), DEVICEDEFENDER_BINDING);<NEW_LINE>protocolMarshaller.marshall(thingDocument.getConnectivity(), CONNECTIVITY_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + <MASK><NEW_LINE>}<NEW_LINE>} | e.getMessage(), e); |
46,803 | private void renderRecordingIndicator(MatrixStack stack) {<NEW_LINE>if (guiControls.isStopped())<NEW_LINE>return;<NEW_LINE>if (settingsRegistry.get(Setting.INDICATOR)) {<NEW_LINE>TextRenderer fontRenderer = mc.textRenderer;<NEW_LINE>String text = guiControls.isPaused() ? I18n.translate("replaymod.gui.paused"<MASK><NEW_LINE>MinecraftGuiRenderer renderer = new MinecraftGuiRenderer(stack);<NEW_LINE>renderer.drawString(30, 18 - (fontRenderer.fontHeight / 2), 0xffffffff, text.toUpperCase());<NEW_LINE>renderer.bindTexture(TEXTURE);<NEW_LINE>// #if MC<11700<NEW_LINE>enableAlphaTest();<NEW_LINE>// #endif<NEW_LINE>renderer.drawTexturedRect(10, 10, 58, 20, 16, 16, 16, 16, TEXTURE_SIZE, TEXTURE_SIZE);<NEW_LINE>}<NEW_LINE>} | ) : I18n.translate("replaymod.gui.recording"); |
984,298 | public Operand buildPatternCase(PatternCaseNode patternCase) {<NEW_LINE>Variable result = temp();<NEW_LINE>Operand value = build(patternCase.getCaseNode());<NEW_LINE>label(end -> {<NEW_LINE>List<Label> labels = new ArrayList<>();<NEW_LINE>Map<Label, Node> <MASK><NEW_LINE>// build each "when"<NEW_LINE>Variable deconstructed = copy(buildNil());<NEW_LINE>for (Node aCase : patternCase.getCases().children()) {<NEW_LINE>InNode inNode = (InNode) aCase;<NEW_LINE>Label bodyLabel = getNewLabel();<NEW_LINE>Variable eqqResult = copy(tru());<NEW_LINE>labels.add(bodyLabel);<NEW_LINE>buildPatternMatch(eqqResult, deconstructed, inNode.getExpression(), value, false);<NEW_LINE>addInstr(createBranch(eqqResult, tru(), bodyLabel));<NEW_LINE>bodies.put(bodyLabel, inNode.getBody());<NEW_LINE>}<NEW_LINE>Label elseLabel = getNewLabel();<NEW_LINE>// Jump to else in case nothing matches!<NEW_LINE>addInstr(new JumpInstr(elseLabel));<NEW_LINE>boolean hasElse = patternCase.getElseNode() != null;<NEW_LINE>// Build "else" if it exists<NEW_LINE>if (hasElse) {<NEW_LINE>labels.add(elseLabel);<NEW_LINE>bodies.put(elseLabel, patternCase.getElseNode());<NEW_LINE>}<NEW_LINE>// Now, emit bodies while preserving when clauses order<NEW_LINE>for (Label label : labels) {<NEW_LINE>addInstr(new LabelInstr(label));<NEW_LINE>Operand bodyValue = build(bodies.get(label));<NEW_LINE>if (bodyValue != null)<NEW_LINE>copy(result, bodyValue);<NEW_LINE>jump(end);<NEW_LINE>}<NEW_LINE>if (!hasElse) {<NEW_LINE>addInstr(new LabelInstr(elseLabel));<NEW_LINE>Variable inspect = call(temp(), value, "inspect");<NEW_LINE>addRaiseError("NoMatchingPatternError", inspect);<NEW_LINE>jump(end);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return result;<NEW_LINE>} | bodies = new HashMap<>(); |
465,309 | private static String stripGarbage(String contents) {<NEW_LINE>String working = contents;<NEW_LINE>working = removeMultiLineGarbage(working, PRAGMA);<NEW_LINE>// Windows<NEW_LINE>working = working.replaceAll("_+cdecl", "");<NEW_LINE>working = working.replaceAll("_+stdcall", "");<NEW_LINE>working = DECLSPEC.matcher(working).replaceAll("");<NEW_LINE>working = ASM.matcher(working).replaceAll("");<NEW_LINE>working = TRAILING_BACKSLASH.matcher(working).replaceAll("");<NEW_LINE>working = working.replaceAll("__forceinline", "");<NEW_LINE>working = working.replaceAll("\u000c", "");<NEW_LINE>working = working.replaceAll("WINAPI", "");<NEW_LINE>// gcc<NEW_LINE>working = working.replaceAll("__restrict", "");<NEW_LINE>working = working.replaceAll("__const", "");<NEW_LINE>working = working.replaceAll("__attribute__\\s*[(]{2}.*[)]{2}", "");<NEW_LINE>working = working.replaceAll("__asm__[^;]+", "");<NEW_LINE>working = ATTRIBUTE.matcher(working).replaceAll("");<NEW_LINE>working = <MASK><NEW_LINE>working = working.replaceAll("__extension__", "");<NEW_LINE>working = ASM2.matcher(working).replaceAll("");<NEW_LINE>return working;<NEW_LINE>} | working.replaceAll("(<?=\\s)_+inline", ""); |
521,668 | static NestedSet<?> expandSet(CompletionContext ctx, NestedSet<?> artifacts) {<NEW_LINE>NestedSetBuilder<Object> res = new NestedSetBuilder<>(Order.STABLE_ORDER);<NEW_LINE>for (Object artifact : artifacts.getLeaves()) {<NEW_LINE>if (artifact instanceof ExpandedArtifact) {<NEW_LINE>res.add(artifact);<NEW_LINE>} else if (artifact instanceof Artifact) {<NEW_LINE>ctx.visitArtifacts(ImmutableList.of((Artifact) artifact), new ArtifactReceiver() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void accept(Artifact artifact) {<NEW_LINE>res.add(new ExpandedArtifact(artifact, null, null));<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void acceptFilesetMapping(Artifact fileset, PathFragment relName, Path targetFile) {<NEW_LINE>res.add(new ExpandedArtifact(fileset, relName, targetFile));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} else {<NEW_LINE>throw new IllegalStateException("Unexpected type in artifact set: " + artifact);<NEW_LINE>}<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>ImmutableList<? extends NestedSet<?>> nonLeaves = artifacts.getNonLeaves();<NEW_LINE>for (NestedSet<?> succ : nonLeaves) {<NEW_LINE>res.addTransitive(succ);<NEW_LINE>}<NEW_LINE>NestedSet<?> result = res.build();<NEW_LINE>// If we have executed one call to res.addTransitive(x)<NEW_LINE>// and none to res.add, then res.build() simply returns x<NEW_LINE>// ("inlining"), which may violate our postcondition on elements.<NEW_LINE>// (This can happen if 'artifacts' contains one non-leaf successor<NEW_LINE>// and one or more leaf successors for which visitArtifacts is a no-op.)<NEW_LINE>//<NEW_LINE>// In that case we need to recursively apply the expansion. Ugh.<NEW_LINE>if (noDirects && nonLeaves.size() == 1) {<NEW_LINE>return expandSet(ctx, result);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | boolean noDirects = res.isEmpty(); |
1,649,568 | private boolean constReturn(int type, int value, int nextOpcode, int iter) {<NEW_LINE>if (nextOpcode == type) {<NEW_LINE>instructions.remove(iter);<NEW_LINE>instructions.remove(iter);<NEW_LINE>if (synchronizedMethod && instructions.size() > 0) {<NEW_LINE>if (staticMethod) {<NEW_LINE>instructions.add(iter, new CustomIntruction(" monitorExit(threadStateData, (JAVA_OBJECT)&class__" + clsName + ");\n" + " return " + value + ";\n", " monitorExit(threadStateData, (JAVA_OBJECT)&class__" + clsName + ");\n" + " RETURN_AND_RELEASE_FROM_METHOD(" + value + ", " + maxLocals + ");\n", dependentClasses));<NEW_LINE>} else {<NEW_LINE>instructions.add(iter, new CustomIntruction(" monitorExit(threadStateData, __cn1ThisObject);\n" + " return " + value + ";\n", " monitorExit(threadStateData, __cn1ThisObject);\n" + " RETURN_AND_RELEASE_FROM_METHOD(" + value + ", " + maxLocals + ");\n", dependentClasses));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>instructions.add(iter, new CustomIntruction(" return " + value + ";\n", " RETURN_AND_RELEASE_FROM_METHOD(" + value + ", " <MASK><NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | + maxLocals + ");\n", dependentClasses)); |
694,639 | private // name of parent file<NEW_LINE>String createErrorMsg(JspLineId jspLineId, int errorLineNr) {<NEW_LINE>StringBuffer compilerOutput = new StringBuffer();<NEW_LINE>if (jspLineId.getSourceLineCount() <= 1) {<NEW_LINE>Object[] objArray = new Object[] { new Integer(jspLineId.getStartSourceLineNum()), jspLineId.getFilePath() };<NEW_LINE>if (jspLineId.getFilePath().equals(jspLineId.getParentFile())) {<NEW_LINE>// Defect 211450<NEW_LINE>compilerOutput.append(separatorString + JspCoreException.getMsg("jsp.error.single.line.number", objArray));<NEW_LINE>} else {<NEW_LINE>// Defect 211450<NEW_LINE>compilerOutput.append(separatorString + JspCoreException.getMsg("jsp.error.single.line.number.included.file", objArray));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// compute exact JSP line number<NEW_LINE>int actualLineNum = jspLineId.getStartSourceLineNum() + (errorLineNr - jspLineId.getStartGeneratedLineNum());<NEW_LINE>if (actualLineNum >= jspLineId.getStartSourceLineNum() && actualLineNum <= (jspLineId.getStartSourceLineNum() + jspLineId.getSourceLineCount() - 1)) {<NEW_LINE>Object[] objArray = new Object[] { new Integer(actualLineNum), jspLineId.getFilePath() };<NEW_LINE>if (jspLineId.getFilePath().equals(jspLineId.getParentFile())) {<NEW_LINE>// Defect 211450<NEW_LINE>compilerOutput.append(separatorString + JspCoreException<MASK><NEW_LINE>} else {<NEW_LINE>// Defect 211450<NEW_LINE>compilerOutput.append(separatorString + JspCoreException.getMsg("jsp.error.single.line.number.included.file", objArray));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Object[] objArray = new Object[] { new Integer(jspLineId.getStartSourceLineNum()), new Integer((jspLineId.getStartSourceLineNum()) + jspLineId.getSourceLineCount() - 1), jspLineId.getFilePath() };<NEW_LINE>if (jspLineId.getFilePath().equals(jspLineId.getParentFile())) {<NEW_LINE>// Defect 211450<NEW_LINE>compilerOutput.// Defect 211450<NEW_LINE>append(separatorString + JspCoreException.getMsg("jsp.error.multiple.line.number", objArray));<NEW_LINE>} else {<NEW_LINE>// Defect 211450<NEW_LINE>compilerOutput.// Defect 211450<NEW_LINE>append(separatorString + JspCoreException.getMsg("jsp.error.multiple.line.number.included.file", objArray));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Defect 211450<NEW_LINE>compilerOutput.append(separatorString + JspCoreException.getMsg("jsp.error.corresponding.servlet", new Object[] { jspLineId.getParentFile() }));<NEW_LINE>// 152470 starts<NEW_LINE>if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINER)) {<NEW_LINE>logger.logp(Level.FINER, CLASS_NAME, "createErrorMsg", "The value of the JSP attribute jdkSourceLevel is [" + jdkSourceLevel + "]");<NEW_LINE>}<NEW_LINE>// 152470 ends<NEW_LINE>return compilerOutput.toString();<NEW_LINE>} | .getMsg("jsp.error.single.line.number", objArray)); |
325,664 | public void doFrame(long frameTimeNanos) {<NEW_LINE>postFrameCallback();<NEW_LINE>if (composition == null || !isRunning()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>L.beginSection("LottieValueAnimator#doFrame");<NEW_LINE>long timeSinceFrame = lastFrameTimeNs == 0 ? 0 : frameTimeNanos - lastFrameTimeNs;<NEW_LINE>float frameDuration = getFrameDurationNs();<NEW_LINE>float dFrames = timeSinceFrame / frameDuration;<NEW_LINE>frame += isReversed() ? -dFrames : dFrames;<NEW_LINE>boolean ended = !MiscUtils.contains(frame, getMinFrame(), getMaxFrame());<NEW_LINE>frame = MiscUtils.clamp(frame, getMinFrame(), getMaxFrame());<NEW_LINE>lastFrameTimeNs = frameTimeNanos;<NEW_LINE>notifyUpdate();<NEW_LINE>if (ended) {<NEW_LINE>if (getRepeatCount() != INFINITE && repeatCount >= getRepeatCount()) {<NEW_LINE>frame = speed < 0 <MASK><NEW_LINE>removeFrameCallback();<NEW_LINE>notifyEnd(isReversed());<NEW_LINE>} else {<NEW_LINE>notifyRepeat();<NEW_LINE>repeatCount++;<NEW_LINE>if (getRepeatMode() == REVERSE) {<NEW_LINE>speedReversedForRepeatMode = !speedReversedForRepeatMode;<NEW_LINE>reverseAnimationSpeed();<NEW_LINE>} else {<NEW_LINE>frame = isReversed() ? getMaxFrame() : getMinFrame();<NEW_LINE>}<NEW_LINE>lastFrameTimeNs = frameTimeNanos;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>verifyFrame();<NEW_LINE>L.endSection("LottieValueAnimator#doFrame");<NEW_LINE>} | ? getMinFrame() : getMaxFrame(); |
1,022,088 | public Page<CommunityRest> findAllTop(Pageable pageable) {<NEW_LINE>try {<NEW_LINE>Context context = obtainContext();<NEW_LINE>List<Community> topLevelCommunities = new LinkedList<Community>();<NEW_LINE>DiscoverQuery discoverQuery = new DiscoverQuery();<NEW_LINE>discoverQuery.setQuery("*:*");<NEW_LINE>discoverQuery.setDSpaceObjectFilter(IndexableCommunity.TYPE);<NEW_LINE>discoverQuery.addFilterQueries("-location.parent:*");<NEW_LINE>discoverQuery.setStart(Math.toIntExact(pageable.getOffset()));<NEW_LINE>discoverQuery.setSortField("dc.title_sort", DiscoverQuery.SORT_ORDER.asc);<NEW_LINE>discoverQuery.setMaxResults(pageable.getPageSize());<NEW_LINE>DiscoverResult resp = searchService.search(context, discoverQuery);<NEW_LINE>long tot = resp.getTotalSearchResults();<NEW_LINE>for (IndexableObject solrCommunities : resp.getIndexableObjects()) {<NEW_LINE>Community c = ((IndexableCommunity) solrCommunities).getIndexedObject();<NEW_LINE>topLevelCommunities.add(c);<NEW_LINE>}<NEW_LINE>return converter.toRestPage(topLevelCommunities, pageable, tot, utils.obtainProjection());<NEW_LINE>} catch (SearchServiceException e) {<NEW_LINE>throw new RuntimeException(<MASK><NEW_LINE>}<NEW_LINE>} | e.getMessage(), e); |
654,711 | public static ListDataStatisticsResponse unmarshall(ListDataStatisticsResponse listDataStatisticsResponse, UnmarshallerContext _ctx) {<NEW_LINE>listDataStatisticsResponse.setRequestId(_ctx.stringValue("ListDataStatisticsResponse.RequestId"));<NEW_LINE>listDataStatisticsResponse.setCode(_ctx.stringValue("ListDataStatisticsResponse.Code"));<NEW_LINE>listDataStatisticsResponse.setMessage<MASK><NEW_LINE>listDataStatisticsResponse.setPageNumber(_ctx.longValue("ListDataStatisticsResponse.PageNumber"));<NEW_LINE>listDataStatisticsResponse.setPageSize(_ctx.longValue("ListDataStatisticsResponse.PageSize"));<NEW_LINE>listDataStatisticsResponse.setTotalCount(_ctx.longValue("ListDataStatisticsResponse.TotalCount"));<NEW_LINE>List<Datas> data = new ArrayList<Datas>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListDataStatisticsResponse.Data.Length"); i++) {<NEW_LINE>Datas datas = new Datas();<NEW_LINE>datas.setCorpId(_ctx.stringValue("ListDataStatisticsResponse.Data[" + i + "].CorpId"));<NEW_LINE>datas.setNumber(_ctx.stringValue("ListDataStatisticsResponse.Data[" + i + "].Number"));<NEW_LINE>data.add(datas);<NEW_LINE>}<NEW_LINE>listDataStatisticsResponse.setData(data);<NEW_LINE>return listDataStatisticsResponse;<NEW_LINE>} | (_ctx.stringValue("ListDataStatisticsResponse.Message")); |
1,070,242 | private static String localesToResourceQualifier(List<Locale> locs) {<NEW_LINE>final StringBuilder sb = new StringBuilder();<NEW_LINE>for (int i = 0; i < locs.size(); i++) {<NEW_LINE>final Locale loc = locs.get(i);<NEW_LINE>final int l = loc.getLanguage().length();<NEW_LINE>if (l == 0) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>final int s = loc.getScript().length();<NEW_LINE>final int c = loc.getCountry().length();<NEW_LINE>final int v = loc.getVariant().length();<NEW_LINE>// We ignore locale extensions, since they are not supported by AAPT<NEW_LINE>if (sb.length() != 0) {<NEW_LINE>sb.append(",");<NEW_LINE>}<NEW_LINE>if (l == 2 && s == 0 && (c == 0 || c == 2) && v == 0) {<NEW_LINE>// Traditional locale format: xx or xx-rYY<NEW_LINE>sb.append(loc.getLanguage());<NEW_LINE>if (c == 2) {<NEW_LINE>sb.append("-r").append(loc.getCountry());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>sb.append("b+");<NEW_LINE>sb.append(loc.getLanguage());<NEW_LINE>if (s != 0) {<NEW_LINE>sb.append("+");<NEW_LINE>sb.append(loc.getScript());<NEW_LINE>}<NEW_LINE>if (c != 0) {<NEW_LINE>sb.append("+");<NEW_LINE>sb.<MASK><NEW_LINE>}<NEW_LINE>if (v != 0) {<NEW_LINE>sb.append("+");<NEW_LINE>sb.append(loc.getVariant());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return sb.toString();<NEW_LINE>} | append(loc.getCountry()); |
127,183 | public UserNotification save(@NonNull final UserNotificationRequest request) {<NEW_LINE>final I_AD_Note notificationPO = InterfaceWrapperHelper.newInstanceOutOfTrx(I_AD_Note.class);<NEW_LINE>notificationPO.setAD_User_ID(request.getRecipient().getUserId().getRepoId());<NEW_LINE>notificationPO.setIsImportant(request.isImportant());<NEW_LINE>//<NEW_LINE>// contentADMessage -> AD_Message<NEW_LINE>AdMessageId adMessageId = null;<NEW_LINE>final AdMessageKey detailADMessage = request.getContentADMessage();<NEW_LINE>if (detailADMessage != null) {<NEW_LINE>adMessageId = Services.get(IADMessageDAO.class).retrieveIdByValue(detailADMessage).orElse(null);<NEW_LINE>}<NEW_LINE>if (adMessageId == null) {<NEW_LINE>adMessageId = Services.get(IADMessageDAO.class).retrieveIdByValue(DEFAULT_AD_MESSAGE).orElse(null);<NEW_LINE>}<NEW_LINE>notificationPO.setAD_Message_ID(AdMessageId.toRepoId(adMessageId));<NEW_LINE>//<NEW_LINE>// contentADMessageParams<NEW_LINE>final List<Object> detailADMessageParams = request.getContentADMessageParams();<NEW_LINE>if (detailADMessageParams != null && !detailADMessageParams.isEmpty()) {<NEW_LINE>try {<NEW_LINE>final String <MASK><NEW_LINE>notificationPO.setAD_Message_ParamsJSON(detailADMessageParamsJSON);<NEW_LINE>} catch (final JsonProcessingException e) {<NEW_LINE>throw new AdempiereException("Unable to create JSON from the given request's contentADMessageParams", e).appendParametersToMessage().setParameter("detailADMessageParams", detailADMessageParams).setParameter("request", request);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// contentPlain<NEW_LINE>final String detailPlain = request.getContentPlain();<NEW_LINE>notificationPO.setTextMsg(detailPlain);<NEW_LINE>//<NEW_LINE>// Target action<NEW_LINE>final TargetAction targetAction = request.getTargetAction();<NEW_LINE>if (targetAction == null) {<NEW_LINE>// no action<NEW_LINE>} else if (targetAction instanceof TargetRecordAction) {<NEW_LINE>final TargetRecordAction targetRecordAction = TargetRecordAction.cast(targetAction);<NEW_LINE>final ITableRecordReference targetRecord = targetRecordAction.getRecord();<NEW_LINE>notificationPO.setAD_Table_ID(targetRecord.getAD_Table_ID());<NEW_LINE>notificationPO.setRecord_ID(targetRecord.getRecord_ID());<NEW_LINE>notificationPO.setAD_Window_ID(targetRecordAction.getAdWindowId().map(AdWindowId::getRepoId).orElse(-1));<NEW_LINE>} else if (targetAction instanceof TargetViewAction) {<NEW_LINE>final TargetViewAction targetViewAction = TargetViewAction.cast(targetAction);<NEW_LINE>notificationPO.setViewId(targetViewAction.getViewId());<NEW_LINE>notificationPO.setAD_Window_ID(AdWindowId.toRepoId(targetViewAction.getAdWindowId()));<NEW_LINE>} else {<NEW_LINE>throw new AdempiereException("Unknown target action: " + targetAction + " (" + targetAction.getClass() + ")");<NEW_LINE>}<NEW_LINE>//<NEW_LINE>InterfaceWrapperHelper.save(notificationPO);<NEW_LINE>final List<Resource> attachments = request.getAttachments();<NEW_LINE>if (!attachments.isEmpty()) {<NEW_LINE>attachmentEntryService.createNewAttachments(notificationPO, AttachmentEntryCreateRequest.fromResources(attachments));<NEW_LINE>}<NEW_LINE>return toUserNotification(notificationPO);<NEW_LINE>} | detailADMessageParamsJSON = jsonMapper.writeValueAsString(detailADMessageParams); |
1,777,831 | public CollectNFResult collectFromOperation(FieldCollectorNormalizedQueryParams parameters, OperationDefinition operationDefinition, GraphQLObjectType rootType) {<NEW_LINE>Set<GraphQLObjectType> possibleObjects = ImmutableSet.of(rootType);<NEW_LINE>List<CollectedField> collectedFields = new ArrayList<>();<NEW_LINE>collectFromSelectionSet(parameters, operationDefinition.getSelectionSet(), collectedFields, rootType, possibleObjects);<NEW_LINE>// group by result key<NEW_LINE>Map<String, List<CollectedField>> fieldsByName = fieldsByResultKey(collectedFields);<NEW_LINE>ImmutableList.Builder<ExecutableNormalizedField> resultNFs = ImmutableList.builder();<NEW_LINE>ImmutableListMultimap.Builder<ExecutableNormalizedField, FieldAndAstParent<MASK><NEW_LINE>createNFs(resultNFs, parameters, fieldsByName, normalizedFieldToAstFields, 1, null);<NEW_LINE>return new CollectNFResult(resultNFs.build(), normalizedFieldToAstFields.build());<NEW_LINE>} | > normalizedFieldToAstFields = ImmutableListMultimap.builder(); |
675,720 | public AttachSecurityProfileResult attachSecurityProfile(AttachSecurityProfileRequest attachSecurityProfileRequest) throws AmazonServiceException, AmazonClientException {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(attachSecurityProfileRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<AttachSecurityProfileRequest> request = null;<NEW_LINE>Response<AttachSecurityProfileResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new AttachSecurityProfileRequestMarshaller().marshall(attachSecurityProfileRequest);<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>Unmarshaller<AttachSecurityProfileResult, JsonUnmarshallerContext> unmarshaller = new AttachSecurityProfileResultJsonUnmarshaller();<NEW_LINE>JsonResponseHandler<AttachSecurityProfileResult> responseHandler = <MASK><NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.ClientExecuteTime);<NEW_LINE>endClientExecution(awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC);<NEW_LINE>}<NEW_LINE>} | new JsonResponseHandler<AttachSecurityProfileResult>(unmarshaller); |
696,875 | public ScriptFailedResolution onScriptFailed(final IScript script, final ScriptExecutionException e) {<NEW_LINE>final File file = script.getLocalFile();<NEW_LINE>// printStackTrace=false<NEW_LINE>final String <MASK><NEW_LINE>final String message = "<html><body>" + "Script failed to run. Shall we add it to ignore list?<br/><br/>" + "<pre>" + StringEscapeUtils.escapeHtml(exceptionMessage) + "</pre>" + "<br/>" + "Script File: <a href=\"" + file.toURI() + "\">" + StringEscapeUtils.escapeHtml(file.toString()) + "</a><br/>" + "</body></html>";<NEW_LINE>final ScriptFailedResolution response = uiAsk("Add script to ignore list?", message, ScriptFailedResolution.values(), ScriptFailedResolution.Fail);<NEW_LINE>if (response == ScriptFailedResolution.Fail) {<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>return response;<NEW_LINE>} | exceptionMessage = e.toStringX(false); |
642,888 | public EncryptionSetting unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>EncryptionSetting encryptionSetting = new EncryptionSetting();<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("kmsKeyArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>encryptionSetting.setKmsKeyArn(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("botLocaleExportPassword", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>encryptionSetting.setBotLocaleExportPassword(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("associatedTranscriptsPassword", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>encryptionSetting.setAssociatedTranscriptsPassword(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return encryptionSetting;<NEW_LINE>} | class).unmarshall(context)); |
1,248,955 | public void doIt(String regex, int eCount, int[] eCodes, int cCount, String[] c) {<NEW_LINE>if (incExc == ((!overlap(exc, eCount, eCodes)) && subset(sub, eCount, eCodes)))<NEW_LINE>try {<NEW_LINE>out.write("/*\n");<NEW_LINE>for (int j = 0; j < cCount; j++) {<NEW_LINE>out.write(c[j]);<NEW_LINE>out.write('\n');<NEW_LINE>}<NEW_LINE>out.write("*/\n");<NEW_LINE>out.write(regex);<NEW_LINE>out.write(" {\n");<NEW_LINE>count++;<NEW_LINE>out.write("rule(" + count + "); ");<NEW_LINE>for (int i = 0; i < eCount; i++) out.write("error(" + errorCodeName(<MASK><NEW_LINE>out.write("}\n");<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>} | eCodes[i]) + ");"); |
1,112,370 | public void errorHandlerEvent(RetrofitError error) {<NEW_LINE>String errorType;<NEW_LINE>String errorDesc;<NEW_LINE>ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);<NEW_LINE>NetworkInfo netinfo = connMgr != null ? connMgr.getActiveNetworkInfo() : null;<NEW_LINE>if (!(netinfo != null && netinfo.isConnected())) {<NEW_LINE>StrategyRegistry.getInstance().getEventBusStrategy()<MASK><NEW_LINE>} else {<NEW_LINE>if (error.getThrowable() instanceof IOException) {<NEW_LINE>errorType = "Timeout";<NEW_LINE>errorDesc = String.valueOf(error.getThrowable().getCause());<NEW_LINE>} else if (error.getThrowable() instanceof IllegalStateException) {<NEW_LINE>errorType = "ConversionError";<NEW_LINE>errorDesc = String.valueOf(error.getThrowable().getCause());<NEW_LINE>} else {<NEW_LINE>errorType = "Other Error";<NEW_LINE>errorDesc = String.valueOf(error.getThrowable().getLocalizedMessage());<NEW_LINE>}<NEW_LINE>Timber.tag(errorType).e(errorDesc);<NEW_LINE>showErrorSnackbar(errorType, errorDesc);<NEW_LINE>}<NEW_LINE>} | .postEventOnUIThread(new ShowNetworkDialogEvent()); |
292,942 | public static List<Person> readXMLCharacterList(Document doc) {<NEW_LINE>List<Person> personList = new ArrayList<>();<NEW_LINE>NodeList characters = doc.getDocumentElement().getElementsByTagName("characters").item(0).getChildNodes();<NEW_LINE>for (int i = 0; i < characters.getLength(); i++) {<NEW_LINE>Node child = characters.item(i);<NEW_LINE>if (child.getNodeName().equals("character")) {<NEW_LINE>String name = child.getAttributes().getNamedItem("name").getNodeValue();<NEW_LINE>char[] cName = name.toCharArray();<NEW_LINE>cName[0] = Character.toUpperCase(cName[0]);<NEW_LINE>name = new String(cName);<NEW_LINE>List<String> aliases = Arrays.asList(child.getAttributes().getNamedItem("aliases").getNodeValue().split(";"));<NEW_LINE>String gender = (child.getAttributes().getNamedItem("gender") == null) ? "" : child.getAttributes().getNamedItem("gender").getNodeValue();<NEW_LINE>personList.add(new Person(child.getAttributes().getNamedItem("name").getNodeValue<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return personList;<NEW_LINE>} | (), gender, aliases)); |
1,392,811 | public void generateDocumentation(String outputDirectory, Contexts contexts, LabelExpression labelExpression) throws LiquibaseException {<NEW_LINE>runInScope(new Scope.ScopedRunner() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() throws Exception {<NEW_LINE>LOG.info("Generating Database Documentation");<NEW_LINE>changeLogParameters.setContexts(contexts);<NEW_LINE>changeLogParameters.setLabels(labelExpression);<NEW_LINE>LockService lockService = LockServiceFactory.getInstance().getLockService(database);<NEW_LINE>lockService.waitForLock();<NEW_LINE>try {<NEW_LINE>DatabaseChangeLog changeLog = getDatabaseChangeLog();<NEW_LINE>checkLiquibaseTables(false, changeLog, new Contexts(), new LabelExpression());<NEW_LINE>changeLog.validate(database, contexts, labelExpression);<NEW_LINE>ChangeLogIterator logIterator = new ChangeLogIterator(changeLog, new DbmsChangeSetFilter(database));<NEW_LINE>DBDocVisitor visitor = new DBDocVisitor(database);<NEW_LINE>logIterator.run(visitor, new RuntimeEnvironment(database, contexts, labelExpression));<NEW_LINE>visitor.writeHTML(<MASK><NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new LiquibaseException(e);<NEW_LINE>} finally {<NEW_LINE>try {<NEW_LINE>lockService.releaseLock();<NEW_LINE>} catch (LockException e) {<NEW_LINE>LOG.severe(MSG_COULD_NOT_RELEASE_LOCK, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | new File(outputDirectory), resourceAccessor); |
1,257,210 | protected void onPopulateNodeForVirtualView(int virtualViewId, AccessibilityNodeInfoCompat node) {<NEW_LINE>final Spanned spanned = (Spanned) mText;<NEW_LINE>final Rect sTempRect = new Rect();<NEW_LINE>// it can happen as part of an unmount/mount cycle that the accessibility framework will<NEW_LINE>// request the bounds of a virtual view even if it no longer exists.<NEW_LINE>if (mClickableSpans == null || virtualViewId >= mClickableSpans.length) {<NEW_LINE>node.setText("");<NEW_LINE>node.setBoundsInParent(sTempRect);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final ClickableSpan span = mClickableSpans[virtualViewId];<NEW_LINE>final int start = spanned.getSpanStart(span);<NEW_LINE>final int end = spanned.getSpanEnd(span);<NEW_LINE>final int startLine = mLayout.getLineForOffset(start);<NEW_LINE>final int <MASK><NEW_LINE>final Path sTempPath = new Path();<NEW_LINE>final RectF sTempRectF = new RectF();<NEW_LINE>// The bounds for multi-line strings should *only* include the first line. This is because<NEW_LINE>// TalkBack triggers its click at the center point of these bounds, and if that center point<NEW_LINE>// is outside the spannable, it will click on something else. There is no harm in not<NEW_LINE>// outlining<NEW_LINE>// the wrapped part of the string, as the text for the whole string will be read regardless of<NEW_LINE>// the bounding box.<NEW_LINE>final int selectionPathEnd = startLine == endLine ? end : mLayout.getLineVisibleEnd(startLine);<NEW_LINE>mLayout.getSelectionPath(start, selectionPathEnd, sTempPath);<NEW_LINE>sTempPath.computeBounds(sTempRectF, /* unused */<NEW_LINE>true);<NEW_LINE>sTempRectF.round(sTempRect);<NEW_LINE>node.setBoundsInParent(sTempRect);<NEW_LINE>node.setClickable(true);<NEW_LINE>node.setFocusable(true);<NEW_LINE>node.setEnabled(true);<NEW_LINE>node.setVisibleToUser(true);<NEW_LINE>node.setText(spanned.subSequence(start, end));<NEW_LINE>// This is needed to get the swipe action<NEW_LINE>node.setClassName(ACCESSIBILITY_BUTTON_CLASS);<NEW_LINE>} | endLine = mLayout.getLineForOffset(end); |
1,622,118 | private static Certificate selfSign(KeyPair keyPair, String subjectDN) throws Exception {<NEW_LINE>Provider bcProvider = new BouncyCastleProvider();<NEW_LINE>Security.addProvider(bcProvider);<NEW_LINE>long now = System.currentTimeMillis();<NEW_LINE><MASK><NEW_LINE>X500Name dnName = new X500Name("CN=" + subjectDN);<NEW_LINE>// <-- Using the current timestamp as the certificate serial number<NEW_LINE>BigInteger certSerialNumber = new BigInteger(Long.toString(now));<NEW_LINE>Calendar calendar = Calendar.getInstance();<NEW_LINE>calendar.setTime(startDate);<NEW_LINE>// <-- 1 Yr validity<NEW_LINE>calendar.add(Calendar.YEAR, 1);<NEW_LINE>Date endDate = calendar.getTime();<NEW_LINE>// <-- Use appropriate signature algorithm based on your keyPair algorithm.<NEW_LINE>String signatureAlgorithm = "SHA256WithRSA";<NEW_LINE>ContentSigner contentSigner = new JcaContentSignerBuilder(signatureAlgorithm).build(keyPair.getPrivate());<NEW_LINE>JcaX509v3CertificateBuilder certBuilder = new JcaX509v3CertificateBuilder(dnName, certSerialNumber, startDate, endDate, dnName, keyPair.getPublic());<NEW_LINE>// Extensions --------------------------<NEW_LINE>// Basic Constraints<NEW_LINE>// <-- true for CA, false for EndEntity<NEW_LINE>BasicConstraints basicConstraints = new BasicConstraints(true);<NEW_LINE>// Basic Constraints is usually marked as critical.<NEW_LINE>certBuilder.addExtension(new ASN1ObjectIdentifier("2.5.29.19"), true, basicConstraints);<NEW_LINE>// -------------------------------------<NEW_LINE>return new JcaX509CertificateConverter().setProvider(bcProvider).getCertificate(certBuilder.build(contentSigner));<NEW_LINE>} | Date startDate = new Date(now); |
798,869 | public static void main(String[] args) throws Exception {<NEW_LINE>ArgP argp = new ArgP();<NEW_LINE>CliOptions.addCommon(argp);<NEW_LINE>CliOptions.addAutoMetricFlag(argp);<NEW_LINE>argp.addOption("--skip-errors", "Whether or not to skip exceptions " + "during processing");<NEW_LINE>args = CliOptions.parse(argp, args);<NEW_LINE>if (args == null) {<NEW_LINE>usage(argp, 1);<NEW_LINE>} else if (args.length < 1) {<NEW_LINE>usage(argp, 2);<NEW_LINE>}<NEW_LINE>// get a config object<NEW_LINE>Config config = CliOptions.getConfig(argp);<NEW_LINE>final TSDB tsdb = new TSDB(config);<NEW_LINE>final boolean skip_errors = argp.has("--skip-errors");<NEW_LINE>tsdb.checkNecessaryTablesExist().joinUninterruptibly();<NEW_LINE>argp = null;<NEW_LINE>try {<NEW_LINE>int points = 0;<NEW_LINE>final long start_time = System.nanoTime();<NEW_LINE>for (final String path : args) {<NEW_LINE>points += importFile(tsdb.getClient(), tsdb, path, skip_errors);<NEW_LINE>}<NEW_LINE>final double time_delta = (System.nanoTime() - start_time) / 1000000000.0;<NEW_LINE>LOG.info(String.format("Total: imported %d data points in %.3fs" + " (%.1f points/s)", points, time_delta, (points / time_delta)));<NEW_LINE>// TODO(tsuna): Figure out something better than just writing to stderr.<NEW_LINE>tsdb.collectStats(new StatsCollector("tsd") {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public final void emit(final String line) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>} finally {<NEW_LINE>try {<NEW_LINE>tsdb.shutdown().joinUninterruptibly();<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.error("Unexpected exception", e);<NEW_LINE>System.exit(1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | System.err.print(line); |
1,160,603 | private int releaseInternal(String path, long fd) {<NEW_LINE>try {<NEW_LINE>FileInStream is = mOpenFileEntries.remove(fd);<NEW_LINE>CreateFileEntry<FileOutStream> ce = <MASK><NEW_LINE>if (is == null && ce == null) {<NEW_LINE>LOG.error("Failed to release {}: Cannot find fd {}", path, fd);<NEW_LINE>return -ErrorCodes.EBADFD();<NEW_LINE>}<NEW_LINE>if (ce != null) {<NEW_LINE>// Remove earlier to try best effort to avoid write() - async release() - getAttr()<NEW_LINE>// without waiting for file completed and return 0 bytes file size error<NEW_LINE>mCreateFileEntries.remove(ce);<NEW_LINE>synchronized (ce) {<NEW_LINE>ce.close();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (is != null) {<NEW_LINE>synchronized (is) {<NEW_LINE>is.close();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Throwable e) {<NEW_LINE>LOG.error("Failed to release {}", path, e);<NEW_LINE>return -ErrorCodes.EIO();<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>} | mCreateFileEntries.getFirstByField(ID_INDEX, fd); |
1,598,125 | static List<List<?>> chooseHyperParameterCombos(List<HyperParamValues<?>> ranges, int howMany) {<NEW_LINE>// Put some reasonable upper limit on the number of combos<NEW_LINE>Preconditions.checkArgument(howMany > 0 && howMany <= MAX_COMBOS);<NEW_LINE>int numParams = ranges.size();<NEW_LINE>int perParam = chooseValuesPerHyperParam(ranges, howMany);<NEW_LINE>if (numParams == 0 || perParam == 0) {<NEW_LINE>return Collections.singletonList(Collections.emptyList());<NEW_LINE>}<NEW_LINE>int howManyCombos = 1;<NEW_LINE>List<List<?>> paramRanges = new ArrayList<>(numParams);<NEW_LINE>for (HyperParamValues<?> range : ranges) {<NEW_LINE>List<?> values = range.getTrialValues(perParam);<NEW_LINE>paramRanges.add(values);<NEW_LINE>howManyCombos *= values.size();<NEW_LINE>}<NEW_LINE>List<List<?>> allCombinations = new ArrayList<>(howManyCombos);<NEW_LINE>for (int combo = 0; combo < howManyCombos; combo++) {<NEW_LINE>List<Object> combination = new ArrayList<>(numParams);<NEW_LINE>for (int param = 0; param < numParams; param++) {<NEW_LINE>int whichValueToTry = combo;<NEW_LINE>for (int i = 0; i < param; i++) {<NEW_LINE>whichValueToTry /= paramRanges.get(i).size();<NEW_LINE>}<NEW_LINE>whichValueToTry %= paramRanges.get(param).size();<NEW_LINE>combination.add(paramRanges.get(<MASK><NEW_LINE>}<NEW_LINE>allCombinations.add(combination);<NEW_LINE>}<NEW_LINE>if (howMany >= howManyCombos) {<NEW_LINE>Collections.shuffle(allCombinations);<NEW_LINE>return allCombinations;<NEW_LINE>}<NEW_LINE>RandomDataGenerator rdg = new RandomDataGenerator(RandomManager.getRandom());<NEW_LINE>int[] indices = rdg.nextPermutation(howManyCombos, howMany);<NEW_LINE>List<List<?>> result = new ArrayList<>(indices.length);<NEW_LINE>for (int i = 0; i < indices.length; i++) {<NEW_LINE>result.add(allCombinations.get(i));<NEW_LINE>}<NEW_LINE>Collections.shuffle(result);<NEW_LINE>return result;<NEW_LINE>} | param).get(whichValueToTry)); |
1,734,759 | public Builder mergeFrom(emu.grasscutter.net.proto.ReliquaryUpgradeReqOuterClass.ReliquaryUpgradeReq other) {<NEW_LINE>if (other == emu.grasscutter.net.proto.ReliquaryUpgradeReqOuterClass.ReliquaryUpgradeReq.getDefaultInstance())<NEW_LINE>return this;<NEW_LINE>if (other.getTargetReliquaryGuid() != 0L) {<NEW_LINE>setTargetReliquaryGuid(other.getTargetReliquaryGuid());<NEW_LINE>}<NEW_LINE>if (!other.foodReliquaryGuidList_.isEmpty()) {<NEW_LINE>if (foodReliquaryGuidList_.isEmpty()) {<NEW_LINE>foodReliquaryGuidList_ = other.foodReliquaryGuidList_;<NEW_LINE>bitField0_ = (bitField0_ & ~0x00000001);<NEW_LINE>} else {<NEW_LINE>ensureFoodReliquaryGuidListIsMutable();<NEW_LINE>foodReliquaryGuidList_.addAll(other.foodReliquaryGuidList_);<NEW_LINE>}<NEW_LINE>onChanged();<NEW_LINE>}<NEW_LINE>if (itemParamListBuilder_ == null) {<NEW_LINE>if (!other.itemParamList_.isEmpty()) {<NEW_LINE>if (itemParamList_.isEmpty()) {<NEW_LINE>itemParamList_ = other.itemParamList_;<NEW_LINE>bitField0_ = (bitField0_ & ~0x00000002);<NEW_LINE>} else {<NEW_LINE>ensureItemParamListIsMutable();<NEW_LINE>itemParamList_.addAll(other.itemParamList_);<NEW_LINE>}<NEW_LINE>onChanged();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (!other.itemParamList_.isEmpty()) {<NEW_LINE>if (itemParamListBuilder_.isEmpty()) {<NEW_LINE>itemParamListBuilder_.dispose();<NEW_LINE>itemParamListBuilder_ = null;<NEW_LINE>itemParamList_ = other.itemParamList_;<NEW_LINE>bitField0_ = (bitField0_ & ~0x00000002);<NEW_LINE>itemParamListBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getItemParamListFieldBuilder() : null;<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>this.mergeUnknownFields(other.unknownFields);<NEW_LINE>onChanged();<NEW_LINE>return this;<NEW_LINE>} | itemParamListBuilder_.addAllMessages(other.itemParamList_); |
582,522 | public void analyze(Analyzer analyzer) throws AnalysisException, UserException {<NEW_LINE>super.analyze(analyzer);<NEW_LINE>// check operation privilege<NEW_LINE>if (!Env.getCurrentEnv().getAuth().checkGlobalPriv(ConnectContext.get(), PrivPredicate.ADMIN)) {<NEW_LINE>ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR, "ADMIN");<NEW_LINE>}<NEW_LINE>if (dbName == null) {<NEW_LINE>dbName = analyzer.getDefaultDb();<NEW_LINE>} else {<NEW_LINE>if (Strings.isNullOrEmpty(analyzer.getClusterName())) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>dbName = ClusterNamespace.getFullName(analyzer.getClusterName(), dbName);<NEW_LINE>}<NEW_LINE>if (Strings.isNullOrEmpty(dbName)) {<NEW_LINE>ErrorReport.reportAnalysisException(ErrorCode.ERR_NO_DB_ERROR);<NEW_LINE>}<NEW_LINE>if (Strings.isNullOrEmpty(fileName)) {<NEW_LINE>throw new AnalysisException("File name is not specified");<NEW_LINE>}<NEW_LINE>Optional<String> optional = properties.keySet().stream().filter(entity -> !PROP_CATALOG.equals(entity)).findFirst();<NEW_LINE>if (optional.isPresent()) {<NEW_LINE>throw new AnalysisException(optional.get() + " is invalid property");<NEW_LINE>}<NEW_LINE>catalogName = properties.get(PROP_CATALOG);<NEW_LINE>if (Strings.isNullOrEmpty(catalogName)) {<NEW_LINE>throw new AnalysisException("catalog name is missing");<NEW_LINE>}<NEW_LINE>} | ErrorReport.reportAnalysisException(ErrorCode.ERR_CLUSTER_NAME_NULL); |
998,358 | public io.kubernetes.client.proto.V1beta2Apps.DeploymentStatus buildPartial() {<NEW_LINE>io.kubernetes.client.proto.V1beta2Apps.DeploymentStatus result = new io.kubernetes.client.proto.V1beta2Apps.DeploymentStatus(this);<NEW_LINE>int from_bitField0_ = bitField0_;<NEW_LINE>int to_bitField0_ = 0;<NEW_LINE>if (((from_bitField0_ & 0x00000001) == 0x00000001)) {<NEW_LINE>to_bitField0_ |= 0x00000001;<NEW_LINE>}<NEW_LINE>result.observedGeneration_ = observedGeneration_;<NEW_LINE>if (((from_bitField0_ & 0x00000002) == 0x00000002)) {<NEW_LINE>to_bitField0_ |= 0x00000002;<NEW_LINE>}<NEW_LINE>result.replicas_ = replicas_;<NEW_LINE>if (((from_bitField0_ & 0x00000004) == 0x00000004)) {<NEW_LINE>to_bitField0_ |= 0x00000004;<NEW_LINE>}<NEW_LINE>result.updatedReplicas_ = updatedReplicas_;<NEW_LINE>if (((from_bitField0_ & 0x00000008) == 0x00000008)) {<NEW_LINE>to_bitField0_ |= 0x00000008;<NEW_LINE>}<NEW_LINE>result.readyReplicas_ = readyReplicas_;<NEW_LINE>if (((from_bitField0_ & 0x00000010) == 0x00000010)) {<NEW_LINE>to_bitField0_ |= 0x00000010;<NEW_LINE>}<NEW_LINE>result.availableReplicas_ = availableReplicas_;<NEW_LINE>if (((from_bitField0_ & 0x00000020) == 0x00000020)) {<NEW_LINE>to_bitField0_ |= 0x00000020;<NEW_LINE>}<NEW_LINE>result.unavailableReplicas_ = unavailableReplicas_;<NEW_LINE>if (conditionsBuilder_ == null) {<NEW_LINE>if (((bitField0_ & 0x00000040) == 0x00000040)) {<NEW_LINE>conditions_ = java.util.Collections.unmodifiableList(conditions_);<NEW_LINE>bitField0_ = (bitField0_ & ~0x00000040);<NEW_LINE>}<NEW_LINE>result.conditions_ = conditions_;<NEW_LINE>} else {<NEW_LINE>result<MASK><NEW_LINE>}<NEW_LINE>if (((from_bitField0_ & 0x00000080) == 0x00000080)) {<NEW_LINE>to_bitField0_ |= 0x00000040;<NEW_LINE>}<NEW_LINE>result.collisionCount_ = collisionCount_;<NEW_LINE>result.bitField0_ = to_bitField0_;<NEW_LINE>onBuilt();<NEW_LINE>return result;<NEW_LINE>} | .conditions_ = conditionsBuilder_.build(); |
145,543 | public static String VRResources_GetResourceFullPath(@NativeType("char const *") CharSequence pchResourceName, @NativeType("char const *") CharSequence pchResourceTypeDirectory, @NativeType("uint32_t") int unBufferLen) {<NEW_LINE>MemoryStack stack = stackGet();<NEW_LINE>int stackPointer = stack.getPointer();<NEW_LINE>try {<NEW_LINE>stack.nASCII(pchResourceName, true);<NEW_LINE>long pchResourceNameEncoded = stack.getPointerAddress();<NEW_LINE>stack.nASCII(pchResourceTypeDirectory, true);<NEW_LINE>long pchResourceTypeDirectoryEncoded = stack.getPointerAddress();<NEW_LINE>ByteBuffer pchPathBuffer = stack.malloc(unBufferLen);<NEW_LINE>int __result = nVRResources_GetResourceFullPath(pchResourceNameEncoded, pchResourceTypeDirectoryEncoded<MASK><NEW_LINE>return memASCII(pchPathBuffer, __result - 1);<NEW_LINE>} finally {<NEW_LINE>stack.setPointer(stackPointer);<NEW_LINE>}<NEW_LINE>} | , memAddress(pchPathBuffer), unBufferLen); |
1,559,715 | // If this is a supported change (currently only permanent changes are supported) apply it.<NEW_LINE>@SuppressWarnings("deprecation")<NEW_LINE>private void maybeApplyChanges(Map<String, String> queryMap) {<NEW_LINE>String changeStr = queryMap.get(CHANGE);<NEW_LINE>if (PERMANENT_CHANGE.equals(changeStr)) {<NEW_LINE>TraceParams.Builder traceParamsBuilder = traceConfig.getActiveTraceParams().toBuilder();<NEW_LINE>String samplingProbabilityStr = queryMap.get(QUERY_COMPONENT_SAMPLING_PROBABILITY);<NEW_LINE>if (!isNullOrEmpty(samplingProbabilityStr)) {<NEW_LINE>double samplingProbability = Double.parseDouble(samplingProbabilityStr);<NEW_LINE>traceParamsBuilder.setSampler(Samplers.probabilitySampler(samplingProbability));<NEW_LINE>}<NEW_LINE>String maxNumberOfAttributesStr = queryMap.get(QUERY_COMPONENT_MAX_NUMBER_OF_ATTRIBUTES);<NEW_LINE>if (!isNullOrEmpty(maxNumberOfAttributesStr)) {<NEW_LINE>int maxNumberOfAttributes = Integer.parseInt(maxNumberOfAttributesStr);<NEW_LINE>traceParamsBuilder.setMaxNumberOfAttributes(maxNumberOfAttributes);<NEW_LINE>}<NEW_LINE>String maxNumberOfAnnotationsStr = queryMap.get(QUERY_COMPONENT_MAX_NUMBER_OF_ANNOTATIONS);<NEW_LINE>if (!isNullOrEmpty(maxNumberOfAnnotationsStr)) {<NEW_LINE>int maxNumberOfAnnotations = Integer.parseInt(maxNumberOfAnnotationsStr);<NEW_LINE>traceParamsBuilder.setMaxNumberOfAnnotations(maxNumberOfAnnotations);<NEW_LINE>}<NEW_LINE>String maxNumberOfNetworkEventsStr = queryMap.get(QUERY_COMPONENT_MAX_NUMBER_OF_NETWORK_EVENTS);<NEW_LINE>if (!isNullOrEmpty(maxNumberOfNetworkEventsStr)) {<NEW_LINE>int maxNumberOfNetworkEvents = Integer.parseInt(maxNumberOfNetworkEventsStr);<NEW_LINE>traceParamsBuilder.setMaxNumberOfNetworkEvents(maxNumberOfNetworkEvents);<NEW_LINE>}<NEW_LINE>String maxNumverOfLinksStr = queryMap.get(QUERY_COMPONENT_MAX_NUMBER_OF_LINKS);<NEW_LINE>if (!isNullOrEmpty(maxNumverOfLinksStr)) {<NEW_LINE>int <MASK><NEW_LINE>traceParamsBuilder.setMaxNumberOfLinks(maxNumberOfLinks);<NEW_LINE>}<NEW_LINE>traceConfig.updateActiveTraceParams(traceParamsBuilder.build());<NEW_LINE>} else if (RESTORE_DEFAULT_CHANGE.equals(changeStr)) {<NEW_LINE>traceConfig.updateActiveTraceParams(TraceParams.DEFAULT);<NEW_LINE>}<NEW_LINE>} | maxNumberOfLinks = Integer.parseInt(maxNumverOfLinksStr); |
83,799 | private void writeSourceOauthParameter(final List<SourceOAuthParameter> configs, final DSLContext ctx) {<NEW_LINE>final OffsetDateTime timestamp = OffsetDateTime.now();<NEW_LINE>configs.forEach((sourceOAuthParameter) -> {<NEW_LINE>final boolean isExistingConfig = ctx.fetchExists(select().from(ACTOR_OAUTH_PARAMETER).where(ACTOR_OAUTH_PARAMETER.ID.eq(sourceOAuthParameter.getOauthParameterId())));<NEW_LINE>if (isExistingConfig) {<NEW_LINE>ctx.update(ACTOR_OAUTH_PARAMETER).set(ACTOR_OAUTH_PARAMETER.ID, sourceOAuthParameter.getOauthParameterId()).set(ACTOR_OAUTH_PARAMETER.WORKSPACE_ID, sourceOAuthParameter.getWorkspaceId()).set(ACTOR_OAUTH_PARAMETER.ACTOR_DEFINITION_ID, sourceOAuthParameter.getSourceDefinitionId()).set(ACTOR_OAUTH_PARAMETER.CONFIGURATION, JSONB.valueOf(Jsons.serialize(sourceOAuthParameter.getConfiguration()))).set(ACTOR_OAUTH_PARAMETER.ACTOR_TYPE, ActorType.source).set(ACTOR_OAUTH_PARAMETER.UPDATED_AT, timestamp).where(ACTOR_OAUTH_PARAMETER.ID.eq(sourceOAuthParameter.getOauthParameterId<MASK><NEW_LINE>} else {<NEW_LINE>ctx.insertInto(ACTOR_OAUTH_PARAMETER).set(ACTOR_OAUTH_PARAMETER.ID, sourceOAuthParameter.getOauthParameterId()).set(ACTOR_OAUTH_PARAMETER.WORKSPACE_ID, sourceOAuthParameter.getWorkspaceId()).set(ACTOR_OAUTH_PARAMETER.ACTOR_DEFINITION_ID, sourceOAuthParameter.getSourceDefinitionId()).set(ACTOR_OAUTH_PARAMETER.CONFIGURATION, JSONB.valueOf(Jsons.serialize(sourceOAuthParameter.getConfiguration()))).set(ACTOR_OAUTH_PARAMETER.ACTOR_TYPE, ActorType.source).set(ACTOR_OAUTH_PARAMETER.CREATED_AT, timestamp).set(ACTOR_OAUTH_PARAMETER.UPDATED_AT, timestamp).execute();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | ())).execute(); |
521,437 | /*<NEW_LINE>* This function detects numbers like 12 ,32h ,42m .. etc,. 1) plain number<NEW_LINE>* like 12 2) time or tablesize like 12h, 34m, 45k, 54m , here last<NEW_LINE>* character is non-digit but from known characters .<NEW_LINE>*/<NEW_LINE>private static boolean containsOnlyNumbers(final String str, final String endChar) {<NEW_LINE>if (str == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>String number = str;<NEW_LINE>if (endChar != null) {<NEW_LINE>boolean matchedEndChar = false;<NEW_LINE>if (str.length() < 2) {<NEW_LINE>// atleast one numeric and one char. example:<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// 3h<NEW_LINE>final char strEnd = str.toCharArray()[<MASK><NEW_LINE>for (final char c : endChar.toCharArray()) {<NEW_LINE>if (strEnd == c) {<NEW_LINE>number = str.substring(0, str.length() - 1);<NEW_LINE>matchedEndChar = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!matchedEndChar) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Integer.parseInt(number);<NEW_LINE>} catch (final NumberFormatException e) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | str.length() - 1]; |
1,704,386 | public final static int ycbcr_to_rgb24(int y, int cb, int cr) {<NEW_LINE>y = y << SCALEBITS;<NEW_LINE>cb = cb - 128;<NEW_LINE>cr = cr - 128;<NEW_LINE>int add_r = FIX_1_402 * cr + ONE_HALF;<NEW_LINE>int add_g = _FIX_0_34414 <MASK><NEW_LINE>int add_b = FIX_1_772 * cb + ONE_HALF;<NEW_LINE>int r = (y + add_r) >> SCALEBITS;<NEW_LINE>int g = (y + add_g) >> SCALEBITS;<NEW_LINE>int b = (y + add_b) >> SCALEBITS;<NEW_LINE>r = crop(r);<NEW_LINE>g = crop(g);<NEW_LINE>b = crop(b);<NEW_LINE>return ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff);<NEW_LINE>} | * cb - FIX_0_71414 * cr + ONE_HALF; |
1,210,560 | private void handleSuccessfulDownload(Downloader downloader) {<NEW_LINE>DownloadRequest request = downloader.getDownloadRequest();<NEW_LINE><MASK><NEW_LINE>final int type = status.getFeedfileType();<NEW_LINE>if (type == Feed.FEEDFILETYPE_FEED) {<NEW_LINE>Log.d(TAG, "Handling completed Feed Download");<NEW_LINE>FeedSyncTask task = new FeedSyncTask(DownloadService.this, request);<NEW_LINE>boolean success = task.run();<NEW_LINE>if (success) {<NEW_LINE>if (request.getFeedfileId() == 0) {<NEW_LINE>// No download logs for new subscriptions<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// we create a 'successful' download log if the feed's last refresh failed<NEW_LINE>List<DownloadStatus> log = DBReader.getFeedDownloadLog(request.getFeedfileId());<NEW_LINE>if (log.size() > 0 && !log.get(0).isSuccessful()) {<NEW_LINE>saveDownloadStatus(task.getDownloadStatus());<NEW_LINE>}<NEW_LINE>if (!request.isInitiatedByUser()) {<NEW_LINE>// Was stored in the database before and not initiated manually<NEW_LINE>newEpisodesNotification.showIfNeeded(DownloadService.this, task.getSavedFeed());<NEW_LINE>}<NEW_LINE>if (downloader.permanentRedirectUrl != null) {<NEW_LINE>DBWriter.updateFeedDownloadURL(request.getSource(), downloader.permanentRedirectUrl);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>DBWriter.setFeedLastUpdateFailed(request.getFeedfileId(), true);<NEW_LINE>saveDownloadStatus(task.getDownloadStatus());<NEW_LINE>}<NEW_LINE>} else if (type == FeedMedia.FEEDFILETYPE_FEEDMEDIA) {<NEW_LINE>Log.d(TAG, "Handling completed FeedMedia Download");<NEW_LINE>MediaDownloadedHandler handler = new MediaDownloadedHandler(DownloadService.this, status, request);<NEW_LINE>handler.run();<NEW_LINE>saveDownloadStatus(handler.getUpdatedStatus());<NEW_LINE>}<NEW_LINE>} | DownloadStatus status = downloader.getResult(); |
830,970 | void doGeneric(VirtualFrame frame, SequenceStorage storage, WriteNode[] slots, int starredIndex, @Shared("getItemNode") @Cached SequenceStorageNodes.GetItemNode getItemNode, @Shared("lenNode") @Cached SequenceStorageNodes.LenNode lenNode) {<NEW_LINE>CompilerAsserts.partialEvaluationConstant(slots);<NEW_LINE>CompilerAsserts.partialEvaluationConstant(starredIndex);<NEW_LINE>int len = lenNode.execute(storage);<NEW_LINE>if (len < slots.length - 1) {<NEW_LINE>throw ensureRaiseNode().raise(ValueError, ErrorMessages.NOT_ENOUGH_VALUES_TO_UNPACK, slots.length, len);<NEW_LINE>} else {<NEW_LINE>writeSlots(frame, storage, getItemNode, slots, starredIndex);<NEW_LINE>final int starredLength = len - (slots.length - 1);<NEW_LINE>Object[] array = new Object[starredLength];<NEW_LINE>int pos = starredIndex;<NEW_LINE>for (int i = 0; i < starredLength; i++) {<NEW_LINE>array[i] = getItemNode.execute(frame, storage, pos++);<NEW_LINE>}<NEW_LINE>slots[starredIndex].executeObject(frame, factory().createList(array));<NEW_LINE>for (int i = starredIndex + 1; i < slots.length; i++) {<NEW_LINE>Object value = getItemNode.execute(frame, storage, pos++);<NEW_LINE>slots[i<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ].executeObject(frame, value); |
1,774,281 | private void parseEmbed(final Element e, final Metadata md) {<NEW_LINE>final Element embedElement = e.getChild("embed", getNS());<NEW_LINE>if (embedElement != null) {<NEW_LINE>final Embed embed = new Embed();<NEW_LINE>embed.setWidth(Integers.parse(embedElement.getAttributeValue("width")));<NEW_LINE>embed.setHeight(Integers.parse(embedElement.getAttributeValue("height")));<NEW_LINE>if (embedElement.getAttributeValue("url") != null) {<NEW_LINE>try {<NEW_LINE>embed.setUrl(new URL(embedElement.getAttributeValue("url")));<NEW_LINE>} catch (MalformedURLException ex) {<NEW_LINE>LOG.warn("Exception parsing embed tag.", ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final List<Element> paramElements = embedElement.<MASK><NEW_LINE>embed.setParams(new Param[paramElements.size()]);<NEW_LINE>for (int i = 0; i < paramElements.size(); i++) {<NEW_LINE>embed.getParams()[i] = new Param(paramElements.get(i).getAttributeValue("name"), paramElements.get(i).getTextTrim());<NEW_LINE>}<NEW_LINE>md.setEmbed(embed);<NEW_LINE>}<NEW_LINE>} | getChildren("param", getNS()); |
527,044 | final DeleteCloudFrontOriginAccessIdentityResult executeDeleteCloudFrontOriginAccessIdentity(DeleteCloudFrontOriginAccessIdentityRequest deleteCloudFrontOriginAccessIdentityRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteCloudFrontOriginAccessIdentityRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteCloudFrontOriginAccessIdentityRequest> request = null;<NEW_LINE>Response<DeleteCloudFrontOriginAccessIdentityResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new DeleteCloudFrontOriginAccessIdentityRequestMarshaller().marshall(super.beforeMarshalling(deleteCloudFrontOriginAccessIdentityRequest));<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, "CloudFront");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteCloudFrontOriginAccessIdentity");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DeleteCloudFrontOriginAccessIdentityResult> responseHandler = new StaxResponseHandler<DeleteCloudFrontOriginAccessIdentityResult>(new DeleteCloudFrontOriginAccessIdentityResultStaxUnmarshaller());<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.RequestMarshallTime); |
1,001,435 | public static String sshPublicKey() {<NEW_LINE>if (sshPublicKey == null) {<NEW_LINE>try {<NEW_LINE>KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");<NEW_LINE>keyGen.initialize(1024);<NEW_LINE>KeyPair pair = keyGen.generateKeyPair();<NEW_LINE>PublicKey publicKey = pair.getPublic();<NEW_LINE>RSAPublicKey rsaPublicKey = (RSAPublicKey) publicKey;<NEW_LINE>ByteArrayOutputStream byteOs = new ByteArrayOutputStream();<NEW_LINE><MASK><NEW_LINE>dos.writeInt("ssh-rsa".getBytes(StandardCharsets.US_ASCII).length);<NEW_LINE>dos.write("ssh-rsa".getBytes(StandardCharsets.US_ASCII));<NEW_LINE>dos.writeInt(rsaPublicKey.getPublicExponent().toByteArray().length);<NEW_LINE>dos.write(rsaPublicKey.getPublicExponent().toByteArray());<NEW_LINE>dos.writeInt(rsaPublicKey.getModulus().toByteArray().length);<NEW_LINE>dos.write(rsaPublicKey.getModulus().toByteArray());<NEW_LINE>String publicKeyEncoded = new String(Base64.getEncoder().encode(byteOs.toByteArray()), StandardCharsets.US_ASCII);<NEW_LINE>sshPublicKey = "ssh-rsa " + publicKeyEncoded;<NEW_LINE>} catch (NoSuchAlgorithmException | IOException e) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalStateException("failed to generate ssh key", e));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return sshPublicKey;<NEW_LINE>} | DataOutputStream dos = new DataOutputStream(byteOs); |
1,295,993 | public void testCriteriaQuery_double(TestExecutionContext testExecCtx, TestExecutionResources testExecResources, Object managedComponentObject) throws Throwable {<NEW_LINE>final String testName = getTestName();<NEW_LINE>// Verify parameters<NEW_LINE>if (testExecCtx == null || testExecResources == null) {<NEW_LINE>Assert.fail(testName + ": Missing context and/or resources. Cannot execute the test.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final JPAResource jpaResource = testExecResources.getJpaResourceMap().get("test-jpa-resource");<NEW_LINE>if (jpaResource == null) {<NEW_LINE>Assert.fail("Missing JPAResource 'test-jpa-resource'). Cannot execute the test.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Process Test Properties<NEW_LINE>final Map<String, Serializable> testProps = testExecCtx.getProperties();<NEW_LINE>if (testProps != null) {<NEW_LINE>for (String key : testProps.keySet()) {<NEW_LINE>System.out.println("Test Property: " + key + " = " + testProps.get(key));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>EntityManager em = jpaResource.getEm();<NEW_LINE>TransactionJacket tx = jpaResource.getTj();<NEW_LINE>// Execute Test Case<NEW_LINE>try {<NEW_LINE>tx.beginTransaction();<NEW_LINE>if (jpaResource.getPcCtxInfo().getPcType() == PersistenceContextType.APPLICATION_MANAGED_JTA)<NEW_LINE>em.joinTransaction();<NEW_LINE><MASK><NEW_LINE>CriteriaQuery<Entity0006> cq = cb.createQuery(Entity0006.class);<NEW_LINE>Root<Entity0006> root = cq.from(Entity0006.class);<NEW_LINE>cq.select(root);<NEW_LINE>TypedQuery<Entity0006> tq = em.createQuery(cq);<NEW_LINE>Entity0006 findEntity = tq.getSingleResult();<NEW_LINE>System.out.println("Object returned by query: " + findEntity);<NEW_LINE>assertNotNull("Did not find entity in criteria query", findEntity);<NEW_LINE>assertTrue("Entity returned by find was not contained in the persistence context.", em.contains(findEntity));<NEW_LINE>assertEquals(06.06D, findEntity.getEntity0006_id(), 0.01);<NEW_LINE>assertEquals("Entity0006_STRING01", findEntity.getEntity0006_string01());<NEW_LINE>assertEquals("Entity0006_STRING02", findEntity.getEntity0006_string02());<NEW_LINE>assertEquals("Entity0006_STRING03", findEntity.getEntity0006_string03());<NEW_LINE>tx.commitTransaction();<NEW_LINE>} finally {<NEW_LINE>System.out.println(testName + ": End");<NEW_LINE>}<NEW_LINE>} | CriteriaBuilder cb = em.getCriteriaBuilder(); |
1,200,584 | public boolean onOptionsItemSelected(MenuItem item) {<NEW_LINE>switch(item.getItemId()) {<NEW_LINE>case R.id.saveButton:<NEW_LINE>final boolean isEdit = scaleMeasurement.getId() > 0;<NEW_LINE>saveScaleData();<NEW_LINE>if (isEdit) {<NEW_LINE>setViewMode(MeasurementView.MeasurementViewMode.VIEW);<NEW_LINE>} else {<NEW_LINE>Navigation.findNavController(getActivity(), R.id.nav_host_fragment).navigateUp();<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>case R.id.expandButton:<NEW_LINE>SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);<NEW_LINE>final boolean expand = !prefs.getBoolean(PREF_EXPAND, false);<NEW_LINE>prefs.edit().putBoolean(<MASK><NEW_LINE>for (MeasurementView measurement : dataEntryMeasurements) {<NEW_LINE>measurement.setExpand(expand);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>case R.id.editButton:<NEW_LINE>setViewMode(MeasurementView.MeasurementViewMode.EDIT);<NEW_LINE>return true;<NEW_LINE>case R.id.deleteButton:<NEW_LINE>deleteMeasurement();<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return super.onOptionsItemSelected(item);<NEW_LINE>} | PREF_EXPAND, expand).apply(); |
865,048 | private PropertyNode fieldDefinition(Expression propertyName, boolean isStatic, long startToken, boolean computed) {<NEW_LINE>// "constructor" or #constructor is not allowed as an instance field name<NEW_LINE>if (!computed && propertyName instanceof PropertyKey) {<NEW_LINE>TruffleString name = ((PropertyKey) propertyName).getPropertyName();<NEW_LINE>if (CONSTRUCTOR_NAME.equals(name) || PRIVATE_CONSTRUCTOR_NAME.equals(name)) {<NEW_LINE>throw error(AbstractParser.message(MSG_CONSTRUCTOR_FIELD), startToken);<NEW_LINE>}<NEW_LINE>if (isStatic && PROTOTYPE_NAME.equals(name)) {<NEW_LINE>throw error(AbstractParser<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>FunctionNode initializer = null;<NEW_LINE>boolean isAnonymousFunctionDefinition = false;<NEW_LINE>if (type == ASSIGN) {<NEW_LINE>next();<NEW_LINE>// Parse AssignmentExpression[In] in a function.<NEW_LINE>Pair<FunctionNode, Boolean> pair = fieldInitializer(line, startToken, propertyName, computed);<NEW_LINE>initializer = pair.getLeft();<NEW_LINE>isAnonymousFunctionDefinition = pair.getRight();<NEW_LINE>// semicolon or end of line<NEW_LINE>endOfLine();<NEW_LINE>}<NEW_LINE>return new PropertyNode(startToken, finish, propertyName, initializer, null, null, isStatic, computed, false, false, true, isAnonymousFunctionDefinition);<NEW_LINE>} | .message(MSG_STATIC_PROTOTYPE_FIELD), startToken); |
649,457 | public void actionPerformed(final ActionEvent e) {<NEW_LINE>if (RP.isRequestProcessorThread()) {<NEW_LINE><MASK><NEW_LINE>org.netbeans.modules.web.webkit.debugging.api.css.Rule rule = lookup.lookup(org.netbeans.modules.web.webkit.debugging.api.css.Rule.class);<NEW_LINE>Resource resource = lookup.lookup(Resource.class);<NEW_LINE>if (resource == null || rule == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>FileObject fob = resource.toFileObject();<NEW_LINE>if (fob == null || fob.isFolder()) /* issue 233463 */<NEW_LINE>{<NEW_LINE>StyleSheetBody body = rule.getParentStyleSheet();<NEW_LINE>if (body == null) {<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>fob = RemoteStyleSheetCache.getDefault().getFileObject(body);<NEW_LINE>if (fob == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Source source = Source.create(fob);<NEW_LINE>ParserManager.parse(Collections.singleton(source), new GoToRuleTask(rule, fob));<NEW_LINE>} catch (ParseException ex) {<NEW_LINE>Logger.getLogger(GoToRuleSourceAction.class.getName()).log(Level.INFO, null, ex);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>RP.post(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>actionPerformed(e);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | Lookup lookup = node.getLookup(); |
1,177,140 | // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<NEW_LINE>public void handleRunEmulator(Sketch sketch, AndroidEditor editor, RunnerListener listener) throws SketchException, IOException {<NEW_LINE>listener.startIndeterminate();<NEW_LINE>listener.statusNotice(AndroidMode.getTextString("android_mode.status.starting_project_build"));<NEW_LINE>AndroidBuild build = new AndroidBuild(sketch, this, editor.getAppComponent());<NEW_LINE>listener.statusNotice(AndroidMode.getTextString("android_mode.status.building_project"));<NEW_LINE>build.build("debug");<NEW_LINE>boolean avd = AVD.ensureProperAVD(editor, this, sdk, build.isWear());<NEW_LINE>if (!avd) {<NEW_LINE>SketchException se = new SketchException(AndroidMode.getTextString("android_mode.error.cannot_create_avd"));<NEW_LINE>se.hideStackTrace();<NEW_LINE>throw se;<NEW_LINE>}<NEW_LINE>int comp = build.getAppComponent();<NEW_LINE>Future<Device> emu = Devices.getInstance().getEmulator(build.isWear());<NEW_LINE>runner = new AndroidRunner(build, listener);<NEW_LINE>runner.<MASK><NEW_LINE>} | launch(emu, comp, true); |
399,914 | public static int decompress(DataInput compressed, int decompressedLen, byte[] dest, int dOff) throws IOException {<NEW_LINE>final int destEnd = dOff + decompressedLen;<NEW_LINE>do {<NEW_LINE>// literals<NEW_LINE>final int token <MASK><NEW_LINE>int literalLen = token >>> 4;<NEW_LINE>if (literalLen != 0) {<NEW_LINE>if (literalLen == 0x0F) {<NEW_LINE>byte len;<NEW_LINE>while ((len = compressed.readByte()) == (byte) 0xFF) {<NEW_LINE>literalLen += 0xFF;<NEW_LINE>}<NEW_LINE>literalLen += len & 0xFF;<NEW_LINE>}<NEW_LINE>compressed.readBytes(dest, dOff, literalLen);<NEW_LINE>dOff += literalLen;<NEW_LINE>}<NEW_LINE>if (dOff >= destEnd) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>// matchs<NEW_LINE>final int matchDec = compressed.readShort() & 0xFFFF;<NEW_LINE>assert matchDec > 0;<NEW_LINE>int matchLen = token & 0x0F;<NEW_LINE>if (matchLen == 0x0F) {<NEW_LINE>int len;<NEW_LINE>while ((len = compressed.readByte()) == (byte) 0xFF) {<NEW_LINE>matchLen += 0xFF;<NEW_LINE>}<NEW_LINE>matchLen += len & 0xFF;<NEW_LINE>}<NEW_LINE>matchLen += MIN_MATCH;<NEW_LINE>// copying a multiple of 8 bytes can make decompression from 5% to 10% faster<NEW_LINE>final int fastLen = (matchLen + 7) & 0xFFFFFFF8;<NEW_LINE>if (matchDec < matchLen || dOff + fastLen > destEnd) {<NEW_LINE>// overlap -> naive incremental copy<NEW_LINE>for (int ref = dOff - matchDec, end = dOff + matchLen; dOff < end; ++ref, ++dOff) {<NEW_LINE>dest[dOff] = dest[ref];<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// no overlap -> arraycopy<NEW_LINE>System.arraycopy(dest, dOff - matchDec, dest, dOff, fastLen);<NEW_LINE>dOff += matchLen;<NEW_LINE>}<NEW_LINE>} while (dOff < destEnd);<NEW_LINE>return dOff;<NEW_LINE>} | = compressed.readByte() & 0xFF; |
1,110,358 | /* ------------------------------------------------------------------------ */<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>public static Permission extractPermission(String permText) {<NEW_LINE>StreamTokenizer tokens = new <MASK><NEW_LINE>String className = null;<NEW_LINE>String resourceName = "";<NEW_LINE>String actions = "";<NEW_LINE>try {<NEW_LINE>tokens.nextToken();<NEW_LINE>className = getStringToken(tokens);<NEW_LINE>if (tokens.nextToken() != StreamTokenizer.TT_EOF) {<NEW_LINE>resourceName = getStringToken(tokens);<NEW_LINE>}<NEW_LINE>if (tokens.nextToken() != StreamTokenizer.TT_EOF) {<NEW_LINE>actions = getStringToken(tokens);<NEW_LINE>}<NEW_LINE>} catch (IOException ioe) {<NEW_LINE>ioe.printStackTrace();<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Class<? extends Permission> permClazz = (Class<? extends Permission>) Class.forName(className);<NEW_LINE>Constructor<? extends Permission> cons = permClazz.getConstructor(String.class, String.class);<NEW_LINE>return cons.newInstance(resourceName, actions);<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | StreamTokenizer(new StringReader(permText)); |
1,777,859 | private static Configuration buildConfiguration() {<NEW_LINE>String configTypeName = CURRENT_FILE_INSTANCE.getConfig(ConfigurationKeys.FILE_ROOT_CONFIG + ConfigurationKeys.FILE_CONFIG_SPLIT_CHAR + ConfigurationKeys.FILE_ROOT_TYPE);<NEW_LINE>if (StringUtils.isBlank(configTypeName)) {<NEW_LINE>throw new NotSupportYetException("config type can not be null");<NEW_LINE>}<NEW_LINE>ConfigType configType = ConfigType.getType(configTypeName);<NEW_LINE>Configuration extConfiguration = null;<NEW_LINE>Configuration configuration;<NEW_LINE>if (ConfigType.File == configType) {<NEW_LINE>String pathDataId = String.join(ConfigurationKeys.FILE_CONFIG_SPLIT_CHAR, ConfigurationKeys.FILE_ROOT_CONFIG, FILE_TYPE, NAME_KEY);<NEW_LINE>String name = CURRENT_FILE_INSTANCE.getConfig(pathDataId);<NEW_LINE>configuration = new FileConfiguration(name);<NEW_LINE>try {<NEW_LINE>extConfiguration = EnhancedServiceLoader.load(ExtConfigurationProvider.class).provide(configuration);<NEW_LINE>if (LOGGER.isInfoEnabled()) {<NEW_LINE>LOGGER.info("load Configuration from :{}", extConfiguration == null ? configuration.getClass().getSimpleName() : "Spring Configuration");<NEW_LINE>}<NEW_LINE>} catch (EnhancedServiceNotFoundException ignore) {<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error("failed to load extConfiguration:{}", e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>configuration = EnhancedServiceLoader.load(ConfigurationProvider.class, Objects.requireNonNull(configType).name()).provide();<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Configuration configurationCache;<NEW_LINE>if (null != extConfiguration) {<NEW_LINE>configurationCache = ConfigurationCache.<MASK><NEW_LINE>} else {<NEW_LINE>configurationCache = ConfigurationCache.getInstance().proxy(configuration);<NEW_LINE>}<NEW_LINE>if (null != configurationCache) {<NEW_LINE>extConfiguration = configurationCache;<NEW_LINE>}<NEW_LINE>} catch (EnhancedServiceNotFoundException ignore) {<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error("failed to load configurationCacheProvider:{}", e.getMessage(), e);<NEW_LINE>}<NEW_LINE>return null == extConfiguration ? configuration : extConfiguration;<NEW_LINE>} | getInstance().proxy(extConfiguration); |
486,597 | public void readLiteralSection() throws IOException {<NEW_LINE>if (log.isLoggable(Level.FINE))<NEW_LINE>log.fine("readLiteralSection");<NEW_LINE>final byte[] buf = in.read_size_and_inflate();<NEW_LINE>final EInputStream is = new EInputStream(buf);<NEW_LINE>int nLiterals = is.read4BE();<NEW_LINE>if (log.isLoggable(Level.FINE))<NEW_LINE>log.fine("Number of literals: " + nLiterals);<NEW_LINE>literals = new EObject[nLiterals];<NEW_LINE>for (int i = 0; i < nLiterals; i++) {<NEW_LINE>int lit_length = is.read4BE();<NEW_LINE>int pos_before_lit = is.getPos();<NEW_LINE>literals[i] = is.read_any();<NEW_LINE>if (log.isLoggable(Level.FINE))<NEW_LINE>log.fine("- #" + i + ": " + literals[i]);<NEW_LINE>int pos_after_lit = is.getPos();<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | assert (pos_after_lit == pos_before_lit + lit_length); |
580,743 | /* package */<NEW_LINE>DoubleFunction<Color> buildColorFunction(ResourceManager resourceManager) {<NEW_LINE>switch(this) {<NEW_LINE>case GREEN_YELLOW_RED:<NEW_LINE>return performance -> {<NEW_LINE>// convert to 0 = -0.07 -> 1 = +0.07<NEW_LINE>final double max = 0.07f;<NEW_LINE>double p = performance;<NEW_LINE>p = Math.max(-max, p);<NEW_LINE>p = Math.min(max, p);<NEW_LINE>p = (p + max) * (1 / (2 * max));<NEW_LINE>// 0 = red, 60 = yellow, 120 = red<NEW_LINE>float hue = (float) p * 120f;<NEW_LINE>return resourceManager.createColor(new RGB(hue, 0.9f, 1f));<NEW_LINE>};<NEW_LINE>case GREEN_WHITE_RED:<NEW_LINE>return performance -> {<NEW_LINE>final double max = 0.07f;<NEW_LINE>double p = performance;<NEW_LINE>p = Math.min(max, Math.abs(p));<NEW_LINE>p = p / max;<NEW_LINE>RGB color = performance > 0f ? GREEN <MASK><NEW_LINE>return resourceManager.createColor(Colors.interpolate(Colors.theme().defaultBackground().getRGB(), color, (float) p));<NEW_LINE>};<NEW_LINE>default:<NEW_LINE>throw new IllegalArgumentException();<NEW_LINE>}<NEW_LINE>} | : Colors.RED.getRGB(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.