idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,646,803 | public static GetSmsConfigResponse unmarshall(GetSmsConfigResponse getSmsConfigResponse, UnmarshallerContext context) {<NEW_LINE>getSmsConfigResponse.setRequestId(context.stringValue("GetSmsConfigResponse.RequestId"));<NEW_LINE>getSmsConfigResponse.setSuccess(context.booleanValue("GetSmsConfigResponse.Success"));<NEW_LINE>getSmsConfigResponse.setCode(context.stringValue("GetSmsConfigResponse.Code"));<NEW_LINE>getSmsConfigResponse.setMessage(context.stringValue("GetSmsConfigResponse.Message"));<NEW_LINE>getSmsConfigResponse.setHttpStatusCode(context.integerValue("GetSmsConfigResponse.HttpStatusCode"));<NEW_LINE>List<SmsConfig> smsConfigs = new ArrayList<SmsConfig>();<NEW_LINE>for (int i = 0; i < context.lengthValue("GetSmsConfigResponse.SmsConfigs.Length"); i++) {<NEW_LINE>SmsConfig smsConfig = new SmsConfig();<NEW_LINE>smsConfig.setId(context.longValue("GetSmsConfigResponse.SmsConfigs[" + i + "].Id"));<NEW_LINE>smsConfig.setInstance(context.stringValue("GetSmsConfigResponse.SmsConfigs[" + i + "].Instance"));<NEW_LINE>smsConfig.setSignName(context.stringValue<MASK><NEW_LINE>smsConfig.setTemplateCode(context.stringValue("GetSmsConfigResponse.SmsConfigs[" + i + "].TemplateCode"));<NEW_LINE>smsConfig.setScenario(context.integerValue("GetSmsConfigResponse.SmsConfigs[" + i + "].Scenario"));<NEW_LINE>smsConfig.setName(context.stringValue("GetSmsConfigResponse.SmsConfigs[" + i + "].Name"));<NEW_LINE>smsConfig.setDescription(context.stringValue("GetSmsConfigResponse.SmsConfigs[" + i + "].Description"));<NEW_LINE>smsConfig.setExtra(context.stringValue("GetSmsConfigResponse.SmsConfigs[" + i + "].Extra"));<NEW_LINE>smsConfig.setGmtCreate(context.stringValue("GetSmsConfigResponse.SmsConfigs[" + i + "].GmtCreate"));<NEW_LINE>smsConfig.setGmtModified(context.stringValue("GetSmsConfigResponse.SmsConfigs[" + i + "].GmtModified"));<NEW_LINE>smsConfigs.add(smsConfig);<NEW_LINE>}<NEW_LINE>getSmsConfigResponse.setSmsConfigs(smsConfigs);<NEW_LINE>return getSmsConfigResponse;<NEW_LINE>} | ("GetSmsConfigResponse.SmsConfigs[" + i + "].SignName")); |
649,728 | public Object calculate(Context ctx) {<NEW_LINE>if (param == null) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("rgb" + mm.getMessage("function.missingParam"));<NEW_LINE>}<NEW_LINE>int size = param.getSubSize();<NEW_LINE>if (size < 3 || size > 4) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("rgb" + mm.getMessage("function.invalidParam"));<NEW_LINE>}<NEW_LINE>int r, g, b, a = 255;<NEW_LINE>IParam sub1 = param.getSub(0);<NEW_LINE>IParam sub2 = param.getSub(1);<NEW_LINE>IParam sub3 = param.getSub(2);<NEW_LINE>if (sub1 == null || sub2 == null || sub3 == null) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("rgb" + mm.getMessage("function.invalidParam"));<NEW_LINE>}<NEW_LINE>Object result1 = sub1.getLeafExpression().calculate(ctx);<NEW_LINE>if (result1 instanceof Number) {<NEW_LINE>r = ((Number) result1).intValue();<NEW_LINE>} else {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("rgb" + mm.getMessage("function.paramTypeError"));<NEW_LINE>}<NEW_LINE>Object result2 = sub2.getLeafExpression().calculate(ctx);<NEW_LINE>if (result2 instanceof Number) {<NEW_LINE>g = ((Number) result2).intValue();<NEW_LINE>} else {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("rgb" <MASK><NEW_LINE>}<NEW_LINE>Object result3 = sub3.getLeafExpression().calculate(ctx);<NEW_LINE>if (result3 instanceof Number) {<NEW_LINE>b = ((Number) result3).intValue();<NEW_LINE>} else {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("rgb" + mm.getMessage("function.paramTypeError"));<NEW_LINE>}<NEW_LINE>if (size == 4) {<NEW_LINE>IParam sub4 = param.getSub(3);<NEW_LINE>if (sub4 != null) {<NEW_LINE>Object result4 = sub4.getLeafExpression().calculate(ctx);<NEW_LINE>if (result4 instanceof Number) {<NEW_LINE>a = ((Number) result4).intValue();<NEW_LINE>} else {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("rgb" + mm.getMessage("function.paramTypeError"));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return ((a & 0xFF) << 24) | ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | ((b & 0xFF) << 0);<NEW_LINE>} | + mm.getMessage("function.paramTypeError")); |
791,041 | public void marshall(ListChannelMessagesRequest listChannelMessagesRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (listChannelMessagesRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(listChannelMessagesRequest.getChannelArn(), CHANNELARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(listChannelMessagesRequest.getSortOrder(), SORTORDER_BINDING);<NEW_LINE>protocolMarshaller.marshall(listChannelMessagesRequest.getNotBefore(), NOTBEFORE_BINDING);<NEW_LINE>protocolMarshaller.marshall(listChannelMessagesRequest.getNotAfter(), NOTAFTER_BINDING);<NEW_LINE>protocolMarshaller.marshall(listChannelMessagesRequest.getMaxResults(), MAXRESULTS_BINDING);<NEW_LINE>protocolMarshaller.marshall(listChannelMessagesRequest.getNextToken(), NEXTTOKEN_BINDING);<NEW_LINE>protocolMarshaller.marshall(listChannelMessagesRequest.getChimeBearer(), CHIMEBEARER_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + <MASK><NEW_LINE>}<NEW_LINE>} | e.getMessage(), e); |
1,674,884 | private void terminateWorker(IMantisWorkerMetadata workerMeta, WorkerState finalWorkerState, JobCompletedReason reason) {<NEW_LINE>LOGGER.info("Terminating worker {} with number {}", workerMeta, workerMeta.getWorkerNumber());<NEW_LINE>try {<NEW_LINE>WorkerId workerId = workerMeta.getWorkerId();<NEW_LINE>// call vmservice terminate<NEW_LINE>scheduler.unscheduleAndTerminateWorker(workerMeta.getWorkerId(), Optional.ofNullable(workerMeta.getSlave()));<NEW_LINE>LOGGER.debug(<MASK><NEW_LINE>int stageNum = mantisJobMetaData.getWorkerNumberToStageMap().get(workerMeta.getWorkerNumber());<NEW_LINE>Optional<IMantisStageMetadata> stageMetaOp = mantisJobMetaData.getStageMetadata(stageNum);<NEW_LINE>if (stageMetaOp.isPresent()) {<NEW_LINE>// Mark work as terminal<NEW_LINE>WorkerTerminate terminateEvent = new WorkerTerminate(workerId, finalWorkerState, reason);<NEW_LINE>MantisStageMetadataImpl stageMetaData = (MantisStageMetadataImpl) stageMetaOp.get();<NEW_LINE>Optional<JobWorker> jobWorkerOp = stageMetaData.processWorkerEvent(terminateEvent, jobStore);<NEW_LINE>// Mark work as terminal<NEW_LINE>if (jobWorkerOp.isPresent()) {<NEW_LINE>jobStore.archiveWorker(jobWorkerOp.get().getMetadata());<NEW_LINE>eventPublisher.publishStatusEvent(new LifecycleEventsProto.WorkerStatusEvent(INFO, "Terminated worker, reason: " + reason.name(), workerMeta.getStageNum(), workerMeta.getWorkerId(), workerMeta.getState()));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>LOGGER.error("Stage {} not found while terminating worker {}", stageNum, workerId);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error("Error terminating worker {}", workerMeta.getWorkerId(), e);<NEW_LINE>}<NEW_LINE>} | "WorkerNumber->StageMap {}", mantisJobMetaData.getWorkerNumberToStageMap()); |
1,046,703 | public Value evaluate(Env env, Object... args) {<NEW_LINE>Value value = valueExpr.evaluate(env, args);<NEW_LINE>if (args != null) {<NEW_LINE>if (args.length == 1 && args[0] instanceof CoreMap) {<NEW_LINE>CoreMap cm = (CoreMap) args[0];<NEW_LINE>Class annotationKey = <MASK><NEW_LINE>if (annotationKey != null) {<NEW_LINE>cm.set(annotationKey, (value != null) ? value.get() : null);<NEW_LINE>return value;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (bindAsValue) {<NEW_LINE>env.bind(varName, value);<NEW_LINE>} else {<NEW_LINE>env.bind(varName, (value != null) ? value.get() : null);<NEW_LINE>if (TYPE_REGEX == value.getType()) {<NEW_LINE>try {<NEW_LINE>Object vobj = value.get();<NEW_LINE>if (vobj instanceof String) {<NEW_LINE>env.bindStringRegex(varName, (String) vobj);<NEW_LINE>} else if (vobj instanceof Pattern) {<NEW_LINE>env.bindStringRegex(varName, ((Pattern) vobj).pattern());<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return value;<NEW_LINE>} | EnvLookup.lookupAnnotationKey(env, varName); |
1,818,723 | protected Order mergeOfferCodes(Order anonymousCart, Order customerCart) {<NEW_LINE>// add all offers from anonymous order<NEW_LINE>Map<String, OfferCode> customerOffersMap = new HashMap<String, OfferCode>();<NEW_LINE>for (OfferCode customerOffer : customerCart.getAddedOfferCodes()) {<NEW_LINE>customerOffersMap.put(<MASK><NEW_LINE>}<NEW_LINE>for (OfferCode anonymousOffer : anonymousCart.getAddedOfferCodes()) {<NEW_LINE>if (!customerOffersMap.containsKey(anonymousOffer.getOfferCode())) {<NEW_LINE>OfferCode transferredCode = offerService.lookupOfferCodeByCode(anonymousOffer.getOfferCode());<NEW_LINE>OfferInfo info = anonymousCart.getAdditionalOfferInformation().get(anonymousOffer.getOffer());<NEW_LINE>OfferInfo offerInfo = offerDao.createOfferInfo();<NEW_LINE>for (String key : info.getFieldValues().keySet()) {<NEW_LINE>offerInfo.getFieldValues().put(key, info.getFieldValues().get(key));<NEW_LINE>}<NEW_LINE>customerCart.getAdditionalOfferInformation().put(transferredCode.getOffer(), offerInfo);<NEW_LINE>customerCart.addOfferCode(transferredCode);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return customerCart;<NEW_LINE>} | customerOffer.getOfferCode(), customerOffer); |
312,220 | private static void open(DbMethodCall mc) {<NEW_LINE>synchronized (mc.plugin) {<NEW_LINE>String path = normalizePath(mc.getAppContext(), (String<MASK><NEW_LINE>DbEntry dbe = null;<NEW_LINE>for (DbEntry v : dbmap.values()) {<NEW_LINE>if (v.path.equals(path)) {<NEW_LINE>dbe = v;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (dbe != null) {<NEW_LINE>dbe.countOpen();<NEW_LINE>mc.successOnMainThread(dbe.handle);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Map<String, Object> opts = cast(mc.args[2]);<NEW_LINE>EJDB2Builder b = new EJDB2Builder(path);<NEW_LINE>if (asBoolean(opts.get("readonly"), false)) {<NEW_LINE>b.readonly();<NEW_LINE>}<NEW_LINE>if (asBoolean(opts.get("truncate"), false)) {<NEW_LINE>b.truncate();<NEW_LINE>}<NEW_LINE>if (asBoolean(opts.get("wal_enabled"), true)) {<NEW_LINE>b.withWAL();<NEW_LINE>}<NEW_LINE>b.walCRCOnCheckpoint(asBoolean(opts.get("wal_check_crc_on_checkpoint"), false));<NEW_LINE>if (opts.containsKey("wal_checkpoint_buffer_sz")) {<NEW_LINE>b.walCheckpointBufferSize(asInt(opts.get("wal_checkpoint_buffer_sz"), 0));<NEW_LINE>}<NEW_LINE>if (opts.containsKey("wal_checkpoint_timeout_sec")) {<NEW_LINE>b.walCheckpointTimeoutSec(asInt(opts.get("wal_checkpoint_timeout_sec"), 0));<NEW_LINE>}<NEW_LINE>if (opts.containsKey("wal_savepoint_timeout_sec")) {<NEW_LINE>b.walSavepointTimeoutSec(asInt(opts.get("wal_savepoint_timeout_sec"), 0));<NEW_LINE>}<NEW_LINE>if (opts.containsKey("wal_wal_buffer_sz")) {<NEW_LINE>b.walBufferSize(asInt(opts.get("wal_wal_buffer_sz"), 0));<NEW_LINE>}<NEW_LINE>if (opts.containsKey("document_buffer_sz")) {<NEW_LINE>b.documentBufferSize(asInt(opts.get("document_buffer_sz"), 0));<NEW_LINE>}<NEW_LINE>if (opts.containsKey("sort_buffer_sz")) {<NEW_LINE>b.sortBufferSize(asInt(opts.get("sort_buffer_sz"), 0));<NEW_LINE>}<NEW_LINE>final Integer handle = dbkeys.incrementAndGet();<NEW_LINE>dbmap.put(handle, new DbEntry(b.open(), handle, path));<NEW_LINE>mc.successOnMainThread(handle);<NEW_LINE>}<NEW_LINE>} | ) mc.args[1]); |
1,026,654 | public void onSessionFinished(@NonNull TerminalSession finishedSession) {<NEW_LINE>TermuxService service = mActivity.getTermuxService();<NEW_LINE>if (service == null || service.wantsToStop()) {<NEW_LINE>// The service wants to stop as soon as possible.<NEW_LINE>mActivity.finishActivityIfNotFinishing();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int <MASK><NEW_LINE>// For plugin commands that expect the result back, we should immediately close the session<NEW_LINE>// and send the result back instead of waiting fo the user to press enter.<NEW_LINE>// The plugin can handle/show errors itself.<NEW_LINE>boolean isPluginExecutionCommandWithPendingResult = false;<NEW_LINE>TermuxSession termuxSession = service.getTermuxSession(index);<NEW_LINE>if (termuxSession != null) {<NEW_LINE>isPluginExecutionCommandWithPendingResult = termuxSession.getExecutionCommand().isPluginExecutionCommandWithPendingResult();<NEW_LINE>if (isPluginExecutionCommandWithPendingResult)<NEW_LINE>Logger.logVerbose(LOG_TAG, "The \"" + finishedSession.mSessionName + "\" session will be force finished automatically since result in pending.");<NEW_LINE>}<NEW_LINE>if (mActivity.isVisible() && finishedSession != mActivity.getCurrentSession()) {<NEW_LINE>// Show toast for non-current sessions that exit.<NEW_LINE>// Verify that session was not removed before we got told about it finishing:<NEW_LINE>if (index >= 0)<NEW_LINE>mActivity.showToast(toToastTitle(finishedSession) + " - exited", true);<NEW_LINE>}<NEW_LINE>if (mActivity.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK)) {<NEW_LINE>// On Android TV devices we need to use older behaviour because we may<NEW_LINE>// not be able to have multiple launcher icons.<NEW_LINE>if (service.getTermuxSessionsSize() > 1 || isPluginExecutionCommandWithPendingResult) {<NEW_LINE>removeFinishedSession(finishedSession);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// Once we have a separate launcher icon for the failsafe session, it<NEW_LINE>// should be safe to auto-close session on exit code '0' or '130'.<NEW_LINE>if (finishedSession.getExitStatus() == 0 || finishedSession.getExitStatus() == 130 || isPluginExecutionCommandWithPendingResult) {<NEW_LINE>removeFinishedSession(finishedSession);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | index = service.getIndexOfSession(finishedSession); |
1,682,775 | protected Result check() throws Exception {<NEW_LINE>if (!STORAGE_CHECK_ENABLED) {<NEW_LINE>return Result.healthy("Storage check disabled");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>Instant writeTimestamp = Instant.now();<NEW_LINE>// insert record<NEW_LINE>dataStore.execute(dataStore.queryBuilder().insertInto(KEYSPACE_NAME, TABLE_NAME).value(PK_COLUMN_NAME, STARGATE_NODE_ID).value(VALUE_COLUMN_NAME, VALUE_COLUMN_VALUE).ttl(INSERT_TTL_SECONDS).timestamp(writeTimestamp.toEpochMilli()).build().bind(), ConsistencyLevel.LOCAL_QUORUM).get();<NEW_LINE>// select record<NEW_LINE>ResultSet rs = dataStore.execute(dataStore.queryBuilder().select().writeTimeColumn(VALUE_COLUMN_NAME).from(KEYSPACE_NAME, TABLE_NAME).where(PK_COLUMN_NAME, Predicate.EQ, STARGATE_NODE_ID).build().bind(), ConsistencyLevel.LOCAL_QUORUM).get();<NEW_LINE>Row row = rs.one();<NEW_LINE>Instant timestampRead = Instant.ofEpochMilli(row.getLong(0));<NEW_LINE>if (isGreaterThanOrEqual(timestampRead, writeTimestamp)) {<NEW_LINE>return Result.healthy("Storage is operational");<NEW_LINE>} else {<NEW_LINE>return Result.unhealthy("Storage did not return the proper data.");<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.warn("checkIsReady failed with {}", e.getMessage(), e);<NEW_LINE>return Result.unhealthy("Unable to access Storage: " + e);<NEW_LINE>}<NEW_LINE>} | DataStore dataStore = dataStoreFactory.createInternal(); |
204,469 | public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) {<NEW_LINE>DebugGraphicsInfo info = info();<NEW_LINE>if (debugLog()) {<NEW_LINE>info().log(toShortString() + " Drawing polygon: " + " nPoints: " + nPoints + " X's: " + xPoints + " Y's: " + yPoints);<NEW_LINE>}<NEW_LINE>if (isDrawingBuffer()) {<NEW_LINE>if (debugBuffered()) {<NEW_LINE>Graphics debugGraphics = debugGraphics();<NEW_LINE>debugGraphics.drawPolygon(xPoints, yPoints, nPoints);<NEW_LINE>debugGraphics.dispose();<NEW_LINE>}<NEW_LINE>} else if (debugFlash()) {<NEW_LINE>Color oldColor = getColor();<NEW_LINE>int i, count = (info.flashCount * 2) - 1;<NEW_LINE>for (i = 0; i < count; i++) {<NEW_LINE>graphics.setColor((i % 2) == <MASK><NEW_LINE>graphics.drawPolygon(xPoints, yPoints, nPoints);<NEW_LINE>Toolkit.getDefaultToolkit().sync();<NEW_LINE>sleep(info.flashTime);<NEW_LINE>}<NEW_LINE>graphics.setColor(oldColor);<NEW_LINE>}<NEW_LINE>graphics.drawPolygon(xPoints, yPoints, nPoints);<NEW_LINE>} | 0 ? info.flashColor : oldColor); |
1,060,057 | public Map<String, Object> annotate(ReferenceContext ref, VariantContext vc, AlleleLikelihoods<GATKRead, Allele> likelihoods) {<NEW_LINE>Utils.nonNull(vc);<NEW_LINE>Utils.nonNull(likelihoods);<NEW_LINE>final double[] lods = Mutect2FilteringEngine.getTumorLogOdds(vc);<NEW_LINE>if (lods == null) {<NEW_LINE>warning.warn(String.format("One or more variant contexts is missing the 'TLOD' annotation, %s will not be computed for these VariantContexts", GATKVCFConstants.ORIGINAL_CONTIG_MISMATCH_KEY));<NEW_LINE>return Collections.emptyMap();<NEW_LINE>}<NEW_LINE>final int indexOfMaxLod = MathUtils.maxElementIndex(lods);<NEW_LINE>final Allele altAlelle = vc.getAlternateAllele(indexOfMaxLod);<NEW_LINE>final Collection<AlleleLikelihoods<GATKRead, Allele>.BestAllele> bestAlleles = likelihoods.bestAllelesBreakingTies();<NEW_LINE>final String currentContig = ref.getInterval().getContig();<NEW_LINE>final long nonChrMAlt = bestAlleles.stream().filter(ba -> ba.evidence.hasAttribute(AddOriginalAlignmentTags.OA_TAG_NAME) && ba.isInformative() && ba.allele.equals(altAlelle) && !AddOriginalAlignmentTags.getOAContig(ba.evidence).equals(currentContig)).count();<NEW_LINE>return ImmutableMap.<MASK><NEW_LINE>} | of(GATKVCFConstants.ORIGINAL_CONTIG_MISMATCH_KEY, nonChrMAlt); |
1,029,809 | public void addFormForEditAccount() {<NEW_LINE>gridRowFrom = gridRow;<NEW_LINE>addAccountNameTextFieldWithAutoFillToggleButton();<NEW_LINE>addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"), Res.get(australiaPayid.getPaymentMethod().getId()));<NEW_LINE>addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.payid"), australiaPayid.getPayid());<NEW_LINE>TextField field = addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.owner"), australiaPayid.getBankAccountName()).second;<NEW_LINE>field.setMouseTransparent(false);<NEW_LINE>TradeCurrency singleTradeCurrency = australiaPayid.getSingleTradeCurrency();<NEW_LINE>String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "null";<NEW_LINE>addCompactTopLabelTextField(gridPane, ++gridRow, Res<MASK><NEW_LINE>addLimitations(true);<NEW_LINE>} | .get("shared.currency"), nameAndCode); |
635 | private static Map<String, String> fetchColumnType(Connection conn, String actualTableName) {<NEW_LINE>Map<String, String> specialType = new TreeMap(String.CASE_INSENSITIVE_ORDER);<NEW_LINE>Statement stmt = null;<NEW_LINE>ResultSet rs = null;<NEW_LINE>try {<NEW_LINE>stmt = conn.createStatement();<NEW_LINE>rs = stmt.executeQuery("desc `" + actualTableName + "`");<NEW_LINE>while (rs.next()) {<NEW_LINE>String field = rs.getString("Field");<NEW_LINE>String type = rs.getString("Type");<NEW_LINE>if (TStringUtil.startsWithIgnoreCase(type, "enum(")) {<NEW_LINE>specialType.put(field, type);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>Throwables.propagate(e);<NEW_LINE>} finally {<NEW_LINE>try {<NEW_LINE>if (rs != null) {<NEW_LINE>rs.close();<NEW_LINE>}<NEW_LINE>if (stmt != null) {<NEW_LINE>stmt.close();<NEW_LINE>}<NEW_LINE>} catch (SQLException e) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return specialType;<NEW_LINE>} | logger.warn("", e); |
1,657,537 | static public HashMap<String, String> readSettings(File inputFile) {<NEW_LINE>HashMap<String, String> outgoing = new HashMap<>();<NEW_LINE>// return empty hash<NEW_LINE>if (!inputFile.exists())<NEW_LINE>return outgoing;<NEW_LINE>String[] lines = PApplet.loadStrings(inputFile);<NEW_LINE>for (int i = 0; i < lines.length; i++) {<NEW_LINE>int hash = lines[i].indexOf('#');<NEW_LINE>String line = (hash == -1) ? lines[i].trim() : lines[i].substring(0, hash).trim();<NEW_LINE>if (line.length() == 0)<NEW_LINE>continue;<NEW_LINE>int equals = line.indexOf('=');<NEW_LINE>if (equals == -1) {<NEW_LINE>System.err.println("ignoring illegal line in " + inputFile);<NEW_LINE>System.err.println(" " + line);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String attr = line.substring(0, equals).trim();<NEW_LINE>String valu = line.substring(equals + 1).trim();<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>return outgoing;<NEW_LINE>} | outgoing.put(attr, valu); |
21,280 | public void verifyActivityStarting(android.os.Bundle options, java.lang.String pkg, android.content.ComponentName componentName, int uid, int pid, github.tornaco.android.thanos.core.app.activity.IVerifyCallback callback) throws android.os.RemoteException {<NEW_LINE>android.os.Parcel _data = android.os.Parcel.obtain();<NEW_LINE>android.os.Parcel _reply = android<MASK><NEW_LINE>try {<NEW_LINE>_data.writeInterfaceToken(DESCRIPTOR);<NEW_LINE>if ((options != null)) {<NEW_LINE>_data.writeInt(1);<NEW_LINE>options.writeToParcel(_data, 0);<NEW_LINE>} else {<NEW_LINE>_data.writeInt(0);<NEW_LINE>}<NEW_LINE>_data.writeString(pkg);<NEW_LINE>if ((componentName != null)) {<NEW_LINE>_data.writeInt(1);<NEW_LINE>componentName.writeToParcel(_data, 0);<NEW_LINE>} else {<NEW_LINE>_data.writeInt(0);<NEW_LINE>}<NEW_LINE>_data.writeInt(uid);<NEW_LINE>_data.writeInt(pid);<NEW_LINE>_data.writeStrongBinder((((callback != null)) ? (callback.asBinder()) : (null)));<NEW_LINE>boolean _status = mRemote.transact(Stub.TRANSACTION_verifyActivityStarting, _data, _reply, 0);<NEW_LINE>if (!_status && getDefaultImpl() != null) {<NEW_LINE>getDefaultImpl().verifyActivityStarting(options, pkg, componentName, uid, pid, callback);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>_reply.readException();<NEW_LINE>} finally {<NEW_LINE>_reply.recycle();<NEW_LINE>_data.recycle();<NEW_LINE>}<NEW_LINE>} | .os.Parcel.obtain(); |
1,085,655 | private void insertFieldInDb(Field field) throws DotDataException {<NEW_LINE>DotConnect dc = new DotConnect();<NEW_LINE>dc.setSQL(sql.insertField);<NEW_LINE>dc.addParam(field.id());<NEW_LINE>dc.addParam(field.contentTypeId());<NEW_LINE>dc.addParam(field.name());<NEW_LINE>dc.addParam(field.type().getCanonicalName());<NEW_LINE>dc.addParam(field.relationType());<NEW_LINE>dc.addParam(field.dbColumn());<NEW_LINE>dc.addParam(field.required());<NEW_LINE>dc.addParam(field.indexed());<NEW_LINE>dc.addParam(field.listed());<NEW_LINE>dc.addParam(field.variable());<NEW_LINE>dc.addParam(field.sortOrder());<NEW_LINE>dc.addParam(field.values());<NEW_LINE>dc.addParam(field.regexCheck());<NEW_LINE>dc.addParam(field.hint());<NEW_LINE>dc.<MASK><NEW_LINE>dc.addParam(field.fixed());<NEW_LINE>dc.addParam(field.readOnly());<NEW_LINE>dc.addParam(field.searchable());<NEW_LINE>dc.addParam(field.unique());<NEW_LINE>dc.addParam(field.modDate());<NEW_LINE>dc.loadResult();<NEW_LINE>} | addParam(field.defaultValue()); |
1,304,437 | private List<AnAction> initActions() {<NEW_LINE>List<AnAction> result = new ArrayList<>();<NEW_LINE>result.add(new ConfigureInspectionsAction());<NEW_LINE>result.add(DaemonEditorPopup.createGotoGroup());<NEW_LINE>result.add(AnSeparator.create());<NEW_LINE>result.add(new ToggleAction(EditorBundle.message("iw.show.import.tooltip")) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean isSelected(@Nonnull AnActionEvent e) {<NEW_LINE>PsiFile psiFile = getPsiFile();<NEW_LINE>return psiFile != null && myDaemonCodeAnalyzer.isImportHintsEnabled(psiFile);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void setSelected(@Nonnull AnActionEvent e, boolean state) {<NEW_LINE>PsiFile psiFile = getPsiFile();<NEW_LINE>if (psiFile != null) {<NEW_LINE>myDaemonCodeAnalyzer.setImportHintsEnabled(psiFile, state);<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void update(@Nonnull AnActionEvent e) {<NEW_LINE>super.update(e);<NEW_LINE>e.getPresentation().setEnabled(myDaemonCodeAnalyzer<MASK><NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean isDumbAware() {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return result;<NEW_LINE>} | .isAutohintsAvailable(getPsiFile())); |
1,121,405 | final DBInstance executeRestoreDBInstanceToPointInTime(RestoreDBInstanceToPointInTimeRequest restoreDBInstanceToPointInTimeRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(restoreDBInstanceToPointInTimeRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<RestoreDBInstanceToPointInTimeRequest> request = null;<NEW_LINE>Response<DBInstance> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new RestoreDBInstanceToPointInTimeRequestMarshaller().marshall(super.beforeMarshalling(restoreDBInstanceToPointInTimeRequest));<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, "RDS");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RestoreDBInstanceToPointInTime");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DBInstance> responseHandler = new StaxResponseHandler<DBInstance>(new DBInstanceStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
223,698 | Repositories repositories(ServiceRegistry serviceRegistry, FlavorContainer flavors, PlatformContainer platforms, BuildTypeContainer buildTypes, CollectionCallbackActionDecorator callbackActionDecorator) {<NEW_LINE>Instantiator instantiator = serviceRegistry.get(Instantiator.class);<NEW_LINE>ObjectFactory sourceDirectorySetFactory = <MASK><NEW_LINE>NativePlatforms nativePlatforms = serviceRegistry.get(NativePlatforms.class);<NEW_LINE>FileCollectionFactory fileCollectionFactory = serviceRegistry.get(FileCollectionFactory.class);<NEW_LINE>Action<PrebuiltLibrary> initializer = new PrebuiltLibraryInitializer(instantiator, fileCollectionFactory, nativePlatforms, platforms.withType(NativePlatform.class), buildTypes, flavors);<NEW_LINE>DomainObjectCollectionFactory domainObjectCollectionFactory = serviceRegistry.get(DomainObjectCollectionFactory.class);<NEW_LINE>return new DefaultRepositories(instantiator, sourceDirectorySetFactory, initializer, callbackActionDecorator, domainObjectCollectionFactory);<NEW_LINE>} | serviceRegistry.get(ObjectFactory.class); |
1,173,390 | public SetIpAddressTypeResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>SetIpAddressTypeResult setIpAddressTypeResult = new SetIpAddressTypeResult();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return setIpAddressTypeResult;<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("operations", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>setIpAddressTypeResult.setOperations(new ListUnmarshaller<Operation>(OperationJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return setIpAddressTypeResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,143,020 | private static Codec createCodec(Format format, MediaFormat mediaFormat, boolean isVideo, boolean isDecoder, @Nullable Surface outputSurface) throws TransformationException {<NEW_LINE>@Nullable<NEW_LINE>MediaCodec mediaCodec = null;<NEW_LINE>@Nullable<NEW_LINE>Surface inputSurface = null;<NEW_LINE>try {<NEW_LINE>mediaCodec = isDecoder ? MediaCodec.createDecoderByType(format.sampleMimeType) : MediaCodec.createEncoderByType(format.sampleMimeType);<NEW_LINE>configureCodec(mediaCodec, mediaFormat, isDecoder, outputSurface);<NEW_LINE>if (isVideo && !isDecoder) {<NEW_LINE>inputSurface = mediaCodec.createInputSurface();<NEW_LINE>}<NEW_LINE>startCodec(mediaCodec);<NEW_LINE>} catch (Exception e) {<NEW_LINE>if (inputSurface != null) {<NEW_LINE>inputSurface.release();<NEW_LINE>}<NEW_LINE>@Nullable<NEW_LINE>String mediaCodecName = null;<NEW_LINE>if (mediaCodec != null) {<NEW_LINE>mediaCodecName = mediaCodec.getName();<NEW_LINE>mediaCodec.release();<NEW_LINE>}<NEW_LINE>throw createTransformationException(e, format, isVideo, isDecoder, mediaCodecName);<NEW_LINE>}<NEW_LINE>return new <MASK><NEW_LINE>} | Codec(mediaCodec, format, inputSurface); |
1,360,067 | private boolean backupGroupCtrlConfig(StringBuilder strBuff) {<NEW_LINE>logger.info("[Backup Group Ctrl] begin ");<NEW_LINE>Map<String, GroupResCtrlEntity> groupCtrlMap = getGroupResCtrlInfos(strBuff);<NEW_LINE>if (groupCtrlMap == null) {<NEW_LINE>logger.error(" download group-control configurations are null!");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>logger.info("[Backup Group Ctrl] store group-control configurations to local file");<NEW_LINE><MASK><NEW_LINE>logger.info("[Backup Group Ctrl] verify configurations");<NEW_LINE>Map<String, GroupResCtrlEntity> storedGroupCtrlMap = (Map<String, GroupResCtrlEntity>) readObjectFromFile(backupAndRecoveryPath, storeFileNameGroupCtrl);<NEW_LINE>if (storedGroupCtrlMap == null) {<NEW_LINE>logger.error(strBuff.append(" read configure file ").append(backupAndRecoveryPath).append("/").append(storeFileNameGroupCtrl).append(" failure!").toString());<NEW_LINE>strBuff.delete(0, strBuff.length());<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (storedGroupCtrlMap.size() != groupCtrlMap.size()) {<NEW_LINE>logger.error(" verify failure, stored group-control configurations size not equal!");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>for (Map.Entry<String, GroupResCtrlEntity> qryEntry : groupCtrlMap.entrySet()) {<NEW_LINE>GroupResCtrlEntity targetEntity = storedGroupCtrlMap.get(qryEntry.getKey());<NEW_LINE>if (targetEntity == null || !targetEntity.isDataEquals(qryEntry.getValue())) {<NEW_LINE>logger.error(strBuff.append(" verify failure, stored group-control value not equal!").append(" data in server is ").append(qryEntry.getValue().toString()).append(", data stored is ").append((targetEntity == null) ? null : targetEntity.toString()).toString());<NEW_LINE>strBuff.delete(0, strBuff.length());<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>logger.info("[Backup Group Ctrl] end, success!");<NEW_LINE>return true;<NEW_LINE>} | storeObjectToFile(groupCtrlMap, backupAndRecoveryPath, storeFileNameGroupCtrl); |
915,777 | public Property convertSimpleRuleToJson(MVELToDataWrapperTranslator translator, ObjectMapper mapper, String matchRule, String jsonProp, String fieldService) {<NEW_LINE>Entity[<MASK><NEW_LINE>Property[] properties = new Property[1];<NEW_LINE>Property mvelProperty = new Property();<NEW_LINE>mvelProperty.setName("matchRule");<NEW_LINE>mvelProperty.setValue(matchRule == null ? "" : matchRule);<NEW_LINE>properties[0] = mvelProperty;<NEW_LINE>Entity criteria = new Entity();<NEW_LINE>criteria.setProperties(properties);<NEW_LINE>matchCriteria[0] = criteria;<NEW_LINE>String json;<NEW_LINE>try {<NEW_LINE>DataWrapper orderWrapper = translator.createRuleData(matchCriteria, "matchRule", null, null, ruleBuilderFieldServiceFactory.createInstance(fieldService));<NEW_LINE>json = mapper.writeValueAsString(orderWrapper);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>Property p = new Property();<NEW_LINE>p.setName(jsonProp);<NEW_LINE>p.setValue(json);<NEW_LINE>return p;<NEW_LINE>} | ] matchCriteria = new Entity[1]; |
238,535 | private void executeAggregation(OCommandContext ctx, int nRecords) {<NEW_LINE>long timeoutBegin = System.currentTimeMillis();<NEW_LINE>if (!prev.isPresent()) {<NEW_LINE>throw new OCommandExecutionException("Cannot execute an aggregation or a GROUP BY without a previous result");<NEW_LINE>}<NEW_LINE>OExecutionStepInternal prevStep = prev.get();<NEW_LINE>OResultSet lastRs = prevStep.syncPull(ctx, nRecords);<NEW_LINE>while (lastRs.hasNext()) {<NEW_LINE>if (timeoutMillis > 0 && timeoutBegin + timeoutMillis < System.currentTimeMillis()) {<NEW_LINE>sendTimeout();<NEW_LINE>}<NEW_LINE>aggregate(lastRs.next(), ctx);<NEW_LINE>if (!lastRs.hasNext()) {<NEW_LINE>lastRs = prevStep.syncPull(ctx, nRecords);<NEW_LINE>}<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>finalResults.addAll(aggregateResults.values());<NEW_LINE>aggregateResults.clear();<NEW_LINE>for (OResultInternal item : finalResults) {<NEW_LINE>if (timeoutMillis > 0 && timeoutBegin + timeoutMillis < System.currentTimeMillis()) {<NEW_LINE>sendTimeout();<NEW_LINE>}<NEW_LINE>for (String name : item.getTemporaryProperties()) {<NEW_LINE>Object prevVal = item.getTemporaryProperty(name);<NEW_LINE>if (prevVal instanceof AggregationContext) {<NEW_LINE>item.setTemporaryProperty(name, ((AggregationContext) prevVal).getFinalValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | finalResults = new ArrayList<>(); |
1,325,383 | protected FilterResults performFiltering(CharSequence constraint) {<NEW_LINE>FilterResults filterResults = new FilterResults();<NEW_LINE>ArrayList<AmiiboFile> tempList = new ArrayList<>();<NEW_LINE>String queryText = settings.getQuery().trim().toLowerCase();<NEW_LINE>for (AmiiboFile amiiboFile : amiiboFiles) {<NEW_LINE>boolean add;<NEW_LINE>if (null != settings.getAmiiboManager()) {<NEW_LINE>Amiibo amiibo = settings.getAmiiboManager().amiibos.get(amiiboFile.getId());<NEW_LINE>if (null == amiibo)<NEW_LINE>amiibo = new Amiibo(settings.getAmiiboManager(), amiiboFile.getId(), null, null);<NEW_LINE>add = amiiboContainsQuery(amiibo, queryText);<NEW_LINE>} else {<NEW_LINE>add = queryText.isEmpty();<NEW_LINE>}<NEW_LINE>if (!add && null != amiiboFile.getFilePath())<NEW_LINE>add = pathContainsQuery(amiiboFile.getFilePath().getAbsolutePath(), queryText);<NEW_LINE>if (add)<NEW_LINE>tempList.add(amiiboFile);<NEW_LINE>}<NEW_LINE>filterResults<MASK><NEW_LINE>filterResults.values = tempList;<NEW_LINE>return filterResults;<NEW_LINE>} | .count = tempList.size(); |
518,614 | public static Table run(StreamExecutionEnvironment streamEnv, TableEnvironment tableEnv, StatementSet statementSet, ExecutionMode mode, Table input, TFConfig tfConfig, TableSchema outSchema) throws IOException {<NEW_LINE><MASK><NEW_LINE>Preconditions.checkArgument(hasScript || mode == ExecutionMode.INFERENCE, "Python script can be omitted only for inference");<NEW_LINE>Preconditions.checkArgument(hasScript || input != null, "Input table and python script can't both be null");<NEW_LINE>if (null != input) {<NEW_LINE>tfConfig.addProperty(MLConstants.CONFIG_JOB_HAS_INPUT, "true");<NEW_LINE>}<NEW_LINE>setTFDefaultConfig(tfConfig);<NEW_LINE>Table worker = null;<NEW_LINE>Table chief = null;<NEW_LINE>TFConfig nodeConfig = toChiefTypeConfig(tfConfig);<NEW_LINE>DataStream<Row> toDataStream = tableToDS(input, tableEnv);<NEW_LINE>if (hasScript) {<NEW_LINE>PythonFileUtil.registerPythonFiles(streamEnv, nodeConfig.getMlConfig());<NEW_LINE>RoleUtils.addAMRole(tableEnv, statementSet, tfConfig.getMlConfig());<NEW_LINE>if (nodeConfig.getPsNum() > 0) {<NEW_LINE>RoleUtils.addRole(tableEnv, statementSet, mode, null, nodeConfig.getMlConfig(), null, new PsRole());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>TableSchema workerSchema = outSchema != null ? outSchema : DUMMY_SCHEMA;<NEW_LINE>Pair<DataStream<Row>, DataStream<Row>> workerAndChief = getWorkerDataStream(streamEnv, mode, toDataStream, nodeConfig, TypeUtil.schemaToRowTypeInfo(workerSchema));<NEW_LINE>if (workerAndChief.getLeft() != null) {<NEW_LINE>worker = dsToTable(workerAndChief.getLeft(), tableEnv);<NEW_LINE>}<NEW_LINE>if (workerAndChief.getRight() != null) {<NEW_LINE>chief = dsToTable(workerAndChief.getRight(), tableEnv);<NEW_LINE>}<NEW_LINE>if (outSchema == null) {<NEW_LINE>if (worker != null) {<NEW_LINE>writeToDummySink(worker, tableEnv, statementSet);<NEW_LINE>}<NEW_LINE>if (chief != null) {<NEW_LINE>writeToDummySink(chief, tableEnv, statementSet);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return worker;<NEW_LINE>} | final boolean hasScript = hasScript(tfConfig); |
520,277 | public static Object evaluateExpression(final Expression expr, final CompilerConfiguration config) {<NEW_LINE>Expression ce = expr instanceof CastExpression ? ((CastExpression) expr).getExpression() : expr;<NEW_LINE>if (ce instanceof ConstantExpression) {<NEW_LINE>if (expr.getType().equals(ce.getType()))<NEW_LINE>return ((ConstantExpression) ce).getValue();<NEW_LINE>} else if (ce instanceof ListExpression) {<NEW_LINE>if (expr.getType().isArray() && expr.getType().getComponentType().equals(STRING_TYPE))<NEW_LINE>return ((ListExpression) ce).getExpressions().stream().map(e -> evaluateExpression(e, config)).toArray(String[]::new);<NEW_LINE>}<NEW_LINE>String className = "Expression$" + UUID.randomUUID().toString(<MASK><NEW_LINE>ClassNode simpleClass = new ClassNode(className, Opcodes.ACC_PUBLIC, OBJECT_TYPE);<NEW_LINE>addGeneratedMethod(simpleClass, "eval", Opcodes.ACC_PUBLIC + Opcodes.ACC_STATIC, OBJECT_TYPE, Parameter.EMPTY_ARRAY, ClassNode.EMPTY_ARRAY, new ReturnStatement(expr));<NEW_LINE>// adjust configuration so class can be inspected by this JVM<NEW_LINE>CompilerConfiguration cc = new CompilerConfiguration(config);<NEW_LINE>// unlikely to be required by expression<NEW_LINE>cc.setPreviewFeatures(false);<NEW_LINE>cc.setTargetBytecode(CompilerConfiguration.DEFAULT.getTargetBytecode());<NEW_LINE>CompilationUnit cu = new CompilationUnit(cc);<NEW_LINE>try {<NEW_LINE>cu.addClassNode(simpleClass);<NEW_LINE>cu.compile(Phases.CLASS_GENERATION);<NEW_LINE>List<GroovyClass> classes = cu.getClasses();<NEW_LINE>Class<?> aClass = cu.getClassLoader().defineClass(className, classes.get(0).getBytes());<NEW_LINE>try {<NEW_LINE>return aClass.getMethod("eval").invoke(null);<NEW_LINE>} catch (ReflectiveOperationException e) {<NEW_LINE>throw new GroovyBugError(e);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>closeQuietly(cu.getClassLoader());<NEW_LINE>}<NEW_LINE>} | ).replace('-', '$'); |
1,265,912 | public void updateDBCapacity() throws DalException {<NEW_LINE>int maxId = m_manager.getWeeklyStatus();<NEW_LINE>while (true) {<NEW_LINE>List<WeeklyReportContent> reports = m_weeklyReportContentDao.findOverloadReport(maxId, WeeklyReportContentEntity.READSET_LENGTH);<NEW_LINE>for (WeeklyReportContent content : reports) {<NEW_LINE>try {<NEW_LINE>int reportId = content.getReportId();<NEW_LINE>double contentLength = content.getContentLength();<NEW_LINE>if (contentLength >= CapacityUpdater.CAPACITY) {<NEW_LINE>Overload overload = m_overloadDao.createLocal();<NEW_LINE>overload.setReportId(reportId);<NEW_LINE>overload.setReportSize(contentLength);<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>WeeklyReport report = m_weeklyReportDao.findByPK(reportId, WeeklyReportEntity.READSET_FULL);<NEW_LINE>overload.setPeriod(report.getPeriod());<NEW_LINE>m_overloadDao.insert(overload);<NEW_LINE>} catch (DalNotFoundException e) {<NEW_LINE>} catch (Exception e) {<NEW_LINE>Cat.logError(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>Cat.logError(ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int size = reports.size();<NEW_LINE>if (size == 0) {<NEW_LINE>break;<NEW_LINE>} else {<NEW_LINE>maxId = reports.get(size - 1).getReportId();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>m_manager.updateWeeklyStatus(maxId);<NEW_LINE>} | overload.setReportType(CapacityUpdater.WEEKLY_TYPE); |
1,081,938 | protected TraceModule doRecordProcessModule(long snap, TargetModule module) {<NEW_LINE>String <MASK><NEW_LINE>if (recorder.getMemoryMapper() == null) {<NEW_LINE>Msg.error(this, "Got module before memory mapper: " + path);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// Short-circuit the DuplicateNameException for efficiency?<NEW_LINE>TraceModule exists = moduleManager.getLoadedModuleByPath(snap, path);<NEW_LINE>if (exists != null) {<NEW_LINE>return exists;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>AddressRange targetRange = module.getRange();<NEW_LINE>if (targetRange == null) {<NEW_LINE>Msg.error(this, "Range not found for " + module);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>AddressRange traceRange = recorder.getMemoryMapper().targetToTrace(targetRange);<NEW_LINE>return moduleManager.addLoadedModule(path, module.getModuleName(), traceRange, snap);<NEW_LINE>} catch (DuplicateNameException e) {<NEW_LINE>// This resolves the race condition, since DB access is synchronized<NEW_LINE>return moduleManager.getLoadedModuleByPath(snap, path);<NEW_LINE>}<NEW_LINE>} | path = module.getJoinedPath("."); |
8,831 | final CreateCertificateAuthorityResult executeCreateCertificateAuthority(CreateCertificateAuthorityRequest createCertificateAuthorityRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createCertificateAuthorityRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateCertificateAuthorityRequest> request = null;<NEW_LINE>Response<CreateCertificateAuthorityResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateCertificateAuthorityRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createCertificateAuthorityRequest));<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, "ACM PCA");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateCertificateAuthority");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateCertificateAuthorityResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateCertificateAuthorityResultJsonUnmarshaller());<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,511,006 | public Messages process(Messages messages) {<NEW_LINE>for (final MessageFilter filter : filterRegistry) {<NEW_LINE>for (Message msg : messages) {<NEW_LINE>final String timerName = name(filter.getClass(), "executionTime");<NEW_LINE>final Timer timer = metricRegistry.timer(timerName);<NEW_LINE>final Timer.<MASK><NEW_LINE>try {<NEW_LINE>LOG.debug("Applying filter [{}] on message <{}>.", filter.getName(), msg.getId());<NEW_LINE>if (filter.filter(msg)) {<NEW_LINE>LOG.debug("Filter [{}] marked message <{}> to be discarded. Dropping message.", filter.getName(), msg.getId());<NEW_LINE>msg.setFilterOut(true);<NEW_LINE>filteredOutMessages.mark();<NEW_LINE>messageQueueAcknowledger.acknowledge(msg);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>final String shortError = String.format(Locale.US, "Could not apply filter [%s] on message <%s>", filter.getName(), msg.getId());<NEW_LINE>if (LOG.isDebugEnabled()) {<NEW_LINE>LOG.error("{}:", shortError, e);<NEW_LINE>} else {<NEW_LINE>LOG.error("{}:\n{}", shortError, ExceptionUtils.getShortenedStackTrace(e));<NEW_LINE>}<NEW_LINE>msg.addProcessingError(new Message.ProcessingError(ProcessingFailureCause.MessageFilterException, shortError, ExceptionUtils.getRootCauseMessage(e)));<NEW_LINE>} finally {<NEW_LINE>final long elapsedNanos = timerContext.stop();<NEW_LINE>msg.recordTiming(serverStatus, timerName, elapsedNanos);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return messages;<NEW_LINE>} | Context timerContext = timer.time(); |
371,763 | protected void startCore(ServletContext context) {<NEW_LINE>Injector injector = (Injector) context.getAttribute(Injector.class.getName());<NEW_LINE>// create the runtime settings object<NEW_LINE>IStoredSettings runtimeSettings = injector.getInstance(IStoredSettings.class);<NEW_LINE>final File baseFolder;<NEW_LINE>if (goSettings != null) {<NEW_LINE>// Gitblit GO<NEW_LINE>baseFolder = configureGO(context, goSettings, goBaseFolder, runtimeSettings);<NEW_LINE>} else {<NEW_LINE>// servlet container<NEW_LINE>WebXmlSettings webxmlSettings = new WebXmlSettings(context);<NEW_LINE>String contextRealPath = context.getRealPath("/");<NEW_LINE>File contextFolder = (contextRealPath != null) ? new File(contextRealPath) : null;<NEW_LINE>// if the base folder dosen't match the default assume they don't want to use express,<NEW_LINE>// this allows for other containers to customise the basefolder per context.<NEW_LINE>String defaultBase = Constants.contextFolder$ + "/WEB-INF/data";<NEW_LINE>String base = getBaseFolderPath(defaultBase);<NEW_LINE>if (!StringUtils.isEmpty(System.getenv("OPENSHIFT_DATA_DIR")) && defaultBase.equals(base)) {<NEW_LINE>// RedHat OpenShift<NEW_LINE>baseFolder = configureExpress(context, webxmlSettings, contextFolder, runtimeSettings);<NEW_LINE>} else {<NEW_LINE>// standard WAR<NEW_LINE>baseFolder = configureWAR(context, webxmlSettings, contextFolder, runtimeSettings);<NEW_LINE>}<NEW_LINE>// Test for Tomcat forward-slash/%2F issue and auto-adjust settings<NEW_LINE>ContainerUtils.CVE_2007_0450.test(runtimeSettings);<NEW_LINE>}<NEW_LINE>// Manually configure IRuntimeManager<NEW_LINE>logManager(IRuntimeManager.class);<NEW_LINE>IRuntimeManager runtime = injector.getInstance(IRuntimeManager.class);<NEW_LINE>runtime.setBaseFolder(baseFolder);<NEW_LINE>runtime.getStatus().isGO = goSettings != null;<NEW_LINE>runtime.getStatus().servletContainer = context.getServerInfo();<NEW_LINE>runtime.start();<NEW_LINE>managers.add(runtime);<NEW_LINE>// create the plugin manager instance but do not start it<NEW_LINE>loadManager(injector, IPluginManager.class);<NEW_LINE>// start all other managers<NEW_LINE>startManager(injector, INotificationManager.class);<NEW_LINE>startManager(injector, IUserManager.class);<NEW_LINE>startManager(injector, IAuthenticationManager.class);<NEW_LINE>startManager(injector, IPublicKeyManager.class);<NEW_LINE>startManager(injector, IRepositoryManager.class);<NEW_LINE>startManager(injector, IProjectManager.class);<NEW_LINE>startManager(injector, IFederationManager.class);<NEW_LINE>startManager(injector, ITicketService.class);<NEW_LINE>startManager(injector, IGitblit.class);<NEW_LINE><MASK><NEW_LINE>startManager(injector, IFilestoreManager.class);<NEW_LINE>// start the plugin manager last so that plugins can depend on<NEW_LINE>// deterministic access to all other managers in their start() methods<NEW_LINE>startManager(injector, IPluginManager.class);<NEW_LINE>logger.info("");<NEW_LINE>logger.info("All managers started.");<NEW_LINE>logger.info("");<NEW_LINE>IPluginManager pluginManager = injector.getInstance(IPluginManager.class);<NEW_LINE>for (LifeCycleListener listener : pluginManager.getExtensions(LifeCycleListener.class)) {<NEW_LINE>try {<NEW_LINE>listener.onStartup();<NEW_LINE>} catch (Throwable t) {<NEW_LINE>logger.error(null, t);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | startManager(injector, IServicesManager.class); |
528,518 | public String testEJBExtension() throws Exception {<NEW_LINE>Container ejbContainer = getEJBJarContainer(TEST_EJB);<NEW_LINE>EJBJarExt extensions = <MASK><NEW_LINE>if (extensions == null)<NEW_LINE>return "Could not adapt EJB jar extensions";<NEW_LINE>List<EnterpriseBean> ejbs = extensions.getEnterpriseBeans();<NEW_LINE>if (ejbs == null || ejbs.isEmpty())<NEW_LINE>return "Could not find enterprise beans in ejb jar extensions";<NEW_LINE>if (ejbs.size() != 1) {<NEW_LINE>return "Invalid number of enterprise beans: " + ejbs.size() + "; expected 1";<NEW_LINE>} else {<NEW_LINE>EnterpriseBean ejb = ejbs.get(0);<NEW_LINE>if (!"TestBean".equals(ejb.getName()))<NEW_LINE>return "Invalid ejb name: " + ejb.getName();<NEW_LINE>// ResourceRef also lives in commonbnd.<NEW_LINE>List<com.ibm.ws.javaee.dd.commonext.ResourceRef> refs = ejb.getResourceRefs();<NEW_LINE>if (refs.size() != 4)<NEW_LINE>return "Invalid number of resource refs: " + refs.size() + "; expected 4";<NEW_LINE>if (ejb.getStartAtAppStart() != null)<NEW_LINE>return "Start at app start should not be specified";<NEW_LINE>if (!(ejb instanceof com.ibm.ws.javaee.dd.ejbext.Session))<NEW_LINE>return "The enterprise bean shoudl be a session bean";<NEW_LINE>com.ibm.ws.javaee.dd.ejbext.Session session = (com.ibm.ws.javaee.dd.ejbext.Session) ejb;<NEW_LINE>TimeOut t = session.getTimeOut();<NEW_LINE>if (t == null)<NEW_LINE>return "Time out should be specified on session bean";<NEW_LINE>if (t.getValue() != 42)<NEW_LINE>return "THe time out value should be 42";<NEW_LINE>}<NEW_LINE>return OK;<NEW_LINE>} | ejbContainer.adapt(EJBJarExt.class); |
1,415,945 | public void handle(Request request, Response response) {<NEW_LINE>try {<NEW_LINE>if (getLogger().isLoggable(Level.FINE)) {<NEW_LINE>getLogger().log(Level.FINE, "Handling client request: " + request);<NEW_LINE>}<NEW_LINE>if ((request != null) && request.isSynchronous() && request.isExpectingResponse()) {<NEW_LINE>// Prepare the latch to block the caller thread<NEW_LINE><MASK><NEW_LINE>request.getAttributes().put(CONNECTOR_LATCH, latch);<NEW_LINE>// Add the message to the outbound queue for processing<NEW_LINE>addOutboundMessage(response);<NEW_LINE>// Await on the latch<NEW_LINE>latch.await();<NEW_LINE>} else {<NEW_LINE>// Add the message to the outbound queue for processing<NEW_LINE>addOutboundMessage(response);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>getLogger().log(Level.INFO, "Error while handling a " + request.getProtocol().getName() + " client request", e);<NEW_LINE>response.setStatus(Status.CONNECTOR_ERROR_INTERNAL, e);<NEW_LINE>}<NEW_LINE>} | CountDownLatch latch = new CountDownLatch(1); |
129,572 | public HClient borrowClient() throws HectorException {<NEW_LINE>if (!active.get()) {<NEW_LINE>throw new HInactivePoolException("Attempt to borrow on in-active pool: " + getName());<NEW_LINE>}<NEW_LINE>HClient cassandraClient = availableClientQueue.poll();<NEW_LINE>int currentActiveClients = activeClientsCount.incrementAndGet();<NEW_LINE>try {<NEW_LINE>if (cassandraClient != null) {<NEW_LINE>if (cassandraClient.getCassandraHost().getMaxLastSuccessTimeMillis() > 0 && cassandraClient.getLastSuccessTime() > 0 && System.currentTimeMillis() - cassandraClient.getLastSuccessTime() > cassandraClient.getCassandraHost().getMaxLastSuccessTimeMillis()) {<NEW_LINE>log.info("Closing connection to {} due to too long idle time of {} ms", cassandraClient.getCassandraHost().getHost(), System.currentTimeMillis() - cassandraClient.getLastSuccessTime());<NEW_LINE>cassandraClient.close();<NEW_LINE>cassandraClient = null;<NEW_LINE>monitor.incCounter(Counter.RENEWED_IDLE_CONNECTIONS);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (cassandraClient != null) {<NEW_LINE>if (cassandraClient.getCassandraHost().getMaxConnectTimeMillis() > 0 && System.currentTimeMillis() - cassandraClient.getCreatedTime() > cassandraClient.getCassandraHost().getMaxConnectTimeMillis()) {<NEW_LINE>log.info("Closing connection to {} due to too long existence time of {} ms", cassandraClient.getCassandraHost().getHost(), System.currentTimeMillis(<MASK><NEW_LINE>cassandraClient.close();<NEW_LINE>cassandraClient = null;<NEW_LINE>monitor.incCounter(Counter.RENEWED_TOO_LONG_CONNECTIONS);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (cassandraClient == null) {<NEW_LINE>if (currentActiveClients <= cassandraHost.getMaxActive()) {<NEW_LINE>cassandraClient = createClient();<NEW_LINE>} else {<NEW_LINE>// We can't grow so let's wait for a connection to become available.<NEW_LINE>cassandraClient = waitForConnection();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (cassandraClient == null) {<NEW_LINE>throw new HectorException("HConnectionManager returned a null client after aquisition - are we shutting down?");<NEW_LINE>}<NEW_LINE>} catch (RuntimeException e) {<NEW_LINE>activeClientsCount.decrementAndGet();<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>realActiveClientsCount.incrementAndGet();<NEW_LINE>if (isExhausted()) {<NEW_LINE>exhaustedStartTime.set(System.currentTimeMillis());<NEW_LINE>}<NEW_LINE>return cassandraClient;<NEW_LINE>} | ) - cassandraClient.getCreatedTime()); |
1,673,200 | public JDBCStatement prepareUniqueConstraintsLoadStatement(@NotNull JDBCSession session, @NotNull GenericStructContainer owner, @Nullable GenericTableBase forParent) throws SQLException, DBException {<NEW_LINE>JDBCPreparedStatement dbStat;<NEW_LINE>dbStat = session.prepareStatement(// "LEFT JOIN v_catalog.comments com ON com.object_id = col.constraint_id"<NEW_LINE>"SELECT col.constraint_name as PK_NAME, col.table_name as TABLE_NAME, col.column_name as COLUMN_NAME, " + "c.ordinal_position as KEY_SEQ, col.constraint_type, tc.predicate, col.is_enabled \n" + "FROM v_catalog.constraint_columns col\n" + "LEFT JOIN v_catalog.columns c ON\n" + "c.table_id = col.table_id\n" + // v_catalog.comments dramatically reduces data loading speed. Maybe we can use another table or use lazy cache for constraints too<NEW_LINE>"JOIN v_catalog.table_constraints tc ON\n" + "tc.constraint_id = col.constraint_id \n" + "AND col.column_name = c.column_name \n" + "WHERE col.constraint_type IN ('u','p','c')\n" + "AND col.table_schema = ?" + (forParent != null <MASK><NEW_LINE>if (forParent != null) {<NEW_LINE>dbStat.setString(1, forParent.getSchema().getName());<NEW_LINE>dbStat.setString(2, forParent.getName());<NEW_LINE>} else {<NEW_LINE>dbStat.setString(1, owner.getName());<NEW_LINE>}<NEW_LINE>return dbStat;<NEW_LINE>} | ? " AND col.table_name = ?" : "") + " ORDER BY col.table_id, KEY_SEQ, PK_NAME"); |
1,346,476 | public void shortReportLineTo(PrintWriter w) {<NEW_LINE>Map<String, Object> map = shortReportMap();<NEW_LINE>w.print(map.get("toeCount"));<NEW_LINE>w.print(" threads: ");<NEW_LINE>LinkedList<String> sortedSteps = (LinkedList<String>) map.get("steps");<NEW_LINE>{<NEW_LINE>Iterator<String> iter = sortedSteps.iterator();<NEW_LINE>if (!iter.hasNext()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>w.print(iter.next());<NEW_LINE>if (iter.hasNext()) {<NEW_LINE>w.print(", ");<NEW_LINE>w.print(iter.next());<NEW_LINE>if (iter.hasNext()) {<NEW_LINE>w.print(", etc...");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>w.print("; ");<NEW_LINE>}<NEW_LINE>LinkedList<String> sortedProcesses = (LinkedList<String>) map.get("processors");<NEW_LINE>{<NEW_LINE>Iterator<String> iter = sortedProcesses.iterator();<NEW_LINE>if (iter.hasNext()) {<NEW_LINE>w.print(iter.next());<NEW_LINE>while (iter.hasNext()) {<NEW_LINE>w.print(", ");<NEW_LINE>w.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | print(iter.next()); |
968,056 | public void inheritedMethodsHaveIncompatibleReturnTypes(ASTNode location, MethodBinding[] inheritedMethods, int length) {<NEW_LINE>StringBuffer methodSignatures = new StringBuffer();<NEW_LINE>StringBuffer shortSignatures = new StringBuffer();<NEW_LINE>for (int i = length; --i >= 0; ) {<NEW_LINE>methodSignatures.append(inheritedMethods[i].declaringClass.readableName()).append('.').append(inheritedMethods[i].readableName());<NEW_LINE>shortSignatures.append(inheritedMethods[i].declaringClass.shortReadableName()).append('.').append(inheritedMethods<MASK><NEW_LINE>if (i != 0) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>methodSignatures.append(", ");<NEW_LINE>// $NON-NLS-1$<NEW_LINE>shortSignatures.append(", ");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Return type is incompatible with %1<NEW_LINE>this.// Return type is incompatible with %1<NEW_LINE>handle(// 9.4.2 - The return type from the method is incompatible with the declaration.<NEW_LINE>IProblem.InheritedIncompatibleReturnType, new String[] { methodSignatures.toString() }, new String[] { shortSignatures.toString() }, location.sourceStart, location.sourceEnd);<NEW_LINE>} | [i].shortReadableName()); |
1,742,781 | public static double squaredDistance(SparseArray x, SparseArray y) {<NEW_LINE>Iterator<SparseArray.Entry> it1 = x.iterator();<NEW_LINE>Iterator<SparseArray.Entry> it2 = y.iterator();<NEW_LINE>SparseArray.Entry e1 = it1.hasNext() ? it1.next() : null;<NEW_LINE>SparseArray.Entry e2 = it2.hasNext() ? it2.next() : null;<NEW_LINE>double sum = 0.0;<NEW_LINE>while (e1 != null && e2 != null) {<NEW_LINE>if (e1.i == e2.i) {<NEW_LINE>sum += pow2(e1.x - e2.x);<NEW_LINE>e1 = it1.hasNext() ? it1.next() : null;<NEW_LINE>e2 = it2.hasNext() ? it2.next() : null;<NEW_LINE>} else if (e1.i > e2.i) {<NEW_LINE>sum += pow2(e2.x);<NEW_LINE>e2 = it2.hasNext() <MASK><NEW_LINE>} else {<NEW_LINE>sum += pow2(e1.x);<NEW_LINE>e1 = it1.hasNext() ? it1.next() : null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>while (it1.hasNext()) {<NEW_LINE>double d = it1.next().x;<NEW_LINE>sum += d * d;<NEW_LINE>}<NEW_LINE>while (it2.hasNext()) {<NEW_LINE>double d = it2.next().x;<NEW_LINE>sum += d * d;<NEW_LINE>}<NEW_LINE>return sum;<NEW_LINE>} | ? it2.next() : null; |
1,638,631 | public Object execute(ODistributedRequestId requestId, OServer iServer, ODistributedServerManager iManager, ODatabaseDocumentInternal database) throws Exception {<NEW_LINE>if (iManager != null) {<NEW_LINE>iManager.messageBeforeOp("prepare1Phase", requestId);<NEW_LINE>}<NEW_LINE>convert(database);<NEW_LINE>if (iManager != null) {<NEW_LINE>iManager.messageAfterOp("prepare1Phase", requestId);<NEW_LINE>}<NEW_LINE>OTransactionOptimisticDistributed tx = new OTransactionOptimisticDistributed(database, ops, uniqueIndexKeys);<NEW_LINE>// No need to increase the lock timeout here with the retry because this retries are not<NEW_LINE>// deadlock retries<NEW_LINE>OTransactionResultPayload res1;<NEW_LINE>try {<NEW_LINE>res1 = executeTransaction(requestId, transactionId, (ODatabaseDocumentDistributed) database, tx, false, retryCount);<NEW_LINE>} catch (Exception e) {<NEW_LINE>this.finished = true;<NEW_LINE>if (this.notYetFinishedTask != null) {<NEW_LINE>this.notYetFinishedTask.cancel();<NEW_LINE>}<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>if (res1 == null) {<NEW_LINE>final int autoRetryDelay <MASK><NEW_LINE>retryCount++;<NEW_LINE>((ODatabaseDocumentDistributed) database).getDistributedShared().reEnqueue(requestId.getNodeId(), requestId.getMessageId(), database.getName(), this, retryCount, autoRetryDelay);<NEW_LINE>hasResponse = false;<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>hasResponse = true;<NEW_LINE>this.finished = true;<NEW_LINE>if (this.notYetFinishedTask != null) {<NEW_LINE>this.notYetFinishedTask.cancel();<NEW_LINE>}<NEW_LINE>return new OTransactionPhase1TaskResult(res1);<NEW_LINE>} | = OGlobalConfiguration.DISTRIBUTED_CONCURRENT_TX_AUTORETRY_DELAY.getValueAsInteger(); |
1,144,309 | public void deleteTask(TaskEntity task, String deleteReason, boolean cascade, boolean skipCustomListeners) {<NEW_LINE>if (!task.isDeleted()) {<NEW_LINE>task.setDeleted(true);<NEW_LINE>CommandContext commandContext = Context.getCommandContext();<NEW_LINE>String taskId = task.getId();<NEW_LINE>List<Task> subTasks = findTasksByParentTaskId(taskId);<NEW_LINE>for (Task subTask : subTasks) {<NEW_LINE>((TaskEntity) subTask).delete(deleteReason, cascade, skipCustomListeners);<NEW_LINE>}<NEW_LINE>task.deleteIdentityLinks();<NEW_LINE>commandContext.getVariableInstanceManager().deleteVariableInstanceByTask(task);<NEW_LINE>if (cascade) {<NEW_LINE>commandContext.getHistoricTaskInstanceManager().deleteHistoricTaskInstanceById(taskId);<NEW_LINE>} else {<NEW_LINE>commandContext.getHistoricTaskInstanceManager().markTaskInstanceEnded(taskId, deleteReason);<NEW_LINE>}<NEW_LINE>deleteAuthorizations(Resources.TASK, taskId);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | getDbEntityManager().delete(task); |
1,411,179 | public static <T, U, A, R> AggregateOperation1<T, A, R> mapping(@Nonnull FunctionEx<? super T, ? extends U> mapFn, @Nonnull AggregateOperation1<? super U, A, ? extends R> downstream) {<NEW_LINE>checkSerializable(mapFn, "mapFn");<NEW_LINE>BiConsumerEx<? super A, ? super U<MASK><NEW_LINE>return AggregateOperation.withCreate(downstream.createFn()).andAccumulate((A a, T t) -> {<NEW_LINE>U mapped = mapFn.apply(t);<NEW_LINE>if (mapped != null) {<NEW_LINE>downstreamAccumulateFn.accept(a, mapped);<NEW_LINE>}<NEW_LINE>}).andCombine(downstream.combineFn()).andDeduct(downstream.deductFn()).<R>andExport(downstream.exportFn()).andFinish(downstream.finishFn());<NEW_LINE>} | > downstreamAccumulateFn = downstream.accumulateFn(); |
594,944 | private void addProxySettingRadioButtons() {<NEW_LINE>ButtonGroup group = new ButtonGroup();<NEW_LINE>JPanel radioPanel = new JPanel();<NEW_LINE>radioPanel.setLayout(new BoxLayout(radioPanel, BoxLayout.Y_AXIS));<NEW_LINE>radioPanel.add<MASK><NEW_LINE>automatic = createRadioButton("Automatic", group, radioPanel);<NEW_LINE>none = createRadioButton("None", group, radioPanel);<NEW_LINE>manual = createRadioButton("Manual", group, radioPanel);<NEW_LINE>proxyPrefForm.append("Proxy Setting", radioPanel);<NEW_LINE>automatic.addActionListener(new ActionListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(ActionEvent e) {<NEW_LINE>autoProxy = true;<NEW_LINE>setManualProxyTextFieldsEnabled(true, false);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>manual.addActionListener(new ActionListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(ActionEvent e) {<NEW_LINE>autoProxy = false;<NEW_LINE>setManualProxyTextFieldsEnabled(true, true);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>none.addActionListener(new ActionListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(ActionEvent e) {<NEW_LINE>setManualProxyTextFieldsEnabled(false, false);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | (Box.createVerticalStrut(4)); |
1,088,945 | private Calendar addDurationToDate(final I_C_Flatrate_Transition trans, final Timestamp date) {<NEW_LINE><MASK><NEW_LINE>calTermEnd.setTime(date);<NEW_LINE>if (X_C_Flatrate_Transition.TERMDURATIONUNIT_JahrE.equals(trans.getTermDurationUnit())) {<NEW_LINE>calTermEnd.add(Calendar.YEAR, trans.getTermDuration());<NEW_LINE>} else if (X_C_Flatrate_Transition.TERMDURATIONUNIT_MonatE.equals(trans.getTermDurationUnit())) {<NEW_LINE>calTermEnd.add(Calendar.MONTH, trans.getTermDuration());<NEW_LINE>} else if (X_C_Flatrate_Transition.TERMDURATIONUNIT_WocheN.equals(trans.getTermDurationUnit())) {<NEW_LINE>calTermEnd.add(Calendar.WEEK_OF_YEAR, trans.getTermDuration());<NEW_LINE>} else if (X_C_Flatrate_Transition.TERMDURATIONUNIT_TagE.equals(trans.getTermDurationUnit())) {<NEW_LINE>calTermEnd.add(Calendar.DAY_OF_YEAR, trans.getTermDuration());<NEW_LINE>} else {<NEW_LINE>Check.assume(false, trans + " has unsupported TermDurationUnit=" + trans.getTermDurationUnit());<NEW_LINE>}<NEW_LINE>calTermEnd.add(Calendar.DAY_OF_YEAR, -1);<NEW_LINE>return calTermEnd;<NEW_LINE>} | final Calendar calTermEnd = new GregorianCalendar(); |
356,993 | public void initialize(TemplateWizard wizard) {<NEW_LINE>WizardDescriptor.Panel<WizardDescriptor> folderPanel;<NEW_LINE>Project project = Templates.getProject(wizard);<NEW_LINE>Sources sources = ProjectUtils.getSources(project);<NEW_LINE>SourceGroup[] sourceGroups = sources.getSourceGroups(WebProjectConstants.TYPE_WEB_INF);<NEW_LINE>if (sourceGroups.length == 0) {<NEW_LINE>sourceGroups = sources.getSourceGroups(WebProjectConstants.TYPE_DOC_ROOT);<NEW_LINE>}<NEW_LINE>if (sourceGroups.length == 0) {<NEW_LINE>sourceGroups = sources.getSourceGroups(Sources.TYPE_GENERIC);<NEW_LINE>}<NEW_LINE>folderPanel = Templates.buildSimpleTargetChooser(project, sourceGroups).create();<NEW_LINE>folderPanel = new ValidationPanel(wizard, folderPanel);<NEW_LINE>panels = new WizardDescriptor.Panel[] { folderPanel };<NEW_LINE>// Creating steps.<NEW_LINE>// NOI18N<NEW_LINE>Object prop = wizard.getProperty(WizardDescriptor.PROP_CONTENT_DATA);<NEW_LINE>String[] beforeSteps = null;<NEW_LINE>if (prop != null && prop instanceof String[]) {<NEW_LINE>beforeSteps = (String[]) prop;<NEW_LINE>}<NEW_LINE>String[] steps = createSteps(beforeSteps, panels);<NEW_LINE>for (int i = 0; i < panels.length; i++) {<NEW_LINE>JComponent jc = (JComponent) <MASK><NEW_LINE>if (steps[i] == null) {<NEW_LINE>steps[i] = jc.getName();<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i);<NEW_LINE>// NOI18N<NEW_LINE>jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);<NEW_LINE>}<NEW_LINE>Templates.setTargetName(wizard, getDefaultName());<NEW_LINE>Templates.setTargetFolder(wizard, getTargetFolder(project));<NEW_LINE>} | panels[i].getComponent(); |
918,632 | protected void addOverlays() {<NEW_LINE>super.addOverlays();<NEW_LINE>final ArrayList<GeoPoint> list = new ArrayList<>();<NEW_LINE>list.clear();<NEW_LINE>list.add(new GeoPoint(sCentralParkBoundingBox.getActualNorth(), -85));<NEW_LINE>list.add(new GeoPoint(sCentralParkBoundingBox.getActualNorth(), -65));<NEW_LINE>mNorthPolyline.setPoints(list);<NEW_LINE>mMapView.getOverlays().add(mNorthPolyline);<NEW_LINE>list.clear();<NEW_LINE>list.add(new GeoPoint(sCentralParkBoundingBox.<MASK><NEW_LINE>list.add(new GeoPoint(sCentralParkBoundingBox.getActualSouth(), -65));<NEW_LINE>mSouthPolyline.setPoints(list);<NEW_LINE>mMapView.getOverlays().add(mSouthPolyline);<NEW_LINE>list.clear();<NEW_LINE>list.add(new GeoPoint(45, sCentralParkBoundingBox.getLonWest()));<NEW_LINE>list.add(new GeoPoint(35, sCentralParkBoundingBox.getLonWest()));<NEW_LINE>mWestPolyline.setPoints(list);<NEW_LINE>mMapView.getOverlays().add(mWestPolyline);<NEW_LINE>list.clear();<NEW_LINE>list.add(new GeoPoint(45, sCentralParkBoundingBox.getLonEast()));<NEW_LINE>list.add(new GeoPoint(35, sCentralParkBoundingBox.getLonEast()));<NEW_LINE>mEastPolyline.setPoints(list);<NEW_LINE>mMapView.getOverlays().add(mEastPolyline);<NEW_LINE>mMapView.getController().setZoom(13.);<NEW_LINE>setHasOptionsMenu(true);<NEW_LINE>mMapView.post(new // "post" because we need View.getWidth() to be set<NEW_LINE>Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>setLimitScrollingLatitude(true);<NEW_LINE>setLimitScrollingLongitude(true);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | getActualSouth(), -85)); |
482,942 | public void flatMap(BaseVectorSummarizer srt, Collector<Tuple2<Integer, DenseVector>> collector) throws Exception {<NEW_LINE>BaseVectorSummary summary = srt.toSummary();<NEW_LINE>if (summary.count() == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int colNum = summary.vectorSize();<NEW_LINE>// rowNum<NEW_LINE>{<NEW_LINE>double[] count = new double[colNum];<NEW_LINE>Arrays.fill(count, summary.count());<NEW_LINE>collector.collect(new Tuple2<>(0, new DenseVector(count)));<NEW_LINE>}<NEW_LINE>// sum<NEW_LINE>{<NEW_LINE>DenseVector sumsVec = toDenseVector(summary.sum());<NEW_LINE>collector.collect(new Tuple2<>(1, sumsVec));<NEW_LINE>}<NEW_LINE>// squareSum<NEW_LINE>{<NEW_LINE>DenseVector sum2sVec = toDenseVector(summary.normL2());<NEW_LINE>for (int i = 0; i < sum2sVec.size(); i++) {<NEW_LINE>double v = sum2sVec.get(i);<NEW_LINE>sum2sVec.set(i, v * v);<NEW_LINE>}<NEW_LINE>collector.collect(new Tuple2<>(2, sum2sVec));<NEW_LINE>}<NEW_LINE>// dotProduction split by blockSize<NEW_LINE>int totalDotNum = colNum * (colNum + 1) * 2;<NEW_LINE>double[] vec = new double[PcaTrainBatchOp.block + 1];<NEW_LINE>vec[0] = (double) colNum;<NEW_LINE>int vecIdx = 1;<NEW_LINE>int collectIdx = 3;<NEW_LINE>int covSize = srt<MASK><NEW_LINE>for (int i = 0; i < colNum; i++) {<NEW_LINE>for (int j = i; j < colNum; j++) {<NEW_LINE>if (i < covSize && j < covSize) {<NEW_LINE>vec[vecIdx] = srt.getOuterProduct().get(i, j);<NEW_LINE>} else {<NEW_LINE>vec[vecIdx] = 0;<NEW_LINE>}<NEW_LINE>vecIdx++;<NEW_LINE>if (vecIdx == PcaTrainBatchOp.block + 1) {<NEW_LINE>DenseVector dotVec = new DenseVector(vec.clone());<NEW_LINE>collector.collect(new Tuple2<>(collectIdx, dotVec));<NEW_LINE>collectIdx++;<NEW_LINE>vecIdx = 1;<NEW_LINE>vec = new double[PcaTrainBatchOp.block + 1];<NEW_LINE>vec[0] = (double) colNum;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (totalDotNum % PcaTrainBatchOp.block > 0) {<NEW_LINE>DenseVector dotVec = new DenseVector(vec.clone());<NEW_LINE>collector.collect(new Tuple2<>(collectIdx, dotVec));<NEW_LINE>}<NEW_LINE>} | .getOuterProduct().numRows(); |
1,122,621 | // introduced in Hive 0.14<NEW_LINE>// implemented to actually get access to the raw properties<NEW_LINE>@Override<NEW_LINE>public void initialize(Configuration conf, Properties tbl, Properties partitionProperties) throws SerDeException {<NEW_LINE>inspector = HiveUtils.structObjectInspector(tbl);<NEW_LINE>structTypeInfo = HiveUtils.typeInfo(inspector);<NEW_LINE>cfg = conf;<NEW_LINE>List<Settings> settingSources = new ArrayList<>();<NEW_LINE>settingSources.add<MASK><NEW_LINE>if (cfg != null) {<NEW_LINE>settingSources.add(HadoopSettingsManager.loadFrom(cfg));<NEW_LINE>}<NEW_LINE>settings = new CompositeSettings(settingSources);<NEW_LINE>alias = HiveUtils.alias(settings);<NEW_LINE>HiveUtils.fixHive13InvalidComments(settings, tbl);<NEW_LINE>trace = log.isTraceEnabled();<NEW_LINE>outputJSON = settings.getOutputAsJson();<NEW_LINE>if (outputJSON) {<NEW_LINE>jsonFieldName = new Text(HiveUtils.discoverJsonFieldName(settings, alias));<NEW_LINE>}<NEW_LINE>} | (HadoopSettingsManager.loadFrom(tbl)); |
7,710 | private void runAndAdd(TreePath path, List<HintDescription> rules, Map<HintDescription, List<ErrorDescription>> d) {<NEW_LINE>if (rules != null) {<NEW_LINE>boolean <MASK><NEW_LINE>OUTER: for (HintDescription hd : rules) {<NEW_LINE>if (isCanceled()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (guarded && !hd.getTrigger().hasOption(TriggerOptions.PROCESS_GUARDED)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>HintMetadata hm = hd.getMetadata();<NEW_LINE>for (String wname : hm.suppressWarnings) {<NEW_LINE>if (!suppresWarnings.isEmpty() && suppresWarnings.peek().contains(wname)) {<NEW_LINE>continue OUTER;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>HintContext c = SPIAccessor.getINSTANCE().createHintContext(info, settings, hm, path, Collections.<String, TreePath>emptyMap(), Collections.<String, Collection<? extends TreePath>>emptyMap(), Collections.<String, String>emptyMap(), Collections.<String, TypeMirror>emptyMap(), new ArrayList<>(), bulkMode, cancel, caret);<NEW_LINE>Collection<? extends ErrorDescription> errors = runHint(hd, c);<NEW_LINE>if (errors != null) {<NEW_LINE>merge(d, hd, errors);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | guarded = isInGuarded(info, path); |
498,659 | final ListPromptsResult executeListPrompts(ListPromptsRequest listPromptsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listPromptsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListPromptsRequest> request = null;<NEW_LINE>Response<ListPromptsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListPromptsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listPromptsRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Connect");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListPrompts");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListPromptsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListPromptsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); |
1,690,605 | public byte[] encrypt(final byte[] plaintext, final byte[] contextInfo) throws GeneralSecurityException {<NEW_LINE>// KEM: generate a random shared secret whose bit length is equal to the modulus'.<NEW_LINE>BigInteger mod = recipientPublicKey.getModulus();<NEW_LINE>byte[] sharedSecret = RsaKem.generateSecret(mod);<NEW_LINE>// KEM: encrypt the shared secret using the public key.<NEW_LINE>Cipher rsaCipher = Cipher.getInstance("RSA/ECB/NoPadding");<NEW_LINE>rsaCipher.init(Cipher.ENCRYPT_MODE, recipientPublicKey);<NEW_LINE>byte[] token = rsaCipher.doFinal(sharedSecret);<NEW_LINE>// KDF: derive a DEM key from the shared secret, salt, and contextInfo.<NEW_LINE>byte[] demKey = Hkdf.computeHkdf(hkdfHmacAlgo, sharedSecret, hkdfSalt, contextInfo, aeadFactory.getKeySizeInBytes());<NEW_LINE>Aead <MASK><NEW_LINE>byte[] ciphertext = aead.encrypt(plaintext, RsaKem.EMPTY_AAD);<NEW_LINE>return ByteBuffer.allocate(token.length + ciphertext.length).put(token).put(ciphertext).array();<NEW_LINE>} | aead = aeadFactory.createAead(demKey); |
680,821 | private // <String, Sequence<String>><NEW_LINE>void // <String, Sequence<String>><NEW_LINE>parseManagedDirectories(Map<String, ?> managedDirectories) throws EvalException {<NEW_LINE>Map<PathFragment, String> nonNormalizedPathsMap = Maps.newHashMap();<NEW_LINE>for (Map.Entry<String, ?> entry : managedDirectories.entrySet()) {<NEW_LINE>RepositoryName repositoryName = createRepositoryName(entry.getKey());<NEW_LINE>List<PathFragment> paths = getManagedDirectoriesPaths(entry.getValue(), nonNormalizedPathsMap);<NEW_LINE>for (PathFragment dir : paths) {<NEW_LINE>PathFragment <MASK><NEW_LINE>if (dir.equals(floorKey)) {<NEW_LINE>throw Starlark.errorf("managed_directories attribute should not contain multiple" + " (or duplicate) repository mappings for the same directory ('%s').", nonNormalizedPathsMap.get(dir));<NEW_LINE>}<NEW_LINE>PathFragment ceilingKey = managedDirectoriesMap.ceilingKey(dir);<NEW_LINE>boolean isDescendant = floorKey != null && dir.startsWith(floorKey);<NEW_LINE>if (isDescendant || (ceilingKey != null && ceilingKey.startsWith(dir))) {<NEW_LINE>throw Starlark.errorf("managed_directories attribute value can not contain nested mappings." + " '%s' is a descendant of '%s'.", nonNormalizedPathsMap.get(isDescendant ? dir : ceilingKey), nonNormalizedPathsMap.get(isDescendant ? floorKey : dir));<NEW_LINE>}<NEW_LINE>managedDirectoriesMap.put(dir, repositoryName);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | floorKey = managedDirectoriesMap.floorKey(dir); |
1,687,137 | public JComponent createComponent(Category category, Lookup context) {<NEW_LINE>Project project = context.lookup(Project.class);<NEW_LINE>ProjectAccessor acc = <MASK><NEW_LINE>AuxiliaryConfiguration aux = context.lookup(AuxiliaryConfiguration.class);<NEW_LINE>assert aux != null;<NEW_LINE>assert acc != null;<NEW_LINE>assert project != null;<NEW_LINE>final JdkConfiguration jdkConf = new JdkConfiguration(project, acc.getHelper(), acc.getEvaluator());<NEW_LINE>final ClasspathPanel panel = new ClasspathPanel(jdkConf);<NEW_LINE>final JavaPlatform initialPlatform = (JavaPlatform) panel.javaPlatform.getSelectedItem();<NEW_LINE>ProjectModel pm = context.lookup(ProjectModel.class);<NEW_LINE>assert pm != null;<NEW_LINE>panel.setModel(pm);<NEW_LINE>pm.addChangeListener(new ChangeListener() {<NEW_LINE><NEW_LINE>public void stateChanged(ChangeEvent arg0) {<NEW_LINE>panel.updateControls();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>category.setOkButtonListener(new ActionListener() {<NEW_LINE><NEW_LINE>public void actionPerformed(ActionEvent arg0) {<NEW_LINE>JavaPlatform p = (JavaPlatform) panel.javaPlatform.getSelectedItem();<NEW_LINE>if (p != initialPlatform) {<NEW_LINE>try {<NEW_LINE>jdkConf.setSelectedPlatform(p);<NEW_LINE>} catch (IOException x) {<NEW_LINE>ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, x);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return panel;<NEW_LINE>} | context.lookup(ProjectAccessor.class); |
481,834 | private void writeRendererDispatcher(IndentedWriter w, String dispatcherName, JClassType targetType, String rootFieldName, JMethod[] uiHandlerMethods, JMethod sourceMethod) throws UnableToCompleteException {<NEW_LINE>// static class UiRendererDispatcherForFoo extends UiRendererDispatcher<Foo> {<NEW_LINE>w.write("static class %s extends UiRendererDispatcher<%s> {", dispatcherName, targetType.getQualifiedSourceName());<NEW_LINE>w.indent();<NEW_LINE>writeRendererDispatcherTableInit(w, rootFieldName, uiHandlerMethods, dispatcherName);<NEW_LINE>writeRendererDispatcherExtraParameters(w, sourceMethod);<NEW_LINE>writeRendererDispatcherFire(w, sourceMethod);<NEW_LINE>w.write("@SuppressWarnings(\"rawtypes\")");<NEW_LINE>w.write("@Override");<NEW_LINE>// public void fireEvent(GwtEvent<?> somethingUnlikelyToCollideWithParamNames) {<NEW_LINE>w.write("public void fireEvent(com.google.gwt.event.shared.GwtEvent<?> %sEvent) {", SAFE_VAR_PREFIX);<NEW_LINE>w.indent();<NEW_LINE>// switch (getMethodIndex()) {<NEW_LINE>w.write("switch (getMethodIndex()) {");<NEW_LINE>w.indent();<NEW_LINE>for (int j = 0; j < uiHandlerMethods.length; j++) {<NEW_LINE>JMethod uiMethod = uiHandlerMethods[j];<NEW_LINE>// case 0:<NEW_LINE>w.write("case %s:", j);<NEW_LINE>w.indent();<NEW_LINE>// getEventTarget().onClickRoot((ClickEvent) somethingUnlikelyToCollideWithParamNames,<NEW_LINE>// getRoot(), a, b);<NEW_LINE>StringBuffer sb = new StringBuffer();<NEW_LINE>JParameter[] sourceParameters = sourceMethod.getParameters();<NEW_LINE>// Cat the extra parameters i.e. ", a, b"<NEW_LINE>JType[] uiHandlerParameterTypes = uiMethod.getParameterTypes();<NEW_LINE>if (uiHandlerParameterTypes.length >= 2) {<NEW_LINE>sb.append(", getRoot()");<NEW_LINE>}<NEW_LINE>for (int k = 2; k < uiHandlerParameterTypes.length; k++) {<NEW_LINE>JParameter sourceParam = sourceParameters[k + 1];<NEW_LINE>sb.append(", ");<NEW_LINE>sb.<MASK><NEW_LINE>}<NEW_LINE>w.write("getEventTarget().%s((%s) %sEvent%s);", uiMethod.getName(), uiHandlerParameterTypes[0].getQualifiedSourceName(), SAFE_VAR_PREFIX, sb.toString());<NEW_LINE>// break;<NEW_LINE>w.write("break;");<NEW_LINE>w.newline();<NEW_LINE>w.outdent();<NEW_LINE>}<NEW_LINE>// default:<NEW_LINE>w.write("default:");<NEW_LINE>w.indent();<NEW_LINE>// break;<NEW_LINE>w.write("break;");<NEW_LINE>w.outdent();<NEW_LINE>w.outdent();<NEW_LINE>w.write("}");<NEW_LINE>w.outdent();<NEW_LINE>w.write("}");<NEW_LINE>w.outdent();<NEW_LINE>w.write("}");<NEW_LINE>} | append(sourceParam.getName()); |
356,544 | protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {<NEW_LINE>AccessTokenAuthToken authToken = (AccessTokenAuthToken) token;<NEW_LINE>final AccessToken accessToken = accessTokenService.load(String.valueOf<MASK><NEW_LINE>if (accessToken == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// TODO should be using IDs<NEW_LINE>final User user = userService.load(accessToken.getUserName());<NEW_LINE>if (user == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (!user.getAccountStatus().equals(User.AccountStatus.ENABLED)) {<NEW_LINE>LOG.warn("Account for user <{}> is disabled.", user.getName());<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (LOG.isDebugEnabled()) {<NEW_LINE>LOG.debug("Found user {} for access token.", user);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>accessTokenService.touch(accessToken);<NEW_LINE>} catch (ValidationException e) {<NEW_LINE>LOG.warn("Unable to update access token's last access date.", e);<NEW_LINE>}<NEW_LINE>ShiroSecurityContext.requestSessionCreation(false);<NEW_LINE>return new SimpleAccount(user.getId(), null, "access token realm");<NEW_LINE>} | (authToken.getToken())); |
547,339 | public boolean handleServerInfo(ClassLoader classLoader, ProtectionDomain domain) {<NEW_LINE>String serverVersion = "";<NEW_LINE>try {<NEW_LINE>String path = domain.getCodeSource().getLocation().getFile();<NEW_LINE>path = URLDecoder.decode(path, "UTF-8");<NEW_LINE><MASK><NEW_LINE>File homeFile = runJar.getParentFile().getParentFile();<NEW_LINE>System.setProperty("jboss.home.dir", homeFile.getCanonicalPath());<NEW_LINE>Method getPackageMethod = ClassLoader.class.getDeclaredMethod("getPackage", String.class);<NEW_LINE>getPackageMethod.setAccessible(true);<NEW_LINE>Package jbossBootPackage = (Package) getPackageMethod.invoke(classLoader, "org.jboss");<NEW_LINE>serverVersion = jbossBootPackage.getSpecificationVersion();<NEW_LINE>} catch (Throwable t) {<NEW_LINE>logDetectError("handle jboss startup failed", t);<NEW_LINE>}<NEW_LINE>ApplicationModel.setServerInfo("jboss", serverVersion);<NEW_LINE>return true;<NEW_LINE>} | File runJar = new File(path); |
1,244,088 | public String[] deserializeFromMemory(final Memory mem, final int numItems) {<NEW_LINE>final String[] array = new String[numItems];<NEW_LINE>long offsetBytes = 0;<NEW_LINE>for (int i = 0; i < numItems; i++) {<NEW_LINE>// Read the length of the ith String<NEW_LINE>Util.checkBounds(offsetBytes, Integer.BYTES, mem.getCapacity());<NEW_LINE>final int strLength = mem.getInt(offsetBytes);<NEW_LINE>offsetBytes += Integer.BYTES;<NEW_LINE>if (strLength >= 0) {<NEW_LINE>// Read the bytes for the String<NEW_LINE>final byte[] bytes = new byte[strLength];<NEW_LINE>Util.checkBounds(offsetBytes, <MASK><NEW_LINE>mem.getByteArray(offsetBytes, bytes, 0, strLength);<NEW_LINE>offsetBytes += strLength;<NEW_LINE>array[i] = new String(bytes, StandardCharsets.UTF_8);<NEW_LINE>} else if (strLength != NULL_STRING_LENGTH) {<NEW_LINE>throw new IAE("Illegal strLength [%s] at offset [%s]. Must be %s, 0 or a positive integer.", strLength, offsetBytes, NULL_STRING_LENGTH);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return array;<NEW_LINE>} | strLength, mem.getCapacity()); |
1,592,410 | protected final String updateMessage(String msg) {<NEW_LINE>if (errorContentLength == 0 || msg == null) {<NEW_LINE>// doesn't replace labels enclosed within { and }.<NEW_LINE>return msg;<NEW_LINE>}<NEW_LINE>StringBuilder out = new StringBuilder(msg.length());<NEW_LINE>int previous = 0;<NEW_LINE>int start = 0;<NEW_LINE>while (true) {<NEW_LINE>start = msg.indexOf('{', start);<NEW_LINE>if (start == -1) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>int end = msg.indexOf('}', start);<NEW_LINE>if (end == -1) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>String label = msg.substring(start + 1, end);<NEW_LINE>Object value = null;<NEW_LINE>if ("value".equals(label)) {<NEW_LINE>value = this.value;<NEW_LINE>} else if (values.containsKey(label)) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (value != null) {<NEW_LINE>String content = restrictContent(value);<NEW_LINE>out.append(msg, previous, start);<NEW_LINE>out.append(content);<NEW_LINE>previous = end;<NEW_LINE>}<NEW_LINE>start = end;<NEW_LINE>}<NEW_LINE>out.append(msg, previous == 0 ? 0 : previous + 1, msg.length());<NEW_LINE>return out.toString();<NEW_LINE>} | value = values.get(label); |
329,879 | private Response.PropStat readPropStat(XmlPullParser parser) throws IOException, XmlPullParserException {<NEW_LINE>Response.PropStat propstat = new Response.PropStat();<NEW_LINE>parser.require(XmlPullParser.START_TAG, ns, "propstat");<NEW_LINE>android.util.<MASK><NEW_LINE>while (parser.next() != XmlPullParser.END_TAG) {<NEW_LINE>android.util.Log.d("PARSE", "3eventtype=" + parser.getEventType());<NEW_LINE>if (parser.getEventType() != XmlPullParser.START_TAG) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String name = parser.getName();<NEW_LINE>android.util.Log.d("PARSE", "3name=" + name);<NEW_LINE>if (name.equals("prop")) {<NEW_LINE>propstat.prop = readProp(parser);<NEW_LINE>} else if (name.equals("status")) {<NEW_LINE>propstat.status = readText(parser);<NEW_LINE>} else {<NEW_LINE>skip(parser);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return propstat;<NEW_LINE>} | Log.d("PARSE", "readPropStat"); |
1,793,580 | private static Node<Integer> test1() {<NEW_LINE>Node<Integer> root = new Node<Integer>(2);<NEW_LINE>Node<Integer> n11 = new Node<Integer>(7);<NEW_LINE>Node<Integer> n12 = new Node<Integer>(5);<NEW_LINE>Node<Integer> n21 = new Node<Integer>(2);<NEW_LINE>Node<Integer> n22 = new Node<Integer>(6);<NEW_LINE>Node<Integer> n23 = <MASK><NEW_LINE>Node<Integer> n24 = new Node<Integer>(6);<NEW_LINE>Node<Integer> n31 = new Node<Integer>(5);<NEW_LINE>Node<Integer> n32 = new Node<Integer>(8);<NEW_LINE>Node<Integer> n33 = new Node<Integer>(4);<NEW_LINE>Node<Integer> n34 = new Node<Integer>(5);<NEW_LINE>Node<Integer> n35 = new Node<Integer>(8);<NEW_LINE>Node<Integer> n36 = new Node<Integer>(4);<NEW_LINE>Node<Integer> n37 = new Node<Integer>(5);<NEW_LINE>Node<Integer> n38 = new Node<Integer>(8);<NEW_LINE>root.left = n11;<NEW_LINE>root.right = n12;<NEW_LINE>n11.left = n21;<NEW_LINE>n11.right = n22;<NEW_LINE>n12.left = n23;<NEW_LINE>n12.right = n24;<NEW_LINE>n21.left = n31;<NEW_LINE>n21.right = n32;<NEW_LINE>n22.left = n33;<NEW_LINE>n22.right = n34;<NEW_LINE>n23.left = n35;<NEW_LINE>n23.right = n36;<NEW_LINE>n24.left = n37;<NEW_LINE>n24.right = n38;<NEW_LINE>return root;<NEW_LINE>} | new Node<Integer>(3); |
203,012 | public boolean validate(String name, Consumer<ValidationError>... listeners) {<NEW_LINE>Entry<String, List<String>> attribute = createAttribute(name);<NEW_LINE>List<AttributeMetadata> metadatas = new ArrayList<>();<NEW_LINE>metadatas.addAll(Optional.ofNullable(this.metadataByAttribute.get(attribute.getKey())).map(Collections::singletonList).orElse<MASK><NEW_LINE>metadatas.addAll(Optional.ofNullable(this.metadataByAttribute.get(READ_ONLY_ATTRIBUTE_KEY)).map(Collections::singletonList).orElse(Collections.emptyList()));<NEW_LINE>Boolean result = null;<NEW_LINE>for (AttributeMetadata metadata : metadatas) {<NEW_LINE>AttributeContext attributeContext = createAttributeContext(attribute, metadata);<NEW_LINE>for (AttributeValidatorMetadata validator : metadata.getValidators()) {<NEW_LINE>ValidationContext vc = validator.validate(attributeContext);<NEW_LINE>if (vc.isValid()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (result == null) {<NEW_LINE>result = false;<NEW_LINE>}<NEW_LINE>if (listeners != null) {<NEW_LINE>for (ValidationError error : vc.getErrors()) {<NEW_LINE>for (Consumer<ValidationError> consumer : listeners) {<NEW_LINE>consumer.accept(error);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result == null;<NEW_LINE>} | (Collections.emptyList())); |
1,238,034 | private final void addVertex(final float[] values, final int offset) {<NEW_LINE>final int o = vertices.size;<NEW_LINE>vertices.addAll(values, offset, stride);<NEW_LINE>lastIndex = vindex++;<NEW_LINE>if (vertexTransformationEnabled) {<NEW_LINE>transformPosition(vertices.items, o + posOffset, posSize, positionTransform);<NEW_LINE>if (norOffset >= 0)<NEW_LINE>transformNormal(vertices.items, o + norOffset, 3, normalTransform);<NEW_LINE>if (biNorOffset >= 0)<NEW_LINE>transformNormal(vertices.items, o + biNorOffset, 3, normalTransform);<NEW_LINE>if (tangentOffset >= 0)<NEW_LINE>transformNormal(vertices.items, o + tangentOffset, 3, normalTransform);<NEW_LINE>}<NEW_LINE>final float x = vertices.items[o + posOffset];<NEW_LINE>final float y = (posSize > 1) ? vertices.items[o + posOffset + 1] : 0f;<NEW_LINE>final float z = (posSize > 2) ? vertices.items[o + posOffset + 2] : 0f;<NEW_LINE>bounds.<MASK><NEW_LINE>if (hasColor) {<NEW_LINE>if (colOffset >= 0) {<NEW_LINE>vertices.items[o + colOffset] *= color.r;<NEW_LINE>vertices.items[o + colOffset + 1] *= color.g;<NEW_LINE>vertices.items[o + colOffset + 2] *= color.b;<NEW_LINE>if (colSize > 3)<NEW_LINE>vertices.items[o + colOffset + 3] *= color.a;<NEW_LINE>} else if (cpOffset >= 0) {<NEW_LINE>Color.abgr8888ToColor(tempC1, vertices.items[o + cpOffset]);<NEW_LINE>vertices.items[o + cpOffset] = tempC1.mul(color).toFloatBits();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (hasUVTransform && uvOffset >= 0) {<NEW_LINE>vertices.items[o + uvOffset] = uOffset + uScale * vertices.items[o + uvOffset];<NEW_LINE>vertices.items[o + uvOffset + 1] = vOffset + vScale * vertices.items[o + uvOffset + 1];<NEW_LINE>}<NEW_LINE>} | ext(x, y, z); |
452,233 | public EVD eigen(boolean vl, boolean vr, boolean overwrite) {<NEW_LINE>if (m != n) {<NEW_LINE>throw new IllegalArgumentException(String.format("The matrix is not square: %d x %d", m, n));<NEW_LINE>}<NEW_LINE>Matrix eig = overwrite ? this : clone();<NEW_LINE>if (isSymmetric()) {<NEW_LINE>double[] w = new double[n];<NEW_LINE>int info = LAPACK.engine.syevd(eig.layout(), vr ? EVDJob.VECTORS : EVDJob.NO_VECTORS, eig.uplo, n, eig.A, eig.ld, w);<NEW_LINE>if (info != 0) {<NEW_LINE>logger.error("LAPACK SYEV error code: {}", info);<NEW_LINE>throw new ArithmeticException("LAPACK SYEV error code: " + info);<NEW_LINE>}<NEW_LINE>// Vr is not symmetric<NEW_LINE>eig.uplo = null;<NEW_LINE>return new EVD(w, vr ? eig : null);<NEW_LINE>} else {<NEW_LINE>double[] wr = new double[n];<NEW_LINE>double[<MASK><NEW_LINE>Matrix Vl = vl ? new Matrix(n, n) : new Matrix(1, 1);<NEW_LINE>Matrix Vr = vr ? new Matrix(n, n) : new Matrix(1, 1);<NEW_LINE>int info = LAPACK.engine.geev(eig.layout(), vl ? EVDJob.VECTORS : EVDJob.NO_VECTORS, vr ? EVDJob.VECTORS : EVDJob.NO_VECTORS, n, eig.A, eig.ld, wr, wi, Vl.A, Vl.ld, Vr.A, Vr.ld);<NEW_LINE>if (info != 0) {<NEW_LINE>logger.error("LAPACK GEEV error code: {}", info);<NEW_LINE>throw new ArithmeticException("LAPACK GEEV error code: " + info);<NEW_LINE>}<NEW_LINE>return new EVD(wr, wi, vl ? Vl : null, vr ? Vr : null);<NEW_LINE>}<NEW_LINE>} | ] wi = new double[n]; |
890,747 | public void patchPool(String poolId, StartTask startTask, Collection<CertificateReference> certificateReferences, Collection<ApplicationPackageReference> applicationPackageReferences, Collection<MetadataItem> metadata, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {<NEW_LINE>PoolPatchOptions options = new PoolPatchOptions();<NEW_LINE>BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);<NEW_LINE>bhMgr.applyRequestBehaviors(options);<NEW_LINE>PoolPatchParameter param = new PoolPatchParameter().withStartTask(startTask);<NEW_LINE>if (metadata != null) {<NEW_LINE>param.withMetadata(new LinkedList<>(metadata));<NEW_LINE>}<NEW_LINE>if (applicationPackageReferences != null) {<NEW_LINE>param.withApplicationPackageReferences(new LinkedList<>(applicationPackageReferences));<NEW_LINE>}<NEW_LINE>if (certificateReferences != null) {<NEW_LINE>param.withCertificateReferences(<MASK><NEW_LINE>}<NEW_LINE>this.parentBatchClient.protocolLayer().pools().patch(poolId, param, options);<NEW_LINE>} | new LinkedList<>(certificateReferences)); |
184,109 | protected void takeStep(AbstractStochasticCachingDiffFunction dfunction) {<NEW_LINE>for (int i = 0; i < x.length; i++) {<NEW_LINE>double thisGain = fixedGain * gainSchedule(k, 5 * numBatches) / (diag[i]);<NEW_LINE>newX[i] = x[i] - thisGain * grad[i];<NEW_LINE>}<NEW_LINE>// Get a new pair...<NEW_LINE>say(" A ");<NEW_LINE>double[] s;<NEW_LINE>double[] y;<NEW_LINE>if (pairMem > 0 && sList.size() == pairMem || sList.size() == pairMem) {<NEW_LINE>s = sList.remove(0);<NEW_LINE>y = yList.remove(0);<NEW_LINE>} else {<NEW_LINE>s = new double[x.length];<NEW_LINE>y = new double[x.length];<NEW_LINE>}<NEW_LINE>s = ArrayMath.pairwiseSubtract(newX, x);<NEW_LINE>dfunction.recalculatePrevBatch = true;<NEW_LINE>System.arraycopy(dfunction.derivativeAt(newX, bSize), 0, <MASK><NEW_LINE>// newY = newY-newGrad<NEW_LINE>ArrayMath.pairwiseSubtractInPlace(y, newGrad);<NEW_LINE>double[] comp = new double[x.length];<NEW_LINE>sList.add(s);<NEW_LINE>yList.add(y);<NEW_LINE>updateDiag(diag, s, y);<NEW_LINE>} | y, 0, grad.length); |
1,612,787 | public void actionPerformed(final ActionEvent e) {<NEW_LINE>final Object source = e.getSource();<NEW_LINE>if (source instanceof JTree) {<NEW_LINE>final JTree tree = (JTree) source;<NEW_LINE>final <MASK><NEW_LINE>if (selectionRow == -1)<NEW_LINE>return;<NEW_LINE>final TreePath selectionPath = tree.getPathForRow(selectionRow);<NEW_LINE>if (selectionPath == null)<NEW_LINE>return;<NEW_LINE>if (tree.getModel().isLeaf(selectionPath.getLastPathComponent()) || tree.isCollapsed(selectionRow)) {<NEW_LINE>final TreePath parentPath = tree.getPathForRow(selectionRow).getParentPath();<NEW_LINE>if (parentPath != null) {<NEW_LINE>if (parentPath.getParentPath() != null || tree.isRootVisible()) {<NEW_LINE>final int parentRow = tree.getRowForPath(parentPath);<NEW_LINE>tree.scrollRowToVisible(parentRow);<NEW_LINE>tree.setSelectionInterval(parentRow, parentRow);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>tree.collapseRow(selectionRow);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | int selectionRow = tree.getLeadSelectionRow(); |
1,316,391 | void updateNodeMap(Subdiv2D subdiv, final double pixelWidth, final double pixelHeight) {<NEW_LINE>if (subdiv == null)<NEW_LINE>return;<NEW_LINE>int[] firstEdgeArray = new int[1];<NEW_LINE>// double distanceThreshold = 0;<NEW_LINE>boolean ignoreDistance = Double.isNaN(distanceThreshold) || Double.isInfinite(distanceThreshold) || distanceThreshold <= 0;<NEW_LINE>DelaunayNodeFactory factory = new DelaunayNodeFactory(pixelWidth, pixelHeight);<NEW_LINE>nodeMap = new HashMap<>(vertexMap.size(), 1f);<NEW_LINE>for (Entry<Integer, PathObject> entry : vertexMap.entrySet()) {<NEW_LINE>int v = entry.getKey();<NEW_LINE>PathObject pathObject = entry.getValue();<NEW_LINE>PathClass pathClass = pathObject.getPathClass() == null ? null : pathObject.getPathClass().getBaseClass();<NEW_LINE>// // TODO: CHECK INTENSITY DIFFERENT THRESHOLD<NEW_LINE>// String measurementName = "Nucleus: DAB OD mean";<NEW_LINE>// double measurementDiffThreshold = 0.1;<NEW_LINE>// double od = pathObject.getMeasurementList().getMeasurementValue(measurementName);<NEW_LINE>subdiv.getVertex(v, firstEdgeArray);<NEW_LINE>int firstEdge = firstEdgeArray[0];<NEW_LINE>int edge = firstEdge;<NEW_LINE>DelaunayNode <MASK><NEW_LINE>while (true) {<NEW_LINE>int edgeDest = subdiv.edgeDst(edge);<NEW_LINE>PathObject destination = vertexMap.get(edgeDest);<NEW_LINE>if (destination == null)<NEW_LINE>break;<NEW_LINE>boolean distanceOK = ignoreDistance || distance(getROI(pathObject), getROI(destination)) < distanceThreshold;<NEW_LINE>boolean classOK = !limitByClass || pathClass == destination.getPathClass() || (destination.getPathClass() != null && destination.getPathClass().getBaseClass() == pathClass);<NEW_LINE>if (distanceOK && classOK) {<NEW_LINE>// Intensity test (works, but currently commented out)<NEW_LINE>// if (Math.abs(od - destination.getMeasurementList().getMeasurementValue(measurementName)) < measurementDiffThreshold)<NEW_LINE>DelaunayNode destinationNode = factory.getNode(destination);<NEW_LINE>node.addEdge(destinationNode);<NEW_LINE>destinationNode.addEdge(node);<NEW_LINE>}<NEW_LINE>// Unused code exploring how a similarity test could be included<NEW_LINE>// if (ignoreDistance || distance(pathObject.getROI(), destination.getROI()) < distanceThreshold) {<NEW_LINE>// MeasurementList m1 = pathObject.getMeasurementList();<NEW_LINE>// MeasurementList m2 = destination.getMeasurementList();<NEW_LINE>// double d2 = 0;<NEW_LINE>// for (String name : new String[]{"Nucleus: Area", "Nucleus: DAB OD mean", "Nucleus: Eccentricity"}) {<NEW_LINE>// double t1 = m1.getMeasurementValue(name);<NEW_LINE>// double t2 = m2.getMeasurementValue(name);<NEW_LINE>// double temp = ((t1 - t2) / (t1 + t2)) * 2;<NEW_LINE>// d2 += temp*temp;<NEW_LINE>// }<NEW_LINE>// if (d2 < 1)<NEW_LINE>// // System.out.println(d2);<NEW_LINE>// node.addEdge(factory.getNode(destination));<NEW_LINE>// }<NEW_LINE>edge = subdiv.getEdge(edge, Subdiv2D.NEXT_AROUND_ORG);<NEW_LINE>if (edge == firstEdge)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>Object previous = nodeMap.put(pathObject, node);<NEW_LINE>assert previous == null;<NEW_LINE>}<NEW_LINE>} | node = factory.getNode(pathObject); |
241,425 | TimelineEventDescription parseDescription(String fullDescriptionRaw, String medDescriptionRaw, String shortDescriptionRaw) {<NEW_LINE>String fullDescription = fullDescriptionRaw;<NEW_LINE>try {<NEW_LINE>URI uri = new URI(fullDescription);<NEW_LINE>String host = uri.getHost();<NEW_LINE>if (host == null) {<NEW_LINE>host = <MASK><NEW_LINE>}<NEW_LINE>String shortDescription;<NEW_LINE>if (InternetDomainName.isValid(host)) {<NEW_LINE>InternetDomainName domain = InternetDomainName.from(host);<NEW_LINE>shortDescription = (domain.isUnderPublicSuffix()) ? domain.topPrivateDomain().toString() : domain.toString();<NEW_LINE>} else {<NEW_LINE>shortDescription = host;<NEW_LINE>}<NEW_LINE>String mediumDescription = new URI(uri.getScheme(), uri.getUserInfo(), host, uri.getPort(), uri.getPath(), null, null).toString();<NEW_LINE>return new TimelineEventDescription(fullDescription, mediumDescription, shortDescription);<NEW_LINE>} catch (URISyntaxException ex) {<NEW_LINE>// There was an error parsing the description as a URL, just ignore the description levels.<NEW_LINE>return new TimelineEventDescription(fullDescription);<NEW_LINE>}<NEW_LINE>} | StringUtils.strip(fullDescription, "./"); |
711,906 | protected static void updateAlias(QueryContext queryContext, BrokerResponseNative brokerResponseNative) {<NEW_LINE>ResultTable resultTable = brokerResponseNative.getResultTable();<NEW_LINE>if (resultTable == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<String> aliasList = queryContext.getAliasList();<NEW_LINE>if (aliasList.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String[] columnNames = resultTable.getDataSchema().getColumnNames();<NEW_LINE>List<ExpressionContext> selectExpressions = getSelectExpressions(queryContext.getSelectExpressions());<NEW_LINE><MASK><NEW_LINE>// For query like `SELECT *`, we skip alias update.<NEW_LINE>if (columnNames.length != numSelectExpressions) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (int i = 0; i < numSelectExpressions; i++) {<NEW_LINE>String alias = aliasList.get(i);<NEW_LINE>if (alias != null) {<NEW_LINE>columnNames[i] = alias;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | int numSelectExpressions = selectExpressions.size(); |
346,361 | protected void layoutChildren(double x, double y, double w, final double h) {<NEW_LINE>if (tableView == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>size.set(getItemCount());<NEW_LINE>double width = w;<NEW_LINE>double height = h;<NEW_LINE>double rowHeaderWidth = getRowHeaderOffset();<NEW_LINE>if (tableView.isRowHeaderVisible()) {<NEW_LINE>x += rowHeaderWidth;<NEW_LINE>width -= rowHeaderWidth;<NEW_LINE>}<NEW_LINE>super.layoutChildren(x, y, width, height);<NEW_LINE>final double baselineOffset = getSkinnable().getLayoutBounds().getHeight() / 2;<NEW_LINE>double tableHeaderRowHeight = 0;<NEW_LINE>if (isColumnHeaderVisible()) {<NEW_LINE>// position the table header<NEW_LINE>tableHeaderRowHeight = tableHeaderRow.prefHeight(-1);<NEW_LINE>layoutInArea(getTableHeaderRow(), x, y, width, tableHeaderRowHeight, baselineOffset, <MASK><NEW_LINE>y += tableHeaderRowHeight;<NEW_LINE>}<NEW_LINE>if (tableView.isRowHeaderVisible() && rowHeader != null) {<NEW_LINE>layoutInArea(rowHeader, x - rowHeaderWidth, y - tableHeaderRowHeight, rowHeaderWidth, height, baselineOffset, HPos.CENTER, VPos.CENTER);<NEW_LINE>}<NEW_LINE>} | HPos.CENTER, VPos.CENTER); |
1,434,100 | static Header readHeader(Version version, int networkMessageSize, BytesReference bytesReference) throws IOException {<NEW_LINE>try (StreamInput streamInput = bytesReference.streamInput()) {<NEW_LINE>streamInput.skip(TcpHeader.BYTES_REQUIRED_FOR_MESSAGE_SIZE);<NEW_LINE>long requestId = streamInput.readLong();<NEW_LINE>byte status = streamInput.readByte();<NEW_LINE>Version remoteVersion = Version.<MASK><NEW_LINE>Header header = new Header(networkMessageSize, requestId, status, remoteVersion);<NEW_LINE>final IllegalStateException invalidVersion = ensureVersionCompatibility(remoteVersion, version, header.isHandshake());<NEW_LINE>if (invalidVersion != null) {<NEW_LINE>throw invalidVersion;<NEW_LINE>} else {<NEW_LINE>if (remoteVersion.onOrAfter(TcpHeader.VERSION_WITH_HEADER_SIZE)) {<NEW_LINE>// Skip since we already have ensured enough data available<NEW_LINE>streamInput.readInt();<NEW_LINE>header.finishParsingHeader(streamInput);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return header;<NEW_LINE>}<NEW_LINE>} | fromId(streamInput.readInt()); |
1,511,359 | public boolean clipToMargin(double[] origin, double[] target) {<NEW_LINE>assert (target.length == 2 && origin.length == 2);<NEW_LINE>if (//<NEW_LINE>//<NEW_LINE>(origin[0] < minx && target[0] < minx) || //<NEW_LINE>(origin[0] > maxx && target[0] > maxx) || (origin[1] < miny && target[1] < miny) || (origin[1] > maxy && target[1] > maxy)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>double deltax = target[0] - origin[0];<NEW_LINE>double deltay = target[1] - origin[1];<NEW_LINE>double fmaxx = (maxx - origin[0]) / deltax;<NEW_LINE>double fmaxy = (maxy - origin[1]) / deltay;<NEW_LINE>double fminx = (minx - origin[0]) / deltax;<NEW_LINE>double fminy = (miny - origin[1]) / deltay;<NEW_LINE>double factor1 = MathUtil.min(1, fmaxx > fminx ? fmaxx : fminx, fmaxy > fminy ? fmaxy : fminy);<NEW_LINE>double factor2 = MathUtil.max(0, fmaxx < fminx ? fmaxx : fminx, fmaxy < fminy ? fmaxy : fminy);<NEW_LINE>if (factor1 <= factor2) {<NEW_LINE>// Clipped!<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>target[0] = <MASK><NEW_LINE>target[1] = origin[1] + factor1 * deltay;<NEW_LINE>origin[0] += factor2 * deltax;<NEW_LINE>origin[1] += factor2 * deltay;<NEW_LINE>return true;<NEW_LINE>} | origin[0] + factor1 * deltax; |
1,161,349 | public void onCreate(Bundle savedInstanceState) {<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>setContentView(R.layout.demo_extras_activity_main);<NEW_LINE>// The attacher should always be created in the Activity's onCreate<NEW_LINE>// mPullToRefreshAttacher = PullToRefreshAttacher.get(this);<NEW_LINE>// enable ActionBar app icon to behave as action to toggle nav drawer<NEW_LINE>getActionBar().setDisplayHomeAsUpEnabled(true);<NEW_LINE>getActionBar().setHomeButtonEnabled(true);<NEW_LINE>mDrawer = (DrawerLayout) <MASK><NEW_LINE>mDrawer.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);<NEW_LINE>_initMenu();<NEW_LINE>mDrawerToggle = new CustomActionBarDrawerToggle(this, mDrawer);<NEW_LINE>mDrawer.setDrawerListener(mDrawerToggle);<NEW_LINE>// ---------------------------------------------------------------<NEW_LINE>// ...<NEW_LINE>String base64EncodedPublicKey = IabUtil.key;<NEW_LINE>// compute your public key and store it in base64EncodedPublicKey<NEW_LINE>mHelper = new IabHelper(this, base64EncodedPublicKey);<NEW_LINE>mHelper.enableDebugLogging(true);<NEW_LINE>mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {<NEW_LINE><NEW_LINE>public void onIabSetupFinished(IabResult result) {<NEW_LINE>if (!result.isSuccess()) {<NEW_LINE>// Oh noes, there was a problem.<NEW_LINE>Log.d(TAG, "Problem setting up In-app Billing: " + result);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Have we been disposed of in the meantime? If so, quit.<NEW_LINE>if (mHelper == null)<NEW_LINE>return;<NEW_LINE>// Hooray, IAB is fully set up!<NEW_LINE>IabUtil.getInstance().retrieveData(mHelper);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// -----------------------------------------------------------------<NEW_LINE>// BaseFragment baseFragment = null;<NEW_LINE>if (savedInstanceState != null) {<NEW_LINE>mSelectedFragment = savedInstanceState.getInt(BUNDLE_SELECTEDFRAGMENT);<NEW_LINE>FragmentManager fragmentManager = getFragmentManager();<NEW_LINE>FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();<NEW_LINE>if (fragmentManager.findFragmentById(R.id.fragment_main_extras) == null)<NEW_LINE>mBaseFragment = selectFragment(mSelectedFragment);<NEW_LINE>// if (mBaseFragment==null)<NEW_LINE>// mBaseFragment = selectFragment(mSelectedFragment);<NEW_LINE>} else {<NEW_LINE>mBaseFragment = new PicassoFragment();<NEW_LINE>openFragment(mBaseFragment);<NEW_LINE>}<NEW_LINE>// -----------------------------------------------------------------<NEW_LINE>} | findViewById(R.id.drawer_layout_extras); |
578,019 | protected BeanDefinitionBuilder parseHandler(Element element, ParserContext parserContext) {<NEW_LINE>BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(RedisOutboundGateway.class);<NEW_LINE>String redisTemplate = element.getAttribute("redis-template");<NEW_LINE>String connectionFactory = element.getAttribute("connection-factory");<NEW_LINE>if (StringUtils.hasText(redisTemplate) && StringUtils.hasText(connectionFactory)) {<NEW_LINE>parserContext.getReaderContext().error("Only one of '" + redisTemplate + "' or '" + connectionFactory + "' is allowed.", element);<NEW_LINE>}<NEW_LINE>if (StringUtils.hasText(redisTemplate)) {<NEW_LINE>builder.addConstructorArgReference(redisTemplate);<NEW_LINE>} else {<NEW_LINE>if (!StringUtils.hasText(connectionFactory)) {<NEW_LINE>connectionFactory = "redisConnectionFactory";<NEW_LINE>}<NEW_LINE>builder.addConstructorArgReference(connectionFactory);<NEW_LINE>}<NEW_LINE>String argumentExpressions = element.getAttribute("argument-expressions");<NEW_LINE>boolean <MASK><NEW_LINE>String argumentsStrategy = element.getAttribute("arguments-strategy");<NEW_LINE>boolean hasArgumentStrategy = element.hasAttribute("arguments-strategy");<NEW_LINE>if (hasArgumentExpressions & hasArgumentStrategy) {<NEW_LINE>parserContext.getReaderContext().error("'argument-expressions' and 'arguments-strategy' are mutually exclusive.", element);<NEW_LINE>}<NEW_LINE>if (hasArgumentExpressions) {<NEW_LINE>BeanDefinitionBuilder argumentsBuilder = BeanDefinitionBuilder.genericBeanDefinition(ExpressionArgumentsStrategy.class).addConstructorArgValue(argumentExpressions).addConstructorArgValue(element.getAttribute("use-command-variable"));<NEW_LINE>builder.addPropertyValue("argumentsStrategy", argumentsBuilder.getBeanDefinition());<NEW_LINE>} else if (StringUtils.hasLength(argumentsStrategy)) {<NEW_LINE>builder.addPropertyReference("argumentsStrategy", argumentsStrategy);<NEW_LINE>} else if (hasArgumentStrategy) {<NEW_LINE>builder.addPropertyValue("argumentsStrategy", null);<NEW_LINE>}<NEW_LINE>IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "reply-channel", "outputChannel");<NEW_LINE>IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "requires-reply");<NEW_LINE>IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "reply-timeout", "sendTimeout");<NEW_LINE>BeanDefinition expressionDef = IntegrationNamespaceUtils.createExpressionDefIfAttributeDefined("command-expression", element);<NEW_LINE>if (expressionDef != null) {<NEW_LINE>builder.addPropertyValue("commandExpression", expressionDef);<NEW_LINE>}<NEW_LINE>IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "arguments-serializer");<NEW_LINE>return builder;<NEW_LINE>} | hasArgumentExpressions = StringUtils.hasText(argumentExpressions); |
136,950 | // Implementations for KotlinPropertyVisitor.<NEW_LINE>@Override<NEW_LINE>public void visitAnyProperty(Clazz clazz, KotlinDeclarationContainerMetadata kotlinDeclarationContainerMetadata, KotlinPropertyMetadata kotlinPropertyMetadata) {<NEW_LINE>kotlinPropertyMetadata.versionRequirementAccept(clazz, kotlinDeclarationContainerMetadata, this);<NEW_LINE>kotlinPropertyMetadata.<MASK><NEW_LINE>kotlinPropertyMetadata.setterParametersAccept(clazz, kotlinDeclarationContainerMetadata, this);<NEW_LINE>kotlinPropertyMetadata.receiverTypeAccept(clazz, kotlinDeclarationContainerMetadata, this);<NEW_LINE>kotlinPropertyMetadata.typeParametersAccept(clazz, kotlinDeclarationContainerMetadata, this);<NEW_LINE>if (kotlinPropertyMetadata.syntheticMethodForAnnotations != null) {<NEW_LINE>kotlinPropertyMetadata.referencedSyntheticMethodForAnnotations.accept(kotlinPropertyMetadata.referencedSyntheticMethodClass, annotationCounter.reset());<NEW_LINE>kotlinPropertyMetadata.flags.common.hasAnnotations = annotationCounter.getCount() > 0;<NEW_LINE>} else if (kotlinPropertyMetadata.referencedBackingField != null) {<NEW_LINE>kotlinPropertyMetadata.referencedBackingField.accept(kotlinPropertyMetadata.referencedBackingFieldClass, annotationCounter);<NEW_LINE>kotlinPropertyMetadata.flags.common.hasAnnotations = annotationCounter.getCount() > 0;<NEW_LINE>} else {<NEW_LINE>kotlinPropertyMetadata.flags.common.hasAnnotations = false;<NEW_LINE>}<NEW_LINE>if (kotlinPropertyMetadata.flags.hasGetter && kotlinPropertyMetadata.referencedGetterMethod != null) {<NEW_LINE>kotlinPropertyMetadata.referencedGetterMethod.accept(clazz, annotationCounter.reset());<NEW_LINE>kotlinPropertyMetadata.getterFlags.common.hasAnnotations = annotationCounter.getCount() > 0;<NEW_LINE>}<NEW_LINE>if (kotlinPropertyMetadata.flags.hasSetter && kotlinPropertyMetadata.referencedSetterMethod != null) {<NEW_LINE>kotlinPropertyMetadata.referencedSetterMethod.accept(clazz, annotationCounter.reset());<NEW_LINE>kotlinPropertyMetadata.setterFlags.common.hasAnnotations = annotationCounter.getCount() > 0;<NEW_LINE>}<NEW_LINE>} | typeAccept(clazz, kotlinDeclarationContainerMetadata, this); |
589,824 | // -------------------------------------------------------- Adapter Methods<NEW_LINE>@Override<NEW_LINE>public void service(org.glassfish.grizzly.http.server.Request req, org.glassfish.grizzly.http.server.Response res) throws Exception {<NEW_LINE>res.getResponse().setAllowCustomReasonPhrase(Constants.USE_CUSTOM_STATUS_MSG_IN_HEADER);<NEW_LINE>Request <MASK><NEW_LINE>Response response = req.getNote(CATALINA_RESPONSE_NOTE);<NEW_LINE>// Grizzly already parsed, decoded, and mapped the request.<NEW_LINE>// Let's re-use this info here, before firing the<NEW_LINE>// requestStartEvent probe, so that the mapping data will be<NEW_LINE>// available to any probe event listener via standard<NEW_LINE>// ServletRequest APIs (such as getContextPath())<NEW_LINE>MappingData md = req.getNote(MAPPING_DATA);<NEW_LINE>final boolean v3Enabled = md != null;<NEW_LINE>if (request == null) {<NEW_LINE>// Create objects<NEW_LINE>request = (Request) connector.createRequest();<NEW_LINE>response = (Response) connector.createResponse();<NEW_LINE>// Link objects<NEW_LINE>request.setResponse(response);<NEW_LINE>response.setRequest(request);<NEW_LINE>// Set as notes<NEW_LINE>req.setNote(CATALINA_REQUEST_NOTE, request);<NEW_LINE>req.setNote(CATALINA_RESPONSE_NOTE, response);<NEW_LINE>// res.setNote(ADAPTER_NOTES, response);<NEW_LINE>// Set query string encoding<NEW_LINE>req.getRequest().getRequestURIRef().setDefaultURIEncoding(Charset.forName(connector.getURIEncoding()));<NEW_LINE>}<NEW_LINE>request.setCoyoteRequest(req);<NEW_LINE>response.setCoyoteResponse(res);<NEW_LINE>if (v3Enabled && !compatWithTomcat) {<NEW_LINE>request.setMappingData(md);<NEW_LINE>request.updatePaths(md);<NEW_LINE>}<NEW_LINE>req.addAfterServiceListener(catalinaAfterServiceListener);<NEW_LINE>try {<NEW_LINE>doService(req, request, res, response, v3Enabled);<NEW_LINE>// Request may want to initialize async processing<NEW_LINE>request.onExitService();<NEW_LINE>} catch (Throwable t) {<NEW_LINE>log.log(Level.SEVERE, LogFacade.REQUEST_PROCESSING_EXCEPTION, t);<NEW_LINE>}<NEW_LINE>} | request = req.getNote(CATALINA_REQUEST_NOTE); |
582,124 | final StartJobRunResult executeStartJobRun(StartJobRunRequest startJobRunRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(startJobRunRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<StartJobRunRequest> request = null;<NEW_LINE>Response<StartJobRunResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new StartJobRunRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(startJobRunRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Glue");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StartJobRun");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<StartJobRunResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new StartJobRunResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | endClientExecution(awsRequestMetrics, request, response); |
1,536,462 | public Optional<BiMapProperty> create(Config config) {<NEW_LINE>Property property = config.getProperty();<NEW_LINE>DeclaredType type = maybeDeclared(property.getType()).orElse(null);<NEW_LINE>if (!erasesToAnyOf(type, BiMap.class, ImmutableBiMap.class)) {<NEW_LINE>return Optional.empty();<NEW_LINE>}<NEW_LINE>TypeMirror keyType = upperBound(config.getElements(), type.getTypeArguments().get(0));<NEW_LINE>TypeMirror valueType = upperBound(config.getElements(), type.getTypeArguments().get(1));<NEW_LINE>Optional<TypeMirror> unboxedKeyType = maybeUnbox(<MASK><NEW_LINE>Optional<TypeMirror> unboxedValueType = maybeUnbox(valueType, config.getTypes());<NEW_LINE>Optional<ExecutableElement> putMethodOverride = putMethodOverride(config, unboxedKeyType.orElse(keyType), unboxedValueType.orElse(valueType));<NEW_LINE>boolean overridesForcePutMethod = hasForcePutMethodOverride(config, unboxedKeyType.orElse(keyType), unboxedValueType.orElse(valueType));<NEW_LINE>if (putMethodOverride.isPresent() && !overridesForcePutMethod) {<NEW_LINE>config.getEnvironment().getMessager().printMessage(Kind.ERROR, "Overriding " + putMethod(property) + " will not correctly validate all inputs. Please override " + forcePutMethod(property) + ".", putMethodOverride.get());<NEW_LINE>}<NEW_LINE>FunctionalType mutatorType = functionalTypeAcceptedByMethod(config.getBuilder(), mutator(property), consumer(biMap(keyType, valueType, config.getElements(), config.getTypes())), config.getElements(), config.getTypes());<NEW_LINE>return Optional.of(new BiMapProperty(config.getDatatype(), property, overridesForcePutMethod, keyType, unboxedKeyType, valueType, unboxedValueType, mutatorType));<NEW_LINE>} | keyType, config.getTypes()); |
1,215,925 | public void confirmPassword(String password, byte[] keySpec, byte[] keySalt, byte[] verifier, byte[] verifierSalt, byte[] integritySalt) {<NEW_LINE>StandardEncryptionVerifier ver = builder.getVerifier();<NEW_LINE>ver.setSalt(verifierSalt);<NEW_LINE>SecretKey secretKey = generateSecretKey(<MASK><NEW_LINE>setSecretKey(secretKey);<NEW_LINE>Cipher cipher = getCipher(secretKey, null);<NEW_LINE>try {<NEW_LINE>byte[] encryptedVerifier = cipher.doFinal(verifier);<NEW_LINE>MessageDigest hashAlgo = CryptoFunctions.getMessageDigest(ver.getHashAlgorithm());<NEW_LINE>byte[] calcVerifierHash = hashAlgo.digest(verifier);<NEW_LINE>// 2.3.3 EncryptionVerifier ...<NEW_LINE>// An array of bytes that contains the encrypted form of the<NEW_LINE>// hash of the randomly generated Verifier value. The length of the array MUST be the size of<NEW_LINE>// the encryption block size multiplied by the number of blocks needed to encrypt the hash of the<NEW_LINE>// Verifier. If the encryption algorithm is RC4, the length MUST be 20 bytes. If the encryption<NEW_LINE>// algorithm is AES, the length MUST be 32 bytes. After decrypting the EncryptedVerifierHash<NEW_LINE>// field, only the first VerifierHashSize bytes MUST be used.<NEW_LINE>int encVerHashSize = ver.getCipherAlgorithm().encryptedVerifierHashLength;<NEW_LINE>byte[] encryptedVerifierHash = cipher.doFinal(Arrays.copyOf(calcVerifierHash, encVerHashSize));<NEW_LINE>ver.setEncryptedVerifier(encryptedVerifier);<NEW_LINE>ver.setEncryptedVerifierHash(encryptedVerifierHash);<NEW_LINE>} catch (GeneralSecurityException e) {<NEW_LINE>throw new EncryptedDocumentException("Password confirmation failed", e);<NEW_LINE>}<NEW_LINE>} | password, ver, getKeySizeInBytes()); |
194,843 | ObjectNode fetchLogEvents(final EcsClient client, final ObjectNode previousStatus, final ObjectNode previousExecutorStatus) throws IOException {<NEW_LINE>final Optional<String> previousToken = !previousExecutorStatus.has("next_token") ? Optional.absent() : Optional.of(previousExecutorStatus.get("next_token").asText());<NEW_LINE>final GetLogEventsResult result = client.getLog(toLogGroupName(previousStatus), toLogStreamName(previousStatus), previousToken);<NEW_LINE>final List<OutputLogEvent> logEvents = result.getEvents();<NEW_LINE>// trim "f/" prefix of the token<NEW_LINE>final String nextForwardToken = result.getNextForwardToken().substring(2);<NEW_LINE>// trim "b/" prefix of the token<NEW_LINE>final String nextBackwardToken = result.getNextBackwardToken().substring(2);<NEW_LINE>final ObjectNode nextExecutorStatus = previousExecutorStatus.deepCopy();<NEW_LINE>if (!previousToken.isPresent() && nextForwardToken.equals(nextBackwardToken)) {<NEW_LINE>// just in case, we'd better to drop "next_token" key<NEW_LINE>nextExecutorStatus.remove("next_token");<NEW_LINE>} else {<NEW_LINE>for (final OutputLogEvent logEvent : logEvents) {<NEW_LINE>String log = logEvent.getMessage();<NEW_LINE>if (log.contains(ECS_END_OF_TASK_LOG_MARK)) {<NEW_LINE>nextExecutorStatus.put("logging_finished_at", Instant.now().getEpochSecond());<NEW_LINE>} else {<NEW_LINE>log(log + "\n", clog);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>nextExecutorStatus.set("next_token", JsonNodeFactory<MASK><NEW_LINE>}<NEW_LINE>return nextExecutorStatus;<NEW_LINE>} | .instance.textNode(nextForwardToken)); |
88,487 | public Request<DeleteAliasRequest> marshall(DeleteAliasRequest deleteAliasRequest) {<NEW_LINE>if (deleteAliasRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(DeleteAliasRequest)");<NEW_LINE>}<NEW_LINE>Request<DeleteAliasRequest> request = new DefaultRequest<DeleteAliasRequest>(deleteAliasRequest, "AWSKMS");<NEW_LINE>String target = "TrentService.DeleteAlias";<NEW_LINE>request.addHeader("X-Amz-Target", target);<NEW_LINE>request.setHttpMethod(HttpMethodName.POST);<NEW_LINE>String uriResourcePath = "/";<NEW_LINE>request.setResourcePath(uriResourcePath);<NEW_LINE>try {<NEW_LINE>StringWriter stringWriter = new StringWriter();<NEW_LINE>AwsJsonWriter jsonWriter = JsonUtils.getJsonWriter(stringWriter);<NEW_LINE>jsonWriter.beginObject();<NEW_LINE>if (deleteAliasRequest.getAliasName() != null) {<NEW_LINE>String aliasName = deleteAliasRequest.getAliasName();<NEW_LINE>jsonWriter.name("AliasName");<NEW_LINE>jsonWriter.value(aliasName);<NEW_LINE>}<NEW_LINE>jsonWriter.endObject();<NEW_LINE>jsonWriter.close();<NEW_LINE>String snippet = stringWriter.toString();<NEW_LINE>byte[] content = snippet.getBytes(UTF8);<NEW_LINE>request.setContent(new StringInputStream(snippet));<NEW_LINE>request.addHeader("Content-Length", Integer<MASK><NEW_LINE>} catch (Throwable t) {<NEW_LINE>throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);<NEW_LINE>}<NEW_LINE>if (!request.getHeaders().containsKey("Content-Type")) {<NEW_LINE>request.addHeader("Content-Type", "application/x-amz-json-1.1");<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | .toString(content.length)); |
1,249,594 | // TODO: Vespa 8: remove<NEW_LINE>@SuppressWarnings("removal")<NEW_LINE>private void handleCreateVisitorReply(CreateVisitorReply reply) {<NEW_LINE>CreateVisitorMessage msg = (CreateVisitorMessage) reply.getMessage();<NEW_LINE>BucketId superbucket = msg.getBuckets().get(0);<NEW_LINE>BucketId subBucketProgress = reply.getLastBucket();<NEW_LINE>log.log(Level.FINE, () -> sessionName + ": received CreateVisitorReply for bucket " + superbucket + " with progress " + subBucketProgress);<NEW_LINE>progress.getIterator().update(superbucket, subBucketProgress);<NEW_LINE>params.getControlHandler().<MASK><NEW_LINE>statistics.add(reply.getVisitorStatistics());<NEW_LINE>params.getControlHandler().onVisitorStatistics(statistics);<NEW_LINE>// A visitor session might be long lived so we need a safeguard against blowing the memory if tracing<NEW_LINE>// has been enabled.<NEW_LINE>if (!reply.getTrace().getRoot().isEmpty() && (trace.getRoot().getNumChildren() < 1000)) {<NEW_LINE>trace.getRoot().addChild(reply.getTrace().getRoot());<NEW_LINE>}<NEW_LINE>// TODO: Vespa 8 remove this unused functionality<NEW_LINE>if (params.getDynamicallyIncreaseMaxBucketsPerVisitor() && (reply.getVisitorStatistics().getDocumentsReturned() < params.getMaxFirstPassHits() / 2.0)) {<NEW_LINE>// Attempt to increase parallelism to reduce latency of visiting<NEW_LINE>// Ensure new count is within [1, 128]<NEW_LINE>int newMaxBuckets = Math.max(Math.min((int) (params.getMaxBucketsPerVisitor() * params.getDynamicMaxBucketsIncreaseFactor()), 128), 1);<NEW_LINE>params.setMaxBucketsPerVisitor(newMaxBuckets);<NEW_LINE>log.log(Level.FINE, () -> sessionName + ": increasing max buckets per visitor to " + params.getMaxBucketsPerVisitor());<NEW_LINE>}<NEW_LINE>} | onProgress(progress.getToken()); |
1,425,046 | public void validateConfig(CustomerConfig customerConfig) {<NEW_LINE>beanValidator.validate(customerConfig);<NEW_LINE>String configName = customerConfig.getConfigName();<NEW_LINE>CustomerConfig existentConfig = CustomerConfig.get(customerConfig.customerUUID, configName);<NEW_LINE>if (existentConfig != null) {<NEW_LINE>if (!existentConfig.getConfigUUID().equals(customerConfig.getConfigUUID())) {<NEW_LINE>beanValidator.error().code(CONFLICT).forField("configName", String.format("Configuration %s already exists", configName)).throwError();<NEW_LINE>}<NEW_LINE>JsonNode newBackupLocation = customerConfig.getData().get(BACKUP_LOCATION_FIELDNAME);<NEW_LINE>JsonNode oldBackupLocation = existentConfig.getData().get(BACKUP_LOCATION_FIELDNAME);<NEW_LINE>if (newBackupLocation != null && oldBackupLocation != null && !StringUtils.equals(newBackupLocation.textValue(), oldBackupLocation.textValue())) {<NEW_LINE>String errorMsg = "Field is read-only.";<NEW_LINE>throwBeanValidatorError(BACKUP_LOCATION_FIELDNAME, errorMsg);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>validators.forEach(v -> v.validate(customerConfig.getType().name(), customerConfig.getName()<MASK><NEW_LINE>} | , customerConfig.getData())); |
1,289,099 | // join the sequences of a chain of contigs to produce a single, new contig<NEW_LINE>private static Contig joinContigs(final Contig firstContig, final List<Connection> path) {<NEW_LINE>if (path.isEmpty())<NEW_LINE>return firstContig;<NEW_LINE>final int nSupportingReads = path.stream().mapToInt(conn -> conn.getTarget().getNSupportingReads()).reduce(firstContig.getNSupportingReads(), Integer::sum);<NEW_LINE>final int newContigLen = path.stream().mapToInt(conn -> conn.getTarget().getSequence().length - conn.getOverlapLen()).reduce(firstContig.getSequence().length, Integer::sum);<NEW_LINE>final byte[] sequence = new byte[newContigLen];<NEW_LINE>int destinationOffset = firstContig.getSequence().length;<NEW_LINE>System.arraycopy(firstContig.getSequence(), 0, sequence, 0, destinationOffset);<NEW_LINE>if (path.get(0).isRC())<NEW_LINE>SequenceUtil.reverseComplement(sequence, 0, destinationOffset);<NEW_LINE>for (final Connection conn : path) {<NEW_LINE>final byte[] contigSequence = conn.getTarget().getSequence();<NEW_LINE>final int len = contigSequence.length - conn.getOverlapLen();<NEW_LINE>if (!conn.isTargetRC()) {<NEW_LINE>System.arraycopy(contigSequence, conn.getOverlapLen(), sequence, destinationOffset, len);<NEW_LINE>} else {<NEW_LINE>System.arraycopy(contigSequence, <MASK><NEW_LINE>SequenceUtil.reverseComplement(sequence, destinationOffset, len);<NEW_LINE>}<NEW_LINE>destinationOffset += len;<NEW_LINE>}<NEW_LINE>return new Contig(sequence, null, nSupportingReads);<NEW_LINE>} | 0, sequence, destinationOffset, len); |
1,376,376 | protected void onAccountChangeMessage(String topic, String message) {<NEW_LINE>if (!open.get()) {<NEW_LINE>// take no action instead of throwing an exception to silence noisy log messages when a message is received while<NEW_LINE>// closing the AccountService.<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>logger.trace("Start to process message={} for topic={}", message, topic);<NEW_LINE>try {<NEW_LINE>switch(message) {<NEW_LINE>case FULL_ACCOUNT_METADATA_CHANGE_MESSAGE:<NEW_LINE>logger.<MASK><NEW_LINE>fetchAndUpdateCache(true);<NEW_LINE>logger.trace("Completed processing message={} for topic={}", message, topic);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>accountServiceMetrics.unrecognizedMessageErrorCount.inc();<NEW_LINE>throw new RuntimeException("Could not understand message=" + message + " for topic=" + topic);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.error("Exception occurred when processing message={} for topic={}.", message, topic, e);<NEW_LINE>accountServiceMetrics.remoteDataCorruptionErrorCount.inc();<NEW_LINE>accountServiceMetrics.fetchRemoteAccountErrorCount.inc();<NEW_LINE>}<NEW_LINE>} | trace("Start processing message={} for topic={}", message, topic); |
1,123,591 | private PropertyDescriptor ordinaryGetOwnProperty(JSDynamicObject thisObj, Property prop) {<NEW_LINE>assert !JSProxy.isJSProxy(thisObj);<NEW_LINE>if (hasPropertyBranch.profile(prop == null)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>PropertyDescriptor d;<NEW_LINE>if (isDataPropertyBranch.profile(JSProperty.isData(prop))) {<NEW_LINE>Object value = needValue ? getDataPropertyValue(thisObj, prop) : null;<NEW_LINE>d = PropertyDescriptor.createData(value);<NEW_LINE>if (needWritability) {<NEW_LINE>d.setWritable(JSProperty.isWritable(prop));<NEW_LINE>}<NEW_LINE>} else if (isAccessorPropertyBranch.profile(JSProperty.isAccessor(prop))) {<NEW_LINE>if (needValue) {<NEW_LINE>Accessor acc = (Accessor) prop.getLocation(<MASK><NEW_LINE>d = PropertyDescriptor.createAccessor(acc.getGetter(), acc.getSetter());<NEW_LINE>} else {<NEW_LINE>d = PropertyDescriptor.createAccessor(null, null);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>d = PropertyDescriptor.createEmpty();<NEW_LINE>}<NEW_LINE>if (needEnumerability) {<NEW_LINE>d.setEnumerable(JSProperty.isEnumerable(prop));<NEW_LINE>}<NEW_LINE>if (needConfigurability) {<NEW_LINE>d.setConfigurable(JSProperty.isConfigurable(prop));<NEW_LINE>}<NEW_LINE>return d;<NEW_LINE>} | ).get(thisObj, false); |
1,154,914 | public KneighborRecords customizedKneighbor(Id source, EdgeStep step, int maxDepth, long limit) {<NEW_LINE>E.checkNotNull(source, "source vertex id");<NEW_LINE>this.checkVertexExist(source, "source vertex");<NEW_LINE>checkPositive(maxDepth, "k-neighbor max_depth");<NEW_LINE>checkLimit(limit);<NEW_LINE>boolean concurrent = maxDepth >= this.concurrentDepth();<NEW_LINE>KneighborRecords records = new KneighborRecords(concurrent, source, true);<NEW_LINE>Consumer<Id> consumer = v -> {<NEW_LINE>if (this.reachLimit(limit, records.size())) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Iterator<Edge> <MASK><NEW_LINE>while (!this.reachLimit(limit, records.size()) && edges.hasNext()) {<NEW_LINE>Id target = ((HugeEdge) edges.next()).id().otherVertexId();<NEW_LINE>records.addPath(v, target);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>while (maxDepth-- > 0) {<NEW_LINE>records.startOneLayer(true);<NEW_LINE>traverseIds(records.keys(), consumer, concurrent);<NEW_LINE>records.finishOneLayer();<NEW_LINE>}<NEW_LINE>return records;<NEW_LINE>} | edges = edgesOfVertex(v, step); |
495,295 | protected HttpResponse convertResponse(Response response) throws IOException {<NEW_LINE>final int responseCode = response.code();<NEW_LINE>final BasicHttpResponse convertedResponse = new BasicHttpResponse(new BasicStatusLine(convertProtocol(response.protocol()), responseCode, response.message()));<NEW_LINE>for (String header : response.headers().names()) {<NEW_LINE>convertedResponse.setHeader(header, response.header(header));<NEW_LINE>}<NEW_LINE>if (response.body() != null) {<NEW_LINE><MASK><NEW_LINE>byte[] responseBytes = null;<NEW_LINE>if (responseCode >= 400) {<NEW_LINE>final JSONObject errorResponse = new JSONObject();<NEW_LINE>Throwable syntethicException = new ClientProtocolException("Failure calling Jolokia in kubernetes");<NEW_LINE>errorResponse.put("status", responseCode);<NEW_LINE>try {<NEW_LINE>// the payload would be a kubernetes error response<NEW_LINE>syntethicException = new KubernetesClientException(OperationSupport.createStatus(response));<NEW_LINE>} catch (Exception e) {<NEW_LINE>}<NEW_LINE>errorResponse.put("error_type", syntethicException.getClass().getName());<NEW_LINE>errorResponse.put("error", syntethicException.getMessage());<NEW_LINE>final StringWriter stacktrace = new StringWriter();<NEW_LINE>syntethicException.printStackTrace(new PrintWriter(stacktrace));<NEW_LINE>errorResponse.put("stacktrace", stacktrace.getBuffer().toString());<NEW_LINE>responseBytes = errorResponse.toJSONString().getBytes();<NEW_LINE>} else {<NEW_LINE>responseBytes = response.body().bytes();<NEW_LINE>}<NEW_LINE>responseEntity.setContentLength(responseBytes.length);<NEW_LINE>responseEntity.setContent(new ByteArrayInputStream(responseBytes));<NEW_LINE>responseEntity.setContentType(response.header(HttpHeaders.CONTENT_TYPE));<NEW_LINE>convertedResponse.setEntity(responseEntity);<NEW_LINE>convertedResponse.setHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(responseBytes.length));<NEW_LINE>}<NEW_LINE>return convertedResponse;<NEW_LINE>} | final BasicHttpEntity responseEntity = new BasicHttpEntity(); |
818,562 | public int compare(String currentVersion, String oldVersion) {<NEW_LINE>if (oldVersion == null) {<NEW_LINE>throw new IllegalArgumentException("Reference version can't be null.");<NEW_LINE>}<NEW_LINE>if (currentVersion == null || currentVersion.startsWith(oldVersion)) {<NEW_LINE>return 1;<NEW_LINE>} else {<NEW_LINE>String[] oldVersionChunks = oldVersion.split("\\.");<NEW_LINE>String[] currentVersionChunks = currentVersion.split("\\.");<NEW_LINE>int count = Math.min(oldVersionChunks.length, currentVersionChunks.length);<NEW_LINE>for (int i = 0, old = 0, current = 0; i < count; i++) {<NEW_LINE>try {<NEW_LINE>// numeric comparison<NEW_LINE>old = Integer.valueOf(oldVersionChunks[i]);<NEW_LINE>current = Integer.valueOf(currentVersionChunks[i]);<NEW_LINE>if (current != old) {<NEW_LINE>return current - old;<NEW_LINE>}<NEW_LINE>} catch (NumberFormatException e) {<NEW_LINE>// string comparison<NEW_LINE>if (currentVersionChunks[i].compareTo(oldVersionChunks[i]) != 0) {<NEW_LINE>return currentVersionChunks[i].compareTo(oldVersionChunks[i]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | return currentVersionChunks.length - oldVersionChunks.length; |
1,143,808 | private JPanel buildConfigPanel() {<NEW_LINE>scopeDropdownLabel.setToolTipText(CheckStyleBundle.message("config.scanscope.tooltip"));<NEW_LINE>scopeDropdown.setToolTipText<MASK><NEW_LINE>suppressErrorsCheckbox.setText(CheckStyleBundle.message("config.suppress-errors.checkbox.text"));<NEW_LINE>suppressErrorsCheckbox.setToolTipText(CheckStyleBundle.message("config.suppress-errors.checkbox.tooltip"));<NEW_LINE>copyLibsCheckbox.setText(CheckStyleBundle.message("config.stabilize-classpath.text"));<NEW_LINE>copyLibsCheckbox.setToolTipText(CheckStyleBundle.message("config.stabilize-classpath.tooltip"));<NEW_LINE>final JPanel configFilePanel = new JPanel(new GridBagLayout());<NEW_LINE>configFilePanel.setOpaque(false);<NEW_LINE>configFilePanel.add(csVersionDropdownLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, COMPONENT_INSETS, 0, 0));<NEW_LINE>configFilePanel.add(csVersionDropdown, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, COMPONENT_INSETS, 0, 0));<NEW_LINE>configFilePanel.add(scopeDropdownLabel, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, COMPONENT_INSETS, 0, 0));<NEW_LINE>configFilePanel.add(scopeDropdown, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, COMPONENT_INSETS, 0, 0));<NEW_LINE>configFilePanel.add(suppressErrorsCheckbox, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, COMPONENT_INSETS, 0, 0));<NEW_LINE>configFilePanel.add(copyLibsCheckbox, new GridBagConstraints(2, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, COMPONENT_INSETS, 0, 0));<NEW_LINE>configFilePanel.add(buildRuleFilePanel(), new GridBagConstraints(0, 2, 4, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, COMPONENT_INSETS, 0, 0));<NEW_LINE>configFilePanel.add(buildClassPathPanel(), new GridBagConstraints(0, 3, 4, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, COMPONENT_INSETS, 0, 0));<NEW_LINE>return configFilePanel;<NEW_LINE>} | (CheckStyleBundle.message("config.scanscope.tooltip")); |
716,457 | public Completable start(String url) {<NEW_LINE>this.active = true;<NEW_LINE>logger.debug("Starting LongPolling transport.");<NEW_LINE>this.url = url;<NEW_LINE>pollUrl = url + "&_=" + System.currentTimeMillis();<NEW_LINE>logger.debug("Polling {}.", pollUrl);<NEW_LINE>return this.updateHeaderToken().andThen(Completable.defer(() -> {<NEW_LINE>HttpRequest request = new HttpRequest();<NEW_LINE>request.addHeaders(headers);<NEW_LINE>return this.pollingClient.get(pollUrl, request).flatMapCompletable(response -> {<NEW_LINE>if (response.getStatusCode() != 200) {<NEW_LINE>logger.error("Unexpected response code {}.", response.getStatusCode());<NEW_LINE>this.active = false;<NEW_LINE>return Completable.error(new Exception("Failed to connect."));<NEW_LINE>} else {<NEW_LINE>this.active = true;<NEW_LINE>}<NEW_LINE>this.threadPool = Executors.newCachedThreadPool();<NEW_LINE>threadPool.execute(() -> {<NEW_LINE>this<MASK><NEW_LINE>receiveLoopSubject.observeOn(Schedulers.io()).subscribe(u -> {<NEW_LINE>poll(u);<NEW_LINE>}, e -> {<NEW_LINE>this.stop().onErrorComplete().subscribe();<NEW_LINE>}, () -> {<NEW_LINE>this.stop().onErrorComplete().subscribe();<NEW_LINE>});<NEW_LINE>// start polling<NEW_LINE>receiveLoopSubject.onNext(url);<NEW_LINE>});<NEW_LINE>return Completable.complete();<NEW_LINE>});<NEW_LINE>}));<NEW_LINE>} | .onReceiveThread = Executors.newSingleThreadExecutor(); |
456,033 | public Boolean scan(Tree tree, Void p) {<NEW_LINE>int lastEndPos = endPos;<NEW_LINE>if (tree != null && tree.getKind() != Tree.Kind.COMPILATION_UNIT) {<NEW_LINE>if (tree instanceof FakeBlock) {<NEW_LINE>endPos = Integer.MAX_VALUE;<NEW_LINE>} else {<NEW_LINE>endPos = (int) sp.getEndPosition(getCurrentPath().getCompilationUnit(), tree);<NEW_LINE>}<NEW_LINE>if (tree.getKind() != Tree.Kind.ERRONEOUS && tree.getKind() != Tree.Kind.BLOCK && (tree.getKind() != Tree.Kind.CLASS || getCurrentPath().getLeaf().getKind() != Tree.Kind.NEW_CLASS) && (tree.getKind() != Tree.Kind.NEW_ARRAY)) {<NEW_LINE>int startPos = (int) sp.getStartPosition(getCurrentPath().getCompilationUnit(), tree);<NEW_LINE>if (startPos >= 0 && startPos > tokens.offset()) {<NEW_LINE>tokens.move(startPos);<NEW_LINE>if (!tokens.moveNext())<NEW_LINE>tokens.movePrevious();<NEW_LINE>}<NEW_LINE>if (startPos >= endPos)<NEW_LINE>endPos = -1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>if (endPos < 0)<NEW_LINE>return false;<NEW_LINE>if (tokens.offset() > endPos)<NEW_LINE>return true;<NEW_LINE>Boolean ret;<NEW_LINE>ret = <MASK><NEW_LINE>return ret != null ? ret : true;<NEW_LINE>} finally {<NEW_LINE>endPos = lastEndPos;<NEW_LINE>}<NEW_LINE>} | super.scan(tree, p); |
1,236,335 | private static void createRecording(final Aeron aeron, final AeronArchive aeronArchive, final long startPosition, final long targetPosition) {<NEW_LINE>final int initialTermId = 7;<NEW_LINE>recordingNumber++;<NEW_LINE>final ChannelUriStringBuilder uriBuilder = new ChannelUriStringBuilder().media("udp").endpoint("localhost:" + recordingNumber).termLength(TERM_LENGTH);<NEW_LINE>if (startPosition > 0) {<NEW_LINE>uriBuilder.initialPosition(startPosition, initialTermId, TERM_LENGTH);<NEW_LINE>}<NEW_LINE>try (Publication publication = aeronArchive.addRecordedExclusivePublication(uriBuilder.build(), STREAM_ID)) {<NEW_LINE>final CountersReader counters = aeron.countersReader();<NEW_LINE>final int counterId = awaitRecordingCounterId(counters, publication.sessionId());<NEW_LINE>final long recordingId = RecordingPos.getRecordingId(counters, counterId);<NEW_LINE>System.out.println("recordingId=" + recordingId + " position " + publication.<MASK><NEW_LINE>offerToPosition(publication, targetPosition);<NEW_LINE>awaitPosition(counters, counterId, publication.position());<NEW_LINE>aeronArchive.stopRecording(publication);<NEW_LINE>}<NEW_LINE>} | position() + " to " + targetPosition); |
574,856 | private ExportResult<CalendarContainerResource> exportCalendars(TokensAndUrlAuthData authData, Optional<PaginationData> pageData) {<NEW_LINE>Calendar.CalendarList.List listRequest;<NEW_LINE>CalendarList listResult;<NEW_LINE>// Get calendar information<NEW_LINE>try {<NEW_LINE>listRequest = getOrCreateCalendarInterface(authData).calendarList().list();<NEW_LINE>if (pageData.isPresent()) {<NEW_LINE>StringPaginationToken paginationToken = (StringPaginationToken) pageData.get();<NEW_LINE>Preconditions.checkState(paginationToken.getToken().startsWith(CALENDAR_TOKEN_PREFIX), "Token is not applicable");<NEW_LINE>listRequest.setPageToken(((StringPaginationToken) pageData.get()).getToken().substring(CALENDAR_TOKEN_PREFIX.length()));<NEW_LINE>}<NEW_LINE>listResult = listRequest.execute();<NEW_LINE>} catch (IOException e) {<NEW_LINE>return new ExportResult<>(e);<NEW_LINE>}<NEW_LINE>// Set up continuation data<NEW_LINE>PaginationData nextPageData = null;<NEW_LINE>if (listResult.getNextPageToken() != null) {<NEW_LINE>nextPageData = new StringPaginationToken(CALENDAR_TOKEN_PREFIX + listResult.getNextPageToken());<NEW_LINE>}<NEW_LINE>ContinuationData continuationData = new ContinuationData(nextPageData);<NEW_LINE>// Process calendar list<NEW_LINE>List<CalendarModel> calendarModels = new ArrayList<>(listResult.getItems().size());<NEW_LINE>for (CalendarListEntry calendarData : listResult.getItems()) {<NEW_LINE>CalendarModel model = convertToCalendarModel(calendarData);<NEW_LINE>continuationData.addContainerResource(new IdOnlyContainerResource<MASK><NEW_LINE>calendarModels.add(model);<NEW_LINE>}<NEW_LINE>CalendarContainerResource calendarContainerResource = new CalendarContainerResource(calendarModels, null);<NEW_LINE>// Get result type<NEW_LINE>ExportResult.ResultType resultType = ResultType.CONTINUE;<NEW_LINE>if (calendarModels.isEmpty()) {<NEW_LINE>resultType = ResultType.END;<NEW_LINE>}<NEW_LINE>return new ExportResult<>(resultType, calendarContainerResource, continuationData);<NEW_LINE>} | (calendarData.getId())); |
1,370,242 | protected void excludeResources(Set<String> resources) {<NEW_LINE>super.excludeResources(resources);<NEW_LINE>boolean isSigleTable = false;<NEW_LINE>boolean isBroadCastTable = false;<NEW_LINE>if (partitionInfo != null) {<NEW_LINE>isSigleTable = partitionInfo.isGsiSingleOrSingleTable();<NEW_LINE>isBroadCastTable = partitionInfo.isGsiBroadcastOrBroadcast();<NEW_LINE>}<NEW_LINE>TableGroupConfig tgConfig = physicalPlanData.getTableGroupConfig();<NEW_LINE>for (TablePartRecordInfoContext entry : tgConfig.getTables()) {<NEW_LINE>Long tableGroupId = entry.getLogTbRec().getGroupId();<NEW_LINE>if (tableGroupId != null && tableGroupId != -1) {<NEW_LINE>OptimizerContext oc = Objects.requireNonNull(OptimizerContext.getContext(schemaName), schemaName + " corrupted");<NEW_LINE>TableGroupConfig tableGroupConfig = oc.getTableGroupInfoManager().getTableGroupConfigById(tableGroupId);<NEW_LINE>TableGroupRecord record = tableGroupConfig.getTableGroupRecord();<NEW_LINE>String tgName = record.getTg_name();<NEW_LINE>resources.add(concatWithDot(schemaName, tgName));<NEW_LINE>tableGroupIds.add(tableGroupId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (preparedData.getTableGroupName() == null) {<NEW_LINE>if (isSigleTable) {<NEW_LINE>resources.add(concatWithDot<MASK><NEW_LINE>} else if (isBroadCastTable) {<NEW_LINE>resources.add(concatWithDot(schemaName, TableGroupNameUtil.BROADCAST_TG_NAME_TEMPLATE));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (preparedData != null && preparedData.getTableGroupName() != null) {<NEW_LINE>String tgName = RelUtils.stringValue(preparedData.getTableGroupName());<NEW_LINE>if (TStringUtil.isNotBlank(tgName)) {<NEW_LINE>resources.add(concatWithDot(schemaName, tgName));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (schemaName, TableGroupNameUtil.SINGLE_DEFAULT_TG_NAME_TEMPLATE)); |
1,192,083 | public com.amazonaws.services.personalizeruntime.model.ResourceNotFoundException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.personalizeruntime.model.ResourceNotFoundException resourceNotFoundException = new com.amazonaws.services.personalizeruntime.model.ResourceNotFoundException(null);<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>} 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 resourceNotFoundException;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,160,856 | private ItemStack innerRemoveItems(int amount, ItemStack filter, Predicate<ItemStack> destination, Transaction tx) {<NEW_LINE>ItemVariant rv = ItemVariant.blank();<NEW_LINE>long extractedAmount = 0;<NEW_LINE>var it = <MASK><NEW_LINE>while (it.hasNext() && extractedAmount < amount) {<NEW_LINE>var view = it.next();<NEW_LINE>var is = view.getResource();<NEW_LINE>if (is.isBlank()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// Haven't decided what to extract yet<NEW_LINE>if (rv.isBlank()) {<NEW_LINE>if (!filter.isEmpty() && !is.matches(filter)) {<NEW_LINE>// Doesn't match ItemStack template<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (destination != null && !destination.test(is.toStack())) {<NEW_LINE>// Doesn't match filter<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>long actualAmount = view.extract(is, amount - extractedAmount, tx);<NEW_LINE>if (actualAmount <= 0) {<NEW_LINE>// Apparently not extractable<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// we've decided what to extract<NEW_LINE>rv = is;<NEW_LINE>extractedAmount += actualAmount;<NEW_LINE>} else {<NEW_LINE>if (!rv.equals(is)) {<NEW_LINE>// Once we've decided what to extract, we need to stick to it<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>extractedAmount += view.extract(is, amount, tx);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// If any of the slots returned more than what we requested, it'll be voided here<NEW_LINE>if (extractedAmount > amount) {<NEW_LINE>// TODO<NEW_LINE>// AELog.warn(<NEW_LINE>// "An inventory returned more (%d) than we requested (%d) during extraction. Excess will be voided.",<NEW_LINE>// extractedAmount, amount);<NEW_LINE>}<NEW_LINE>return rv.toStack((int) Math.min(amount, extractedAmount));<NEW_LINE>} | this.storage.iterator(tx); |
941,738 | public void logSubtitleTrack(int idx, boolean videoSubtitle) {<NEW_LINE>if (mI == null || !mI.isValid()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>sb.append("\n - Sub - ");<NEW_LINE>boolean first = true;<NEW_LINE>if (videoSubtitle) {<NEW_LINE>first &= !appendString("Title", mI.Get(StreamType.Video, idx, "Title"), first, true, true);<NEW_LINE>first &= !appendString("Format", mI.Get(StreamType.Video, idx, "Format"), first, true, true);<NEW_LINE>first &= !appendString("Version", mI.Get(StreamType.Video, idx, "Format_Version"<MASK><NEW_LINE>first &= !appendString("Profile", mI.Get(StreamType.Video, idx, "Format_Profile"), first, true, true);<NEW_LINE>first &= !appendString("ID", mI.Get(StreamType.Video, idx, "ID"), first, false, true);<NEW_LINE>} else {<NEW_LINE>first &= !appendString("Title", mI.Get(StreamType.Text, idx, "Title"), first, true, true);<NEW_LINE>first &= !appendString("Format", mI.Get(StreamType.Text, idx, "Format"), first, true, true);<NEW_LINE>first &= !appendString("Version", mI.Get(StreamType.Text, idx, "Format_Version"), first, true, true);<NEW_LINE>first &= !appendString("Profile", mI.Get(StreamType.Text, idx, "Format_Profile"), first, true, true);<NEW_LINE>first &= !appendString("ID", mI.Get(StreamType.Text, idx, "ID"), first, false, true);<NEW_LINE>first &= !appendString("Language", mI.Get(StreamType.Text, idx, "Language"), first, true, true);<NEW_LINE>}<NEW_LINE>} | ), first, true, true); |
426,111 | public void processingDone(List<Processing> processings) {<NEW_LINE>List<DocumentMessage> messages = new ArrayList<>();<NEW_LINE>if (messageFactory != null) {<NEW_LINE>for (Processing processing : processings) {<NEW_LINE>for (DocumentOperation documentOperation : processing.getDocumentOperations()) {<NEW_LINE>messages.add(messageFactory.fromDocumentOperation(processing, documentOperation));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>log.log(Level.FINE, () -> "Forwarding " + messages.size() + " messages from " + processings.size() + " processings.");<NEW_LINE>if (messages.isEmpty()) {<NEW_LINE>dispatchResponse(Response.Status.OK);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>long inputSequenceId = requestMsg.getSequenceId();<NEW_LINE>ResponseMerger responseHandler = new ResponseMerger(requestMsg, messages.size(), this);<NEW_LINE>int numMsgWithOriginalSequenceId = 0;<NEW_LINE>for (Message message : messages) {<NEW_LINE>if (message.getSequenceId() == inputSequenceId)<NEW_LINE>numMsgWithOriginalSequenceId++;<NEW_LINE>}<NEW_LINE>for (Message message : messages) {<NEW_LINE>String path = internalNoThrottledSourcePath;<NEW_LINE>if ((numMsgWithOriginalSequenceId == 1) && (message.getSequenceId() == inputSequenceId))<NEW_LINE>path <MASK><NEW_LINE>// See comment for internalNoThrottledSource<NEW_LINE>dispatchRequest(message, path, responseHandler);<NEW_LINE>}<NEW_LINE>} | = getUri().getPath(); |
1,368,670 | public final String searchFile(FileSearchParams fileSearchParams) {<NEW_LINE>final <MASK><NEW_LINE>if (!execEnv.isLocal()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>log.log(Level.FINE, "File Searching Task: {0}...", fileSearchParams.toString());<NEW_LINE>List<String> sp = new ArrayList<>(fileSearchParams.getSearchPaths());<NEW_LINE>if (fileSearchParams.isSearchInUserPaths()) {<NEW_LINE>try {<NEW_LINE>Map<String, String> environment = HostInfoUtils.getHostInfo(execEnv).getEnvironment();<NEW_LINE>String path = null;<NEW_LINE>if (environment.containsKey("Path")) {<NEW_LINE>// NOI18N<NEW_LINE>// NOI18N<NEW_LINE>path = environment.get("Path");<NEW_LINE>} else if (environment.containsKey("PATH")) {<NEW_LINE>// NOI18N<NEW_LINE>// NOI18N<NEW_LINE>path = environment.get("PATH");<NEW_LINE>}<NEW_LINE>if (path != null) {<NEW_LINE>sp.addAll(Arrays.asList(path.split(File.pathSeparator)));<NEW_LINE>}<NEW_LINE>} catch (IOException ex) {<NEW_LINE>} catch (CancellationException ex) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String file = fileSearchParams.getFilename();<NEW_LINE>for (String path : sp) {<NEW_LINE>try {<NEW_LINE>File f = new File(path, file);<NEW_LINE>// NOI18N<NEW_LINE>log.log(Level.FINE, " Test ''{0}''", f.toString());<NEW_LINE>if (f.canRead()) {<NEW_LINE>// NOI18N<NEW_LINE>log.log(Level.FINE, " FOUND ''{0}''", f.toString());<NEW_LINE>return f.getCanonicalPath();<NEW_LINE>}<NEW_LINE>} catch (Throwable th) {<NEW_LINE>// NOI18N<NEW_LINE>log.log(Level.FINE, "Execption in LocalFileSearcherImpl:", th);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | ExecutionEnvironment execEnv = fileSearchParams.getExecEnv(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.