idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,451,228 | public Collection<HmDevice> parse(Object[] message) throws IOException {<NEW_LINE>message = (Object[]) message[0];<NEW_LINE>Map<String, HmDevice> devices = new HashMap<>();<NEW_LINE>for (int i = 0; i < message.length; i++) {<NEW_LINE>Map<String, ?> data = (Map<String, ?>) message[i];<NEW_LINE>if (MiscUtils.isDevice(toString(data.get("ADDRESS")), true)) {<NEW_LINE>String address = getSanitizedAddress(data.get("ADDRESS"));<NEW_LINE>String type = MiscUtils.validateCharacters(toString(data.get("TYPE")), "Device type", "-");<NEW_LINE>String id = toString(data.get("ID"));<NEW_LINE>String firmware = toString(data.get("FIRMWARE"));<NEW_LINE>HmDevice device = new HmDevice(address, hmInterface, type, config.getGatewayInfo().getId(), id, firmware);<NEW_LINE>device.addChannel(new HmChannel(type, CONFIGURATION_CHANNEL_NUMBER));<NEW_LINE>devices.put(address, device);<NEW_LINE>} else {<NEW_LINE>// channel<NEW_LINE>String deviceAddress = getSanitizedAddress<MASK><NEW_LINE>HmDevice device = devices.get(deviceAddress);<NEW_LINE>String type = toString(data.get("TYPE"));<NEW_LINE>Integer number = toInteger(data.get("INDEX"));<NEW_LINE>device.addChannel(new HmChannel(type, number));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return devices.values();<NEW_LINE>} | (data.get("PARENT")); |
1,654,724 | static boolean combineAnnotations(PathObjectHierarchy hierarchy, List<PathObject> pathObjects, RoiTools.CombineOp op) {<NEW_LINE>if (hierarchy == null || hierarchy.isEmpty() || pathObjects.isEmpty()) {<NEW_LINE>logger.warn("Combine annotations: Cannot combine - no annotations found");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>pathObjects = new ArrayList<>(pathObjects);<NEW_LINE>PathObject pathObject = pathObjects.get(0);<NEW_LINE>if (!pathObject.isAnnotation()) {<NEW_LINE>// || !RoiTools.isShapeROI(pathObject.getROI())) {<NEW_LINE>logger.warn("Combine annotations: No annotation with ROI selected");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>var plane = pathObject<MASK><NEW_LINE>// pathObjects.removeIf(p -> !RoiTools.isShapeROI(p.getROI())); // Remove any null or point ROIs, TODO: Consider supporting points<NEW_LINE>// Remove any null or point ROIs, TODO: Consider supporting points<NEW_LINE>pathObjects.removeIf(p -> !p.hasROI() || !p.getROI().getImagePlane().equals(plane));<NEW_LINE>if (pathObjects.isEmpty()) {<NEW_LINE>logger.warn("Cannot combine annotations - only one suitable annotation found");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>var allROIs = pathObjects.stream().map(p -> p.getROI()).collect(Collectors.toCollection(() -> new ArrayList<>()));<NEW_LINE>ROI newROI;<NEW_LINE>switch(op) {<NEW_LINE>case ADD:<NEW_LINE>newROI = RoiTools.union(allROIs);<NEW_LINE>break;<NEW_LINE>case INTERSECT:<NEW_LINE>newROI = RoiTools.intersection(allROIs);<NEW_LINE>break;<NEW_LINE>case SUBTRACT:<NEW_LINE>var first = allROIs.remove(0);<NEW_LINE>newROI = RoiTools.combineROIs(first, RoiTools.union(allROIs), op);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new IllegalArgumentException("Unknown combine op " + op);<NEW_LINE>}<NEW_LINE>if (newROI == null) {<NEW_LINE>logger.debug("No changes were made");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>PathObject newObject = null;<NEW_LINE>if (!newROI.isEmpty()) {<NEW_LINE>newObject = PathObjects.createAnnotationObject(newROI, pathObject.getPathClass());<NEW_LINE>newObject.setName(pathObject.getName());<NEW_LINE>newObject.setColorRGB(pathObject.getColorRGB());<NEW_LINE>}<NEW_LINE>// Remove previous objects<NEW_LINE>hierarchy.removeObjects(pathObjects, true);<NEW_LINE>if (newObject != null)<NEW_LINE>hierarchy.addPathObject(newObject);<NEW_LINE>return true;<NEW_LINE>} | .getROI().getImagePlane(); |
1,791,003 | public void onClick(View v) {<NEW_LINE>new QMUIDialog.MessageDialogBuilder(getActivity()).setTitle(getString(R.string.string_143)).setMessage(getString(R.string.string_144)).setSkinManager(QMUISkinManager.defaultInstance(mContext)).addAction(getString(R.string.string_142), new QMUIDialogAction.ActionListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(QMUIDialog dialog, int index) {<NEW_LINE>dialog.dismiss();<NEW_LINE>}<NEW_LINE>}).addAction(0, getString(R.string.string_141), QMUIDialogAction.ACTION_PROP_NEGATIVE, new QMUIDialogAction.ActionListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(QMUIDialog dialog, int index) {<NEW_LINE>AppDatabase.getAppDatabase(Shaft.getContext())<MASK><NEW_LINE>Common.showToast(getString(R.string.string_140));<NEW_LINE>dialog.dismiss();<NEW_LINE>onResume();<NEW_LINE>}<NEW_LINE>}).show();<NEW_LINE>} | .searchDao().deleteAllUnpinned(); |
980,875 | protected void createRuntimeDataComponents() {<NEW_LINE>if (rDS != null && categoriesDs != null) {<NEW_LINE>Map<String, Object> params = new HashMap<>();<NEW_LINE>params.put("runtimeDs", rDS.getId());<NEW_LINE>params.put(<MASK><NEW_LINE>params.put("fieldWidth", themeConstants.get("cuba.gui.EntityInspectorEditor.field.width"));<NEW_LINE>params.put("borderVisible", Boolean.TRUE);<NEW_LINE>RuntimePropertiesFrame runtimePropertiesFrame = (RuntimePropertiesFrame) openFrame(runtimePane, "runtimePropertiesFrame", params);<NEW_LINE>runtimePropertiesFrame.setFrame(this.getFrame());<NEW_LINE>runtimePropertiesFrame.setMessagesPack("com.haulmont.cuba.gui.app.core.entityinspector");<NEW_LINE>runtimePropertiesFrame.setCategoryFieldVisible(false);<NEW_LINE>runtimePropertiesFrame.setHeightAuto();<NEW_LINE>runtimePropertiesFrame.setWidthFull();<NEW_LINE>runtimePane.add(runtimePropertiesFrame);<NEW_LINE>}<NEW_LINE>} | "categoriesDs", categoriesDs.getId()); |
161,336 | List<ZeebePartition> constructPartitions(final RaftPartitionGroup partitionGroup, final List<PartitionListener> partitionListeners, final TopologyManager topologyManager) {<NEW_LINE>final var partitions = new ArrayList<ZeebePartition>();<NEW_LINE>final var communicationService = clusterServices.getCommunicationService();<NEW_LINE>final var eventService = clusterServices.getEventService();<NEW_LINE>final var membershipService = clusterServices.getMembershipService();<NEW_LINE>final MemberId nodeId = membershipService.getLocalMember().id();<NEW_LINE>final List<RaftPartition> owningPartitions = partitionGroup.getPartitionsWithMember(nodeId).stream().map(RaftPartition.class::cast).collect(Collectors.toList());<NEW_LINE>final var typedRecordProcessorsFactory = createFactory(topologyManager, localBroker, communicationService, eventService, deploymentRequestHandler);<NEW_LINE>for (final RaftPartition owningPartition : owningPartitions) {<NEW_LINE>final var partitionId = owningPartition.id().id();<NEW_LINE>final ConstructableSnapshotStore constructableSnapshotStore = snapshotStoreFactory.getConstructableSnapshotStore(partitionId);<NEW_LINE>final StateController stateController = createStateController(owningPartition, constructableSnapshotStore, snapshotStoreFactory.getSnapshotStoreConcurrencyControl(partitionId));<NEW_LINE>final PartitionStartupAndTransitionContextImpl partitionStartupAndTransitionContext = new PartitionStartupAndTransitionContextImpl(localBroker.getNodeId(), owningPartition, partitionListeners, new AtomixPartitionMessagingService(communicationService, membershipService, owningPartition.members()), actorSchedulingService, brokerCfg, commandApiService::newCommandResponseWriter, () -> commandApiService.getOnProcessedListener(partitionId), constructableSnapshotStore, snapshotStoreFactory.getReceivableSnapshotStore(partitionId), stateController, typedRecordProcessorsFactory, exporterRepository, new PartitionProcessingState(owningPartition));<NEW_LINE>final PartitionTransition newTransitionBehavior = new PartitionTransitionImpl(TRANSITION_STEPS);<NEW_LINE>final ZeebePartition zeebePartition = new <MASK><NEW_LINE>healthCheckService.registerMonitoredPartition(zeebePartition.getPartitionId(), zeebePartition);<NEW_LINE>partitions.add(zeebePartition);<NEW_LINE>}<NEW_LINE>return partitions;<NEW_LINE>} | ZeebePartition(partitionStartupAndTransitionContext, newTransitionBehavior, STARTUP_STEPS); |
628,940 | private void populateArtifactEditor(ArtifactCondition artifactConditionToPopulateWith) {<NEW_LINE>cbAttributeType.setSelected(true);<NEW_LINE>comboBoxArtifactName.setSelectedItem(artifactConditionToPopulateWith.getArtifactTypeName());<NEW_LINE>comboBoxAttributeComparison.setSelectedItem(artifactConditionToPopulateWith.getRelationalOperator().getSymbol());<NEW_LINE>comboBoxAttributeName.setSelectedItem(artifactConditionToPopulateWith.getAttributeTypeName());<NEW_LINE>BlackboardAttribute.<MASK><NEW_LINE>comboBoxValueType.setSelectedItem(valueType.getLabel());<NEW_LINE>comboBoxValueType.setEnabled(null == attributeTypeMap.get(artifactConditionToPopulateWith.getAttributeTypeName()));<NEW_LINE>if (valueType == BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DATETIME) {<NEW_LINE>Instant instant = Instant.ofEpochMilli(artifactConditionToPopulateWith.getDateTimeValue().toDate().getTime());<NEW_LINE>dateTimePicker.setDateTimeStrict(LocalDateTime.ofInstant(instant, ZoneId.systemDefault()));<NEW_LINE>} else {<NEW_LINE>tbAttributeValue.setText(artifactConditionToPopulateWith.getStringRepresentationOfValue());<NEW_LINE>}<NEW_LINE>} | TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE valueType = artifactConditionToPopulateWith.getAttributeValueType(); |
1,681,339 | public static QueryTrademarkMonitorResultsResponse unmarshall(QueryTrademarkMonitorResultsResponse queryTrademarkMonitorResultsResponse, UnmarshallerContext _ctx) {<NEW_LINE>queryTrademarkMonitorResultsResponse.setRequestId<MASK><NEW_LINE>queryTrademarkMonitorResultsResponse.setTotalItemNum(_ctx.integerValue("QueryTrademarkMonitorResultsResponse.TotalItemNum"));<NEW_LINE>queryTrademarkMonitorResultsResponse.setCurrentPageNum(_ctx.integerValue("QueryTrademarkMonitorResultsResponse.CurrentPageNum"));<NEW_LINE>queryTrademarkMonitorResultsResponse.setPageSize(_ctx.integerValue("QueryTrademarkMonitorResultsResponse.PageSize"));<NEW_LINE>queryTrademarkMonitorResultsResponse.setTotalPageNum(_ctx.integerValue("QueryTrademarkMonitorResultsResponse.TotalPageNum"));<NEW_LINE>queryTrademarkMonitorResultsResponse.setPrePage(_ctx.booleanValue("QueryTrademarkMonitorResultsResponse.PrePage"));<NEW_LINE>queryTrademarkMonitorResultsResponse.setNextPage(_ctx.booleanValue("QueryTrademarkMonitorResultsResponse.NextPage"));<NEW_LINE>List<TmMonitorResult> data = new ArrayList<TmMonitorResult>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("QueryTrademarkMonitorResultsResponse.Data.Length"); i++) {<NEW_LINE>TmMonitorResult tmMonitorResult = new TmMonitorResult();<NEW_LINE>tmMonitorResult.setUserId(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].UserId"));<NEW_LINE>tmMonitorResult.setRuleId(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].RuleId"));<NEW_LINE>tmMonitorResult.setTmUid(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].TmUid"));<NEW_LINE>tmMonitorResult.setDataCreateTime(_ctx.longValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].DataCreateTime"));<NEW_LINE>tmMonitorResult.setDataUpdateTime(_ctx.longValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].DataUpdateTime"));<NEW_LINE>tmMonitorResult.setTmName(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].TmName"));<NEW_LINE>tmMonitorResult.setTmImage(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].TmImage"));<NEW_LINE>tmMonitorResult.setClassification(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].Classification"));<NEW_LINE>tmMonitorResult.setRegistrationNumber(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].RegistrationNumber"));<NEW_LINE>tmMonitorResult.setTmProcedureStatusDesc(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].TmProcedureStatusDesc"));<NEW_LINE>tmMonitorResult.setOwnerName(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].OwnerName"));<NEW_LINE>tmMonitorResult.setOwnerEnName(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].OwnerEnName"));<NEW_LINE>tmMonitorResult.setApplyDate(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].ApplyDate"));<NEW_LINE>tmMonitorResult.setXuzhanEndDate(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].XuzhanEndDate"));<NEW_LINE>tmMonitorResult.setChesanEndDate(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].ChesanEndDate"));<NEW_LINE>tmMonitorResult.setWuxiaoEndDate(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].WuxiaoEndDate"));<NEW_LINE>tmMonitorResult.setYiyiEndDate(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].YiyiEndDate"));<NEW_LINE>data.add(tmMonitorResult);<NEW_LINE>}<NEW_LINE>queryTrademarkMonitorResultsResponse.setData(data);<NEW_LINE>return queryTrademarkMonitorResultsResponse;<NEW_LINE>} | (_ctx.stringValue("QueryTrademarkMonitorResultsResponse.RequestId")); |
655,724 | public Void visitBlock(BlockTree bt, Void p) {<NEW_LINE>List<CatchTree> catches = createCatches(info, make, thandles, statement);<NEW_LINE>// #89379: if inside a constructor, do not wrap the "super"/"this" call:<NEW_LINE>// please note that the "super" or "this" call is supposed to be always<NEW_LINE>// in the constructor body<NEW_LINE>BlockTree toUse = bt;<NEW_LINE>StatementTree toKeep = null;<NEW_LINE>Tree parent = getCurrentPath().getParentPath().getLeaf();<NEW_LINE>if (parent.getKind() == Kind.METHOD && bt.getStatements().size() > 0) {<NEW_LINE>MethodTree mt = (MethodTree) parent;<NEW_LINE>if (mt.getReturnType() == null) {<NEW_LINE>toKeep = bt.getStatements().get(0);<NEW_LINE>toUse = make.Block(bt.getStatements().subList(1, bt.getStatements().size()), false);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!streamAlike) {<NEW_LINE>info.rewrite(bt, createBlock(bt.isStatic(), toKeep, make.Try(toUse, catches, null)));<NEW_LINE>} else {<NEW_LINE>VariableTree originalDeclaration = (VariableTree) statement.getLeaf();<NEW_LINE>VariableTree declaration = make.Variable(make.Modifiers(EnumSet.noneOf(Modifier.class)), originalDeclaration.getName(), originalDeclaration.getType()<MASK><NEW_LINE>StatementTree assignment = make.ExpressionStatement(make.Assignment(make.Identifier(originalDeclaration.getName()), originalDeclaration.getInitializer()));<NEW_LINE>BlockTree finallyTree = make.Block(Collections.singletonList(createFinallyCloseBlockStatement(originalDeclaration)), false);<NEW_LINE>info.rewrite(originalDeclaration, assignment);<NEW_LINE>info.rewrite(bt, createBlock(bt.isStatic(), toKeep, declaration, make.Try(toUse, catches, finallyTree)));<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | , make.Identifier("null")); |
283,892 | static void attachBaseContext() {<NEW_LINE>Log.i(Consts.TAG, "ARouter start attachBaseContext");<NEW_LINE>try {<NEW_LINE>Class<?> mMainThreadClass = Class.forName("android.app.ActivityThread");<NEW_LINE>// Get current main thread.<NEW_LINE>Method getMainThread = mMainThreadClass.getDeclaredMethod("currentActivityThread");<NEW_LINE>getMainThread.setAccessible(true);<NEW_LINE>Object <MASK><NEW_LINE>// The field contain instrumentation.<NEW_LINE>Field mInstrumentationField = mMainThreadClass.getDeclaredField("mInstrumentation");<NEW_LINE>mInstrumentationField.setAccessible(true);<NEW_LINE>// Hook current instrumentation<NEW_LINE>mInstrumentationField.set(currentActivityThread, new InstrumentationHook());<NEW_LINE>Log.i(Consts.TAG, "ARouter hook instrumentation success!");<NEW_LINE>} catch (Exception ex) {<NEW_LINE>Log.e(Consts.TAG, "ARouter hook instrumentation failed! [" + ex.getMessage() + "]");<NEW_LINE>}<NEW_LINE>} | currentActivityThread = getMainThread.invoke(null); |
7,419 | public boolean sendPushRevocationPolicyRequest(RealmModel realm, ClientModel resource, int notBefore, String managementUrl) {<NEW_LINE>PushNotBeforeAction adminAction = new PushNotBeforeAction(TokenIdGenerator.generateId(), Time.currentTime() + 30, resource.getClientId(), notBefore);<NEW_LINE>String token = session.<MASK><NEW_LINE>logger.debugv("pushRevocation resource: {0} url: {1}", resource.getClientId(), managementUrl);<NEW_LINE>URI target = UriBuilder.fromUri(managementUrl).path(AdapterConstants.K_PUSH_NOT_BEFORE).build();<NEW_LINE>try {<NEW_LINE>int status = session.getProvider(HttpClientProvider.class).postText(target.toString(), token);<NEW_LINE>boolean success = status == 204 || status == 200;<NEW_LINE>logger.debugf("pushRevocation success for %s: %s", managementUrl, success);<NEW_LINE>return success;<NEW_LINE>} catch (IOException e) {<NEW_LINE>ServicesLogger.LOGGER.failedToSendRevocation(e);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | tokens().encode(adminAction); |
1,148,192 | public void editorContextMenuAboutToShow(IMenuManager menu) {<NEW_LINE>menu.add(new GroupMarker(GROUP_SQL_ADDITIONS));<NEW_LINE>super.editorContextMenuAboutToShow(menu);<NEW_LINE>// menu.add(new Separator("content"));//$NON-NLS-1$<NEW_LINE>addAction(menu, GROUP_SQL_EXTRAS, SQLEditorContributor.ACTION_CONTENT_ASSIST_PROPOSAL);<NEW_LINE>addAction(menu, GROUP_SQL_EXTRAS, SQLEditorContributor.ACTION_CONTENT_ASSIST_TIP);<NEW_LINE>addAction(menu, GROUP_SQL_EXTRAS, SQLEditorContributor.ACTION_CONTENT_ASSIST_INFORMATION);<NEW_LINE>menu.insertBefore(ITextEditorActionConstants.GROUP_COPY, ActionUtils.makeCommandContribution(getSite(), SQLEditorCommands.CMD_NAVIGATE_OBJECT));<NEW_LINE>TextViewer textViewer = getTextViewer();<NEW_LINE>if (!isReadOnly() && textViewer != null && textViewer.isEditable()) {<NEW_LINE>MenuManager formatMenu = new MenuManager(SQLEditorMessages.sql_editor_menu_format, "format");<NEW_LINE>IAction formatAction = getAction(SQLEditorContributor.ACTION_CONTENT_FORMAT_PROPOSAL);<NEW_LINE>if (formatAction != null) {<NEW_LINE>formatMenu.add(formatAction);<NEW_LINE>}<NEW_LINE>formatMenu.add(ActionUtils.makeCommandContribution<MASK><NEW_LINE>formatMenu.add(getAction(ITextEditorActionConstants.UPPER_CASE));<NEW_LINE>formatMenu.add(getAction(ITextEditorActionConstants.LOWER_CASE));<NEW_LINE>formatMenu.add(ActionUtils.makeCommandContribution(getSite(), "org.jkiss.dbeaver.ui.editors.sql.trim.spaces"));<NEW_LINE>formatMenu.add(new Separator());<NEW_LINE>formatMenu.add(ActionUtils.makeCommandContribution(getSite(), "org.jkiss.dbeaver.ui.editors.sql.word.wrap"));<NEW_LINE>formatMenu.add(ActionUtils.makeCommandContribution(getSite(), "org.jkiss.dbeaver.ui.editors.sql.comment.single"));<NEW_LINE>formatMenu.add(ActionUtils.makeCommandContribution(getSite(), "org.jkiss.dbeaver.ui.editors.sql.comment.multi"));<NEW_LINE>menu.insertAfter(GROUP_SQL_ADDITIONS, formatMenu);<NEW_LINE>}<NEW_LINE>// menu.remove(IWorkbenchActionConstants.MB_ADDITIONS);<NEW_LINE>} | (getSite(), "org.jkiss.dbeaver.ui.editors.sql.morph.delimited.list")); |
1,528,950 | static ClassInfo addScannedClass(final String className, final int classModifiers, final boolean isExternalClass, final Map<String, ClassInfo> classNameToClassInfo, final ClasspathElement classpathElement, final Resource classfileResource) {<NEW_LINE>ClassInfo <MASK><NEW_LINE>if (classInfo == null) {<NEW_LINE>// This is the first time this class has been seen, add it<NEW_LINE>classNameToClassInfo.put(className, classInfo = new ClassInfo(className, classModifiers, classfileResource));<NEW_LINE>} else {<NEW_LINE>// There was a previous placeholder ClassInfo class added, due to the class being referred<NEW_LINE>// to as a superclass, interface or annotation. The isScannedClass field should be false<NEW_LINE>// in this case, since the actual class definition wasn't reached before now.<NEW_LINE>if (classInfo.isScannedClass) {<NEW_LINE>// The class should not have been scanned more than once, because of classpath masking<NEW_LINE>throw new IllegalArgumentException("Class " + className + " should not have been encountered more than once due to classpath masking --" + " please report this bug at: https://github.com/classgraph/classgraph/issues");<NEW_LINE>}<NEW_LINE>// Set the classfileResource for the placeholder class<NEW_LINE>classInfo.classfileResource = classfileResource;<NEW_LINE>// Add any additional modifier bits<NEW_LINE>classInfo.modifiers |= classModifiers;<NEW_LINE>}<NEW_LINE>// Mark the class as scanned<NEW_LINE>classInfo.isScannedClass = true;<NEW_LINE>// Mark the class as non-external if it is an accepted class<NEW_LINE>classInfo.isExternalClass = isExternalClass;<NEW_LINE>// Remember which classpath element (zipfile / classpath root directory / module) the class was found in<NEW_LINE>classInfo.classpathElement = classpathElement;<NEW_LINE>// Remember which classloader is used to load the class<NEW_LINE>classInfo.classLoader = classpathElement.getClassLoader();<NEW_LINE>return classInfo;<NEW_LINE>} | classInfo = classNameToClassInfo.get(className); |
907,161 | public void remove(int entryIndex) throws IOException {<NEW_LINE>int entryPosition = getIntValue(offset + POSITIONS_ARRAY_OFFSET + entryIndex * OIntegerSerializer.INT_SIZE);<NEW_LINE>int entrySize = <MASK><NEW_LINE>if (isLeaf) {<NEW_LINE>assert valueSerializer.isFixedLength();<NEW_LINE>entrySize += valueSerializer.getFixedLength();<NEW_LINE>} else {<NEW_LINE>throw new IllegalStateException("Remove is applies to leaf buckets only");<NEW_LINE>}<NEW_LINE>int size = size();<NEW_LINE>if (entryIndex < size - 1) {<NEW_LINE>moveData(offset + POSITIONS_ARRAY_OFFSET + (entryIndex + 1) * OIntegerSerializer.INT_SIZE, offset + POSITIONS_ARRAY_OFFSET + entryIndex * OIntegerSerializer.INT_SIZE, (size - entryIndex - 1) * OIntegerSerializer.INT_SIZE);<NEW_LINE>}<NEW_LINE>size--;<NEW_LINE>setIntValue(offset + SIZE_OFFSET, size);<NEW_LINE>int freePointer = getIntValue(offset + FREE_POINTER_OFFSET);<NEW_LINE>if (size > 0 && entryPosition > freePointer) {<NEW_LINE>moveData(offset + freePointer, offset + freePointer + entrySize, entryPosition - freePointer);<NEW_LINE>}<NEW_LINE>setIntValue(offset + FREE_POINTER_OFFSET, freePointer + entrySize);<NEW_LINE>int currentPositionOffset = offset + POSITIONS_ARRAY_OFFSET;<NEW_LINE>for (int i = 0; i < size; i++) {<NEW_LINE>int currentEntryPosition = getIntValue(currentPositionOffset);<NEW_LINE>if (currentEntryPosition < entryPosition)<NEW_LINE>setIntValue(currentPositionOffset, currentEntryPosition + entrySize);<NEW_LINE>currentPositionOffset += OIntegerSerializer.INT_SIZE;<NEW_LINE>}<NEW_LINE>} | getObjectSizeInDirectMemory(keySerializer, offset + entryPosition); |
972,125 | static public void inner4(GrayF32 intensity, GrayF32 derivX, GrayF32 derivY, GrayF32 output) {<NEW_LINE>final int w = intensity.width;<NEW_LINE>final int h = intensity.height - 1;<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(1,h,y->{<NEW_LINE>for (int y = 1; y < h; y++) {<NEW_LINE>int indexI = intensity.startIndex + y * intensity.stride + 1;<NEW_LINE>int indexX = derivX.startIndex + y * derivX.stride + 1;<NEW_LINE>int indexY = derivY.startIndex + y * derivY.stride + 1;<NEW_LINE>int indexO = output.startIndex <MASK><NEW_LINE>int end = indexI + w - 2;<NEW_LINE>for (; indexI < end; indexI++, indexX++, indexY++, indexO++) {<NEW_LINE>int dx, dy;<NEW_LINE>if (derivX.data[indexX] > 0)<NEW_LINE>dx = 1;<NEW_LINE>else<NEW_LINE>dx = -1;<NEW_LINE>if (derivY.data[indexY] > 0)<NEW_LINE>dy = 1;<NEW_LINE>else<NEW_LINE>dy = -1;<NEW_LINE>float middle = intensity.data[indexI];<NEW_LINE>// suppress the value if either of its neighboring values are more than or equal to it<NEW_LINE>if (intensity.data[indexI - dx - dy * intensity.stride] > middle || intensity.data[indexI + dx + dy * intensity.stride] > middle) {<NEW_LINE>output.data[indexO] = 0;<NEW_LINE>} else {<NEW_LINE>output.data[indexO] = middle;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} | + y * output.stride + 1; |
1,216,121 | public MethodDelegationBinder.ParameterBinding<?> bind(AnnotationDescription.Loadable<Default> annotation, MethodDescription source, ParameterDescription target, Implementation.Target implementationTarget, Assigner assigner, Assigner.Typing typing) {<NEW_LINE>TypeDescription proxyType = TypeLocator.ForType.of(annotation.getValue(PROXY_TYPE).resolve(TypeDescription.class)).resolve(target.getType());<NEW_LINE>if (!proxyType.isInterface()) {<NEW_LINE>throw new IllegalStateException(target + " uses the @Default annotation on an invalid type");<NEW_LINE>}<NEW_LINE>if (source.isStatic() || !implementationTarget.getInstrumentedType().getInterfaces().asErasures().contains(proxyType)) {<NEW_LINE>return MethodDelegationBinder.ParameterBinding.Illegal.INSTANCE;<NEW_LINE>} else {<NEW_LINE>return new MethodDelegationBinder.ParameterBinding.Anonymous(new TypeProxy.ForDefaultMethod(proxyType, implementationTarget, annotation.getValue(SERIALIZABLE_PROXY).<MASK><NEW_LINE>}<NEW_LINE>} | resolve(Boolean.class))); |
954,608 | private UpdateRequest updateTopic(ChangeEvent event) throws IOException {<NEW_LINE>UpdateRequest updateRequest = new UpdateRequest(ElasticSearchIndexType.TOPIC_SEARCH_INDEX.indexName, event.getEntityId().toString());<NEW_LINE>TopicESIndex topicESIndex = null;<NEW_LINE>if (event.getEntity() != null && event.getEventType() != EventType.ENTITY_SOFT_DELETED) {<NEW_LINE>Topic topic;<NEW_LINE>topic = (Topic) event.getEntity();<NEW_LINE>topicESIndex = TopicESIndex.builder(topic, event.<MASK><NEW_LINE>}<NEW_LINE>switch(event.getEventType()) {<NEW_LINE>case ENTITY_CREATED:<NEW_LINE>String json = JsonUtils.pojoToJson(topicESIndex);<NEW_LINE>updateRequest.doc(json, XContentType.JSON);<NEW_LINE>updateRequest.docAsUpsert(true);<NEW_LINE>break;<NEW_LINE>case ENTITY_UPDATED:<NEW_LINE>if (Objects.equals(event.getCurrentVersion(), event.getPreviousVersion())) {<NEW_LINE>updateRequest = applyChangeEvent(event);<NEW_LINE>} else {<NEW_LINE>scriptedUpsert(topicESIndex, updateRequest);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case ENTITY_SOFT_DELETED:<NEW_LINE>softDeleteEntity(updateRequest);<NEW_LINE>break;<NEW_LINE>case ENTITY_DELETED:<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>return updateRequest;<NEW_LINE>} | getEventType()).build(); |
220,645 | public GetRepositoryEndpointResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>GetRepositoryEndpointResult getRepositoryEndpointResult = new GetRepositoryEndpointResult();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return getRepositoryEndpointResult;<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("repositoryEndpoint", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getRepositoryEndpointResult.setRepositoryEndpoint(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 getRepositoryEndpointResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,490,726 | private OracleNoSQLQueryInterpreter translateQuery(Queue clauseQueue, EntityMetadata entityMetadata) {<NEW_LINE>OracleNoSQLQueryInterpreter interpreter = new OracleNoSQLQueryInterpreter(getColumns(getKunderaQuery().getResult(), entityMetadata));<NEW_LINE>interpreter.setClauseQueue(clauseQueue);<NEW_LINE>String operatorWithIdClause = null;<NEW_LINE>boolean idClauseFound = false;<NEW_LINE>for (Object clause : clauseQueue) {<NEW_LINE>if (clause.getClass().isAssignableFrom(FilterClause.class) && !idClauseFound) {<NEW_LINE>String columnName = ((FilterClause) clause).getProperty();<NEW_LINE>SingularAttribute idAttribute = entityMetadata.getIdAttribute();<NEW_LINE>if (columnName.equals(((AbstractAttribute) idAttribute).getJPAColumnName())) {<NEW_LINE>interpreter.setFindById(true);<NEW_LINE>// To convert rowkey string to object.<NEW_LINE>// With 2.11 onwards Filter clause values has been changed<NEW_LINE>// to collection of values. other than IN or sub query<NEW_LINE>// doing get(0) here.<NEW_LINE>Object keyObj = PropertyAccessorHelper.fromSourceToTargetClass(((AbstractAttribute) idAttribute).getBindableJavaType(), (((FilterClause) clause).getValue().get(0)).getClass(), ((FilterClause) clause).getValue<MASK><NEW_LINE>interpreter.setRowKey(keyObj);<NEW_LINE>idClauseFound = true;<NEW_LINE>}<NEW_LINE>} else if (clause instanceof String) {<NEW_LINE>operatorWithIdClause = clause.toString().trim();<NEW_LINE>}<NEW_LINE>if (idClauseFound && operatorWithIdClause != null) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>interpreter.setOperatorWithRowKey(operatorWithIdClause);<NEW_LINE>return interpreter;<NEW_LINE>} | ().get(0)); |
1,640,523 | private static Pair<NewVirtualFile, Iterable<String>> prepare(@Nonnull NewVirtualFileSystem vfs, @Nonnull String path) {<NEW_LINE>String normalizedPath = normalize(vfs, path);<NEW_LINE>if (StringUtil.isEmptyOrSpaces(normalizedPath)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>String basePath = vfs.extractRootPath(normalizedPath);<NEW_LINE>if (basePath.length() > normalizedPath.length()) {<NEW_LINE>LOG.error(vfs + " failed to extract root path '" + basePath + "' from '" + normalizedPath + "' (original '" + path + "')");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>NewVirtualFile root = ManagingFS.getInstance(<MASK><NEW_LINE>if (root == null || !root.exists()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Iterable<String> parts = StringUtil.tokenize(normalizedPath.substring(basePath.length()), FILE_SEPARATORS);<NEW_LINE>return Pair.create(root, parts);<NEW_LINE>} | ).findRoot(basePath, vfs); |
226,093 | public void marshall(Nodegroup nodegroup, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (nodegroup == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(nodegroup.getNodegroupArn(), NODEGROUPARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(nodegroup.getClusterName(), CLUSTERNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(nodegroup.getVersion(), VERSION_BINDING);<NEW_LINE>protocolMarshaller.marshall(nodegroup.getReleaseVersion(), RELEASEVERSION_BINDING);<NEW_LINE>protocolMarshaller.marshall(nodegroup.getCreatedAt(), CREATEDAT_BINDING);<NEW_LINE>protocolMarshaller.marshall(nodegroup.getModifiedAt(), MODIFIEDAT_BINDING);<NEW_LINE>protocolMarshaller.marshall(nodegroup.getStatus(), STATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(nodegroup.getCapacityType(), CAPACITYTYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(nodegroup.getScalingConfig(), SCALINGCONFIG_BINDING);<NEW_LINE>protocolMarshaller.marshall(nodegroup.getInstanceTypes(), INSTANCETYPES_BINDING);<NEW_LINE>protocolMarshaller.marshall(nodegroup.getSubnets(), SUBNETS_BINDING);<NEW_LINE>protocolMarshaller.marshall(nodegroup.getRemoteAccess(), REMOTEACCESS_BINDING);<NEW_LINE>protocolMarshaller.marshall(nodegroup.getAmiType(), AMITYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(nodegroup.getNodeRole(), NODEROLE_BINDING);<NEW_LINE>protocolMarshaller.marshall(nodegroup.getLabels(), LABELS_BINDING);<NEW_LINE>protocolMarshaller.marshall(nodegroup.getTaints(), TAINTS_BINDING);<NEW_LINE>protocolMarshaller.marshall(nodegroup.getResources(), RESOURCES_BINDING);<NEW_LINE>protocolMarshaller.marshall(nodegroup.getDiskSize(), DISKSIZE_BINDING);<NEW_LINE>protocolMarshaller.marshall(nodegroup.getHealth(), HEALTH_BINDING);<NEW_LINE>protocolMarshaller.marshall(nodegroup.getUpdateConfig(), UPDATECONFIG_BINDING);<NEW_LINE>protocolMarshaller.marshall(nodegroup.getLaunchTemplate(), LAUNCHTEMPLATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(nodegroup.getTags(), TAGS_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | nodegroup.getNodegroupName(), NODEGROUPNAME_BINDING); |
1,464,092 | protected JasperData processReport(File reportFile) {<NEW_LINE>log.info("reportFile.getAbsolutePath() = " + reportFile.getAbsolutePath());<NEW_LINE>JasperReport jasperReport = null;<NEW_LINE>String jasperName = reportFile.getName();<NEW_LINE>int pos = jasperName.indexOf('.');<NEW_LINE>if (pos != -1)<NEW_LINE>jasperName = jasperName.substring(0, pos);<NEW_LINE><MASK><NEW_LINE>// test if the compiled report exists<NEW_LINE>File jasperFile = new File(reportDir.getAbsolutePath(), jasperName + ".jasper");<NEW_LINE>if (jasperFile.exists()) {<NEW_LINE>// test time<NEW_LINE>if (reportFile.lastModified() == jasperFile.lastModified()) {<NEW_LINE>log.info(" no need to compile use " + jasperFile.getAbsolutePath());<NEW_LINE>try {<NEW_LINE>jasperReport = (JasperReport) JRLoader.loadObject(jasperFile);<NEW_LINE>} catch (JRException e) {<NEW_LINE>log.severe("Can not load report - " + e.getMessage());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>jasperReport = compileReport(reportFile, jasperFile);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// create new jasper file<NEW_LINE>jasperReport = compileReport(reportFile, jasperFile);<NEW_LINE>}<NEW_LINE>return new JasperData(jasperReport, reportDir, jasperName, jasperFile);<NEW_LINE>} | File reportDir = reportFile.getParentFile(); |
1,018,865 | public ListConstraintsForPortfolioResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ListConstraintsForPortfolioResult listConstraintsForPortfolioResult = new ListConstraintsForPortfolioResult();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return listConstraintsForPortfolioResult;<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("ConstraintDetails", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listConstraintsForPortfolioResult.setConstraintDetails(new ListUnmarshaller<ConstraintDetail>(ConstraintDetailJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("NextPageToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listConstraintsForPortfolioResult.setNextPageToken(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 listConstraintsForPortfolioResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,501,920 | public static String createJdbcXmlResultEx(Statement statement, boolean makeUpperCased) throws SQLException, ParserConfigurationException {<NEW_LINE>DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();<NEW_LINE>DocumentBuilder builder = factory.newDocumentBuilder();<NEW_LINE>org.w3c.dom.Document xmlDocumentResult = builder.newDocument();<NEW_LINE>Element resultsElement = xmlDocumentResult.createElement("Results");<NEW_LINE>xmlDocumentResult.appendChild(resultsElement);<NEW_LINE>if (statement != null) {<NEW_LINE>try (ResultSet resultSet = statement.getResultSet()) {<NEW_LINE>if (resultSet != null) {<NEW_LINE>resultSet.<MASK><NEW_LINE>xmlDocumentResult = addResultSetXmlPart(resultsElement, resultSet, xmlDocumentResult, makeUpperCased);<NEW_LINE>while (statement.getMoreResults()) {<NEW_LINE>try (ResultSet moreResults = statement.getResultSet()) {<NEW_LINE>xmlDocumentResult = addResultSetXmlPart(resultsElement, moreResults, xmlDocumentResult, makeUpperCased);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Element errorElement = xmlDocumentResult.createElement("UpdateCount");<NEW_LINE>errorElement.appendChild(xmlDocumentResult.createTextNode(String.valueOf(statement.getUpdateCount())));<NEW_LINE>resultsElement.appendChild(errorElement);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>StringWriter out = new StringWriter();<NEW_LINE>OutputFormat outputFormat = new OutputFormat(xmlDocumentResult);<NEW_LINE>outputFormat.setOmitComments(true);<NEW_LINE>outputFormat.setOmitDocumentType(true);<NEW_LINE>outputFormat.setOmitXMLDeclaration(true);<NEW_LINE>// outputFormat.setLineSeparator( "\n" );<NEW_LINE>// add this line //<NEW_LINE>// outputFormat.setPreserveSpace( true );<NEW_LINE>outputFormat.setIndent(3);<NEW_LINE>outputFormat.setIndenting(true);<NEW_LINE>try {<NEW_LINE>XMLSerializer serializer = new XMLSerializer(new PrintWriter(out), outputFormat);<NEW_LINE>serializer.asDOMSerializer();<NEW_LINE>serializer.serialize(xmlDocumentResult);<NEW_LINE>} catch (IOException e) {<NEW_LINE>SoapUI.logError(e);<NEW_LINE>}<NEW_LINE>return out.toString();<NEW_LINE>} | setFetchSize(statement.getFetchSize()); |
1,776,773 | public boolean onOptionsItemSelected(MenuItem item) {<NEW_LINE>Uri.Builder urlBuilder = IntentUtils.createBaseUriForRepo(mRepoOwner, mRepoName).appendPath("blob").appendPath(mRef);<NEW_LINE>for (String element : mPath.split("\\/")) {<NEW_LINE>urlBuilder.appendPath(element);<NEW_LINE>}<NEW_LINE>Uri url = urlBuilder.build();<NEW_LINE>switch(item.getItemId()) {<NEW_LINE>case R.id.browser:<NEW_LINE>IntentUtils.launchBrowser(this, url);<NEW_LINE>return true;<NEW_LINE>case R.id.download:<NEW_LINE>DownloadUtils.enqueueDownloadWithPermissionCheck(this, buildRawFileUrl(), FileUtils.getMimeTypeFor(mPath), FileUtils.getFileName(mPath), null);<NEW_LINE>return true;<NEW_LINE>case R.id.share:<NEW_LINE>IntentUtils.share(this, getString(R.string.share_file_subject, FileUtils.getFileName(mPath), mRepoOwner + "/" + mRepoName), url);<NEW_LINE>return true;<NEW_LINE>case MENU_ITEM_HISTORY:<NEW_LINE>startActivity(CommitHistoryActivity.makeIntent(this, mRepoOwner, mRepoName<MASK><NEW_LINE>return true;<NEW_LINE>case R.id.view_raw:<NEW_LINE>mViewRawText = !mViewRawText;<NEW_LINE>item.setChecked(mViewRawText);<NEW_LINE>onRefresh();<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return super.onOptionsItemSelected(item);<NEW_LINE>} | , mRef, mPath, false)); |
1,735,394 | private void waitingLoop() {<NEW_LINE>try {<NEW_LINE>while (true) {<NEW_LINE>// underlying work-queue is shutting down, quit the loop.<NEW_LINE>if (super.isShuttingDown()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// peek the first item from the delay queue<NEW_LINE>WaitForEntry<T> entry = delayQueue.peek();<NEW_LINE>// default next ready-at time to "never"<NEW_LINE>Duration nextReadyAt = heartBeatInterval;<NEW_LINE>if (entry != null) {<NEW_LINE>// the delay-queue isn't empty, so we deal with the item in the following logic:<NEW_LINE>// 1. check if the item is ready to fire<NEW_LINE>// a. if ready, remove it from the delay-queue and push it into underlying<NEW_LINE>// work-queue<NEW_LINE>// b. if not, refresh the next ready-at time.<NEW_LINE>Instant now = this.timeSource.get();<NEW_LINE>if (!Duration.between(entry.readyAtMillis, now).isNegative()) {<NEW_LINE>delayQueue.remove(entry);<NEW_LINE>super.add(entry.data);<NEW_LINE>this.waitingEntryByData.remove(entry.data);<NEW_LINE>continue;<NEW_LINE>} else {<NEW_LINE>nextReadyAt = Duration.between(now, entry.readyAtMillis);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>WaitForEntry<T> waitForEntry = waitingForAddQueue.poll(nextReadyAt.<MASK><NEW_LINE>if (waitForEntry != null) {<NEW_LINE>if (Duration.between(waitForEntry.readyAtMillis, this.timeSource.get()).isNegative()) {<NEW_LINE>// the item is not yet ready, insert it to the delay-queue<NEW_LINE>insert(this.delayQueue, this.waitingEntryByData, waitForEntry);<NEW_LINE>} else {<NEW_LINE>// the item is ready as soon as received, fire it to the work-queue directly<NEW_LINE>super.add(waitForEntry.data);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>// empty block<NEW_LINE>}<NEW_LINE>} | toMillis(), TimeUnit.MILLISECONDS); |
387,201 | private void printStaticFieldFullDeclaration(VariableDeclarationFragment fragment) {<NEW_LINE>VariableElement var = fragment.getVariableElement();<NEW_LINE>boolean isVolatile = ElementUtil.isVolatile(var);<NEW_LINE>String objcType = nameTable.getObjCType(var.asType());<NEW_LINE>String objcTypePadded = objcType + (objcType.endsWith("*") ? "" : " ");<NEW_LINE>String declType = getDeclarationType(var);<NEW_LINE>declType += (declType.endsWith("*") ? "" : " ");<NEW_LINE>String name = nameTable.getVariableShortName(var);<NEW_LINE>boolean isFinal = ElementUtil.isFinal(var);<NEW_LINE>boolean isPrimitive = var.asType().getKind().isPrimitive();<NEW_LINE>boolean isConstant = ElementUtil.isPrimitiveConstant(var);<NEW_LINE>String qualifiers = isConstant ? "_CONSTANT" : (isPrimitive ? "_PRIMITIVE" : "_OBJ") + (isVolatile ? "_VOLATILE" : "") + (isFinal ? "_FINAL" : "");<NEW_LINE>newline();<NEW_LINE>FieldDeclaration decl = (FieldDeclaration) fragment.getParent();<NEW_LINE>JavadocGenerator.printDocComment(getBuilder(), decl.getJavadoc());<NEW_LINE>printf("inline %s%s_get_%s(void);\n", objcTypePadded, typeName, name);<NEW_LINE>if (!isFinal) {<NEW_LINE>printf("inline %s%s_set_%s(%svalue);\n", objcTypePadded, typeName, name, objcTypePadded);<NEW_LINE>if (isPrimitive && !isVolatile) {<NEW_LINE>printf("inline %s *%s_getRef_%s(void);\n", objcType, typeName, name);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (isConstant) {<NEW_LINE>Object value = var.getConstantValue();<NEW_LINE>assert value != null;<NEW_LINE>printf("#define %s_%s %s\n", typeName, name<MASK><NEW_LINE>} else {<NEW_LINE>printStaticFieldDeclaration(fragment, UnicodeUtils.format("%s%s_%s", declType, typeName, name));<NEW_LINE>}<NEW_LINE>printf("J2OBJC_STATIC_FIELD%s(%s, %s, %s)\n", qualifiers, typeName, name, objcType);<NEW_LINE>} | , LiteralGenerator.generate(value)); |
1,732,325 | private static Pair<String, String> preIndexedRRX(final long offset, final ITranslationEnvironment environment, final List<ReilInstruction> instructions, final String registerNodeValue1, final String registerNodeValue2) {<NEW_LINE>final String address = environment.getNextVariableString();<NEW_LINE>final String index = environment.getNextVariableString();<NEW_LINE>final String tmpVar = environment.getNextVariableString();<NEW_LINE>final String tmpVar1 = environment.getNextVariableString();<NEW_LINE>final String tmpVar2 = environment.getNextVariableString();<NEW_LINE>final String tmpVar3 = environment.getNextVariableString();<NEW_LINE>long baseOffset = offset;<NEW_LINE>instructions.add(ReilHelpers.createBsh(baseOffset++, bt, "C", wd, String.valueOf(31), dw, tmpVar1));<NEW_LINE>instructions.add(ReilHelpers.createBsh(baseOffset++, dw, registerNodeValue2, bt, String.valueOf(-1), dw, tmpVar2));<NEW_LINE>instructions.add(ReilHelpers.createOr(baseOffset++, dw, tmpVar1, dw, tmpVar2, dw, tmpVar3));<NEW_LINE>instructions.add(ReilHelpers.createAnd(baseOffset++, dw, tmpVar3, dw, dWordBitMask, dw, index));<NEW_LINE>instructions.add(ReilHelpers.createAdd(baseOffset++, dw, registerNodeValue1, dw, index, dw, tmpVar));<NEW_LINE>instructions.add(ReilHelpers.createAnd(baseOffset++, dw, tmpVar, dw, dWordBitMask, dw, address));<NEW_LINE>instructions.add(ReilHelpers.createStr(baseOffset++, dw<MASK><NEW_LINE>return new Pair<String, String>(address, registerNodeValue1);<NEW_LINE>} | , address, dw, registerNodeValue1)); |
655,182 | private boolean runReadyJob(final ExecutableNode node) throws IOException {<NEW_LINE>if (Status.isStatusFinished(node.getStatus()) || Status.isStatusRunning(node.getStatus())) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>final Status nextNodeStatus = getImpliedStatus(node);<NEW_LINE>if (nextNodeStatus == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (nextNodeStatus == Status.CANCELLED) {<NEW_LINE>// if node is root flow<NEW_LINE>if (node instanceof ExecutableFlow && node.getParentFlow() == null) {<NEW_LINE>this.logger.info(String.format("Flow '%s' was cancelled before execution had started.", node.getId()));<NEW_LINE>finalizeFlow((ExecutableFlow) node);<NEW_LINE>} else {<NEW_LINE>this.logger.info(String.format("Cancelling '%s' due to prior errors.", node.getNestedId()));<NEW_LINE>node.cancelNode(System.currentTimeMillis());<NEW_LINE>finishExecutableNode(node);<NEW_LINE>}<NEW_LINE>} else if (nextNodeStatus == Status.SKIPPED) {<NEW_LINE>this.logger.info("Skipping disabled job '" + node.getId() + "'.");<NEW_LINE>node.<MASK><NEW_LINE>finishExecutableNode(node);<NEW_LINE>} else if (nextNodeStatus == Status.READY) {<NEW_LINE>if (node instanceof ExecutableFlowBase) {<NEW_LINE>final ExecutableFlowBase flow = ((ExecutableFlowBase) node);<NEW_LINE>this.logger.info("Running flow '" + flow.getNestedId() + "'.");<NEW_LINE>flow.setStatus(Status.RUNNING);<NEW_LINE>// don't overwrite start time of root flows<NEW_LINE>if (flow.getStartTime() <= 0) {<NEW_LINE>flow.setStartTime(System.currentTimeMillis());<NEW_LINE>}<NEW_LINE>prepareJobProperties(flow);<NEW_LINE>for (final String startNodeId : ((ExecutableFlowBase) node).getStartNodes()) {<NEW_LINE>final ExecutableNode startNode = flow.getExecutableNode(startNodeId);<NEW_LINE>runReadyJob(startNode);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>runExecutableNode(node);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | skipNode(System.currentTimeMillis()); |
1,122,684 | public void generateTicketPdf(@PathVariable("eventName") String eventName, @PathVariable("ticketIdentifier") String ticketIdentifier, HttpServletResponse response) {<NEW_LINE>ticketReservationManager.fetchCompleteAndAssigned(eventName, ticketIdentifier).ifPresentOrElse(data -> {<NEW_LINE>Ticket ticket = data.getRight();<NEW_LINE>Event event = data.getLeft();<NEW_LINE>TicketReservation ticketReservation = data.getMiddle();<NEW_LINE>response.setContentType(MediaType.APPLICATION_PDF_VALUE);<NEW_LINE>response.addHeader("Content-Disposition", "attachment; filename=ticket-" + ticketIdentifier + ".pdf");<NEW_LINE>try (OutputStream os = response.getOutputStream()) {<NEW_LINE>TicketCategory ticketCategory = ticketCategoryRepository.getByIdAndActive(ticket.getCategoryId(), event.getId());<NEW_LINE>Organization organization = organizationRepository.<MASK><NEW_LINE>String reservationID = ticketReservationManager.getShortReservationID(event, ticketReservation);<NEW_LINE>var ticketWithMetadata = TicketWithMetadataAttributes.build(ticket, ticketRepository.getTicketMetadata(ticket.getId()));<NEW_LINE>TemplateProcessor.renderPDFTicket(LocaleUtil.getTicketLanguage(ticket, LocaleUtil.forLanguageTag(ticketReservation.getUserLanguage(), event)), event, ticketReservation, ticketWithMetadata, ticketCategory, organization, templateManager, fileUploadManager, reservationID, os, ticketHelper.buildRetrieveFieldValuesFunction(), extensionManager);<NEW_LINE>} catch (IOException ioe) {<NEW_LINE>throw new IllegalStateException(ioe);<NEW_LINE>}<NEW_LINE>}, () -> {<NEW_LINE>try {<NEW_LINE>response.sendError(HttpServletResponse.SC_FORBIDDEN);<NEW_LINE>} catch (IOException ioe) {<NEW_LINE>throw new IllegalStateException(ioe);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | getById(event.getOrganizationId()); |
1,471,465 | protected static void collectData(int numberOfVotes, int numberOfSamples, int ratioMin, int ratioMax, String fileName) {<NEW_LINE>String testName = "insufficient_noise";<NEW_LINE>String algorithmType = "bounded_mean";<NEW_LINE>String expected = "0";<NEW_LINE>String numDatasets = "22";<NEW_LINE>String numSamples = Integer.toString(numberOfSamples);<NEW_LINE>String time = "null";<NEW_LINE>SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss");<NEW_LINE>PrintWriter pw = null;<NEW_LINE>try {<NEW_LINE>pw = new PrintWriter(new File("../results/" + fileName));<NEW_LINE>} catch (FileNotFoundException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>StringBuilder builder = new StringBuilder();<NEW_LINE>Timestamp timestamp = new Timestamp(System.currentTimeMillis());<NEW_LINE>builder.<MASK><NEW_LINE>String columnNamesList = "test_name,algorithm,expected,actual,ratio,num_datasets,num_samples,time(sec)";<NEW_LINE>builder.append(columnNamesList + "\n");<NEW_LINE>for (int i = ratioMin; i <= ratioMax; i++) {<NEW_LINE>String r = Integer.toString(i);<NEW_LINE>String Outcome = Integer.toString(getOverallOutcome(numberOfSamples, r, numberOfVotes));<NEW_LINE>builder.append(testName + "," + algorithmType + "," + expected + "," + Outcome + "," + r + "," + numDatasets + "," + numSamples + "," + time);<NEW_LINE>builder.append('\n');<NEW_LINE>}<NEW_LINE>pw.write(builder.toString());<NEW_LINE>pw.close();<NEW_LINE>} | append("Results run on: " + timestamp + "\n"); |
1,051,363 | public Tuple4<DataSet<Tuple2<Long, MT>>, DataSet<Tuple2<Long, DT>>, ApsContext, BatchOperator[]> persistentAll(DataSet<Tuple2<Long, MT>> model, DataSet<Tuple2<Long, DT>> data, ApsContext context, BatchOperator[] others, String prefix) {<NEW_LINE>if (available()) {<NEW_LINE>TypeInformation<DT> dtType = (null == data) ? null : ((TupleTypeInfo<Tuple2<Long, DT>>) data.getType()).getTypeAt(1);<NEW_LINE>int nOthers = (null == others) ? 0 : others.length;<NEW_LINE>BatchOperator[] inOps = new BatchOperator[nOthers + 3];<NEW_LINE>inOps[0] = apsSerializeModel.serializeModel(model, mlEnvId);<NEW_LINE>inOps[1] = (null == data) ? null : apsSerializeData.serializeData(data, mlEnvId);<NEW_LINE>inOps[2] = (null == context) ? null : context.serialize(mlEnvId);<NEW_LINE>for (int i = 0; i < nOthers; i++) {<NEW_LINE>inOps[3 + i] = others[i];<NEW_LINE>}<NEW_LINE>BatchOperator[] outOps = persistentWithRetry(prefix, inOps);<NEW_LINE>model = (null == outOps[0]) ? null : apsSerializeModel.deserilizeModel(outOps[0], model.getType());<NEW_LINE>data = (null == outOps[1]) ? null : apsSerializeData.deserializeData(outOps[1], dtType);<NEW_LINE>context = (null == outOps[2]) ? null : ApsContext<MASK><NEW_LINE>BatchOperator[] outOthers = null;<NEW_LINE>if (nOthers > 0) {<NEW_LINE>outOthers = new BatchOperator[nOthers];<NEW_LINE>for (int i = 0; i < nOthers; i++) {<NEW_LINE>outOthers[i] = outOps[3 + i];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new Tuple4<>(model, data, context, outOthers);<NEW_LINE>} else {<NEW_LINE>return new Tuple4<>(model, data, context, others);<NEW_LINE>}<NEW_LINE>} | .deserilize(outOps[2]); |
113,891 | protected void paintComponent(Graphics g) {<NEW_LINE>final Insets i = getInsets();<NEW_LINE>final Rectangle r = getBounds();<NEW_LINE>final int width = r.width - i.left - i.right;<NEW_LINE>final int height = r.height - i.top - i.bottom;<NEW_LINE>g.setColor(Color.WHITE);<NEW_LINE>g.fillRect(i.left, <MASK><NEW_LINE>g.setColor(myColor);<NEW_LINE>g.fillRect(i.left, i.top, width, height);<NEW_LINE>g.setColor(Color.BLACK);<NEW_LINE>g.drawRect(i.left, i.top, width - JBUI.scale(1), height - JBUI.scale(1));<NEW_LINE>g.setColor(Color.WHITE);<NEW_LINE>g.drawRect(i.left + JBUI.scale(1), i.top + JBUI.scale(1), width - JBUI.scale(3), height - JBUI.scale(3));<NEW_LINE>} | i.top, width, height); |
390,438 | public void marshall(MitigationActionParams mitigationActionParams, AwsJsonWriter jsonWriter) throws Exception {<NEW_LINE>jsonWriter.beginObject();<NEW_LINE>if (mitigationActionParams.getUpdateDeviceCertificateParams() != null) {<NEW_LINE>UpdateDeviceCertificateParams updateDeviceCertificateParams = mitigationActionParams.getUpdateDeviceCertificateParams();<NEW_LINE>jsonWriter.name("updateDeviceCertificateParams");<NEW_LINE>UpdateDeviceCertificateParamsJsonMarshaller.getInstance().marshall(updateDeviceCertificateParams, jsonWriter);<NEW_LINE>}<NEW_LINE>if (mitigationActionParams.getUpdateCACertificateParams() != null) {<NEW_LINE>UpdateCACertificateParams updateCACertificateParams = mitigationActionParams.getUpdateCACertificateParams();<NEW_LINE>jsonWriter.name("updateCACertificateParams");<NEW_LINE>UpdateCACertificateParamsJsonMarshaller.getInstance().marshall(updateCACertificateParams, jsonWriter);<NEW_LINE>}<NEW_LINE>if (mitigationActionParams.getAddThingsToThingGroupParams() != null) {<NEW_LINE>AddThingsToThingGroupParams addThingsToThingGroupParams = mitigationActionParams.getAddThingsToThingGroupParams();<NEW_LINE>jsonWriter.name("addThingsToThingGroupParams");<NEW_LINE>AddThingsToThingGroupParamsJsonMarshaller.getInstance().marshall(addThingsToThingGroupParams, jsonWriter);<NEW_LINE>}<NEW_LINE>if (mitigationActionParams.getReplaceDefaultPolicyVersionParams() != null) {<NEW_LINE>ReplaceDefaultPolicyVersionParams replaceDefaultPolicyVersionParams = mitigationActionParams.getReplaceDefaultPolicyVersionParams();<NEW_LINE>jsonWriter.name("replaceDefaultPolicyVersionParams");<NEW_LINE>ReplaceDefaultPolicyVersionParamsJsonMarshaller.getInstance().marshall(replaceDefaultPolicyVersionParams, jsonWriter);<NEW_LINE>}<NEW_LINE>if (mitigationActionParams.getEnableIoTLoggingParams() != null) {<NEW_LINE>EnableIoTLoggingParams enableIoTLoggingParams = mitigationActionParams.getEnableIoTLoggingParams();<NEW_LINE>jsonWriter.name("enableIoTLoggingParams");<NEW_LINE>EnableIoTLoggingParamsJsonMarshaller.getInstance().marshall(enableIoTLoggingParams, jsonWriter);<NEW_LINE>}<NEW_LINE>if (mitigationActionParams.getPublishFindingToSnsParams() != null) {<NEW_LINE>PublishFindingToSnsParams publishFindingToSnsParams = mitigationActionParams.getPublishFindingToSnsParams();<NEW_LINE>jsonWriter.name("publishFindingToSnsParams");<NEW_LINE>PublishFindingToSnsParamsJsonMarshaller.getInstance(<MASK><NEW_LINE>}<NEW_LINE>jsonWriter.endObject();<NEW_LINE>} | ).marshall(publishFindingToSnsParams, jsonWriter); |
90,845 | private boolean testForExactMatch(final SplitHunk splitHunk, final SplitHunk originalHunk) {<NEW_LINE>final int offset = splitHunk.getContextBefore().size();<NEW_LINE>final List<BeforeAfter<List<String>>> steps = splitHunk.getPatchSteps();<NEW_LINE>if (splitHunk.isInsertion()) {<NEW_LINE>final boolean emptyFile = myLines.isEmpty() || myLines.size() == 1 && myLines.get(0).trim<MASK><NEW_LINE>if (emptyFile) {<NEW_LINE>myNotBound.add(splitHunk);<NEW_LINE>}<NEW_LINE>return emptyFile;<NEW_LINE>}<NEW_LINE>int idx = splitHunk.getStartLineBefore() + offset;<NEW_LINE>int cnt = 0;<NEW_LINE>boolean hadAlreadyApplied = false;<NEW_LINE>for (BeforeAfter<List<String>> step : steps) {<NEW_LINE>if (myLines.size() <= idx)<NEW_LINE>return false;<NEW_LINE>// can occur only in the end<NEW_LINE>if (step.getBefore().isEmpty())<NEW_LINE>continue;<NEW_LINE>final Pair<Integer, Boolean> distance = new FragmentMatcher(idx + cnt, step).find(false);<NEW_LINE>if (distance.getFirst() > 0) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// fits!<NEW_LINE>int length;<NEW_LINE>if (distance.getSecond()) {<NEW_LINE>length = step.getBefore().size();<NEW_LINE>} else {<NEW_LINE>length = step.getAfter().size();<NEW_LINE>hadAlreadyApplied = true;<NEW_LINE>}<NEW_LINE>cnt += length;<NEW_LINE>// idx += length - 1;<NEW_LINE>}<NEW_LINE>putCutIntoTransformations(new TextRange(idx, idx + cnt - 1), originalHunk, new MyAppliedData(splitHunk.getAfterAll(), hadAlreadyApplied, true, true, ChangeType.REPLACE), new IntPair(originalHunk.getContextBefore().size() - splitHunk.getContextBefore().size(), originalHunk.getContextAfter().size() - splitHunk.getContextAfter().size()));<NEW_LINE>return true;<NEW_LINE>} | ().length() == 0; |
729,955 | void renderMarker(Canvas canvas, Paint paint, float opacity, RNSVGMarkerPosition position, float strokeWidth) {<NEW_LINE>int count = saveAndSetupCanvas(canvas, mCTM);<NEW_LINE>markerTransform.reset();<NEW_LINE>Point origin = position.origin;<NEW_LINE>markerTransform.setTranslate((float) origin.x * mScale, (float) origin.y * mScale);<NEW_LINE>double markerAngle = "auto".equals(mOrient) ? -1 : Double.parseDouble(mOrient);<NEW_LINE>float degrees = 180 + (float) (markerAngle == -1 ? position.angle : markerAngle);<NEW_LINE>markerTransform.preRotate(degrees);<NEW_LINE>boolean useStrokeWidth = "strokeWidth".equals(mMarkerUnits);<NEW_LINE>if (useStrokeWidth) {<NEW_LINE>markerTransform.preScale(strokeWidth, strokeWidth);<NEW_LINE>}<NEW_LINE>double width = relativeOnWidth(mMarkerWidth) / mScale;<NEW_LINE>double height = relativeOnHeight(mMarkerHeight) / mScale;<NEW_LINE>RectF eRect = new RectF(0, 0, (float) width, (float) height);<NEW_LINE>if (mAlign != null) {<NEW_LINE>RectF vbRect = new RectF(mMinX * mScale, mMinY * mScale, (mMinX + mVbWidth) * mScale, (mMinY + mVbHeight) * mScale);<NEW_LINE>Matrix viewBoxMatrix = ViewBox.getTransform(<MASK><NEW_LINE>float[] values = new float[9];<NEW_LINE>viewBoxMatrix.getValues(values);<NEW_LINE>markerTransform.preScale(values[Matrix.MSCALE_X], values[Matrix.MSCALE_Y]);<NEW_LINE>}<NEW_LINE>double x = relativeOnWidth(mRefX);<NEW_LINE>double y = relativeOnHeight(mRefY);<NEW_LINE>markerTransform.preTranslate((float) -x, (float) -y);<NEW_LINE>canvas.concat(markerTransform);<NEW_LINE>drawGroup(canvas, paint, opacity);<NEW_LINE>restoreCanvas(canvas, count);<NEW_LINE>} | vbRect, eRect, mAlign, mMeetOrSlice); |
779,451 | public SegmentRecord storage2Entity(final Convert2Entity converter) {<NEW_LINE>SegmentRecord record = new SegmentRecord();<NEW_LINE>record.setSegmentId((String) converter.get(SEGMENT_ID));<NEW_LINE>record.setTraceId((String) converter.get(TRACE_ID));<NEW_LINE>record.setServiceId((String) converter.get(SERVICE_ID));<NEW_LINE>record.setServiceInstanceId((String) converter.get(SERVICE_INSTANCE_ID));<NEW_LINE>record.setEndpointId((String) converter.get(ENDPOINT_ID));<NEW_LINE>record.setStartTime(((Number) converter.get(START_TIME)).longValue());<NEW_LINE>record.setLatency(((Number) converter.get(LATENCY)).intValue());<NEW_LINE>record.setIsError(((Number) converter.get(IS_ERROR)).intValue());<NEW_LINE>record.setTimeBucket(((Number) converter.get(TIME_BUCKET)).longValue());<NEW_LINE>record.setDataBinary(converter.getWith(DATA_BINARY, HashMapConverter<MASK><NEW_LINE>// Don't read the tags as they have been in the data binary already.<NEW_LINE>return record;<NEW_LINE>} | .ToEntity.Base64Decoder.INSTANCE)); |
1,624,843 | protected Bundle doInBackground(Bundle... params) {<NEW_LINE>String verifier = params[0].getString(PARAM_VERIFIER);<NEW_LINE>Bundle result = new Bundle();<NEW_LINE>HttpsURLConnection httpsURLConnection = null;<NEW_LINE>try {<NEW_LINE>String tokenURLString = LINKEDIN_TOKEN + "&code=" + verifier + "&redirect_uri=" + mRedirectURL + "&client_id=" + mConsumerKey + "&client_secret=" + mConsumerSecret;<NEW_LINE>URL url = new URL(tokenURLString);<NEW_LINE>httpsURLConnection = (HttpsURLConnection) url.openConnection();<NEW_LINE>httpsURLConnection.setRequestMethod("POST");<NEW_LINE>String response = streamToString(httpsURLConnection.getInputStream());<NEW_LINE>JSONObject jsonObject = (JSONObject) new JSONTokener(response).nextValue();<NEW_LINE>String accessToken = jsonObject.getString("access_token");<NEW_LINE>int expiresIn = jsonObject.getInt("expires_in");<NEW_LINE>Calendar calendar = Calendar.getInstance();<NEW_LINE>calendar.add(Calendar.SECOND, expiresIn);<NEW_LINE>long expireDate = calendar.getTimeInMillis();<NEW_LINE><MASK><NEW_LINE>result.putString(RESULT_REQUEST_TOKEN, verifier);<NEW_LINE>result.putLong(RESULT_EXPIRES_DATE, expireDate);<NEW_LINE>} catch (Exception e) {<NEW_LINE>String error;<NEW_LINE>if (e == null) {<NEW_LINE>InputStream inputStream = httpsURLConnection.getErrorStream();<NEW_LINE>error = streamToString(inputStream);<NEW_LINE>} else {<NEW_LINE>error = e.getMessage();<NEW_LINE>}<NEW_LINE>result.putString(RESULT_ERROR, error);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | result.putString(RESULT_ACCESS_TOKEN, accessToken); |
773,065 | public void onActivityCreated(Bundle savedInstanceState) {<NEW_LINE>super.onActivityCreated(savedInstanceState);<NEW_LINE>loadButton = getView().findViewById(R.id.adsizes_btn_loadad);<NEW_LINE>cb120x20 = getView().findViewById(R.id.adsizes_cb_120x20);<NEW_LINE>cb320x50 = getView().findViewById(R.id.adsizes_cb_320x50);<NEW_LINE>cb300x250 = getView().findViewById(R.id.adsizes_cb_300x250);<NEW_LINE>adView = getView().findViewById(R.id.adsizes_pav_main);<NEW_LINE>adView.setAdListener(new AdListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onAdLoaded() {<NEW_LINE>adView.setVisibility(View.VISIBLE);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>loadButton.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View view) {<NEW_LINE>if (!cb120x20.isChecked() && !cb320x50.isChecked() && !cb300x250.isChecked()) {<NEW_LINE>Toast.makeText(AdManagerMultipleAdSizesFragment.this.getActivity(), "At least one size is required.", Toast.LENGTH_SHORT).show();<NEW_LINE>} else {<NEW_LINE>List<AdSize> sizeList = new ArrayList<>();<NEW_LINE>if (cb120x20.isChecked()) {<NEW_LINE>sizeList.add(<MASK><NEW_LINE>}<NEW_LINE>if (cb320x50.isChecked()) {<NEW_LINE>sizeList.add(AdSize.BANNER);<NEW_LINE>}<NEW_LINE>if (cb300x250.isChecked()) {<NEW_LINE>sizeList.add(AdSize.MEDIUM_RECTANGLE);<NEW_LINE>}<NEW_LINE>adView.setVisibility(View.INVISIBLE);<NEW_LINE>adView.setAdSizes(sizeList.toArray(new AdSize[sizeList.size()]));<NEW_LINE>adView.loadAd(new AdManagerAdRequest.Builder().build());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | new AdSize(120, 20)); |
406,972 | public boolean onDeadCallback() {<NEW_LINE>GameEvent event = new DeathEvent(this);<NEW_LINE>GameServer.INSTANCE.getEventDispatcher().dispatch(event);<NEW_LINE>reset();<NEW_LINE>// Teleport to spawn point<NEW_LINE>this.getWorld().removeObject(this);<NEW_LINE>this.getWorld().decUpdatable();<NEW_LINE>IServerConfiguration config = GameServer.INSTANCE.getConfig();<NEW_LINE>Random random = new Random();<NEW_LINE>int spawnX = config.getInt("new_user_worldX") + random.nextInt(5);<NEW_LINE>int spawnY = config.getInt("new_user_worldY") + random.nextInt(5);<NEW_LINE>String dimension = config.getString("new_user_dimension");<NEW_LINE>this.setWorld(GameServer.INSTANCE.getGameUniverse().getWorld(spawnX<MASK><NEW_LINE>Point point = this.getWorld().getRandomPassableTile();<NEW_LINE>this.setX(point.x);<NEW_LINE>this.setY(point.y);<NEW_LINE>this.getWorld().addObject(this);<NEW_LINE>this.getWorld().incUpdatable();<NEW_LINE>return true;<NEW_LINE>} | , spawnY, true, dimension)); |
1,303,742 | public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {<NEW_LINE>if (!this.isEnabled()) {<NEW_LINE>sender.sendMessage("This plugin is Disabled!");<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>ArrayList<String> allArgs = new ArrayList<String>(Arrays.asList(args));<NEW_LINE>allArgs.add(<MASK><NEW_LINE>try {<NEW_LINE>return this.commandHandler.locateAndRunCommand(sender, allArgs, getMVConfig().getDisplayPermErrors());<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>sender.sendMessage(ChatColor.RED + "An internal error occurred when attempting to perform this command.");<NEW_LINE>if (sender.isOp())<NEW_LINE>sender.sendMessage(ChatColor.RED + "Details were printed to the server console and logs, please add that to your bug report.");<NEW_LINE>else<NEW_LINE>sender.sendMessage(ChatColor.RED + "Try again and contact the server owner or an admin if this problem persists.");<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>} | 0, command.getName()); |
337,447 | private static ByteSizeValue parse(final String initialInput, final String normalized, final String suffix, ByteSizeUnit unit, final String settingName) {<NEW_LINE>final String s = normalized.substring(0, normalized.length() - suffix.length()).trim();<NEW_LINE>try {<NEW_LINE>try {<NEW_LINE>return new ByteSizeValue(Long.parseLong(s), unit);<NEW_LINE>} catch (final NumberFormatException e) {<NEW_LINE>try {<NEW_LINE>final double doubleValue = Double.parseDouble(s);<NEW_LINE>DeprecationLoggerHolder.deprecationLogger.warn(DeprecationCategory.PARSING, <MASK><NEW_LINE>return new ByteSizeValue((long) (doubleValue * unit.toBytes(1)));<NEW_LINE>} catch (final NumberFormatException ignored) {<NEW_LINE>throw new ElasticsearchParseException("failed to parse setting [{}] with value [{}]", e, settingName, initialInput);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>throw new ElasticsearchParseException("failed to parse setting [{}] with value [{}] as a size in bytes", e, settingName, initialInput);<NEW_LINE>}<NEW_LINE>} | "fractional_byte_values", "Fractional bytes values are deprecated. Use non-fractional bytes values instead: [{}] found for setting [{}]", initialInput, settingName); |
1,557,033 | public UExpression visitIdentifier(IdentifierTree tree, Void v) {<NEW_LINE>Symbol sym = ASTHelpers.getSymbol(tree);<NEW_LINE>if (sym instanceof ClassSymbol) {<NEW_LINE>return UClassIdent.create((ClassSymbol) sym);<NEW_LINE>} else if (sym != null && sym.isStatic()) {<NEW_LINE>return staticMember(sym);<NEW_LINE>} else if (freeVariables.containsKey(tree.getName().toString())) {<NEW_LINE>VarSymbol symbol = freeVariables.get(tree.getName().toString());<NEW_LINE>checkState(symbol == sym);<NEW_LINE>UExpression ident = UFreeIdent.<MASK><NEW_LINE>Matches matches = ASTHelpers.getAnnotation(symbol, Matches.class);<NEW_LINE>if (matches != null) {<NEW_LINE>ident = UMatches.create(getValue(matches), /* positive= */<NEW_LINE>true, ident);<NEW_LINE>}<NEW_LINE>NotMatches notMatches = ASTHelpers.getAnnotation(symbol, NotMatches.class);<NEW_LINE>if (notMatches != null) {<NEW_LINE>ident = UMatches.create(getValue(notMatches), /* positive= */<NEW_LINE>false, ident);<NEW_LINE>}<NEW_LINE>OfKind hasKind = ASTHelpers.getAnnotation(symbol, OfKind.class);<NEW_LINE>if (hasKind != null) {<NEW_LINE>EnumSet<Kind> allowed = EnumSet.copyOf(Arrays.asList(hasKind.value()));<NEW_LINE>ident = UOfKind.create(ident, ImmutableSet.copyOf(allowed));<NEW_LINE>}<NEW_LINE>// @Repeated annotations need to be checked last.<NEW_LINE>Repeated repeated = ASTHelpers.getAnnotation(symbol, Repeated.class);<NEW_LINE>if (repeated != null) {<NEW_LINE>ident = URepeated.create(tree.getName(), ident);<NEW_LINE>}<NEW_LINE>return ident;<NEW_LINE>}<NEW_LINE>if (sym == null) {<NEW_LINE>return UTypeVarIdent.create(tree.getName());<NEW_LINE>}<NEW_LINE>switch(sym.getKind()) {<NEW_LINE>case TYPE_PARAMETER:<NEW_LINE>return UTypeVarIdent.create(tree.getName());<NEW_LINE>default:<NEW_LINE>return ULocalVarIdent.create(tree.getName());<NEW_LINE>}<NEW_LINE>} | create(tree.getName()); |
160,443 | protected CompilationUnitDeclaration endParse(int act) {<NEW_LINE>this.lastAct = act;<NEW_LINE>if (this.statementRecoveryActivated) {<NEW_LINE>RecoveredElement recoveredElement = buildInitialRecoveryState();<NEW_LINE>if (recoveredElement != null) {<NEW_LINE>recoveredElement.topElement().updateParseTree();<NEW_LINE>}<NEW_LINE>if (this.hasError)<NEW_LINE>resetStacks();<NEW_LINE>} else if (this.currentElement != null) {<NEW_LINE>if (VERBOSE_RECOVERY) {<NEW_LINE>System.out.print(Messages.parser_syntaxRecovery);<NEW_LINE>// $NON-NLS-1$<NEW_LINE>System.out.println("--------------------------");<NEW_LINE>System.out.println(this.compilationUnit);<NEW_LINE>// $NON-NLS-1$<NEW_LINE>System.out.println("----------------------------------");<NEW_LINE>}<NEW_LINE>this.currentElement.topElement().updateParseTree();<NEW_LINE>} else {<NEW_LINE>if (this.diet & VERBOSE_RECOVERY) {<NEW_LINE>System.out.print(Messages.parser_regularParse);<NEW_LINE>// $NON-NLS-1$<NEW_LINE>System.out.println("--------------------------");<NEW_LINE>System.<MASK><NEW_LINE>// $NON-NLS-1$<NEW_LINE>System.out.println("----------------------------------");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>persistLineSeparatorPositions();<NEW_LINE>for (int i = 0; i < this.scanner.foundTaskCount; i++) {<NEW_LINE>if (!this.statementRecoveryActivated)<NEW_LINE>problemReporter().task(new String(this.scanner.foundTaskTags[i]), new String(this.scanner.foundTaskMessages[i]), this.scanner.foundTaskPriorities[i] == null ? null : new String(this.scanner.foundTaskPriorities[i]), this.scanner.foundTaskPositions[i][0], this.scanner.foundTaskPositions[i][1]);<NEW_LINE>}<NEW_LINE>this.javadoc = null;<NEW_LINE>return this.compilationUnit;<NEW_LINE>} | out.println(this.compilationUnit); |
651,824 | public BuildRule createBuildRule(BuildRuleCreationContextWithTargetGraph context, BuildTarget buildTarget, BuildRuleParams params, AndroidBuildConfigDescriptionArg args) {<NEW_LINE><MASK><NEW_LINE>if (JavaAbis.isClassAbiTarget(buildTarget)) {<NEW_LINE>BuildTarget configTarget = JavaAbis.getLibraryTarget(buildTarget);<NEW_LINE>BuildRule configRule = graphBuilder.requireRule(configTarget);<NEW_LINE>return CalculateClassAbi.of(buildTarget, graphBuilder, context.getProjectFilesystem(), Objects.requireNonNull(configRule.getSourcePathToOutput()));<NEW_LINE>}<NEW_LINE>return createBuildRule(buildTarget, context.getProjectFilesystem(), params, args.getPackage(), args.getValues(), args.getValuesFile(), /* useConstantExpressions */<NEW_LINE>false, javacFactory.create(graphBuilder, null, buildTarget.getTargetConfiguration()), context.getToolchainProvider().getByName(JavacOptionsProvider.DEFAULT_NAME, buildTarget.getTargetConfiguration(), JavacOptionsProvider.class).getJavacOptions(), graphBuilder);<NEW_LINE>} | ActionGraphBuilder graphBuilder = context.getActionGraphBuilder(); |
1,496,638 | private boolean isEntityExists(TenantId tenantId, EntityId entityId) throws ThingsboardException {<NEW_LINE>switch(entityId.getEntityType()) {<NEW_LINE>case DEVICE:<NEW_LINE>return deviceService.findDeviceById(tenantId, new DeviceId(entityId.getId())) != null;<NEW_LINE>case ASSET:<NEW_LINE>return assetService.findAssetById(tenantId, new AssetId(entityId.getId())) != null;<NEW_LINE>case ENTITY_VIEW:<NEW_LINE>return entityViewService.findEntityViewById(tenantId, new EntityViewId(entityId.getId())) != null;<NEW_LINE>case CUSTOMER:<NEW_LINE>return customerService.findCustomerById(tenantId, new CustomerId(entityId.getId())) != null;<NEW_LINE>case USER:<NEW_LINE>return userService.findUserById(tenantId, new UserId(entityId<MASK><NEW_LINE>case DASHBOARD:<NEW_LINE>return dashboardService.findDashboardById(tenantId, new DashboardId(entityId.getId())) != null;<NEW_LINE>default:<NEW_LINE>throw new ThingsboardException("Unsupported entity type " + entityId.getEntityType(), ThingsboardErrorCode.INVALID_ARGUMENTS);<NEW_LINE>}<NEW_LINE>} | .getId())) != null; |
1,722,267 | public Flux<MultiValueResponse<HGetCommand, ByteBuffer>> hMGet(Publisher<HGetCommand> commands) {<NEW_LINE>return execute(commands, command -> {<NEW_LINE>Assert.notNull(command.getKey(), "Key must not be null!");<NEW_LINE>Assert.notNull(<MASK><NEW_LINE>byte[] keyBuf = toByteArray(command.getKey());<NEW_LINE>List<Object> args = new ArrayList<Object>(command.getFields().size() + 1);<NEW_LINE>args.add(keyBuf);<NEW_LINE>args.addAll(command.getFields().stream().map(buf -> toByteArray(buf)).collect(Collectors.toList()));<NEW_LINE>Mono<List<byte[]>> m = read(keyBuf, ByteArrayCodec.INSTANCE, HMGET, args.toArray());<NEW_LINE>return m.map(v -> {<NEW_LINE>List<ByteBuffer> values = v.stream().map(array -> {<NEW_LINE>if (array != null) {<NEW_LINE>return ByteBuffer.wrap(array);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>}).collect(Collectors.toList());<NEW_LINE>return new MultiValueResponse<>(command, values);<NEW_LINE>});<NEW_LINE>});<NEW_LINE>} | command.getFields(), "Fields must not be null!"); |
1,271,625 | public static <B extends Message.Builder> B fieldWiseCopy(MessageOrBuilder source, B target) {<NEW_LINE>Descriptor sourceDescriptor = source.getDescriptorForType();<NEW_LINE>Descriptor targetDescriptor = target.getDescriptorForType();<NEW_LINE>if (!AnnotationUtils.sameFhirType(sourceDescriptor, targetDescriptor)) {<NEW_LINE>throw new IllegalArgumentException("Unable to do a fieldwise copy from " + sourceDescriptor.getFullName() + " to " + <MASK><NEW_LINE>}<NEW_LINE>for (FieldDescriptor sourceField : sourceDescriptor.getFields()) {<NEW_LINE>if (!ProtoUtils.fieldIsSet(source, sourceField)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>FieldDescriptor targetField = targetDescriptor.findFieldByName(sourceField.getName());<NEW_LINE>if (targetField == null || sourceField.getType() != targetField.getType()) {<NEW_LINE>throw new IllegalArgumentException("Unable to do a fieldwise copy from " + sourceDescriptor.getFullName() + " to " + targetDescriptor.getFullName() + ". Mismatch for field: " + sourceField.getFullName());<NEW_LINE>}<NEW_LINE>if (sourceField.getType() == FieldDescriptor.Type.MESSAGE) {<NEW_LINE>ProtoUtils.<Message>forEachInstance(source, sourceField, (sourceValue, index) -> fieldWiseCopy(sourceValue, getOrAddBuilder(target, targetField)));<NEW_LINE>} else {<NEW_LINE>target.setField(targetField, source.getField(sourceField));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return target;<NEW_LINE>} | targetDescriptor.getFullName() + ". They are not the same FHIR types."); |
1,543,152 | protected OffsetsEnum createOffsetsEnumFromReader(LeafReader leafReader, int doc) throws IOException {<NEW_LINE>final Terms termsIndex = leafReader.terms(getField());<NEW_LINE>if (termsIndex == null) {<NEW_LINE>return OffsetsEnum.EMPTY;<NEW_LINE>}<NEW_LINE>final List<OffsetsEnum> offsetsEnums = new ArrayList<>();<NEW_LINE>// Handle Weight.matches approach<NEW_LINE>if (components.getHighlightFlags().contains(UnifiedHighlighter.HighlightFlag.WEIGHT_MATCHES)) {<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>// classic approach<NEW_LINE>// Handle position insensitive terms (a subset of this.terms field):<NEW_LINE>final BytesRef[] insensitiveTerms;<NEW_LINE>final PhraseHelper phraseHelper = components.getPhraseHelper();<NEW_LINE>final BytesRef[] terms = components.getTerms();<NEW_LINE>if (phraseHelper.hasPositionSensitivity()) {<NEW_LINE>insensitiveTerms = phraseHelper.getAllPositionInsensitiveTerms();<NEW_LINE>assert insensitiveTerms.length <= terms.length : "insensitive terms should be smaller set of all terms";<NEW_LINE>} else {<NEW_LINE>insensitiveTerms = terms;<NEW_LINE>}<NEW_LINE>if (insensitiveTerms.length > 0) {<NEW_LINE>createOffsetsEnumsForTerms(insensitiveTerms, termsIndex, doc, offsetsEnums);<NEW_LINE>}<NEW_LINE>// Handle spans<NEW_LINE>if (phraseHelper.hasPositionSensitivity()) {<NEW_LINE>phraseHelper.createOffsetsEnumsForSpans(leafReader, doc, offsetsEnums);<NEW_LINE>}<NEW_LINE>// Handle automata<NEW_LINE>if (components.getAutomata().length > 0) {<NEW_LINE>createOffsetsEnumsForAutomata(termsIndex, doc, offsetsEnums);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>switch(offsetsEnums.size()) {<NEW_LINE>case 0:<NEW_LINE>return OffsetsEnum.EMPTY;<NEW_LINE>case 1:<NEW_LINE>return offsetsEnums.get(0);<NEW_LINE>default:<NEW_LINE>return new OffsetsEnum.MultiOffsetsEnum(offsetsEnums);<NEW_LINE>}<NEW_LINE>} | createOffsetsEnumsWeightMatcher(leafReader, doc, offsetsEnums); |
1,852,988 | public String findMessageDestinationName(String mdbName) throws ConfigurationException {<NEW_LINE>// validation<NEW_LINE>if (Utils.strEmpty(mdbName)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>String destinationName = null;<NEW_LINE>try {<NEW_LINE>RootInterface sunDDRoot = getSunDDRoot(false);<NEW_LINE>if (sunDDRoot instanceof SunEjbJar) {<NEW_LINE>SunEjbJar sunEjbJar = (SunEjbJar) sunDDRoot;<NEW_LINE>EnterpriseBeans eb = sunEjbJar.getEnterpriseBeans();<NEW_LINE>if (eb != null) {<NEW_LINE>Ejb ejb = findNamedBean(eb, mdbName, EnterpriseBeans.EJB, Ejb.EJB_NAME);<NEW_LINE>if (ejb != null) {<NEW_LINE>assert mdbName.equals(ejb.getEjbName());<NEW_LINE>destinationName = ejb.getJndiName();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException ex) {<NEW_LINE>// This is a legitimate exception that could occur, such as a problem<NEW_LINE>// writing the changed descriptor to disk.<NEW_LINE>String message = // NOI18N<NEW_LINE>NbBundle.// NOI18N<NEW_LINE>getMessage(// NOI18N<NEW_LINE>GlassfishConfiguration.class, // NOI18N<NEW_LINE>"ERR_ExceptionBindingMdb", ex.getClass().getSimpleName());<NEW_LINE>throw new ConfigurationException(message, ex);<NEW_LINE>} catch (Exception ex) {<NEW_LINE>// This would probably be a runtime exception due to a bug, but we<NEW_LINE>// must trap it here so it doesn't cause trouble upstream.<NEW_LINE>// We handle it the same as above for now.<NEW_LINE>String message = // NOI18N<NEW_LINE>NbBundle.// NOI18N<NEW_LINE>getMessage(// NOI18N<NEW_LINE>GlassfishConfiguration.class, // NOI18N<NEW_LINE>"ERR_ExceptionBindingMdb", ex.<MASK><NEW_LINE>throw new ConfigurationException(message, ex);<NEW_LINE>}<NEW_LINE>return destinationName;<NEW_LINE>} | getClass().getSimpleName()); |
22,378 | protected StateChange waitShutDown() {<NEW_LINE>ShutdownStateListener listener = prepareShutdownMonitoring();<NEW_LINE>if (listener == null) {<NEW_LINE>return new StateChange(this, TaskState.FAILED, TaskEvent.ILLEGAL_STATE, "BasicTask.waitShutDown.listenerError", instanceName);<NEW_LINE>}<NEW_LINE>long start = System.currentTimeMillis();<NEW_LINE>LOGGER.log(Level.FINEST, NbBundle.getMessage(RestartTask.class, "BasicTask.waitShutDown.waitingTime", new Object[] { instanceName, Integer.toString(STOP_TIMEOUT) }));<NEW_LINE>try {<NEW_LINE>synchronized (listener) {<NEW_LINE>while (!listener.isWakeUp() && (System.currentTimeMillis() - start < STOP_TIMEOUT)) {<NEW_LINE>listener.wait(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (InterruptedException ie) {<NEW_LINE>LOGGER.log(Level.INFO, NbBundle.getMessage(RestartTask.class, "BasicTask.waitShutDown.interruptedException", new Object[] { instance.getName(), ie.getLocalizedMessage() }));<NEW_LINE>} finally {<NEW_LINE>GlassFishStatus.removeListener(instance, listener);<NEW_LINE>}<NEW_LINE>LogViewMgr.removeLog(instance);<NEW_LINE>LogViewMgr logger = LogViewMgr.getInstance(instance.getProperty(GlassfishModule.URL_ATTR));<NEW_LINE>logger.stopReaders();<NEW_LINE>if (!listener.isWakeUp()) {<NEW_LINE>return new StateChange(this, TaskState.FAILED, TaskEvent.CMD_FAILED, "BasicTask.waitShutDown.timeout", new String[] { instanceName, Integer.toString(STOP_TIMEOUT) });<NEW_LINE>} else {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | System.currentTimeMillis() - start); |
1,510,610 | public void start(Stage stage) {<NEW_LINE>stage.setTitle("Path Anti-Aliasing Test");<NEW_LINE>Scene scene = new Scene(new <MASK><NEW_LINE>scene.setCamera(new PerspectiveCamera());<NEW_LINE>scene.setFill(Color.BEIGE);<NEW_LINE>Path path = new Path();<NEW_LINE>path.setRotate(40.0F);<NEW_LINE>path.setRotationAxis(Rotate.Y_AXIS);<NEW_LINE>path.setStroke(Color.RED);<NEW_LINE>path.setStrokeWidth(8.0F);<NEW_LINE>path.getElements().clear();<NEW_LINE>path.getElements().addAll(new MoveTo(100.0F, 600.0F), new LineTo(100.0F, 550.0F), new CubicCurveTo(100.0F, 450.0F, 600.0F, 600.0F, 600.0F, 300.0F), new VLineTo(150.0F), new CubicCurveTo(600.0F, 40.0F, 700.0F, 80.0F, 700.0F, 200.0F), new VLineTo(450.0F), new QuadCurveTo(700.0F, 650.0F, 600.0F, 650.0F), new HLineTo(150.0F), new QuadCurveTo(100.0F, 650.0F, 100.0F, 600.0F), new ClosePath());<NEW_LINE>((Group) scene.getRoot()).getChildren().addAll(path);<NEW_LINE>stage.setScene(scene);<NEW_LINE>stage.sizeToScene();<NEW_LINE>if (!Platform.isSupported(ConditionalFeature.SCENE3D)) {<NEW_LINE>System.out.println("*************************************************************");<NEW_LINE>System.out.println("* WARNING: common conditional SCENE3D isn\'t supported *");<NEW_LINE>System.out.println("*************************************************************");<NEW_LINE>}<NEW_LINE>stage.show();<NEW_LINE>} | Group(), 800.0f, 800.0f); |
95,662 | public OSelectStatement copy() {<NEW_LINE>OSelectStatement result = null;<NEW_LINE>try {<NEW_LINE>result = getClass().getConstructor(Integer.TYPE).newInstance(-1);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>result.originalStatement = originalStatement;<NEW_LINE>result.target = target == null ? null : target.copy();<NEW_LINE>result.projection = projection == null ? null : projection.copy();<NEW_LINE>result.whereClause = whereClause == null ? null : whereClause.copy();<NEW_LINE>result.groupBy = groupBy == null ? null : groupBy.copy();<NEW_LINE>result.orderBy = orderBy == null ? null : orderBy.copy();<NEW_LINE>result.unwind = unwind == null ? null : unwind.copy();<NEW_LINE>result.skip = skip == null <MASK><NEW_LINE>result.limit = limit == null ? null : limit.copy();<NEW_LINE>result.lockRecord = lockRecord;<NEW_LINE>result.fetchPlan = fetchPlan == null ? null : fetchPlan.copy();<NEW_LINE>result.letClause = letClause == null ? null : letClause.copy();<NEW_LINE>result.timeout = timeout == null ? null : timeout.copy();<NEW_LINE>result.parallel = parallel;<NEW_LINE>result.noCache = noCache;<NEW_LINE>return result;<NEW_LINE>} | ? null : skip.copy(); |
1,128,946 | public static void migrateOptionalAuthenticationExecution(RealmModel realm, AuthenticationFlowModel parentFlow, AuthenticationExecutionModel optionalExecution, boolean updateOptionalExecution) {<NEW_LINE>LOG.debugf("Migrating optional execution '%s' of flow '%s' of realm '%s' to subflow", optionalExecution.getAuthenticator(), parentFlow.getAlias(), realm.getName());<NEW_LINE>AuthenticationFlowModel conditionalOTP = new AuthenticationFlowModel();<NEW_LINE>conditionalOTP.setTopLevel(false);<NEW_LINE>conditionalOTP.setBuiltIn(parentFlow.isBuiltIn());<NEW_LINE>conditionalOTP.setAlias(parentFlow.getAlias() + " - " + optionalExecution.getAuthenticator() + " - Conditional");<NEW_LINE>conditionalOTP.setDescription("Flow to determine if the " + optionalExecution.getAuthenticator() + " authenticator should be used or not.");<NEW_LINE>conditionalOTP.setProviderId("basic-flow");<NEW_LINE>conditionalOTP = realm.addAuthenticationFlow(conditionalOTP);<NEW_LINE>AuthenticationExecutionModel execution = new AuthenticationExecutionModel();<NEW_LINE>execution.setParentFlow(parentFlow.getId());<NEW_LINE>execution.setRequirement(AuthenticationExecutionModel.Requirement.CONDITIONAL);<NEW_LINE>execution.setFlowId(conditionalOTP.getId());<NEW_LINE>execution.setPriority(optionalExecution.getPriority());<NEW_LINE>execution.setAuthenticatorFlow(true);<NEW_LINE>realm.addAuthenticatorExecution(execution);<NEW_LINE>execution = new AuthenticationExecutionModel();<NEW_LINE>execution.setParentFlow(conditionalOTP.getId());<NEW_LINE>execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);<NEW_LINE>execution.setAuthenticator("conditional-user-configured");<NEW_LINE>execution.setPriority(10);<NEW_LINE>execution.setAuthenticatorFlow(false);<NEW_LINE>realm.addAuthenticatorExecution(execution);<NEW_LINE>// Move optionalExecution as child of newly created parent flow<NEW_LINE>optionalExecution.setParentFlow(conditionalOTP.getId());<NEW_LINE>optionalExecution.<MASK><NEW_LINE>optionalExecution.setPriority(20);<NEW_LINE>// In case of DB migration, we're updating existing execution, which is already in DB.<NEW_LINE>// In case of JSON migration, the execution is not yet in DB and will be added later<NEW_LINE>if (updateOptionalExecution) {<NEW_LINE>realm.updateAuthenticatorExecution(optionalExecution);<NEW_LINE>}<NEW_LINE>} | setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED); |
259,176 | public void checkFields() {<NEW_LINE>warnIncorrectParsingIfBlank(getGeocode(), "geo");<NEW_LINE>warnIncorrectParsingIfBlank(getName(), "name");<NEW_LINE><MASK><NEW_LINE>warnIncorrectParsingIf(getTerrain() == 0.0, "terrain");<NEW_LINE>warnIncorrectParsingIf(getDifficulty() == 0.0, "difficulty");<NEW_LINE>warnIncorrectParsingIfBlank(getOwnerDisplayName(), "owner");<NEW_LINE>warnIncorrectParsingIfBlank(getOwnerUserId(), "owner");<NEW_LINE>warnIncorrectParsingIf(getHiddenDate() == null, "hidden");<NEW_LINE>warnIncorrectParsingIf(getFavoritePoints() < 0, "favoriteCount");<NEW_LINE>warnIncorrectParsingIf(getSize() == CacheSize.UNKNOWN, "size");<NEW_LINE>warnIncorrectParsingIf(getType() == null || getType() == CacheType.UNKNOWN, "type");<NEW_LINE>warnIncorrectParsingIf(getCoords() == null, "coordinates");<NEW_LINE>warnIncorrectParsingIfBlank(getLocation(), "location");<NEW_LINE>} | warnIncorrectParsingIfBlank(getGuid(), "guid"); |
1,321,040 | public void selected(MenuItem menu, Object target) {<NEW_LINE>SimpleTextEntryWindow entryWindow = new SimpleTextEntryWindow("sr_prog.window.title", "sr_prog.window.message");<NEW_LINE>DecimalFormat df = new DecimalFormat("0.000");<NEW_LINE>df.setGroupingUsed(false);<NEW_LINE>df.setMaximumFractionDigits(3);<NEW_LINE>entryWindow.setPreenteredText(df.format(existing_sr / 1000.0f), false);<NEW_LINE>entryWindow.selectPreenteredText(true);<NEW_LINE>entryWindow.setWidthHint(400);<NEW_LINE>entryWindow.prompt(new UIInputReceiverListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void UIInputReceiverClosed(UIInputReceiver receiver) {<NEW_LINE>if (!receiver.hasSubmittedInput()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>String text = receiver<MASK><NEW_LINE>if (text.length() > 0) {<NEW_LINE>float f = DisplayFormatters.parseFloat(df, text);<NEW_LINE>int sr = (int) (f * 1000);<NEW_LINE>COConfigurationManager.setParameter("Share Ratio Progress Interval", sr);<NEW_LINE>}<NEW_LINE>} catch (Throwable e) {<NEW_LINE>MessageBox mb = new MessageBox(Utils.findAnyShell(), SWT.ICON_ERROR | SWT.OK);<NEW_LINE>mb.setText(MessageText.getString("MyTorrentsView.dialog.NumberError.title"));<NEW_LINE>mb.setMessage(MessageText.getString("MyTorrentsView.dialog.NumberError.text"));<NEW_LINE>mb.open();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | .getSubmittedInput().trim(); |
988,303 | public static void postValidateBrew(JReleaserContext context, Errors errors) {<NEW_LINE>Map<String, List<Distribution>> map = context.getModel().getActiveDistributions().stream().filter(d -> d.getBrew().isEnabled()).collect(groupingBy(d -> d.getBrew().getResolvedFormulaName(context)));<NEW_LINE>map.forEach((formulaName, distributions) -> {<NEW_LINE>if (distributions.size() > 1) {<NEW_LINE>errors.configuration(RB.$("validation_brew_duplicate_definition", "brew.formulaName '" + formulaName + "'", distributions.stream().map(Distribution::getName).collect(Collectors.joining(", "))));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>map = context.getModel().getActiveDistributions().stream().filter(d -> d.getBrew().getCask().isEnabled()).collect(groupingBy(d -> d.getBrew().getCask().getResolvedCaskName(context)));<NEW_LINE>map.forEach((caskName, distributions) -> {<NEW_LINE>if (distributions.size() > 1) {<NEW_LINE>errors.configuration(RB.$("validation_brew_duplicate_definition", "brew.cask.name '" + caskName + "'", distributions.stream().map(Distribution::getName).collect(Collectors<MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | .joining(", ")))); |
1,287,887 | private static void resolveInWorkspace(IClasspathEntry classpathEntry, Set<String> classPath, Set<IProject> projectOnCp) {<NEW_LINE>int entryKind = classpathEntry.getEntryKind();<NEW_LINE>switch(entryKind) {<NEW_LINE>case IClasspathEntry.CPE_PROJECT:<NEW_LINE>Set<String> cp = resolveProjectClassPath(<MASK><NEW_LINE>classPath.addAll(cp);<NEW_LINE>break;<NEW_LINE>case IClasspathEntry.CPE_VARIABLE:<NEW_LINE>classpathEntry = JavaCore.getResolvedClasspathEntry(classpathEntry);<NEW_LINE>if (classpathEntry == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// $FALL-THROUGH$<NEW_LINE>case IClasspathEntry.CPE_LIBRARY:<NEW_LINE>String lib = resolveLibrary(classpathEntry.getPath());<NEW_LINE>if (lib != null) {<NEW_LINE>classPath.add(lib);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case IClasspathEntry.CPE_SOURCE:<NEW_LINE>// ???<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} | classpathEntry.getPath(), projectOnCp); |
837,638 | private void loadNode182() {<NEW_LINE>StateTypeNode node = new StateTypeNode(this.context, Identifiers.ProgramStateMachineType_Running, new QualifiedName(0, "Running"), new LocalizedText("en", "Running"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), UByte.valueOf(0));<NEW_LINE>node.addReference(new Reference(Identifiers.ProgramStateMachineType_Running, Identifiers.HasProperty, Identifiers.ProgramStateMachineType_Running_StateNumber<MASK><NEW_LINE>node.addReference(new Reference(Identifiers.ProgramStateMachineType_Running, Identifiers.ToState, Identifiers.ProgramStateMachineType_ReadyToRunning.expanded(), false));<NEW_LINE>node.addReference(new Reference(Identifiers.ProgramStateMachineType_Running, Identifiers.FromState, Identifiers.ProgramStateMachineType_RunningToHalted.expanded(), false));<NEW_LINE>node.addReference(new Reference(Identifiers.ProgramStateMachineType_Running, Identifiers.FromState, Identifiers.ProgramStateMachineType_RunningToReady.expanded(), false));<NEW_LINE>node.addReference(new Reference(Identifiers.ProgramStateMachineType_Running, Identifiers.FromState, Identifiers.ProgramStateMachineType_RunningToSuspended.expanded(), false));<NEW_LINE>node.addReference(new Reference(Identifiers.ProgramStateMachineType_Running, Identifiers.ToState, Identifiers.ProgramStateMachineType_SuspendedToRunning.expanded(), false));<NEW_LINE>node.addReference(new Reference(Identifiers.ProgramStateMachineType_Running, Identifiers.HasTypeDefinition, Identifiers.StateType.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.ProgramStateMachineType_Running, Identifiers.HasComponent, Identifiers.ProgramStateMachineType.expanded(), false));<NEW_LINE>this.nodeManager.addNode(node);<NEW_LINE>} | .expanded(), true)); |
957,597 | public UpdateSecretResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>UpdateSecretResult updateSecretResult = new UpdateSecretResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return updateSecretResult;<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("ARN", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>updateSecretResult.setARN(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("Name", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>updateSecretResult.setName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("VersionId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>updateSecretResult.setVersionId(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 updateSecretResult;<NEW_LINE>} | class).unmarshall(context)); |
205,957 | protected void checkSubProcess(Model model) {<NEW_LINE>String chldModel = model instanceof MetaJsonRecord ? ((MetaJsonRecord) model).getJsonModel() : model.getClass().getSimpleName();<NEW_LINE>List<WkfTaskConfig> taskConfigs = wkfTaskConfigRepository.all().filter("self.callModel = ?1 AND self.callLink IS NOT NULL", chldModel).fetch();<NEW_LINE>if (taskConfigs.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>FullContext modelCtx = WkfContextHelper.create(model);<NEW_LINE>Map<String, Object> ctxMap = ImmutableMap.of(wkfService.getVarName(model), modelCtx);<NEW_LINE>for (WkfTaskConfig taskConfig : taskConfigs) {<NEW_LINE>if (!evalCondition(ctxMap, taskConfig.getCallLinkCondition())) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Object parentModel = modelCtx.get(taskConfig.getCallLink());<NEW_LINE>if (parentModel != null && parentModel instanceof FullContext) {<NEW_LINE>Model parent = (Model) ((FullContext) parentModel).getTarget();<NEW_LINE>if (parent.getProcessInstanceId() != null) {<NEW_LINE>addChildProcessInstanceId(parent.<MASK><NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getProcessInstanceId(), modelCtx, ctxMap); |
1,168,235 | final GetWorkflowRunResult executeGetWorkflowRun(GetWorkflowRunRequest getWorkflowRunRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getWorkflowRunRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<GetWorkflowRunRequest> request = null;<NEW_LINE>Response<GetWorkflowRunResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetWorkflowRunRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getWorkflowRunRequest));<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, "Glue");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetWorkflowRun");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetWorkflowRunResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetWorkflowRunResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
813,459 | public final void sizeFnExpr() throws RecognitionException, TokenStreamException {<NEW_LINE>returnAST = null;<NEW_LINE>ASTPair currentAST = new ASTPair();<NEW_LINE>AST sizeFnExpr_AST = null;<NEW_LINE>AST tmp87_AST = null;<NEW_LINE>tmp87_AST = astFactory<MASK><NEW_LINE>astFactory.addASTChild(currentAST, tmp87_AST);<NEW_LINE>match(AT_SIZE);<NEW_LINE>{<NEW_LINE>switch(LA(1)) {<NEW_LINE>case EQ:<NEW_LINE>{<NEW_LINE>AST tmp88_AST = null;<NEW_LINE>tmp88_AST = astFactory.create(LT(1));<NEW_LINE>astFactory.addASTChild(currentAST, tmp88_AST);<NEW_LINE>match(EQ);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case NE:<NEW_LINE>{<NEW_LINE>AST tmp89_AST = null;<NEW_LINE>tmp89_AST = astFactory.create(LT(1));<NEW_LINE>astFactory.addASTChild(currentAST, tmp89_AST);<NEW_LINE>match(NE);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case LT:<NEW_LINE>{<NEW_LINE>AST tmp90_AST = null;<NEW_LINE>tmp90_AST = astFactory.create(LT(1));<NEW_LINE>astFactory.addASTChild(currentAST, tmp90_AST);<NEW_LINE>match(LT);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case LE:<NEW_LINE>{<NEW_LINE>AST tmp91_AST = null;<NEW_LINE>tmp91_AST = astFactory.create(LT(1));<NEW_LINE>astFactory.addASTChild(currentAST, tmp91_AST);<NEW_LINE>match(LE);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case GT:<NEW_LINE>{<NEW_LINE>AST tmp92_AST = null;<NEW_LINE>tmp92_AST = astFactory.create(LT(1));<NEW_LINE>astFactory.addASTChild(currentAST, tmp92_AST);<NEW_LINE>match(GT);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case GE:<NEW_LINE>{<NEW_LINE>AST tmp93_AST = null;<NEW_LINE>tmp93_AST = astFactory.create(LT(1));<NEW_LINE>astFactory.addASTChild(currentAST, tmp93_AST);<NEW_LINE>match(GE);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>{<NEW_LINE>throw new NoViableAltException(LT(1), getFilename());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>AST tmp94_AST = null;<NEW_LINE>tmp94_AST = astFactory.create(LT(1));<NEW_LINE>astFactory.addASTChild(currentAST, tmp94_AST);<NEW_LINE>match(INT);<NEW_LINE>sizeFnExpr_AST = (AST) currentAST.root;<NEW_LINE>returnAST = sizeFnExpr_AST;<NEW_LINE>} | .create(LT(1)); |
331,577 | public void refresh() {<NEW_LINE>if (table == null || table.isDisposed() || noChange)<NEW_LINE>return;<NEW_LINE>noChange = true;<NEW_LINE>TableItem[] items = table.getItems();<NEW_LINE>for (TableItem item : items) {<NEW_LINE>if (item == null || item.isDisposed()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String tmp = item.getText(0);<NEW_LINE>IpRange range = <MASK><NEW_LINE>String desc = range.getDescription();<NEW_LINE>if (desc != null && !desc.equals(tmp))<NEW_LINE>item.setText(0, desc);<NEW_LINE>tmp = item.getText(1);<NEW_LINE>if (range.getStartIp() != null && !range.getStartIp().equals(tmp))<NEW_LINE>item.setText(1, range.getStartIp());<NEW_LINE>tmp = item.getText(2);<NEW_LINE>if (range.getEndIp() != null && !range.getEndIp().equals(tmp))<NEW_LINE>item.setText(2, range.getEndIp());<NEW_LINE>}<NEW_LINE>} | (IpRange) item.getData(); |
1,226,966 | public ImageUploadResult modifyImage(String mediaId, ImageUrlPayload imageUrlPayload) throws APIConnectionException, APIRequestException {<NEW_LINE>Preconditions.checkArgument(StringUtils.isNotEmpty(mediaId), "mediaId should not be empty");<NEW_LINE>checkImageUrlPayload(imageUrlPayload);<NEW_LINE>NativeHttpClient client = (NativeHttpClient) _httpClient;<NEW_LINE>String url = _baseUrl + _imagesPath + "/" + ImageSource.URL<MASK><NEW_LINE>JsonElement jsonElement = imageUrlPayload.toJSON();<NEW_LINE>String content = _gson.toJson(jsonElement);<NEW_LINE>ResponseWrapper responseWrapper = client.sendPut(url, content);<NEW_LINE>if (responseWrapper.responseCode != 200) {<NEW_LINE>LOG.error("upload image failed: {}", responseWrapper);<NEW_LINE>}<NEW_LINE>ImageUploadResult imageUploadResult = _gson.fromJson(responseWrapper.responseContent, ImageUploadResult.class);<NEW_LINE>LOG.info("upload image result:{}", imageUploadResult);<NEW_LINE>return imageUploadResult;<NEW_LINE>} | .value() + "/" + mediaId; |
1,592,713 | private void loadNode297() {<NEW_LINE>TwoStateVariableTypeNode node = new TwoStateVariableTypeNode(this.context, Identifiers.AlarmConditionType_ActiveState, new QualifiedName(0, "ActiveState"), new LocalizedText("en", "ActiveState"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), new DataValue(Variant.NULL_VALUE), Identifiers.LocalizedText, -1, new UInteger[] {}, UByte.valueOf(1), UByte.valueOf(1), 0.0, false);<NEW_LINE>node.addReference(new Reference(Identifiers.AlarmConditionType_ActiveState, Identifiers.HasProperty, Identifiers.AlarmConditionType_ActiveState_Id.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.AlarmConditionType_ActiveState, Identifiers.HasProperty, Identifiers.AlarmConditionType_ActiveState_EffectiveDisplayName.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.AlarmConditionType_ActiveState, Identifiers.HasProperty, Identifiers.AlarmConditionType_ActiveState_TransitionTime.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.AlarmConditionType_ActiveState, Identifiers.HasProperty, Identifiers.AlarmConditionType_ActiveState_EffectiveTransitionTime.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.AlarmConditionType_ActiveState, Identifiers.HasTrueSubState, Identifiers.AlarmConditionType_EnabledState.expanded(), false));<NEW_LINE>node.addReference(new Reference(Identifiers.AlarmConditionType_ActiveState, Identifiers.HasTypeDefinition, Identifiers.TwoStateVariableType.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.AlarmConditionType_ActiveState, Identifiers.HasModellingRule, Identifiers.ModellingRule_Mandatory.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.AlarmConditionType_ActiveState, Identifiers.HasComponent, Identifiers.AlarmConditionType<MASK><NEW_LINE>this.nodeManager.addNode(node);<NEW_LINE>} | .expanded(), false)); |
1,102,618 | protected void paintChildren(Graphics g) {<NEW_LINE>super.paintChildren(g);<NEW_LINE>Component title = layout.getTitle();<NEW_LINE>if (title != null && layoutData.showActions != null && layoutData.showActions.compute()) {<NEW_LINE>int width = layoutData.configuration.allActionsOffset;<NEW_LINE>int x = getWidth() - width - JBUI.scale(5);<NEW_LINE>int y = layoutData.configuration.topSpaceHeight;<NEW_LINE>int height = title instanceof JEditorPane ? getFirstLineHeight((JEditorPane) title) : title.getHeight();<NEW_LINE><MASK><NEW_LINE>g.fillRect(x, y, width, height);<NEW_LINE>width = layoutData.configuration.beforeGearSpace;<NEW_LINE>x -= width;<NEW_LINE>((Graphics2D) g).setPaint(new GradientPaint(x, y, ColorUtil.withAlpha(layoutData.fillColor, 0.2), x + width, y, layoutData.fillColor));<NEW_LINE>g.fillRect(x, y, width, height);<NEW_LINE>}<NEW_LINE>} | g.setColor(layoutData.fillColor); |
1,759,203 | public void destroy() throws DatabaseException {<NEW_LINE>Database database = getDatabase();<NEW_LINE>try {<NEW_LINE>//<NEW_LINE>// This code now uses the ChangeGeneratorFactory to<NEW_LINE>// allow extension code to be called in order to<NEW_LINE>// delete the changelog table.<NEW_LINE>//<NEW_LINE>// To implement the extension, you will need to override:<NEW_LINE>// DropTableStatement<NEW_LINE>// DropTableChange<NEW_LINE>// DropTableGenerator<NEW_LINE>//<NEW_LINE>//<NEW_LINE>DatabaseObject example = new Table().setName(database.getDatabaseChangeLogTableName()).setSchema(database.getLiquibaseCatalogName(), database.getLiquibaseSchemaName());<NEW_LINE>if (SnapshotGeneratorFactory.getInstance().has(example, database)) {<NEW_LINE>DatabaseObject table = SnapshotGeneratorFactory.getInstance().createSnapshot(example, database);<NEW_LINE>DiffOutputControl diffOutputControl = new DiffOutputControl(true, true, false, null);<NEW_LINE>Change[] change = ChangeGeneratorFactory.getInstance().fixUnexpected(table, diffOutputControl, database, database);<NEW_LINE>SqlStatement[] sqlStatement = change[0].generateStatements(database);<NEW_LINE>Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", database)<MASK><NEW_LINE>}<NEW_LINE>reset();<NEW_LINE>} catch (InvalidExampleException e) {<NEW_LINE>throw new UnexpectedLiquibaseException(e);<NEW_LINE>}<NEW_LINE>} | .execute(sqlStatement[0]); |
1,318,104 | protected void removeByCompanyId(String companyId) throws SystemException {<NEW_LINE>Session session = null;<NEW_LINE>try {<NEW_LINE>session = openSession();<NEW_LINE>StringBuffer query = new StringBuffer();<NEW_LINE>query.append("FROM User_ IN CLASS com.liferay.portal.ejb.UserHBM WHERE ");<NEW_LINE>query.append("companyId = ?");<NEW_LINE>query.append(" AND delete_in_progress = ");<NEW_LINE>query.append(DbConnectionFactory.getDBFalse());<NEW_LINE>query.append(" ORDER BY ");<NEW_LINE>query.append<MASK><NEW_LINE>query.append("middleName ASC").append(", ");<NEW_LINE>query.append("lastName ASC");<NEW_LINE>Query q = session.createQuery(query.toString());<NEW_LINE>int queryPos = 0;<NEW_LINE>q.setString(queryPos++, companyId);<NEW_LINE>Iterator itr = q.list().iterator();<NEW_LINE>while (itr.hasNext()) {<NEW_LINE>UserHBM userHBM = (UserHBM) itr.next();<NEW_LINE>UserPool.remove((String) userHBM.getPrimaryKey());<NEW_LINE>session.delete(userHBM);<NEW_LINE>}<NEW_LINE>session.flush();<NEW_LINE>} catch (HibernateException he) {<NEW_LINE>throw new SystemException(he);<NEW_LINE>}<NEW_LINE>} | ("firstName ASC").append(", "); |
1,208,679 | public void exitNo_ip_route(No_ip_routeContext ctx) {<NEW_LINE>Vrf vrf = _configuration.getVrfs().get(AristaConfiguration.DEFAULT_VRF_NAME);<NEW_LINE>if (ctx.vrf != null) {<NEW_LINE>String vrfName = toString(ctx.vrf);<NEW_LINE>vrf = _configuration.getVrfs().get(vrfName);<NEW_LINE>if (vrf == null) {<NEW_LINE>warn(ctx.vrf, "VRF " + vrfName + " is not yet defined");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Prefix p = toPrefix(ctx.prefix);<NEW_LINE>StaticRouteManager removeFrom = vrf.getStaticRoutes().get(p);<NEW_LINE>if (removeFrom == null) {<NEW_LINE>warn(ctx.prefix, "No static routes for network " + p + " in vrf " + vrf.getName());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (ctx.nh == null) {<NEW_LINE>// Without a next-hop, none of the config is compared to the route.<NEW_LINE>vrf.getStaticRoutes().remove(p);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Optional<NextHop> maybeNextHop = toNextHop(ctx.nh);<NEW_LINE>if (!maybeNextHop.isPresent()) {<NEW_LINE>// already warned.<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>@Nullable<NEW_LINE>Integer distance = null;<NEW_LINE>if (ctx.distance != null) {<NEW_LINE>Optional<Integer> maybeDistance = toInteger(ctx, ctx.distance);<NEW_LINE>if (maybeDistance.isPresent()) {<NEW_LINE>distance = maybeDistance.get();<NEW_LINE>} else {<NEW_LINE>// already warned.<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>boolean removedSomething = removeFrom.removeVariant(nextHop, distance);<NEW_LINE>if (!removedSomething) {<NEW_LINE>warn(ctx.getParent(), "No static routes found to remove");<NEW_LINE>}<NEW_LINE>if (removeFrom.getVariants().isEmpty()) {<NEW_LINE>// If there are no more routes, remove the prefix too.<NEW_LINE>vrf.getStaticRoutes().remove(p);<NEW_LINE>}<NEW_LINE>} | NextHop nextHop = maybeNextHop.get(); |
1,700,597 | private boolean validateWhereClauseAndCheckTableScan() {<NEW_LINE>for (Expression disjunct : disjuncts) {<NEW_LINE>final Validator validator = new Validator();<NEW_LINE>validator.process(disjunct, null);<NEW_LINE>if (validator.requiresTableScan) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (!validator.isKeyedQuery) {<NEW_LINE>if (queryPlannerOptions.getTableScansEnabled()) {<NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>throw invalidWhereClauseException("WHERE clause missing key column for disjunct: " + disjunct.toString(), isWindowed);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!validator.seenKeys.isEmpty() && validator.seenKeys.cardinality() != schema.key().size()) {<NEW_LINE>if (queryPlannerOptions.getTableScansEnabled()) {<NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>final List<ColumnName> seenKeyNames = validator.seenKeys.stream().boxed().map(i -> schema.key().get(i)).map(Column::name).collect(Collectors.toList());<NEW_LINE>throw invalidWhereClauseException("Multi-column sources must specify every key in the WHERE clause. Specified: " + seenKeyNames + " Expected: " + <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | schema.key(), isWindowed); |
1,361,289 | public void beginConstruction() {<NEW_LINE>this.createFixedTextLabel("MinimizedWindow.all_transfers", false, true);<NEW_LINE>this.createGap(40);<NEW_LINE>// Download speed.<NEW_LINE>Label dlab = this.createFixedTextLabel("ConfigView.download.abbreviated", false, false);<NEW_LINE>this.down_speed = this.createSpeedLabel();<NEW_LINE>final Menu downloadSpeedMenu = new Menu(getShell(), SWT.POP_UP);<NEW_LINE>downloadSpeedMenu.addListener(SWT.Show, new Listener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void handleEvent(Event event) {<NEW_LINE>if (CoreFactory.isCoreRunning()) {<NEW_LINE>SelectableSpeedMenu.generateMenuItems(downloadSpeedMenu, CoreFactory.getSingleton(), g_manager, false);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>dlab.setMenu(downloadSpeedMenu);<NEW_LINE>down_speed.setMenu(downloadSpeedMenu);<NEW_LINE>// Upload speed.<NEW_LINE>Label ulab = this.createFixedTextLabel("ConfigView.upload.abbreviated", false, false);<NEW_LINE>this.up_speed = this.createSpeedLabel();<NEW_LINE>final Menu uploadSpeedMenu = new Menu(getShell(), SWT.POP_UP);<NEW_LINE>uploadSpeedMenu.addListener(SWT.Show, new Listener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void handleEvent(Event event) {<NEW_LINE>if (CoreFactory.isCoreRunning()) {<NEW_LINE>SelectableSpeedMenu.generateMenuItems(uploadSpeedMenu, CoreFactory.getSingleton(), g_manager, true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>ulab.setMenu(uploadSpeedMenu);<NEW_LINE>up_speed.setMenu(uploadSpeedMenu);<NEW_LINE>// next eta<NEW_LINE>this.<MASK><NEW_LINE>this.next_eta = this.createDataLabel(65);<NEW_LINE>// options icon area<NEW_LINE>if (COConfigurationManager.getBooleanParameter("Transfer Bar Show Icon Area")) {<NEW_LINE>icon_label = createFixedLabel(16);<NEW_LINE>}<NEW_LINE>} | createFixedTextLabel("TableColumn.header.eta_next", true, false); |
1,402,765 | // loads a single CSV file, filtering by date<NEW_LINE>private static void parseSingle(Predicate<LocalDate> datePredicate, CharSource resource, Map<LocalDate, ImmutableMap.Builder<QuoteId, Double>> mutableMap) {<NEW_LINE>try {<NEW_LINE>CsvFile csv = CsvFile.of(resource, true);<NEW_LINE>for (CsvRow row : csv.rows()) {<NEW_LINE>String dateText = row.getField(DATE_FIELD);<NEW_LINE>LocalDate date = LoaderUtils.parseDate(dateText);<NEW_LINE>if (datePredicate.test(date)) {<NEW_LINE>String <MASK><NEW_LINE>String tickerStr = row.getField(TICKER_FIELD);<NEW_LINE>String fieldNameStr = row.getField(FIELD_NAME_FIELD);<NEW_LINE>String valueStr = row.getField(VALUE_FIELD);<NEW_LINE>double value = Double.valueOf(valueStr);<NEW_LINE>StandardId id = StandardId.of(symbologyStr, tickerStr);<NEW_LINE>FieldName fieldName = fieldNameStr.isEmpty() ? FieldName.MARKET_VALUE : FieldName.of(fieldNameStr);<NEW_LINE>ImmutableMap.Builder<QuoteId, Double> builderForDate = mutableMap.computeIfAbsent(date, k -> ImmutableMap.builder());<NEW_LINE>builderForDate.put(QuoteId.of(id, fieldName), value);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (RuntimeException ex) {<NEW_LINE>throw new IllegalArgumentException(Messages.format("Error processing resource as CSV file: {}", resource), ex);<NEW_LINE>}<NEW_LINE>} | symbologyStr = row.getField(SYMBOLOGY_FIELD); |
1,383,074 | public GraphPath createDirectGraphPath(NearbyStop egress, boolean arriveBy, int departureTime, ZonedDateTime startOfTime) {<NEW_LINE>List<MASK><NEW_LINE>Vertex flexToVertex = egress.state.getVertex();<NEW_LINE>if (!isRouteable(flexToVertex)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>FlexTripEdge flexEdge = getFlexEdge(flexToVertex, egress.stop);<NEW_LINE>State state = flexEdge.traverse(accessEgress.state);<NEW_LINE>for (Edge e : egressEdges) {<NEW_LINE>state = e.traverse(state);<NEW_LINE>}<NEW_LINE>int[] flexTimes = getFlexTimes(flexEdge, state);<NEW_LINE>int preFlexTime = flexTimes[0];<NEW_LINE>int flexTime = flexTimes[1];<NEW_LINE>int postFlexTime = flexTimes[2];<NEW_LINE>int timeShift;<NEW_LINE>if (arriveBy) {<NEW_LINE>int lastStopArrivalTime = departureTime - postFlexTime - secondsFromStartOfTime;<NEW_LINE>int latestArrivalTime = trip.latestArrivalTime(lastStopArrivalTime, fromStopIndex, toStopIndex, flexTime);<NEW_LINE>if (latestArrivalTime == -1) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// Shift from departing at departureTime to arriving at departureTime<NEW_LINE>timeShift = secondsFromStartOfTime + latestArrivalTime - flexTime - preFlexTime;<NEW_LINE>} else {<NEW_LINE>int firstStopDepartureTime = departureTime + preFlexTime - secondsFromStartOfTime;<NEW_LINE>int earliestDepartureTime = trip.earliestDepartureTime(firstStopDepartureTime, fromStopIndex, toStopIndex, flexTime);<NEW_LINE>if (earliestDepartureTime == -1) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>timeShift = secondsFromStartOfTime + earliestDepartureTime - preFlexTime;<NEW_LINE>}<NEW_LINE>State s = state;<NEW_LINE>while (s != null) {<NEW_LINE>s.timeshiftBySeconds(timeShift);<NEW_LINE>s = s.getBackState();<NEW_LINE>}<NEW_LINE>return new GraphPath(state);<NEW_LINE>} | <Edge> egressEdges = egress.edges; |
1,313,238 | public Object apply(ActionContext ctx, Object caller, Object[] sources) throws FrameworkException {<NEW_LINE>try {<NEW_LINE>assertArrayHasMinLengthAndAllElementsNotNull(sources, 1);<NEW_LINE>final User user = (User) sources[0];<NEW_LINE>int accessTokenTimeout = Settings.JWTExpirationTimeout.getValue();<NEW_LINE>int refreshTokenTimeout = Settings.JWTRefreshTokenExpirationTimeout.getValue();<NEW_LINE>if (sources.length > 1) {<NEW_LINE>accessTokenTimeout = (int) sources[1];<NEW_LINE>}<NEW_LINE>Calendar accessTokenExpirationDate = Calendar.getInstance();<NEW_LINE>accessTokenExpirationDate.<MASK><NEW_LINE>Map<String, String> tokens = JWTHelper.createTokensForUser(user, accessTokenExpirationDate.getTime(), null);<NEW_LINE>return tokens.get("access_token");<NEW_LINE>} catch (ArgumentCountException pe) {<NEW_LINE>logParameterError(caller, sources, pe.getMessage(), ctx.isJavaScriptContext());<NEW_LINE>return usage(ctx.isJavaScriptContext());<NEW_LINE>}<NEW_LINE>} | add(Calendar.MINUTE, accessTokenTimeout); |
230,749 | public static void placeSchematicBlock(Level world, BlockState state, BlockPos target, ItemStack stack, @Nullable CompoundTag data) {<NEW_LINE>// Piston<NEW_LINE>if (state.hasProperty(BlockStateProperties.EXTENDED))<NEW_LINE>state = state.setValue(BlockStateProperties.EXTENDED, Boolean.FALSE);<NEW_LINE>if (state.hasProperty(BlockStateProperties.WATERLOGGED))<NEW_LINE>state = state.setValue(BlockStateProperties.WATERLOGGED, Boolean.FALSE);<NEW_LINE>if (AllBlocks.BELT.has(state)) {<NEW_LINE>world.setBlock(target, state, 2);<NEW_LINE>return;<NEW_LINE>} else if (state.getBlock() == Blocks.COMPOSTER)<NEW_LINE>state = Blocks.COMPOSTER.defaultBlockState();<NEW_LINE>else if (state.getBlock() != Blocks.SEA_PICKLE && state.getBlock() instanceof IPlantable)<NEW_LINE>state = ((IPlantable) state.getBlock()).getPlant(world, target);<NEW_LINE>if (world.dimensionType().ultraWarm() && state.getFluidState().getType().is(FluidTags.WATER)) {<NEW_LINE>int i = target.getX();<NEW_LINE>int j = target.getY();<NEW_LINE>int k = target.getZ();<NEW_LINE>world.playSound(null, target, SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);<NEW_LINE>for (int l = 0; l < 8; ++l) {<NEW_LINE>world.addParticle(ParticleTypes.LARGE_SMOKE, i + Math.random(), j + Math.random(), k + Math.random(), 0.0D, 0.0D, 0.0D);<NEW_LINE>}<NEW_LINE>Block.dropResources(state, world, target);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (state.getBlock() instanceof BaseRailBlock) {<NEW_LINE>placeRailWithoutUpdate(world, state, target);<NEW_LINE>} else {<NEW_LINE>world.setBlock(target, state, 18);<NEW_LINE>}<NEW_LINE>if (data != null) {<NEW_LINE>BlockEntity tile = world.getBlockEntity(target);<NEW_LINE>if (tile != null) {<NEW_LINE>data.putInt("x", target.getX());<NEW_LINE>data.putInt("y", target.getY());<NEW_LINE>data.putInt("z", target.getZ());<NEW_LINE>if (tile instanceof KineticTileEntity)<NEW_LINE>((KineticTileEntity) tile).warnOfMovement();<NEW_LINE>tile.load(data);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>state.getBlock().setPlacedBy(world, <MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>}<NEW_LINE>} | target, state, null, stack); |
1,394,193 | public static SipApplicationRouterInfo createSARInfoFactory(String infoString) {<NEW_LINE>SipApplicationRouterInfo sarInfo = null;<NEW_LINE>String appName = "";<NEW_LINE>String uriField = "";<NEW_LINE>String region = "";<NEW_LINE>String routeURI = "";<NEW_LINE>String routeType = "";<NEW_LINE>String stateInfo = "";<NEW_LINE>infoString = infoString.trim();<NEW_LINE>infoString = infoString.substring(1, infoString.length() - 1);<NEW_LINE>StringTokenizer tokenizer = new StringTokenizer(infoString, ",");<NEW_LINE>appName = tokenizer.nextToken().trim();<NEW_LINE>appName = appName.substring(1, appName.length() - 1);<NEW_LINE>uriField = tokenizer.nextToken().trim();<NEW_LINE>uriField = uriField.substring(1, uriField.length() - 1);<NEW_LINE>region = tokenizer.nextToken().trim();<NEW_LINE>region = region.substring(1, region.length() - 1);<NEW_LINE>routeURI = tokenizer.nextToken().trim();<NEW_LINE>routeURI = routeURI.substring(1, <MASK><NEW_LINE>routeType = tokenizer.nextToken().trim().toUpperCase();<NEW_LINE>routeType = routeType.substring(1, routeType.length() - 1);<NEW_LINE>stateInfo = tokenizer.nextToken().trim();<NEW_LINE>stateInfo = stateInfo.substring(1, stateInfo.length() - 1);<NEW_LINE>SipApplicationRoutingRegionType sipApplicationRoutingRegionType = SipApplicationRoutingRegionType.valueOf(region);<NEW_LINE>String[] routeArray = { routeURI };<NEW_LINE>sarInfo = new SipApplicationRouterInfo(appName, new SipApplicationRoutingRegion("", sipApplicationRoutingRegionType), uriField, routeArray, SipRouteModifier.valueOf(routeType), stateInfo);<NEW_LINE>return sarInfo;<NEW_LINE>} | routeURI.length() - 1); |
1,084,232 | static public FModeController createModeController() {<NEW_LINE>final Controller controller = Controller.getCurrentController();<NEW_LINE>modeController = new FModeController(controller);<NEW_LINE>final UserInputListenerFactory userInputListenerFactory = new UserInputListenerFactory(modeController);<NEW_LINE>modeController.setUserInputListenerFactory(userInputListenerFactory);<NEW_LINE>controller.addModeController(modeController);<NEW_LINE>controller.selectModeForBuild(modeController);<NEW_LINE>ClipboardControllers.install(new ClipboardControllers());<NEW_LINE>new FMapController(modeController);<NEW_LINE>UrlManager.install(new UrlManager());<NEW_LINE>MapIO.install(modeController);<NEW_LINE>new IconController(modeController).install(modeController);<NEW_LINE>NodeStyleController.install(new NodeStyleController(modeController));<NEW_LINE>EdgeController.install(new EdgeController(modeController));<NEW_LINE>new TextController(modeController).install(modeController);<NEW_LINE>LinkController.install(new LinkController(modeController));<NEW_LINE>CloudController.install(new CloudController(modeController));<NEW_LINE>LocationController.install(new LocationController());<NEW_LINE>LogicalStyleController.install(new LogicalStyleController(modeController));<NEW_LINE>MapStyle.install(true);<NEW_LINE>NodeStyleController.getController().shapeHandlers.addGetter(new Integer(0), new IPropertyHandler<NodeGeometryModel, NodeModel>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public NodeGeometryModel getProperty(final NodeModel node, LogicalStyleController.StyleOption option, final NodeGeometryModel currentValue) {<NEW_LINE>return NodeGeometryModel.FORK;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>modeController.addAction(new CenterAction());<NEW_LINE>modeController<MASK><NEW_LINE>userInputListenerFactory.setNodePopupMenu(new JPopupMenu());<NEW_LINE>final FreeplaneToolBar toolBar = new FreeplaneToolBar("main_toolbar", SwingConstants.HORIZONTAL);<NEW_LINE>UIComponentVisibilityDispatcher.install(toolBar, "toolbarVisible");<NEW_LINE>userInputListenerFactory.addToolBar("/main_toolbar", ViewController.TOP, toolBar);<NEW_LINE>userInputListenerFactory.addToolBar("/filter_toolbar", FilterController.TOOLBAR_SIDE, FilterController.getCurrentFilterController().getFilterToolbar());<NEW_LINE>userInputListenerFactory.addToolBar("/status", ViewController.BOTTOM, controller.getViewController().getStatusBar());<NEW_LINE>NodeHistory.install(modeController);<NEW_LINE>return modeController;<NEW_LINE>} | .addAction(new OpenPathAction()); |
1,611,218 | final AttrSet findOverride(AttrSet override) {<NEW_LINE>AttrSet attrSet = cachedOverride(override);<NEW_LINE>if (attrSet == null) {<NEW_LINE>Object[] oSharedPairs = override.sharedPairs();<NEW_LINE>Object[] oExtraPairs = override.extraPairs();<NEW_LINE>int osIndex = oSharedPairs.length;<NEW_LINE>int oeIndex = oExtraPairs.length;<NEW_LINE>AttrSetBuilder builder = new AttrSetBuilder(sharedPairs(), sharedHashCode(), extraPairs(), extrasHashCode(), osIndex, oeIndex);<NEW_LINE>while (osIndex > 0) {<NEW_LINE>Object value = oSharedPairs[--osIndex];<NEW_LINE>KeyWrapper keyWrapper = (KeyWrapper) oSharedPairs[--osIndex];<NEW_LINE>builder.addShared(keyWrapper, value);<NEW_LINE>}<NEW_LINE>while (oeIndex > 0) {<NEW_LINE><MASK><NEW_LINE>Object key = oExtraPairs[--oeIndex];<NEW_LINE>builder.addExtra(key, value);<NEW_LINE>}<NEW_LINE>attrSet = builder.toAttrSet();<NEW_LINE>addOverride(override, attrSet);<NEW_LINE>}<NEW_LINE>return attrSet;<NEW_LINE>} | Object value = oExtraPairs[--oeIndex]; |
733,138 | private void writeCompoundFile(IndexOutput entries, IndexOutput data, Directory dir, SegmentInfo si) throws IOException {<NEW_LINE>// write number of files<NEW_LINE>entries.writeVInt(si.<MASK><NEW_LINE>for (String file : si.files()) {<NEW_LINE>// align file start offset<NEW_LINE>long startOffset = data.alignFilePointer(Long.BYTES);<NEW_LINE>// write bytes for file<NEW_LINE>try (ChecksumIndexInput in = dir.openChecksumInput(file, IOContext.READONCE)) {<NEW_LINE>// just copies the index header, verifying that its id matches what we expect<NEW_LINE>CodecUtil.verifyAndCopyIndexHeader(in, data, si.getId());<NEW_LINE>// copy all bytes except the footer<NEW_LINE>long numBytesToCopy = in.length() - CodecUtil.footerLength() - in.getFilePointer();<NEW_LINE>data.copyBytes(in, numBytesToCopy);<NEW_LINE>// verify footer (checksum) matches for the incoming file we are copying<NEW_LINE>long checksum = CodecUtil.checkFooter(in);<NEW_LINE>// this is poached from CodecUtil.writeFooter, but we need to use our own checksum, not<NEW_LINE>// data.getChecksum(), but I think<NEW_LINE>// adding a public method to CodecUtil to do that is somewhat dangerous:<NEW_LINE>CodecUtil.writeBEInt(data, CodecUtil.FOOTER_MAGIC);<NEW_LINE>CodecUtil.writeBEInt(data, 0);<NEW_LINE>CodecUtil.writeBELong(data, checksum);<NEW_LINE>}<NEW_LINE>long endOffset = data.getFilePointer();<NEW_LINE>long length = endOffset - startOffset;<NEW_LINE>// write entry for file<NEW_LINE>entries.writeString(IndexFileNames.stripSegmentName(file));<NEW_LINE>entries.writeLong(startOffset);<NEW_LINE>entries.writeLong(length);<NEW_LINE>}<NEW_LINE>} | files().size()); |
1,041,955 | public final ASTNode visitSimpleExpr(final SimpleExprContext ctx) {<NEW_LINE>int startIndex = ctx.getStart().getStartIndex();<NEW_LINE>int stopIndex = ctx.getStop().getStopIndex();<NEW_LINE>if (null != ctx.subquery()) {<NEW_LINE>return new SubquerySegment(startIndex, stopIndex, (OracleSelectStatement) visit(ctx.subquery()));<NEW_LINE>}<NEW_LINE>if (null != ctx.parameterMarker()) {<NEW_LINE>ParameterMarkerValue parameterMarker = (ParameterMarkerValue) visit(ctx.parameterMarker());<NEW_LINE>ParameterMarkerExpressionSegment segment = new ParameterMarkerExpressionSegment(startIndex, stopIndex, parameterMarker.getValue(), parameterMarker.getType());<NEW_LINE>parameterMarkerSegments.add(segment);<NEW_LINE>return segment;<NEW_LINE>}<NEW_LINE>if (null != ctx.literals()) {<NEW_LINE>return SQLUtil.createLiteralExpression(visit(ctx.literals()), startIndex, stopIndex, ctx.literals().start.getInputStream().getText(new Interval(startIndex, stopIndex)));<NEW_LINE>}<NEW_LINE>if (null != ctx.functionCall()) {<NEW_LINE>return visit(ctx.functionCall());<NEW_LINE>}<NEW_LINE>if (null != ctx.columnName()) {<NEW_LINE>return <MASK><NEW_LINE>}<NEW_LINE>return new CommonExpressionSegment(startIndex, stopIndex, ctx.getText());<NEW_LINE>} | visit(ctx.columnName()); |
840,896 | public void pairDevice(BluetoothGatt bleServer, int connId, long deviceId, long setupPincode, @Nullable byte[] csrNonce, NetworkCredentials networkCredentials) {<NEW_LINE>if (connectionId == 0) {<NEW_LINE>connectionId = connId;<NEW_LINE>if (connectionId == 0) {<NEW_LINE><MASK><NEW_LINE>completionListener.onError(new Exception("Failed to add Bluetooth connection."));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Log.d(TAG, "Bluetooth connection added with ID: " + connectionId);<NEW_LINE>Log.d(TAG, "Pairing device with ID: " + deviceId);<NEW_LINE>pairDevice(deviceControllerPtr, deviceId, connectionId, setupPincode, csrNonce, networkCredentials);<NEW_LINE>} else {<NEW_LINE>Log.e(TAG, "Bluetooth connection already in use.");<NEW_LINE>completionListener.onError(new Exception("Bluetooth connection already in use."));<NEW_LINE>}<NEW_LINE>} | Log.e(TAG, "Failed to add Bluetooth connection."); |
1,204,415 | protected static // ------------------------------------------------------------------------------------<NEW_LINE>void printImages(EnumMap<measurements, Map<String, Double>> values) {<NEW_LINE>System.out.println();<NEW_LINE>for (measurements m : values.keySet()) {<NEW_LINE>Map<String, Double> <MASK><NEW_LINE>ArrayList<Map.Entry<String, Double>> list = new ArrayList<Map.Entry<String, Double>>(map.entrySet());<NEW_LINE>Collections.sort(list, new Comparator<Map.Entry<String, Double>>() {<NEW_LINE><NEW_LINE>public int compare(Map.Entry<String, Double> o1, Map.Entry<String, Double> o2) {<NEW_LINE>double diff = o1.getValue() - o2.getValue();<NEW_LINE>return diff > 0 ? 1 : (diff < 0 ? -1 : 0);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>LinkedHashMap<String, Double> sortedMap = new LinkedHashMap<String, Double>();<NEW_LINE>for (Map.Entry<String, Double> entry : list) {<NEW_LINE>if (!entry.getValue().isNaN()) {<NEW_LINE>sortedMap.put(entry.getKey(), entry.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!sortedMap.isEmpty())<NEW_LINE>printImage(sortedMap, m);<NEW_LINE>}<NEW_LINE>System.out.println();<NEW_LINE>} | map = values.get(m); |
72,024 | public static void vertical3(Kernel1D_F32 kernel, GrayF32 src, GrayF32 dst) {<NEW_LINE>final float[] dataSrc = src.data;<NEW_LINE>final float[] dataDst = dst.data;<NEW_LINE>final float k1 = kernel.data[0];<NEW_LINE>final float k2 = kernel.data[1];<NEW_LINE>final float k3 = kernel.data[2];<NEW_LINE>final int radius = kernel.getRadius();<NEW_LINE>final int imgWidth = dst.getWidth();<NEW_LINE>final <MASK><NEW_LINE>final int yEnd = imgHeight - radius;<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(radius, yEnd, y -> {<NEW_LINE>for (int y = radius; y < yEnd; y++) {<NEW_LINE>int indexDst = dst.startIndex + y * dst.stride;<NEW_LINE>int i = src.startIndex + (y - radius) * src.stride;<NEW_LINE>final int iEnd = i + imgWidth;<NEW_LINE>for (; i < iEnd; i++) {<NEW_LINE>int indexSrc = i;<NEW_LINE>float total = (dataSrc[indexSrc]) * k1;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc]) * k2;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc]) * k3;<NEW_LINE>dataDst[indexDst++] = total;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} | int imgHeight = dst.getHeight(); |
77,336 | public void run() {<NEW_LINE>RSSReader rss = null;<NEW_LINE>try {<NEW_LINE>final Response response = this.sb.loader.load(this.sb.loader.request(this.urlf, true, false), CacheStrategy.NOCACHE, Integer.MAX_VALUE, <MASK><NEW_LINE>final byte[] resource = response == null ? null : response.getContent();<NEW_LINE>rss = resource == null ? null : RSSReader.parse(RSSFeed.DEFAULT_MAXSIZE, resource);<NEW_LINE>} catch (final MalformedURLException e) {<NEW_LINE>ConcurrentLog.warn("Load_RSS", "rss loading for url '" + getName().substring(9) + "' failed: " + e.getMessage());<NEW_LINE>return;<NEW_LINE>} catch (final IOException e) {<NEW_LINE>ConcurrentLog.warn("Load_RSS", "rss loading for url '" + this.urlf.toNormalform(true) + "' failed: " + e.getMessage());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (rss == null) {<NEW_LINE>ConcurrentLog.warn("Load_RSS", "no rss for url " + this.urlf.toNormalform(true));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final RSSFeed feed = rss.getFeed();<NEW_LINE>indexAllRssFeed(this.sb, this.urlf, feed, this.collections);<NEW_LINE>// add the feed also to the scheduler<NEW_LINE>recordAPI(this.sb, null, this.urlf, feed, 7, "seldays");<NEW_LINE>} | BlacklistType.CRAWLER, this.agent); |
1,555,335 | protected void buildUI() {<NEW_LINE>JPanel innerPanel = new JPanel(new BorderLayout());<NEW_LINE>innerPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));<NEW_LINE>JPanel comboBoxPanel = createAuthorizationLabelAndComboBox();<NEW_LINE>innerPanel.add(comboBoxPanel, BorderLayout.PAGE_START);<NEW_LINE>cardPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));<NEW_LINE>cardPanel.add(createEmptyPanel(), EMPTY_PANEL);<NEW_LINE>innerPanel.<MASK><NEW_LINE>authenticationForm = new BasicAuthenticationForm<T>(request);<NEW_LINE>cardPanel.add(authenticationForm.getComponent(), BASIC_FORM_LABEL);<NEW_LINE>if (isSoapRequest(request)) {<NEW_LINE>wssAuthenticationForm = new WSSAuthenticationForm((WsdlRequest) request);<NEW_LINE>cardPanel.add(wssAuthenticationForm.getComponent(), WSS_FORM_LABEL);<NEW_LINE>}<NEW_LINE>outerPanel.add(new JScrollPane(innerPanel), BorderLayout.CENTER);<NEW_LINE>} | add(cardPanel, BorderLayout.CENTER); |
807,890 | private List<SourceMethod> retrievePrototypeMethods(TypeElement mapperTypeElement, MapperOptions mapperAnnotation) {<NEW_LINE>if (!mapperAnnotation.hasMapperConfig()) {<NEW_LINE>return Collections.emptyList();<NEW_LINE>}<NEW_LINE>TypeElement typeElement = asTypeElement(mapperAnnotation.mapperConfigType());<NEW_LINE>List<SourceMethod> methods = new ArrayList<>();<NEW_LINE>for (ExecutableElement executable : elementUtils.getAllEnclosedExecutableElements(typeElement)) {<NEW_LINE>ExecutableType methodType = typeFactory.getMethodType(mapperAnnotation.mapperConfigType(), executable);<NEW_LINE>List<Parameter> parameters = typeFactory.getParameters(methodType, executable);<NEW_LINE>boolean <MASK><NEW_LINE>// prototype methods don't have prototypes themselves<NEW_LINE>List<SourceMethod> prototypeMethods = Collections.emptyList();<NEW_LINE>SourceMethod method = getMethodRequiringImplementation(methodType, executable, parameters, containsTargetTypeParameter, mapperAnnotation, prototypeMethods, mapperTypeElement);<NEW_LINE>if (method != null) {<NEW_LINE>methods.add(method);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return methods;<NEW_LINE>} | containsTargetTypeParameter = SourceMethod.containsTargetTypeParameter(parameters); |
1,416,967 | FixedKeyNode updateRecord(int index, DBRecord record) throws IOException {<NEW_LINE>int offset = getRecordDataOffset(index);<NEW_LINE>int oldLen = getRecordLength(index, offset);<NEW_LINE>int len = record.length();<NEW_LINE>// Check for use of indirect chained record node(s)<NEW_LINE>// min 4 records per node<NEW_LINE>int maxRecordLength = ((buffer.length() - HEADER_SIZE) >> 2) - entrySize;<NEW_LINE>boolean wasIndirect = hasIndirectStorage(index);<NEW_LINE>boolean useIndirect = (len > maxRecordLength);<NEW_LINE>if (useIndirect) {<NEW_LINE>// Store record in chained buffers<NEW_LINE>len = 4;<NEW_LINE>ChainedBuffer chainedBuffer = null;<NEW_LINE>if (wasIndirect) {<NEW_LINE>chainedBuffer = new ChainedBuffer(nodeMgr.getBufferMgr(), buffer.getInt(offset));<NEW_LINE>chainedBuffer.setSize(<MASK><NEW_LINE>} else {<NEW_LINE>chainedBuffer = new ChainedBuffer(record.length(), nodeMgr.getBufferMgr());<NEW_LINE>// assumes old len is always > 4<NEW_LINE>buffer.putInt(offset + oldLen - 4, chainedBuffer.getId());<NEW_LINE>enableIndirectStorage(index, true);<NEW_LINE>}<NEW_LINE>record.write(chainedBuffer, 0);<NEW_LINE>} else if (wasIndirect) {<NEW_LINE>removeChainedBuffer(buffer.getInt(offset));<NEW_LINE>enableIndirectStorage(index, false);<NEW_LINE>}<NEW_LINE>// See if updated record will fit in current buffer<NEW_LINE>if (useIndirect || len <= (getFreeSpace() + oldLen)) {<NEW_LINE>// Overwrite record data - move other data if needed<NEW_LINE>int dataShift = oldLen - len;<NEW_LINE>if (dataShift != 0) {<NEW_LINE>offset = moveRecords(index + 1, dataShift);<NEW_LINE>putRecordDataOffset(index, offset);<NEW_LINE>}<NEW_LINE>if (!useIndirect) {<NEW_LINE>record.write(buffer, offset);<NEW_LINE>}<NEW_LINE>return getRoot();<NEW_LINE>}<NEW_LINE>// Insufficient room for updated record - remove and re-add<NEW_LINE>Field key = record.getKeyField();<NEW_LINE>FixedKeyRecordNode leaf = (FixedKeyRecordNode) deleteRecord(key, null).getLeafNode(key);<NEW_LINE>return leaf.putRecord(record, null);<NEW_LINE>} | record.length(), false); |
1,219,188 | public void update(Integer extendId, List<SysExtendField> entitys) {<NEW_LINE>if (CommonUtils.notEmpty(extendId)) {<NEW_LINE>Set<String> codeList = new HashSet<>();<NEW_LINE>if (CommonUtils.notEmpty(entitys)) {<NEW_LINE>for (SysExtendField entity : entitys) {<NEW_LINE>if (0 != entity.getId().getExtendId()) {<NEW_LINE>if (null == getEntity(entity.getId())) {<NEW_LINE>save(entity);<NEW_LINE>} else {<NEW_LINE>update(entity.getId(), entity, ignoreProperties);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>entity.getId().setExtendId(extendId);<NEW_LINE>save(entity);<NEW_LINE>}<NEW_LINE>codeList.add(entity.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (SysExtendField extend : getList(extendId, null, null)) {<NEW_LINE>if (!codeList.contains(extend.getId().getCode())) {<NEW_LINE>delete(extend.getId());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getId().getCode()); |
267,704 | public Container createContainer(EjbDescriptor ejbDescriptor, ClassLoader loader, DeploymentContext deployContext) throws Exception {<NEW_LINE>this.ejbDescriptor = ejbDescriptor;<NEW_LINE>// FIXME: Read from domain.xml iiop-service ip-addr<NEW_LINE>byte[<MASK><NEW_LINE>try {<NEW_LINE>ipAddress = InetAddress.getLocalHost().getAddress();<NEW_LINE>} catch (Exception ex) {<NEW_LINE>long val = System.identityHashCode(ipAddress) + System.currentTimeMillis();<NEW_LINE>Utility.longToBytes(val, ipAddress, 0);<NEW_LINE>}<NEW_LINE>// FIXME: Read from domain.xml<NEW_LINE>int port = 8080;<NEW_LINE>cacheProps.init(ejbDescriptor);<NEW_LINE>SecurityManager sm = getSecurityManager(ejbDescriptor);<NEW_LINE>sfsbContainer = new StatefulSessionContainer(ejbDescriptor, loader, sm);<NEW_LINE>buildComponents(ipAddress, port, deployContext);<NEW_LINE>sfsbContainer.initializeHome();<NEW_LINE>return sfsbContainer;<NEW_LINE>} | ] ipAddress = new byte[4]; |
1,244,745 | public void run() {<NEW_LINE>logger.info("Starting server.");<NEW_LINE>InetAddress localAddr = MaryProperties.needInetAddress("socket.addr");<NEW_LINE>int localPort = MaryProperties.needInteger("socket.port");<NEW_LINE>HttpParams params = new BasicHttpParams();<NEW_LINE>// 0 means no timeout, any positive value means time out in miliseconds (i.e. 50000 for 50 seconds)<NEW_LINE>params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 0).setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024).setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false).setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true).setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1");<NEW_LINE>BasicHttpProcessor httpproc = new BasicHttpProcessor();<NEW_LINE>httpproc<MASK><NEW_LINE>httpproc.addInterceptor(new ResponseServer());<NEW_LINE>httpproc.addInterceptor(new ResponseContent());<NEW_LINE>httpproc.addInterceptor(new ResponseConnControl());<NEW_LINE>BufferingHttpServiceHandler handler = new BufferingHttpServiceHandler(httpproc, new DefaultHttpResponseFactory(), new DefaultConnectionReuseStrategy(), params);<NEW_LINE>// Set up request handlers<NEW_LINE>HttpRequestHandlerRegistry registry = new HttpRequestHandlerRegistry();<NEW_LINE>registry.register("/process", new SynthesisRequestHandler());<NEW_LINE>InfoRequestHandler infoRH = new InfoRequestHandler();<NEW_LINE>registry.register("/version", infoRH);<NEW_LINE>registry.register("/datatypes", infoRH);<NEW_LINE>registry.register("/locales", infoRH);<NEW_LINE>registry.register("/voices", infoRH);<NEW_LINE>registry.register("/audioformats", infoRH);<NEW_LINE>registry.register("/exampletext", infoRH);<NEW_LINE>registry.register("/audioeffects", infoRH);<NEW_LINE>registry.register("/audioeffect-default-param", infoRH);<NEW_LINE>registry.register("/audioeffect-full", infoRH);<NEW_LINE>registry.register("/audioeffect-help", infoRH);<NEW_LINE>registry.register("/audioeffect-is-hmm-effect", infoRH);<NEW_LINE>registry.register("/features", infoRH);<NEW_LINE>registry.register("/features-discrete", infoRH);<NEW_LINE>registry.register("/vocalizations", infoRH);<NEW_LINE>registry.register("/styles", infoRH);<NEW_LINE>registry.register("*", new FileRequestHandler());<NEW_LINE>handler.setHandlerResolver(registry);<NEW_LINE>// Provide an event logger<NEW_LINE>handler.setEventListener(new EventLogger());<NEW_LINE>IOEventDispatch ioEventDispatch = new DefaultServerIOEventDispatch(handler, params);<NEW_LINE>int numParallelThreads = MaryProperties.getInteger("server.http.parallelthreads", 5);<NEW_LINE>logger.info("Waiting for client to connect on port " + localPort);<NEW_LINE>try {<NEW_LINE>ListeningIOReactor ioReactor = new DefaultListeningIOReactor(numParallelThreads, params);<NEW_LINE>ioReactor.listen(new InetSocketAddress(localAddr, localPort));<NEW_LINE>isReady = true;<NEW_LINE>ioReactor.execute(ioEventDispatch);<NEW_LINE>} catch (InterruptedIOException ex) {<NEW_LINE>logger.info("Interrupted", ex);<NEW_LINE>} catch (IOException e) {<NEW_LINE>logger.info("Problem with HTTP connection", e);<NEW_LINE>}<NEW_LINE>logger.debug("Shutdown");<NEW_LINE>} | .addInterceptor(new ResponseDate()); |
193,265 | private void updateStoreTableSize() throws ConnectionUnavailableException {<NEW_LINE>if (cacheEnabled && !queryStoreWithoutCheckingCache.get()) {<NEW_LINE>readWriteLock.writeLock().lock();<NEW_LINE>try {<NEW_LINE>// check if we need to check the size of store<NEW_LINE>if (storeTableSize == -1 || (!cacheExpiryEnabled && storeSizeLastCheckedTime < siddhiAppContext.getTimestampGenerator().currentTime() - storeSizeCheckInterval)) {<NEW_LINE>StateEvent stateEventForCaching = new StateEvent(1, 0);<NEW_LINE>queryStoreWithoutCheckingCache.set(Boolean.TRUE);<NEW_LINE>try {<NEW_LINE>StreamEvent preLoadedData = query(stateEventForCaching, compiledConditionForCaching, compiledSelectionForCaching, outputAttributesForCaching);<NEW_LINE>storeTableSize = findEventChunkSize(preLoadedData);<NEW_LINE>storeSizeLastCheckedTime = siddhiAppContext.getTimestampGenerator().currentTime();<NEW_LINE>} finally {<NEW_LINE>queryStoreWithoutCheckingCache.set(Boolean.FALSE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>readWriteLock<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .writeLock().unlock(); |
1,683,450 | public CreateVocabularyFilterResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>CreateVocabularyFilterResult createVocabularyFilterResult = new CreateVocabularyFilterResult();<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 createVocabularyFilterResult;<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("VocabularyFilterName", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createVocabularyFilterResult.setVocabularyFilterName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("LanguageCode", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createVocabularyFilterResult.setLanguageCode(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("LastModifiedTime", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createVocabularyFilterResult.setLastModifiedTime(DateJsonUnmarshallerFactory.getInstance("unixTimestamp").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 createVocabularyFilterResult;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
971,975 | public void openViewer(String title, FileInputStream input) {<NEW_LINE>boolean inUIThread <MASK><NEW_LINE>boolean desktopActivated = false;<NEW_LINE>Desktop desktop = null;<NEW_LINE>try {<NEW_LINE>if (!inUIThread) {<NEW_LINE>desktop = AEnv.getDesktop();<NEW_LINE>if (desktop == null) {<NEW_LINE>log.warning("desktop is null");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// 1 second timeout<NEW_LINE>if (Executions.activate(desktop, 1000)) {<NEW_LINE>desktopActivated = true;<NEW_LINE>} else {<NEW_LINE>log.warning("could not activate desktop");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Window win = new SimplePDFViewer(title, input);<NEW_LINE>SessionManager.getAppDesktop().showWindow(win, "center");<NEW_LINE>} catch (Exception e) {<NEW_LINE>} finally {<NEW_LINE>if (!inUIThread && desktopActivated) {<NEW_LINE>Executions.deactivate(desktop);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | = Executions.getCurrent() != null; |
1,467,549 | public void onMatch(RelOptRuleCall call) {<NEW_LINE>LogicalTableFunctionScan scan = call.rel(0);<NEW_LINE>int wmIndex = orderingColumnFieldIndex(scan);<NEW_LINE>WatermarkLogicalRel wmRel = new WatermarkLogicalRel(scan.getCluster(), OptUtils.toLogicalConvention(scan.getTraitSet()), Iterables.getOnlyElement(Util.toList(scan.getInputs(), OptUtils::toLogicalInput))<MASK><NEW_LINE>if (wmIndex < 0) {<NEW_LINE>call.transformTo(wmRel);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>WatermarkedFields watermarkedFields = watermarkedFieldByIndex(wmRel, wmIndex);<NEW_LINE>if (watermarkedFields == null || watermarkedFields.isEmpty()) {<NEW_LINE>call.transformTo(wmRel);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Map.Entry<Integer, RexNode> watermarkedField = watermarkedFields.findFirst();<NEW_LINE>if (watermarkedField == null) {<NEW_LINE>call.transformTo(wmRel);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>DropLateItemsLogicalRel dropLateItemsRel = new DropLateItemsLogicalRel(scan.getCluster(), OptUtils.toLogicalConvention(scan.getTraitSet()), wmRel, watermarkedField.getValue());<NEW_LINE>call.transformTo(dropLateItemsRel);<NEW_LINE>} | , toEventTimePolicyProvider(scan), wmIndex); |
912,187 | public void dump() {<NEW_LINE>try {<NEW_LINE>if (isEnabled()) {<NEW_LINE>if (LOGGER.isDebugEnabled()) {<NEW_LINE>if (receivedRequests.isUsed() || sentRequests.isUsed() || sendErrors.isUsed()) {<NEW_LINE>String eol = StringUtil.lineSeparator();<NEW_LINE>String head = " " + tag;<NEW_LINE>StringBuilder log = new StringBuilder();<NEW_LINE>log.append(tag).append("endpoint statistic:").append(eol);<NEW_LINE>log.append(tag).append("send statistic:").append(eol);<NEW_LINE>log.append(head).append(sentRequests).append(eol);<NEW_LINE>log.append(head).append(sentResponses).append(eol);<NEW_LINE>if (udp) {<NEW_LINE>log.append(head).append(sentAcknowledges).append(eol);<NEW_LINE>log.append(head).append(sentRejects).append(eol);<NEW_LINE>log.append(head).append(resentRequests).append(eol);<NEW_LINE>log.append(head).append(resentResponses).append(eol);<NEW_LINE>}<NEW_LINE>log.append(head).append(sendErrors).append(eol);<NEW_LINE>log.append(tag).append("receive statistic:").append(eol);<NEW_LINE>log.append(head).append(receivedRequests).append(eol);<NEW_LINE>log.append(head).append(receivedResponses).append(eol);<NEW_LINE>if (udp) {<NEW_LINE>log.append(head).append(receivedAcknowledges).append(eol);<NEW_LINE>log.append(head).append(receivedRejects).append(eol);<NEW_LINE>log.append(head).append<MASK><NEW_LINE>log.append(head).append(duplicateResponses).append(eol);<NEW_LINE>log.append(head).append(offloadedMessages).append(eol);<NEW_LINE>}<NEW_LINE>log.append(head).append(ignoredMessages).append(eol);<NEW_LINE>long sent = getSentCounters();<NEW_LINE>long processed = getProcessedCounters();<NEW_LINE>log.append(tag).append("sent ").append(sent).append(", received ").append(processed);<NEW_LINE>LOGGER.debug("{}", log);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>transferCounter();<NEW_LINE>}<NEW_LINE>} catch (Throwable e) {<NEW_LINE>LOGGER.error("{}", tag, e);<NEW_LINE>}<NEW_LINE>} | (duplicateRequests).append(eol); |
1,563,298 | public void shutdown() {<NEW_LINE>if (LOG.isDebugEnabled())<NEW_LINE>LOG.debug("Shutdown sessions, invalidating = {}", isInvalidateOnShutdown());<NEW_LINE>// loop over all the sessions in memory (a few times if necessary to catch sessions that have been<NEW_LINE>// added while we're running<NEW_LINE>int loop = 100;<NEW_LINE>while (!_sessions.isEmpty() && loop-- > 0) {<NEW_LINE>for (Session session : _sessions.values()) {<NEW_LINE>if (isInvalidateOnShutdown()) {<NEW_LINE>// not preserving sessions on exit<NEW_LINE>try {<NEW_LINE>session.invalidate();<NEW_LINE>} catch (Exception e) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// write out the session and remove from the cache<NEW_LINE>if (_sessionDataStore.isPassivating())<NEW_LINE>session.willPassivate();<NEW_LINE>try {<NEW_LINE>_sessionDataStore.store(session.getId(), session.getSessionData());<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.warn("Unable to store {}", session, e);<NEW_LINE>}<NEW_LINE>// remove from memory<NEW_LINE>doDelete(session.getId());<NEW_LINE>session.setResident(false);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | LOG.trace("IGNORED", e); |
734 | private void populateLogRecordFields(int index, String fieldData, ParsedLogRecord parsedLogRecord) {<NEW_LINE>switch(index) {<NEW_LINE>case 0:<NEW_LINE>parsedLogRecord.setFieldValue(ParsedLogRecord.DATE_TIME, fieldData);<NEW_LINE>break;<NEW_LINE>case 1:<NEW_LINE>parsedLogRecord.setFieldValue(ParsedLogRecord.LOG_LEVEL_NAME, fieldData);<NEW_LINE>break;<NEW_LINE>case 2:<NEW_LINE>parsedLogRecord.setFieldValue(ParsedLogRecord.PRODUCT_ID, fieldData);<NEW_LINE>break;<NEW_LINE>case 3:<NEW_LINE>parsedLogRecord.setFieldValue(ParsedLogRecord.LOGGER_NAME, fieldData);<NEW_LINE>break;<NEW_LINE>case 4:<NEW_LINE>String[] nv_pairs = fieldData.split(";");<NEW_LINE>for (String pair : nv_pairs) {<NEW_LINE>String[] nameValue = pair.split("=");<NEW_LINE>if (nameValue.length == 2) {<NEW_LINE>String name = nameValue[0];<NEW_LINE>String value = nameValue[1];<NEW_LINE>if (FIELD_NAME_ALIASES.containsKey(name)) {<NEW_LINE><MASK><NEW_LINE>parsedLogRecord.setFieldValue(name, value);<NEW_LINE>} else {<NEW_LINE>Properties props = (Properties) parsedLogRecord.getFieldValue(ParsedLogRecord.SUPP_ATTRS);<NEW_LINE>props.put(name, value);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case 5:<NEW_LINE>parsedLogRecord.setFieldValue(ParsedLogRecord.LOG_MESSAGE, fieldData);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} | name = FIELD_NAME_ALIASES.get(name); |
875,822 | public Future<Boolean> shutDownAsync(Runnable midHook) {<NEW_LINE>assertWritable();<NEW_LINE>Set<Module> unorderedModules = getEnabledModules();<NEW_LINE>Map<String, Set<Module>> providersMap = new HashMap<String, Set<Module>>();<NEW_LINE>for (Module m : unorderedModules) {<NEW_LINE>registerProviders(m, providersMap);<NEW_LINE>}<NEW_LINE>Map<Module, List<Module>> deps = Util.moduleDependencies(unorderedModules, modulesByName, providersMap);<NEW_LINE>List<Module> sortedModules;<NEW_LINE>try {<NEW_LINE>sortedModules = <MASK><NEW_LINE>} catch (TopologicalSortException ex) {<NEW_LINE>// Once again, weird situation.<NEW_LINE>if (PRINT_TOPOLOGICAL_EXCEPTION_STACK_TRACES) {<NEW_LINE>Util.err.log(Level.WARNING, null, ex);<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>Util.err.warning("Cyclic module dependencies, will not shut down cleanly: " + deps);<NEW_LINE>return new TaskFuture(true, Task.EMPTY);<NEW_LINE>}<NEW_LINE>if (!TopSecurityManager.officialExit && !installer.closing(sortedModules)) {<NEW_LINE>return new TaskFuture(false, Task.EMPTY);<NEW_LINE>}<NEW_LINE>if (midHook != null) {<NEW_LINE>try {<NEW_LINE>midHook.run();<NEW_LINE>} catch (RuntimeException e) {<NEW_LINE>Util.err.log(Level.WARNING, null, e);<NEW_LINE>} catch (LinkageError e) {<NEW_LINE>Util.err.log(Level.WARNING, null, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>netigso.shutdownFramework();<NEW_LINE>Task task = installer.closeAsync(sortedModules);<NEW_LINE>return new TaskFuture(true, task);<NEW_LINE>} | Utilities.topologicalSort(unorderedModules, deps); |
1,321,137 | protected void performRewrite(TransformationContext ctx) throws Exception {<NEW_LINE>WorkingCopy wc = ctx.getWorkingCopy();<NEW_LINE>TreePath path = ctx.getPath();<NEW_LINE>TypeMirror compType = ctype.resolve(wc);<NEW_LINE>if (compType == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>TreeMaker mk = wc.getTreeMaker();<NEW_LINE>Tree l = path.getLeaf();<NEW_LINE>if (l.getKind() == Tree.Kind.NEW_ARRAY) {<NEW_LINE>NewArrayTree nat = (NewArrayTree) l;<NEW_LINE>// if there are some initializers, we should probably rewrite the whole expression.<NEW_LINE>if (nat.getInitializers() == null) {<NEW_LINE>rewriteNewArrayTree(wc, mk, path, compType);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// replace the entire tree<NEW_LINE>TreePath colRef = null;<NEW_LINE>if (colReference != null) {<NEW_LINE>colRef = colReference.resolve(wc);<NEW_LINE>if (colRef == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>GeneratorUtilities gu = GeneratorUtilities.get(wc);<NEW_LINE>Tree lc = gu.importComments(l, wc.getCompilationUnit());<NEW_LINE>Tree newArrayTree = mk.NewArray(mk.Type(compType), Collections.<ExpressionTree>singletonList(mk.MethodInvocation(Collections.<ExpressionTree>emptyList(), // NOI18N<NEW_LINE>colRef == null ? // NOI18N<NEW_LINE>mk.Identifier("size") : mk.MemberSelect((ExpressionTree) colRef.getLeaf(), "size"), Collections.<ExpressionTree><MASK><NEW_LINE>gu.copyComments(lc, newArrayTree, true);<NEW_LINE>gu.copyComments(lc, newArrayTree, false);<NEW_LINE>wc.rewrite(lc, newArrayTree);<NEW_LINE>} | emptyList())), null); |
1,332,066 | private void partialUpdatePhoto(PrintWriter respWriter, long photoId) throws RemoteInvocationException {<NEW_LINE>final Request<Photo> getReq = _photoBuilders.get().id(photoId).build();<NEW_LINE>final ResponseFuture<Photo> getFuture = _restClient.sendRequest(getReq);<NEW_LINE>final Response<Photo<MASK><NEW_LINE>final Photo originalPhoto = getResp.getEntity();<NEW_LINE>final Photo updatedPhoto = new Photo().setTitle("Partially Updated Photo");<NEW_LINE>final PatchRequest<Photo> patch = PatchGenerator.diff(originalPhoto, updatedPhoto);<NEW_LINE>final Request<EmptyRecord> partialUpdateRequest = _photoBuilders.partialUpdate().id(photoId).input(patch).build();<NEW_LINE>final int status = _restClient.sendRequest(partialUpdateRequest).getResponse().getStatus();<NEW_LINE>respWriter.println("Partial update photo is successful: " + (status == 202));<NEW_LINE>} | > getResp = getFuture.getResponse(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.