idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
632,419 | private void copyFrom(MProcess process, int key) throws SQLException {<NEW_LINE>// Get Values<NEW_LINE>int columnId = getSelectionAsInt(key, "PARAMETER_AD_Column_ID");<NEW_LINE>int reportViewId = getSelectionAsInt(key, "PARAMETER_AD_ReportView_ID");<NEW_LINE>int processParaId = getSelectionAsInt(key, "PARAMETER_AD_Process_Para_ID");<NEW_LINE>boolean isMandatory = getSelectionAsBoolean(key, "PARAMETER_IsMandatory");<NEW_LINE>boolean isRange = getSelectionAsBoolean(key, "PARAMETER_IsRange");<NEW_LINE>String defaultValue = getSelectionAsString(key, "PARAMETER_DefaultValue");<NEW_LINE>String defaultValue2 = getSelectionAsString(key, "PARAMETER_DefaultValue2");<NEW_LINE>// Do it<NEW_LINE>MProcessPara newParameter = new MProcessPara(process);<NEW_LINE>if (reportViewId != 0) {<NEW_LINE>// For Create from View<NEW_LINE>MColumn column = MColumn.get(getCtx(), columnId);<NEW_LINE>//<NEW_LINE>if (column.getAD_Reference_ID() == DisplayType.ID) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// For Process<NEW_LINE>if (process.getAD_ReportView_ID() != reportViewId) {<NEW_LINE>process.setAD_ReportView_ID(reportViewId);<NEW_LINE>process.saveEx();<NEW_LINE>}<NEW_LINE>// Set Values<NEW_LINE>newParameter.setEntityType(process.getEntityType());<NEW_LINE>newParameter.setAD_Element_ID(column.getAD_Element_ID());<NEW_LINE>newParameter.setAD_Reference_ID(column.getAD_Reference_ID());<NEW_LINE>newParameter.setAD_Reference_Value_ID(column.getAD_Reference_Value_ID());<NEW_LINE>newParameter.setAD_Val_Rule_ID(column.getAD_Val_Rule_ID());<NEW_LINE>newParameter.setName(column.getName());<NEW_LINE>newParameter.setColumnName(column.getColumnName());<NEW_LINE>newParameter.setDescription(column.getDescription());<NEW_LINE>newParameter.setFieldLength(column.getFieldLength());<NEW_LINE>newParameter.<MASK><NEW_LINE>newParameter.setIsCentrallyMaintained(true);<NEW_LINE>} else if (processParaId != 0) {<NEW_LINE>// For Copy from Process<NEW_LINE>MProcessPara fromParameter = new MProcessPara(getCtx(), processParaId, get_TrxName());<NEW_LINE>PO.copyValues(fromParameter, newParameter);<NEW_LINE>newParameter.setAD_Process_ID(process.getAD_Process_ID());<NEW_LINE>} else {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Fill values<NEW_LINE>newParameter.setIsMandatory(isMandatory);<NEW_LINE>newParameter.setIsRange(isRange);<NEW_LINE>newParameter.setDefaultValue(defaultValue);<NEW_LINE>newParameter.setDefaultValue2(defaultValue2);<NEW_LINE>newParameter.setSeqNo(seqNo);<NEW_LINE>// Save<NEW_LINE>newParameter.saveEx();<NEW_LINE>// Add new Sequence<NEW_LINE>seqNo += 10;<NEW_LINE>addLog("@AD_Process_Para_ID@ @" + newParameter.getColumnName() + "@ @Added@");<NEW_LINE>} | setHelp(column.getHelp()); |
550,404 | public Object createResource(ResourceInfo info) throws Exception {<NEW_LINE>final boolean trace = TraceComponent.isAnyTracingEnabled();<NEW_LINE>if (trace && tc.isEntryEnabled())<NEW_LINE>Tr.entry(this, tc, "createResource", info);<NEW_LINE>Object resource;<NEW_LINE>try {<NEW_LINE>ResourceFactory factory = tracker.waitForService(5000);<NEW_LINE>if (factory == null)<NEW_LINE>throw new Exception(ConnectorService.getMessage("MISSING_RESOURCE_J2CA8030", info == null ? "" : info.getType(), id, "application", appName));<NEW_LINE><MASK><NEW_LINE>} catch (Exception x) {<NEW_LINE>FFDCFilter.processException(x, getClass().getName(), "129", this);<NEW_LINE>if (trace && tc.isEntryEnabled())<NEW_LINE>Tr.exit(this, tc, "createResource", x);<NEW_LINE>throw x;<NEW_LINE>} catch (Error x) {<NEW_LINE>FFDCFilter.processException(x, getClass().getName(), "134", this);<NEW_LINE>if (trace && tc.isEntryEnabled())<NEW_LINE>Tr.exit(this, tc, "createResource", x);<NEW_LINE>throw x;<NEW_LINE>}<NEW_LINE>if (trace && tc.isEntryEnabled())<NEW_LINE>Tr.exit(this, tc, "createResource", resource);<NEW_LINE>return resource;<NEW_LINE>} | resource = factory.createResource(info); |
409,831 | public void visitListInit(EListInit userListInitNode, ScriptScope scriptScope) {<NEW_LINE>ListInitializationNode irListInitializationNode = new ListInitializationNode(userListInitNode.getLocation());<NEW_LINE>irListInitializationNode.attachDecoration(new IRDExpressionType(scriptScope.getDecoration(userListInitNode, ValueType.class).valueType()));<NEW_LINE>irListInitializationNode.attachDecoration(new IRDConstructor(scriptScope.getDecoration(userListInitNode, StandardPainlessConstructor.<MASK><NEW_LINE>irListInitializationNode.attachDecoration(new IRDMethod(scriptScope.getDecoration(userListInitNode, StandardPainlessMethod.class).standardPainlessMethod()));<NEW_LINE>for (AExpression userValueNode : userListInitNode.getValueNodes()) {<NEW_LINE>irListInitializationNode.addArgumentNode(injectCast(userValueNode, scriptScope));<NEW_LINE>}<NEW_LINE>scriptScope.putDecoration(userListInitNode, new IRNodeDecoration(irListInitializationNode));<NEW_LINE>} | class).standardPainlessConstructor())); |
1,183,225 | public void deregisterObject(JRVirtualizable o) {<NEW_LINE>String uid = o.getUID();<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("deregistering " + uid);<NEW_LINE>}<NEW_LINE>// try to remove virtual data<NEW_LINE>try {<NEW_LINE>dispose(o);<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.error("Error removing virtual data", e);<NEW_LINE>// ignore<NEW_LINE>}<NEW_LINE>synchronized (this) {<NEW_LINE>JRVirtualizable oldIn = pagedIn.remove(uid);<NEW_LINE>if (oldIn != null) {<NEW_LINE>if (oldIn != o) {<NEW_LINE>pagedIn.put(uid, oldIn);<NEW_LINE>throw new IllegalStateException("Wrong object stored with UID \"" + o.getUID() + "\"");<NEW_LINE>}<NEW_LINE>Object contextLast = lastObjectMap.get(o.getContext());<NEW_LINE>if (contextLast == o) {<NEW_LINE>lastObjectMap.remove(o.getContext());<NEW_LINE>lastObjectSet.remove(o);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Object <MASK><NEW_LINE>if (oldOut != null && oldOut != o) {<NEW_LINE>pagedOut.put(uid, oldOut);<NEW_LINE>throw new IllegalStateException("Wrong object stored with UID \"" + o.getUID() + "\"");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// We don't really care if someone deregisters an object<NEW_LINE>// that's not registered.<NEW_LINE>}<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("deregistered object " + o + " with id " + o.getUID());<NEW_LINE>}<NEW_LINE>} | oldOut = pagedOut.remove(uid); |
631,956 | protected Object decode(Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {<NEW_LINE>FullHttpRequest request = (FullHttpRequest) msg;<NEW_LINE>QueryStringDecoder decoder = new QueryStringDecoder(request.uri());<NEW_LINE>DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, decoder.parameters().get(<MASK><NEW_LINE>if (deviceSession == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Parser parser = new Parser(PATTERN, decoder.parameters().get("LOC").get(0));<NEW_LINE>if (!parser.matches()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Position position = new Position(getProtocolName());<NEW_LINE>position.setDeviceId(deviceSession.getDeviceId());<NEW_LINE>position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS));<NEW_LINE>position.setValid(true);<NEW_LINE>position.setLatitude(parser.nextDouble(0));<NEW_LINE>position.setLongitude(parser.nextDouble(0));<NEW_LINE>position.setAltitude(parser.nextDouble(0));<NEW_LINE>position.setSpeed(parser.nextDouble(0));<NEW_LINE>position.setCourse(parser.nextDouble(0));<NEW_LINE>if (channel != null) {<NEW_LINE>FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);<NEW_LINE>channel.writeAndFlush(new NetworkMessage(response, remoteAddress)).addListener(ChannelFutureListener.CLOSE);<NEW_LINE>}<NEW_LINE>return position;<NEW_LINE>} | "UserName").get(0)); |
355,163 | private void runStateMachineOperation(final String initialStateName, final TransactionType transactionType, final LeavingStateCallback leavingStateCallback, final OperationCallback operationCallback, final EnteringStateCallback enteringStateCallback, final Boolean includeDeletedPaymentMethod, final PaymentStateContext paymentStateContext, final PaymentAutomatonDAOHelper daoHelper) throws PaymentApiException {<NEW_LINE>try {<NEW_LINE>final StateMachineConfig stateMachineConfig = paymentSMHelper.getStateMachineConfig(daoHelper.getPaymentProviderPluginName(includeDeletedPaymentMethod), paymentStateContext.getInternalCallContext());<NEW_LINE>final StateMachine initialStateMachine = stateMachineConfig.getStateMachineForState(initialStateName);<NEW_LINE>final State <MASK><NEW_LINE>final Operation operation = paymentSMHelper.getOperationForTransaction(stateMachineConfig, transactionType);<NEW_LINE>initialState.runOperation(operation, operationCallback, enteringStateCallback, leavingStateCallback);<NEW_LINE>} catch (final MissingEntryException e) {<NEW_LINE>throw new PaymentApiException(e.getCause(), ErrorCode.PAYMENT_INVALID_OPERATION, transactionType, initialStateName);<NEW_LINE>} catch (final OperationException e) {<NEW_LINE>if (e.getCause() == null) {<NEW_LINE>throw new PaymentApiException(e, ErrorCode.PAYMENT_INTERNAL_ERROR, MoreObjects.firstNonNull(e.getMessage(), ""));<NEW_LINE>} else if (e.getCause() instanceof PaymentApiException) {<NEW_LINE>throw (PaymentApiException) e.getCause();<NEW_LINE>} else {<NEW_LINE>throw new PaymentApiException(e.getCause(), ErrorCode.PAYMENT_INTERNAL_ERROR, MoreObjects.firstNonNull(e.getMessage(), ""));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | initialState = initialStateMachine.getState(initialStateName); |
1,783,478 | private boolean isNetworkAddressInCidr(String networkUuid1, String networkUuid2) {<NEW_LINE>L3NetworkVO l3vo1 = Q.New(L3NetworkVO.class).eq(L3NetworkVO_.uuid, networkUuid1).find();<NEW_LINE>L3NetworkVO l3vo2 = Q.New(L3NetworkVO.class).eq(L3NetworkVO_.<MASK><NEW_LINE>List<IpRangeInventory> ipInvs1 = IpRangeHelper.getNormalIpRanges(l3vo1);<NEW_LINE>List<IpRangeInventory> ipInvs2 = IpRangeHelper.getNormalIpRanges(l3vo2);<NEW_LINE>List<IpRangeInventory> ip4Invs1 = ipInvs1.stream().filter(ipr -> ipr.getIpVersion() == IPv6Constants.IPv4).collect(Collectors.toList());<NEW_LINE>List<IpRangeInventory> ip4Invs2 = ipInvs2.stream().filter(ipr -> ipr.getIpVersion() == IPv6Constants.IPv4).collect(Collectors.toList());<NEW_LINE>List<IpRangeInventory> ip6Invs1 = ipInvs1.stream().filter(ipr -> ipr.getIpVersion() == IPv6Constants.IPv6).collect(Collectors.toList());<NEW_LINE>List<IpRangeInventory> ip6Invs2 = ipInvs2.stream().filter(ipr -> ipr.getIpVersion() == IPv6Constants.IPv6).collect(Collectors.toList());<NEW_LINE>return isIpv4RangeInSameCidr(ip4Invs1, ip4Invs2) || isIpv6RangeInSameCidr(ip6Invs1, ip6Invs2);<NEW_LINE>} | uuid, networkUuid2).find(); |
1,041,122 | private byte printKeywordsFor(GherkinDialect dialect) {<NEW_LINE>StringBuilder builder = new StringBuilder();<NEW_LINE>List<List<String>> table = new ArrayList<>();<NEW_LINE>addKeywordRow(table, "feature", dialect.getFeatureKeywords());<NEW_LINE>addKeywordRow(table, "background", dialect.getBackgroundKeywords());<NEW_LINE>addKeywordRow(table, "scenario", dialect.getScenarioKeywords());<NEW_LINE>addKeywordRow(table, "scenario outline", dialect.getScenarioOutlineKeywords());<NEW_LINE>addKeywordRow(table, "examples", dialect.getExamplesKeywords());<NEW_LINE>addKeywordRow(table, <MASK><NEW_LINE>addKeywordRow(table, "when", dialect.getWhenKeywords());<NEW_LINE>addKeywordRow(table, "then", dialect.getThenKeywords());<NEW_LINE>addKeywordRow(table, "and", dialect.getAndKeywords());<NEW_LINE>addKeywordRow(table, "but", dialect.getButKeywords());<NEW_LINE>addCodeKeywordRow(table, "given", dialect.getGivenKeywords());<NEW_LINE>addCodeKeywordRow(table, "when", dialect.getWhenKeywords());<NEW_LINE>addCodeKeywordRow(table, "then", dialect.getThenKeywords());<NEW_LINE>addCodeKeywordRow(table, "and", dialect.getAndKeywords());<NEW_LINE>addCodeKeywordRow(table, "but", dialect.getButKeywords());<NEW_LINE>DataTable.create(table).print(builder);<NEW_LINE>out.println(builder.toString());<NEW_LINE>return 0x0;<NEW_LINE>} | "given", dialect.getGivenKeywords()); |
920,724 | private static Condition convIn2Or(Relation relation, boolean supportIn) {<NEW_LINE>assert relation.relation() == Condition.RelationType.IN;<NEW_LINE><MASK><NEW_LINE>Object valueObject = relation.value();<NEW_LINE>E.checkArgument(valueObject instanceof List, "Expect list value for IN condition: %s", relation);<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>List<Object> values = (List<Object>) valueObject;<NEW_LINE>E.checkArgument(values.size() <= Query.QUERY_BATCH, "Too many conditions(%s) each query", values.size());<NEW_LINE>// Keep IN condition if IN query is supported and necessary<NEW_LINE>if (supportIn && relation.isSysprop() && values.size() > 1 && (key == HugeKeys.OWNER_VERTEX || key == HugeKeys.ID)) {<NEW_LINE>// TODO: Should not rely on HugeKeys here, improve key judgment<NEW_LINE>// Just mark flatten<NEW_LINE>return new Condition.FlattenSyspropRelation((SyspropRelation) relation);<NEW_LINE>}<NEW_LINE>// Do IN flatten, return null if values.size() == 0<NEW_LINE>Condition conds = null;<NEW_LINE>for (Object value : values) {<NEW_LINE>Condition cond;<NEW_LINE>// Convert IN to EQ<NEW_LINE>if (key instanceof HugeKeys) {<NEW_LINE>cond = Condition.eq((HugeKeys) key, value);<NEW_LINE>} else {<NEW_LINE>cond = Condition.eq((Id) key, value);<NEW_LINE>}<NEW_LINE>// Join EQ with OR<NEW_LINE>conds = conds == null ? cond : Condition.or(conds, cond);<NEW_LINE>}<NEW_LINE>return conds;<NEW_LINE>} | Object key = relation.key(); |
207,009 | public void assignLabels(LingoProcessingContext context, DoubleMatrix2D stemCos, IntIntHashMap filteredRowToStemIndex, DoubleMatrix2D phraseCos) {<NEW_LINE>final PreprocessingContext preprocessingContext = context.preprocessingContext;<NEW_LINE>final <MASK><NEW_LINE>final int[] labelsFeatureIndex = preprocessingContext.allLabels.featureIndex;<NEW_LINE>final int[] mostFrequentOriginalWordIndex = preprocessingContext.allStems.mostFrequentOriginalWordIndex;<NEW_LINE>final int desiredClusterCount = stemCos.columns();<NEW_LINE>final IntArrayList clusterLabelFeatureIndex = new IntArrayList(desiredClusterCount);<NEW_LINE>final DoubleArrayList clusterLabelScore = new DoubleArrayList(desiredClusterCount);<NEW_LINE>for (int label = 0; label < desiredClusterCount; label++) {<NEW_LINE>final Pair<Integer, Integer> stemMax = max(stemCos);<NEW_LINE>final Pair<Integer, Integer> phraseMax = max(phraseCos);<NEW_LINE>if (stemMax == null && phraseMax == null) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>double stemScore = stemMax != null ? stemCos.getQuick(stemMax.objectA, stemMax.objectB) : -1;<NEW_LINE>double phraseScore = phraseMax != null ? phraseCos.getQuick(phraseMax.objectA, phraseMax.objectB) : -1;<NEW_LINE>if (phraseScore > stemScore) {<NEW_LINE>phraseCos.viewRow(phraseMax.objectA).assign(0);<NEW_LINE>phraseCos.viewColumn(phraseMax.objectB).assign(0);<NEW_LINE>stemCos.viewColumn(phraseMax.objectB).assign(0);<NEW_LINE>clusterLabelFeatureIndex.add(labelsFeatureIndex[phraseMax.objectA + firstPhraseIndex]);<NEW_LINE>clusterLabelScore.add(phraseScore);<NEW_LINE>} else {<NEW_LINE>stemCos.viewRow(stemMax.objectA).assign(0);<NEW_LINE>stemCos.viewColumn(stemMax.objectB).assign(0);<NEW_LINE>if (phraseCos != null) {<NEW_LINE>phraseCos.viewColumn(stemMax.objectB).assign(0);<NEW_LINE>}<NEW_LINE>clusterLabelFeatureIndex.add(mostFrequentOriginalWordIndex[filteredRowToStemIndex.get(stemMax.objectA)]);<NEW_LINE>clusterLabelScore.add(stemScore);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>context.clusterLabelFeatureIndex = clusterLabelFeatureIndex.toArray();<NEW_LINE>context.clusterLabelScore = clusterLabelScore.toArray();<NEW_LINE>} | int firstPhraseIndex = preprocessingContext.allLabels.firstPhraseIndex; |
1,789,580 | protected void doPrefetch(final File tokenFile, final Props props, final Logger logger, final String userToProxy) throws HadoopSecurityManagerException {<NEW_LINE>// Create suffix to be added to kerberos principal<NEW_LINE>final String suffix = getFQNSuffix(props);<NEW_LINE>final String userToProxyFQN = userToProxy + suffix;<NEW_LINE>logger.info("Getting hadoop tokens based on props for " + userToProxyFQN);<NEW_LINE>final Credentials cred = new Credentials();<NEW_LINE>try {<NEW_LINE>fetchAllHadoopTokens(userToProxyFQN, <MASK><NEW_LINE>getProxiedUser(userToProxyFQN).doAs((PrivilegedExceptionAction<Void>) () -> {<NEW_LINE>registerAllCustomCredentials(userToProxy, props, cred, logger);<NEW_LINE>return null;<NEW_LINE>});<NEW_LINE>logger.info("Preparing token file " + tokenFile.getAbsolutePath());<NEW_LINE>prepareTokenFile(userToProxy, cred, tokenFile, logger, props.getString(Constants.ConfigurationKeys.SECURITY_USER_GROUP, "azkaban"));<NEW_LINE>// stash them to cancel after use.<NEW_LINE>logger.info("Tokens loaded in " + tokenFile.getAbsolutePath());<NEW_LINE>} catch (final Exception e) {<NEW_LINE>throw new HadoopSecurityManagerException("Failed to get hadoop tokens! " + e.getMessage() + e.getCause(), e);<NEW_LINE>} catch (final Throwable t) {<NEW_LINE>throw new HadoopSecurityManagerException("Failed to get hadoop tokens! " + t.getMessage() + t.getCause(), t);<NEW_LINE>}<NEW_LINE>} | userToProxy, props, logger, cred); |
1,392,828 | public void shouldAddPipelineToTheTopOfConfigFile() throws Exception {<NEW_LINE>goConfigDao.load();<NEW_LINE>PipelineConfig pipelineConfig = PipelineMother.twoBuildPlansWithResourcesAndSvnMaterialsAtUrl("addedFirst", "ut", "www.spring.com");<NEW_LINE>PipelineConfig pipelineConfig2 = PipelineMother.twoBuildPlansWithResourcesAndSvnMaterialsAtUrl("addedSecond", "ut", "www.spring.com");<NEW_LINE>goConfigDao.addPipeline(pipelineConfig, DEFAULT_GROUP);<NEW_LINE>goConfigDao.addPipeline(pipelineConfig2, DEFAULT_GROUP);<NEW_LINE>goConfigDao.load();<NEW_LINE>final File configFile = new File(goConfigDao.fileLocation());<NEW_LINE>final String content = FileUtils.readFileToString(configFile, UTF_8);<NEW_LINE>final int indexOfSecond = content.indexOf("addedSecond");<NEW_LINE>final int <MASK><NEW_LINE>assertThat(indexOfSecond, is(not(-1)));<NEW_LINE>assertThat(indexOfFirst, is(not(-1)));<NEW_LINE>assertTrue(indexOfSecond < indexOfFirst);<NEW_LINE>} | indexOfFirst = content.indexOf("addedFirst"); |
1,597,170 | public HashMap pageContent(String query, String sortBy, String perPage, String currentPageNumber) {<NEW_LINE>HashMap retMap = new HashMap();<NEW_LINE>int pageNumber = 1;<NEW_LINE>try {<NEW_LINE>pageNumber = Integer.parseInt(currentPageNumber);<NEW_LINE>} catch (Exception e) {<NEW_LINE>}<NEW_LINE>int displayPerPage = Config.getIntProperty("PER_PAGE");<NEW_LINE>try {<NEW_LINE>displayPerPage = Integer.parseInt(perPage);<NEW_LINE>} catch (Exception e) {<NEW_LINE>}<NEW_LINE>int minIndex = (pageNumber - 1) * displayPerPage;<NEW_LINE>int maxIndex = displayPerPage * pageNumber;<NEW_LINE>int limit = 0;<NEW_LINE>List<Map> l = new ArrayList<Map>();<NEW_LINE>SearchHits hits = null;<NEW_LINE>List<Contentlet> c = new ArrayList<Contentlet>();<NEW_LINE>try {<NEW_LINE>c = APILocator.getContentletAPI().search(query, limit, -1, sortBy, user, true);<NEW_LINE>} catch (Exception ex) {<NEW_LINE>Logger.error(this.getClass(), "indexSearch: Error Searching Contentlets - lucene query: " + query, ex);<NEW_LINE>}<NEW_LINE>for (int i = minIndex; i < c.size(); i++) {<NEW_LINE>if (i == maxIndex) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Map<String, Object> hm = new HashMap<String, Object>();<NEW_LINE>hm.put("inode", c.get(i).getInode());<NEW_LINE>hm.put("identifier", c.get<MASK><NEW_LINE>l.add(hm);<NEW_LINE>} catch (Exception e) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>retMap.put("_inodeList", l);<NEW_LINE>retMap.put("_total", String.valueOf(c.size()));<NEW_LINE>return retMap;<NEW_LINE>} | (i).getIdentifier()); |
1,217,597 | protected void encodeScript(FacesContext context, InputTextarea inputTextarea) throws IOException {<NEW_LINE>boolean autoResize = inputTextarea.isAutoResize();<NEW_LINE>String counter = inputTextarea.getCounter();<NEW_LINE>WidgetBuilder wb = getWidgetBuilder(context);<NEW_LINE>wb.init("InputTextarea", inputTextarea).attr("autoResize", autoResize).attr("maxlength", inputTextarea.getMaxlength(), Integer.MAX_VALUE);<NEW_LINE>if (counter != null) {<NEW_LINE>UIComponent counterComponent = SearchExpressionFacade.resolveComponent(context, inputTextarea, counter);<NEW_LINE>wb.attr("counter", counterComponent.getClientId(context)).attr("counterTemplate", inputTextarea.getCounterTemplate(), null).attr("countBytesAsChars", inputTextarea.getCountBytesAsChars());<NEW_LINE>}<NEW_LINE>if (inputTextarea.getCompleteMethod() != null) {<NEW_LINE>wb.attr("autoComplete", true).attr("minQueryLength", inputTextarea.getMinQueryLength()).attr("queryDelay", inputTextarea.getQueryDelay()).attr("scrollHeight", inputTextarea.<MASK><NEW_LINE>}<NEW_LINE>encodeClientBehaviors(context, inputTextarea);<NEW_LINE>wb.finish();<NEW_LINE>} | getScrollHeight(), Integer.MAX_VALUE); |
456,775 | public static void processApiOperation(ApiOperation apiOperation, Resource resource, Operation operation) {<NEW_LINE>if (!StringUtils.isNullOrEmpty(apiOperation.nickname())) {<NEW_LINE>operation.setName(apiOperation.nickname());<NEW_LINE>}<NEW_LINE>if (!StringUtils.isNullOrEmpty(apiOperation.value())) {<NEW_LINE>operation.setDescription(apiOperation.value());<NEW_LINE>}<NEW_LINE>if (!StringUtils.isNullOrEmpty(apiOperation.httpMethod())) {<NEW_LINE>operation.<MASK><NEW_LINE>}<NEW_LINE>if (apiOperation.tags() != null) {<NEW_LINE>for (String tag : apiOperation.tags()) {<NEW_LINE>if (!resource.getSections().contains(tag)) {<NEW_LINE>resource.getSections().add(tag);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!StringUtils.isNullOrEmpty(apiOperation.consumes())) {<NEW_LINE>operation.setConsumes(StringUtils.splitAndTrim(apiOperation.consumes()));<NEW_LINE>}<NEW_LINE>if (!StringUtils.isNullOrEmpty(apiOperation.produces())) {<NEW_LINE>operation.setProduces(StringUtils.splitAndTrim(apiOperation.produces()));<NEW_LINE>}<NEW_LINE>} | setMethod(apiOperation.httpMethod()); |
749,573 | public void drawBoundingBoxes(DetectedObjects detections) {<NEW_LINE>// Make image copy with alpha channel because original image was jpg<NEW_LINE>convertIdNeeded();<NEW_LINE>Graphics2D g = (Graphics2D) image.getGraphics();<NEW_LINE>int stroke = 2;<NEW_LINE>g.setStroke(new BasicStroke(stroke));<NEW_LINE>g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);<NEW_LINE>int imageWidth = image.getWidth();<NEW_LINE>int imageHeight = image.getHeight();<NEW_LINE>List<DetectedObjects.DetectedObject> list = detections.items();<NEW_LINE>for (DetectedObjects.DetectedObject result : list) {<NEW_LINE>String className = result.getClassName();<NEW_LINE>BoundingBox box = result.getBoundingBox();<NEW_LINE>g.setPaint(randomColor().darker());<NEW_LINE>Rectangle rectangle = box.getBounds();<NEW_LINE>int x = (int) (rectangle.getX() * imageWidth);<NEW_LINE>int y = (int) (rectangle.getY() * imageHeight);<NEW_LINE>g.drawRect(x, y, (int) (rectangle.getWidth() * imageWidth), (int) (rectangle<MASK><NEW_LINE>drawText(g, className, x, y, stroke, 4);<NEW_LINE>// If we have a mask instead of a plain rectangle, draw tha mask<NEW_LINE>if (box instanceof Mask) {<NEW_LINE>drawMask((Mask) box);<NEW_LINE>} else if (box instanceof Landmark) {<NEW_LINE>drawLandmarks(box);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>g.dispose();<NEW_LINE>} | .getHeight() * imageHeight)); |
1,033,461 | String testLdap(@BindRequest LdapConfigDto configDto) throws Exception {<NEW_LINE>// capturing newPlainPassword separately so that newPassword doesn't go through<NEW_LINE>// encryption/decryption which has possibility of throwing<NEW_LINE>// org.glowroot.common.repo.util.LazySecretKey.SymmetricEncryptionKeyMissingException<NEW_LINE>LdapConfigDto configDtoWithoutNewPassword;<NEW_LINE>String passwordOverride;<NEW_LINE>String newPassword = configDto.newPassword();<NEW_LINE>if (newPassword.isEmpty()) {<NEW_LINE>configDtoWithoutNewPassword = configDto;<NEW_LINE>passwordOverride = null;<NEW_LINE>} else {<NEW_LINE>configDtoWithoutNewPassword = ImmutableLdapConfigDto.builder().copyFrom(configDto).newPassword("").build();<NEW_LINE>passwordOverride = newPassword;<NEW_LINE>}<NEW_LINE>LdapConfig config = configDtoWithoutNewPassword.convert(configRepository);<NEW_LINE>String authTestUsername = checkNotNull(configDtoWithoutNewPassword.authTestUsername());<NEW_LINE>String authTestPassword = checkNotNull(configDtoWithoutNewPassword.authTestPassword());<NEW_LINE>Set<String> ldapGroupDns;<NEW_LINE>try {<NEW_LINE>ldapGroupDns = LdapAuthentication.authenticateAndGetLdapGroupDns(authTestUsername, authTestPassword, config, <MASK><NEW_LINE>} catch (AuthenticationException e) {<NEW_LINE>logger.debug(e.getMessage(), e);<NEW_LINE>return createErrorResponse(e);<NEW_LINE>}<NEW_LINE>Set<String> glowrootRoles = LdapAuthentication.getGlowrootRoles(ldapGroupDns, config);<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>JsonGenerator jg = mapper.getFactory().createGenerator(CharStreams.asWriter(sb));<NEW_LINE>try {<NEW_LINE>jg.writeStartObject();<NEW_LINE>jg.writeObjectField("ldapGroupDns", ldapGroupDns);<NEW_LINE>jg.writeObjectField("glowrootRoles", glowrootRoles);<NEW_LINE>jg.writeEndObject();<NEW_LINE>} finally {<NEW_LINE>jg.close();<NEW_LINE>}<NEW_LINE>return sb.toString();<NEW_LINE>} | passwordOverride, configRepository.getLazySecretKey()); |
778,730 | private static int combinePixels(int rgb1, int rgb2) {<NEW_LINE>// first ARGB<NEW_LINE>int a1 = (rgb1 >> 24) & 0xff;<NEW_LINE>int r1 = <MASK><NEW_LINE>int g1 = (rgb1 >> 8) & 0xff;<NEW_LINE>int b1 = rgb1 & 0xff;<NEW_LINE>// second ARGB<NEW_LINE>int a2 = (rgb2 >> 24) & 0xff;<NEW_LINE>int r2 = (rgb2 >> 16) & 0xff;<NEW_LINE>int g2 = (rgb2 >> 8) & 0xff;<NEW_LINE>int b2 = rgb2 & 0xff;<NEW_LINE>r1 = clamp(Math.abs(r1 - r2));<NEW_LINE>g1 = clamp(Math.abs(g1 - g2));<NEW_LINE>b1 = clamp(Math.abs(b1 - b2));<NEW_LINE>// in case if alpha is enabled (translucent image)<NEW_LINE>if (a1 != 0xff) {<NEW_LINE>a1 = a1 * 0xff / 255;<NEW_LINE>int a3 = (255 - a1) * a2 / 255;<NEW_LINE>r1 = clamp((r1 * a1 + r2 * a3) / 255);<NEW_LINE>g1 = clamp((g1 * a1 + g2 * a3) / 255);<NEW_LINE>b1 = clamp((b1 * a1 + b2 * a3) / 255);<NEW_LINE>a1 = clamp(a1 + a3);<NEW_LINE>}<NEW_LINE>return (a1 << 24) | (r1 << 16) | (g1 << 8) | b1;<NEW_LINE>} | (rgb1 >> 16) & 0xff; |
506,723 | /* (non-Javadoc)<NEW_LINE>* @see com.kkalice.adempiere.migrate.DBEngineInterface#sqlAction_enforceCheckConstraints(java.lang.String, java.lang.String, java.lang.String, java.lang.String)<NEW_LINE>*/<NEW_LINE>public String sqlAction_enforceCheckConstraints(String catalogName, String schemaName, String tableName, String checkExpression) {<NEW_LINE>StringBuffer sql = new StringBuffer();<NEW_LINE>// extract column name, operator, and value<NEW_LINE>String pattern = "(?i).*?(\\b\\w*\\b).*?([<=>!]+|(\\bNOT\\s+)?LIKE\\b|\\bIN\\b).*?('\\w*'|\\d+|\\bNULL\\b).*";<NEW_LINE>// extract the last word before first operator as column name<NEW_LINE>String columnName = checkExpression.replaceAll(pattern, "$1");<NEW_LINE>if (columnName.equalsIgnoreCase(checkExpression))<NEW_LINE>columnName = null;<NEW_LINE>// extract the first operator<NEW_LINE>String operator = checkExpression.replaceAll(pattern, "$2").toUpperCase();<NEW_LINE>if (operator.equalsIgnoreCase(checkExpression))<NEW_LINE>operator = null;<NEW_LINE>// extract the first string or number or NULL after first operator as value<NEW_LINE>String value = checkExpression.replaceAll(pattern, "$4");<NEW_LINE>if (value.equalsIgnoreCase(checkExpression))<NEW_LINE>value = null;<NEW_LINE>// only continue if extraction of column name, operator and value was successful<NEW_LINE>if (columnName != null && operator != null && value != null) {<NEW_LINE>// we can only determine default values for equality operators =, LIKE, or IN<NEW_LINE>// (< or > are permissible only as <= or >=)<NEW_LINE>if (operator.contains("=") || operator.contains("LIKE") || operator.contains("IN")) {<NEW_LINE>// we can not dtermine default values for NOT operators<NEW_LINE>// (!= or NOT LIKE are not permissable)<NEW_LINE>if (!(operator.contains("!") || operator.contains("NOT"))) {<NEW_LINE>// remove wrong quotes arround column names<NEW_LINE>checkExpression = checkExpression.replaceAll("\"", " ");<NEW_LINE>// build the sql string<NEW_LINE>sql.append("UPDATE ").append(schemaName).append(".").append(tableName).append(" " + "SET ").append(columnName).append(" = ").append(value).append(" " + "WHERE NOT (").append<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (sql != null && sql.length() > 0)<NEW_LINE>return sql.toString();<NEW_LINE>else<NEW_LINE>return null;<NEW_LINE>} | (checkExpression).append(") "); |
1,499,331 | private void declareField(final VariableDeclarationContext ctx, final ModifierManager modifierManager, final ClassNode variableType, final ClassNode classNode, final int i, final VariableExpression variableExpression, final String fieldName, final int modifiers, final Expression initialValue) {<NEW_LINE>FieldNode existingFieldNode = classNode.getDeclaredField(fieldName);<NEW_LINE>if (null != existingFieldNode && !existingFieldNode.isSynthetic()) {<NEW_LINE>throw createParsingFailedException("The field '" + fieldName + "' is declared multiple times", ctx);<NEW_LINE>}<NEW_LINE>FieldNode fieldNode;<NEW_LINE>PropertyNode propertyNode = classNode.getProperty(fieldName);<NEW_LINE>if (null != propertyNode && propertyNode.getField().isSynthetic()) {<NEW_LINE>classNode.getFields().remove(propertyNode.getField());<NEW_LINE>fieldNode = new FieldNode(fieldName, modifiers, variableType, classNode.redirect(), initialValue);<NEW_LINE>propertyNode.setField(fieldNode);<NEW_LINE>classNode.addField(fieldNode);<NEW_LINE>} else {<NEW_LINE>fieldNode = classNode.addField(<MASK><NEW_LINE>}<NEW_LINE>modifierManager.attachAnnotations(fieldNode);<NEW_LINE>groovydocManager.handle(fieldNode, ctx);<NEW_LINE>if (initialValue != null && initialValue.getEnd() > 0) {<NEW_LINE>configureAST(fieldNode, ctx, initialValue);<NEW_LINE>} else {<NEW_LINE>configureAST(fieldNode, ctx, variableExpression);<NEW_LINE>}<NEW_LINE>fieldNode.setNameStart(variableExpression.getStart());<NEW_LINE>fieldNode.setNameEnd(variableExpression.getEnd() - 1);<NEW_LINE>// GRECLIPSE end<NEW_LINE>} | fieldName, modifiers, variableType, initialValue); |
607,077 | public static String computeFitText(JTable table, int rowIdx, int columnIdx, String text) {<NEW_LINE>// NOI18N<NEW_LINE>if (text == null)<NEW_LINE>text = "";<NEW_LINE>if (text.length() <= VISIBLE_START_CHARS + 3)<NEW_LINE>return text;<NEW_LINE>FontMetrics fm = table.getFontMetrics(table.getFont());<NEW_LINE>int width = table.getCellRect(rowIdx, columnIdx, false).width;<NEW_LINE>// NOI18N<NEW_LINE>String sufix = "...";<NEW_LINE>// NOI18N<NEW_LINE>int sufixLength = fm.stringWidth(sufix + " ");<NEW_LINE>int desired = width - sufixLength;<NEW_LINE>if (desired <= 0)<NEW_LINE>return text;<NEW_LINE>for (int i = 0; i <= text.length() - 1; i++) {<NEW_LINE>String prefix = <MASK><NEW_LINE>int swidth = fm.stringWidth(prefix);<NEW_LINE>if (swidth >= desired) {<NEW_LINE>return prefix.length() > 0 ? prefix + sufix : text;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return text;<NEW_LINE>} | text.substring(0, i); |
371,024 | private static List<String> readConfig(String filename) {<NEW_LINE>File userHome = new File<MASK><NEW_LINE>// search for config file<NEW_LINE>String[] configDirs = { // KDE 5<NEW_LINE>// KDE 4<NEW_LINE>".config", // KDE 3<NEW_LINE>".kde4/share/config", ".kde/share/config" };<NEW_LINE>File file = null;<NEW_LINE>for (String configDir : configDirs) {<NEW_LINE>file = new File(userHome, configDir + "/" + filename);<NEW_LINE>if (file.isFile())<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (!file.isFile())<NEW_LINE>return Collections.emptyList();<NEW_LINE>// read config file<NEW_LINE>ArrayList<String> lines = new ArrayList<>(200);<NEW_LINE>try (BufferedReader reader = new BufferedReader(new FileReader(file))) {<NEW_LINE>String line;<NEW_LINE>while ((line = reader.readLine()) != null) lines.add(line);<NEW_LINE>} catch (IOException ex) {<NEW_LINE>LoggingFacade.INSTANCE.logConfig("FlatLaf: Failed to read '" + filename + "'.", ex);<NEW_LINE>}<NEW_LINE>return lines;<NEW_LINE>} | (System.getProperty("user.home")); |
278,460 | public static Savable fromName(String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException {<NEW_LINE>className = remapClass(className);<NEW_LINE>Constructor noArgConstructor = findNoArgConstructor(className);<NEW_LINE>noArgConstructor.setAccessible(true);<NEW_LINE>try {<NEW_LINE>return (Savable) noArgConstructor.newInstance();<NEW_LINE>} catch (InvocationTargetException | InstantiationException e) {<NEW_LINE>Logger.getLogger(SavableClassUtil.class.getName()).log(Level.SEVERE, "Could not access constructor of class ''{0}" + "''! \n" + "Some types need to have the BinaryImporter set up in a special way. Please double-check the setup.", className);<NEW_LINE>throw e;<NEW_LINE>} catch (IllegalAccessException e) {<NEW_LINE>Logger.getLogger(SavableClassUtil.class.getName()).log(Level.SEVERE, "{0} \n" + <MASK><NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>} | "Some types need to have the BinaryImporter set up in a special way. Please double-check the setup.", e.getMessage()); |
134,341 | private PluginOperationResult executeUpdate() throws Exception {<NEW_LINE>List<String> updateablePlugins = findUpdateCandidates();<NEW_LINE>List<String> erroneousPlugins = Lists.newArrayList();<NEW_LINE>List<String> delayedPlugins = Lists.newArrayList();<NEW_LINE>// update only a specific plugin if it is updatable and provided<NEW_LINE>String forcePluginId = options.getPluginId();<NEW_LINE>logger.log(Level.FINE, "Force plugin is " + forcePluginId);<NEW_LINE>if (forcePluginId != null) {<NEW_LINE>if (updateablePlugins.contains(forcePluginId)) {<NEW_LINE>updateablePlugins = Lists.newArrayList(forcePluginId);<NEW_LINE>} else {<NEW_LINE>logger.log(Level.WARNING, "User requested to update a non-updatable plugin: " + forcePluginId);<NEW_LINE>erroneousPlugins.add(forcePluginId);<NEW_LINE>// empty list<NEW_LINE>updateablePlugins = Lists.newArrayList();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>logger.log(Level.INFO, "The following plugins can be automatically updated: " + StringUtil.join(updateablePlugins, ", "));<NEW_LINE>for (String pluginId : updateablePlugins) {<NEW_LINE>// first remove<NEW_LINE>PluginOperationResult removeResult = executeRemove(pluginId);<NEW_LINE>if (removeResult.getResultCode() == PluginResultCode.NOK) {<NEW_LINE>logger.log(Level.SEVERE, "Unable to remove " + pluginId + " during the update process");<NEW_LINE>erroneousPlugins.add(pluginId);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// ... and install again<NEW_LINE>if (EnvironmentUtil.isWindows()) {<NEW_LINE>logger.log(Level.FINE, "Appending jar to updatefile");<NEW_LINE>File updatefilePath = new File(UserConfig.getUserConfigDir(), UPDATE_FILENAME);<NEW_LINE>try (PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(updatefilePath, true)))) {<NEW_LINE>out.println(pluginId + (options.isSnapshots() ? " --snapshot" : ""));<NEW_LINE>delayedPlugins.add(pluginId);<NEW_LINE>} catch (IOException e) {<NEW_LINE>logger.log(Level.SEVERE, "Unable to append to updatefile " + updatefilePath, e);<NEW_LINE>erroneousPlugins.add(pluginId);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>PluginOperationResult installResult = executeInstallFromApiHost(pluginId);<NEW_LINE>if (installResult.getResultCode() == PluginResultCode.NOK) {<NEW_LINE>logger.log(Level.SEVERE, "Unable to install " + pluginId + " during the update process");<NEW_LINE>erroneousPlugins.add(pluginId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (erroneousPlugins.size() > 0 && erroneousPlugins.size() == updateablePlugins.size()) {<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>result.setResultCode(PluginResultCode.OK);<NEW_LINE>}<NEW_LINE>result.setUpdatedPluginIds(updateablePlugins);<NEW_LINE>result.setErroneousPluginIds(erroneousPlugins);<NEW_LINE>result.setDelayedPluginIds(delayedPlugins);<NEW_LINE>return result;<NEW_LINE>} | result.setResultCode(PluginResultCode.NOK); |
1,310,513 | public static ImmutablePair<Contract, Contract> loadTopicControlContract(Client client, String controlAddress, int version, int timeout) throws BrokerException {<NEW_LINE>// support version list<NEW_LINE>switch(version) {<NEW_LINE>case 10:<NEW_LINE>TopicController topicController = (TopicController) Web3SDK2Wrapper.loadContract(controlAddress, client, TopicController.class);<NEW_LINE>String address = "";<NEW_LINE>try {<NEW_LINE>address = topicController.getTopicAddress();<NEW_LINE>} catch (NullPointerException | ContractException e) {<NEW_LINE>log.error("getTopicAddress failed due to transaction execution error. ", e);<NEW_LINE>throw new BrokerException(ErrorCode.TRANSACTION_EXECUTE_ERROR);<NEW_LINE>}<NEW_LINE>Topic topic = (Topic) Web3SDK2Wrapper.loadContract(address, client, Topic.class);<NEW_LINE>return new ImmutablePair<>(topicController, topic);<NEW_LINE>default:<NEW_LINE><MASK><NEW_LINE>throw new BrokerException(ErrorCode.UNKNOWN_SOLIDITY_VERSION);<NEW_LINE>}<NEW_LINE>} | log.error("unknown solidity version: {}", version); |
1,556,181 | public ResponseEntity<Void> createUserWithHttpInfo(User body) throws RestClientException {<NEW_LINE>Object postBody = body;<NEW_LINE>// verify the required parameter 'body' is set<NEW_LINE>if (body == null) {<NEW_LINE>throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling createUser");<NEW_LINE>}<NEW_LINE>String path = apiClient.expandPath("/user", Collections.<String, Object>emptyMap());<NEW_LINE>final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();<NEW_LINE>final HttpHeaders headerParams = new HttpHeaders();<NEW_LINE>final MultiValueMap<String, String> cookieParams = new <MASK><NEW_LINE>final MultiValueMap formParams = new LinkedMultiValueMap();<NEW_LINE>final String[] accepts = {};<NEW_LINE>final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);<NEW_LINE>final String[] contentTypes = { "application/json" };<NEW_LINE>final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);<NEW_LINE>String[] authNames = new String[] {};<NEW_LINE>ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {<NEW_LINE>};<NEW_LINE>return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);<NEW_LINE>} | LinkedMultiValueMap<String, String>(); |
500,477 | final ListKeysResult executeListKeys(ListKeysRequest listKeysRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listKeysRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListKeysRequest> request = null;<NEW_LINE>Response<ListKeysResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListKeysRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listKeysRequest));<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, "KMS");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListKeys");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListKeysResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListKeysResultJsonUnmarshaller());<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
319,445 | private static int run(CommandContext<CommandSourceStack> context, Operation op, int count) throws CommandSyntaxException {<NEW_LINE>if (count == 0 && op != Operation.SET) {<NEW_LINE>throw INVALID_SLOT_COUNT.create();<NEW_LINE>}<NEW_LINE>SlotType slotType = <MASK><NEW_LINE>List<LivingEntity> successes = HeldModifiableItemIterator.apply(context, (living, stack) -> {<NEW_LINE>// add slots<NEW_LINE>ToolStack tool = ToolStack.copyFrom(stack);<NEW_LINE>ModDataNBT slots = tool.getPersistentData();<NEW_LINE>if (op == Operation.ADD) {<NEW_LINE>slots.addSlots(slotType, count);<NEW_LINE>} else {<NEW_LINE>// for setting, we want to subtract slots from all sources, so this is the one true source<NEW_LINE>slots.addSlots(slotType, count - tool.getFreeSlots(slotType));<NEW_LINE>}<NEW_LINE>tool.rebuildStats();<NEW_LINE>// ensure no modifier problems after adding, mainly happens if we subtract slots<NEW_LINE>ValidatedResult toolValidation = tool.validate();<NEW_LINE>if (toolValidation.hasError()) {<NEW_LINE>throw VALIDATION_ERROR.create(toolValidation.getMessage());<NEW_LINE>}<NEW_LINE>// if successful, update held item<NEW_LINE>living.setItemInHand(InteractionHand.MAIN_HAND, tool.createStack(stack.getCount()));<NEW_LINE>return true;<NEW_LINE>});<NEW_LINE>// success message<NEW_LINE>CommandSourceStack source = context.getSource();<NEW_LINE>int size = successes.size();<NEW_LINE>if (op == Operation.ADD) {<NEW_LINE>if (size == 1) {<NEW_LINE>source.sendSuccess(new TranslatableComponent(ADD_SUCCESS, count, slotType.getDisplayName(), successes.get(0).getDisplayName()), true);<NEW_LINE>} else {<NEW_LINE>source.sendSuccess(new TranslatableComponent(ADD_SUCCESS_MULTIPLE, count, slotType.getDisplayName(), size), true);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (size == 1) {<NEW_LINE>source.sendSuccess(new TranslatableComponent(SET_SUCCESS, slotType.getDisplayName(), count, successes.get(0).getDisplayName()), true);<NEW_LINE>} else {<NEW_LINE>source.sendSuccess(new TranslatableComponent(SET_SUCCESS_MULTIPLE, slotType.getDisplayName(), count, size), true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return size;<NEW_LINE>} | SlotTypeArgument.getSlotType(context, "slot_type"); |
175,230 | public boolean deleteBackup(final Long backupId) {<NEW_LINE>final BackupVO <MASK><NEW_LINE>if (backup == null) {<NEW_LINE>throw new CloudRuntimeException("Backup " + backupId + " does not exist");<NEW_LINE>}<NEW_LINE>final Long vmId = backup.getVmId();<NEW_LINE>final VMInstanceVO vm = vmInstanceDao.findByIdIncludingRemoved(vmId);<NEW_LINE>if (vm == null) {<NEW_LINE>throw new CloudRuntimeException("VM " + vmId + " does not exist");<NEW_LINE>}<NEW_LINE>validateForZone(vm.getDataCenterId());<NEW_LINE>accountManager.checkAccess(CallContext.current().getCallingAccount(), null, true, vm);<NEW_LINE>final BackupOffering offering = backupOfferingDao.findByIdIncludingRemoved(vm.getBackupOfferingId());<NEW_LINE>if (offering == null) {<NEW_LINE>throw new CloudRuntimeException("VM backup offering ID " + vm.getBackupOfferingId() + " does not exist");<NEW_LINE>}<NEW_LINE>List<Backup> backupsForVm = backupDao.listByVmId(vm.getDataCenterId(), vmId);<NEW_LINE>if (CollectionUtils.isNotEmpty(backupsForVm)) {<NEW_LINE>backupsForVm = backupsForVm.stream().filter(vmBackup -> vmBackup.getId() != backupId).collect(Collectors.toList());<NEW_LINE>if (backupsForVm.size() <= 0 && vm.getRemoved() != null) {<NEW_LINE>removeVMFromBackupOffering(vmId, true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final BackupProvider backupProvider = getBackupProvider(offering.getProvider());<NEW_LINE>boolean result = backupProvider.deleteBackup(backup);<NEW_LINE>if (result) {<NEW_LINE>return backupDao.remove(backup.getId());<NEW_LINE>}<NEW_LINE>throw new CloudRuntimeException("Failed to delete the backup");<NEW_LINE>} | backup = backupDao.findByIdIncludingRemoved(backupId); |
377,847 | public boolean copyDir(URI srcUri, URI dstUri) throws IOException {<NEW_LINE>LOGGER.debug("copy is called with srcUri='{}', dstUri='{}'", srcUri, dstUri);<NEW_LINE>// If src and dst are the same, do nothing.<NEW_LINE>if (srcUri.equals(dstUri)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>// Remove the destination directory or file<NEW_LINE>if (exists(dstUri)) {<NEW_LINE>delete(dstUri, true);<NEW_LINE>}<NEW_LINE>if (!isDirectory(srcUri)) {<NEW_LINE>// If source is a file, we can simply copy the file from src to dst<NEW_LINE>return copySrcToDst(srcUri, dstUri);<NEW_LINE>} else {<NEW_LINE>// In case we are copying a directory, we need to recursively look into the directory and copy all the files and<NEW_LINE>// directories accordingly<NEW_LINE>try {<NEW_LINE>boolean copySucceeded = true;<NEW_LINE>Path srcPath = Paths.get(srcUri.getPath());<NEW_LINE>for (String path : listFiles(srcUri, true)) {<NEW_LINE>// Compute the src path for the given path<NEW_LINE>URI currentSrc = new URI(srcUri.getScheme(), srcUri.<MASK><NEW_LINE>// Compute the destination path for the current path.<NEW_LINE>String relativeSrcPath = srcPath.relativize(Paths.get(path)).toString();<NEW_LINE>String newDstPath = Paths.get(dstUri.getPath(), relativeSrcPath).toString();<NEW_LINE>URI newDst = new URI(dstUri.getScheme(), dstUri.getHost(), newDstPath, null);<NEW_LINE>if (isDirectory(currentSrc)) {<NEW_LINE>// If src is directory, create one.<NEW_LINE>mkdir(newDst);<NEW_LINE>} else {<NEW_LINE>// If src is a file, we need to copy.<NEW_LINE>copySucceeded &= copySrcToDst(currentSrc, newDst);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return copySucceeded;<NEW_LINE>} catch (DataLakeStorageException | URISyntaxException e) {<NEW_LINE>throw new IOException(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getHost(), path, null); |
1,322,397 | protected void translateCore(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) {<NEW_LINE>final IOperandTreeNode registerOperand1 = instruction.getOperands().get(0).getRootNode().getChildren().get(0);<NEW_LINE>final IOperandTreeNode registerOperand2 = instruction.getOperands().get(1).getRootNode().getChildren().get(0);<NEW_LINE>final IOperandTreeNode registerOperand3 = instruction.getOperands().get(2).getRootNode().getChildren().get(0);<NEW_LINE>final String targetRegister = (registerOperand1.getValue());<NEW_LINE>final String sourceRegister1 = (registerOperand2.getValue());<NEW_LINE>final String sourceRegister2 = (registerOperand3.getValue());<NEW_LINE>final OperandSize wd = OperandSize.WORD;<NEW_LINE>final OperandSize dw = OperandSize.DWORD;<NEW_LINE>final OperandSize qw = OperandSize.QWORD;<NEW_LINE>long baseOffset = ReilHelpers.nextReilAddress(instruction, instructions);<NEW_LINE>final String operand2 = environment.getNextVariableString();<NEW_LINE>final <MASK><NEW_LINE>final String tmpVar2 = environment.getNextVariableString();<NEW_LINE>final String trueTmpResult = environment.getNextVariableString();<NEW_LINE>final String tmpResult = environment.getNextVariableString();<NEW_LINE>if (instruction.getMnemonic().contains("B")) {<NEW_LINE>Helpers.signExtend(baseOffset, environment, instruction, instructions, dw, sourceRegister2, dw, operand2, 16);<NEW_LINE>} else {<NEW_LINE>instructions.add(ReilHelpers.createBsh(baseOffset++, dw, sourceRegister2, wd, String.valueOf(-16L), dw, tmpVar1));<NEW_LINE>Helpers.signExtend(baseOffset, environment, instruction, instructions, dw, tmpVar1, dw, operand2, 16);<NEW_LINE>}<NEW_LINE>baseOffset = ReilHelpers.nextReilAddress(instruction, instructions);<NEW_LINE>Helpers.signedMul(baseOffset, environment, instruction, instructions, dw, sourceRegister1, dw, operand2, qw, tmpResult);<NEW_LINE>baseOffset = ReilHelpers.nextReilAddress(instruction, instructions);<NEW_LINE>instructions.add(ReilHelpers.createBsh(baseOffset++, qw, trueTmpResult, wd, String.valueOf(-16L), qw, tmpVar2));<NEW_LINE>instructions.add(ReilHelpers.createAnd(baseOffset++, qw, tmpVar2, dw, String.valueOf(0xFFFFFFFFL), dw, targetRegister));<NEW_LINE>} | String tmpVar1 = environment.getNextVariableString(); |
1,165,961 | private void configureClearText(SocketChannel ch) {<NEW_LINE>final ChannelPipeline p = ch.pipeline();<NEW_LINE>final HttpServerCodec sourceCodec = new HttpServerCodec();<NEW_LINE>final HttpServerUpgradeHandler upgradeHandler = new HttpServerUpgradeHandler(sourceCodec, upgradeCodecFactory);<NEW_LINE>final CleartextHttp2ServerUpgradeHandler cleartextHttp2ServerUpgradeHandler = new CleartextHttp2ServerUpgradeHandler(sourceCodec, upgradeHandler, new HelloWorldHttp2HandlerBuilder().build());<NEW_LINE>p.addLast(cleartextHttp2ServerUpgradeHandler);<NEW_LINE>p.addLast(new SimpleChannelInboundHandler<HttpMessage>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected void channelRead0(ChannelHandlerContext ctx, HttpMessage msg) throws Exception {<NEW_LINE>// If this handler is hit then no upgrade has been attempted and the client is just talking HTTP.<NEW_LINE>System.err.println("Directly talking: " + msg.protocolVersion() + " (no upgrade was attempted)");<NEW_LINE>ChannelPipeline pipeline = ctx.pipeline();<NEW_LINE>pipeline.addAfter(ctx.name(), null, new HelloWorldHttp1Handler("Direct. No Upgrade Attempted."));<NEW_LINE>pipeline.replace(this, null, new HttpObjectAggregator(maxHttpContentLength));<NEW_LINE>ctx.fireChannelRead(ReferenceCountUtil.retain(msg));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>p<MASK><NEW_LINE>} | .addLast(new UserEventLogger()); |
1,810,957 | public boolean isAvailable() {<NEW_LINE>if (available != null) {<NEW_LINE>return available;<NEW_LINE>}<NEW_LINE>if (generatorList != null && !generatorList.isEmpty()) {<NEW_LINE>String path = System.getenv("PATH");<NEW_LINE>if (path == null) {<NEW_LINE>path = System.getenv("Path");<NEW_LINE>}<NEW_LINE>if (path == null) {<NEW_LINE>path = System.getenv("path");<NEW_LINE>}<NEW_LINE>final List<String> pathList = new ArrayList<>();<NEW_LINE>pathList.add("/usr/share/fess/bin");<NEW_LINE>if (path != null) {<NEW_LINE>stream(path.split(File.pathSeparator)).of(stream -> stream.map(String::trim).forEach(s -> pathList.add(s)));<NEW_LINE>}<NEW_LINE>available = generatorList.stream().map(s -> {<NEW_LINE>if (s.startsWith("${path}")) {<NEW_LINE>for (final String p : pathList) {<NEW_LINE>final File f = new File(s.replace("${path}", p));<NEW_LINE>if (f.exists()) {<NEW_LINE>final String filePath = f.getAbsolutePath();<NEW_LINE><MASK><NEW_LINE>return filePath;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return s;<NEW_LINE>}).allMatch(s -> new File(s).isFile());<NEW_LINE>} else {<NEW_LINE>available = true;<NEW_LINE>}<NEW_LINE>return available;<NEW_LINE>} | filePathMap.put(s, filePath); |
132,656 | private void doCreateFormatCombo() {<NEW_LINE>FormData data;<NEW_LINE>// Text label for combo box<NEW_LINE>formatLabel = getWidgetFactory().createCLabel(getSectionComposite(), "Format:");<NEW_LINE>data = new FormData();<NEW_LINE>data.top = new FormAttachment(getTextWidget(), ITabbedPropertyConstants.VSPACE, SWT.BOTTOM);<NEW_LINE>data.bottom = new FormAttachment(100, 0);<NEW_LINE>formatLabel.setLayoutData(data);<NEW_LINE>// Combo box<NEW_LINE>formatCombo = getWidgetFactory().createCCombo(getSectionComposite());<NEW_LINE>CommentFormat[] formatValues = CommentFormat.values();<NEW_LINE>int i = 0;<NEW_LINE>String[] formats = new String[formatValues.length];<NEW_LINE>for (CommentFormat formatValue : formatValues) {<NEW_LINE>formats[i++] = formatValue.name();<NEW_LINE>}<NEW_LINE>// Attempt was made to use CCombo.setText() to set the default<NEW_LINE>// combo box option, but this did not work. So instead, we'll force<NEW_LINE>// the issue by making the default format the first one added to<NEW_LINE>// the combo box.<NEW_LINE>formatCombo.add(defaultCommentFormatString.toLowerCase());<NEW_LINE>for (String format : formats) {<NEW_LINE>if (!format.equals(defaultCommentFormatString)) {<NEW_LINE>formatCombo.add(format.toLowerCase());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>data = new FormData();<NEW_LINE>data.left = new FormAttachment(<MASK><NEW_LINE>data.bottom = new FormAttachment(100, 0);<NEW_LINE>formatCombo.setLayoutData(data);<NEW_LINE>formatCombo.pack();<NEW_LINE>formatCombo.addFocusListener(new FocusListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void focusLost(FocusEvent e) {<NEW_LINE>setCommentFormat();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void focusGained(FocusEvent e) {<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | formatLabel, 0, SWT.RIGHT); |
1,685,348 | protected void startPersistThread() {<NEW_LINE>final Granularity segmentGranularity = schema.getGranularitySpec().getSegmentGranularity();<NEW_LINE>final Period windowPeriod = config.getWindowPeriod();<NEW_LINE>final DateTime truncatedNow = segmentGranularity.bucketStart(DateTimes.nowUtc());<NEW_LINE>final long windowMillis = windowPeriod.toStandardDuration().getMillis();<NEW_LINE>log.info("Expect to run at [%s]", DateTimes.nowUtc().plus(new Duration(System.currentTimeMillis(), segmentGranularity.increment(truncatedNow).getMillis() + windowMillis)));<NEW_LINE>String threadName = StringUtils.format("%s-overseer-%d", schema.getDataSource(), config.<MASK><NEW_LINE>ThreadRenamingCallable<ScheduledExecutors.Signal> threadRenamingCallable = new ThreadRenamingCallable<ScheduledExecutors.Signal>(threadName) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public ScheduledExecutors.Signal doCall() {<NEW_LINE>if (stopped) {<NEW_LINE>log.info("Stopping merge-n-push overseer thread");<NEW_LINE>return ScheduledExecutors.Signal.STOP;<NEW_LINE>}<NEW_LINE>mergeAndPush();<NEW_LINE>if (stopped) {<NEW_LINE>log.info("Stopping merge-n-push overseer thread");<NEW_LINE>return ScheduledExecutors.Signal.STOP;<NEW_LINE>} else {<NEW_LINE>return ScheduledExecutors.Signal.REPEAT;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>Duration initialDelay = new Duration(System.currentTimeMillis(), segmentGranularity.increment(truncatedNow).getMillis() + windowMillis);<NEW_LINE>Duration rate = new Duration(truncatedNow, segmentGranularity.increment(truncatedNow));<NEW_LINE>ScheduledExecutors.scheduleAtFixedRate(scheduledExecutor, initialDelay, rate, threadRenamingCallable);<NEW_LINE>} | getShardSpec().getPartitionNum()); |
454,990 | private static String outputMapResultsDefaultKeys(Map<String, Counter<Result>> tagResults, String[] keyOrder) {<NEW_LINE>StringBuilder output = new StringBuilder();<NEW_LINE>Result[] order = new Result[] { Result.CORRECT, Result.INCORRECT, Result.SKIPPED };<NEW_LINE>for (String tag : keyOrder) {<NEW_LINE>Counter<Result> resultsCounter = tagResults.get(tag);<NEW_LINE>if (resultsCounter == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (tag == null) {<NEW_LINE>output.append("No label" + "\t");<NEW_LINE>} else {<NEW_LINE>output.append(tag + "\t");<NEW_LINE>}<NEW_LINE>for (Result result : order) {<NEW_LINE>output.append(result.toString() + "\t" + resultsCounter<MASK><NEW_LINE>}<NEW_LINE>// append total and precision<NEW_LINE>double numCorrect = resultsCounter.getCount(Result.CORRECT);<NEW_LINE>double numIncorrect = resultsCounter.getCount(Result.INCORRECT);<NEW_LINE>double total = numCorrect + numIncorrect;<NEW_LINE>double precision = (total == 0) ? 0 : numCorrect / total;<NEW_LINE>output.append(total + "\t" + precision + "\n");<NEW_LINE>}<NEW_LINE>return output.toString();<NEW_LINE>} | .getCount(result) + "\t"); |
656,760 | final AdminDeleteUserAttributesResult executeAdminDeleteUserAttributes(AdminDeleteUserAttributesRequest adminDeleteUserAttributesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(adminDeleteUserAttributesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<AdminDeleteUserAttributesRequest> request = null;<NEW_LINE>Response<AdminDeleteUserAttributesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new AdminDeleteUserAttributesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(adminDeleteUserAttributesRequest));<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, "Cognito Identity Provider");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "AdminDeleteUserAttributes");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<AdminDeleteUserAttributesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(<MASK><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>} | false), new AdminDeleteUserAttributesResultJsonUnmarshaller()); |
1,056,737 | static // smaller tablets into large tablets.<NEW_LINE>SortedMap<KeyExtent, Bulk.Files> mergeOverlapping(SortedMap<KeyExtent, Bulk.Files> mappings) {<NEW_LINE>List<KeyExtent> extents = new ArrayList<<MASK><NEW_LINE>for (KeyExtent ke : extents) {<NEW_LINE>Set<KeyExtent> overlapping = KeyExtent.findOverlapping(ke, mappings);<NEW_LINE>for (KeyExtent oke : overlapping) {<NEW_LINE>if (ke.equals(oke)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (ke.contains(oke)) {<NEW_LINE>mappings.get(ke).merge(mappings.remove(oke));<NEW_LINE>} else if (!oke.contains(ke)) {<NEW_LINE>throw new RuntimeException("Error during bulk import: Unable to merge overlapping " + "tablets where neither tablet contains the other. This may be caused by " + "a concurrent merge. Key extents " + oke + " and " + ke + " overlap, but " + "neither contains the other.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return mappings;<NEW_LINE>} | >(mappings.keySet()); |
259,849 | final StartSnapshotResult executeStartSnapshot(StartSnapshotRequest startSnapshotRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(startSnapshotRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<StartSnapshotRequest> request = null;<NEW_LINE>Response<StartSnapshotResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new StartSnapshotRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(startSnapshotRequest));<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, "EBS");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StartSnapshot");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<StartSnapshotResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new StartSnapshotResultJsonUnmarshaller());<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
42,649 | public V forcePut(K key, V value) {<NEW_LINE>boolean containsValue = this.inverse.delegate.containsKey(value);<NEW_LINE>if (containsValue) {<NEW_LINE>if (AbstractMutableBiMap.nullSafeEquals(key, this.inverse.delegate.get(value))) {<NEW_LINE>return value;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>boolean containsKey = this.delegate.containsKey(key);<NEW_LINE>if (containsValue) {<NEW_LINE>V oldValueToPreserve = this.delegate.get(this.inverse.delegate.get(value));<NEW_LINE>V put = this.delegate.put(key, oldValueToPreserve);<NEW_LINE>if (containsKey) {<NEW_LINE>K oldKeyToPreserve = this.inverse.delegate.removeKey(put);<NEW_LINE>K oldKey = this.inverse.delegate.put(value, oldKeyToPreserve);<NEW_LINE>this.delegate.removeKey(oldKey);<NEW_LINE>return put;<NEW_LINE>}<NEW_LINE>K oldKey = this.inverse.delegate.put(value, key);<NEW_LINE>this.delegate.removeKey(oldKey);<NEW_LINE>return put;<NEW_LINE>}<NEW_LINE>V put = this.delegate.put(key, value);<NEW_LINE>if (containsKey) {<NEW_LINE>this.inverse.delegate.removeKey(put);<NEW_LINE>}<NEW_LINE>this.inverse.<MASK><NEW_LINE>return put;<NEW_LINE>} | delegate.put(value, key); |
69,848 | public void layout(LayoutContext c, int contentStart) {<NEW_LINE>boolean running = c.isPrint() && getTable().getStyle().isPaginateTable();<NEW_LINE>int prevExtraTop = 0;<NEW_LINE>int prevExtraBottom = 0;<NEW_LINE>if (running) {<NEW_LINE>prevExtraTop = c.getExtraSpaceTop();<NEW_LINE>prevExtraBottom = c.getExtraSpaceBottom();<NEW_LINE>calcExtraSpaceTop(c);<NEW_LINE>calcExtraSpaceBottom(c);<NEW_LINE>c.setExtraSpaceTop(c.getExtraSpaceTop() + getExtraSpaceTop());<NEW_LINE>c.setExtraSpaceBottom(c.getExtraSpaceBottom() + getExtraSpaceBottom());<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>if (running) {<NEW_LINE>if (isShouldMoveToNextPage(c)) {<NEW_LINE>if (getTable().getFirstBodyRow() == this) {<NEW_LINE>// XXX Performance problem here. This forces the table<NEW_LINE>// to move to the next page (which we want), but the initial<NEW_LINE>// table layout run still completes (which we don't)<NEW_LINE>getTable().setNeedPageClear(true);<NEW_LINE>} else {<NEW_LINE>setNeedPageClear(true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>c.setExtraSpaceTop(prevExtraTop);<NEW_LINE>c.setExtraSpaceBottom(prevExtraBottom);<NEW_LINE>}<NEW_LINE>} | super.layout(c, contentStart); |
721,921 | protected com.liferay.portal.model.PasswordTracker update(com.liferay.portal.model.PasswordTracker passwordTracker) throws SystemException {<NEW_LINE>Session session = null;<NEW_LINE>try {<NEW_LINE>if (passwordTracker.isNew() || passwordTracker.isModified()) {<NEW_LINE>session = openSession();<NEW_LINE>if (passwordTracker.isNew()) {<NEW_LINE>PasswordTrackerHBM passwordTrackerHBM = new PasswordTrackerHBM(passwordTracker.getPasswordTrackerId(), passwordTracker.getUserId(), passwordTracker.getCreateDate(<MASK><NEW_LINE>session.save(passwordTrackerHBM);<NEW_LINE>session.flush();<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>PasswordTrackerHBM passwordTrackerHBM = (PasswordTrackerHBM) session.load(PasswordTrackerHBM.class, passwordTracker.getPrimaryKey());<NEW_LINE>passwordTrackerHBM.setUserId(passwordTracker.getUserId());<NEW_LINE>passwordTrackerHBM.setCreateDate(passwordTracker.getCreateDate());<NEW_LINE>passwordTrackerHBM.setPassword(passwordTracker.getPassword());<NEW_LINE>session.flush();<NEW_LINE>} catch (ObjectNotFoundException onfe) {<NEW_LINE>PasswordTrackerHBM passwordTrackerHBM = new PasswordTrackerHBM(passwordTracker.getPasswordTrackerId(), passwordTracker.getUserId(), passwordTracker.getCreateDate(), passwordTracker.getPassword());<NEW_LINE>session.save(passwordTrackerHBM);<NEW_LINE>session.flush();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>passwordTracker.setNew(false);<NEW_LINE>passwordTracker.setModified(false);<NEW_LINE>passwordTracker.protect();<NEW_LINE>PasswordTrackerPool.remove(passwordTracker.getPrimaryKey());<NEW_LINE>PasswordTrackerPool.put(passwordTracker.getPrimaryKey(), passwordTracker);<NEW_LINE>}<NEW_LINE>return passwordTracker;<NEW_LINE>} catch (HibernateException he) {<NEW_LINE>throw new SystemException(he);<NEW_LINE>} finally {<NEW_LINE>HibernateUtil.closeSession(session);<NEW_LINE>}<NEW_LINE>} | ), passwordTracker.getPassword()); |
646,417 | /* Spreading */<NEW_LINE>@SuppressWarnings("deprecation")<NEW_LINE>@Deprecated<NEW_LINE>@Override<NEW_LINE>public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {<NEW_LINE>// based on vanilla logic, reimplemented to remove dirt hardcode<NEW_LINE>// prevent loading unloaded chunks<NEW_LINE>if (!world.isAreaLoaded(pos, 3))<NEW_LINE>return;<NEW_LINE>// if this is no longer valid grass, destroy<NEW_LINE>if (!isValidPos(state, world, pos)) {<NEW_LINE>world.setBlockAndUpdate(pos, getDirtState(state));<NEW_LINE>} else if (world.getMaxLocalRawBrightness(pos.above()) >= 9) {<NEW_LINE>// otherwise, attempt spreading<NEW_LINE>for (int i = 0; i < 4; ++i) {<NEW_LINE>BlockPos newGrass = pos.offset(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1);<NEW_LINE>BlockState newState = getStateFromDirt(world.getBlockState(newGrass), foliageType);<NEW_LINE>if (newState != null && canSpread(newState, world, newGrass)) {<NEW_LINE>world.setBlockAndUpdate(newGrass, newState.setValue(SNOWY, world.getBlockState(newGrass.above()).<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | is(Blocks.SNOW))); |
900,534 | public static Ticker adaptTicker(BitcoinChartsTicker[] bitcoinChartsTickers, CurrencyPair currencyPair) {<NEW_LINE>for (int i = 0; i < bitcoinChartsTickers.length; i++) {<NEW_LINE>if (bitcoinChartsTickers[i].getSymbol().equals(currencyPair.counter.getCurrencyCode())) {<NEW_LINE>BigDecimal last = bitcoinChartsTickers[i].getClose() != null ? bitcoinChartsTickers[i].getClose() : null;<NEW_LINE>BigDecimal bid = bitcoinChartsTickers[i].getBid() != null ? bitcoinChartsTickers[i].getBid() : null;<NEW_LINE>BigDecimal ask = bitcoinChartsTickers[i].getAsk() != null ? bitcoinChartsTickers[i].getAsk() : null;<NEW_LINE>BigDecimal high = bitcoinChartsTickers[i].getHigh() != null ? bitcoinChartsTickers[i].getHigh() : null;<NEW_LINE>BigDecimal low = bitcoinChartsTickers[i].getLow() != null ? bitcoinChartsTickers[i].getLow() : null;<NEW_LINE>BigDecimal volume = bitcoinChartsTickers[i].getVolume();<NEW_LINE>Date timeStamp = new Date(bitcoinChartsTickers[i<MASK><NEW_LINE>return new Ticker.Builder().currencyPair(currencyPair).last(last).bid(bid).ask(ask).high(high).low(low).volume(volume).timestamp(timeStamp).build();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | ].getLatestTrade() * 1000L); |
1,383,815 | private int readFromInputWhileSpanQuickCheckYes() {<NEW_LINE>afterQuickCheckYes = true;<NEW_LINE>int end = normalizer.spanQuickCheckYes(inputBuffer);<NEW_LINE>if (end > 0) {<NEW_LINE>int cp;<NEW_LINE>if (end == inputBuffer.length() && !normalizer.hasBoundaryAfter(cp = inputBuffer.codePointBefore(end))) {<NEW_LINE>afterQuickCheckYes = false;<NEW_LINE><MASK><NEW_LINE>// NOTE: for the loop, we pivot to using `hasBoundaryBefore()` because per the docs for<NEW_LINE>// `Normalizer2.hasBoundaryAfter()`:<NEW_LINE>// "Note that this operation may be significantly slower than hasBoundaryBefore()"<NEW_LINE>while (end > 0 && !normalizer.hasBoundaryBefore(cp)) {<NEW_LINE>cp = inputBuffer.codePointBefore(end);<NEW_LINE>end -= Character.charCount(cp);<NEW_LINE>}<NEW_LINE>if (end == 0) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>resultBuffer.append(inputBuffer.subSequence(0, end));<NEW_LINE>inputBuffer.delete(0, end);<NEW_LINE>checkedInputBoundary = Math.max(checkedInputBoundary - end, 0);<NEW_LINE>charCount += end;<NEW_LINE>}<NEW_LINE>return end;<NEW_LINE>} | end -= Character.charCount(cp); |
366,395 | public HealthbotManager authenticate(TokenCredential credential, AzureProfile profile) {<NEW_LINE>Objects.requireNonNull(credential, "'credential' cannot be null.");<NEW_LINE>Objects.requireNonNull(profile, "'profile' cannot be null.");<NEW_LINE>if (retryPolicy == null) {<NEW_LINE>retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);<NEW_LINE>}<NEW_LINE>List<HttpPipelinePolicy> policies = new ArrayList<>();<NEW_LINE>policies.add(new UserAgentPolicy(null, "com.azure.resourcemanager.healthbot", "1.0.0-beta.1", Configuration.getGlobalConfiguration()));<NEW_LINE>policies<MASK><NEW_LINE>HttpPolicyProviders.addBeforeRetryPolicies(policies);<NEW_LINE>policies.add(retryPolicy);<NEW_LINE>policies.add(new AddDatePolicy());<NEW_LINE>policies.add(new BearerTokenAuthenticationPolicy(credential, profile.getEnvironment().getManagementEndpoint() + "/.default"));<NEW_LINE>HttpPolicyProviders.addAfterRetryPolicies(policies);<NEW_LINE>policies.add(new HttpLoggingPolicy(httpLogOptions));<NEW_LINE>HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient).policies(policies.toArray(new HttpPipelinePolicy[0])).build();<NEW_LINE>return new HealthbotManager(httpPipeline, profile, defaultPollInterval);<NEW_LINE>} | .add(new RequestIdPolicy()); |
545,011 | protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {<NEW_LINE>// Reference the data source.<NEW_LINE>final DataSource source = mysqlDataSource;<NEW_LINE>final int count = Common.normalise(req.getParameter(PARAMETER_QUERIES));<NEW_LINE>final World[] worlds = new World[count];<NEW_LINE>try (Connection conn = source.getConnection();<NEW_LINE>PreparedStatement statement = conn.prepareStatement(DB_QUERY, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);<NEW_LINE>PreparedStatement statement2 = conn.prepareStatement(UPDATE_QUERY, ResultSet.TYPE_FORWARD_ONLY)) {<NEW_LINE>Common.modifySQLConnectionSettings(conn);<NEW_LINE>// Run the query the number of times requested.<NEW_LINE>for (int i = 0; i < count; i++) {<NEW_LINE>final int id = Common.getRandom();<NEW_LINE>statement.setInt(1, id);<NEW_LINE>try (ResultSet results = statement.executeQuery()) {<NEW_LINE>if (results.next()) {<NEW_LINE>worlds[i] = new World(id, results.getInt("randomNumber"));<NEW_LINE>// Update row<NEW_LINE>worlds[i].<MASK><NEW_LINE>statement2.setInt(1, worlds[i].getRandomNumber());<NEW_LINE>statement2.setInt(2, id);<NEW_LINE>// Add update statement to batch update<NEW_LINE>statement2.addBatch();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Execute batch update<NEW_LINE>statement2.executeBatch();<NEW_LINE>}<NEW_LINE>} catch (SQLException sqlex) {<NEW_LINE>throw new ServletException(sqlex);<NEW_LINE>}<NEW_LINE>// Set content type to JSON<NEW_LINE>res.setHeader(Common.HEADER_CONTENT_TYPE, Common.CONTENT_TYPE_JSON);<NEW_LINE>// Write JSON encoded message to the response.<NEW_LINE>Common.MAPPER.writeValue(res.getOutputStream(), worlds);<NEW_LINE>} | setRandomNumber(Common.getRandom()); |
1,821,778 | protected List<Amenity> doInBackground(Void... voids) {<NEW_LINE>FragmentActivity activity = activityRef.get();<NEW_LINE>OsmandApplication application = (OsmandApplication) activity.getApplication();<NEW_LINE>final List<Amenity> results = new ArrayList<>();<NEW_LINE>if (application != null && !isCancelled()) {<NEW_LINE>List<WorldRegion> regions = null;<NEW_LINE>if (articleLatLon != null) {<NEW_LINE>try {<NEW_LINE>regions = application.<MASK><NEW_LINE>} catch (IOException e) {<NEW_LINE>Log.e(TAG, e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (regions != null) {<NEW_LINE>AmenityIndexRepositoryBinary repository = getWikiRepositoryByRegions(regions, application);<NEW_LINE>if (repository == null) {<NEW_LINE>if (regionName == null || regionName.isEmpty()) {<NEW_LINE>IndexItem item = null;<NEW_LINE>try {<NEW_LINE>item = DownloadResources.findSmallestIndexItemAt(application, articleLatLon, DownloadActivityType.WIKIPEDIA_FILE);<NEW_LINE>} catch (IOException e) {<NEW_LINE>Log.e(TAG, e.getMessage(), e);<NEW_LINE>}<NEW_LINE>if (item != null) {<NEW_LINE>regionName = getRegionName(item.getFileName(), application.getRegions());<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (isCancelled()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>ResultMatcher<Amenity> matcher = new ResultMatcher<Amenity>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean publish(Amenity amenity) {<NEW_LINE>String localeName = amenity.getName();<NEW_LINE>List<String> otherNames = amenity.getOtherNames(false);<NEW_LINE>if (WikiArticleSearchTask.this.name.equals(localeName)) {<NEW_LINE>results.add(amenity);<NEW_LINE>} else {<NEW_LINE>for (String amenityName : otherNames) {<NEW_LINE>if (WikiArticleSearchTask.this.name.equals(amenityName)) {<NEW_LINE>results.add(amenity);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean isCancelled() {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>repository.searchAmenitiesByName(0, 0, 0, 0, Integer.MAX_VALUE, Integer.MAX_VALUE, name, matcher);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return results;<NEW_LINE>} | getRegions().getWorldRegionsAt(articleLatLon); |
124,352 | private static <T extends ReferenceListAwareEnum> ImmutableSet<ReferenceListAwareEnum> extractValuesOrNull(final Class<T> clazz) {<NEW_LINE>//<NEW_LINE>// Enum type<NEW_LINE>final T[] enumConstants = clazz.getEnumConstants();<NEW_LINE>if (enumConstants != null) {<NEW_LINE>return ImmutableSet.copyOf(enumConstants);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// static values() method<NEW_LINE>final Method valuesMethod = getMethodOrNull(clazz, "values");<NEW_LINE>if (valuesMethod != null) {<NEW_LINE>final Class<?> returnType = valuesMethod.getReturnType();<NEW_LINE>if (returnType.isArray()) {<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>final T[] valuesArr = (T[]) invokeStaticMethod(valuesMethod);<NEW_LINE>return ImmutableSet.copyOf(valuesArr);<NEW_LINE>} else if (Collection.class.isAssignableFrom(returnType)) {<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>final Collection<T> valuesCollection = (Collection<T>) invokeStaticMethod(valuesMethod);<NEW_LINE>return ImmutableSet.copyOf(valuesCollection);<NEW_LINE>} else {<NEW_LINE>throw <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// cannot extract values<NEW_LINE>return null;<NEW_LINE>} | Check.newException("Invalid values method: " + valuesMethod); |
749,755 | /*<NEW_LINE>* (non-Javadoc)<NEW_LINE>*<NEW_LINE>* @see org.openhab.binding.rwesmarthome.internal.communicator.client.RWEClient#execute(java.lang.String,<NEW_LINE>* java.lang.String)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public String execute(String hostname, String clientId, String request, String command) throws IOException, RWESmarthomeSessionExpiredException {<NEW_LINE>// prepare connection<NEW_LINE>HttpClient httpclient = httpHelper.getNewHttpClient();<NEW_LINE>HttpPost httpPost = new HttpPost("https://" + hostname + command);<NEW_LINE>httpPost.addHeader("ClientId", clientId);<NEW_LINE>httpPost.addHeader("Connection", "Keep-Alive");<NEW_LINE>HttpResponse response;<NEW_LINE>StringEntity se = new StringEntity(request, HTTP.UTF_8);<NEW_LINE>se.setContentType("text/xml");<NEW_LINE>httpPost.setEntity(se);<NEW_LINE>// execute HTTP request<NEW_LINE>logger.trace("executing request: " + httpPost.getURI().toString());<NEW_LINE><MASK><NEW_LINE>response = httpclient.execute(httpPost);<NEW_LINE>logger.trace("Response: " + response.toString());<NEW_LINE>// handle expired session<NEW_LINE>if (response.getStatusLine().getStatusCode() == 401) {<NEW_LINE>logger.info("401 Unauthorized returned - Session expired!");<NEW_LINE>throw new RWESmarthomeSessionExpiredException("401 Unauthorized returned - Session expired!");<NEW_LINE>}<NEW_LINE>// handle return<NEW_LINE>HttpEntity entity1 = response.getEntity();<NEW_LINE>InputStream in = entity1.getContent();<NEW_LINE>return InputStream2String.copyFromInputStream(in, "UTF-8");<NEW_LINE>} | logger.trace("REQ:" + request); |
825,713 | public Map<String, Object> createTopicPartitions(String clusterAlias, String topic, int totalCount) {<NEW_LINE>Map<String, Object> targets = new HashMap<String, Object>();<NEW_LINE>int existPartitions = (int) partitionNumbers(clusterAlias, topic);<NEW_LINE>Properties prop = new Properties();<NEW_LINE>prop.put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, kafkaService.getKafkaBrokerServer(clusterAlias));<NEW_LINE>if (SystemConfigUtils.getBooleanProperty(clusterAlias + ".efak.sasl.enable")) {<NEW_LINE>kafkaService.sasl(prop, clusterAlias);<NEW_LINE>}<NEW_LINE>if (SystemConfigUtils.getBooleanProperty(clusterAlias + ".efak.ssl.enable")) {<NEW_LINE>kafkaService.ssl(prop, clusterAlias);<NEW_LINE>}<NEW_LINE>AdminClient adminClient = null;<NEW_LINE>try {<NEW_LINE>adminClient = AdminClient.create(prop);<NEW_LINE>Map<String, NewPartitions> newPartitions = new HashMap<String, NewPartitions>();<NEW_LINE>newPartitions.put(topic, NewPartitions.increaseTo(existPartitions + totalCount));<NEW_LINE>adminClient.createPartitions(newPartitions);<NEW_LINE><MASK><NEW_LINE>targets.put("info", "Add topic[" + topic + "], before partition[" + existPartitions + "], after partition[" + (existPartitions + totalCount) + "] has successed.");<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.info("Add kafka topic partitions has error, msg is " + e.getMessage());<NEW_LINE>e.printStackTrace();<NEW_LINE>targets.put("status", "failed");<NEW_LINE>targets.put("info", "Add kafka topic partitions has error, msg is " + e.getMessage());<NEW_LINE>} finally {<NEW_LINE>adminClient.close();<NEW_LINE>}<NEW_LINE>return targets;<NEW_LINE>} | targets.put("status", "success"); |
1,229,472 | private void addPrimaryKey(StringBuilder query, List<Column> columns, String name) {<NEW_LINE>checkArgument(columns.stream().anyMatch(c -> c.kind() == Column.Kind.valueOf(Column.Kind.PartitionKey.name())), "At least one partition key must be specified for table or materialized view '%s' %s", name, Arrays.deepToString(columns.toArray()));<NEW_LINE>query.append("PRIMARY KEY ((");<NEW_LINE>query.append(columns.stream().filter(c -> c.kind() == Column.Kind.PartitionKey).map(SchemaEntity::cqlName).collect(<MASK><NEW_LINE>query.append(")");<NEW_LINE>if (columns.stream().anyMatch(c -> c.kind() == Column.Kind.Clustering)) {<NEW_LINE>query.append(", ");<NEW_LINE>}<NEW_LINE>query.append(columns.stream().filter(c -> c.kind() == Column.Kind.Clustering).map(SchemaEntity::cqlName).collect(Collectors.joining(", ")));<NEW_LINE>query.append(")");<NEW_LINE>} | Collectors.joining(", "))); |
270,426 | private void initialize(ApplicationConfigurator applicationConfigurator, InjectionManager injectionManager, Binder customBinder) {<NEW_LINE>LOGGER.config(LocalizationMessages.INIT_MSG(Version.getBuildId()));<NEW_LINE>this.injectionManager = injectionManager;<NEW_LINE>this.injectionManager.register(CompositeBinder.wrap(new ServerBinder(), customBinder));<NEW_LINE>this.managedObjectsFinalizer = new ManagedObjectsFinalizer(injectionManager);<NEW_LINE>ServerBootstrapBag bootstrapBag = new ServerBootstrapBag();<NEW_LINE>bootstrapBag.setManagedObjectsFinalizer(managedObjectsFinalizer);<NEW_LINE>List<BootstrapConfigurator> bootstrapConfigurators = Arrays.asList(new RequestProcessingConfigurator(), new RequestScope.RequestScopeConfigurator(), new ParamConverterConfigurator(), new ParamExtractorConfigurator(), new ValueParamProviderConfigurator(), new JerseyResourceContextConfigurator(), new ComponentProviderConfigurator(), new JaxrsProviders.ProvidersConfigurator(), applicationConfigurator, new RuntimeConfigConfigurator(), new ContextResolverFactory.ContextResolversConfigurator(), new MessageBodyFactory.MessageBodyWorkersConfigurator(), new ExceptionMapperFactory.ExceptionMappersConfigurator(), new ResourceMethodInvokerConfigurator(), new ProcessingProvidersConfigurator(), new ContainerProviderConfigurator(RuntimeType.SERVER), new AutoDiscoverableConfigurator(RuntimeType.SERVER), new DynamicFeatureConfigurator(), <MASK><NEW_LINE>bootstrapConfigurators.forEach(configurator -> configurator.init(injectionManager, bootstrapBag));<NEW_LINE>this.runtime = Errors.processWithException(() -> initialize(injectionManager, bootstrapConfigurators, bootstrapBag));<NEW_LINE>this.containerLifecycleListeners = Providers.getAllProviders(injectionManager, ContainerLifecycleListener.class);<NEW_LINE>} | new FeatureConfigurator(RuntimeType.SERVER)); |
1,042,803 | protected void paintInPanel(AffineTransform tran, Graphics2D g2) {<NEW_LINE>super.paintInPanel(tran, g2);<NEW_LINE>BoofSwingUtil.antialiasing(g2);<NEW_LINE>if (controlPanel.translucent > 0) {<NEW_LINE>// this requires some explaining<NEW_LINE>// for some reason it was decided that the transform would apply a translation, but not a scale<NEW_LINE>// so this scale will be concatted on top of the translation in the g2<NEW_LINE>tran.setTransform(scale, 0, 0, scale, 0, 0);<NEW_LINE>Composite beforeAC = g2.getComposite();<NEW_LINE><MASK><NEW_LINE>AlphaComposite ac = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, translucent);<NEW_LINE>g2.setComposite(ac);<NEW_LINE>g2.drawImage(visualized, tran, null);<NEW_LINE>g2.setComposite(beforeAC);<NEW_LINE>}<NEW_LINE>if (controlPanel.showCorners) {<NEW_LINE>Line2D.Double line = new Line2D.Double();<NEW_LINE>synchronized (lockCorners) {<NEW_LINE>g2.setStroke(new BasicStroke(3));<NEW_LINE>for (int i = 0; i < foundCorners.size; i++) {<NEW_LINE>ChessboardCorner c = foundCorners.get(i);<NEW_LINE>double x = c.x;<NEW_LINE>double y = c.y;<NEW_LINE>g2.setColor(Color.ORANGE);<NEW_LINE>VisualizeFeatures.drawCircle(g2, x * scale, y * scale, 5, circle);<NEW_LINE>double dx = 4 * Math.cos(c.orientation);<NEW_LINE>double dy = 4 * Math.sin(c.orientation);<NEW_LINE>g2.setColor(Color.CYAN);<NEW_LINE>line.setLine((x - dx) * scale, (y - dy) * scale, (x + dx) * scale, (y + dy) * scale);<NEW_LINE>g2.draw(line);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | float translucent = controlPanel.translucent / 100.0f; |
796,309 | public void loadLibrary() throws IOException {<NEW_LINE>try {<NEW_LINE>// First, try loading path<NEW_LINE>System.loadLibrary(m_libraryName);<NEW_LINE>} catch (UnsatisfiedLinkError ule) {<NEW_LINE>// Then load the hash from the resources<NEW_LINE>String <MASK><NEW_LINE>String resname = RuntimeDetector.getLibraryResource(m_libraryName);<NEW_LINE>try (InputStream hashIs = m_loadClass.getResourceAsStream(hashName)) {<NEW_LINE>if (hashIs == null) {<NEW_LINE>throw new IOException(getLoadErrorMessage(ule));<NEW_LINE>}<NEW_LINE>try (Scanner scanner = new Scanner(hashIs, StandardCharsets.UTF_8.name())) {<NEW_LINE>String hash = scanner.nextLine();<NEW_LINE>File jniLibrary = new File(m_extractionRoot, resname + "." + hash);<NEW_LINE>try {<NEW_LINE>// Try to load from an already extracted hash<NEW_LINE>System.load(jniLibrary.getAbsolutePath());<NEW_LINE>} catch (UnsatisfiedLinkError ule2) {<NEW_LINE>// If extraction failed, extract<NEW_LINE>try (InputStream resIs = m_loadClass.getResourceAsStream(resname)) {<NEW_LINE>if (resIs == null) {<NEW_LINE>throw new IOException(getLoadErrorMessage(ule));<NEW_LINE>}<NEW_LINE>var parentFile = jniLibrary.getParentFile();<NEW_LINE>if (parentFile == null) {<NEW_LINE>throw new IOException("JNI library has no parent file");<NEW_LINE>}<NEW_LINE>parentFile.mkdirs();<NEW_LINE>try (OutputStream os = Files.newOutputStream(jniLibrary.toPath())) {<NEW_LINE>// 64K copy buffer<NEW_LINE>byte[] buffer = new byte[0xFFFF];<NEW_LINE>int readBytes;<NEW_LINE>while ((readBytes = resIs.read(buffer)) != -1) {<NEW_LINE>// NOPMD<NEW_LINE>os.write(buffer, 0, readBytes);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>System.load(jniLibrary.getAbsolutePath());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | hashName = RuntimeDetector.getHashLibraryResource(m_libraryName); |
884,528 | public void emptyDeletedNodes(Long nodeId, String xSdsAuthToken) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// verify the required parameter 'nodeId' is set<NEW_LINE>if (nodeId == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'nodeId' when calling emptyDeletedNodes");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/v4/nodes/{node_id}/deleted_nodes".replaceAll("\\{" + "node_id" + "\\}", apiClient.escapeString(nodeId.toString()));<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams <MASK><NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>if (xSdsAuthToken != null)<NEW_LINE>localVarHeaderParams.put("X-Sds-Auth-Token", apiClient.parameterToString(xSdsAuthToken));<NEW_LINE>final String[] localVarAccepts = { "application/json" };<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] { "oauth2" };<NEW_LINE>apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);<NEW_LINE>} | = new ArrayList<Pair>(); |
1,573,824 | protected void updatePlayer(final Server server, final CommandSource sender, final User user, final String[] args) throws PlayerExemptException {<NEW_LINE>try {<NEW_LINE>final Player player = user.getBase();<NEW_LINE>if (player.getHealth() == 0) {<NEW_LINE>throw new PlayerExemptException(tl("healDead"));<NEW_LINE>}<NEW_LINE>final double amount = player.getMaxHealth() - player.getHealth();<NEW_LINE>final EntityRegainHealthEvent erhe = new EntityRegainHealthEvent(player, amount, RegainReason.CUSTOM);<NEW_LINE>ess.getServer().getPluginManager().callEvent(erhe);<NEW_LINE>if (erhe.isCancelled()) {<NEW_LINE>throw new QuietAbortException();<NEW_LINE>}<NEW_LINE>double newAmount = player.getHealth() + erhe.getAmount();<NEW_LINE>if (newAmount > player.getMaxHealth()) {<NEW_LINE>newAmount = player.getMaxHealth();<NEW_LINE>}<NEW_LINE>player.setHealth(newAmount);<NEW_LINE>player.setFoodLevel(20);<NEW_LINE>player.setFireTicks(0);<NEW_LINE>user<MASK><NEW_LINE>if (ess.getSettings().isRemovingEffectsOnHeal()) {<NEW_LINE>for (final PotionEffect effect : player.getActivePotionEffects()) {<NEW_LINE>player.removePotionEffect(effect.getType());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>sender.sendMessage(tl("healOther", user.getDisplayName()));<NEW_LINE>} catch (final QuietAbortException e) {<NEW_LINE>// Handle Quietly<NEW_LINE>}<NEW_LINE>} | .sendMessage(tl("heal")); |
1,022,809 | final DescribeCustomRoutingEndpointGroupResult executeDescribeCustomRoutingEndpointGroup(DescribeCustomRoutingEndpointGroupRequest describeCustomRoutingEndpointGroupRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeCustomRoutingEndpointGroupRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeCustomRoutingEndpointGroupRequest> request = null;<NEW_LINE>Response<DescribeCustomRoutingEndpointGroupResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeCustomRoutingEndpointGroupRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeCustomRoutingEndpointGroupRequest));<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, "Global Accelerator");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeCustomRoutingEndpointGroup");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeCustomRoutingEndpointGroupResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeCustomRoutingEndpointGroupResultJsonUnmarshaller());<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.endEvent(Field.RequestMarshallTime); |
766,110 | private static RowType addMetadataFields(RowType rowType, boolean withOperationField) {<NEW_LINE>List<RowType.RowField> mergedFields = new ArrayList<>();<NEW_LINE>LogicalType metadataFieldType = DataTypes.STRING().getLogicalType();<NEW_LINE>RowType.RowField commitTimeField = new RowType.RowField(HoodieRecord.COMMIT_TIME_METADATA_FIELD, metadataFieldType, "commit time");<NEW_LINE>RowType.RowField commitSeqnoField = new RowType.RowField(HoodieRecord.COMMIT_SEQNO_METADATA_FIELD, metadataFieldType, "commit seqno");<NEW_LINE>RowType.RowField recordKeyField = new RowType.RowField(HoodieRecord.RECORD_KEY_METADATA_FIELD, metadataFieldType, "record key");<NEW_LINE>RowType.RowField partitionPathField = new RowType.RowField(HoodieRecord.PARTITION_PATH_METADATA_FIELD, metadataFieldType, "partition path");<NEW_LINE>RowType.RowField fileNameField = new RowType.RowField(<MASK><NEW_LINE>mergedFields.add(commitTimeField);<NEW_LINE>mergedFields.add(commitSeqnoField);<NEW_LINE>mergedFields.add(recordKeyField);<NEW_LINE>mergedFields.add(partitionPathField);<NEW_LINE>mergedFields.add(fileNameField);<NEW_LINE>if (withOperationField) {<NEW_LINE>RowType.RowField operationField = new RowType.RowField(HoodieRecord.OPERATION_METADATA_FIELD, metadataFieldType, "operation");<NEW_LINE>mergedFields.add(operationField);<NEW_LINE>}<NEW_LINE>mergedFields.addAll(rowType.getFields());<NEW_LINE>return new RowType(false, mergedFields);<NEW_LINE>} | HoodieRecord.FILENAME_METADATA_FIELD, metadataFieldType, "field name"); |
1,621,109 | protected void sendEntriesToSwitch(DatapathId switchId) {<NEW_LINE>IOFSwitch sw = switchService.getSwitch(switchId);<NEW_LINE>if (sw == null)<NEW_LINE>return;<NEW_LINE>String stringId = sw.getId().toString();<NEW_LINE>if ((entriesFromStorage != null) && (entriesFromStorage.containsKey(stringId))) {<NEW_LINE>Map<String, OFMessage> entries = entriesFromStorage.get(stringId);<NEW_LINE>List<String> sortedList = new ArrayList<String>(entries.keySet());<NEW_LINE>// weird that Collections.sort() returns void<NEW_LINE>Collections.sort(sortedList, new FlowModSorter(stringId));<NEW_LINE>for (String entryName : sortedList) {<NEW_LINE>OFMessage <MASK><NEW_LINE>if (message != null) {<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("Pushing static entry {} for {}", stringId, entryName);<NEW_LINE>}<NEW_LINE>writeOFMessageToSwitch(sw.getId(), message);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | message = entries.get(entryName); |
1,824,036 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {<NEW_LINE>String sessionHandle = InputParser.getQueryParamOrThrowError(req, "sessionHandle", false);<NEW_LINE>assert sessionHandle != null;<NEW_LINE>try {<NEW_LINE>JsonObject userDataInDatabase = Session.getSessionData(main, sessionHandle);<NEW_LINE>JsonObject result = new JsonObject();<NEW_LINE><MASK><NEW_LINE>result.add("userDataInDatabase", userDataInDatabase);<NEW_LINE>super.sendJsonResponse(200, result, resp);<NEW_LINE>} catch (StorageQueryException e) {<NEW_LINE>throw new ServletException(e);<NEW_LINE>} catch (UnauthorisedException e) {<NEW_LINE>Logging.debug(main, Utils.exceptionStacktraceToString(e));<NEW_LINE>JsonObject reply = new JsonObject();<NEW_LINE>reply.addProperty("status", "UNAUTHORISED");<NEW_LINE>reply.addProperty("message", e.getMessage());<NEW_LINE>super.sendJsonResponse(200, reply, resp);<NEW_LINE>}<NEW_LINE>} | result.addProperty("status", "OK"); |
749,403 | public final PyObject _ge(PyObject o) {<NEW_LINE>PyObject token = null;<NEW_LINE>PyType t1 = this.getType();<NEW_LINE>PyType t2 = o.getType();<NEW_LINE>if (t1 != t2 && t2.isSubType(t1)) {<NEW_LINE>return o._le(this);<NEW_LINE>}<NEW_LINE>ThreadState ts = Py.getThreadState();<NEW_LINE>try {<NEW_LINE>if (++ts.compareStateNesting > 10) {<NEW_LINE>if ((token = check_recursion(ts, this, o)) == null) {<NEW_LINE>throw Py.ValueError("can't order recursive values");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>PyObject res = __ge__(o);<NEW_LINE>if (res != null) {<NEW_LINE>return res;<NEW_LINE>}<NEW_LINE>res = o.__le__(this);<NEW_LINE>if (res != null) {<NEW_LINE>return res;<NEW_LINE>}<NEW_LINE>return _cmp_unsafe(o) >= 0 <MASK><NEW_LINE>} finally {<NEW_LINE>delete_token(ts, token);<NEW_LINE>ts.compareStateNesting--;<NEW_LINE>}<NEW_LINE>} | ? Py.True : Py.False; |
1,683,306 | final GetGraphqlApiResult executeGetGraphqlApi(GetGraphqlApiRequest getGraphqlApiRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getGraphqlApiRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetGraphqlApiRequest> request = null;<NEW_LINE>Response<GetGraphqlApiResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetGraphqlApiRequestProtocolMarshaller(protocolFactory).marshall<MASK><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, "AppSync");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetGraphqlApi");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetGraphqlApiResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetGraphqlApiResultJsonUnmarshaller());<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>} | (super.beforeMarshalling(getGraphqlApiRequest)); |
1,367,721 | public Map<String, Map<String, Object>> asList() {<NEW_LINE>final Map<String, Map<String, Object>> configs = Maps.newLinkedHashMap();<NEW_LINE>for (ConfigurationField f : fields.values()) {<NEW_LINE>final Map<String, Object> config = Maps.newHashMap();<NEW_LINE>config.put("type", f.getFieldType());<NEW_LINE>config.put("human_name", f.getHumanName());<NEW_LINE>config.put("description", f.getDescription());<NEW_LINE>config.put("default_value", f.getDefaultValue());<NEW_LINE>config.put("is_optional", f.isOptional().equals(ConfigurationField.Optional.OPTIONAL));<NEW_LINE>config.put(<MASK><NEW_LINE>config.put("additional_info", f.getAdditionalInformation());<NEW_LINE>config.put("position", f.getPosition());<NEW_LINE>configs.put(f.getName(), config);<NEW_LINE>}<NEW_LINE>return configs;<NEW_LINE>} | "attributes", f.getAttributes()); |
1,503,750 | public static Expr buildExpr(Item item) {<NEW_LINE>// Before testing for a list because of RDF terms that are lists: (qtriple).<NEW_LINE>if (item.isNode())<NEW_LINE>return ExprLib.nodeToExpr(item.getNode());<NEW_LINE>Expr expr = null;<NEW_LINE>if (item.isList()) {<NEW_LINE>ItemList list = item.getList();<NEW_LINE>if (list.size() == 0)<NEW_LINE>BuilderLib.broken(item, "Empty list for expression");<NEW_LINE>Item head = list.get(0);<NEW_LINE>if (head.isNode()) {<NEW_LINE>if (head.getNode().isVariable() && list.size() == 1)<NEW_LINE>// The case of (?z)<NEW_LINE>return new ExprVar(Var.alloc(head.getNode()));<NEW_LINE>return buildFunctionCall(list);<NEW_LINE>} else if (head.isList())<NEW_LINE>BuilderLib.broken(item, "Head is a list");<NEW_LINE>else if (head.isSymbol()) {<NEW_LINE>if (item.isTagged(Tags.tagExpr)) {<NEW_LINE>BuilderLib.checkLength(2, list, "Wrong length: " + item.shortString());<NEW_LINE><MASK><NEW_LINE>return buildExpr(item);<NEW_LINE>}<NEW_LINE>return buildExpr(list);<NEW_LINE>}<NEW_LINE>throw new ARQInternalErrorException();<NEW_LINE>}<NEW_LINE>if (item.isSymbolIgnoreCase(Tags.tagTrue))<NEW_LINE>return NodeValue.TRUE;<NEW_LINE>if (item.isSymbolIgnoreCase(Tags.tagFalse))<NEW_LINE>return NodeValue.FALSE;<NEW_LINE>BuilderLib.broken(item, "Not a list or a node or recognized symbol: " + item);<NEW_LINE>return null;<NEW_LINE>} | item = list.get(1); |
1,538,628 | public TestStepConfig createNewTestStep(WsdlTestCase testCase, String name) {<NEW_LINE>if (dialog == null) {<NEW_LINE>buildDialog();<NEW_LINE>} else {<NEW_LINE>dialog.setValue(Form.ENDPOINT, "");<NEW_LINE>}<NEW_LINE>params = new XmlBeansRestParamsTestPropertyHolder(testCase, <MASK><NEW_LINE>paramsTable = new RestParamsTable(params, false, NewRestResourceActionBase.ParamLocation.RESOURCE, true, false);<NEW_LINE>dialog.getFormField(Form.PARAMSTABLE).setProperty("component", paramsTable);<NEW_LINE>dialog.setValue(Form.STEPNAME, name);<NEW_LINE>try {<NEW_LINE>if (dialog.show()) {<NEW_LINE>HttpRequestConfig httpRequest = HttpRequestConfig.Factory.newInstance();<NEW_LINE>httpRequest.setEndpoint(HttpUtils.completeUrlWithHttpIfProtocolIsNotHttpOrHttpsOrPropertyExpansion(dialog.getValue(Form.ENDPOINT)));<NEW_LINE>httpRequest.setMethod(dialog.getValue(Form.HTTPMETHOD));<NEW_LINE>XmlBeansRestParamsTestPropertyHolder tempParams = new XmlBeansRestParamsTestPropertyHolder(testCase, httpRequest.addNewParameters());<NEW_LINE>tempParams.addParameters(params);<NEW_LINE>tempParams.release();<NEW_LINE>TestStepConfig testStep = TestStepConfig.Factory.newInstance();<NEW_LINE>testStep.setType(HTTPREQUEST_TYPE);<NEW_LINE>testStep.setConfig(httpRequest);<NEW_LINE>testStep.setName(dialog.getValue(Form.STEPNAME));<NEW_LINE>return testStep;<NEW_LINE>} else {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>paramsTable.release();<NEW_LINE>paramsTable = null;<NEW_LINE>params = null;<NEW_LINE>dialog.getFormField(Form.PARAMSTABLE).setProperty("component", paramsTable);<NEW_LINE>}<NEW_LINE>} | RestParametersConfig.Factory.newInstance()); |
345,637 | private void loadSessionsFromRemoteCache(final KeycloakSessionFactory sessionFactory, String cacheName, final int sessionsPerSegment, final int maxErrors) {<NEW_LINE>log.debugf("Check pre-loading sessions from remote cache '%s'", cacheName);<NEW_LINE>KeycloakModelUtils.runJobInTransaction(sessionFactory, new KeycloakSessionTask() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run(KeycloakSession session) {<NEW_LINE>InfinispanConnectionProvider connections = session.getProvider(InfinispanConnectionProvider.class);<NEW_LINE>Cache<String, Serializable> workCache = connections.getCache(InfinispanConnectionProvider.WORK_CACHE_NAME);<NEW_LINE>InfinispanCacheInitializer initializer = new InfinispanCacheInitializer(sessionFactory, workCache, new RemoteCacheSessionsLoader(cacheName, sessionsPerSegment), <MASK><NEW_LINE>initializer.initCache();<NEW_LINE>initializer.loadSessions();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>log.debugf("Pre-loading sessions from remote cache '%s' finished", cacheName);<NEW_LINE>} | "remoteCacheLoad::" + cacheName, sessionsPerSegment, maxErrors); |
1,029,644 | void doUncached(Object callable, Object[] scope_w, Signature signature, PKeyword[] kwdefaults, int co_argcount, int co_kwonlyargcount, @Cached PRaiseNode raise, @Cached FindKwDefaultNode findKwDefaultNode, @Cached ConditionProfile missingProfile) {<NEW_LINE>String[] missingNames = new String[co_kwonlyargcount];<NEW_LINE>int missingCnt = 0;<NEW_LINE>for (int i = co_argcount; i < co_argcount + co_kwonlyargcount; i++) {<NEW_LINE>if (PArguments.getArgument(scope_w, i) != null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String kwname = signature.getKeywordNames()[i - co_argcount];<NEW_LINE>PKeyword kwdefault = <MASK><NEW_LINE>if (kwdefault != null) {<NEW_LINE>PArguments.setArgument(scope_w, i, kwdefault.getValue());<NEW_LINE>} else {<NEW_LINE>missingNames[missingCnt++] = kwname;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (missingProfile.profile(missingCnt > 0)) {<NEW_LINE>throw raiseMissing(callable, missingNames, missingCnt, "keyword-only", raise);<NEW_LINE>}<NEW_LINE>} | findKwDefaultNode.execute(kwdefaults, kwname); |
1,320,995 | public DiffRequest process(@Nonnull UserDataHolder context, @Nonnull ProgressIndicator indicator) throws DiffRequestProducerException, ProcessCanceledException {<NEW_LINE>if (!isNewFile && file.getFileType() == UnknownFileType.INSTANCE) {<NEW_LINE>return new UnknownFileTypeDiffRequest(file, getName());<NEW_LINE>}<NEW_LINE>if (shelvedChange.isConflictingChange(project)) {<NEW_LINE>try {<NEW_LINE>final CommitContext commitContext = new CommitContext();<NEW_LINE>final TextFilePatch patch = preloader.getPatch(shelvedChange, commitContext);<NEW_LINE>final FilePath pathBeforeRename = patchContext.getPathBeforeRename(file);<NEW_LINE>final String relativePath = patch.getAfterName() == null ? patch.getBeforeName() : patch.getAfterName();<NEW_LINE>final Getter<CharSequence> baseContentGetter = new Getter<CharSequence>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public CharSequence get() {<NEW_LINE>BaseRevisionTextPatchEP baseRevisionTextPatchEP = PatchEP.EP_NAME.findExtensionOrFail(project, BaseRevisionTextPatchEP.class);<NEW_LINE>return baseRevisionTextPatchEP.provideContent(relativePath, commitContext);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>Getter<ApplyPatchForBaseRevisionTexts> getter = new Getter<ApplyPatchForBaseRevisionTexts>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public ApplyPatchForBaseRevisionTexts get() {<NEW_LINE>return ApplyPatchForBaseRevisionTexts.create(project, file, pathBeforeRename, patch, baseContentGetter);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>return PatchDiffRequestFactory.createConflictDiffRequest(project, file, patch, "Shelved Version", getter, <MASK><NEW_LINE>} catch (VcsException e) {<NEW_LINE>throw new DiffRequestProducerException("Can't show diff for '" + getName() + "'", e);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>final Change change = shelvedChange.getChange(project);<NEW_LINE>return PatchDiffRequestFactory.createDiffRequest(project, change, getName(), context, indicator);<NEW_LINE>}<NEW_LINE>} | getName(), context, indicator); |
1,482,908 | public void testSimpleQueryWithSet(HttpServletRequest req, HttpServletResponse resp) throws Exception {<NEW_LINE>QueryClient client = <MASK><NEW_LINE>Query query = new Query();<NEW_LINE>query.setOperationName("allWidgetsSet");<NEW_LINE>query.setQuery("query allWidgetsSet {" + System.lineSeparator() + " allWidgetsSet {" + System.lineSeparator() + " name," + System.lineSeparator() + " weight" + System.lineSeparator() + " }" + System.lineSeparator() + "}");<NEW_LINE>WidgetQueryResponse response = client.allWidgets(query);<NEW_LINE>System.out.println("Response: " + response);<NEW_LINE>Set<Widget> widgets = response.getData().getAllWidgetsSet();<NEW_LINE>assertEquals(2, widgets.size());<NEW_LINE>for (Widget widget : widgets) {<NEW_LINE>String name = widget.getName();<NEW_LINE>assertNotNull(name);<NEW_LINE>if ("Notebook".equals(name)) {<NEW_LINE>assertEquals(2.0, widget.getWeight(), 0.1);<NEW_LINE>} else if ("Pencil".equals(name)) {<NEW_LINE>assertEquals(0.5, widget.getWeight(), 0.1);<NEW_LINE>} else {<NEW_LINE>fail("Unexpected widget: " + widget);<NEW_LINE>}<NEW_LINE>// quantity wasn't specified in the query<NEW_LINE>assertEquals(-1, widget.getQuantity());<NEW_LINE>}<NEW_LINE>} | builder.build(QueryClient.class); |
1,311,409 | public CodegenExpression evaluateCodegen(EPTypeClass requiredType, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) {<NEW_LINE>CodegenExpressionField eventToPublic = TableDeployTimeResolver.makeTableEventToPublicField(table, codegenClassScope, this.getClass());<NEW_LINE>CodegenMethod methodNode = codegenMethodScope.makeChild(EventBean.EPTYPEARRAY, this.getClass(), codegenClassScope);<NEW_LINE>CodegenExpressionRef refEPS = exprSymbol.getAddEPS(methodNode);<NEW_LINE>CodegenExpression <MASK><NEW_LINE>CodegenExpressionRef refExprEvalCtx = exprSymbol.getAddExprEvalCtx(methodNode);<NEW_LINE>methodNode.getBlock().declareVar(EPTypePremade.OBJECT.getEPType(), "result", enumerationForge.evaluateGetROCollectionEventsCodegen(methodNode, exprSymbol, codegenClassScope)).ifRefNullReturnNull("result").methodReturn(staticMethod(ExprEvalEnumerationAtBeanCollTable.class, "convertToTableType", ref("result"), eventToPublic, refEPS, refIsNewData, refExprEvalCtx));<NEW_LINE>return localMethod(methodNode);<NEW_LINE>} | refIsNewData = exprSymbol.getAddIsNewData(methodNode); |
127,516 | public Stream<M> receiveMessages(MessageScope messageScope) {<NEW_LINE>if (messageScope instanceof MessageScope.Global) {<NEW_LINE>M message = vertexMemory.getMessage(vertexId, messageScope);<NEW_LINE>if (message == null)<NEW_LINE>return Stream.empty();<NEW_LINE>else<NEW_LINE>return Stream.of(message);<NEW_LINE>} else {<NEW_LINE>final MessageScope.Local<M> localMessageScope = (MessageScope.Local) messageScope;<NEW_LINE>final Traversal<Vertex, Edge> reverseIncident = FulgoraUtil.getReverseElementTraversal(localMessageScope, vertex, vertex.tx());<NEW_LINE>final BiFunction<M, Edge, M> edgeFct = localMessageScope.getEdgeFunction();<NEW_LINE>return IteratorUtils.stream(reverseIncident).map(e -> {<NEW_LINE>M msg = vertexMemory.getMessage(vertexMemory.getCanonicalId(((TitanEdge) e).otherVertex(vertex)<MASK><NEW_LINE>return msg == null ? null : edgeFct.apply(msg, e);<NEW_LINE>}).filter(m -> m != null);<NEW_LINE>}<NEW_LINE>} | .longId()), localMessageScope); |
1,630,904 | public HeuristicResult apply(MapReduceApplicationData data) {<NEW_LINE>if (!data.getSucceeded()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>long totalInputByteSize = 0;<NEW_LINE>MapReduceTaskData[] tasks = data.getMapperData();<NEW_LINE>List<Long> inputByteSizes = new ArrayList<Long>();<NEW_LINE>List<Long> speeds = new ArrayList<Long>();<NEW_LINE>List<Long> runtimesMs = new ArrayList<Long>();<NEW_LINE>for (MapReduceTaskData task : tasks) {<NEW_LINE>if (task.isTimeAndCounterDataPresent()) {<NEW_LINE>long inputBytes = 0;<NEW_LINE>for (MapReduceCounterData.CounterName counterName : _counterNames) {<NEW_LINE>inputBytes += task.<MASK><NEW_LINE>}<NEW_LINE>long runtimeMs = task.getTotalRunTimeMs();<NEW_LINE>inputByteSizes.add(inputBytes);<NEW_LINE>totalInputByteSize += inputBytes;<NEW_LINE>runtimesMs.add(runtimeMs);<NEW_LINE>// Speed is bytes per second<NEW_LINE>speeds.add((1000 * inputBytes) / (runtimeMs));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>long medianSpeed;<NEW_LINE>long medianSize;<NEW_LINE>long medianRuntimeMs;<NEW_LINE>if (tasks.length != 0) {<NEW_LINE>medianSpeed = Statistics.median(speeds);<NEW_LINE>medianSize = Statistics.median(inputByteSizes);<NEW_LINE>medianRuntimeMs = Statistics.median(runtimesMs);<NEW_LINE>} else {<NEW_LINE>medianSpeed = 0;<NEW_LINE>medianSize = 0;<NEW_LINE>medianRuntimeMs = 0;<NEW_LINE>}<NEW_LINE>Severity severity = getDiskSpeedSeverity(medianSpeed);<NEW_LINE>// This reduces severity if task runtime is insignificant<NEW_LINE>severity = Severity.min(severity, getRuntimeSeverity(medianRuntimeMs));<NEW_LINE>HeuristicResult result = new HeuristicResult(_heuristicConfData.getClassName(), _heuristicConfData.getHeuristicName(), severity, Utils.getHeuristicScore(severity, tasks.length));<NEW_LINE>result.addResultDetail("Number of tasks", Integer.toString(tasks.length));<NEW_LINE>result.addResultDetail("Median task input size", FileUtils.byteCountToDisplaySize(medianSize));<NEW_LINE>result.addResultDetail("Median task runtime", Statistics.readableTimespan(medianRuntimeMs));<NEW_LINE>result.addResultDetail("Median task speed", FileUtils.byteCountToDisplaySize(medianSpeed) + "/s");<NEW_LINE>result.addResultDetail(CommonConstantsHeuristic.TOTAL_INPUT_SIZE_IN_MB, totalInputByteSize * 1.0 / (FileUtils.ONE_MB) + "");<NEW_LINE>return result;<NEW_LINE>} | getCounters().get(counterName); |
453,406 | public static void addPartResource(FhirContext theContext, IBase theParameter, String theName, IBaseResource theValue) {<NEW_LINE>BaseRuntimeElementCompositeDefinition<?> def = (BaseRuntimeElementCompositeDefinition<?>) theContext.getElementDefinition(theParameter.getClass());<NEW_LINE>BaseRuntimeChildDefinition partChild = def.getChildByName("part");<NEW_LINE>BaseRuntimeElementCompositeDefinition<?> partChildElem = (BaseRuntimeElementCompositeDefinition<?>) partChild.getChildByName("part");<NEW_LINE>IBase part = partChildElem.newInstance();<NEW_LINE>partChild.getMutator().addValue(theParameter, part);<NEW_LINE>IPrimitiveType<String> name = (IPrimitiveType<String>) theContext.getElementDefinition("string").newInstance();<NEW_LINE>name.setValue(theName);<NEW_LINE>partChildElem.getChildByName("name").getMutator(<MASK><NEW_LINE>partChildElem.getChildByName("resource").getMutator().addValue(part, theValue);<NEW_LINE>} | ).addValue(part, name); |
1,846,413 | public void handle(Request request, Response response) {<NEW_LINE>try {<NEW_LINE>final Protocol protocol = request.getProtocol();<NEW_LINE>if (Protocol.SMTP.equals(protocol) || Protocol.SMTPS.equals(protocol)) {<NEW_LINE>handleSmtp(request, response);<NEW_LINE>} else if (Protocol.POP.equals(protocol) || Protocol.POPS.equals(protocol)) {<NEW_LINE>handlePop(request, response);<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>getLogger().log(Level.WARNING, "JavaMail client error", e);<NEW_LINE>response.setStatus(Status.CONNECTOR_ERROR_INTERNAL, e.getMessage());<NEW_LINE>} catch (NoSuchProviderException e) {<NEW_LINE>getLogger().log(Level.WARNING, "JavaMail client error", e);<NEW_LINE>response.setStatus(Status.SERVER_ERROR_INTERNAL, e.getMessage());<NEW_LINE>} catch (AddressException e) {<NEW_LINE>getLogger().log(<MASK><NEW_LINE>response.setStatus(Status.CLIENT_ERROR_BAD_REQUEST, e.getMessage());<NEW_LINE>} catch (MessagingException e) {<NEW_LINE>getLogger().log(Level.WARNING, "JavaMail client error", e);<NEW_LINE>response.setStatus(Status.SERVER_ERROR_INTERNAL, e.getMessage());<NEW_LINE>}<NEW_LINE>} | Level.WARNING, "JavaMail client error", e); |
1,089,116 | public SQLFuture<List<CursorWithError>> executeBatch(Context ctx, List<String> queryList, @Nullable List<Map<String, ?>> bindVarsList, final VTSession vtSession) throws SQLException {<NEW_LINE>vtSession.checkCallIsAllowed("executeBatch");<NEW_LINE>List<Query.BoundQuery> <MASK><NEW_LINE>if (null != bindVarsList && bindVarsList.size() != queryList.size()) {<NEW_LINE>throw new SQLDataException("Size of SQL Query list does not match the bind variables list");<NEW_LINE>}<NEW_LINE>for (int i = 0; i < queryList.size(); ++i) {<NEW_LINE>queries.add(i, Proto.bindQuery(checkNotNull(queryList.get(i)), bindVarsList == null ? null : bindVarsList.get(i)));<NEW_LINE>}<NEW_LINE>Vtgate.ExecuteBatchRequest.Builder requestBuilder = Vtgate.ExecuteBatchRequest.newBuilder().addAllQueries(checkNotNull(queries)).setSession(vtSession.getSession());<NEW_LINE>if (ctx.getCallerId() != null) {<NEW_LINE>requestBuilder.setCallerId(ctx.getCallerId());<NEW_LINE>}<NEW_LINE>SQLFuture<List<CursorWithError>> call = new SQLFuture<>(transformAsync(client.executeBatch(ctx, requestBuilder.build()), new AsyncFunction<Vtgate.ExecuteBatchResponse, List<CursorWithError>>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public ListenableFuture<List<CursorWithError>> apply(Vtgate.ExecuteBatchResponse response) throws Exception {<NEW_LINE>vtSession.setSession(response.getSession());<NEW_LINE>Proto.checkError(response.getError());<NEW_LINE>return Futures.immediateFuture(Proto.fromQueryResponsesToCursorList(response.getResultsList()));<NEW_LINE>}<NEW_LINE>}, directExecutor()));<NEW_LINE>vtSession.setLastCall(call);<NEW_LINE>return call;<NEW_LINE>} | queries = new ArrayList<>(); |
160,460 | void completed(Exception throwable) {<NEW_LINE>boolean needToFire = true;<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, <MASK><NEW_LINE>}<NEW_LINE>synchronized (this.completedSemaphore) {<NEW_LINE>// future can already be completed<NEW_LINE>if (this.completed || !this.channel.isOpen()) {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "Future completed after already cancelled or socket was closed");<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>this.completed = true;<NEW_LINE>// new timeout code - cancel active timeout request<NEW_LINE>if (getTimeoutWorkItem() != null) {<NEW_LINE>getTimeoutWorkItem().state = TimerWorkItem.ENTRY_CANCELLED;<NEW_LINE>}<NEW_LINE>this.exception = throwable;<NEW_LINE>if (this.firstListener == null) {<NEW_LINE>// Sync Read/Write request.<NEW_LINE>// must do this inside the sync, or else syncRead/Write could complete<NEW_LINE>// before we get here, and we would be doing this on the next<NEW_LINE>// read/write request!<NEW_LINE>needToFire = false;<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "doing notify for future " + this);<NEW_LINE>}<NEW_LINE>this.completedSemaphore.notifyAll();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// end of sync<NEW_LINE>if (needToFire) {<NEW_LINE>// ASync Read/Write request.<NEW_LINE>// need to do this outside the sync, or else we will hold the sync<NEW_LINE>// for the user's callback.<NEW_LINE>fireCompletionActions();<NEW_LINE>}<NEW_LINE>} | "completed", throwable.getMessage()); |
485,850 | List<ChatEmote> findTwitchEmotes(@Nullable String line, String message) {<NEW_LINE>if (line == null)<NEW_LINE>return Collections.emptyList();<NEW_LINE>List<ChatEmote> emotes = new ArrayList<>();<NEW_LINE>Matcher emoteMatcher = emotePattern.matcher(line);<NEW_LINE>while (emoteMatcher.find()) {<NEW_LINE>String emoteId = emoteMatcher.group(1);<NEW_LINE>String[] stringPositions = emoteMatcher.group(2).split(",");<NEW_LINE>int[] positions = new int[stringPositions.length];<NEW_LINE>String keyword = "";<NEW_LINE>for (int i = 0; i < stringPositions.length; i++) {<NEW_LINE>String stringPosition = stringPositions[i];<NEW_LINE>String[] range = stringPosition.split("-");<NEW_LINE>int start = Integer<MASK><NEW_LINE>positions[i] = start;<NEW_LINE>if (i == 0) {<NEW_LINE>int end = Integer.parseInt(range[1]);<NEW_LINE>keyword = message.substring(start, end + 1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>emotes.add(new ChatEmote(Emote.Twitch(keyword, emoteId), positions));<NEW_LINE>}<NEW_LINE>return emotes;<NEW_LINE>} | .parseInt(range[0]); |
1,691,269 | final GetPermissionPolicyResult executeGetPermissionPolicy(GetPermissionPolicyRequest getPermissionPolicyRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getPermissionPolicyRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetPermissionPolicyRequest> request = null;<NEW_LINE>Response<GetPermissionPolicyResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetPermissionPolicyRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getPermissionPolicyRequest));<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, "WAF");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetPermissionPolicy");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetPermissionPolicyResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetPermissionPolicyResultJsonUnmarshaller());<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); |
892,100 | private Spliterator<R> arraySplit() {<NEW_LINE>long s = estimateSize();<NEW_LINE>if (s <= 1)<NEW_LINE>return null;<NEW_LINE>int n = batch + BATCH_UNIT;<NEW_LINE>if (n > s)<NEW_LINE>n = (int) s;<NEW_LINE>if (n > MAX_BATCH)<NEW_LINE>n = MAX_BATCH;<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>R[] array = (R[]) new Object[n];<NEW_LINE>int <MASK><NEW_LINE>if ((batch = index) == 0)<NEW_LINE>return null;<NEW_LINE>long s2 = estimateSize();<NEW_LINE>USOfRef<R> prefix = new UnknownSizeSpliterator.USOfRef<>(array, 0, index);<NEW_LINE>if (hasCharacteristics(SUBSIZED))<NEW_LINE>prefix.est = index;<NEW_LINE>else if (s == s2)<NEW_LINE>prefix.est = Math.max(index, s / 2);<NEW_LINE>else<NEW_LINE>prefix.est = Math.max(index, s2 - s);<NEW_LINE>return prefix;<NEW_LINE>} | index = drainTo(array, this); |
609,636 | public Object bind(BindableRequest request, EntityBean bean) throws SQLException {<NEW_LINE>Object embeddedId = (bean == null) ? null : foreignAssocOne.getValue(bean);<NEW_LINE><MASK><NEW_LINE>if (embeddedId == null) {<NEW_LINE>for (ImportedIdSimple anImported : imported) {<NEW_LINE>if (anImported.isInclude(update)) {<NEW_LINE>request.bind(null, anImported.foreignProperty);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// return anything non-null to skip a derived relationship update<NEW_LINE>return Object.class;<NEW_LINE>} else {<NEW_LINE>EntityBean embedded = (EntityBean) embeddedId;<NEW_LINE>for (ImportedIdSimple anImported : imported) {<NEW_LINE>if (anImported.isInclude(update)) {<NEW_LINE>Object scalarValue = anImported.foreignProperty.getValue(embedded);<NEW_LINE>request.bind(scalarValue, anImported.foreignProperty);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return embedded;<NEW_LINE>}<NEW_LINE>} | boolean update = request.isUpdate(); |
187,285 | final GetInsightSelectorsResult executeGetInsightSelectors(GetInsightSelectorsRequest getInsightSelectorsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getInsightSelectorsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetInsightSelectorsRequest> request = null;<NEW_LINE>Response<GetInsightSelectorsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetInsightSelectorsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getInsightSelectorsRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetInsightSelectors");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetInsightSelectorsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetInsightSelectorsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.SERVICE_ID, "CloudTrail"); |
1,298,473 | ProviderAuthenticationResult handleImplicitFlowTokens(HttpServletRequest req, HttpServletResponse res, String responseState, ConvergedClientConfig clientConfig, Hashtable<String, String> reqParameters) {<NEW_LINE>OidcClientRequest oidcClientRequest = (OidcClientRequest) req.getAttribute(ClientConstants.ATTRIB_OIDC_CLIENT_REQUEST);<NEW_LINE>ProviderAuthenticationResult oidcResult = null;<NEW_LINE>oidcResult = verifyResponseState(req, res, responseState, clientConfig);<NEW_LINE>if (oidcResult != null) {<NEW_LINE>// 401<NEW_LINE>return oidcResult;<NEW_LINE>}<NEW_LINE>oidcClientRequest.setTokenType(OidcClientRequest.TYPE_ID_TOKEN);<NEW_LINE>oidcResult = jose4jUtil.createResultWithJose4J(responseState, reqParameters, clientConfig, oidcClientRequest);<NEW_LINE>// get userinfo if configured and available.<NEW_LINE>if (clientConfig.getUserInfoEndpointUrl() != null) {<NEW_LINE>boolean needHttps = clientConfig.getUserInfoEndpointUrl().toLowerCase().startsWith("https");<NEW_LINE>SSLSocketFactory sslSocketFactory = null;<NEW_LINE>try {<NEW_LINE>sslSocketFactory = new OidcClientHttpUtil().getSSLSocketFactory(clientConfig, sslSupport, false, needHttps);<NEW_LINE>} catch (com.ibm.websphere.ssl.SSLException e) {<NEW_LINE>// ffdc<NEW_LINE>}<NEW_LINE>new UserInfoHelper(clientConfig, sslSupport).getUserInfoIfPossible(<MASK><NEW_LINE>}<NEW_LINE>return oidcResult;<NEW_LINE>} | oidcResult, reqParameters, sslSocketFactory, oidcClientRequest); |
694,955 | private void loadCpeEcosystemCache() {<NEW_LINE>final Map<Pair<String, String>, String> map = new HashMap<>();<NEW_LINE>try (Connection conn = databaseManager.getConnection();<NEW_LINE>PreparedStatement ps = getPreparedStatement(conn, SELECT_CPE_ECOSYSTEM);<NEW_LINE>ResultSet rs = ps.executeQuery()) {<NEW_LINE>while (rs.next()) {<NEW_LINE>final Pair<String, String> key = new Pair<>(rs.getString(1), rs.getString(2));<NEW_LINE>final String <MASK><NEW_LINE>map.put(key, value);<NEW_LINE>}<NEW_LINE>} catch (SQLException ex) {<NEW_LINE>final String msg = String.format("Error loading the Cpe Ecosystem Cache: %s", ex.getMessage());<NEW_LINE>LOGGER.debug(msg, ex);<NEW_LINE>throw new DatabaseException(msg, ex);<NEW_LINE>}<NEW_LINE>CpeEcosystemCache.setCache(map);<NEW_LINE>} | value = rs.getString(3); |
290,546 | public void testFindTaskIds(HttpServletRequest request, HttpServletResponse response) throws Exception {<NEW_LINE><MASK><NEW_LINE>String jndiName = request.getParameter("jndiName");<NEW_LINE>String executorName = request.getParameter("executorId");<NEW_LINE>ObjectInstance bean = getPEMBean(mbs, jndiName);<NEW_LINE>Object obj = mbs.invoke(bean.getObjectName(), "findPartitionInfo", new Object[] { null, null, null, executorName }, new String[] { "java.lang.String", "java.lang.String", "java.lang.String", "java.lang.String" });<NEW_LINE>String[][] records = (String[][]) obj;<NEW_LINE>String partitionId = records[0][0];<NEW_LINE>obj = mbs.invoke(bean.getObjectName(), "findTaskIds", new Object[] { Long.valueOf(partitionId), "ENDED", false, null, null }, new String[] { "long", "java.lang.String", "boolean", "java.lang.Long", "java.lang.Integer" });<NEW_LINE>Long[] taskIds = (Long[]) obj;<NEW_LINE>out.print("Task ids: ");<NEW_LINE>for (Long taskId : taskIds) out.print(taskId + " ");<NEW_LINE>out.println(".");<NEW_LINE>} | PrintWriter out = response.getWriter(); |
976,937 | static int measureChildForCells(View child, int cellSize, int cellsRemaining, int parentHeightMeasureSpec, int parentHeightPadding) {<NEW_LINE>final LayoutParams lp = (LayoutParams) child.getLayoutParams();<NEW_LINE>final int childHeightSize = MeasureSpec.getSize(parentHeightMeasureSpec) - parentHeightPadding;<NEW_LINE>final int childHeightMode = MeasureSpec.getMode(parentHeightMeasureSpec);<NEW_LINE>final int childHeightSpec = MeasureSpec.makeMeasureSpec(childHeightSize, childHeightMode);<NEW_LINE>int cellsUsed = 0;<NEW_LINE>if (cellsRemaining > 0) {<NEW_LINE>final int childWidthSpec = MeasureSpec.makeMeasureSpec(cellSize * cellsRemaining, MeasureSpec.AT_MOST);<NEW_LINE>child.measure(childWidthSpec, childHeightSpec);<NEW_LINE>final <MASK><NEW_LINE>cellsUsed = measuredWidth / cellSize;<NEW_LINE>if (measuredWidth % cellSize != 0)<NEW_LINE>cellsUsed++;<NEW_LINE>}<NEW_LINE>final ActionMenuItemView itemView = child instanceof ActionMenuItemView ? (ActionMenuItemView) child : null;<NEW_LINE>final boolean expandable = !lp.isOverflowButton && itemView != null && itemView.hasText();<NEW_LINE>lp.expandable = expandable;<NEW_LINE>lp.cellsUsed = cellsUsed;<NEW_LINE>final int targetWidth = cellsUsed * cellSize;<NEW_LINE>child.measure(MeasureSpec.makeMeasureSpec(targetWidth, MeasureSpec.EXACTLY), childHeightSpec);<NEW_LINE>return cellsUsed;<NEW_LINE>} | int measuredWidth = child.getMeasuredWidth(); |
1,423,040 | public void run(RegressionEnvironment env) {<NEW_LINE>RegressionPath path = new RegressionPath();<NEW_LINE>env.compileDeploy("@Name('context') @public create context SegmentedByString partition by theString from SupportBean", path);<NEW_LINE>env.compileDeploy("@Name('table') @public context SegmentedByString " + "create table MyTable(theString string, intPrimitive int primary key)", path);<NEW_LINE>env.compileDeploy("@Name('insert') context SegmentedByString insert into MyTable select theString, intPrimitive from SupportBean", path);<NEW_LINE>env.sendEventBean(new SupportBean("G1", 10));<NEW_LINE>assertValues(env, "G1", new Object[][] { { "G1", 10 } });<NEW_LINE>env.milestone(0);<NEW_LINE>env.sendEventBean(new SupportBean("G2", 20));<NEW_LINE>assertValues(env, "G1", new Object[][] { { "G1", 10 } });<NEW_LINE>assertValues(env, "G2", new Object[][] { { "G2", 20 } });<NEW_LINE>env.milestone(1);<NEW_LINE>env.sendEventBean(new SupportBean("G1", 11));<NEW_LINE>env.milestone(2);<NEW_LINE>assertValues(env, "G1", new Object[][] { { "G1", 10 }, { "G1", 11 } });<NEW_LINE>assertValues(env, "G2", new Object[][] { { "G2", 20 } });<NEW_LINE>env.sendEventBean(new SupportBean("G2", 21));<NEW_LINE>env.milestone(3);<NEW_LINE>assertValues(env, "G1", new Object[][] { { "G1", 10 }, { "G1", 11 } });<NEW_LINE>assertValues(env, "G2", new Object[][] { { "G2", 20 }<MASK><NEW_LINE>env.undeployAll();<NEW_LINE>} | , { "G2", 21 } }); |
1,007,210 | public CompletionStage<Void> receive(Message<String> message) throws InterruptedException {<NEW_LINE>Thread.sleep(WORK_TIME);<NEW_LINE>ReceivedMessage status = new ReceivedMessage(message.getPayload());<NEW_LINE>messages.add(status);<NEW_LINE>System.out.println("Bean received message " + message.getPayload());<NEW_LINE>executor.schedule(() -> {<NEW_LINE>System.out.println("Bean acking message " + message.getPayload());<NEW_LINE>message.ack().handle((r, t) -> {<NEW_LINE>if (t == null) {<NEW_LINE>System.out.println("Bean successfully acked message " + message.getPayload());<NEW_LINE>status.ackStatus.set(AckStatus.ACK_SUCCESS);<NEW_LINE>if (status.number == FINAL_MESSAGE_NUMBER) {<NEW_LINE>paritionsFinished.countDown();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>System.out.println(<MASK><NEW_LINE>status.ackStatus.set(AckStatus.ACK_FAILED);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>});<NEW_LINE>}, ACK_TIME, TimeUnit.MILLISECONDS);<NEW_LINE>return CompletableFuture.completedFuture(null);<NEW_LINE>} | "Bean failed to ack message " + message.getPayload()); |
958,482 | private static Attributes storeTo(CompressionRule rule, BasicAttributes attrs) {<NEW_LINE>attrs.put("objectclass", "dcmCompressionRule");<NEW_LINE>attrs.put("cn", rule.getCommonName());<NEW_LINE>LdapUtils.storeNotEmpty(attrs, "dcmPhotometricInterpretation", rule.getPhotometricInterpretations());<NEW_LINE>LdapUtils.storeNotEmpty(attrs, "dcmBitsStored", rule.getBitsStored());<NEW_LINE>LdapUtils.storeNotDef(attrs, "dcmPixelRepresentation", rule.getPixelRepresentation(), -1);<NEW_LINE>LdapUtils.storeNotEmpty(attrs, <MASK><NEW_LINE>LdapUtils.storeNotEmpty(attrs, "dcmSOPClass", rule.getSOPClasses());<NEW_LINE>LdapUtils.storeNotEmpty(attrs, "dcmBodyPartExamined", rule.getBodyPartExamined());<NEW_LINE>attrs.put("dicomTransferSyntax", rule.getTransferSyntax());<NEW_LINE>LdapUtils.storeNotEmpty(attrs, "dcmImageWriteParam", rule.getImageWriteParams());<NEW_LINE>return attrs;<NEW_LINE>} | "dcmAETitle", rule.getAETitles()); |
1,306,761 | public void onConnectionLocalOpen(Event event) {<NEW_LINE>Connection connection = event.getConnection();<NEW_LINE>if (connection.getRemoteState() != EndpointState.UNINITIALIZED) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Transport transport = Proton.transport();<NEW_LINE>// To detect connection drops in worst case in idleTimeout, which otherwise can take a non deterministic<NEW_LINE>// amount of time to get detected. In practice, we saw 15-20 minutes, on Linux docker containers when<NEW_LINE>// simulating packet drops with iptables rules.<NEW_LINE><MASK><NEW_LINE>// We are creating transport, we should also set the max frame size<NEW_LINE>// Only if transport is created by qpid handler will it set max frame size from reactor options.<NEW_LINE>transport.setMaxFrameSize(event.getReactor().getOptions().getMaxFrameSize());<NEW_LINE>transport.sasl();<NEW_LINE>transport.setEmitFlowEventOnSend(false);<NEW_LINE>transport.bind(connection);<NEW_LINE>} | transport.setIdleTimeout(AmqpConstants.TRANSPORT_IDLE_TIMEOUT_MILLIS); |
290,045 | private void queueRetry(List<QCMutation> mutations, HostAndPort server) {<NEW_LINE>if (timeout < Long.MAX_VALUE) {<NEW_LINE><MASK><NEW_LINE>ArrayList<QCMutation> mutations2 = new ArrayList<>(mutations.size());<NEW_LINE>for (QCMutation qcm : mutations) {<NEW_LINE>qcm.resetDelay();<NEW_LINE>if (time + qcm.getDelay(MILLISECONDS) > qcm.entryTime + timeout) {<NEW_LINE>TimedOutException toe;<NEW_LINE>if (server != null)<NEW_LINE>toe = new TimedOutException(Collections.singleton(server.toString()));<NEW_LINE>else<NEW_LINE>toe = new TimedOutException("Conditional mutation timed out");<NEW_LINE>qcm.queueResult(new Result(toe, qcm, (server == null ? null : server.toString())));<NEW_LINE>} else {<NEW_LINE>mutations2.add(qcm);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!mutations2.isEmpty())<NEW_LINE>failedMutations.addAll(mutations2);<NEW_LINE>} else {<NEW_LINE>mutations.forEach(QCMutation::resetDelay);<NEW_LINE>failedMutations.addAll(mutations);<NEW_LINE>}<NEW_LINE>} | long time = System.currentTimeMillis(); |
1,692,583 | final AttachThingPrincipalResult executeAttachThingPrincipal(AttachThingPrincipalRequest attachThingPrincipalRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(attachThingPrincipalRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<AttachThingPrincipalRequest> request = null;<NEW_LINE>Response<AttachThingPrincipalResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new AttachThingPrincipalRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(attachThingPrincipalRequest));<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, "IoT");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "AttachThingPrincipal");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<AttachThingPrincipalResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new AttachThingPrincipalResultJsonUnmarshaller());<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
582,675 | protected void drawIcon(Graphics g, Icon icon) {<NEW_LINE>Insets i = getInsets();<NEW_LINE>if (i != null) {<NEW_LINE>drawX = i.left;<NEW_LINE>drawY = i.top;<NEW_LINE>} else {<NEW_LINE>drawX = 0;<NEW_LINE>drawY = 0;<NEW_LINE>}<NEW_LINE>if (icon != null) {<NEW_LINE>if (g != null) {<NEW_LINE>icon.paintIcon(this, g, drawX, drawY);<NEW_LINE>}<NEW_LINE>drawX += icon.getIconWidth() + iconTextGap;<NEW_LINE>drawHeight = Math.max(<MASK><NEW_LINE>} else {<NEW_LINE>int extraPaintGap = completionItem.getExtraPaintGap();<NEW_LINE>drawX += extraPaintGap + iconTextGap;<NEW_LINE>drawHeight = fontHeight;<NEW_LINE>}<NEW_LINE>if (i != null) {<NEW_LINE>drawHeight += i.bottom;<NEW_LINE>}<NEW_LINE>drawHeight += drawY;<NEW_LINE>drawY += ascent;<NEW_LINE>} | fontHeight, icon.getIconHeight()); |
929,570 | public void emitIf(final IfNode x) {<NEW_LINE>Logger.traceBuildLIR(Logger.BACKEND.OpenCL, "emitIf: %s, condition=%s\n", x, x.condition().getClass().getName());<NEW_LINE>final LabelRef falseBranch = getLIRBlock(x.falseSuccessor());<NEW_LINE>if (falseBranch.getTargetBlock().isExceptionEntry()) {<NEW_LINE>Logger.traceBuildLIR(Logger.BACKEND.OpenCL, "emitExceptionEntry");<NEW_LINE>shouldNotReachHere("exceptions are unimplemented");<NEW_LINE>}<NEW_LINE>final boolean isLoop = gen.getCurrentBlock().isLoopHeader();<NEW_LINE>final boolean invertedLoop = isLoop && x.trueSuccessor() instanceof LoopExitNode;<NEW_LINE>final Value condition = (invertedLoop) ? emitNegatedLogicNode(x.condition()) : <MASK><NEW_LINE>Logger.traceBuildLIR(Logger.BACKEND.OpenCL, "condition: %s -> %s", x.condition(), condition);<NEW_LINE>if (isLoop) {<NEW_LINE>// HERE NEED TO ADD THE PRAGMA UNROLL<NEW_LINE>append(new OCLControlFlow.LoopConditionOp(condition));<NEW_LINE>} else if (elseClause) {<NEW_LINE>append(new OCLControlFlow.LinkedConditionalBranchOp(condition));<NEW_LINE>} else {<NEW_LINE>Value operand = operand(x.condition());<NEW_LINE>Variable newVariable = getGen().newVariable(operand.getValueKind());<NEW_LINE>append(new AssignStmt(newVariable, operand));<NEW_LINE>append(new OCLControlFlow.ConditionalBranchOp(newVariable));<NEW_LINE>}<NEW_LINE>} | emitLogicNode(x.condition()); |
138,636 | private void positionViews() {<NEW_LINE>LayoutParams layoutParams = (LayoutParams) getLayoutParams();<NEW_LINE>layoutParams.setMargins(0, 0, 0, 0);<NEW_LINE>setLayoutParams(layoutParams);<NEW_LINE>// FloatingWidgetView layout is forced LTR<NEW_LINE>mBackgroundView.setTranslationX(mBackgroundPosition.left);<NEW_LINE>mBackgroundView.setTranslationY(mBackgroundPosition.top + mIconOffsetY);<NEW_LINE>LayoutParams backgroundParams = (LayoutParams) mBackgroundView.getLayoutParams();<NEW_LINE>backgroundParams.leftMargin = 0;<NEW_LINE>backgroundParams.topMargin = 0;<NEW_LINE>backgroundParams.width = (int) mBackgroundPosition.width();<NEW_LINE>backgroundParams.height = (int) mBackgroundPosition.height();<NEW_LINE>mBackgroundView.setLayoutParams(backgroundParams);<NEW_LINE>if (mForegroundOverlayView != null) {<NEW_LINE>sTmpMatrix.reset();<NEW_LINE>float foregroundScale = mBackgroundPosition.width() / mAppWidgetBackgroundView.getWidth();<NEW_LINE>sTmpMatrix.setTranslate(-mBackgroundOffset.left - mAppWidgetView.getLeft(), -mBackgroundOffset.top - mAppWidgetView.getTop());<NEW_LINE><MASK><NEW_LINE>sTmpMatrix.postTranslate(mBackgroundPosition.left, mBackgroundPosition.top + mIconOffsetY);<NEW_LINE>mForegroundOverlayView.setMatrix(sTmpMatrix);<NEW_LINE>}<NEW_LINE>} | sTmpMatrix.postScale(foregroundScale, foregroundScale); |
153,445 | public Intent executeApi(Intent data, InputStream is, OutputStream os) {<NEW_LINE>ParcelFileDescriptor input = null;<NEW_LINE>ParcelFileDescriptor output = null;<NEW_LINE>try {<NEW_LINE>if (is != null) {<NEW_LINE>input = ParcelFileDescriptorUtil.pipeFrom(is);<NEW_LINE>}<NEW_LINE>Thread pumpThread = null;<NEW_LINE>int outputPipeId = 0;<NEW_LINE>if (os != null) {<NEW_LINE>outputPipeId = mPipeIdGen.incrementAndGet();<NEW_LINE>output = mService.createOutputPipe(outputPipeId);<NEW_LINE>pumpThread = ParcelFileDescriptorUtil.pipeTo(os, output);<NEW_LINE>}<NEW_LINE>Intent result = executeApi(data, input, outputPipeId);<NEW_LINE>// wait for ALL data being pumped from remote side<NEW_LINE>if (pumpThread != null) {<NEW_LINE>pumpThread.join();<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} catch (Exception e) {<NEW_LINE>Timber.e(e, "Exception in executeApi call");<NEW_LINE>Intent result = new Intent();<NEW_LINE><MASK><NEW_LINE>result.putExtra(RESULT_ERROR, new OpenPgpError(OpenPgpError.CLIENT_SIDE_ERROR, e.getMessage()));<NEW_LINE>return result;<NEW_LINE>} finally {<NEW_LINE>closeLoudly(output);<NEW_LINE>}<NEW_LINE>} | result.putExtra(RESULT_CODE, RESULT_CODE_ERROR); |
389,663 | final DescribeEventsResult executeDescribeEvents(DescribeEventsRequest describeEventsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeEventsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeEventsRequest> request = null;<NEW_LINE>Response<DescribeEventsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeEventsRequestMarshaller().marshall(super.beforeMarshalling(describeEventsRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeEvents");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DescribeEventsResult> responseHandler = new StaxResponseHandler<DescribeEventsResult>(new DescribeEventsResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.SERVICE_ID, "Redshift"); |
381,661 | public void process(T gray, GrayU8 binary) {<NEW_LINE>detector.process(gray, binary);<NEW_LINE>if (refineGray != null)<NEW_LINE>refineGray.setImage(gray);<NEW_LINE>edgeIntensity.setImage(gray);<NEW_LINE><MASK><NEW_LINE>DogArray<DetectPolygonFromContour.Info> detections = detector.getFoundInfo();<NEW_LINE>if (adjustForBias != null) {<NEW_LINE>int minSides = getMinimumSides();<NEW_LINE>for (int i = detections.size() - 1; i >= 0; i--) {<NEW_LINE>Polygon2D_F64 p = detections.get(i).polygon;<NEW_LINE>adjustForBias.process(p, detector.isOutputClockwiseUpY());<NEW_LINE>// When the polygon is adjusted for bias a point might need to be removed because it's<NEW_LINE>// almost parallel. This could cause the shape to have too few corners and needs to be removed.<NEW_LINE>if (p.size() < minSides)<NEW_LINE>detections.remove(i);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>long time1 = System.nanoTime();<NEW_LINE>double milli = (time1 - time0) * 1e-6;<NEW_LINE>milliAdjustBias.update(milli);<NEW_LINE>// System.out.printf(" contour %7.2f shapes %7.2f adjust_bias %7.2f\n",<NEW_LINE>// detector.getMilliShapes(),detector.getMilliShapes(),milliAdjustBias);<NEW_LINE>} | long time0 = System.nanoTime(); |
1,824,381 | static void pollCheckAppContextLocal(final Locale destLocale, final int index, final Utils.Consumer<Boolean> consumer) {<NEW_LINE>Resources appResources = Utils.getApp().getResources();<NEW_LINE><MASK><NEW_LINE>Locale appLocal = getLocal(appConfig);<NEW_LINE>setLocal(appConfig, destLocale);<NEW_LINE>Utils.getApp().getResources().updateConfiguration(appConfig, appResources.getDisplayMetrics());<NEW_LINE>if (consumer == null)<NEW_LINE>return;<NEW_LINE>if (isSameLocale(appLocal, destLocale)) {<NEW_LINE>consumer.accept(true);<NEW_LINE>} else {<NEW_LINE>if (index < 20) {<NEW_LINE>UtilsBridge.runOnUiThreadDelayed(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>pollCheckAppContextLocal(destLocale, index + 1, consumer);<NEW_LINE>}<NEW_LINE>}, 16);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Log.e("LanguageUtils", "appLocal didn't update.");<NEW_LINE>consumer.accept(false);<NEW_LINE>}<NEW_LINE>} | Configuration appConfig = appResources.getConfiguration(); |
622,488 | public static DataSet<FastDistanceMatrixData> initKmeansCentroids(DataSet<FastDistanceVectorData> data, FastDistance distance, Params params, DataSet<Integer> vectorSize, int seed) {<NEW_LINE>final InitMode initMode = params.get(KMeansTrainParams.INIT_MODE);<NEW_LINE>final int initSteps = <MASK><NEW_LINE>final int k = params.get(KMeansTrainParams.K);<NEW_LINE>DataSet<FastDistanceMatrixData> initCentroid;<NEW_LINE>switch(initMode) {<NEW_LINE>case RANDOM:<NEW_LINE>{<NEW_LINE>initCentroid = randomInit(data, k, distance, vectorSize, seed);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case K_MEANS_PARALLEL:<NEW_LINE>{<NEW_LINE>initCentroid = kMeansPlusPlusInit(data, k, initSteps, distance, vectorSize, seed);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>{<NEW_LINE>throw new IllegalArgumentException("Unknown init mode: " + initMode);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return initCentroid;<NEW_LINE>} | params.get(KMeansTrainParams.INIT_STEPS); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.