idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
37,561 | public static void connectUser(@NonNull Context context, @NonNull User user, @Nullable AlLoginHandler loginHandler) {<NEW_LINE>if (isConnected(context)) {<NEW_LINE>RegistrationResponse registrationResponse = new RegistrationResponse();<NEW_LINE>registrationResponse.setMessage("User already Logged in");<NEW_LINE>Contact contact = new ContactDatabase(context).getContactById(MobiComUserPreference.getInstance(context).getUserId());<NEW_LINE>if (contact != null) {<NEW_LINE>registrationResponse.setUserId(contact.getUserId());<NEW_LINE>registrationResponse.setContactNumber(contact.getContactNumber());<NEW_LINE>registrationResponse.setRoleType(contact.getRoleType());<NEW_LINE>registrationResponse.setImageLink(contact.getImageURL());<NEW_LINE>registrationResponse.setDisplayName(contact.getDisplayName());<NEW_LINE>registrationResponse.setStatusMessage(contact.getStatus());<NEW_LINE>}<NEW_LINE>if (loginHandler != null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>AlTask.execute(new UserLoginTask(user, loginHandler, context));<NEW_LINE>}<NEW_LINE>} | loginHandler.onSuccess(registrationResponse, context); |
649,076 | private static void stopVideoCapture(boolean useCallbacks) {<NEW_LINE>// Do not continue if not started.<NEW_LINE>if (recorder == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Determine if the activity is closing/closed.<NEW_LINE>boolean isFinishing = (cameraActivity != null) ? cameraActivity.isFinishing() : false;<NEW_LINE>if (isFinishing) {<NEW_LINE>useCallbacks = false;<NEW_LINE>}<NEW_LINE>// Stop and release the media recorder.<NEW_LINE>boolean wasSuccessful = false;<NEW_LINE>try {<NEW_LINE>recorder.stop();<NEW_LINE>recorder.release();<NEW_LINE>wasSuccessful = !isFinishing && (videoContentUri != null);<NEW_LINE>} catch (Exception e) {<NEW_LINE>onError(MediaModule.UNKNOWN_ERROR, "Unable to stop recording: " + e.getMessage());<NEW_LINE>useCallbacks = false;<NEW_LINE>} finally {<NEW_LINE>recorder = null;<NEW_LINE>}<NEW_LINE>// Lock camera for preview surface now that we're done recording.<NEW_LINE>try {<NEW_LINE>if (camera != null) {<NEW_LINE>camera.reconnect();<NEW_LINE>camera.lock();<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>Log.e(TAG, "Unable to reconnect to camera after recording.", ex);<NEW_LINE>}<NEW_LINE>// Close the video file. Delete it if failed to record or if we're canceling out of activity.<NEW_LINE>if (videoParcelFileDescriptor != null) {<NEW_LINE>try {<NEW_LINE>videoParcelFileDescriptor.close();<NEW_LINE>if (!wasSuccessful && (videoContentUri != null)) {<NEW_LINE>ContentResolver contentResolver = TiApplication.getInstance().getContentResolver();<NEW_LINE>contentResolver.delete(videoContentUri, null, null);<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>Log.<MASK><NEW_LINE>}<NEW_LINE>videoParcelFileDescriptor = null;<NEW_LINE>}<NEW_LINE>// Notify the caller that the recording has stopped.<NEW_LINE>if (wasSuccessful) {<NEW_LINE>if (useCallbacks && (successCallback != null)) {<NEW_LINE>TiBlob blob = TiBlob.blobFromFile(new TiContentFile(videoContentUri));<NEW_LINE>KrollDict response = MediaModule.createDictForImage(blob, blob.getMimeType());<NEW_LINE>KrollDict previewRect = new KrollDict();<NEW_LINE>previewRect.put(TiC.PROPERTY_WIDTH, 0);<NEW_LINE>previewRect.put(TiC.PROPERTY_HEIGHT, 0);<NEW_LINE>response.put("previewRect", previewRect);<NEW_LINE>successCallback.callAsync(callbackContext, response);<NEW_LINE>}<NEW_LINE>} else if (!isFinishing) {<NEW_LINE>String message = "Failed to record video.";<NEW_LINE>if (useCallbacks) {<NEW_LINE>onError(MediaModule.UNKNOWN_ERROR, message);<NEW_LINE>} else {<NEW_LINE>Log.e(TAG, message);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Close the activity if auto-hide is enabled.<NEW_LINE>// Otherwise, restart the camera preview.<NEW_LINE>if (autohide) {<NEW_LINE>hide();<NEW_LINE>} else if (camera != null) {<NEW_LINE>camera.startPreview();<NEW_LINE>}<NEW_LINE>} | e(TAG, "Failed to close video file.", ex); |
89,242 | public void onRegisterDevice(int status, @Nullable String message, @Nullable BackupError error) {<NEW_LINE>FragmentActivity activity = getActivity();<NEW_LINE>if (AndroidUtils.isActivityNotDestroyed(activity)) {<NEW_LINE>int errorCode = error != null ? error.getCode() : -1;<NEW_LINE>if (dialogType == LoginDialogType.VERIFY_EMAIL) {<NEW_LINE>progressBar.setVisibility(View.INVISIBLE);<NEW_LINE>if (status == BackupHelper.STATUS_SUCCESS) {<NEW_LINE>FragmentManager fragmentManager = activity.getSupportFragmentManager();<NEW_LINE>if (!fragmentManager.isStateSaved()) {<NEW_LINE>fragmentManager.popBackStack(BaseSettingsFragment.SettingsScreenType.BACKUP_AUTHORIZATION.name(), FragmentManager.POP_BACK_STACK_INCLUSIVE);<NEW_LINE>}<NEW_LINE>BackupAndRestoreFragment.showInstance(fragmentManager, signIn ? LoginDialogType.SIGN_IN : LoginDialogType.SIGN_UP);<NEW_LINE>} else {<NEW_LINE>errorText.setText(error != null ? error.getLocalizedError(app) : message);<NEW_LINE>buttonContinue.setEnabled(false);<NEW_LINE>AndroidUiHelper.updateVisibility(errorText, true);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (errorCode == dialogType.permittedErrorCode) {<NEW_LINE>registerUser();<NEW_LINE>} else if (errorCode != -1) {<NEW_LINE>progressBar.setVisibility(View.INVISIBLE);<NEW_LINE>if (errorCode == dialogType.warningErrorCode) {<NEW_LINE>errorText.setText(dialogType.warningId);<NEW_LINE>AndroidUiHelper.updateVisibility<MASK><NEW_LINE>} else {<NEW_LINE>errorText.setText(error.getLocalizedError(app));<NEW_LINE>}<NEW_LINE>buttonContinue.setEnabled(false);<NEW_LINE>AndroidUiHelper.updateVisibility(errorText, true);<NEW_LINE>}<NEW_LINE>AndroidUiHelper.updateVisibility(buttonChoosePlan, false);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (buttonAuthorize, !promoCodeSupported()); |
1,808,465 | public static String dumpMRPRecordsToString(final String message) {<NEW_LINE>// services<NEW_LINE>final IQueryBL queryBL = Services.get(IQueryBL.class);<NEW_LINE>final IMRPDAO mrpDAO = Services.get(IMRPDAO.class);<NEW_LINE>final IContextAware contextProvider = new PlainContextAware(Env.getCtx());<NEW_LINE>// String writer<NEW_LINE>final ByteArrayOutputStream baos = new ByteArrayOutputStream();<NEW_LINE>final PrintStream out = new PrintStream(baos);<NEW_LINE>final IQueryBuilder<I_PP_MRP> queryBuilder = queryBL.createQueryBuilder(I_PP_MRP.class, contextProvider);<NEW_LINE>queryBuilder.orderBy().addColumn(I_PP_MRP.COLUMNNAME_M_Product_ID).addColumn(I_PP_MRP.COLUMNNAME_AD_Org_ID).addColumn(I_PP_MRP.COLUMNNAME_S_Resource_ID).addColumn(I_PP_MRP.COLUMNNAME_M_Warehouse_ID).addColumn(I_PP_MRP.COLUMNNAME_PP_MRP_ID);<NEW_LINE>out.println("");<NEW_LINE>out.println("=========[ " + message + " ]===========================================================================");<NEW_LINE>IMRPSegment mrpSegmentPrevious = null;<NEW_LINE>BigDecimal qtyDemand = BigDecimal.ZERO;<NEW_LINE>BigDecimal qtySupply = BigDecimal.ZERO;<NEW_LINE>int mrpCountPerSegment = 0;<NEW_LINE>final List<I_PP_MRP> mrpsAll = queryBuilder.create().list();<NEW_LINE>for (final I_PP_MRP mrp : mrpsAll) {<NEW_LINE>final IMRPSegment mrpSegment = Services.get(IMRPBL.class).createMRPSegment(mrp);<NEW_LINE>// Check if segment changed<NEW_LINE>if (mrpSegmentPrevious != null && !mrpSegmentPrevious.equals(mrpSegment)) {<NEW_LINE>final BigDecimal qtyOnHand = mrpDAO.getQtyOnHand(contextProvider, mrpSegmentPrevious.getM_Warehouse(), mrpSegmentPrevious.getM_Product());<NEW_LINE>final BigDecimal qtyBalance = qtyDemand.subtract(qtySupply);<NEW_LINE>out.println("=> Totals: QtyDemand=" + qtyDemand + ", QtySupply=" + qtySupply + ", Balance=" + qtyBalance + ", QtyOnHand=" + qtyOnHand);<NEW_LINE>// reset<NEW_LINE>qtyDemand = BigDecimal.ZERO;<NEW_LINE>qtySupply = BigDecimal.ZERO;<NEW_LINE>mrpCountPerSegment = 0;<NEW_LINE>}<NEW_LINE>// Update Segment Aggregated values:<NEW_LINE>final String typeMRP = mrp.getTypeMRP();<NEW_LINE>final BigDecimal qty = mrp.getQty();<NEW_LINE>if (X_PP_MRP.TYPEMRP_Demand.equals(typeMRP)) {<NEW_LINE><MASK><NEW_LINE>} else if (X_PP_MRP.TYPEMRP_Supply.equals(typeMRP)) {<NEW_LINE>qtySupply = qtySupply.add(qty);<NEW_LINE>}<NEW_LINE>final String mrpStr = toString(mrp);<NEW_LINE>out.println(mrpStr);<NEW_LINE>mrpSegmentPrevious = mrpSegment;<NEW_LINE>mrpCountPerSegment++;<NEW_LINE>}<NEW_LINE>// Totals for last segment<NEW_LINE>if (mrpCountPerSegment > 0) {<NEW_LINE>final BigDecimal qtyOnHand = mrpDAO.getQtyOnHand(contextProvider, mrpSegmentPrevious.getM_Warehouse(), mrpSegmentPrevious.getM_Product());<NEW_LINE>final BigDecimal qtyBalance = qtyDemand.subtract(qtySupply);<NEW_LINE>out.println("=> Totals: QtyDemand=" + qtyDemand + ", QtySupply=" + qtySupply + ", Balance=" + qtyBalance + ", QtyOnHand=" + qtyOnHand);<NEW_LINE>// reset<NEW_LINE>qtyDemand = BigDecimal.ZERO;<NEW_LINE>qtySupply = BigDecimal.ZERO;<NEW_LINE>mrpCountPerSegment = 0;<NEW_LINE>}<NEW_LINE>out.println("======================================================================================================");<NEW_LINE>return baos.toString();<NEW_LINE>} | qtyDemand = qtyDemand.add(qty); |
588,152 | static final MethodHandle[] populateMHs(Class<?> type, ByteOrder byteOrder) {<NEW_LINE>Class<? extends ByteArrayViewVarHandleOperations> operationsClass = null;<NEW_LINE>boolean convertEndian = (byteOrder != ByteOrder.nativeOrder());<NEW_LINE>if (int.class == type) {<NEW_LINE>operationsClass = convertEndian <MASK><NEW_LINE>} else if (long.class == type) {<NEW_LINE>operationsClass = convertEndian ? OpLongConvertEndian.class : OpLong.class;<NEW_LINE>} else if (char.class == type) {<NEW_LINE>operationsClass = convertEndian ? OpCharConvertEndian.class : OpChar.class;<NEW_LINE>} else if (double.class == type) {<NEW_LINE>operationsClass = convertEndian ? OpDoubleConvertEndian.class : OpDouble.class;<NEW_LINE>} else if (float.class == type) {<NEW_LINE>operationsClass = convertEndian ? OpFloatConvertEndian.class : OpFloat.class;<NEW_LINE>} else if (short.class == type) {<NEW_LINE>operationsClass = convertEndian ? OpShortConvertEndian.class : OpShort.class;<NEW_LINE>} else { | ? OpIntConvertEndian.class : OpInt.class; |
1,484,933 | public void customize(Connector connector, HttpConfiguration channelConfig, Request request) {<NEW_LINE>EndPoint endp = request.getHttpChannel().getEndPoint();<NEW_LINE>if (endp instanceof DecryptedEndPoint) {<NEW_LINE>SslConnection.DecryptedEndPoint sslEndp = (DecryptedEndPoint) endp;<NEW_LINE><MASK><NEW_LINE>SSLEngine sslEngine = sslConnection.getSSLEngine();<NEW_LINE>customize(sslEngine, request);<NEW_LINE>request.setHttpURI(HttpURI.build(request.getHttpURI()).scheme(HttpScheme.HTTPS));<NEW_LINE>} else if (endp instanceof ProxyConnectionFactory.ProxyEndPoint) {<NEW_LINE>ProxyConnectionFactory.ProxyEndPoint proxy = (ProxyConnectionFactory.ProxyEndPoint) endp;<NEW_LINE>if (request.getHttpURI().getScheme() == null && proxy.getAttribute(ProxyConnectionFactory.TLS_VERSION) != null)<NEW_LINE>request.setHttpURI(HttpURI.build(request.getHttpURI()).scheme(HttpScheme.HTTPS));<NEW_LINE>}<NEW_LINE>if (HttpScheme.HTTPS.is(request.getScheme()))<NEW_LINE>customizeSecure(request);<NEW_LINE>} | SslConnection sslConnection = sslEndp.getSslConnection(); |
139,475 | @Authenticate(AccessType.CREATE)<NEW_LINE>@Produces(MediaType.APPLICATION_JSON)<NEW_LINE>@Consumes(MediaType.MULTIPART_FORM_DATA)<NEW_LINE>public String segmentCommitEndWithMetadata(@QueryParam(SegmentCompletionProtocol.PARAM_INSTANCE_ID) String instanceId, @QueryParam(SegmentCompletionProtocol.PARAM_SEGMENT_NAME) String segmentName, @QueryParam(SegmentCompletionProtocol.PARAM_SEGMENT_LOCATION) String segmentLocation, @QueryParam(SegmentCompletionProtocol.PARAM_OFFSET) long offset, @QueryParam(SegmentCompletionProtocol.PARAM_STREAM_PARTITION_MSG_OFFSET) String streamPartitionMsgOffset, @QueryParam(SegmentCompletionProtocol.PARAM_MEMORY_USED_BYTES) long memoryUsedBytes, @QueryParam(SegmentCompletionProtocol.PARAM_BUILD_TIME_MILLIS) long buildTimeMillis, @QueryParam(SegmentCompletionProtocol.PARAM_WAIT_TIME_MILLIS) long waitTimeMillis, @QueryParam(SegmentCompletionProtocol.PARAM_ROW_COUNT) int numRows, @QueryParam(SegmentCompletionProtocol.PARAM_SEGMENT_SIZE_BYTES) long segmentSizeBytes, FormDataMultiPart metadataFiles) {<NEW_LINE>if (instanceId == null || segmentName == null || segmentLocation == null || metadataFiles == null || (offset == -1 && streamPartitionMsgOffset == null)) {<NEW_LINE>LOGGER.error("Invalid call: offset={}, segmentName={}, instanceId={}, segmentLocation={}, streamPartitionMsgOffset={}", offset, segmentName, instanceId, segmentLocation, streamPartitionMsgOffset);<NEW_LINE>// TODO: memoryUsedInBytes = 0 if not present in params. Add validation when we start using it<NEW_LINE>return SegmentCompletionProtocol.RESP_FAILED.toJsonString();<NEW_LINE>}<NEW_LINE>SegmentCompletionProtocol.Request.Params requestParams = new SegmentCompletionProtocol.Request.Params();<NEW_LINE>requestParams.withInstanceId(instanceId).withSegmentName(segmentName).withSegmentLocation(segmentLocation).withSegmentSizeBytes(segmentSizeBytes).withBuildTimeMillis(buildTimeMillis).withWaitTimeMillis(waitTimeMillis).withNumRows(numRows).withMemoryUsedBytes(memoryUsedBytes);<NEW_LINE>extractOffsetFromParams(requestParams, streamPartitionMsgOffset, offset);<NEW_LINE>LOGGER.info("Processing segmentCommitEndWithMetadata:{}", requestParams.toString());<NEW_LINE>SegmentMetadataImpl segmentMetadata;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error("Caught exception while extracting metadata for segment: {} from instance: {}", segmentName, instanceId, e);<NEW_LINE>return SegmentCompletionProtocol.RESP_FAILED.toJsonString();<NEW_LINE>}<NEW_LINE>final boolean isSuccess = true;<NEW_LINE>final boolean isSplitCommit = true;<NEW_LINE>SegmentCompletionProtocol.Response response = _segmentCompletionManager.segmentCommitEnd(requestParams, isSuccess, isSplitCommit, CommittingSegmentDescriptor.fromSegmentCompletionReqParamsAndMetadata(requestParams, segmentMetadata));<NEW_LINE>final String responseStr = response.toJsonString();<NEW_LINE>LOGGER.info("Response to segmentCommitEndWithMetadata for segment:{} is:{}", segmentName, responseStr);<NEW_LINE>return responseStr;<NEW_LINE>} | segmentMetadata = extractSegmentMetadataFromForm(metadataFiles, segmentName); |
1,619,760 | ImmutableMap<String, ImmutableSet<QueryTarget>> resolveTargetPatterns(Iterable<String> patterns) throws InterruptedException, BuildFileParseException, IOException {<NEW_LINE>ImmutableMap.Builder<String, ImmutableSet<QueryTarget>> resolved = ImmutableMap.builder();<NEW_LINE>Map<String, String> unresolved = new HashMap<>();<NEW_LINE>for (String pattern : patterns) {<NEW_LINE>// First check if this pattern was resolved before.<NEW_LINE>ImmutableSet<QueryTarget> targets = resolvedTargets.get(pattern);<NEW_LINE>if (targets != null) {<NEW_LINE>resolved.put(pattern, targets);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// Check if this is an alias.<NEW_LINE>ImmutableSet<UnconfiguredBuildTarget> aliasTargets = AliasConfig.from(buckConfig).getBuildTargetsForAlias(pattern);<NEW_LINE>if (!aliasTargets.isEmpty()) {<NEW_LINE>for (UnconfiguredBuildTarget alias : aliasTargets) {<NEW_LINE>unresolved.put(alias.getFullyQualifiedName(), pattern);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// Check if the pattern corresponds to a build target or a path.<NEW_LINE>// Note: If trying to get a path with a single ':' in it, this /will/ choose to assume a<NEW_LINE>// build target, not a file. In general, this is okay as:<NEW_LINE>// 1) Most of our functions that take paths are going to be build files and the like, not<NEW_LINE>// something with a ':' in it<NEW_LINE>// 2) By putting a ':' in the filename, you're already dooming yourself to never work on<NEW_LINE>// windows. Don't do that.<NEW_LINE>if (pattern.contains("//") || pattern.contains(":") || pattern.endsWith("/...") || pattern.equals("...")) {<NEW_LINE>unresolved.put(pattern, pattern);<NEW_LINE>} else {<NEW_LINE>ImmutableSet<QueryTarget> fileTargets = resolveFilePattern(pattern);<NEW_LINE>resolved.put(pattern, fileTargets);<NEW_LINE>resolvedTargets.put(pattern, fileTargets);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Resolve any remaining target patterns using the parser.<NEW_LINE>ImmutableMap<String, ImmutableSet<QueryTarget>> results = MoreMaps.transformKeys(resolveBuildTargetPatterns(ImmutableList.copyOf(unresolved.keySet()))<MASK><NEW_LINE>resolved.putAll(results);<NEW_LINE>resolvedTargets.putAll(results);<NEW_LINE>return resolved.build();<NEW_LINE>} | , Functions.forMap(unresolved)); |
1,726,390 | private void inlineArguments() {<NEW_LINE>int valueType = type.getValueType();<NEW_LINE>int l = args.length;<NEW_LINE>int count = l;<NEW_LINE>for (int i = 0; i < l; i++) {<NEW_LINE>Expression arg = args[i];<NEW_LINE>if (arg instanceof ConcatenationOperation && arg.getType().getValueType() == valueType) {<NEW_LINE>count += arg.getSubexpressionCount() - 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (count > l) {<NEW_LINE>Expression[<MASK><NEW_LINE>for (int i = 0, offset = 0; i < l; i++) {<NEW_LINE>Expression arg = args[i];<NEW_LINE>if (arg instanceof ConcatenationOperation && arg.getType().getValueType() == valueType) {<NEW_LINE>ConcatenationOperation c = (ConcatenationOperation) arg;<NEW_LINE>Expression[] innerArgs = c.args;<NEW_LINE>int innerLength = innerArgs.length;<NEW_LINE>System.arraycopy(innerArgs, 0, newArguments, offset, innerLength);<NEW_LINE>offset += innerLength;<NEW_LINE>} else {<NEW_LINE>newArguments[offset++] = arg;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>args = newArguments;<NEW_LINE>argsCount = count;<NEW_LINE>}<NEW_LINE>} | ] newArguments = new Expression[count]; |
846,218 | public EnvironmentVariable unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>EnvironmentVariable environmentVariable = new EnvironmentVariable();<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("name", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>environmentVariable.setName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("value", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>environmentVariable.setValue(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("type", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>environmentVariable.setType(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return environmentVariable;<NEW_LINE>} | class).unmarshall(context)); |
182,689 | public okhttp3.Call connectPostNamespacedServiceProxyCall(String name, String namespace, String path, final ApiCallback _callback) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/api/v1/namespaces/{namespace}/services/{name}/proxy".replaceAll("\\{" + "name" + "\\}", localVarApiClient.escapeString(name.toString())).replaceAll("\\{" + "namespace" + "\\}", localVarApiClient.escapeString(namespace.toString()));<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();<NEW_LINE>if (path != null) {<NEW_LINE>localVarQueryParams.addAll(localVarApiClient.parameterToPair("path", path));<NEW_LINE>}<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, String> localVarCookieParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>final String[] localVarAccepts = { "*/*" };<NEW_LINE>final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>if (localVarAccept != null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>localVarHeaderParams.put("Content-Type", localVarContentType);<NEW_LINE>String[] localVarAuthNames = new String[] { "BearerToken" };<NEW_LINE>return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);<NEW_LINE>} | localVarHeaderParams.put("Accept", localVarAccept); |
597,246 | public static DescribeParameterGroupsResponse unmarshall(DescribeParameterGroupsResponse describeParameterGroupsResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeParameterGroupsResponse.setRequestId(_ctx.stringValue("DescribeParameterGroupsResponse.RequestId"));<NEW_LINE>describeParameterGroupsResponse.setSignalForOptimizeParams(_ctx.booleanValue("DescribeParameterGroupsResponse.SignalForOptimizeParams"));<NEW_LINE>List<ParameterGroup> parameterGroups = new ArrayList<ParameterGroup>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeParameterGroupsResponse.ParameterGroups.Length"); i++) {<NEW_LINE>ParameterGroup parameterGroup = new ParameterGroup();<NEW_LINE>parameterGroup.setParameterGroupType(_ctx.integerValue("DescribeParameterGroupsResponse.ParameterGroups[" + i + "].ParameterGroupType"));<NEW_LINE>parameterGroup.setParameterGroupName(_ctx.stringValue("DescribeParameterGroupsResponse.ParameterGroups[" + i + "].ParameterGroupName"));<NEW_LINE>parameterGroup.setParamCounts(_ctx.integerValue("DescribeParameterGroupsResponse.ParameterGroups[" + i + "].ParamCounts"));<NEW_LINE>parameterGroup.setParameterGroupDesc(_ctx.stringValue<MASK><NEW_LINE>parameterGroup.setForceRestart(_ctx.integerValue("DescribeParameterGroupsResponse.ParameterGroups[" + i + "].ForceRestart"));<NEW_LINE>parameterGroup.setEngine(_ctx.stringValue("DescribeParameterGroupsResponse.ParameterGroups[" + i + "].Engine"));<NEW_LINE>parameterGroup.setEngineVersion(_ctx.stringValue("DescribeParameterGroupsResponse.ParameterGroups[" + i + "].EngineVersion"));<NEW_LINE>parameterGroup.setCreateTime(_ctx.stringValue("DescribeParameterGroupsResponse.ParameterGroups[" + i + "].CreateTime"));<NEW_LINE>parameterGroup.setUpdateTime(_ctx.stringValue("DescribeParameterGroupsResponse.ParameterGroups[" + i + "].UpdateTime"));<NEW_LINE>parameterGroup.setParameterGroupId(_ctx.stringValue("DescribeParameterGroupsResponse.ParameterGroups[" + i + "].ParameterGroupId"));<NEW_LINE>parameterGroups.add(parameterGroup);<NEW_LINE>}<NEW_LINE>describeParameterGroupsResponse.setParameterGroups(parameterGroups);<NEW_LINE>return describeParameterGroupsResponse;<NEW_LINE>} | ("DescribeParameterGroupsResponse.ParameterGroups[" + i + "].ParameterGroupDesc")); |
1,536,906 | @Produces(MediaType.APPLICATION_JSON)<NEW_LINE>public List<KeyValueBean> windowedByKey(@PathParam("storeName") final String storeName, @PathParam("key") final String key, @PathParam("from") final Long from, @PathParam("to") final Long to) {<NEW_LINE>// Lookup the WindowStore with the provided storeName<NEW_LINE>final ReadOnlyWindowStore<String, Long> store = streams.store(fromNameAndType(storeName, QueryableStoreTypes.windowStore()));<NEW_LINE>if (store == null) {<NEW_LINE>throw new NotFoundException();<NEW_LINE>}<NEW_LINE>// fetch the window results for the given key and time range<NEW_LINE>final WindowStoreIterator<Long> results = store.fetch(key, Instant.ofEpochMilli(from)<MASK><NEW_LINE>final List<KeyValueBean> windowResults = new ArrayList<>();<NEW_LINE>while (results.hasNext()) {<NEW_LINE>final KeyValue<Long, Long> next = results.next();<NEW_LINE>// convert the result to have the window time and the key (for display purposes)<NEW_LINE>windowResults.add(new KeyValueBean(key + "@" + next.key, next.value));<NEW_LINE>}<NEW_LINE>return windowResults;<NEW_LINE>} | , Instant.ofEpochMilli(to)); |
1,124,456 | public boolean canSync(@Nonnull IPermissionContainer targetChannel, @Nonnull IPermissionContainer syncSource) {<NEW_LINE>Checks.notNull(targetChannel, "Channel");<NEW_LINE>Checks.notNull(syncSource, "Channel");<NEW_LINE>Checks.check(targetChannel.getGuild().equals(getGuild()), "Channels must be from the same guild!");<NEW_LINE>Checks.check(syncSource.getGuild().equals(getGuild()), "Channels must be from the same guild!");<NEW_LINE>long rolePerms = PermissionUtil.getEffectivePermission(targetChannel, this);<NEW_LINE>if ((rolePerms & Permission.MANAGE_PERMISSIONS.getRawValue()) == 0)<NEW_LINE>// Role can't manage permissions at all!<NEW_LINE>return false;<NEW_LINE>long channelPermissions = PermissionUtil.getExplicitPermission(targetChannel, this, false);<NEW_LINE>// If the role has ADMINISTRATOR or MANAGE_PERMISSIONS then it can also set any other permission on the channel<NEW_LINE>boolean hasLocalAdmin = ((rolePerms & Permission.ADMINISTRATOR.getRawValue()) | (channelPermissions & Permission.MANAGE_PERMISSIONS.getRawValue())) != 0;<NEW_LINE>if (hasLocalAdmin)<NEW_LINE>return true;<NEW_LINE>TLongObjectMap<PermissionOverride> existingOverrides = ((IPermissionContainerMixin<?<MASK><NEW_LINE>for (PermissionOverride override : syncSource.getPermissionOverrides()) {<NEW_LINE>PermissionOverride existing = existingOverrides.get(override.getIdLong());<NEW_LINE>long allow = override.getAllowedRaw();<NEW_LINE>long deny = override.getDeniedRaw();<NEW_LINE>if (existing != null) {<NEW_LINE>allow ^= existing.getAllowedRaw();<NEW_LINE>deny ^= existing.getDeniedRaw();<NEW_LINE>}<NEW_LINE>// If any permissions changed that the role doesn't have in the channel, the role can't sync it :(<NEW_LINE>if (((allow | deny) & ~rolePerms) != 0)<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | >) targetChannel).getPermissionOverrideMap(); |
727,875 | public Object list(DataCommandsParam dataCommandsParam) {<NEW_LINE>jedis.select(dataCommandsParam.getDatabase());<NEW_LINE><MASK><NEW_LINE>String[] list = SignUtil.splitBySpace(command);<NEW_LINE>String cmd = command.toUpperCase();<NEW_LINE>String key = list[1];<NEW_LINE>String[] items = removeCommandAndKey(list);<NEW_LINE>Object result = null;<NEW_LINE>if (cmd.startsWith(LPUSH)) {<NEW_LINE>result = jedis.lpush(key, items);<NEW_LINE>} else if (cmd.startsWith(RPUSH)) {<NEW_LINE>result = jedis.rpush(key, items);<NEW_LINE>} else if (cmd.startsWith(LINDEX)) {<NEW_LINE>result = jedis.lindex(key, Integer.parseInt(list[2]));<NEW_LINE>} else if (cmd.startsWith(LLEN)) {<NEW_LINE>result = jedis.llen(key);<NEW_LINE>} else if (cmd.startsWith(LRANGE)) {<NEW_LINE>int start = Integer.parseInt(list[2]);<NEW_LINE>int stop = Integer.parseInt(list[3]);<NEW_LINE>result = jedis.lrange(key, start, stop);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | String command = dataCommandsParam.getCommand(); |
1,696,312 | public Response safeHandle(HttpRequest request) throws JSONException {<NEW_LINE>SelendroidLogger.info("execute script command");<NEW_LINE>JSONObject payload = getPayload(request);<NEW_LINE>String script = payload.getString("script");<NEW_LINE>JSONArray args = payload.optJSONArray("args");<NEW_LINE>Object value = null;<NEW_LINE>try {<NEW_LINE>value = getSelendroidDriver(request).executeAsyncScript(script, args);<NEW_LINE>} catch (io.selendroid.server.common.exceptions.UnsupportedOperationException e) {<NEW_LINE>return new SelendroidResponse(getSessionId(request), StatusCode.UNKNOWN_ERROR, e);<NEW_LINE>}<NEW_LINE>if (value instanceof String) {<NEW_LINE>String result = (String) value;<NEW_LINE>if (result.contains("value")) {<NEW_LINE>JSONObject json = new JSONObject(result);<NEW_LINE>int status = json.optInt("status");<NEW_LINE>if (0 != status) {<NEW_LINE>return new SelendroidResponse(getSessionId(request), StatusCode.fromInteger(status), new SelendroidException(json.optString("value")));<NEW_LINE>}<NEW_LINE>if (json.isNull("value")) {<NEW_LINE>return new SelendroidResponse<MASK><NEW_LINE>} else {<NEW_LINE>return new SelendroidResponse(getSessionId(request), json.get("value"));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new SelendroidResponse(getSessionId(request), value);<NEW_LINE>} | (getSessionId(request), null); |
62,248 | public AlterTableGroupItemPreparedData createAlterTableGroupItemPreparedData(String tableName, List<GroupDetailInfoExRecord> groupDetailInfoExRecords) {<NEW_LINE>AlterTableGroupItemPreparedData alterTableGroupItemPreparedData = new AlterTableGroupItemPreparedData(preparedData.getSchemaName(), tableName);<NEW_LINE>PartitionInfo partitionInfo = OptimizerContext.getContext(preparedData.getSchemaName()).getPartitionInfoManager().getPartitionInfo(tableName);<NEW_LINE>PartitionSpec partitionSpec = partitionInfo.getPartitionBy().getPartitions().get(0);<NEW_LINE>alterTableGroupItemPreparedData.setDefaultPartitionSpec(partitionSpec);<NEW_LINE>alterTableGroupItemPreparedData.setGroupDetailInfoExRecords(groupDetailInfoExRecords);<NEW_LINE>alterTableGroupItemPreparedData.setTableGroupName(preparedData.getTableGroupName());<NEW_LINE>alterTableGroupItemPreparedData.setNewPhyTables(getNewPhyTables(tableName));<NEW_LINE>// here the oldPartition is tread as the source table of backfill task<NEW_LINE>alterTableGroupItemPreparedData.setOldPartitionNames(preparedData.getNewPartitionNames());<NEW_LINE>alterTableGroupItemPreparedData.setNewPartitionNames(preparedData.getNewPartitionNames());<NEW_LINE>alterTableGroupItemPreparedData.<MASK><NEW_LINE>alterTableGroupItemPreparedData.setTaskType(preparedData.getTaskType());<NEW_LINE>String primaryTableName;<NEW_LINE>TableMeta tableMeta = executionContext.getSchemaManager(preparedData.getSchemaName()).getTable(tableName);<NEW_LINE>if (tableMeta.isGsi()) {<NEW_LINE>// all the gsi table version change will be behavior by primary table<NEW_LINE>assert tableMeta.getGsiTableMetaBean() != null && tableMeta.getGsiTableMetaBean().gsiMetaBean != null;<NEW_LINE>primaryTableName = tableMeta.getGsiTableMetaBean().gsiMetaBean.tableName;<NEW_LINE>} else {<NEW_LINE>primaryTableName = tableName;<NEW_LINE>}<NEW_LINE>alterTableGroupItemPreparedData.setPrimaryTableName(primaryTableName);<NEW_LINE>alterTableGroupItemPreparedData.setTableVersion(executionContext.getSchemaManager(preparedData.getSchemaName()).getTable(primaryTableName).getVersion());<NEW_LINE>return alterTableGroupItemPreparedData;<NEW_LINE>} | setInvisiblePartitionGroups(preparedData.getInvisiblePartitionGroups()); |
1,378,420 | public void CheckForInner(String fileName, int line, String script) {<NEW_LINE>String lower = script.toLowerCase(Locale.ROOT);<NEW_LINE>int column = lower.indexOf("innerhtml");<NEW_LINE>if (column >= 0) {<NEW_LINE>report.message(MessageId.SCP_007, EPUBLocation.create(fileName, line, column, trimContext(script, column)));<NEW_LINE>}<NEW_LINE>column = lower.indexOf("innertext");<NEW_LINE>if (column >= 0) {<NEW_LINE>report.message(MessageId.SCP_008, EPUBLocation.create(fileName, line, column, trimContext(script, column)));<NEW_LINE>}<NEW_LINE>// the exact pattern is very complex and it slows down all script checking.<NEW_LINE>// what we can do here is use a blunt check (for the word "eval"). if it is not found, keep moving.<NEW_LINE>// If it is found, look closely using the exact pattern to see if the line truly matches the exact eval() function and report that.<NEW_LINE>Matcher m = null;<NEW_LINE>if (script.contains("eval")) {<NEW_LINE>m = <MASK><NEW_LINE>if (m.find()) {<NEW_LINE>report.message(MessageId.SCP_001, EPUBLocation.create(fileName, line, m.start(0), trimContext(script, m.start())));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>m = ScriptTagHandler.localStoragePattern.matcher(script);<NEW_LINE>if (m.find()) {<NEW_LINE>report.message(MessageId.SCP_003, EPUBLocation.create(fileName, line, m.start(0), trimContext(script, m.start())));<NEW_LINE>}<NEW_LINE>m = ScriptTagHandler.sessionStoragePattern.matcher(script);<NEW_LINE>if (m.find()) {<NEW_LINE>report.message(MessageId.SCP_003, EPUBLocation.create(fileName, line, m.start(0), trimContext(script, m.start())));<NEW_LINE>}<NEW_LINE>m = ScriptTagHandler.xmlHttpRequestPattern.matcher(script);<NEW_LINE>if (m.find()) {<NEW_LINE>report.message(MessageId.SCP_002, EPUBLocation.create(fileName, line, m.start(0), trimContext(script, m.start())));<NEW_LINE>}<NEW_LINE>m = ScriptTagHandler.microsoftXmlHttpRequestPattern.matcher(script);<NEW_LINE>if (m.find()) {<NEW_LINE>report.message(MessageId.SCP_002, EPUBLocation.create(fileName, line, m.start(0), trimContext(script, m.start())));<NEW_LINE>}<NEW_LINE>} | ScriptTagHandler.evalPattern.matcher(script); |
804,029 | public void onRegisterUser(int status, @Nullable String message, @Nullable BackupError error) {<NEW_LINE>FragmentActivity activity = getActivity();<NEW_LINE>if (AndroidUtils.isActivityNotDestroyed(activity)) {<NEW_LINE>progressBar.setVisibility(View.INVISIBLE);<NEW_LINE>if (status == BackupHelper.STATUS_SUCCESS) {<NEW_LINE>lastTimeCodeSent = System.currentTimeMillis();<NEW_LINE>setDialogType(LoginDialogType.VERIFY_EMAIL);<NEW_LINE>updateContent();<NEW_LINE>} else {<NEW_LINE>boolean choosePlanVisible = false;<NEW_LINE>if (error != null) {<NEW_LINE>int code = error.getCode();<NEW_LINE>choosePlanVisible = !promoCodeSupported() && (code == SERVER_ERROR_CODE_NO_VALID_SUBSCRIPTION || code == SERVER_ERROR_CODE_USER_IS_NOT_REGISTERED || code == SERVER_ERROR_CODE_SUBSCRIPTION_WAS_EXPIRED_OR_NOT_PRESENT);<NEW_LINE>}<NEW_LINE>errorText.setText(error != null ? error.getLocalizedError(app) : message);<NEW_LINE>buttonContinue.setEnabled(false);<NEW_LINE><MASK><NEW_LINE>AndroidUiHelper.updateVisibility(buttonChoosePlan, choosePlanVisible);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | AndroidUiHelper.updateVisibility(errorText, true); |
827,364 | protected ItemStack run(ItemStack stack, LootContext context) {<NEW_LINE>if (TinkerTags.Items.MODIFIABLE.contains(stack.getItem())) {<NEW_LINE>ToolStack tool = ToolStack.from(stack);<NEW_LINE><MASK><NEW_LINE>if (definition.isMultipart() && !materials.isEmpty()) {<NEW_LINE>MaterialNBT.Builder builder = MaterialNBT.builder();<NEW_LINE>Random random = context.getRandom();<NEW_LINE>for (RandomMaterial material : materials) {<NEW_LINE>builder.add(material.getMaterial(random));<NEW_LINE>}<NEW_LINE>tool.setMaterials(builder.build());<NEW_LINE>} else {<NEW_LINE>// not multipart? no sense doing materials, just initialize stats<NEW_LINE>tool.rebuildStats();<NEW_LINE>}<NEW_LINE>// set damage last to a percentage of max damage if requested<NEW_LINE>if (damage > 0) {<NEW_LINE>tool.setDamage((int) (tool.getStats().get(ToolStats.DURABILITY) * damage));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return stack;<NEW_LINE>} | ToolDefinition definition = tool.getDefinition(); |
763,693 | public void showForgotDialog() {<NEW_LINE>Resources res = getResources();<NEW_LINE>// Create the builder with required paramaters - Context, Title, Positive Text<NEW_LINE>CustomDialog.Builder builder = new CustomDialog.Builder(this, res.getString(R.string.activity_dialog_title), res.getString(R.string.activity_dialog_accept));<NEW_LINE>builder.content(res.getString(R.string.activity_dialog_content));<NEW_LINE>builder.negativeText(res.getString(R.string.activity_dialog_decline));<NEW_LINE>// Set theme<NEW_LINE>builder.darkTheme(false);<NEW_LINE>builder.typeface(Typeface.SANS_SERIF);<NEW_LINE>// int res, or int colorRes parameter versions available as well.<NEW_LINE>builder.positiveColor(res.getColor(R.color.light_blue_500));<NEW_LINE>builder.negativeColor(res.getColor(R.color.light_blue_500));<NEW_LINE>// Enables right to left positioning for languages that may require so.<NEW_LINE>builder.rightToLeft(false);<NEW_LINE>builder.titleAlignment(BaseDialog.Alignment.CENTER);<NEW_LINE>builder.<MASK><NEW_LINE>builder.setButtonStacking(false);<NEW_LINE>// Set text sizes<NEW_LINE>builder.titleTextSize((int) res.getDimension(R.dimen.activity_dialog_title_size));<NEW_LINE>builder.contentTextSize((int) res.getDimension(R.dimen.activity_dialog_content_size));<NEW_LINE>builder.positiveButtonTextSize((int) res.getDimension(R.dimen.activity_dialog_positive_button_size));<NEW_LINE>builder.negativeButtonTextSize((int) res.getDimension(R.dimen.activity_dialog_negative_button_size));<NEW_LINE>// Build the dialog.<NEW_LINE>CustomDialog customDialog = builder.build();<NEW_LINE>customDialog.setCanceledOnTouchOutside(false);<NEW_LINE>customDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));<NEW_LINE>customDialog.setClickListener(new CustomDialog.ClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onConfirmClick() {<NEW_LINE>Toast.makeText(getApplicationContext(), "Yes", Toast.LENGTH_SHORT).show();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onCancelClick() {<NEW_LINE>Toast.makeText(getApplicationContext(), "Cancel", Toast.LENGTH_SHORT).show();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// Show the dialog.<NEW_LINE>customDialog.show();<NEW_LINE>} | buttonAlignment(BaseDialog.Alignment.CENTER); |
1,071,106 | public PointSensitivityBuilder presentValueSensitivityRatesStickyModel(IborCapletFloorletPeriod period, RatesProvider ratesProvider, SabrIborCapletFloorletVolatilities volatilities) {<NEW_LINE>Currency currency = period.getCurrency();<NEW_LINE>if (ratesProvider.getValuationDate().isAfter(period.getPaymentDate())) {<NEW_LINE>return PointSensitivityBuilder.none();<NEW_LINE>}<NEW_LINE>double expiry = volatilities.<MASK><NEW_LINE>PutCall putCall = period.getPutCall();<NEW_LINE>double strike = period.getStrike();<NEW_LINE>double indexRate = ratesProvider.iborIndexRates(period.getIndex()).rate(period.getIborRate().getObservation());<NEW_LINE>PointSensitivityBuilder dfSensi = ratesProvider.discountFactors(currency).zeroRatePointSensitivity(period.getPaymentDate());<NEW_LINE>double factor = period.getNotional() * period.getYearFraction();<NEW_LINE>if (expiry < 0d) {<NEW_LINE>// option expired already, but not yet paid<NEW_LINE>double sign = putCall.isCall() ? 1d : -1d;<NEW_LINE>double payoff = Math.max(sign * (indexRate - strike), 0d);<NEW_LINE>return dfSensi.multipliedBy(payoff * factor);<NEW_LINE>}<NEW_LINE>ValueDerivatives volatilityAdj = volatilities.volatilityAdjoint(expiry, strike, indexRate);<NEW_LINE>PointSensitivityBuilder indexRateSensiSensi = ratesProvider.iborIndexRates(period.getIndex()).ratePointSensitivity(period.getIborRate().getObservation());<NEW_LINE>double df = ratesProvider.discountFactor(currency, period.getPaymentDate());<NEW_LINE>double fwdPv = factor * volatilities.price(expiry, putCall, strike, indexRate, volatilityAdj.getValue());<NEW_LINE>double fwdDelta = factor * volatilities.priceDelta(expiry, putCall, strike, indexRate, volatilityAdj.getValue());<NEW_LINE>double fwdVega = factor * volatilities.priceVega(expiry, putCall, strike, indexRate, volatilityAdj.getValue());<NEW_LINE>return dfSensi.multipliedBy(fwdPv).combinedWith(indexRateSensiSensi.multipliedBy(fwdDelta * df + fwdVega * volatilityAdj.getDerivative(0) * df));<NEW_LINE>} | relativeTime(period.getFixingDateTime()); |
575,307 | public static void clearSelectionCache(TileMap tileMap) {<NEW_LINE>if (tileMap.isSelectionInverted()) {<NEW_LINE>SelectionData selection = new SelectionData(tileMap.getMarkedChunks(<MASK><NEW_LINE>File[] cacheDirs = Config.getCacheDirs();<NEW_LINE>for (File cacheDir : cacheDirs) {<NEW_LINE>File[] cacheFiles = cacheDir.listFiles((dir, name) -> name.matches("^r\\.-?\\d+\\.-?\\d+\\.png$"));<NEW_LINE>if (cacheFiles == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>for (File cacheFile : cacheFiles) {<NEW_LINE>Point2i cacheRegion = FileHelper.parseCacheFileName(cacheFile);<NEW_LINE>if (selection.isRegionSelected(cacheRegion) && cacheFile.exists()) {<NEW_LINE>if (!cacheFile.delete()) {<NEW_LINE>Debug.error("could not delete file " + cacheFile);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>tileMap.clearTile(cacheRegion.asLong());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Long2ObjectOpenHashMap<LongOpenHashSet> trueSelection = SelectionHelper.getTrueSelection(selection);<NEW_LINE>for (long region : trueSelection.keySet()) {<NEW_LINE>tileMap.getOverlayPool().discardData(new Point2i(region));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>for (Long2ObjectMap.Entry<LongOpenHashSet> entry : tileMap.getMarkedChunks().long2ObjectEntrySet()) {<NEW_LINE>Point2i region = new Point2i(entry.getLongKey());<NEW_LINE>for (File cacheDir : Config.getCacheDirs()) {<NEW_LINE>File file = FileHelper.createPNGFilePath(cacheDir, region);<NEW_LINE>if (file.exists()) {<NEW_LINE>if (!file.delete()) {<NEW_LINE>Debug.error("could not delete file " + file);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>tileMap.clearTile(entry.getLongKey());<NEW_LINE>}<NEW_LINE>tileMap.getOverlayPool().discardData(region);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>RegionImageGenerator.invalidateCachedMCAFiles();<NEW_LINE>tileMap.draw();<NEW_LINE>} | ), tileMap.isSelectionInverted()); |
1,451,026 | public Object proxyAround(ProceedingJoinPoint point) {<NEW_LINE>try {<NEW_LINE>MethodSignature ms = <MASK><NEW_LINE>Method method = ms.getMethod();<NEW_LINE>DePermissionProxy annotation = method.getAnnotation(DePermissionProxy.class);<NEW_LINE>Object[] args = point.getArgs();<NEW_LINE>if (null == args || args.length == 0) {<NEW_LINE>return point.proceed(args);<NEW_LINE>}<NEW_LINE>Object arg = point.getArgs()[annotation.paramIndex()];<NEW_LINE>PermissionProxy proxy = getProxy(arg, annotation, 0);<NEW_LINE>if (null != proxy && null != proxy.getUserId()) {<NEW_LINE>AuthUtils.setProxyUser(proxy.getUserId());<NEW_LINE>}<NEW_LINE>return point.proceed(args);<NEW_LINE>} catch (Throwable throwable) {<NEW_LINE>LogUtil.error(throwable.getMessage(), throwable);<NEW_LINE>throw new RuntimeException(throwable.getMessage());<NEW_LINE>} finally {<NEW_LINE>AuthUtils.cleanProxyUser();<NEW_LINE>}<NEW_LINE>} | (MethodSignature) point.getSignature(); |
829,032 | public final boolean accept(EdgeIteratorState iter) {<NEW_LINE>if (env == null)<NEW_LINE>return true;<NEW_LINE>boolean inEnv = false;<NEW_LINE>// PointList pl = iter.fetchWayGeometry(2); // does not work<NEW_LINE>PointList pl = iter.fetchWayGeometry(3);<NEW_LINE><MASK><NEW_LINE>double eMinX = Double.MAX_VALUE;<NEW_LINE>double eMinY = Double.MAX_VALUE;<NEW_LINE>double eMaxX = Double.MIN_VALUE;<NEW_LINE>double eMaxY = Double.MIN_VALUE;<NEW_LINE>for (int j = 0; j < pl.getSize(); j++) {<NEW_LINE>double x = pl.getLon(j);<NEW_LINE>double y = pl.getLat(j);<NEW_LINE>if (env.contains(x, y)) {<NEW_LINE>inEnv = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (x < eMinX)<NEW_LINE>eMinX = x;<NEW_LINE>if (y < eMinY)<NEW_LINE>eMinY = y;<NEW_LINE>if (x > eMaxX)<NEW_LINE>eMaxX = x;<NEW_LINE>if (y > eMaxY)<NEW_LINE>eMaxY = y;<NEW_LINE>}<NEW_LINE>if (inEnv || !(eMinX > env.getMaxX() || eMaxX < env.getMinX() || eMinY > env.getMaxY() || eMaxY < env.getMinY())) {<NEW_LINE>// We have to reset the coordinate sequence else for some reason the envelopes for the edge are wrong<NEW_LINE>coordSequence = new DefaultCoordinateSequence(new Coordinate[1], 1);<NEW_LINE>if (size >= 2) {<NEW_LINE>// resize sequence if needed<NEW_LINE>coordSequence.resize(size);<NEW_LINE>for (int j = 0; j < size; j++) {<NEW_LINE>double x = pl.getLon(j);<NEW_LINE>double y = pl.getLat(j);<NEW_LINE>Coordinate c = coordSequence.getCoordinate(j);<NEW_LINE>if (c == null) {<NEW_LINE>c = new Coordinate(x, y);<NEW_LINE>coordSequence.setCoordinate(j, c);<NEW_LINE>} else {<NEW_LINE>c.x = x;<NEW_LINE>c.y = y;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>LineString ls = geomFactory.createLineString(coordSequence);<NEW_LINE>for (int i = 0; i < polys.length; i++) {<NEW_LINE>Polygon poly = polys[i];<NEW_LINE>if (poly.contains(ls) || ls.crosses(poly)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | int size = pl.getSize(); |
1,440,571 | private String generateContents() {<NEW_LINE>try {<NEW_LINE>// NOI18N<NEW_LINE>Document doc = XMLUtil.createDocument("project", null, null, null);<NEW_LINE>Element pel = doc.getDocumentElement();<NEW_LINE>String displayName = (String) getProperty(PROP_DISPLAY_NAME);<NEW_LINE>if (displayName != null && displayName.length() > 0) {<NEW_LINE>// NOI18N<NEW_LINE>pel.setAttribute("name", displayName);<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>pel.setAttribute("default", "run");<NEW_LINE>// NOI18N<NEW_LINE>Element tel = doc.createElement("target");<NEW_LINE>// NOI18N<NEW_LINE>tel.setAttribute("name", "run");<NEW_LINE>// NOI18N<NEW_LINE>Element ael = doc.createElement("ant");<NEW_LINE>// NOI18N<NEW_LINE>ael.setAttribute("antfile", project.getFile().getAbsolutePath());<NEW_LINE>// #34802: let the child project decide on the basedir:<NEW_LINE>// NOI18N<NEW_LINE>ael.setAttribute("inheritall", "false");<NEW_LINE>// NOI18N<NEW_LINE>ael.setAttribute("target", target.getAttribute("name"));<NEW_LINE>tel.appendChild(ael);<NEW_LINE>pel.appendChild(tel);<NEW_LINE>ByteArrayOutputStream baos = new ByteArrayOutputStream(1000);<NEW_LINE>// NOI18N<NEW_LINE>XMLUtil.<MASK><NEW_LINE>// NOI18N<NEW_LINE>return baos.toString("UTF-8");<NEW_LINE>} catch (IOException e) {<NEW_LINE>AntModule.err.notify(e);<NEW_LINE>// NOI18N<NEW_LINE>return "";<NEW_LINE>}<NEW_LINE>} | write(doc, baos, "UTF-8"); |
1,643,920 | // End of variables declaration//GEN-END:variables<NEW_LINE>public static FileObject showDialog(SourceGroup[] folders) {<NEW_LINE>BrowseFolders bf = new BrowseFolders(folders);<NEW_LINE>JButton[] options = new JButton[] { // new JButton( NbBundle.getMessage( BrowseFolders.class, "LBL_BrowseFolders_Select_Option") ), // NOI18N<NEW_LINE>// new JButton( NbBundle.getMessage( BrowseFolders.class, "LBL_BrowseFolders_Cancel_Option") ), // NOI18N<NEW_LINE>new JButton(NbBundle.getMessage(BrowseFolders.class, "LBL_SelectFile")), new JButton(NbBundle.getMessage(BrowseFolders.class, "LBL_Cancel")) };<NEW_LINE>OptionsListener optionsListener = new OptionsListener(bf);<NEW_LINE>options[0].setActionCommand(OptionsListener.COMMAND_SELECT);<NEW_LINE>options<MASK><NEW_LINE>options[0].getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(BrowseFolders.class, "ACSD_SelectFile"));<NEW_LINE>options[1].setActionCommand(OptionsListener.COMMAND_CANCEL);<NEW_LINE>options[1].addActionListener(optionsListener);<NEW_LINE>options[1].getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(BrowseFolders.class, "ACSD_Cancel"));<NEW_LINE>DialogDescriptor dialogDescriptor = new // innerPane<NEW_LINE>DialogDescriptor(// displayName<NEW_LINE>bf, // modal<NEW_LINE>NbBundle.getMessage(BrowseFolders.class, "LBL_BrowseFiles"), // options<NEW_LINE>true, // initial value<NEW_LINE>options, // options align<NEW_LINE>options[0], // helpCtx<NEW_LINE>DialogDescriptor.BOTTOM_ALIGN, // listener<NEW_LINE>null, null);<NEW_LINE>dialogDescriptor.setClosingOptions(new Object[] { options[0], options[1] });<NEW_LINE>Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);<NEW_LINE>dialog.setVisible(true);<NEW_LINE>return optionsListener.getResult();<NEW_LINE>} | [0].addActionListener(optionsListener); |
1,120,244 | public AddressSet flowConstants(final Program program, Address flowStart, AddressSetView flowSet, final SymbolicPropogator symEval, final TaskMonitor monitor) throws CancelledException {<NEW_LINE>// follow all flows building up context<NEW_LINE>// use context to fill out addresses on certain instructions<NEW_LINE>ContextEvaluator eval = new ConstantPropagationContextEvaluator(trustWriteMemOption) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean evaluateReference(VarnodeContext context, Instruction instr, int pcodeop, Address address, int size, RefType refType) {<NEW_LINE>AddressSpace space = address.getAddressSpace();<NEW_LINE>if (space.hasMappedRegisters()) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>boolean isCodeSpace = address.getAddressSpace().getName().equals(CODE_SPACE_NAME);<NEW_LINE>if (refType.isComputed() && refType.isFlow() && isCodeSpace) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return super.evaluateReference(context, instr, pcodeop, address, size, refType);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean evaluateDestination(VarnodeContext context, Instruction instruction) {<NEW_LINE>FlowType flowType = instruction.getFlowType();<NEW_LINE>if (!flowType.isFlow()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>Reference[] refs = instruction.getReferencesFrom();<NEW_LINE>if (refs.length == 1 && refs[0].getReferenceType().isFlow()) {<NEW_LINE>writeContext(refs[0].getToAddress(), context);<NEW_LINE>Address dest = refs[0].getToAddress();<NEW_LINE>disassemblyPoints.addRange(dest, dest);<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE><NEW_LINE>private void writeContext(Address dest, VarnodeContext context) {<NEW_LINE>flowRegister(dest, context, bsrReg);<NEW_LINE>flowRegister(dest, context, statusReg);<NEW_LINE>flowRegister(dest, context, pclathReg);<NEW_LINE>flowRegister(dest, context, pclReg);<NEW_LINE>flowRegister(dest, context, wReg);<NEW_LINE>flowRegister(dest, context, rpStatusReg);<NEW_LINE>flowRegister(dest, context, irpStatusReg);<NEW_LINE>startNewBlock(program, dest);<NEW_LINE>}<NEW_LINE><NEW_LINE>private void flowRegister(Address dest, VarnodeContext context, Register reg) {<NEW_LINE>ProgramContext programContext = program.getProgramContext();<NEW_LINE>if (reg == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>RegisterValue rValue = context.getRegisterValue(reg);<NEW_LINE>if (rValue == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>programContext.setRegisterValue(dest, dest, rValue);<NEW_LINE>} catch (ContextChangeException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>startNewBlock(program, flowStart);<NEW_LINE>AddressSet result = symEval.flowConstants(flowStart, <MASK><NEW_LINE>if (!disassemblyPoints.isEmpty()) {<NEW_LINE>AutoAnalysisManager mgr = AutoAnalysisManager.getAnalysisManager(program);<NEW_LINE>mgr.disassemble(disassemblyPoints);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | flowSet, eval, true, monitor); |
1,599,482 | void computePointsAndWeights(EllipseRotated_F64 ellipse) {<NEW_LINE>// use the semi-major axis to scale the input points for numerical stability<NEW_LINE>double localScale = ellipse.a;<NEW_LINE>samplePts.reset();<NEW_LINE>weights.reset();<NEW_LINE>int numSamples = radialSamples * 2 + 2;<NEW_LINE>int numPts = numSamples - 1;<NEW_LINE>Point2D_F64 sample = new Point2D_F64();<NEW_LINE>for (int i = 0; i < numSampleContour; i++) {<NEW_LINE>// find a point along the ellipse at evenly spaced angles<NEW_LINE>double theta = 2.0 * Math.PI * i / numSampleContour;<NEW_LINE>UtilEllipse_F64.computePoint(theta, ellipse, sample);<NEW_LINE>// compute the unit tangent along the ellipse at this point<NEW_LINE>double tanX = sample.x - ellipse.center.x;<NEW_LINE>double tanY = sample.y - ellipse.center.y;<NEW_LINE>double r = Math.sqrt(tanX * tanX + tanY * tanY);<NEW_LINE>tanX /= r;<NEW_LINE>tanY /= r;<NEW_LINE>// define the line it will sample along<NEW_LINE>double x = sample.x - numSamples * tanX / 2.0;<NEW_LINE>double y = sample.y - numSamples * tanY / 2.0;<NEW_LINE>double lengthX = numSamples * tanX;<NEW_LINE>double lengthY = numSamples * tanY;<NEW_LINE>// Unless all the sample points are inside the image, ignore this point<NEW_LINE>if (!integral.isInside(x, y) || !integral.isInside(x + lengthX, y + lengthY))<NEW_LINE>continue;<NEW_LINE>double sample0 = integral.compute(x, y, <MASK><NEW_LINE>x += tanX;<NEW_LINE>y += tanY;<NEW_LINE>for (int j = 0; j < numPts; j++) {<NEW_LINE>double sample1 = integral.compute(x, y, x + tanX, y + tanY);<NEW_LINE>double w = sample0 - sample1;<NEW_LINE>if (w < 0)<NEW_LINE>w = -w;<NEW_LINE>if (w > 0) {<NEW_LINE>// convert into a local coordinate so make the linear fitting more numerically stable and<NEW_LINE>// independent on position in the image<NEW_LINE>samplePts.grow().setTo((x - ellipse.center.x) / localScale, (y - ellipse.center.y) / localScale);<NEW_LINE>weights.add(w);<NEW_LINE>}<NEW_LINE>x += tanX;<NEW_LINE>y += tanY;<NEW_LINE>sample0 = sample1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | x + tanX, y + tanY); |
1,441,079 | final PutImageTagMutabilityResult executePutImageTagMutability(PutImageTagMutabilityRequest putImageTagMutabilityRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(putImageTagMutabilityRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<PutImageTagMutabilityRequest> request = null;<NEW_LINE>Response<PutImageTagMutabilityResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new PutImageTagMutabilityRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(putImageTagMutabilityRequest));<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, "ECR");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "PutImageTagMutability");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<PutImageTagMutabilityResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new PutImageTagMutabilityResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
1,409,400 | public static KeyTemplate createAesCtrHmacStreamingKeyTemplate(int mainKeySize, HashType hkdfHashType, int derivedKeySize, HashType macHashType, int tagSize, int ciphertextSegmentSize) {<NEW_LINE>HmacParams hmacParams = HmacParams.newBuilder().setHash(macHashType).setTagSize(tagSize).build();<NEW_LINE>AesCtrHmacStreamingParams params = AesCtrHmacStreamingParams.newBuilder().setCiphertextSegmentSize(ciphertextSegmentSize).setDerivedKeySize(derivedKeySize).setHkdfHashType(hkdfHashType).setHmacParams(hmacParams).build();<NEW_LINE>AesCtrHmacStreamingKeyFormat format = AesCtrHmacStreamingKeyFormat.newBuilder().setParams(params).setKeySize(mainKeySize).build();<NEW_LINE>return KeyTemplate.newBuilder().setValue(format.toByteString()).setTypeUrl(new AesCtrHmacStreamingKeyManager().getKeyType()).setOutputPrefixType(<MASK><NEW_LINE>} | OutputPrefixType.RAW).build(); |
2,397 | private <T extends AbstractNode> void exportDataForType(final SecurityContext context, final Class<T> nodeType, final Path targetConfFile) throws FrameworkException {<NEW_LINE>final App app = StructrApp.getInstance(context);<NEW_LINE>try (final Tx tx = app.tx()) {<NEW_LINE>try (final Writer fos = new OutputStreamWriter(new FileOutputStream(targetConfFile.toFile()))) {<NEW_LINE>final Gson gson = getGson();<NEW_LINE>boolean dataWritten = false;<NEW_LINE>fos.write("[");<NEW_LINE>try (final ResultStream<T> resultStream = app.nodeQuery(nodeType).sort(AbstractNode.createdDate).getResultStream()) {<NEW_LINE>for (final T node : resultStream) {<NEW_LINE>final Map<String, Object> entry = new TreeMap<>();<NEW_LINE>final PropertyContainer pc = node.getPropertyContainer();<NEW_LINE>for (final String key : pc.getPropertyKeys()) {<NEW_LINE>putData(entry, key<MASK><NEW_LINE>}<NEW_LINE>exportOwnershipAndSecurity(node, entry);<NEW_LINE>exportRelationshipsForNode(context, node);<NEW_LINE>if (dataWritten) {<NEW_LINE>fos.write(",");<NEW_LINE>}<NEW_LINE>fos.write("\n");<NEW_LINE>gson.toJson(entry, fos);<NEW_LINE>dataWritten = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (dataWritten) {<NEW_LINE>fos.write("\n");<NEW_LINE>}<NEW_LINE>fos.write("]");<NEW_LINE>} catch (IOException ioex) {<NEW_LINE>logger.warn("", ioex);<NEW_LINE>}<NEW_LINE>tx.success();<NEW_LINE>}<NEW_LINE>} | , pc.getProperty(key)); |
1,778,671 | private void addSortingIndicatorsToHeaderRow(HeaderRow headerRow, FlyweightCell cell) {<NEW_LINE>Element cellElement = cell.getElement();<NEW_LINE>boolean sortedBefore = cellElement.hasClassName("sort-asc") || cellElement.hasClassName("sort-desc");<NEW_LINE>cleanup(cell);<NEW_LINE>if (!headerRow.isDefault()) {<NEW_LINE>// Nothing more to do if not in the default row<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final Column<?, T> column = <MASK><NEW_LINE>SortOrder sortingOrder = getSortOrder(column);<NEW_LINE>boolean sortable = column.isSortable();<NEW_LINE>if (sortable) {<NEW_LINE>cellElement.addClassName("sortable");<NEW_LINE>cellElement.setAttribute("aria-sort", "none");<NEW_LINE>}<NEW_LINE>if (!sortable || sortingOrder == null) {<NEW_LINE>// Only apply sorting indicators to sortable header columns<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (SortDirection.ASCENDING == sortingOrder.getDirection()) {<NEW_LINE>cellElement.addClassName("sort-asc");<NEW_LINE>cellElement.setAttribute("aria-sort", "ascending");<NEW_LINE>} else {<NEW_LINE>cellElement.addClassName("sort-desc");<NEW_LINE>cellElement.setAttribute("aria-sort", "descending");<NEW_LINE>}<NEW_LINE>int sortIndex = Grid.this.getSortOrder().indexOf(sortingOrder);<NEW_LINE>if (sortIndex > -1 && Grid.this.getSortOrder().size() > 1) {<NEW_LINE>// Show sort order indicator if column is<NEW_LINE>// sorted and other sorted columns also exists.<NEW_LINE>cellElement.setAttribute("sort-order", String.valueOf(sortIndex + 1));<NEW_LINE>cellElement.setAttribute("aria-sort", "other");<NEW_LINE>}<NEW_LINE>if (!sortedBefore) {<NEW_LINE>verifyColumnWidth(column);<NEW_LINE>}<NEW_LINE>} | getVisibleColumn(cell.getColumn()); |
601,522 | public Model parseWithoutDocTypeCleanup(InputStream inputStream) throws PomParseException {<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>final SAXParser saxParser = XmlUtils.buildSecureSaxParser();<NEW_LINE>final XMLReader xmlReader = saxParser.getXMLReader();<NEW_LINE>xmlReader.setContentHandler(handler);<NEW_LINE>final BOMInputStream bomStream = new BOMInputStream(new XmlInputStream(inputStream));<NEW_LINE>final ByteOrderMark bom = bomStream.getBOM();<NEW_LINE>final String defaultEncoding = StandardCharsets.UTF_8.name();<NEW_LINE>final String charsetName = bom == null ? defaultEncoding : bom.getCharsetName();<NEW_LINE>final Reader reader = new InputStreamReader(bomStream, charsetName);<NEW_LINE>final InputSource in = new InputSource(reader);<NEW_LINE>xmlReader.parse(in);<NEW_LINE>return handler.getModel();<NEW_LINE>} catch (ParserConfigurationException | SAXException | FileNotFoundException ex) {<NEW_LINE>LOGGER.debug("", ex);<NEW_LINE>throw new PomParseException(ex);<NEW_LINE>} catch (IOException ex) {<NEW_LINE>LOGGER.debug("", ex);<NEW_LINE>throw new PomParseException(ex);<NEW_LINE>}<NEW_LINE>} | final PomHandler handler = new PomHandler(); |
665,524 | public void onLightningStrike(LightningStrikeEvent event) {<NEW_LINE>WorldConfiguration wcfg = getWorldConfig(event.getWorld());<NEW_LINE>if (!wcfg.disallowedLightningBlocks.isEmpty()) {<NEW_LINE>final Block target = event.getLightning().getLocation().getBlock();<NEW_LINE>Material targetId = target.getType();<NEW_LINE>if (targetId == Material.AIR) {<NEW_LINE>targetId = target.getRelative(<MASK><NEW_LINE>}<NEW_LINE>if (wcfg.disallowedLightningBlocks.contains(BukkitAdapter.asBlockType(targetId).getId())) {<NEW_LINE>event.setCancelled(true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Location loc = event.getLightning().getLocation();<NEW_LINE>if (wcfg.useRegions) {<NEW_LINE>if (!StateFlag.test(WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery().queryState(BukkitAdapter.adapt(loc), (RegionAssociable) null, Flags.LIGHTNING))) {<NEW_LINE>event.setCancelled(true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | BlockFace.DOWN).getType(); |
915,502 | public void storeSuperCells(IntObjectMap<IntHashSet> superCells) {<NEW_LINE>// Store the beginning of the supercells information<NEW_LINE>superCellIdToCellsMap = superCells;<NEW_LINE>cells.setHeader(8, (int) (cellContourPointer >> 32));<NEW_LINE>cells.setHeader(12, (int) cellContourPointer);<NEW_LINE>for (IntObjectCursor<IntHashSet> superCell : superCells) {<NEW_LINE>// + 1 for supercellId and + 1 for trailing -1<NEW_LINE>cells.ensureCapacity(cellContourPointer + (long) (superCell.value.size() + 2) * byteCount);<NEW_LINE>cells.setInt(cellContourPointer, superCell.key);<NEW_LINE>cellContourPointer = cellContourPointer + (long) byteCount;<NEW_LINE>for (IntCursor cellId : superCell.value) {<NEW_LINE>cells.setInt(cellContourPointer, cellId.value);<NEW_LINE>cellIdToSuperCellMap.put(cellId.value, superCell.key);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>// Add trailing -1 to signal next entry<NEW_LINE>cells.setInt(cellContourPointer, -1);<NEW_LINE>cellContourPointer = cellContourPointer + (long) byteCount;<NEW_LINE>}<NEW_LINE>// Add second trailing -1 to mark end of superCell block<NEW_LINE>cells.ensureCapacity(cellContourPointer + (long) byteCount);<NEW_LINE>cells.setInt(cellContourPointer, -1);<NEW_LINE>cellContourPointer = cellContourPointer + (long) byteCount;<NEW_LINE>} | cellContourPointer = cellContourPointer + (long) byteCount; |
813,735 | public void onSuccess(HashMap<String, List<V2TIMGroupMemberFullInfo>> stringListHashMap) {<NEW_LINE>Iterator it = stringListHashMap.entrySet().iterator();<NEW_LINE>HashMap<String, LinkedList<HashMap<String, Object>>> res = new HashMap();<NEW_LINE>while (it.hasNext()) {<NEW_LINE>Map.Entry entry = (Map.Entry) it.next();<NEW_LINE>String key = (String) entry.getKey();<NEW_LINE>List<V2TIMGroupMemberFullInfo> value = (List<V2TIMGroupMemberFullInfo>) entry.getValue();<NEW_LINE>LinkedList<HashMap<String, Object>> resItem = new LinkedList<>();<NEW_LINE>for (int i = 0; i < value.size(); i++) {<NEW_LINE>resItem.add(CommonUtil.convertV2TIMGroupMemberFullInfoToMap(value.get(i)));<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>CommonUtil.returnSuccess(result, res);<NEW_LINE>} | res.put(key, resItem); |
515,658 | protected InstallRequest buildInstallRequest(RaftMemberContext member, Snapshot snapshot) {<NEW_LINE>if (member.getNextSnapshotIndex() != snapshot.index()) {<NEW_LINE>member.setNextSnapshotIndex(snapshot.index());<NEW_LINE>member.setNextSnapshotOffset(0);<NEW_LINE>}<NEW_LINE>InstallRequest request;<NEW_LINE>synchronized (snapshot) {<NEW_LINE>// Open a new snapshot reader.<NEW_LINE>try (SnapshotReader reader = snapshot.openReader()) {<NEW_LINE>// Skip to the next batch of bytes according to the snapshot chunk size and current offset.<NEW_LINE>reader.skip(member.getNextSnapshotOffset() * MAX_BATCH_SIZE);<NEW_LINE>byte[] data = new byte[Math.min(MAX_BATCH_SIZE, reader.remaining())];<NEW_LINE>reader.read(data);<NEW_LINE>// Create the install request, indicating whether this is the last chunk of data based on the number<NEW_LINE>// of bytes remaining in the buffer.<NEW_LINE><MASK><NEW_LINE>request = InstallRequest.builder().withTerm(raft.getTerm()).withLeader(leader != null ? leader.memberId() : null).withIndex(snapshot.index()).withTimestamp(snapshot.timestamp().unixTimestamp()).withVersion(snapshot.version()).withOffset(member.getNextSnapshotOffset()).withData(data).withComplete(!reader.hasRemaining()).build();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | DefaultRaftMember leader = raft.getLeader(); |
1,733,384 | public void verifyMacAndDecode(JwtVerifyRequest request, StreamObserver<JwtVerifyResponse> responseObserver) {<NEW_LINE>JwtVerifyResponse response;<NEW_LINE>try {<NEW_LINE>KeysetHandle keysetHandle = CleartextKeysetHandle.read(BinaryKeysetReader.withBytes(request.getKeyset<MASK><NEW_LINE>JwtValidator validator = convertProtoValidatorToValidator(request.getValidator());<NEW_LINE>JwtMac jwtMac = keysetHandle.getPrimitive(JwtMac.class);<NEW_LINE>VerifiedJwt verifiedJwt = jwtMac.verifyMacAndDecode(request.getSignedCompactJwt(), validator);<NEW_LINE>JwtToken token = convertVerifiedJwtToJwtToken(verifiedJwt);<NEW_LINE>response = JwtVerifyResponse.newBuilder().setVerifiedJwt(token).build();<NEW_LINE>} catch (GeneralSecurityException | InvalidProtocolBufferException e) {<NEW_LINE>response = JwtVerifyResponse.newBuilder().setErr(e.toString()).build();<NEW_LINE>} catch (IOException e) {<NEW_LINE>responseObserver.onError(Status.UNKNOWN.withDescription(e.getMessage()).asException());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>responseObserver.onNext(response);<NEW_LINE>responseObserver.onCompleted();<NEW_LINE>} | ().toByteArray())); |
1,258,419 | private Conflict registerConflict(Collection<K> targets, K replacedBy) {<NEW_LINE>assert !targets.isEmpty();<NEW_LINE>// replacement candidates are the only important candidates<NEW_LINE>Collection<? extends T> candidates = elements.get(replacedBy);<NEW_LINE>assert candidates != null;<NEW_LINE>Set<K> participants = new LinkedHashSet<>(targets);<NEW_LINE>participants.add(replacedBy);<NEW_LINE>// We need to ensure that the conflict is orderly injected to the list of conflicts<NEW_LINE>// Brand new conflict goes to the end<NEW_LINE>// If we find any matching conflict we have to hook up with it<NEW_LINE>// Find an existing matching conflict<NEW_LINE>for (K participant : participants) {<NEW_LINE>Conflict <MASK><NEW_LINE>if (c != null) {<NEW_LINE>// there is already registered conflict with at least one matching participant, hook up to this conflict<NEW_LINE>c.candidates = candidates;<NEW_LINE>c.participants.addAll(participants);<NEW_LINE>return c;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// No conflict with matching participants found, create new<NEW_LINE>Conflict c = new Conflict(participants, candidates);<NEW_LINE>conflicts.add(c);<NEW_LINE>for (K participant : participants) {<NEW_LINE>conflictsByParticipant.put(participant, c);<NEW_LINE>}<NEW_LINE>return c;<NEW_LINE>} | c = conflictsByParticipant.get(participant); |
1,807,233 | MutationProto toMutationProto() {<NEW_LINE>final MutationProto.Builder del = MutationProto.newBuilder().setRow(Bytes.wrap(key)).setMutateType(MutationProto.MutationType.DELETE);<NEW_LINE>if (family != WHOLE_ROW) {<NEW_LINE>final MutationProto.ColumnValue.Builder // All columns ...<NEW_LINE>// All columns ...<NEW_LINE>columns = // ... for this family.<NEW_LINE>MutationProto.ColumnValue.newBuilder().// ... for this family.<NEW_LINE>setFamily(Bytes.wrap(family));<NEW_LINE>final MutationProto.DeleteType type = (qualifiers == DELETE_FAMILY_MARKER ? MutationProto.DeleteType.DELETE_FAMILY : (at_timestamp_only ? MutationProto.DeleteType.DELETE_ONE_VERSION : MutationProto.DeleteType.DELETE_MULTIPLE_VERSIONS));<NEW_LINE>// Now add all the qualifiers to delete.<NEW_LINE>for (int i = 0; i < qualifiers.length; i++) {<NEW_LINE>final MutationProto.ColumnValue.QualifierValue column = MutationProto.ColumnValue.QualifierValue.newBuilder().setQualifier(Bytes.wrap(qualifiers[i])).setTimestamp(timestamp).setDeleteType(type).build();<NEW_LINE>columns.addQualifierValue(column);<NEW_LINE>}<NEW_LINE>del.addColumnValue(columns);<NEW_LINE>}<NEW_LINE>if (!durable) {<NEW_LINE>del.<MASK><NEW_LINE>}<NEW_LINE>return del.build();<NEW_LINE>} | setDurability(MutationProto.Durability.SKIP_WAL); |
328,883 | private void addCharacter(MeshBuilder builder, FontCharacter character, Colorc color, float xOffset, float yOffset, float depth) {<NEW_LINE>float top = y <MASK><NEW_LINE>float bottom = top + character.getHeight() + yOffset;<NEW_LINE>float left = x + character.getxOffset() + xOffset;<NEW_LINE>float right = left + character.getWidth() + xOffset;<NEW_LINE>float texTop = character.getY();<NEW_LINE>float texBottom = texTop + character.getTexHeight();<NEW_LINE>float texLeft = character.getX();<NEW_LINE>float texRight = texLeft + character.getTexWidth();<NEW_LINE>Vector3f v1 = new Vector3f(left, top, depth);<NEW_LINE>Vector3f v2 = new Vector3f(right, top, depth);<NEW_LINE>Vector3f v3 = new Vector3f(right, bottom, depth);<NEW_LINE>Vector3f v4 = new Vector3f(left, bottom, depth);<NEW_LINE>builder.addPoly(v1, v2, v3, v4);<NEW_LINE>builder.addColor(color, color, color, color);<NEW_LINE>builder.addTexCoord(texLeft, texTop);<NEW_LINE>builder.addTexCoord(texRight, texTop);<NEW_LINE>builder.addTexCoord(texRight, texBottom);<NEW_LINE>builder.addTexCoord(texLeft, texBottom);<NEW_LINE>} | + character.getyOffset() + yOffset; |
1,706,116 | public SirixDeweyID deserializeDeweyID(DataInput source, SirixDeweyID previousDeweyID, ResourceConfiguration resourceConfig) throws IOException {<NEW_LINE>if (resourceConfig.areDeweyIDsStored) {<NEW_LINE>if (previousDeweyID != null) {<NEW_LINE>final byte[] previousDeweyIDBytes = previousDeweyID.toBytes();<NEW_LINE>final int cutOffSize = source.readByte();<NEW_LINE>final <MASK><NEW_LINE>final byte[] deweyIDBytes = new byte[size];<NEW_LINE>source.readFully(deweyIDBytes);<NEW_LINE>final byte[] bytes = new byte[cutOffSize + deweyIDBytes.length];<NEW_LINE>final ByteBuffer target = ByteBuffer.wrap(bytes);<NEW_LINE>target.put(Arrays.copyOfRange(previousDeweyIDBytes, 0, cutOffSize));<NEW_LINE>target.put(deweyIDBytes);<NEW_LINE>return new SirixDeweyID(bytes);<NEW_LINE>} else {<NEW_LINE>final byte deweyIDLength = source.readByte();<NEW_LINE>final byte[] deweyIDBytes = new byte[deweyIDLength];<NEW_LINE>source.readFully(deweyIDBytes, 0, deweyIDLength);<NEW_LINE>return new SirixDeweyID(deweyIDBytes);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | int size = source.readByte(); |
216,199 | public void prepareData(CodeGenContext context) throws Exception {<NEW_LINE>List<String> exceptions = new ArrayList<>();<NEW_LINE>JavaCodeGenContext ctx = (JavaCodeGenContext) context;<NEW_LINE>try {<NEW_LINE>LoggerManager.getInstance().info(String.format("Begin to prepare java table data for project %s", ctx.getProjectId()));<NEW_LINE>new JavaDataPreparerOfTableViewSpProcessor().process(ctx);<NEW_LINE>LoggerManager.getInstance().info(String.format("Prepare java table data for project %s completed.", ctx.getProjectId()));<NEW_LINE>} catch (Exception e) {<NEW_LINE>LoggerManager.getInstance().error(e);<NEW_LINE>exceptions.add(e.getMessage());<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>LoggerManager.getInstance().info(String.format("Begin to prepare java sqlbuilder data for project %s", ctx.getProjectId()));<NEW_LINE>new JavaDataPreparerOfSqlBuilderProcessor().process(ctx);<NEW_LINE>LoggerManager.getInstance().info(String.format("Prepare java sqlbuilder data for project %s completed.", ctx.getProjectId()));<NEW_LINE>} catch (Throwable e) {<NEW_LINE>LoggerManager.getInstance().error(e);<NEW_LINE>exceptions.add(e.getMessage());<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>LoggerManager.getInstance().info(String.format("Begin to prepare java freesql data for project %s"<MASK><NEW_LINE>new JavaDataPreparerOfFreeSqlProcessor().process(ctx);<NEW_LINE>LoggerManager.getInstance().info(String.format("Prepare java freesql data for project %s completed.", ctx.getProjectId()));<NEW_LINE>} catch (Throwable e) {<NEW_LINE>LoggerManager.getInstance().error(e);<NEW_LINE>exceptions.add(e.getMessage());<NEW_LINE>}<NEW_LINE>if (exceptions.size() > 0) {<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>for (String exception : exceptions) {<NEW_LINE>sb.append(exception);<NEW_LINE>}<NEW_LINE>throw new RuntimeException(sb.toString());<NEW_LINE>}<NEW_LINE>} | , ctx.getProjectId())); |
485,748 | public IPSetUpdate unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>IPSetUpdate iPSetUpdate = new IPSetUpdate();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("Action", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>iPSetUpdate.setAction(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("IPSetDescriptor", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>iPSetUpdate.setIPSetDescriptor(IPSetDescriptorJsonUnmarshaller.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 iPSetUpdate;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
1,087,331 | public static void testParameterTypes() {<NEW_LINE>ApplyFunction foo = new B<String>();<NEW_LINE>ApplyFunction bar = new A();<NEW_LINE>assertTrue(callGenericInterface(foo, "a", 1).equals("a"));<NEW_LINE>assertTrue(callGenericInterface(bar, 1.1, 1.1).equals(new Double(2.2)));<NEW_LINE>assertTrue(callParametricInterface(foo, "a").equals("a"));<NEW_LINE>assertTrue(callParametricWithTypeVariable(foo, "a", 1).equals("a"));<NEW_LINE>assertTrue(callParametricWithTypeVariable(bar, 1.1, 1.1).equals(new Double(2.2)));<NEW_LINE>assertTrue(callImplementorGeneric(new B<Double>(), 1.1, 1).equals(new Double(1.1)));<NEW_LINE>assertTrue(callImplementorParametric(new B<String>(), <MASK><NEW_LINE>assertTrue(foo.apply("a", 1).equals("a"));<NEW_LINE>assertTrue(bar.apply(1.1, 1.1).equals(new Double(2.2)));<NEW_LINE>assertTrue(callOnFunction(new A()) == 2.2);<NEW_LINE>} | "").equals("")); |
1,496,452 | public Block readBlock(BlockEncodingSerde blockEncodingSerde, SliceInput sliceInput) {<NEW_LINE>int positionCount = sliceInput.readInt();<NEW_LINE>byte[] valueIsNullPacked = retrieveNullBits(sliceInput, positionCount);<NEW_LINE>int[] values = new int[positionCount];<NEW_LINE>if (valueIsNullPacked == null) {<NEW_LINE>sliceInput.readBytes(Slices.wrappedIntArray(values));<NEW_LINE>return new IntArrayBlock(0, positionCount, null, values);<NEW_LINE>}<NEW_LINE>boolean[] valueIsNull = decodeNullBits(valueIsNullPacked, positionCount);<NEW_LINE>int nonNullPositionCount = sliceInput.readInt();<NEW_LINE>sliceInput.readBytes(Slices.wrappedIntArray(values, 0, nonNullPositionCount));<NEW_LINE>int position = nonNullPositionCount - 1;<NEW_LINE>// Handle Last (positionCount % 8) values<NEW_LINE>for (int i = positionCount - 1; i >= (positionCount & ~0b111) && position >= 0; i--) {<NEW_LINE>values[i] = values[position];<NEW_LINE>if (!valueIsNull[i]) {<NEW_LINE>position--;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Handle the remaining positions.<NEW_LINE>for (int i = (positionCount & ~0b111) - 8; i >= 0 && position >= 0; i -= 8) {<NEW_LINE>byte packed = valueIsNullPacked[i >>> 3];<NEW_LINE>if (packed == 0) {<NEW_LINE>// Only values<NEW_LINE>arraycopy(values, position - 7, values, i, 8);<NEW_LINE>position -= 8;<NEW_LINE>} else if (packed != -1) {<NEW_LINE>// At least one non-null<NEW_LINE>for (int j = i + 7; j >= i && position >= 0; j--) {<NEW_LINE>values[j] = values[position];<NEW_LINE>if (!valueIsNull[j]) {<NEW_LINE>position--;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Do nothing if there are only nulls<NEW_LINE>}<NEW_LINE>return new IntArrayBlock(<MASK><NEW_LINE>} | 0, positionCount, valueIsNull, values); |
1,758,066 | public void explain(int p, ExplanationForSignedClause explanation) {<NEW_LINE>IntIterableRangeSet set;<NEW_LINE>int m;<NEW_LINE>if (explanation.readVar(p) == vars[0]) {<NEW_LINE>// case a. (see javadoc)<NEW_LINE>m = explanation.readDom(vars[1]).max();<NEW_LINE>set = explanation.complement(vars[1]);<NEW_LINE>set.retainBetween(<MASK><NEW_LINE>vars[0].intersectLit(cste - m, IntIterableRangeSet.MAX, explanation);<NEW_LINE>vars[1].unionLit(set, explanation);<NEW_LINE>} else {<NEW_LINE>// case b. (see javadoc)<NEW_LINE>assert explanation.readVar(p) == vars[1];<NEW_LINE>m = explanation.readDom(vars[0]).max();<NEW_LINE>set = explanation.complement(vars[0]);<NEW_LINE>set.retainBetween(m + 1, IntIterableRangeSet.MAX);<NEW_LINE>vars[0].unionLit(set, explanation);<NEW_LINE>vars[1].intersectLit(cste - m, IntIterableRangeSet.MAX, explanation);<NEW_LINE>}<NEW_LINE>} | m + 1, IntIterableRangeSet.MAX); |
1,655,576 | public Id projectAddGraphs(Id id, Set<String> graphs) {<NEW_LINE>E.checkArgument(!CollectionUtils.isEmpty(graphs), "Failed to add graphs to project '%s', the graphs " + "parameter can't be empty", id);<NEW_LINE>LockUtil.Locks locks = new LockUtil.Locks(this.graph.name());<NEW_LINE>try {<NEW_LINE>locks.lockWrites(LockUtil.PROJECT_UPDATE, id);<NEW_LINE>HugeProject project = <MASK><NEW_LINE>Set<String> sourceGraphs = new HashSet<>(project.graphs());<NEW_LINE>int oldSize = sourceGraphs.size();<NEW_LINE>sourceGraphs.addAll(graphs);<NEW_LINE>// Return if there is none graph been added<NEW_LINE>if (sourceGraphs.size() == oldSize) {<NEW_LINE>return id;<NEW_LINE>}<NEW_LINE>project.graphs(sourceGraphs);<NEW_LINE>return this.project.update(project);<NEW_LINE>} finally {<NEW_LINE>locks.unlock();<NEW_LINE>}<NEW_LINE>} | this.project.get(id); |
1,307,809 | public void onLogin(MagicConsoleSession session, String token, String clientId) {<NEW_LINE>session.setClientId(clientId);<NEW_LINE>MagicUser user = null;<NEW_LINE>try {<NEW_LINE>user = authorizationInterceptor.getUserByToken(token);<NEW_LINE>} catch (Exception e) {<NEW_LINE>if (!authorizationInterceptor.requireLogin()) {<NEW_LINE>user = guest;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (user != null) {<NEW_LINE>String ip = Optional.ofNullable(session.getWebSocketSession().getRemoteAddress()).map(it -> it.getAddress().getHostAddress()).orElse("unknown");<NEW_LINE>HttpHeaders headers = session.getWebSocketSession().getHandshakeHeaders();<NEW_LINE>ip = IpUtils.getRealIP(ip, headers::getFirst, null);<NEW_LINE>session.setAttribute(Constants.WEBSOCKET_ATTRIBUTE_USER_ID, user.getId());<NEW_LINE>session.setAttribute(Constants.WEBSOCKET_ATTRIBUTE_USER_IP, StringUtils.defaultIfBlank(ip, "unknown"));<NEW_LINE>session.setAttribute(Constants.<MASK><NEW_LINE>session.setActivateTime(System.currentTimeMillis());<NEW_LINE>synchronized (MagicWorkbenchHandler.class) {<NEW_LINE>if (WebSocketSessionManager.getConsoleSession(clientId) != null) {<NEW_LINE>WebSocketSessionManager.sendBySession(session, WebSocketSessionManager.buildMessage(MessageType.LOGIN_RESPONSE, "-1"));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>WebSocketSessionManager.add(session);<NEW_LINE>}<NEW_LINE>WebSocketSessionManager.sendBySession(session, WebSocketSessionManager.buildMessage(MessageType.LOGIN_RESPONSE, "1", session.getAttributes()));<NEW_LINE>List<Map<String, Object>> messages = getOnlineUsers();<NEW_LINE>if (!messages.isEmpty()) {<NEW_LINE>WebSocketSessionManager.sendByClientId(session.getClientId(), WebSocketSessionManager.buildMessage(MessageType.ONLINE_USERS, messages));<NEW_LINE>}<NEW_LINE>WebSocketSessionManager.sendToMachine(MessageType.SEND_ONLINE, session.getClientId());<NEW_LINE>WebSocketSessionManager.sendToOther(session.getClientId(), MessageType.USER_LOGIN, session.getAttributes());<NEW_LINE>} else {<NEW_LINE>WebSocketSessionManager.sendBySession(session, WebSocketSessionManager.buildMessage(MessageType.LOGIN_RESPONSE, "0"));<NEW_LINE>}<NEW_LINE>} | WEBSOCKET_ATTRIBUTE_USER_NAME, user.getUsername()); |
503,390 | private void createStringForGroupUse(StringBuilder insertString, String indentString, String usePrefix, List<UsePart> useParts) {<NEW_LINE>List<UsePart> groupedUseParts = new ArrayList<<MASK><NEW_LINE>List<UsePart> nonGroupedUseParts = new ArrayList<>(useParts.size());<NEW_LINE>List<String> prefixes = CodeUtils.getCommonNamespacePrefixes(usePartsToNamespaces(useParts));<NEW_LINE>String lastGroupUsePrefix = null;<NEW_LINE>for (UsePart usePart : useParts) {<NEW_LINE>String fqNamespace = CodeUtils.fullyQualifyNamespace(usePart.getTextPart());<NEW_LINE>String groupUsePrefix = null;<NEW_LINE>for (String prefix : prefixes) {<NEW_LINE>if (fqNamespace.startsWith(prefix)) {<NEW_LINE>groupUsePrefix = prefix;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (groupUsePrefix != null) {<NEW_LINE>if (lastGroupUsePrefix != null && !lastGroupUsePrefix.equals(groupUsePrefix)) {<NEW_LINE>processGroupedUseParts(insertString, indentString, usePrefix, lastGroupUsePrefix, groupedUseParts);<NEW_LINE>}<NEW_LINE>lastGroupUsePrefix = groupUsePrefix;<NEW_LINE>processNonGroupedUseParts(insertString, indentString, nonGroupedUseParts);<NEW_LINE>groupedUseParts.add(usePart);<NEW_LINE>} else {<NEW_LINE>processGroupedUseParts(insertString, indentString, usePrefix, lastGroupUsePrefix, groupedUseParts);<NEW_LINE>nonGroupedUseParts.add(usePart);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>processNonGroupedUseParts(insertString, indentString, nonGroupedUseParts);<NEW_LINE>processGroupedUseParts(insertString, indentString, usePrefix, lastGroupUsePrefix, groupedUseParts);<NEW_LINE>} | >(useParts.size()); |
500,326 | public void refresh(TableCell cell) {<NEW_LINE>TrackerPeerSource ps = (TrackerPeerSource) cell.getDataSource();<NEW_LINE>long[] stats = (ps == null) ? null : ps.getReportedStats();<NEW_LINE>long sort;<NEW_LINE>String str;<NEW_LINE>if (stats != null) {<NEW_LINE>long gu = stats[0];<NEW_LINE>long uu = stats[2];<NEW_LINE>long su = stats[4];<NEW_LINE>sort = gu != 0 ? gu : (uu != 0 ? uu : su);<NEW_LINE>if (sort == 0) {<NEW_LINE>str = "";<NEW_LINE>} else {<NEW_LINE>if (uu > 0) {<NEW_LINE>str = DisplayFormatters.formatByteCountToKiBEtc(uu);<NEW_LINE>} else {<NEW_LINE>str = "";<NEW_LINE>}<NEW_LINE>if (gu != 0 && gu != uu) {<NEW_LINE>str = DisplayFormatters.formatByteCountToKiBEtc(gu) + (str.isEmpty() ? <MASK><NEW_LINE>}<NEW_LINE>if (su > 0) {<NEW_LINE>str += " (" + DisplayFormatters.formatByteCountToKiBEtc(su) + ")";<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>sort = -1;<NEW_LINE>str = "";<NEW_LINE>}<NEW_LINE>if (!cell.setSortValue(sort) && cell.isValid()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>cell.setText(str);<NEW_LINE>} | "" : ("/" + str)); |
372,234 | private void writeObjects(DataWriter out) throws IOException {<NEW_LINE>long ofsMin = Long.MAX_VALUE;<NEW_LINE>long ofsMax = Long.MIN_VALUE;<NEW_LINE>for (SerializedObjectData data : serialized.objectData()) {<NEW_LINE>ByteBuffer bb = data.buffer();<NEW_LINE>bb.rewind();<NEW_LINE>out.align(8);<NEW_LINE>ofsMin = Math.min(ofsMin, out.position());<NEW_LINE>ofsMax = Math.max(ofsMax, out.position() + bb.remaining());<NEW_LINE>ObjectInfo info = data.info();<NEW_LINE>info.offset(out.position() - serialized.<MASK><NEW_LINE>info.length(bb.remaining());<NEW_LINE>out.writeBuffer(bb);<NEW_LINE>}<NEW_LINE>DataBlock objectDataBlock = serialized.objectDataBlock();<NEW_LINE>objectDataBlock.offset(ofsMin);<NEW_LINE>objectDataBlock.endOffset(ofsMax);<NEW_LINE>L.log(Level.FINER, "objectDataBlock: {0}", objectDataBlock);<NEW_LINE>} | header().dataOffset()); |
1,764,648 | public boolean visit(IfStatement node) {<NEW_LINE>Statement elseNode = node.getElseStatement();<NEW_LINE>Statement thenNode = node.getThenStatement();<NEW_LINE>if (elseNode != null) {<NEW_LINE>if (this.options.insert_new_line_before_else_in_if_statement || !(thenNode instanceof Block))<NEW_LINE>this.tm.firstTokenBefore(<MASK><NEW_LINE>boolean keepElseOnSameLine = (this.options.keep_else_statement_on_same_line) || (this.options.compact_else_if && (elseNode instanceof IfStatement));<NEW_LINE>if (!keepElseOnSameLine)<NEW_LINE>handleLoopBody(elseNode);<NEW_LINE>}<NEW_LINE>boolean keepThenOnSameLine = this.options.keep_then_statement_on_same_line || (this.options.keep_simple_if_on_one_line && elseNode == null);<NEW_LINE>if (!keepThenOnSameLine)<NEW_LINE>handleLoopBody(thenNode);<NEW_LINE>return true;<NEW_LINE>} | elseNode, TokenNameelse).breakBefore(); |
314,426 | public int writePrimitiveType(DebugContext context, PrimitiveTypeEntry primitiveTypeEntry, byte[] buffer, int p) {<NEW_LINE>assert primitiveTypeEntry.getBitCount() > 0;<NEW_LINE>int pos = p;<NEW_LINE>log(context, " [0x%08x] primitive type %s", <MASK><NEW_LINE>setIndirectTypeIndex(primitiveTypeEntry, pos);<NEW_LINE>int abbrevCode = DwarfDebugInfo.DW_ABBREV_CODE_primitive_type;<NEW_LINE>log(context, " [0x%08x] <1> Abbrev Number %d", pos, abbrevCode);<NEW_LINE>pos = writeAbbrevCode(abbrevCode, buffer, pos);<NEW_LINE>byte byteSize = (byte) primitiveTypeEntry.getSize();<NEW_LINE>log(context, " [0x%08x] byte_size %d", pos, byteSize);<NEW_LINE>pos = writeAttrData1(byteSize, buffer, pos);<NEW_LINE>byte bitCount = (byte) primitiveTypeEntry.getBitCount();<NEW_LINE>log(context, " [0x%08x] bitCount %d", pos, bitCount);<NEW_LINE>pos = writeAttrData1(bitCount, buffer, pos);<NEW_LINE>byte encoding = computeEncoding(primitiveTypeEntry.getFlags(), bitCount);<NEW_LINE>log(context, " [0x%08x] encoding 0x%x", pos, encoding);<NEW_LINE>pos = writeAttrData1(encoding, buffer, pos);<NEW_LINE>String name = primitiveTypeEntry.getTypeName();<NEW_LINE>log(context, " [0x%08x] name 0x%x (%s)", pos, debugStringIndex(name), name);<NEW_LINE>return writeAttrStrp(name, buffer, pos);<NEW_LINE>} | pos, primitiveTypeEntry.getTypeName()); |
1,128,433 | private void installPlugin(Terminal terminal, boolean isBatch, Path tmpRoot, Environment env, List<Path> deleteOnFailure) throws Exception {<NEW_LINE>final PluginInfo info = loadPluginInfo(terminal, tmpRoot, env);<NEW_LINE>// read optional security policy (extra permissions), if it exists, confirm or warn the user<NEW_LINE>Path policy = tmpRoot.resolve(PluginInfo.ES_PLUGIN_POLICY);<NEW_LINE>final Set<String> permissions;<NEW_LINE>if (Files.exists(policy)) {<NEW_LINE>permissions = PluginSecurity.parsePermissions(policy, env.tmpFile());<NEW_LINE>} else {<NEW_LINE>permissions = Collections.emptySet();<NEW_LINE>}<NEW_LINE>PluginSecurity.confirmPolicyExceptions(terminal, permissions, isBatch);<NEW_LINE>final Path destination = env.pluginsFile().resolve(info.getName());<NEW_LINE>deleteOnFailure.add(destination);<NEW_LINE>installPluginSupportFiles(info, tmpRoot, env.binFile().resolve(info.getName()), env.configFile().resolve(info.getName()), deleteOnFailure);<NEW_LINE>movePlugin(tmpRoot, destination);<NEW_LINE>terminal.println(<MASK><NEW_LINE>} | "-> Installed " + info.getName()); |
1,845,507 | private void readServletMapping(Element servletMappingElem) {<NEW_LINE>String servletName = null;<NEW_LINE>String urlPattern = null;<NEW_LINE>NodeList nodeList = servletMappingElem.getChildNodes();<NEW_LINE>for (int i = 0, len = nodeList.getLength(); i < len; i++) {<NEW_LINE>Node n = nodeList.item(i);<NEW_LINE>if (n.getNodeType() == Node.ELEMENT_NODE) {<NEW_LINE>if (n.getNodeName().equals("servlet-name")) {<NEW_LINE>servletName = org.apache.myfaces.shared.util.xml.XmlUtils.getElementText((Element) n);<NEW_LINE>} else if (n.getNodeName().equals("url-pattern")) {<NEW_LINE>urlPattern = org.apache.myfaces.shared.util.xml.XmlUtils.getElementText((Element) n).trim();<NEW_LINE>} else {<NEW_LINE>if (log.isLoggable(Level.FINE)) {<NEW_LINE>log.fine("Ignored element '" + n.getNodeName() + "' as child of '" + servletMappingElem.getNodeName() + "'.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (log.isLoggable(Level.FINE)) {<NEW_LINE>log.fine("Ignored node '" + n.getNodeName() + <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>urlPattern = urlPattern.trim();<NEW_LINE>_webXml.addServletMapping(servletName, urlPattern);<NEW_LINE>} | "' of type " + n.getNodeType()); |
1,247,041 | private Optional<String> figureUsernameGrantParam(final PwmRequest pwmRequest, final UserIdentity userIdentity) throws PwmUnrecoverableException {<NEW_LINE>if (userIdentity == null) {<NEW_LINE>return Optional.empty();<NEW_LINE>}<NEW_LINE>final String macroText = settings.getUsernameSendValue();<NEW_LINE>if (StringUtil.isEmpty(macroText)) {<NEW_LINE>return Optional.empty();<NEW_LINE>}<NEW_LINE>final MacroRequest macroRequest = MacroRequest.forUser(pwmRequest, userIdentity);<NEW_LINE>final String username = macroRequest.expandMacros(macroText);<NEW_LINE>LOGGER.debug(sessionLabel, () -> "calculated username value for user as: " + username);<NEW_LINE>final String grantUrl = settings.getLoginURL();<NEW_LINE>final String signUrl = grantUrl.replace("/grant", "/sign");<NEW_LINE>final Map<String, String> requestPayload;<NEW_LINE>{<NEW_LINE>final Map<String, String> dataPayload = new HashMap<>();<NEW_LINE>dataPayload.put("username", username);<NEW_LINE>final List<Map<String, String>> listWrapper = new ArrayList<>();<NEW_LINE>listWrapper.add(dataPayload);<NEW_LINE>requestPayload = new HashMap<>();<NEW_LINE>requestPayload.put("data", JsonFactory.get().serializeCollection(listWrapper));<NEW_LINE>}<NEW_LINE>LOGGER.debug(sessionLabel, () -> "preparing to send username to OAuth /sign endpoint for future injection to /grant redirect");<NEW_LINE>final PwmHttpClientResponse restResults = makeHttpRequest(pwmRequest, "OAuth pre-inject username signing service", settings, signUrl, requestPayload, null);<NEW_LINE>final String resultBody = restResults.getBody();<NEW_LINE>final Map<String, String> resultBodyMap = JsonFactory.get().deserializeStringMap(resultBody);<NEW_LINE>final String <MASK><NEW_LINE>if (StringUtil.isEmpty(data)) {<NEW_LINE>LOGGER.debug(sessionLabel, () -> "oauth /sign endpoint returned signed username data: " + data);<NEW_LINE>return Optional.of(data);<NEW_LINE>}<NEW_LINE>return Optional.empty();<NEW_LINE>} | data = resultBodyMap.get("data"); |
1,404,360 | static boolean startBootstrapServicesInParallel(PinotServiceManager pinotServiceManager, List<Entry<ServiceRole, Map<String, Object>>> parallelConfigs) {<NEW_LINE>if (parallelConfigs.isEmpty()) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>// True is when everything succeeded<NEW_LINE><MASK><NEW_LINE>List<Thread> threads = new ArrayList<>();<NEW_LINE>for (Entry<ServiceRole, Map<String, Object>> roleToConfig : parallelConfigs) {<NEW_LINE>ServiceRole role = roleToConfig.getKey();<NEW_LINE>Map<String, Object> config = roleToConfig.getValue();<NEW_LINE>Thread thread = new Thread("Start a Pinot [" + role + "]") {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>if (!startPinotService(role, () -> pinotServiceManager.startRole(role, config))) {<NEW_LINE>failed.set(true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>threads.add(thread);<NEW_LINE>// Unhandled exceptions are likely logged, so we don't need to re-log here<NEW_LINE>thread.setUncaughtExceptionHandler((t, e) -> failed.set(true));<NEW_LINE>thread.start();<NEW_LINE>}<NEW_LINE>// Block until service startup completes<NEW_LINE>for (Thread thread : threads) {<NEW_LINE>try {<NEW_LINE>thread.join();<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>Thread.currentThread().interrupt();<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return !failed.get();<NEW_LINE>} | AtomicBoolean failed = new AtomicBoolean(false); |
1,469,125 | public boolean add(ModuleLoadRequest moduleLoadRequest) {<NEW_LINE>if (this.contains(moduleLoadRequest)) {<NEW_LINE>Set<Location> locations = new HashSet<>();<NEW_LINE>ModuleLoadRequest finalModuleLoadRequest = moduleLoadRequest;<NEW_LINE>ModuleLoadRequest oldLoadRequest = this.stream().filter(oldRequest -> oldRequest.equals(finalModuleLoadRequest)).findFirst().orElseThrow();<NEW_LINE>locations.addAll(oldLoadRequest.locations());<NEW_LINE>locations.addAll(moduleLoadRequest.locations());<NEW_LINE>PackageDependencyScope scope = oldLoadRequest.scope() == PackageDependencyScope.DEFAULT ? oldLoadRequest.scope() : moduleLoadRequest.scope();<NEW_LINE>moduleLoadRequest = new ModuleLoadRequest(oldLoadRequest.orgName().orElse(null), oldLoadRequest.moduleName(), scope, <MASK><NEW_LINE>this.remove(oldLoadRequest);<NEW_LINE>}<NEW_LINE>return super.add(moduleLoadRequest);<NEW_LINE>} | oldLoadRequest.dependencyResolvedType(), locations); |
453,758 | public int compareTo(BulkImportStatus other) {<NEW_LINE>if (!getClass().equals(other.getClass())) {<NEW_LINE>return getClass().getName().compareTo(other.getClass().getName());<NEW_LINE>}<NEW_LINE>int lastComparison = 0;<NEW_LINE>lastComparison = java.lang.Boolean.compare(isSetStartTime(), other.isSetStartTime());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetStartTime()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.startTime, other.startTime);<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>lastComparison = java.lang.Boolean.compare(isSetFilename(), other.isSetFilename());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetFilename()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.filename, other.filename);<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>lastComparison = java.lang.Boolean.compare(isSetState(), other.isSetState());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetState()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(<MASK><NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>} | this.state, other.state); |
1,727,635 | // DO NOT MODIFY THIS CODE, GENERATED AUTOMATICALLY<NEW_LINE>public static void addSourceNameFilter(com.sun.jdi.request.ClassPrepareRequest a, java.lang.String b) throws org.netbeans.modules.debugger.jpda.jdi.InternalExceptionWrapper, org.netbeans.modules.debugger.jpda.jdi.VMDisconnectedExceptionWrapper {<NEW_LINE>if (org.netbeans.modules.debugger.jpda.JDIExceptionReporter.isLoggable()) {<NEW_LINE>org.netbeans.modules.debugger.jpda.JDIExceptionReporter.logCallStart("com.sun.jdi.request.ClassPrepareRequest", "addSourceNameFilter", "JDI CALL: com.sun.jdi.request.ClassPrepareRequest({0}).addSourceNameFilter({1})", new Object[] { a, b });<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>a.addSourceNameFilter(b);<NEW_LINE>} catch (com.sun.jdi.InternalException ex) {<NEW_LINE>org.netbeans.modules.debugger.<MASK><NEW_LINE>throw new org.netbeans.modules.debugger.jpda.jdi.InternalExceptionWrapper(ex);<NEW_LINE>} catch (com.sun.jdi.VMDisconnectedException ex) {<NEW_LINE>if (a instanceof com.sun.jdi.Mirror) {<NEW_LINE>com.sun.jdi.VirtualMachine vm = ((com.sun.jdi.Mirror) a).virtualMachine();<NEW_LINE>try {<NEW_LINE>vm.dispose();<NEW_LINE>} catch (com.sun.jdi.VMDisconnectedException vmdex) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw new org.netbeans.modules.debugger.jpda.jdi.VMDisconnectedExceptionWrapper(ex);<NEW_LINE>} finally {<NEW_LINE>if (org.netbeans.modules.debugger.jpda.JDIExceptionReporter.isLoggable()) {<NEW_LINE>org.netbeans.modules.debugger.jpda.JDIExceptionReporter.logCallEnd("com.sun.jdi.request.ClassPrepareRequest", "addSourceNameFilter", org.netbeans.modules.debugger.jpda.JDIExceptionReporter.RET_VOID);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | jpda.JDIExceptionReporter.report(ex); |
187,356 | public void addEntries(@Nonnull ItemStack itemstack, @Nonnull List<String> list, @Nullable String withGrindingMultiplier) {<NEW_LINE>IGrindingMultiplier ball = SagMillRecipeManager.getInstance().getGrindballFromStack(itemstack);<NEW_LINE>list.add(Lang.GRINDING_BALL_1.get(TextFormatting.BLUE));<NEW_LINE>if (withGrindingMultiplier == null) {<NEW_LINE>list.add(Lang.GRINDING_BALL_2.get(TextFormatting.GRAY, LangPower.toPercent(ball.getGrindingMultiplier())));<NEW_LINE>} else {<NEW_LINE>list.add(Lang.GRINDING_BALL_2.get(TextFormatting.GRAY, withGrindingMultiplier));<NEW_LINE>}<NEW_LINE>list.add(Lang.GRINDING_BALL_3.get(TextFormatting.GRAY, LangPower.toPercent(<MASK><NEW_LINE>list.add(Lang.GRINDING_BALL_4.get(TextFormatting.GRAY, LangPower.toPercent(ball.getPowerMultiplier())));<NEW_LINE>} | ball.getChanceMultiplier()))); |
1,659,608 | DbInfo.Builder doParse(String jdbcUrl, DbInfo.Builder builder) {<NEW_LINE>if (jdbcUrl.contains("@(description")) {<NEW_LINE>return ORACLE_AT_DESCRIPTION.doParse(jdbcUrl, builder);<NEW_LINE>}<NEW_LINE>String user;<NEW_LINE>String[] atSplit = <MASK><NEW_LINE>int userInfoLoc = atSplit[0].indexOf("/");<NEW_LINE>if (userInfoLoc > 0) {<NEW_LINE>user = atSplit[0].substring(0, userInfoLoc);<NEW_LINE>} else {<NEW_LINE>user = null;<NEW_LINE>}<NEW_LINE>String connectInfo = atSplit[1];<NEW_LINE>int hostStart;<NEW_LINE>if (connectInfo.startsWith("//")) {<NEW_LINE>hostStart = "//".length();<NEW_LINE>} else if (connectInfo.startsWith("ldap://")) {<NEW_LINE>hostStart = "ldap://".length();<NEW_LINE>} else {<NEW_LINE>hostStart = 0;<NEW_LINE>}<NEW_LINE>if (user != null) {<NEW_LINE>builder.user(user);<NEW_LINE>}<NEW_LINE>return ORACLE_CONNECT_INFO.doParse(connectInfo.substring(hostStart), builder);<NEW_LINE>} | jdbcUrl.split("@", 2); |
754,276 | public static void average(InterleavedS8 from, GrayS8 to) {<NEW_LINE>final int numBands = from.getNumBands();<NEW_LINE>if (numBands == 1) {<NEW_LINE>for (int y = 0; y < from.height; y++) {<NEW_LINE>int indexFrom = from.getIndex(0, y);<NEW_LINE>int indexTo = to.getIndex(0, y);<NEW_LINE>System.arraycopy(from.data, indexFrom, to.data, indexTo, from.width);<NEW_LINE>}<NEW_LINE>} else if (numBands == 2) {<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, from.height, y -> {<NEW_LINE>for (int y = 0; y < from.height; y++) {<NEW_LINE>int indexFrom = from.getIndex(0, y);<NEW_LINE>int indexTo = to.getIndex(0, y);<NEW_LINE>int indexEndTo = indexTo + from.width;<NEW_LINE>while (indexTo < indexEndTo) {<NEW_LINE>// for (int x = 0; x < from.width; x++ ) {<NEW_LINE>int sum <MASK><NEW_LINE>sum += from.data[indexFrom++];<NEW_LINE>to.data[indexTo++] = (byte) (sum / 2);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} else if (numBands == 3) {<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, from.height, y -> {<NEW_LINE>for (int y = 0; y < from.height; y++) {<NEW_LINE>int indexFrom = from.getIndex(0, y);<NEW_LINE>int indexTo = to.getIndex(0, y);<NEW_LINE>int indexEndTo = indexTo + from.width;<NEW_LINE>while (indexTo < indexEndTo) {<NEW_LINE>// for (int x = 0; x < from.width; x++ ) {<NEW_LINE>int sum = from.data[indexFrom++];<NEW_LINE>sum += from.data[indexFrom++];<NEW_LINE>sum += from.data[indexFrom++];<NEW_LINE>to.data[indexTo++] = (byte) (sum / 3);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} else {<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, from.height, y -> {<NEW_LINE>for (int y = 0; y < from.height; y++) {<NEW_LINE>int indexFrom = from.getIndex(0, y);<NEW_LINE>int indexTo = to.getIndex(0, y);<NEW_LINE>for (int x = 0; x < from.width; x++) {<NEW_LINE>int sum = 0;<NEW_LINE>int indexFromEnd = indexFrom + numBands;<NEW_LINE>while (indexFrom < indexFromEnd) {<NEW_LINE>sum += from.data[indexFrom++];<NEW_LINE>}<NEW_LINE>to.data[indexTo++] = (byte) (sum / numBands);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>}<NEW_LINE>} | = from.data[indexFrom++]; |
1,065,244 | private void addCommitParents(RepositoryCommit commit, LayoutInflater inflater) {<NEW_LINE>List<Commit<MASK><NEW_LINE>if (parents == null || parents.isEmpty())<NEW_LINE>return;<NEW_LINE>for (Commit parent : parents) {<NEW_LINE>View parentView = inflater.inflate(R.layout.commit_parent_item, null);<NEW_LINE>TextView parentIdText = (TextView) parentView.findViewById(R.id.tv_commit_id);<NEW_LINE>parentIdText.setPaintFlags(parentIdText.getPaintFlags() | UNDERLINE_TEXT_FLAG);<NEW_LINE>StyledText parentText = new StyledText();<NEW_LINE>parentText.append(getString(R.string.parent_prefix));<NEW_LINE>parentText.monospace(CommitUtils.abbreviate(parent));<NEW_LINE>parentIdText.setText(parentText);<NEW_LINE>adapter.addHeader(parentView, parent, true);<NEW_LINE>}<NEW_LINE>} | > parents = commit.getParents(); |
618,090 | public //<NEW_LINE>void onSurfaceCreated(GL10 glUnused, EGLConfig config) {<NEW_LINE>String vShaderStr = "#version 300 es \n" + "layout(location = 0) in vec4 a_color; \n" + "layout(location = 1) in vec4 a_position; \n" + "out vec4 v_color; \n" + "void main() \n" + "{ \n" + " v_color = a_color; \n" + " gl_Position = a_position; \n" + "}";<NEW_LINE>String fShaderStr = "#version 300 es \n" + "precision mediump float; \n" + "in vec4 v_color; \n" + "out vec4 o_fragColor; \n" <MASK><NEW_LINE>// Load the shaders and get a linked program object<NEW_LINE>mProgramObject = ESShader.loadProgram(vShaderStr, fShaderStr);<NEW_LINE>GLES30.glClearColor(1.0f, 1.0f, 1.0f, 0.0f);<NEW_LINE>} | + "void main() \n" + "{ \n" + " o_fragColor = v_color; \n" + "}"; |
242,428 | public void thresholdBlock(int blockX0, int blockY0, GrayU8 input, GrayU8 stats, GrayU8 output) {<NEW_LINE>int x0 = blockX0 * blockWidth;<NEW_LINE>int y0 = blockY0 * blockHeight;<NEW_LINE>int x1 = blockX0 == stats.width - 1 ? input.width : (blockX0 + 1) * blockWidth;<NEW_LINE>int y1 = blockY0 == stats.height - 1 ? input.height : (blockY0 + 1) * blockHeight;<NEW_LINE>// define the local 3x3 region in blocks, taking in account the image border<NEW_LINE>int blockX1, blockY1;<NEW_LINE>if (thresholdFromLocalBlocks) {<NEW_LINE>blockX1 = Math.min(stats.width - 1, blockX0 + 1);<NEW_LINE>blockY1 = Math.min(stats.height - 1, blockY0 + 1);<NEW_LINE>blockX0 = Math.max(0, blockX0 - 1);<NEW_LINE>blockY0 = Math.max(0, blockY0 - 1);<NEW_LINE>} else {<NEW_LINE>blockX1 = blockX0;<NEW_LINE>blockY1 = blockY0;<NEW_LINE>}<NEW_LINE>// Average the mean across local blocks<NEW_LINE>int mean = 0;<NEW_LINE>for (int y = blockY0; y <= blockY1; y++) {<NEW_LINE>for (int x = blockX0; x <= blockX1; x++) {<NEW_LINE>mean += stats.unsafe_get(x, y);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>mean /= (blockY1 - blockY0 + 1) <MASK><NEW_LINE>for (int y = y0; y < y1; y++) {<NEW_LINE>int indexInput = input.startIndex + y * input.stride + x0;<NEW_LINE>int indexOutput = output.startIndex + y * output.stride + x0;<NEW_LINE>int end = indexOutput + (x1 - x0);<NEW_LINE>for (; indexOutput < end; indexOutput++, indexInput++) {<NEW_LINE>output.data[indexOutput] = (input.data[indexInput] & 0xFF) <= mean ? (byte) a : b;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | * (blockX1 - blockX0 + 1); |
839,540 | public boolean requestChildRectangleOnScreen(RecyclerViewBase parent, View child, Rect rect, boolean immediate) {<NEW_LINE>try {<NEW_LINE>final int parentLeft = getPaddingLeft();<NEW_LINE>final int parentTop = getPaddingTop();<NEW_LINE>final int parentRight = getWidth() - getPaddingRight();<NEW_LINE>final int parentBottom = getHeight() - getPaddingBottom();<NEW_LINE>final int childLeft = child.getLeft() + rect.left;<NEW_LINE>final int childTop = child.getTop() + rect.top;<NEW_LINE>final int childRight = childLeft + rect.right;<NEW_LINE>final int childBottom = childTop + rect.bottom;<NEW_LINE>final int offScreenLeft = Math.min(0, childLeft - parentLeft);<NEW_LINE>final int offScreenTop = Math.<MASK><NEW_LINE>final int offScreenRight = Math.max(0, childRight - parentRight);<NEW_LINE>final int offScreenBottom = Math.max(0, childBottom - parentBottom);<NEW_LINE>// Favor the "start" layout direction over the end when bringing<NEW_LINE>// one<NEW_LINE>// side or the other<NEW_LINE>// of a large rect into view.<NEW_LINE>final int dx;<NEW_LINE>{<NEW_LINE>dx = offScreenLeft != 0 ? offScreenLeft : offScreenRight;<NEW_LINE>}<NEW_LINE>// Favor bringing the top into view over the bottom<NEW_LINE>final int dy = offScreenTop != 0 ? offScreenTop : offScreenBottom;<NEW_LINE>if (dx != 0 || dy != 0) {<NEW_LINE>if (immediate) {<NEW_LINE>parent.scrollBy(dx, dy);<NEW_LINE>} else {<NEW_LINE>parent.smoothScrollBy(dx, dy, false);<NEW_LINE>}<NEW_LINE>if (parent.needNotifyFooter && !parent.checkNotifyFooterOnRelease) {<NEW_LINE>// Log.d("leo", "ontouchevent needNotify" + ",offsetY="<NEW_LINE>// + mOffsetY + "mTotalLength-height="<NEW_LINE>// + (mAdapter.getListTotalHeight() - getHeight()));<NEW_LINE>parent.needNotifyFooter = false;<NEW_LINE>parent.mRecycler.notifyLastFooterAppeared();<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} catch (StackOverflowError e) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | min(0, childTop - parentTop); |
513,367 | public static QueryAliyunCorpNumberResponse unmarshall(QueryAliyunCorpNumberResponse queryAliyunCorpNumberResponse, UnmarshallerContext context) {<NEW_LINE>queryAliyunCorpNumberResponse.setRequestId(context.stringValue("QueryAliyunCorpNumberResponse.RequestId"));<NEW_LINE>queryAliyunCorpNumberResponse.setSuccess(context.booleanValue("QueryAliyunCorpNumberResponse.Success"));<NEW_LINE>queryAliyunCorpNumberResponse.setCode(context.stringValue("QueryAliyunCorpNumberResponse.Code"));<NEW_LINE>queryAliyunCorpNumberResponse.setMessage(context.stringValue("QueryAliyunCorpNumberResponse.Message"));<NEW_LINE>queryAliyunCorpNumberResponse.setHttpStatusCode(context.integerValue("QueryAliyunCorpNumberResponse.HttpStatusCode"));<NEW_LINE>List<Number> numbers = new ArrayList<Number>();<NEW_LINE>for (int i = 0; i < context.lengthValue("QueryAliyunCorpNumberResponse.Numbers.Length"); i++) {<NEW_LINE>Number number = new Number();<NEW_LINE>number.setTaobaoUid(context.longValue<MASK><NEW_LINE>number.setRamId(context.longValue("QueryAliyunCorpNumberResponse.Numbers[" + i + "].RamId"));<NEW_LINE>number.setRealNameInsId(context.longValue("QueryAliyunCorpNumberResponse.Numbers[" + i + "].RealNameInsId"));<NEW_LINE>number.setNumber(context.stringValue("QueryAliyunCorpNumberResponse.Numbers[" + i + "].Number"));<NEW_LINE>number.setRegionNameProvince(context.stringValue("QueryAliyunCorpNumberResponse.Numbers[" + i + "].RegionNameProvince"));<NEW_LINE>number.setRegionNameCity(context.stringValue("QueryAliyunCorpNumberResponse.Numbers[" + i + "].RegionNameCity"));<NEW_LINE>number.setCorpName(context.stringValue("QueryAliyunCorpNumberResponse.Numbers[" + i + "].CorpName"));<NEW_LINE>number.setMonthlyPrice(context.stringValue("QueryAliyunCorpNumberResponse.Numbers[" + i + "].MonthlyPrice"));<NEW_LINE>number.setSpecName(context.stringValue("QueryAliyunCorpNumberResponse.Numbers[" + i + "].SpecName"));<NEW_LINE>number.setCommodityInstanceId(context.stringValue("QueryAliyunCorpNumberResponse.Numbers[" + i + "].CommodityInstanceId"));<NEW_LINE>number.setNumberCommodityStatus(context.integerValue("QueryAliyunCorpNumberResponse.Numbers[" + i + "].NumberCommodityStatus"));<NEW_LINE>number.setGmtCreate(context.stringValue("QueryAliyunCorpNumberResponse.Numbers[" + i + "].GmtCreate"));<NEW_LINE>PrivacyNumber privacyNumber = new PrivacyNumber();<NEW_LINE>privacyNumber.setPoolId(context.stringValue("QueryAliyunCorpNumberResponse.Numbers[" + i + "].PrivacyNumber.PoolId"));<NEW_LINE>privacyNumber.setType(context.stringValue("QueryAliyunCorpNumberResponse.Numbers[" + i + "].PrivacyNumber.Type"));<NEW_LINE>privacyNumber.setTelX(context.stringValue("QueryAliyunCorpNumberResponse.Numbers[" + i + "].PrivacyNumber.TelX"));<NEW_LINE>privacyNumber.setPoolName(context.stringValue("QueryAliyunCorpNumberResponse.Numbers[" + i + "].PrivacyNumber.PoolName"));<NEW_LINE>privacyNumber.setExtra(context.stringValue("QueryAliyunCorpNumberResponse.Numbers[" + i + "].PrivacyNumber.Extra"));<NEW_LINE>privacyNumber.setBizId(context.stringValue("QueryAliyunCorpNumberResponse.Numbers[" + i + "].PrivacyNumber.BizId"));<NEW_LINE>privacyNumber.setSubId(context.stringValue("QueryAliyunCorpNumberResponse.Numbers[" + i + "].PrivacyNumber.SubId"));<NEW_LINE>privacyNumber.setProviderId(context.stringValue("QueryAliyunCorpNumberResponse.Numbers[" + i + "].PrivacyNumber.ProviderId"));<NEW_LINE>privacyNumber.setRegionNameCity(context.stringValue("QueryAliyunCorpNumberResponse.Numbers[" + i + "].PrivacyNumber.RegionNameCity"));<NEW_LINE>number.setPrivacyNumber(privacyNumber);<NEW_LINE>numbers.add(number);<NEW_LINE>}<NEW_LINE>queryAliyunCorpNumberResponse.setNumbers(numbers);<NEW_LINE>return queryAliyunCorpNumberResponse;<NEW_LINE>} | ("QueryAliyunCorpNumberResponse.Numbers[" + i + "].taobaoUid")); |
1,715,653 | public AggregateResult queryAggData(AggConfig config) throws Exception {<NEW_LINE>String exec = sqlHelper.assembleAggDataSql(config);<NEW_LINE>List<String[]> list = new LinkedList<>();<NEW_LINE>LOG.info(exec);<NEW_LINE><MASK><NEW_LINE>Statement stat = connection.createStatement();<NEW_LINE>ResultSet rs = stat.executeQuery(exec)) {<NEW_LINE>ResultSetMetaData metaData = rs.getMetaData();<NEW_LINE>int columnCount = metaData.getColumnCount();<NEW_LINE>while (rs.next()) {<NEW_LINE>String[] row = new String[columnCount];<NEW_LINE>for (int j = 0; j < columnCount; j++) {<NEW_LINE>int columType = metaData.getColumnType(j + 1);<NEW_LINE>switch(columType) {<NEW_LINE>case java.sql.Types.DATE:<NEW_LINE>row[j] = rs.getDate(j + 1).toString();<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>row[j] = rs.getString(j + 1);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>list.add(row);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.error("ERROR:" + e.getMessage());<NEW_LINE>throw new Exception("ERROR:" + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>return DPCommonUtils.transform2AggResult(config, list);<NEW_LINE>} | try (Connection connection = getConnection(); |
826,142 | // private Throwable classSourceRecord;<NEW_LINE>//<NEW_LINE>// private synchronized void markClassSourceRecord(String i_className, String classSourceName) {<NEW_LINE>// classSourceRecord = new Throwable(<NEW_LINE>// "ClassTableMulti:" +<NEW_LINE>// " LastRecord [ " + Thread.currentThread().getName() + " ]" +<NEW_LINE>// " [ " + i_className + " ] [ " + classSourceName + " ]");<NEW_LINE>// }<NEW_LINE>//<NEW_LINE>// public synchronized void clearClassRecord() {<NEW_LINE>// classSourceRecord = null;<NEW_LINE>// }<NEW_LINE>//<NEW_LINE>// public synchronized void verifyClassRecord() {<NEW_LINE>// if ( classSourceRecord != null ) {<NEW_LINE>// System.out.println("ClassTableMulti: Class table [ " + getHashText() + " ]");<NEW_LINE>// System.out.println("ClassTableMutli: Class names [ " + i_classNames.hashCode() + " ]");<NEW_LINE>// classSourceRecord.printStackTrace(System.out);<NEW_LINE>// classSourceRecord = null;<NEW_LINE>//<NEW_LINE>// (new Throwable("ClassTableMulti: Eager [ " + Thread.currentThread().getName() + " ]")).printStackTrace(System.out);<NEW_LINE>// }<NEW_LINE>// }<NEW_LINE>@Override<NEW_LINE>public void record(String childClassSourceName, String i_className, String i_superclassName, List<String> i_useInterfaceNames, int modifiers) {<NEW_LINE>super.record(i_className, i_superclassName, i_useInterfaceNames, modifiers);<NEW_LINE>// markClassSourceRecord(i_className, classSourceName);<NEW_LINE><MASK><NEW_LINE>Set<String> i_classSourceClassNames = i_classSourceClassNamesMap.get(childClassSourceName);<NEW_LINE>if (i_classSourceClassNames == null) {<NEW_LINE>i_classSourceClassNames = createIdentityStringSet();<NEW_LINE>i_classSourceClassNamesMap.put(childClassSourceName, i_classSourceClassNames);<NEW_LINE>}<NEW_LINE>i_classSourceClassNames.add(i_className);<NEW_LINE>} | i_classNameClassSourceMap.put(i_className, childClassSourceName); |
758,680 | final RejectSharedDirectoryResult executeRejectSharedDirectory(RejectSharedDirectoryRequest rejectSharedDirectoryRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(rejectSharedDirectoryRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<RejectSharedDirectoryRequest> request = null;<NEW_LINE>Response<RejectSharedDirectoryResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new RejectSharedDirectoryRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(rejectSharedDirectoryRequest));<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, "Directory Service");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RejectSharedDirectory");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<RejectSharedDirectoryResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new RejectSharedDirectoryResultJsonUnmarshaller());<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); |
704,299 | public int executeUpdate(String sql, String[] columnNames) throws SQLException {<NEW_LINE>final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();<NEW_LINE>if (isTraceOn && tc.isEntryEnabled())<NEW_LINE>Tr.entry(this, tc, "executeUpdate", sql, Arrays.toString(columnNames));<NEW_LINE>int numUpdates;<NEW_LINE>try {<NEW_LINE>if (childWrapper != null) {<NEW_LINE>closeAndRemoveResultSet();<NEW_LINE>}<NEW_LINE>if (childWrappers != null && !childWrappers.isEmpty()) {<NEW_LINE>closeAndRemoveResultSets();<NEW_LINE>}<NEW_LINE>parentWrapper.beginTransactionIfNecessary();<NEW_LINE>enforceStatementProperties();<NEW_LINE>numUpdates = <MASK><NEW_LINE>} catch (SQLException ex) {<NEW_LINE>// No FFDC code needed. Might be an application error.<NEW_LINE>if (isTraceOn && tc.isEntryEnabled())<NEW_LINE>Tr.exit(this, tc, "executeUpdate", ex);<NEW_LINE>throw WSJdbcUtil.mapException(this, ex);<NEW_LINE>} catch (NullPointerException nullX) {<NEW_LINE>// No FFDC code needed; we might be closed.<NEW_LINE>if (isTraceOn && tc.isEntryEnabled())<NEW_LINE>Tr.exit(this, tc, "executeUpdate", "Exception");<NEW_LINE>throw runtimeXIfNotClosed(nullX);<NEW_LINE>}<NEW_LINE>if (isTraceOn && tc.isEntryEnabled())<NEW_LINE>Tr.exit(this, tc, "executeUpdate", numUpdates);<NEW_LINE>return numUpdates;<NEW_LINE>} | stmtImpl.executeUpdate(sql, columnNames); |
1,602,633 | public Collection<String> featuresCnC(PaddedList<IN> cInfo, int loc) {<NEW_LINE>Collection<String> features = new ArrayList<>();<NEW_LINE>CoreLabel c = cInfo.get(loc);<NEW_LINE>CoreLabel c1 = cInfo.get(loc + 1);<NEW_LINE>CoreLabel p = cInfo.get(loc - 1);<NEW_LINE>String charc = c.get(CoreAnnotations.CharAnnotation.class);<NEW_LINE>String charc1 = c1.get(CoreAnnotations.CharAnnotation.class);<NEW_LINE>String charp = p.<MASK><NEW_LINE>if (flags.useWordn) {<NEW_LINE>features.add(charc + "c");<NEW_LINE>features.add(charc1 + "c1");<NEW_LINE>features.add(charp + "p");<NEW_LINE>features.add(charp + charc + "pc");<NEW_LINE>if (flags.useAs || flags.useMsr || flags.usePk || flags.useHk) {<NEW_LINE>features.add(charc + charc1 + "cc1");<NEW_LINE>features.add(charp + charc1 + "pc1");<NEW_LINE>}<NEW_LINE>features.add("|wordn");<NEW_LINE>}<NEW_LINE>return features;<NEW_LINE>} | get(CoreAnnotations.CharAnnotation.class); |
1,523,310 | final ListSourceLocationsResult executeListSourceLocations(ListSourceLocationsRequest listSourceLocationsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listSourceLocationsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListSourceLocationsRequest> request = null;<NEW_LINE>Response<ListSourceLocationsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListSourceLocationsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listSourceLocationsRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "MediaTailor");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListSourceLocations");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListSourceLocationsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListSourceLocationsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); |
1,639,275 | public static SchemaMapping create(String schemaName, ResultSetMetaData metadata, DatabaseDialect dialect) throws SQLException {<NEW_LINE>Map<ColumnId, ColumnDefinition> colDefns = dialect.describeColumns(metadata);<NEW_LINE>Map<String, ColumnConverter> colConvertersByFieldName = new LinkedHashMap<>();<NEW_LINE>SchemaBuilder builder = SchemaBuilder.struct().name(schemaName);<NEW_LINE>int columnNumber = 0;<NEW_LINE>for (ColumnDefinition colDefn : colDefns.values()) {<NEW_LINE>++columnNumber;<NEW_LINE>String fieldName = dialect.addFieldToSchema(colDefn, builder);<NEW_LINE>if (fieldName == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Field field = builder.field(fieldName);<NEW_LINE>ColumnMapping mapping = new ColumnMapping(colDefn, columnNumber, field);<NEW_LINE>ColumnConverter converter = dialect.createColumnConverter(mapping);<NEW_LINE>colConvertersByFieldName.put(fieldName, converter);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>return new SchemaMapping(schema, colConvertersByFieldName);<NEW_LINE>} | Schema schema = builder.build(); |
210,501 | protected void update() {<NEW_LINE>if (!isUpdateNeeded()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>switch(numGains) {<NEW_LINE>case 0:<NEW_LINE>assert (A == null);<NEW_LINE>break;<NEW_LINE>case 1:<NEW_LINE>A.put(0, colorParameters[0]);<NEW_LINE>A.put(4, colorParameters[0]);<NEW_LINE>A.put(8, colorParameters[0]);<NEW_LINE>break;<NEW_LINE>case 3:<NEW_LINE>A.put(0, colorParameters[0]);<NEW_LINE>A.put(4, colorParameters[1]);<NEW_LINE>A.put(8, colorParameters[2]);<NEW_LINE>break;<NEW_LINE>case 9:<NEW_LINE>A.put(<MASK><NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>assert (false);<NEW_LINE>}<NEW_LINE>switch(numBiases) {<NEW_LINE>case 0:<NEW_LINE>assert (b == null);<NEW_LINE>break;<NEW_LINE>case 1:<NEW_LINE>b.put(0, colorParameters[numGains]);<NEW_LINE>b.put(1, colorParameters[numGains]);<NEW_LINE>b.put(2, colorParameters[numGains]);<NEW_LINE>break;<NEW_LINE>case 3:<NEW_LINE>b.put(0, colorParameters, numGains, 3);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>assert (false);<NEW_LINE>}<NEW_LINE>super.update();<NEW_LINE>setUpdateNeeded(false);<NEW_LINE>} | 0, colorParameters, 0, 9); |
1,761,545 | private static void parseArgs(Set<Integer> existLevelSet, List<PokerSell> pokerSells, Set<List<Poker>> pokersList, PokerSell pokerSell, int deep, SellType sellType, SellType targetSellType) {<NEW_LINE>if (deep == 0) {<NEW_LINE>List<Poker> allPokers = new ArrayList<<MASK><NEW_LINE>for (List<Poker> ps : pokersList) {<NEW_LINE>allPokers.addAll(ps);<NEW_LINE>}<NEW_LINE>pokerSells.add(new PokerSell(targetSellType, allPokers, pokerSell.getCoreLevel()));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (int index = 0; index < pokerSells.size(); index++) {<NEW_LINE>PokerSell subSell = pokerSells.get(index);<NEW_LINE>if (subSell.getSellType() == sellType && !existLevelSet.contains(subSell.getCoreLevel())) {<NEW_LINE>pokersList.add(subSell.getSellPokers());<NEW_LINE>existLevelSet.add(subSell.getCoreLevel());<NEW_LINE>parseArgs(existLevelSet, pokerSells, pokersList, pokerSell, deep - 1, sellType, targetSellType);<NEW_LINE>existLevelSet.remove(subSell.getCoreLevel());<NEW_LINE>pokersList.remove(subSell.getSellPokers());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | >(pokerSell.getSellPokers()); |
1,418,203 | public long handle(Emulator<?> emulator) {<NEW_LINE>RegisterContext context = emulator.getContext();<NEW_LINE>UnidbgPointer object = context.getPointerArg(1);<NEW_LINE>UnidbgPointer jmethodID = context.getPointerArg(2);<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("CallIntMethod object=" + object + ", jmethodID=" + jmethodID);<NEW_LINE>}<NEW_LINE>DvmObject<?> dvmObject = getObject(object.toIntPeer());<NEW_LINE>DvmClass dvmClass = dvmObject == null ? null : dvmObject.getObjectType();<NEW_LINE>DvmMethod dvmMethod = dvmClass == null ? null : dvmClass.getMethod(jmethodID.toIntPeer());<NEW_LINE>if (dvmMethod == null) {<NEW_LINE>throw new BackendException();<NEW_LINE>} else {<NEW_LINE>VarArg varArg = ArmVarArg.create(emulator, DalvikVM64.this, dvmMethod);<NEW_LINE>int ret = dvmMethod.callIntMethod(dvmObject, varArg);<NEW_LINE>if (verbose) {<NEW_LINE>System.out.printf("JNIEnv->CallIntMethod(%s, %s(%s) => 0x%x) was called from %s%n", dvmObject, dvmMethod.methodName, varArg.formatArgs(), <MASK><NEW_LINE>}<NEW_LINE>return ret;<NEW_LINE>}<NEW_LINE>} | ret, context.getLRPointer()); |
175,150 | public String createMockjsDataAuto() throws UnsupportedEncodingException {<NEW_LINE>String callback = getCallback();<NEW_LINE>boolean isJSON = false;<NEW_LINE>updateProjectListMockNum(SystemVisitorLog.mock(__id__, "createMockjsData", pattern, getCurAccount()));<NEW_LINE>String _c = get_c();<NEW_LINE>Map<String, Object> options = new HashMap<String, Object>();<NEW_LINE>options.put("method", getMethod());<NEW_LINE><MASK><NEW_LINE>String result = mockMgr.generateRuleData(__id__, pattern, options);<NEW_LINE>if (options.get("callback") != null) {<NEW_LINE>_c = (String) options.get("callback");<NEW_LINE>callback = (String) options.get("callback");<NEW_LINE>}<NEW_LINE>if (callback != null && !callback.isEmpty()) {<NEW_LINE>setContent(callback + "(" + result + ")");<NEW_LINE>} else if (_c != null && !_c.isEmpty()) {<NEW_LINE>setContent(_c + "(" + result + ")");<NEW_LINE>} else {<NEW_LINE>isJSON = true;<NEW_LINE>setContent(result);<NEW_LINE>}<NEW_LINE>if (isJSON) {<NEW_LINE>return "json";<NEW_LINE>} else {<NEW_LINE>return SUCCESS;<NEW_LINE>}<NEW_LINE>} | options.put("loadRule", true); |
528,253 | public static void bakeCube(List<MutableQuad> quads, EntityResizableCuboid cuboid, boolean outsideFace, boolean insideFace) {<NEW_LINE>TextureAtlasSprite[] sprites = cuboid.textures;<NEW_LINE>if (sprites == null) {<NEW_LINE>sprites = new TextureAtlasSprite[6];<NEW_LINE>for (int i = 0; i < 6; i++) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>int[] flips = cuboid.textureFlips;<NEW_LINE>if (flips == null) {<NEW_LINE>flips = new int[6];<NEW_LINE>}<NEW_LINE>Vec3d textureStart = new Vec3d(cuboid.textureStartX / 16D, cuboid.textureStartY / 16D, cuboid.textureStartZ / 16D);<NEW_LINE>Vec3d textureSize = new Vec3d(cuboid.textureSizeX / 16D, cuboid.textureSizeY / 16D, cuboid.textureSizeZ / 16D);<NEW_LINE>Vec3d textureOffset = new Vec3d(cuboid.textureOffsetX / 16D, cuboid.textureOffsetY / 16D, cuboid.textureOffsetZ / 16D);<NEW_LINE>Vec3d size = new Vec3d(cuboid.xSize, cuboid.ySize, cuboid.zSize);<NEW_LINE>for (EnumFacing face : EnumFacing.values()) {<NEW_LINE>bakeCuboidFace(quads, cuboid, face, sprites, flips, textureStart, textureSize, size, textureOffset, outsideFace, insideFace);<NEW_LINE>}<NEW_LINE>} | sprites[i] = cuboid.texture; |
1,290,527 | private void recalculateScoresFromVector(Vulnerability vuln) {<NEW_LINE>// Recalculate V2 score based on vector passed to resource and normalize vector<NEW_LINE>final Cvss v2 = Cvss.fromVector(vuln.getCvssV2Vector());<NEW_LINE>if (v2 != null) {<NEW_LINE>final Score score = v2.calculateScore();<NEW_LINE>vuln.setCvssV2BaseScore(BigDecimal.valueOf(score.getBaseScore()));<NEW_LINE>vuln.setCvssV2ImpactSubScore(BigDecimal.valueOf(score.getImpactSubScore()));<NEW_LINE>vuln.setCvssV2ExploitabilitySubScore(BigDecimal.valueOf(score.getExploitabilitySubScore()));<NEW_LINE>vuln.setCvssV2Vector(v2.getVector());<NEW_LINE>}<NEW_LINE>// Recalculate V3 score based on vector passed to resource and normalize vector<NEW_LINE>final Cvss v3 = Cvss.<MASK><NEW_LINE>if (v3 != null) {<NEW_LINE>final Score score = v3.calculateScore();<NEW_LINE>vuln.setCvssV3BaseScore(BigDecimal.valueOf(score.getBaseScore()));<NEW_LINE>vuln.setCvssV3ImpactSubScore(BigDecimal.valueOf(score.getImpactSubScore()));<NEW_LINE>vuln.setCvssV3ExploitabilitySubScore(BigDecimal.valueOf(score.getExploitabilitySubScore()));<NEW_LINE>vuln.setCvssV3Vector(v3.getVector());<NEW_LINE>}<NEW_LINE>} | fromVector(vuln.getCvssV3Vector()); |
1,091,248 | public MdmLink createOrUpdateLinkEntity(IBaseResource theGoldenResource, IBaseResource theSourceResource, MdmMatchOutcome theMatchOutcome, MdmLinkSourceEnum theLinkSource, @Nullable MdmTransactionContext theMdmTransactionContext) {<NEW_LINE>Long goldenResourcePid = myJpaIdHelperService.getPidOrNull(theGoldenResource);<NEW_LINE>Long sourceResourcePid = myJpaIdHelperService.getPidOrNull(theSourceResource);<NEW_LINE>MdmLink mdmLink = getOrCreateMdmLinkByGoldenResourcePidAndSourceResourcePid(goldenResourcePid, sourceResourcePid);<NEW_LINE>mdmLink.setLinkSource(theLinkSource);<NEW_LINE>mdmLink.<MASK><NEW_LINE>// Preserve these flags for link updates<NEW_LINE>mdmLink.setEidMatch(theMatchOutcome.isEidMatch() | mdmLink.isEidMatchPresent());<NEW_LINE>mdmLink.setHadToCreateNewGoldenResource(theMatchOutcome.isCreatedNewResource() | mdmLink.getHadToCreateNewGoldenResource());<NEW_LINE>mdmLink.setMdmSourceType(myFhirContext.getResourceType(theSourceResource));<NEW_LINE>if (mdmLink.getScore() != null) {<NEW_LINE>mdmLink.setScore(Math.max(theMatchOutcome.score, mdmLink.getScore()));<NEW_LINE>} else {<NEW_LINE>mdmLink.setScore(theMatchOutcome.score);<NEW_LINE>}<NEW_LINE>String message = String.format("Creating MdmLink from %s to %s -> %s", theGoldenResource.getIdElement().toUnqualifiedVersionless(), theSourceResource.getIdElement().toUnqualifiedVersionless(), theMatchOutcome);<NEW_LINE>theMdmTransactionContext.addTransactionLogMessage(message);<NEW_LINE>ourLog.debug(message);<NEW_LINE>save(mdmLink);<NEW_LINE>return mdmLink;<NEW_LINE>} | setMatchResult(theMatchOutcome.getMatchResultEnum()); |
1,316,563 | public static int trap(int[] height) {<NEW_LINE>int result = 0;<NEW_LINE>if (height == null || height.length <= 2)<NEW_LINE>return result;<NEW_LINE>int[] left <MASK><NEW_LINE>int[] right = new int[height.length];<NEW_LINE>// scan from left to right<NEW_LINE>int max = height[0];<NEW_LINE>left[0] = height[0];<NEW_LINE>for (int i = 1; i < height.length; i++) {<NEW_LINE>if (height[i] < max) {<NEW_LINE>left[i] = max;<NEW_LINE>} else {<NEW_LINE>left[i] = height[i];<NEW_LINE>max = height[i];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// scan from right to left<NEW_LINE>max = height[height.length - 1];<NEW_LINE>right[height.length - 1] = height[height.length - 1];<NEW_LINE>for (int i = height.length - 2; i >= 0; i--) {<NEW_LINE>if (height[i] < max) {<NEW_LINE>right[i] = max;<NEW_LINE>} else {<NEW_LINE>right[i] = height[i];<NEW_LINE>max = height[i];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// calculate total<NEW_LINE>for (int i = 0; i < height.length; i++) {<NEW_LINE>result += Math.min(left[i], right[i]) - height[i];<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | = new int[height.length]; |
1,131,828 | public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventContext converters) {<NEW_LINE>BuildEventStreamProtos.TargetComplete.Builder builder = BuildEventStreamProtos.TargetComplete.newBuilder();<NEW_LINE>boolean failed = failed();<NEW_LINE>builder.setSuccess(!failed);<NEW_LINE>if (detailedExitCode != null) {<NEW_LINE>if (!failed) {<NEW_LINE>BugReport.sendBugReport(new IllegalStateException("Detailed exit code with success? " + detailedExitCode));<NEW_LINE>}<NEW_LINE>FailureDetails.FailureDetail failureDetail = detailedExitCode.getFailureDetail();<NEW_LINE>if (failureDetail != null) {<NEW_LINE>builder.setFailureDetail(failureDetail);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>builder.addAllTag(getTags());<NEW_LINE>builder.addAllOutputGroup(getOutputFilesByGroup<MASK><NEW_LINE>if (isTest) {<NEW_LINE>builder.setTestTimeout(Durations.fromSeconds(testTimeoutSeconds));<NEW_LINE>builder.setTestTimeoutSeconds(testTimeoutSeconds);<NEW_LINE>}<NEW_LINE>Iterable<Artifact> filteredImportantArtifacts = getLegacyFilteredImportantArtifacts();<NEW_LINE>for (Artifact artifact : filteredImportantArtifacts) {<NEW_LINE>if (artifact.isDirectory()) {<NEW_LINE>builder.addDirectoryOutput(newFileFromArtifact(artifact, completionContext).build());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// TODO(aehlig): remove direct reporting of artifacts as soon as clients no longer need it.<NEW_LINE>if (converters.getOptions().legacyImportantOutputs) {<NEW_LINE>addImportantOutputs(completionContext, builder, converters, filteredImportantArtifacts);<NEW_LINE>if (baselineCoverageArtifacts != null) {<NEW_LINE>addImportantOutputs(completionContext, builder, artifact -> BASELINE_COVERAGE, converters, baselineCoverageArtifacts.toList());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>BuildEventStreamProtos.TargetComplete complete = builder.build();<NEW_LINE>return GenericBuildEvent.protoChaining(this).setCompleted(complete).build();<NEW_LINE>} | (converters.artifactGroupNamer())); |
1,530,130 | protected Control createPreferenceContent(Composite parent) {<NEW_LINE>Composite composite = UIUtils.createPlaceholder(parent, 2, 5);<NEW_LINE>{<NEW_LINE>Group uiGroup = UIUtils.createControlGroup(composite, DataEditorsMessages.pref_page_database_resultsets_group_common, 1, SWT.NONE, 0);<NEW_LINE>((GridData) uiGroup.getLayoutData()).horizontalSpan = 2;<NEW_LINE>autoSwitchMode = UIUtils.createCheckbox(uiGroup, DataEditorsMessages.pref_page_database_resultsets_label_switch_mode_on_rows, false);<NEW_LINE>showDescription = UIUtils.createCheckbox(uiGroup, DataEditorsMessages.pref_page_database_resultsets_label_show_column_description, false);<NEW_LINE>columnWidthByValue = UIUtils.createCheckbox(uiGroup, DataEditorsMessages.pref_page_database_resultsets_label_calc_column_width_by_values, DataEditorsMessages.pref_page_database_resultsets_label_calc_column_width_by_values_tip, false, 1);<NEW_LINE>showConnectionName = UIUtils.createCheckbox(uiGroup, DataEditorsMessages.pref_page_database_resultsets_label_show_connection_name, false);<NEW_LINE>transformComplexTypes = UIUtils.createCheckbox(uiGroup, DataEditorsMessages.pref_page_database_resultsets_label_structurize_complex_types, DataEditorsMessages.pref_page_database_resultsets_label_structurize_complex_types_tip, false, 1);<NEW_LINE>rightJustifyNumbers = UIUtils.createCheckbox(uiGroup, DataEditorsMessages.pref_page_database_resultsets_label_right_justify_numbers_and_date, null, false, 1);<NEW_LINE>rightJustifyDateTime = UIUtils.createCheckbox(uiGroup, DataEditorsMessages.pref_page_database_resultsets_label_right_justify_datetime, null, false, 1);<NEW_LINE>autoCompleteProposal = UIUtils.createCheckbox(uiGroup, DataEditorsMessages.pref_page_database_resultsets_label_auto_completion, <MASK><NEW_LINE>}<NEW_LINE>return composite;<NEW_LINE>} | DataEditorsMessages.pref_page_database_resultsets_label_auto_completion_tip, true, 1); |
1,510,906 | public void handle(Map data) {<NEW_LINE>markSnapshotTreeCompleted(snapshot);<NEW_LINE>if (volumeNewInstallPath != null) {<NEW_LINE>vol.setInstallPath(volumeNewInstallPath);<NEW_LINE>dbf.update(vol);<NEW_LINE>}<NEW_LINE>VolumeSnapshotVO svo = dbf.findByUuid(snapshot.getUuid(), VolumeSnapshotVO.class);<NEW_LINE>svo.setType(snapshot.getType());<NEW_LINE>svo.setPrimaryStorageUuid(snapshot.getPrimaryStorageUuid());<NEW_LINE>svo.<MASK><NEW_LINE>svo.setStatus(VolumeSnapshotStatus.Ready);<NEW_LINE>svo.setSize(snapshot.getSize());<NEW_LINE>if (snapshot.getFormat() != null) {<NEW_LINE>svo.setFormat(snapshot.getFormat());<NEW_LINE>}<NEW_LINE>svo = dbf.updateAndRefresh(svo);<NEW_LINE>new FireSnapShotCanonicalEvent().fireSnapShotStatusChangedEvent(VolumeSnapshotStatus.valueOf(snapshot.getStatus()), VolumeSnapshotInventory.valueOf(svo));<NEW_LINE>ret.setInventory(VolumeSnapshotInventory.valueOf(svo));<NEW_LINE>bus.reply(msg, ret);<NEW_LINE>} | setPrimaryStorageInstallPath(snapshot.getPrimaryStorageInstallPath()); |
93,150 | public static void main(String[] args) throws Exception {<NEW_LINE>CliArgs parsedArgs = new CliArgs();<NEW_LINE>CmdLineParser cmdLineParser = new CmdLineParser(parsedArgs);<NEW_LINE>cmdLineParser.parseArgument(args);<NEW_LINE>SoyTemplateSkylarkSignatureRenderer renderer = new SoyTemplateSkylarkSignatureRenderer();<NEW_LINE>ImmutableList<SkylarkCallable> skylarkSignatures = SignatureCollector.getSkylarkCallables(classInfo -> classInfo.getPackageName().contains(parsedArgs.skylarkPackage)).collect(ImmutableList.toImmutableList());<NEW_LINE>Path destinationPath = parsedArgs.destinationDirectory.toPath();<NEW_LINE>Path <MASK><NEW_LINE>String tableOfContents = renderer.renderTableOfContents(skylarkSignatures);<NEW_LINE>Files.write(tableOfContentsPath, tableOfContents.getBytes(StandardCharsets.UTF_8));<NEW_LINE>for (SkylarkCallable signature : skylarkSignatures) {<NEW_LINE>Path functionPath = destinationPath.resolve(signature.name() + ".soy");<NEW_LINE>String functionContent = renderer.render(signature);<NEW_LINE>Files.write(functionPath, functionContent.getBytes(StandardCharsets.UTF_8));<NEW_LINE>}<NEW_LINE>} | tableOfContentsPath = destinationPath.resolve("__table_of_contents.soy"); |
1,500,109 | /*<NEW_LINE>* Application entry point.<NEW_LINE>*/<NEW_LINE>public static void main(String[] args) {<NEW_LINE>String version = StringUtil.CALIFORNIUM_VERSION == null ? "" : StringUtil.CALIFORNIUM_VERSION;<NEW_LINE>CommandLine cmd = new CommandLine(config);<NEW_LINE>try {<NEW_LINE>ParseResult result = cmd.parseArgs(args);<NEW_LINE>if (result.isVersionHelpRequested()) {<NEW_LINE>System.out.println("\nCalifornium (Cf) " + cmd.getCommandName() + " " + version);<NEW_LINE><MASK><NEW_LINE>System.out.println();<NEW_LINE>}<NEW_LINE>if (result.isUsageHelpRequested()) {<NEW_LINE>cmd.usage(System.out);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} catch (ParameterException ex) {<NEW_LINE>System.err.println(ex.getMessage());<NEW_LINE>System.err.println();<NEW_LINE>cmd.usage(System.err);<NEW_LINE>System.exit(-1);<NEW_LINE>}<NEW_LINE>Configuration netConfig = Configuration.createWithFile(CONFIG_FILE, CONFIG_HEADER, DEFAULTS);<NEW_LINE>// reduce the message size for plain UDP<NEW_LINE>Configuration udpConfig = new Configuration(netConfig).set(CoapConfig.MAX_MESSAGE_SIZE, netConfig.get(EXTERNAL_UDP_MAX_MESSAGE_SIZE)).set(CoapConfig.PREFERRED_BLOCK_SIZE, netConfig.get(EXTERNAL_UDP_PREFERRED_BLOCK_SIZE));<NEW_LINE>Map<Select, Configuration> protocolConfig = new HashMap<>();<NEW_LINE>protocolConfig.put(new Select(Protocol.UDP, InterfaceType.EXTERNAL), udpConfig);<NEW_LINE>try {<NEW_LINE>String filesRootPath = config.fileRoot;<NEW_LINE>String coapRootPath = config.pathRoot;<NEW_LINE>if (0 <= coapRootPath.indexOf('/')) {<NEW_LINE>LOG.error("{} don't use '/'! Only one path segement for coap root allowed!", coapRootPath);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>File filesRoot = new File(filesRootPath);<NEW_LINE>if (!filesRoot.exists()) {<NEW_LINE>LOG.error("{} doesn't exists!", filesRoot.getAbsolutePath());<NEW_LINE>return;<NEW_LINE>} else if (!filesRoot.isDirectory()) {<NEW_LINE>LOG.error("{} is no directory!", filesRoot.getAbsolutePath());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>listURIs(filesRoot, coapRootPath);<NEW_LINE>// create server<NEW_LINE>SimpleFileServer server = new SimpleFileServer(netConfig, protocolConfig, coapRootPath, filesRoot);<NEW_LINE>server.add(new MyContext(MyContext.RESOURCE_NAME, version, true));<NEW_LINE>// add endpoints on all IP addresses<NEW_LINE>server.addEndpoints(config);<NEW_LINE>server.start();<NEW_LINE>} catch (SocketException e) {<NEW_LINE>LOG.error("Failed to initialize server: ", e);<NEW_LINE>}<NEW_LINE>} | cmd.printVersionHelp(System.out); |
1,346,927 | public static Object convertRV(String sig, Object[] rp, Method m, AbstractConnection conn) throws DBusException {<NEW_LINE>Class<? extends Object> c = m.getReturnType();<NEW_LINE>if (null == rp) {<NEW_LINE>if (null == c || Void.TYPE.equals(c))<NEW_LINE>return null;<NEW_LINE>else<NEW_LINE>throw <MASK><NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>if (Debug.debug)<NEW_LINE>Debug.print(Debug.VERBOSE, "Converting return parameters from " + Arrays.deepToString(rp) + " to type " + m.getGenericReturnType());<NEW_LINE>rp = Marshalling.deSerializeParameters(rp, new Type[] { m.getGenericReturnType() }, conn);<NEW_LINE>} catch (Exception e) {<NEW_LINE>if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug)<NEW_LINE>Debug.print(Debug.ERR, e);<NEW_LINE>throw new DBusExecutionException(MessageFormat.format(getString("invalidReturnType"), new Object[] { e.getMessage() }));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>switch(rp.length) {<NEW_LINE>case 0:<NEW_LINE>if (null == c || Void.TYPE.equals(c))<NEW_LINE>return null;<NEW_LINE>else<NEW_LINE>throw new DBusExecutionException(getString("voidReturnType"));<NEW_LINE>case 1:<NEW_LINE>return rp[0];<NEW_LINE>default:<NEW_LINE>// check we are meant to return multiple values<NEW_LINE>if (!Tuple.class.isAssignableFrom(c))<NEW_LINE>throw new DBusExecutionException(getString("tupleReturnType"));<NEW_LINE>Constructor<? extends Object> cons = c.getConstructors()[0];<NEW_LINE>try {<NEW_LINE>return cons.newInstance(rp);<NEW_LINE>} catch (Exception e) {<NEW_LINE>if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug)<NEW_LINE>Debug.print(Debug.ERR, e);<NEW_LINE>throw new DBusException(e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | new DBusExecutionException(getString("voidReturnType")); |
521,231 | private static void emitGenericHelp(OutErr outErr, BlazeRuntime runtime) {<NEW_LINE>outErr.printOut(String.format("Usage: %s <command> <options> ...\n\n", runtime.getProductName()));<NEW_LINE>outErr.printOut("Available commands:\n");<NEW_LINE>Map<String, BlazeCommand> commandsByName = runtime.getCommandMap();<NEW_LINE>List<String> namesInOrder = new ArrayList<>(commandsByName.keySet());<NEW_LINE>Collections.sort(namesInOrder);<NEW_LINE>for (String name : namesInOrder) {<NEW_LINE>BlazeCommand command = commandsByName.get(name);<NEW_LINE>Command annotation = command.getClass().getAnnotation(Command.class);<NEW_LINE>if (annotation.hidden()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String shortDescription = annotation.shortDescription().replace("%{product}", runtime.getProductName());<NEW_LINE>outErr.printOut(String.format(" %-19s %s\n", name, shortDescription));<NEW_LINE>}<NEW_LINE>outErr.printOut("\n");<NEW_LINE>outErr.printOut("Getting more help:\n");<NEW_LINE>outErr.printOut(String.format(" %s help <command>\n"<MASK><NEW_LINE>outErr.printOut(" Prints help and options for <command>.\n");<NEW_LINE>outErr.printOut(String.format(" %s help startup_options\n", runtime.getProductName()));<NEW_LINE>outErr.printOut(String.format(" Options for the JVM hosting %s.\n", runtime.getProductName()));<NEW_LINE>outErr.printOut(String.format(" %s help target-syntax\n", runtime.getProductName()));<NEW_LINE>outErr.printOut(" Explains the syntax for specifying targets.\n");<NEW_LINE>outErr.printOut(String.format(" %s help info-keys\n", runtime.getProductName()));<NEW_LINE>outErr.printOut(" Displays a list of keys used by the info command.\n");<NEW_LINE>} | , runtime.getProductName())); |
349,315 | public static IntList newInstance(final IntList delegateList, final int blockSize) {<NEW_LINE>if (blockSize < 1)<NEW_LINE>throw new IllegalArgumentException("Unsupported blockSize:" + blockSize);<NEW_LINE>if (delegateList.size() == 0)<NEW_LINE>return new FullIntList(new int[0]);<NEW_LINE>IntList intDeltaCompressor = SmartDeltaCompressor.newInstance(new IntList() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public int size() {<NEW_LINE>return delegateList.size();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public int get(int index) {<NEW_LINE>return delegateList.get(index) - delegateList.get(index - (index % blockSize));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>int[] strongValues = new int[(delegateList.size() - 1) / blockSize + 1];<NEW_LINE>for (int i = 0; i < strongValues.length; i++) {<NEW_LINE>strongValues[i] = delegateList.get(i * blockSize);<NEW_LINE>}<NEW_LINE>return new <MASK><NEW_LINE>} | CompressedIntList(blockSize, strongValues, intDeltaCompressor); |
673,354 | private byte[] encodeBlock(ArrayList<Point> list) {<NEW_LINE>// Quantification<NEW_LINE>int m = list.size();<NEW_LINE>int[<MASK><NEW_LINE>long[] value = new long[m];<NEW_LINE>double eps = Math.pow(2, beta);<NEW_LINE>for (int i = 0; i < m; i++) {<NEW_LINE>Point p = list.get(i);<NEW_LINE>index[i] = p.getIndex();<NEW_LINE>value[i] = Math.round(p.getValue() / eps);<NEW_LINE>}<NEW_LINE>BitConstructor constructor = new BitConstructor(9 + 13 * m);<NEW_LINE>// Block size with 16 bits<NEW_LINE>constructor.add(writeIndex, 16);<NEW_LINE>// Number of reserved components with 16 bits<NEW_LINE>constructor.add(m, 16);<NEW_LINE>// Exponent of quantification level with 16 bits<NEW_LINE>constructor.add(beta, 16);<NEW_LINE>// Encode the index sequence<NEW_LINE>encodeIndex(index, constructor);<NEW_LINE>// Encode the value sequence<NEW_LINE>encodeValue(value, constructor);<NEW_LINE>constructor.pad();<NEW_LINE>// return the encoded bytes<NEW_LINE>return constructor.toByteArray();<NEW_LINE>} | ] index = new int[m]; |
849,163 | private Savable readSavableFromCurrentElem(Savable defVal) throws InstantiationException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IOException, IllegalAccessException {<NEW_LINE>Savable ret = defVal;<NEW_LINE>Savable tmp = null;<NEW_LINE>if (currentElem == null || currentElem.getNodeName().equals("null")) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>String reference = currentElem.getAttribute("ref");<NEW_LINE>if (reference.length() > 0) {<NEW_LINE>ret = referencedSavables.get(reference);<NEW_LINE>} else {<NEW_LINE>String className = currentElem.getNodeName();<NEW_LINE>if (currentElem.hasAttribute("class")) {<NEW_LINE>className = currentElem.getAttribute("class");<NEW_LINE>} else if (defVal != null) {<NEW_LINE>className = defVal.getClass().getName();<NEW_LINE>}<NEW_LINE>tmp = SavableClassUtil.fromName(className, null);<NEW_LINE>String versionsStr = currentElem.getAttribute("savable_versions");<NEW_LINE>if (versionsStr != null && !versionsStr.equals("")) {<NEW_LINE>String[] versionStr = versionsStr.split(",");<NEW_LINE>classHierarchyVersions = new int[versionStr.length];<NEW_LINE>for (int i = 0; i < classHierarchyVersions.length; i++) {<NEW_LINE>classHierarchyVersions[i] = Integer.parseInt(versionStr[i].trim());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>classHierarchyVersions = null;<NEW_LINE>}<NEW_LINE>String refID = currentElem.getAttribute("reference_ID");<NEW_LINE>if (refID.length() < 1)<NEW_LINE><MASK><NEW_LINE>if (refID.length() > 0)<NEW_LINE>referencedSavables.put(refID, tmp);<NEW_LINE>if (tmp != null) {<NEW_LINE>// Allows reading versions from this savable<NEW_LINE>savable = tmp;<NEW_LINE>tmp.read(importer);<NEW_LINE>ret = tmp;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return ret;<NEW_LINE>} | refID = currentElem.getAttribute("id"); |
812,587 | public int handleTask(ConsoleWrapper stdin, PrintStream stdout, PrintStream stderr, String[] args) throws Exception {<NEW_LINE>setTaskIO(new TaskIO(stdin, stdout, stderr));<NEW_LINE>setTaskArgs(args);<NEW_LINE>JobInstance jobInstance;<NEW_LINE>JobExecution jobExecution;<NEW_LINE>long executionId = resolveJobExecutionId();<NEW_LINE>if (executionId >= 0) {<NEW_LINE>jobExecution = getBatchRestClient().stop(executionId);<NEW_LINE>jobInstance = getBatchRestClient().<MASK><NEW_LINE>} else {<NEW_LINE>jobInstance = getBatchRestClient().getJobInstance(getJobInstanceId());<NEW_LINE>jobExecution = getBatchRestClient().stop(jobInstance);<NEW_LINE>}<NEW_LINE>issueJobStopSubmittedMessage(jobInstance);<NEW_LINE>if (shouldWaitForTermination()) {<NEW_LINE>// If there are no job executions, consider the job stopped. If the status has not been updated<NEW_LINE>// because of a database problem, we don't want to sit and wait forever.<NEW_LINE>if (jobExecution.getExecutionId() == -1) {<NEW_LINE>issueJobStoppedMessage(jobInstance, null);<NEW_LINE>return 0;<NEW_LINE>} else {<NEW_LINE>jobExecution = waitForTermination(jobInstance, jobExecution);<NEW_LINE>return getProcessReturnCode(jobExecution);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>} | getJobInstanceForJobExecution(jobExecution.getExecutionId()); |
1,176,598 | public com.amazonaws.services.elasticfilesystem.model.PolicyNotFoundException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.elasticfilesystem.model.PolicyNotFoundException policyNotFoundException = new com.amazonaws.services.elasticfilesystem.model.PolicyNotFoundException(null);<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("ErrorCode", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>policyNotFoundException.setErrorCode(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 policyNotFoundException;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,716,583 | public void startImport() {<NEW_LINE>List<Path> fileList = checkedFileListProperty.stream().map(item -> item.getValue().getPath()).filter(path -> path.toFile().isFile()).collect(Collectors.toList());<NEW_LINE>if (fileList.isEmpty()) {<NEW_LINE>LOGGER.warn("There are no valid files checked");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>resultList.clear();<NEW_LINE>importFilesBackgroundTask = importHandler.importFilesInBackground(fileList).onRunning(() -> {<NEW_LINE>progressValueProperty.<MASK><NEW_LINE>progressTextProperty.bind(importFilesBackgroundTask.messageProperty());<NEW_LINE>taskActiveProperty.setValue(true);<NEW_LINE>}).onFinished(() -> {<NEW_LINE>progressValueProperty.unbind();<NEW_LINE>progressTextProperty.unbind();<NEW_LINE>taskActiveProperty.setValue(false);<NEW_LINE>}).onSuccess(resultList::addAll);<NEW_LINE>importFilesBackgroundTask.executeWith(taskExecutor);<NEW_LINE>} | bind(importFilesBackgroundTask.workDonePercentageProperty()); |
1,167,729 | public void onClick(View v) {<NEW_LINE>SimpleDialogFragment.createBuilder(c, getSupportFragmentManager()).setTitle("More Firefly quotes:").setMessage("Wash: \"Psychic, though? That sounds like something out of science fiction.\"\n\nZoe: \"We live" + " " + "in a space ship, dear.\"\nWash: \"Here lies my beloved Zoe, " + ("my autumn flower ... somewhat less attractive now that she's all corpsified and gross" + ".\"\n\nRiver Tam: \"Also? I can kill you with my brain.\"\n\nKayle: \"Going on a year now, nothins twixed my neathers not run on batteries.\" \n" + "Mal: \"I can't know that.\" \n" + "Jayne: \"I can stand to hear a little more.\"\n\nWash: \"I've been under fire before. " + "Well ... I've been in a fire. Actually, I was fired. I can handle myself.\"")).<MASK><NEW_LINE>} | setNegativeButtonText("Close").show(); |
433,380 | public void validateModelSpecificInfo() throws InvalidDataTypeException {<NEW_LINE>Program program = getProgram();<NEW_LINE>Address startAddress = getAddress();<NEW_LINE>boolean validateReferredToData = validationOptions.shouldValidateReferredToData();<NEW_LINE>// Num1 is dword at SIGNATURE_OFFSET.<NEW_LINE>// No additional validation for this yet.<NEW_LINE>// Num2 is dword at VB_TABLE_OFFSET_OFFSET.<NEW_LINE>// No additional validation for this yet.<NEW_LINE>// Num3 is dword at CONSTRUCTOR_DISP_OFFSET_OFFSET.<NEW_LINE>// No additional validation for this yet.<NEW_LINE>// Next component should refer to RTTI0.<NEW_LINE>Address rtti0CompAddress = startAddress.add(RTTI_0_PTR_OFFSET);<NEW_LINE>Address <MASK><NEW_LINE>if (rtti0Address == null) {<NEW_LINE>throw new InvalidDataTypeException(getName() + " data type at " + getAddress() + " doesn't refer to a valid location " + rtti0Address + " for the Type Descriptor.");<NEW_LINE>}<NEW_LINE>rtti0Model = new TypeDescriptorModel(program, rtti0Address, validationOptions);<NEW_LINE>if (validateReferredToData) {<NEW_LINE>rtti0Model.validate();<NEW_LINE>} else if (!rtti0Model.isLoadedAndInitializedAddress()) {<NEW_LINE>throw new InvalidDataTypeException("Data referencing " + rtti0Model.getName() + " data type isn't a loaded and initialized address " + rtti0Address + ".");<NEW_LINE>}<NEW_LINE>// Last 4 bytes should refer to RTTI3.<NEW_LINE>Address rtti3CompAddress = startAddress.add(RTTI_3_PTR_OFFSET);<NEW_LINE>Address rtti3Address = getReferencedAddress(program, rtti3CompAddress);<NEW_LINE>if (rtti3Address == null) {<NEW_LINE>throw new InvalidDataTypeException(getName() + " data type at " + getAddress() + " doesn't refer to a valid location for the Class Hierarchy Descriptor.");<NEW_LINE>}<NEW_LINE>rtti3Model = new Rtti3Model(program, rtti3Address, validationOptions);<NEW_LINE>if (validateReferredToData) {<NEW_LINE>rtti3Model.validate();<NEW_LINE>} else if (!rtti3Model.isLoadedAndInitializedAddress()) {<NEW_LINE>throw new InvalidDataTypeException("Data referencing " + rtti3Model.getName() + " data type isn't a loaded and initialized address " + rtti3Address + ".");<NEW_LINE>}<NEW_LINE>} | rtti0Address = getReferencedAddress(program, rtti0CompAddress); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.