idx
int32 46
1.86M
| input
stringlengths 321
6.6k
| target
stringlengths 9
1.24k
|
|---|---|---|
846,114
|
public boolean createMessageCommunicate(String strOperType, String strOrgType, T t, EffectivePerson effectivePerson) {<NEW_LINE>try {<NEW_LINE>Gson gson = new Gson();<NEW_LINE>String strT = gson.toJson(t);<NEW_LINE>OrgMessage orgMessage = new OrgMessage();<NEW_LINE>orgMessage.setOperType(strOperType);<NEW_LINE>orgMessage.setOrgType(strOrgType);<NEW_LINE>orgMessage.setOperUerId(effectivePerson.getDistinguishedName());<NEW_LINE>orgMessage.setOperDataId(t.getId());<NEW_LINE>orgMessage.setReceiveSystem("");<NEW_LINE>orgMessage.setConsumed(false);<NEW_LINE>orgMessage.setConsumedModule("");<NEW_LINE>OrgBodyMessage orgBodyMessage = new OrgBodyMessage();<NEW_LINE>orgBodyMessage.setOriginalData(strT);<NEW_LINE>orgMessage.setBody(gson.toJson(orgBodyMessage));<NEW_LINE>String path = "org/create";<NEW_LINE>ActionResponse resp = ThisApplication.context().applications().postQuery(x_message_assemble_communicate.class, path, orgMessage);<NEW_LINE>String mess = resp.getMessage();<NEW_LINE>String data = resp<MASK><NEW_LINE>return true;<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.print(e.toString());<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}
|
.getData().toString();
|
185,782
|
// Code adapted from HTSJDK's BlockCompressedInputStream class<NEW_LINE>private BGZFBlockMetadata processNextBlock(InputStream stream, String streamSource) throws IOException {<NEW_LINE>final byte[] buffer = new byte[BlockCompressedStreamConstants.MAX_COMPRESSED_BLOCK_SIZE];<NEW_LINE>long blockAddress = streamOffset;<NEW_LINE>final int headerByteCount = readBytes(stream, buffer, 0, BlockCompressedStreamConstants.BLOCK_HEADER_LENGTH);<NEW_LINE>// Return null when we hit EOF<NEW_LINE>if (headerByteCount <= 0) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (headerByteCount != BlockCompressedStreamConstants.BLOCK_HEADER_LENGTH) {<NEW_LINE>throw new IOException("Incorrect header size for file: " + streamSource);<NEW_LINE>}<NEW_LINE>streamOffset += headerByteCount;<NEW_LINE>final int blockLength = unpackInt16(buffer, BlockCompressedStreamConstants.BLOCK_LENGTH_OFFSET) + 1;<NEW_LINE>if (blockLength < BlockCompressedStreamConstants.BLOCK_HEADER_LENGTH || blockLength > buffer.length) {<NEW_LINE>throw new IOException("Unexpected compressed block length: " + blockLength + " for " + streamSource);<NEW_LINE>}<NEW_LINE>final int remaining = blockLength - BlockCompressedStreamConstants.BLOCK_HEADER_LENGTH;<NEW_LINE>final int dataByteCount = readBytes(stream, buffer, BlockCompressedStreamConstants.BLOCK_HEADER_LENGTH, remaining);<NEW_LINE>if (dataByteCount != remaining) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>streamOffset += dataByteCount;<NEW_LINE>final int uncompressedLength = unpackInt32(buffer, blockLength - 4);<NEW_LINE>if (uncompressedLength < 0) {<NEW_LINE>throw new IOException(streamSource + " has invalid uncompressed length: " + uncompressedLength);<NEW_LINE>}<NEW_LINE>return new BGZFBlockMetadata(blockAddress, blockLength, uncompressedLength);<NEW_LINE>}
|
throw new IOException("Premature end of file: " + streamSource);
|
756,452
|
public static void main(String[] args) {<NEW_LINE>String nameRgb = UtilIO.pathExample("kinect/basket/basket_rgb.png");<NEW_LINE>String nameDepth = UtilIO.pathExample("kinect/basket/basket_depth.png");<NEW_LINE>String <MASK><NEW_LINE>VisualDepthParameters param = CalibrationIO.load(nameCalib);<NEW_LINE>BufferedImage buffered = UtilImageIO.loadImageNotNull(nameRgb);<NEW_LINE>Planar<GrayU8> rgb = ConvertBufferedImage.convertFromPlanar(buffered, null, true, GrayU8.class);<NEW_LINE>GrayU16 depth = ConvertBufferedImage.convertFrom(UtilImageIO.loadImageNotNull(nameDepth), null, GrayU16.class);<NEW_LINE>var cloud = new DogArray<>(Point3D_F64::new);<NEW_LINE>var cloudColor = new DogArray<>(() -> new int[3]);<NEW_LINE>VisualDepthOps.depthTo3D(param.visualParam, rgb, depth, cloud, cloudColor);<NEW_LINE>PointCloudViewer viewer = VisualizeData.createPointCloudViewer();<NEW_LINE>viewer.setCameraHFov(PerspectiveOps.computeHFov(param.visualParam));<NEW_LINE>viewer.setTranslationStep(15);<NEW_LINE>for (int i = 0; i < cloud.size; i++) {<NEW_LINE>Point3D_F64 p = cloud.get(i);<NEW_LINE>int[] color = cloudColor.get(i);<NEW_LINE>int c = (color[0] << 16) | (color[1] << 8) | color[2];<NEW_LINE>viewer.addPoint(p.x, p.y, p.z, c);<NEW_LINE>}<NEW_LINE>viewer.getComponent().setPreferredSize(new Dimension(rgb.width, rgb.height));<NEW_LINE>// ---------- Display depth image<NEW_LINE>// use the actual max value in the image to maximize its appearance<NEW_LINE>int maxValue = ImageStatistics.max(depth);<NEW_LINE>BufferedImage depthOut = VisualizeImageData.disparity(depth, null, maxValue, 0);<NEW_LINE>ShowImages.showWindow(depthOut, "Depth Image", true);<NEW_LINE>// ---------- Display colorized point cloud<NEW_LINE>ShowImages.showWindow(viewer.getComponent(), "Point Cloud", true);<NEW_LINE>System.out.println("Total points = " + cloud.size);<NEW_LINE>}
|
nameCalib = UtilIO.pathExample("kinect/basket/visualdepth.yaml");
|
454,621
|
public static ClientResponse uninstallBiz(String bizName, String bizVersion) throws Throwable {<NEW_LINE>AssertUtils.assertNotNull(bizFactoryService, "bizFactoryService must not be null!");<NEW_LINE>AssertUtils.assertNotNull(bizManagerService, "bizFactoryService must not be null!");<NEW_LINE>AssertUtils.assertNotNull(bizName, "bizName must not be null!");<NEW_LINE>AssertUtils.assertNotNull(bizVersion, "bizVersion must not be null!");<NEW_LINE>// ignore when uninstall master biz<NEW_LINE>if (bizName.equals(ArkConfigs.getStringValue(Constants.MASTER_BIZ))) {<NEW_LINE>return new ClientResponse().setCode(ResponseCode.FAILED).setMessage("Master biz must not be uninstalled.");<NEW_LINE>}<NEW_LINE>Biz biz = bizManagerService.getBiz(bizName, bizVersion);<NEW_LINE>ClientResponse response = new ClientResponse().setCode(ResponseCode.NOT_FOUND_BIZ).setMessage(String.format("Uninstall biz: %s not found.", BizIdentityUtils.<MASK><NEW_LINE>if (biz != null) {<NEW_LINE>try {<NEW_LINE>biz.stop();<NEW_LINE>} catch (Throwable throwable) {<NEW_LINE>LOGGER.error(String.format("UnInstall Biz: %s fail.", biz.getIdentity()), throwable);<NEW_LINE>throw throwable;<NEW_LINE>} finally {<NEW_LINE>bizManagerService.unRegisterBizStrictly(biz.getBizName(), biz.getBizVersion());<NEW_LINE>}<NEW_LINE>response.setCode(ResponseCode.SUCCESS).setMessage(String.format("Uninstall biz: %s success.", biz.getIdentity()));<NEW_LINE>}<NEW_LINE>LOGGER.info(response.getMessage());<NEW_LINE>return response;<NEW_LINE>}
|
generateBizIdentity(bizName, bizVersion)));
|
135,599
|
public GetRetainedMessageResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>GetRetainedMessageResult getRetainedMessageResult = new GetRetainedMessageResult();<NEW_LINE>AwsJsonReader reader = context.getReader();<NEW_LINE>reader.beginObject();<NEW_LINE>while (reader.hasNext()) {<NEW_LINE>String name = reader.nextName();<NEW_LINE>if (name.equals("topic")) {<NEW_LINE>getRetainedMessageResult.setTopic(StringJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else if (name.equals("payload")) {<NEW_LINE>getRetainedMessageResult.setPayload(ByteBufferJsonUnmarshaller.getInstance<MASK><NEW_LINE>} else if (name.equals("qos")) {<NEW_LINE>getRetainedMessageResult.setQos(IntegerJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else if (name.equals("lastModifiedTime")) {<NEW_LINE>getRetainedMessageResult.setLastModifiedTime(LongJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else {<NEW_LINE>reader.skipValue();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>reader.endObject();<NEW_LINE>return getRetainedMessageResult;<NEW_LINE>}
|
().unmarshall(context));
|
805,393
|
public AviatorObject call(final Map<String, Object> env, final AviatorObject arg1, final AviatorObject arg2) {<NEW_LINE>Object first = arg1.getValue(env);<NEW_LINE>if (first == null) {<NEW_LINE>return AviatorBoolean.FALSE;<NEW_LINE>}<NEW_LINE>Class<?<MASK><NEW_LINE>boolean contains = false;<NEW_LINE>if (Set.class.isAssignableFrom(clazz)) {<NEW_LINE>contains = ((Set) first).contains(arg2.getValue(env));<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>for (Object obj : RuntimeUtils.seq(first, env)) {<NEW_LINE>if (AviatorRuntimeJavaType.valueOf(obj).compareEq(arg2, env) == 0) {<NEW_LINE>contains = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>RuntimeUtils.printStackTrace(env, e);<NEW_LINE>return AviatorBoolean.FALSE;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return AviatorBoolean.valueOf(contains);<NEW_LINE>}
|
> clazz = first.getClass();
|
1,821,331
|
public void menuSelected(MenuEvent event) {<NEW_LINE>Set<JMenuItem> unseen = new HashSet<>(itemMap.values());<NEW_LINE>for (final Editor editor : base.getEditors()) {<NEW_LINE>Sketch sketch = editor.getSketch();<NEW_LINE>JMenuItem item = itemMap.get(sketch);<NEW_LINE>if (item != null) {<NEW_LINE>unseen.remove(item);<NEW_LINE>} else {<NEW_LINE>// it's a new item<NEW_LINE>item = new JCheckBoxMenuItem();<NEW_LINE>sketchMenu.add(item);<NEW_LINE>itemMap.put(sketch, item);<NEW_LINE>}<NEW_LINE>// set selected if the current sketch, deselect if not<NEW_LINE>item.setSelected(sketch<MASK><NEW_LINE>// name may have changed while Sketch object stayed the same<NEW_LINE>String name = sketch.getName();<NEW_LINE>if (!editor.getMode().equals(base.getDefaultMode())) {<NEW_LINE>name += " (" + editor.getMode().getTitle() + ")";<NEW_LINE>}<NEW_LINE>item.setText(name);<NEW_LINE>// Action listener to bring the appropriate sketch in front<NEW_LINE>item.addActionListener(e -> {<NEW_LINE>editor.setState(Frame.NORMAL);<NEW_LINE>editor.setVisible(true);<NEW_LINE>editor.toFront();<NEW_LINE>});<NEW_LINE>// Disabling for now, might be problematic [fry 200117]<NEW_LINE>// Toolkit.setMenuMnemsInside(sketchMenu);<NEW_LINE>}<NEW_LINE>for (JMenuItem item : unseen) {<NEW_LINE>sketchMenu.remove(item);<NEW_LINE>Sketch s = findSketch(item);<NEW_LINE>if (s != null) {<NEW_LINE>itemMap.remove(s);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
|
.equals(getSketch()));
|
25,729
|
public void outputAccumulators(FinishBundleContext context) {<NEW_LINE>// Establish immutable non-null handles to demonstrate that calling other<NEW_LINE>// methods cannot make them null<NEW_LINE>final Map<WindowedStructuralKey<K>, AccumT> accumulators = this.accumulators;<NEW_LINE>final Map<WindowedStructuralKey<K>, Instant> timestamps = this.timestamps;<NEW_LINE>for (Map.Entry<WindowedStructuralKey<K>, Instant> timestampEntry : timestamps.entrySet()) {<NEW_LINE>WindowedStructuralKey<K<MASK><NEW_LINE>Instant timestamp = timestampEntry.getValue();<NEW_LINE>// Note that preCombineAccum may be null because no data arrives, or may be null because<NEW_LINE>// the accumulator type allows null. For this reason, we must iterate the timestamp entrySet<NEW_LINE>AccumT preCombineAccum = accumulators.get(key);<NEW_LINE>context.output(KV.of(key.getKey(), combineFn.compact(preCombineAccum)), timestamp, key.getWindow());<NEW_LINE>}<NEW_LINE>this.accumulators = null;<NEW_LINE>this.timestamps = null;<NEW_LINE>}
|
> key = timestampEntry.getKey();
|
377,720
|
static Model buildModel(Arguments arguments, ClassLoader classLoader, Set<Validator.Feature> features) {<NEW_LINE>List<String> models = arguments.positionalArguments();<NEW_LINE>ModelAssembler assembler = CommandUtils.createModelAssembler(classLoader);<NEW_LINE>ContextualValidationEventFormatter formatter = new ContextualValidationEventFormatter();<NEW_LINE>boolean stdout = features.contains(Validator.Feature.STDOUT);<NEW_LINE>boolean quiet = features.contains(Validator.Feature.QUIET);<NEW_LINE>Consumer<String> writer = stdout ? Cli.getStdout() : Cli.getStderr();<NEW_LINE>// --severity defaults to NOTE.<NEW_LINE>Severity minSeverity = arguments.has(SmithyCli.SEVERITY) ? parseSeverity(arguments.parameter(SmithyCli.SEVERITY)) : Severity.NOTE;<NEW_LINE>assembler.validationEventListener(event -> {<NEW_LINE>// Only log events that are >= --severity.<NEW_LINE>if (event.getSeverity().ordinal() >= minSeverity.ordinal()) {<NEW_LINE>if (event.getSeverity() == Severity.WARNING && !quiet) {<NEW_LINE>// Only log warnings when not quiet<NEW_LINE>Colors.YELLOW.write(writer, formatter.format(event) + System.lineSeparator());<NEW_LINE>} else if (event.getSeverity() == Severity.DANGER || event.getSeverity() == Severity.ERROR) {<NEW_LINE>// Always output error and danger events, even when quiet.<NEW_LINE>Colors.RED.write(writer, formatter.format(event<MASK><NEW_LINE>} else if (!quiet) {<NEW_LINE>writer.accept(formatter.format(event) + System.lineSeparator());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>CommandUtils.handleModelDiscovery(arguments, assembler, classLoader);<NEW_LINE>CommandUtils.handleUnknownTraitsOption(arguments, assembler);<NEW_LINE>models.forEach(assembler::addImport);<NEW_LINE>ValidatedResult<Model> result = assembler.assemble();<NEW_LINE>Validator.validate(result, features);<NEW_LINE>return result.getResult().orElseThrow(() -> new RuntimeException("Expected Validator to throw"));<NEW_LINE>}
|
) + System.lineSeparator());
|
1,785,734
|
protected void encodeScript(FacesContext context, Dialog dialog) throws IOException {<NEW_LINE>WidgetBuilder wb = getWidgetBuilder(context);<NEW_LINE>wb.init("Dialog", dialog);<NEW_LINE>wb.attr("visible", dialog.isVisible(), false).attr("draggable", dialog.isDraggable(), true).attr("resizable", dialog.isResizable(), true).attr("modal", dialog.isModal(), false).attr("blockScroll", dialog.isBlockScroll(), false).attr("width", dialog.getWidth(), null).attr("height", dialog.getHeight(), null).attr("minWidth", dialog.getMinWidth(), Integer.MIN_VALUE).attr("minHeight", dialog.getMinHeight(), Integer.MIN_VALUE).attr("appendTo", SearchExpressionFacade.resolveClientId(context, dialog, dialog.getAppendTo(), SearchExpressionUtils.SET_RESOLVE_CLIENT_SIDE), null).attr("dynamic", dialog.isDynamic(), false).attr("showEffect", dialog.getShowEffect(), null).attr("hideEffect", dialog.getHideEffect(), null).attr("my", dialog.getMy(), null).attr("position", dialog.getPosition(), null).attr("closeOnEscape", dialog.isCloseOnEscape(), false).attr("fitViewport", dialog.isFitViewport(), false).attr("responsive", dialog.isResponsive(), true).attr("cache", dialog.isCache(), true).callback("onHide", "function()", dialog.getOnHide()).callback("onShow", "function()", dialog.getOnShow());<NEW_LINE>String focusExpressions = SearchExpressionFacade.resolveClientIds(context, dialog, dialog.getFocus(), SearchExpressionUtils.SET_RESOLVE_CLIENT_SIDE);<NEW_LINE>if (focusExpressions != null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>encodeClientBehaviors(context, dialog);<NEW_LINE>wb.finish();<NEW_LINE>}
|
wb.attr("focus", focusExpressions);
|
741,909
|
private void handle(GetPrimaryStorageLicenseInfoMsg msg) {<NEW_LINE>GetPrimaryStorageLicenseInfoReply reply = new GetPrimaryStorageLicenseInfoReply();<NEW_LINE>if (!PrimaryStorageSystemTags.PRIMARY_STORAGE_VENDOR.hasTag(msg.getPrimaryStorageUuid())) {<NEW_LINE>bus.reply(msg, reply);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String vendor = PrimaryStorageSystemTags.PRIMARY_STORAGE_VENDOR.getTokenByResourceUuid(msg.<MASK><NEW_LINE>final PrimaryStorageLicenseInfoFactory factory = getPrimaryStorageLicenseInfoFactory(vendor);<NEW_LINE>if (factory == null) {<NEW_LINE>bus.reply(msg, reply);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>factory.getPrimaryStorageLicenseInfo(msg.getPrimaryStorageUuid(), new ReturnValueCompletion<PrimaryStorageLicenseInfo>(msg) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void success(PrimaryStorageLicenseInfo primaryStorageLicenseInfo) {<NEW_LINE>reply.setPrimaryStorageLicenseInfo(primaryStorageLicenseInfo);<NEW_LINE>bus.reply(msg, reply);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void fail(ErrorCode errorCode) {<NEW_LINE>reply.setError(errorCode);<NEW_LINE>bus.reply(msg, reply);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}
|
getPrimaryStorageUuid(), PrimaryStorageSystemTags.PRIMARY_STORAGE_VENDOR_TOKEN);
|
75,744
|
private void buildArrayType(TypeMirror type, Map<String, Integer> typeVariableIndexes, Map<String, TypeMirror> genericSignatures) throws IOException {<NEW_LINE>String typeName = typeWithoutAnnotations(type.toString());<NEW_LINE>if (type.getKind() == TypeKind.DECLARED) {<NEW_LINE>DeclaredType declaredType = (DeclaredType) type;<NEW_LINE>if (declaredType.getTypeArguments().isEmpty()) {<NEW_LINE>code.append(typeName);<NEW_LINE>} else {<NEW_LINE>int first = typeName.indexOf('<');<NEW_LINE>code.append(typeName, 0, first);<NEW_LINE>}<NEW_LINE>code.append(".class");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (type.getKind() == TypeKind.ARRAY) {<NEW_LINE>ArrayType arrayType = (ArrayType) type;<NEW_LINE>code.append("com.dslplatform.json.runtime.Generics.makeArrayType(");<NEW_LINE>buildArrayType(arrayType.getComponentType(), typeVariableIndexes, genericSignatures);<NEW_LINE>code.append(")");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (typeVariableIndexes.containsKey(type.toString())) {<NEW_LINE>Integer index = typeVariableIndexes.get(type.toString());<NEW_LINE>if (index != null && index >= 0) {<NEW_LINE>code.append("actualTypes[").append(Integer.toString(<MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (type instanceof TypeVariable) {<NEW_LINE>if (typeVariableIndexes.containsKey(typeName)) {<NEW_LINE>Integer index = typeVariableIndexes.get(typeName);<NEW_LINE>if (index != null && index >= 0) {<NEW_LINE>code.append("actualTypes[").append(Integer.toString(index)).append("]");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>TypeMirror mirror = genericSignatures.get(typeName);<NEW_LINE>if (mirror != null) {<NEW_LINE>buildArrayType(mirror, typeVariableIndexes, genericSignatures);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>code.append(typeName).append(".class");<NEW_LINE>}
|
index)).append("]");
|
1,552,531
|
final CreateMatchmakingRuleSetResult executeCreateMatchmakingRuleSet(CreateMatchmakingRuleSetRequest createMatchmakingRuleSetRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createMatchmakingRuleSetRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateMatchmakingRuleSetRequest> request = null;<NEW_LINE>Response<CreateMatchmakingRuleSetResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new CreateMatchmakingRuleSetRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createMatchmakingRuleSetRequest));<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, "GameLift");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateMatchmakingRuleSet");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateMatchmakingRuleSetResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateMatchmakingRuleSetResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>}
|
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
|
428,959
|
final StopExperimentResult executeStopExperiment(StopExperimentRequest stopExperimentRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(stopExperimentRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<StopExperimentRequest> request = null;<NEW_LINE>Response<StopExperimentResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new StopExperimentRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(stopExperimentRequest));<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.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StopExperiment");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<StopExperimentResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new StopExperimentResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>}
|
addHandlerContext(HandlerContextKey.SERVICE_ID, "fis");
|
1,654,491
|
private static void addVoidPointersAsSymbols(String structureName, long structureAddress, StructureReader structureReader, IProcess process) throws DataUnavailableException, CorruptDataException {<NEW_LINE>if (structureAddress == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<String> voidFields = getVoidPointerFieldsFromStructure(structureReader, structureName);<NEW_LINE>if (voidFields == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Format the hex and structure name the same as the rest of DDR.<NEW_LINE>int paddingSize = process.bytesPerPointer() * 2;<NEW_LINE>String formatString = "[!%s 0x%0" + paddingSize + "X->%s]";<NEW_LINE>for (String field : voidFields) {<NEW_LINE>if (ignoredSymbols.contains(structureName + "." + field)) {<NEW_LINE>// Ignore this field, it's not a function.<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>long functionAddress = followPointerFromStructure(structureName, structureAddress, field, structureReader, process);<NEW_LINE>if (functionAddress == 0) {<NEW_LINE>// Skip null pointers.<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// Lower case the structure name to match the rest of the DDR !<struct> commands.<NEW_LINE>String symName = String.format(formatString, structureName.toLowerCase(), structureAddress, field);<NEW_LINE>if (functionAddress == 0) {<NEW_LINE>// Null pointer, possibly unset or no longer used.<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (addSymbols) {<NEW_LINE>IModule module = getModuleForInstructionAddress(process, functionAddress);<NEW_LINE>if (module == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>boolean found = false;<NEW_LINE>// Don't override/duplicate symbols we've already seen.<NEW_LINE>for (ISymbol sym : module.getSymbols()) {<NEW_LINE>if (sym.getAddress() == functionAddress) {<NEW_LINE>Logger logger = Logger.getLogger(LoggerNames.LOGGER_STRUCTURE_READER);<NEW_LINE>logger.log(FINER, "DDRSymbolFinder: Found exact match with " + sym.toString() + " not adding.");<NEW_LINE>found = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!found) {<NEW_LINE>Logger logger = Logger.getLogger(LoggerNames.LOGGER_STRUCTURE_READER);<NEW_LINE>logger.<MASK><NEW_LINE>SymbolUtil.addDDRSymbolToModule(module, "[" + field + "]", symName, functionAddress);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
|
log(FINER, "DDRSymbolFinder: Adding new DDR symbol " + symName);
|
974,636
|
public List<InvoiceExportResult> export(@NonNull final InvoiceToExport invoice) {<NEW_LINE>final ImmutableMultimap<CrossVersionRequestConverter, InvoiceAttachment> //<NEW_LINE>converter2ConvertableAttachment = extractConverters(invoice.getInvoiceAttachments());<NEW_LINE>final ImmutableList.Builder<InvoiceExportResult> exportResults = ImmutableList.builder();<NEW_LINE>for (final CrossVersionRequestConverter importConverter : converter2ConvertableAttachment.keySet()) {<NEW_LINE>for (final InvoiceAttachment attachment : converter2ConvertableAttachment.get(importConverter)) {<NEW_LINE>final XmlRequest xRequest = importConverter.toCrossVersionRequest(attachment.getDataAsInputStream());<NEW_LINE>final XmlRequest xAugmentedRequest = augmentRequest(xRequest, invoice);<NEW_LINE>final XmlRequest xRequestAugmentedByConverter = exportConverter.augmentRequest(xAugmentedRequest, invoice.getBiller().getId());<NEW_LINE>final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();<NEW_LINE>exportConverter.fromCrossVersionRequest(xRequestAugmentedByConverter, outputStream);<NEW_LINE>final ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());<NEW_LINE>final InvoiceExportResult exportResult = InvoiceExportResult.builder().data(inputStream).fileName("Export_" + attachment.getFileName()).mimeType(attachment.getMimeType()).invoiceExportProviderId(ForumDatenaustauschChConstants.INVOICE_EXPORT_PROVIDER_ID).recipientId(invoice.getRecipient().<MASK><NEW_LINE>exportResults.add(exportResult);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return exportResults.build();<NEW_LINE>}
|
getId()).build();
|
1,507,656
|
final DeleteTokenResult executeDeleteToken(DeleteTokenRequest deleteTokenRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteTokenRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteTokenRequest> request = null;<NEW_LINE>Response<DeleteTokenResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteTokenRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteTokenRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "License Manager");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteToken");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteTokenResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteTokenResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>}
|
addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
|
1,300,664
|
private void minimize(final File output) throws IOException, MojoFailureException {<NEW_LINE><MASK><NEW_LINE>options.setCodingConvention(new ClosureCodingConvention());<NEW_LINE>options.setOutputCharset(Charset.forName(encoding));<NEW_LINE>options.setWarningLevel(DiagnosticGroups.CHECK_VARIABLES, CheckLevel.WARNING);<NEW_LINE>CompilationLevel.SIMPLE_OPTIMIZATIONS.setOptionsForCompilationLevel(options);<NEW_LINE>Compiler.setLoggingLevel(Level.SEVERE);<NEW_LINE>Compiler compiler = new Compiler();<NEW_LINE>compiler.disableThreads();<NEW_LINE>compiler.initOptions(options);<NEW_LINE>Result result = compiler.compile(Collections.<SourceFile>emptyList(), Arrays.asList(SourceFile.fromFile(output.getAbsolutePath())), options);<NEW_LINE>if (result.success) {<NEW_LINE>FileUtils.fileWrite(output, compiler.toSource());<NEW_LINE>} else {<NEW_LINE>List<JSError> errors = result.errors;<NEW_LINE>throw new MojoFailureException(errors.get(0).toString());<NEW_LINE>}<NEW_LINE>}
|
final CompilerOptions options = new CompilerOptions();
|
1,226,924
|
public void process() {<NEW_LINE>// query for jobs<NEW_LINE>Cursor query = context.getContentResolver().query(Jobs.CONTENT_URI, Jobs.PROJECTION, null, null, Jobs.SORT_OLDEST);<NEW_LINE>if (query == null) {<NEW_LINE>// query failed<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// process jobs, starting with oldest<NEW_LINE>List<Long> jobsToRemove = new ArrayList<>();<NEW_LINE>while (query.moveToNext()) {<NEW_LINE>long jobId = query.getLong(0);<NEW_LINE>int typeId = query.getInt(1);<NEW_LINE>JobAction action = JobAction.fromId(typeId);<NEW_LINE>if (action != JobAction.UNKNOWN) {<NEW_LINE>Timber.d("Running job %d %s", jobId, action);<NEW_LINE>long createdAt = query.getLong(2);<NEW_LINE>byte[] jobInfoArr = query.getBlob(3);<NEW_LINE>ByteBuffer jobInfoBuffered = ByteBuffer.wrap(jobInfoArr);<NEW_LINE>SgJobInfo jobInfo = SgJobInfo.getRootAsSgJobInfo(jobInfoBuffered);<NEW_LINE>if (!doNetworkJob(jobId, action, createdAt, jobInfo)) {<NEW_LINE><MASK><NEW_LINE>// abort to avoid ordering issues<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>Timber.d("Job %d completed, will remove.", jobId);<NEW_LINE>}<NEW_LINE>jobsToRemove.add(jobId);<NEW_LINE>}<NEW_LINE>query.close();<NEW_LINE>// remove completed jobs<NEW_LINE>if (!jobsToRemove.isEmpty()) {<NEW_LINE>removeJobs(jobsToRemove);<NEW_LINE>}<NEW_LINE>}
|
Timber.e("Job %d failed, will retry.", jobId);
|
972,715
|
public Response add(@FormParam("parent") String parentName, @FormParam("name") String name) {<NEW_LINE>if (!authenticate()) {<NEW_LINE>throw new ForbiddenClientException();<NEW_LINE>}<NEW_LINE>checkBaseFunction(BaseFunction.ADMIN);<NEW_LINE>// Validate input<NEW_LINE>name = ValidationUtil.validateLength(name, "name", 1, 50, false);<NEW_LINE>ValidationUtil.validateAlphanumeric(name, "name");<NEW_LINE>// Avoid duplicates<NEW_LINE>GroupDao groupDao = new GroupDao();<NEW_LINE>Group existingGroup = groupDao.getActiveByName(name);<NEW_LINE>if (existingGroup != null) {<NEW_LINE>throw new ClientException("GroupAlreadyExists", MessageFormat<MASK><NEW_LINE>}<NEW_LINE>// Validate parent<NEW_LINE>String parentId = null;<NEW_LINE>if (!Strings.isNullOrEmpty(parentName)) {<NEW_LINE>Group parentGroup = groupDao.getActiveByName(parentName);<NEW_LINE>if (parentGroup == null) {<NEW_LINE>throw new ClientException("ParentGroupNotFound", MessageFormat.format("This group does not exists: {0}", parentName));<NEW_LINE>}<NEW_LINE>parentId = parentGroup.getId();<NEW_LINE>}<NEW_LINE>// Create the group<NEW_LINE>groupDao.create(new Group().setName(name).setParentId(parentId), principal.getId());<NEW_LINE>// Always return OK<NEW_LINE>JsonObjectBuilder response = Json.createObjectBuilder().add("status", "ok");<NEW_LINE>return Response.ok().entity(response.build()).build();<NEW_LINE>}
|
.format("This group already exists: {0}", name));
|
1,118,891
|
public void run(final FlowTrigger trigger, Map data) {<NEW_LINE>installUrl = Q.New(ImageCacheVO.class).eq(ImageCacheVO_.imageUuid, msg.getVolume().getRootImageUuid()).eq(ImageCacheVO_.primaryStorageUuid, msg.getPrimaryStorageUuid()).select(ImageCacheVO_.installUrl).findValue();<NEW_LINE>if (installUrl != null) {<NEW_LINE>trigger.next();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>DownloadVolumeTemplateToPrimaryStorageMsg dmsg = new DownloadVolumeTemplateToPrimaryStorageMsg();<NEW_LINE>dmsg.setTemplateSpec(makeImageSpec(msg.getVolume()));<NEW_LINE>dmsg.setPrimaryStorageUuid(msg.getPrimaryStorageUuid());<NEW_LINE>bus.makeTargetServiceIdByResourceUuid(dmsg, PrimaryStorageConstant.SERVICE_ID, dmsg.getPrimaryStorageUuid());<NEW_LINE>bus.send(dmsg, new CloudBusCallBack(trigger) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run(MessageReply reply) {<NEW_LINE>if (!reply.isSuccess()) {<NEW_LINE>trigger.<MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>installUrl = ((DownloadVolumeTemplateToPrimaryStorageReply) reply).getImageCache().getInstallUrl();<NEW_LINE>trigger.next();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}
|
fail(reply.getError());
|
1,742,085
|
public HiresTileModel rotate(int start, int count, float angle, float axisX, float axisY, float axisZ) {<NEW_LINE>// create quaternion<NEW_LINE>double halfAngle = Math.toRadians(angle) * 0.5;<NEW_LINE>double q = TrigMath.sin(halfAngle) / Math.sqrt(axisX * axisX + axisY * axisY + axisZ * axisZ);<NEW_LINE>double // quaternion<NEW_LINE>qx = axisX * q, qy = axisY * q, qz = axisZ * q, qw = TrigMath.cos(halfAngle), qLength = Math.sqrt(qx * qx + qy * qy + qz * qz + qw * qw);<NEW_LINE>// normalize quaternion<NEW_LINE>qx /= qLength;<NEW_LINE>qy /= qLength;<NEW_LINE>qz /= qLength;<NEW_LINE>qw /= qLength;<NEW_LINE>return rotateByQuaternion(start, count, <MASK><NEW_LINE>}
|
qx, qy, qz, qw);
|
1,077,216
|
// ---------------------- visit //text:a<NEW_LINE>@Override<NEW_LINE>public void visit(TextAElement ele) {<NEW_LINE>StylableAnchor anchor = document.createAnchor(currentContainer);<NEW_LINE>String reference = ele.getXlinkHrefAttribute();<NEW_LINE>applyStyles(ele, anchor);<NEW_LINE>if (anchor.getFont().getColor() == null) {<NEW_LINE>// if no color was applied to the link get the font of the paragraph and set blue color.<NEW_LINE>Font linkFont = anchor.getFont();<NEW_LINE>Style style = currentContainer.getLastStyleApplied();<NEW_LINE>if (style != null) {<NEW_LINE>StyleTextProperties textProperties = style.getTextProperties();<NEW_LINE>if (textProperties != null) {<NEW_LINE>Font font = textProperties.getFont();<NEW_LINE>if (font != null) {<NEW_LINE>linkFont = new Font(font);<NEW_LINE>anchor.setFont(linkFont);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>linkFont.setColor(Converter.toBaseColor(Color.BLUE));<NEW_LINE>}<NEW_LINE>// set the link<NEW_LINE>if (reference.endsWith(StylableHeading.IMPLICIT_REFERENCE_SUFFIX)) {<NEW_LINE>reference = <MASK><NEW_LINE>}<NEW_LINE>anchor.setReference(reference);<NEW_LINE>// Add to current container.<NEW_LINE>addITextContainer(ele, anchor);<NEW_LINE>}
|
"#" + StylableHeading.generateImplicitDestination(reference);
|
215,332
|
private String addProjects(CloseableHttpClient httpClient, Endpoint endpoint, Collection<GitLabProject> projects) throws IOException, SourceConnectorException {<NEW_LINE>HttpGet get = new HttpGet(endpoint.toString());<NEW_LINE>get.addHeader("Accept", "application/json");<NEW_LINE>addSecurity(get);<NEW_LINE>try (CloseableHttpResponse response = httpClient.execute(get)) {<NEW_LINE>try (InputStream contentStream = response.getEntity().getContent()) {<NEW_LINE>JsonNode node = mapper.readTree(contentStream);<NEW_LINE>if (node.isArray()) {<NEW_LINE>ArrayNode array = (ArrayNode) node;<NEW_LINE>array.forEach(obj -> {<NEW_LINE>JsonNode project = obj;<NEW_LINE>int id = project.get("id").asInt();<NEW_LINE>String name = project.get("name").asText();<NEW_LINE>String path = project.get("path").asText();<NEW_LINE>String fullPath = project.get("path_with_namespace").asText();<NEW_LINE>GitLabProject glp = new GitLabProject();<NEW_LINE>glp.setId(id);<NEW_LINE>glp.setName(name);<NEW_LINE>glp.setPath(path);<NEW_LINE>glp.setFull_path(fullPath);<NEW_LINE>projects.add(glp);<NEW_LINE>});<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Header <MASK><NEW_LINE>return getNextPage(linkHeader);<NEW_LINE>}<NEW_LINE>}
|
linkHeader = response.getFirstHeader("Link");
|
713,363
|
public static void addResource(String path, Map<String, LocalResource> resourcesMap, Configuration conf) {<NEW_LINE>try {<NEW_LINE>if (path != null) {<NEW_LINE>// Check the format of the path, if the path is of path#archive, we set resource type as ARCHIVE<NEW_LINE>LocalizableResource localizableResource = new LocalizableResource(path, conf);<NEW_LINE>if (localizableResource.isDirectory()) {<NEW_LINE>Path dirpath = localizableResource.getSourceFilePath();<NEW_LINE>FileStatus[] ls = dirpath.getFileSystem(conf).listStatus(dirpath);<NEW_LINE>for (FileStatus fileStatus : ls) {<NEW_LINE>// We only add first level files.<NEW_LINE>if (fileStatus.isDirectory()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>addResource(fileStatus.getPath().toString(), resourcesMap, conf);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>resourcesMap.put(localizableResource.getLocalizedFileName(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException | ParseException exception) {<NEW_LINE>LOG.error("Failed to add " + path + " to local resources.", exception);<NEW_LINE>}<NEW_LINE>}
|
), localizableResource.toLocalResource());
|
1,141,166
|
public int minCostII(int[][] costs) {<NEW_LINE>if (costs == null || costs.length == 0) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>int n = costs.length;<NEW_LINE>int k = costs[0].length;<NEW_LINE>// min1 is the index of the 1st-smallest cost till previous house<NEW_LINE>// min2 is the index of the 2nd-smallest cost till previous house<NEW_LINE>int min1 = -1;<NEW_LINE>int min2 = -1;<NEW_LINE>for (int i = 0; i < n; i++) {<NEW_LINE>int last1 = min1;<NEW_LINE>int last2 = min2;<NEW_LINE>min1 = -1;<NEW_LINE>min2 = -1;<NEW_LINE>for (int j = 0; j < k; j++) {<NEW_LINE>if (j != last1) {<NEW_LINE>// current color j is different to last min1<NEW_LINE>costs[i][j] += last1 < 0 ? 0 : costs[i - 1][last1];<NEW_LINE>} else {<NEW_LINE>costs[i][j] += last2 < 0 ? 0 : costs<MASK><NEW_LINE>}<NEW_LINE>// find the indices of 1st and 2nd smallest cost of painting current house i<NEW_LINE>if (min1 < 0 || costs[i][j] < costs[i][min1]) {<NEW_LINE>min2 = min1;<NEW_LINE>min1 = j;<NEW_LINE>} else if (min2 < 0 || costs[i][j] < costs[i][min2]) {<NEW_LINE>min2 = j;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return costs[n - 1][min1];<NEW_LINE>}
|
[i - 1][last2];
|
856,079
|
final DeleteAssessmentRunResult executeDeleteAssessmentRun(DeleteAssessmentRunRequest deleteAssessmentRunRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteAssessmentRunRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteAssessmentRunRequest> request = null;<NEW_LINE>Response<DeleteAssessmentRunResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new DeleteAssessmentRunRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteAssessmentRunRequest));<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, "Inspector");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteAssessmentRun");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteAssessmentRunResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteAssessmentRunResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>}
|
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
|
1,783,646
|
public void openLink(String url, String title, String target) {<NEW_LINE>Objects.requireNonNull(url);<NEW_LINE>// javascript: security issue<NEW_LINE>if (SecurityUtils.ignoreThisLink(url))<NEW_LINE>return;<NEW_LINE>// if (pendingAction.size() > 0)<NEW_LINE>// closeLink();<NEW_LINE>pendingAction.add(0, (Element) document.createElement("a"));<NEW_LINE>pendingAction.get(0).setAttribute("target", target);<NEW_LINE>pendingAction.get(0).setAttribute(XLINK_HREF1, url);<NEW_LINE>pendingAction.get(0<MASK><NEW_LINE>pendingAction.get(0).setAttribute("xlink:type", "simple");<NEW_LINE>pendingAction.get(0).setAttribute("xlink:actuate", "onRequest");<NEW_LINE>pendingAction.get(0).setAttribute("xlink:show", "new");<NEW_LINE>if (title == null) {<NEW_LINE>pendingAction.get(0).setAttribute(XLINK_TITLE1, url);<NEW_LINE>pendingAction.get(0).setAttribute(XLINK_TITLE2, url);<NEW_LINE>} else {<NEW_LINE>title = formatTitle(title);<NEW_LINE>pendingAction.get(0).setAttribute(XLINK_TITLE1, title);<NEW_LINE>pendingAction.get(0).setAttribute(XLINK_TITLE2, title);<NEW_LINE>}<NEW_LINE>}
|
).setAttribute(XLINK_HREF2, url);
|
1,085,391
|
static boolean compareGreaterThan(Object left, Object right) {<NEW_LINE>Class<?> leftClass = left == null ? null : left.getClass();<NEW_LINE>Class<?> rightClass = right == null ? null : right.getClass();<NEW_LINE>if (leftClass == Integer.class && rightClass == Integer.class) {<NEW_LINE>return (Integer) left > (Integer) right;<NEW_LINE>}<NEW_LINE>if (leftClass == Double.class && rightClass == Double.class) {<NEW_LINE>return (Double) left > (Double) right;<NEW_LINE>}<NEW_LINE>if (leftClass == Long.class && rightClass == Long.class) {<NEW_LINE>return (Long) left > (Long) right;<NEW_LINE>}<NEW_LINE>// -- compare memory unit<NEW_LINE>if (left instanceof MemoryUnit) {<NEW_LINE>if (right == null)<NEW_LINE>return false;<NEW_LINE>return MemoryUnit.compareTo((MemoryUnit) left, right) > 0;<NEW_LINE>}<NEW_LINE>if (right instanceof MemoryUnit) {<NEW_LINE>if (left == null)<NEW_LINE>return false;<NEW_LINE>return MemoryUnit.compareTo((<MASK><NEW_LINE>}<NEW_LINE>// -- compare duration<NEW_LINE>if (left instanceof Duration) {<NEW_LINE>if (right == null)<NEW_LINE>return false;<NEW_LINE>return Duration.compareTo((Duration) left, right) > 0;<NEW_LINE>}<NEW_LINE>if (right instanceof Duration) {<NEW_LINE>if (left == null)<NEW_LINE>return false;<NEW_LINE>return Duration.compareTo((Duration) right, left) < 0;<NEW_LINE>}<NEW_LINE>// -- fallback on default<NEW_LINE>return ScriptBytecodeAdapter.compareTo(left, right) > 0;<NEW_LINE>}
|
MemoryUnit) right, left) < 0;
|
1,203,140
|
public void processNewResult(Object result) {<NEW_LINE>Database db = ResultUtil.findDatabase(result);<NEW_LINE>// Prepare<NEW_LINE>SetDBIDs positiveids = DBIDUtil.ensureSet(DatabaseUtil.getObjectsByLabelMatch(db, positiveClassName));<NEW_LINE>if (positiveids.size() == 0) {<NEW_LINE>LOG.warning("Computing a ROC curve failed - no objects matched.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<OutlierResult> <MASK><NEW_LINE>List<OrderingResult> orderings = ResultUtil.getOrderingResults(result);<NEW_LINE>// Outlier results are the main use case.<NEW_LINE>for (OutlierResult o : oresults) {<NEW_LINE>DBIDs sorted = o.getOrdering().order(o.getOrdering().getDBIDs());<NEW_LINE>Metadata.hierarchyOf(o).addChild(computePrecisionResult(o.getScores().size(), positiveids, sorted));<NEW_LINE>// Process them only once.<NEW_LINE>orderings.remove(o.getOrdering());<NEW_LINE>}<NEW_LINE>// FIXME: find appropriate place to add the derived result<NEW_LINE>// otherwise apply an ordering to the database IDs.<NEW_LINE>for (OrderingResult or : orderings) {<NEW_LINE>DBIDs sorted = or.order(or.getDBIDs());<NEW_LINE>Metadata.hierarchyOf(or).addChild(computePrecisionResult(or.getDBIDs().size(), positiveids, sorted));<NEW_LINE>}<NEW_LINE>}
|
oresults = OutlierResult.getOutlierResults(result);
|
308,127
|
public void loadProgram() throws Exception {<NEW_LINE>ToyProgramBuilder builder = new ToyProgramBuilder("String Examples", false);<NEW_LINE>builder.createMemory("RAM", "0x0", 0x2000);<NEW_LINE>builder.createString("0x100", "Hello World!\n", StandardCharsets.US_ASCII, true, StringDataType.dataType);<NEW_LINE>Data nonStringBytes = builder.createString("0x150", bytes(0, 1, 2, 3, 4, 0x80, 0x81, 0x82, 0x83), StandardCharsets.US_ASCII, StringDataType.dataType);<NEW_LINE>Data CN_HOVERCRAFT = builder.createString("0x200", "\u6211\u96bb\u6c23\u588a\u8239\u88dd\u6eff\u6652\u9c54", StandardCharsets.UTF_16, true, UnicodeDataType.dataType);<NEW_LINE>builder.createString("0x250", "Exception %s\n\tline: %d\n", StandardCharsets.US_ASCII, true, StringDataType.dataType);<NEW_LINE>builder.createString("0x450", "Roses are \u001b[0;31mred\u001b[0m, violets are \u001b[0;34mblue. Hope you enjoy terminal hue", StandardCharsets.US_ASCII, true, StringDataType.dataType);<NEW_LINE>Data tempDegrees = builder.createString("0x500", "Temp \u2103", Charset.forName("UTF-32LE"), true, Unicode32DataType.dataType);<NEW_LINE>builder.withTransaction(() -> {<NEW_LINE>RenderUnicodeSettingsDefinition.RENDER.setEnumValue(nonStringBytes, RenderUnicodeSettingsDefinition.RENDER_ENUM.BYTE_SEQ);<NEW_LINE>RenderUnicodeSettingsDefinition.RENDER.setEnumValue(tempDegrees, RenderUnicodeSettingsDefinition.RENDER_ENUM.ESC_SEQ);<NEW_LINE>TranslationSettingsDefinition.TRANSLATION.setTranslatedValue(CN_HOVERCRAFT, "My hovercraft is full of eels");<NEW_LINE>TranslationSettingsDefinition.TRANSLATION.setShowTranslated(CN_HOVERCRAFT, true);<NEW_LINE>});<NEW_LINE>program = builder.getProgram();<NEW_LINE>runSwing(() -> {<NEW_LINE>ProgramManager pm = <MASK><NEW_LINE>pm.openProgram(program.getDomainFile());<NEW_LINE>});<NEW_LINE>}
|
tool.getService(ProgramManager.class);
|
1,716,479
|
public Result invoke(final Invoker<?> invoker, final Invocation invocation) throws RpcException {<NEW_LINE>LOGGER.debug("create dubbo xa sources");<NEW_LINE>Class<?> clazz = invoker.getInterface();<NEW_LINE>Class<?>[] args = invocation.getParameterTypes();<NEW_LINE>String methodName = invocation.getMethodName();<NEW_LINE>try {<NEW_LINE>Method method = clazz.getMethod(methodName, args);<NEW_LINE>Hmily hmily = method.getAnnotation(Hmily.class);<NEW_LINE>if (Objects.isNull(hmily)) {<NEW_LINE>return invoker.invoke(invocation);<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>LogUtil.error(<MASK><NEW_LINE>return invoker.invoke(invocation);<NEW_LINE>}<NEW_LINE>// If it is an xa transaction that can be processed.<NEW_LINE>Transaction transaction = TransactionManagerImpl.INST.getTransaction();<NEW_LINE>if (transaction instanceof TransactionImpl) {<NEW_LINE>XAResource resource = new DubboRpcResource(invoker, invocation);<NEW_LINE>try {<NEW_LINE>((TransactionImpl) transaction).doEnList(resource, XAResource.TMJOIN);<NEW_LINE>} catch (SystemException | RollbackException e) {<NEW_LINE>LOGGER.error(":", e);<NEW_LINE>throw new RuntimeException("dubbo xa resource tm join err", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return invoker.invoke(invocation);<NEW_LINE>}
|
LOGGER, "hmily find method error {} ", ex::getMessage);
|
401,587
|
public INDArray computeGradient(INDArray labels, INDArray preOutput, IActivation activationFn, INDArray mask) {<NEW_LINE>if (!labels.equalShapes(preOutput)) {<NEW_LINE>Preconditions.throwEx("Labels and preOutput must have equal shapes: got shapes %s vs %s", labels.shape(), preOutput.shape());<NEW_LINE>}<NEW_LINE>// No-op if already correct dtype<NEW_LINE>labels = labels.castTo(preOutput.dataType());<NEW_LINE>INDArray output = activationFn.getActivation(preOutput.dup(), true);<NEW_LINE>INDArray p1 = output.add(1.0);<NEW_LINE>INDArray dlda = p1.rdiv(2.0 / labels.size(1));<NEW_LINE>INDArray logRatio = Transforms.log(p1.divi(labels.add(1.0)), false);<NEW_LINE>dlda.muli(logRatio);<NEW_LINE>if (weights != null) {<NEW_LINE>dlda.muliRowVector(weights.castTo(dlda.dataType()));<NEW_LINE>}<NEW_LINE>if (mask != null && LossUtil.isPerOutputMasking(dlda, mask)) {<NEW_LINE>// For *most* activation functions: we don't actually need to mask dL/da in addition to masking dL/dz later<NEW_LINE>// but: some, like softmax, require both (due to dL/dz_i being a function of dL/da_j, for i != j)<NEW_LINE>// We could add a special case for softmax (activationFn instanceof ActivationSoftmax) but that would be<NEW_LINE>// error prone - though buy us a tiny bit of performance<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>// dL/dz<NEW_LINE>// TODO activation functions with weights<NEW_LINE>INDArray gradients = activationFn.backprop(preOutput, dlda).getFirst();<NEW_LINE>if (mask != null) {<NEW_LINE>LossUtil.applyMask(gradients, mask);<NEW_LINE>}<NEW_LINE>return gradients;<NEW_LINE>}
|
LossUtil.applyMask(dlda, mask);
|
425,209
|
public boolean isClusterSafe() {<NEW_LINE>Collection<Member> members = nodeEngine.getClusterService().getMembers();<NEW_LINE>if (members == null || members.isEmpty()) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>final Collection<Future<Boolean>> futures = new ArrayList<>(members.size());<NEW_LINE>for (Member member : members) {<NEW_LINE>final <MASK><NEW_LINE>final Operation operation = new SafeStateCheckOperation();<NEW_LINE>final Future<Boolean> future = nodeEngine.getOperationService().invokeOnTarget(InternalPartitionService.SERVICE_NAME, operation, target);<NEW_LINE>futures.add(future);<NEW_LINE>}<NEW_LINE>// todo this max wait is appropriate?<NEW_LINE>final int maxWaitTime = getMaxWaitTime();<NEW_LINE>Collection<Boolean> results = FutureUtil.returnWithDeadline(futures, maxWaitTime, TimeUnit.SECONDS, exceptionHandler);<NEW_LINE>if (results.size() != futures.size()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>for (Boolean result : results) {<NEW_LINE>if (!result) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}
|
Address target = member.getAddress();
|
1,064,114
|
public static void buildVersionInfo(List<? extends Object> list) {<NEW_LINE>ProjectVersionService projectVersionService = CommonBeanFactory.getBean(ProjectVersionService.class);<NEW_LINE>List<String> versionIds = list.stream().map(i -> {<NEW_LINE>Class<?> clazz = i.getClass();<NEW_LINE>try {<NEW_LINE>Method getVersionId = clazz.getMethod("getVersionId");<NEW_LINE>return getVersionId.invoke(i).toString();<NEW_LINE>} catch (Exception e) {<NEW_LINE>LogUtil.error(e);<NEW_LINE>return i.toString();<NEW_LINE>}<NEW_LINE>}).distinct().collect(Collectors.toList());<NEW_LINE>Map<String, String> versionNameMap = projectVersionService.getProjectVersionByIds(versionIds).stream().collect(Collectors.toMap(ProjectVersion::getId, ProjectVersion::getName));<NEW_LINE>list.forEach(i -> {<NEW_LINE>Class<?> clazz = i.getClass();<NEW_LINE>try {<NEW_LINE>Method setVersionName = clazz.<MASK><NEW_LINE>Method getVersionId = clazz.getMethod("getVersionId");<NEW_LINE>Object versionId = getVersionId.invoke(i);<NEW_LINE>setVersionName.invoke(i, versionNameMap.get(versionId));<NEW_LINE>} catch (Exception e) {<NEW_LINE>LogUtil.error(e);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}
|
getMethod("setVersionName", String.class);
|
1,266,755
|
protected boolean isSloppyGesture(MotionEvent event) {<NEW_LINE>boolean sloppy = super.isSloppyGesture(event);<NEW_LINE>if (sloppy) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>final float drag0 = event.getY(0) - mStartY0;<NEW_LINE>final float drag1 = event.getY(1) - mStartY1;<NEW_LINE>final float xSpanDiff = <MASK><NEW_LINE>final float minDim = Math.min(displayMetrics.widthPixels, displayMetrics.heightPixels);<NEW_LINE>final float minDrag = DRAG_THRESHOLD * minDim;<NEW_LINE>if (drag0 * drag1 < 0.0f) {<NEW_LINE>// Sloppy if fingers moving in opposite y direction<NEW_LINE>return true;<NEW_LINE>} else if (Math.abs(drag0) < minDrag || Math.abs(drag1) < minDrag) {<NEW_LINE>return true;<NEW_LINE>} else if (xSpanDiff > XSPAN_THRESHOLD * minDim) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>// Do angle check post drag check!!<NEW_LINE>double angle = Math.abs(Math.atan2(mCurrFingerDiffY, mCurrFingerDiffX));<NEW_LINE>// about 35 degrees, left or right<NEW_LINE>boolean badAngle = !((0.0f < angle && angle < 0.611f) || 2.53f < angle && angle < Math.PI);<NEW_LINE>return badAngle;<NEW_LINE>}
|
Math.abs(mCurrFingerDiffX - mPrevFingerDiffX);
|
201,378
|
protected Flux<Payload> localRequestStream(GSVRoutingMetadata routing, MessageMimeTypeMetadata dataEncodingMetadata, @Nullable MessageAcceptMimeTypesMetadata messageAcceptMimeTypesMetadata, Payload payload) {<NEW_LINE>try {<NEW_LINE>ReactiveMethodHandler methodHandler = localServiceCaller.getInvokeMethod(routing.getService(<MASK><NEW_LINE>if (methodHandler != null) {<NEW_LINE>Object result = invokeLocalService(methodHandler, dataEncodingMetadata, payload);<NEW_LINE>Flux<Object> fluxResult;<NEW_LINE>if (result instanceof Flux) {<NEW_LINE>fluxResult = (Flux<Object>) result;<NEW_LINE>} else {<NEW_LINE>fluxResult = methodHandler.getReactiveAdapter().toFlux(result);<NEW_LINE>}<NEW_LINE>// composite data for return value<NEW_LINE>RSocketMimeType resultEncodingType = resultEncodingType(messageAcceptMimeTypesMetadata, dataEncodingMetadata.getRSocketMimeType(), methodHandler);<NEW_LINE>return fluxResult.map(object -> encodingFacade.encodingResult(object, resultEncodingType)).map(dataByteBuf -> ByteBufPayload.create(dataByteBuf, getCompositeMetadataWithEncoding(resultEncodingType.getType())));<NEW_LINE>} else {<NEW_LINE>ReferenceCountUtil.safeRelease(payload);<NEW_LINE>return Flux.error(new InvalidException(RsocketErrorCode.message("RST-201404", routing.getService(), routing.getMethod())));<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.error(RsocketErrorCode.message("RST-200500"), e);<NEW_LINE>ReferenceCountUtil.safeRelease(payload);<NEW_LINE>return Flux.error(new InvalidException(RsocketErrorCode.message("RST-900500", e.getMessage())));<NEW_LINE>}<NEW_LINE>}
|
), routing.getMethod());
|
1,741,360
|
public EncryptionEntity unmarshall(StaxUnmarshallerContext context) throws Exception {<NEW_LINE>EncryptionEntity encryptionEntity = new EncryptionEntity();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>if (context.isStartOfDocument())<NEW_LINE>targetDepth += 1;<NEW_LINE>while (true) {<NEW_LINE>XMLEvent xmlEvent = context.nextEvent();<NEW_LINE>if (xmlEvent.isEndDocument())<NEW_LINE>return encryptionEntity;<NEW_LINE>if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {<NEW_LINE>if (context.testExpression("PublicKeyId", targetDepth)) {<NEW_LINE>encryptionEntity.setPublicKeyId(StringStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("ProviderId", targetDepth)) {<NEW_LINE>encryptionEntity.setProviderId(StringStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("FieldPatterns", targetDepth)) {<NEW_LINE>encryptionEntity.setFieldPatterns(FieldPatternsStaxUnmarshaller.getInstance<MASK><NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>} else if (xmlEvent.isEndElement()) {<NEW_LINE>if (context.getCurrentDepth() < originalDepth) {<NEW_LINE>return encryptionEntity;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
|
().unmarshall(context));
|
487,515
|
public DataPoint transform(DataPoint dp) {<NEW_LINE>Vec orig = dp.getNumericalValues();<NEW_LINE>final int nnz = orig.nnz();<NEW_LINE>if (// /make sparse<NEW_LINE>nnz / (double) orig.length() < factor) {<NEW_LINE>if (// already sparse, just return<NEW_LINE>orig.isSparse())<NEW_LINE>return dp;<NEW_LINE>// else, make sparse<NEW_LINE>// TODO create a constructor for this<NEW_LINE>SparseVector sv = new SparseVector(orig.length(), nnz);<NEW_LINE>for (int i = 0; i < orig.length(); i++) if (orig.get(i) != 0)<NEW_LINE>sv.set(i, orig.get(i));<NEW_LINE>return new DataPoint(sv, dp.getCategoricalValues(), dp.getCategoricalData());<NEW_LINE>} else // make dense<NEW_LINE>{<NEW_LINE>if (// already dense, just return<NEW_LINE>!orig.isSparse())<NEW_LINE>return dp;<NEW_LINE>DenseVector dv = new DenseVector(orig.length());<NEW_LINE>Iterator<IndexValue> iter = orig.getNonZeroIterator();<NEW_LINE>while (iter.hasNext()) {<NEW_LINE>IndexValue indexValue = iter.next();<NEW_LINE>dv.set(indexValue.getIndex(), indexValue.getValue());<NEW_LINE>}<NEW_LINE>return new DataPoint(dv, dp.getCategoricalValues(<MASK><NEW_LINE>}<NEW_LINE>}
|
), dp.getCategoricalData());
|
1,607,395
|
public List<Variable> batchInsert(List<VariableCreateParam> createParams) {<NEW_LINE>if (CollectionUtils.isEmpty(createParams)) {<NEW_LINE>return Collections.emptyList();<NEW_LINE>}<NEW_LINE>List<RelVariableSubject> rels = new LinkedList<>();<NEW_LINE>List<Variable> variables = createParams.stream().map(p -> {<NEW_LINE>// check name<NEW_LINE>checkUnique(p.getOrgId(), p.getViewId(), p.getName());<NEW_LINE>Variable variable = new Variable();<NEW_LINE>BeanUtils.copyProperties(p, variable);<NEW_LINE>variable.setCreateBy(getCurrentUser().getId());<NEW_LINE>variable.setCreateTime(new Date());<NEW_LINE>variable.<MASK><NEW_LINE>if (!CollectionUtils.isEmpty(p.getRelVariableSubjects())) {<NEW_LINE>for (RelVariableSubject r : p.getRelVariableSubjects()) {<NEW_LINE>r.setCreateBy(getCurrentUser().getId());<NEW_LINE>r.setCreateTime(new Date());<NEW_LINE>r.setId(UUIDGenerator.generate());<NEW_LINE>r.setVariableId(variable.getId());<NEW_LINE>if (r.getUseDefaultValue() == null) {<NEW_LINE>r.setUseDefaultValue(false);<NEW_LINE>}<NEW_LINE>rels.add(r);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return variable;<NEW_LINE>}).collect(Collectors.toList());<NEW_LINE>variableMapper.batchInsert(variables);<NEW_LINE>if (!CollectionUtils.isEmpty(rels)) {<NEW_LINE>rvsMapper.batchInsert(rels);<NEW_LINE>}<NEW_LINE>return variables;<NEW_LINE>}
|
setId(UUIDGenerator.generate());
|
1,072,007
|
public synchronized int read(byte[] b, int off, int len) throws IOException {<NEW_LINE>if (off < 0 || len < 0 || b.length - off < len)<NEW_LINE>throw new IndexOutOfBoundsException();<NEW_LINE>if (len == 0)<NEW_LINE>return 0;<NEW_LINE>if (buf == null)<NEW_LINE>throw new IOException("stream was closed");<NEW_LINE>if (!buf.hasRemaining() && len <= buf.capacity() && !refill())<NEW_LINE>// No bytes were read before EOF.<NEW_LINE>return -1;<NEW_LINE>int read = Math.min(<MASK><NEW_LINE>if (read > 0) {<NEW_LINE>buf.get(b, off, read);<NEW_LINE>statistics.incrementBytesRead(read);<NEW_LINE>off += read;<NEW_LINE>len -= read;<NEW_LINE>}<NEW_LINE>if (len == 0)<NEW_LINE>return read;<NEW_LINE>int more = read(position, b, off, len);<NEW_LINE>if (more <= 0) {<NEW_LINE>if (read > 0) {<NEW_LINE>return read;<NEW_LINE>} else {<NEW_LINE>return -1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>position += more;<NEW_LINE>buf.position(0);<NEW_LINE>buf.limit(0);<NEW_LINE>return read + more;<NEW_LINE>}
|
buf.remaining(), len);
|
1,291,812
|
public void run(RegressionEnvironment env) {<NEW_LINE>String[] fields = "c0".split(",");<NEW_LINE>String epl = "@Name('s0') select irstream theString as c0 from SupportBean#keepall()";<NEW_LINE>env.compileDeployAddListenerMileZero(epl, "s0");<NEW_LINE>env.assertPropsPerRowIterator("s0", fields, new Object[0][]);<NEW_LINE>sendSupportBean(env, "E1");<NEW_LINE>env.assertPropsNew("s0", fields, <MASK><NEW_LINE>env.milestone(1);<NEW_LINE>env.assertPropsPerRowIteratorAnyOrder("s0", fields, new Object[][] { { "E1" } });<NEW_LINE>sendSupportBean(env, "E2");<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { "E2" });<NEW_LINE>env.milestone(2);<NEW_LINE>env.assertPropsPerRowIteratorAnyOrder("s0", fields, new Object[][] { { "E1" }, { "E2" } });<NEW_LINE>sendSupportBean(env, "E3");<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { "E3" });<NEW_LINE>env.milestone(3);<NEW_LINE>env.assertPropsPerRowIteratorAnyOrder("s0", fields, new Object[][] { { "E1" }, { "E2" }, { "E3" } });<NEW_LINE>sendSupportBean(env, "E4");<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { "E4" });<NEW_LINE>env.assertPropsPerRowIteratorAnyOrder("s0", fields, new Object[][] { { "E1" }, { "E2" }, { "E3" }, { "E4" } });<NEW_LINE>env.milestone(4);<NEW_LINE>env.undeployAll();<NEW_LINE>}
|
new Object[] { "E1" });
|
135,711
|
public void publish(LogRecord record) {<NEW_LINE>if (!isLoggable(record) || m_writerOut == null)<NEW_LINE>return;<NEW_LINE>// Format<NEW_LINE>String msg = null;<NEW_LINE>try {<NEW_LINE>msg = getFormatter().format(record);<NEW_LINE>} catch (Exception ex) {<NEW_LINE>reportError("formatting", ex, ErrorManager.FORMAT_FAILURE);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Output<NEW_LINE>try {<NEW_LINE>if (!m_doneHeader) {<NEW_LINE>m_writerOut.write(getFormatter().getHead(this));<NEW_LINE>m_doneHeader = true;<NEW_LINE>}<NEW_LINE>if (record.getLevel() == Level.SEVERE || record.getLevel() == Level.WARNING) {<NEW_LINE>flush();<NEW_LINE>m_writerErr.write(msg);<NEW_LINE>flush();<NEW_LINE>} else {<NEW_LINE>m_writerOut.write(msg);<NEW_LINE>m_writerOut.flush();<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>reportError(<MASK><NEW_LINE>}<NEW_LINE>}
|
"writing", ex, ErrorManager.WRITE_FAILURE);
|
595,748
|
private static TextAttributeDefinition buildTextAttributeDefinition(final TemplateMode templateMode, final TextAttributeName name, final Set<IElementProcessor> elementProcessors) {<NEW_LINE>// No need to use a list for sorting - the elementProcessors set has already been ordered<NEW_LINE>final Set<IElementProcessor> associatedProcessors = new LinkedHashSet<IElementProcessor>(2);<NEW_LINE>if (elementProcessors != null) {<NEW_LINE>for (final IElementProcessor processor : elementProcessors) {<NEW_LINE>if (processor.getTemplateMode() != templateMode) {<NEW_LINE>// We are creating a text element definition, therefore we are only interested on XML processors<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>final <MASK><NEW_LINE>final MatchingAttributeName matchingAttributeName = processor.getMatchingAttributeName();<NEW_LINE>if ((matchingElementName != null && matchingElementName.getTemplateMode() != templateMode) || (matchingAttributeName != null && matchingAttributeName.getTemplateMode() != templateMode)) {<NEW_LINE>throw new ConfigurationException(templateMode + " processors must return " + templateMode + "element names and " + templateMode + " attribute names (processor: " + processor.getClass().getName() + ")");<NEW_LINE>}<NEW_LINE>if (matchingAttributeName == null || matchingAttributeName.isMatchingAllAttributes()) {<NEW_LINE>// This processor does not relate to a specific attribute - surely an element processor<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (!matchingAttributeName.matches(name)) {<NEW_LINE>// Doesn't match. This processor is not associated with this attribute<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>associatedProcessors.add(processor);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Build the final instance<NEW_LINE>return new TextAttributeDefinition(name, associatedProcessors);<NEW_LINE>}
|
MatchingElementName matchingElementName = processor.getMatchingElementName();
|
725,805
|
private void cleanTrash(Long trashId, final ReturnValueCompletion<CleanTrashResult> completion) {<NEW_LINE>CleanTrashResult result = new CleanTrashResult();<NEW_LINE>InstallPathRecycleInventory inv = trash.getTrash(trashId);<NEW_LINE>if (inv == null) {<NEW_LINE>completion.success(result);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String details = trash.makeSureInstallPathNotUsed(inv);<NEW_LINE>if (details != null) {<NEW_LINE>result.getDetails().add(details);<NEW_LINE>completion.success(result);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>DeleteBitsOnBackupStorageMsg msg = new DeleteBitsOnBackupStorageMsg();<NEW_LINE>msg.setInstallPath(inv.getInstallPath());<NEW_LINE>msg.setBackupStorageUuid(self.getUuid());<NEW_LINE>bus.makeTargetServiceIdByResourceUuid(msg, BackupStorageConstant.SERVICE_ID, self.getUuid());<NEW_LINE>bus.send(msg, new CloudBusCallBack(completion) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run(MessageReply reply) {<NEW_LINE>if (reply.isSuccess()) {<NEW_LINE>BackupStorageVO srcBS = dbf.findByUuid(self.<MASK><NEW_LINE>srcBS.setAvailableCapacity(srcBS.getAvailableCapacity() + inv.getSize());<NEW_LINE>dbf.update(srcBS);<NEW_LINE>logger.info(String.format("Deleted image %s and returned space[size:%s] to BS[uuid:%s] after image migration", inv.getInstallPath(), inv.getSize(), self.getUuid()));<NEW_LINE>trash.removeFromDb(inv.getTrashId());<NEW_LINE>result.setSize(inv.getSize());<NEW_LINE>result.setResourceUuids(CollectionDSL.list(inv.getResourceUuid()));<NEW_LINE>completion.success(result);<NEW_LINE>} else {<NEW_LINE>logger.warn(String.format("Failed to delete image %s in image migration.", inv.getInstallPath()));<NEW_LINE>completion.fail(reply.getError());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}
|
getUuid(), BackupStorageVO.class);
|
840,737
|
private boolean subTypeOfType(ReferenceBinding subType, ReferenceBinding typeBinding) {<NEW_LINE>if (typeBinding == null || subType == null)<NEW_LINE>return false;<NEW_LINE>if (TypeBinding.equalsEquals(subType, typeBinding))<NEW_LINE>return true;<NEW_LINE>ReferenceBinding superclass = subType.superclass();<NEW_LINE>if (superclass != null)<NEW_LINE>superclass = (ReferenceBinding) superclass.erasure();<NEW_LINE>// if (superclass != null && superclass.id == TypeIds.T_JavaLangObject && subType.isHierarchyInconsistent()) return false;<NEW_LINE>if (subTypeOfType(superclass, typeBinding))<NEW_LINE>return true;<NEW_LINE>ReferenceBinding[] superInterfaces = subType.superInterfaces();<NEW_LINE>if (superInterfaces != null) {<NEW_LINE>for (int i = 0, length = superInterfaces.length; i < length; i += 1) {<NEW_LINE>ReferenceBinding superInterface = (ReferenceBinding) <MASK><NEW_LINE>if (superInterface.isHierarchyInconsistent())<NEW_LINE>return false;<NEW_LINE>if (subTypeOfType(superInterface, typeBinding))<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>}
|
superInterfaces[i].erasure();
|
1,321,104
|
private <PFRML> int keyin(PFRML target, String text, int modifiers) throws FindFailed {<NEW_LINE>if (target != null && 0 == click(target, 0)) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>Debug profiler = Debug.startTimer("Region.type");<NEW_LINE>if (text != null && !"".equals(text)) {<NEW_LINE>String showText = "";<NEW_LINE>for (int i = 0; i < text.length(); i++) {<NEW_LINE>showText += Key.toJavaKeyCodeText(text.charAt(i));<NEW_LINE>}<NEW_LINE>String modText = "";<NEW_LINE>String modWindows = null;<NEW_LINE>if ((modifiers & KeyModifier.WIN) != 0) {<NEW_LINE>modifiers -= KeyModifier.WIN;<NEW_LINE>modifiers |= KeyModifier.META;<NEW_LINE>log(lvl, "Key.WIN as modifier");<NEW_LINE>modWindows = "Windows";<NEW_LINE>}<NEW_LINE>if (modifiers != 0) {<NEW_LINE>modText = String.format("( %s ) "<MASK><NEW_LINE>if (modWindows != null) {<NEW_LINE>modText = modText.replace("Meta", modWindows);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Debug.action("%s TYPE \"%s\"", modText, showText);<NEW_LINE>log(lvl, "%s TYPE \"%s\"", modText, showText);<NEW_LINE>profiler.lap("before getting Robot");<NEW_LINE>IRobot r = getRobotForRegion();<NEW_LINE>int pause = 20 + (Settings.TypeDelay > 1 ? 1000 : (int) (Settings.TypeDelay * 1000));<NEW_LINE>Settings.TypeDelay = 0.0;<NEW_LINE>profiler.lap("before typing");<NEW_LINE>r.typeStarts();<NEW_LINE>for (int i = 0; i < text.length(); i++) {<NEW_LINE>r.pressModifiers(modifiers);<NEW_LINE>r.typeChar(text.charAt(i), IRobot.KeyMode.PRESS_RELEASE);<NEW_LINE>r.releaseModifiers(modifiers);<NEW_LINE>r.delay(pause);<NEW_LINE>}<NEW_LINE>r.typeEnds();<NEW_LINE>profiler.lap("after typing, before waitForIdle");<NEW_LINE>r.waitForIdle();<NEW_LINE>profiler.end();<NEW_LINE>return 1;<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>}
|
, KeyEvent.getKeyModifiersText(modifiers));
|
1,611,034
|
public void run() {<NEW_LINE>if (mIsForeground && mPaused) {<NEW_LINE>mIsForeground = false;<NEW_LINE>try {<NEW_LINE>double sessionLength = System.currentTimeMillis() - sStartSessionTime;<NEW_LINE>if (sessionLength >= mConfig.getMinimumSessionDuration() && sessionLength < mConfig.getSessionTimeoutDuration()) {<NEW_LINE>double elapsedTime = sessionLength / 1000;<NEW_LINE>double elapsedTimeRounded = Math.round(elapsedTime * 10.0) / 10.0;<NEW_LINE>JSONObject sessionProperties = new JSONObject();<NEW_LINE>sessionProperties.put(AutomaticEvents.SESSION_LENGTH, elapsedTimeRounded);<NEW_LINE>mMpInstance.getPeople().<MASK><NEW_LINE>mMpInstance.getPeople().increment(AutomaticEvents.TOTAL_SESSIONS_LENGTH, elapsedTimeRounded);<NEW_LINE>mMpInstance.track(AutomaticEvents.SESSION, sessionProperties, true);<NEW_LINE>}<NEW_LINE>} catch (JSONException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>mMpInstance.onBackground();<NEW_LINE>}<NEW_LINE>}
|
increment(AutomaticEvents.TOTAL_SESSIONS, 1);
|
816,927
|
public CurrentReceivingHU execute() {<NEW_LINE>final I_PP_Order <MASK><NEW_LINE>final I_PP_Order_BOMLine coProductLine;<NEW_LINE>final LocatorId locatorId;<NEW_LINE>final UomId uomId;<NEW_LINE>final IPPOrderReceiptHUProducer huProducer;<NEW_LINE>if (coProductBOMLineId != null) {<NEW_LINE>coProductLine = ppOrderBOMBL.getOrderBOMLineById(coProductBOMLineId);<NEW_LINE>locatorId = LocatorId.ofRepoId(coProductLine.getM_Warehouse_ID(), coProductLine.getM_Locator_ID());<NEW_LINE>uomId = UomId.ofRepoId(coProductLine.getC_UOM_ID());<NEW_LINE>huProducer = ppOrderBL.receivingByOrCoProduct(coProductBOMLineId);<NEW_LINE>} else {<NEW_LINE>coProductLine = null;<NEW_LINE>locatorId = LocatorId.ofRepoId(ppOrder.getM_Warehouse_ID(), ppOrder.getM_Locator_ID());<NEW_LINE>uomId = UomId.ofRepoId(ppOrder.getC_UOM_ID());<NEW_LINE>huProducer = ppOrderBL.receivingMainProduct(ppOrderId);<NEW_LINE>}<NEW_LINE>final HUPIItemProductId tuPIItemProductId = aggregateToLU.getTUPIItemProductId().orElseGet(() -> HUPIItemProductId.ofRepoIdOrNone(ppOrder.getCurrent_Receiving_TU_PI_Item_Product_ID()));<NEW_LINE>final List<I_M_HU> tusOrVhus = huProducer.movementDate(date).locatorId(locatorId).receiveTUs(Quantitys.create(qtyToReceiveBD, uomId), tuPIItemProductId);<NEW_LINE>final HuId luId = aggregateTUsToLU(tusOrVhus);<NEW_LINE>final CurrentReceivingHU currentReceivingHU = CurrentReceivingHU.builder().tuPIItemProductId(tuPIItemProductId).aggregateToLUId(luId).build();<NEW_LINE>//<NEW_LINE>// Remember current receiving LU.<NEW_LINE>// We will need it later too.<NEW_LINE>if (coProductLine != null) {<NEW_LINE>ManufacturingJobLoaderAndSaver.updateRecordFromCurrentReceivingHU(coProductLine, currentReceivingHU);<NEW_LINE>ppOrderBOMBL.save(coProductLine);<NEW_LINE>} else {<NEW_LINE>ManufacturingJobLoaderAndSaver.updateRecordFromCurrentReceivingHU(ppOrder, currentReceivingHU);<NEW_LINE>ppOrderBL.save(ppOrder);<NEW_LINE>}<NEW_LINE>return currentReceivingHU;<NEW_LINE>}
|
ppOrder = ppOrderBL.getById(ppOrderId);
|
381,833
|
public void deleteById(String id) {<NEW_LINE>String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups");<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));<NEW_LINE>}<NEW_LINE>String workspaceName = Utils.getValueFromIdByName(id, "workspaces");<NEW_LINE>if (workspaceName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id)));<NEW_LINE>}<NEW_LINE>String bookmarkId = Utils.getValueFromIdByName(id, "bookmarks");<NEW_LINE>if (bookmarkId == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'bookmarks'.", id)));<NEW_LINE>}<NEW_LINE>String relationName = Utils.getValueFromIdByName(id, "relations");<NEW_LINE>if (relationName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'relations'.", id)));<NEW_LINE>}<NEW_LINE>this.deleteWithResponse(resourceGroupName, workspaceName, <MASK><NEW_LINE>}
|
bookmarkId, relationName, Context.NONE);
|
766,324
|
private void writePages(Iterator<Page> pageIterator) {<NEW_LINE>checkState(writable, "Spilling no longer allowed. The spiller has been made non-writable on first read for subsequent reads to be consistent");<NEW_LINE>checkState(!committed, "Spilling no longer allowed. Spill file is already committed");<NEW_LINE>while (pageIterator.hasNext()) {<NEW_LINE>Page page = pageIterator.next();<NEW_LINE>spilledPagesInMemorySize += page.getSizeInBytes();<NEW_LINE>// page serialization requires page.getSizeInBytes() + Integer.BYTES to fit in an integer<NEW_LINE>splitPage(page, DEFAULT_MAX_PAGE_SIZE_IN_BYTES).stream().map(serde::serialize).forEach(serializedPage -> {<NEW_LINE><MASK><NEW_LINE>localSpillContext.updateBytes(pageSize);<NEW_LINE>spillerStats.addToTotalSpilledBytes(pageSize);<NEW_LINE>PageDataOutput pageDataOutput = new PageDataOutput(serializedPage);<NEW_LINE>bufferedBytes += toIntExact(pageDataOutput.size());<NEW_LINE>bufferedPages.add(pageDataOutput);<NEW_LINE>if (bufferedBytes > maxBufferSizeInBytes) {<NEW_LINE>flushBufferedPages();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>memoryContext.setBytes(bufferedBytes + dataSink.getRetainedSizeInBytes());<NEW_LINE>}
|
long pageSize = serializedPage.getSizeInBytes();
|
1,841,935
|
public static void horizontal5(Kernel1D_S32 kernel, GrayS16 image, GrayI16 dest, int divisor) {<NEW_LINE>final short[] dataSrc = image.data;<NEW_LINE>final short[] dataDst = dest.data;<NEW_LINE>final int k1 = kernel.data[0];<NEW_LINE>final int k2 = kernel.data[1];<NEW_LINE>final int k3 = kernel.data[2];<NEW_LINE>final int k4 = kernel.data[3];<NEW_LINE>final int k5 = kernel.data[4];<NEW_LINE>final int radius = kernel.getRadius();<NEW_LINE>final <MASK><NEW_LINE>final int halfDivisor = divisor / 2;<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, image.height, i -> {<NEW_LINE>for (int i = 0; i < image.height; i++) {<NEW_LINE>int indexDst = dest.startIndex + i * dest.stride + radius;<NEW_LINE>int j = image.startIndex + i * image.stride - radius;<NEW_LINE>final int jEnd = j + width - radius;<NEW_LINE>for (j += radius; j < jEnd; j++) {<NEW_LINE>int indexSrc = j;<NEW_LINE>int total = (dataSrc[indexSrc++]) * k1;<NEW_LINE>total += (dataSrc[indexSrc++]) * k2;<NEW_LINE>total += (dataSrc[indexSrc++]) * k3;<NEW_LINE>total += (dataSrc[indexSrc++]) * k4;<NEW_LINE>total += (dataSrc[indexSrc]) * k5;<NEW_LINE>dataDst[indexDst++] = (short) ((total + halfDivisor) / divisor);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>}
|
int width = image.getWidth();
|
120,248
|
public Map<String, Object> parse(File file) throws IOException {<NEW_LINE>RandomAccessFile raf = null;<NEW_LINE>byte[] buf = null;<NEW_LINE>try {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>raf = new RandomAccessFile(file, "r");<NEW_LINE>// Parse the HEADER<NEW_LINE>// ----------------<NEW_LINE>// magic number ("bplist")<NEW_LINE>// file format version ("00")<NEW_LINE>int bpli = raf.readInt();<NEW_LINE><MASK><NEW_LINE>if (bpli != 0x62706c69 || st00 != 0x73743030) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>throw new IOException("parseHeader: File does not start with 'bplist00' magic.");<NEW_LINE>}<NEW_LINE>// Parse the TRAILER<NEW_LINE>// ----------------<NEW_LINE>// byte size of offset ints in offset table<NEW_LINE>// byte size of object refs in arrays and dicts<NEW_LINE>// number of offsets in offset table (also is number of objects)<NEW_LINE>// element # in offset table which is top level object<NEW_LINE>raf.seek(raf.length() - 32);<NEW_LINE>// count of offset ints in offset table<NEW_LINE>// offsetCount = (int) raf.readLong();<NEW_LINE>raf.readLong();<NEW_LINE>// count of object refs in arrays and dicts<NEW_LINE>refCount = (int) raf.readLong();<NEW_LINE>// count of offsets in offset table (also is number of objects)<NEW_LINE>// objectCount = (int) raf.readLong();<NEW_LINE>raf.readLong();<NEW_LINE>// element # in offset table which is top level object<NEW_LINE>topLevelOffset = (int) raf.readLong();<NEW_LINE>buf = new byte[topLevelOffset - 8];<NEW_LINE>raf.seek(8);<NEW_LINE>raf.readFully(buf);<NEW_LINE>} finally {<NEW_LINE>if (raf != null) {<NEW_LINE>raf.close();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Parse the OBJECT TABLE<NEW_LINE>// ----------------------<NEW_LINE>objectTable = new ArrayList<Object>();<NEW_LINE>DataInputStream in = null;<NEW_LINE>try {<NEW_LINE>in = new DataInputStream(new ByteArrayInputStream(buf));<NEW_LINE>parseObjectTable(in);<NEW_LINE>} finally {<NEW_LINE>if (in != null) {<NEW_LINE>in.close();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return ((BPLDict) objectTable.get(0)).toMap();<NEW_LINE>}
|
int st00 = raf.readInt();
|
1,430,841
|
final UpdateStackInstancesResult executeUpdateStackInstances(UpdateStackInstancesRequest updateStackInstancesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateStackInstancesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateStackInstancesRequest> request = null;<NEW_LINE>Response<UpdateStackInstancesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateStackInstancesRequestMarshaller().marshall(super.beforeMarshalling(updateStackInstancesRequest));<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.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateStackInstances");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<UpdateStackInstancesResult> responseHandler = new StaxResponseHandler<UpdateStackInstancesResult>(new UpdateStackInstancesResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>}
|
addHandlerContext(HandlerContextKey.SERVICE_ID, "CloudFormation");
|
1,307,266
|
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {<NEW_LINE>final SSLContext sslcontext;<NEW_LINE>final TrustStrategy trustStrategy = allowSelfSignedCertificates ? new TrustSelfSignedStrategy() : null;<NEW_LINE>try {<NEW_LINE>if (StringUtils.isNotEmpty(trustStoreFile)) {<NEW_LINE>sslContextBuilder.loadTrustMaterial(new File(trustStoreFile), trustStorePassword.toCharArray(), trustStrategy);<NEW_LINE>} else {<NEW_LINE>sslContextBuilder.loadTrustMaterial(trustStrategy);<NEW_LINE>}<NEW_LINE>} catch (KeyStoreException | CertificateException | NoSuchAlgorithmException e) {<NEW_LINE>throw new RuntimeException("Invalid trust store file " + trustStoreFile, e);<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>try {<NEW_LINE>if (StringUtils.isNotEmpty(keyStoreFile)) {<NEW_LINE>sslContextBuilder.loadKeyMaterial(new File(keyStoreFile), keyStorePassword.toCharArray(), keyPassword.toCharArray());<NEW_LINE>}<NEW_LINE>} catch (KeyStoreException | CertificateException | NoSuchAlgorithmException | UnrecoverableKeyException e) {<NEW_LINE>throw new RuntimeException("Invalid key store file " + keyStoreFile, e);<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new RuntimeException("Unable to load key store data from " + keyStoreFile, e);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>sslcontext = sslContextBuilder.build();<NEW_LINE>} catch (KeyManagementException | NoSuchAlgorithmException e) {<NEW_LINE>throw new RuntimeException("SSL context initialization failed", e);<NEW_LINE>}<NEW_LINE>httpClientBuilder.setSSLContext(sslcontext);<NEW_LINE>if (disableHostNameVerification) {<NEW_LINE>httpClientBuilder.setSSLHostnameVerifier(new NoopHostnameVerifier());<NEW_LINE>}<NEW_LINE>return httpClientBuilder;<NEW_LINE>}
|
RuntimeException("Unable to load trust store data from " + trustStoreFile, e);
|
1,251,907
|
private void createResultData(Composite panel, String label, int rate) {<NEW_LINE>GridData gridData;<NEW_LINE>// spacer column<NEW_LINE>Label c1 = new Label(panel, SWT.NULL);<NEW_LINE>gridData = new GridData();<NEW_LINE>gridData.horizontalSpan = 1;<NEW_LINE>c1.setLayoutData(gridData);<NEW_LINE>// label<NEW_LINE>Label c2 = new Label(panel, SWT.NULL);<NEW_LINE>gridData = new GridData();<NEW_LINE>gridData.horizontalSpan = 1;<NEW_LINE>gridData.horizontalAlignment = GridData.END;<NEW_LINE>c2.setLayoutData(gridData);<NEW_LINE>c2.setText(label);<NEW_LINE>// bytes<NEW_LINE>Label c3 = new Label(panel, SWT.NULL);<NEW_LINE>gridData = new GridData();<NEW_LINE>gridData.horizontalSpan = 1;<NEW_LINE>gridData.horizontalAlignment = GridData.CENTER;<NEW_LINE>c3.setLayoutData(gridData);<NEW_LINE>c3.setText(DisplayFormatters.formatByteCountToKiBEtcPerSec(rate));<NEW_LINE>// bits<NEW_LINE>Label c4 = new <MASK><NEW_LINE>gridData = new GridData();<NEW_LINE>gridData.horizontalSpan = 1;<NEW_LINE>gridData.horizontalAlignment = GridData.CENTER;<NEW_LINE>c4.setLayoutData(gridData);<NEW_LINE>c4.setText(DisplayFormatters.formatByteCountToBitsPerSec2(rate));<NEW_LINE>// spacer column<NEW_LINE>Label c5 = new Label(panel, SWT.NULL);<NEW_LINE>gridData = new GridData();<NEW_LINE>gridData.horizontalSpan = 1;<NEW_LINE>c5.setLayoutData(gridData);<NEW_LINE>}
|
Label(panel, SWT.NULL);
|
305,212
|
private synchronized void initMySeed() {<NEW_LINE>if (this.mySeed != null)<NEW_LINE>return;<NEW_LINE>// create or init own seed<NEW_LINE>if (this.myOwnSeedFile.length() > 0)<NEW_LINE>try {<NEW_LINE>// load existing identity<NEW_LINE>this.mySeed = Seed.load(this.myOwnSeedFile);<NEW_LINE>if (this.mySeed == null)<NEW_LINE>throw new IOException("current seed is null");<NEW_LINE>} catch (final IOException e) {<NEW_LINE>// create new identity<NEW_LINE>ConcurrentLog.severe("SEEDDB", "could not load stored mySeed.txt from " + this.myOwnSeedFile.toString() + ": " + e.getMessage() + ". creating new seed.", e);<NEW_LINE>this.mySeed = Seed.genLocalSeed(this);<NEW_LINE>try {<NEW_LINE>this.mySeed.save(this.myOwnSeedFile);<NEW_LINE>} catch (final IOException ee) {<NEW_LINE>ConcurrentLog.severe("SEEDDB", "error saving mySeed.txt (1) to " + this.myOwnSeedFile.toString() + ": " + ee.getMessage(), ee);<NEW_LINE>ConcurrentLog.logException(ee);<NEW_LINE>System.exit(-1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>else {<NEW_LINE>// create new identity<NEW_LINE>ConcurrentLog.info("SEEDDB", "could not find stored mySeed.txt at " + this.myOwnSeedFile.toString() + ": " + ". creating new seed.");<NEW_LINE>this.mySeed = Seed.genLocalSeed(this);<NEW_LINE>try {<NEW_LINE>this.mySeed.save(this.myOwnSeedFile);<NEW_LINE>} catch (final IOException ee) {<NEW_LINE>ConcurrentLog.severe("SEEDDB", "error saving mySeed.txt (2) to " + this.myOwnSeedFile.toString() + ": " + ee.getMessage(), ee);<NEW_LINE>ConcurrentLog.logException(ee);<NEW_LINE>System.exit(-1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>this.mySeed.setIPs(Switchboard.<MASK><NEW_LINE>// markup startup condition<NEW_LINE>this.mySeed.put(Seed.PEERTYPE, Seed.PEERTYPE_VIRGIN);<NEW_LINE>}
|
getSwitchboard().myPublicIPs());
|
1,457,307
|
public void endElement(String namespaceURI, String localName, String qualifiedName) throws SAXException {<NEW_LINE>switch(Element.fromString(localName)) {<NEW_LINE>case BROWSER:<NEW_LINE>exitBrowser(namespaceURI, localName, qualifiedName);<NEW_LINE>break;<NEW_LINE>case CLASS:<NEW_LINE>exitClass(namespaceURI, localName, qualifiedName);<NEW_LINE>break;<NEW_LINE>case CONSTRUCTORS:<NEW_LINE><MASK><NEW_LINE>break;<NEW_LINE>case DEPRECATED:<NEW_LINE>exitDeprecated(namespaceURI, localName, qualifiedName);<NEW_LINE>break;<NEW_LINE>case DESCRIPTION:<NEW_LINE>exitDescription(namespaceURI, localName, qualifiedName);<NEW_LINE>break;<NEW_LINE>case EXAMPLE:<NEW_LINE>exitExample(namespaceURI, localName, qualifiedName);<NEW_LINE>break;<NEW_LINE>case EXCEPTION:<NEW_LINE>exitException(namespaceURI, localName, qualifiedName);<NEW_LINE>break;<NEW_LINE>case JAVASCRIPT:<NEW_LINE>exitJavaScript(namespaceURI, localName, qualifiedName);<NEW_LINE>break;<NEW_LINE>case METHOD:<NEW_LINE>case CONSTRUCTOR:<NEW_LINE>exitMethod(namespaceURI, localName, qualifiedName);<NEW_LINE>break;<NEW_LINE>case PARAMETER:<NEW_LINE>exitParameter(namespaceURI, localName, qualifiedName);<NEW_LINE>break;<NEW_LINE>case PROPERTY:<NEW_LINE>exitProperty(namespaceURI, localName, qualifiedName);<NEW_LINE>break;<NEW_LINE>case REMARKS:<NEW_LINE>exitRemarks(namespaceURI, localName, qualifiedName);<NEW_LINE>break;<NEW_LINE>case RETURN_DESCRIPTION:<NEW_LINE>exitReturnDescription(namespaceURI, localName, qualifiedName);<NEW_LINE>break;<NEW_LINE>case RETURN_TYPE:<NEW_LINE>exitReturnType(namespaceURI, localName, qualifiedName);<NEW_LINE>break;<NEW_LINE>case VALUE:<NEW_LINE>exitValue(namespaceURI, localName, qualifiedName);<NEW_LINE>break;<NEW_LINE>case UNDEFINED:<NEW_LINE>// $NON-NLS-1$<NEW_LINE>IdeLog.// $NON-NLS-1$<NEW_LINE>logWarning(// $NON-NLS-1$<NEW_LINE>JSCorePlugin.getDefault(), MessageFormat.format("Unable to convert element with name {0} to enum value", localName));<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>// do nothing<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>super.endElement(namespaceURI, localName, qualifiedName);<NEW_LINE>}
|
exitConstructors(namespaceURI, localName, qualifiedName);
|
480,901
|
public void addListGrid(ClassMetadata cmd, ListGrid listGrid, String tabName, Integer tabOrder, String groupName, boolean isTabPresent) {<NEW_LINE>tabName = tabName == null ? DEFAULT_TAB_NAME : tabName;<NEW_LINE>tabOrder = tabOrder == null ? DEFAULT_TAB_ORDER : tabOrder;<NEW_LINE>// Check CMD for Tab/Group name overrides so that Tabs/Groups can be properly found by their display names<NEW_LINE>boolean groupFound = false;<NEW_LINE>Map<String, TabMetadata> tabMetadataMap = cmd.getTabAndGroupMetadata();<NEW_LINE>for (String tabKey : tabMetadataMap.keySet()) {<NEW_LINE>Map<String, GroupMetadata> groupMetadataMap = tabMetadataMap.get(tabKey).getGroupMetadata();<NEW_LINE>for (String groupKey : groupMetadataMap.keySet()) {<NEW_LINE>if (groupKey.equals(groupName) || groupMetadataMap.get(groupKey).getGroupName().equals(groupName)) {<NEW_LINE>groupName = groupMetadataMap.get(groupKey).getGroupName();<NEW_LINE>groupFound = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (groupFound) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (tabKey.equals(tabName) || tabMetadataMap.get(tabKey).getTabName().equals(tabName)) {<NEW_LINE>tabName = tabMetadataMap.get(tabKey).getTabName();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>FieldGroup fieldGroup = findGroup(groupName);<NEW_LINE>Tab tab = findTab(tabName);<NEW_LINE>if (fieldGroup != null) {<NEW_LINE>fieldGroup.addListGrid(listGrid);<NEW_LINE>} else if (fieldGroup == null && tab != null) {<NEW_LINE>tab.getListGrids().add(listGrid);<NEW_LINE>} else {<NEW_LINE>tab = new Tab();<NEW_LINE>tab.setKey(tabName);<NEW_LINE>tab.setTitle<MASK><NEW_LINE>tab.setOrder(tabOrder);<NEW_LINE>tab.setTabsPresent(isTabPresent);<NEW_LINE>tabs.add(tab);<NEW_LINE>tab.getListGrids().add(listGrid);<NEW_LINE>}<NEW_LINE>}
|
(BLCMessageUtils.getMessage(tabName));
|
1,597,361
|
private void importFromMediationTicket(String tradeId) {<NEW_LINE>clearInputFields();<NEW_LINE>Optional<Dispute> optionalDispute = mediationManager.findDispute(tradeId);<NEW_LINE>if (optionalDispute.isPresent()) {<NEW_LINE>Dispute dispute = optionalDispute.get();<NEW_LINE>depositTxHex.<MASK><NEW_LINE>if (dispute.disputeResultProperty().get() != null) {<NEW_LINE>buyerPayoutAmount.setText(dispute.disputeResultProperty().get().getBuyerPayoutAmount().toPlainString());<NEW_LINE>sellerPayoutAmount.setText(dispute.disputeResultProperty().get().getSellerPayoutAmount().toPlainString());<NEW_LINE>}<NEW_LINE>buyerAddressString.setText(dispute.getContract().getBuyerPayoutAddressString());<NEW_LINE>sellerAddressString.setText(dispute.getContract().getSellerPayoutAddressString());<NEW_LINE>buyerPubKeyAsHex.setText(Utils.HEX.encode(dispute.getContract().getBuyerMultiSigPubKey()));<NEW_LINE>sellerPubKeyAsHex.setText(Utils.HEX.encode(dispute.getContract().getSellerMultiSigPubKey()));<NEW_LINE>// switch back to the inputs pane<NEW_LINE>hideAllPanes();<NEW_LINE>inputsGridPane.setVisible(true);<NEW_LINE>UserThread.execute(() -> new Popup().warning("Ticket imported. You still need to enter the multisig amount and specify if it is a legacy Tx").show());<NEW_LINE>}<NEW_LINE>}
|
setText(dispute.getDepositTxId());
|
769,975
|
// Returns true if the relation holds.<NEW_LINE>static boolean multiPointRelatePoint_(MultiPoint multipoint_a, Point point_b, double tolerance, String scl, ProgressTracker progress_tracker) {<NEW_LINE>RelationalOperationsMatrix relOps = new RelationalOperationsMatrix();<NEW_LINE>relOps.resetMatrix_();<NEW_LINE>relOps.setPredicates_(scl);<NEW_LINE>relOps.setPointPointPredicates_();<NEW_LINE>Envelope2D env_a = new Envelope2D();<NEW_LINE>multipoint_a.queryEnvelope2D(env_a);<NEW_LINE>Point2D pt_b = point_b.getXY();<NEW_LINE>boolean bRelationKnown = false;<NEW_LINE>boolean b_disjoint = RelationalOperations.pointDisjointEnvelope_(pt_b, env_a, tolerance, progress_tracker);<NEW_LINE>if (b_disjoint) {<NEW_LINE>relOps.pointPointDisjointPredicates_();<NEW_LINE>bRelationKnown = true;<NEW_LINE>}<NEW_LINE>if (!bRelationKnown) {<NEW_LINE>boolean b_intersects = false;<NEW_LINE>boolean b_multipoint_contained = true;<NEW_LINE>double tolerance_sq = tolerance * tolerance;<NEW_LINE>for (int i = 0; i < multipoint_a.getPointCount(); i++) {<NEW_LINE>Point2D pt_a = multipoint_a.getXY(i);<NEW_LINE>if (Point2D.sqrDistance(pt_a, pt_b) <= tolerance_sq)<NEW_LINE>b_intersects = true;<NEW_LINE>else<NEW_LINE>b_multipoint_contained = false;<NEW_LINE>if (b_intersects && !b_multipoint_contained)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (b_intersects) {<NEW_LINE>relOps.m_matrix[MatrixPredicate.InteriorInterior] = 0;<NEW_LINE>if (!b_multipoint_contained)<NEW_LINE>relOps.m_matrix[MatrixPredicate.InteriorExterior] = 0;<NEW_LINE>else<NEW_LINE>relOps.m_matrix[MatrixPredicate.InteriorExterior] = -1;<NEW_LINE>relOps.m_matrix[MatrixPredicate.ExteriorInterior] = -1;<NEW_LINE>} else {<NEW_LINE>relOps.m_matrix[MatrixPredicate.InteriorInterior] = -1;<NEW_LINE>relOps.m_matrix[MatrixPredicate.InteriorExterior] = 0;<NEW_LINE>relOps.m_matrix[MatrixPredicate.ExteriorInterior] = 0;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>boolean bRelation = <MASK><NEW_LINE>return bRelation;<NEW_LINE>}
|
relationCompare_(relOps.m_matrix, scl);
|
1,099,045
|
public void showAnnualReport(ActionRequest request, ActionResponse response) throws JSONException, NumberFormatException, AxelorException {<NEW_LINE>String employeeId = request.getContext().get("_id").toString();<NEW_LINE>String year = request.getContext().get("year").toString();<NEW_LINE>int yearId = new JSONObject(year).getInt("id");<NEW_LINE>String yearName = new JSONObject(year).getString("name");<NEW_LINE><MASK><NEW_LINE>String name = I18n.get("Annual expenses report") + " : " + user.getFullName() + " (" + yearName + ")";<NEW_LINE>String fileLink = ReportFactory.createReport(IReport.EMPLOYEE_ANNUAL_REPORT, name).addParam("EmployeeId", Long.valueOf(employeeId)).addParam("Timezone", getTimezone(Beans.get(EmployeeRepository.class).find(Long.valueOf(employeeId)).getUser())).addParam("YearId", Long.valueOf(yearId)).addParam("Locale", ReportSettings.getPrintingLocale(null)).toAttach(Beans.get(EmployeeRepository.class).find(Long.valueOf(employeeId))).generate().getFileLink();<NEW_LINE>response.setView(ActionView.define(name).add("html", fileLink).map());<NEW_LINE>response.setCanClose(true);<NEW_LINE>}
|
User user = AuthUtils.getUser();
|
1,358,985
|
protected int createOrUpdateUsingBatch(Set<Long> workItems) {<NEW_LINE>TransactionLegacy txn = TransactionLegacy.currentTxn();<NEW_LINE>PreparedStatement stmtInsert = null;<NEW_LINE>int[] queryResult = null;<NEW_LINE>int count = 0;<NEW_LINE>boolean success = true;<NEW_LINE>try {<NEW_LINE>stmtInsert = txn.prepareAutoCloseStatement(InsertOrUpdateSQl);<NEW_LINE>txn.start();<NEW_LINE>for (Long vmId : workItems) {<NEW_LINE><MASK><NEW_LINE>stmtInsert.addBatch();<NEW_LINE>count++;<NEW_LINE>if (count % 16 == 0) {<NEW_LINE>queryResult = stmtInsert.executeBatch();<NEW_LINE>stmtInsert.clearBatch();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>queryResult = stmtInsert.executeBatch();<NEW_LINE>txn.commit();<NEW_LINE>if (s_logger.isTraceEnabled())<NEW_LINE>s_logger.trace("Updated or inserted " + workItems.size() + " log items");<NEW_LINE>} catch (SQLException e) {<NEW_LINE>s_logger.warn("Failed to execute batch update statement for ruleset log: ", e);<NEW_LINE>txn.rollback();<NEW_LINE>success = false;<NEW_LINE>}<NEW_LINE>if (!success && queryResult != null) {<NEW_LINE>Long[] arrayItems = new Long[workItems.size()];<NEW_LINE>workItems.toArray(arrayItems);<NEW_LINE>for (int i = 0; i < queryResult.length; i++) {<NEW_LINE>if (queryResult[i] < 0) {<NEW_LINE>s_logger.debug("Batch query update failed for vm " + arrayItems[i]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return count;<NEW_LINE>}
|
stmtInsert.setLong(1, vmId);
|
1,354,398
|
private static Relationship fromMap(final Map<String, Object> map) {<NEW_LINE>final Relationship var = new Relationship();<NEW_LINE>var.setInode((String<MASK><NEW_LINE>var.setParentStructureInode((String) map.get("parent_structure_inode"));<NEW_LINE>var.setChildStructureInode((String) map.get("child_structure_inode"));<NEW_LINE>var.setParentRelationName((String) map.get("parent_relation_name"));<NEW_LINE>var.setChildRelationName((String) map.get("child_relation_name"));<NEW_LINE>var.setRelationTypeValue((String) map.get("relation_type_value"));<NEW_LINE>var.setFixed(DbConnectionFactory.isDBTrue(map.get("fixed").toString()));<NEW_LINE>var.setParentRequired(DbConnectionFactory.isDBTrue(map.get("parent_required").toString()));<NEW_LINE>var.setChildRequired(DbConnectionFactory.isDBTrue(map.get("child_required").toString()));<NEW_LINE>var.setCardinality(ConversionUtils.toInt(map.get("cardinality"), 0));<NEW_LINE>var.setModDate((Date) map.get("mod_date"));<NEW_LINE>return var;<NEW_LINE>}
|
) map.get("inode"));
|
41,979
|
private Position decodeAlternative(Channel channel, SocketAddress remoteAddress, String sentence) {<NEW_LINE>Parser parser = new Parser(PATTERN_ALT, sentence);<NEW_LINE>if (!parser.matches()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next());<NEW_LINE>if (deviceSession == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Position position = new Position(getProtocolName());<NEW_LINE>position.setDeviceId(deviceSession.getDeviceId());<NEW_LINE>position.set(Position.KEY_EVENT, parser.next());<NEW_LINE>position.set("sensorId", parser.next());<NEW_LINE>position.set("sensorVoltage", parser.nextDouble());<NEW_LINE>position.setTime(parser.nextDateTime(Parser.DateTimeFormat.HMS_DMY));<NEW_LINE>position.set(Position.KEY_RSSI, parser.nextInt());<NEW_LINE>position.setValid(parser.nextInt() > 0);<NEW_LINE>position.setLatitude(parser.nextDouble());<NEW_LINE>position.setLongitude(parser.nextDouble());<NEW_LINE>position.setSpeed(UnitsConverter.knotsFromKph(parser.nextInt()));<NEW_LINE>position.setCourse(parser.nextInt());<NEW_LINE>position.setAltitude(parser.nextInt());<NEW_LINE>position.set(Position.KEY_HDOP, parser.nextDouble());<NEW_LINE>position.set(Position.KEY_SATELLITES, parser.nextInt());<NEW_LINE>position.set(Position.KEY_IGNITION, <MASK><NEW_LINE>position.set(Position.KEY_CHARGE, parser.nextInt() > 0);<NEW_LINE>position.set("error", parser.next());<NEW_LINE>return position;<NEW_LINE>}
|
parser.nextInt() > 0);
|
1,277,179
|
public static ObservableMetricsSystem create(final MetricsConfiguration metricsConfiguration) {<NEW_LINE>LOG.trace(<MASK><NEW_LINE>if (!metricsConfiguration.isEnabled() && !metricsConfiguration.isPushEnabled()) {<NEW_LINE>return new NoOpMetricsSystem();<NEW_LINE>}<NEW_LINE>if (PROMETHEUS.equals(metricsConfiguration.getProtocol())) {<NEW_LINE>final PrometheusMetricsSystem metricsSystem = new PrometheusMetricsSystem(metricsConfiguration.getMetricCategories(), metricsConfiguration.isTimersEnabled());<NEW_LINE>metricsSystem.init();<NEW_LINE>return metricsSystem;<NEW_LINE>} else if (OPENTELEMETRY.equals(metricsConfiguration.getProtocol())) {<NEW_LINE>final OpenTelemetrySystem metricsSystem = new OpenTelemetrySystem(metricsConfiguration.getMetricCategories(), metricsConfiguration.isTimersEnabled(), metricsConfiguration.getPrometheusJob());<NEW_LINE>metricsSystem.initDefaults();<NEW_LINE>return metricsSystem;<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("Invalid metrics protocol " + metricsConfiguration.getProtocol());<NEW_LINE>}<NEW_LINE>}
|
"Creating a metric system with {}", metricsConfiguration.getProtocol());
|
1,085,173
|
public static boolean shapeEquals(long[] shape1, long[] shape2) {<NEW_LINE>if (isColumnVectorShape(shape1) && isColumnVectorShape(shape2)) {<NEW_LINE>return Arrays.equals(shape1, shape2);<NEW_LINE>}<NEW_LINE>if (isRowVectorShape(shape1) && isRowVectorShape(shape2)) {<NEW_LINE>long[] shape1Comp = squeeze(shape1);<NEW_LINE>long<MASK><NEW_LINE>return Arrays.equals(shape1Comp, shape2Comp);<NEW_LINE>}<NEW_LINE>// scalars<NEW_LINE>if (shape1.length == 0 || shape2.length == 0) {<NEW_LINE>if (shape1.length == 0 && shapeIsScalar(shape2)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (shape2.length == 0 && shapeIsScalar(shape1)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>shape1 = squeeze(shape1);<NEW_LINE>shape2 = squeeze(shape2);<NEW_LINE>return scalarEquals(shape1, shape2) || Arrays.equals(shape1, shape2);<NEW_LINE>}
|
[] shape2Comp = squeeze(shape2);
|
575,505
|
public void resolve(InjectionBinding<PersistenceUnit> injectionBinding) throws InjectionException {<NEW_LINE>final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();<NEW_LINE>if (isTraceOn && tc.isEntryEnabled())<NEW_LINE>Tr.entry(tc, "resolve : " + injectionBinding);<NEW_LINE>JPAPUnitInjectionBinding pUnitBinding = (JPAPUnitInjectionBinding) injectionBinding;<NEW_LINE><MASK><NEW_LINE>String modJarName = pUnitBinding.getModJarName();<NEW_LINE>String puName = pUnitBinding.getAnnotation().unitName();<NEW_LINE>// If this is a WAR module with EJBs, then the isSFSB setting is not reliable,<NEW_LINE>// so use a different object factory which knows how to look at the metadata<NEW_LINE>// on the thread to determine if running in a stateful bean context. F743-30682<NEW_LINE>boolean isEJBinWar = ivNameSpaceConfig.getOwningFlow() == HYBRID;<NEW_LINE>JPAPuId puId = new JPAPuId(applName, modJarName, puName);<NEW_LINE>AbstractJPAComponent jpaComponent = (AbstractJPAComponent) JPAAccessor.getJPAComponent();<NEW_LINE>Reference ref = // d510184<NEW_LINE>jpaComponent.// d510184<NEW_LINE>createPersistenceUnitReference(// d510184<NEW_LINE>isEJBinWar, // d510184<NEW_LINE>puId, // d510184<NEW_LINE>ivNameSpaceConfig.getJ2EEName(), // d416151.3.1<NEW_LINE>pUnitBinding.getJndiName(), ivNameSpaceConfig.isSFSB());<NEW_LINE>pUnitBinding.setObjects(null, ref);<NEW_LINE>if (isTraceOn && tc.isEntryEnabled())<NEW_LINE>Tr.exit(tc, "resolve : " + pUnitBinding);<NEW_LINE>}
|
String applName = pUnitBinding.getApplName();
|
88,525
|
private static void configure(String propertiesFile) throws IOException {<NEW_LINE>FileInputStream inputStream = new FileInputStream(propertiesFile);<NEW_LINE>Properties properties = new Properties();<NEW_LINE>try {<NEW_LINE>properties.load(inputStream);<NEW_LINE>} finally {<NEW_LINE>inputStream.close();<NEW_LINE>}<NEW_LINE>String topologyNameOverride = properties.getProperty(ConfigKeys.TOPOLOGY_NAME_KEY);<NEW_LINE>if (topologyNameOverride != null) {<NEW_LINE>topologyName = topologyNameOverride;<NEW_LINE>}<NEW_LINE>LOG.info("Using topology name " + topologyName);<NEW_LINE>String streamNameOverride = properties.getProperty(ConfigKeys.STREAM_NAME_KEY);<NEW_LINE>if (streamNameOverride != null) {<NEW_LINE>streamName = streamNameOverride;<NEW_LINE>}<NEW_LINE>LOG.info("Using stream name " + streamName);<NEW_LINE>String initialPositionOverride = properties.getProperty(ConfigKeys.INITIAL_POSITION_IN_STREAM_KEY);<NEW_LINE>if (initialPositionOverride != null) {<NEW_LINE>initialPositionInStream = InitialPositionInStream.valueOf(initialPositionOverride);<NEW_LINE>}<NEW_LINE>LOG.info("Using initial position " + initialPositionInStream.toString() + " (if a checkpoint is not found).");<NEW_LINE>String zookeeperEndpointOverride = properties.getProperty(ConfigKeys.ZOOKEEPER_ENDPOINT_KEY);<NEW_LINE>if (zookeeperEndpointOverride != null) {<NEW_LINE>zookeeperEndpoint = zookeeperEndpointOverride;<NEW_LINE>}<NEW_LINE>LOG.info("Using zookeeper endpoint " + zookeeperEndpoint);<NEW_LINE>String zookeeperPrefixOverride = <MASK><NEW_LINE>if (zookeeperPrefixOverride != null) {<NEW_LINE>zookeeperPrefix = zookeeperPrefixOverride;<NEW_LINE>}<NEW_LINE>LOG.info("Using zookeeper prefix " + zookeeperPrefix);<NEW_LINE>String elasticCacheRedisEndpointOverride = properties.getProperty(ConfigKeys.REDIS_ENDPOINT_KEY);<NEW_LINE>if (elasticCacheRedisEndpointOverride != null) {<NEW_LINE>elasticCacheRedisEndpoint = elasticCacheRedisEndpointOverride;<NEW_LINE>}<NEW_LINE>LOG.info("Using zookeeper prefix " + elasticCacheRedisEndpoint);<NEW_LINE>String regionNameOverride = properties.getProperty(ConfigKeys.REGION_NAME);<NEW_LINE>if (regionNameOverride != null) {<NEW_LINE>regionName = regionNameOverride;<NEW_LINE>}<NEW_LINE>LOG.info("Using Region " + regionName);<NEW_LINE>}
|
properties.getProperty(ConfigKeys.ZOOKEEPER_PREFIX_KEY);
|
1,541,446
|
public void testThatResponseValidationForOneResponseBookFails(Map<String, String> param, StringBuilder ret) throws Exception {<NEW_LINE>// Will double check why 1234 is not correct for this case later<NEW_LINE>String uri = getAddress("bookstore/booksResponse/123");<NEW_LINE>Response cResp = client.target(uri)<MASK><NEW_LINE>assertEquals(Status.INTERNAL_SERVER_ERROR.getStatusCode(), cResp.getStatus());<NEW_LINE>String uri2 = getAddress("bookstore/books");<NEW_LINE>Response resp = client.target(uri2).request().post(Entity.entity("id=123", MediaType.APPLICATION_FORM_URLENCODED + "; charset=UTF-8"));<NEW_LINE>assertEquals(Status.CREATED.getStatusCode(), resp.getStatus());<NEW_LINE>client = ClientBuilder.newClient();<NEW_LINE>uri = getAddress("bookstore/booksResponse/123");<NEW_LINE>cResp = client.target(uri).request().get();<NEW_LINE>assertEquals(Status.INTERNAL_SERVER_ERROR.getStatusCode(), cResp.getStatus());<NEW_LINE>ret.append("OK");<NEW_LINE>}
|
.request().get();
|
1,038,752
|
public void marshall(PackageVersionDescription packageVersionDescription, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (packageVersionDescription == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(packageVersionDescription.getFormat(), FORMAT_BINDING);<NEW_LINE>protocolMarshaller.marshall(packageVersionDescription.getNamespace(), NAMESPACE_BINDING);<NEW_LINE>protocolMarshaller.marshall(packageVersionDescription.getPackageName(), PACKAGENAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(packageVersionDescription.getDisplayName(), DISPLAYNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(packageVersionDescription.getVersion(), VERSION_BINDING);<NEW_LINE>protocolMarshaller.marshall(packageVersionDescription.getSummary(), SUMMARY_BINDING);<NEW_LINE>protocolMarshaller.marshall(packageVersionDescription.getHomePage(), HOMEPAGE_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(packageVersionDescription.getPublishedTime(), PUBLISHEDTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(packageVersionDescription.getLicenses(), LICENSES_BINDING);<NEW_LINE>protocolMarshaller.marshall(packageVersionDescription.getRevision(), REVISION_BINDING);<NEW_LINE>protocolMarshaller.marshall(packageVersionDescription.getStatus(), STATUS_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>}
|
packageVersionDescription.getSourceCodeRepository(), SOURCECODEREPOSITORY_BINDING);
|
931,637
|
public CloudTrailDetails unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>CloudTrailDetails cloudTrailDetails = new CloudTrailDetails();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("accessRole", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>cloudTrailDetails.setAccessRole(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("endTime", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>cloudTrailDetails.setEndTime(DateJsonUnmarshallerFactory.getInstance("iso8601").unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("startTime", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>cloudTrailDetails.setStartTime(DateJsonUnmarshallerFactory.getInstance(<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("trails", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>cloudTrailDetails.setTrails(new ListUnmarshaller<Trail>(TrailJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return cloudTrailDetails;<NEW_LINE>}
|
"iso8601").unmarshall(context));
|
235,930
|
public List<MapMarkersGroup> loadGroupsLegacy() {<NEW_LINE>Map<String, MapMarkersGroup> groupsMap = getAllGroupsMap();<NEW_LINE>Iterator<Entry<String, MapMarkersGroup>> iterator = groupsMap.entrySet().iterator();<NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>MapMarkersGroup group = iterator.next().getValue();<NEW_LINE>if (group.getType() == ItineraryType.TRACK && !new File(group.getId()).exists()) {<NEW_LINE>iterator.remove();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<MapMarker> allMarkers = new ArrayList<>();<NEW_LINE>allMarkers.addAll(markersDbHelper.getActiveMarkers(true));<NEW_LINE>allMarkers.addAll<MASK><NEW_LINE>MapMarkersGroup noGroup = null;<NEW_LINE>for (MapMarker marker : allMarkers) {<NEW_LINE>MapMarkersGroup group = groupsMap.get(marker.groupKey);<NEW_LINE>if (group == null) {<NEW_LINE>if (noGroup == null) {<NEW_LINE>noGroup = new MapMarkersGroup();<NEW_LINE>noGroup.setCreationDate(Long.MAX_VALUE);<NEW_LINE>groupsMap.put(noGroup.getId(), noGroup);<NEW_LINE>}<NEW_LINE>noGroup.getMarkers().add(marker);<NEW_LINE>} else {<NEW_LINE>if (marker.creationDate < group.getCreationDate()) {<NEW_LINE>group.setCreationDate(marker.creationDate);<NEW_LINE>}<NEW_LINE>group.getMarkers().add(marker);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new ArrayList<>(groupsMap.values());<NEW_LINE>}
|
(markersDbHelper.getMarkersHistory(true));
|
580,136
|
protected void createOrReplaceTriggerQuery(DBRProgressMonitor monitor, DBCExecutionContext executionContext, List<DBEPersistAction> actions, MySQLTrigger trigger, boolean create) {<NEW_LINE>if (trigger.isPersisted()) {<NEW_LINE>actions.add(new SQLDatabasePersistAction("Drop trigger", "DROP TRIGGER IF EXISTS " + trigger.getFullyQualifiedName(DBPEvaluationContext.DDL)));<NEW_LINE>}<NEW_LINE>MySQLCatalog curCatalog = ((<MASK><NEW_LINE>if (curCatalog != trigger.getCatalog()) {<NEW_LINE>// $NON-NLS-2$<NEW_LINE>actions.add(new SQLDatabasePersistAction("Set current schema ", "USE " + DBUtils.getQuotedIdentifier(trigger.getCatalog()), false));<NEW_LINE>}<NEW_LINE>// $NON-NLS-2$<NEW_LINE>actions.add(new SQLDatabasePersistAction("Create trigger", trigger.getBody(), true));<NEW_LINE>if (curCatalog != null && curCatalog != trigger.getCatalog()) {<NEW_LINE>// $NON-NLS-2$<NEW_LINE>actions.add(new SQLDatabasePersistAction("Set current schema ", "USE " + DBUtils.getQuotedIdentifier(curCatalog), false));<NEW_LINE>}<NEW_LINE>}
|
MySQLExecutionContext) executionContext).getDefaultCatalog();
|
1,022,486
|
public UserSessionModel loadUserSession(RealmModel realm, String userSessionId, boolean offline) {<NEW_LINE>String offlineStr = offlineToString(offline);<NEW_LINE>TypedQuery<PersistentUserSessionEntity> userSessionQuery = em.createNamedQuery("findUserSession", PersistentUserSessionEntity.class);<NEW_LINE>userSessionQuery.setParameter("realmId", realm.getId());<NEW_LINE>userSessionQuery.setParameter("offline", offlineStr);<NEW_LINE>userSessionQuery.setParameter("userSessionId", userSessionId);<NEW_LINE>userSessionQuery.setMaxResults(1);<NEW_LINE>Stream<PersistentUserSessionAdapter> persistentUserSessions = closing(userSessionQuery.getResultStream().map(this::toAdapter));<NEW_LINE>return persistentUserSessions.findAny().map(userSession -> {<NEW_LINE>TypedQuery<PersistentClientSessionEntity> clientSessionQuery = em.createNamedQuery("findClientSessionsByUserSession", PersistentClientSessionEntity.class);<NEW_LINE>clientSessionQuery.setParameter("userSessionId", Collections.singleton(userSessionId));<NEW_LINE>clientSessionQuery.setParameter("offline", offlineStr);<NEW_LINE>Set<String> removedClientUUIDs = new HashSet<>();<NEW_LINE>closing(clientSessionQuery.getResultStream()).forEach(clientSession -> {<NEW_LINE>boolean <MASK><NEW_LINE>if (!added) {<NEW_LINE>// client was removed in the meantime<NEW_LINE>removedClientUUIDs.add(clientSession.getClientId());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>removedClientUUIDs.forEach(this::onClientRemoved);<NEW_LINE>return userSession;<NEW_LINE>}).orElse(null);<NEW_LINE>}
|
added = addClientSessionToAuthenticatedClientSessionsIfPresent(userSession, clientSession);
|
861,848
|
public synchronized void resetStorageGroupStatus(StorageGroupInfo storageGroupInfo) {<NEW_LINE>long delta = 0;<NEW_LINE>if (reportedStorageGroupMemCostMap.containsKey(storageGroupInfo)) {<NEW_LINE>delta = reportedStorageGroupMemCostMap.get(storageGroupInfo) - storageGroupInfo.getMemCost();<NEW_LINE>this.totalStorageGroupMemCost -= delta;<NEW_LINE>storageGroupInfo.setLastReportedSize(storageGroupInfo.getMemCost());<NEW_LINE>reportedStorageGroupMemCostMap.put(storageGroupInfo, storageGroupInfo.getMemCost());<NEW_LINE>}<NEW_LINE>if (totalStorageGroupMemCost >= FLUSH_THERSHOLD && totalStorageGroupMemCost < REJECT_THERSHOLD) {<NEW_LINE>logger.debug("SG ({}) released memory (delta: {}) but still exceeding flush proportion (totalSgMemCost: {}), call flush.", storageGroupInfo.getVirtualStorageGroupProcessor().getLogicalStorageGroupName(), delta, totalStorageGroupMemCost);<NEW_LINE>if (rejected) {<NEW_LINE>logger.info("SG ({}) released memory (delta: {}), set system to normal status (totalSgMemCost: {}).", storageGroupInfo.getVirtualStorageGroupProcessor().getLogicalStorageGroupName(), delta, totalStorageGroupMemCost);<NEW_LINE>}<NEW_LINE>logCurrentTotalSGMemory();<NEW_LINE>rejected = false;<NEW_LINE>} else if (totalStorageGroupMemCost >= REJECT_THERSHOLD) {<NEW_LINE>logger.warn("SG ({}) released memory (delta: {}), but system is still in reject status (totalSgMemCost: {}).", storageGroupInfo.getVirtualStorageGroupProcessor().getLogicalStorageGroupName(), delta, totalStorageGroupMemCost);<NEW_LINE>logCurrentTotalSGMemory();<NEW_LINE>rejected = true;<NEW_LINE>} else {<NEW_LINE>logger.debug("SG ({}) released memory (delta: {}), system is in normal status (totalSgMemCost: {}).", storageGroupInfo.getVirtualStorageGroupProcessor().<MASK><NEW_LINE>logCurrentTotalSGMemory();<NEW_LINE>rejected = false;<NEW_LINE>}<NEW_LINE>}
|
getLogicalStorageGroupName(), delta, totalStorageGroupMemCost);
|
1,681,672
|
private PricingSystemId retrievePricingSystemIdOrNull(@NonNull final BPartnerId bpartnerId, final SOTrx soTrx, @Nullable final String trxName) {<NEW_LINE>final Properties ctx = Env.getCtx();<NEW_LINE>final I_C_BPartner bPartner = InterfaceWrapperHelper.create(ctx, bpartnerId.getRepoId(<MASK><NEW_LINE>if (bPartner == null) {<NEW_LINE>throw new AdempiereException("No BPartner found for " + bpartnerId);<NEW_LINE>}<NEW_LINE>final Integer bpPricingSysId;<NEW_LINE>if (soTrx.isSales()) {<NEW_LINE>bpPricingSysId = bPartner.getM_PricingSystem_ID();<NEW_LINE>} else {<NEW_LINE>bpPricingSysId = bPartner.getPO_PricingSystem_ID();<NEW_LINE>}<NEW_LINE>if (bpPricingSysId != null && bpPricingSysId > 0) {<NEW_LINE>logger.debug("Got M_PricingSystem_ID={} from bPartner={}", bpPricingSysId, bPartner);<NEW_LINE>return PricingSystemId.ofRepoId(bpPricingSysId);<NEW_LINE>}<NEW_LINE>final int bpGroupId = bPartner.getC_BP_Group_ID();<NEW_LINE>if (bpGroupId > 0) {<NEW_LINE>final I_C_BP_Group bpGroup = InterfaceWrapperHelper.create(ctx, bpGroupId, I_C_BP_Group.class, trxName);<NEW_LINE>final Integer bpGroupPricingSysId;<NEW_LINE>// metas: Same problem as above: The method always retrieved SO-PricingSys. This caused errors in<NEW_LINE>// PO-Documents.<NEW_LINE>if (soTrx.isSales()) {<NEW_LINE>bpGroupPricingSysId = bpGroup.getM_PricingSystem_ID();<NEW_LINE>} else {<NEW_LINE>bpGroupPricingSysId = bpGroup.getPO_PricingSystem_ID();<NEW_LINE>}<NEW_LINE>// metas: end<NEW_LINE>if (bpGroupPricingSysId != null && bpGroupPricingSysId > 0) {<NEW_LINE>logger.debug("Got M_PricingSystem_ID={} from bpGroup={}", bpGroupPricingSysId, bpGroup);<NEW_LINE>return PricingSystemId.ofRepoId(bpGroupPricingSysId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final OrgId adOrgId = OrgId.ofRepoIdOrAny(bPartner.getAD_Org_ID());<NEW_LINE>if (adOrgId.isRegular() && soTrx.isSales()) {<NEW_LINE>final OrgInfo orgInfo = Services.get(IOrgDAO.class).getOrgInfoById(adOrgId);<NEW_LINE>if (orgInfo.getPricingSystemId() != null) {<NEW_LINE>return orgInfo.getPricingSystemId();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>logger.warn("bPartner={} has no pricing system id (soTrx={}); returning null", bPartner, soTrx);<NEW_LINE>return null;<NEW_LINE>}
|
), I_C_BPartner.class, trxName);
|
1,830,882
|
public <A> double estimate(A data, NumberArrayAdapter<?, ? super A> adapter, final int end) {<NEW_LINE>final int begin = DistanceBasedIntrinsicDimensionalityEstimator.countLeadingZeros(data, adapter, end);<NEW_LINE>if (end - begin <= 3) {<NEW_LINE>if (end - begin == 2) {<NEW_LINE>// Fallback to MoM<NEW_LINE>double v1 = adapter.getDouble(data, begin) / adapter.getDouble(data, begin + 1);<NEW_LINE>return v1 / (1 - v1);<NEW_LINE>}<NEW_LINE>if (end - begin == 3) {<NEW_LINE>// Fallback to first moment only<NEW_LINE>double v1 = adapter.getDouble(data, begin + 1) * .5 / adapter.<MASK><NEW_LINE>return v1 / (1 - 2 * v1);<NEW_LINE>}<NEW_LINE>throw new ArithmeticException("ID estimates require at least 2 non-zero distances");<NEW_LINE>}<NEW_LINE>// Except for last<NEW_LINE>final int last = end - 1;<NEW_LINE>// Estimate second PWM (k=2)<NEW_LINE>// In the following, we pretend we had TWO more data points!<NEW_LINE>double v2 = 0.;<NEW_LINE>int valid = 0;<NEW_LINE>for (int j = begin; j < last; j++, valid++) {<NEW_LINE>v2 += adapter.getDouble(data, j) * (valid + 2) * (valid + 1);<NEW_LINE>}<NEW_LINE>// All scaling factors collected for performance reasons<NEW_LINE>final double w = adapter.getDouble(data, last);<NEW_LINE>v2 /= (valid + 2) * w * (valid + 1) * valid;<NEW_LINE>return v2 / (1 - 3 * v2);<NEW_LINE>}
|
getDouble(data, begin + 2);
|
911,958
|
protected String createStartInvocation(BuildRequest request, String mainObject, boolean includeVserv) {<NEW_LINE>String zone = request.getArg("vserv.zone", null);<NEW_LINE>if (includeVserv && zone != null && zone.length() > 0) {<NEW_LINE>String transition = request.getArg("vserv.transition", "300000");<NEW_LINE>String countryCode = <MASK><NEW_LINE>String networkCode = request.getArg("vserv.networkCode", "null");<NEW_LINE>String locale = request.getArg("vserv.locale", "en_US");<NEW_LINE>String category = request.getArg("vserv.category", "29");<NEW_LINE>try {<NEW_LINE>URL u = new URL("http://admin.vserv.mobi/partner/zone-add.php?partnerid=1&zoneid=" + zone);<NEW_LINE>InputStream i = u.openStream();<NEW_LINE>i.read();<NEW_LINE>i.close();<NEW_LINE>} catch (Exception ex) {<NEW_LINE>ex.printStackTrace();<NEW_LINE>}<NEW_LINE>String scaleMode = request.getArg("vserv.scaleMode", "false");<NEW_LINE>String allowSkipping = request.getArg("vserv.allowSkipping", "true");<NEW_LINE>return " com.codename1.impl.VServAds v = new com.codename1.impl.VServAds();\n" + " v.setCountryCode(\"" + countryCode + "\");\n" + " v.setNetworkCode(\"" + networkCode + "\");\n" + " v.setLocale(\"" + locale + "\");\n" + " v.setZoneId(\"" + zone + "\");\n" + " v.setCategory(" + category + ");\n" + " v.setScaleMode(" + scaleMode + ");\n" + " v.setAllowSkipping(" + allowSkipping + ");\n" + " v.showWelcomeAd();\n" + " v.bindTransitionAd(" + transition + ");\n" + " " + mainObject + ".start();\n";<NEW_LINE>}<NEW_LINE>return mainObject + ".start();\n";<NEW_LINE>}
|
request.getArg("vserv.countryCode", "null");
|
497,104
|
public static void verifyOptionsEqualsHashcode(ParserOptions options1, ParserOptions options2, ParserOptions options3, ParserOptions options4) {<NEW_LINE>// Objects should be different<NEW_LINE>Assert.assertNotSame(options1, options2);<NEW_LINE>Assert.assertNotSame(options1, options2);<NEW_LINE>Assert.assertNotSame(options1, options3);<NEW_LINE>Assert.assertNotSame(options2, options3);<NEW_LINE>Assert.assertNotSame(options2, options4);<NEW_LINE>Assert.assertNotSame(options3, options4);<NEW_LINE>// Check all 16 equality combinations<NEW_LINE>Assert.assertEquals(options1, options1);<NEW_LINE>Assert.assertFalse(options1.equals(options2));<NEW_LINE>Assert.assertEquals(options1, options3);<NEW_LINE>Assert.assertFalse(options1.equals(options4));<NEW_LINE>Assert.assertFalse(options2.equals(options1));<NEW_LINE>Assert.assertEquals(options2, options2);<NEW_LINE>Assert.assertFalse<MASK><NEW_LINE>Assert.assertEquals(options2, options4);<NEW_LINE>Assert.assertEquals(options3, options1);<NEW_LINE>Assert.assertFalse(options3.equals(options2));<NEW_LINE>Assert.assertEquals(options3, options3);<NEW_LINE>Assert.assertFalse(options3.equals(options4));<NEW_LINE>Assert.assertFalse(options4.equals(options1));<NEW_LINE>Assert.assertEquals(options4, options2);<NEW_LINE>Assert.assertFalse(options4.equals(options3));<NEW_LINE>Assert.assertEquals(options4, options4);<NEW_LINE>// Hashcodes should match up<NEW_LINE>Assert.assertNotEquals(options1.hashCode(), options2.hashCode());<NEW_LINE>Assert.assertEquals(options1.hashCode(), options3.hashCode());<NEW_LINE>Assert.assertNotEquals(options1.hashCode(), options4.hashCode());<NEW_LINE>Assert.assertNotEquals(options2.hashCode(), options3.hashCode());<NEW_LINE>Assert.assertEquals(options2.hashCode(), options4.hashCode());<NEW_LINE>Assert.assertNotEquals(options3.hashCode(), options4.hashCode());<NEW_LINE>}
|
(options2.equals(options3));
|
1,043,081
|
protected void handle(final SyncImageSizeOnBackupStorageMsg msg) {<NEW_LINE>GetImageSizeCmd cmd = new GetImageSizeCmd();<NEW_LINE>cmd.imageUuid = msg.getImage().getUuid();<NEW_LINE>ImageBackupStorageRefInventory ref = CollectionUtils.find(msg.getImage().getBackupStorageRefs(), new Function<ImageBackupStorageRefInventory, ImageBackupStorageRefInventory>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public ImageBackupStorageRefInventory call(ImageBackupStorageRefInventory arg) {<NEW_LINE>return self.getUuid().equals(arg.getBackupStorageUuid()) ? arg : null;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>if (ref == null) {<NEW_LINE>throw new CloudRuntimeException(String.format("cannot find ImageBackupStorageRefInventory of image[uuid:%s] for" + " the backup storage[uuid:%s]", msg.getImage().getUuid(), self.getUuid()));<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>cmd.installPath = ref.getInstallPath();<NEW_LINE>httpCall(GET_IMAGE_SIZE_PATH, cmd, GetImageSizeRsp.class, new ReturnValueCompletion<GetImageSizeRsp>(msg) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void success(GetImageSizeRsp rsp) {<NEW_LINE>reply.setSize(rsp.size);<NEW_LINE>// current ceph cannot get actual size<NEW_LINE>long asize = rsp.actualSize == null ? msg.getImage().getActualSize() : rsp.actualSize;<NEW_LINE>reply.setActualSize(asize);<NEW_LINE>bus.reply(msg, reply);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void fail(ErrorCode errorCode) {<NEW_LINE>reply.setError(errorCode);<NEW_LINE>bus.reply(msg, reply);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}
|
final SyncImageSizeOnBackupStorageReply reply = new SyncImageSizeOnBackupStorageReply();
|
308,319
|
private int produceHello(Msg msg) {<NEW_LINE>int bytesLeft = msg.size();<NEW_LINE>int index = 0;<NEW_LINE>if (bytesLeft < 6 || !compare(msg, "HELLO", true)) {<NEW_LINE>return ZError.EPROTO;<NEW_LINE>}<NEW_LINE>bytesLeft -= 6;<NEW_LINE>index += 6;<NEW_LINE>if (bytesLeft < 1) {<NEW_LINE>return ZError.EPROTO;<NEW_LINE>}<NEW_LINE>byte <MASK><NEW_LINE>bytesLeft -= 1;<NEW_LINE>if (bytesLeft < length) {<NEW_LINE>return ZError.EPROTO;<NEW_LINE>}<NEW_LINE>byte[] tmp = new byte[length];<NEW_LINE>index += 1;<NEW_LINE>msg.getBytes(index, tmp, 0, length);<NEW_LINE>byte[] username = tmp;<NEW_LINE>bytesLeft -= length;<NEW_LINE>index += length;<NEW_LINE>length = msg.get(index);<NEW_LINE>bytesLeft -= 1;<NEW_LINE>if (bytesLeft < length) {<NEW_LINE>return ZError.EPROTO;<NEW_LINE>}<NEW_LINE>tmp = new byte[length];<NEW_LINE>index += 1;<NEW_LINE>msg.getBytes(index, tmp, 0, length);<NEW_LINE>byte[] password = tmp;<NEW_LINE>bytesLeft -= length;<NEW_LINE>// index += length;<NEW_LINE>if (bytesLeft > 0) {<NEW_LINE>return ZError.EPROTO;<NEW_LINE>}<NEW_LINE>// Use ZAP protocol (RFC 27) to authenticate the user.<NEW_LINE>int rc = session.zapConnect();<NEW_LINE>if (rc == 0) {<NEW_LINE>sendZapRequest(username, password);<NEW_LINE>rc = receiveAndProcessZapReply();<NEW_LINE>if (rc == 0) {<NEW_LINE>state = "200".equals(statusCode) ? State.SENDING_WELCOME : State.SENDING_ERROR;<NEW_LINE>} else if (rc == ZError.EAGAIN) {<NEW_LINE>state = State.WAITING_FOR_ZAP_REPLY;<NEW_LINE>} else {<NEW_LINE>return -1;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>state = State.SENDING_WELCOME;<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>}
|
length = msg.get(index);
|
973,010
|
Map<String, Object> bindParameters(Neo4jParameterAccessor parameterAccessor, boolean includePageableParameter, UnaryOperator<Integer> limitModifier) {<NEW_LINE>final Parameters<?, ?> formalParameters = parameterAccessor.getParameters();<NEW_LINE>Map<String, Object> resolvedParameters = new HashMap<>();<NEW_LINE>// Values from the parameter accessor can only get converted after evaluation<NEW_LINE>for (Entry<String, Object> evaluatedParam : spelEvaluator.evaluate(parameterAccessor.getValues()).entrySet()) {<NEW_LINE>Object value = evaluatedParam.getValue();<NEW_LINE>if (!(evaluatedParam.getValue() instanceof LiteralReplacement)) {<NEW_LINE>Neo4jQuerySupport.logParameterIfNull(evaluatedParam.getKey(), value);<NEW_LINE>value = super.convertParameter(evaluatedParam.getValue());<NEW_LINE>}<NEW_LINE>resolvedParameters.put(evaluatedParam.getKey(), value);<NEW_LINE>}<NEW_LINE>formalParameters.getBindableParameters().forEach(parameter -> {<NEW_LINE>int index = parameter.getIndex();<NEW_LINE>Object value = parameterAccessor.getBindableValue(index);<NEW_LINE>Neo4jQuerySupport.logParameterIfNull(parameter.getName().orElseGet(() -> Integer.<MASK><NEW_LINE>Object convertedValue = super.convertParameter(value);<NEW_LINE>// Add the parameter under its name when possible<NEW_LINE>parameter.getName().ifPresent(parameterName -> resolvedParameters.put(parameterName, convertedValue));<NEW_LINE>// Always add under its index.<NEW_LINE>resolvedParameters.put(Integer.toString(index), convertedValue);<NEW_LINE>});<NEW_LINE>if (formalParameters.hasPageableParameter() && includePageableParameter) {<NEW_LINE>Pageable pageable = parameterAccessor.getPageable();<NEW_LINE>resolvedParameters.put("limit", limitModifier.apply(pageable.getPageSize()));<NEW_LINE>resolvedParameters.put("skip", pageable.getOffset());<NEW_LINE>}<NEW_LINE>return resolvedParameters;<NEW_LINE>}
|
toString(index)), value);
|
1,197,673
|
public PlanFragment visitAbstractPhysicalSort(AbstractPhysicalSort<? extends Plan> sort, PlanTranslatorContext context) {<NEW_LINE>PlanFragment childFragment = sort.child(0).accept(this, context);<NEW_LINE>List<Expr> oldOrderingExprList = Lists.newArrayList();<NEW_LINE>List<Boolean> ascOrderList = Lists.newArrayList();<NEW_LINE>List<Boolean> nullsFirstParamList = Lists.newArrayList();<NEW_LINE>List<OrderKey> orderKeyList = sort.getOrderKeys();<NEW_LINE>// 1.Get previous slotRef<NEW_LINE>orderKeyList.forEach(k -> {<NEW_LINE>oldOrderingExprList.add(ExpressionTranslator.translate(k.getExpr(), context));<NEW_LINE>ascOrderList.<MASK><NEW_LINE>nullsFirstParamList.add(k.isNullFirst());<NEW_LINE>});<NEW_LINE>List<Expr> sortTupleOutputList = new ArrayList<>();<NEW_LINE>List<Slot> outputList = sort.getOutput();<NEW_LINE>outputList.forEach(k -> {<NEW_LINE>sortTupleOutputList.add(ExpressionTranslator.translate(k, context));<NEW_LINE>});<NEW_LINE>// 2. Generate new Tuple<NEW_LINE>TupleDescriptor tupleDesc = generateTupleDesc(outputList, orderKeyList, context, null);<NEW_LINE>// 3. Get current slotRef<NEW_LINE>List<Expr> newOrderingExprList = Lists.newArrayList();<NEW_LINE>orderKeyList.forEach(k -> {<NEW_LINE>newOrderingExprList.add(ExpressionTranslator.translate(k.getExpr(), context));<NEW_LINE>});<NEW_LINE>// 4. fill in SortInfo members<NEW_LINE>SortInfo sortInfo = new SortInfo(newOrderingExprList, ascOrderList, nullsFirstParamList, tupleDesc);<NEW_LINE>PlanNode childNode = childFragment.getPlanRoot();<NEW_LINE>SortNode sortNode = new SortNode(context.nextPlanNodeId(), childNode, sortInfo, true);<NEW_LINE>sortNode.finalizeForNereids(tupleDesc, sortTupleOutputList, oldOrderingExprList);<NEW_LINE>childFragment.addPlanRoot(sortNode);<NEW_LINE>return childFragment;<NEW_LINE>}
|
add(k.isAsc());
|
429,747
|
public JavaSourceFile visitJavaSourceFile(JavaSourceFile cu, P p) {<NEW_LINE>JavaSourceFile t = (JavaSourceFile) new RemoveTrailingWhitespaceVisitor<>(stopAfter<MASK><NEW_LINE>t = (JavaSourceFile) new BlankLinesVisitor<>(Optional.ofNullable(((SourceFile) cu).getStyle(BlankLinesStyle.class)).orElse(IntelliJ.blankLines()), stopAfter).visit(t, p);<NEW_LINE>t = (JavaSourceFile) new SpacesVisitor<P>(Optional.ofNullable(((SourceFile) cu).getStyle(SpacesStyle.class)).orElse(IntelliJ.spaces()), ((SourceFile) cu).getStyle(EmptyForInitializerPadStyle.class), ((SourceFile) cu).getStyle(EmptyForIteratorPadStyle.class), stopAfter).visit(t, p);<NEW_LINE>t = (JavaSourceFile) new WrappingAndBracesVisitor<>(Optional.ofNullable(((SourceFile) cu).getStyle(WrappingAndBracesStyle.class)).orElse(IntelliJ.wrappingAndBraces()), stopAfter).visit(t, p);<NEW_LINE>t = (JavaSourceFile) new NormalizeTabsOrSpacesVisitor<>(Optional.ofNullable(((SourceFile) cu).getStyle(TabsAndIndentsStyle.class)).orElse(IntelliJ.tabsAndIndents()), stopAfter).visit(t, p);<NEW_LINE>t = (JavaSourceFile) new TabsAndIndentsVisitor<>(Optional.ofNullable(((SourceFile) cu).getStyle(TabsAndIndentsStyle.class)).orElse(IntelliJ.tabsAndIndents()), stopAfter).visit(t, p);<NEW_LINE>assert t != null;<NEW_LINE>return t;<NEW_LINE>}
|
).visit(cu, p);
|
1,100,606
|
public CreateRateBasedRuleResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>CreateRateBasedRuleResult createRateBasedRuleResult = new CreateRateBasedRuleResult();<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 createRateBasedRuleResult;<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("Rule", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createRateBasedRuleResult.setRule(RateBasedRuleJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("ChangeToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createRateBasedRuleResult.setChangeToken(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return createRateBasedRuleResult;<NEW_LINE>}
|
class).unmarshall(context));
|
145,055
|
private Mono<PagedResponse<PremiumMessagingRegionInner>> listBySkuSinglePageAsync(String sku, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (sku == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter sku is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.listBySku(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), sku, accept, context).map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue()<MASK><NEW_LINE>}
|
.nextLink(), null));
|
947,509
|
// query.from() is non-inclusive<NEW_LINE>@Override<NEW_LINE>public void mergeQueriesInto(String agentRollupId, AggregateQuery query, QueryCollector collector) throws Exception {<NEW_LINE>ResultSet results = executeQuery(agentRollupId, query, queryTable);<NEW_LINE>long captureTime = Long.MIN_VALUE;<NEW_LINE>for (Row row : results) {<NEW_LINE>int i = 0;<NEW_LINE>captureTime = Math.max(captureTime, checkNotNull(row.getTimestamp(i++)).getTime());<NEW_LINE>String queryType = checkNotNull(row.getString(i++));<NEW_LINE>String truncatedText = checkNotNull(row.getString(i++));<NEW_LINE>// full_query_text_sha1 cannot be null since it is used in clustering key<NEW_LINE>String fullTextSha1 = Strings.emptyToNull(row.getString(i++));<NEW_LINE>double totalDurationNanos = row.getDouble(i++);<NEW_LINE>long executionCount = row.getLong(i++);<NEW_LINE>boolean hasTotalRows <MASK><NEW_LINE>long totalRows = row.getLong(i++);<NEW_LINE>collector.mergeQuery(queryType, truncatedText, fullTextSha1, totalDurationNanos, executionCount, hasTotalRows, totalRows);<NEW_LINE>collector.updateLastCaptureTime(captureTime);<NEW_LINE>}<NEW_LINE>}
|
= !row.isNull(i);
|
1,210,133
|
protected IDeserializationConverter<RowData, AbstractBaseColumn> createInternalConverter(String type) {<NEW_LINE>switch(type.toUpperCase(Locale.ENGLISH)) {<NEW_LINE>case "ID":<NEW_LINE>return val -> new BigDecimalColumn(new BigDecimal(id.incrementAndGet()));<NEW_LINE>case "INT":<NEW_LINE>case "INTEGER":<NEW_LINE>return val -> new BigDecimalColumn(JMockData.mock(int.class));<NEW_LINE>case "BOOLEAN":<NEW_LINE>return val -> new BooleanColumn(JMockData.mock(boolean.class));<NEW_LINE>case "TINYINT":<NEW_LINE>case "BYTE":<NEW_LINE>return val -> new ByteColumn(JMockData.mock(byte.class));<NEW_LINE>case "CHAR":<NEW_LINE>case "CHARACTER":<NEW_LINE>return val -> new StringColumn(JMockData.mock(char<MASK><NEW_LINE>case "SHORT":<NEW_LINE>case "SMALLINT":<NEW_LINE>return val -> new BigDecimalColumn(JMockData.mock(short.class));<NEW_LINE>case "LONG":<NEW_LINE>case "BIGINT":<NEW_LINE>return val -> new BigDecimalColumn(JMockData.mock(long.class));<NEW_LINE>case "FLOAT":<NEW_LINE>return val -> new BigDecimalColumn(JMockData.mock(float.class));<NEW_LINE>case "DOUBLE":<NEW_LINE>return val -> new BigDecimalColumn(JMockData.mock(double.class));<NEW_LINE>case "DECIMAL":<NEW_LINE>return val -> new BigDecimalColumn(JMockData.mock(BigDecimal.class));<NEW_LINE>case "DATE":<NEW_LINE>return val -> new SqlDateColumn(Date.valueOf(LocalDate.now()));<NEW_LINE>case "DATETIME":<NEW_LINE>return val -> new TimestampColumn(System.currentTimeMillis(), 0);<NEW_LINE>case "TIMESTAMP":<NEW_LINE>return val -> new TimestampColumn(System.currentTimeMillis());<NEW_LINE>case "TIME":<NEW_LINE>return val -> new TimeColumn(Time.valueOf(LocalTime.now()));<NEW_LINE>default:<NEW_LINE>return val -> new StringColumn(JMockData.mock(String.class));<NEW_LINE>}<NEW_LINE>}
|
.class).toString());
|
249,405
|
private ActionListener<Response> cancelTransformTasksWithNoAssignment(final ActionListener<Response> finalListener, final TransformNodeAssignments transformNodeAssignments) {<NEW_LINE>final ActionListener<Response> doExecuteListener = ActionListener.wrap(response -> {<NEW_LINE>GroupedActionListener<PersistentTask<?>> groupedListener = new GroupedActionListener<>(ActionListener.wrap(r -> {<NEW_LINE>finalListener.onResponse(response);<NEW_LINE>}, finalListener::onFailure), transformNodeAssignments.getWaitingForAssignment().size());<NEW_LINE>for (String unassignedTaskId : transformNodeAssignments.getWaitingForAssignment()) {<NEW_LINE>persistentTasksService.sendRemoveRequest(unassignedTaskId, groupedListener);<NEW_LINE>}<NEW_LINE>}, e -> {<NEW_LINE>GroupedActionListener<PersistentTask<?>> groupedListener = new GroupedActionListener<>(ActionListener.wrap(r -> {<NEW_LINE>finalListener.onFailure(e);<NEW_LINE>}, finalListener::onFailure), transformNodeAssignments.<MASK><NEW_LINE>for (String unassignedTaskId : transformNodeAssignments.getWaitingForAssignment()) {<NEW_LINE>persistentTasksService.sendRemoveRequest(unassignedTaskId, groupedListener);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return doExecuteListener;<NEW_LINE>}
|
getWaitingForAssignment().size());
|
84,900
|
protected void doHandle(Exception thrownException, ConsumerRecords<?, ?> data, Consumer<?, ?> consumer, MessageListenerContainer container, Runnable invokeListener) {<NEW_LINE>BatchListenerFailedException batchListenerFailedException = getBatchListenerFailedException(thrownException);<NEW_LINE>if (batchListenerFailedException == null) {<NEW_LINE>this.logger.debug(thrownException, "Expected a BatchListenerFailedException; re-seeking batch");<NEW_LINE>this.fallbackBatchHandler.handleBatch(thrownException, data, consumer, container, invokeListener);<NEW_LINE>} else {<NEW_LINE>ConsumerRecord<?, ?> record = batchListenerFailedException.getRecord();<NEW_LINE>int index = record != null ? findIndex(data, <MASK><NEW_LINE>if (index < 0 || index >= data.count()) {<NEW_LINE>this.logger.warn(batchListenerFailedException, () -> String.format("Record not found in batch: %s-%d@%d; re-seeking batch", record.topic(), record.partition(), record.offset()));<NEW_LINE>this.fallbackBatchHandler.handleBatch(thrownException, data, consumer, container, invokeListener);<NEW_LINE>} else {<NEW_LINE>seekOrRecover(thrownException, data, consumer, container, index);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
|
record) : batchListenerFailedException.getIndex();
|
370,362
|
public static void registerType(ModelBuilder modelBuilder) {<NEW_LINE>ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Decision.class, DMN_ELEMENT_DECISION).namespaceUri(LATEST_DMN_NS).extendsType(DrgElement.class).instanceProvider(new ModelTypeInstanceProvider<Decision>() {<NEW_LINE><NEW_LINE>public Decision newInstance(ModelTypeInstanceContext instanceContext) {<NEW_LINE>return new DecisionImpl(instanceContext);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>SequenceBuilder sequenceBuilder = typeBuilder.sequence();<NEW_LINE>questionChild = sequenceBuilder.element(Question.class).build();<NEW_LINE>allowedAnswersChild = sequenceBuilder.element(<MASK><NEW_LINE>variableChild = sequenceBuilder.element(Variable.class).build();<NEW_LINE>informationRequirementCollection = sequenceBuilder.elementCollection(InformationRequirement.class).build();<NEW_LINE>knowledgeRequirementCollection = sequenceBuilder.elementCollection(KnowledgeRequirement.class).build();<NEW_LINE>authorityRequirementCollection = sequenceBuilder.elementCollection(AuthorityRequirement.class).build();<NEW_LINE>supportedObjectiveChildElementCollection = sequenceBuilder.elementCollection(SupportedObjectiveReference.class).build();<NEW_LINE>impactedPerformanceIndicatorRefCollection = sequenceBuilder.elementCollection(ImpactedPerformanceIndicatorReference.class).uriElementReferenceCollection(PerformanceIndicator.class).build();<NEW_LINE>decisionMakerRefCollection = sequenceBuilder.elementCollection(DecisionMakerReference.class).uriElementReferenceCollection(OrganizationUnit.class).build();<NEW_LINE>decisionOwnerRefCollection = sequenceBuilder.elementCollection(DecisionOwnerReference.class).uriElementReferenceCollection(OrganizationUnit.class).build();<NEW_LINE>usingProcessCollection = sequenceBuilder.elementCollection(UsingProcessReference.class).build();<NEW_LINE>usingTaskCollection = sequenceBuilder.elementCollection(UsingTaskReference.class).build();<NEW_LINE>expressionChild = sequenceBuilder.element(Expression.class).build();<NEW_LINE>// camunda extensions<NEW_LINE>camundaHistoryTimeToLiveAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_HISTORY_TIME_TO_LIVE).namespace(CAMUNDA_NS).build();<NEW_LINE>camundaVersionTag = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_VERSION_TAG).namespace(CAMUNDA_NS).build();<NEW_LINE>typeBuilder.build();<NEW_LINE>}
|
AllowedAnswers.class).build();
|
1,633,201
|
public String stringify(Object o) {<NEW_LINE>if (o == null) {<NEW_LINE>return ("null");<NEW_LINE>}<NEW_LINE>final ObjectName on = (ObjectName) o;<NEW_LINE>final StringBuilder buf = new StringBuilder();<NEW_LINE>if (!mOmitDomain) {<NEW_LINE>buf.append(on.getDomain()).append(":");<NEW_LINE>}<NEW_LINE>final Map<String, String> props = TypeCast.asMap(on.getKeyPropertyList());<NEW_LINE>final List<String> ordered = new ArrayList<>(mOrderedProps);<NEW_LINE>ordered.retainAll(props.keySet());<NEW_LINE>// go through each ordered property, and if it exists, emit it<NEW_LINE>final Iterator<String> iter = ordered.iterator();<NEW_LINE>while (iter.hasNext() && props.keySet().size() >= 2) {<NEW_LINE>final String key = iter.next();<NEW_LINE>final String value = props.get(key);<NEW_LINE>if (value != null) {<NEW_LINE>buf.append(makeProp(key, value)).append(",");<NEW_LINE>props.remove(key);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// emit all remaining properties in order<NEW_LINE>final Set<String> remainingSet = props.keySet();<NEW_LINE>final String[] remaining = new String[remainingSet.size()];<NEW_LINE>remainingSet.toArray(remaining);<NEW_LINE>Arrays.sort(remaining);<NEW_LINE>for (final String key : remaining) {<NEW_LINE>final String value = props.get(key);<NEW_LINE>buf.append(makeProp(key, value)).append(",");<NEW_LINE>}<NEW_LINE>final String result = StringUtil.stripSuffix(<MASK><NEW_LINE>return (result);<NEW_LINE>}
|
buf.toString(), ",");
|
1,058,903
|
private static <CC extends ClientConnection> void handleSuccess(SaslChallengeContext<CC> context) throws SaslException {<NEW_LINE>final CC connection = context.connection;<NEW_LINE>final SaslClient saslClient = connection.getSaslClient();<NEW_LINE>try {<NEW_LINE>// Check if connection was marked for being secure then verify for negotiated QOP value for<NEW_LINE>// correctness.<NEW_LINE>final String negotiatedQOP = saslClient.getNegotiatedProperty(Sasl.QOP).toString();<NEW_LINE>final String expectedQOP = connection.isEncryptionEnabled() ? SaslProperties.QualityOfProtection.PRIVACY.getSaslQop() : SaslProperties.QualityOfProtection.AUTHENTICATION.getSaslQop();<NEW_LINE>if (!(negotiatedQOP.equals(expectedQOP))) {<NEW_LINE>throw new SaslException(String.format("Mismatch in negotiated QOP value: %s and Expected QOP value: %s", negotiatedQOP, expectedQOP));<NEW_LINE>}<NEW_LINE>// Update the rawWrapChunkSize with the negotiated buffer size since we cannot call encode with more than<NEW_LINE>// negotiated size of buffer.<NEW_LINE>if (connection.isEncryptionEnabled()) {<NEW_LINE>final int negotiatedRawSendSize = Integer.parseInt(saslClient.getNegotiatedProperty(Sasl<MASK><NEW_LINE>if (negotiatedRawSendSize <= 0) {<NEW_LINE>throw new SaslException(String.format("Negotiated rawSendSize: %d is invalid. Please check the configured " + "value of encryption.sasl.max_wrapped_size. It might be configured to a very small value.", negotiatedRawSendSize));<NEW_LINE>}<NEW_LINE>connection.setWrapSizeLimit(negotiatedRawSendSize);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SaslException(String.format("Unexpected failure while retrieving negotiated property values (%s)", e.getMessage()), e);<NEW_LINE>}<NEW_LINE>if (connection.isEncryptionEnabled()) {<NEW_LINE>connection.addSecurityHandlers();<NEW_LINE>} else {<NEW_LINE>// Encryption is not required hence we don't need to hold on to saslClient object.<NEW_LINE>connection.disposeSaslClient();<NEW_LINE>}<NEW_LINE>}
|
.RAW_SEND_SIZE).toString());
|
1,199,076
|
public void marshall(TokenData tokenData, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (tokenData == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(tokenData.getTokenId(), TOKENID_BINDING);<NEW_LINE>protocolMarshaller.marshall(tokenData.getTokenType(), TOKENTYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(tokenData.getLicenseArn(), LICENSEARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(tokenData.getExpirationTime(), EXPIRATIONTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(tokenData.getTokenProperties(), TOKENPROPERTIES_BINDING);<NEW_LINE>protocolMarshaller.marshall(tokenData.getRoleArns(), ROLEARNS_BINDING);<NEW_LINE>protocolMarshaller.marshall(tokenData.getStatus(), STATUS_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + <MASK><NEW_LINE>}<NEW_LINE>}
|
e.getMessage(), e);
|
1,457,951
|
final DescribeRegionsResult executeDescribeRegions(DescribeRegionsRequest describeRegionsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeRegionsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<DescribeRegionsRequest> request = null;<NEW_LINE>Response<DescribeRegionsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeRegionsRequestMarshaller().marshall(super.beforeMarshalling(describeRegionsRequest));<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, "EC2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeRegions");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DescribeRegionsResult> responseHandler = new StaxResponseHandler<DescribeRegionsResult>(new DescribeRegionsResultStaxUnmarshaller());<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);
|
386,056
|
private void okPressed() {<NEW_LINE>int skipCertificates = -1;<NEW_LINE>String skipCertificatesStr = jtfSkipCertificates.getText().trim();<NEW_LINE>if (skipCertificatesStr.length() == 0) {<NEW_LINE>JOptionPane.showMessageDialog(this, res.getString("DInhibitAnyPolicy.ValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>skipCertificates = Integer.parseInt(skipCertificatesStr);<NEW_LINE>} catch (NumberFormatException ex) {<NEW_LINE>JOptionPane.showMessageDialog(this, res.getString("DInhibitAnyPolicy.InvalidLengthValue.message"), getTitle(), JOptionPane.WARNING_MESSAGE);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (skipCertificates < 0) {<NEW_LINE>JOptionPane.showMessageDialog(this, res.getString("DInhibitAnyPolicy.InvalidLengthValue.message"), getTitle(), JOptionPane.WARNING_MESSAGE);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>InhibitAnyPolicy inhibitAnyPolicy = new InhibitAnyPolicy(skipCertificates);<NEW_LINE>try {<NEW_LINE>value = inhibitAnyPolicy.getEncoded(ASN1Encoding.DER);<NEW_LINE>} catch (IOException e) {<NEW_LINE><MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>closeDialog();<NEW_LINE>}
|
DError.displayError(this, e);
|
1,541,738
|
public void associate() {<NEW_LINE>matches.reset();<NEW_LINE>unassociatedSrc.reset();<NEW_LINE>for (int i = 0; i < locationLeft.size; i++) {<NEW_LINE>Point2D_F64 left = locationLeft.get(i);<NEW_LINE>Desc descLeft = descriptionsLeft.get(i);<NEW_LINE>int bestIndex = -1;<NEW_LINE>double bestScore = scoreThreshold;<NEW_LINE>for (int j = 0; j < locationRight.size; j++) {<NEW_LINE>Point2D_F64 <MASK><NEW_LINE>if (checkRectified(left, right)) {<NEW_LINE>double dist = scorer.score(descLeft, descriptionsRight.get(j));<NEW_LINE>if (dist < bestScore) {<NEW_LINE>bestScore = dist;<NEW_LINE>bestIndex = j;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (bestIndex >= 0) {<NEW_LINE>matches.grow().setTo(i, bestIndex, bestScore);<NEW_LINE>} else {<NEW_LINE>unassociatedSrc.push(i);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
|
right = locationRight.get(j);
|
1,167,689
|
public Image createScaledProfileIcon() {<NEW_LINE>String icon = unresolvedProfile.getIcon();<NEW_LINE>if (icon != null && icon != "") {<NEW_LINE>final String prefix = "data:image/png;base64,";<NEW_LINE>Image image = null;<NEW_LINE>if (icon.startsWith(prefix)) {<NEW_LINE>icon = icon.substring(prefix.length());<NEW_LINE>try (ByteArrayInputStream stream = new ByteArrayInputStream(Base64.getDecoder().decode(icon))) {<NEW_LINE>image = ImageIO.read(stream);<NEW_LINE>} catch (IOException e) {<NEW_LINE>AmidstLogger.warn("Unable to decode base64 icon");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>image = ImageIO.read(ResourceLoader.getResourceURL<MASK><NEW_LINE>} catch (IOException | IllegalArgumentException e) {<NEW_LINE>AmidstLogger.error("Error reading icon: " + icon);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (image != null) {<NEW_LINE>return image.getScaledInstance(32, 32, Image.SCALE_SMOOTH);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>}
|
("/amidst/icon/profileicons/" + icon + ".png"));
|
1,148,996
|
static CharsetQualityTuple parseTuple(Object o) {<NEW_LINE>String s;<NEW_LINE>if (o instanceof String) {<NEW_LINE>s = (String) o;<NEW_LINE>} else {<NEW_LINE>s = o.toString();<NEW_LINE>}<NEW_LINE>CharsetQualityTuple tuple = new CharsetQualityTuple();<NEW_LINE>String[] sArr = s.split(";[qQ]=");<NEW_LINE>if (sArr.length > 1) {<NEW_LINE>try {<NEW_LINE>float f = Float<MASK><NEW_LINE>tuple.quality = Float.min(1.0f, Float.max(0f, f));<NEW_LINE>} catch (NumberFormatException ex) {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "Invalid charset weight (" + s + ") - defaulting to 0.");<NEW_LINE>}<NEW_LINE>tuple.quality = 0;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>if (Charset.isSupported(sArr[0])) {<NEW_LINE>tuple.charset = Charset.forName(sArr[0]);<NEW_LINE>} else if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "Unsupported charset, " + sArr[0]);<NEW_LINE>}<NEW_LINE>} catch (IllegalCharsetNameException ex) {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "Illegal charset name, " + sArr[0]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return tuple;<NEW_LINE>}
|
.parseFloat(sArr[1]);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.