idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
294,891 | void activatePartContexts(IWorkbenchPart part) {<NEW_LINE>IContextService contextService = PlatformUI.getWorkbench().getService(IContextService.class);<NEW_LINE>if (contextService == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>contextService.deferUpdates(true);<NEW_LINE>// if (part instanceof INavigatorModelView) {<NEW_LINE>// We check for instanceof (do not use adapter) because otherwise it become active<NEW_LINE>// for all entity editor and clashes with SQL editor and other complex stuff.<NEW_LINE>// if (activationNavigator != null) {<NEW_LINE>// //log.debug("Double activation of navigator context");<NEW_LINE>// contextService.deactivateContext(activationNavigator);<NEW_LINE>// }<NEW_LINE>// activationNavigator = contextService.activateContext(INavigatorModelView.NAVIGATOR_CONTEXT_ID);<NEW_LINE>// }<NEW_LINE>// What the point of setting SQL editor context here? It is set by editor itself<NEW_LINE>// if (part instanceof SQLEditorBase || part.getAdapter(SQLEditorBase.class) != null) {<NEW_LINE>// if (activationSQL != null) {<NEW_LINE>// //log.debug("Double activation of SQL context");<NEW_LINE>// contextService.deactivateContext(activationSQL);<NEW_LINE>// }<NEW_LINE>// activationSQL = contextService.activateContext(SQLEditorContributions.SQL_EDITOR_CONTEXT);<NEW_LINE>// }<NEW_LINE>// Refresh auto-commit element state (#3315)<NEW_LINE>// Refresh OpenSeparateConnection<NEW_LINE>ActionUtils.fireCommandRefresh(<MASK><NEW_LINE>} finally {<NEW_LINE>contextService.deferUpdates(false);<NEW_LINE>}<NEW_LINE>} | ConnectionCommands.CMD_TOGGLE_AUTOCOMMIT, SQLEditorCommands.CMD_TOGGLE_SEPARATE_CONNECTION); |
1,086,614 | protected void exportColumn(FacesContext context, T table, UIColumn column, List<UIComponent> components, boolean joinComponents, Consumer<String> callback) {<NEW_LINE>if (column.getExportValue() != null) {<NEW_LINE>callback.<MASK><NEW_LINE>} else if (column.getExportFunction() != null) {<NEW_LINE>MethodExpression exportFunction = column.getExportFunction();<NEW_LINE>callback.accept((String) exportFunction.invoke(context.getELContext(), new Object[] { column }));<NEW_LINE>} else if (LangUtils.isNotBlank(column.getField())) {<NEW_LINE>String value = table.getConvertedFieldValue(context, column);<NEW_LINE>callback.accept(Objects.toString(value, Constants.EMPTY_STRING));<NEW_LINE>} else {<NEW_LINE>StringBuilder sb = null;<NEW_LINE>for (UIComponent component : components) {<NEW_LINE>if (component.isRendered()) {<NEW_LINE>String value = exportValue(context, component);<NEW_LINE>if (joinComponents) {<NEW_LINE>if (value != null) {<NEW_LINE>if (sb == null) {<NEW_LINE>sb = new StringBuilder();<NEW_LINE>}<NEW_LINE>sb.append(value);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>callback.accept(value);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (joinComponents) {<NEW_LINE>callback.accept(sb == null ? null : sb.toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | accept(column.getExportValue()); |
1,108,332 | public void exportItems(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName, @PathVariable String namespaceName, HttpServletResponse res) {<NEW_LINE>List<String> fileNameSplit = Splitter.on(".").splitToList(namespaceName);<NEW_LINE>String fileName = namespaceName;<NEW_LINE>// properties file or public namespace has not suffix (.properties)<NEW_LINE>if (fileNameSplit.size() <= 1 || !ConfigFileFormat.isValidFormat(fileNameSplit.get(fileNameSplit.size() - 1))) {<NEW_LINE>fileName = Joiner.on(".").join(namespaceName, ConfigFileFormat.Properties.getValue());<NEW_LINE>}<NEW_LINE>NamespaceBO namespaceBO = namespaceService.loadNamespaceBO(appId, Env.valueOf(env), clusterName, namespaceName);<NEW_LINE>// generate a file.<NEW_LINE>res.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + fileName);<NEW_LINE>// file content<NEW_LINE>final String <MASK><NEW_LINE>try {<NEW_LINE>// write content to net<NEW_LINE>res.getOutputStream().write(configFileContent.getBytes());<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new ServiceException("export items failed:{}", e);<NEW_LINE>}<NEW_LINE>} | configFileContent = NamespaceBOUtils.convert2configFileContent(namespaceBO); |
469,798 | /*<NEW_LINE>TODO partial implementation supporting WRAPPER_OBJECT with JsonTypeInfo.Id.CLASS and JsonTypeInfo.Id.NAME<NEW_LINE><NEW_LINE>Also note that JsonTypeInfo on interfaces are not considered as multiple interfaces might have conflicting<NEW_LINE>annotations, although Jackson seems to apply them if present on an interface<NEW_LINE>*/<NEW_LINE>protected Schema resolveWrapping(JavaType type, ModelConverterContext context, Schema model) {<NEW_LINE>// add JsonTypeInfo.property if not member of bean<NEW_LINE>JsonTypeInfo typeInfo = type.getRawClass().getDeclaredAnnotation(JsonTypeInfo.class);<NEW_LINE>if (typeInfo != null) {<NEW_LINE>JsonTypeInfo.Id id = typeInfo.use();<NEW_LINE>JsonTypeInfo.As as = typeInfo.include();<NEW_LINE>if (JsonTypeInfo.As.WRAPPER_OBJECT.equals(as)) {<NEW_LINE>String name = model.getName();<NEW_LINE>if (JsonTypeInfo.Id.CLASS.equals(id)) {<NEW_LINE>name = type.getRawClass().getName();<NEW_LINE>}<NEW_LINE>Schema wrapperSchema = new ObjectSchema();<NEW_LINE>wrapperSchema.name(model.getName());<NEW_LINE><MASK><NEW_LINE>return wrapperSchema;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return model;<NEW_LINE>} | wrapperSchema.addProperties(name, model); |
1,326,077 | static // /CLOVER:OFF<NEW_LINE>void printNode(RBBINode n) {<NEW_LINE>if (n == null) {<NEW_LINE>System.out.print(" -- null --\n");<NEW_LINE>} else {<NEW_LINE>RBBINode.printInt(n.fSerialNum, 10);<NEW_LINE>RBBINode.printString(nodeTypeNames[n.fType], 11);<NEW_LINE>RBBINode.printInt(n.fParent == null ? 0 : n.fParent.fSerialNum, 11);<NEW_LINE>RBBINode.printInt(n.fLeftChild == null ? 0 : n.fLeftChild.fSerialNum, 11);<NEW_LINE>RBBINode.printInt(n.fRightChild == null ? 0 : n.fRightChild.fSerialNum, 12);<NEW_LINE>RBBINode.printInt(n.fFirstPos, 12);<NEW_LINE>RBBINode.<MASK><NEW_LINE>if (n.fType == varRef) {<NEW_LINE>System.out.print(" " + n.fText);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>System.out.println("");<NEW_LINE>} | printInt(n.fVal, 7); |
225,318 | private void multiPartUpload(File source, Map<String, String> configValues, RetryPolicy retryPolicy, Throttle throttle, String key) throws Exception {<NEW_LINE>InitiateMultipartUploadRequest initRequest = new InitiateMultipartUploadRequest(configValues.get(CONFIG_BUCKET.getKey()), key);<NEW_LINE>InitiateMultipartUploadResult initResponse = s3Client.initiateMultipartUpload(initRequest);<NEW_LINE>byte[] buffer = new byte[MIN_S3_PART_SIZE];<NEW_LINE>InputStream in = null;<NEW_LINE>try {<NEW_LINE>List<PartETag> eTags = Lists.newArrayList();<NEW_LINE>int index = 1;<NEW_LINE>in = new FileInputStream(source);<NEW_LINE>for (; ; ) {<NEW_LINE>int <MASK><NEW_LINE>if (bytesRead < 0) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>throttle.throttle(bytesRead);<NEW_LINE>PartETag eTag = uploadChunkWithRetry(buffer, bytesRead, initResponse, index++, retryPolicy);<NEW_LINE>eTags.add(eTag);<NEW_LINE>}<NEW_LINE>completeUpload(initResponse, eTags);<NEW_LINE>} catch (Exception e) {<NEW_LINE>abortUpload(initResponse);<NEW_LINE>throw e;<NEW_LINE>} finally {<NEW_LINE>CloseableUtils.closeQuietly(in);<NEW_LINE>}<NEW_LINE>} | bytesRead = in.read(buffer); |
954,049 | public void finish() {<NEW_LINE>if (this.fieldAdders != null) {<NEW_LINE>for (FieldAdder fieldAdder : this.fieldAdders) {<NEW_LINE>fieldAdder.generateField(this.classWriter, this);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (this.clinitAdders != null) {<NEW_LINE>MethodVisitor mv = this.classWriter.visitMethod(ACC_PUBLIC | ACC_STATIC, <MASK><NEW_LINE>mv.visitCode();<NEW_LINE>// to 0 because there is no 'this' in a clinit<NEW_LINE>this.nextFreeVariableId = 0;<NEW_LINE>for (ClinitAdder clinitAdder : this.clinitAdders) {<NEW_LINE>clinitAdder.generateCode(mv, this);<NEW_LINE>}<NEW_LINE>mv.visitInsn(RETURN);<NEW_LINE>// not supplied due to COMPUTE_MAXS<NEW_LINE>mv.visitMaxs(0, 0);<NEW_LINE>mv.visitEnd();<NEW_LINE>}<NEW_LINE>} | "<clinit>", "()V", null, null); |
1,283,592 | static String encodeValue(Object value) throws IOException {<NEW_LINE>ByteArrayOutputStream bos = new ByteArrayOutputStream();<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>oos.writeObject(value);<NEW_LINE>oos.close();<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw (IOException) ExternalUtil.copyAnnotation(new IOException(), e);<NEW_LINE>}<NEW_LINE>byte[] bArray = bos.toByteArray();<NEW_LINE>StringBuffer strBuff = new StringBuffer(bArray.length * 2);<NEW_LINE>for (int i = 0; i < bArray.length; i++) {<NEW_LINE>if ((bArray[i] < 16) && (bArray[i] >= 0)) {<NEW_LINE>// NOI18N<NEW_LINE>strBuff.append("0");<NEW_LINE>}<NEW_LINE>strBuff.append(Integer.toHexString((bArray[i] < 0) ? (bArray[i] + 256) : bArray[i]));<NEW_LINE>}<NEW_LINE>return strBuff.toString();<NEW_LINE>} | ObjectOutputStream oos = new ObjectOutputStream(bos); |
768,853 | public static void register(Lang lang) {<NEW_LINE>if (lang == null)<NEW_LINE>throw new IllegalArgumentException("null for language");<NEW_LINE>// Expel previous registration.<NEW_LINE>if (isMimeTypeRegistered(lang)) {<NEW_LINE>// Find previous registration (uses primary MIME type).<NEW_LINE>Lang prev = contentTypeToLang(lang.getContentType());<NEW_LINE>if (prev == null)<NEW_LINE>throw new IllegalStateException("Expect to find '" + lang.getContentType() + "'");<NEW_LINE>unregister(prev);<NEW_LINE>}<NEW_LINE>checkRegistration(lang);<NEW_LINE>mapLabelToLang.put(canonicalKey(lang<MASK><NEW_LINE>for (String altName : lang.getAltNames()) mapLabelToLang.put(canonicalKey(altName), lang);<NEW_LINE>mapContentTypeToLang.put(canonicalKey(lang.getContentType().getContentTypeStr()), lang);<NEW_LINE>for (String ct : lang.getAltContentTypes()) mapContentTypeToLang.put(canonicalKey(ct), lang);<NEW_LINE>for (String ext : lang.getFileExtensions()) {<NEW_LINE>if (ext.startsWith("."))<NEW_LINE>ext = ext.substring(1);<NEW_LINE>mapFileExtToLang.put(canonicalKey(ext), lang);<NEW_LINE>}<NEW_LINE>} | .getLabel()), lang); |
967,619 | public void serialize(ColumnDef def, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {<NEW_LINE>jgen.writeStartObject();<NEW_LINE>jgen.writeStringField("type", def.getType());<NEW_LINE>jgen.writeStringField("name", def.getName());<NEW_LINE>if (def instanceof StringColumnDef) {<NEW_LINE>jgen.writeStringField("charset", ((StringColumnDef) def).getCharset());<NEW_LINE>} else if (def instanceof IntColumnDef) {<NEW_LINE>jgen.writeBooleanField("signed", ((IntColumnDef) def).isSigned());<NEW_LINE>} else if (def instanceof BigIntColumnDef) {<NEW_LINE>jgen.writeBooleanField("signed", ((BigIntColumnDef) def).isSigned());<NEW_LINE>} else if (def instanceof EnumeratedColumnDef) {<NEW_LINE>jgen.writeArrayFieldStart("enum-values");<NEW_LINE>for (String s : ((EnumeratedColumnDef) def).getEnumValues(<MASK><NEW_LINE>jgen.writeEndArray();<NEW_LINE>} else if (def instanceof ColumnDefWithLength) {<NEW_LINE>// columnLength is a long but technically, it' not that long. It it were, we could<NEW_LINE>// need to use a string to represent it, instead of an integer, to avoid issues<NEW_LINE>// with Javascript when parsing long integers.<NEW_LINE>Long columnLength = ((ColumnDefWithLength) def).getColumnLength();<NEW_LINE>if (columnLength != null)<NEW_LINE>jgen.writeNumberField("column-length", columnLength);<NEW_LINE>}<NEW_LINE>jgen.writeEndObject();<NEW_LINE>} | )) jgen.writeString(s); |
166,718 | public SamlServiceProvider deserialize(JsonParser jp, DeserializationContext ctxt) {<NEW_LINE>SamlServiceProvider result = new SamlServiceProvider();<NEW_LINE>// determine the type of IdentityProvider<NEW_LINE>JsonNode node = JsonUtils.readTree(jp);<NEW_LINE>// deserialize based on type<NEW_LINE>String config = getNodeAsString(node, FIELD_CONFIG, null);<NEW_LINE>SamlServiceProviderDefinition definition = null;<NEW_LINE>if (StringUtils.hasText(config)) {<NEW_LINE>definition = JsonUtils.readValue(config, SamlServiceProviderDefinition.class);<NEW_LINE>}<NEW_LINE>result.setConfig(definition);<NEW_LINE>result.setId(getNodeAsString(node, FIELD_ID, null));<NEW_LINE>result.setEntityId(getNodeAsString<MASK><NEW_LINE>result.setName(getNodeAsString(node, FIELD_NAME, null));<NEW_LINE>result.setVersion(getNodeAsInt(node, FIELD_VERSION, 0));<NEW_LINE>result.setCreated(getNodeAsDate(node, FIELD_CREATED));<NEW_LINE>result.setLastModified(getNodeAsDate(node, FIELD_LAST_MODIFIED));<NEW_LINE>result.setActive(getNodeAsBoolean(node, FIELD_ACTIVE, true));<NEW_LINE>result.setIdentityZoneId(getNodeAsString(node, FIELD_IDENTITY_ZONE_ID, null));<NEW_LINE>return result;<NEW_LINE>} | (node, FIELD_ENTITY_ID, null)); |
1,111,538 | private JComboBox createComboBox(DataItem item, Font font, FocusListener listener) {<NEW_LINE>List<ItemVariant> variants = item.getVariants();<NEW_LINE>JComboBox combo = new JComboBox(variants.toArray());<NEW_LINE>combo.setSelectedItem(item.getDefaultVariant());<NEW_LINE>// NOI18N<NEW_LINE>combo.getAccessibleContext().setAccessibleDescription(getBundleString("FixDupImportStmts_Combo_ACSD"));<NEW_LINE>// NOI18N<NEW_LINE>combo.getAccessibleContext().setAccessibleName(getBundleString("FixDupImportStmts_Combo_Name_ACSD"));<NEW_LINE>combo.setOpaque(false);<NEW_LINE>combo.setFont(font);<NEW_LINE>combo.addFocusListener(listener);<NEW_LINE>combo.setEnabled(variants.size() > 1);<NEW_LINE>combo.setRenderer(new DelegatingRenderer(combo.getRenderer(), variants, item.getVariantIcons()));<NEW_LINE>InputMap inputMap = <MASK><NEW_LINE>// NOI18N<NEW_LINE>inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), "showPopup");<NEW_LINE>// NOI18N<NEW_LINE>combo.getActionMap().put("showPopup", new TogglePopupAction());<NEW_LINE>return combo;<NEW_LINE>} | combo.getInputMap(JComboBox.WHEN_FOCUSED); |
391,879 | public void initIpTable(InputStream ipFile) {<NEW_LINE>BufferedReader reader = null;<NEW_LINE>try {<NEW_LINE>reader = new <MASK><NEW_LINE>int size = Integer.parseInt(reader.readLine());<NEW_LINE>String line;<NEW_LINE>String[] strs;<NEW_LINE>m_starts = new long[size];<NEW_LINE>m_ends = new long[size];<NEW_LINE>m_areaIds = new int[size];<NEW_LINE>m_corpIds = new int[size];<NEW_LINE>for (int i = 0; i < size; i++) {<NEW_LINE>line = reader.readLine();<NEW_LINE>strs = line.split(":");<NEW_LINE>m_starts[i] = Long.parseLong(strs[0]);<NEW_LINE>m_ends[i] = Long.parseLong(strs[1]);<NEW_LINE>m_areaIds[i] = Integer.parseInt(strs[2]);<NEW_LINE>m_corpIds[i] = Integer.parseInt(strs[3]);<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>Cat.logError(e);<NEW_LINE>} finally {<NEW_LINE>try {<NEW_LINE>reader.close();<NEW_LINE>} catch (Exception e) {<NEW_LINE>Cat.logError(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | BufferedReader(new InputStreamReader(ipFile)); |
1,401,695 | private ArgumentBuilder buildArgs(StringToStringMap values, WsdlInterface modelItem) {<NEW_LINE>values.put(OUTPUT, Tools.ensureDir(values.get(OUTPUT), ""));<NEW_LINE>ArgumentBuilder builder = new ArgumentBuilder(values);<NEW_LINE>builder.startScript(WSDL2JAVA_SCRIPT_NAME);<NEW_LINE>builder.addArgs("-uri", getWsdlUrl(values, modelItem));<NEW_LINE>builder.addString(OUTPUT, "-o");<NEW_LINE>builder.addString(PACKAGE, "p");<NEW_LINE><MASK><NEW_LINE>builder.addBoolean(ASYNC, "-a");<NEW_LINE>builder.addBoolean(SYNC, "-s");<NEW_LINE>builder.addBoolean(TESTCASE, "-t");<NEW_LINE>builder.addBoolean(SERVERSIDE, "-ss");<NEW_LINE>builder.addBoolean(SERVERSIDEINTERFACE, "-ssi");<NEW_LINE>builder.addBoolean(SERICEDESCRIPTOR, "-sd");<NEW_LINE>builder.addBoolean(GENERATEALL, "-g");<NEW_LINE>builder.addBoolean(UNPACK, "-u");<NEW_LINE>builder.addString(SERVICE_NAME, "-sn");<NEW_LINE>builder.addString(PORT_NAME, "-pn");<NEW_LINE>if ("adb".equals(values.get(DATABINDING))) {<NEW_LINE>builder.addBoolean(ADB_WRAP, "-Ew", "true", "false");<NEW_LINE>builder.addBoolean(ADB_WRITE, "-Er");<NEW_LINE>}<NEW_LINE>if ("jibx".equals(values.get(DATABINDING))) {<NEW_LINE>builder.addString(JIBX_BINDING_FILE, "-E", "");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>StringBuilder nsMapArg = new StringBuilder();<NEW_LINE>StringToStringMap nsMappings = StringToStringMap.fromXml(values.get(NAMESPACE_MAPPING));<NEW_LINE>for (Map.Entry<String, String> entry : nsMappings.entrySet()) {<NEW_LINE>if (nsMapArg.length() > 0) {<NEW_LINE>nsMapArg.append(',');<NEW_LINE>}<NEW_LINE>nsMapArg.append(entry.getKey()).append('=').append(entry.getValue());<NEW_LINE>}<NEW_LINE>builder.addArgs("-ns2p", nsMapArg.toString());<NEW_LINE>} catch (Exception e) {<NEW_LINE>SoapUI.logError(e);<NEW_LINE>}<NEW_LINE>addToolArgs(values, builder);<NEW_LINE>return builder;<NEW_LINE>} | builder.addString(DATABINDING, "-d"); |
1,628,953 | public void validateIDTokenPayload(JSONObject tokenInfo, TestSettings settings, String testSigAlg) throws Exception {<NEW_LINE>String thisMethod = "validateIDTokenPayload";<NEW_LINE>msgUtils.printMethodName(thisMethod, "Start of");<NEW_LINE>ArrayList<String> shouldntExistKeys = new ArrayList<String>();<NEW_LINE>// make sure we have all required keys<NEW_LINE>ArrayList<String> requiredKeys = new ArrayList<String>();<NEW_LINE>requiredKeys.add(Constants.IDTOK_SUBJECT_KEY);<NEW_LINE>requiredKeys.add(Constants.IDTOK_ISSUER_KEY);<NEW_LINE>requiredKeys.add(Constants.IDTOK_AUDIENCE_KEY);<NEW_LINE>requiredKeys.add(Constants.IDTOK_EXPIRE_KEY);<NEW_LINE>requiredKeys.add(Constants.IDTOK_ISSUETIME_KEY);<NEW_LINE>if (!testSigAlg.equals(Constants.SIGALG_NONE)) {<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>// make sure at_hash does NOT exist if the response is not signed<NEW_LINE>shouldntExistKeys.add(Constants.IDTOK_AT_HASH_KEY);<NEW_LINE>// msgUtils.assertTrueAndLog(thisMethod, "Key: " + Constants.IDTOK_AT_HASH_KEY + " should NOT exist", Boolean.valueOf(tokenInfo.get(Constants.IDTOK_AT_HASH_KEY) == null));<NEW_LINE>}<NEW_LINE>if (settings.getNonce() != null) {<NEW_LINE>requiredKeys.add(Constants.IDTOK_NONCE_KEY);<NEW_LINE>} else {<NEW_LINE>shouldntExistKeys.add(Constants.IDTOK_NONCE_KEY);<NEW_LINE>}<NEW_LINE>for (String key : requiredKeys) {<NEW_LINE>msgUtils.assertTrueAndLog(thisMethod, "Expected key: " + key + " does not exist", (tokenInfo.get(key) != null));<NEW_LINE>String tokenValue = tokenInfo.get(key).toString();<NEW_LINE>Log.info(thisClass, thisMethod, "Making sure required key: " + key + " exists");<NEW_LINE>// a null value implies the key wasn't there<NEW_LINE>msgUtils.assertTrueAndLog(thisMethod, "Expected key: " + key + " does not exist", Boolean.valueOf(tokenValue != null));<NEW_LINE>}<NEW_LINE>if (shouldntExistKeys != null) {<NEW_LINE>for (String key : shouldntExistKeys) {<NEW_LINE>Object tokenValue = tokenInfo.get(key);<NEW_LINE>Log.info(thisClass, thisMethod, "Making sure key: " + key + " does NOT exist");<NEW_LINE>// a null value implies the key wasn't there<NEW_LINE>msgUtils.assertTrueAndLog(thisMethod, "Key: " + key + " does exist and should NOT - it has a value of: " + tokenValue, Boolean.valueOf(tokenValue == null));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// now, let's validate the time (exp and ait have just been validated as not null,<NEW_LINE>// so, we should have a value now.<NEW_LINE>validateTokenTimeStamps(settings, tokenInfo);<NEW_LINE>} | requiredKeys.add(Constants.IDTOK_AT_HASH_KEY); |
1,151,635 | protected void doPost(HttpServletRequest request, HttpServletResponse response) {<NEW_LINE>try {<NEW_LINE>String contract = request.getReader().lines().collect(Collectors.joining(System.lineSeparator()));<NEW_LINE>Util.checkBodySize(contract);<NEW_LINE>JSONObject input = JSONObject.parseObject(contract);<NEW_LINE>boolean visible = Util.getVisibleOnlyForSign(input);<NEW_LINE>String strTransaction = input.getJSONObject("transaction").toJSONString();<NEW_LINE>Transaction transaction = Util.packTransaction(strTransaction, visible);<NEW_LINE>JSONObject jsonTransaction = JSONObject.parseObject(JsonFormat.printToString(transaction, visible));<NEW_LINE>input.put("transaction", jsonTransaction);<NEW_LINE>TransactionSign.Builder build = TransactionSign.newBuilder();<NEW_LINE>JsonFormat.merge(input.toJSONString(), build, visible);<NEW_LINE>TransactionCapsule reply = transactionUtil.addSign(build.build());<NEW_LINE>if (reply != null) {<NEW_LINE>response.getWriter().println(Util.printCreateTransaction(reply.getInstance(), visible));<NEW_LINE>} else {<NEW_LINE>response.<MASK><NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>Util.processError(e, response);<NEW_LINE>}<NEW_LINE>} | getWriter().println("{}"); |
708,407 | final CopyImageResult executeCopyImage(CopyImageRequest copyImageRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(copyImageRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CopyImageRequest> request = null;<NEW_LINE>Response<CopyImageResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CopyImageRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(copyImageRequest));<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, "AppStream");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CopyImage");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CopyImageResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CopyImageResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
1,330,930 | final DescribeChannelMembershipResult executeDescribeChannelMembership(DescribeChannelMembershipRequest describeChannelMembershipRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeChannelMembershipRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeChannelMembershipRequest> request = null;<NEW_LINE>Response<DescribeChannelMembershipResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeChannelMembershipRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeChannelMembershipRequest));<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, "Chime");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>URI endpointTraitHost = null;<NEW_LINE>if (!clientConfiguration.isDisableHostPrefixInjection()) {<NEW_LINE>String hostPrefix = "messaging-";<NEW_LINE>String resolvedHostPrefix = String.format("messaging-");<NEW_LINE>endpointTraitHost = UriResourcePathUtils.updateUriHost(endpoint, resolvedHostPrefix);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeChannelMembershipResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeChannelMembershipResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext, null, endpointTraitHost);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeChannelMembership"); |
256,586 | private void optimizeJsLoop(Collection<JsNode> toInline) throws InterruptedException {<NEW_LINE>int optimizationLevel = options.getOptimizationLevel();<NEW_LINE>List<OptimizerStats> allOptimizerStats = Lists.newArrayList();<NEW_LINE>int counter = 0;<NEW_LINE>while (true) {<NEW_LINE>counter++;<NEW_LINE>if (Thread.interrupted()) {<NEW_LINE>throw new InterruptedException();<NEW_LINE>}<NEW_LINE>Event optimizeJsEvent = SpeedTracerLogger.start(CompilerEventType.OPTIMIZE_JS);<NEW_LINE>OptimizerStats stats <MASK><NEW_LINE>// Remove unused functions if possible.<NEW_LINE>stats.add(JsStaticEval.exec(jsProgram));<NEW_LINE>// Inline Js function invocations<NEW_LINE>stats.add(JsInliner.exec(jsProgram, toInline));<NEW_LINE>// Remove unused functions if possible.<NEW_LINE>stats.add(JsUnusedFunctionRemover.exec(jsProgram));<NEW_LINE>// Save the stats to print out after optimizers finish.<NEW_LINE>allOptimizerStats.add(stats);<NEW_LINE>optimizeJsEvent.end();<NEW_LINE>if ((optimizationLevel < OptionOptimize.OPTIMIZE_LEVEL_MAX && counter > optimizationLevel) || !stats.didChange()) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (optimizationLevel > OptionOptimize.OPTIMIZE_LEVEL_DRAFT) {<NEW_LINE>DuplicateClinitRemover.exec(jsProgram);<NEW_LINE>}<NEW_LINE>} | = new OptimizerStats("Pass " + counter); |
841,971 | final ListAccountAliasesResult executeListAccountAliases(ListAccountAliasesRequest listAccountAliasesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listAccountAliasesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListAccountAliasesRequest> request = null;<NEW_LINE>Response<ListAccountAliasesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListAccountAliasesRequestMarshaller().marshall(super.beforeMarshalling(listAccountAliasesRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "IAM");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListAccountAliases");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<ListAccountAliasesResult> responseHandler = new StaxResponseHandler<ListAccountAliasesResult>(new ListAccountAliasesResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); |
109,880 | public static void pushOntoStack(OperationResourceInfo ori, MultivaluedMap<String, String> params, Message msg) {<NEW_LINE>OperationResourceInfoStack stack = msg.get(OperationResourceInfoStack.class);<NEW_LINE>if (stack == null) {<NEW_LINE>stack = new OperationResourceInfoStack();<NEW_LINE>msg.put(OperationResourceInfoStack.class, stack);<NEW_LINE>}<NEW_LINE>List<String> values = null;<NEW_LINE>if (params.size() <= 1) {<NEW_LINE>values = Collections.emptyList();<NEW_LINE>} else {<NEW_LINE>values = new ArrayList<>(<MASK><NEW_LINE>addTemplateVarValues(values, params, ori.getClassResourceInfo().getURITemplate());<NEW_LINE>addTemplateVarValues(values, params, ori.getURITemplate());<NEW_LINE>}<NEW_LINE>Class<?> realClass = ori.getClassResourceInfo().getServiceClass();<NEW_LINE>stack.push(new MethodInvocationInfo(ori, realClass, values));<NEW_LINE>} | params.size() - 1); |
1,464,132 | final CreateRuleResult executeCreateRule(CreateRuleRequest createRuleRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createRuleRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateRuleRequest> request = null;<NEW_LINE>Response<CreateRuleResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateRuleRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createRuleRequest));<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, "WAF");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateRule");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateRuleResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateRuleResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
1,644,922 | private TorrentDetails torrentDetails(Log log, String torrentId) throws DaemonException {<NEW_LINE>List<String> trackers = new ArrayList<>();<NEW_LINE>List<String> <MASK><NEW_LINE>try {<NEW_LINE>JSONObject jsonTorrent = authGet(log, "SYNO.DownloadStation.Task", "1", "DownloadStation/task.cgi", "&method=getinfo&id=" + torrentId + "&additional=tracker").getData(log).getJSONArray("tasks").getJSONObject(0);<NEW_LINE>JSONObject additional = jsonTorrent.getJSONObject("additional");<NEW_LINE>if (additional.has("tracker")) {<NEW_LINE>JSONArray tracker = additional.getJSONArray("tracker");<NEW_LINE>for (int i = 0; i < tracker.length(); i++) {<NEW_LINE>JSONObject t = tracker.getJSONObject(i);<NEW_LINE>if ("Success".equals(t.getString("status"))) {<NEW_LINE>trackers.add(t.getString("url"));<NEW_LINE>} else {<NEW_LINE>errors.add(t.getString("status"));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new TorrentDetails(trackers, errors);<NEW_LINE>} catch (JSONException e) {<NEW_LINE>throw new DaemonException(ExceptionType.ParsingFailed, e.toString());<NEW_LINE>}<NEW_LINE>} | errors = new ArrayList<>(); |
739,700 | public void handle(AnnotationValues<ToString> annotation, Annotation ast, EclipseNode annotationNode) {<NEW_LINE>handleFlagUsage(annotationNode, ConfigurationKeys.TO_STRING_FLAG_USAGE, "@ToString");<NEW_LINE>ToString ann = annotation.getInstance();<NEW_LINE>boolean onlyExplicitlyIncluded = annotationNode.getAst().getBooleanAnnotationValue(annotation, "onlyExplicitlyIncluded", ConfigurationKeys.TO_STRING_ONLY_EXPLICITLY_INCLUDED);<NEW_LINE>List<Included<EclipseNode, ToString.Include>> members = InclusionExclusionUtils.handleToStringMarking(annotationNode.up(), onlyExplicitlyIncluded, annotation, annotationNode);<NEW_LINE>if (members == null)<NEW_LINE>return;<NEW_LINE><MASK><NEW_LINE>if (!annotation.isExplicit("callSuper"))<NEW_LINE>callSuper = null;<NEW_LINE>Boolean doNotUseGettersConfiguration = annotationNode.getAst().readConfiguration(ConfigurationKeys.TO_STRING_DO_NOT_USE_GETTERS);<NEW_LINE>boolean doNotUseGetters = annotation.isExplicit("doNotUseGetters") || doNotUseGettersConfiguration == null ? ann.doNotUseGetters() : doNotUseGettersConfiguration;<NEW_LINE>FieldAccess fieldAccess = doNotUseGetters ? FieldAccess.PREFER_FIELD : FieldAccess.GETTER;<NEW_LINE>Boolean fieldNamesConfiguration = annotationNode.getAst().readConfiguration(ConfigurationKeys.TO_STRING_INCLUDE_FIELD_NAMES);<NEW_LINE>boolean includeFieldNames = annotation.isExplicit("includeFieldNames") || fieldNamesConfiguration == null ? ann.includeFieldNames() : fieldNamesConfiguration;<NEW_LINE>generateToString(annotationNode.up(), annotationNode, members, includeFieldNames, callSuper, true, fieldAccess);<NEW_LINE>} | Boolean callSuper = ann.callSuper(); |
1,834,353 | public GroundStationData unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>GroundStationData groundStationData = new GroundStationData();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("groundStationId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>groundStationData.setGroundStationId(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("groundStationName", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>groundStationData.setGroundStationName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("region", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>groundStationData.setRegion(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return groundStationData;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
1,754,528 | private void rotateDate() {<NEW_LINE>this.startDate = System.currentTimeMillis();<NEW_LINE>if (handler != null) {<NEW_LINE>handler.close();<NEW_LINE>}<NEW_LINE>SimpleDateFormat format = dateFormatThreadLocal.get();<NEW_LINE>String newPattern = pattern.replace("%d", format.format(new Date()));<NEW_LINE>// Get current date.<NEW_LINE>Calendar next = Calendar.getInstance();<NEW_LINE>// Begin of next date.<NEW_LINE>next.set(Calendar.HOUR_OF_DAY, 0);<NEW_LINE>next.set(Calendar.MINUTE, 0);<NEW_LINE>next.set(Calendar.SECOND, 0);<NEW_LINE>next.<MASK><NEW_LINE>next.add(Calendar.DATE, 1);<NEW_LINE>this.endDate = next.getTimeInMillis();<NEW_LINE>try {<NEW_LINE>this.handler = new FileHandler(newPattern, limit, count, append);<NEW_LINE>if (initialized) {<NEW_LINE>handler.setEncoding(this.getEncoding());<NEW_LINE>handler.setErrorManager(this.getErrorManager());<NEW_LINE>handler.setFilter(this.getFilter());<NEW_LINE>handler.setFormatter(this.getFormatter());<NEW_LINE>handler.setLevel(this.getLevel());<NEW_LINE>}<NEW_LINE>} catch (SecurityException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>} catch (IOException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>} | set(Calendar.MILLISECOND, 0); |
67,104 | private void createPackageDeclaration(ModuleNode moduleNode) {<NEW_LINE>if (moduleNode.hasPackageName()) {<NEW_LINE>String packageName = moduleNode.getPackageName();<NEW_LINE>if (packageName.endsWith(".")) {<NEW_LINE>packageName = packageName.substring(0, packageName.length() - 1);<NEW_LINE>}<NEW_LINE>PackageNode packageNode = moduleNode.getPackage();<NEW_LINE>char[][] splits = CharOperation.splitOn('.', packageName.toCharArray());<NEW_LINE>long[] positions = positionsFor(splits, startOffset(packageNode), endOffset(packageNode));<NEW_LINE>ImportReference ref = new ImportReference(splits, <MASK><NEW_LINE>ref.annotations = createAnnotations(packageNode.getAnnotations());<NEW_LINE>ref.declarationEnd = ref.sourceEnd + trailerLength(packageNode);<NEW_LINE>ref.declarationSourceStart = Math.max(0, ref.sourceStart - "package ".length());<NEW_LINE>ref.declarationSourceEnd = ref.sourceEnd;<NEW_LINE>unitDeclaration.currentPackage = ref;<NEW_LINE>}<NEW_LINE>} | positions, true, Flags.AccDefault); |
953,518 | public static <T extends Model> List<T> processCursor(Class<? extends Model> type, Cursor cursor) {<NEW_LINE>TableInfo tableInfo = Cache.getTableInfo(type);<NEW_LINE>String idName = tableInfo.getIdName();<NEW_LINE>final List<T> entities = new ArrayList<T>();<NEW_LINE>try {<NEW_LINE>Constructor<?> entityConstructor = type.getConstructor();<NEW_LINE>if (cursor.moveToFirst()) {<NEW_LINE>List<String> columnsOrdered = new ArrayList<String>(Arrays.asList(cursor.getColumnNames()));<NEW_LINE>do {<NEW_LINE>Model entity = Cache.getEntity(type, cursor.getLong(<MASK><NEW_LINE>if (entity == null) {<NEW_LINE>entity = (T) entityConstructor.newInstance();<NEW_LINE>}<NEW_LINE>entity.loadFromCursor(cursor);<NEW_LINE>entities.add((T) entity);<NEW_LINE>} while (cursor.moveToNext());<NEW_LINE>}<NEW_LINE>} catch (NoSuchMethodException e) {<NEW_LINE>throw new RuntimeException("Your model " + type.getName() + " does not define a default " + "constructor. The default constructor is required for " + "now in ActiveAndroid models, as the process to " + "populate the ORM model is : " + "1. instantiate default model " + "2. populate fields");<NEW_LINE>} catch (Exception e) {<NEW_LINE>Log.e("Failed to process cursor.", e);<NEW_LINE>}<NEW_LINE>return entities;<NEW_LINE>} | columnsOrdered.indexOf(idName))); |
1,022,574 | public Expr apply(final List<Expr> args) {<NEW_LINE>if (args.size() != 2) {<NEW_LINE>throw new IAE(ExprUtils.createErrMsg(name(), "must have 2 arguments"));<NEW_LINE>}<NEW_LINE>SubnetUtils.SubnetInfo subnetInfo = getSubnetInfo(args);<NEW_LINE>Expr arg = args.get(0);<NEW_LINE>class IPv4AddressMatchExpr extends ExprMacroTable.BaseScalarUnivariateMacroFunctionExpr {<NEW_LINE><NEW_LINE>private final SubnetUtils.SubnetInfo subnetInfo;<NEW_LINE><NEW_LINE>private IPv4AddressMatchExpr(Expr arg, SubnetUtils.SubnetInfo subnetInfo) {<NEW_LINE>super(FN_NAME, arg);<NEW_LINE>this.subnetInfo = subnetInfo;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Nonnull<NEW_LINE>@Override<NEW_LINE>public ExprEval eval(final ObjectBinding bindings) {<NEW_LINE>ExprEval eval = arg.eval(bindings);<NEW_LINE>boolean match;<NEW_LINE>switch(eval.type().getType()) {<NEW_LINE>case STRING:<NEW_LINE>match = <MASK><NEW_LINE>break;<NEW_LINE>case LONG:<NEW_LINE>match = !eval.isNumericNull() && isLongMatch(eval.asLong());<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>match = false;<NEW_LINE>}<NEW_LINE>return ExprEval.ofLongBoolean(match);<NEW_LINE>}<NEW_LINE><NEW_LINE>private boolean isStringMatch(String stringValue) {<NEW_LINE>return IPv4AddressExprUtils.isValidAddress(stringValue) && subnetInfo.isInRange(stringValue);<NEW_LINE>}<NEW_LINE><NEW_LINE>private boolean isLongMatch(long longValue) {<NEW_LINE>return !IPv4AddressExprUtils.overflowsUnsignedInt(longValue) && subnetInfo.isInRange((int) longValue);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Expr visit(Shuttle shuttle) {<NEW_LINE>return shuttle.visit(apply(shuttle.visitAll(args)));<NEW_LINE>}<NEW_LINE><NEW_LINE>@Nullable<NEW_LINE>@Override<NEW_LINE>public ExpressionType getOutputType(InputBindingInspector inspector) {<NEW_LINE>return ExpressionType.LONG;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String stringify() {<NEW_LINE>return StringUtils.format("%s(%s, %s)", FN_NAME, arg.stringify(), args.get(ARG_SUBNET).stringify());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new IPv4AddressMatchExpr(arg, subnetInfo);<NEW_LINE>} | isStringMatch(eval.asString()); |
407,530 | public void checkClasses(ABCAnalysis abcAnalysis) throws AxelorException {<NEW_LINE>List<ABCAnalysisClass<MASK><NEW_LINE>BigDecimal classQty, classWorth;<NEW_LINE>BigDecimal totalQty = BigDecimal.ZERO, totalWorth = BigDecimal.ZERO;<NEW_LINE>BigDecimal comparisonValue = new BigDecimal(100);<NEW_LINE>for (ABCAnalysisClass abcAnalysisClass : abcAnalysisClassList) {<NEW_LINE>classQty = abcAnalysisClass.getQty();<NEW_LINE>classWorth = abcAnalysisClass.getWorth();<NEW_LINE>if (classQty.compareTo(BigDecimal.ZERO) <= 0 || classWorth.compareTo(BigDecimal.ZERO) <= 0) {<NEW_LINE>throw new AxelorException(abcAnalysis, TraceBackRepository.CATEGORY_CONFIGURATION_ERROR, I18n.get(IExceptionMessage.ABC_CLASSES_NEGATIVE_OR_NULL_QTY_OR_WORTH));<NEW_LINE>}<NEW_LINE>totalQty = totalQty.add(classQty);<NEW_LINE>totalWorth = totalWorth.add(classWorth);<NEW_LINE>}<NEW_LINE>if (totalQty.compareTo(comparisonValue) != 0 || totalWorth.compareTo(comparisonValue) != 0) {<NEW_LINE>throw new AxelorException(abcAnalysis, TraceBackRepository.CATEGORY_CONFIGURATION_ERROR, I18n.get(IExceptionMessage.ABC_CLASSES_INVALID_QTY_OR_WORTH));<NEW_LINE>}<NEW_LINE>} | > abcAnalysisClassList = abcAnalysis.getAbcAnalysisClassList(); |
1,160,458 | final ListComponentVersionsResult executeListComponentVersions(ListComponentVersionsRequest listComponentVersionsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listComponentVersionsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListComponentVersionsRequest> request = null;<NEW_LINE>Response<ListComponentVersionsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListComponentVersionsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listComponentVersionsRequest));<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, "GreengrassV2");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListComponentVersionsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListComponentVersionsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListComponentVersions"); |
397,721 | public DescribeAccessPointsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>DescribeAccessPointsResult describeAccessPointsResult = new DescribeAccessPointsResult();<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 describeAccessPointsResult;<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("AccessPoints", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>describeAccessPointsResult.setAccessPoints(new ListUnmarshaller<AccessPointDescription>(AccessPointDescriptionJsonUnmarshaller.getInstance(<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("NextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>describeAccessPointsResult.setNextToken(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return describeAccessPointsResult;<NEW_LINE>} | )).unmarshall(context)); |
323,991 | private Mono<PagedResponse<ClusterInner>> listByResourceGroupSinglePageAsync(String resourceGroupName, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.listByResourceGroup(this.client.getEndpoint(), resourceGroupName, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context).map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null));<NEW_LINE>} | error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); |
163,884 | public void weaveJarFile(String sourceJarFileName, String destJarFileName) throws IOException {<NEW_LINE>JarFile jarFile = new JarFile(sourceJarFileName);<NEW_LINE>ArrayList<JarEntry> entries = Collections.list(jarFile.entries());<NEW_LINE><MASK><NEW_LINE>JarOutputStream out = new JarOutputStream(os);<NEW_LINE>int n = 0;<NEW_LINE>for (JarEntry entry : entries) {<NEW_LINE>if (entry.getName().endsWith(".class")) {<NEW_LINE>n++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>displayStartMessage(n);<NEW_LINE>for (JarEntry entry : entries) {<NEW_LINE>String name = entry.getName();<NEW_LINE>InputStream dataStream = null;<NEW_LINE>if (name.endsWith(".class")) {<NEW_LINE>// weave class<NEW_LINE>InputStream is = jarFile.getInputStream(entry);<NEW_LINE>ByteArrayOutputStream classStream = new ByteArrayOutputStream();<NEW_LINE>if (weave(is, name, classStream)) {<NEW_LINE>// class file was modified<NEW_LINE>weavedClassCount++;<NEW_LINE>dataStream = new ByteArrayInputStream(classStream.toByteArray());<NEW_LINE>// create new entry<NEW_LINE>entry = new JarEntry(name);<NEW_LINE>recordFileForVerifier(name);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (dataStream == null) {<NEW_LINE>// not a class file or class wasn't no<NEW_LINE>dataStream = jarFile.getInputStream(entry);<NEW_LINE>}<NEW_LINE>// writing entry<NEW_LINE>out.putNextEntry(new JarEntry(name));<NEW_LINE>// writing data<NEW_LINE>int len;<NEW_LINE>final byte[] buf = new byte[1024];<NEW_LINE>while ((len = dataStream.read(buf)) >= 0) {<NEW_LINE>out.write(buf, 0, len);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>out.close();<NEW_LINE>jarFile.close();<NEW_LINE>displayEndMessage();<NEW_LINE>if (verifier != null) {<NEW_LINE>verifier.verifyJarFile(destJarFileName);<NEW_LINE>verifier.displaySummary();<NEW_LINE>}<NEW_LINE>} | OutputStream os = new FileOutputStream(destJarFileName); |
676,155 | public static ResAttr factory(ResReferenceValue parent, Duo<Integer, ResScalarValue>[] items, ResValueFactory factory, ResPackage pkg) throws AndrolibException {<NEW_LINE>int type = ((ResIntValue) items[0].m2).getValue();<NEW_LINE>int scalarType = type & 0xffff;<NEW_LINE>Integer min = null, max = null;<NEW_LINE>Boolean l10n = null;<NEW_LINE>int i;<NEW_LINE>for (i = 1; i < items.length; i++) {<NEW_LINE>switch(items[i].m1) {<NEW_LINE>case BAG_KEY_ATTR_MIN:<NEW_LINE>min = ((ResIntValue) items[i].m2).getValue();<NEW_LINE>continue;<NEW_LINE>case BAG_KEY_ATTR_MAX:<NEW_LINE>max = ((ResIntValue) items[i].m2).getValue();<NEW_LINE>continue;<NEW_LINE>case BAG_KEY_ATTR_L10N:<NEW_LINE>l10n = ((ResIntValue) items[i].m2).getValue() != 0;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (i == items.length) {<NEW_LINE>return new ResAttr(parent, scalarType, min, max, l10n);<NEW_LINE>}<NEW_LINE>Duo<ResReferenceValue, ResIntValue>[] attrItems = new Duo[items.length - i];<NEW_LINE>int j = 0;<NEW_LINE>for (; i < items.length; i++) {<NEW_LINE>int resId = items[i].m1;<NEW_LINE>pkg.addSynthesizedRes(resId);<NEW_LINE>attrItems[j++] = new Duo<>(factory.newReference(resId, null), (ResIntValue) items[i].m2);<NEW_LINE>}<NEW_LINE>switch(type & 0xff0000) {<NEW_LINE>case TYPE_ENUM:<NEW_LINE>return new ResEnumAttr(parent, scalarType, min, max, l10n, attrItems);<NEW_LINE>case TYPE_FLAGS:<NEW_LINE>return new ResFlagsAttr(parent, scalarType, <MASK><NEW_LINE>}<NEW_LINE>throw new AndrolibException("Could not decode attr value");<NEW_LINE>} | min, max, l10n, attrItems); |
726,211 | public LongAnalysisCounter merge(LongAnalysisCounter other) {<NEW_LINE><MASK><NEW_LINE>long newCountMinValue;<NEW_LINE>if (getMinValueSeen() == otherMin) {<NEW_LINE>newCountMinValue = countMinValue + other.getCountMinValue();<NEW_LINE>} else if (getMinValueSeen() > otherMin) {<NEW_LINE>// Keep other, take count from other<NEW_LINE>newCountMinValue = other.getCountMinValue();<NEW_LINE>} else {<NEW_LINE>// Keep this min, no change to count<NEW_LINE>newCountMinValue = countMinValue;<NEW_LINE>}<NEW_LINE>long otherMax = other.getMaxValueSeen();<NEW_LINE>long newCountMaxValue;<NEW_LINE>if (getMaxValueSeen() == otherMax) {<NEW_LINE>newCountMaxValue = countMaxValue + other.getCountMaxValue();<NEW_LINE>} else if (getMaxValueSeen() < otherMax) {<NEW_LINE>// Keep other, take count from other<NEW_LINE>newCountMaxValue = other.getCountMaxValue();<NEW_LINE>} else {<NEW_LINE>// Keep this max, no change to count<NEW_LINE>newCountMaxValue = countMaxValue;<NEW_LINE>}<NEW_LINE>digest.add(other.getDigest());<NEW_LINE>return new LongAnalysisCounter(counter.merge(other.getCounter()), countZero + other.getCountZero(), newCountMinValue, newCountMaxValue, countPositive + other.getCountPositive(), countNegative + other.getCountNegative(), digest);<NEW_LINE>} | long otherMin = other.getMinValueSeen(); |
22,349 | private void submitForm() {<NEW_LINE>if (!validateForm()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);<NEW_LINE>imm.hideSoftInputFromWindow(et_user.getWindowToken(), 0);<NEW_LINE>if (!isOnline(this)) {<NEW_LINE>loginLoggingIn.setVisibility(View.GONE);<NEW_LINE>loginLogin.setVisibility(View.VISIBLE);<NEW_LINE>loginCreateAccount.setVisibility(View.INVISIBLE);<NEW_LINE>queryingSignupLinkText.setVisibility(View.GONE);<NEW_LINE>confirmingAccountText.setVisibility(View.GONE);<NEW_LINE>generatingKeysText.setVisibility(View.GONE);<NEW_LINE>loggingInText.setVisibility(View.GONE);<NEW_LINE>fetchingNodesText.setVisibility(View.GONE);<NEW_LINE>prepareNodesText.setVisibility(View.GONE);<NEW_LINE>if (serversBusyText != null) {<NEW_LINE>serversBusyText.setVisibility(View.GONE);<NEW_LINE>}<NEW_LINE>showErrorAlertDialog(getString(R.string.error_server_connection_problem), false, this);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>loginLogin.setVisibility(View.GONE);<NEW_LINE>loginCreateAccount.setVisibility(View.GONE);<NEW_LINE><MASK><NEW_LINE>generatingKeysText.setVisibility(View.VISIBLE);<NEW_LINE>loginProgressBar.setVisibility(View.VISIBLE);<NEW_LINE>loginFetchNodesProgressBar.setVisibility(View.GONE);<NEW_LINE>queryingSignupLinkText.setVisibility(View.GONE);<NEW_LINE>confirmingAccountText.setVisibility(View.GONE);<NEW_LINE>lastEmail = et_user.getText().toString().toLowerCase(Locale.ENGLISH).trim();<NEW_LINE>lastPassword = et_password.getText().toString();<NEW_LINE>logDebug("Generating keys");<NEW_LINE>onKeysGenerated(lastEmail, lastPassword);<NEW_LINE>} | loginLoggingIn.setVisibility(View.VISIBLE); |
560,885 | public BreakStatement convert(org.eclipse.jdt.internal.compiler.ast.BreakStatement statement) {<NEW_LINE>BreakStatement breakStatement = new BreakStatement(this.ast);<NEW_LINE>if (this.ast.apiLevel == AST.JLS12_INTERNAL && this.ast.isPreviewEnabled()) {<NEW_LINE>breakStatement.setImplicit(statement.isImplicit);<NEW_LINE>if (statement.isImplicit) {<NEW_LINE>breakStatement.setSourceRange(statement.sourceEnd - 1, 0);<NEW_LINE>} else {<NEW_LINE>breakStatement.setSourceRange(statement.sourceStart, statement.<MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>breakStatement.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);<NEW_LINE>}<NEW_LINE>if (statement.label != null) {<NEW_LINE>final SimpleName name = new SimpleName(this.ast);<NEW_LINE>name.internalSetIdentifier(new String(statement.label));<NEW_LINE>retrieveIdentifierAndSetPositions(statement.sourceStart, statement.sourceEnd, name);<NEW_LINE>breakStatement.setLabel(name);<NEW_LINE>} else if (statement.expression != null && this.ast.apiLevel == AST.JLS12_INTERNAL && this.ast.isPreviewEnabled()) {<NEW_LINE>final Expression expression = convert(statement.expression);<NEW_LINE>breakStatement.setExpression(expression);<NEW_LINE>int sourceEnd = statement.sourceEnd;<NEW_LINE>if (sourceEnd == -1) {<NEW_LINE>breakStatement.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 2);<NEW_LINE>} else {<NEW_LINE>breakStatement.setSourceRange(statement.sourceStart, sourceEnd - statement.sourceStart + 1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return breakStatement;<NEW_LINE>} | sourceEnd - statement.sourceStart + 1); |
446,687 | public List<CompletionProposal> complete(CodeCompletionContext ccContext, CompletionContext jsCompletionContext, String prefix) {<NEW_LINE>List<CompletionProposal> <MASK><NEW_LINE>int caretOffset = ccContext.getParserResult().getSnapshot().getEmbeddedOffset(ccContext.getCaretOffset());<NEW_LINE>String pref = ccContext.getPrefix();<NEW_LINE>int offset = pref == null ? caretOffset : // can't just use 'prefix.getLength()' here cos it might have been calculated with<NEW_LINE>caretOffset - // the 'upToOffset' flag set to false<NEW_LINE>pref.length();<NEW_LINE>switch(jsCompletionContext) {<NEW_LINE>case STRING_ELEMENTS_BY_ID:<NEW_LINE>completeTagIds(ccContext.getParserResult(), pref, offset, resultList);<NEW_LINE>break;<NEW_LINE>case STRING_ELEMENTS_BY_CLASS_NAME:<NEW_LINE>completeCSSClassNames(ccContext.getParserResult(), pref, offset, resultList);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>return resultList;<NEW_LINE>} | resultList = new ArrayList<>(); |
891,612 | private List<Wo> list(Business business, Wi wi) throws Exception {<NEW_LINE>List<Wo> wos = new ArrayList<>();<NEW_LINE>Identity identity = business.identity().pick(wi.getIdentity());<NEW_LINE>if (null != identity) {<NEW_LINE>EntityManager em = business.entityManagerContainer().get(UnitDuty.class);<NEW_LINE><MASK><NEW_LINE>CriteriaQuery<String> cq = cb.createQuery(String.class);<NEW_LINE>Root<UnitDuty> root = cq.from(UnitDuty.class);<NEW_LINE>Predicate p = cb.isMember(identity.getId(), root.get(UnitDuty_.identityList));<NEW_LINE>p = cb.and(p, cb.equal(root.get(UnitDuty_.name), wi.getName()));<NEW_LINE>List<String> unitIds = em.createQuery(cq.select(root.get(UnitDuty_.unit)).where(p)).getResultList().stream().distinct().collect(Collectors.toList());<NEW_LINE>unitIds = ListTools.trim(unitIds, true, true);<NEW_LINE>List<Unit> units = business.unit().pick(unitIds);<NEW_LINE>units = business.unit().sort(units);<NEW_LINE>for (Unit o : units) {<NEW_LINE>wos.add(this.convert(business, o, Wo.class));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return wos;<NEW_LINE>} | CriteriaBuilder cb = em.getCriteriaBuilder(); |
1,387,281 | protected k8055BindingConfig parseBindingConfig(String bindingConfig) throws BindingConfigParseException {<NEW_LINE>k8055BindingConfig config = new k8055BindingConfig();<NEW_LINE>String[] configParts = bindingConfig.split(":");<NEW_LINE>if (configParts.length != 2) {<NEW_LINE>throw new BindingConfigParseException("Unable to parse k8055 binding string: " + bindingConfig + ". Incorrect number of colons.");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>config.ioNumber = Integer.parseInt(configParts[1]);<NEW_LINE>config.ioType = IOType.valueOf(configParts[0]);<NEW_LINE>} catch (NumberFormatException e) {<NEW_LINE>throw new BindingConfigParseException("Unable to parse k8055 binding string: " + bindingConfig + ". Could not parse input number: " + configParts[1]);<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>throw new BindingConfigParseException("Unable to parse k8055 binding string: " + bindingConfig + ". Invalid input type: " + configParts[0]);<NEW_LINE>}<NEW_LINE>// Verify config is actually valid given the hardware<NEW_LINE>if (config.ioNumber < 1) {<NEW_LINE>throw new BindingConfigParseException("Unable to parse k8055 binding string: " + bindingConfig + ". IO channel must be greater than equal to 1 ");<NEW_LINE>} else if ((config.ioNumber > NUM_DIGITAL_INPUTS && config.ioType.equals(IOType.DIGITAL_IN)) || (config.ioNumber > NUM_DIGITAL_OUTPUTS && config.ioType.equals(IOType.DIGITAL_OUT)) || (config.ioNumber > NUM_ANALOG_INPUTS && config.ioType.equals(IOType.ANALOG_IN)) || (config.ioNumber > NUM_ANALOG_OUTPUTS && config.ioType.equals(IOType.ANALOG_OUT))) {<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>return config;<NEW_LINE>} | BindingConfigParseException("Unable to parse k8055 binding string: " + bindingConfig + ". IO channel number was greater than the number of physical channels "); |
1,485,983 | public void generateSources(InitSettings settings, TemplateFactory templateFactory) {<NEW_LINE>for (String subproject : settings.getSubprojects()) {<NEW_LINE>List<String> sourceTemplates = new ArrayList<>();<NEW_LINE>List<String> <MASK><NEW_LINE>List<String> integrationTestSourceTemplates = new ArrayList<>();<NEW_LINE>sourceTemplates(subproject, settings, templateFactory, sourceTemplates);<NEW_LINE>testSourceTemplates(subproject, settings, templateFactory, testSourceTemplates);<NEW_LINE>List<TemplateOperation> templateOps = new ArrayList<>(sourceTemplates.size() + testSourceTemplates.size() + integrationTestSourceTemplates.size());<NEW_LINE>sourceTemplates.stream().map(t -> templateFactory.fromSourceTemplate(templatePath(t), "main", subproject, templateLanguage(t))).forEach(templateOps::add);<NEW_LINE>testSourceTemplates.stream().map(t -> templateFactory.fromSourceTemplate(templatePath(t), "test", subproject, templateLanguage(t))).forEach(templateOps::add);<NEW_LINE>integrationTestSourceTemplates.stream().map(t -> templateFactory.fromSourceTemplate(templatePath(t), "integrationTest", subproject, templateLanguage(t))).forEach(templateOps::add);<NEW_LINE>templateFactory.whenNoSourcesAvailable(subproject, templateOps).generate();<NEW_LINE>}<NEW_LINE>} | testSourceTemplates = new ArrayList<>(); |
572,288 | // The magic is here<NEW_LINE>private void drawCutIcon(TextureAtlasSprite icon, int x, int y, int width, int height, int cut) {<NEW_LINE>Tessellator tess = Tessellator.getInstance();<NEW_LINE>VertexBuffer vb = tess.getBuffer();<NEW_LINE>vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);<NEW_LINE>vertexUV(vb, x, y + height, zLevel, icon.getMinU(), icon.getInterpolatedV(height));<NEW_LINE>vertexUV(vb, x + width, y + height, zLevel, icon.getInterpolatedU(width)<MASK><NEW_LINE>vertexUV(vb, x + width, y + cut, zLevel, icon.getInterpolatedU(width), icon.getInterpolatedV(cut));<NEW_LINE>vertexUV(vb, x, y + cut, zLevel, icon.getMinU(), icon.getInterpolatedV(cut));<NEW_LINE>tess.draw();<NEW_LINE>} | , icon.getInterpolatedV(height)); |
1,842,994 | public static void flipCopyWithGamma(FloatBuffer srcBuf, int srcStep, FloatBuffer dstBuf, int dstStep, double gamma, boolean flip, int channels) {<NEW_LINE>assert srcBuf != dstBuf;<NEW_LINE>int w = Math.min(srcStep, dstStep);<NEW_LINE>int srcLine = srcBuf.position(), dstLine = dstBuf.position();<NEW_LINE>float[] buffer = new float[channels];<NEW_LINE>while (srcLine < srcBuf.capacity() && dstLine < dstBuf.capacity()) {<NEW_LINE>if (flip) {<NEW_LINE>srcBuf.position(srcBuf.capacity() - srcLine - srcStep);<NEW_LINE>} else {<NEW_LINE>srcBuf.position(srcLine);<NEW_LINE>}<NEW_LINE>dstBuf.position(dstLine);<NEW_LINE>w = Math.min(Math.min(w, srcBuf.remaining()), dstBuf.remaining());<NEW_LINE>if (channels > 1) {<NEW_LINE>for (int x = 0; x < w; x += channels) {<NEW_LINE>for (int z = 0; z < channels; z++) {<NEW_LINE>float in = srcBuf.get();<NEW_LINE>float out;<NEW_LINE>if (gamma == 1.0) {<NEW_LINE>out = in;<NEW_LINE>} else {<NEW_LINE>out = (float) Math.pow(in, gamma);<NEW_LINE>}<NEW_LINE>buffer[z] = out;<NEW_LINE>}<NEW_LINE>for (int z = channels - 1; z >= 0; z--) {<NEW_LINE>dstBuf.put(buffer[z]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>for (int x = 0; x < w; x++) {<NEW_LINE>float in = srcBuf.get();<NEW_LINE>float out;<NEW_LINE>if (gamma == 1.0) {<NEW_LINE>out = in;<NEW_LINE>} else {<NEW_LINE>out = (float) <MASK><NEW_LINE>}<NEW_LINE>dstBuf.put(out);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>srcLine += srcStep;<NEW_LINE>dstLine += dstStep;<NEW_LINE>}<NEW_LINE>} | Math.pow(in, gamma); |
1,285,950 | public static void dumpComponentProperties(Object cmp, String indent) {<NEW_LINE>Class cls = cmp.getClass();<NEW_LINE>Method[] methods = cls.getMethods();<NEW_LINE>Arrays.sort(methods, new Comparator<Method>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public int compare(Method o1, Method o2) {<NEW_LINE>return methodPropertyName_(o1.getName()).toLowerCase().compareTo(methodPropertyName_(o2.getName()).toLowerCase());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>System.out.println(indent + cmp.getClass().getName() + "{");<NEW_LINE>for (int i = 0; i < methods.length; i++) {<NEW_LINE>Method method = methods[i];<NEW_LINE>method.setAccessible(true);<NEW_LINE>String name = method.getName();<NEW_LINE>String propertyName = methodPropertyName_(name);<NEW_LINE>if ((name.startsWith("get") || name.startsWith("is") || name.equalsIgnoreCase("scrollableYFlag") || name.equalsIgnoreCase("scrollableXFlag")) && method.getParameterCount() == 0 && method.getReturnType() != Void.class) {<NEW_LINE>try {<NEW_LINE>System.out.println(indent + " " + propertyName + ": " + method.invoke(cmp, new Object[0]));<NEW_LINE>if (propertyName.equalsIgnoreCase("style")) {<NEW_LINE>dumpComponentProperties(method.invoke(cmp, new Object[0]), indent + " ");<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>System.<MASK><NEW_LINE>} | out.println(indent + "}"); |
824,787 | static void writeUpdateOfUpdaterJar(JarEntry updaterJarEntry, File zipFileWithUpdater, File targetCluster) throws IOException {<NEW_LINE>JarFile jf = new JarFile(zipFileWithUpdater);<NEW_LINE>String entryPath = updaterJarEntry.getName();<NEW_LINE>String entryName = entryPath.contains("/") ? entryPath.substring(entryPath.lastIndexOf("/") + 1) : entryPath;<NEW_LINE>File dest = new // updater<NEW_LINE>File(// updater<NEW_LINE>targetCluster, // new_updater<NEW_LINE>UpdaterDispatcher.UPDATE_DIR + UpdateTracking.FILE_SEPARATOR + UpdaterDispatcher.NEW_UPDATER_DIR + UpdateTracking.FILE_SEPARATOR + entryName);<NEW_LINE>dest.getParentFile().mkdirs();<NEW_LINE>assert dest.getParentFile().exists() && dest.getParentFile().isDirectory() : "Parent of " + dest + " exists and is directory.";<NEW_LINE>InputStream is = null;<NEW_LINE>OutputStream fos = null;<NEW_LINE>try {<NEW_LINE>try {<NEW_LINE>fos = new FileOutputStream(dest);<NEW_LINE>is = jf.getInputStream(updaterJarEntry);<NEW_LINE><MASK><NEW_LINE>} finally {<NEW_LINE>if (is != null)<NEW_LINE>is.close();<NEW_LINE>if (fos != null)<NEW_LINE>fos.close();<NEW_LINE>jf.close();<NEW_LINE>}<NEW_LINE>} catch (java.io.FileNotFoundException fnfe) {<NEW_LINE>getLogger().log(Level.SEVERE, fnfe.getLocalizedMessage(), fnfe);<NEW_LINE>} catch (java.io.IOException ioe) {<NEW_LINE>getLogger().log(Level.SEVERE, ioe.getLocalizedMessage(), ioe);<NEW_LINE>}<NEW_LINE>} | FileUtil.copy(is, fos); |
1,783,382 | public com.amazonaws.services.cloud9.model.ConcurrentAccessException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.cloud9.model.ConcurrentAccessException concurrentAccessException = new com.amazonaws.services.cloud9.model.ConcurrentAccessException(null);<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>} 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 concurrentAccessException;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
1,846,486 | public CreateUploadResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>CreateUploadResult createUploadResult = new CreateUploadResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return createUploadResult;<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("upload", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createUploadResult.setUpload(UploadJsonUnmarshaller.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 createUploadResult;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
1,580,133 | public void testTaskIsRunning(HttpServletRequest request, HttpServletResponse response) throws Exception {<NEW_LINE>String jndiName = request.getParameter("jndiName");<NEW_LINE>long taskId = Long.parseLong(request.getParameter("taskId"));<NEW_LINE>PersistentExecutor executor = (PersistentExecutor) new InitialContext().lookup(jndiName);<NEW_LINE>TaskStatus<Integer> status = executor.getStatus(taskId);<NEW_LINE>for (long start = System.nanoTime(); System.nanoTime() - start < TIMEOUT_NS && !status.hasResult(); status = executor.getStatus(taskId)) Thread.sleep(POLL_INTERVAL);<NEW_LINE>if (!status.hasResult())<NEW_LINE>throw new Exception("Task did not complete any executions within alotted interval. " + status);<NEW_LINE><MASK><NEW_LINE>for (long start = System.nanoTime(); System.nanoTime() - start < TIMEOUT_NS && result1 == status.getResult(); status = executor.getStatus(taskId)) Thread.sleep(POLL_INTERVAL);<NEW_LINE>int result2 = status.getResult();<NEW_LINE>if (result1 == result2)<NEW_LINE>throw new Exception("Did not see new result for repeating task within allotted interval. Result: " + result1 + ", Status: " + status);<NEW_LINE>} | int result1 = status.getResult(); |
415,241 | public static void dbcOpenEnd(Object stat, Throwable thr) {<NEW_LINE>if (stat == null)<NEW_LINE>return;<NEW_LINE>LocalContext lctx = (LocalContext) stat;<NEW_LINE>MethodStep step = (MethodStep) lctx.stepSingle;<NEW_LINE>if (step == null)<NEW_LINE>return;<NEW_LINE>TraceContext tctx = lctx.context;<NEW_LINE>if (tctx == null)<NEW_LINE>return;<NEW_LINE>step.elapsed = (int) (System.currentTimeMillis() - tctx.startTime) - step.start_time;<NEW_LINE>if (tctx.profile_thread_cputime) {<NEW_LINE>step.cputime = (int) (SysJMX.getCurrentThreadCPU() - tctx.startCpu) - step.start_cpu;<NEW_LINE>}<NEW_LINE>if (thr != null) {<NEW_LINE>String msg = thr.toString();<NEW_LINE>int hash = DataProxy.sendError(msg);<NEW_LINE>if (tctx.error == 0) {<NEW_LINE>tctx.error = hash;<NEW_LINE>}<NEW_LINE>tctx.offerErrorEntity(ErrorEntity.of(connectionOpenFailException<MASK><NEW_LINE>}<NEW_LINE>tctx.profile.pop(step);<NEW_LINE>} | , hash, 0, 0)); |
854,195 | static OVChipCredit create(byte[] data) {<NEW_LINE>if (data == null) {<NEW_LINE>data = new byte[16];<NEW_LINE>}<NEW_LINE>final int banbits = ByteUtils.<MASK><NEW_LINE>final int id = ByteUtils.getBitsFromBuffer(data, 9, 12);<NEW_LINE>final int creditId = ByteUtils.getBitsFromBuffer(data, 56, 12);<NEW_LINE>// Skipping the first bit (77)...<NEW_LINE>int credit = ByteUtils.getBitsFromBuffer(data, 78, 15);<NEW_LINE>if ((data[9] & (byte) 0x04) != 4) {<NEW_LINE>// ...as the first bit is used to see if the credit is negative or not<NEW_LINE>credit ^= (char) 0x7FFF;<NEW_LINE>credit = credit * -1;<NEW_LINE>}<NEW_LINE>return new AutoValue_OVChipCredit(id, creditId, credit, banbits);<NEW_LINE>} | getBitsFromBuffer(data, 0, 9); |
1,542,936 | void drawResult(Canvas canvas) {<NEW_LINE>if (barcodeResult.isEmpty())<NEW_LINE>return;<NEW_LINE>float width = canvas.getWidth();<NEW_LINE>float height = canvas.getHeight();<NEW_LINE>float bottomBorder = getBottomBorder(width, height);<NEW_LINE>float leftBorder = getLeftBorder(width, height);<NEW_LINE>textHeigh = Math.min(bottomBorder, leftBorder) / 3;<NEW_LINE>mTextPaint.setTextSize(textHeigh);<NEW_LINE>float measuredWidth = mTextPaint.measureText(barcodeResult);<NEW_LINE>if (isVertical) {<NEW_LINE>float x = width * 0.1f;<NEW_LINE>float y = (height + bottomBorder + textHeigh) / 2f;<NEW_LINE>int textWidth = (int) (width * 0.8f);<NEW_LINE>if (measuredWidth < textWidth) {<NEW_LINE>x += (textWidth - measuredWidth) / 2f;<NEW_LINE>canvas.drawText(barcodeResult, x, y, mTextPaint);<NEW_LINE>} else {<NEW_LINE>CharSequence txt = TextUtils.ellipsize(barcodeResult, mTextPaint, textWidth, TextUtils.TruncateAt.END);<NEW_LINE>canvas.drawText(txt, 0, txt.length(), x, y, mTextPaint);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>canvas.save();<NEW_LINE>float x = height * 0.1f;<NEW_LINE>float y = (-leftBorder + textHeigh) / 2;<NEW_LINE>int textWidth = (int) (height * 0.8f);<NEW_LINE>canvas.rotate(90.0f);<NEW_LINE>if (measuredWidth < textWidth) {<NEW_LINE>x <MASK><NEW_LINE>canvas.drawText(barcodeResult, x, y, mTextPaint);<NEW_LINE>} else {<NEW_LINE>CharSequence txt = TextUtils.ellipsize(barcodeResult, mTextPaint, textWidth, TextUtils.TruncateAt.END);<NEW_LINE>canvas.drawText(txt, 0, txt.length(), x, y, mTextPaint);<NEW_LINE>}<NEW_LINE>canvas.restore();<NEW_LINE>}<NEW_LINE>} | += (textWidth - measuredWidth) / 2f; |
1,212,300 | protected Lookup.Handler createAddHandler(final MetaProperty metaProperty, final CollectionDatasource propertyDs) {<NEW_LINE>Lookup.Handler result = items -> {<NEW_LINE>for (Object item : items) {<NEW_LINE>Entity entity = (Entity) item;<NEW_LINE>if (!propertyDs.getItems().contains(entity)) {<NEW_LINE>MetaProperty inverseProperty = metaProperty.getInverse();<NEW_LINE>if (inverseProperty != null) {<NEW_LINE>if (!inverseProperty.getRange().getCardinality().isMany()) {<NEW_LINE>// set currently editing item to the child's parent property<NEW_LINE>entity.setValue(inverseProperty.getName(<MASK><NEW_LINE>propertyDs.addItem(entity);<NEW_LINE>} else {<NEW_LINE>Collection properties = entity.getValue(inverseProperty.getName());<NEW_LINE>if (properties != null) {<NEW_LINE>properties.add(datasource.getItem());<NEW_LINE>propertyDs.addItem(entity);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>propertyDs.addItem(entity);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>propertyDs.refresh();<NEW_LINE>return result;<NEW_LINE>} | ), datasource.getItem()); |
1,457,164 | public void putVector(long t, TsPrimitiveType[] v) {<NEW_LINE>if (writeCurArrayIndex == capacity) {<NEW_LINE>if (capacity >= CAPACITY_THRESHOLD) {<NEW_LINE>timeRet.add(new long[capacity]);<NEW_LINE>vectorRet.add(new TsPrimitiveType[capacity][]);<NEW_LINE>writeCurListIndex++;<NEW_LINE>writeCurArrayIndex = 0;<NEW_LINE>} else {<NEW_LINE>int newCapacity = capacity << 1;<NEW_LINE>long[] newTimeData = new long[newCapacity];<NEW_LINE>TsPrimitiveType[][] newValueData = new TsPrimitiveType[newCapacity][];<NEW_LINE>System.arraycopy(timeRet.get(0), 0, newTimeData, 0, capacity);<NEW_LINE>System.arraycopy(vectorRet.get(0), 0, newValueData, 0, capacity);<NEW_LINE>timeRet.set(0, newTimeData);<NEW_LINE>vectorRet.set(0, newValueData);<NEW_LINE>capacity = newCapacity;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>timeRet.get<MASK><NEW_LINE>vectorRet.get(writeCurListIndex)[writeCurArrayIndex] = v;<NEW_LINE>writeCurArrayIndex++;<NEW_LINE>count++;<NEW_LINE>} | (writeCurListIndex)[writeCurArrayIndex] = t; |
1,780,173 | public static HttpClientResponse request(HttpMethod method, HttpUrl url, HttpHeaders requestHeaders, String requestBody) {<NEW_LINE>reactor.netty.http.client.HttpClient client = reactor.netty.http<MASK><NEW_LINE>if (url.getScheme().equals("https")) {<NEW_LINE>client = client.secure();<NEW_LINE>}<NEW_LINE>client = client.headers(h -> {<NEW_LINE>h.add(requestHeaders);<NEW_LINE>if (!h.contains(HttpHeaderNames.USER_AGENT)) {<NEW_LINE>h.add(HttpHeaderNames.USER_AGENT, DEFAULT_USER_AGENT);<NEW_LINE>if (!h.contains(HttpHeaderNames.CONTENT_LENGTH)) {<NEW_LINE>if (requestBody != null) {<NEW_LINE>h.add(HttpHeaderNames.CONTENT_LENGTH, requestBody.length());<NEW_LINE>} else {<NEW_LINE>h.add(HttpHeaderNames.CONTENT_LENGTH, 0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>String _requestBody = requestBody;<NEW_LINE>if (_requestBody == null) {<NEW_LINE>_requestBody = "";<NEW_LINE>}<NEW_LINE>RequestSender sender = client.request(method).uri(url.build());<NEW_LINE>try {<NEW_LINE>return sender.send(ByteBufFlux.fromString(Mono.just(_requestBody))).responseSingle((res, buf) -> buf.asByteArray().map(content -> new HttpClientResponse(null, requestBody, content, url, res)).defaultIfEmpty(new HttpClientResponse(null, requestBody, new byte[0], url, res))).toFuture().get(TIMEOUT_TIME, TimeUnit.MILLISECONDS);<NEW_LINE>} catch (InterruptedException | ExecutionException | TimeoutException ex) {<NEW_LINE>return new HttpClientResponse(ex, false, method, requestBody, null, requestHeaders, null, null, url);<NEW_LINE>}<NEW_LINE>} | .client.HttpClient.create(); |
979,352 | protected void prepareInstall(File installDir) throws IOException {<NEW_LINE>createInfoPList(installDir);<NEW_LINE>generateDsym(<MASK><NEW_LINE>if (isDeviceArch(arch)) {<NEW_LINE>// strip local symbols<NEW_LINE>strip(installDir, getExecutable());<NEW_LINE>// remove bitcode to minimize binary size if not required<NEW_LINE>if (!config.isEnableBitcode()) {<NEW_LINE>config.getLogger().info("Striping bitcode from binary: %s", new File(installDir, getExecutable()));<NEW_LINE>stripBitcode(new File(installDir, getExecutable()));<NEW_LINE>}<NEW_LINE>if (config.isIosSkipSigning()) {<NEW_LINE>config.getLogger().warn("Skipping code signing. The resulting app will " + "be unsigned and will not run on unjailbroken devices");<NEW_LINE>codesignApp(SigningIdentity.ADHOC, getOrCreateEntitlementsPList(false, getBundleId()), installDir);<NEW_LINE>} else {<NEW_LINE>String appIdPrefix = provisioningProfile.getAppIdPrefix();<NEW_LINE>// Copy the provisioning profile<NEW_LINE>copyProvisioningProfile(provisioningProfile, installDir);<NEW_LINE>boolean getTaskAllow = provisioningProfile.getType() == Type.Development;<NEW_LINE>signFrameworks(signIdentity, installDir);<NEW_LINE>// app extensions<NEW_LINE>provisionAppExtensions(config.getAppExtensions(), signIdentity, installDir);<NEW_LINE>signAppExtensions(signIdentity, installDir, appIdPrefix, getTaskAllow);<NEW_LINE>// watch app<NEW_LINE>if (config.getWatchKitApp() != null) {<NEW_LINE>provisionWatchApp(signIdentity, installDir);<NEW_LINE>signWatchApp(signIdentity, installDir, appIdPrefix, getTaskAllow);<NEW_LINE>}<NEW_LINE>// app<NEW_LINE>codesignApp(signIdentity, getOrCreateEntitlementsPList(getTaskAllow, getBundleId()), installDir);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | installDir, getExecutable(), false); |
656,605 | public static DescribeAuditContentItemResponse unmarshall(DescribeAuditContentItemResponse describeAuditContentItemResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeAuditContentItemResponse.setRequestId(_ctx.stringValue("DescribeAuditContentItemResponse.RequestId"));<NEW_LINE>describeAuditContentItemResponse.setPageSize(_ctx.integerValue("DescribeAuditContentItemResponse.PageSize"));<NEW_LINE>describeAuditContentItemResponse.setCurrentPage(_ctx.integerValue("DescribeAuditContentItemResponse.CurrentPage"));<NEW_LINE>describeAuditContentItemResponse.setTotalCount(_ctx.integerValue("DescribeAuditContentItemResponse.TotalCount"));<NEW_LINE>List<AuditContentItem> auditContentItemList = new ArrayList<AuditContentItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeAuditContentItemResponse.AuditContentItemList.Length"); i++) {<NEW_LINE>AuditContentItem auditContentItem = new AuditContentItem();<NEW_LINE>auditContentItem.setParentTaskId(_ctx.stringValue("DescribeAuditContentItemResponse.AuditContentItemList[" + i + "].ParentTaskId"));<NEW_LINE>auditContentItem.setContent(_ctx.stringValue("DescribeAuditContentItemResponse.AuditContentItemList[" + i + "].Content"));<NEW_LINE>auditContentItem.setSn(_ctx.integerValue("DescribeAuditContentItemResponse.AuditContentItemList[" + i + "].Sn"));<NEW_LINE>auditContentItem.setStartTime(_ctx.stringValue("DescribeAuditContentItemResponse.AuditContentItemList[" + i + "].StartTime"));<NEW_LINE>auditContentItem.setEndTime(_ctx.stringValue("DescribeAuditContentItemResponse.AuditContentItemList[" + i + "].EndTime"));<NEW_LINE>auditContentItem.setAudit(_ctx.integerValue<MASK><NEW_LINE>auditContentItem.setAuditResult(_ctx.stringValue("DescribeAuditContentItemResponse.AuditContentItemList[" + i + "].AuditResult"));<NEW_LINE>auditContentItem.setSuggestion(_ctx.stringValue("DescribeAuditContentItemResponse.AuditContentItemList[" + i + "].Suggestion"));<NEW_LINE>auditContentItem.setId(_ctx.longValue("DescribeAuditContentItemResponse.AuditContentItemList[" + i + "].Id"));<NEW_LINE>List<String> auditIllegalReasons = new ArrayList<String>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("DescribeAuditContentItemResponse.AuditContentItemList[" + i + "].AuditIllegalReasons.Length"); j++) {<NEW_LINE>auditIllegalReasons.add(_ctx.stringValue("DescribeAuditContentItemResponse.AuditContentItemList[" + i + "].AuditIllegalReasons[" + j + "]"));<NEW_LINE>}<NEW_LINE>auditContentItem.setAuditIllegalReasons(auditIllegalReasons);<NEW_LINE>auditContentItemList.add(auditContentItem);<NEW_LINE>}<NEW_LINE>describeAuditContentItemResponse.setAuditContentItemList(auditContentItemList);<NEW_LINE>return describeAuditContentItemResponse;<NEW_LINE>} | ("DescribeAuditContentItemResponse.AuditContentItemList[" + i + "].Audit")); |
1,068,051 | public static IntFloatVector mergeSparseFloatVector(IndexGetParam param, List<PartitionGetResult> partResults) {<NEW_LINE>int dim = (int) PSAgentContext.get().getMatrixMetaManager().getMatrixMeta(param.getMatrixId()).getColNum();<NEW_LINE>IntFloatVector vector = VFactory.sparseFloatVector(dim, param.size());<NEW_LINE>for (PartitionGetResult part : partResults) {<NEW_LINE>PartitionKey partKey = ((IndexPartGetFloatResult) part).getPartKey();<NEW_LINE>int[] indexes = param.getPartKeyToIndexesMap().get(partKey);<NEW_LINE>float[] values = ((IndexPartGetFloatResult) part).getValues();<NEW_LINE>for (int i = 0; i < indexes.length; i++) {<NEW_LINE>if (i < 10) {<NEW_LINE>LOG.debug("index " + indexes[i] + ", value " + values[i]);<NEW_LINE>}<NEW_LINE>vector.set(indexes[<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>vector.setMatrixId(param.getMatrixId());<NEW_LINE>vector.setRowId(param.getRowId());<NEW_LINE>return vector;<NEW_LINE>} | i], values[i]); |
1,355,489 | public static void drawNumbers(Graphics2D g2, List<PointIndex2D_F64> points, @Nullable Point2Transform2_F32 transform, double scale) {<NEW_LINE>Font regular = new Font(<MASK><NEW_LINE>g2.setFont(regular);<NEW_LINE>Point2D_F32 adj = new Point2D_F32();<NEW_LINE>AffineTransform origTran = g2.getTransform();<NEW_LINE>for (int i = 0; i < points.size(); i++) {<NEW_LINE>Point2D_F64 p = points.get(i).p;<NEW_LINE>int gridIndex = points.get(i).index;<NEW_LINE>if (transform != null) {<NEW_LINE>transform.compute((float) p.x, (float) p.y, adj);<NEW_LINE>} else {<NEW_LINE>adj.setTo((float) p.x, (float) p.y);<NEW_LINE>}<NEW_LINE>String text = String.format("%2d", gridIndex);<NEW_LINE>int x = (int) (adj.x * scale);<NEW_LINE>int y = (int) (adj.y * scale);<NEW_LINE>g2.setColor(Color.BLACK);<NEW_LINE>g2.drawString(text, x - 1, y);<NEW_LINE>g2.drawString(text, x + 1, y);<NEW_LINE>g2.drawString(text, x, y - 1);<NEW_LINE>g2.drawString(text, x, y + 1);<NEW_LINE>g2.setTransform(origTran);<NEW_LINE>g2.setColor(Color.GREEN);<NEW_LINE>g2.drawString(text, x, y);<NEW_LINE>}<NEW_LINE>} | "Serif", Font.PLAIN, 16); |
103,682 | private void readIndices(PersistentCollection<?> collection) throws IOException {<NEW_LINE>// move to [<NEW_LINE>parser.nextToken();<NEW_LINE>// loop till token equal to "]"<NEW_LINE>while (parser.nextToken() != JsonToken.END_ARRAY) {<NEW_LINE>// loop until end of collection object<NEW_LINE>while (parser.nextToken() != JsonToken.END_OBJECT) {<NEW_LINE>String fieldName = parser.getCurrentName();<NEW_LINE>if (TAG_INDEX.equals(fieldName)) {<NEW_LINE>parser.nextToken();<NEW_LINE>String data = parser.readValueAs(String.class);<NEW_LINE>IndexDescriptor index = (IndexDescriptor) readEncodedObject(data);<NEW_LINE>if (index != null) {<NEW_LINE>String[] fieldNames = index.getIndexFields().getFieldNames().toArray(new String[0]);<NEW_LINE>if (collection != null && index.getIndexFields() != null && !collection.hasIndex(fieldNames)) {<NEW_LINE>collection.createIndex(indexOptions(index<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getIndexType()), fieldNames); |
1,638,087 | public AggregateResult aggregate(KeyType key, int keyHash) {<NEW_LINE>final ByteBuffer keyBuffer = keySerde.toByteBuffer(key);<NEW_LINE>if (keyBuffer == null) {<NEW_LINE>// This may just trigger a spill and get ignored, which is ok. If it bubbles up to the user, the message will<NEW_LINE>// be correct.<NEW_LINE>return Groupers.dictionaryFull(0);<NEW_LINE>}<NEW_LINE>if (keyBuffer.remaining() != keySize) {<NEW_LINE>throw new IAE("keySerde.toByteBuffer(key).remaining[%s] != keySerde.keySize[%s], buffer was the wrong size?!", keyBuffer.remaining(), keySize);<NEW_LINE>}<NEW_LINE>// find and try to expand if table is full and find again<NEW_LINE>int bucket = hashTable.findBucketWithAutoGrowth(keyBuffer, keyHash, () -> {<NEW_LINE>});<NEW_LINE>if (bucket < 0) {<NEW_LINE>// This may just trigger a spill and get ignored, which is ok. If it bubbles up to the user, the message will<NEW_LINE>// be correct.<NEW_LINE>return Groupers.hashTableFull(0);<NEW_LINE>}<NEW_LINE>final int bucketStartOffset = hashTable.getOffsetForBucket(bucket);<NEW_LINE>final boolean bucketWasUsed = hashTable.isBucketUsed(bucket);<NEW_LINE>final ByteBuffer tableBuffer = hashTable.getTableBuffer();<NEW_LINE>// Set up key and initialize the aggs if this is a new bucket.<NEW_LINE>if (!bucketWasUsed) {<NEW_LINE>hashTable.initializeNewBucketKey(bucket, keyBuffer, keyHash);<NEW_LINE>aggregators.<MASK><NEW_LINE>newBucketHook(bucketStartOffset);<NEW_LINE>}<NEW_LINE>if (canSkipAggregate(bucketStartOffset)) {<NEW_LINE>return AggregateResult.ok();<NEW_LINE>}<NEW_LINE>// Aggregate the current row.<NEW_LINE>aggregators.aggregateBuffered(tableBuffer, bucketStartOffset + baseAggregatorOffset);<NEW_LINE>afterAggregateHook(bucketStartOffset);<NEW_LINE>return AggregateResult.ok();<NEW_LINE>} | init(tableBuffer, bucketStartOffset + baseAggregatorOffset); |
1,060,866 | public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {<NEW_LINE>if (((bitField0_ & 0x00000001) != 0)) {<NEW_LINE>com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000002) != 0)) {<NEW_LINE>com.google.protobuf.GeneratedMessageV3.writeString(output, 2, version_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000004) != 0)) {<NEW_LINE>output.writeUInt32(3, majorVersion_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000008) != 0)) {<NEW_LINE>output.writeUInt32(4, minorVersion_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000010) != 0)) {<NEW_LINE>output.writeUInt32(5, patchVersion_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000020) != 0)) {<NEW_LINE>com.google.protobuf.GeneratedMessageV3.writeString(output, 6, application_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000040) != 0)) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000080) != 0)) {<NEW_LINE>com.google.protobuf.GeneratedMessageV3.writeString(output, 8, versionQualifier_);<NEW_LINE>}<NEW_LINE>unknownFields.writeTo(output);<NEW_LINE>} | output.writeUInt32(7, buildNumber_); |
1,162,078 | public RecrawlPolicy unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>RecrawlPolicy recrawlPolicy = new RecrawlPolicy();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("RecrawlBehavior", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>recrawlPolicy.setRecrawlBehavior(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return recrawlPolicy;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
673,381 | public void marshall(CreateUserPoolClientRequest createUserPoolClientRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (createUserPoolClientRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(createUserPoolClientRequest.getUserPoolId(), USERPOOLID_BINDING);<NEW_LINE>protocolMarshaller.marshall(createUserPoolClientRequest.getClientName(), CLIENTNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(createUserPoolClientRequest.getGenerateSecret(), GENERATESECRET_BINDING);<NEW_LINE>protocolMarshaller.marshall(createUserPoolClientRequest.getRefreshTokenValidity(), REFRESHTOKENVALIDITY_BINDING);<NEW_LINE>protocolMarshaller.marshall(createUserPoolClientRequest.getAccessTokenValidity(), ACCESSTOKENVALIDITY_BINDING);<NEW_LINE>protocolMarshaller.marshall(createUserPoolClientRequest.getIdTokenValidity(), IDTOKENVALIDITY_BINDING);<NEW_LINE>protocolMarshaller.marshall(createUserPoolClientRequest.getTokenValidityUnits(), TOKENVALIDITYUNITS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createUserPoolClientRequest.getReadAttributes(), READATTRIBUTES_BINDING);<NEW_LINE>protocolMarshaller.marshall(createUserPoolClientRequest.getWriteAttributes(), WRITEATTRIBUTES_BINDING);<NEW_LINE>protocolMarshaller.marshall(createUserPoolClientRequest.getExplicitAuthFlows(), EXPLICITAUTHFLOWS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createUserPoolClientRequest.getSupportedIdentityProviders(), SUPPORTEDIDENTITYPROVIDERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createUserPoolClientRequest.getCallbackURLs(), CALLBACKURLS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createUserPoolClientRequest.getLogoutURLs(), LOGOUTURLS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createUserPoolClientRequest.getDefaultRedirectURI(), DEFAULTREDIRECTURI_BINDING);<NEW_LINE>protocolMarshaller.marshall(createUserPoolClientRequest.getAllowedOAuthFlows(), ALLOWEDOAUTHFLOWS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createUserPoolClientRequest.getAllowedOAuthScopes(), ALLOWEDOAUTHSCOPES_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(createUserPoolClientRequest.getAnalyticsConfiguration(), ANALYTICSCONFIGURATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(createUserPoolClientRequest.getPreventUserExistenceErrors(), PREVENTUSEREXISTENCEERRORS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createUserPoolClientRequest.getEnableTokenRevocation(), ENABLETOKENREVOCATION_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | createUserPoolClientRequest.getAllowedOAuthFlowsUserPoolClient(), ALLOWEDOAUTHFLOWSUSERPOOLCLIENT_BINDING); |
1,323,186 | private void displaySubComponents(String appName, ActionReport report, ActionReport.MessagePart part, final Subject subject) {<NEW_LINE><MASK><NEW_LINE>CommandRunner.CommandInvocation inv = commandRunner.getCommandInvocation("list-sub-components", subReport, subject);<NEW_LINE>final ParameterMap parameters = new ParameterMap();<NEW_LINE>parameters.add("DEFAULT", appName);<NEW_LINE>parameters.add("terse", "true");<NEW_LINE>parameters.add("resources", resources.toString());<NEW_LINE>inv.parameters(parameters).execute();<NEW_LINE>ActionReport.MessagePart subPart = subReport.getTopMessagePart();<NEW_LINE>for (ActionReport.MessagePart childPart : subPart.getChildren()) {<NEW_LINE>ActionReport.MessagePart actualChildPart = part.addChild();<NEW_LINE>actualChildPart.setMessage(" " + childPart.getMessage());<NEW_LINE>for (ActionReport.MessagePart grandChildPart : childPart.getChildren()) {<NEW_LINE>actualChildPart.addChild().setMessage(grandChildPart.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ActionReport subReport = report.addSubActionsReport(); |
1,673,860 | static URLConnection openConnection(Task task, final URL url, URI[] connectedVia) throws IOException {<NEW_LINE>long connectTimeoutMs = getProjectPropertyInt(task, "downloadBinaries.connectTimeoutMs", 15000);<NEW_LINE>task.log("Connect timeout set to " + connectTimeoutMs + " milliseconds prior to connecting to " + url, Project.MSG_DEBUG);<NEW_LINE>final <MASK><NEW_LINE>final List<Exception> errs = new CopyOnWriteArrayList<>();<NEW_LINE>final StringBuffer msgs = new StringBuffer();<NEW_LINE>final CountDownLatch connected = new CountDownLatch(1);<NEW_LINE>ExecutorService connectors = Executors.newFixedThreadPool(3);<NEW_LINE>connectors.submit(() -> {<NEW_LINE>checkProxyProperty("http_proxy", url, conn, connectedVia, connected, errs, msgs);<NEW_LINE>});<NEW_LINE>connectors.submit(() -> {<NEW_LINE>checkProxyProperty("https_proxy", url, conn, connectedVia, connected, errs, msgs);<NEW_LINE>});<NEW_LINE>connectors.submit(() -> {<NEW_LINE>try {<NEW_LINE>URLConnection test = url.openConnection(Proxy.NO_PROXY);<NEW_LINE>test.connect();<NEW_LINE>conn[0] = test;<NEW_LINE>msgs.append("\nNo proxy connected");<NEW_LINE>connected.countDown();<NEW_LINE>} catch (IOException ex) {<NEW_LINE>errs.add(ex);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>try {<NEW_LINE>if (!connected.await(connectTimeoutMs, TimeUnit.MILLISECONDS)) {<NEW_LINE>throw new IOException("Could not connect to " + url + " within " + connectTimeoutMs + " milliseconds");<NEW_LINE>}<NEW_LINE>} catch (InterruptedException ex) {<NEW_LINE>}<NEW_LINE>if (conn[0] == null) {<NEW_LINE>for (Exception ex : errs) {<NEW_LINE>task.log(ex, Project.MSG_ERR);<NEW_LINE>}<NEW_LINE>if (msgs.length() > 0) {<NEW_LINE>task.log(msgs.toString(), Project.MSG_ERR);<NEW_LINE>}<NEW_LINE>throw new IOException("Cannot connect to " + url);<NEW_LINE>} else {<NEW_LINE>task.log(msgs.toString(), Project.MSG_DEBUG);<NEW_LINE>}<NEW_LINE>return conn[0];<NEW_LINE>} | URLConnection[] conn = { null }; |
24,694 | public void marshall(NFSFileShareInfo nFSFileShareInfo, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (nFSFileShareInfo == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(nFSFileShareInfo.getNFSFileShareDefaults(), NFSFILESHAREDEFAULTS_BINDING);<NEW_LINE>protocolMarshaller.marshall(nFSFileShareInfo.getFileShareARN(), FILESHAREARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(nFSFileShareInfo.getFileShareId(), FILESHAREID_BINDING);<NEW_LINE>protocolMarshaller.marshall(nFSFileShareInfo.getFileShareStatus(), FILESHARESTATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(nFSFileShareInfo.getGatewayARN(), GATEWAYARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(nFSFileShareInfo.getKMSEncrypted(), KMSENCRYPTED_BINDING);<NEW_LINE>protocolMarshaller.marshall(nFSFileShareInfo.getKMSKey(), KMSKEY_BINDING);<NEW_LINE>protocolMarshaller.marshall(nFSFileShareInfo.getPath(), PATH_BINDING);<NEW_LINE>protocolMarshaller.marshall(nFSFileShareInfo.getRole(), ROLE_BINDING);<NEW_LINE>protocolMarshaller.marshall(nFSFileShareInfo.getLocationARN(), LOCATIONARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(nFSFileShareInfo.getDefaultStorageClass(), DEFAULTSTORAGECLASS_BINDING);<NEW_LINE>protocolMarshaller.marshall(nFSFileShareInfo.getObjectACL(), OBJECTACL_BINDING);<NEW_LINE>protocolMarshaller.marshall(nFSFileShareInfo.getClientList(), CLIENTLIST_BINDING);<NEW_LINE>protocolMarshaller.marshall(nFSFileShareInfo.getSquash(), SQUASH_BINDING);<NEW_LINE>protocolMarshaller.marshall(nFSFileShareInfo.getReadOnly(), READONLY_BINDING);<NEW_LINE>protocolMarshaller.marshall(nFSFileShareInfo.getGuessMIMETypeEnabled(), GUESSMIMETYPEENABLED_BINDING);<NEW_LINE>protocolMarshaller.marshall(nFSFileShareInfo.getRequesterPays(), REQUESTERPAYS_BINDING);<NEW_LINE>protocolMarshaller.marshall(nFSFileShareInfo.getTags(), TAGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(nFSFileShareInfo.getFileShareName(), FILESHARENAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(nFSFileShareInfo.getNotificationPolicy(), NOTIFICATIONPOLICY_BINDING);<NEW_LINE>protocolMarshaller.marshall(nFSFileShareInfo.getVPCEndpointDNSName(), VPCENDPOINTDNSNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(nFSFileShareInfo.getBucketRegion(), BUCKETREGION_BINDING);<NEW_LINE>protocolMarshaller.marshall(nFSFileShareInfo.getAuditDestinationARN(), AUDITDESTINATIONARN_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | nFSFileShareInfo.getCacheAttributes(), CACHEATTRIBUTES_BINDING); |
807,774 | public void initialise() throws FileNotFoundException {<NEW_LINE>bSilent = false;<NEW_LINE>// double [] tmpx = input.getAllData();<NEW_LINE>// double [] x = new double[origLen+pm.totalZerosToPadd];<NEW_LINE>// Arrays.fill(x, 0.0);<NEW_LINE>// System.arraycopy(tmpx, 0, x, 0, origLen);<NEW_LINE>psFrm = new PsolaFrameProvider(input, pm, <MASK><NEW_LINE>tempOutBinaryFile = outputFile + ".bin";<NEW_LINE>dout = new LEDataOutputStream(tempOutBinaryFile);<NEW_LINE>windowIn = new DynamicWindow(Window.HANNING);<NEW_LINE>windowOut = new DynamicWindow(Window.HANNING);<NEW_LINE>frmSize = 0;<NEW_LINE>newFrmSize = 0;<NEW_LINE>newPeriod = 0;<NEW_LINE>synthFrmInd = 0;<NEW_LINE>localDurDiff = 0.0;<NEW_LINE>// -1:skip frame, 0:no repetition (use synthesized frame as it is), >0: number of repetitions for<NEW_LINE>repeatSkipCount = 0;<NEW_LINE>// synthesized frame<NEW_LINE>localDurDiffSaved = 0.0;<NEW_LINE>sumLocalDurDiffs = 0.0;<NEW_LINE>nextAdd = 0.0;<NEW_LINE>synthSt = pm.pitchMarks[0];<NEW_LINE>synthTotal = 0;<NEW_LINE>maxFrmSize = (int) (modParams.numPeriods * modParams.fs / 40.0);<NEW_LINE>if ((maxFrmSize % 2) != 0)<NEW_LINE>maxFrmSize++;<NEW_LINE>maxNewFrmSize = (int) (Math.floor(maxFrmSize / MathUtils.min(modParams.pscalesVar) + 0.5));<NEW_LINE>if ((maxNewFrmSize % 2) != 0)<NEW_LINE>maxNewFrmSize++;<NEW_LINE>synthFrameInd = 0;<NEW_LINE>bLastFrame = false;<NEW_LINE>bBroke = false;<NEW_LINE>fftSize = (int) Math.pow(2, (Math.ceil(Math.log((double) maxFrmSize) / Math.log(2.0))));<NEW_LINE>maxFreq = fftSize / 2 + 1;<NEW_LINE>outBuffLen = 100;<NEW_LINE>outBuff = MathUtils.zeros(outBuffLen);<NEW_LINE>outBuffStart = 1;<NEW_LINE>totalWrittenToFile = 0;<NEW_LINE>ySynthBuff = MathUtils.zeros(maxNewFrmSize);<NEW_LINE>wSynthBuff = MathUtils.zeros(maxNewFrmSize);<NEW_LINE>ySynthInd = 1;<NEW_LINE>} | modParams.fs, modParams.numPeriods); |
447,307 | private static void runStatementWithRetry(ShouldRetry retryAnnotation, Statement base, Description description) {<NEW_LINE>Preconditions.checkArgument(retryAnnotation.numAttempts() > 0, "Number of attempts should be positive, but found %s", retryAnnotation.numAttempts());<NEW_LINE>for (int attempt = 1; attempt <= retryAnnotation.numAttempts(); attempt++) {<NEW_LINE>try {<NEW_LINE>base.evaluate();<NEW_LINE>log.info("Test {}.{} succeeded on attempt {} of {}.", SafeArg.of("testClass", description.getClassName()), SafeArg.of("testMethod", description.getMethodName()), SafeArg.of("attempt", attempt), SafeArg.of("maxAttempts"<MASK><NEW_LINE>return;<NEW_LINE>} catch (Throwable t) {<NEW_LINE>if (Arrays.stream(retryAnnotation.retryableExceptions()).anyMatch(type -> causeHasType(t, type))) {<NEW_LINE>logFailureAndThrowIfNeeded(retryAnnotation, description, attempt, t);<NEW_LINE>} else {<NEW_LINE>throw Throwables.propagate(t);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | , retryAnnotation.numAttempts())); |
1,748,100 | protected void clearPinnedAllocations(boolean extended) {<NEW_LINE>if (isDebug.get())<NEW_LINE>log.info("Workspace [{}] device_{} threadId {} cycle {}: clearing pinned allocations...", id, Nd4j.getAffinityManager().getDeviceForCurrentThread(), Thread.currentThread().getId(), cyclesCount.get());<NEW_LINE>while (!pinnedAllocations.isEmpty()) {<NEW_LINE>PointersPair pair = pinnedAllocations.peek();<NEW_LINE>if (pair == null)<NEW_LINE>throw new RuntimeException();<NEW_LINE>long stepNumber = pair.getAllocationCycle();<NEW_LINE><MASK><NEW_LINE>if (isDebug.get())<NEW_LINE>log.info("Allocation step: {}; Current step: {}", stepNumber, stepCurrent);<NEW_LINE>if (stepNumber + 2 < stepCurrent || extended) {<NEW_LINE>pinnedAllocations.remove();<NEW_LINE>memoryManager.release(pair.getHostPointer(), MemoryKind.HOST);<NEW_LINE>pinnedCount.decrementAndGet();<NEW_LINE>pinnedAllocationsSize.addAndGet(pair.getRequiredMemory() * -1);<NEW_LINE>} else {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | long stepCurrent = stepsCount.get(); |
1,356,045 | public void testFailureStackShowsCallerOfJoin() throws Exception {<NEW_LINE>CompletableFuture<?> future = defaultManagedExecutor.failedFuture(CANCELLATION_X_CAUSED_BY_ARRAY_X);<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>fail("Got result " + result + " by joining a failed future");<NEW_LINE>} catch (CancellationException x) {<NEW_LINE>boolean foundInStack = false;<NEW_LINE>for (StackTraceElement line : x.getStackTrace()) foundInStack |= "testFailureStackShowsCallerOfJoin".equals(line.getMethodName());<NEW_LINE>if (!foundInStack || x.getCause() != CANCELLATION_X_CAUSED_BY_ARRAY_X.getCause())<NEW_LINE>throw x;<NEW_LINE>}<NEW_LINE>future = defaultManagedExecutor.failedFuture(COMPLETION_X_CAUSED_BY_NAMING_X);<NEW_LINE>try {<NEW_LINE>Object result = future.join();<NEW_LINE>fail("Got result " + result + " by joining a failed future");<NEW_LINE>} catch (CompletionException x) {<NEW_LINE>boolean foundInStack = false;<NEW_LINE>for (StackTraceElement line : x.getStackTrace()) foundInStack |= "testFailureStackShowsCallerOfJoin".equals(line.getMethodName());<NEW_LINE>if (!foundInStack || x.getCause() != COMPLETION_X_CAUSED_BY_NAMING_X.getCause())<NEW_LINE>throw x;<NEW_LINE>}<NEW_LINE>} | Object result = future.join(); |
1,723,421 | protected void processFlowElements(Collection<FlowElement> flowElementList, BaseElement parentScope) {<NEW_LINE>for (FlowElement flowElement : flowElementList) {<NEW_LINE>if (flowElement instanceof SequenceFlow) {<NEW_LINE>SequenceFlow sequenceFlow = (SequenceFlow) flowElement;<NEW_LINE>FlowNode sourceNode = getFlowNodeFromScope(sequenceFlow.getSourceRef(), parentScope);<NEW_LINE>if (sourceNode != null) {<NEW_LINE>sourceNode.getOutgoingFlows().add(sequenceFlow);<NEW_LINE>sequenceFlow.setSourceFlowElement(sourceNode);<NEW_LINE>}<NEW_LINE>FlowNode targetNode = getFlowNodeFromScope(sequenceFlow.getTargetRef(), parentScope);<NEW_LINE>if (targetNode != null) {<NEW_LINE>targetNode.<MASK><NEW_LINE>sequenceFlow.setTargetFlowElement(targetNode);<NEW_LINE>}<NEW_LINE>} else if (flowElement instanceof BoundaryEvent) {<NEW_LINE>BoundaryEvent boundaryEvent = (BoundaryEvent) flowElement;<NEW_LINE>FlowElement attachedToElement = getFlowNodeFromScope(boundaryEvent.getAttachedToRefId(), parentScope);<NEW_LINE>if (attachedToElement instanceof Activity) {<NEW_LINE>Activity attachedActivity = (Activity) attachedToElement;<NEW_LINE>boundaryEvent.setAttachedToRef(attachedActivity);<NEW_LINE>attachedActivity.getBoundaryEvents().add(boundaryEvent);<NEW_LINE>}<NEW_LINE>} else if (flowElement instanceof SubProcess) {<NEW_LINE>SubProcess subProcess = (SubProcess) flowElement;<NEW_LINE>Collection<FlowElement> childFlowElements = subProcess.getFlowElements();<NEW_LINE>processFlowElements(childFlowElements, subProcess);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getIncomingFlows().add(sequenceFlow); |
192,272 | final UpdateQueueResult executeUpdateQueue(UpdateQueueRequest updateQueueRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateQueueRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateQueueRequest> request = null;<NEW_LINE>Response<UpdateQueueResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new UpdateQueueRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateQueueRequest));<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, "MediaConvert");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateQueue");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdateQueueResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateQueueResultJsonUnmarshaller());<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,733,206 | public static void horizontal9(Kernel1D_S32 kernel, GrayU8 image, GrayI8 dest, int divisor) {<NEW_LINE>final byte[] dataSrc = image.data;<NEW_LINE>final byte[] 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 k6 = kernel.data[5];<NEW_LINE>final int k7 = kernel.data[6];<NEW_LINE>final int k8 = kernel.data[7];<NEW_LINE>final int k9 = kernel.data[8];<NEW_LINE>final int radius = kernel.getRadius();<NEW_LINE>final int width = image.getWidth();<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++] & 0xFF) * k1;<NEW_LINE>total += (dataSrc[indexSrc++] & 0xFF) * k2;<NEW_LINE>total += (dataSrc[indexSrc++] & 0xFF) * k3;<NEW_LINE>total += (dataSrc[indexSrc++] & 0xFF) * k4;<NEW_LINE>total += (dataSrc[<MASK><NEW_LINE>total += (dataSrc[indexSrc++] & 0xFF) * k6;<NEW_LINE>total += (dataSrc[indexSrc++] & 0xFF) * k7;<NEW_LINE>total += (dataSrc[indexSrc++] & 0xFF) * k8;<NEW_LINE>total += (dataSrc[indexSrc] & 0xFF) * k9;<NEW_LINE>dataDst[indexDst++] = (byte) ((total + halfDivisor) / divisor);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} | indexSrc++] & 0xFF) * k5; |
1,120,580 | // this is needed because the heron executor ignores the override.yaml<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>public static void applyOverridesToStateManagerConfig(Path overridesPath, Path stateManagerPath) throws IOException {<NEW_LINE>final Path tempStateManagerPath = Files.createTempFile("statemgr-", CONFIG_SUFFIX);<NEW_LINE>Reader stateManagerReader = null;<NEW_LINE>try (Reader overrideReader = Files.newBufferedReader(overridesPath);<NEW_LINE>Writer writer = Files.newBufferedWriter(tempStateManagerPath)) {<NEW_LINE>stateManagerReader = Files.newBufferedReader(stateManagerPath);<NEW_LINE>final Map<String, Object> overrides = (Map<String, Object>) new Yaml(new SafeConstructor()).load(overrideReader);<NEW_LINE>final Map<String, Object> stateMangerConfig = (Map<String, Object>) new Yaml(new SafeConstructor()).load(stateManagerReader);<NEW_LINE>// update the state manager config with the overrides<NEW_LINE>for (Map.Entry<String, Object> entry : overrides.entrySet()) {<NEW_LINE>// does this key have an override?<NEW_LINE>if (stateMangerConfig.containsKey(entry.getKey())) {<NEW_LINE>stateMangerConfig.put(entry.getKey(), entry.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// write new state manager config<NEW_LINE>newYaml().dump(stateMangerConfig, writer);<NEW_LINE>// close state manager file so we can replace it with the updated configuration<NEW_LINE>stateManagerReader.close();<NEW_LINE>FileHelper.copy(tempStateManagerPath, stateManagerPath);<NEW_LINE>} finally {<NEW_LINE>tempStateManagerPath<MASK><NEW_LINE>SysUtils.closeIgnoringExceptions(stateManagerReader);<NEW_LINE>}<NEW_LINE>} | .toFile().delete(); |
1,647,046 | /*<NEW_LINE>* (non-Javadoc)<NEW_LINE>*<NEW_LINE>* @see<NEW_LINE>* org.openhab.core.persistence.PersistenceService#store(org.openhab.core<NEW_LINE>* .items.Item, java.lang.String)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public void store(Item item, String alias) {<NEW_LINE>if (isAgentConnected()) {<NEW_LINE>String hwid = getConfiguration().getDefaultHardwareId();<NEW_LINE>try {<NEW_LINE>State state = item.getState();<NEW_LINE>if (state instanceof PercentType) {<NEW_LINE>addDeviceMeasurement(hwid, item, ((PercentType) state).toBigDecimal().doubleValue());<NEW_LINE>} else if (state instanceof DecimalType) {<NEW_LINE>addDeviceMeasurement(hwid, item, ((DecimalType) state).<MASK><NEW_LINE>} else if (state instanceof DateTimeType) {<NEW_LINE>addDeviceAlert(hwid, item, (DateTimeType) state);<NEW_LINE>} else if (state instanceof OnOffType) {<NEW_LINE>addDeviceAlert(hwid, item, (OnOffType) state);<NEW_LINE>} else if (state instanceof OpenClosedType) {<NEW_LINE>addDeviceAlert(hwid, item, (OpenClosedType) state);<NEW_LINE>} else if (state instanceof StringType) {<NEW_LINE>addDeviceAlert(hwid, item, (StringType) state);<NEW_LINE>} else if (state instanceof PointType) {<NEW_LINE>addDeviceLocation(hwid, item, (PointType) state);<NEW_LINE>} else {<NEW_LINE>LOGGER.debug("Unable to store item of type: " + item.getState().getClass().getSimpleName());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} catch (SiteWhereAgentException e) {<NEW_LINE>LOGGER.warn("Unable to store item: " + item.getName(), e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | toBigDecimal().doubleValue()); |
282,261 | public static void main(String[] args) {<NEW_LINE>System.out.println("the number is " + parseLongDecSubstring("number=78 ", 7));<NEW_LINE>System.out.println("the number is " + parseIntDecSubstring("number=78x ", 7, 9));<NEW_LINE>Random r = new Random(1);<NEW_LINE>String[<MASK><NEW_LINE>for (int i = 0; i < s.length; i++) s[i] = "abc " + Integer.toString(r.nextInt()) + " ";<NEW_LINE>long d = 0;<NEW_LINE>long t0 = System.currentTimeMillis();<NEW_LINE>for (String element : s) {<NEW_LINE>d += Integer.parseInt(element.substring(4).trim());<NEW_LINE>}<NEW_LINE>System.out.println("java: " + d + " - " + (System.currentTimeMillis() - t0) + " millis");<NEW_LINE>d = 0;<NEW_LINE>t0 = System.currentTimeMillis();<NEW_LINE>for (String element : s) {<NEW_LINE>d += parseIntDecSubstring(element, 4);<NEW_LINE>}<NEW_LINE>System.out.println("cora: " + d + " - " + (System.currentTimeMillis() - t0) + " millis");<NEW_LINE>r = new Random(1);<NEW_LINE>for (int i = 0; i < s.length; i++) s[i] = Integer.toString(r.nextInt());<NEW_LINE>d = 0;<NEW_LINE>t0 = System.currentTimeMillis();<NEW_LINE>for (String element : s) {<NEW_LINE>d += Integer.parseInt(element);<NEW_LINE>}<NEW_LINE>System.out.println("java: " + d + " - " + (System.currentTimeMillis() - t0) + " millis");<NEW_LINE>d = 0;<NEW_LINE>t0 = System.currentTimeMillis();<NEW_LINE>for (String element : s) {<NEW_LINE>d += parseIntDecSubstring(element);<NEW_LINE>}<NEW_LINE>System.out.println("cora: " + d + " - " + (System.currentTimeMillis() - t0) + " millis");<NEW_LINE>} | ] s = new String[1000000]; |
1,819,494 | public boolean onOptionsItemSelected(MenuItem item) {<NEW_LINE>switch(item.getItemId()) {<NEW_LINE>case R.id.action_share_file:<NEW_LINE>{<NEW_LINE>mContainerActivity.getFileOperationsHelper().showShareFile(getFile());<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>case R.id.action_open_file_with:<NEW_LINE>{<NEW_LINE>openFile();<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>case R.id.action_remove_file:<NEW_LINE>{<NEW_LINE>RemoveFilesDialogFragment dialog = RemoveFilesDialogFragment.newInstance(getFile());<NEW_LINE>dialog.show(getFragmentManager(), ConfirmationDialogFragment.FTAG_CONFIRMATION);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>case R.id.action_see_details:<NEW_LINE>{<NEW_LINE>seeDetails();<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>case R.id.action_send_file:<NEW_LINE>{<NEW_LINE>mContainerActivity.getFileOperationsHelper().sendDownloadedFile(getFile());<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>case R.id.action_sync_file:<NEW_LINE>{<NEW_LINE>mContainerActivity.getFileOperationsHelper(<MASK><NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>case R.id.action_set_available_offline:<NEW_LINE>{<NEW_LINE>mContainerActivity.getFileOperationsHelper().toggleAvailableOffline(getFile(), true);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>case R.id.action_unset_available_offline:<NEW_LINE>{<NEW_LINE>mContainerActivity.getFileOperationsHelper().toggleAvailableOffline(getFile(), false);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>return super.onOptionsItemSelected(item);<NEW_LINE>}<NEW_LINE>} | ).syncFile(getFile()); |
1,293,668 | protected void save() {<NEW_LINE>preferences.activateAccelerometer(true);<NEW_LINE>preferences.activateCamera(true);<NEW_LINE>preferences.activateMicrophone(true);<NEW_LINE>setPhoneNumber();<NEW_LINE>boolean videoMonitoringActive = ((SwitchPreference) findPreference(mActivity.getResources().getString(R.string.video_active_preference_key))).isChecked();<NEW_LINE>preferences.setActivateVideoMonitoring(videoMonitoringActive);<NEW_LINE>boolean remoteNotificationActive = ((SwitchPreference) findPreference(PreferenceManager.REMOTE_NOTIFICATION_ACTIVE)).isChecked();<NEW_LINE>preferences.setRemoteNotificationActive(remoteNotificationActive);<NEW_LINE>boolean remoteAccessActive = ((SwitchPreference) findPreference(PreferenceManager.REMOTE_ACCESS_ACTIVE)).isChecked();<NEW_LINE>preferences.activateRemoteAccess(remoteAccessActive);<NEW_LINE>String password = ((EditTextPreference) findPreference(PreferenceManager.REMOTE_ACCESS_CRED)).getText();<NEW_LINE>if (checkValidStrings(password, preferences.getRemoteAccessCredential()) && (TextUtils.isEmpty(preferences.getRemoteAccessCredential()) || !password.trim().equals(preferences.getRemoteAccessCredential().trim()))) {<NEW_LINE>preferences.setRemoteAccessCredential(password.trim());<NEW_LINE>app.stopServer();<NEW_LINE>app.startServer();<NEW_LINE>}<NEW_LINE>preferences.setVoiceVerification(false);<NEW_LINE>boolean heartbeatMonitorActive = ((SwitchPreference) findPreference(PreferenceManager.HEARTBEAT_MONITOR_ACTIVE)).isChecked();<NEW_LINE>preferences.activateHeartbeat(heartbeatMonitorActive);<NEW_LINE><MASK><NEW_LINE>mActivity.finish();<NEW_LINE>} | mActivity.setResult(AppCompatActivity.RESULT_OK); |
1,598,196 | private void logConnectionPoolBusy(ConnectionPoolBusyInfo info, long waitMillis, int connectionFlags) {<NEW_LINE>StringBuilder msg = new StringBuilder();<NEW_LINE>if (waitMillis != 0) {<NEW_LINE>final Thread thread = Thread.currentThread();<NEW_LINE>msg.append("The connection pool for database '").append(info.label);<NEW_LINE>msg.append("' has been unable to grant a connection to thread ");<NEW_LINE>msg.append(thread.getId()).append(" (").append(thread.getName()).append(") ");<NEW_LINE>msg.append("with flags 0x").append(Integer.toHexString(connectionFlags));<NEW_LINE>msg.append(" for ").append(waitMillis * 0.001f).append(" seconds.\n");<NEW_LINE>}<NEW_LINE>msg.append("Connections: ").append(info.activeConnections).append(" active, ");<NEW_LINE>msg.append(info<MASK><NEW_LINE>msg.append(info.availableConnections).append(" available.\n");<NEW_LINE>if (!info.activeOperationDescriptions.isEmpty()) {<NEW_LINE>msg.append("\nRequests in progress:\n");<NEW_LINE>for (String request : info.activeOperationDescriptions) {<NEW_LINE>msg.append(" ").append(request).append("\n");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String message = msg.toString();<NEW_LINE>Log.w(TAG, message);<NEW_LINE>} | .idleConnections).append(" idle, "); |
1,103,700 | public void testBizIntLookupXmlBasedComp_StatelessTwoNames() throws Exception {<NEW_LINE>UserTransaction userTran = null;<NEW_LINE>// --------------------------------------------------------------------<NEW_LINE>// Lookup SLSB by XML name and execute the test<NEW_LINE>// --------------------------------------------------------------------<NEW_LINE>CMTStatelessLocal bean2 = (CMTStatelessLocal) FATHelper.<MASK><NEW_LINE>assertNotNull("1 ---> CMTStatelessLocal2 obtained successfully.", bean2);<NEW_LINE>bean2.tx_Default();<NEW_LINE>bean2.tx_Required();<NEW_LINE>bean2.tx_NotSupported();<NEW_LINE>bean2.tx_RequiresNew();<NEW_LINE>bean2.tx_Supports();<NEW_LINE>bean2.tx_Never();<NEW_LINE>userTran = FATHelper.lookupUserTransaction();<NEW_LINE>svLogger.info("Beginning User Transaction ...");<NEW_LINE>userTran.begin();<NEW_LINE>bean2.tx_Mandatory();<NEW_LINE>svLogger.info("Committing User Transaction ...");<NEW_LINE>userTran.commit();<NEW_LINE>} | lookupDefaultBindingEJBJavaApp(businessInterface, module, beanName2); |
788,146 | public ContainerInstanceHealthStatus unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ContainerInstanceHealthStatus containerInstanceHealthStatus = new ContainerInstanceHealthStatus();<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("overallStatus", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>containerInstanceHealthStatus.setOverallStatus(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("details", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>containerInstanceHealthStatus.setDetails(new ListUnmarshaller<InstanceHealthCheckResult>(InstanceHealthCheckResultJsonUnmarshaller.getInstance(<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 containerInstanceHealthStatus;<NEW_LINE>} | )).unmarshall(context)); |
1,624,579 | public boolean apply(Game game, Ability source) {<NEW_LINE>Permanent sourcePermanent = source.getSourcePermanentOrLKI(game);<NEW_LINE>if (sourcePermanent == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>int amount = sourcePermanent.getPower().getValue();<NEW_LINE>if (amount < 1) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));<NEW_LINE>if (permanent == null) {<NEW_LINE>Player player = game.getPlayer(getTargetPointer().getFirst(game, source));<NEW_LINE>return player != null && player.damage(amount, source, game) > 0;<NEW_LINE>}<NEW_LINE>if (!permanent.isCreature(game)) {<NEW_LINE>return permanent.damage(amount, source, game) > 0;<NEW_LINE>}<NEW_LINE>int lethal = permanent.getLethalDamage(<MASK><NEW_LINE>permanent.damage(amount, source.getSourceId(), source, game);<NEW_LINE>if (lethal >= amount) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>Player player = game.getPlayer(source.getControllerId());<NEW_LINE>if (player != null) {<NEW_LINE>player.drawCards(1, source, game);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | source.getSourceId(), game); |
1,027,180 | V putInternal(K key, V value, ExpirationPolicy expirationPolicy, long expirationNanos) {<NEW_LINE>writeLock.lock();<NEW_LINE>try {<NEW_LINE>ExpiringEntry<K, V> entry = entries.get(key);<NEW_LINE>V oldValue = null;<NEW_LINE>if (entry == null) {<NEW_LINE>entry = new ExpiringEntry<K, V>(key, value, variableExpiration ? new AtomicReference<ExpirationPolicy>(expirationPolicy) : this.expirationPolicy, variableExpiration ? new AtomicLong(expirationNanos) : this.expirationNanos);<NEW_LINE>if (entries.size() >= maxSize) {<NEW_LINE>ExpiringEntry<K, V<MASK><NEW_LINE>entries.remove(expiredEntry.key);<NEW_LINE>notifyListeners(expiredEntry);<NEW_LINE>}<NEW_LINE>entries.put(key, entry);<NEW_LINE>if (entries.size() == 1 || entries.first().equals(entry))<NEW_LINE>scheduleEntry(entry);<NEW_LINE>} else {<NEW_LINE>oldValue = entry.getValue();<NEW_LINE>if (!ExpirationPolicy.ACCESSED.equals(expirationPolicy) && ((oldValue == null && value == null) || (oldValue != null && oldValue.equals(value))))<NEW_LINE>return value;<NEW_LINE>entry.setValue(value);<NEW_LINE>resetEntry(entry, false);<NEW_LINE>}<NEW_LINE>return oldValue;<NEW_LINE>} finally {<NEW_LINE>writeLock.unlock();<NEW_LINE>}<NEW_LINE>} | > expiredEntry = entries.first(); |
170,808 | private void loadWorlds() {<NEW_LINE>File f = new File(core.getDataFolder(), "forgeworlds.yml");<NEW_LINE>if (f.canRead() == false) {<NEW_LINE>useSaveFolder = true;<NEW_LINE>ForgeWorld.setSaveFolderMapping();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ConfigurationNode cn = new ConfigurationNode(f);<NEW_LINE>cn.load();<NEW_LINE>// If defined, use maxWorldHeight<NEW_LINE>ForgeWorld.setMaxWorldHeight(cn.getInteger("maxWorldHeight", 256));<NEW_LINE>// If setting defined, use it<NEW_LINE>if (cn.containsKey("useSaveFolderAsName")) {<NEW_LINE>useSaveFolder = cn.getBoolean("useSaveFolderAsName", useSaveFolder);<NEW_LINE>}<NEW_LINE>if (useSaveFolder) {<NEW_LINE>ForgeWorld.setSaveFolderMapping();<NEW_LINE>}<NEW_LINE>List<Map<String, Object>> lst = cn.getMapList("worlds");<NEW_LINE>if (lst == null) {<NEW_LINE>Log.warning("Discarding bad forgeworlds.yml");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (Map<String, Object> world : lst) {<NEW_LINE>try {<NEW_LINE>String name = (String) world.get("name");<NEW_LINE>int height = (Integer) world.get("height");<NEW_LINE>int sealevel = (Integer) world.get("sealevel");<NEW_LINE>boolean nether = (Boolean) world.get("nether");<NEW_LINE>boolean theend = (Boolean) world.get("the_end");<NEW_LINE>String title = (String) world.get("title");<NEW_LINE>if (name != null) {<NEW_LINE>ForgeWorld fw = new ForgeWorld(name, height, sealevel, nether, theend, title);<NEW_LINE>fw.setWorldUnloaded();<NEW_LINE>core.processWorldLoad(fw);<NEW_LINE>worlds.put(<MASK><NEW_LINE>}<NEW_LINE>} catch (Exception x) {<NEW_LINE>Log.warning("Unable to load saved worlds from forgeworlds.yml");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | fw.getName(), fw); |
1,101,201 | private boolean handleEarlyCancellation(ClientRequestContext ctx, HttpRequest req, DecodedHttpResponse res) {<NEW_LINE>if (res.isOpen()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>assert responseDecoder != null;<NEW_LINE>responseDecoder.decrementUnfinishedResponses();<NEW_LINE>// The response has been closed even before its request is sent.<NEW_LINE>assert protocol != null;<NEW_LINE>try (SafeCloseable ignored = RequestContextUtil.pop()) {<NEW_LINE>req.abort(CancelledSubscriptionException.get());<NEW_LINE>ctx.logBuilder().session(channel, protocol, null);<NEW_LINE>ctx.logBuilder().requestHeaders(req.headers());<NEW_LINE>req.whenComplete().handle((unused, cause) -> {<NEW_LINE>if (cause == null) {<NEW_LINE>ctx<MASK><NEW_LINE>} else {<NEW_LINE>ctx.logBuilder().endRequest(cause);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>});<NEW_LINE>res.whenComplete().handle((unused, cause) -> {<NEW_LINE>if (cause == null) {<NEW_LINE>ctx.logBuilder().endResponse();<NEW_LINE>} else {<NEW_LINE>ctx.logBuilder().endResponse(cause);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>});<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | .logBuilder().endRequest(); |
885,096 | void deleteOldArtifacts() {<NEW_LINE>ServerConfig serverConfig = goConfigService.serverConfig();<NEW_LINE>Double requiredSpaceInGb = serverConfig.getPurgeUpto();<NEW_LINE>if (serverConfig.isArtifactPurgingAllowed()) {<NEW_LINE>double requiredSpace = requiredSpaceInGb * GoConstants.GIGA_BYTE;<NEW_LINE>LOGGER.info(<MASK><NEW_LINE>List<Stage> stages;<NEW_LINE>int numberOfStagesPurged = 0;<NEW_LINE>do {<NEW_LINE>configDbStateRepository.flushConfigState();<NEW_LINE>stages = stageService.oldestStagesWithDeletableArtifacts();<NEW_LINE>for (Stage stage : stages) {<NEW_LINE>if (availableSpace() > requiredSpace) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>numberOfStagesPurged++;<NEW_LINE>artifactService.purgeArtifactsForStage(stage);<NEW_LINE>}<NEW_LINE>} while ((availableSpace() < requiredSpace) && !stages.isEmpty());<NEW_LINE>if (availableSpace() < requiredSpace) {<NEW_LINE>LOGGER.warn("Ran out of stages to clear artifacts from but the disk space is still low");<NEW_LINE>}<NEW_LINE>LOGGER.info("Finished clearing old artifacts. Deleted artifacts for '{}' stages. Current space: '{}'", numberOfStagesPurged, availableSpace());<NEW_LINE>}<NEW_LINE>} | "Clearing old artifacts as the disk space is low. Current space: '{}'. Need to clear till we hit: '{}'.", availableSpace(), requiredSpace); |
1,807,357 | private Model internalBuildModel(WSDLDocument document) {<NEW_LINE>numPasses++;<NEW_LINE>// build the jaxbModel to be used latter<NEW_LINE>buildJAXBModel(document);<NEW_LINE>QName modelName = new QName(document.getDefinitions().getTargetNamespaceURI(), document.getDefinitions().getName() == null ? "model" : document.<MASK><NEW_LINE>Model model = new Model(modelName, document.getDefinitions());<NEW_LINE>model.setJAXBModel(getJAXBModelBuilder().getJAXBModel());<NEW_LINE>// This fails with the changed classname (WSDLModeler to WSDLModeler11 etc.)<NEW_LINE>// with this source comaptibility change the WSDL Modeler class name is changed. Right now hardcoding the<NEW_LINE>// modeler class name to the same one being checked in WSDLGenerator.<NEW_LINE>model.setProperty(ModelProperties.PROPERTY_MODELER_NAME, ModelProperties.WSDL_MODELER_NAME);<NEW_LINE>_javaExceptions = new HashMap<String, JavaException>();<NEW_LINE>_bindingNameToPortMap = new HashMap<QName, Port>();<NEW_LINE>// grab target namespace<NEW_LINE>model.setTargetNamespaceURI(document.getDefinitions().getTargetNamespaceURI());<NEW_LINE>setDocumentationIfPresent(model, document.getDefinitions().getDocumentation());<NEW_LINE>boolean hasServices = document.getDefinitions().services().hasNext();<NEW_LINE>if (hasServices) {<NEW_LINE>for (Iterator iter = document.getDefinitions().services(); iter.hasNext(); ) {<NEW_LINE>processService((com.sun.tools.internal.ws.wsdl.document.Service) iter.next(), model, document);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// emit a warning if there are no service definitions<NEW_LINE>warning(model.getEntity(), ModelerMessages.WSDLMODELER_WARNING_NO_SERVICE_DEFINITIONS_FOUND());<NEW_LINE>}<NEW_LINE>return model;<NEW_LINE>} | getDefinitions().getName()); |
184,753 | private boolean areAttributeMinimumsFeasible(SingularityOfferHolder offerHolder, SingularityTaskRequest taskRequest, List<SingularityTaskId> activeTaskIdsForRequest) {<NEW_LINE>if (!taskRequest.getRequest().getAgentAttributeMinimums().isPresent()) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>Map<String, String> offerAttributes = agentManager.getObject(offerHolder.getAgentId())<MASK><NEW_LINE>Integer numDesiredInstances = taskRequest.getRequest().getInstancesSafe();<NEW_LINE>Integer numActiveInstances = activeTaskIdsForRequest.size();<NEW_LINE>for (Entry<String, Map<String, Integer>> keyEntry : taskRequest.getRequest().getAgentAttributeMinimums().get().entrySet()) {<NEW_LINE>String attrKey = keyEntry.getKey();<NEW_LINE>for (Entry<String, Integer> valueEntry : keyEntry.getValue().entrySet()) {<NEW_LINE>Integer percentInstancesWithAttr = valueEntry.getValue();<NEW_LINE>Integer minInstancesWithAttr = Math.max(1, (int) ((percentInstancesWithAttr / 100.0) * numDesiredInstances));<NEW_LINE>if (offerAttributes.containsKey(attrKey) && offerAttributes.get(attrKey).equals(valueEntry.getKey())) {<NEW_LINE>// Accepting this offer would add an instance of the needed attribute, so it's okay.<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// Would accepting this offer prevent meeting the necessary attribute in the future?<NEW_LINE>long numInstancesWithAttr = getNumInstancesWithAttribute(activeTaskIdsForRequest, attrKey, valueEntry.getKey());<NEW_LINE>long numInstancesWithoutAttr = numActiveInstances - numInstancesWithAttr + 1;<NEW_LINE>long maxPotentialInstancesWithAttr = numDesiredInstances - numInstancesWithoutAttr;<NEW_LINE>if (maxPotentialInstancesWithAttr < minInstancesWithAttr) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | .get().getAttributes(); |
386,261 | private ClusterState applyCreateIndexRequestWithExistingMetadata(final ClusterState currentState, final CreateIndexClusterStateUpdateRequest request, final boolean silent, final IndexMetadata sourceMetadata, final BiConsumer<Metadata.Builder, IndexMetadata> metadataTransformer) throws Exception {<NEW_LINE>logger.info("applying create index request using existing index [{}] metadata", sourceMetadata.getIndex().getName());<NEW_LINE>final Map<String, Object> mappings = MapperService.parseMapping(<MASK><NEW_LINE>if (mappings.isEmpty() == false) {<NEW_LINE>throw new IllegalArgumentException("mappings are not allowed when creating an index from a source index, " + "all mappings are copied from the source index");<NEW_LINE>}<NEW_LINE>final Settings aggregatedIndexSettings = aggregateIndexSettings(currentState, request, Settings.EMPTY, sourceMetadata, settings, indexScopedSettings, shardLimitValidator, indexSettingProviders);<NEW_LINE>final int routingNumShards = getIndexNumberOfRoutingShards(aggregatedIndexSettings, sourceMetadata);<NEW_LINE>IndexMetadata tmpImd = buildAndValidateTemporaryIndexMetadata(aggregatedIndexSettings, request, routingNumShards);<NEW_LINE>return applyCreateIndexWithTemporaryService(currentState, request, silent, sourceMetadata, tmpImd, List.of(), indexService -> // the context is only used for validation so it's fine to pass fake values for the<NEW_LINE>resolveAndValidateAliases(// the context is only used for validation so it's fine to pass fake values for the<NEW_LINE>request.index(), // the context is only used for validation so it's fine to pass fake values for the<NEW_LINE>request.aliases(), // the context is only used for validation so it's fine to pass fake values for the<NEW_LINE>Collections.emptyList(), // the context is only used for validation so it's fine to pass fake values for the<NEW_LINE>currentState.metadata(), // the context is only used for validation so it's fine to pass fake values for the<NEW_LINE>xContentRegistry, // shard id and the current timestamp<NEW_LINE>indexService.newSearchExecutionContext(0, 0, null, () -> 0L, null, emptyMap()), IndexService.dateMathExpressionResolverAt(request.getNameResolvedAt()), systemIndices::isSystemName), List.of(), metadataTransformer);<NEW_LINE>} | xContentRegistry, request.mappings()); |
58,403 | public List<EditOperation> calculatePath() {<NEW_LINE>LinkedList<EditOperation> ops = new LinkedList<>();<NEW_LINE>int i = seq1.length();<NEW_LINE>int j = seq2.length();<NEW_LINE>int dist = matrix[i][j];<NEW_LINE>while (i > 0 && j > 0 && dist > 0) {<NEW_LINE>int ins = matrix[i][j - 1];<NEW_LINE>int del = matrix[i - 1][j];<NEW_LINE>int sub = matrix[i - 1][j - 1];<NEW_LINE>if (dist == ins + 1) {<NEW_LINE>addOrUpdate(ops, INSERT, 1);<NEW_LINE>j--;<NEW_LINE>} else if (dist == del + 1) {<NEW_LINE><MASK><NEW_LINE>i--;<NEW_LINE>} else {<NEW_LINE>if (dist == sub)<NEW_LINE>addOrUpdate(ops, SKIP, 1);<NEW_LINE>else<NEW_LINE>addOrUpdate(ops, SUBSTITUTE, 1);<NEW_LINE>i--;<NEW_LINE>j--;<NEW_LINE>}<NEW_LINE>dist = matrix[i][j];<NEW_LINE>}<NEW_LINE>if (i == 0)<NEW_LINE>addOrUpdate(ops, INSERT, j);<NEW_LINE>else if (j == 0)<NEW_LINE>addOrUpdate(ops, DELETE, i);<NEW_LINE>else<NEW_LINE>addOrUpdate(ops, SKIP, i);<NEW_LINE>return ops;<NEW_LINE>} | addOrUpdate(ops, DELETE, 1); |
562,566 | public void draw(final Canvas pCanvas, final Projection pProjection) {<NEW_LINE>final Paint background;<NEW_LINE>final Paint foreground;<NEW_LINE>if (mIsDragged) {<NEW_LINE>background = mDragBackground != null ? mDragBackground : mBackground;<NEW_LINE>foreground = mDragForeground != null ? mDragForeground : mForeground;<NEW_LINE>} else {<NEW_LINE>background = mBackground;<NEW_LINE>foreground = mForeground;<NEW_LINE>}<NEW_LINE>if (mGeoPoint == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (mTitle == null || mTitle.trim().length() == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (foreground == null || background == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>pProjection.toPixels(mGeoPoint, mPixel);<NEW_LINE>final String text = mTitle;<NEW_LINE>foreground.getTextBounds(text, 0, text.length(), mTextRect);<NEW_LINE>mPoint.set(mPixel.x, mPixel.y);<NEW_LINE>mTextRect.offset((int) (mPoint.x + mOffsetX + mDragDeltaX), (int) (mPoint.y + mOffsetY + mDragDeltaY));<NEW_LINE>mTextRect.top -= mMargin;<NEW_LINE>mTextRect.left -= mMargin;<NEW_LINE>mTextRect.right += mMargin;<NEW_LINE>mTextRect.bottom += mMargin;<NEW_LINE>mRect.set(mTextRect.left, mTextRect.top, mTextRect.right, mTextRect.bottom);<NEW_LINE>final int corner = mHelper.compute(mRect, <MASK><NEW_LINE>pCanvas.drawRect(mTextRect.left, mTextRect.top, mTextRect.right, mTextRect.bottom, background);<NEW_LINE>if (corner != SpeechBalloonHelper.CORNER_INSIDE) {<NEW_LINE>mPath.reset();<NEW_LINE>mPath.moveTo(mPoint.x, mPoint.y);<NEW_LINE>mPath.lineTo(mIntersection1.x, mIntersection1.y);<NEW_LINE>mPath.lineTo(mIntersection2.x, mIntersection2.y);<NEW_LINE>mPath.close();<NEW_LINE>pCanvas.drawPath(mPath, background);<NEW_LINE>}<NEW_LINE>pCanvas.drawText(text, mTextRect.left + mMargin, mTextRect.bottom - mMargin, foreground);<NEW_LINE>} | mPoint, mRadius, mIntersection1, mIntersection2); |
248,514 | public Map<File, IndexProcessingResults> processIndex(Set<File> replicaDirs, Set<StoreKey> filterSet, int parallelism, boolean detectDuplicatesAcrossKeys) {<NEW_LINE>if (detectDuplicatesAcrossKeys && parallelism != 1) {<NEW_LINE>throw new IllegalArgumentException("Parallelism cannot be > 1 because StoreKeyConverter is not thread safe");<NEW_LINE>}<NEW_LINE>if (replicaDirs == null || replicaDirs.size() == 0) {<NEW_LINE>return Collections.emptyMap();<NEW_LINE>}<NEW_LINE>long currentTimeMs = time.milliseconds();<NEW_LINE>ConcurrentMap<File, IndexProcessingResults> resultsByReplica = new ConcurrentHashMap<>();<NEW_LINE>ExecutorService executorService = Executors.newFixedThreadPool(Math.min(parallelism, replicaDirs.size()));<NEW_LINE>List<Future<?>> taskFutures = new ArrayList<>(replicaDirs.size());<NEW_LINE>for (File replicaDir : replicaDirs) {<NEW_LINE>Future<?> taskFuture = executorService.submit(() -> {<NEW_LINE><MASK><NEW_LINE>IndexProcessingResults results = null;<NEW_LINE>try {<NEW_LINE>results = processIndex(replicaDir, filterSet, currentTimeMs, detectDuplicatesAcrossKeys);<NEW_LINE>} catch (Throwable e) {<NEW_LINE>results = new IndexProcessingResults(e);<NEW_LINE>} finally {<NEW_LINE>resultsByReplica.put(replicaDir, results);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>taskFutures.add(taskFuture);<NEW_LINE>}<NEW_LINE>for (Future<?> taskFuture : taskFutures) {<NEW_LINE>try {<NEW_LINE>taskFuture.get();<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new IllegalStateException("Future encountered error while waiting", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return resultsByReplica;<NEW_LINE>} | logger.info("Processing segment files for replica {} ", replicaDir); |
182,060 | public synchronized Map<String, Object> asMap(boolean withDetails) {<NEW_LINE>E.checkState(this.type != null, "Task type can't be null");<NEW_LINE>E.checkState(this.name != null, "Task name can't be null");<NEW_LINE>Map<String, Object> map = new HashMap<>();<NEW_LINE>map.put(Hidden.unHide(P<MASK><NEW_LINE>map.put(Hidden.unHide(P.TYPE), this.type);<NEW_LINE>map.put(Hidden.unHide(P.NAME), this.name);<NEW_LINE>map.put(Hidden.unHide(P.STATUS), this.status.string());<NEW_LINE>map.put(Hidden.unHide(P.PROGRESS), this.progress);<NEW_LINE>map.put(Hidden.unHide(P.CREATE), this.create);<NEW_LINE>map.put(Hidden.unHide(P.RETRIES), this.retries);<NEW_LINE>if (this.description != null) {<NEW_LINE>map.put(Hidden.unHide(P.DESCRIPTION), this.description);<NEW_LINE>}<NEW_LINE>if (this.update != null) {<NEW_LINE>map.put(Hidden.unHide(P.UPDATE), this.update);<NEW_LINE>}<NEW_LINE>if (this.dependencies != null) {<NEW_LINE>Set<Long> value = this.dependencies.stream().map(Id::asLong).collect(toOrderSet());<NEW_LINE>map.put(Hidden.unHide(P.DEPENDENCIES), value);<NEW_LINE>}<NEW_LINE>if (this.server != null) {<NEW_LINE>map.put(Hidden.unHide(P.SERVER), this.server.asString());<NEW_LINE>}<NEW_LINE>if (withDetails) {<NEW_LINE>map.put(Hidden.unHide(P.CALLABLE), this.callable.getClass().getName());<NEW_LINE>if (this.input != null) {<NEW_LINE>map.put(Hidden.unHide(P.INPUT), this.input);<NEW_LINE>}<NEW_LINE>if (this.result != null) {<NEW_LINE>map.put(Hidden.unHide(P.RESULT), this.result);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return map;<NEW_LINE>} | .ID), this.id); |
1,655,628 | boolean matches(LocalDate date) {<NEW_LINE>for (FieldPart part : parts) {<NEW_LINE>if ("L".equals(part.modifier)) {<NEW_LINE>YearMonth ym = YearMonth.of(date.getYear(), date.getMonth().getValue());<NEW_LINE>return date.getDayOfWeek() == DayOfWeek.of(part.from) && date.getDayOfMonth() > (ym.lengthOfMonth() - DAYS_IN_WEEK);<NEW_LINE>} else if ("#".equals(part.incrementModifier)) {<NEW_LINE>if (date.getDayOfWeek() == DayOfWeek.of(part.from)) {<NEW_LINE>int num = date.getDayOfMonth() / DAYS_IN_WEEK;<NEW_LINE>return part.increment == (date.getDayOfMonth() % DAYS_IN_WEEK == <MASK><NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} else if (matches(date.getDayOfWeek().getValue(), part)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | 0 ? num : num + 1); |
732,280 | public static Project readXML(File f) throws IOException, SAXException {<NEW_LINE>InputStream in = new BufferedInputStream(new FileInputStream(f));<NEW_LINE>Project project = new Project();<NEW_LINE>try {<NEW_LINE>String tag = Util.getXMLType(in);<NEW_LINE>SAXBugCollectionHandler handler;<NEW_LINE>if ("Project".equals(tag)) {<NEW_LINE>handler = new SAXBugCollectionHandler(project, f);<NEW_LINE>} else if ("BugCollection".equals(tag)) {<NEW_LINE>SortedBugCollection bugs = new SortedBugCollection(project);<NEW_LINE>handler = new SAXBugCollectionHandler(bugs, f);<NEW_LINE>} else {<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>XMLReader xr = XMLReaderFactory.createXMLReader();<NEW_LINE>xr.setContentHandler(handler);<NEW_LINE>xr.setErrorHandler(handler);<NEW_LINE>Reader reader = Util.getReader(in);<NEW_LINE>xr.parse(new InputSource(reader));<NEW_LINE>} finally {<NEW_LINE>in.close();<NEW_LINE>}<NEW_LINE>// Presumably, project is now up-to-date<NEW_LINE>project.setModified(false);<NEW_LINE>return project;<NEW_LINE>} | IOException("Can't load a project from a " + tag + " file"); |
214,516 | private void executeAndShowTextFind() {<NEW_LINE>String textToFind = textToFindField.getText();<NEW_LINE>if (this.searchProvider != null) {<NEW_LINE>// new search?<NEW_LINE>if (lastTextTofind != null && !lastTextTofind.equals(textToFind)) {<NEW_LINE>searchProvider.resetTextToFind();<NEW_LINE>textToFindField.setBackground(Color.WHITE);<NEW_LINE>textToFindField.setForeground(Color.BLACK);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Pattern pattern = createPattern(textToFindField.getText());<NEW_LINE>boolean found = searchProvider.executeAndShowTextFind(pattern);<NEW_LINE>if (found) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>findButton.setText(JMeterUtils.getResString("search_text_button_find"));<NEW_LINE>lastTextTofind = textToFind;<NEW_LINE>textToFindField.setBackground(Color.WHITE);<NEW_LINE>textToFindField.setForeground(Color.BLACK);<NEW_LINE>} else {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>findButton.setText(JMeterUtils.getResString("search_text_button_find"));<NEW_LINE>textToFindField.setBackground(Colors.LIGHT_RED);<NEW_LINE>textToFindField.setForeground(Color.WHITE);<NEW_LINE>}<NEW_LINE>} catch (PatternSyntaxException pse) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>JOptionPane.// $NON-NLS-1$<NEW_LINE>showMessageDialog(// $NON-NLS-1$<NEW_LINE>null, // $NON-NLS-1$<NEW_LINE>pse.toString(), JMeterUtils.getResString<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ("error_title"), JOptionPane.WARNING_MESSAGE); |
1,477,254 | public Response<Void> deleteByIdWithResponse(String id, Context context) {<NEW_LINE>String resourceGroupName = <MASK><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 labName = Utils.getValueFromIdByName(id, "labs");<NEW_LINE>if (labName == null) {<NEW_LINE>throw logger.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id)));<NEW_LINE>}<NEW_LINE>String name = Utils.getValueFromIdByName(id, "artifactsources");<NEW_LINE>if (name == null) {<NEW_LINE>throw logger.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'artifactsources'.", id)));<NEW_LINE>}<NEW_LINE>return this.deleteWithResponse(resourceGroupName, labName, name, context);<NEW_LINE>} | Utils.getValueFromIdByName(id, "resourceGroups"); |
130,521 | final DisassociateElasticIpResult executeDisassociateElasticIp(DisassociateElasticIpRequest disassociateElasticIpRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(disassociateElasticIpRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DisassociateElasticIpRequest> request = null;<NEW_LINE>Response<DisassociateElasticIpResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DisassociateElasticIpRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(disassociateElasticIpRequest));<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, "OpsWorks");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DisassociateElasticIp");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DisassociateElasticIpResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DisassociateElasticIpResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
1,053,147 | public void initData() {<NEW_LINE>if (disposable != null)<NEW_LINE>return;<NEW_LINE>ACache aCache = ACache.get(mView.getContext(), "findCache");<NEW_LINE>Single.create((SingleOnSubscribe<List<RecyclerViewData>>) e -> {<NEW_LINE>List<RecyclerViewData> group = new ArrayList<>();<NEW_LINE>boolean showAllFind = MApplication.getConfigPreferences().getBoolean("showAllFind", true);<NEW_LINE>List<BookSourceBean> sourceBeans = new ArrayList<>(showAllFind ? BookSourceManager.getAllBookSourceBySerialNumber() : BookSourceManager.getSelectedBookSourceBySerialNumber());<NEW_LINE>for (BookSourceBean sourceBean : sourceBeans) {<NEW_LINE>Pair<FindKindGroupBean, List<FindKindBean>> pair = sourceBean.getFindList();<NEW_LINE>if (pair != null) {<NEW_LINE>group.add(new RecyclerViewData(pair.first<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>e.onSuccess(group);<NEW_LINE>}).compose(RxUtils::toSimpleSingle).subscribe(new SingleObserver<List<RecyclerViewData>>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onSubscribe(Disposable d) {<NEW_LINE>disposable = d;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onSuccess(List<RecyclerViewData> recyclerViewData) {<NEW_LINE>mView.upData(recyclerViewData);<NEW_LINE>disposable.dispose();<NEW_LINE>disposable = null;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onError(Throwable e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>Toast.makeText(mView.getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();<NEW_LINE>disposable.dispose();<NEW_LINE>disposable = null;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | , pair.second, false)); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.