idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
123,685 | private void applyMigrations(final LinkedHashMap<MigrationInfoImpl, Boolean> group, boolean skipExecutingMigrations) {<NEW_LINE>boolean executeGroupInTransaction = isExecuteGroupInTransaction(group);<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>if (executeGroupInTransaction) {<NEW_LINE>ExecutionTemplateFactory.createExecutionTemplate(connectionUserObjects.getJdbcConnection(), database).execute(() -> {<NEW_LINE>doMigrateGroup(group, stopWatch, skipExecutingMigrations, true);<NEW_LINE>return null;<NEW_LINE>});<NEW_LINE>} else {<NEW_LINE>doMigrateGroup(group, stopWatch, skipExecutingMigrations, false);<NEW_LINE>}<NEW_LINE>} catch (FlywayMigrateException e) {<NEW_LINE>MigrationInfo migration = e.getMigration();<NEW_LINE>String failedMsg = "Migration of " + toMigrationText(migration, e.isExecutableInTransaction(), e.isOutOfOrder()) + " failed!";<NEW_LINE>if (database.supportsDdlTransactions() && executeGroupInTransaction) {<NEW_LINE>LOG.error(failedMsg + " Changes successfully rolled back.");<NEW_LINE>} else {<NEW_LINE>LOG.error(failedMsg + " Please restore backups and roll back database and code!");<NEW_LINE>stopWatch.stop();<NEW_LINE>int executionTime = (int) stopWatch.getTotalTimeMillis();<NEW_LINE>schemaHistory.addAppliedMigration(migration.getVersion(), migration.getDescription(), migration.getType(), migration.getScript(), migration.getChecksum(), executionTime, false);<NEW_LINE>}<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>} | final StopWatch stopWatch = new StopWatch(); |
590,185 | public static void prepareTransactionalConnection(Connection connection) throws SQLException {<NEW_LINE>if (!isInAHttpRequest()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>boolean mustCheck = !isCurrentlyInAPublicUrlRequest() && isLoggedUser() && !isPublic() && !isAdmin();<NEW_LINE>if (!mustCheck) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try (var s = connection.createStatement()) {<NEW_LINE>s.execute("reset alfio.checkRowAccess");<NEW_LINE>}<NEW_LINE>try (var s = connection.createStatement()) {<NEW_LINE>s.execute("reset alfio.currentUserOrgs");<NEW_LINE>}<NEW_LINE>Set<Integer> orgIds = new TreeSet<>();<NEW_LINE>try (var s = connection.prepareStatement(QUERY_ORG_FOR_USER)) {<NEW_LINE>String username = SecurityContextHolder.getContext().getAuthentication().getName();<NEW_LINE>s.setString(1, username);<NEW_LINE>s.setString(2, username);<NEW_LINE>try (var rs = s.executeQuery()) {<NEW_LINE>while (rs.next()) {<NEW_LINE>orgIds.add(rs.getInt(1));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (orgIds.isEmpty()) {<NEW_LINE>log.warn("orgIds is empty, was not able to apply currentUserOrgs");<NEW_LINE>} else {<NEW_LINE>try (var s = connection.createStatement()) {<NEW_LINE>s.execute("set local alfio.checkRowAccess = true");<NEW_LINE>}<NEW_LINE>try (var s = connection.createStatement()) {<NEW_LINE>String formattedOrgIds = orgIds.stream().map(orgId -> Integer.toString(orgId)).collect(Collectors.joining(","));<NEW_LINE>// can't use placeholder in a prepared statement when using 'set ...', but cannot be sql injected as the source is a set of integers<NEW_LINE>s.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | execute("set local alfio.currentUserOrgs = '" + formattedOrgIds + "'"); |
579,161 | public static DescribeSuspiciousEventsResponse unmarshall(DescribeSuspiciousEventsResponse describeSuspiciousEventsResponse, UnmarshallerContext context) {<NEW_LINE>describeSuspiciousEventsResponse.setRequestId(context.stringValue("DescribeSuspiciousEventsResponse.RequestId"));<NEW_LINE>describeSuspiciousEventsResponse.setPageSize<MASK><NEW_LINE>describeSuspiciousEventsResponse.setTotalCount(context.integerValue("DescribeSuspiciousEventsResponse.TotalCount"));<NEW_LINE>describeSuspiciousEventsResponse.setCurrentPage(context.integerValue("DescribeSuspiciousEventsResponse.CurrentPage"));<NEW_LINE>List<LogListItem> logList = new ArrayList<LogListItem>();<NEW_LINE>for (int i = 0; i < context.lengthValue("DescribeSuspiciousEventsResponse.LogList.Length"); i++) {<NEW_LINE>LogListItem logListItem = new LogListItem();<NEW_LINE>logListItem.setAliasEventType(context.stringValue("DescribeSuspiciousEventsResponse.LogList[" + i + "].AliasEventType"));<NEW_LINE>logListItem.setLastTime(context.longValue("DescribeSuspiciousEventsResponse.LogList[" + i + "].LastTime"));<NEW_LINE>logListItem.setLevel(context.stringValue("DescribeSuspiciousEventsResponse.LogList[" + i + "].Level"));<NEW_LINE>logListItem.setInstanceName(context.stringValue("DescribeSuspiciousEventsResponse.LogList[" + i + "].InstanceName"));<NEW_LINE>logListItem.setGroupId(context.longValue("DescribeSuspiciousEventsResponse.LogList[" + i + "].GroupId"));<NEW_LINE>logListItem.setIp(context.stringValue("DescribeSuspiciousEventsResponse.LogList[" + i + "].Ip"));<NEW_LINE>logListItem.setEventType(context.stringValue("DescribeSuspiciousEventsResponse.LogList[" + i + "].EventType"));<NEW_LINE>logListItem.setUuid(context.stringValue("DescribeSuspiciousEventsResponse.LogList[" + i + "].Uuid"));<NEW_LINE>logListItem.setFirstTime(context.longValue("DescribeSuspiciousEventsResponse.LogList[" + i + "].FirstTime"));<NEW_LINE>logListItem.setInstanceId(context.stringValue("DescribeSuspiciousEventsResponse.LogList[" + i + "].InstanceId"));<NEW_LINE>logListItem.setTag(context.stringValue("DescribeSuspiciousEventsResponse.LogList[" + i + "].Tag"));<NEW_LINE>logListItem.setAliasEventName(context.stringValue("DescribeSuspiciousEventsResponse.LogList[" + i + "].AliasEventName"));<NEW_LINE>logListItem.setOsVersion(context.stringValue("DescribeSuspiciousEventsResponse.LogList[" + i + "].OsVersion"));<NEW_LINE>logListItem.setClientIp(context.stringValue("DescribeSuspiciousEventsResponse.LogList[" + i + "].ClientIp"));<NEW_LINE>logListItem.setEventName(context.stringValue("DescribeSuspiciousEventsResponse.LogList[" + i + "].EventName"));<NEW_LINE>List<DetailListItem> detailList = new ArrayList<DetailListItem>();<NEW_LINE>for (int j = 0; j < context.lengthValue("DescribeSuspiciousEventsResponse.LogList[" + i + "].DetailList.Length"); j++) {<NEW_LINE>DetailListItem detailListItem = new DetailListItem();<NEW_LINE>detailListItem.setName(context.stringValue("DescribeSuspiciousEventsResponse.LogList[" + i + "].DetailList[" + j + "].Name"));<NEW_LINE>detailListItem.setType(context.stringValue("DescribeSuspiciousEventsResponse.LogList[" + i + "].DetailList[" + j + "].Type"));<NEW_LINE>detailListItem.setValue(context.stringValue("DescribeSuspiciousEventsResponse.LogList[" + i + "].DetailList[" + j + "].Value"));<NEW_LINE>detailListItem.setInfoType(context.stringValue("DescribeSuspiciousEventsResponse.LogList[" + i + "].DetailList[" + j + "].InfoType"));<NEW_LINE>detailList.add(detailListItem);<NEW_LINE>}<NEW_LINE>logListItem.setDetailList(detailList);<NEW_LINE>logList.add(logListItem);<NEW_LINE>}<NEW_LINE>describeSuspiciousEventsResponse.setLogList(logList);<NEW_LINE>return describeSuspiciousEventsResponse;<NEW_LINE>} | (context.integerValue("DescribeSuspiciousEventsResponse.PageSize")); |
1,242,692 | public void apply(double[] x) {<NEW_LINE>int i;<NEW_LINE>double[] lpfOutTmp;<NEW_LINE>// lpfOutTmp = SignalProcUtils.filter(Hd.getDenumeratorCoefficients(), filterNumerator, x);<NEW_LINE>lpfOutTmp = Hd.apply(x);<NEW_LINE>lpfOutTmp = SignalProcUtils.decimate(lpfOutTmp, 2.0);<NEW_LINE>// lpfOutTmp = SignalProcUtils.filter(Hb.getDenumeratorCoefficients(), filterNumerator, lpfOutTmp);<NEW_LINE>lpfOutTmp = Hb.apply(lpfOutTmp);<NEW_LINE>// Interpolation of lowpass channel<NEW_LINE>lpfOutInterpolated = SignalProcUtils.interpolate(lpfOutTmp, 2.0);<NEW_LINE>// lpfOutInterpolated = SignalProcUtils.filter(Hi.getDenumeratorCoefficients(), filterNumerator, lpfOutInterpolated);<NEW_LINE>lpfOutInterpolated = Hi.apply(lpfOutInterpolated);<NEW_LINE>//<NEW_LINE>// Energy compensation<NEW_LINE>double enx = SignalProcUtils.energy(x);<NEW_LINE>double enxloi = SignalProcUtils.energy(lpfOutInterpolated);<NEW_LINE>double gxloi = <MASK><NEW_LINE>for (i = 0; i < lpfOutInterpolated.length; i++) lpfOutInterpolated[i] *= gxloi;<NEW_LINE>//<NEW_LINE>int delay = (int) Math.floor(1.5 * filterLengthMinusOne + 0.5) - 1;<NEW_LINE>hpfOut = new double[x.length];<NEW_LINE>for (i = 0; i < x.length - delay; i++) hpfOut[i] = x[i] - lpfOutInterpolated[i + delay];<NEW_LINE>for (i = x.length - delay; i < x.length; i++) hpfOut[i] = 0.0;<NEW_LINE>delay = (int) Math.floor(0.5 * filterLengthMinusOne + 0.5);<NEW_LINE>lpfOut = new double[lpfOutTmp.length - delay];<NEW_LINE>for (i = delay; i < lpfOutTmp.length; i++) lpfOut[i - delay] = lpfOutTmp[i];<NEW_LINE>lpfOutEnergy = SignalProcUtils.energy(lpfOut);<NEW_LINE>} | Math.sqrt(enx / enxloi); |
1,572,534 | public SubjectAreaOMASAPIResponse<IsATypeOf> restoreIsATypeOf(String serverName, String userId, String guid) {<NEW_LINE>String restAPIName = "restoreIsATypeOf";<NEW_LINE>RESTCallToken token = restCallLogger.logRESTCall(serverName, userId, restAPIName);<NEW_LINE>SubjectAreaOMASAPIResponse<IsATypeOf> response = new SubjectAreaOMASAPIResponse<>();<NEW_LINE>AuditLog auditLog = null;<NEW_LINE>// should not be called without a supplied relationship - the calling layer should not allow this.<NEW_LINE>try {<NEW_LINE>auditLog = instanceHandler.getAuditLog(userId, serverName, restAPIName);<NEW_LINE>RelationshipHandler handler = instanceHandler.getRelationshipHandler(serverName, userId, restAPIName);<NEW_LINE>IsATypeOf restoredIsATypeOf = handler.restoreIsATypeOf(userId, guid);<NEW_LINE>response.addResult(restoredIsATypeOf);<NEW_LINE>} catch (Exception exception) {<NEW_LINE>response = getResponseForException(<MASK><NEW_LINE>}<NEW_LINE>restCallLogger.logRESTCallReturn(token, response.toString());<NEW_LINE>return response;<NEW_LINE>} | exception, auditLog, className, restAPIName); |
421,958 | public okhttp3.Call readRuntimeClassCall(String name, String pretty, final ApiCallback _callback) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/apis/node.k8s.io/v1beta1/runtimeclasses/{name}".replaceAll("\\{" + "name" + "\\}", localVarApiClient.escapeString(name.toString()));<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();<NEW_LINE>if (pretty != null) {<NEW_LINE>localVarQueryParams.addAll(localVarApiClient.parameterToPair("pretty", pretty));<NEW_LINE>}<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, String> localVarCookieParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new <MASK><NEW_LINE>final String[] localVarAccepts = { "application/json", "application/yaml", "application/vnd.kubernetes.protobuf" };<NEW_LINE>final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>if (localVarAccept != null) {<NEW_LINE>localVarHeaderParams.put("Accept", localVarAccept);<NEW_LINE>}<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>localVarHeaderParams.put("Content-Type", localVarContentType);<NEW_LINE>String[] localVarAuthNames = new String[] { "BearerToken" };<NEW_LINE>return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);<NEW_LINE>} | HashMap<String, Object>(); |
629,516 | public void processWrappedEvent(EventBean eventBean) {<NEW_LINE>if (InstrumentationHelper.ENABLED) {<NEW_LINE>InstrumentationHelper.get().qStimulantEvent(eventBean, services.getRuntimeURI());<NEW_LINE>}<NEW_LINE>EPEventServiceThreadLocalEntry tlEntry = threadLocals.get();<NEW_LINE>if (internalEventRouter.isHasPreprocessing()) {<NEW_LINE>eventBean = internalEventRouter.preprocess(eventBean, tlEntry.getExprEvaluatorContext(), InstrumentationHelper.get());<NEW_LINE>if (eventBean == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Acquire main processing lock which locks out statement management<NEW_LINE>if (InstrumentationHelper.ENABLED) {<NEW_LINE>InstrumentationHelper.get().qEvent(eventBean, services.getRuntimeURI(), true);<NEW_LINE>}<NEW_LINE>services.getEventProcessingRWLock().acquireReadLock();<NEW_LINE>try {<NEW_LINE>processMatches(eventBean);<NEW_LINE>} catch (RuntimeException ex) {<NEW_LINE>tlEntry<MASK><NEW_LINE>throw new EPException(ex);<NEW_LINE>} finally {<NEW_LINE>services.getEventProcessingRWLock().releaseReadLock();<NEW_LINE>if (InstrumentationHelper.ENABLED) {<NEW_LINE>InstrumentationHelper.get().aEvent();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Dispatch results to listeners<NEW_LINE>// Done outside of the read-lock to prevent lockups when listeners create statements<NEW_LINE>dispatch();<NEW_LINE>// Work off the event queue if any events accumulated in there via a route() or insert-into<NEW_LINE>processThreadWorkQueue();<NEW_LINE>if (InstrumentationHelper.ENABLED) {<NEW_LINE>InstrumentationHelper.get().aStimulantEvent();<NEW_LINE>}<NEW_LINE>} | .getMatchesArrayThreadLocal().clear(); |
59,162 | public void finishRecord() {<NEW_LINE>if (headers.isEmpty()) {<NEW_LINE>throw UserException.dataReadError().message("The file must define at least one header.").addContext("File Path", filePath.toString()).build(logger);<NEW_LINE>}<NEW_LINE>// Force headers to be unique.<NEW_LINE>final Set<String> idents = new HashSet<>();<NEW_LINE>for (int i = 0; i < headers.size(); i++) {<NEW_LINE>String <MASK><NEW_LINE>String key = header.toLowerCase();<NEW_LINE>// Is the header a duplicate?<NEW_LINE>if (idents.contains(key)) {<NEW_LINE>// Make header unique by appending a suffix.<NEW_LINE>// This loop must end because we have a finite<NEW_LINE>// number of headers.<NEW_LINE>// The original column is assumed to be "1", so<NEW_LINE>// the first duplicate is "2", and so on.<NEW_LINE>// Note that this will map columns of the form:<NEW_LINE>// "col,col,col_2,col_2_2" to<NEW_LINE>// "col", "col_2", "col_2_2", "col_2_2_2".<NEW_LINE>// No mapping scheme is perfect...<NEW_LINE>for (int l = 2; ; l++) {<NEW_LINE>final String rewritten = header + "_" + l;<NEW_LINE>key = rewritten.toLowerCase();<NEW_LINE>if (!idents.contains(key)) {<NEW_LINE>headers.set(i, rewritten);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>idents.add(key);<NEW_LINE>}<NEW_LINE>} | header = headers.get(i); |
1,332,474 | private List<HgLogMessageChangedPath> loadCachedChangePaths(File repository, String revision) {<NEW_LINE>Storage storage = StorageManager.getInstance().getStorage(repository.getAbsolutePath());<NEW_LINE>byte[] buff = storage.getRevisionInfo(revision);<NEW_LINE>if (buff == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>List<HgLogMessageChangedPath> changePaths = null;<NEW_LINE>DataInputStream dis = new DataInputStream(new ByteArrayInputStream(buff));<NEW_LINE>try {<NEW_LINE>String version = dis.readUTF();<NEW_LINE>if (PERSISTED_DATA_VERSION.equals(version)) {<NEW_LINE>int len = dis.readInt();<NEW_LINE>// do not care about empty paths, test for 0<NEW_LINE>changePaths = len == 0 ? null : new ArrayList<HgLogMessageChangedPath>(len);<NEW_LINE>for (int i = 0; i < len; ++i) {<NEW_LINE>String path = dis.readUTF();<NEW_LINE><MASK><NEW_LINE>String copyPath = dis.readUTF();<NEW_LINE>changePaths.add(new HgLogMessageChangedPath(path, copyPath.isEmpty() ? null : copyPath, action));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException ex) {<NEW_LINE>// NOI18N<NEW_LINE>LOG.log(Level.FINE, "changePaths from disk cache corrupted {0}", new Object[] { revision });<NEW_LINE>}<NEW_LINE>return changePaths;<NEW_LINE>} | char action = dis.readChar(); |
368,232 | private static URI rewriteUri(URI fsUri) {<NEW_LINE>final URI uri;<NEW_LINE>if (fsUri.getScheme() != null) {<NEW_LINE>uri = fsUri;<NEW_LINE>} else {<NEW_LINE>// Apply the default fs scheme<NEW_LINE>final URI defaultUri = org.apache.flink.core.fs.local.LocalFileSystem.getLocalFsURI();<NEW_LINE>URI rewrittenUri = null;<NEW_LINE>try {<NEW_LINE>rewrittenUri = new URI(defaultUri.getScheme(), null, defaultUri.getHost(), defaultUri.getPort(), fsUri.getPath(), null, null);<NEW_LINE>} catch (URISyntaxException e) {<NEW_LINE>// for local URIs, we make one more try to repair the path by making it absolute<NEW_LINE>if (defaultUri.getScheme().equals("file")) {<NEW_LINE>try {<NEW_LINE>rewrittenUri = new URI("file", null, new Path(new File(fsUri.getPath()).getAbsolutePath()).toUri().getPath(), null);<NEW_LINE>} catch (URISyntaxException ignored) {<NEW_LINE>// could not help it...<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (rewrittenUri != null) {<NEW_LINE>uri = rewrittenUri;<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("The file system URI '" + <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>// print a helpful pointer for malformed local URIs (happens a lot to new users)<NEW_LINE>if (uri.getScheme().equals("file") && uri.getAuthority() != null && !uri.getAuthority().isEmpty()) {<NEW_LINE>String supposedUri = "file:///" + uri.getAuthority() + uri.getPath();<NEW_LINE>throw new IllegalArgumentException("Found local file path with authority '" + uri.getAuthority() + "' in path '" + uri.toString() + "'. Hint: Did you forget a slash? (correct path would be '" + supposedUri + "')");<NEW_LINE>}<NEW_LINE>return uri;<NEW_LINE>} | fsUri + "' declares no scheme and cannot be interpreted relative to the default file system URI (" + defaultUri + ")."); |
93,197 | public static MetadataStore createInMemoryMetadataStore(Store<String, String, String> innerStore, int nodeId) {<NEW_LINE>StorageEngine<String, String, String> storesRepo = new InMemoryStorageEngine<String, String, String>("stores-repo");<NEW_LINE>List<Versioned<String>> versionedStoreList = <MASK><NEW_LINE>if (versionedStoreList != null && versionedStoreList.size() > 0) {<NEW_LINE>String stores = versionedStoreList.get(0).getValue();<NEW_LINE>StoreDefinitionsMapper mapper = new StoreDefinitionsMapper();<NEW_LINE>List<StoreDefinition> storeDefinitions = mapper.readStoreList(new StringReader(stores));<NEW_LINE>for (StoreDefinition storeDef : storeDefinitions) {<NEW_LINE>Versioned<String> versionedStoreValue = new Versioned<String>(mapper.writeStore(storeDef));<NEW_LINE>storesRepo.put(storeDef.getName(), versionedStoreValue, null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>MetadataStore store = new MetadataStore(innerStore, storesRepo);<NEW_LINE>store.initNodeId(nodeId);<NEW_LINE>return store;<NEW_LINE>} | innerStore.get(STORES_KEY, ""); |
108,461 | public void manageModels() {<NEW_LINE>// BEGIN: readme-sample-manageModels<NEW_LINE>AtomicReference<String> modelId = new AtomicReference<>();<NEW_LINE>// First, we see how many models we have, and what our limit is<NEW_LINE>AccountProperties accountProperties = documentModelAdminClient.getAccountProperties();<NEW_LINE>System.out.printf("The account has %s models, and we can have at most %s models", accountProperties.getDocumentModelCount(), accountProperties.getDocumentModelLimit());<NEW_LINE>// Next, we get a paged list of all of our models<NEW_LINE>PagedIterable<DocumentModelInfo> customDocumentModels = documentModelAdminClient.listModels();<NEW_LINE>System.out.println("We have following models in the account:");<NEW_LINE>customDocumentModels.forEach(documentModelInfo -> {<NEW_LINE>System.out.printf("Model ID: %s%n", documentModelInfo.getModelId());<NEW_LINE>modelId.set(documentModelInfo.getModelId());<NEW_LINE>// get custom document analysis model info<NEW_LINE>DocumentModel documentModel = documentModelAdminClient.getModel(documentModelInfo.getModelId());<NEW_LINE>System.out.printf("Model ID: %s%n", documentModel.getModelId());<NEW_LINE>System.out.printf("Model Description: %s%n", documentModel.getDescription());<NEW_LINE>System.out.printf("Model created on: %s%n", documentModel.getCreatedOn());<NEW_LINE>documentModel.getDocTypes().forEach((key, docTypeInfo) -> {<NEW_LINE>docTypeInfo.getFieldSchema().forEach((field, documentFieldSchema) -> {<NEW_LINE>System.out.printf("Field: %s", field);<NEW_LINE>System.out.printf("Field type: %s", documentFieldSchema.getType());<NEW_LINE>System.out.printf("Field confidence: %.2f", docTypeInfo.getFieldConfidence().get(field));<NEW_LINE>});<NEW_LINE>});<NEW_LINE>});<NEW_LINE>// Delete Model<NEW_LINE>documentModelAdminClient.<MASK><NEW_LINE>// END: readme-sample-manageModels<NEW_LINE>} | deleteModel(modelId.get()); |
1,105,709 | protected void exportLine(JRPrintLine line) throws IOException {<NEW_LINE>int x = line.getX() + getOffsetX();<NEW_LINE>int y = line.getY() + getOffsetY();<NEW_LINE>int height = line.getHeight();<NEW_LINE>int width = line.getWidth();<NEW_LINE>if (width <= 1 || height <= 1) {<NEW_LINE>if (width > 1) {<NEW_LINE>height = 0;<NEW_LINE>} else {<NEW_LINE>width = 0;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>contentWriter.write("{\\shp\\shpbxpage\\shpbypage\\shpwr5\\shpfhdr0\\shpz");<NEW_LINE>contentWriter.write(String.valueOf(zorder++));<NEW_LINE>contentWriter.write("\\shpleft");<NEW_LINE>contentWriter.write(String.valueOf(LengthUtil.twip(x)));<NEW_LINE>contentWriter.write("\\shpright");<NEW_LINE>contentWriter.write(String.valueOf(LengthUtil.<MASK><NEW_LINE>contentWriter.write("\\shptop");<NEW_LINE>contentWriter.write(String.valueOf(LengthUtil.twip(y)));<NEW_LINE>contentWriter.write("\\shpbottom");<NEW_LINE>contentWriter.write(String.valueOf(LengthUtil.twip(y + height)));<NEW_LINE>contentWriter.write("{\\shpinst");<NEW_LINE>contentWriter.write("{\\sp{\\sn shapeType}{\\sv 20}}");<NEW_LINE>exportPen(line.getLinePen());<NEW_LINE>if (line.getDirectionValue() == LineDirectionEnum.TOP_DOWN) {<NEW_LINE>contentWriter.write("{\\sp{\\sn fFlipV}{\\sv 0}}");<NEW_LINE>} else {<NEW_LINE>contentWriter.write("{\\sp{\\sn fFlipV}{\\sv 1}}");<NEW_LINE>}<NEW_LINE>contentWriter.write("}}\n");<NEW_LINE>} | twip(x + width))); |
399,175 | private void downloadResource(String execLocalPath, Map<String, String> projectRes, Logger logger) {<NEW_LINE>if (MapUtils.isEmpty(projectRes)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Set<Map.Entry<String, String>> resEntries = projectRes.entrySet();<NEW_LINE>for (Map.Entry<String, String> resource : resEntries) {<NEW_LINE>String fullName = resource.getKey();<NEW_LINE>String tenantCode = resource.getValue();<NEW_LINE>File resFile <MASK><NEW_LINE>if (!resFile.exists()) {<NEW_LINE>try {<NEW_LINE>// query the tenant code of the resource according to the name of the resource<NEW_LINE>String resHdfsPath = storageOperate.getResourceFileName(tenantCode, fullName);<NEW_LINE>logger.info("get resource file from hdfs :{}", resHdfsPath);<NEW_LINE>storageOperate.download(tenantCode, resHdfsPath, execLocalPath + File.separator + fullName, false, true);<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.error(e.getMessage(), e);<NEW_LINE>throw new ServiceException(e.getMessage());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>logger.info("file : {} exists ", resFile.getName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | = new File(execLocalPath, fullName); |
1,063,922 | private TagElement findTagElementToInsertAfter(List<TagElement> tags, String tagName) {<NEW_LINE>List<String> tagOrder = Arrays.asList(TagElement.TAG_AUTHOR, TagElement.TAG_VERSION, TagElement.TAG_PARAM, TagElement.TAG_RETURN, TagElement.TAG_THROWS, TagElement.TAG_EXCEPTION, TagElement.TAG_SEE, TagElement.TAG_SINCE, TagElement.TAG_SERIAL, TagElement.TAG_SERIALFIELD, TagElement.TAG_SERIALDATA, TagElement.TAG_DEPRECATED, TagElement.TAG_VALUE);<NEW_LINE>int goalOrdinal = tagOrder.indexOf(tagName);<NEW_LINE>if (goalOrdinal == -1) {<NEW_LINE>return (tags.isEmpty()) ? null : (TagElement) tags.get(tags.size());<NEW_LINE>}<NEW_LINE>for (int i = 0; i < tags.size(); i++) {<NEW_LINE>int tagOrdinal = tagOrder.indexOf(tags.get(i).getTagName());<NEW_LINE>if (tagOrdinal >= goalOrdinal) {<NEW_LINE>return (i == 0) ? null : (TagElement) tags.get(i - 1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return (tags.isEmpty()) ? null : (TagElement) tags.get(<MASK><NEW_LINE>} | tags.size() - 1); |
223,314 | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {<NEW_LINE>Context ctx = view.getContext();<NEW_LINE>mStatus = view.findViewById(R.id.status);<NEW_LINE>mHandler = new <MASK><NEW_LINE>mStatusIcon = view.findViewById(R.id.status_icon);<NEW_LINE>mConnectionsBtn = view.findViewById(R.id.show_connections);<NEW_LINE>mNumMalicious = view.findViewById(R.id.num_malicious);<NEW_LINE>mNumUpToDate = view.findViewById(R.id.num_up_to_date);<NEW_LINE>mNumChecked = view.findViewById(R.id.num_checked);<NEW_LINE>mLastUpdate = view.findViewById(R.id.last_update);<NEW_LINE>mDomainRules = view.findViewById(R.id.num_domain_rules);<NEW_LINE>mIPRules = view.findViewById(R.id.num_ip_rules);<NEW_LINE>mBlacklists = PCAPdroid.getInstance().getBlacklists();<NEW_LINE>mOkColor = ContextCompat.getColor(ctx, R.color.ok);<NEW_LINE>mWarnColor = ContextCompat.getColor(ctx, R.color.warning);<NEW_LINE>mDangerColor = ContextCompat.getColor(ctx, R.color.danger);<NEW_LINE>mTextColor = ContextCompat.getColor(ctx, R.color.highContrast);<NEW_LINE>mConnectionsBtn.setOnClickListener(v -> {<NEW_LINE>FilterDescriptor filter = new FilterDescriptor();<NEW_LINE>filter.onlyBlacklisted = true;<NEW_LINE>Intent intent = new Intent(requireContext(), ConnectionsActivity.class).putExtra(ConnectionsFragment.FILTER_EXTRA, filter);<NEW_LINE>startActivity(intent);<NEW_LINE>});<NEW_LINE>} | Handler(Looper.getMainLooper()); |
1,799,911 | public void run() {<NEW_LINE>// The TEE calls are asynchronous, and simulate a blocking call<NEW_LINE>// To avoid locking up the UI thread, a new one is started<NEW_LINE>new Thread() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>List<HdKeyNode> nextAccounts = masterseedScanManager.getNextUnusedAccounts();<NEW_LINE>MbwManager mbwManager = <MASK><NEW_LINE>if (!nextAccounts.isEmpty()) {<NEW_LINE>final UUID acc = mbwManager.getWalletManager(false).createAccounts(new ExternalSignaturesAccountConfig(nextAccounts, (LedgerManager) masterseedScanManager, nextAccounts.get(0).getIndex())).get(0);<NEW_LINE>mbwManager.getMetadataStorage().setOtherAccountBackupState(acc, MetadataStorage.BackupState.IGNORED);<NEW_LINE>runOnUiThread(new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>Intent result = new Intent();<NEW_LINE>result.putExtra("account", acc);<NEW_LINE>setResult(RESULT_OK, result);<NEW_LINE>finish();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}.start();<NEW_LINE>} | MbwManager.getInstance(LedgerAccountImportActivity.this); |
943,028 | public AirbyteConnectionStatus check(final JsonNode config) {<NEW_LINE>try {<NEW_LINE>final String datasetId = BigQueryUtils.getDatasetId(config);<NEW_LINE>final String datasetLocation = BigQueryUtils.getDatasetLocation(config);<NEW_LINE>final BigQuery bigquery = getBigQuery(config);<NEW_LINE>final UploadingMethod uploadingMethod = BigQueryUtils.getLoadingMethod(config);<NEW_LINE>BigQueryUtils.createSchemaTable(bigquery, datasetId, datasetLocation);<NEW_LINE>final QueryJobConfiguration queryConfig = QueryJobConfiguration.newBuilder(String.format("SELECT * FROM `%s.INFORMATION_SCHEMA.TABLES` LIMIT 1;", datasetId)).setUseLegacySql(false).build();<NEW_LINE>if (UploadingMethod.GCS.equals(uploadingMethod)) {<NEW_LINE>// TODO: use GcsDestination::check instead of writing our own custom logic to check perms<NEW_LINE>// this is not currently possible because using the Storage class to check perms requires<NEW_LINE>// a service account key, and the GCS destination does not accept a Service Account Key,<NEW_LINE>// only an HMAC key<NEW_LINE>final AirbyteConnectionStatus airbyteConnectionStatus = checkStorageIamPermissions(config);<NEW_LINE>if (Status.FAILED == airbyteConnectionStatus.getStatus()) {<NEW_LINE>return new AirbyteConnectionStatus().withStatus(Status.FAILED).withMessage(airbyteConnectionStatus.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final ImmutablePair<Job, String> result = BigQueryUtils.executeQuery(bigquery, queryConfig);<NEW_LINE>if (result.getLeft() != null) {<NEW_LINE>return new AirbyteConnectionStatus().withStatus(Status.SUCCEEDED);<NEW_LINE>} else {<NEW_LINE>return new AirbyteConnectionStatus().withStatus(Status.FAILED).withMessage(result.getRight());<NEW_LINE>}<NEW_LINE>} catch (final Exception e) {<NEW_LINE>LOGGER.info("Check failed.", e);<NEW_LINE>return new AirbyteConnectionStatus().withStatus(Status.FAILED).withMessage(e.getMessage() != null ? e.getMessage(<MASK><NEW_LINE>}<NEW_LINE>} | ) : e.toString()); |
1,195,402 | public void start() throws Exception {<NEW_LINE>// 1. Do prepare work<NEW_LINE>// create an instance of state manager<NEW_LINE>String statemgrClass = Context.stateManagerClass(config);<NEW_LINE>LOG.info("Context.stateManagerClass " + statemgrClass);<NEW_LINE>IStateManager statemgr;<NEW_LINE>try {<NEW_LINE>statemgr = ReflectionUtils.newInstance(statemgrClass);<NEW_LINE>} catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) {<NEW_LINE>throw new Exception(String.format("Failed to instantiate state manager class '%s'", statemgrClass), e);<NEW_LINE>}<NEW_LINE>// Put it in a try block so that we can always clean resources<NEW_LINE>try {<NEW_LINE>// initialize the statemgr<NEW_LINE>statemgr.initialize(config);<NEW_LINE>Boolean b = statemgr.setMetricsCacheLocation(metricsCacheLocation, topologyName).<MASK><NEW_LINE>if (b != null && b) {<NEW_LINE>LOG.info("metricsCacheLocation " + metricsCacheLocation.toString());<NEW_LINE>LOG.info("topologyName " + topologyName.toString());<NEW_LINE>LOG.info("Starting Metrics Cache HTTP Server");<NEW_LINE>metricsCacheManagerHttpServer.start();<NEW_LINE>// 2. The MetricsCacheServer would run in the main thread<NEW_LINE>// We do it in the final step since it would await the main thread<NEW_LINE>LOG.info("Starting Metrics Cache Server");<NEW_LINE>metricsCacheManagerServer.start();<NEW_LINE>metricsCacheManagerServerLoop.loop();<NEW_LINE>} else {<NEW_LINE>throw new RuntimeException("Failed to set metricscahe location.");<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>// 3. Do post work basing on the result<NEW_LINE>// Currently nothing to do here<NEW_LINE>// 4. Close the resources<NEW_LINE>SysUtils.closeIgnoringExceptions(statemgr);<NEW_LINE>}<NEW_LINE>} | get(5000, TimeUnit.MILLISECONDS); |
419,840 | private static byte[] rsaPrivateKeyToBlob(RSAPrivateCrtKey rsaPrivCrtKey) throws CryptoException {<NEW_LINE>try {<NEW_LINE>// 2316 sufficient for a 4096 bit RSA key<NEW_LINE>ByteBuffer bb = ByteBuffer.wrap(new byte[4096]);<NEW_LINE>bb.order(ByteOrder.LITTLE_ENDIAN);<NEW_LINE>// Write out the blob fields<NEW_LINE>// rsapubkey.magic<NEW_LINE>UnsignedUtil.putInt(bb, RSA_PRIV_MAGIC);<NEW_LINE>BigInteger modulus = rsaPrivCrtKey.getModulus();<NEW_LINE>int bitLength = modulus.bitLength();<NEW_LINE>// rsapubkey.bitlen<NEW_LINE>UnsignedUtil.putInt(bb, bitLength);<NEW_LINE>BigInteger publicExponent = rsaPrivCrtKey.getPublicExponent();<NEW_LINE>// rsapubkey.pubexp<NEW_LINE>UnsignedUtil.putInt(bb, (int) publicExponent.longValue());<NEW_LINE>int add8 = 0;<NEW_LINE>if ((bitLength % 8) != 0) {<NEW_LINE>add8++;<NEW_LINE>}<NEW_LINE>int add16 = 0;<NEW_LINE>if ((bitLength % 16) != 0) {<NEW_LINE>add16++;<NEW_LINE>}<NEW_LINE>// modulus<NEW_LINE>writeBigInteger(bb, modulus, (bitLength / 8) + add8);<NEW_LINE>// prime1<NEW_LINE>writeBigInteger(bb, rsaPrivCrtKey.getPrimeP(), (bitLength / 16) + add16);<NEW_LINE>// prime2<NEW_LINE>writeBigInteger(bb, rsaPrivCrtKey.getPrimeQ(), (bitLength / 16) + add16);<NEW_LINE>// exponent1<NEW_LINE>writeBigInteger(bb, rsaPrivCrtKey.getPrimeExponentP(), (bitLength / 16) + add16);<NEW_LINE>// exponent2<NEW_LINE>writeBigInteger(bb, rsaPrivCrtKey.getPrimeExponentQ(), (bitLength / 16) + add16);<NEW_LINE>// coefficient<NEW_LINE>writeBigInteger(bb, rsaPrivCrtKey.getCrtCoefficient(), (bitLength / 16) + add16);<NEW_LINE>// privateExponent<NEW_LINE>writeBigInteger(bb, rsaPrivCrtKey.getPrivateExponent(), (bitLength / 8) + add8);<NEW_LINE>return getBufferBytes(bb);<NEW_LINE>} catch (IOException ex) {<NEW_LINE>throw new CryptoException(res<MASK><NEW_LINE>}<NEW_LINE>} | .getString("NoConvertKeyToBlob.exception.message"), ex); |
442,556 | public void read(org.apache.thrift.protocol.TProtocol prot, getTopologyTasksToSupervisorIds_result struct) throws org.apache.thrift.TException {<NEW_LINE>TTupleProtocol iprot = (TTupleProtocol) prot;<NEW_LINE>BitSet <MASK><NEW_LINE>if (incoming.get(0)) {<NEW_LINE>{<NEW_LINE>org.apache.thrift.protocol.TMap _map238 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.STRING, iprot.readI32());<NEW_LINE>struct.success = new HashMap<Integer, String>(2 * _map238.size);<NEW_LINE>int _key239;<NEW_LINE>String _val240;<NEW_LINE>for (int _i241 = 0; _i241 < _map238.size; ++_i241) {<NEW_LINE>_key239 = iprot.readI32();<NEW_LINE>_val240 = iprot.readString();<NEW_LINE>struct.success.put(_key239, _val240);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>struct.set_success_isSet(true);<NEW_LINE>}<NEW_LINE>if (incoming.get(1)) {<NEW_LINE>struct.e = new NotAliveException();<NEW_LINE>struct.e.read(iprot);<NEW_LINE>struct.set_e_isSet(true);<NEW_LINE>}<NEW_LINE>} | incoming = iprot.readBitSet(2); |
389,496 | private OutboundSecurityResponse sign(SecurityEnvironment outboundEnv, OutboundTarget target) {<NEW_LINE>SignatureTarget signatureTarget = target.customObject(SignatureTarget.class).orElseThrow(() -> new SecurityException("Failed to find signature configuration for target " + target.name()));<NEW_LINE>Map<String, List<String>> newHeaders = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);<NEW_LINE>newHeaders.putAll(outboundEnv.headers());<NEW_LINE><MASK><NEW_LINE>LOGGER.finest("Creating request signature with kid: " + sigData.keyId());<NEW_LINE>OciHttpSignature signature = OciHttpSignature.sign(SignatureRequest.builder().env(outboundEnv).privateKey(sigData.privateKey()).keyId(sigData.keyId()).headersConfig(signatureTarget.signedHeadersConfig).newHeaders(newHeaders).build());<NEW_LINE>TOKEN_HANDLER.addHeader(newHeaders, signature.toSignatureHeader());<NEW_LINE>return OutboundSecurityResponse.builder().requestHeaders(newHeaders).status(SecurityResponse.SecurityStatus.SUCCESS).build();<NEW_LINE>} | OciSignatureData sigData = signatureData.get(); |
289,361 | public ParcelFileDescriptor openFile(@NonNull Uri uri, @NonNull String mode) throws FileNotFoundException {<NEW_LINE>Log.i(TAG, "openFile(" + <MASK><NEW_LINE>switch(uriMatcher.match(uri)) {<NEW_LINE>case SINGLE_ROW:<NEW_LINE>Log.i(TAG, "Fetching message body for a single row...");<NEW_LINE>File tmpFile = getFile(uri);<NEW_LINE>final int fileMode;<NEW_LINE>switch(mode) {<NEW_LINE>case "w":<NEW_LINE>fileMode = ParcelFileDescriptor.MODE_TRUNCATE | ParcelFileDescriptor.MODE_CREATE | ParcelFileDescriptor.MODE_WRITE_ONLY;<NEW_LINE>break;<NEW_LINE>case "r":<NEW_LINE>fileMode = ParcelFileDescriptor.MODE_READ_ONLY;<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new IllegalArgumentException("requested file mode unsupported");<NEW_LINE>}<NEW_LINE>Log.i(TAG, "returning file " + tmpFile.getAbsolutePath());<NEW_LINE>return ParcelFileDescriptor.open(tmpFile, fileMode);<NEW_LINE>}<NEW_LINE>throw new FileNotFoundException("Request for bad message.");<NEW_LINE>} | uri + ", " + mode + ")"); |
651,073 | public static DescriptorSupport mbeanDescriptor(final boolean immutable, final Class<?> intf, final boolean singleton, final boolean globalSingleton, final String group, final boolean supportsAdoption, final String[] subTypes) {<NEW_LINE>final DescriptorSupport desc = new DescriptorSupport();<NEW_LINE>if (intf == null || !intf.isInterface()) {<NEW_LINE>throw new IllegalArgumentException("interface class must be an interface");<NEW_LINE>}<NEW_LINE>desc.setField(DESC_STD_IMMUTABLE_INFO, immutable);<NEW_LINE>desc.setField(DESC_STD_INTERFACE_NAME, intf.getName());<NEW_LINE>desc.setField(DESC_IS_SINGLETON, singleton);<NEW_LINE>desc.setField(DESC_IS_GLOBAL_SINGLETON, globalSingleton);<NEW_LINE>desc.setField(DESC_GROUP, group);<NEW_LINE><MASK><NEW_LINE>if (subTypes != null) {<NEW_LINE>desc.setField(DESC_SUB_TYPES, subTypes);<NEW_LINE>}<NEW_LINE>return desc;<NEW_LINE>} | desc.setField(DESC_SUPPORTS_ADOPTION, supportsAdoption); |
102,522 | private LFCustoms findCustoms() {<NEW_LINE>// NOI18N<NEW_LINE>ResourceBundle b = bundle != null ? bundle : ResourceBundle.getBundle("org.netbeans.swing.plaf.Bundle");<NEW_LINE>// NOI18N<NEW_LINE>String <MASK><NEW_LINE>if ("default".equals(uiClassName)) {<NEW_LINE>// NOI18N<NEW_LINE>return findDefaultCustoms();<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Class klazz = UIUtils.classForName(uiClassName);<NEW_LINE>Object inst = klazz.newInstance();<NEW_LINE>if (inst instanceof LFCustoms)<NEW_LINE>return (LFCustoms) inst;<NEW_LINE>} catch (ClassNotFoundException e) {<NEW_LINE>// NOI18N<NEW_LINE>System.err.println("LF Customs " + uiClassName + " not on classpath.");<NEW_LINE>} catch (Exception e) {<NEW_LINE>// NOI18N<NEW_LINE>System.err.println("While loading: " + uiClassName);<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | uiClassName = b.getString("LookAndFeelCustomsClassName"); |
623,602 | public void removeExpireJobs(long expireTime) {<NEW_LINE>// remove finished tasks<NEW_LINE>List<KeyValueEntity> successEntityList = db.search(StateSearchKey.SUCCESS);<NEW_LINE>List<KeyValueEntity> failedEntityList = db.search(StateSearchKey.FAILED);<NEW_LINE>List<KeyValueEntity> entityList = new ArrayList<>(successEntityList);<NEW_LINE>entityList.addAll(failedEntityList);<NEW_LINE>for (KeyValueEntity entity : entityList) {<NEW_LINE>if (entity.getKey().startsWith(JobConstants.JOB_ID_PREFIX)) {<NEW_LINE>JobProfile profile = entity.getAsJobProfile();<NEW_LINE>long storeTime = profile.getLong(JobConstants.JOB_STORE_TIME, 0);<NEW_LINE>long currentTime = System.currentTimeMillis();<NEW_LINE>if (storeTime == 0 || currentTime - storeTime > expireTime) {<NEW_LINE>LOGGER.info("delete job {} because of timeout store time: {}, expire time: {}", entity.<MASK><NEW_LINE>deleteJob(entity.getKey());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getKey(), storeTime, expireTime); |
1,087,453 | void store(WizardDescriptor settings) {<NEW_LINE>File srcRoot = null;<NEW_LINE>String srcPath = moduleLocationTextField.getText();<NEW_LINE>if (srcPath.length() > 0) {<NEW_LINE>srcRoot = FileUtil.normalizeFile(new File(srcPath));<NEW_LINE>}<NEW_LINE>if (srcRoot != null)<NEW_LINE>UserProjectSettings.getDefault().setLastUsedImportLocation(srcRoot);<NEW_LINE>settings.putProperty(ProjectImportLocationWizardPanel.SOURCE_ROOT, srcRoot);<NEW_LINE>settings.putProperty(ProjectLocationWizardPanel.NAME, projectNameTextField.getText().trim());<NEW_LINE>final String projectLocation = projectLocationTextField.getText().trim();<NEW_LINE>if (projectLocation.length() >= 0) {<NEW_LINE>settings.putProperty(ProjectLocationWizardPanel.PROJECT_DIR, new File(projectLocation));<NEW_LINE>}<NEW_LINE>settings.putProperty(ProjectLocationWizardPanel.SHARED_LIBRARIES, sharableProject.isSelected() ? <MASK><NEW_LINE>} | librariesLocation.getText() : null); |
595,802 | protected T circularGet(final Provider<? extends T> provider, InternalContext context, final Dependency<?> dependency, @Nullable ProvisionListenerStackCallback<T> provisionCallback) throws InternalProvisionException {<NEW_LINE>final ConstructionContext<T> constructionContext = context.getConstructionContext(this);<NEW_LINE>// We have a circular reference between constructors. Return a proxy.<NEW_LINE>if (constructionContext.isConstructing()) {<NEW_LINE>Class<?> expectedType = dependency.getKey().getTypeLiteral().getRawType();<NEW_LINE>// TODO: if we can't proxy this object, can we proxy the other object?<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>T proxyType = (T) constructionContext.createProxy(context.getInjectorOptions(), expectedType);<NEW_LINE>return proxyType;<NEW_LINE>}<NEW_LINE>// Optimization: Don't go through the callback stack if no one's listening.<NEW_LINE>constructionContext.startConstruction();<NEW_LINE>try {<NEW_LINE>if (provisionCallback == null) {<NEW_LINE>return provision(provider, dependency, constructionContext);<NEW_LINE>} else {<NEW_LINE>return provisionCallback.provision(context, new ProvisionCallback<T>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public T call() throws InternalProvisionException {<NEW_LINE>return <MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>constructionContext.removeCurrentReference();<NEW_LINE>constructionContext.finishConstruction();<NEW_LINE>}<NEW_LINE>} | provision(provider, dependency, constructionContext); |
1,017,707 | public void marshall(CreateFunctionRequest createFunctionRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (createFunctionRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(createFunctionRequest.getFunctionName(), FUNCTIONNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFunctionRequest.getRuntime(), RUNTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFunctionRequest.getRole(), ROLE_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFunctionRequest.getHandler(), HANDLER_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFunctionRequest.getCode(), CODE_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFunctionRequest.getDescription(), DESCRIPTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFunctionRequest.getTimeout(), TIMEOUT_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFunctionRequest.getMemorySize(), MEMORYSIZE_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFunctionRequest.getPublish(), PUBLISH_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFunctionRequest.getVpcConfig(), VPCCONFIG_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFunctionRequest.getPackageType(), PACKAGETYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFunctionRequest.getDeadLetterConfig(), DEADLETTERCONFIG_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFunctionRequest.getEnvironment(), ENVIRONMENT_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFunctionRequest.getKMSKeyArn(), KMSKEYARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(createFunctionRequest.getTags(), TAGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFunctionRequest.getLayers(), LAYERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFunctionRequest.getFileSystemConfigs(), FILESYSTEMCONFIGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFunctionRequest.getImageConfig(), IMAGECONFIG_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFunctionRequest.getCodeSigningConfigArn(), CODESIGNINGCONFIGARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFunctionRequest.getArchitectures(), ARCHITECTURES_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFunctionRequest.getEphemeralStorage(), EPHEMERALSTORAGE_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | createFunctionRequest.getTracingConfig(), TRACINGCONFIG_BINDING); |
50,585 | public Object hash(DataCommandsParam dataCommandsParam) {<NEW_LINE>AutoCommandResult autoCommandResult = new AutoCommandResult();<NEW_LINE>String command = dataCommandsParam.getCommand();<NEW_LINE>String[] list = SignUtil.splitBySpace(command);<NEW_LINE>String cmd = command.toUpperCase();<NEW_LINE>String key = list[1];<NEW_LINE>String type = type(key);<NEW_LINE>long ttl = ttl(key);<NEW_LINE>Object result = null;<NEW_LINE>if (cmd.startsWith(HGETALL)) {<NEW_LINE>result = jedisCluster.hgetAll(key);<NEW_LINE>} else if (cmd.startsWith(HGET)) {<NEW_LINE>result = jedisCluster.hget(key, list[2]);<NEW_LINE>} else if (cmd.startsWith(HMGET)) {<NEW_LINE>String[] items = removeCommandAndKey(list);<NEW_LINE>result = jedisCluster.hmget(key, items);<NEW_LINE>} else if (cmd.startsWith(HKEYS)) {<NEW_LINE>result = jedisCluster.hkeys(key);<NEW_LINE>} else if (cmd.startsWith(HSET)) {<NEW_LINE>Map<String, String> hash = new HashMap<>();<NEW_LINE>String[] items = removeCommandAndKey(list);<NEW_LINE>for (int i = 0; i < items.length; i += 2) {<NEW_LINE>String subKey = items[i];<NEW_LINE>if (!Strings.isNullOrEmpty(subKey)) {<NEW_LINE>hash.put(subKey, items[i + 1]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>result = <MASK><NEW_LINE>}<NEW_LINE>autoCommandResult.setTtl(ttl);<NEW_LINE>autoCommandResult.setType(type);<NEW_LINE>autoCommandResult.setValue(result);<NEW_LINE>return autoCommandResult;<NEW_LINE>} | jedisCluster.hset(key, hash); |
121,567 | protected DBTraceInstruction doCreate(Range<Long> lifespan, Address address, InstructionPrototype prototype, ProcessorContextView context) throws CodeUnitInsertionException, AddressOverflowException {<NEW_LINE>Address endAddress = address.addNoWrap(prototype.getLength() - 1);<NEW_LINE>AddressRangeImpl createdRange = new AddressRangeImpl(address, endAddress);<NEW_LINE>// First, truncate lifespan to the next unit in the range, if end is unbounded<NEW_LINE>if (!lifespan.hasUpperBound()) {<NEW_LINE>lifespan = space.instructions.truncateSoonestDefined(lifespan, createdRange);<NEW_LINE>lifespan = space.definedData.truncateSoonestDefined(lifespan, createdRange);<NEW_LINE>}<NEW_LINE>// Second, truncate lifespan to the next change of bytes in the range<NEW_LINE>// Then, check that against existing code units.<NEW_LINE>DBTraceMemorySpace memSpace = space.trace.getMemoryManager().getMemorySpace(space.space, true);<NEW_LINE>long endSnap = <MASK><NEW_LINE>if (endSnap == Long.MIN_VALUE) {<NEW_LINE>endSnap = DBTraceUtils.upperEndpoint(lifespan);<NEW_LINE>} else {<NEW_LINE>endSnap--;<NEW_LINE>}<NEW_LINE>TraceAddressSnapRange tasr = new ImmutableTraceAddressSnapRange(createdRange, DBTraceUtils.toRange(DBTraceUtils.lowerEndpoint(lifespan), endSnap));<NEW_LINE>if (!space.undefinedData.coversRange(tasr)) {<NEW_LINE>// TODO: Figure out the conflicting unit or snap boundary?<NEW_LINE>throw new CodeUnitInsertionException("Code units cannot overlap");<NEW_LINE>}<NEW_LINE>doSetContexts(tasr, prototype.getLanguage(), context);<NEW_LINE>DBTraceInstruction created = space.instructionMapSpace.put(tasr, null);<NEW_LINE>created.set(prototype, context);<NEW_LINE>cacheForContaining.notifyNewEntry(lifespan, createdRange, created);<NEW_LINE>cacheForSequence.notifyNewEntry(lifespan, createdRange, created);<NEW_LINE>space.undefinedData.invalidateCache();<NEW_LINE>// TODO: Save the context register into the context manager? Flow it?<NEW_LINE>// TODO: Ensure cached undefineds don't extend into defined stuff<NEW_LINE>// TODO: Explicitly remove undefined from cache, or let weak refs take care of it?<NEW_LINE>return created;<NEW_LINE>} | memSpace.getFirstChange(lifespan, createdRange); |
1,506,332 | public void onMapReady(@Nullable MapController mapController) {<NEW_LINE>if (mapController == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>map = mapController;<NEW_LINE>String sceneUrl = sceneSelector.getCurrentString();<NEW_LINE>map.setSceneLoadListener(this);<NEW_LINE>LngLat startPoint = new LngLat(-74.00976419448854, 40.70532700869127);<NEW_LINE>map.updateCameraPosition(CameraUpdateFactory.newLngLatZoom(startPoint, 16));<NEW_LINE>Log.d("Tangram", "START SCENE LOAD");<NEW_LINE>map.loadSceneFileAsync(sceneUrl, sceneUpdates);<NEW_LINE>Marker p = map.addMarker();<NEW_LINE>p.setStylingFromPath(pointStylingPath);<NEW_LINE>p.setPoint(startPoint);<NEW_LINE>pointMarkers.add(p);<NEW_LINE>TouchInput touchInput = map.getTouchInput();<NEW_LINE>touchInput.setTapResponder(this);<NEW_LINE>touchInput.setDoubleTapResponder(this);<NEW_LINE>touchInput.setLongPressResponder(this);<NEW_LINE>map.setFeaturePickListener(this);<NEW_LINE>map.setLabelPickListener(this);<NEW_LINE>map.setMarkerPickListener(this);<NEW_LINE>map.setMapChangeListener(new MapChangeListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onViewComplete() {<NEW_LINE>Log.d(TAG, "View complete");<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onRegionWillChange(boolean animated) {<NEW_LINE>Log.d(TAG, "On Region Will Change Animated: " + animated);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onRegionIsChanging() {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onRegionDidChange(boolean animated) {<NEW_LINE>Log.d(TAG, "On Region Did Change Animated: " + animated);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>map.updateCameraPosition(CameraUpdateFactory.newLngLatZoom(new LngLat(-74.00976419448854, 40.70532700869127), 16));<NEW_LINE>mapData = map.addDataLayer("touch");<NEW_LINE>map.setPickRadius(10);<NEW_LINE>} | Log.d(TAG, "On Region Is Changing"); |
1,487,163 | final PutAccountConfigurationResult executePutAccountConfiguration(PutAccountConfigurationRequest putAccountConfigurationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(putAccountConfigurationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<PutAccountConfigurationRequest> request = null;<NEW_LINE>Response<PutAccountConfigurationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new PutAccountConfigurationRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(putAccountConfigurationRequest));<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, "ACM");<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<PutAccountConfigurationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new PutAccountConfigurationResultJsonUnmarshaller());<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, "PutAccountConfiguration"); |
1,116,056 | public static String stringify(Thread thread, StackTraceElement[] elements) {<NEW_LINE>StringBuilder builder = new StringBuilder().append('"').append(thread.getName()).append('"').append(thread.isDaemon() ? " daemon" : "").append(" prio=").append(thread.getPriority()).append(" tid=").append(thread.getId()).append(' ').append(thread.getState().name().toLowerCase<MASK><NEW_LINE>builder.append(" ").append(State.class.getName()).append(": ").append(thread.getState().name().toUpperCase()).append('\n');<NEW_LINE>for (StackTraceElement element : elements) {<NEW_LINE>builder.append(" at ").append(element.getClassName()).append('.').append(element.getMethodName());<NEW_LINE>if (element.isNativeMethod()) {<NEW_LINE>builder.append("(Native method)");<NEW_LINE>} else if (element.getFileName() == null) {<NEW_LINE>builder.append("(Unknown source)");<NEW_LINE>} else {<NEW_LINE>builder.append('(').append(element.getFileName()).append(':').append(element.getLineNumber()).append(')');<NEW_LINE>}<NEW_LINE>builder.append("\n");<NEW_LINE>}<NEW_LINE>return builder.toString();<NEW_LINE>} | ()).append('\n'); |
1,324,771 | protected Action process() throws IOException {<NEW_LINE>cipherBuffer = byteBufferPool.acquire(connection.getOutputBufferSize(), connection.isUseOutputDirectByteBuffers());<NEW_LINE>int pos = BufferUtil.flipToFill(cipherBuffer);<NEW_LINE>int drained = quicheConnection.drainCipherBytes(cipherBuffer);<NEW_LINE>if (LOG.isDebugEnabled())<NEW_LINE>LOG.debug("drained {} byte(s) of cipher bytes from {}", drained, QuicSession.this);<NEW_LINE>long nextTimeoutInMs = quicheConnection.nextTimeout();<NEW_LINE>if (LOG.isDebugEnabled())<NEW_LINE>LOG.debug("next quiche timeout: {} ms on {}", nextTimeoutInMs, QuicSession.this);<NEW_LINE>if (nextTimeoutInMs < 0)<NEW_LINE>timeout.cancel();<NEW_LINE>else<NEW_LINE>timeout.schedule(nextTimeoutInMs, TimeUnit.MILLISECONDS);<NEW_LINE>if (drained == 0) {<NEW_LINE>boolean connectionClosed = quicheConnection.isConnectionClosed();<NEW_LINE>Action action = connectionClosed ? Action.SUCCEEDED : Action.IDLE;<NEW_LINE>if (LOG.isDebugEnabled())<NEW_LINE>LOG.debug("connection draining={} closed={}, action={} on {}", quicheConnection.isDraining(), connectionClosed, action, QuicSession.this);<NEW_LINE>if (action == Action.IDLE)<NEW_LINE>byteBufferPool.release(cipherBuffer);<NEW_LINE>return action;<NEW_LINE>}<NEW_LINE>BufferUtil.flipToFlush(cipherBuffer, pos);<NEW_LINE>if (LOG.isDebugEnabled())<NEW_LINE>LOG.debug(<MASK><NEW_LINE>connection.write(this, remoteAddress, cipherBuffer);<NEW_LINE>return Action.SCHEDULED;<NEW_LINE>} | "writing cipher bytes for {} on {}", remoteAddress, QuicSession.this); |
457,156 | static Properties buildJdbcProperties(DatabaseConfig config) {<NEW_LINE>Properties props = new Properties();<NEW_LINE>Optional<RemoteDatabaseConfig> rc = config.getRemoteDatabaseConfig();<NEW_LINE>// add default params<NEW_LINE>switch(config.getType()) {<NEW_LINE>case "h2":<NEW_LINE>// nothing<NEW_LINE>break;<NEW_LINE>case "postgresql":<NEW_LINE>// seconds<NEW_LINE>props.setProperty("loginTimeout", Integer.toString(rc.get().getLoginTimeout()));<NEW_LINE>// seconds<NEW_LINE>props.setProperty("socketTimeout", Integer.toString(rc.get().getSocketTimeout()));<NEW_LINE><MASK><NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new ConfigException("Unsupported database type: " + config.getType());<NEW_LINE>}<NEW_LINE>if (config.getRemoteDatabaseConfig().isPresent()) {<NEW_LINE>props.setProperty("user", rc.get().getUser());<NEW_LINE>props.setProperty("password", rc.get().getPassword());<NEW_LINE>if (rc.get().getSsl()) {<NEW_LINE>props.setProperty("ssl", "true");<NEW_LINE>// disable server certificate validation<NEW_LINE>props.setProperty("sslfactory", "org.postgresql.ssl.NonValidatingFactory");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Map.Entry<String, String> pair : config.getOptions().entrySet()) {<NEW_LINE>props.setProperty(pair.getKey(), pair.getValue());<NEW_LINE>}<NEW_LINE>return props;<NEW_LINE>} | props.setProperty("tcpKeepAlive", "true"); |
27,345 | private static void tryInKeywordPattern(RegressionEnvironment env, String field, SupportInKeywordBean prototype, AtomicInteger milestone) {<NEW_LINE>String epl = "@name('s0') select * from pattern[every a=SupportInKeywordBean -> SupportBean(intPrimitive in (a." + field + "))]";<NEW_LINE>env.compileDeployAddListenerMile(epl, "s0", milestone.getAndIncrement());<NEW_LINE>assertInKeywordReceivedPattern(env, SerializableObjectCopier.copyMayFail<MASK><NEW_LINE>assertInKeywordReceivedPattern(env, SerializableObjectCopier.copyMayFail(prototype), 2, true);<NEW_LINE>assertInKeywordReceivedPattern(env, SerializableObjectCopier.copyMayFail(prototype), 3, false);<NEW_LINE>if (hasFilterIndexPlanBasicOrMore(env)) {<NEW_LINE>SupportFilterServiceHelper.assertFilterSvcByTypeMulti(env, "s0", "SupportBean", new FilterItem[][] { { new FilterItem("intPrimitive", FilterOperator.IN_LIST_OF_VALUES) } });<NEW_LINE>}<NEW_LINE>env.undeployAll();<NEW_LINE>} | (prototype), 1, true); |
1,044,920 | private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(String resourceGroupName, String registryName, String taskName, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (registryName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter registryName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (taskName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter taskName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String apiVersion = "2019-04-01";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, <MASK><NEW_LINE>} | registryName, apiVersion, taskName, context); |
1,433,741 | private static List<JvmInstallationMetadata> discoverLocalInstallations() {<NEW_LINE>ExecHandleFactory execHandleFactory = TestFiles.execHandleFactory();<NEW_LINE>TemporaryFileProvider temporaryFileProvider = TestFiles.tmpDirTemporaryFileProvider(new File(SystemProperties.getInstance().getJavaIoTmpDir()));<NEW_LINE>DefaultJvmMetadataDetector defaultJvmMetadataDetector = new DefaultJvmMetadataDetector(execHandleFactory, temporaryFileProvider);<NEW_LINE>JvmMetadataDetector metadataDetector = new CachingJvmMetadataDetector(defaultJvmMetadataDetector);<NEW_LINE>final List<JvmInstallationMetadata> jvms = new JavaInstallationRegistry(defaultInstallationSuppliers(), new TestBuildOperationExecutor(), OperatingSystem.current()).listInstallations().stream().map(InstallationLocation::getLocation).map(metadataDetector::getMetadata).filter(JvmInstallationMetadata::isValidInstallation).sorted(Comparator.comparing(JvmInstallationMetadata::getDisplayName).thenComparing(JvmInstallationMetadata::getLanguageVersion)).collect(Collectors.toList());<NEW_LINE><MASK><NEW_LINE>for (JvmInstallationMetadata jvm : jvms) {<NEW_LINE>String name = jvm.getDisplayName() + " " + jvm.getImplementationVersion() + " ";<NEW_LINE>System.out.println(" " + name + " - " + jvm.getJavaHome());<NEW_LINE>}<NEW_LINE>return jvms;<NEW_LINE>} | System.out.println("Found the following JVMs:"); |
732,895 | final DeregisterTargetsResult executeDeregisterTargets(DeregisterTargetsRequest deregisterTargetsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deregisterTargetsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeregisterTargetsRequest> request = null;<NEW_LINE>Response<DeregisterTargetsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeregisterTargetsRequestMarshaller().marshall(super.beforeMarshalling(deregisterTargetsRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeregisterTargets");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DeregisterTargetsResult> responseHandler = new StaxResponseHandler<DeregisterTargetsResult>(new DeregisterTargetsResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.SERVICE_ID, "Elastic Load Balancing v2"); |
1,150,808 | protected static void parseJSON(JSONObject json, MapObject o) {<NEW_LINE>if (json.has("name")) {<NEW_LINE>o.name = json.getString("name");<NEW_LINE>}<NEW_LINE>if (json.has("enName")) {<NEW_LINE>o.enName = json.getString("enName");<NEW_LINE>}<NEW_LINE>if (json.has("names")) {<NEW_LINE>JSONObject namesObj = json.getJSONObject("names");<NEW_LINE>o.names = new HashMap<>();<NEW_LINE>Iterator<String> iterator = namesObj.keys();<NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>String key = iterator.next();<NEW_LINE>String value = namesObj.getString(key);<NEW_LINE>o.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (json.has("lat") && json.has("lon")) {<NEW_LINE>o.location = new LatLon(json.getDouble("lat"), json.getDouble("lon"));<NEW_LINE>}<NEW_LINE>if (json.has("id")) {<NEW_LINE>o.id = json.getLong("id");<NEW_LINE>}<NEW_LINE>} | names.put(key, value); |
665,841 | public Optional<FileResource> resolveUri(final ResourceRequestContext resourceRequestContext) {<NEW_LINE>final String effectiveUri = resourceRequestContext.getUri();<NEW_LINE>final DomainConfig domainConfig = resourceRequestContext.getDomainConfig();<NEW_LINE>final String embedThemeUrl = ResourceFileServlet.RESOURCE_PATH + ResourceFileServlet.THEME_CSS_PATH.replace(ResourceFileServlet.TOKEN_THEME, ResourceFileServlet.EMBED_THEME);<NEW_LINE>final String embedThemeMobileUrl = ResourceFileServlet.RESOURCE_PATH + ResourceFileServlet.THEME_CSS_MOBILE_PATH.replace(ResourceFileServlet.TOKEN_THEME, ResourceFileServlet.EMBED_THEME);<NEW_LINE>if (effectiveUri.equalsIgnoreCase(embedThemeUrl)) {<NEW_LINE>return Optional.of(new ConfigSettingFileResource(PwmSetting<MASK><NEW_LINE>} else if (effectiveUri.equalsIgnoreCase(embedThemeMobileUrl)) {<NEW_LINE>return Optional.of(new ConfigSettingFileResource(PwmSetting.DISPLAY_CSS_MOBILE_EMBED, domainConfig, effectiveUri));<NEW_LINE>}<NEW_LINE>return Optional.empty();<NEW_LINE>} | .DISPLAY_CSS_EMBED, domainConfig, effectiveUri)); |
732,834 | private Map<FieldDescriptor, FieldAccessDescriptor> resolveNestedFieldsAccessed(Schema schema) {<NEW_LINE>Map<FieldDescriptor, FieldAccessDescriptor> nestedFields = Maps.newLinkedHashMap();<NEW_LINE>for (Map.Entry<FieldDescriptor, FieldAccessDescriptor> entry : getNestedFieldsAccessed().entrySet()) {<NEW_LINE>FieldDescriptor fieldDescriptor = entry.getKey();<NEW_LINE>FieldAccessDescriptor fieldAccessDescriptor = entry.getValue();<NEW_LINE>validateFieldDescriptor(schema, fieldDescriptor);<NEW_LINE>// Resolve the field id of the field that has nested access.<NEW_LINE>if (entry.getKey().getFieldId() == null) {<NEW_LINE>fieldDescriptor = fieldDescriptor.toBuilder().setFieldId(schema.indexOf(fieldDescriptor.getFieldName())).build();<NEW_LINE>} else if (entry.getKey().getFieldName() == null) {<NEW_LINE>fieldDescriptor = fieldDescriptor.toBuilder().setFieldName(schema.nameOf(fieldDescriptor.getFieldId())).build();<NEW_LINE>}<NEW_LINE>fieldDescriptor = fillInMissingQualifiers(fieldDescriptor, schema);<NEW_LINE>// fieldType should now be the row we are selecting from, so recursively resolve it and<NEW_LINE>// store the result in the list of resolved nested fields.<NEW_LINE>fieldAccessDescriptor = fieldAccessDescriptor.resolve(getFieldDescriptorSchema(fieldDescriptor, schema));<NEW_LINE>// We might still have duplicate FieldDescriptors, even if union was called earlier. Until<NEW_LINE>// resolving against an actual schema we might not have been to tell that two<NEW_LINE>// FieldDescriptors were equivalent.<NEW_LINE>nestedFields.merge(fieldDescriptor, fieldAccessDescriptor, (d1, d2) -> union(ImmutableList.<MASK><NEW_LINE>}<NEW_LINE>return nestedFields;<NEW_LINE>} | of(d1, d2))); |
1,377,487 | public void testSimpleQuery(HttpServletRequest req, HttpServletResponse resp) throws Exception {<NEW_LINE>QueryClient client = builder.build(QueryClient.class);<NEW_LINE>Query query = new Query();<NEW_LINE>query.setOperationName("allWidgets");<NEW_LINE>query.setQuery("query allWidgets {" + System.lineSeparator() + " allWidgets {" + System.lineSeparator() + " name," + System.lineSeparator() + " quantity" + System.lineSeparator() + " }" + System.lineSeparator() + "}");<NEW_LINE>WidgetQueryResponse response = client.allWidgets(query);<NEW_LINE>System.out.println("Response: " + response);<NEW_LINE>List<Widget> widgets = response<MASK><NEW_LINE>assertEquals(2, widgets.size());<NEW_LINE>for (Widget widget : widgets) {<NEW_LINE>String name = widget.getName();<NEW_LINE>assertNotNull(name);<NEW_LINE>if ("Notebook".equals(name)) {<NEW_LINE>assertEquals(20, widget.getQuantity());<NEW_LINE>} else if ("Pencil".equals(name)) {<NEW_LINE>assertEquals(200, widget.getQuantity());<NEW_LINE>} else {<NEW_LINE>fail("Unexpected widget: " + widget);<NEW_LINE>}<NEW_LINE>// weight wasn't specified in the query<NEW_LINE>assertEquals(-1.0, widget.getWeight(), 0.1);<NEW_LINE>}<NEW_LINE>} | .getData().getAllWidgets(); |
1,188,489 | private Menu createHistoryMenu(ToolItem toolItem, final String preferenceName, Menu menu) {<NEW_LINE>ToolBar toolbar = toolItem.getParent();<NEW_LINE>Rectangle bounds = toolItem.getBounds();<NEW_LINE>Point point = toolbar.toDisplay(new Point(bounds.x, bounds.y + bounds.height));<NEW_LINE>List<String> loadEntries = findBarEntriesHelper.loadEntries(preferenceName);<NEW_LINE>if (menu != null && !menu.isDisposed()) {<NEW_LINE>menu.dispose();<NEW_LINE>}<NEW_LINE>menu = new Menu(UIUtils.getActiveShell(), (toolbar.getStyle() & (SWT.RIGHT_TO_LEFT | SWT.LEFT_TO_RIGHT)) | SWT.POP_UP);<NEW_LINE>if (!CollectionsUtil.isEmpty(loadEntries)) {<NEW_LINE>int i = 0;<NEW_LINE>for (final String item : loadEntries) {<NEW_LINE>final MenuItem menuItem = new MenuItem(menu, SWT.NONE);<NEW_LINE>menuItem.setData<MASK><NEW_LINE>menuItem.setText(StringUtil.truncate(NEWLINE_SANITIZER.searchAndReplace(item), 30));<NEW_LINE>menuItem.addSelectionListener(new SelectionAdapter() {<NEW_LINE><NEW_LINE>public void widgetSelected(SelectionEvent e) {<NEW_LINE>if (FindBarEntriesHelper.PREFERENCE_NAME_REPLACE.equals(preferenceName)) {<NEW_LINE>lastReplaceHistory = (Integer) menuItem.getData();<NEW_LINE>} else {<NEW_LINE>lastFindHistory = (Integer) menuItem.getData();<NEW_LINE>}<NEW_LINE>updateTextAfterHistorySelection(item, preferenceName);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>MenuItem menuItem = new MenuItem(menu, SWT.NONE);<NEW_LINE>menuItem.setText(Messages.FindBarDecorator_LABEL_No_History);<NEW_LINE>}<NEW_LINE>menu.setLocation(point.x, point.y);<NEW_LINE>menu.setVisible(true);<NEW_LINE>return menu;<NEW_LINE>} | (Integer.valueOf(i)); |
905,327 | public MethodWriter generateTagStart() throws JspCoreException {<NEW_LINE>tagStartWriter = new MethodWriter();<NEW_LINE>if (hasBody) {<NEW_LINE>// LIDB4147-24<NEW_LINE>if (!jspOptions.isDisableResourceInjection()) {<NEW_LINE>// PM06063<NEW_LINE>// have CDI create and inject the managed object<NEW_LINE>tagStartWriter.print("com.ibm.ws.managedobject.ManagedObject " + tagHandlerVar + "_mo = ");<NEW_LINE>tagStartWriter.print("_jspx_iaHelper.inject(");<NEW_LINE>tagStartWriter.print(tagClassInfo.getTagClassName() + ".class");<NEW_LINE>tagStartWriter.println(");");<NEW_LINE>// get the underlying object from the managed object<NEW_LINE>tagStartWriter.print(tagClassInfo.getTagClassName());<NEW_LINE>tagStartWriter.print(" ");<NEW_LINE>tagStartWriter.print(tagHandlerVar);<NEW_LINE>tagStartWriter.print(" = ");<NEW_LINE>tagStartWriter.println("(" + tagClassInfo.getTagClassName() + ")" + tagHandlerVar + "_mo.getObject();");<NEW_LINE>tagStartWriter.print("_jspx_iaHelper.doPostConstruct(");<NEW_LINE>tagStartWriter.print(tagHandlerVar);<NEW_LINE>tagStartWriter.println(");");<NEW_LINE>tagStartWriter.print("_jspx_iaHelper.addTagHandlerToCdiMap(");<NEW_LINE>tagStartWriter.print(tagHandlerVar + ", " + tagHandlerVar + "_mo");<NEW_LINE>tagStartWriter.println(");");<NEW_LINE>} else {<NEW_LINE>// not using CDI<NEW_LINE>tagStartWriter.<MASK><NEW_LINE>tagStartWriter.print(" ");<NEW_LINE>tagStartWriter.print(tagHandlerVar);<NEW_LINE>tagStartWriter.print(" = ");<NEW_LINE>tagStartWriter.print("new ");<NEW_LINE>tagStartWriter.print(tagClassInfo.getTagClassName());<NEW_LINE>tagStartWriter.print("();");<NEW_LINE>tagStartWriter.println();<NEW_LINE>}<NEW_LINE>tagStartWriter.println();<NEW_LINE>}<NEW_LINE>return tagStartWriter;<NEW_LINE>} | print(tagClassInfo.getTagClassName()); |
787,378 | public static <E extends @Nullable Object> Multiset<E> intersection(final Multiset<E> multiset1, final Multiset<?> multiset2) {<NEW_LINE>checkNotNull(multiset1);<NEW_LINE>checkNotNull(multiset2);<NEW_LINE>return new ViewMultiset<E>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public int count(@CheckForNull Object element) {<NEW_LINE>int <MASK><NEW_LINE>return (count1 == 0) ? 0 : Math.min(count1, multiset2.count(element));<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>Set<E> createElementSet() {<NEW_LINE>return Sets.intersection(multiset1.elementSet(), multiset2.elementSet());<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>Iterator<E> elementIterator() {<NEW_LINE>throw new AssertionError("should never be called");<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>Iterator<Entry<E>> entryIterator() {<NEW_LINE>final Iterator<Entry<E>> iterator1 = multiset1.entrySet().iterator();<NEW_LINE>// TODO(lowasser): consider making the entries live views<NEW_LINE>return new AbstractIterator<Entry<E>>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>@CheckForNull<NEW_LINE>protected Entry<E> computeNext() {<NEW_LINE>while (iterator1.hasNext()) {<NEW_LINE>Entry<E> entry1 = iterator1.next();<NEW_LINE>E element = entry1.getElement();<NEW_LINE>int count = Math.min(entry1.getCount(), multiset2.count(element));<NEW_LINE>if (count > 0) {<NEW_LINE>return immutableEntry(element, count);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return endOfData();<NEW_LINE>}<NEW_LINE>};<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | count1 = multiset1.count(element); |
1,307,803 | private <N, E> OrthogonalRepresentation<N, E> computeOrthogonalRepresentation(FlowNetwork<N, E> network) {<NEW_LINE>OrthogonalRepresentation<N, E> or = OrthogonalRepresentation.createGraph(network.getOriginalGraph());<NEW_LINE>for (Arc<N> arc : network.getArcs()) {<NEW_LINE>if (arc.isVertexArc()) {<NEW_LINE>Vertex<N> v = arc.getSourceNode().getVertex();<NEW_LINE>Face f = arc.getDestinationNode().getFace();<NEW_LINE>OrthogonalShape shape = or.getShape(f);<NEW_LINE>Dart d = arc.getDart();<NEW_LINE>Tuple t = shape.getTuple(d);<NEW_LINE>t.setAngles(arc.getFlow() + 1);<NEW_LINE>} else if (arc.isFaceArc()) {<NEW_LINE>Node<N> srcNode = arc.getSourceNode();<NEW_LINE>Node<N> destNode = arc.getDestinationNode();<NEW_LINE>Face f = srcNode.getFace();<NEW_LINE>Arc<N> reverseArc = destNode.getArcToVia(srcNode, arc.getDart());<NEW_LINE>OrthogonalShape shape = or.getShape(f);<NEW_LINE><MASK><NEW_LINE>Tuple t = shape.getTuple(d);<NEW_LINE>BitSet bends = t.getBends();<NEW_LINE>int forwardFlow = arc.getFlow();<NEW_LINE>int reverseFlow = reverseArc.getFlow();<NEW_LINE>int sum = forwardFlow + reverseFlow;<NEW_LINE>if (sum == 0) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>for (int i = 0; i < forwardFlow; i++) {<NEW_LINE>bends.clear(i);<NEW_LINE>}<NEW_LINE>for (int i = forwardFlow; i < sum; i++) {<NEW_LINE>bends.set(i);<NEW_LINE>}<NEW_LINE>bends.set(sum);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return or;<NEW_LINE>} | Dart d = arc.getDart(); |
1,192,379 | private void addField(QueryProfilesConfig.Queryprofile.Builder qpB, QueryProfile profile, Entry<String, Object> field, String namePrefix) {<NEW_LINE>String fullName = namePrefix + field.getKey();<NEW_LINE>if (field.getValue() instanceof QueryProfile) {<NEW_LINE>QueryProfile subProfile = (QueryProfile) field.getValue();<NEW_LINE>if (!subProfile.isExplicit()) {<NEW_LINE>// Implicitly defined profile - add content<NEW_LINE>addFieldChildren(qpB, subProfile, fullName + ".");<NEW_LINE>} else {<NEW_LINE>// Reference to an id'ed profile - output reference plus any local overrides<NEW_LINE>QueryProfilesConfig.Queryprofile.Reference.Builder refB = new QueryProfilesConfig.Queryprofile.Reference.Builder();<NEW_LINE>createReferenceFieldConfig(refB, profile, fullName, field.getKey(), ((BackedOverridableQueryProfile) subProfile).getBacking().<MASK><NEW_LINE>qpB.reference(refB);<NEW_LINE>addFieldChildren(qpB, subProfile, fullName + ".");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// a primitive<NEW_LINE>qpB.property(createPropertyFieldConfig(profile, fullName, field.getKey(), field.getValue()));<NEW_LINE>}<NEW_LINE>} | getId().stringValue()); |
1,328,611 | public void onGetEditorContext(GetEditorContextEvent event) {<NEW_LINE>GetEditorContextEvent.<MASK><NEW_LINE>int type = data.getType();<NEW_LINE>if (type == GetEditorContextEvent.TYPE_ACTIVE_EDITOR) {<NEW_LINE>if (consoleEditorHadFocusLast() || !columnManager_.hasActiveEditor())<NEW_LINE>type = GetEditorContextEvent.TYPE_CONSOLE_EDITOR;<NEW_LINE>else<NEW_LINE>type = GetEditorContextEvent.TYPE_SOURCE_EDITOR;<NEW_LINE>}<NEW_LINE>if (type == GetEditorContextEvent.TYPE_CONSOLE_EDITOR) {<NEW_LINE>InputEditorDisplay editor = consoleEditorProvider_.getConsoleEditor();<NEW_LINE>if (editor != null && editor instanceof DocDisplay) {<NEW_LINE>SourceColumnManager.getEditorContext("#console", "", (DocDisplay) editor, server_);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} else if (type == GetEditorContextEvent.TYPE_SOURCE_EDITOR) {<NEW_LINE>if (columnManager_.requestActiveEditorContext())<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// We need to ensure a 'getEditorContext' event is always<NEW_LINE>// returned as we have a 'wait-for' event on the server side<NEW_LINE>server_.getEditorContextCompleted(GetEditorContextEvent.SelectionData.create(), new VoidServerRequestCallback());<NEW_LINE>} | Data data = event.getData(); |
1,204,614 | public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {<NEW_LINE>this.locale = ProtocolUtils.readString(buf, 16);<NEW_LINE>this.viewDistance = buf.readByte();<NEW_LINE>this.chatVisibility = ProtocolUtils.readVarInt(buf);<NEW_LINE>this.chatColors = buf.readBoolean();<NEW_LINE>if (version.compareTo(ProtocolVersion.MINECRAFT_1_7_6) <= 0) {<NEW_LINE>this.difficulty = buf.readByte();<NEW_LINE>}<NEW_LINE>this.skinParts = buf.readUnsignedByte();<NEW_LINE>if (version.compareTo(ProtocolVersion.MINECRAFT_1_9) >= 0) {<NEW_LINE>this.mainHand = ProtocolUtils.readVarInt(buf);<NEW_LINE>if (version.compareTo(ProtocolVersion.MINECRAFT_1_17) >= 0) {<NEW_LINE>this<MASK><NEW_LINE>if (version.compareTo(ProtocolVersion.MINECRAFT_1_18) >= 0) {<NEW_LINE>this.clientListingAllowed = buf.readBoolean();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .chatFilteringEnabled = buf.readBoolean(); |
449,175 | private void reduceLedgers(Staff staff, int index, List<LedgerInter> ledgers) {<NEW_LINE>final int interline = staff.getSpecificInterline();<NEW_LINE>int maxDx = largeScale.toPixels(constants.maxInterLedgerDx);<NEW_LINE>Set<Exclusion> exclusions = new LinkedHashSet<>();<NEW_LINE>Collections.sort(ledgers, Inters.byAbscissa);<NEW_LINE>for (int i = 0; i < ledgers.size(); i++) {<NEW_LINE>final LedgerInter ledger = ledgers.get(i);<NEW_LINE>final Rectangle ledgerBox = ledger.getBounds();<NEW_LINE>final Rectangle fatBox = ledger.getBounds();<NEW_LINE>fatBox.grow(maxDx, interline);<NEW_LINE>// Check neighbors on the right only (since we are browsing a sorted list)<NEW_LINE>for (LedgerInter other : ledgers.subList(i + 1, ledgers.size())) {<NEW_LINE>if (GeoUtil.xOverlap(ledgerBox, other.getBounds()) > 0) {<NEW_LINE>// Abscissa overlap<NEW_LINE>exclusions.add(sig.insertExclusion(ledger, other, Exclusion.ExclusionCause.OVERLAP));<NEW_LINE>} else {<NEW_LINE>// End of reachable neighbors<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!exclusions.isEmpty()) {<NEW_LINE>Set<Inter> deletions = sig.reduceExclusions(exclusions);<NEW_LINE>logger.debug("Staff: {} index: {} deletions: {} {}", staff.getId(), index, <MASK><NEW_LINE>ledgers.removeAll(deletions);<NEW_LINE>}<NEW_LINE>} | deletions.size(), deletions); |
1,833,191 | public static void test(DataSet set, PerceptronAmbiguityResolver resolver) {<NEW_LINE>int hit = 0, total = 0;<NEW_LINE>Stopwatch sw = Stopwatch.createStarted();<NEW_LINE>for (SentenceAnalysis sentence : set.sentences) {<NEW_LINE>DecodeResult result = resolver.getDecoder().bestPath(sentence.ambiguousAnalysis());<NEW_LINE>int i = 0;<NEW_LINE>List<SingleAnalysis> bestExpected = sentence.bestAnalysis();<NEW_LINE>for (SingleAnalysis bestActual : result.bestParse) {<NEW_LINE>if (bestExpected.get(i).equals(bestActual)) {<NEW_LINE>hit++;<NEW_LINE>}<NEW_LINE>total++;<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Log.info("Elapsed: " + sw.elapsed(TimeUnit.MILLISECONDS));<NEW_LINE>Log.info("Word count:" + total + " hit=" + hit + String.format(Locale.ENGLISH, " Accuracy:%f"<MASK><NEW_LINE>} | , hit * 1.0 / total)); |
600,956 | public Tree normalizeWholeTree(Tree tree, TreeFactory tf) {<NEW_LINE>// add an extra root to non-unary roots<NEW_LINE>if (tree.value() == null)<NEW_LINE>tree = fixNonUnaryRoot(tree, tf);<NEW_LINE>else if (!tree.value().equals(tlp.startSymbol()))<NEW_LINE>tree = tf.newTreeNode(tlp.startSymbol(), Collections.singletonList(tree));<NEW_LINE>tree = tree.prune(emptyFilter, tf<MASK><NEW_LINE>// insert NPs in PPs if you're supposed to do that<NEW_LINE>if (insertNPinPP) {<NEW_LINE>insertNPinPPall(tree);<NEW_LINE>}<NEW_LINE>for (Tree t : tree) {<NEW_LINE>if (t.isLeaf() || t.isPreTerminal())<NEW_LINE>continue;<NEW_LINE>if (t.value() == null || t.value().equals(""))<NEW_LINE>t.setValue("DUMMY");<NEW_LINE>// there's also a '--' category<NEW_LINE>if (t.value().matches("--.*"))<NEW_LINE>continue;<NEW_LINE>// fix a bug in the ACL08 German tiger treebank<NEW_LINE>String cat = t.value();<NEW_LINE>if (cat == null || cat.equals("")) {<NEW_LINE>if (t.numChildren() == 3 && t.firstChild().label().value().equals("NN") && t.getChild(1).label().value().equals("$.")) {<NEW_LINE>log.info("Correcting treebank error: giving phrase label DL to " + t);<NEW_LINE>t.label().setValue("DL");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return tree;<NEW_LINE>} | ).spliceOut(aOverAFilter, tf); |
666,297 | protected void writeClassTargets(TargetsTableAnnotationsImpl targetTable) throws IOException {<NEW_LINE>Map<String, String> i_annotatedClassNames = new IdentityHashMap<String, String>();<NEW_LINE>UtilImpl_BidirectionalMap classTargetMap = targetTable.i_getClassAnnotations();<NEW_LINE>UtilImpl_BidirectionalMap fieldTargetMap = targetTable.i_getFieldAnnotations();<NEW_LINE>UtilImpl_BidirectionalMap methodTargetMap = targetTable.i_getMethodAnnotations();<NEW_LINE>for (String i_annotationClassName : classTargetMap.getHolderSet()) {<NEW_LINE>i_annotatedClassNames.put(i_annotationClassName, i_annotationClassName);<NEW_LINE>}<NEW_LINE>for (String i_annotationClassName : fieldTargetMap.getHolderSet()) {<NEW_LINE>i_annotatedClassNames.put(i_annotationClassName, i_annotationClassName);<NEW_LINE>}<NEW_LINE>for (String i_annotationClassName : methodTargetMap.getHolderSet()) {<NEW_LINE>i_annotatedClassNames.put(i_annotationClassName, i_annotationClassName);<NEW_LINE>}<NEW_LINE>Set<String> i_classNames = i_annotatedClassNames.keySet();<NEW_LINE>bufOutput.writeLargeInt(i_classNames.size());<NEW_LINE>for (String i_className : i_classNames) {<NEW_LINE>writeCompact(CLASS_BYTE, i_className);<NEW_LINE>Set<String> <MASK><NEW_LINE>Set<String> i_fieldAnnotations = fieldTargetMap.selectHeldOf(i_className);<NEW_LINE>Set<String> i_methodAnnotations = methodTargetMap.selectHeldOf(i_className);<NEW_LINE>bufOutput.writeSmallInt(i_classAnnotations.size() + i_fieldAnnotations.size() + i_methodAnnotations.size());<NEW_LINE>for (String i_annotationClassName : i_classAnnotations) {<NEW_LINE>writeCompact(CLASS_ANNOTATION_BYTE, i_annotationClassName);<NEW_LINE>}<NEW_LINE>for (String i_annotationClassName : i_fieldAnnotations) {<NEW_LINE>writeCompact(FIELD_ANNOTATION_BYTE, i_annotationClassName);<NEW_LINE>}<NEW_LINE>for (String i_annotationClassName : i_methodAnnotations) {<NEW_LINE>writeCompact(METHOD_ANNOTATION_BYTE, i_annotationClassName);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | i_classAnnotations = classTargetMap.selectHeldOf(i_className); |
926,476 | public Mono<UserRole> updateRoleForMember(String orgId, UserRole userRole, String originHeader) {<NEW_LINE>if (userRole.getUsername() == null) {<NEW_LINE>return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, "username"));<NEW_LINE>}<NEW_LINE>Mono<Organization> organizationMono = organizationRepository.findById(orgId, MANAGE_ORGANIZATIONS).switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.ACTION_IS_NOT_AUTHORIZED, "Change role of a member")));<NEW_LINE>Mono<User> userMono = userRepository.findByEmail(userRole.getUsername());<NEW_LINE>Mono<User> currentUserMono = sessionUserService.getCurrentUser();<NEW_LINE>return Mono.zip(organizationMono, userMono, currentUserMono).flatMap(tuple -> {<NEW_LINE>Organization organization = tuple.getT1();<NEW_LINE><MASK><NEW_LINE>User currentUser = tuple.getT3();<NEW_LINE>return this.updateMemberRole(organization, user, userRole, currentUser, originHeader);<NEW_LINE>});<NEW_LINE>} | User user = tuple.getT2(); |
1,392,744 | protected void loadTileLayer(TiledMap map, MapLayers parentLayers, Element element) {<NEW_LINE>if (element.getName().equals("layer")) {<NEW_LINE>int width = element.getIntAttribute("width", 0);<NEW_LINE>int height = element.getIntAttribute("height", 0);<NEW_LINE>int tileWidth = map.getProperties().get("tilewidth", Integer.class);<NEW_LINE>int tileHeight = map.getProperties().get("tileheight", Integer.class);<NEW_LINE>TiledMapTileLayer layer = new TiledMapTileLayer(width, height, tileWidth, tileHeight);<NEW_LINE>loadBasicLayerInfo(layer, element);<NEW_LINE>int[] ids = getTileIds(element, width, height);<NEW_LINE>TiledMapTileSets tilesets = map.getTileSets();<NEW_LINE>for (int y = 0; y < height; y++) {<NEW_LINE>for (int x = 0; x < width; x++) {<NEW_LINE>int id = ids[y * width + x];<NEW_LINE>boolean flipHorizontally = ((id & FLAG_FLIP_HORIZONTALLY) != 0);<NEW_LINE>boolean flipVertically = ((id & FLAG_FLIP_VERTICALLY) != 0);<NEW_LINE>boolean flipDiagonally = ((id & FLAG_FLIP_DIAGONALLY) != 0);<NEW_LINE>TiledMapTile tile = tilesets.getTile(id & ~MASK_CLEAR);<NEW_LINE>if (tile != null) {<NEW_LINE>Cell cell = createTileLayerCell(flipHorizontally, flipVertically, flipDiagonally);<NEW_LINE>cell.setTile(tile);<NEW_LINE>layer.setCell(x, flipY ? height - 1 - y : y, cell);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Element properties = element.getChildByName("properties");<NEW_LINE>if (properties != null) {<NEW_LINE>loadProperties(<MASK><NEW_LINE>}<NEW_LINE>parentLayers.add(layer);<NEW_LINE>}<NEW_LINE>} | layer.getProperties(), properties); |
1,680,208 | public void deployBlueprint(World world, BlockPos pos, EnumFacing dir, Blueprint bpt) {<NEW_LINE>bpt.id = new LibraryId();<NEW_LINE>bpt.id.extension = "bpt";<NEW_LINE>BptContext context = bpt.getContext(world<MASK><NEW_LINE>if (bpt.rotate) {<NEW_LINE>if (dir == EnumFacing.EAST) {<NEW_LINE>// Do nothing<NEW_LINE>} else if (dir == EnumFacing.SOUTH) {<NEW_LINE>bpt.rotateLeft(context);<NEW_LINE>} else if (dir == EnumFacing.WEST) {<NEW_LINE>bpt.rotateLeft(context);<NEW_LINE>bpt.rotateLeft(context);<NEW_LINE>} else if (dir == EnumFacing.NORTH) {<NEW_LINE>bpt.rotateLeft(context);<NEW_LINE>bpt.rotateLeft(context);<NEW_LINE>bpt.rotateLeft(context);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Vec3d transform = Utils.convert(pos).subtract(Utils.convert(bpt.anchor));<NEW_LINE>bpt.translateToWorld(transform);<NEW_LINE>new BptBuilderBlueprint(bpt, world, pos).deploy();<NEW_LINE>} | , bpt.getBoxForPos(pos)); |
1,666,026 | public void initialize() {<NEW_LINE>addTitledGroupBg(root, gridRow, 3, Res.get("account.menu.walletInfo.balance.headLine"));<NEW_LINE>addMultilineLabel(root, gridRow, Res.get("account.menu.walletInfo.balance.info"), Layout.FIRST_ROW_DISTANCE, Double.MAX_VALUE);<NEW_LINE>btcTextField = addTopLabelTextField(root, ++gridRow, "BTC", -Layout.FLOATING_LABEL_DISTANCE).second;<NEW_LINE>bsqTextField = addTopLabelTextField(root, ++gridRow, "BSQ", -Layout.FLOATING_LABEL_DISTANCE).second;<NEW_LINE>addTitledGroupBg(root, ++gridRow, 4, Res.get("account.menu.walletInfo.xpub.headLine"), Layout.GROUP_DISTANCE);<NEW_LINE>addXpubKeys(btcWalletService, "BTC", gridRow, Layout.FIRST_ROW_AND_GROUP_DISTANCE);<NEW_LINE>// update gridRow<NEW_LINE>++gridRow;<NEW_LINE>addXpubKeys(bsqWalletService, "BSQ", ++gridRow, -Layout.FLOATING_LABEL_DISTANCE);<NEW_LINE>// update gridRow<NEW_LINE>++gridRow;<NEW_LINE>addTitledGroupBg(root, ++gridRow, 4, Res.get<MASK><NEW_LINE>addMultilineLabel(root, gridRow, Res.get("account.menu.walletInfo.path.info"), Layout.FIRST_ROW_AND_GROUP_DISTANCE, Double.MAX_VALUE);<NEW_LINE>addTopLabelTextField(root, ++gridRow, Res.get("account.menu.walletInfo.walletSelector", "BTC", "legacy"), "44'/0'/0'", -Layout.FLOATING_LABEL_DISTANCE);<NEW_LINE>addTopLabelTextField(root, ++gridRow, Res.get("account.menu.walletInfo.walletSelector", "BTC", "segwit"), "44'/0'/1'", -Layout.FLOATING_LABEL_DISTANCE);<NEW_LINE>addTopLabelTextField(root, ++gridRow, Res.get("account.menu.walletInfo.walletSelector", "BSQ", ""), "44'/142'/0'", -Layout.FLOATING_LABEL_DISTANCE);<NEW_LINE>openDetailsButton = addButtonAfterGroup(root, ++gridRow, Res.get("account.menu.walletInfo.openDetails"));<NEW_LINE>btcWalletBalanceListener = new BalanceListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onBalanceChanged(Coin balanceAsCoin, Transaction tx) {<NEW_LINE>updateBalances(btcWalletService);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>bsqWalletBalanceListener = new BalanceListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onBalanceChanged(Coin balanceAsCoin, Transaction tx) {<NEW_LINE>updateBalances(bsqWalletService);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | ("account.menu.walletInfo.path.headLine"), Layout.GROUP_DISTANCE); |
886,177 | private static String createWrapperContent(final CtElement element, final Factory f, final CtTypeReference returnType) {<NEW_LINE>CtClass<?> w = f.Class().create(WRAPPER_CLASS_NAME);<NEW_LINE>CtBlock body = f.Core().createBlock();<NEW_LINE>if (element instanceof CtStatement) {<NEW_LINE>body.addStatement((CtStatement) element);<NEW_LINE>} else if (element instanceof CtExpression) {<NEW_LINE>CtReturn ret = f.Core().createReturn();<NEW_LINE>ret.setReturnedExpression((CtExpression) element);<NEW_LINE>body.addStatement(ret);<NEW_LINE>}<NEW_LINE>Set<ModifierKind> modifiers = EnumSet.of(ModifierKind.STATIC);<NEW_LINE>Set<CtTypeReference<? extends Throwable>> thrownTypes = new HashSet<>();<NEW_LINE>thrownTypes.add(f.Class().<Throwable>get(Throwable.class).getReference());<NEW_LINE>f.Method().create(w, modifiers, returnType, WRAPPER_METHOD_NAME, CtElementImpl.<CtParameter<?>>emptyList(), thrownTypes, body);<NEW_LINE>String contents = w.toString();<NEW_LINE>// Clean up (delete wrapper from factory) after it is printed. The DefaultJavaPrettyPrinter needs w in model to be able to print it correctly<NEW_LINE>w.<MASK><NEW_LINE>return contents;<NEW_LINE>} | getPackage().removeType(w); |
209,212 | final CreateJourneyResult executeCreateJourney(CreateJourneyRequest createJourneyRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createJourneyRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateJourneyRequest> request = null;<NEW_LINE>Response<CreateJourneyResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateJourneyRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createJourneyRequest));<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, "Pinpoint");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateJourney");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateJourneyResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateJourneyResultJsonUnmarshaller());<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
751,850 | public void addOrReplaceSegment(String segmentName, IndexLoadingConfig indexLoadingConfig, SegmentZKMetadata zkMetadata, @Nullable SegmentMetadata localMetadata) throws Exception {<NEW_LINE>if (localMetadata != null && hasSameCRC(zkMetadata, localMetadata)) {<NEW_LINE>LOGGER.info("Segment: {} of table: {} has crc: {} same as before, already loaded, do nothing", segmentName, _tableNameWithType, localMetadata.getCrc());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// The segment is not loaded by the server if the metadata object is null. But the segment<NEW_LINE>// may still be kept on the server. For example when server gets restarted, the segment is<NEW_LINE>// still on the server but the metadata object has not been initialized yet. In this case,<NEW_LINE>// we should check if the segment exists on server and try to load it. If the segment does<NEW_LINE>// not exist or fails to get loaded, we download segment from deep store to load it again.<NEW_LINE>if (localMetadata == null && tryLoadExistingSegment(segmentName, indexLoadingConfig, zkMetadata)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Preconditions.checkState(allowDownload(segmentName, zkMetadata), "Segment: %s of table: %s does not allow download", segmentName, _tableNameWithType);<NEW_LINE>// Download segment and replace the local one, either due to failure to recover local segment,<NEW_LINE>// or the segment data is updated and has new CRC now.<NEW_LINE>if (localMetadata == null) {<NEW_LINE>LOGGER.info("Download segment: {} of table: {} as it doesn't exist", segmentName, _tableNameWithType);<NEW_LINE>} else {<NEW_LINE>LOGGER.info("Download segment: {} of table: {} as crc changes from: {} to: {}", segmentName, _tableNameWithType, localMetadata.getCrc(), zkMetadata.getCrc());<NEW_LINE>}<NEW_LINE>File indexDir = downloadSegment(segmentName, zkMetadata);<NEW_LINE>addSegment(indexDir, indexLoadingConfig);<NEW_LINE>LOGGER.info("Downloaded and loaded segment: {} of table: {} with crc: {}", segmentName, <MASK><NEW_LINE>} | _tableNameWithType, zkMetadata.getCrc()); |
1,733,348 | private void storeLiveIns(BasicBlock block, Instruction callInstruction, int[] updates) {<NEW_LINE>Program program = block.getProgram();<NEW_LINE>List<Instruction> <MASK><NEW_LINE>for (int slot = 0; slot < updates.length; ++slot) {<NEW_LINE>int var = updates[slot];<NEW_LINE>if (var == -2) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Variable slotVar = program.createVariable();<NEW_LINE>IntegerConstantInstruction slotConstant = new IntegerConstantInstruction();<NEW_LINE>slotConstant.setReceiver(slotVar);<NEW_LINE>slotConstant.setConstant(slot);<NEW_LINE>slotConstant.setLocation(callInstruction.getLocation());<NEW_LINE>instructionsToAdd.add(slotConstant);<NEW_LINE>List<Variable> arguments = new ArrayList<>();<NEW_LINE>InvokeInstruction registerInvocation = new InvokeInstruction();<NEW_LINE>registerInvocation.setLocation(callInstruction.getLocation());<NEW_LINE>registerInvocation.setType(InvocationType.SPECIAL);<NEW_LINE>arguments.add(slotVar);<NEW_LINE>if (var >= 0) {<NEW_LINE>registerInvocation.setMethod(new MethodReference(ShadowStack.class, "registerGCRoot", int.class, Object.class, void.class));<NEW_LINE>arguments.add(program.variableAt(var));<NEW_LINE>} else {<NEW_LINE>registerInvocation.setMethod(new MethodReference(ShadowStack.class, "removeGCRoot", int.class, void.class));<NEW_LINE>}<NEW_LINE>registerInvocation.setArguments(arguments.toArray(new Variable[0]));<NEW_LINE>instructionsToAdd.add(registerInvocation);<NEW_LINE>}<NEW_LINE>callInstruction.insertPreviousAll(instructionsToAdd);<NEW_LINE>} | instructionsToAdd = new ArrayList<>(); |
1,632,065 | private void tagFromXML() {<NEW_LINE>Reader reader = null;<NEW_LINE>Writer w = null;<NEW_LINE>try {<NEW_LINE>// todo [cdm dec 13]: change to use the IOUtils read-from-anywhere routines<NEW_LINE>reader = new BufferedReader(new InputStreamReader(new FileInputStream(config.getFile()), config.getEncoding()));<NEW_LINE>String outFile = config.getOutputFile();<NEW_LINE>if (outFile.length() > 0) {<NEW_LINE>w = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile)<MASK><NEW_LINE>} else {<NEW_LINE>w = new BufferedWriter(new OutputStreamWriter(System.out, config.getEncoding()));<NEW_LINE>}<NEW_LINE>w.write("<?xml version=\"1.0\" encoding=\"" + config.getEncoding() + "\"?>\n");<NEW_LINE>tagFromXML(reader, w, config.getXMLInput());<NEW_LINE>} catch (FileNotFoundException e) {<NEW_LINE>log.info("Input file not found: " + config.getFile());<NEW_LINE>e.printStackTrace();<NEW_LINE>} catch (IOException ioe) {<NEW_LINE>log.info("tagFromXML: mysterious IO Exception");<NEW_LINE>ioe.printStackTrace();<NEW_LINE>} finally {<NEW_LINE>IOUtils.closeIgnoringExceptions(reader);<NEW_LINE>IOUtils.closeIgnoringExceptions(w);<NEW_LINE>}<NEW_LINE>} | , config.getEncoding())); |
752,624 | public static synchronized Map<String, String> classLabelNames() throws Exception {<NEW_LINE>if (classLabelNames != null) {<NEW_LINE>return classLabelNames;<NEW_LINE>}<NEW_LINE>if (dataLocalPath == null)<NEW_LINE>dataLocalPath <MASK><NEW_LINE>String s;<NEW_LINE>try {<NEW_LINE>s = FileUtils.readFileToString(new File(dataLocalPath, "PatentClassLabels.txt"), Charset.forName("UTF-8"));<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>Map<String, String> m = new LinkedHashMap<>();<NEW_LINE>String[] lines = s.split("\n");<NEW_LINE>for (String line : lines) {<NEW_LINE>String key = line.substring(0, 3);<NEW_LINE>String name = line.substring(4);<NEW_LINE>m.put(key, name);<NEW_LINE>}<NEW_LINE>classLabelNames = m;<NEW_LINE>return classLabelNames;<NEW_LINE>} | = DownloaderUtility.PATENTEXAMPLE.Download(); |
901,820 | public Request<ModifyCustomDBEngineVersionRequest> marshall(ModifyCustomDBEngineVersionRequest modifyCustomDBEngineVersionRequest) {<NEW_LINE>if (modifyCustomDBEngineVersionRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>Request<ModifyCustomDBEngineVersionRequest> request = new DefaultRequest<ModifyCustomDBEngineVersionRequest>(modifyCustomDBEngineVersionRequest, "AmazonRDS");<NEW_LINE>request.addParameter("Action", "ModifyCustomDBEngineVersion");<NEW_LINE>request.addParameter("Version", "2014-10-31");<NEW_LINE>request.setHttpMethod(HttpMethodName.POST);<NEW_LINE>if (modifyCustomDBEngineVersionRequest.getEngine() != null) {<NEW_LINE>request.addParameter("Engine", StringUtils.fromString<MASK><NEW_LINE>}<NEW_LINE>if (modifyCustomDBEngineVersionRequest.getEngineVersion() != null) {<NEW_LINE>request.addParameter("EngineVersion", StringUtils.fromString(modifyCustomDBEngineVersionRequest.getEngineVersion()));<NEW_LINE>}<NEW_LINE>if (modifyCustomDBEngineVersionRequest.getDescription() != null) {<NEW_LINE>request.addParameter("Description", StringUtils.fromString(modifyCustomDBEngineVersionRequest.getDescription()));<NEW_LINE>}<NEW_LINE>if (modifyCustomDBEngineVersionRequest.getStatus() != null) {<NEW_LINE>request.addParameter("Status", StringUtils.fromString(modifyCustomDBEngineVersionRequest.getStatus()));<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | (modifyCustomDBEngineVersionRequest.getEngine())); |
942,590 | ActionResult<List<NameValueCountPair>> execute(EffectivePerson effectivePerson, String applicationFlag) throws Exception {<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>ActionResult<List<NameValueCountPair>> result = new ActionResult<>();<NEW_LINE>Business business = new Business(emc);<NEW_LINE>List<NameValueCountPair> wraps = new ArrayList<>();<NEW_LINE>Application application = business.application().pick(applicationFlag);<NEW_LINE>if (null != application) {<NEW_LINE>EntityManager em = emc.get(Task.class);<NEW_LINE>CriteriaBuilder cb = em.getCriteriaBuilder();<NEW_LINE>CriteriaQuery<String> cq = cb.createQuery(String.class);<NEW_LINE>Root<Task> root = cq.from(Task.class);<NEW_LINE>Predicate p = cb.equal(root.get(Task_.person), effectivePerson.getDistinguishedName());<NEW_LINE>p = cb.and(p, cb.equal(root.get(Task_.application)<MASK><NEW_LINE>cq.select(root.get(Task_.process)).where(p);<NEW_LINE>List<String> list = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());<NEW_LINE>for (String str : list) {<NEW_LINE>this.addNameValueCountPair(business, effectivePerson, str, wraps);<NEW_LINE>}<NEW_LINE>SortTools.asc(wraps, false, "name");<NEW_LINE>}<NEW_LINE>result.setData(wraps);<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>} | , application.getId())); |
134,493 | public Request<DescribeListenersRequest> marshall(DescribeListenersRequest describeListenersRequest) {<NEW_LINE>if (describeListenersRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>Request<DescribeListenersRequest> request = new DefaultRequest<DescribeListenersRequest>(describeListenersRequest, "AmazonElasticLoadBalancing");<NEW_LINE>request.addParameter("Action", "DescribeListeners");<NEW_LINE>request.addParameter("Version", "2015-12-01");<NEW_LINE>request.setHttpMethod(HttpMethodName.POST);<NEW_LINE>if (describeListenersRequest.getLoadBalancerArn() != null) {<NEW_LINE>request.addParameter("LoadBalancerArn", StringUtils.fromString<MASK><NEW_LINE>}<NEW_LINE>if (describeListenersRequest.getListenerArns() != null) {<NEW_LINE>java.util.List<String> listenerArnsList = describeListenersRequest.getListenerArns();<NEW_LINE>if (listenerArnsList.isEmpty()) {<NEW_LINE>request.addParameter("ListenerArns", "");<NEW_LINE>} else {<NEW_LINE>int listenerArnsListIndex = 1;<NEW_LINE>for (String listenerArnsListValue : listenerArnsList) {<NEW_LINE>if (listenerArnsListValue != null) {<NEW_LINE>request.addParameter("ListenerArns.member." + listenerArnsListIndex, StringUtils.fromString(listenerArnsListValue));<NEW_LINE>}<NEW_LINE>listenerArnsListIndex++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (describeListenersRequest.getMarker() != null) {<NEW_LINE>request.addParameter("Marker", StringUtils.fromString(describeListenersRequest.getMarker()));<NEW_LINE>}<NEW_LINE>if (describeListenersRequest.getPageSize() != null) {<NEW_LINE>request.addParameter("PageSize", StringUtils.fromInteger(describeListenersRequest.getPageSize()));<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | (describeListenersRequest.getLoadBalancerArn())); |
1,557,760 | public Optional<ApplyCommitRequest> handlePublishResponse(DiscoveryNode sourceNode, PublishResponse publishResponse) {<NEW_LINE>if (electionWon == false) {<NEW_LINE>LOGGER.debug("handlePublishResponse: ignored response as election not won");<NEW_LINE>throw new CoordinationStateRejectedException("election not won");<NEW_LINE>}<NEW_LINE>if (publishResponse.getTerm() != getCurrentTerm()) {<NEW_LINE>LOGGER.debug("handlePublishResponse: ignored publish response due to term mismatch (expected: [{}], actual: [{}])", getCurrentTerm(), publishResponse.getTerm());<NEW_LINE>throw new CoordinationStateRejectedException("incoming term " + publishResponse.getTerm() + " does not match current term " + getCurrentTerm());<NEW_LINE>}<NEW_LINE>if (publishResponse.getVersion() != lastPublishedVersion) {<NEW_LINE>LOGGER.debug("handlePublishResponse: ignored publish response due to version mismatch (expected: [{}], actual: [{}])", <MASK><NEW_LINE>throw new CoordinationStateRejectedException("incoming version " + publishResponse.getVersion() + " does not match current version " + lastPublishedVersion);<NEW_LINE>}<NEW_LINE>LOGGER.trace("handlePublishResponse: accepted publish response for version [{}] and term [{}] from [{}]", publishResponse.getVersion(), publishResponse.getTerm(), sourceNode);<NEW_LINE>publishVotes.addVote(sourceNode);<NEW_LINE>if (isPublishQuorum(publishVotes)) {<NEW_LINE>LOGGER.trace("handlePublishResponse: value committed for version [{}] and term [{}]", publishResponse.getVersion(), publishResponse.getTerm());<NEW_LINE>return Optional.of(new ApplyCommitRequest(localNode, publishResponse.getTerm(), publishResponse.getVersion()));<NEW_LINE>}<NEW_LINE>return Optional.empty();<NEW_LINE>} | lastPublishedVersion, publishResponse.getVersion()); |
337,329 | public HttpResponse makeRequest(String path, Request.Builder requestBuilder) throws IOException {<NEW_LINE><MASK><NEW_LINE>long startRequestNanos = System.nanoTime();<NEW_LINE>ImmutableLoadBalancedServiceEventData.Builder data = ImmutableLoadBalancedServiceEventData.builder().setServer(server);<NEW_LINE>URL fullUrl = SingleUriService.getFullUrl(server, path);<NEW_LINE>requestBuilder.url(fullUrl);<NEW_LINE>Request request = requestBuilder.build();<NEW_LINE>if (request.body() != null && request.body().contentLength() != -1) {<NEW_LINE>data.setRequestSizeBytes(request.body().contentLength());<NEW_LINE>}<NEW_LINE>LOG.verbose("Making call to %s", fullUrl);<NEW_LINE>Call call = client.newCall(request);<NEW_LINE>try {<NEW_LINE>HttpResponse response = LoadBalancedHttpResponse.createLoadBalancedResponse(server, slb, call);<NEW_LINE>if (response.contentLength() != -1) {<NEW_LINE>data.setResponseSizeBytes(response.contentLength());<NEW_LINE>}<NEW_LINE>return response;<NEW_LINE>} catch (IOException e) {<NEW_LINE>data.setException(e);<NEW_LINE>throw e;<NEW_LINE>} finally {<NEW_LINE>data.setLatencyMicros((System.nanoTime() - startRequestNanos) / 1000);<NEW_LINE>eventBus.post(new LoadBalancedServiceEvent(data.build()));<NEW_LINE>}<NEW_LINE>} | URI server = slb.getBestServer(); |
126,762 | private void constructMap() {<NEW_LINE>Int2ObjectOpenHashMap<Int2IntOpenHashMap> rowPositionMap = new Int2ObjectOpenHashMap<>();<NEW_LINE>for (int rowIndex = 0; rowIndex < rowSize(); rowIndex++) {<NEW_LINE>SequentialSparseVector tempRowVector = row(rowIndex);<NEW_LINE>Int2IntOpenHashMap tempPositionMap = new Int2IntOpenHashMap();<NEW_LINE>for (Vector.VectorEntry vectorEntry : tempRowVector) {<NEW_LINE>tempPositionMap.put(vectorEntry.index(<MASK><NEW_LINE>}<NEW_LINE>rowPositionMap.put(rowIndex, tempPositionMap);<NEW_LINE>}<NEW_LINE>columnToRowPositionMap = new int[columnSize()][];<NEW_LINE>for (int columnIndex = 0; columnIndex < columnSize(); columnIndex++) {<NEW_LINE>SequentialSparseVector tempRowVector = column(columnIndex);<NEW_LINE>columnToRowPositionMap[columnIndex] = new int[tempRowVector.getNumEntries()];<NEW_LINE>for (Vector.VectorEntry vectorEntry : tempRowVector) {<NEW_LINE>columnToRowPositionMap[columnIndex][vectorEntry.position()] = rowPositionMap.get(vectorEntry.index()).get(columnIndex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Int2ObjectOpenHashMap<Int2IntOpenHashMap> columnPositionMap = new Int2ObjectOpenHashMap<>();<NEW_LINE>for (int columnIndex = 0; columnIndex < columnSize(); columnIndex++) {<NEW_LINE>SequentialSparseVector tempColumnVector = column(columnIndex);<NEW_LINE>Int2IntOpenHashMap tempPositionMap = new Int2IntOpenHashMap();<NEW_LINE>for (Vector.VectorEntry vectorEntry : tempColumnVector) {<NEW_LINE>tempPositionMap.put(vectorEntry.index(), vectorEntry.position());<NEW_LINE>}<NEW_LINE>columnPositionMap.put(columnIndex, tempPositionMap);<NEW_LINE>}<NEW_LINE>rowToColumnPositionMap = new int[rowSize()][];<NEW_LINE>for (int rowIndex = 0; rowIndex < rowSize(); rowIndex++) {<NEW_LINE>SequentialSparseVector tempRowVector = row(rowIndex);<NEW_LINE>rowToColumnPositionMap[rowIndex] = new int[tempRowVector.getNumEntries()];<NEW_LINE>for (Vector.VectorEntry vectorEntry : tempRowVector) {<NEW_LINE>rowToColumnPositionMap[rowIndex][vectorEntry.position()] = columnPositionMap.get(vectorEntry.index()).get(rowIndex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ), vectorEntry.position()); |
1,752,629 | static SearchResult parseCache(final IConnector con, final String page, final DisposableHandler handler) {<NEW_LINE>final ImmutablePair<StatusCode, Geocache> parsed = parseCacheFromText(page, handler);<NEW_LINE>// attention: parseCacheFromText already stores implicitly through searchResult.addCache<NEW_LINE>if (parsed.left != StatusCode.NO_ERROR) {<NEW_LINE>final SearchResult result = new SearchResult(con, parsed.left);<NEW_LINE>if (parsed.left == StatusCode.PREMIUM_ONLY) {<NEW_LINE>result.addAndPutInCache(Collections.singletonList(parsed.right));<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>final Geocache cache = parsed.right;<NEW_LINE>getExtraOnlineInfo(cache, page, handler);<NEW_LINE>// too late: it is already stored through parseCacheFromText<NEW_LINE>cache.setDetailedUpdatedNow();<NEW_LINE>if (DisposableHandler.isDisposed(handler)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// save full detailed caches<NEW_LINE>DisposableHandler.sendLoadProgressDetail(handler, R.string.cache_dialog_loading_details_status_cache);<NEW_LINE>DataStore.saveCache(cache, EnumSet.of(SaveFlag.DB));<NEW_LINE>// update progress message so user knows we're still working. This is more of a place holder than<NEW_LINE>// actual indication of what the program is doing<NEW_LINE>DisposableHandler.sendLoadProgressDetail(<MASK><NEW_LINE>return new SearchResult(cache);<NEW_LINE>} | handler, R.string.cache_dialog_loading_details_status_render); |
925,154 | public void testInjectPersistenceContext() throws Exception {<NEW_LINE>EntityManager em1 = (EntityManager) InitialContext.doLookup("java:comp/env/em1");<NEW_LINE>Assert.assertNotNull(em1);<NEW_LINE>EntityManager em2 = (EntityManager) InitialContext.doLookup("java:comp/env/em2");<NEW_LINE>Assert.assertNotNull(em2);<NEW_LINE>// Persist entities which are appropriate to their respective persistence units<NEW_LINE>tx.begin();<NEW_LINE>InjectEntityA entA1 = new InjectEntityA();<NEW_LINE>entA1.setStrData("A1");<NEW_LINE>em1.persist(entA1);<NEW_LINE>InjectEntityB entB1 = new InjectEntityB();<NEW_LINE>entB1.setStrData("B1");<NEW_LINE>em2.persist(entB1);<NEW_LINE>tx.commit();<NEW_LINE>em1.clear();<NEW_LINE>em2.clear();<NEW_LINE>// Verify persistence<NEW_LINE>InjectEntityA findA1 = em1.find(InjectEntityA.class, entA1.getId());<NEW_LINE>Assert.assertNotNull(findA1);<NEW_LINE>InjectEntityB findB1 = em2.find(InjectEntityB.class, entB1.getId());<NEW_LINE>Assert.assertNotNull(findB1);<NEW_LINE>// Confirm that correct persistence units are associated with the persistence contexts<NEW_LINE>// by attempting to use an entity that is not a member of the associated persistence unit<NEW_LINE>try {<NEW_LINE>InjectEntityA findA1_wrong = em2.find(InjectEntityA.<MASK><NEW_LINE>Assert.fail("No exception was thrown.");<NEW_LINE>} catch (IllegalArgumentException iae) {<NEW_LINE>// Expected<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>InjectEntityB findB1_wrong = em1.find(InjectEntityB.class, entB1.getId());<NEW_LINE>Assert.fail("No exception was thrown.");<NEW_LINE>} catch (IllegalArgumentException iae) {<NEW_LINE>// Expected<NEW_LINE>}<NEW_LINE>} | class, entA1.getId()); |
271,525 | protected void encodeOptions(FacesContext context, Chart chart) throws IOException {<NEW_LINE>super.encodeOptions(context, chart);<NEW_LINE>ResponseWriter writer = context.getResponseWriter();<NEW_LINE>PieChartModel model = (PieChartModel) chart.getModel();<NEW_LINE>int diameter = model.getDiameter();<NEW_LINE>int sliceMargin = model.getSliceMargin();<NEW_LINE><MASK><NEW_LINE>boolean showDataLabels = model.isShowDataLabels();<NEW_LINE>String dataFormat = model.getDataFormat();<NEW_LINE>String dataLabelFormatString = model.getDataLabelFormatString();<NEW_LINE>int dataLabelThreshold = model.getDataLabelThreshold();<NEW_LINE>if (diameter != 0) {<NEW_LINE>writer.write(",diameter:" + diameter);<NEW_LINE>}<NEW_LINE>if (sliceMargin != 0) {<NEW_LINE>writer.write(",sliceMargin:" + sliceMargin);<NEW_LINE>}<NEW_LINE>if (!fill) {<NEW_LINE>writer.write(",fill:false");<NEW_LINE>}<NEW_LINE>if (showDataLabels) {<NEW_LINE>writer.write(",showDataLabels:true");<NEW_LINE>}<NEW_LINE>if (dataFormat != null) {<NEW_LINE>writer.write(",dataFormat:\"" + dataFormat + "\"");<NEW_LINE>}<NEW_LINE>if (dataLabelFormatString != null) {<NEW_LINE>writer.write(",dataLabelFormatString:\"" + dataLabelFormatString + "\"");<NEW_LINE>}<NEW_LINE>if (dataLabelThreshold > 0 && dataLabelThreshold < 100) {<NEW_LINE>writer.write(",dataLabelThreshold:" + dataLabelThreshold);<NEW_LINE>}<NEW_LINE>if (model.isShowDatatip()) {<NEW_LINE>writer.write(",datatip:true");<NEW_LINE>String datatipFormat = model.getDatatipFormat();<NEW_LINE>String datatipEditor = model.getDatatipEditor();<NEW_LINE>if (datatipFormat != null) {<NEW_LINE>writer.write(",datatipFormat:\"" + model.getDatatipFormat() + "\"");<NEW_LINE>}<NEW_LINE>if (datatipEditor != null) {<NEW_LINE>writer.write(",datatipEditor:" + datatipEditor);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | boolean fill = model.isFill(); |
855,312 | public static void read(InputStream inputStream, FeedClient feedClient, AtomicInteger numSent) {<NEW_LINE>try (InputStreamJsonElementBuffer jsonElementBuffer = new InputStreamJsonElementBuffer(inputStream)) {<NEW_LINE>JsonFactory jfactory = new JsonFactoryBuilder().disable(JsonFactory.Feature.CANONICALIZE_FIELD_NAMES).build();<NEW_LINE>JsonParser jParser = jfactory.createParser(jsonElementBuffer);<NEW_LINE>while (true) {<NEW_LINE>int documentStart = (int) jParser.getCurrentLocation().getCharOffset();<NEW_LINE>String docId = parseOneDocument(jParser);<NEW_LINE>if (docId == null) {<NEW_LINE>int documentEnd = (int) jParser.getCurrentLocation().getCharOffset();<NEW_LINE>int documentLength = documentEnd - documentStart;<NEW_LINE>int maxTruncatedLength = 500;<NEW_LINE>StringBuilder stringBuilder = new StringBuilder(maxTruncatedLength + 3);<NEW_LINE>for (int i = 0; i < Math.min(documentLength, maxTruncatedLength); i++) stringBuilder.append(jsonElementBuffer.circular.get(documentStart + i));<NEW_LINE>if (documentLength > maxTruncatedLength)<NEW_LINE>stringBuilder.append("...");<NEW_LINE>throw new IllegalArgumentException("Document is missing ID: '" + stringBuilder.toString() + "'");<NEW_LINE>}<NEW_LINE>CharSequence data = jsonElementBuffer.getJsonAsArray(jParser.getCurrentLocation().getCharOffset());<NEW_LINE><MASK><NEW_LINE>numSent.incrementAndGet();<NEW_LINE>}<NEW_LINE>} catch (EOFException ignored) {<NEW_LINE>// No more documents<NEW_LINE>} catch (IOException ioe) {<NEW_LINE>System.err.println(ioe.getMessage());<NEW_LINE>throw new UncheckedIOException(ioe);<NEW_LINE>}<NEW_LINE>} | feedClient.stream(docId, data); |
1,182,970 | private Mono<Application> addAnalyticsForGitOperation(String eventName, Application application, String errorType, String errorMessage, Boolean isRepoPrivate) {<NEW_LINE><MASK><NEW_LINE>String defaultApplicationId = gitData == null || StringUtils.isEmptyOrNull(gitData.getDefaultApplicationId()) ? "" : gitData.getDefaultApplicationId();<NEW_LINE>String gitHostingProvider = gitData == null ? "" : GitUtils.getGitProviderName(application.getGitApplicationMetadata().getRemoteUrl());<NEW_LINE>Map<String, Object> analyticsProps = new HashMap<>(Map.of("applicationId", defaultApplicationId, "organizationId", defaultIfNull(application.getOrganizationId(), ""), "branchApplicationId", defaultIfNull(application.getId(), ""), "isRepoPrivate", defaultIfNull(isRepoPrivate, ""), "gitHostingProvider", defaultIfNull(gitHostingProvider, "")));<NEW_LINE>return sessionUserService.getCurrentUser().map(user -> {<NEW_LINE>// Do not include the error data points in the map for success states<NEW_LINE>if (!StringUtils.isEmptyOrNull(errorMessage) || !StringUtils.isEmptyOrNull(errorType)) {<NEW_LINE>analyticsProps.put("errorMessage", errorMessage);<NEW_LINE>analyticsProps.put("errorType", errorType);<NEW_LINE>}<NEW_LINE>analyticsService.sendEvent(eventName, user.getUsername(), analyticsProps);<NEW_LINE>return application;<NEW_LINE>});<NEW_LINE>} | GitApplicationMetadata gitData = application.getGitApplicationMetadata(); |
453,551 | protected String replaceAllProperties(String str, final Properties submittedProps, final Properties xmlProperties) {<NEW_LINE>int startIndex = 0;<NEW_LINE>NextProperty nextProp = this.findNextProperty(str, startIndex);<NEW_LINE>while (nextProp != null) {<NEW_LINE>// get the start index past this property for the next property in<NEW_LINE>// the string<NEW_LINE>// startIndex = this.getEndIndexOfNextProperty(str, startIndex);<NEW_LINE>startIndex = nextProp.endIndex;<NEW_LINE>// resolve the property<NEW_LINE>String nextPropValue = this.resolvePropertyValue(nextProp.propName, nextProp.propType, submittedProps, xmlProperties);<NEW_LINE>// if the property didn't resolve use the default value if it exists<NEW_LINE>if (nextPropValue.equals(UNRESOLVED_PROP_VALUE)) {<NEW_LINE>if (nextProp.defaultValueExpression != null) {<NEW_LINE>nextPropValue = this.replaceAllProperties(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>// After we get this value the lenght of the string might change so<NEW_LINE>// we need to reset the start index<NEW_LINE>int lengthDifference = 0;<NEW_LINE>switch(nextProp.propType) {<NEW_LINE>case JOB_PARAMETERS:<NEW_LINE>// this can be a negative value<NEW_LINE>lengthDifference = nextPropValue.length() - (nextProp.propName.length() + "#{jobParameters['']}".length());<NEW_LINE>// move start index for next property<NEW_LINE>startIndex = startIndex + lengthDifference;<NEW_LINE>str = str.replace("#{jobParameters['" + nextProp.propName + "']}" + nextProp.getDefaultValExprWithDelimitersIfExists(), nextPropValue);<NEW_LINE>break;<NEW_LINE>case JOB_PROPERTIES:<NEW_LINE>// this can be a negative value<NEW_LINE>lengthDifference = nextPropValue.length() - (nextProp.propName.length() + "#{jobProperties['']}".length());<NEW_LINE>// move start index for next property<NEW_LINE>startIndex = startIndex + lengthDifference;<NEW_LINE>str = str.replace("#{jobProperties['" + nextProp.propName + "']}" + nextProp.getDefaultValExprWithDelimitersIfExists(), nextPropValue);<NEW_LINE>break;<NEW_LINE>case SYSTEM_PROPERTIES:<NEW_LINE>// this can be a negative value<NEW_LINE>lengthDifference = nextPropValue.length() - (nextProp.propName.length() + "#{systemProperties['']}".length());<NEW_LINE>// move start index for next property<NEW_LINE>startIndex = startIndex + lengthDifference;<NEW_LINE>str = str.replace("#{systemProperties['" + nextProp.propName + "']}" + nextProp.getDefaultValExprWithDelimitersIfExists(), nextPropValue);<NEW_LINE>break;<NEW_LINE>case PARTITION_PROPERTIES:<NEW_LINE>// this can be a negative value<NEW_LINE>lengthDifference = nextPropValue.length() - (nextProp.propName.length() + "#{partitionPlan['']}".length());<NEW_LINE>// move start index for next property<NEW_LINE>startIndex = startIndex + lengthDifference;<NEW_LINE>str = str.replace("#{partitionPlan['" + nextProp.propName + "']}" + nextProp.getDefaultValExprWithDelimitersIfExists(), nextPropValue);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>// find the next property<NEW_LINE>nextProp = this.findNextProperty(str, startIndex);<NEW_LINE>}<NEW_LINE>return str;<NEW_LINE>} | nextProp.defaultValueExpression, submittedProps, xmlProperties); |
1,575,307 | private void updateNative(SootMethod method, Function fn, Value env, long flags, List<MarshaledArg> marshaledArgs) {<NEW_LINE>for (MarshaledArg value : marshaledArgs) {<NEW_LINE>MarshalerMethod marshalerMethod = config.getMarshalerLookup().findMarshalerMethod(new MarshalSite(method, value.paramIndex));<NEW_LINE>SootMethod afterMethod = ((PointerMarshalerMethod) marshalerMethod).getAfterCallbackCallMethod();<NEW_LINE>if (afterMethod != null) {<NEW_LINE>Invokestatic invokestatic = new Invokestatic(getInternalName(method.getDeclaringClass()), getInternalName(afterMethod.getDeclaringClass()), afterMethod.getName<MASK><NEW_LINE>trampolines.add(invokestatic);<NEW_LINE>call(fn, invokestatic.getFunctionRef(), env, value.handle, value.object, new IntegerConstant(flags));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (), getDescriptor(afterMethod)); |
1,316,432 | private void createStreamWithMessageHeader(StoreKey key, ByteBuffer blobEncryptionKey, BlobProperties blobProperties, ByteBuffer userMetadata, InputStream blobStream, long streamSize, BlobType blobType, short lifeVersion) throws MessageFormatException {<NEW_LINE>int headerSize = MessageFormatRecord.getHeaderSizeForVersion(MessageFormatRecord.headerVersionToUse);<NEW_LINE>int blobEncryptionKeySize = blobEncryptionKey == null ? 0 : MessageFormatRecord.BlobEncryptionKey_Format_V1.getBlobEncryptionKeyRecordSize(blobEncryptionKey);<NEW_LINE>int blobPropertiesRecordSize = MessageFormatRecord.BlobProperties_Format_V1.getBlobPropertiesRecordSize(blobProperties);<NEW_LINE>int userMetadataSize = MessageFormatRecord.UserMetadata_Format_V1.getUserMetadataSize(userMetadata);<NEW_LINE>long blobSize = MessageFormatRecord.Blob_Format_V2.getBlobRecordSize(streamSize);<NEW_LINE>buffer = ByteBuffer.allocate(headerSize + key.sizeInBytes() + blobEncryptionKeySize + blobPropertiesRecordSize + userMetadataSize + (int) (blobSize - streamSize - MessageFormatRecord.Crc_Size));<NEW_LINE>long totalSize = blobEncryptionKeySize + blobPropertiesRecordSize + userMetadataSize + blobSize;<NEW_LINE>int blobEncryptionKeyRecordRelativeOffset = blobEncryptionKey == null ? MessageFormatRecord.Message_Header_Invalid_Relative_Offset : headerSize + key.sizeInBytes();<NEW_LINE>int blobPropertiesRecordRelativeOffset = blobEncryptionKey == null ? headerSize + key.sizeInBytes() : blobEncryptionKeyRecordRelativeOffset + blobEncryptionKeySize;<NEW_LINE>int updateRecordRelativeOffset = MessageFormatRecord.Message_Header_Invalid_Relative_Offset;<NEW_LINE>int userMetadataRecordRelativeOffset = blobPropertiesRecordRelativeOffset + blobPropertiesRecordSize;<NEW_LINE>int blobRecordRelativeOffset = userMetadataRecordRelativeOffset + userMetadataSize;<NEW_LINE>if (MessageFormatRecord.headerVersionToUse == MessageFormatRecord.Message_Header_Version_V2) {<NEW_LINE>MessageFormatRecord.MessageHeader_Format_V2.serializeHeader(buffer, totalSize, blobEncryptionKeyRecordRelativeOffset, blobPropertiesRecordRelativeOffset, updateRecordRelativeOffset, userMetadataRecordRelativeOffset, blobRecordRelativeOffset);<NEW_LINE>} else {<NEW_LINE>MessageFormatRecord.MessageHeader_Format_V3.serializeHeader(buffer, lifeVersion, totalSize, blobEncryptionKeyRecordRelativeOffset, blobPropertiesRecordRelativeOffset, updateRecordRelativeOffset, userMetadataRecordRelativeOffset, blobRecordRelativeOffset);<NEW_LINE>}<NEW_LINE>buffer.put(key.toBytes());<NEW_LINE>if (blobEncryptionKey != null) {<NEW_LINE>MessageFormatRecord.BlobEncryptionKey_Format_V1.serializeBlobEncryptionKeyRecord(buffer, blobEncryptionKey);<NEW_LINE>}<NEW_LINE>MessageFormatRecord.<MASK><NEW_LINE>MessageFormatRecord.UserMetadata_Format_V1.serializeUserMetadataRecord(buffer, userMetadata);<NEW_LINE>int bufferBlobStart = buffer.position();<NEW_LINE>MessageFormatRecord.Blob_Format_V2.serializePartialBlobRecord(buffer, streamSize, blobType);<NEW_LINE>Crc32 crc = new Crc32();<NEW_LINE>crc.update(buffer.array(), bufferBlobStart, buffer.position() - bufferBlobStart);<NEW_LINE>stream = new CrcInputStream(crc, blobStream);<NEW_LINE>streamLength = streamSize;<NEW_LINE>messageLength = buffer.capacity() + streamLength + MessageFormatRecord.Crc_Size;<NEW_LINE>buffer.flip();<NEW_LINE>} | BlobProperties_Format_V1.serializeBlobPropertiesRecord(buffer, blobProperties); |
1,568,585 | public void start() {<NEW_LINE>proxy.setTrustAllServers(true);<NEW_LINE>if (outsideProxy != null) {<NEW_LINE>proxy.setChainedProxy(getProxyAddress(outsideProxy));<NEW_LINE><MASK><NEW_LINE>if (noProxy != null) {<NEW_LINE>List<String> noProxyHosts = Arrays.asList(noProxy.split(","));<NEW_LINE>proxy.setChainedProxyNonProxyHosts(noProxyHosts);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>FileDownloadFilter downloadFilter = new FileDownloadFilter(config);<NEW_LINE>addRequestFilter("authentication", new AuthenticationFilter());<NEW_LINE>addRequestFilter("requestSizeWatchdog", new RequestSizeWatchdog());<NEW_LINE>addResponseFilter("responseSizeWatchdog", new ResponseSizeWatchdog());<NEW_LINE>addRequestFilter("download", downloadFilter);<NEW_LINE>addResponseFilter("download", downloadFilter);<NEW_LINE>proxy.start(config.proxyPort());<NEW_LINE>port = proxy.getPort();<NEW_LINE>} | String noProxy = outsideProxy.getNoProxy(); |
723,573 | public synchronized byte[] exportCollection() {<NEW_LINE>// returns null if the collection is empty<NEW_LINE>// experimental; supervise CPU load<NEW_LINE>sort();<NEW_LINE>// uniq();<NEW_LINE>// trim();<NEW_LINE>// on case the collection is sorted<NEW_LINE>assert this.sortBound == this.chunkcount;<NEW_LINE>assert size() * this.rowdef.objectsize <= this.chunkcache.length : "this.size() = " + size() + ", objectsize = " + this.rowdef.objectsize + ", chunkcache.length = " + this.chunkcache.length;<NEW_LINE>final Row row = exportRow(size() * this.rowdef.objectsize);<NEW_LINE>final Row.<MASK><NEW_LINE>assert (this.sortBound <= this.chunkcount) : "sortBound = " + this.sortBound + ", chunkcount = " + this.chunkcount;<NEW_LINE>assert (this.chunkcount <= this.chunkcache.length / this.rowdef.objectsize) : "chunkcount = " + this.chunkcount + ", chunkcache.length = " + this.chunkcache.length + ", rowdef.objectsize = " + this.rowdef.objectsize;<NEW_LINE>entry.setCol(exp_chunkcount, this.chunkcount);<NEW_LINE>entry.setCol(exp_last_read, daysSince2000(System.currentTimeMillis()));<NEW_LINE>entry.setCol(exp_last_wrote, daysSince2000(this.lastTimeWrote));<NEW_LINE>entry.setCol(exp_order_type, (this.rowdef.objectOrder == null) ? ASCII.getBytes("__") : ASCII.getBytes(this.rowdef.objectOrder.signature()));<NEW_LINE>entry.setCol(exp_order_bound, this.sortBound);<NEW_LINE>entry.setCol(exp_collection, this.chunkcache);<NEW_LINE>return entry.bytes();<NEW_LINE>} | Entry entry = row.newEntry(); |
675,100 | private void readSub4x4(MBlock mBlock, int partNo, boolean tAvb, boolean lAvb, int blk8x8X, int blk8x8Y, int mbX, MBType leftMBType, MBType topMBType, MBType curMBType, PartPred leftPred, PartPred topPred, PartPred partPred, int list) {<NEW_LINE>mBlock.pb8x8.mvdX1[list][partNo] = readMVD(0, lAvb, tAvb, leftMBType, topMBType, leftPred, topPred, partPred, mbX, blk8x8X, blk8x8Y, 1, 1, list);<NEW_LINE>mBlock.pb8x8.mvdY1[list][partNo] = readMVD(1, lAvb, tAvb, leftMBType, topMBType, leftPred, topPred, partPred, mbX, blk8x8X, blk8x8Y, 1, 1, list);<NEW_LINE>mBlock.pb8x8.mvdX2[list][partNo] = readMVD(0, true, tAvb, curMBType, topMBType, partPred, topPred, partPred, mbX, blk8x8X + 1, blk8x8Y, 1, 1, list);<NEW_LINE>mBlock.pb8x8.mvdY2[list][partNo] = readMVD(1, true, tAvb, curMBType, topMBType, partPred, topPred, partPred, mbX, blk8x8X + 1, blk8x8Y, 1, 1, list);<NEW_LINE>mBlock.pb8x8.mvdX3[list][partNo] = readMVD(0, lAvb, true, leftMBType, curMBType, leftPred, partPred, partPred, mbX, blk8x8X, blk8x8Y + 1, 1, 1, list);<NEW_LINE>mBlock.pb8x8.mvdY3[list][partNo] = readMVD(1, lAvb, true, leftMBType, curMBType, leftPred, partPred, partPred, mbX, blk8x8X, blk8x8Y + <MASK><NEW_LINE>mBlock.pb8x8.mvdX4[list][partNo] = readMVD(0, true, true, curMBType, curMBType, partPred, partPred, partPred, mbX, blk8x8X + 1, blk8x8Y + 1, 1, 1, list);<NEW_LINE>mBlock.pb8x8.mvdY4[list][partNo] = readMVD(1, true, true, curMBType, curMBType, partPred, partPred, partPred, mbX, blk8x8X + 1, blk8x8Y + 1, 1, 1, list);<NEW_LINE>} | 1, 1, 1, list); |
111,323 | public static AsyncResult<Void> editToolSettings(final Project project, final InspectionProfile inspectionProfile, final boolean canChooseDifferentProfile, final String selectedToolShortName) {<NEW_LINE>final <MASK><NEW_LINE>final ErrorsConfigurable errorsConfigurable;<NEW_LINE>if (!canChooseDifferentProfile) {<NEW_LINE>errorsConfigurable = new IDEInspectionToolsConfigurable(InspectionProjectProfileManager.getInstance(project), InspectionProfileManager.getInstance());<NEW_LINE>} else {<NEW_LINE>errorsConfigurable = ErrorsConfigurable.SERVICE.createConfigurable(project);<NEW_LINE>}<NEW_LINE>return settingsUtil.editConfigurable(project, errorsConfigurable, new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>errorsConfigurable.selectProfile(inspectionProfile);<NEW_LINE>SwingUtilities.invokeLater(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>errorsConfigurable.selectInspectionTool(selectedToolShortName);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | ShowSettingsUtil settingsUtil = ShowSettingsUtil.getInstance(); |
1,678,616 | private JComponent createProgressComponent() {<NEW_LINE>progressLabel = new JLabel(getDisplayName());<NEW_LINE>progressBar = super.getProgressComponent();<NEW_LINE>// NOI18N<NEW_LINE>stopButton = new JButton(NbBundle.getMessage(WizardStepProgressSupport.class, "BK2022"));<NEW_LINE>stopButton.addActionListener(new ActionListener() {<NEW_LINE><NEW_LINE>public void actionPerformed(ActionEvent e) {<NEW_LINE>cancel();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>JPanel panel = new JPanel();<NEW_LINE>GroupLayout layout = new GroupLayout(panel);<NEW_LINE>progressLine = new JPanel();<NEW_LINE>progressLine.add(progressBar);<NEW_LINE>progressLine.add(Box.createHorizontalStrut(LayoutStyle.getInstance().getPreferredGap(progressBar, stopButton, RELATED, SwingConstants.EAST, progressLine)));<NEW_LINE>progressLine.add(stopButton);<NEW_LINE>progressLine.setLayout(new BoxLayout(progressLine, BoxLayout.X_AXIS));<NEW_LINE>progressBar.setAlignmentX(JComponent.CENTER_ALIGNMENT);<NEW_LINE><MASK><NEW_LINE>layout.setHorizontalGroup(layout.createParallelGroup(LEADING).addComponent(progressLabel).addComponent(progressLine));<NEW_LINE>layout.setVerticalGroup(layout.createSequentialGroup().addComponent(progressLabel).addPreferredGap(RELATED).addComponent(progressLine));<NEW_LINE>panel.setLayout(layout);<NEW_LINE>// hiding should not affect prefsize<NEW_LINE>layout.setHonorsVisibility(false);<NEW_LINE>progressLabel.setVisible(false);<NEW_LINE>progressLine.setVisible(false);<NEW_LINE>return panel;<NEW_LINE>} | stopButton.setAlignmentX(JComponent.CENTER_ALIGNMENT); |
1,480,985 | public void assertPasses(String pageName, String pageType, String suiteFilter, String excludeSuiteFilter) throws Exception {<NEW_LINE>FitNesseContext context = ContextConfigurator.systemDefaults().withRootPath(fitNesseRootPath).withPort(port).makeFitNesseContext();<NEW_LINE>JavaFormatter testFormatter = new JavaFormatter(pageName);<NEW_LINE>testFormatter.setResultsRepository(new JavaFormatter.FolderResultsRepository(outputDir));<NEW_LINE>List<WikiPage> pages = initChildren(pageName, suiteFilter, excludeSuiteFilter, context);<NEW_LINE>TestRun run = createTestRun(context, pages);<NEW_LINE>MultipleTestsRunner testRunner = createTestRunner(run, context, debugMode);<NEW_LINE>testRunner.addTestSystemListener(testFormatter);<NEW_LINE>testRunner.addTestSystemListener(resultsListener);<NEW_LINE>testRunner.addExecutionLogListener(new ConsoleExecutionLogListener());<NEW_LINE>testRunner.executeTestPages();<NEW_LINE>TestSummary summary = testFormatter.getTotalSummary();<NEW_LINE>assertEquals("wrong", 0, summary.getWrong());<NEW_LINE>assertEquals("exceptions", 0, summary.getExceptions());<NEW_LINE>assertTrue(msgAtLeastOneTest(pageName, summary), <MASK><NEW_LINE>} | summary.getRight() > 0); |
497,555 | public void saveAsFile() {<NEW_LINE>JFileChooser fileChooser = new JFileChooser();<NEW_LINE>// Sets selected file in JFileChooser to current file<NEW_LINE>if (currentFile.getURL().getScheme().equals(LocalFile.SCHEMA)) {<NEW_LINE>fileChooser.setSelectedFile(new java.io.File(currentFile.getAbsolutePath()));<NEW_LINE>}<NEW_LINE>fileChooser.setDialogType(JFileChooser.SAVE_DIALOG);<NEW_LINE>int ret = fileChooser.showSaveDialog(windowFrame);<NEW_LINE>if (ret == JFileChooser.APPROVE_OPTION) {<NEW_LINE>AbstractFile destFile;<NEW_LINE>try {<NEW_LINE>destFile = FileFactory.getFile(fileChooser.getSelectedFile().getAbsolutePath(), true);<NEW_LINE>} catch (IOException e) {<NEW_LINE>InformationDialog.showErrorDialog(windowFrame, Translator.get("write_error"), Translator.get("file_editor.cannot_write"));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Check for file collisions, i.e. if the file already exists in the destination<NEW_LINE>int collision = <MASK><NEW_LINE>if (collision != FileCollisionChecker.NO_COLLOSION) {<NEW_LINE>// File already exists in destination, ask the user what to do (cancel, overwrite,...) but<NEW_LINE>// do not offer the multiple file mode options such as 'skip' and 'apply to all'.<NEW_LINE>int action = new FileCollisionDialog(windowFrame, windowFrame, /* mainFrame */<NEW_LINE>collision, null, destFile, false, false).getActionValue();<NEW_LINE>if (action != FileCollisionDialog.OVERWRITE_ACTION) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>trySave(destFile);<NEW_LINE>}<NEW_LINE>} | FileCollisionChecker.checkForCollision(null, destFile); |
528,067 | public static ArrayList<double[]> initParam(double[] data, double[] residual, int p, int q, int optOrder, double mean, int ifIntercept) {<NEW_LINE>// regression<NEW_LINE>OLSMultipleLinearRegression lm = new OLSMultipleLinearRegression();<NEW_LINE>// construct data set<NEW_LINE>int len = p + q;<NEW_LINE>int start = Math.max(p, q) + optOrder;<NEW_LINE>double[] y = new double[data.length - start];<NEW_LINE>double[][] x = new double[data.length - start][p + q];<NEW_LINE>for (int i = start; i < data.length; i++) {<NEW_LINE>y[i <MASK><NEW_LINE>for (int j = 0; j < len; j++) {<NEW_LINE>if (j < p) {<NEW_LINE>x[i - start][j] = data[i - j - 1];<NEW_LINE>}<NEW_LINE>if (j >= p) {<NEW_LINE>x[i - start][j] = residual[i - j + p - 1];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>lm.newSampleData(y, x);<NEW_LINE>// Compute approximated MLE parameters of this iteration<NEW_LINE>// first of Beta is intercept<NEW_LINE>double[] beta = lm.estimateRegressionParameters();<NEW_LINE>double[] newARCoef = new double[p];<NEW_LINE>double[] newMACoef = new double[q];<NEW_LINE>double[] newIntercept = new double[1];<NEW_LINE>System.arraycopy(beta, 1, newARCoef, 0, p);<NEW_LINE>for (int i = 0; i < q; i++) {<NEW_LINE>newMACoef[i] = beta[p + i + 1];<NEW_LINE>}<NEW_LINE>double sum = 1;<NEW_LINE>for (int i = 0; i < p; i++) {<NEW_LINE>sum = sum - newARCoef[i];<NEW_LINE>}<NEW_LINE>if (ifIntercept == 1) {<NEW_LINE>newIntercept[0] = beta[0];<NEW_LINE>} else {<NEW_LINE>newIntercept[0] = 0;<NEW_LINE>}<NEW_LINE>ArrayList<double[]> result = new ArrayList<>();<NEW_LINE>result.add(newARCoef);<NEW_LINE>result.add(newMACoef);<NEW_LINE>result.add(newIntercept);<NEW_LINE>return result;<NEW_LINE>} | - start] = data[i]; |
1,661,577 | public ServiceLimit unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ServiceLimit serviceLimit = new ServiceLimit();<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("isServiceLimited", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>serviceLimit.setIsServiceLimited(context.getUnmarshaller(Boolean.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("unit", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>serviceLimit.setUnit(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("value", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>serviceLimit.setValue(context.getUnmarshaller(Long.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 serviceLimit;<NEW_LINE>} | class).unmarshall(context)); |
1,191,012 | protected void handleListenerSetup(final AsyncResult<DatagramSocket> listenResult, final CompletableFuture<InetSocketAddress> addressFuture) {<NEW_LINE>if (listenResult.failed()) {<NEW_LINE>Throwable cause = listenResult.cause();<NEW_LINE>LOG.error("An exception occurred when starting the peer discovery agent", cause);<NEW_LINE>if (cause instanceof BindException || cause instanceof SocketException) {<NEW_LINE>cause = new PeerDiscoveryServiceException(String.format("Failed to bind Ethereum UDP discovery listener to %s:%d: %s", config.getBindHost(), config.getBindPort(), cause.getMessage()));<NEW_LINE>}<NEW_LINE>addressFuture.completeExceptionally(cause);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>this.socket = listenResult.result();<NEW_LINE>// TODO: when using wildcard hosts (0.0.0.0), we need to handle multiple addresses by<NEW_LINE>// selecting<NEW_LINE>// the correct 'announce' address.<NEW_LINE>final String effectiveHost = socket.localAddress().host();<NEW_LINE>final int effectivePort = socket<MASK><NEW_LINE>LOG.info("Started peer discovery agent successfully, on effective host={} and port={}", effectiveHost, effectivePort);<NEW_LINE>socket.exceptionHandler(this::handleException);<NEW_LINE>socket.handler(this::handlePacket);<NEW_LINE>final InetSocketAddress address = new InetSocketAddress(socket.localAddress().host(), socket.localAddress().port());<NEW_LINE>addressFuture.complete(address);<NEW_LINE>} | .localAddress().port(); |
763,394 | private static byte[] objectToWireFormat(ColumnSchema col, Object value) {<NEW_LINE>switch(col.getType()) {<NEW_LINE>case BOOL:<NEW_LINE>return Bytes.fromBoolean((Boolean) value);<NEW_LINE>case INT8:<NEW_LINE>return new byte<MASK><NEW_LINE>case INT16:<NEW_LINE>return Bytes.fromShort((Short) value);<NEW_LINE>case INT32:<NEW_LINE>return Bytes.fromInt((Integer) value);<NEW_LINE>case INT64:<NEW_LINE>case TIMESTAMP:<NEW_LINE>return Bytes.fromLong((Long) value);<NEW_LINE>case STRING:<NEW_LINE>return ((String) value).getBytes(Charsets.UTF_8);<NEW_LINE>case BINARY:<NEW_LINE>return (byte[]) value;<NEW_LINE>case FLOAT:<NEW_LINE>return Bytes.fromFloat((Float) value);<NEW_LINE>case DOUBLE:<NEW_LINE>return Bytes.fromDouble((Double) value);<NEW_LINE>default:<NEW_LINE>throw new IllegalArgumentException("The column " + col.getName() + " is of type " + col.getType() + " which is unknown");<NEW_LINE>}<NEW_LINE>} | [] { (Byte) value }; |
768,567 | public static DescribeWebsiteScanResultDetailResponse unmarshall(DescribeWebsiteScanResultDetailResponse describeWebsiteScanResultDetailResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeWebsiteScanResultDetailResponse.setRequestId(_ctx.stringValue("DescribeWebsiteScanResultDetailResponse.RequestId"));<NEW_LINE>describeWebsiteScanResultDetailResponse.setBaseline(_ctx.stringValue("DescribeWebsiteScanResultDetailResponse.Baseline"));<NEW_LINE>describeWebsiteScanResultDetailResponse.setContent(_ctx.stringValue("DescribeWebsiteScanResultDetailResponse.Content"));<NEW_LINE>describeWebsiteScanResultDetailResponse.setTamperedSource(_ctx.stringValue("DescribeWebsiteScanResultDetailResponse.TamperedSource"));<NEW_LINE>describeWebsiteScanResultDetailResponse.setResourceType<MASK><NEW_LINE>List<String> hitKeywords = new ArrayList<String>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeWebsiteScanResultDetailResponse.HitKeywords.Length"); i++) {<NEW_LINE>hitKeywords.add(_ctx.stringValue("DescribeWebsiteScanResultDetailResponse.HitKeywords[" + i + "]"));<NEW_LINE>}<NEW_LINE>describeWebsiteScanResultDetailResponse.setHitKeywords(hitKeywords);<NEW_LINE>List<ImageScanResult> imageScanResults = new ArrayList<ImageScanResult>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeWebsiteScanResultDetailResponse.ImageScanResults.Length"); i++) {<NEW_LINE>ImageScanResult imageScanResult = new ImageScanResult();<NEW_LINE>imageScanResult.setUrl(_ctx.stringValue("DescribeWebsiteScanResultDetailResponse.ImageScanResults[" + i + "].Url"));<NEW_LINE>List<String> labels = new ArrayList<String>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("DescribeWebsiteScanResultDetailResponse.ImageScanResults[" + i + "].Labels.Length"); j++) {<NEW_LINE>labels.add(_ctx.stringValue("DescribeWebsiteScanResultDetailResponse.ImageScanResults[" + i + "].Labels[" + j + "]"));<NEW_LINE>}<NEW_LINE>imageScanResult.setLabels(labels);<NEW_LINE>imageScanResults.add(imageScanResult);<NEW_LINE>}<NEW_LINE>describeWebsiteScanResultDetailResponse.setImageScanResults(imageScanResults);<NEW_LINE>return describeWebsiteScanResultDetailResponse;<NEW_LINE>} | (_ctx.stringValue("DescribeWebsiteScanResultDetailResponse.ResourceType")); |
173,569 | public I_C_Flatrate_Term createSubscriptionTerm(@NonNull final I_C_OrderLine ol, final boolean completeIt) {<NEW_LINE>final I_C_Order order = InterfaceWrapperHelper.create(ol.getC_Order(), I_C_Order.class);<NEW_LINE>final I_C_Flatrate_Conditions cond = ol.getC_Flatrate_Conditions();<NEW_LINE>final I_C_Flatrate_Term newTerm = InterfaceWrapperHelper.newInstance(I_C_Flatrate_Term.class, ol);<NEW_LINE>newTerm.setC_OrderLine_Term_ID(ol.getC_OrderLine_ID());<NEW_LINE>newTerm.setC_Order_Term_ID(ol.getC_Order_ID());<NEW_LINE>newTerm.setC_Flatrate_Conditions_ID(cond.getC_Flatrate_Conditions_ID());<NEW_LINE>// important: we need to use qtyEntered here, because qtyOrdered (which<NEW_LINE>// is used for pricing) contains the number of goods to be delivered<NEW_LINE>// over the whole subscription term<NEW_LINE>newTerm.setPlannedQtyPerUnit(ol.getQtyEntered());<NEW_LINE>newTerm.setC_UOM_ID(ol.getPrice_UOM_ID());<NEW_LINE>newTerm.setStartDate(order.getDatePromised());<NEW_LINE>newTerm.setMasterStartDate(order.getDatePromised());<NEW_LINE>newTerm.setDeliveryRule(order.getDeliveryRule());<NEW_LINE>newTerm.setDeliveryViaRule(order.getDeliveryViaRule());<NEW_LINE>final BPartnerLocationAndCaptureId billToLocationId = orderBL.getBillToLocationId(order);<NEW_LINE>final BPartnerContactId billToContactId = BPartnerContactId.ofRepoIdOrNull(billToLocationId.getBpartnerId(), order.getBill_User_ID());<NEW_LINE>ContractDocumentLocationAdapterFactory.billLocationAdapter(newTerm).setFrom(billToLocationId, billToContactId);<NEW_LINE>final BPartnerContactId dropshipContactId = BPartnerContactId.ofRepoIdOrNull(ol.getC_BPartner_ID(), ol.getAD_User_ID());<NEW_LINE>final BPartnerLocationAndCaptureId dropshipLocationId = orderBL.getShipToLocationId(order);<NEW_LINE>ContractDocumentLocationAdapterFactory.dropShipLocationAdapter(newTerm).setFrom(dropshipLocationId, dropshipContactId);<NEW_LINE>I_C_Flatrate_Data existingData = fetchFlatrateData(ol, order);<NEW_LINE>if (existingData == null) {<NEW_LINE>existingData = InterfaceWrapperHelper.newInstance(I_C_Flatrate_Data.class, ol);<NEW_LINE>existingData.setC_BPartner_ID(order.getBill_BPartner_ID());<NEW_LINE>save(existingData);<NEW_LINE>}<NEW_LINE>newTerm.setC_Flatrate_Data(existingData);<NEW_LINE>newTerm.setAD_User_InCharge_ID(order.getSalesRep_ID());<NEW_LINE>newTerm.setIsSimulation(cond.isSimulation());<NEW_LINE>newTerm.setM_Product_ID(ol.getM_Product_ID());<NEW_LINE>Services.get(IAttributeSetInstanceBL.class).cloneASI(ol, newTerm);<NEW_LINE>newTerm.setPriceActual(ol.getPriceActual());<NEW_LINE>newTerm.setC_Currency_ID(ol.getC_Currency_ID());<NEW_LINE>setPricingSystemTaxCategAndIsTaxIncluded(ol, newTerm);<NEW_LINE>newTerm.setContractStatus(X_C_Flatrate_Term.CONTRACTSTATUS_Waiting);<NEW_LINE>newTerm.setDocStatus(X_C_Flatrate_Term.DOCSTATUS_Drafted);<NEW_LINE>newTerm.setDocAction(X_C_Flatrate_Term.DOCACTION_Complete);<NEW_LINE>save(newTerm);<NEW_LINE>linkContractsIfNeeded(newTerm);<NEW_LINE>if (completeIt) {<NEW_LINE>Services.get(IDocumentBL.class).processEx(newTerm, <MASK><NEW_LINE>}<NEW_LINE>return newTerm;<NEW_LINE>} | X_C_Flatrate_Term.DOCACTION_Complete, X_C_Flatrate_Term.DOCSTATUS_Completed); |
1,269,244 | final DescribeJobTemplateResult executeDescribeJobTemplate(DescribeJobTemplateRequest describeJobTemplateRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeJobTemplateRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeJobTemplateRequest> request = null;<NEW_LINE>Response<DescribeJobTemplateResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeJobTemplateRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeJobTemplateRequest));<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(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "IoT");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeJobTemplate");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeJobTemplateResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeJobTemplateResultJsonUnmarshaller());<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>} | HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); |
1,164,096 | protected Long extractOffsetIncrementedId(Schema schema, Struct record) {<NEW_LINE>final Long extractedId;<NEW_LINE>final Field field = schema.field(incrementingColumn.name());<NEW_LINE>if (field == null) {<NEW_LINE>throw new DataException("Incrementing column " + incrementingColumn.name() + " not found in " + schema.fields().stream().map(Field::name).collect(Collectors.joining(",")));<NEW_LINE>}<NEW_LINE>final Schema incrementingColumnSchema = field.schema();<NEW_LINE>final Object incrementingColumnValue = record.get(incrementingColumn.name());<NEW_LINE>if (incrementingColumnValue == null) {<NEW_LINE>throw new ConnectException(<MASK><NEW_LINE>} else if (isIntegralPrimitiveType(incrementingColumnValue)) {<NEW_LINE>extractedId = ((Number) incrementingColumnValue).longValue();<NEW_LINE>} else if (incrementingColumnSchema.name() != null && incrementingColumnSchema.name().equals(Decimal.LOGICAL_NAME)) {<NEW_LINE>extractedId = extractDecimalId(incrementingColumnValue);<NEW_LINE>} else {<NEW_LINE>throw new ConnectException("Invalid type for incrementing column: " + incrementingColumnSchema.type());<NEW_LINE>}<NEW_LINE>log.trace("Extracted incrementing column value: {}", extractedId);<NEW_LINE>return extractedId;<NEW_LINE>} | "Null value for incrementing column of type: " + incrementingColumnSchema.type()); |
1,405,042 | public void doCommand(String[] args) {<NEW_LINE>Long address;<NEW_LINE>String param = args[0];<NEW_LINE>address = Utils.longFromStringWithPrefix(param);<NEW_LINE>if (null == address) {<NEW_LINE><MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>out.print("\n");<NEW_LINE>boolean found = false;<NEW_LINE>for (int index = 0; index < argUnitNumber; index++) {<NEW_LINE>long currAddr = address.longValue() + (index * argUnitSize);<NEW_LINE>out.print("\t");<NEW_LINE>out.print(Utils.toHex(currAddr));<NEW_LINE>out.print(": ");<NEW_LINE>ImageAddressSpace ias = ctx.getAddressSpace();<NEW_LINE>ImagePointer ip = ias.getPointer(currAddr);<NEW_LINE>byte b = 0;<NEW_LINE>short s = 0;<NEW_LINE>int i = 0;<NEW_LINE>long l = 0;<NEW_LINE>try {<NEW_LINE>switch(argUnitSize) {<NEW_LINE>case 1:<NEW_LINE>b = ip.getByteAt(0);<NEW_LINE>break;<NEW_LINE>case 2:<NEW_LINE>s = ip.getShortAt(0);<NEW_LINE>break;<NEW_LINE>case 4:<NEW_LINE>i = ip.getIntAt(0);<NEW_LINE>break;<NEW_LINE>case 8:<NEW_LINE>l = ip.getLongAt(0);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>found = true;<NEW_LINE>} catch (CorruptDataException e) {<NEW_LINE>found = false;<NEW_LINE>} catch (MemoryAccessException e) {<NEW_LINE>found = false;<NEW_LINE>}<NEW_LINE>if (found) {<NEW_LINE>switch(argUnitSize) {<NEW_LINE>case 1:<NEW_LINE>out.print(Utils.toFixedWidthHex(b));<NEW_LINE>break;<NEW_LINE>case 2:<NEW_LINE>out.print(Utils.toFixedWidthHex(s));<NEW_LINE>break;<NEW_LINE>case 4:<NEW_LINE>out.print(Utils.toFixedWidthHex(i));<NEW_LINE>break;<NEW_LINE>case 8:<NEW_LINE>out.print(Utils.toFixedWidthHex(l));<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>out.print("\n");<NEW_LINE>}<NEW_LINE>if (!found) {<NEW_LINE>out.print("<address not found in any address space>");<NEW_LINE>}<NEW_LINE>out.print("\n");<NEW_LINE>} | out.println("invalid hex address specify; address must be specified as " + "\"0x<hex_address>\""); |
380,966 | public void sendRequest(String pathInfo, PrintWriter respWriter) {<NEW_LINE>try {<NEW_LINE>if (pathInfo.equals("/fail")) {<NEW_LINE>getNonPhoto();<NEW_LINE>} else {<NEW_LINE>if (pathInfo.startsWith("/album/")) {<NEW_LINE>getAlbum(respWriter, Long.parseLong(pathInfo.substring(<MASK><NEW_LINE>} else {<NEW_LINE>// this track does not make any assumption on server<NEW_LINE>// we need to create photo first, find it and clean them up<NEW_LINE>// we use both sync and async approaches for creating<NEW_LINE>final long newPhotoId = createPhoto(respWriter);<NEW_LINE>final CountDownLatch latch = new CountDownLatch(1);<NEW_LINE>createPhotoAsync(respWriter, latch, newPhotoId);<NEW_LINE>getPhoto(respWriter, newPhotoId);<NEW_LINE>findPhoto(respWriter);<NEW_LINE>partialUpdatePhoto(respWriter, newPhotoId);<NEW_LINE>// photos and albums have IDs starting from 1<NEW_LINE>getAlbumSummary(respWriter, (long) new Random().nextInt(10) + 1);<NEW_LINE>purgeAllPhotos(respWriter);<NEW_LINE>try {<NEW_LINE>latch.await();<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>respWriter.println(e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (RemoteInvocationException e) {<NEW_LINE>respWriter.println("Error in example client: " + e.getMessage());<NEW_LINE>}<NEW_LINE>respWriter.flush();<NEW_LINE>} | "/album/".length()))); |
1,388,625 | protected JPanel buildReplacementTable(MaliciousAttachmentTableModel tableModel) {<NEW_LINE>final JPanel panel = new JPanel(new BorderLayout());<NEW_LINE>final JXTable table = JTableFactory.getInstance().makeJXTable(tableModel);<NEW_LINE>setupTable(table);<NEW_LINE>JScrollPane tableScrollPane = new JScrollPane(table);<NEW_LINE>tableScrollPane.setBorder(BorderFactory.createEmptyBorder());<NEW_LINE>JXToolBar toolbar = UISupport.createToolbar();<NEW_LINE>addReplacementButton = UISupport.createToolbarButton(new AddFileAction());<NEW_LINE>toolbar.add(addReplacementButton);<NEW_LINE>removeReplacementButton = UISupport.createToolbarButton(new RemoveReplacementFileAction(tableModel, table));<NEW_LINE>toolbar.add(removeReplacementButton);<NEW_LINE>removeReplacementButton.setEnabled(false);<NEW_LINE>toolbar.add(UISupport.createToolbarButton(new HelpAction(HelpUrls.SECURITY_MALICIOUS_ATTACHMENT_HELP)));<NEW_LINE>panel.<MASK><NEW_LINE>panel.add(tableScrollPane, BorderLayout.CENTER);<NEW_LINE>table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void valueChanged(ListSelectionEvent e) {<NEW_LINE>if (removeReplacementButton != null) {<NEW_LINE>removeReplacementButton.setEnabled(table.getSelectedRowCount() > 0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>panel.setBorder(BorderFactory.createLineBorder(new Color(0), 1));<NEW_LINE>return panel;<NEW_LINE>} | add(toolbar, BorderLayout.PAGE_START); |
351,679 | public long handle(Emulator<?> emulator) {<NEW_LINE>RegisterContext context = emulator.getContext();<NEW_LINE>UnidbgPointer <MASK><NEW_LINE>UnidbgPointer jmethodID = context.getPointerArg(2);<NEW_LINE>UnidbgPointer va_list = context.getPointerArg(3);<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("CallVoidMethodV object=" + object + ", jmethodID=" + jmethodID + ", va_list=" + va_list);<NEW_LINE>}<NEW_LINE>DvmObject<?> dvmObject = getObject(object.toIntPeer());<NEW_LINE>DvmClass dvmClass = dvmObject == null ? null : dvmObject.getObjectType();<NEW_LINE>DvmMethod dvmMethod = dvmClass == null ? null : dvmClass.getMethod(jmethodID.toIntPeer());<NEW_LINE>if (dvmMethod == null) {<NEW_LINE>throw new BackendException();<NEW_LINE>} else {<NEW_LINE>VaList vaList = new VaList32(emulator, DalvikVM.this, va_list, dvmMethod);<NEW_LINE>dvmMethod.callVoidMethodV(dvmObject, vaList);<NEW_LINE>if (verbose) {<NEW_LINE>System.out.printf("JNIEnv->CallVoidMethodV(%s, %s(%s)) was called from %s%n", dvmObject, dvmMethod.methodName, vaList.formatArgs(), context.getLRPointer());<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>} | object = context.getPointerArg(1); |
264,606 | public void addClientBehavior(String eventName, ClientBehavior behavior) {<NEW_LINE>Collection<MASK><NEW_LINE>if (eventNames == null) {<NEW_LINE>// component didn't implement getEventNames properly<NEW_LINE>// log an error and return<NEW_LINE>if (log.isLoggable(Level.SEVERE)) {<NEW_LINE>log.severe("attempted to add a behavior to a component which did not properly " + "implement getEventNames. getEventNames must not return null");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (eventNames.contains(eventName)) {<NEW_LINE>if (_behaviorsMap == null) {<NEW_LINE>_behaviorsMap = new HashMap<String, List<ClientBehavior>>();<NEW_LINE>}<NEW_LINE>List<ClientBehavior> behaviorsForEvent = _behaviorsMap.get(eventName);<NEW_LINE>if (behaviorsForEvent == null) {<NEW_LINE>// Normally have client only 1 client behaviour per event name,<NEW_LINE>// so size 2 must be sufficient:<NEW_LINE>behaviorsForEvent = new _DeltaList<ClientBehavior>(new ArrayList<ClientBehavior>(2));<NEW_LINE>_behaviorsMap.put(eventName, behaviorsForEvent);<NEW_LINE>}<NEW_LINE>behaviorsForEvent.add(behavior);<NEW_LINE>_unmodifiableBehaviorsMap = null;<NEW_LINE>}<NEW_LINE>} | <String> eventNames = getEventNames(); |
1,319,619 | public static <T> T createLambda(Object instance, Method instanceMethod, Class<?> functionalIntfCls) {<NEW_LINE>try {<NEW_LINE>Method intfMethod = findAbstractMethod(functionalIntfCls);<NEW_LINE>MethodHandle methodHandle = LOOKUP.unreflect(instanceMethod);<NEW_LINE>MethodType intfMethodType = MethodType.methodType(intfMethod.getReturnType(<MASK><NEW_LINE>MethodType instanceMethodType = MethodType.methodType(instanceMethod.getReturnType(), instanceMethod.getParameterTypes());<NEW_LINE>CallSite callSite = LambdaMetafactory.metafactory(LOOKUP, intfMethod.getName(), MethodType.methodType(functionalIntfCls, instance.getClass()), intfMethodType, methodHandle, instanceMethodType);<NEW_LINE>return (T) callSite.getTarget().bindTo(instance).invoke();<NEW_LINE>} catch (Throwable e) {<NEW_LINE>throw new IllegalStateException("Failed to create lambda from " + instanceMethod, e);<NEW_LINE>}<NEW_LINE>} | ), intfMethod.getParameterTypes()); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.