idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
557,664 | private PO createOrLoadPO(final Properties ctx, final String tableName, final int recordId, final String trxName) {<NEW_LINE>final POInfo poInfo = POInfo.getPOInfo(tableName);<NEW_LINE>if (recordId > 0 && !poInfo.isSingleKeyColumnName()) {<NEW_LINE>log.<MASK><NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final Class<?> clazz = tableModelClassLoader.getClass(tableName);<NEW_LINE>if (clazz == null) {<NEW_LINE>log.info("Using GenericPO for {}", tableName);<NEW_LINE>final GenericPO po = new GenericPO(tableName, ctx, recordId, trxName);<NEW_LINE>return po;<NEW_LINE>}<NEW_LINE>boolean errorLogged = false;<NEW_LINE>try {<NEW_LINE>final Constructor<?> constructor = tableModelClassLoader.getIDConstructor(clazz);<NEW_LINE>final PO po = (PO) constructor.newInstance(ctx, recordId, trxName);<NEW_LINE>if (po != null && po.get_ID() != recordId && recordId > 0) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return po;<NEW_LINE>} catch (final Exception ex) {<NEW_LINE>final Throwable cause = ex.getCause() == null ? ex : ex.getCause();<NEW_LINE>log.error("Failed fetching record for table={}, recordId={}, class={}", tableName, recordId, clazz, cause);<NEW_LINE>MetasfreshLastError.saveError(log, "Error", cause);<NEW_LINE>errorLogged = true;<NEW_LINE>}<NEW_LINE>if (!errorLogged) {<NEW_LINE>log.error("Failed fetching record for table={}, recordId={}, class={}", tableName, recordId, clazz);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | warn("Cannot retrieve by ID a multi-key record: table={}, recordId={}", tableName, recordId); |
481,066 | public Object convertDirectly(Object entityInstance) {<NEW_LINE>Neo4jPersistentEntity<?> sourceEntity = context.getRequiredPersistentEntity(entityInstance.getClass());<NEW_LINE>PersistentPropertyAccessor<Object> sourceAccessor = sourceEntity.getPropertyAccessor(entityInstance);<NEW_LINE>Neo4jPersistentEntity<?> targetEntity = context.addPersistentEntity(ClassTypeInformation.from(targetType)).orElse(null);<NEW_LINE><MASK><NEW_LINE>InstanceCreatorMetadata<?> creator = targetEntity.getInstanceCreatorMetadata();<NEW_LINE>Object dto = context.getInstantiatorFor(targetEntity).createInstance(targetEntity, getParameterValueProvider(targetEntity, targetProperty -> getPropertyValueDirectlyFor(targetProperty, sourceEntity, sourceAccessor)));<NEW_LINE>PersistentPropertyAccessor<Object> dtoAccessor = targetEntity.getPropertyAccessor(dto);<NEW_LINE>PropertyHandlerSupport.of(targetEntity).doWithProperties(property -> {<NEW_LINE>if (creator != null && creator.isCreatorParameter(property)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Object propertyValue = getPropertyValueDirectlyFor(property, sourceEntity, sourceAccessor);<NEW_LINE>dtoAccessor.setProperty(property, propertyValue);<NEW_LINE>});<NEW_LINE>return dto;<NEW_LINE>} | Assert.notNull(targetEntity, "Target entity could not be created for a DTO"); |
1,766,111 | private void appendCommon(final ResourceModel resourceModel, final ResourceSchema resourceSchema) {<NEW_LINE>// Set the entityType only when it is a UNSTRUCTURED_DATA base resource to avoid<NEW_LINE>// modifying all existing resources, which by default are STRUCTURED_DATA base.<NEW_LINE>if (ResourceEntityType.UNSTRUCTURED_DATA == resourceModel.getResourceEntityType()) {<NEW_LINE>resourceSchema.setEntityType(ResourceEntityType.UNSTRUCTURED_DATA);<NEW_LINE>}<NEW_LINE>resourceSchema.setName(resourceModel.getName());<NEW_LINE>if (!resourceModel.getNamespace().isEmpty()) {<NEW_LINE>resourceSchema.setNamespace(resourceModel.getNamespace());<NEW_LINE>}<NEW_LINE>// Set the D2 service name only IF it is not null to avoid unnecessary IDL changes.<NEW_LINE>if (resourceModel.getD2ServiceName() != null) {<NEW_LINE>resourceSchema.setD2ServiceName(resourceModel.getD2ServiceName());<NEW_LINE>}<NEW_LINE>resourceSchema.setPath(buildPath(resourceModel));<NEW_LINE>final Class<?<MASK><NEW_LINE>if (valueClass != null) {<NEW_LINE>resourceSchema.setSchema(DataTemplateUtil.getSchema(valueClass).getUnionMemberKey());<NEW_LINE>}<NEW_LINE>final Class<?> resourceClass = resourceModel.getResourceClass();<NEW_LINE>final String doc = _docsProvider.getClassDoc(resourceClass);<NEW_LINE>final StringBuilder docBuilder = new StringBuilder();<NEW_LINE>if (doc != null) {<NEW_LINE>docBuilder.append(doc).append("\n\n");<NEW_LINE>}<NEW_LINE>docBuilder.append("generated from: ").append(resourceClass.getCanonicalName());<NEW_LINE>final String deprecatedDoc = _docsProvider.getClassDeprecatedTag(resourceClass);<NEW_LINE>if (deprecatedDoc != null) {<NEW_LINE>DataMap customAnnotationData = resourceModel.getCustomAnnotationData();<NEW_LINE>if (customAnnotationData == null) {<NEW_LINE>customAnnotationData = new DataMap();<NEW_LINE>resourceModel.setCustomAnnotation(customAnnotationData);<NEW_LINE>}<NEW_LINE>customAnnotationData.put(DEPRECATED_ANNOTATION_NAME, deprecateDocToAnnotationMap(deprecatedDoc));<NEW_LINE>}<NEW_LINE>resourceSchema.setDoc(docBuilder.toString());<NEW_LINE>} | > valueClass = resourceModel.getValueClass(); |
440,583 | public int compareTo(CursorResponseMessage 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(isSetHeader(), other.isSetHeader());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetHeader()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.header, other.header);<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>lastComparison = java.lang.Boolean.compare(isSetCursorId(), other.isSetCursorId());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetCursorId()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(<MASK><NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>lastComparison = java.lang.Boolean.compare(isSetValues(), other.isSetValues());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetValues()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.values, other.values);<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>} | this.cursorId, other.cursorId); |
903,792 | private static Pair<String, Integer> findScriptName(int start, CommonTokenStream tokens) {<NEW_LINE>String lastIdent = null;<NEW_LINE>int lastIdentIndex = 0;<NEW_LINE>for (int i = start; i < tokens.size(); i++) {<NEW_LINE>if (tokens.get(i).getType() == IDENT) {<NEW_LINE>lastIdent = tokens.get(i).getText();<NEW_LINE>lastIdentIndex = i;<NEW_LINE>}<NEW_LINE>if (tokens.get(i).getType() == EsperEPL2GrammarParser.LPAREN) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>// find beginning of script, ignore brackets<NEW_LINE>if (tokens.get(i).getType() == EsperEPL2GrammarParser.LBRACK && tokens.get(i + 1).getType() != EsperEPL2GrammarParser.RBRACK) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (lastIdent == null) {<NEW_LINE>throw new IllegalStateException("Failed to parse expression name");<NEW_LINE>}<NEW_LINE>return new Pair<String<MASK><NEW_LINE>} | , Integer>(lastIdent, lastIdentIndex); |
700,527 | public synchronized void initRef() {<NEW_LINE>if (initialized.get()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>interfaceClass = (Class) Class.forName(interfaceClass.getName(), true, Thread.currentThread().getContextClassLoader());<NEW_LINE>} catch (ClassNotFoundException e) {<NEW_LINE>throw new MotanFrameworkException("ReferereConfig initRef Error: Class not found " + interfaceClass.getName(), e, MotanErrorMsgConstant.FRAMEWORK_INIT_ERROR);<NEW_LINE>}<NEW_LINE>if (CollectionUtil.isEmpty(protocols)) {<NEW_LINE>throw new MotanFrameworkException(String.format("%s RefererConfig is malformed, for protocol not set correctly!"<MASK><NEW_LINE>}<NEW_LINE>checkInterfaceAndMethods(interfaceClass, methods);<NEW_LINE>clusterSupports = new ArrayList<>(protocols.size());<NEW_LINE>List<Cluster<T>> clusters = new ArrayList<>(protocols.size());<NEW_LINE>String proxy = null;<NEW_LINE>ConfigHandler configHandler = ExtensionLoader.getExtensionLoader(ConfigHandler.class).getExtension(MotanConstants.DEFAULT_VALUE);<NEW_LINE>loadRegistryUrls();<NEW_LINE>String localIp = getLocalHostAddress();<NEW_LINE>for (ProtocolConfig protocol : protocols) {<NEW_LINE>Map<String, String> params = new HashMap<>();<NEW_LINE>params.put(URLParamType.nodeType.getName(), MotanConstants.NODE_TYPE_REFERER);<NEW_LINE>params.put(URLParamType.version.getName(), URLParamType.version.getValue());<NEW_LINE>params.put(URLParamType.refreshTimestamp.getName(), String.valueOf(System.currentTimeMillis()));<NEW_LINE>collectConfigParams(params, protocol, basicReferer, extConfig, this);<NEW_LINE>collectMethodConfigParams(params, this.getMethods());<NEW_LINE>String path = StringUtils.isBlank(serviceInterface) ? interfaceClass.getName() : serviceInterface;<NEW_LINE>URL refUrl = new URL(protocol.getName(), localIp, MotanConstants.DEFAULT_INT_VALUE, path, params);<NEW_LINE>ClusterSupport<T> clusterSupport = createClusterSupport(refUrl, configHandler);<NEW_LINE>clusterSupports.add(clusterSupport);<NEW_LINE>clusters.add(clusterSupport.getCluster());<NEW_LINE>if (proxy == null) {<NEW_LINE>String defaultValue = StringUtils.isBlank(serviceInterface) ? URLParamType.proxy.getValue() : MotanConstants.PROXY_COMMON;<NEW_LINE>proxy = refUrl.getParameter(URLParamType.proxy.getName(), defaultValue);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ref = configHandler.refer(interfaceClass, clusters, proxy);<NEW_LINE>initialized.set(true);<NEW_LINE>} | , interfaceClass.getName())); |
254,511 | protected boolean processSquare(GrayF32 square, Result result, double edgeInside, double edgeOutside) {<NEW_LINE>int off = (square.width - binaryInner.width) / 2;<NEW_LINE>square.subimage(off, off, off + binaryInner.width, off + binaryInner.width, grayNoBorder);<NEW_LINE>// convert input image into binary number<NEW_LINE>double threshold = (edgeInside + edgeOutside) / 2;<NEW_LINE>int errorPureColor = decodeDataBits(grayNoBorder, threshold);<NEW_LINE>if (verbose != null)<NEW_LINE>verbose.printf("_ square: threshold=%.1f ambiguous=%d errorPure=%d", threshold, ambiguousBitCount, errorPureColor);<NEW_LINE>if (errorPureColor == 0) {<NEW_LINE>if (verbose != null)<NEW_LINE>verbose.println();<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// Search all markers and orientation to see what is the best match. Stop if it finds a perfect match.<NEW_LINE>int bestMarker = -1;<NEW_LINE>int bestOrientation = -1;<NEW_LINE>int bestError = Integer.MAX_VALUE;<NEW_LINE>for (int orientation = 0; orientation < 4 && bestError != 0; orientation++) {<NEW_LINE>// git bit array for this orientation<NEW_LINE>convertBitImageToBitArray();<NEW_LINE>final int numWords = bits.arrayLength();<NEW_LINE>// Go through all markers<NEW_LINE>for (int markerIdx = 0; markerIdx < description.encoding.size(); markerIdx++) {<NEW_LINE>int[] data = description.encoding.get(markerIdx).pattern.data;<NEW_LINE>int error = 0;<NEW_LINE>for (int wordIdx = 0; wordIdx < numWords; wordIdx++) {<NEW_LINE>error += DescriptorDistance.hamming(bits.data[<MASK><NEW_LINE>}<NEW_LINE>// Check to see if this is the best result<NEW_LINE>if (error < bestError) {<NEW_LINE>bestError = error;<NEW_LINE>bestOrientation = orientation;<NEW_LINE>bestMarker = markerIdx;<NEW_LINE>// stop if it's perfect<NEW_LINE>if (bestError == 0)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Rotate image and repeat<NEW_LINE>ImageMiscOps.rotateCW(bitImage, workImage);<NEW_LINE>bitImage.setTo(workImage);<NEW_LINE>}<NEW_LINE>if (verbose != null)<NEW_LINE>verbose.printf(" hamming_error=%d minimum=%d", bestError, description.minimumHamming);<NEW_LINE>// See if the error is too large or worse than a square that's pure white or back. This is to reduce false<NEW_LINE>// positives. Also consider ambiguous bits, as they are much more likely to be pure noise<NEW_LINE>if (bestError + ambiguousBitCount * ambiguousPenaltyFrac > description.minimumHamming || bestError >= errorPureColor) {<NEW_LINE>if (verbose != null)<NEW_LINE>verbose.println();<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// save the results<NEW_LINE>result.which = bestMarker;<NEW_LINE>result.lengthSide = 1;<NEW_LINE>result.rotation = bestOrientation;<NEW_LINE>result.error = bestError;<NEW_LINE>if (verbose != null)<NEW_LINE>verbose.printf(" id=%d orientation=%d\n", result.which, result.rotation);<NEW_LINE>return true;<NEW_LINE>} | wordIdx] ^ data[wordIdx]); |
1,458,962 | private Component layouts() {<NEW_LINE>TabbedLayout tabbedLayout = TabbedLayout.create();<NEW_LINE>VerticalLayout fold = VerticalLayout.create();<NEW_LINE>fold.add(Label.create("Some label"));<NEW_LINE>fold.add(Button.create(LocalizeValue.localizeTODO("Some &Button"), (e) -> Alerts.okError("Clicked!").showAsync()));<NEW_LINE>FoldoutLayout layout = FoldoutLayout.create(LocalizeValue.of("Show Me"), fold);<NEW_LINE>layout.addStateListener(state -> Alerts.okInfo("State " + state).showAsync());<NEW_LINE>tabbedLayout.addTab("FoldoutLayout", layout);<NEW_LINE>TwoComponentSplitLayout splitLayout = TwoComponentSplitLayout.create(SplitLayoutPosition.HORIZONTAL);<NEW_LINE>splitLayout.setFirstComponent(DockLayout.create().center(Button.create("Left")));<NEW_LINE>splitLayout.setSecondComponent(DockLayout.create().center(Button.create("Second")));<NEW_LINE>tabbedLayout.addTab("SplitLayout", splitLayout);<NEW_LINE>SwipeLayout swipeLayout = SwipeLayout.create();<NEW_LINE>swipeLayout.register("left", () -> swipeChildLayout(LocalizeValue.of("Right"), () -> swipeLayout.swipeRightTo("right")));<NEW_LINE>swipeLayout.register("right", () -> swipeChildLayout(LocalizeValue.of("Left"), () -> swipeLayout.swipeLeftTo("left")));<NEW_LINE>tabbedLayout.addTab("SwipeLayout", swipeLayout);<NEW_LINE>VerticalLayout borderLayout = VerticalLayout.create();<NEW_LINE>DockLayout dockLayout = DockLayout.create();<NEW_LINE>Button centerBtn = Button.create(LocalizeValue.of("Center"));<NEW_LINE>centerBtn.addClickListener(event -> {<NEW_LINE>dockLayout.center(HorizontalLayout.create().add(Label.create(LocalizeValue.of(LocalDateTime.now().toString()))));<NEW_LINE>});<NEW_LINE>borderLayout.add<MASK><NEW_LINE>borderLayout.add(centerBtn);<NEW_LINE>tabbedLayout.addTab("DockLayout", borderLayout);<NEW_LINE>return tabbedLayout;<NEW_LINE>} | (centerBtn).add(dockLayout); |
1,671,591 | public static ExampleMarketDataBuilder ofResource(String resourceRoot, ClassLoader classLoader) {<NEW_LINE>// classpath resources are forward-slash separated<NEW_LINE>String qualifiedRoot = resourceRoot;<NEW_LINE>qualifiedRoot = qualifiedRoot.startsWith("/") ? qualifiedRoot.substring(1) : qualifiedRoot;<NEW_LINE>qualifiedRoot = qualifiedRoot.startsWith("\\") ? qualifiedRoot.substring(1) : qualifiedRoot;<NEW_LINE>qualifiedRoot = qualifiedRoot.endsWith("/") ? qualifiedRoot : qualifiedRoot + "/";<NEW_LINE>URL url = classLoader.getResource(qualifiedRoot);<NEW_LINE>if (url == null) {<NEW_LINE>throw new IllegalArgumentException(Messages.format("Classpath resource not found: {}", qualifiedRoot));<NEW_LINE>}<NEW_LINE>if (url.getProtocol() != null && "jar".equals(url.getProtocol().toLowerCase(Locale.ENGLISH))) {<NEW_LINE>// Inside a JAR<NEW_LINE>int classSeparatorIdx = url.getFile().indexOf('!');<NEW_LINE>if (classSeparatorIdx == -1) {<NEW_LINE>throw new IllegalArgumentException(Messages.format("Unexpected JAR file URL: {}", url));<NEW_LINE>}<NEW_LINE>String jarPath = url.getFile().substring("file:".length(), classSeparatorIdx);<NEW_LINE>File jarFile;<NEW_LINE>try {<NEW_LINE>jarFile = new File(jarPath);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new IllegalArgumentException(Messages.format("Unable to create file for JAR: {}", jarPath), e);<NEW_LINE>}<NEW_LINE>return new JarMarketDataBuilder(jarFile, resourceRoot);<NEW_LINE>} else {<NEW_LINE>// Resource is on disk<NEW_LINE>File file;<NEW_LINE>try {<NEW_LINE>file = new File(url.toURI());<NEW_LINE>} catch (URISyntaxException e) {<NEW_LINE>throw new IllegalArgumentException(Messages.format("Unexpected file location: {}", url), e);<NEW_LINE>}<NEW_LINE>return new <MASK><NEW_LINE>}<NEW_LINE>} | DirectoryMarketDataBuilder(file.toPath()); |
326,455 | final GetSnapshotLimitsResult executeGetSnapshotLimits(GetSnapshotLimitsRequest getSnapshotLimitsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getSnapshotLimitsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetSnapshotLimitsRequest> request = null;<NEW_LINE>Response<GetSnapshotLimitsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetSnapshotLimitsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getSnapshotLimitsRequest));<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, "GetSnapshotLimits");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetSnapshotLimitsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetSnapshotLimitsResultJsonUnmarshaller());<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.ADVANCED_CONFIG, advancedConfig); |
1,850,688 | public void populatePlaces(LatLng curLatLng, LatLng searchLatLng) {<NEW_LINE>final Observable<MapController.ExplorePlacesInfo> nearbyPlacesInfoObservable;<NEW_LINE>if (curLatLng == null) {<NEW_LINE>checkPermissionsAndPerformAction();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (searchLatLng.equals(lastFocusLocation) || lastFocusLocation == null || recenterToUserLocation) {<NEW_LINE>// Means we are checking around current location<NEW_LINE>nearbyPlacesInfoObservable = presenter.loadAttractionsFromLocation(curLatLng, searchLatLng, true);<NEW_LINE>} else {<NEW_LINE>nearbyPlacesInfoObservable = presenter.loadAttractionsFromLocation(curLatLng, searchLatLng, false);<NEW_LINE>}<NEW_LINE>compositeDisposable.add(nearbyPlacesInfoObservable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(explorePlacesInfo -> {<NEW_LINE><MASK><NEW_LINE>mediaList = explorePlacesInfo.mediaList;<NEW_LINE>lastFocusLocation = searchLatLng;<NEW_LINE>}, throwable -> {<NEW_LINE>Timber.d(throwable);<NEW_LINE>showErrorMessage(getString(R.string.error_fetching_nearby_places) + throwable.getLocalizedMessage());<NEW_LINE>setProgressBarVisibility(false);<NEW_LINE>presenter.lockUnlockNearby(false);<NEW_LINE>}));<NEW_LINE>if (recenterToUserLocation) {<NEW_LINE>recenterToUserLocation = false;<NEW_LINE>}<NEW_LINE>} | updateMapMarkers(explorePlacesInfo, isCurrentLocationMarkerVisible()); |
186,655 | public void mouseDragged(MouseEvent e) {<NEW_LINE>if (myLastPoint.isNull() || myPressPoint.isNull())<NEW_LINE>return;<NEW_LINE>PointerInfo info = MouseInfo.getPointerInfo();<NEW_LINE>if (info == null)<NEW_LINE>return;<NEW_LINE>final Point newPoint = info.getLocation();<NEW_LINE>Point p = myLastPoint.get();<NEW_LINE>final Window awtWindow = SwingUtilities.windowForComponent(c);<NEW_LINE>consulo.ui.Window uiWindow = TargetAWT.from(awtWindow);<NEW_LINE>IdeFrame ideFrame = <MASK><NEW_LINE>if (ideFrame == null) {<NEW_LINE>final Point windowLocation = awtWindow.getLocationOnScreen();<NEW_LINE>windowLocation.translate(newPoint.x - p.x, newPoint.y - p.y);<NEW_LINE>awtWindow.setLocation(windowLocation);<NEW_LINE>}<NEW_LINE>myLastPoint.set(newPoint);<NEW_LINE>Component component = getActualSplitter();<NEW_LINE>if (component instanceof ThreeComponentsSplitter) {<NEW_LINE>ThreeComponentsSplitter splitter = (ThreeComponentsSplitter) component;<NEW_LINE>if (myIsLastComponent.get() == Boolean.TRUE) {<NEW_LINE>splitter.setLastSize(myInitialHeight.get() + myPressPoint.get().y - myLastPoint.get().y);<NEW_LINE>} else {<NEW_LINE>splitter.setFirstSize(myInitialHeight.get() + myLastPoint.get().y - myPressPoint.get().y);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (component instanceof Splitter) {<NEW_LINE>Splitter splitter = (Splitter) component;<NEW_LINE>splitter.setProportion(Math.max(0, Math.min(1, 1f - (float) (myInitialHeight.get() + myPressPoint.get().y - myLastPoint.get().y) / splitter.getHeight())));<NEW_LINE>}<NEW_LINE>} | uiWindow.getUserData(IdeFrame.KEY); |
39,570 | public SipAddress unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>SipAddress sipAddress = new SipAddress();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("Uri", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>sipAddress.setUri(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("Type", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>sipAddress.setType(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 sipAddress;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
978,025 | private static Dependency loadDependencyFromManifest(JarFile jarFile, String path) throws IOException {<NEW_LINE>Manifest manifest = jarFile.getManifest();<NEW_LINE>if (manifest != null) {<NEW_LINE><MASK><NEW_LINE>String name = attributes.getValue("implementation-title");<NEW_LINE>String version = attributes.getValue("implementation-version");<NEW_LINE>String vendor = attributes.getValue("implementation-vendor-id");<NEW_LINE>if (vendor == null) {<NEW_LINE>vendor = attributes.getValue("implementation-vendor");<NEW_LINE>}<NEW_LINE>if (name != null && version != null) {<NEW_LINE>return new Dependency(name, version, vendor, path, DEPENDENCY_SOURCE_MANEFEST_IMPL);<NEW_LINE>} else {<NEW_LINE>name = attributes.getValue("specification-title");<NEW_LINE>version = attributes.getValue("specification-version");<NEW_LINE>vendor = attributes.getValue("specification-vendor");<NEW_LINE>if (name != null && version != null) {<NEW_LINE>return new Dependency(name, version, vendor, path, DEPENDENCY_SOURCE_MANEFEST_SPEC);<NEW_LINE>} else {<NEW_LINE>name = attributes.getValue("bundle-symbolicname");<NEW_LINE>version = attributes.getValue("bundle-version");<NEW_LINE>vendor = attributes.getValue("bundle-vendor");<NEW_LINE>if (name != null && version != null) {<NEW_LINE>return new Dependency(name, version, vendor, path, DEPENDENCY_SOURCE_MANEFEST_BUNDLE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | Attributes attributes = manifest.getMainAttributes(); |
1,423,123 | protected TaskManager createTaskManagerImpl(TaskConfiguration taskConfig) {<NEW_LINE>MapWriterConfiguration configuration = new MapWriterConfiguration();<NEW_LINE>configuration.addOutputFile(getStringArgument(taskConfig, PARAM_OUTFILE, Constants.DEFAULT_PARAM_OUTFILE));<NEW_LINE>// must be set before loading tag mapping file<NEW_LINE>configuration.setTagValues(getBooleanArgument(taskConfig, PARAM_TAG_VALUES, false));<NEW_LINE>configuration.loadTagMappingFile(getStringArgument(taskConfig, PARAM_TAG_MAPPING_FILE, null));<NEW_LINE>configuration.addMapStartPosition(getStringArgument(taskConfig, PARAM_MAP_START_POSITION, null));<NEW_LINE>configuration.addMapStartZoom(getStringArgument(taskConfig, PARAM_MAP_START_ZOOM, null));<NEW_LINE>configuration.addBboxConfiguration(getStringArgument(taskConfig, PARAM_BBOX, null));<NEW_LINE>configuration.addZoomIntervalConfiguration(getStringArgument(taskConfig, PARAM_ZOOMINTERVAL_CONFIG, null));<NEW_LINE>configuration.setComment(getStringArgument(taskConfig, PARAM_COMMENT, null));<NEW_LINE>configuration.setDebugStrings(getBooleanArgument(taskConfig, PARAM_DEBUG_INFO, false));<NEW_LINE>configuration.setPolygonClipping(getBooleanArgument(taskConfig, PARAM_POLYGON_CLIPPING, true));<NEW_LINE>configuration.setPolylabel(getBooleanArgument(taskConfig, PARAM_POLYLABEL, false));<NEW_LINE>configuration.setProgressLogs(getBooleanArgument(taskConfig, PARAM_PROGRESS_LOGS, true));<NEW_LINE>configuration.setWayClipping(getBooleanArgument(taskConfig, PARAM_WAY_CLIPPING, true));<NEW_LINE>configuration.setLabelPosition(getBooleanArgument(taskConfig, PARAM_LABEL_POSITION, false));<NEW_LINE>// boolean waynodeCompression = getBooleanArgument(taskConfig, PARAM_WAYNODE_COMPRESSION,<NEW_LINE>// true);<NEW_LINE>configuration.setSimplification(getDoubleArgument(taskConfig<MASK><NEW_LINE>configuration.setSimplificationMaxZoom((byte) getIntegerArgument(taskConfig, PARAM_SIMPLIFICATION_MAX_ZOOM, Constants.DEFAULT_SIMPLIFICATION_MAX_ZOOM));<NEW_LINE>configuration.setSkipInvalidRelations(getBooleanArgument(taskConfig, PARAM_SKIP_INVALID_RELATIONS, false));<NEW_LINE>configuration.setDataProcessorType(getStringArgument(taskConfig, PARAM_TYPE, Constants.DEFAULT_PARAM_TYPE));<NEW_LINE>configuration.setBboxEnlargement(getIntegerArgument(taskConfig, PARAM_BBOX_ENLARGEMENT, Constants.DEFAULT_PARAM_BBOX_ENLARGEMENT));<NEW_LINE>configuration.addPreferredLanguages(getStringArgument(taskConfig, PARAM_PREFERRED_LANGUAGES, null));<NEW_LINE>configuration.addEncodingChoice(getStringArgument(taskConfig, PARAM_ENCODING, Constants.DEFAULT_PARAM_ENCODING));<NEW_LINE>// Use 1 thread to avoid OOM when processing ways, see #920<NEW_LINE>configuration.setThreads(getIntegerArgument(taskConfig, PARAM_THREADS, 1));<NEW_LINE>configuration.validate();<NEW_LINE>MapFileWriterTask task = new MapFileWriterTask(configuration);<NEW_LINE>return new SinkManager(taskConfig.getId(), task, taskConfig.getPipeArgs());<NEW_LINE>} | , PARAM_SIMPLIFICATION_FACTOR, Constants.DEFAULT_SIMPLIFICATION_FACTOR)); |
1,712,664 | public static ImmutableMap<Path, SourcePath> parseExportedHeaders(BuildTarget buildTarget, ActionGraphBuilder graphBuilder, ProjectFilesystem projectFilesystem, Optional<CxxPlatform> cxxPlatform, CxxLibraryDescription.CommonArg args) {<NEW_LINE>ImmutableMap.Builder<String, SourcePath> headers = ImmutableMap.builder();<NEW_LINE>// Include platform-agnostic headers.<NEW_LINE>headers.putAll(parseOnlyHeaders(buildTarget, graphBuilder, "exported_headers", args.getExportedHeaders()));<NEW_LINE>// If a platform is specific, include platform-specific headers.<NEW_LINE>cxxPlatform.ifPresent(cxxPlatformValue -> headers.putAll(parseOnlyPlatformHeaders(buildTarget, graphBuilder, cxxPlatformValue, "exported_headers", args.getExportedHeaders(), "exported_platform_headers", <MASK><NEW_LINE>return CxxPreprocessables.resolveHeaderMap(args.getHeaderNamespace().map(Paths::get).orElse(buildTarget.getCellRelativeBasePath().getPath().toPath(projectFilesystem.getFileSystem())), headers.build());<NEW_LINE>} | args.getExportedPlatformHeaders()))); |
1,764,693 | String implIsValid() {<NEW_LINE>// test whether the selected folder on selected filesystem already exists<NEW_LINE>DataFolder lF = getLocationDataFolder();<NEW_LINE>if (lF == null)<NEW_LINE>// NOI18N<NEW_LINE>return NbBundle.<MASK><NEW_LINE>// target filesystem should be writable<NEW_LINE>if (!lF.getPrimaryFile().canWrite())<NEW_LINE>// NOI18N<NEW_LINE>return NbBundle.getMessage(TemplateWizard2.class, "MSG_fs_is_readonly");<NEW_LINE>FileObject target = lF.getPrimaryFile().getFileObject(newObjectName.getText(), extension);<NEW_LINE>if (target != null) {<NEW_LINE>// NOI18N<NEW_LINE>return NbBundle.getMessage(TemplateWizard2.class, "MSG_file_already_exist", locationFolder.getAbsolutePath());<NEW_LINE>}<NEW_LINE>if ((Utilities.isWindows() || (Utilities.getOperatingSystem() == Utilities.OS_OS2))) {<NEW_LINE>if (TemplateWizard.checkCaseInsensitiveName(lF.getPrimaryFile(), newObjectName.getText(), extension)) {<NEW_LINE>// NOI18N<NEW_LINE>return NbBundle.getMessage(TemplateWizard2.class, "MSG_file_already_exist", newObjectName.getText());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// all ok<NEW_LINE>return null;<NEW_LINE>} | getMessage(TemplateWizard2.class, "MSG_fs_or_folder_does_not_exist"); |
1,443,537 | public boolean onTouchEvent(TextView widget, Spannable buffer, MotionEvent event) {<NEW_LINE>int action = event.getActionMasked();<NEW_LINE>if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_DOWN) {<NEW_LINE>int x = (int) event.getX();<NEW_LINE>int y = (int) event.getY();<NEW_LINE>x -= widget.getTotalPaddingLeft();<NEW_LINE>y -= widget.getTotalPaddingTop();<NEW_LINE>x += widget.getScrollX();<NEW_LINE>y += widget.getScrollY();<NEW_LINE>Layout layout = widget.getLayout();<NEW_LINE>int line = layout.getLineForVertical(y);<NEW_LINE>int off = layout.getOffsetForHorizontal(line, x);<NEW_LINE>ClickableSpan[] link = buffer.getSpans(off, off, ClickableSpan.class);<NEW_LINE>if (link.length > 0) {<NEW_LINE>if (action == MotionEvent.ACTION_UP) {<NEW_LINE>link[0].onClick(widget);<NEW_LINE>} else {<NEW_LINE>Selection.setSelection(buffer, buffer.getSpanStart(link[0]), buffer.<MASK><NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>Selection.removeSelection(buffer);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | getSpanEnd(link[0])); |
602,579 | public List<ImageUrl> parseImages(String html, Chapter chapter) {<NEW_LINE>List<ImageUrl> list = new LinkedList<>();<NEW_LINE>String packed = StringUtils.match("eval(.*?)\\n", html, 1);<NEW_LINE>if (packed != null) {<NEW_LINE>String result = DecryptionUtils.evalDecrypt(packed);<NEW_LINE>String jsonString = StringUtils.match("'fs':\\s*(\\[.*?\\])", result, 1);<NEW_LINE>try {<NEW_LINE>JSONArray array = new JSONArray(jsonString);<NEW_LINE>int size = array.length();<NEW_LINE>for (int i = 0; i != size; ++i) {<NEW_LINE>String url = array.getString(i);<NEW_LINE>if (url.indexOf("http://") == -1) {<NEW_LINE>url = servers[0] + url;<NEW_LINE>}<NEW_LINE>Long comicChapter = chapter.getId();<NEW_LINE>Long id = Long.<MASK><NEW_LINE>list.add(new ImageUrl(id, comicChapter, i + 1, url, false));<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return list;<NEW_LINE>} | parseLong(comicChapter + "000" + i); |
305,963 | public static LibDivideS16 libdivide_s16_gen(@NativeType("int16_t") short denom, @NativeType("struct libdivide_s16_t") LibDivideS16 __result) {<NEW_LINE>if (denom == 0) {<NEW_LINE>throw new IllegalArgumentException("divider must be != 0");<NEW_LINE>}<NEW_LINE>int magic, more;<NEW_LINE>int absD = denom < 0 ? -denom : denom;<NEW_LINE>int floor_log_2_d = 31 - Integer.numberOfLeadingZeros(absD);<NEW_LINE>if ((absD & (absD - 1)) == 0) {<NEW_LINE>magic = 0;<NEW_LINE>more = floor_log_2_d | (denom < 0 ? LIBDIVIDE_NEGATIVE_DIVISOR : 0);<NEW_LINE>} else {<NEW_LINE>int l = 1 << (15 + floor_log_2_d);<NEW_LINE>magic = l / absD;<NEW_LINE>int rem = l % absD;<NEW_LINE>if (absD - rem < 1 << floor_log_2_d) {<NEW_LINE>more = floor_log_2_d - 1;<NEW_LINE>} else {<NEW_LINE>more = floor_log_2_d | LIBDIVIDE_ADD_MARKER;<NEW_LINE>magic <<= 1;<NEW_LINE>}<NEW_LINE>magic++;<NEW_LINE>if (denom < 0) {<NEW_LINE>more |= LIBDIVIDE_NEGATIVE_DIVISOR;<NEW_LINE>magic = -magic;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>__result<MASK><NEW_LINE>__result.more((byte) more);<NEW_LINE>return __result;<NEW_LINE>} | .magic((short) magic); |
350,331 | String formatSlackMessage(JsonObject kgResponse, String query) {<NEW_LINE>JsonObject attachmentJson = new JsonObject();<NEW_LINE>JsonObject responseJson = new JsonObject();<NEW_LINE>responseJson.addProperty("response_type", "in_channel");<NEW_LINE>responseJson.addProperty("text", String.format("Query: %s", query));<NEW_LINE>JsonArray entityList = kgResponse.getAsJsonArray("itemListElement");<NEW_LINE>// Extract the first entity from the result list, if any<NEW_LINE>if (entityList.size() == 0) {<NEW_LINE>attachmentJson.addProperty("text", "No results match your query...");<NEW_LINE>responseJson.add("attachments", attachmentJson);<NEW_LINE>return gson.toJson(responseJson);<NEW_LINE>}<NEW_LINE>JsonObject entity = entityList.get(0).getAsJsonObject().getAsJsonObject("result");<NEW_LINE>// Construct Knowledge Graph response attachment<NEW_LINE>String title = entity.get("name").getAsString();<NEW_LINE>if (entity.has("description")) {<NEW_LINE>title = String.format("%s: %s", title, entity.get<MASK><NEW_LINE>}<NEW_LINE>attachmentJson.addProperty("title", title);<NEW_LINE>if (entity.has("detailedDescription")) {<NEW_LINE>JsonObject detailedDescJson = entity.getAsJsonObject("detailedDescription");<NEW_LINE>addPropertyIfPresent(attachmentJson, "title_link", detailedDescJson, "url");<NEW_LINE>addPropertyIfPresent(attachmentJson, "text", detailedDescJson, "articleBody");<NEW_LINE>}<NEW_LINE>if (entity.has("image")) {<NEW_LINE>JsonObject imageJson = entity.getAsJsonObject("image");<NEW_LINE>addPropertyIfPresent(attachmentJson, "image_url", imageJson, "contentUrl");<NEW_LINE>}<NEW_LINE>JsonArray attachmentList = new JsonArray();<NEW_LINE>attachmentList.add(attachmentJson);<NEW_LINE>responseJson.add("attachments", attachmentList);<NEW_LINE>return gson.toJson(responseJson);<NEW_LINE>} | ("description").getAsString()); |
590,418 | private boolean handleDataChange() throws Exception {<NEW_LINE>StateWrapper currentWrapper = stateRef.get();<NEW_LINE>StateWrapper notifyWrapper = notifyRef.get();<NEW_LINE>StateWrapper newWrapper = readCurrentContext();<NEW_LINE>traceLogWrappers(currentWrapper, notifyWrapper, newWrapper);<NEW_LINE>if (currentWrapper.version + 1 == newWrapper.version && notifyWrapper.version >= currentWrapper.version && stateRef.compareAndSet(currentWrapper, newWrapper)) {<NEW_LINE>// simply used to check if we don't need to replay, if so<NEW_LINE>// we can just try to notify<NEW_LINE>mayNotifyStateChanged(newWrapper);<NEW_LINE>} else {<NEW_LINE>final int start = (notifyWrapper != null ? (notifyWrapper.version) : 0) % logSize;<NEW_LINE>int count = newWrapper.version - (notifyWrapper != null ? <MASK><NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("Events missed, trying to replay start " + start + " count " + count);<NEW_LINE>}<NEW_LINE>for (int i = start; i < (start + count); i++) {<NEW_LINE>Stat stat = new Stat();<NEW_LINE>StateMachineContext<S, E> context = ((ZookeeperStateMachinePersist<S, E>) persist).readLog(i, stat);<NEW_LINE>int ver = (stat.getVersion() - 1) * logSize + (i + 1);<NEW_LINE>// check if we're behind more than a log size meaning we can't<NEW_LINE>// replay full history, notify and break out from a loop<NEW_LINE>if (i + logSize < ver) {<NEW_LINE>notifyError(new StateMachineEnsembleException("Current version behind more than log size"));<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("Replay position " + i + " with version " + ver);<NEW_LINE>log.debug("Context in position " + i + " " + context);<NEW_LINE>}<NEW_LINE>StateWrapper wrapper = new StateWrapper(context, ver);<NEW_LINE>// need to set stateRef when replaying if its<NEW_LINE>// context is not set or otherwise just set<NEW_LINE>// if stateRef still is currentWrapper<NEW_LINE>StateWrapper currentWrapperx = stateRef.get();<NEW_LINE>if (currentWrapperx.context == null) {<NEW_LINE>stateRef.set(wrapper);<NEW_LINE>} else if (wrapper.version == currentWrapperx.version + 1) {<NEW_LINE>stateRef.set(wrapper);<NEW_LINE>}<NEW_LINE>mayNotifyStateChanged(wrapper);<NEW_LINE>}<NEW_LINE>// did we replay<NEW_LINE>return count > 0;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | (notifyWrapper.version) : 0); |
1,125,418 | public PointSensitivityBuilder presentValueSensitivityRates(IborCapletFloorletPeriod period, RatesProvider ratesProvider, IborCapletFloorletVolatilities volatilities) {<NEW_LINE>validate(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.relativeTime(period.getFixingDateTime());<NEW_LINE>PutCall putCall = period.getPutCall();<NEW_LINE><MASK><NEW_LINE>double indexRate = forwardRate(period, ratesProvider);<NEW_LINE>PointSensitivityBuilder dfSensi = ratesProvider.discountFactors(currency).zeroRatePointSensitivity(period.getPaymentDate());<NEW_LINE>if (expiry < 0d) {<NEW_LINE>// Option has expired already<NEW_LINE>double sign = putCall.isCall() ? 1d : -1d;<NEW_LINE>double payoff = Math.max(sign * (indexRate - strike), 0d);<NEW_LINE>return dfSensi.multipliedBy(payoff * period.getYearFraction() * period.getNotional());<NEW_LINE>}<NEW_LINE>PointSensitivityBuilder indexRateSensiSensi = ratesProvider.iborIndexRates(period.getIndex()).ratePointSensitivity(period.getIborRate().getObservation());<NEW_LINE>double volatility = impliedVolatility(period, ratesProvider, volatilities);<NEW_LINE>double df = ratesProvider.discountFactor(currency, period.getPaymentDate());<NEW_LINE>double factor = period.getNotional() * period.getYearFraction();<NEW_LINE>double fwdPv = factor * volatilities.price(expiry, putCall, strike, indexRate, volatility);<NEW_LINE>double fwdDelta = factor * volatilities.priceDelta(expiry, putCall, strike, indexRate, volatility);<NEW_LINE>return dfSensi.multipliedBy(fwdPv).combinedWith(indexRateSensiSensi.multipliedBy(fwdDelta * df));<NEW_LINE>} | double strike = period.getStrike(); |
1,383,407 | private void addEntryInternal(LedgerDescriptor handle, ByteBuf entry, boolean ackBeforeSync, WriteCallback cb, Object ctx, byte[] masterKey) throws IOException, BookieException, InterruptedException {<NEW_LINE>long ledgerId = handle.getLedgerId();<NEW_LINE>long entryId = handle.addEntry(entry);<NEW_LINE>bookieStats.getWriteBytes().add(entry.readableBytes());<NEW_LINE>// journal `addEntry` should happen after the entry is added to ledger storage.<NEW_LINE>// otherwise the journal entry can potentially be rolled before the ledger is created in ledger storage.<NEW_LINE>if (masterKeyCache.get(ledgerId) == null) {<NEW_LINE>// Force the load into masterKey cache<NEW_LINE>byte[] oldValue = masterKeyCache.putIfAbsent(ledgerId, masterKey);<NEW_LINE>if (oldValue == null) {<NEW_LINE>// new handle, we should add the key to journal ensure we can rebuild<NEW_LINE>ByteBuffer bb = ByteBuffer.allocate(8 + 8 + 4 + masterKey.length);<NEW_LINE>bb.putLong(ledgerId);<NEW_LINE>bb.putLong(METAENTRY_ID_LEDGER_KEY);<NEW_LINE>bb.putInt(masterKey.length);<NEW_LINE>bb.put(masterKey);<NEW_LINE>bb.flip();<NEW_LINE>getJournal(ledgerId).logAddEntry(bb, false, /* ackBeforeSync */<NEW_LINE>new NopWriteCallback(), null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!writeDataToJournal) {<NEW_LINE>cb.writeComplete(0, ledgerId, entryId, null, ctx);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (LOG.isTraceEnabled()) {<NEW_LINE>LOG.trace("Adding {}@{}", entryId, ledgerId);<NEW_LINE>}<NEW_LINE>getJournal(ledgerId).logAddEntry(<MASK><NEW_LINE>} | entry, ackBeforeSync, cb, ctx); |
1,715,175 | private synchronized LdapContext connect() {<NEW_LINE>LOGGER.log(Level.INFO, "Connecting to LDAP server {0} ", this);<NEW_LINE>if (errorTimestamp > 0 && errorTimestamp + interval > System.currentTimeMillis()) {<NEW_LINE>LOGGER.log(Level.WARNING, "LDAP server {0} is down", this.url);<NEW_LINE>close();<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (ctx == null) {<NEW_LINE>env.put(Context.PROVIDER_URL, this.url);<NEW_LINE>if (this.username != null) {<NEW_LINE>env.put(Context.SECURITY_PRINCIPAL, this.username);<NEW_LINE>}<NEW_LINE>if (this.password != null) {<NEW_LINE>env.put(Context.SECURITY_CREDENTIALS, this.password);<NEW_LINE>}<NEW_LINE>if (this.connectTimeout > 0) {<NEW_LINE>env.put(LDAP_CONNECT_TIMEOUT_PARAMETER, Integer.toString(this.connectTimeout));<NEW_LINE>}<NEW_LINE>if (this.readTimeout > 0) {<NEW_LINE>env.put(LDAP_READ_TIMEOUT_PARAMETER, Integer.toString(this.readTimeout));<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>ctx = new InitialLdapContext(env, null);<NEW_LINE>ctx.setRequestControls(null);<NEW_LINE>LOGGER.log(Level.INFO, "Connected to LDAP server {0}", this);<NEW_LINE>errorTimestamp = 0;<NEW_LINE>} catch (NamingException ex) {<NEW_LINE>LOGGER.log(Level.WARNING, "LDAP server {0} is not responding", env<MASK><NEW_LINE>errorTimestamp = System.currentTimeMillis();<NEW_LINE>close();<NEW_LINE>return ctx = null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return ctx;<NEW_LINE>} | .get(Context.PROVIDER_URL)); |
764,525 | private Dependency createDependency(Dependency parent, String source, final String name, String version, String repo) {<NEW_LINE>final Dependency dependency = new Dependency(parent.getActualFile(), true);<NEW_LINE>dependency.setEcosystem(DEPENDENCY_ECOSYSTEM);<NEW_LINE>dependency.setName(name);<NEW_LINE>dependency.setVersion(version);<NEW_LINE>final String packagePath = String.format("%s:%s", name, version);<NEW_LINE>dependency.setPackagePath(packagePath);<NEW_LINE>dependency.setDisplayFileName(packagePath);<NEW_LINE>dependency.setSha1sum(Checksum.getSHA1Checksum(packagePath));<NEW_LINE>dependency.setSha256sum(Checksum.getSHA256Checksum(packagePath));<NEW_LINE>dependency.setMd5sum(Checksum.getMD5Checksum(packagePath));<NEW_LINE>dependency.addEvidence(EvidenceType.VENDOR, source, "name", name, Confidence.HIGHEST);<NEW_LINE>dependency.addEvidence(EvidenceType.PRODUCT, source, "name", name, Confidence.HIGHEST);<NEW_LINE>dependency.addEvidence(EvidenceType.VENDOR, source, "repositoryUrl", repo, Confidence.HIGH);<NEW_LINE>dependency.addEvidence(EvidenceType.PRODUCT, source, "repositoryUrl", repo, Confidence.HIGH);<NEW_LINE>dependency.addEvidence(EvidenceType.VERSION, source, "version", version, Confidence.HIGHEST);<NEW_LINE>try {<NEW_LINE>final PackageURLBuilder builder = PackageURLBuilder.aPackageURL().withType("swift").<MASK><NEW_LINE>if (dependency.getVersion() != null) {<NEW_LINE>builder.withVersion(dependency.getVersion());<NEW_LINE>}<NEW_LINE>final PackageURL purl = builder.build();<NEW_LINE>dependency.addSoftwareIdentifier(new PurlIdentifier(purl, Confidence.HIGHEST));<NEW_LINE>} catch (MalformedPackageURLException ex) {<NEW_LINE>LOGGER.debug("Unable to build package url for swift dependency", ex);<NEW_LINE>final GenericIdentifier id;<NEW_LINE>if (dependency.getVersion() != null) {<NEW_LINE>id = new GenericIdentifier("swift:" + dependency.getName() + "@" + dependency.getVersion(), Confidence.HIGHEST);<NEW_LINE>} else {<NEW_LINE>id = new GenericIdentifier("swift:" + dependency.getName(), Confidence.HIGHEST);<NEW_LINE>}<NEW_LINE>dependency.addSoftwareIdentifier(id);<NEW_LINE>}<NEW_LINE>return dependency;<NEW_LINE>} | withName(dependency.getName()); |
610,431 | /* (non-Javadoc)<NEW_LINE>* @see javax.jms.StreamMessage#writeBytes(byte[])<NEW_LINE>*/<NEW_LINE>public void writeBytes(byte[] x) throws JMSException {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())<NEW_LINE>SibTr.entry(this, tc, "writeBytes", x);<NEW_LINE>checkBodyWriteable("writeBytes");<NEW_LINE>// take a copy so that the application can change the original without side effecting<NEW_LINE>// the message body.<NEW_LINE>if (x != null) {<NEW_LINE>byte[] c = new byte[x.length];<NEW_LINE>System.arraycopy(x, 0, <MASK><NEW_LINE>x = c;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>streamMsg.writeBytes(x);<NEW_LINE>} catch (UnsupportedEncodingException e) {<NEW_LINE>// No FFDC Code Needed<NEW_LINE>throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class, "EXCEPTION_RECEIVED_CWSIA0022", new Object[] { e, "JmsStreamMessageImpl.writeBytes" }, e, "JmsStreamMessageImpl#10", this, tc);<NEW_LINE>}<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())<NEW_LINE>SibTr.exit(this, tc, "writeBytes");<NEW_LINE>} | c, 0, x.length); |
1,574,652 | private GetRouterMonitorResultsAnswer parseLinesForHealthChecks(GetRouterMonitorResultsCommand cmd, String executionResult) {<NEW_LINE>List<String> <MASK><NEW_LINE>StringBuilder monitorResults = new StringBuilder();<NEW_LINE>String[] lines = executionResult.trim().split("\n");<NEW_LINE>boolean readingFailedChecks = false, readingMonitorResults = false;<NEW_LINE>for (String line : lines) {<NEW_LINE>line = line.trim();<NEW_LINE>if (line.contains("FAILING CHECKS")) {<NEW_LINE>// Toggle to reading failing checks from next line<NEW_LINE>readingFailedChecks = true;<NEW_LINE>readingMonitorResults = false;<NEW_LINE>} else if (line.contains("MONITOR RESULTS")) {<NEW_LINE>// Toggle to reading monitor results from next line<NEW_LINE>readingFailedChecks = false;<NEW_LINE>readingMonitorResults = true;<NEW_LINE>} else if (readingFailedChecks && !readingMonitorResults) {<NEW_LINE>// Reading failing checks section<NEW_LINE>failingChecks.addAll(getFailingChecks(line));<NEW_LINE>} else if (!readingFailedChecks && readingMonitorResults) {<NEW_LINE>// Reading monitor checks result<NEW_LINE>monitorResults.append(line);<NEW_LINE>} else {<NEW_LINE>s_logger.error("Unexpected lines reached while parsing health check response. Skipping line:- " + line);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new GetRouterMonitorResultsAnswer(cmd, true, failingChecks, monitorResults.toString());<NEW_LINE>} | failingChecks = new ArrayList<>(); |
1,077,540 | //<NEW_LINE>ModelChange(timings = ModelValidator.TYPE_BEFORE_CHANGE, ifColumnsChanged = { I_M_ShipmentSchedule.COLUMNNAME_QtyTU_Calculated, I_M_ShipmentSchedule.COLUMNNAME_QtyTU_Override, I_M_ShipmentSchedule.COLUMNNAME_QtyOrdered_TU, I_M_ShipmentSchedule.COLUMNNAME_M_HU_PI_Item_Product_Calculated_ID, I_M_ShipmentSchedule.COLUMNNAME_M_HU_PI_Item_Product_Override_ID, I_M_ShipmentSchedule.COLUMNNAME_M_HU_PI_Item_Product_ID })<NEW_LINE>public void updateEffectiveValues(final I_M_ShipmentSchedule shipmentSchedule) {<NEW_LINE>if (shipmentSchedule.getC_OrderLine_ID() > 0) {<NEW_LINE>huShipmentScheduleBL.updateHURelatedValuesFromOrderLine(shipmentSchedule);<NEW_LINE>}<NEW_LINE>huShipmentScheduleBL.updateEffectiveValues(shipmentSchedule);<NEW_LINE>if (shipmentSchedule.getC_OrderLine_ID() > 0) {<NEW_LINE>// update orderLine<NEW_LINE>final I_C_OrderLine orderLine = InterfaceWrapperHelper.create(shipmentSchedule.<MASK><NEW_LINE>// task 09005: make sure the correct qtyOrdered is taken from the shipmentSchedule<NEW_LINE>final BigDecimal qtyOrderedEffective = shipmentScheduleEffectiveBL.computeQtyOrdered(shipmentSchedule);<NEW_LINE>orderLine.setQtyOrdered(qtyOrderedEffective);<NEW_LINE>InterfaceWrapperHelper.save(orderLine);<NEW_LINE>}<NEW_LINE>} | getC_OrderLine(), I_C_OrderLine.class); |
1,704,574 | public void paintChart(Graphics g) {<NEW_LINE>synchronized (ChartModelBase.STATIC_MUTEX) {<NEW_LINE>// GanttGraphicArea.super.paintComponent(g);<NEW_LINE>ChartModel model = myChartModel;<NEW_LINE>model.setBottomUnitWidth(getViewState().getBottomUnitWidth());<NEW_LINE>var rowHeight = Math.max(model.calculateRowHeight(), myTaskTableConnector.getMinRowHeight().getValue());<NEW_LINE>myTaskTableConnector.getRowHeight().setValue(rowHeight);<NEW_LINE>model.setRowHeight((int) Math.ceil(rowHeight));<NEW_LINE>model.setTopTimeUnit(<MASK><NEW_LINE>model.setBottomTimeUnit(getViewState().getBottomTimeUnit());<NEW_LINE>List<Task> visibleTasks = myTaskTableConnector.getVisibleTasks();<NEW_LINE>model.setVisibleTasks(visibleTasks);<NEW_LINE>myChartModel.setTimelineTasks(getUIFacade().getCurrentTaskView().getTimelineTasks());<NEW_LINE>model.paint(g);<NEW_LINE>if (getActiveInteraction() != null) {<NEW_LINE>getActiveInteraction().paint(g);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getViewState().getTopTimeUnit()); |
1,235,485 | public void onMethodInitialized(ForestMethod method, LogHandler annotation) {<NEW_LINE>MetaRequest metaRequest = method.getMetaRequest();<NEW_LINE>if (metaRequest == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>LogConfiguration logConfiguration = metaRequest.getLogConfiguration();<NEW_LINE>if (logConfiguration == null) {<NEW_LINE>logConfiguration = new LogConfiguration();<NEW_LINE>logConfiguration.setLogEnabled(configuration.isLogEnabled());<NEW_LINE>logConfiguration.setLogRequest(configuration.isLogRequest());<NEW_LINE>logConfiguration.setLogResponseStatus(configuration.isLogResponseStatus());<NEW_LINE>logConfiguration.setLogResponseContent(configuration.isLogResponseContent());<NEW_LINE>metaRequest.setLogConfiguration(logConfiguration);<NEW_LINE>}<NEW_LINE>Class<? extends ForestLogHandler> logHandlerClass = annotation.value();<NEW_LINE>ForestLogHandler logHandler = null;<NEW_LINE>try {<NEW_LINE>logHandler = logHandlerClass.newInstance();<NEW_LINE>} catch (InstantiationException e) {<NEW_LINE>throw new ForestRuntimeException(e);<NEW_LINE>} catch (IllegalAccessException e) {<NEW_LINE>throw new ForestRuntimeException(e);<NEW_LINE>}<NEW_LINE>if (logHandler != null) {<NEW_LINE>logConfiguration.setLogHandler(logHandler);<NEW_LINE>} else {<NEW_LINE>logConfiguration.setLogHandler(configuration.getLogHandler());<NEW_LINE>}<NEW_LINE>} | ForestConfiguration configuration = method.getConfiguration(); |
528,319 | public final Object invoke(Object proxy, Method method, Object[] args) throws Throwable {<NEW_LINE>String methodName = method.getName();<NEW_LINE>Class<?>[] parameterTypes = method.getParameterTypes();<NEW_LINE>boolean sslEngineVariant = (parameterTypes.length > 0) && SSLEngine.class.equals(parameterTypes[parameterTypes.length - 1]);<NEW_LINE>if ("getKey".equals(methodName)) {<NEW_LINE>if (sslEngineVariant) {<NEW_LINE>return getKey((String) args[0], (String) args[1], (SSLEngine) args[2]);<NEW_LINE>} else {<NEW_LINE>return getKey((String) args[0], (String) args[1], (Socket) args[2]);<NEW_LINE>}<NEW_LINE>} else if ("chooseServerKeyIdentityHint".equals(methodName)) {<NEW_LINE>if (sslEngineVariant) {<NEW_LINE>return chooseServerKeyIdentityHint((SSLEngine) args[0]);<NEW_LINE>} else {<NEW_LINE>return chooseServerKeyIdentityHint((Socket) args[0]);<NEW_LINE>}<NEW_LINE>} else if ("chooseClientKeyIdentity".equals(methodName)) {<NEW_LINE>if (sslEngineVariant) {<NEW_LINE>return chooseClientKeyIdentity((String) args[0], <MASK><NEW_LINE>} else {<NEW_LINE>return chooseClientKeyIdentity((String) args[0], (Socket) args[1]);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("Unexpected method: " + method);<NEW_LINE>}<NEW_LINE>} | (SSLEngine) args[1]); |
1,582,542 | protected void initParameters() throws UnsupportedEncodingException {<NEW_LINE>super.initParameters();<NEW_LINE><MASK><NEW_LINE>_concurrentInterBrokerPartitionMovements = ParameterUtils.concurrentMovements(_request, true, false);<NEW_LINE>_maxInterBrokerPartitionMovements = ParameterUtils.maxPartitionMovements(_request);<NEW_LINE>_concurrentLeaderMovements = ParameterUtils.concurrentMovements(_request, false, false);<NEW_LINE>_executionProgressCheckIntervalMs = ParameterUtils.executionProgressCheckIntervalMs(_request);<NEW_LINE>_skipHardGoalCheck = ParameterUtils.skipHardGoalCheck(_request);<NEW_LINE>_replicaMovementStrategy = ParameterUtils.getReplicaMovementStrategy(_request, _config);<NEW_LINE>_replicationThrottle = ParameterUtils.replicationThrottle(_request, _config);<NEW_LINE>boolean twoStepVerificationEnabled = _config.getBoolean(WebServerConfig.TWO_STEP_VERIFICATION_ENABLED_CONFIG);<NEW_LINE>_reviewId = ParameterUtils.reviewId(_request, twoStepVerificationEnabled);<NEW_LINE>boolean requestReasonRequired = _config.getBoolean(ExecutorConfig.REQUEST_REASON_REQUIRED_CONFIG);<NEW_LINE>_reason = ParameterUtils.reason(_request, requestReasonRequired && !_dryRun);<NEW_LINE>_stopOngoingExecution = ParameterUtils.stopOngoingExecution(_request);<NEW_LINE>if (_stopOngoingExecution && _dryRun) {<NEW_LINE>throw new UserRequestException(String.format("%s and %s cannot both be set to true.", STOP_ONGOING_EXECUTION_PARAM, DRY_RUN_PARAM));<NEW_LINE>}<NEW_LINE>} | _dryRun = ParameterUtils.getDryRun(_request); |
941,143 | private void doPeerMasterAdjust() {<NEW_LINE>SequenceCommandChain sequenceCommandChain = new SequenceCommandChain(true);<NEW_LINE>peerMasterChanged.forEach((gid, nodeModified) -> {<NEW_LINE>Endpoint peerMaster = nodeModified.getNewNode();<NEW_LINE>logOperation(PEER_CHANGE, currentMaster, gid, nodeModified);<NEW_LINE>sequenceCommandChain.add(retryCommandWrap(new PeerOfCommand(clientPool, <MASK><NEW_LINE>});<NEW_LINE>peerMasterAdded.forEach((gid, nodeAdded) -> {<NEW_LINE>Endpoint peerMaster = nodeAdded.getNode();<NEW_LINE>logOperation(PEER_ADD, currentMaster, gid, nodeAdded);<NEW_LINE>sequenceCommandChain.add(retryCommandWrap(new PeerOfCommand(clientPool, gid, peerMaster, scheduled)));<NEW_LINE>});<NEW_LINE>peerMasterDeleted.forEach((gid, nodeDeleted) -> {<NEW_LINE>if (doDelete) {<NEW_LINE>logOperation(PEER_DELETE, currentMaster, gid, nodeDeleted);<NEW_LINE>sequenceCommandChain.add(retryCommandWrap(new PeerOfCommand(clientPool, gid, scheduled)));<NEW_LINE>} else {<NEW_LINE>logOperation(PEER_SKIP_DELETE, currentMaster, gid, nodeDeleted);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>sequenceCommandChain.future().addListener(commandFuture -> {<NEW_LINE>if (commandFuture.isSuccess())<NEW_LINE>future().setSuccess();<NEW_LINE>else<NEW_LINE>future().setFailure(commandFuture.cause());<NEW_LINE>});<NEW_LINE>sequenceCommandChain.execute(executors);<NEW_LINE>} | gid, peerMaster, scheduled))); |
1,483,143 | private static void compareMethods(String contextPrefix, IBinaryMethod expectedMethod, IBinaryMethod actualMethod) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>contextPrefix = contextPrefix + "." + safeString(expectedMethod.getSelector());<NEW_LINE>compareAnnotations(contextPrefix, expectedMethod.getAnnotations(), actualMethod.getAnnotations());<NEW_LINE>// $NON-NLS-1$<NEW_LINE>// $NON-NLS-1$<NEW_LINE>assertEquals(// $NON-NLS-1$<NEW_LINE>contextPrefix + ": The argument names didn't match.", expectedMethod.getArgumentNames(), actualMethod.getArgumentNames());<NEW_LINE>// $NON-NLS-1$<NEW_LINE>// $NON-NLS-1$<NEW_LINE>assertEquals(// $NON-NLS-1$<NEW_LINE>contextPrefix + ": The default values didn't match.", expectedMethod.getDefaultValue(<MASK><NEW_LINE>// $NON-NLS-1$<NEW_LINE>// $NON-NLS-1$<NEW_LINE>assertEquals(contextPrefix + ": The exception type names did not match.", expectedMethod.getExceptionTypeNames(), actualMethod.getExceptionTypeNames());<NEW_LINE>// $NON-NLS-1$<NEW_LINE>// $NON-NLS-1$<NEW_LINE>compareGenericSignatures(contextPrefix + ": The method's generic signature did not match", expectedMethod.getGenericSignature(), actualMethod.getGenericSignature());<NEW_LINE>// $NON-NLS-1$<NEW_LINE>// $NON-NLS-1$<NEW_LINE>assertEquals(// $NON-NLS-1$<NEW_LINE>contextPrefix + ": The method descriptors did not match.", expectedMethod.getMethodDescriptor(), actualMethod.getMethodDescriptor());<NEW_LINE>// $NON-NLS-1$<NEW_LINE>// $NON-NLS-1$<NEW_LINE>assertEquals(// $NON-NLS-1$<NEW_LINE>contextPrefix + ": The modifiers didn't match.", expectedMethod.getModifiers(), actualMethod.getModifiers());<NEW_LINE>// $NON-NLS-1$<NEW_LINE>char[] classFileName = "".toCharArray();<NEW_LINE>int minAnnotatedParameters = Math.min(expectedMethod.getAnnotatedParametersCount(), actualMethod.getAnnotatedParametersCount());<NEW_LINE>for (int idx = 0; idx < minAnnotatedParameters; idx++) {<NEW_LINE>compareAnnotations(contextPrefix, expectedMethod.getParameterAnnotations(idx, classFileName), actualMethod.getParameterAnnotations(idx, classFileName));<NEW_LINE>}<NEW_LINE>for (int idx = minAnnotatedParameters; idx < expectedMethod.getAnnotatedParametersCount(); idx++) {<NEW_LINE>compareAnnotations(contextPrefix, new IBinaryAnnotation[0], expectedMethod.getParameterAnnotations(idx, classFileName));<NEW_LINE>}<NEW_LINE>for (int idx = minAnnotatedParameters; idx < actualMethod.getAnnotatedParametersCount(); idx++) {<NEW_LINE>compareAnnotations(contextPrefix, new IBinaryAnnotation[0], actualMethod.getParameterAnnotations(idx, classFileName));<NEW_LINE>}<NEW_LINE>// $NON-NLS-1$<NEW_LINE>// $NON-NLS-1$<NEW_LINE>assertEquals(// $NON-NLS-1$<NEW_LINE>contextPrefix + ": The selectors did not match", expectedMethod.getSelector(), actualMethod.getSelector());<NEW_LINE>// $NON-NLS-1$<NEW_LINE>// $NON-NLS-1$<NEW_LINE>assertEquals(// $NON-NLS-1$<NEW_LINE>contextPrefix + ": The tag bits did not match", expectedMethod.getTagBits(), actualMethod.getTagBits());<NEW_LINE>compareTypeAnnotations(contextPrefix, expectedMethod.getTypeAnnotations(), actualMethod.getTypeAnnotations());<NEW_LINE>} | ), actualMethod.getDefaultValue()); |
119,464 | @Produces(MediaType.TEXT_PLAIN)<NEW_LINE>@ApiOperation(value = "<b>Simple check</b> feature toggle", response = Boolean.class)<NEW_LINE>@ApiResponses({ @ApiResponse(code = 200, message = "if feature is flipped"), @ApiResponse(code = 400, message = "Invalid parameter"), @ApiResponse(code = 404, message = "feature has not been found") })<NEW_LINE>public Response check(@Context HttpHeaders headers, @PathParam("uid") String uid) {<NEW_LINE>// HoldSecurity Context<NEW_LINE>FF4JSecurityContextHolder.save(securityContext);<NEW_LINE>// Expected Custom FlipStrategy (JSON)<NEW_LINE>if (!ff4j.getFeatureStore().exist(uid)) {<NEW_LINE>String errMsg = new FeatureNotFoundException(uid).getMessage();<NEW_LINE>return Response.status(Response.Status.NOT_FOUND).<MASK><NEW_LINE>}<NEW_LINE>return Response.ok(String.valueOf(ff4j.check(uid))).build();<NEW_LINE>} | entity(errMsg).build(); |
530,872 | public Pair<Boolean, byte[]> execute(byte[] data) {<NEW_LINE>byte[] h = new byte[32];<NEW_LINE>byte[] v = new byte[32];<NEW_LINE>byte[] r = new byte[32];<NEW_LINE>byte[<MASK><NEW_LINE>DataWord out = null;<NEW_LINE>try {<NEW_LINE>System.arraycopy(data, 0, h, 0, 32);<NEW_LINE>System.arraycopy(data, 32, v, 0, 32);<NEW_LINE>System.arraycopy(data, 64, r, 0, 32);<NEW_LINE>int sLength = data.length < 128 ? data.length - 96 : 32;<NEW_LINE>System.arraycopy(data, 96, s, 0, sLength);<NEW_LINE>ECKey.ECDSASignature signature = ECKey.ECDSASignature.fromComponents(r, s, v[31]);<NEW_LINE>if (validateV(v) && signature.validateComponents()) {<NEW_LINE>out = DataWord.of(ECKey.signatureToAddress(h, signature));<NEW_LINE>}<NEW_LINE>} catch (Throwable any) {<NEW_LINE>}<NEW_LINE>if (out == null) {<NEW_LINE>return Pair.of(true, EMPTY_BYTE_ARRAY);<NEW_LINE>} else {<NEW_LINE>return Pair.of(true, out.getData());<NEW_LINE>}<NEW_LINE>} | ] s = new byte[32]; |
572,634 | private void play(final Intent intent, final Promise promise) {<NEW_LINE>Activity currentActivity = getCurrentActivity();<NEW_LINE>if (currentActivity == null) {<NEW_LINE>promise.reject(E_ACTIVITY_DOES_NOT_EXIST, "Activity doesn't exist");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Store the promise to resolve/reject when picker returns data<NEW_LINE>mPickerPromise = promise;<NEW_LINE>try {<NEW_LINE>if (intent != null) {<NEW_LINE>if (canResolveIntent(intent)) {<NEW_LINE>currentActivity.startActivityForResult(intent, REQ_START_STANDALONE_PLAYER);<NEW_LINE>} else {<NEW_LINE>// Could not resolve the intent - must need to install or update the YouTube API service.<NEW_LINE>YouTubeInitializationResult.SERVICE_MISSING.getErrorDialog(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>mPickerPromise.reject(E_FAILED_TO_SHOW_PLAYER, e);<NEW_LINE>mPickerPromise = null;<NEW_LINE>}<NEW_LINE>} | currentActivity, REQ_RESOLVE_SERVICE_MISSING).show(); |
1,391,924 | protected void configure() {<NEW_LINE>bind(ManufOrderRepository.class).to(ManufOrderManagementRepository.class);<NEW_LINE>bind(OperationOrderRepository.class).to(OperationOrderManagementRepository.class);<NEW_LINE>bind(ProductionOrderService.class).to(ProductionOrderServiceImpl.class);<NEW_LINE>bind(BillOfMaterialService.class).to(BillOfMaterialServiceImpl.class);<NEW_LINE>bind(ManufOrderService.class).to(ManufOrderServiceImpl.class);<NEW_LINE>bind(OperationOrderService.class).to(OperationOrderServiceImpl.class);<NEW_LINE>bind(ProductionOrderService.class).to(ProductionOrderServiceImpl.class);<NEW_LINE>bind(ProductionOrderWizardService.class).to(ProductionOrderWizardServiceImpl.class);<NEW_LINE>bind(ProductionOrderSaleOrderService.class).to(ProductionOrderSaleOrderServiceImpl.class);<NEW_LINE>bind(MrpLineServiceImpl.class).to(MrpLineServiceProductionImpl.class);<NEW_LINE>bind(MrpServiceImpl.class).to(MrpServiceProductionImpl.class);<NEW_LINE>bind(CostSheetService.class).to(CostSheetServiceImpl.class);<NEW_LINE>bind(CostSheetLineService.class).to(CostSheetLineServiceImpl.class);<NEW_LINE>bind(SaleOrderWorkflowServiceSupplychainImpl.class).to(SaleOrderWorkflowServiceProductionImpl.class);<NEW_LINE>bind(StockRulesServiceSupplychainImpl.class<MASK><NEW_LINE>bind(BillOfMaterialRepository.class).to(BillOfMaterialManagementRepository.class);<NEW_LINE>bind(StockConfigService.class).to(StockConfigProductionService.class);<NEW_LINE>bind(ConfiguratorBomService.class).to(ConfiguratorBomServiceImpl.class);<NEW_LINE>bind(ConfiguratorProdProcessService.class).to(ConfiguratorProdProcessServiceImpl.class);<NEW_LINE>bind(ConfiguratorProdProcessLineService.class).to(ConfiguratorProdProcessLineServiceImpl.class);<NEW_LINE>bind(ConfiguratorServiceImpl.class).to(ConfiguratorServiceProductionImpl.class);<NEW_LINE>bind(AppProductionService.class).to(AppProductionServiceImpl.class);<NEW_LINE>bind(ProdProcessRepository.class).to(ProdProcessManagementRepository.class);<NEW_LINE>bind(StockMoveLineSupplychainRepository.class).to(StockMoveLineProductionRepository.class);<NEW_LINE>bind(ProdProcessLineService.class).to(ProdProcessLineServiceImpl.class);<NEW_LINE>bind(StockMoveServiceSupplychainImpl.class).to(StockMoveProductionServiceImpl.class);<NEW_LINE>bind(ProdProductRepository.class).to(ProdProductProductionRepository.class);<NEW_LINE>bind(RawMaterialRequirementService.class).to(RawMaterialRequirementServiceImpl.class);<NEW_LINE>bind(RawMaterialRequirementRepository.class).to(RawMaterialRequirementProductionRepository.class);<NEW_LINE>bind(ProductionBatchRepository.class).to(ProductionBatchManagementRepository.class);<NEW_LINE>bind(UnitCostCalculationRepository.class).to(UnitCostCalculationManagementRepository.class);<NEW_LINE>bind(UnitCostCalculationService.class).to(UnitCostCalculationServiceImpl.class);<NEW_LINE>bind(UnitCostCalcLineService.class).to(UnitCostCalcLineServiceImpl.class);<NEW_LINE>bind(ProductStockRepository.class).to(ProductProductionRepository.class);<NEW_LINE>bind(ConfiguratorCreatorImportServiceImpl.class).to(ConfiguratorCreatorImportServiceProductionImpl.class);<NEW_LINE>bind(ProductStockLocationServiceImpl.class).to(ProductionProductStockLocationServiceImpl.class);<NEW_LINE>bind(StockMoveSupplychainRepository.class).to(StockMoveProductionRepository.class);<NEW_LINE>bind(ManufOrderPrintService.class).to(ManufOrderPrintServiceImpl.class);<NEW_LINE>bind(MrpForecastProductionService.class).to(MrpForecastProductionServiceImpl.class);<NEW_LINE>bind(MpsWeeklyScheduleService.class).to(MpsWeeklyScheduleServiceImpl.class);<NEW_LINE>bind(MpsChargeService.class).to(MpsChargeServiceImpl.class);<NEW_LINE>bind(MachineRepository.class).to(MachineToolManagementRepository.class);<NEW_LINE>bind(PurchaseOrderServiceSupplychainImpl.class).to(PurchaseOrderServiceProductionImpl.class);<NEW_LINE>bind(SopService.class).to(SopServiceImpl.class);<NEW_LINE>} | ).to(StockRulesServiceProductionImpl.class); |
1,076,683 | // DO NOT MODIFY THIS CODE, GENERATED AUTOMATICALLY<NEW_LINE>public static java.util.List<com.sun.jdi.InterfaceType> subinterfaces0(com.sun.jdi.InterfaceType a) {<NEW_LINE>if (org.netbeans.modules.debugger.jpda.JDIExceptionReporter.isLoggable()) {<NEW_LINE>org.netbeans.modules.debugger.jpda.JDIExceptionReporter.logCallStart("com.sun.jdi.InterfaceType", "subinterfaces", "JDI CALL: com.sun.jdi.InterfaceType({0}).subinterfaces()", new Object[] { a });<NEW_LINE>}<NEW_LINE>Object retValue = null;<NEW_LINE>try {<NEW_LINE>java.util.List<com.sun.jdi.InterfaceType> ret;<NEW_LINE>ret = a.subinterfaces();<NEW_LINE>retValue = ret;<NEW_LINE>return ret;<NEW_LINE>} catch (com.sun.jdi.InternalException ex) {<NEW_LINE>retValue = ex;<NEW_LINE>org.netbeans.modules.debugger.jpda.JDIExceptionReporter.report(ex);<NEW_LINE>return java<MASK><NEW_LINE>} catch (com.sun.jdi.VMDisconnectedException ex) {<NEW_LINE>retValue = 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>return java.util.Collections.emptyList();<NEW_LINE>} catch (Error err) {<NEW_LINE>retValue = err;<NEW_LINE>throw err;<NEW_LINE>} catch (RuntimeException rex) {<NEW_LINE>retValue = rex;<NEW_LINE>throw rex;<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.InterfaceType", "subinterfaces", retValue);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .util.Collections.emptyList(); |
202,325 | final RegisterTargetWithMaintenanceWindowResult executeRegisterTargetWithMaintenanceWindow(RegisterTargetWithMaintenanceWindowRequest registerTargetWithMaintenanceWindowRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(registerTargetWithMaintenanceWindowRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<RegisterTargetWithMaintenanceWindowRequest> request = null;<NEW_LINE>Response<RegisterTargetWithMaintenanceWindowResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new RegisterTargetWithMaintenanceWindowRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(registerTargetWithMaintenanceWindowRequest));<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, "SSM");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RegisterTargetWithMaintenanceWindow");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<RegisterTargetWithMaintenanceWindowResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new RegisterTargetWithMaintenanceWindowResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | endClientExecution(awsRequestMetrics, request, response); |
746,978 | final ListUserTagsResult executeListUserTags(ListUserTagsRequest listUserTagsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listUserTagsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListUserTagsRequest> request = null;<NEW_LINE>Response<ListUserTagsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListUserTagsRequestMarshaller().marshall(super.beforeMarshalling(listUserTagsRequest));<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, "IAM");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<ListUserTagsResult> responseHandler = new StaxResponseHandler<ListUserTagsResult>(new ListUserTagsResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListUserTags"); |
1,154,103 | private void tryProvisionGroups(List<CorpGroupSnapshot> corpGroups) {<NEW_LINE>log.debug(String.format("Attempting to provision groups with urns %s", corpGroups.stream().map(CorpGroupSnapshot::getUrn).collect(Collectors.toList())));<NEW_LINE>// 1. Check if this user already exists.<NEW_LINE>try {<NEW_LINE>final Set<Urn> urnsToFetch = corpGroups.stream().map(CorpGroupSnapshot::getUrn).collect(Collectors.toSet());<NEW_LINE>final Map<Urn, Entity> existingGroups = _entityClient.batchGet(urnsToFetch, _systemAuthentication);<NEW_LINE>log.debug(String.format("Fetched GMS groups with urns %s", existingGroups.keySet()));<NEW_LINE>final List<CorpGroupSnapshot> groupsToCreate = new ArrayList<>();<NEW_LINE>for (CorpGroupSnapshot extractedGroup : corpGroups) {<NEW_LINE>if (existingGroups.containsKey(extractedGroup.getUrn())) {<NEW_LINE>final Entity groupEntity = existingGroups.<MASK><NEW_LINE>final CorpGroupSnapshot corpGroupSnapshot = groupEntity.getValue().getCorpGroupSnapshot();<NEW_LINE>// If more than the key aspect exists, then the group already "exists".<NEW_LINE>if (corpGroupSnapshot.getAspects().size() <= 1) {<NEW_LINE>log.debug(String.format("Extracted group that does not yet exist %s. Provisioning...", corpGroupSnapshot.getUrn()));<NEW_LINE>groupsToCreate.add(extractedGroup);<NEW_LINE>}<NEW_LINE>log.debug(String.format("Group %s already exists. Skipping provisioning", corpGroupSnapshot.getUrn()));<NEW_LINE>} else {<NEW_LINE>// Should not occur until we stop returning default Key aspects for unrecognized entities.<NEW_LINE>log.debug(String.format("Extracted group that does not yet exist %s. Provisioning...", extractedGroup.getUrn()));<NEW_LINE>groupsToCreate.add(extractedGroup);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<Urn> groupsToCreateUrns = groupsToCreate.stream().map(CorpGroupSnapshot::getUrn).collect(Collectors.toList());<NEW_LINE>log.debug(String.format("Provisioning groups with urns %s", groupsToCreateUrns));<NEW_LINE>// Now batch create all entities identified to create.<NEW_LINE>_entityClient.batchUpdate(groupsToCreate.stream().map(groupSnapshot -> new Entity().setValue(Snapshot.create(groupSnapshot))).collect(Collectors.toSet()), _systemAuthentication);<NEW_LINE>log.debug(String.format("Successfully provisioned groups with urns %s", groupsToCreateUrns));<NEW_LINE>} catch (RemoteInvocationException e) {<NEW_LINE>// Failing provisioning is something worth throwing about.<NEW_LINE>throw new RuntimeException(String.format("Failed to provision groups with urns %s.", corpGroups.stream().map(CorpGroupSnapshot::getUrn).collect(Collectors.toList())), e);<NEW_LINE>}<NEW_LINE>} | get(extractedGroup.getUrn()); |
1,507,054 | public static ListNodesResponse unmarshall(ListNodesResponse listNodesResponse, UnmarshallerContext _ctx) {<NEW_LINE>listNodesResponse.setRequestId(_ctx.stringValue("ListNodesResponse.RequestId"));<NEW_LINE>listNodesResponse.setTotalCount(_ctx.integerValue("ListNodesResponse.TotalCount"));<NEW_LINE>listNodesResponse.setPageNumber(_ctx.integerValue("ListNodesResponse.PageNumber"));<NEW_LINE>listNodesResponse.setPageSize(_ctx.integerValue("ListNodesResponse.PageSize"));<NEW_LINE>List<NodeInfo> nodes = new ArrayList<NodeInfo>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListNodesResponse.Nodes.Length"); i++) {<NEW_LINE>NodeInfo nodeInfo = new NodeInfo();<NEW_LINE>nodeInfo.setId(_ctx.stringValue("ListNodesResponse.Nodes[" + i + "].Id"));<NEW_LINE>nodeInfo.setRegionId(_ctx.stringValue("ListNodesResponse.Nodes[" + i + "].RegionId"));<NEW_LINE>nodeInfo.setHostName(_ctx.stringValue("ListNodesResponse.Nodes[" + i + "].HostName"));<NEW_LINE>nodeInfo.setIpAddress(_ctx.stringValue("ListNodesResponse.Nodes[" + i + "].IpAddress"));<NEW_LINE>nodeInfo.setStatus(_ctx.stringValue("ListNodesResponse.Nodes[" + i + "].Status"));<NEW_LINE>nodeInfo.setVersion(_ctx.stringValue("ListNodesResponse.Nodes[" + i + "].Version"));<NEW_LINE>nodeInfo.setCreatedByEhpc(_ctx.booleanValue("ListNodesResponse.Nodes[" + i + "].CreatedByEhpc"));<NEW_LINE>nodeInfo.setAddTime(_ctx.stringValue("ListNodesResponse.Nodes[" + i + "].AddTime"));<NEW_LINE>nodeInfo.setExpired(_ctx.booleanValue("ListNodesResponse.Nodes[" + i + "].Expired"));<NEW_LINE>nodeInfo.setExpiredTime(_ctx.stringValue("ListNodesResponse.Nodes[" + i + "].ExpiredTime"));<NEW_LINE>nodeInfo.setSpotStrategy(_ctx.stringValue("ListNodesResponse.Nodes[" + i + "].SpotStrategy"));<NEW_LINE>nodeInfo.setLockReason(_ctx.stringValue("ListNodesResponse.Nodes[" + i + "].LockReason"));<NEW_LINE>nodeInfo.setImageOwnerAlias(_ctx.stringValue("ListNodesResponse.Nodes[" + i + "].ImageOwnerAlias"));<NEW_LINE>nodeInfo.setImageId(_ctx.stringValue("ListNodesResponse.Nodes[" + i + "].ImageId"));<NEW_LINE>nodeInfo.setLocation(_ctx.stringValue("ListNodesResponse.Nodes[" + i + "].Location"));<NEW_LINE>nodeInfo.setCreateMode(_ctx.stringValue("ListNodesResponse.Nodes[" + i + "].CreateMode"));<NEW_LINE>nodeInfo.setVpcId(_ctx.stringValue("ListNodesResponse.Nodes[" + i + "].VpcId"));<NEW_LINE>nodeInfo.setZoneId(_ctx.stringValue("ListNodesResponse.Nodes[" + i + "].ZoneId"));<NEW_LINE>nodeInfo.setVSwitchId(_ctx.stringValue("ListNodesResponse.Nodes[" + i + "].VSwitchId"));<NEW_LINE>nodeInfo.setHtEnabled(_ctx.booleanValue("ListNodesResponse.Nodes[" + i + "].HtEnabled"));<NEW_LINE>nodeInfo.setPublicIpAddress(_ctx.stringValue("ListNodesResponse.Nodes[" + i + "].PublicIpAddress"));<NEW_LINE>nodeInfo.setInstanceType(_ctx.stringValue("ListNodesResponse.Nodes[" + i + "].InstanceType"));<NEW_LINE>List<String> roles = new ArrayList<String>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("ListNodesResponse.Nodes[" + i + "].Roles.Length"); j++) {<NEW_LINE>roles.add(_ctx.stringValue("ListNodesResponse.Nodes[" + i + "].Roles[" + j + "]"));<NEW_LINE>}<NEW_LINE>nodeInfo.setRoles(roles);<NEW_LINE>TotalResources totalResources = new TotalResources();<NEW_LINE>totalResources.setCpu(_ctx.integerValue<MASK><NEW_LINE>totalResources.setMemory(_ctx.integerValue("ListNodesResponse.Nodes[" + i + "].TotalResources.Memory"));<NEW_LINE>totalResources.setGpu(_ctx.integerValue("ListNodesResponse.Nodes[" + i + "].TotalResources.Gpu"));<NEW_LINE>nodeInfo.setTotalResources(totalResources);<NEW_LINE>UsedResources usedResources = new UsedResources();<NEW_LINE>usedResources.setCpu(_ctx.integerValue("ListNodesResponse.Nodes[" + i + "].UsedResources.Cpu"));<NEW_LINE>usedResources.setMemory(_ctx.integerValue("ListNodesResponse.Nodes[" + i + "].UsedResources.Memory"));<NEW_LINE>usedResources.setGpu(_ctx.integerValue("ListNodesResponse.Nodes[" + i + "].UsedResources.Gpu"));<NEW_LINE>nodeInfo.setUsedResources(usedResources);<NEW_LINE>nodes.add(nodeInfo);<NEW_LINE>}<NEW_LINE>listNodesResponse.setNodes(nodes);<NEW_LINE>return listNodesResponse;<NEW_LINE>} | ("ListNodesResponse.Nodes[" + i + "].TotalResources.Cpu")); |
414,762 | static BeanDefinitionBuilder configure(Element element, boolean expectReply, ParserContext parserContext) {<NEW_LINE>BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(FileWritingMessageHandlerFactoryBean.class);<NEW_LINE>String directory = element.getAttribute("directory");<NEW_LINE>String directoryExpression = element.getAttribute("directory-expression");<NEW_LINE>if (!StringUtils.hasText(directory) && !StringUtils.hasText(directoryExpression)) {<NEW_LINE>parserContext.getReaderContext().error("directory or directory-expression is required", element);<NEW_LINE>} else if (StringUtils.hasText(directory) && StringUtils.hasText(directoryExpression)) {<NEW_LINE>parserContext.getReaderContext().error("Either directory or directory-expression must be provided but not both", element);<NEW_LINE>}<NEW_LINE>if (StringUtils.hasText(directoryExpression)) {<NEW_LINE>BeanDefinitionBuilder expressionBuilder = BeanDefinitionBuilder.genericBeanDefinition(ExpressionFactoryBean.class);<NEW_LINE>expressionBuilder.addConstructorArgValue(directoryExpression);<NEW_LINE>builder.addPropertyValue("directoryExpression", expressionBuilder.getBeanDefinition());<NEW_LINE>}<NEW_LINE>builder.addPropertyValue("expectReply", expectReply);<NEW_LINE>IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "append-new-line");<NEW_LINE>IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "directory");<NEW_LINE>IntegrationNamespaceUtils.<MASK><NEW_LINE>IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "delete-source-files");<NEW_LINE>IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "temporary-file-suffix");<NEW_LINE>IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "mode", "fileExistsMode");<NEW_LINE>IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "charset");<NEW_LINE>IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "buffer-size");<NEW_LINE>IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "flush-interval");<NEW_LINE>IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "flush-when-idle");<NEW_LINE>IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "flush-predicate");<NEW_LINE>IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "chmod");<NEW_LINE>IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "preserve-timestamp");<NEW_LINE>filenameGenerators(element, parserContext, builder);<NEW_LINE>return builder;<NEW_LINE>} | setValueIfAttributeDefined(builder, element, "auto-create-directory"); |
1,398,378 | public void unregister(URL url) {<NEW_LINE>super.unregister(url);<NEW_LINE>removeFailedRegistered(url);<NEW_LINE>removeFailedUnregistered(url);<NEW_LINE>try {<NEW_LINE>// Sending a cancellation request to the server side<NEW_LINE>doUnregister(url);<NEW_LINE>} catch (Exception e) {<NEW_LINE>Throwable t = e;<NEW_LINE>// If the startup detection is opened, the Exception is thrown directly.<NEW_LINE>boolean check = getUrl().getParameter(Constants.CHECK_KEY, true) && url.getParameter(Constants.CHECK_KEY, true) && !(url.getPort() == 0);<NEW_LINE>boolean skipFailback = t instanceof SkipFailbackWrapperException;<NEW_LINE>if (check || skipFailback) {<NEW_LINE>if (skipFailback) {<NEW_LINE>t = t.getCause();<NEW_LINE>}<NEW_LINE>throw new IllegalStateException("Failed to unregister " + url + " to registry " + getUrl().getAddress() + ", cause: " + t.getMessage(), t);<NEW_LINE>} else {<NEW_LINE>logger.error("Failed to unregister " + url + ", waiting for retry, cause: " + <MASK><NEW_LINE>}<NEW_LINE>// Record a failed registration request to a failed list, retry regularly<NEW_LINE>addFailedUnregistered(url);<NEW_LINE>}<NEW_LINE>} | t.getMessage(), t); |
646,929 | final DescribeAuditTaskResult executeDescribeAuditTask(DescribeAuditTaskRequest describeAuditTaskRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeAuditTaskRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeAuditTaskRequest> request = null;<NEW_LINE>Response<DescribeAuditTaskResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeAuditTaskRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeAuditTaskRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "IoT");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeAuditTaskResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeAuditTaskResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeAuditTask"); |
547,983 | public static ClientMessage encodeRequest(java.lang.String name, long startSequence, int minSize, int maxSize, @Nullable com.hazelcast.internal.serialization.Data predicate, @Nullable com.hazelcast.internal.serialization.Data projection) {<NEW_LINE>ClientMessage clientMessage = ClientMessage.createForEncode();<NEW_LINE>clientMessage.setRetryable(true);<NEW_LINE>clientMessage.setOperationName("Map.EventJournalRead");<NEW_LINE>ClientMessage.Frame initialFrame = new ClientMessage.Frame(new byte[REQUEST_INITIAL_FRAME_SIZE], UNFRAGMENTED_MESSAGE);<NEW_LINE>encodeInt(initialFrame.content, TYPE_FIELD_OFFSET, REQUEST_MESSAGE_TYPE);<NEW_LINE>encodeInt(initialFrame.content, PARTITION_ID_FIELD_OFFSET, -1);<NEW_LINE>encodeLong(initialFrame.content, REQUEST_START_SEQUENCE_FIELD_OFFSET, startSequence);<NEW_LINE>encodeInt(initialFrame.content, REQUEST_MIN_SIZE_FIELD_OFFSET, minSize);<NEW_LINE>encodeInt(<MASK><NEW_LINE>clientMessage.add(initialFrame);<NEW_LINE>StringCodec.encode(clientMessage, name);<NEW_LINE>CodecUtil.encodeNullable(clientMessage, predicate, DataCodec::encode);<NEW_LINE>CodecUtil.encodeNullable(clientMessage, projection, DataCodec::encode);<NEW_LINE>return clientMessage;<NEW_LINE>} | initialFrame.content, REQUEST_MAX_SIZE_FIELD_OFFSET, maxSize); |
643,085 | final AssumeRoleResult executeAssumeRole(AssumeRoleRequest assumeRoleRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(assumeRoleRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<AssumeRoleRequest> request = null;<NEW_LINE>Response<AssumeRoleResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new AssumeRoleRequestMarshaller().marshall(super.beforeMarshalling(assumeRoleRequest));<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, "STS");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "AssumeRole");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<AssumeRoleResult> responseHandler = new StaxResponseHandler<AssumeRoleResult>(new AssumeRoleResultStaxUnmarshaller());<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,244,917 | private static void startApi(CommandLineArgs args, Server server) {<NEW_LINE>// Get database properties and ensure that the version is compatible.<NEW_LINE>DatabaseProperties dbProperties = new DatabaseProperties();<NEW_LINE>server.loadFromDatabase(dbProperties);<NEW_LINE>if (args.getLanguages().length > 0) {<NEW_LINE>dbProperties.restrictLanguages(args.getLanguages());<NEW_LINE>}<NEW_LINE>port(args.getListenPort());<NEW_LINE>ipAddress(args.getListenIp());<NEW_LINE>String allowedOrigin = args.isCorsAnyOrigin() ? "*" : args.getCorsOrigin();<NEW_LINE>if (allowedOrigin != null) {<NEW_LINE>CorsFilter.enableCORS(allowedOrigin, "get", "*");<NEW_LINE>} else {<NEW_LINE>before((request, response) -> {<NEW_LINE>// in the other case set by enableCors<NEW_LINE>response.type("application/json; charset=UTF-8");<NEW_LINE>});<NEW_LINE>}<NEW_LINE>// setup search API<NEW_LINE>String[] langs = dbProperties.getLanguages();<NEW_LINE>get("api", new SearchRequestHandler("api", server.createSearchHandler(langs), langs, args.getDefaultLanguage()));<NEW_LINE>get("api/", new SearchRequestHandler("api/", server.createSearchHandler(langs), langs, args.getDefaultLanguage()));<NEW_LINE>get("reverse", new ReverseSearchRequestHandler("reverse", server.createReverseHandler(), dbProperties.getLanguages(), args.getDefaultLanguage()));<NEW_LINE>get("reverse/", new ReverseSearchRequestHandler("reverse/", server.createReverseHandler(), dbProperties.getLanguages(), args.getDefaultLanguage()));<NEW_LINE>if (args.isEnableUpdateApi()) {<NEW_LINE>// setup update API<NEW_LINE>final NominatimUpdater nominatimUpdater = setupNominatimUpdater(args, server);<NEW_LINE>get("/nominatim-update", (Request request, Response response) -> {<NEW_LINE>new Thread(() -> nominatimUpdater.<MASK><NEW_LINE>return "nominatim update started (more information in console output) ...";<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | update()).start(); |
773,603 | protected void parse() {<NEW_LINE>showTabNames = getBoolean(SHOW_TEXT_ICONS, true);<NEW_LINE>processImages = getInt(PROCESS_IMAGES, 0);<NEW_LINE>// No default<NEW_LINE>configLocale = getString(LOCALE, null);<NEW_LINE>locale = getString(LOCALE, DEFAULT_LOCALE);<NEW_LINE>useSystemsLocaleForFormat = getBoolean(USE_SYSTEMS_LOCALE_FOR_FORMAT_KEY, true);<NEW_LINE>displayOption = getInt(DISPLAY_OPTION, 1);<NEW_LINE>responsePanelPosition = getString(RESPONSE_PANEL_POS_KEY, WorkbenchPanel.ResponsePanelPosition.TABS_SIDE_BY_SIDE.name());<NEW_LINE><MASK><NEW_LINE>showMainToolbar = getInt(SHOW_MAIN_TOOLBAR_OPTION, 1);<NEW_LINE>advancedViewEnabled = getInt(ADVANCEDUI_OPTION, 0);<NEW_LINE>wmUiHandlingEnabled = getInt(WMUIHANDLING_OPTION, 0);<NEW_LINE>askOnExitEnabled = getInt(ASKONEXIT_OPTION, 1);<NEW_LINE>warnOnTabDoubleClick = getBoolean(WARN_ON_TAB_DOUBLE_CLICK_OPTION, true);<NEW_LINE>mode = getString(MODE_OPTION, Mode.standard.name());<NEW_LINE>outputTabTimeStampingEnabled = getBoolean(OUTPUT_TAB_TIMESTAMPING_OPTION, false);<NEW_LINE>outputTabTimeStampFormat = getString(OUTPUT_TAB_TIMESTAMP_FORMAT, DEFAULT_TIME_STAMP_FORMAT);<NEW_LINE>showLocalConnectRequests = getBoolean(SHOW_LOCAL_CONNECT_REQUESTS, false);<NEW_LINE>showSplashScreen = getBoolean(SPLASHSCREEN_OPTION, true);<NEW_LINE>for (FontUtils.FontType fontType : FontUtils.FontType.values()) {<NEW_LINE>fontNames.put(fontType, getString(getFontNameConfKey(fontType), ""));<NEW_LINE>fontSizes.put(fontType, getInt(getFontSizeConfKey(fontType), -1));<NEW_LINE>}<NEW_LINE>scaleImages = getBoolean(SCALE_IMAGES, true);<NEW_LINE>showDevWarning = getBoolean(SHOW_DEV_WARNING, true);<NEW_LINE>lookAndFeelInfo = new LookAndFeelInfo(getString(LOOK_AND_FEEL, DEFAULT_LOOK_AND_FEEL.getName()), getString(LOOK_AND_FEEL_CLASS, DEFAULT_LOOK_AND_FEEL.getClassName()));<NEW_LINE>allowAppIntegrationInContainers = getBoolean(ALLOW_APP_INTEGRATION_IN_CONTAINERS, false);<NEW_LINE>this.confirmRemoveProxyExcludeRegex = getBoolean(CONFIRM_REMOVE_PROXY_EXCLUDE_REGEX_KEY, false);<NEW_LINE>this.confirmRemoveScannerExcludeRegex = getBoolean(CONFIRM_REMOVE_SCANNER_EXCLUDE_REGEX_KEY, false);<NEW_LINE>this.confirmRemoveSpiderExcludeRegex = getBoolean(CONFIRM_REMOVE_SPIDER_EXCLUDE_REGEX_KEY, false);<NEW_LINE>} | brkPanelViewOption = getInt(BRK_PANEL_VIEW_OPTION, 0); |
1,399,739 | public static <T extends TokenId> StringBuilder appendTokenList(StringBuilder sb, TokenList<T> tokenList, int currentIndex, int startIndex, int endIndex, boolean appendEmbedded, int indent, boolean dumpTokenText) {<NEW_LINE>if (sb == null) {<NEW_LINE>sb = new StringBuilder(200);<NEW_LINE>}<NEW_LINE>TokenHierarchy<?> tokenHierarchy;<NEW_LINE>if (tokenList instanceof SnapshotTokenList) {<NEW_LINE>tokenHierarchy = ((SnapshotTokenList<T>) tokenList).snapshot().tokenHierarchy();<NEW_LINE>} else {<NEW_LINE>tokenHierarchy = null;<NEW_LINE>}<NEW_LINE>endIndex = Math.min(tokenList.tokenCountCurrent(), endIndex);<NEW_LINE>int digitCount = ArrayUtilities.digitCount(endIndex - 1);<NEW_LINE>for (int i = Math.max(startIndex, 0); i < endIndex; i++) {<NEW_LINE><MASK><NEW_LINE>sb.append((i == currentIndex) ? '*' : 'T');<NEW_LINE>ArrayUtilities.appendBracketedIndex(sb, i, digitCount);<NEW_LINE>try {<NEW_LINE>appendTokenInfo(sb, tokenList, i, tokenHierarchy, appendEmbedded, indent, dumpTokenText);<NEW_LINE>} catch (IndexOutOfBoundsException e) {<NEW_LINE>// Fallback that allows to grab at least partial info<NEW_LINE>sb.append("<IOOBE occurred!!!>\n");<NEW_LINE>// Do not dump further info<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>sb.append('\n');<NEW_LINE>}<NEW_LINE>return sb;<NEW_LINE>} | ArrayUtilities.appendSpaces(sb, indent); |
908,160 | private void checkAuthWithoutAuthInfo(String command) throws DdlException {<NEW_LINE>Database db = Catalog.getCurrentCatalog().getDbOrDdlException(dbId);<NEW_LINE>// check auth<NEW_LINE>try {<NEW_LINE>Set<MASK><NEW_LINE>if (tableNames.isEmpty()) {<NEW_LINE>// forward compatibility<NEW_LINE>if (!Catalog.getCurrentCatalog().getAuth().checkDbPriv(ConnectContext.get(), db.getFullName(), PrivPredicate.LOAD)) {<NEW_LINE>ErrorReport.reportDdlException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR, PaloPrivilege.LOAD_PRIV);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>for (String tblName : tableNames) {<NEW_LINE>if (!Catalog.getCurrentCatalog().getAuth().checkTblPriv(ConnectContext.get(), db.getFullName(), tblName, PrivPredicate.LOAD)) {<NEW_LINE>ErrorReport.reportDdlException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, command, ConnectContext.get().getQualifiedUser(), ConnectContext.get().getRemoteIP(), db.getFullName() + ": " + tblName);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (MetaNotFoundException e) {<NEW_LINE>throw new DdlException(e.getMessage());<NEW_LINE>}<NEW_LINE>} | <String> tableNames = getTableNames(); |
1,755,264 | private static IntFloatVector deserializeIntFloatVector(ByteBuf in, long dim) {<NEW_LINE>int storageType = deserializeInt(in);<NEW_LINE>switch(storageType) {<NEW_LINE>case DENSE_STORAGE_TYPE:<NEW_LINE>return VFactory.denseFloatVector(deserializeFloats(in));<NEW_LINE>case SPARSE_STORAGE_TYPE:<NEW_LINE>int len = deserializeInt(in);<NEW_LINE>Int2FloatOpenHashMap idToValueMap = new Int2FloatOpenHashMap(len);<NEW_LINE>for (int i = 0; i < len; i++) {<NEW_LINE>idToValueMap.put(deserializeInt(in), deserializeFloat(in));<NEW_LINE>}<NEW_LINE>return new IntFloatVector((int) dim, new IntFloatSparseVectorStorage((int) dim, idToValueMap));<NEW_LINE>case SORTED_STORAGE_TYPE:<NEW_LINE>return VFactory.sortedFloatVector((int) dim, deserializeInts(in), deserializeFloats(in));<NEW_LINE>default:<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | throw new UnsupportedOperationException("Unsupport storage type " + storageType); |
275,573 | public BeamSqlTable buildBeamSqlTable(Table tableDefinition) {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>RowJson.RowJsonDeserializer deserializer = RowJson.RowJsonDeserializer.forSchema(getSchemaIOProvider().configurationSchema()).withNullBehavior(RowJson.RowJsonDeserializer.NullBehavior.ACCEPT_MISSING_OR_NULL);<NEW_LINE>Row configurationRow = newObjectMapperWith(deserializer).readValue(tableProperties.toString(), Row.class);<NEW_LINE>SchemaIO schemaIO = getSchemaIOProvider().from(tableDefinition.getLocation(), configurationRow, tableDefinition.getSchema());<NEW_LINE>return new SchemaIOTableWrapper(schemaIO);<NEW_LINE>} catch (InvalidConfigurationException | InvalidSchemaException e) {<NEW_LINE>throw new InvalidTableException(e.getMessage());<NEW_LINE>} catch (JsonProcessingException e) {<NEW_LINE>throw new AssertionError("Failed to re-parse TBLPROPERTIES JSON " + tableProperties.toString());<NEW_LINE>}<NEW_LINE>} | JSONObject tableProperties = tableDefinition.getProperties(); |
729,919 | private void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {<NEW_LINE>// check for switch or exit request<NEW_LINE>if (requiresSwitchUser(request)) {<NEW_LINE>// if set, attempt switch and store original<NEW_LINE>try {<NEW_LINE>Authentication targetUser = attemptSwitchUser(request);<NEW_LINE>// update the current context to the new target user<NEW_LINE>SecurityContext context = SecurityContextHolder.createEmptyContext();<NEW_LINE>context.setAuthentication(targetUser);<NEW_LINE>SecurityContextHolder.setContext(context);<NEW_LINE>this.logger.debug(LogMessage<MASK><NEW_LINE>// redirect to target url<NEW_LINE>this.successHandler.onAuthenticationSuccess(request, response, targetUser);<NEW_LINE>} catch (AuthenticationException ex) {<NEW_LINE>this.logger.debug("Failed to switch user", ex);<NEW_LINE>this.failureHandler.onAuthenticationFailure(request, response, ex);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (requiresExitUser(request)) {<NEW_LINE>// get the original authentication object (if exists)<NEW_LINE>Authentication originalUser = attemptExitUser(request);<NEW_LINE>// update the current context back to the original user<NEW_LINE>SecurityContext context = SecurityContextHolder.createEmptyContext();<NEW_LINE>context.setAuthentication(originalUser);<NEW_LINE>SecurityContextHolder.setContext(context);<NEW_LINE>this.logger.debug(LogMessage.format("Set SecurityContextHolder to %s", originalUser));<NEW_LINE>// redirect to target url<NEW_LINE>this.successHandler.onAuthenticationSuccess(request, response, originalUser);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>this.logger.trace(LogMessage.format("Did not attempt to switch user since request did not match [%s] or [%s]", this.switchUserMatcher, this.exitUserMatcher));<NEW_LINE>chain.doFilter(request, response);<NEW_LINE>} | .format("Set SecurityContextHolder to %s", targetUser)); |
243,372 | protected void onCreate(Bundle savedInstanceState) {<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>setContentView(R.layout.activity_viewpagertab);<NEW_LINE>setSupportActionBar((Toolbar) findViewById<MASK><NEW_LINE>mHeaderView = findViewById(R.id.header);<NEW_LINE>ViewCompat.setElevation(mHeaderView, getResources().getDimension(R.dimen.toolbar_elevation));<NEW_LINE>mToolbarView = findViewById(R.id.toolbar);<NEW_LINE>mPagerAdapter = new NavigationAdapter(getSupportFragmentManager());<NEW_LINE>mPager = (ViewPager) findViewById(R.id.pager);<NEW_LINE>mPager.setAdapter(mPagerAdapter);<NEW_LINE>SlidingTabLayout slidingTabLayout = (SlidingTabLayout) findViewById(R.id.sliding_tabs);<NEW_LINE>slidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1);<NEW_LINE>slidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.accent));<NEW_LINE>slidingTabLayout.setDistributeEvenly(true);<NEW_LINE>slidingTabLayout.setViewPager(mPager);<NEW_LINE>// When the page is selected, other fragments' scrollY should be adjusted<NEW_LINE>// according to the toolbar status(shown/hidden)<NEW_LINE>slidingTabLayout.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onPageScrolled(int i, float v, int i2) {<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onPageSelected(int i) {<NEW_LINE>propagateToolbarState(toolbarIsShown());<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onPageScrollStateChanged(int i) {<NEW_LINE>}<NEW_LINE>});<NEW_LINE>propagateToolbarState(toolbarIsShown());<NEW_LINE>} | (R.id.toolbar)); |
1,459,379 | static PCollection<DomainNameInfo> readFromCloudSql(Pipeline pipeline) {<NEW_LINE>Read<Object[], KV<String, String>> read = RegistryJpaIO.read("select d.repoId, r.emailAddress from Domain d join Registrar r on" + " d.currentSponsorClientId = r.clientIdentifier where r.type = 'REAL' and" + <MASK><NEW_LINE>return pipeline.apply("Read active domains from Cloud SQL", read).apply("Build DomainNameInfo", ParDo.of(new DoFn<KV<String, String>, DomainNameInfo>() {<NEW_LINE><NEW_LINE>@ProcessElement<NEW_LINE>public void processElement(@Element KV<String, String> input, OutputReceiver<DomainNameInfo> output) {<NEW_LINE>DomainBase domainBase = jpaTm().transact(() -> jpaTm().loadByKey(VKey.createSql(DomainBase.class, input.getKey())));<NEW_LINE>String emailAddress = input.getValue();<NEW_LINE>if (emailAddress == null) {<NEW_LINE>emailAddress = "";<NEW_LINE>}<NEW_LINE>DomainNameInfo domainNameInfo = DomainNameInfo.create(domainBase.getDomainName(), domainBase.getRepoId(), domainBase.getCurrentSponsorRegistrarId(), emailAddress);<NEW_LINE>output.output(domainNameInfo);<NEW_LINE>}<NEW_LINE>}));<NEW_LINE>} | " d.deletionTime > now()", false, Spec11Pipeline::parseRow); |
793,183 | private void paintAxisXBottom(final Graphics g2d) {<NEW_LINE>final Chart2D chart = this.getAccessor().getChart();<NEW_LINE>int tmp = 0;<NEW_LINE>final FontMetrics fontdim = g2d.getFontMetrics();<NEW_LINE>final int fontheight = fontdim.getHeight();<NEW_LINE>final int xAxisStart = chart.getXChartStart();<NEW_LINE>final int xAxisEnd = chart.getXChartEnd();<NEW_LINE>final int yAxisEnd = chart.getYChartEnd();<NEW_LINE>final int rangexPx = xAxisEnd - xAxisStart;<NEW_LINE>final int yAxisLine = this.getPixelYTop();<NEW_LINE>g2d.drawLine(xAxisStart, yAxisLine, xAxisEnd, yAxisLine);<NEW_LINE>// drawing the x title :<NEW_LINE>this.paintTitle(g2d);<NEW_LINE>// drawing tick - scale, corresponding values, grid and conditional unit<NEW_LINE>// label:<NEW_LINE>if (this.isPaintScale() || this.isPaintGrid()) {<NEW_LINE>final IAxisTickPainter tickPainter = chart.getAxisTickPainter();<NEW_LINE>tmp = 0;<NEW_LINE>final List<LabeledValue> labels = this.m_axisScalePolicy.getScaleValues(g2d, this);<NEW_LINE>for (final LabeledValue label : labels) {<NEW_LINE>tmp = xAxisStart + (int) (label.getValue() * rangexPx);<NEW_LINE>// true -> is bottom axis:<NEW_LINE>if (this.isPaintScale()) {<NEW_LINE>tickPainter.paintXTick(tmp, yAxisLine, label.isMajorTick(), true, g2d);<NEW_LINE>tickPainter.paintXLabel(tmp, yAxisLine + fontheight, label.getLabel(), g2d);<NEW_LINE>}<NEW_LINE>if (this.isPaintGrid()) {<NEW_LINE>// do not paint over the axis<NEW_LINE>if (tmp != xAxisStart) {<NEW_LINE>g2d.<MASK><NEW_LINE>g2d.drawLine(tmp, yAxisLine - 1, tmp, yAxisEnd);<NEW_LINE>g2d.setColor(chart.getForeground());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// unit-labeling<NEW_LINE>g2d.drawString(this.getFormatter().getUnit().getUnitName(), xAxisEnd, yAxisLine + 4 + fontdim.getHeight() * 2);<NEW_LINE>} | setColor(chart.getGridColor()); |
631,359 | private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(String resourceGroupName, String circuitName, String peeringName, String connectionName, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (circuitName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter circuitName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (peeringName == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>if (connectionName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter connectionName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String apiVersion = "2018-11-01";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.delete(this.client.getEndpoint(), resourceGroupName, circuitName, peeringName, connectionName, apiVersion, this.client.getSubscriptionId(), context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter peeringName is required and cannot be null.")); |
1,313,427 | private static void buildCountryCodesList() {<NEW_LINE>if (null == mCountryCodes) {<NEW_LINE>Locale applicationLocale = VectorLocale.INSTANCE.getApplicationLocale();<NEW_LINE>// retrieve the ISO country code<NEW_LINE>String[<MASK><NEW_LINE>List<Pair<String, String>> countryCodes = new ArrayList<>();<NEW_LINE>// retrieve the human display name<NEW_LINE>for (String countryCode : isoCountryCodes) {<NEW_LINE>Locale locale = new Locale("", countryCode);<NEW_LINE>countryCodes.add(new Pair<>(countryCode, locale.getDisplayCountry(applicationLocale)));<NEW_LINE>}<NEW_LINE>// sort by human display names<NEW_LINE>Collections.sort(countryCodes, new Comparator<Pair<String, String>>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public int compare(Pair<String, String> lhs, Pair<String, String> rhs) {<NEW_LINE>return lhs.second.compareTo(rhs.second);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>mCountryNameByCC = new HashMap<>(isoCountryCodes.length);<NEW_LINE>mCountryCodes = new String[isoCountryCodes.length];<NEW_LINE>mCountryNames = new String[isoCountryCodes.length];<NEW_LINE>for (int index = 0; index < isoCountryCodes.length; index++) {<NEW_LINE>Pair<String, String> pair = countryCodes.get(index);<NEW_LINE>mCountryCodes[index] = pair.first;<NEW_LINE>mCountryNames[index] = pair.second;<NEW_LINE>mCountryNameByCC.put(pair.first, pair.second);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ] isoCountryCodes = Locale.getISOCountries(); |
49,022 | final ListDataSourcesResult executeListDataSources(ListDataSourcesRequest listDataSourcesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listDataSourcesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListDataSourcesRequest> request = null;<NEW_LINE>Response<ListDataSourcesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListDataSourcesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listDataSourcesRequest));<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, "AppSync");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListDataSources");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListDataSourcesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListDataSourcesResultJsonUnmarshaller());<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.endEvent(Field.RequestMarshallTime); |
1,209,954 | ProcessResult process(String className, ClassNode classNode) {<NEW_LINE>if (!MixinEnvironment.getCompatibilityLevel().supports(LanguageFeatures.METHODS_IN_INTERFACES) || !this.accessorMixins.containsKey(className)) {<NEW_LINE>return ProcessResult.NONE;<NEW_LINE>}<NEW_LINE>MixinInfo mixin = this.accessorMixins.get(className);<NEW_LINE>boolean transformed = false;<NEW_LINE>MixinClassNode mixinClassNode = mixin.getClassNode(0);<NEW_LINE>ClassInfo targetClass = mixin.getTargets().get(0);<NEW_LINE>if (!Bytecode.hasFlag(mixinClassNode, Opcodes.ACC_PUBLIC)) {<NEW_LINE>Bytecode.setVisibility(mixinClassNode, Visibility.PUBLIC);<NEW_LINE>transformed = true;<NEW_LINE>}<NEW_LINE>for (MixinMethodNode methodNode : mixinClassNode.mixinMethods) {<NEW_LINE>if (!Bytecode.hasFlag(methodNode, Opcodes.ACC_STATIC)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>AnnotationNode accessor = methodNode.getVisibleAnnotation(Accessor.class);<NEW_LINE>AnnotationNode invoker = <MASK><NEW_LINE>if (accessor != null || invoker != null) {<NEW_LINE>Method method = this.getAccessorMethod(mixin, methodNode, targetClass);<NEW_LINE>MixinCoprocessorAccessor.createProxy(methodNode, targetClass, method);<NEW_LINE>Annotations.setVisible(methodNode, MixinProxy.class, "sessionId", this.sessionId);<NEW_LINE>classNode.methods.add(methodNode);<NEW_LINE>transformed = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!transformed) {<NEW_LINE>return ProcessResult.NONE;<NEW_LINE>}<NEW_LINE>Bytecode.replace(mixinClassNode, classNode);<NEW_LINE>return ProcessResult.PASSTHROUGH_TRANSFORMED;<NEW_LINE>} | methodNode.getVisibleAnnotation(Invoker.class); |
244,478 | private STNode parseTemplateContentAsXML() {<NEW_LINE>// Separate out the interpolated expressions to a queue. Then merge the string content using '${}'.<NEW_LINE>// These '&{}' are used to represent the interpolated locations. XML parser will replace '&{}' with<NEW_LINE>// the actual interpolated expression, while building the XML tree.<NEW_LINE>ArrayDeque<STNode> expressions = new ArrayDeque<>();<NEW_LINE>StringBuilder xmlStringBuilder = new StringBuilder();<NEW_LINE>STToken nextToken = peek();<NEW_LINE>while (!isEndOfBacktickContent(nextToken.kind)) {<NEW_LINE>STNode contentItem = parseTemplateItem();<NEW_LINE>if (contentItem.kind == SyntaxKind.TEMPLATE_STRING) {<NEW_LINE>xmlStringBuilder.append(((STToken) contentItem).text());<NEW_LINE>} else {<NEW_LINE>xmlStringBuilder.append("${}");<NEW_LINE>expressions.add(contentItem);<NEW_LINE>}<NEW_LINE>nextToken = peek();<NEW_LINE>}<NEW_LINE>CharReader charReader = CharReader.<MASK><NEW_LINE>AbstractTokenReader tokenReader = new TokenReader(new XMLLexer(charReader));<NEW_LINE>XMLParser xmlParser = new XMLParser(tokenReader, expressions);<NEW_LINE>return xmlParser.parse();<NEW_LINE>} | from(xmlStringBuilder.toString()); |
1,383,287 | final DescribeAssetResult executeDescribeAsset(DescribeAssetRequest describeAssetRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeAssetRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeAssetRequest> request = null;<NEW_LINE>Response<DescribeAssetResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeAssetRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeAssetRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "IoTSiteWise");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeAsset");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>URI endpointTraitHost = null;<NEW_LINE>if (!clientConfiguration.isDisableHostPrefixInjection()) {<NEW_LINE>String hostPrefix = "api.";<NEW_LINE>String resolvedHostPrefix = String.format("api.");<NEW_LINE>endpointTraitHost = UriResourcePathUtils.updateUriHost(endpoint, resolvedHostPrefix);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeAssetResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeAssetResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext, null, endpointTraitHost);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
1,800,632 | void removeListener(AllocationListener l) {<NEW_LINE>CompilerAsserts.neverPartOfCompilation();<NEW_LINE>boolean hasListeners = true;<NEW_LINE>synchronized (this) {<NEW_LINE>final int len = listeners.length;<NEW_LINE>if (len == 1) {<NEW_LINE>if (listeners[0] == l) {<NEW_LINE>listeners = null;<NEW_LINE>hasListeners = false;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>for (int i = 0; i < len; i++) {<NEW_LINE>if (listeners[i] == l) {<NEW_LINE>if (i == (len - 1)) {<NEW_LINE>listeners = Arrays.copyOf(listeners, i);<NEW_LINE>} else if (i == 0) {<NEW_LINE>listeners = Arrays.<MASK><NEW_LINE>} else {<NEW_LINE>AllocationListener[] newListeners = new AllocationListener[len - 1];<NEW_LINE>System.arraycopy(listeners, 0, newListeners, 0, i);<NEW_LINE>System.arraycopy(listeners, i + 1, newListeners, i, len - i - 1);<NEW_LINE>listeners = newListeners;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Assumption assumption = listenersNotChangedAssumption;<NEW_LINE>listenersNotChangedAssumption = Truffle.getRuntime().createAssumption();<NEW_LINE>assumption.invalidate();<NEW_LINE>}<NEW_LINE>if (!hasListeners) {<NEW_LINE>for (Consumer<Boolean> listener : activeListeners) {<NEW_LINE>listener.accept(false);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | copyOfRange(listeners, 1, len); |
1,526,750 | private File fetchFile(OrderType orderType, EbicsUser user, EbicsProduct product, Date start, Date end, String fileFormat) throws AxelorException {<NEW_LINE>EbicsSession session = new EbicsSession(user);<NEW_LINE>File file = null;<NEW_LINE>try {<NEW_LINE>boolean test = isTest(user);<NEW_LINE>if (test) {<NEW_LINE>session.addSessionParam("TEST", "true");<NEW_LINE>}<NEW_LINE>if (fileFormat != null) {<NEW_LINE>session.addSessionParam("FORMAT", fileFormat);<NEW_LINE>}<NEW_LINE>if (product == null) {<NEW_LINE>product = defaultProduct;<NEW_LINE>}<NEW_LINE>session.setProduct(product);<NEW_LINE><MASK><NEW_LINE>file = File.createTempFile(user.getName(), "." + orderType.getOrderType());<NEW_LINE>transferManager.fetchFile(orderType, start, end, new FileOutputStream(file));<NEW_LINE>addResponseFile(user, file);<NEW_LINE>userService.getNextOrderId(user);<NEW_LINE>} catch (AxelorException e) {<NEW_LINE>TraceBackService.trace(e);<NEW_LINE>throw e;<NEW_LINE>} catch (IOException e) {<NEW_LINE>TraceBackService.trace(e);<NEW_LINE>throw new AxelorException(e, TraceBackRepository.CATEGORY_CONFIGURATION_ERROR);<NEW_LINE>}<NEW_LINE>return file;<NEW_LINE>} | FileTransfer transferManager = new FileTransfer(session); |
1,542,590 | public void visit(CurrencyConverter converter, CalculationLineItem.ValuationAtStart item) {<NEW_LINE>Money valuation = item.getValue();<NEW_LINE>SecurityPosition position = item.getSecurityPosition().orElseThrow(IllegalArgumentException::new);<NEW_LINE>long amount = converter.convert(item.getDateTime(<MASK><NEW_LINE>TrailRecord trail = TrailRecord.ofPosition(item.getDateTime().toLocalDate(), (Portfolio) item.getOwner(), position);<NEW_LINE>if (!getTermCurrency().equals(valuation.getCurrencyCode()))<NEW_LINE>trail = trail.convert(Money.of(getTermCurrency(), amount), converter.getRate(item.getDateTime(), valuation.getCurrencyCode()));<NEW_LINE>fifo.add(new LineItem(item.getOwner(), position.getShares(), amount, amount, trail));<NEW_LINE>movingRelativeCost += amount;<NEW_LINE>movingRelativeNetCost += amount;<NEW_LINE>heldShares += position.getShares();<NEW_LINE>} | ), valuation).getAmount(); |
157,826 | public void execute(DiagramHandler handler) {<NEW_LINE>super.execute(handler);<NEW_LINE>GridElement gridElement = Main.getInstance().getEditedGridElement();<NEW_LINE>// select grid element if nothing is selected<NEW_LINE>if (gridElement == null) {<NEW_LINE>SelectorOld selector = CurrentGui.getInstance().getGui().getCurrentCustomHandler().getPreviewHandler().getDrawPanel().getSelector();<NEW_LINE>selector.selectAll();<NEW_LINE>if (selector.getSelectedElements().size() >= 1) {<NEW_LINE>gridElement = selector.getSelectedElements().get(0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (gridElement != null && HandlerElementMap.getHandlerForElement(gridElement) instanceof CustomPreviewHandler) {<NEW_LINE>gridElement.setPanelAttributes(_newState);<NEW_LINE>OwnSyntaxPane pane = CurrentGui.getInstance().getGui().getPropertyPane();<NEW_LINE>pane.switchToElement(gridElement);<NEW_LINE>if (pane.getText().length() >= _newCaret) {<NEW_LINE>pane.<MASK><NEW_LINE>}<NEW_LINE>gridElement.repaint();<NEW_LINE>}<NEW_LINE>} | getTextComponent().setCaretPosition(_newCaret); |
1,587,313 | public static TlsConfig extractTlsConfig(PinotConfiguration pinotConfig, String namespace, TlsConfig defaultConfig) {<NEW_LINE>TlsConfig tlsConfig = new TlsConfig(defaultConfig);<NEW_LINE>tlsConfig.setClientAuthEnabled(pinotConfig.getProperty(key(namespace, CLIENT_AUTH_ENABLED)<MASK><NEW_LINE>tlsConfig.setKeyStoreType(pinotConfig.getProperty(key(namespace, KEYSTORE_TYPE), defaultConfig.getKeyStoreType()));<NEW_LINE>tlsConfig.setKeyStorePath(pinotConfig.getProperty(key(namespace, KEYSTORE_PATH), defaultConfig.getKeyStorePath()));<NEW_LINE>tlsConfig.setKeyStorePassword(pinotConfig.getProperty(key(namespace, KEYSTORE_PASSWORD), defaultConfig.getKeyStorePassword()));<NEW_LINE>tlsConfig.setTrustStoreType(pinotConfig.getProperty(key(namespace, TRUSTSTORE_TYPE), defaultConfig.getTrustStoreType()));<NEW_LINE>tlsConfig.setTrustStorePath(pinotConfig.getProperty(key(namespace, TRUSTSTORE_PATH), defaultConfig.getTrustStorePath()));<NEW_LINE>tlsConfig.setTrustStorePassword(pinotConfig.getProperty(key(namespace, TRUSTSTORE_PASSWORD), defaultConfig.getTrustStorePassword()));<NEW_LINE>tlsConfig.setSslProvider(pinotConfig.getProperty(key(namespace, SSL_PROVIDER), defaultConfig.getSslProvider()));<NEW_LINE>return tlsConfig;<NEW_LINE>} | , defaultConfig.isClientAuthEnabled())); |
1,413,298 | public void fillProcessQueueInfo(final ProcessQueueInfo info) {<NEW_LINE>try {<NEW_LINE>this.treeMapLock.readLock().lockInterruptibly();<NEW_LINE>if (!this.msgTreeMap.isEmpty()) {<NEW_LINE>info.setCachedMsgMinOffset(this.msgTreeMap.firstKey());<NEW_LINE>info.setCachedMsgMaxOffset(<MASK><NEW_LINE>info.setCachedMsgCount(this.msgTreeMap.size());<NEW_LINE>info.setCachedMsgSizeInMiB((int) (this.msgSize.get() / (1024 * 1024)));<NEW_LINE>}<NEW_LINE>if (!this.consumingMsgOrderlyTreeMap.isEmpty()) {<NEW_LINE>info.setTransactionMsgMinOffset(this.consumingMsgOrderlyTreeMap.firstKey());<NEW_LINE>info.setTransactionMsgMaxOffset(this.consumingMsgOrderlyTreeMap.lastKey());<NEW_LINE>info.setTransactionMsgCount(this.consumingMsgOrderlyTreeMap.size());<NEW_LINE>}<NEW_LINE>info.setLocked(this.locked);<NEW_LINE>info.setTryUnlockTimes(this.tryUnlockTimes.get());<NEW_LINE>info.setLastLockTimestamp(this.lastLockTimestamp);<NEW_LINE>info.setDroped(this.dropped);<NEW_LINE>info.setLastPullTimestamp(this.lastPullTimestamp);<NEW_LINE>info.setLastConsumeTimestamp(this.lastConsumeTimestamp);<NEW_LINE>} catch (Exception e) {<NEW_LINE>} finally {<NEW_LINE>this.treeMapLock.readLock().unlock();<NEW_LINE>}<NEW_LINE>} | this.msgTreeMap.lastKey()); |
680,692 | public void basicCancel(final String consumerTag) throws IOException {<NEW_LINE>final Consumer originalConsumer = _consumers.get(consumerTag);<NEW_LINE>if (originalConsumer == null) {<NEW_LINE><MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final Method m = new Basic.Cancel(consumerTag, false);<NEW_LINE>BlockingRpcContinuation<Consumer> k = new BlockingRpcContinuation<Consumer>(m) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Consumer transformReply(AMQCommand replyCommand) {<NEW_LINE>if (!(replyCommand.getMethod() instanceof Basic.CancelOk))<NEW_LINE>LOGGER.warn("Received reply {} was not of expected method Basic.CancelOk", replyCommand.getMethod());<NEW_LINE>// may already have been removed<NEW_LINE>_consumers.remove(consumerTag);<NEW_LINE>dispatcher.handleCancelOk(originalConsumer, consumerTag);<NEW_LINE>return originalConsumer;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>rpc(m, k);<NEW_LINE>try {<NEW_LINE>if (_rpcTimeout == NO_RPC_TIMEOUT) {<NEW_LINE>// discard result<NEW_LINE>k.getReply();<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>k.getReply(_rpcTimeout);<NEW_LINE>} catch (TimeoutException e) {<NEW_LINE>throw wrapTimeoutException(m, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (ShutdownSignalException ex) {<NEW_LINE>throw wrap(ex);<NEW_LINE>}<NEW_LINE>metricsCollector.basicCancel(this, consumerTag);<NEW_LINE>} | LOGGER.warn("Tried to cancel consumer with unknown tag {}", consumerTag); |
348,358 | public void multiSet(final List<HippyStorageKeyValue> keyValues, final Callback<Void> callback) {<NEW_LINE>execute(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>try {<NEW_LINE>SQLiteDatabase database = mSQLiteHelper.getDatabase();<NEW_LINE>if (database == null) {<NEW_LINE>callback.onError("Database Error");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String sql = "INSERT OR REPLACE INTO " <MASK><NEW_LINE>SQLiteStatement statement = database.compileStatement(sql);<NEW_LINE>try {<NEW_LINE>database.beginTransaction();<NEW_LINE>for (HippyStorageKeyValue keyValue : keyValues) {<NEW_LINE>statement.clearBindings();<NEW_LINE>statement.bindString(1, keyValue.key);<NEW_LINE>statement.bindString(2, keyValue.value);<NEW_LINE>statement.execute();<NEW_LINE>}<NEW_LINE>database.setTransactionSuccessful();<NEW_LINE>callback.onSuccess(null);<NEW_LINE>} catch (Throwable e) {<NEW_LINE>callback.onError(e.getMessage());<NEW_LINE>} finally {<NEW_LINE>database.endTransaction();<NEW_LINE>}<NEW_LINE>} catch (Throwable e) {<NEW_LINE>callback.onError(e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | + mSQLiteHelper.getTableName() + " VALUES (?, ?);"; |
54,455 | private void printSession(RestSession session) {<NEW_LINE>ln(" session id: %s", session.getId());<NEW_LINE>ln(" attempt id: %s", session.getLastAttempt().transform(a -> String.valueOf(a.getId())).or(""));<NEW_LINE>ln(" uuid: %s", session.getSessionUuid());<NEW_LINE>ln(" project: %s", session.getProject().getName());<NEW_LINE>ln(" workflow: %s", session.getWorkflow().getName());<NEW_LINE>ln(" session time: %s", TimeUtil.formatTime(session.getSessionTime()));<NEW_LINE>ln(" retry attempt name: %s", session.getLastAttempt().transform(a -> a.getRetryAttemptName().or("")).or(""));<NEW_LINE>ln(" params: %s", session.getLastAttempt().transform(a -> a.getParams().toString(<MASK><NEW_LINE>ln(" created at: %s", session.getLastAttempt().transform(a -> TimeUtil.formatTime(a.getCreatedAt())).or(""));<NEW_LINE>ln(" kill requested: %s", session.getLastAttempt().transform(a -> a.getCancelRequested()).or(false));<NEW_LINE>ln(" status: %s", status(session));<NEW_LINE>ln("");<NEW_LINE>} | )).or("")); |
1,353,322 | public void initDriverSettings(JDBCSession session, JDBCDataSource dataSource, JDBCDatabaseMetaData metaData) {<NEW_LINE>super.initDriverSettings(session, dataSource, metaData);<NEW_LINE>DBPDriver driver = dataSource<MASK><NEW_LINE>String delimitersString = CommonUtils.toString(driver.getDriverParameter(GenericConstants.PARAM_SCRIPT_DELIMITER));<NEW_LINE>if (delimitersString.contains(",")) {<NEW_LINE>scriptDelimiters = delimitersString.split(",");<NEW_LINE>} else if (!CommonUtils.isEmpty(delimitersString)) {<NEW_LINE>scriptDelimiters = new String[] { delimitersString };<NEW_LINE>}<NEW_LINE>String escapeStr = CommonUtils.toString(driver.getDriverParameter(GenericConstants.PARAM_STRING_ESCAPE_CHAR));<NEW_LINE>if (!CommonUtils.isEmpty(escapeStr)) {<NEW_LINE>this.stringEscapeCharacter = escapeStr.charAt(0);<NEW_LINE>}<NEW_LINE>this.scriptDelimiterRedefiner = CommonUtils.toString(driver.getDriverParameter(GenericConstants.PARAM_SCRIPT_DELIMITER_REDEFINER));<NEW_LINE>this.hasDelimiterAfterQuery = CommonUtils.toBoolean(driver.getDriverParameter(GenericConstants.PARAM_SQL_DELIMITER_AFTER_QUERY));<NEW_LINE>this.hasDelimiterAfterBlock = CommonUtils.toBoolean(driver.getDriverParameter(GenericConstants.PARAM_SQL_DELIMITER_AFTER_BLOCK));<NEW_LINE>this.legacySQLDialect = CommonUtils.toBoolean(driver.getDriverParameter(GenericConstants.PARAM_LEGACY_DIALECT));<NEW_LINE>this.supportsUpsert = ((GenericDataSource) dataSource).getMetaModel().supportsUpsertStatement();<NEW_LINE>if (this.supportsUpsert) {<NEW_LINE>addSQLKeyword("UPSERT");<NEW_LINE>}<NEW_LINE>this.useSearchStringEscape = CommonUtils.getBoolean(driver.getDriverParameter(GenericConstants.PARAM_USE_SEARCH_STRING_ESCAPE), false);<NEW_LINE>this.quoteReservedWords = CommonUtils.getBoolean(driver.getDriverParameter(GenericConstants.PARAM_QUOTE_RESERVED_WORDS), true);<NEW_LINE>this.testSQL = CommonUtils.toString(driver.getDriverParameter(GenericConstants.PARAM_QUERY_PING));<NEW_LINE>if (CommonUtils.isEmpty(this.testSQL)) {<NEW_LINE>this.testSQL = CommonUtils.toString(driver.getDriverParameter(GenericConstants.PARAM_QUERY_GET_ACTIVE_DB));<NEW_LINE>}<NEW_LINE>this.dualTable = CommonUtils.toString(driver.getDriverParameter(GenericConstants.PARAM_DUAL_TABLE));<NEW_LINE>if (this.dualTable.isEmpty()) {<NEW_LINE>this.dualTable = null;<NEW_LINE>}<NEW_LINE>this.omitCatalogName = CommonUtils.toBoolean(driver.getDriverParameter(GenericConstants.PARAM_OMIT_CATALOG_NAME));<NEW_LINE>} | .getContainer().getDriver(); |
1,352,841 | public void generateStringPoolHeaders(CodeWriter writer, IncludeManager includes) {<NEW_LINE>includes.includeClass("java.lang.String");<NEW_LINE>String stringClassName = context.getNames().forClassInstance(ValueType.object("java.lang.String"));<NEW_LINE>writer.print("int32_t stringHeader = TEAVM_PACK_CLASS(&" + stringClassName + ") | ");<NEW_LINE>CodeGeneratorUtil.<MASK><NEW_LINE>writer.println(";");<NEW_LINE>int size = context.getStringPool().getStrings().size();<NEW_LINE>writer.println("for (int i = 0; i < " + size + "; ++i) {").indent();<NEW_LINE>writer.println("TeaVM_String *s = " + poolVariable + "[i];");<NEW_LINE>writer.println("if (s != NULL) {").indent();<NEW_LINE>writer.println("s = teavm_registerString(s);");<NEW_LINE>writer.println("((TeaVM_Object*) s)->header = stringHeader;");<NEW_LINE>writer.println(poolVariable + "[i] = s;");<NEW_LINE>writer.outdent().println("}");<NEW_LINE>writer.outdent().println("}");<NEW_LINE>} | writeIntValue(writer, RuntimeObject.GC_MARKED); |
663,359 | final ListCustomDataIdentifiersResult executeListCustomDataIdentifiers(ListCustomDataIdentifiersRequest listCustomDataIdentifiersRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listCustomDataIdentifiersRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListCustomDataIdentifiersRequest> request = null;<NEW_LINE>Response<ListCustomDataIdentifiersResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListCustomDataIdentifiersRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listCustomDataIdentifiersRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Macie2");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListCustomDataIdentifiersResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListCustomDataIdentifiersResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListCustomDataIdentifiers"); |
1,407,547 | final UpdateEndpointGroupResult executeUpdateEndpointGroup(UpdateEndpointGroupRequest updateEndpointGroupRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateEndpointGroupRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateEndpointGroupRequest> request = null;<NEW_LINE>Response<UpdateEndpointGroupResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateEndpointGroupRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateEndpointGroupRequest));<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, "Global Accelerator");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateEndpointGroup");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdateEndpointGroupResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateEndpointGroupResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
1,351,657 | private void readPatchContent(SinglePatch patch) throws IOException, PatchException {<NEW_LINE>String base = readPatchLine();<NEW_LINE>if (base == null || !base.startsWith("--- "))<NEW_LINE>throw new PatchException("Invalid unified diff header: " + base);<NEW_LINE>String modified = readPatchLine();<NEW_LINE>if (modified == null || !modified.startsWith("+++ "))<NEW_LINE>throw new PatchException("Invalid unified diff header: " + modified);<NEW_LINE>if (patch.targetPath == null) {<NEW_LINE>computeTargetPath(base, modified, patch);<NEW_LINE>}<NEW_LINE>List<Hunk> hunks = new ArrayList<Hunk>();<NEW_LINE>Hunk hunk = null;<NEW_LINE>for (; ; ) {<NEW_LINE>String line = readPatchLine();<NEW_LINE>if (line == null || line.length() == 0 || line.startsWith("Index:")) {<NEW_LINE>unreadPatchLine();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>char <MASK><NEW_LINE>if (c == '@') {<NEW_LINE>hunk = new Hunk();<NEW_LINE>parseRange(hunk, line);<NEW_LINE>hunks.add(hunk);<NEW_LINE>} else if (c == ' ' || c == '+' || c == '-') {<NEW_LINE>hunk.lines.add(line);<NEW_LINE>} else if (line.equals(Hunk.ENDING_NEWLINE)) {<NEW_LINE>patch.noEndingNewline = true;<NEW_LINE>} else {<NEW_LINE>// first seen in mercurial diffs: be optimistic, this is probably the end of this patch<NEW_LINE>unreadPatchLine();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>patch.hunks = (Hunk[]) hunks.toArray(new Hunk[hunks.size()]);<NEW_LINE>} | c = line.charAt(0); |
142,755 | public static String doSub(String value, Map<String, String> varMap) {<NEW_LINE>try {<NEW_LINE>Matcher matcher = pattern.matcher(value);<NEW_LINE>boolean result = matcher.find();<NEW_LINE>if (result) {<NEW_LINE>StringBuffer sb = new StringBuffer(value.length() * 2);<NEW_LINE>do {<NEW_LINE>String key = matcher.group(1);<NEW_LINE>String replacement = varMap.get(key);<NEW_LINE>if (replacement == null) {<NEW_LINE><MASK><NEW_LINE>if (replacement != null) {<NEW_LINE>replacement = escapePath(replacement);<NEW_LINE>} else {<NEW_LINE>// NOI18N<NEW_LINE>replacement = "\\$\\{" + key + "\\}";<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>replacement = escapePath(replacement);<NEW_LINE>}<NEW_LINE>matcher.appendReplacement(sb, replacement);<NEW_LINE>result = matcher.find();<NEW_LINE>} while (result);<NEW_LINE>matcher.appendTail(sb);<NEW_LINE>value = sb.toString();<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>// NOI18N<NEW_LINE>Logger.getLogger("payara").log(Level.INFO, ex.getLocalizedMessage(), ex);<NEW_LINE>}<NEW_LINE>return value;<NEW_LINE>} | replacement = System.getProperty(key); |
370,147 | boolean sendSignal(final long controlSessionId, final long correlationId, final long recordingId, final long subscriptionId, final long position, final RecordingSignal recordingSignal, final Publication controlPublication) {<NEW_LINE>final int messageLength = MESSAGE_HEADER_LENGTH + RecordingSignalEventEncoder.BLOCK_LENGTH;<NEW_LINE>int attempts = SEND_ATTEMPTS;<NEW_LINE>do {<NEW_LINE>final long result = controlPublication.tryClaim(messageLength, bufferClaim);<NEW_LINE>if (result > 0) {<NEW_LINE>final <MASK><NEW_LINE>final int bufferOffset = bufferClaim.offset();<NEW_LINE>recordingSignalEventEncoder.wrapAndApplyHeader(buffer, bufferOffset, messageHeaderEncoder).controlSessionId(controlSessionId).correlationId(correlationId).recordingId(recordingId).subscriptionId(subscriptionId).position(position).signal(recordingSignal);<NEW_LINE>bufferClaim.commit();<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>} while (--attempts > 0);<NEW_LINE>return false;<NEW_LINE>} | MutableDirectBuffer buffer = bufferClaim.buffer(); |
322,241 | private static Map<String, AnnotationValue<?, ?>> asValue(Annotation annotation) {<NEW_LINE>Map<String, AnnotationValue<?, ?>> annotationValues = new HashMap<String, AnnotationValue<?, ?>>();<NEW_LINE>for (Method property : annotation.annotationType().getDeclaredMethods()) {<NEW_LINE>try {<NEW_LINE>annotationValues.put(property.getName(), asValue(property.invoke(annotation, NO_ARGUMENT), property.getReturnType()));<NEW_LINE>} catch (InvocationTargetException exception) {<NEW_LINE>Throwable cause = exception.getTargetException();<NEW_LINE>if (cause instanceof TypeNotPresentException) {<NEW_LINE>annotationValues.put(property.getName(), new AnnotationValue.ForMissingType<Void, Void>(((TypeNotPresentException) cause).typeName()));<NEW_LINE>} else if (cause instanceof EnumConstantNotPresentException) {<NEW_LINE>annotationValues.put(property.getName(), new AnnotationValue.ForEnumerationDescription.WithUnknownConstant(new TypeDescription.ForLoadedType(((EnumConstantNotPresentException) cause).enumType()), ((EnumConstantNotPresentException) <MASK><NEW_LINE>} else if (cause instanceof AnnotationTypeMismatchException) {<NEW_LINE>annotationValues.put(property.getName(), new AnnotationValue.ForMismatchedType<Void, Void>(new MethodDescription.ForLoadedMethod(((AnnotationTypeMismatchException) cause).element()), ((AnnotationTypeMismatchException) cause).foundType()));<NEW_LINE>} else if (!(cause instanceof IncompleteAnnotationException)) {<NEW_LINE>throw new IllegalStateException("Cannot read " + property, cause);<NEW_LINE>}<NEW_LINE>} catch (IllegalAccessException exception) {<NEW_LINE>throw new IllegalStateException("Cannot access " + property, exception);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return annotationValues;<NEW_LINE>} | cause).constantName())); |
23,662 | public static long parseDuration(String str) throws IllegalArgumentException {<NEW_LINE>if (str == null)<NEW_LINE>return 0;<NEW_LINE>// Check for ISO_8601 format<NEW_LINE>if (str.startsWith("P")) {<NEW_LINE>// A common mistake is when the minutes format is intended but the month format is specified<NEW_LINE>// e.g. one month "P1M" is set, but one minute "PT1M" is meant.<NEW_LINE>try {<NEW_LINE>Duration dur = DatatypeFactory.newInstance().newDuration(str);<NEW_LINE>return dur.getTimeInMillis(STATIC_DATE) / 1000;<NEW_LINE>} catch (Exception ex) {<NEW_LINE>throw new IllegalArgumentException("Cannot parse duration tag value: " + str, ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>int index = str.indexOf(":");<NEW_LINE>if (index > 0) {<NEW_LINE>String hourStr = str.substring(0, index);<NEW_LINE>String minStr = <MASK><NEW_LINE>String secondsStr = "0";<NEW_LINE>index = minStr.indexOf(":");<NEW_LINE>if (index > 0) {<NEW_LINE>secondsStr = minStr.substring(index + 1, index + 3);<NEW_LINE>minStr = minStr.substring(0, index);<NEW_LINE>}<NEW_LINE>long seconds = Integer.parseInt(hourStr) * 60L * 60;<NEW_LINE>seconds += Integer.parseInt(minStr) * 60L;<NEW_LINE>seconds += Integer.parseInt(secondsStr);<NEW_LINE>return seconds;<NEW_LINE>} else {<NEW_LINE>// value contains minutes<NEW_LINE>return Integer.parseInt(str) * 60L;<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>throw new IllegalArgumentException("Cannot parse duration tag value: " + str, ex);<NEW_LINE>}<NEW_LINE>} | str.substring(index + 1); |
671,198 | public Description matchVariable(VariableTree tree, VisitorState state) {<NEW_LINE>if (shouldSkip(state))<NEW_LINE>return Description.NO_MATCH;<NEW_LINE>Symbol identifier = <MASK><NEW_LINE>// Check if this is the flag definition and remove it.<NEW_LINE>if (identifier != null && identifier.isEnum() && identifier.equals(ASTHelpers.getSymbol(tree))) {<NEW_LINE>xpSym = identifier;<NEW_LINE>return removeEnumValue(tree, state, state.getSourceForNode(tree), isOnlyEnumConstant(xpSym, state));<NEW_LINE>} else if (identifier == null && ASTHelpers.getSymbol(tree) != null && xpFlagName.equals(ASTHelpers.getSymbol(tree).getConstantValue())) {<NEW_LINE>return buildDescription(tree).addFix(SuggestedFix.delete(tree)).build();<NEW_LINE>}<NEW_LINE>Symbol sym = ASTHelpers.getSymbol(tree);<NEW_LINE>// Also checks if this is the flag definition. However, this is for the case where xpFlagName<NEW_LINE>// does not match the enum constant itself, but instead, a String value in the enum constructor<NEW_LINE>// (e.g. STALE_FLAG("stale.flag"), where xpFlagName is "stale.flag")<NEW_LINE>if (sym != null && sym.isEnum() && tree.getInitializer().getKind() == Tree.Kind.NEW_CLASS) {<NEW_LINE>// Enum constructor<NEW_LINE>NewClassTree nct = (NewClassTree) tree.getInitializer();<NEW_LINE>String enumClassName = sym.enclClass().getSimpleName().toString();<NEW_LINE>ImmutableCollection<PiranhaEnumRecord> enumRecords = this.config.getEnumRecordsForName(enumClassName);<NEW_LINE>boolean containsFlagName = enumConstructorArgsContainsFlagNameMatcher(enumRecords).matches(nct, state);<NEW_LINE>if (containsFlagName) {<NEW_LINE>return removeEnumValue(tree, state, state.getSourceForNode(tree), isOnlyEnumConstant(sym, state));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// We also match the enum constant previous to the one being removed in some cases,<NEW_LINE>// to fix delimiters.<NEW_LINE>if (sym != null && sym.isEnum()) {<NEW_LINE>EnumEnding enumEnding = getEndingOfLastEnumConstantIfRemoved(sym, state);<NEW_LINE>if (enumEnding == EnumEnding.IGNORE) {<NEW_LINE>return Description.NO_MATCH;<NEW_LINE>}<NEW_LINE>// The next enum constant in the list will be removed by Piranha<NEW_LINE>// Let's replace the current enum constant's ending with the previous one<NEW_LINE>return buildDescription(tree).addFix(SuggestedFix.replace(tree, state.getSourceForNode(tree) + enumEnding.getChar(), 0, 1)).build();<NEW_LINE>}<NEW_LINE>return Description.NO_MATCH;<NEW_LINE>} | FindIdentifiers.findIdent(xpFlagName, state); |
1,746,648 | private void doRequest(HttpServletRequest request, HttpServletResponse response, boolean head) throws IOException {<NEW_LINE>Resource resource;<NEW_LINE>try {<NEW_LINE>resource = <MASK><NEW_LINE>} catch (RedirectException ex) {<NEW_LINE>logger.log(FINE, "Redirecting client to: " + ex.location);<NEW_LINE>response.setHeader("Location", ex.location);<NEW_LINE>response.sendError(HttpServletResponse.SC_FOUND);<NEW_LINE>return;<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>logger.log(FINE, "Got an IllegalArgumentException from user code; interpreting it as 400 Bad Request.", e);<NEW_LINE>response.sendError(HttpServletResponse.SC_BAD_REQUEST);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (resource.file == null) {<NEW_LINE>handleFileNotFound(request, response);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (preconditionFailed(request, resource)) {<NEW_LINE>response.sendError(HttpServletResponse.SC_PRECONDITION_FAILED);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>setCacheHeaders(response, resource, getExpireTime(request, resource.file));<NEW_LINE>if (notModified(request, resource)) {<NEW_LINE>response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<Range> ranges = getRanges(request, resource);<NEW_LINE>if (ranges == null) {<NEW_LINE>response.setHeader("Content-Range", "bytes */" + resource.length);<NEW_LINE>response.sendError(HttpServletResponse.SC_REQUESTED_RANGE_NOT_SATISFIABLE);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!ranges.isEmpty()) {<NEW_LINE>response.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT);<NEW_LINE>} else {<NEW_LINE>// Full content.<NEW_LINE>ranges.add(new Range(0, resource.length - 1));<NEW_LINE>}<NEW_LINE>String contentType = setContentHeaders(request, response, resource, ranges);<NEW_LINE>if (head) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>writeContent(response, resource, ranges, contentType);<NEW_LINE>} | new Resource(getFile(request)); |
514,498 | public static Distribution of(List<String> unquineName) {<NEW_LINE>MetadataManager metadataManager = MetaClusterCurrent.wrapper(MetadataManager.class);<NEW_LINE>List<ShardingTable> shardingTables = new ArrayList<>();<NEW_LINE>List<GlobalTable> globalTables = new ArrayList<>();<NEW_LINE>List<NormalTable> normalTables = new ArrayList<>();<NEW_LINE>Distribution distribution = new Distribution(shardingTables, globalTables, normalTables);<NEW_LINE>unquineName.stream().map(i -> {<NEW_LINE>String[] split = i.split("\\.");<NEW_LINE>return SchemaInfo.of(split[0], split[1]);<NEW_LINE>}).map(n -> metadataManager.getTable(n.getTargetSchema(), n.getTargetTable())).forEach(t -> {<NEW_LINE>switch(t.getType()) {<NEW_LINE>case SHARDING:<NEW_LINE>shardingTables<MASK><NEW_LINE>break;<NEW_LINE>case GLOBAL:<NEW_LINE>globalTables.add((GlobalTable) t);<NEW_LINE>break;<NEW_LINE>case NORMAL:<NEW_LINE>normalTables.add((NormalTable) t);<NEW_LINE>break;<NEW_LINE>case CUSTOM:<NEW_LINE>throw new UnsupportedOperationException();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return distribution;<NEW_LINE>} | .add((ShardingTable) t); |
1,735,141 | public RFuture<Map<StreamMessageId, Map<K, V>>> readAsync(StreamReadArgs args) {<NEW_LINE>StreamReadParams rp = ((StreamReadSource) args).getParams();<NEW_LINE>List<Object> params = new ArrayList<Object>();<NEW_LINE>if (rp.getCount() > 0) {<NEW_LINE>params.add("COUNT");<NEW_LINE>params.add(rp.getCount());<NEW_LINE>}<NEW_LINE>if (rp.getTimeout() != null) {<NEW_LINE>params.add("BLOCK");<NEW_LINE>params.add(toSeconds(rp.getTimeout().getSeconds(), TimeUnit.SECONDS) * 1000);<NEW_LINE>}<NEW_LINE>params.add("STREAMS");<NEW_LINE>params.add(getRawName());<NEW_LINE>params.add(rp.getId1());<NEW_LINE>if (rp.getTimeout() != null) {<NEW_LINE>return commandExecutor.readAsync(getRawName(), codec, RedisCommands.<MASK><NEW_LINE>}<NEW_LINE>return commandExecutor.readAsync(getRawName(), codec, RedisCommands.XREAD_SINGLE, params.toArray());<NEW_LINE>} | XREAD_BLOCKING_SINGLE, params.toArray()); |
1,242,692 | public void apply(double[] x) {<NEW_LINE>int i;<NEW_LINE>double[] lpfOutTmp;<NEW_LINE>// lpfOutTmp = SignalProcUtils.filter(Hd.getDenumeratorCoefficients(), filterNumerator, x);<NEW_LINE>lpfOutTmp = Hd.apply(x);<NEW_LINE>lpfOutTmp = SignalProcUtils.decimate(lpfOutTmp, 2.0);<NEW_LINE>// lpfOutTmp = SignalProcUtils.filter(Hb.getDenumeratorCoefficients(), filterNumerator, lpfOutTmp);<NEW_LINE>lpfOutTmp = Hb.apply(lpfOutTmp);<NEW_LINE>// Interpolation of lowpass channel<NEW_LINE>lpfOutInterpolated = SignalProcUtils.interpolate(lpfOutTmp, 2.0);<NEW_LINE>// lpfOutInterpolated = SignalProcUtils.filter(Hi.getDenumeratorCoefficients(), filterNumerator, lpfOutInterpolated);<NEW_LINE>lpfOutInterpolated = Hi.apply(lpfOutInterpolated);<NEW_LINE>//<NEW_LINE>// Energy compensation<NEW_LINE>double enx = SignalProcUtils.energy(x);<NEW_LINE>double enxloi = SignalProcUtils.energy(lpfOutInterpolated);<NEW_LINE>double gxloi = Math.sqrt(enx / enxloi);<NEW_LINE>for (i = 0; i < lpfOutInterpolated.length; i++) lpfOutInterpolated[i] *= gxloi;<NEW_LINE>//<NEW_LINE>int delay = (int) Math.floor(<MASK><NEW_LINE>hpfOut = new double[x.length];<NEW_LINE>for (i = 0; i < x.length - delay; i++) hpfOut[i] = x[i] - lpfOutInterpolated[i + delay];<NEW_LINE>for (i = x.length - delay; i < x.length; i++) hpfOut[i] = 0.0;<NEW_LINE>delay = (int) Math.floor(0.5 * filterLengthMinusOne + 0.5);<NEW_LINE>lpfOut = new double[lpfOutTmp.length - delay];<NEW_LINE>for (i = delay; i < lpfOutTmp.length; i++) lpfOut[i - delay] = lpfOutTmp[i];<NEW_LINE>lpfOutEnergy = SignalProcUtils.energy(lpfOut);<NEW_LINE>} | 1.5 * filterLengthMinusOne + 0.5) - 1; |
1,087,969 | private void createServerHello(ClientHello clientHello, DTLSFlight flight) throws HandshakeException {<NEW_LINE>ProtocolVersion serverVersion = negotiateProtocolVersion(clientHello.getProtocolVersion());<NEW_LINE>// store client and server random<NEW_LINE>clientRandom = clientHello.getRandom();<NEW_LINE>DTLSSession session = getSession();<NEW_LINE>boolean useSessionId = this.useSessionId;<NEW_LINE>if (extendedMasterSecretMode.is(ExtendedMasterSecretMode.ENABLED) && !clientHello.hasExtendedMasterSecretExtension()) {<NEW_LINE>useSessionId = false;<NEW_LINE>}<NEW_LINE>SessionId sessionId = useSessionId ? new SessionId<MASK><NEW_LINE>session.setSessionIdentifier(sessionId);<NEW_LINE>session.setProtocolVersion(serverVersion);<NEW_LINE>session.setCompressionMethod(CompressionMethod.NULL);<NEW_LINE>ServerHello serverHello = new ServerHello(serverVersion, sessionId, session.getCipherSuite(), session.getCompressionMethod());<NEW_LINE>addHelloExtensions(clientHello, serverHello);<NEW_LINE>if (serverHello.getCipherSuite().isEccBased()) {<NEW_LINE>expectEcc();<NEW_LINE>}<NEW_LINE>wrapMessage(flight, serverHello);<NEW_LINE>serverRandom = serverHello.getRandom();<NEW_LINE>} | () : SessionId.emptySessionId(); |
638,699 | public static void main(String[] args) throws IOException {<NEW_LINE>// Parse the arguments<NEW_LINE>Properties props = StringUtils.argsToProperties(args);<NEW_LINE>ArgumentParser.fillOptions(new Class[] { ArgumentParser.class, SplitTrainingSet.class }, props);<NEW_LINE>if (SPLIT_NAMES.length != SPLIT_WEIGHTS.length) {<NEW_LINE>throw new IllegalArgumentException("Name and weight arrays must be of the same length");<NEW_LINE>}<NEW_LINE>double totalWeight = 0.0;<NEW_LINE>for (Double weight : SPLIT_WEIGHTS) {<NEW_LINE>totalWeight += weight;<NEW_LINE>if (weight < 0.0) {<NEW_LINE>throw new IllegalArgumentException("Split weights cannot be negative");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (totalWeight <= 0.0) {<NEW_LINE>throw new IllegalArgumentException("Split weights must total to a positive weight");<NEW_LINE>}<NEW_LINE>List<Double> splitWeights = new ArrayList<>();<NEW_LINE>for (Double weight : SPLIT_WEIGHTS) {<NEW_LINE>splitWeights.add(weight / totalWeight);<NEW_LINE>}<NEW_LINE>logger.info("Splitting into " + splitWeights.size() + " lists with weights " + splitWeights);<NEW_LINE>if (SEED == 0L) {<NEW_LINE>SEED = System.nanoTime();<NEW_LINE>logger.info("Random seed not set by options, using " + SEED);<NEW_LINE>}<NEW_LINE>Random random = new Random(SEED);<NEW_LINE>List<List<Tree>> splits = new ArrayList<>();<NEW_LINE>for (Double d : splitWeights) {<NEW_LINE>splits.add(new ArrayList<>());<NEW_LINE>}<NEW_LINE>Treebank treebank = new MemoryTreebank(PennTreeReader::new);<NEW_LINE>treebank.loadPath(INPUT);<NEW_LINE>logger.info("Splitting " + <MASK><NEW_LINE>for (Tree tree : treebank) {<NEW_LINE>int index = weightedIndex(splitWeights, random);<NEW_LINE>splits.get(index).add(tree);<NEW_LINE>}<NEW_LINE>for (int i = 0; i < splits.size(); ++i) {<NEW_LINE>String filename = OUTPUT + '.' + SPLIT_NAMES[i];<NEW_LINE>List<Tree> split = splits.get(i);<NEW_LINE>logger.info("Writing " + split.size() + " trees to " + filename);<NEW_LINE>FileWriter fout = new FileWriter(filename);<NEW_LINE>BufferedWriter bout = new BufferedWriter(fout);<NEW_LINE>for (Tree tree : split) {<NEW_LINE>bout.write(tree.toString());<NEW_LINE>bout.newLine();<NEW_LINE>}<NEW_LINE>bout.close();<NEW_LINE>fout.close();<NEW_LINE>}<NEW_LINE>} | treebank.size() + " trees"); |
1,766,951 | protected static String[] processLocalArgs(String[] cliArgs) throws IOException, ParseException {<NEW_LINE>CommandLineParser cliParser = new GnuParser();<NEW_LINE>Options cliOptions = constructCommandLineOptions();<NEW_LINE>CommandLine cmd = cliParser.<MASK><NEW_LINE>// Options here has to be up front<NEW_LINE>if (cmd.hasOption(RELAY_HOST_OPT_NAME)) {<NEW_LINE>_relayHost = cmd.getOptionValue(RELAY_HOST_OPT_NAME);<NEW_LINE>LOG.info("Relay Host = " + _relayHost);<NEW_LINE>}<NEW_LINE>if (cmd.hasOption(RELAY_PORT_OPT_NAME)) {<NEW_LINE>_relayPort = cmd.getOptionValue(RELAY_PORT_OPT_NAME);<NEW_LINE>LOG.info("Relay Port = " + _relayPort);<NEW_LINE>}<NEW_LINE>if (cmd.hasOption(EVENT_DUMP_FILE_OPT_NAME)) {<NEW_LINE>_eventDumpFile = cmd.getOptionValue(EVENT_DUMP_FILE_OPT_NAME);<NEW_LINE>LOG.info("Saving event dump to file: " + _eventDumpFile);<NEW_LINE>}<NEW_LINE>if (cmd.hasOption(VALUE_DUMP_FILE_OPT_NAME)) {<NEW_LINE>_valueDumpFile = cmd.getOptionValue(VALUE_DUMP_FILE_OPT_NAME);<NEW_LINE>LOG.info("Saving event value dump to file: " + _valueDumpFile);<NEW_LINE>}<NEW_LINE>if (cmd.hasOption(HTTP_PORT_OPT_NAME)) {<NEW_LINE>_httpPort = cmd.getOptionValue(HTTP_PORT_OPT_NAME);<NEW_LINE>LOG.info("Consumer http port = " + _httpPort);<NEW_LINE>}<NEW_LINE>if (cmd.hasOption(JMX_SERVICE_PORT_OPT_NAME)) {<NEW_LINE>_jmxServicePort = cmd.getOptionValue(JMX_SERVICE_PORT_OPT_NAME);<NEW_LINE>LOG.info("Consumer JMX Service port = " + _jmxServicePort);<NEW_LINE>}<NEW_LINE>if (cmd.hasOption(CHECKPOINT_DIR)) {<NEW_LINE>_checkpointFileRootDir = cmd.getOptionValue(CHECKPOINT_DIR);<NEW_LINE>LOG.info("Checkpoint dir = " + _checkpointFileRootDir);<NEW_LINE>}<NEW_LINE>if (cmd.hasOption(BOOTSTRAP_HOST_OPT_NAME)) {<NEW_LINE>_bootstrapHost = cmd.getOptionValue(BOOTSTRAP_HOST_OPT_NAME);<NEW_LINE>LOG.info("Bootstrap Server = " + _bootstrapHost);<NEW_LINE>}<NEW_LINE>if (cmd.hasOption(BOOTSTRAP_PORT_OPT_NAME)) {<NEW_LINE>_bootstrapPort = cmd.getOptionValue(BOOTSTRAP_PORT_OPT_NAME);<NEW_LINE>LOG.info("Bootstrap Server Port = " + _bootstrapPort);<NEW_LINE>}<NEW_LINE>if (cmd.hasOption(EVENT_PATTERN_OPT_NAME)) {<NEW_LINE>_eventPattern = cmd.getOptionValue(EVENT_PATTERN_OPT_NAME);<NEW_LINE>LOG.info("Event pattern = " + _eventPattern);<NEW_LINE>}<NEW_LINE>if (_bootstrapHost != null || _bootstrapPort != null) {<NEW_LINE>_enableBootStrap = true;<NEW_LINE>}<NEW_LINE>if (cmd.hasOption(FILTER_CONF_FILE_OPT_NAME)) {<NEW_LINE>_filterConfFile = cmd.getOptionValue(FILTER_CONF_FILE_OPT_NAME);<NEW_LINE>LOG.info("Server Side Filtering Config File =" + _filterConfFile);<NEW_LINE>}<NEW_LINE>if (cmd.hasOption(SOURCES_OPT_NAME)) {<NEW_LINE>_sources = cmd.getOptionValue(SOURCES_OPT_NAME).split(",");<NEW_LINE>LOG.info("Sources to be subscribed are =" + Arrays.toString(_sources));<NEW_LINE>}<NEW_LINE>// return what left over args<NEW_LINE>return cmd.getArgs();<NEW_LINE>} | parse(cliOptions, cliArgs, true); |
1,417,442 | public int writeHeaderType(DebugContext context, HeaderTypeEntry headerTypeEntry, byte[] buffer, int p) {<NEW_LINE>int pos = p;<NEW_LINE>String name = headerTypeEntry.getTypeName();<NEW_LINE>byte size = (byte) headerTypeEntry.getSize();<NEW_LINE>log(context, " [0x%08x] header type %s", pos, name);<NEW_LINE>setIndirectTypeIndex(headerTypeEntry, pos);<NEW_LINE>int abbrevCode = DwarfDebugInfo.DW_ABBREV_CODE_object_header;<NEW_LINE>log(context, " [0x%08x] <1> Abbrev Number %d", pos, abbrevCode);<NEW_LINE>pos = writeAbbrevCode(abbrevCode, buffer, pos);<NEW_LINE>log(context, " [0x%08x] name 0x%x (%s)", pos, debugStringIndex(name), name);<NEW_LINE>pos = writeAttrStrp(name, buffer, pos);<NEW_LINE>log(<MASK><NEW_LINE>pos = writeAttrData1(size, buffer, pos);<NEW_LINE>pos = writeHeaderFields(context, headerTypeEntry, buffer, pos);<NEW_LINE>return writeAttrNull(buffer, pos);<NEW_LINE>} | context, " [0x%08x] byte_size 0x%x", pos, size); |
1,043,409 | private void printMonitors(final PrintStream out, final SAObject javaFrame, Object waitingToLockMonitor, boolean objectWaitFrame) throws IllegalAccessException, InvocationTargetException {<NEW_LINE>if (objectWaitFrame) {<NEW_LINE>// NOI18N<NEW_LINE>SAObject <MASK><NEW_LINE>// NOI18N<NEW_LINE>Boolean isEmpty = (Boolean) stackValueCollection.invoke("isEmpty");<NEW_LINE>if (!isEmpty.booleanValue()) {<NEW_LINE>// NOI18N<NEW_LINE>Object oopHandle = stackValueCollection.invoke("oopHandleAt", 0);<NEW_LINE>// NOI18N<NEW_LINE>printMonitor(out, oopHandle, "waiting on");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>// NOI18N<NEW_LINE>List mList = (List) javaFrame.invoke("getMonitors");<NEW_LINE>Object[] monitors = mList.toArray();<NEW_LINE>for (int i = monitors.length - 1; i >= 0; i--) {<NEW_LINE>SAObject monitorInfo = new SAObject(monitors[i]);<NEW_LINE>// NOI18N<NEW_LINE>Object ownerHandle = monitorInfo.invoke("owner");<NEW_LINE>if (ownerHandle != null) {<NEW_LINE>// NOI18N<NEW_LINE>String state = "locked";<NEW_LINE>if (waitingToLockMonitor != null) {<NEW_LINE>// NOI18N<NEW_LINE>Object objectHandle = new SAObject(waitingToLockMonitor).invoke("object");<NEW_LINE>if (objectHandle.equals(ownerHandle)) {<NEW_LINE>// NOI18N<NEW_LINE>state = "waiting to lock";<NEW_LINE>}<NEW_LINE>}<NEW_LINE>printMonitor(out, ownerHandle, state);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>// Ignore...<NEW_LINE>}<NEW_LINE>} | stackValueCollection = javaFrame.invokeSA("getLocals"); |
1,577,289 | final TestAlarmResult executeTestAlarm(TestAlarmRequest testAlarmRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(testAlarmRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<TestAlarmRequest> request = null;<NEW_LINE>Response<TestAlarmResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new TestAlarmRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(testAlarmRequest));<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, "Lightsail");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "TestAlarm");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<TestAlarmResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new TestAlarmResultJsonUnmarshaller());<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.ADVANCED_CONFIG, advancedConfig); |
603,250 | public ApiResponse<Void> testJsonFormDataWithHttpInfo(String param, String param2) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// verify the required parameter 'param' is set<NEW_LINE>if (param == null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>// verify the required parameter 'param2' is set<NEW_LINE>if (param2 == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/fake/jsonFormData";<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, String> localVarCookieParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>if (param != null)<NEW_LINE>localVarFormParams.put("param", param);<NEW_LINE>if (param2 != null)<NEW_LINE>localVarFormParams.put("param2", param2);<NEW_LINE>final String[] localVarAccepts = {};<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final String[] localVarContentTypes = { "application/x-www-form-urlencoded" };<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] {};<NEW_LINE>return apiClient.invokeAPI("FakeApi.testJsonFormData", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null, false);<NEW_LINE>} | throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData"); |
487,323 | private void removeNode(Node<K, V> node) {<NEW_LINE>if (node.previous != null) {<NEW_LINE>node.previous.next = node.next;<NEW_LINE>} else {<NEW_LINE>// node was head<NEW_LINE>head = node.next;<NEW_LINE>}<NEW_LINE>if (node.next != null) {<NEW_LINE>node.next.previous = node.previous;<NEW_LINE>} else {<NEW_LINE>// node was tail<NEW_LINE>tail = node.previous;<NEW_LINE>}<NEW_LINE>if (node.previousSibling == null && node.nextSibling == null) {<NEW_LINE>KeyList<K, V> keyList = requireNonNull(keyToKeyList.remove(node.key));<NEW_LINE>keyList.count = 0;<NEW_LINE>modCount++;<NEW_LINE>} else {<NEW_LINE>// requireNonNull is safe (under the conditions listed in the comment in the branch above).<NEW_LINE>KeyList<K, V> keyList = requireNonNull(keyToKeyList.get(node.key));<NEW_LINE>keyList.count--;<NEW_LINE>if (node.previousSibling == null) {<NEW_LINE>// requireNonNull is safe because we checked that not *both* siblings were null.<NEW_LINE>keyList.head = requireNonNull(node.nextSibling);<NEW_LINE>} else {<NEW_LINE>node.previousSibling.nextSibling = node.nextSibling;<NEW_LINE>}<NEW_LINE>if (node.nextSibling == null) {<NEW_LINE>// requireNonNull is safe because we checked that not *both* siblings were null.<NEW_LINE>keyList.tail = requireNonNull(node.previousSibling);<NEW_LINE>} else {<NEW_LINE>node<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>size--;<NEW_LINE>} | .nextSibling.previousSibling = node.previousSibling; |
1,025,564 | public Vector<Object> processIncoming(Document soapDocument, PropertyExpansionContext context) throws WSSecurityException {<NEW_LINE>Element header = WSSecurityUtil.findWsseSecurityHeaderBlock(soapDocument, soapDocument.getDocumentElement(), false);<NEW_LINE>if (header == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>WSSecurityEngine wssecurityEngine = new WSSecurityEngine();<NEW_LINE>WssCrypto signatureCrypto = getWssContainer().getCryptoByName(getSignatureCrypto());<NEW_LINE>WssCrypto decryptCrypto = getWssContainer().getCryptoByName(getDecryptCrypto());<NEW_LINE>Crypto sig = signatureCrypto == null ? null : signatureCrypto.getCrypto();<NEW_LINE>Crypto dec = decryptCrypto == null <MASK><NEW_LINE>if (sig == null && dec == null) {<NEW_LINE>throw new WSSecurityException("Missing cryptos");<NEW_LINE>}<NEW_LINE>if (sig == null) {<NEW_LINE>sig = dec;<NEW_LINE>} else if (dec == null) {<NEW_LINE>dec = sig;<NEW_LINE>}<NEW_LINE>List<WSSecurityEngineResult> incomingResult = wssecurityEngine.processSecurityHeader(soapDocument, (String) null, new WSSCallbackHandler(dec), sig, dec);<NEW_LINE>Vector<Object> wssResult = new Vector<Object>();<NEW_LINE>wssResult.setSize(incomingResult.size());<NEW_LINE>Collections.copy(wssResult, incomingResult);<NEW_LINE>return wssResult;<NEW_LINE>} catch (WSSecurityException e) {<NEW_LINE>SoapUI.logError(e);<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>} | ? null : decryptCrypto.getCrypto(); |
713,847 | public List<PluginSummaryBean> listPlugins() throws StorageException {<NEW_LINE>beginTx();<NEW_LINE>try {<NEW_LINE>EntityManager entityManager = getActiveEntityManager();<NEW_LINE>String sql = "SELECT p.id, p.artifact_id, p.group_id, p.version, p.classifier, p.type, p.name, p.description, p.created_by, p.created_on" + " FROM plugins p" + " WHERE p.deleted IS NULL OR p.deleted = 0" + " ORDER BY p.name ASC";<NEW_LINE>Query query = entityManager.createNativeQuery(sql);<NEW_LINE>List<Object[]> rows = query.getResultList();<NEW_LINE>List<PluginSummaryBean> plugins = new ArrayList<>(rows.size());<NEW_LINE>for (Object[] row : rows) {<NEW_LINE>PluginSummaryBean plugin = new PluginSummaryBean();<NEW_LINE>plugin.setId(((Number) row[0]).longValue());<NEW_LINE>plugin.setArtifactId(String.valueOf(row[1]));<NEW_LINE>plugin.setGroupId(String.valueOf(row[2]));<NEW_LINE>plugin.setVersion(String.valueOf(row[3]));<NEW_LINE>plugin.setClassifier((String) row[4]);<NEW_LINE>plugin.setType((String) row[5]);<NEW_LINE>plugin.setName(String.valueOf(row[6]));<NEW_LINE>plugin.setDescription(String.valueOf(row[7]));<NEW_LINE>plugin.setCreatedBy(String.valueOf(row[8]));<NEW_LINE>plugin.setCreatedOn(<MASK><NEW_LINE>plugins.add(plugin);<NEW_LINE>}<NEW_LINE>return plugins;<NEW_LINE>} catch (Throwable t) {<NEW_LINE>logger.error(t.getMessage(), t);<NEW_LINE>throw new StorageException(t);<NEW_LINE>} finally {<NEW_LINE>rollbackTx();<NEW_LINE>}<NEW_LINE>} | (Date) row[9]); |
199,196 | public static Map<String, TopicWorkload> retrieveTopicInRate(long timeInMs, long windowInMs, String c3Host, int c3Port, String kafkaCluster, List<String> topics) throws IOException {<NEW_LINE>Map<String, TopicWorkload> workloads = new HashMap<>();<NEW_LINE>if (c3Port == 0) {<NEW_LINE>return workloads;<NEW_LINE>}<NEW_LINE>long endSec = (timeInMs / 1000 - DEFAULT_QUERY_MINIMUM_END_TO_CURRENT_SEC) / 600 * 600;<NEW_LINE>long startSec = endSec - windowInMs / 1000L;<NEW_LINE>LOGGER.info("Retrieve workload for [{}, {}] for {} for {} topics", startSec, endSec, <MASK><NEW_LINE>long ts1 = System.currentTimeMillis();<NEW_LINE>for (int i = 0; i < topics.size(); i += DEFAULT_BATCH_TOPICS) {<NEW_LINE>StringBuilder query = new StringBuilder();<NEW_LINE>query.append("startSec=");<NEW_LINE>query.append(startSec);<NEW_LINE>query.append("&endSec=");<NEW_LINE>query.append(endSec);<NEW_LINE>query.append("&tier=");<NEW_LINE>query.append(kafkaCluster);<NEW_LINE>query.append("&topicList=");<NEW_LINE>List<String> batch = topics.subList(i, Math.min(i + DEFAULT_BATCH_TOPICS, topics.size()));<NEW_LINE>query.append(StringUtils.join(batch, ","));<NEW_LINE>String jsonStr = makeQuery(c3Host, c3Port, query.toString());<NEW_LINE>extractJsonResults(jsonStr, batch, workloads);<NEW_LINE>}<NEW_LINE>LOGGER.info("took {} ms to retrieve {} topics for {}", System.currentTimeMillis() - ts1, topics.size(), kafkaCluster);<NEW_LINE>return workloads;<NEW_LINE>} | kafkaCluster, topics.size()); |
909,214 | public static void collectStreamsFrom(final InfoItemsCollector collector, final JsonObject json, final String baseUrl, final boolean sepia) throws ParsingException {<NEW_LINE>final JsonArray contents;<NEW_LINE>try {<NEW_LINE>contents = (JsonArray) JsonUtils.getValue(json, "data");<NEW_LINE>} catch (final Exception e) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>for (final Object c : contents) {<NEW_LINE>if (c instanceof JsonObject) {<NEW_LINE>JsonObject item = (JsonObject) c;<NEW_LINE>// PeerTube playlists have the stream info encapsulated in an "video" object<NEW_LINE>if (item.has("video")) {<NEW_LINE>item = item.getObject("video");<NEW_LINE>}<NEW_LINE>final PeertubeStreamInfoItemExtractor extractor;<NEW_LINE>if (sepia) {<NEW_LINE>extractor = new PeertubeSepiaStreamInfoItemExtractor(item, baseUrl);<NEW_LINE>} else {<NEW_LINE>extractor = new PeertubeStreamInfoItemExtractor(item, baseUrl);<NEW_LINE>}<NEW_LINE>collector.commit(extractor);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | throw new ParsingException("Unable to extract list info", e); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.