idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
932,510 | void addLocalNotification(JSONArray data, CallbackContext callbackContext) throws JSONException {<NEW_LINE>int builderId = data.getInt(0);<NEW_LINE>String content = data.getString(1);<NEW_LINE>String title = data.getString(2);<NEW_LINE>int notificationID = data.getInt(3);<NEW_LINE>int broadcastTime = data.getInt(4);<NEW_LINE>String extrasStr = data.isNull(5) ? "" : data.getString(5);<NEW_LINE>JSONObject extras = new JSONObject();<NEW_LINE>if (!extrasStr.isEmpty()) {<NEW_LINE>extras = new JSONObject(extrasStr);<NEW_LINE>}<NEW_LINE>JPushLocalNotification ln = new JPushLocalNotification();<NEW_LINE>ln.setBuilderId(builderId);<NEW_LINE>ln.setContent(content);<NEW_LINE>ln.setTitle(title);<NEW_LINE>ln.setNotificationId(notificationID);<NEW_LINE>ln.setBroadcastTime(System.currentTimeMillis() + broadcastTime);<NEW_LINE>ln.<MASK><NEW_LINE>JPushInterface.addLocalNotification(this.cordova.getActivity(), ln);<NEW_LINE>} | setExtras(extras.toString()); |
436,273 | public boolean process(@Nonnull VirtualFile file, IntList list) {<NEW_LINE>for (int i = 0, len = list.size(); i < len; i += 2) {<NEW_LINE>ProgressManager.checkCanceled();<NEW_LINE>if (list.get(i + 1) != myHash2)<NEW_LINE>continue;<NEW_LINE>int offset = list.get(i);<NEW_LINE>if (myFileIndex.isInSourceContent(virtualFile)) {<NEW_LINE>if (!myFileIndex.isInSourceContent(file))<NEW_LINE>return true;<NEW_LINE>if (!TestSourcesFilter.isTestSources(virtualFile, project) && TestSourcesFilter.isTestSources(file, project))<NEW_LINE>return true;<NEW_LINE>if (mySkipGeneratedCode) {<NEW_LINE>if (!myFileWithinGeneratedCode && GeneratedSourcesFilter.isGeneratedSourceByAnyFilter(file, project))<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>} else if (myFileIndex.isInSourceContent(file)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>final int startOffset = getStartOffset(myNode);<NEW_LINE>final int endOffset = getEndOffset(myNode);<NEW_LINE>if (file.equals(virtualFile) && offset >= startOffset && offset < endOffset)<NEW_LINE>continue;<NEW_LINE>PsiElement target = getPsi(myNode);<NEW_LINE>TextRange rangeInElement = getRangeInElement(myNode);<NEW_LINE>Integer fragmentStartOffsetInteger = startOffset;<NEW_LINE>SortedMap<Integer, TextRange> map = reportedRanges.subMap(fragmentStartOffsetInteger, endOffset);<NEW_LINE>int newFragmentSize = !map.isEmpty() ? 0 : 1;<NEW_LINE>Iterator<Integer> iterator = map.keySet().iterator();<NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>Integer next = iterator.next();<NEW_LINE>iterator.remove();<NEW_LINE>reportedFiles.remove(next);<NEW_LINE>reportedOffsetInOtherFiles.remove(next);<NEW_LINE>reportedPsi.remove(next);<NEW_LINE>newFragmentSize += fragmentSize.remove(next);<NEW_LINE>}<NEW_LINE>reportedRanges.put(fragmentStartOffsetInteger, rangeInElement);<NEW_LINE>reportedFiles.put(fragmentStartOffsetInteger, file);<NEW_LINE>reportedOffsetInOtherFiles.put(fragmentStartOffsetInteger, offset);<NEW_LINE><MASK><NEW_LINE>fragmentSize.put(fragmentStartOffsetInteger, newFragmentSize);<NEW_LINE>if (newFragmentSize >= MIN_FRAGMENT_SIZE || isLightProfile()) {<NEW_LINE>fragmentHash.put(fragmentStartOffsetInteger, (myHash & 0xFFFFFFFFL) | ((long) myHash2 << 32));<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | reportedPsi.put(fragmentStartOffsetInteger, target); |
569,575 | public void init(PinotConfiguration serverConf) throws Exception {<NEW_LINE>// Make a clone so that changes to the config won't propagate to the caller<NEW_LINE>_serverConf = serverConf.clone();<NEW_LINE>_zkAddress = _serverConf.getProperty(CommonConstants.Helix.CONFIG_OF_ZOOKEEPR_SERVER);<NEW_LINE>_helixClusterName = _serverConf.getProperty(CommonConstants.Helix.CONFIG_OF_CLUSTER_NAME);<NEW_LINE>ServiceStartableUtils.applyClusterConfig(_serverConf, _zkAddress, _helixClusterName, ServiceRole.SERVER);<NEW_LINE>setupHelixSystemProperties();<NEW_LINE>_listenerConfigs = ListenerConfigUtil.buildServerAdminConfigs(_serverConf);<NEW_LINE>_hostname = _serverConf.getProperty(Helix.KEY_OF_SERVER_NETTY_HOST, _serverConf.getProperty(Helix.SET_INSTANCE_ID_TO_HOSTNAME_KEY, false) ? NetUtils.getHostnameOrAddress() : NetUtils.getHostAddress());<NEW_LINE>_port = _serverConf.getProperty(Helix.KEY_OF_SERVER_NETTY_PORT, Helix.DEFAULT_SERVER_NETTY_PORT);<NEW_LINE>_instanceId = _serverConf.getProperty(Server.CONFIG_OF_INSTANCE_ID);<NEW_LINE>if (_instanceId != null) {<NEW_LINE>// NOTE:<NEW_LINE>// - Force all instances to have the same prefix in order to derive the instance type based on the instance id<NEW_LINE>// - Only log a warning instead of throw exception here for backward-compatibility<NEW_LINE>if (!_instanceId.startsWith(Helix.PREFIX_OF_SERVER_INSTANCE)) {<NEW_LINE>LOGGER.warn("Instance id '{}' does not have prefix '{}'", _instanceId, Helix.PREFIX_OF_SERVER_INSTANCE);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>_instanceId = Helix.PREFIX_OF_SERVER_INSTANCE + _hostname + "_" + _port;<NEW_LINE>// NOTE: Need to add the instance id to the config because it is required in HelixInstanceDataManagerConfig<NEW_LINE>_serverConf.addProperty(Server.CONFIG_OF_INSTANCE_ID, _instanceId);<NEW_LINE>}<NEW_LINE>_instanceConfigScope = new HelixConfigScopeBuilder(ConfigScopeProperty.PARTICIPANT, _helixClusterName).forParticipant(_instanceId).build();<NEW_LINE>// Initialize Pinot Environment Provider<NEW_LINE>_pinotEnvironmentProvider = initializePinotEnvironmentProvider();<NEW_LINE>// Enable/disable thread CPU time measurement through instance config.<NEW_LINE>ThreadTimer.setThreadCpuTimeMeasurementEnabled(_serverConf.getProperty(Server.CONFIG_OF_ENABLE_THREAD_CPU_TIME_MEASUREMENT, Server.DEFAULT_ENABLE_THREAD_CPU_TIME_MEASUREMENT));<NEW_LINE>// Set data table version send to broker.<NEW_LINE>DataTableBuilder.setCurrentDataTableVersion(_serverConf.getProperty(Server<MASK><NEW_LINE>LOGGER.info("Initializing Helix manager with zkAddress: {}, clusterName: {}, instanceId: {}", _zkAddress, _helixClusterName, _instanceId);<NEW_LINE>_helixManager = HelixManagerFactory.getZKHelixManager(_helixClusterName, _instanceId, InstanceType.PARTICIPANT, _zkAddress);<NEW_LINE>} | .CONFIG_OF_CURRENT_DATA_TABLE_VERSION, Server.DEFAULT_CURRENT_DATA_TABLE_VERSION)); |
1,094,115 | @JSONP<NEW_LINE>@NoCache<NEW_LINE>@Consumes(MediaType.APPLICATION_JSON)<NEW_LINE>@Produces({ MediaType.APPLICATION_JSON, "application/javascript" })<NEW_LINE>public Response updateFieldVariableByFieldVar(@PathParam("typeId") final String typeId, @PathParam("fieldVar") final String fieldVar, @PathParam("fieldVarId") final String fieldVarId, final String fieldVariableJson, @Context final HttpServletRequest req, @Context final HttpServletResponse res) throws DotDataException {<NEW_LINE>final InitDataObject initData = this.webResource.init(null, req, res, false, null);<NEW_LINE>final User user = initData.getUser();<NEW_LINE>final FieldAPI fapi = APILocator.getContentTypeFieldAPI();<NEW_LINE>Response response = null;<NEW_LINE>try {<NEW_LINE>Field field = fapi.byContentTypeIdAndVar(typeId, fieldVar);<NEW_LINE>FieldVariable fieldVariable = new JsonFieldVariableTransformer(fieldVariableJson).from();<NEW_LINE>if (!UtilMethods.isSet(fieldVariable.id())) {<NEW_LINE>response = ExceptionMapperUtil.createResponse(null, "Field 'id' should be set");<NEW_LINE>} else if (!UtilMethods.isSet(fieldVariable.fieldId()) || !fieldVariable.fieldId().equals(field.id())) {<NEW_LINE>response = ExceptionMapperUtil.createResponse(null, "Field fieldId '" + fieldVariable.fieldId() + "' does not match a field with id '" + <MASK><NEW_LINE>} else {<NEW_LINE>FieldVariable currentFieldVariable = getFieldVariable(field, fieldVarId);<NEW_LINE>if (!currentFieldVariable.id().equals(fieldVariable.id())) {<NEW_LINE>response = ExceptionMapperUtil.createResponse(null, "Field variable id '" + fieldVarId + "' does not match a field variable with id '" + fieldVariable.id() + "'");<NEW_LINE>} else {<NEW_LINE>fieldVariable = fapi.save(fieldVariable, user);<NEW_LINE>response = Response.ok(new ResponseEntityView(new JsonFieldVariableTransformer(fieldVariable).mapObject())).build();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (DotStateException e) {<NEW_LINE>response = ExceptionMapperUtil.createResponse(null, "Field variable is not valid (" + e.getMessage() + ")");<NEW_LINE>} catch (NotFoundInDbException e) {<NEW_LINE>response = ExceptionMapperUtil.createResponse(e, Response.Status.NOT_FOUND);<NEW_LINE>} catch (DotSecurityException e) {<NEW_LINE>throw new ForbiddenException(e);<NEW_LINE>} catch (Exception e) {<NEW_LINE>response = ExceptionMapperUtil.createResponse(e, Response.Status.INTERNAL_SERVER_ERROR);<NEW_LINE>}<NEW_LINE>return response;<NEW_LINE>} | field.id() + "'"); |
1,605,364 | private static TrustManager[] buildSecureTrustManager(String trustCertPath) throws SSLException {<NEW_LINE>TrustManagerFactory selfTmf;<NEW_LINE>InputStream in = null;<NEW_LINE>try {<NEW_LINE>String algorithm = TrustManagerFactory.getDefaultAlgorithm();<NEW_LINE><MASK><NEW_LINE>KeyStore trustKeyStore = KeyStore.getInstance("JKS");<NEW_LINE>trustKeyStore.load(null, null);<NEW_LINE>in = new FileInputStream(trustCertPath);<NEW_LINE>CertificateFactory cf = CertificateFactory.getInstance("X.509");<NEW_LINE>Collection<X509Certificate> certs = (Collection<X509Certificate>) cf.generateCertificates(in);<NEW_LINE>int count = 0;<NEW_LINE>for (Certificate cert : certs) {<NEW_LINE>trustKeyStore.setCertificateEntry("cert-" + (count++), cert);<NEW_LINE>}<NEW_LINE>selfTmf.init(trustKeyStore);<NEW_LINE>return selfTmf.getTrustManagers();<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error("build client trustManagerFactory failed", e);<NEW_LINE>throw new SSLException(e);<NEW_LINE>} finally {<NEW_LINE>IoUtils.closeQuietly(in);<NEW_LINE>}<NEW_LINE>} | selfTmf = TrustManagerFactory.getInstance(algorithm); |
598,418 | final SendBounceResult executeSendBounce(SendBounceRequest sendBounceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(sendBounceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<SendBounceRequest> request = null;<NEW_LINE>Response<SendBounceResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new SendBounceRequestMarshaller().marshall(super.beforeMarshalling(sendBounceRequest));<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, "SES");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "SendBounce");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<SendBounceResult> responseHandler = new StaxResponseHandler<SendBounceResult>(new SendBounceResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
1,334,117 | private void processCodeItem(DexHeader header, ClassDefItem item, EncodedMethod method, MethodIDItem methodID) throws DuplicateNameException, IOException, Exception {<NEW_LINE>if (method.getCodeOffset() > 0) {<NEW_LINE>Address codeAddress = baseAddress.add(DexUtil.adjustOffset(method.getCodeOffset(), header));<NEW_LINE>CodeItem codeItem = method.getCodeItem();<NEW_LINE>StringBuilder builder = new StringBuilder();<NEW_LINE>builder.append(DexUtil.convertTypeIndexToString(header, item.getClassIndex()) + " " + DexUtil.convertToString(header, methodID.getNameIndex()) + "\n");<NEW_LINE>if (codeItem != null) {<NEW_LINE>builder.append("\n");<NEW_LINE>builder.append("Instruction Bytes: 0x" + Integer.toHexString(codeItem.getInstructionBytes().length) + "\n");<NEW_LINE>builder.append("Registers Size: 0x" + Integer.toHexString(codeItem.getRegistersSize()) + "\n");<NEW_LINE>builder.append("Incoming Size: 0x" + Integer.toHexString(codeItem.getIncomingSize()) + "\n");<NEW_LINE>builder.append("Outgoing Size: 0x" + Integer.toHexString(codeItem.getOutgoingSize()) + "\n");<NEW_LINE>builder.append("Tries Size: 0x" + Integer.toHexString(codeItem<MASK><NEW_LINE>}<NEW_LINE>if (codeItem instanceof CDexCodeItem) {<NEW_LINE>CDexCodeItem cdexCodeItem = (CDexCodeItem) codeItem;<NEW_LINE>builder.append("\n" + (cdexCodeItem.hasPreHeader() ? "PREHEADER" : ""));<NEW_LINE>}<NEW_LINE>api.setPlateComment(codeAddress, builder.toString());<NEW_LINE>if (codeItem != null) {<NEW_LINE>// external<NEW_LINE>DataType codeItemDataType = codeItem.toDataType();<NEW_LINE>try {<NEW_LINE>api.createData(codeAddress, codeItemDataType);<NEW_LINE>int codeItemDataTypeLength = codeItemDataType.getLength();<NEW_LINE>fragmentManager.codeItemAddressSet.add(codeAddress, codeAddress.add(codeItemDataTypeLength - 1));<NEW_LINE>Address tempAddress = codeAddress.add(codeItemDataTypeLength);<NEW_LINE>tempAddress = processCodeItemTrys(tempAddress, codeItem);<NEW_LINE>processCodeItemHandlers(codeItem, tempAddress);<NEW_LINE>} catch (Exception e) {<NEW_LINE>// happens when "padding" member has been removed, so struct won't fit<NEW_LINE>// just ignore it<NEW_LINE>}<NEW_LINE>if (codeItem.getDebugInfoOffset() > 0) {<NEW_LINE>Address debugAddress = baseAddress.add(codeItem.getDebugInfoOffset());<NEW_LINE>DebugInfoItem debug = codeItem.getDebugInfo();<NEW_LINE>DataType debugDataType = debug.toDataType();<NEW_LINE>api.createData(debugAddress, debugDataType);<NEW_LINE>fragmentManager.debugInfoAddressSet.add(debugAddress, debugAddress.add(debugDataType.getLength() - 1));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getTriesSize()) + "\n"); |
1,325,599 | public RoaringBitmap compare(BitmapSliceIndex.Operation operation, int startOrValue, int end, RoaringBitmap foundSet) {<NEW_LINE>// todo whether we need this or not?<NEW_LINE>if (startOrValue > this.maxValue || (end > 0 && end < this.minValue)) {<NEW_LINE>return new RoaringBitmap();<NEW_LINE>}<NEW_LINE>startOrValue = startOrValue == 0 ? 1 : startOrValue;<NEW_LINE>switch(operation) {<NEW_LINE>case EQ:<NEW_LINE>return oNeilCompare(<MASK><NEW_LINE>case NEQ:<NEW_LINE>return oNeilCompare(Operation.NEQ, startOrValue, foundSet);<NEW_LINE>case GE:<NEW_LINE>return oNeilCompare(Operation.GE, startOrValue, foundSet);<NEW_LINE>case GT:<NEW_LINE>{<NEW_LINE>return oNeilCompare(BitmapSliceIndex.Operation.GT, startOrValue, foundSet);<NEW_LINE>}<NEW_LINE>case LT:<NEW_LINE>return oNeilCompare(BitmapSliceIndex.Operation.LT, startOrValue, foundSet);<NEW_LINE>case LE:<NEW_LINE>return oNeilCompare(BitmapSliceIndex.Operation.LE, startOrValue, foundSet);<NEW_LINE>case RANGE:<NEW_LINE>{<NEW_LINE>RoaringBitmap left = oNeilCompare(Operation.GE, startOrValue, foundSet);<NEW_LINE>RoaringBitmap right = oNeilCompare(BitmapSliceIndex.Operation.LE, end, foundSet);<NEW_LINE>return RoaringBitmap.and(left, right);<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>throw new IllegalArgumentException("not support operation!");<NEW_LINE>}<NEW_LINE>} | Operation.EQ, startOrValue, foundSet); |
290,309 | private void openReadOnlyFile(TaskMonitor monitor) {<NEW_LINE>String fileDescr = ((version != DomainFile.DEFAULT_VERSION) ? "version " + version + " of " : "") + domainFile.getName();<NEW_LINE>String contentType = null;<NEW_LINE>try {<NEW_LINE>monitor.setMessage("Opening " + fileDescr);<NEW_LINE>contentType = domainFile.getContentType();<NEW_LINE>dtArchive = (DataTypeArchive) domainFile.getImmutableDomainObject(this, version, monitor);<NEW_LINE>} catch (CancelledException e) {<NEW_LINE>// we don't care, the task has been canceled<NEW_LINE>} catch (IOException e) {<NEW_LINE>if (domainFile.isVersioned() && domainFile.isInWritableProject()) {<NEW_LINE>ClientUtil.handleException(AppInfo.getActiveProject().getRepository(), e, "Get Versioned Object", null);<NEW_LINE>} else {<NEW_LINE>Msg.showError(this, null, <MASK><NEW_LINE>}<NEW_LINE>} catch (VersionException e) {<NEW_LINE>VersionExceptionHandler.showVersionError(tool.getToolFrame(), domainFile.getName(), contentType, "Open", e);<NEW_LINE>}<NEW_LINE>} | "Project Archive Open Error", "Error occurred while opening " + fileDescr, e); |
1,654,161 | public CheckResult apply(RoutingContext routingContext, SecurityIdentity identity) {<NEW_LINE>if (identity.isAnonymous()) {<NEW_LINE>PathConfig pathConfig = resolver.getPolicyEnforcer(null).getPathMatcher().matches(routingContext.request().path());<NEW_LINE>if (pathConfig != null && pathConfig.getEnforcementMode() == EnforcementMode.ENFORCING) {<NEW_LINE>return CheckResult.DENY;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>AccessTokenCredential credential = identity.getCredential(AccessTokenCredential.class);<NEW_LINE>if (credential == null) {<NEW_LINE>// SecurityIdentity has been created by the authentication mechanism other than quarkus-oidc<NEW_LINE>return CheckResult.PERMIT;<NEW_LINE>}<NEW_LINE>VertxHttpFacade httpFacade = new VertxHttpFacade(routingContext, credential.getToken(), resolver.getReadTimeout());<NEW_LINE>KeycloakAdapterPolicyEnforcer adapterPolicyEnforcer = new KeycloakAdapterPolicyEnforcer(resolver.getPolicyEnforcer(identity.getAttribute(TENANT_ID_ATTRIBUTE)));<NEW_LINE>AuthorizationContext <MASK><NEW_LINE>if (result.isGranted()) {<NEW_LINE>SecurityIdentity newIdentity = enhanceSecurityIdentity(identity, result);<NEW_LINE>return new CheckResult(true, newIdentity);<NEW_LINE>}<NEW_LINE>return CheckResult.DENY;<NEW_LINE>} | result = adapterPolicyEnforcer.authorize(httpFacade); |
224,257 | public boolean previewSql(EditingTarget editingTarget) {<NEW_LINE>TextEditingTargetCommentHeaderHelper previewSource = new TextEditingTargetCommentHeaderHelper(docDisplay_.<MASK><NEW_LINE>if (!previewSource.hasCommentHeader())<NEW_LINE>return false;<NEW_LINE>if (previewSource.getFunction().length() == 0) {<NEW_LINE>previewSource.setFunction(".rs.previewSql");<NEW_LINE>}<NEW_LINE>previewSource.buildCommand(editingTarget.getPath(), new OperationWithInput<String>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void execute(String command) {<NEW_LINE>server_.previewSql(command, new ServerRequestCallback<String>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onResponseReceived(String message) {<NEW_LINE>if (!StringUtil.isNullOrEmpty(message)) {<NEW_LINE>display_.showErrorMessage(constants_.errorPreviewingSql(), message);<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onError(ServerError error) {<NEW_LINE>Debug.logError(error);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return true;<NEW_LINE>} | getCode(), "preview", "--"); |
1,168,963 | private static Map<Entry<Integer, Integer>, Icon> populateInstances() {<NEW_LINE>// The string keys of these maps aren't currently used, but are useful for debugging.<NEW_LINE>Map<String, Integer> buttonIDs = new LinkedHashMap<String, Integer>();<NEW_LINE>// ViewTabDisplayerUI<NEW_LINE>buttonIDs.put("close", TabControlButton.ID_CLOSE_BUTTON);<NEW_LINE>// buttonIDs.put("slide_right", TabControlButton.ID_SLIDE_RIGHT_BUTTON);<NEW_LINE>// buttonIDs.put("slide_left", TabControlButton.ID_SLIDE_LEFT_BUTTON);<NEW_LINE>// buttonIDs.put("slide_down", TabControlButton.ID_SLIDE_DOWN_BUTTON);<NEW_LINE>buttonIDs.put("pin", TabControlButton.ID_PIN_BUTTON);<NEW_LINE>buttonIDs.<MASK><NEW_LINE>buttonIDs.put("slide_group", TabControlButton.ID_SLIDE_GROUP_BUTTON);<NEW_LINE>// EditorTabDisplayerUI<NEW_LINE>buttonIDs.put("scroll_left", TabControlButton.ID_SCROLL_LEFT_BUTTON);<NEW_LINE>buttonIDs.put("scroll_right", TabControlButton.ID_SCROLL_RIGHT_BUTTON);<NEW_LINE>buttonIDs.put("drop_down", TabControlButton.ID_DROP_DOWN_BUTTON);<NEW_LINE>buttonIDs.put("maximize", TabControlButton.ID_MAXIMIZE_BUTTON);<NEW_LINE>buttonIDs.put("restore", TabControlButton.ID_RESTORE_BUTTON);<NEW_LINE>Map<String, Integer> buttonStates = new LinkedHashMap<String, Integer>();<NEW_LINE>buttonStates.put("default", TabControlButton.STATE_DEFAULT);<NEW_LINE>buttonStates.put("pressed", TabControlButton.STATE_PRESSED);<NEW_LINE>buttonStates.put("disabled", TabControlButton.STATE_DISABLED);<NEW_LINE>buttonStates.put("rollover", TabControlButton.STATE_ROLLOVER);<NEW_LINE>Map<Entry<Integer, Integer>, Icon> ret = new LinkedHashMap<Entry<Integer, Integer>, Icon>();<NEW_LINE>for (Entry<String, Integer> buttonID : buttonIDs.entrySet()) {<NEW_LINE>for (Entry<String, Integer> buttonState : buttonStates.entrySet()) {<NEW_LINE>populateOne(ret, buttonID.getValue(), buttonState.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Effectively immutable upon assignment to the final static variable.<NEW_LINE>return Collections.unmodifiableMap(ret);<NEW_LINE>} | put("restore_group", TabControlButton.ID_RESTORE_GROUP_BUTTON); |
1,056,308 | public final PropertyLineContext propertyLine() throws RecognitionException {<NEW_LINE>PropertyLineContext _localctx = new PropertyLineContext(_ctx, getState());<NEW_LINE><MASK><NEW_LINE>int _la;<NEW_LINE>try {<NEW_LINE>enterOuterAlt(_localctx, 1);<NEW_LINE>{<NEW_LINE>setState(38);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>_la = _input.LA(1);<NEW_LINE>while (_la == Space) {<NEW_LINE>{<NEW_LINE>{<NEW_LINE>setState(35);<NEW_LINE>match(Space);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>setState(40);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>_la = _input.LA(1);<NEW_LINE>}<NEW_LINE>setState(41);<NEW_LINE>keyValuePair();<NEW_LINE>}<NEW_LINE>} catch (RecognitionException re) {<NEW_LINE>_localctx.exception = re;<NEW_LINE>_errHandler.reportError(this, re);<NEW_LINE>_errHandler.recover(this, re);<NEW_LINE>} finally {<NEW_LINE>exitRule();<NEW_LINE>}<NEW_LINE>return _localctx;<NEW_LINE>} | enterRule(_localctx, 4, RULE_propertyLine); |
275,190 | public static <R> Task<R> flatten(final String desc, final Task<Task<R>> task) {<NEW_LINE>ArgumentUtil.requireNotNull(task, "task");<NEW_LINE>Task<R> flattenTask = async(desc, context -> {<NEW_LINE>final SettablePromise<R> result = Promises.settable();<NEW_LINE>context.after(task).run(() -> {<NEW_LINE>try {<NEW_LINE>if (!task.isFailed()) {<NEW_LINE>Task<R> t = task.get();<NEW_LINE>if (t == null) {<NEW_LINE>throw new RuntimeException(desc + " returned null");<NEW_LINE>} else {<NEW_LINE>Promises.propagateResult(t, result);<NEW_LINE>return t;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>result.<MASK><NEW_LINE>}<NEW_LINE>} catch (Throwable t) {<NEW_LINE>result.fail(t);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>});<NEW_LINE>context.run(task);<NEW_LINE>return result;<NEW_LINE>});<NEW_LINE>flattenTask.getShallowTraceBuilder().setTaskType(TaskType.FLATTEN.getName());<NEW_LINE>return flattenTask;<NEW_LINE>} | fail(task.getError()); |
492,854 | private PrivateKey loadPrivateKey(String keyFile) throws IOException, GeneralSecurityException {<NEW_LINE>KeyFactory keyFactory = KeyFactory.getInstance("RSA");<NEW_LINE>try (InputStream is = new FileInputStream(keyFile)) {<NEW_LINE>String content = IOUtils.toString(is, StandardCharsets.UTF_8);<NEW_LINE>content = content.replaceAll("-----(BEGIN|END)( RSA)? PRIVATE KEY-----\\s*", "");<NEW_LINE>byte[] buf = Base64.<MASK><NEW_LINE>try {<NEW_LINE>PKCS8EncodedKeySpec privKeySpec = new PKCS8EncodedKeySpec(buf);<NEW_LINE>return keyFactory.generatePrivate(privKeySpec);<NEW_LINE>} catch (InvalidKeySpecException e) {<NEW_LINE>// old private key is OpenSSL format private key<NEW_LINE>buf = OpenSslKey.convertPrivateKey(buf);<NEW_LINE>PKCS8EncodedKeySpec privKeySpec = new PKCS8EncodedKeySpec(buf);<NEW_LINE>return keyFactory.generatePrivate(privKeySpec);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getMimeDecoder().decode(content); |
1,221,521 | public static boolean addNumberedRegValue(HKEY root, String key, Object data) {<NEW_LINE>try {<NEW_LINE>// Recursively create keys as needed<NEW_LINE>String partialKey = "";<NEW_LINE>for (String section : key.split("\\\\")) {<NEW_LINE>if (partialKey.isEmpty()) {<NEW_LINE>partialKey += section;<NEW_LINE>} else {<NEW_LINE>partialKey += "\\" + section;<NEW_LINE>}<NEW_LINE>if (!Advapi32Util.registryKeyExists(root, partialKey)) {<NEW_LINE>Advapi32Util.registryCreateKey(root, partialKey);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Make sure it doesn't already exist<NEW_LINE>for (Map.Entry<String, Object> entry : Advapi32Util.registryGetValues(root, key).entrySet()) {<NEW_LINE>if (entry.getValue().equals(data)) {<NEW_LINE>log.info("Registry data {}\\\\{}\\\\{} already has {}, skipping.", getHkeyName(root), key, entry.getKey(), data);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Find the next available number and iterate<NEW_LINE>int counter = 0;<NEW_LINE>while (Advapi32Util.registryValueExists(root, key, counter + "")) {<NEW_LINE>counter++;<NEW_LINE>}<NEW_LINE>String value = String.valueOf(counter);<NEW_LINE>if (data instanceof String) {<NEW_LINE>Advapi32Util.registrySetStringValue(root, key, value, (String) data);<NEW_LINE>} else if (data instanceof Integer) {<NEW_LINE>Advapi32Util.registrySetIntValue(root, key, value, (Integer) data);<NEW_LINE>} else {<NEW_LINE>throw new Exception("Registry values of type " + <MASK><NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.error("Could not write numbered registry value at {}\\\\{}", getHkeyName(root), key, e);<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | data.getClass() + " aren't supported"); |
884,588 | public Object calculate(Context ctx) {<NEW_LINE>if (param == null) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("workday" + mm.getMessage("function.missingParam"));<NEW_LINE>}<NEW_LINE>int size = param.getSubSize();<NEW_LINE>if (size != 2 && size != 3) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("workday" + mm.getMessage("function.invalidParam"));<NEW_LINE>}<NEW_LINE>IParam sub1 = param.getSub(0);<NEW_LINE>IParam sub2 = param.getSub(1);<NEW_LINE>if (sub1 == null || sub2 == null) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("workday" + mm.getMessage("function.invalidParam"));<NEW_LINE>}<NEW_LINE>Object result1 = sub1.getLeafExpression().calculate(ctx);<NEW_LINE>Object result2 = sub2.getLeafExpression().calculate(ctx);<NEW_LINE>if (!(result1 instanceof Date) || !(result2 instanceof Number)) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("workday" + mm.getMessage("function.paramTypeError"));<NEW_LINE>}<NEW_LINE>Sequence offDays = null;<NEW_LINE>if (size == 3) {<NEW_LINE>IParam sub3 = param.getSub(2);<NEW_LINE>if (sub3 != null) {<NEW_LINE>Object obj = sub3.getLeafExpression().calculate(ctx);<NEW_LINE>if (obj instanceof Sequence) {<NEW_LINE>offDays = (Sequence) obj;<NEW_LINE>} else if (obj != null) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("workday" + mm.getMessage("function.paramTypeError"));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Date date1 = (Date) result1;<NEW_LINE><MASK><NEW_LINE>calendar.setTime(date1);<NEW_LINE>int diff = ((Number) result2).intValue();<NEW_LINE>int d = 1;<NEW_LINE>if (diff < 0) {<NEW_LINE>d = -1;<NEW_LINE>} else if (diff == 0) {<NEW_LINE>return date1;<NEW_LINE>}<NEW_LINE>while (diff != 0) {<NEW_LINE>calendar.add(Calendar.DATE, d);<NEW_LINE>if (isWorkDay(calendar, offDays))<NEW_LINE>diff -= d;<NEW_LINE>}<NEW_LINE>Date date = (Date) date1.clone();<NEW_LINE>date.setTime(calendar.getTimeInMillis());<NEW_LINE>return date;<NEW_LINE>} | Calendar calendar = Calendar.getInstance(); |
204,784 | private void processHandle(EPStatementAgentInstanceHandle handle, List<NamedWindowConsumerView> value, EventBean[] newData, EventBean[] oldData) {<NEW_LINE>if (InstrumentationHelper.ENABLED) {<NEW_LINE>InstrumentationHelper.get().qNamedWindowCPSingle(exceptionHandlingService.getRuntimeURI(), value.size(), newData, oldData, handle, schedulingService.getTime());<NEW_LINE>}<NEW_LINE>handle.getStatementAgentInstanceLock().acquireWriteLock();<NEW_LINE>try {<NEW_LINE>if (handle.isHasVariables()) {<NEW_LINE>variableService.setLocalVersion();<NEW_LINE>}<NEW_LINE>for (NamedWindowConsumerView consumerView : value) {<NEW_LINE>consumerView.update(newData, oldData);<NEW_LINE>}<NEW_LINE>// internal join processing, if applicable<NEW_LINE>handle.internalDispatch();<NEW_LINE>} catch (RuntimeException ex) {<NEW_LINE>exceptionHandlingService.handleException(ex, handle, ExceptionHandlerExceptionType.PROCESS, null);<NEW_LINE>} finally {<NEW_LINE>if (handle.isHasTableAccess()) {<NEW_LINE>tableManagementService.getTableExprEvaluatorContext().releaseAcquiredLocks();<NEW_LINE>}<NEW_LINE>handle.getStatementAgentInstanceLock().releaseWriteLock();<NEW_LINE>if (InstrumentationHelper.ENABLED) {<NEW_LINE>InstrumentationHelper<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .get().aNamedWindowCPSingle(); |
804,183 | private void showMappingDialog(int canvasKey) {<NEW_LINE>int id = androidToSymbian.indexOfValue(canvasKey);<NEW_LINE>String keyName = "";<NEW_LINE>if (id >= 0) {<NEW_LINE>keyName = KeyEvent.keyCodeToString<MASK><NEW_LINE>}<NEW_LINE>AlertDialog.Builder builder = new AlertDialog.Builder(requireContext()).setTitle(R.string.mapping_dialog_title).setMessage(getString(R.string.mapping_dialog_message, keyName)).setOnKeyListener((dialog, keyCode, event) -> {<NEW_LINE>if (keyCode == KeyEvent.KEYCODE_BACK) {<NEW_LINE>dialog.dismiss();<NEW_LINE>return false;<NEW_LINE>} else {<NEW_LINE>deleteDuplicates(canvasKey);<NEW_LINE>androidToSymbian.put(keyCode, canvasKey);<NEW_LINE>params.keyMappings = androidToSymbian;<NEW_LINE>ProfilesManager.saveConfig(params);<NEW_LINE>dialog.dismiss();<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>builder.show();<NEW_LINE>} | (androidToSymbian.keyAt(id)); |
1,779,704 | protected Object parseResponse(String result, int subModel) {<NEW_LINE>if (result.length() > 1024 * 1024) {<NEW_LINE>String ss = result.substring(0, 100);<NEW_LINE>ss = ss.substring(0, ss.indexOf("item"));<NEW_LINE>boolean bResult = (ss.indexOf("\"errors\":false")) > 0;<NEW_LINE>return bResult;<NEW_LINE>} else if (ImUtils.isJson(result)) {<NEW_LINE>JSONObject jobs = JSONObject.fromString(result);<NEW_LINE><MASK><NEW_LINE>int len = jobs.length();<NEW_LINE>if (len == 1 && itr.hasNext()) {<NEW_LINE>Object line = itr.next();<NEW_LINE>Object vals = jobs.get(line.toString());<NEW_LINE>String vs = vals.toString();<NEW_LINE>return JSONUtil.parseJSON(vs.toCharArray(), 0, vs.length() - 1);<NEW_LINE>} else {<NEW_LINE>return JSONUtil.parseJSON(result.toCharArray(), 0, result.length() - 1);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>List<Object[]> ls = null;<NEW_LINE>if (subModel == 1) {<NEW_LINE>ls = new ArrayList<Object[]>();<NEW_LINE>parseCatJson(result, ls);<NEW_LINE>} else if (subModel == 4) {<NEW_LINE>ls = parseIndex(result);<NEW_LINE>} else {<NEW_LINE>ls = parseInfo(result);<NEW_LINE>}<NEW_LINE>Table tbl = toTable(ls);<NEW_LINE>return tbl;<NEW_LINE>}<NEW_LINE>} | Iterator itr = jobs.keys(); |
1,072,431 | public boolean execute(long timeout) {<NEW_LINE>long startTime = System.currentTimeMillis();<NEW_LINE>JobManager jobManager = ApplicationDependencies.getJobManager();<NEW_LINE>QueueFindingJobListener queueListener = new QueueFindingJobListener();<NEW_LINE>try (IncomingMessageProcessor.Processor processor = ApplicationDependencies.getIncomingMessageProcessor().acquire()) {<NEW_LINE>jobManager.addListener(job -> job.getParameters().getQueue() != null && job.getParameters().getQueue().startsWith(PushProcessMessageJob.QUEUE_PREFIX), queueListener);<NEW_LINE>int jobCount = enqueuePushDecryptJobs(processor, startTime, timeout);<NEW_LINE>if (jobCount == 0) {<NEW_LINE>Log.d(TAG, "No PushDecryptMessageJobs were enqueued.");<NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>Log.d(TAG, jobCount + " PushDecryptMessageJob(s) were enqueued.");<NEW_LINE>}<NEW_LINE>long timeRemainingMs = blockUntilQueueDrained(PushDecryptMessageJob.QUEUE, TimeUnit.SECONDS.toMillis(10));<NEW_LINE>Set<String> processQueues = queueListener.getQueues();<NEW_LINE>Log.d(TAG, "Discovered " + processQueues.size() + " queue(s): " + processQueues);<NEW_LINE>if (timeRemainingMs > 0) {<NEW_LINE>Iterator<String<MASK><NEW_LINE>while (iter.hasNext() && timeRemainingMs > 0) {<NEW_LINE>timeRemainingMs = blockUntilQueueDrained(iter.next(), timeRemainingMs);<NEW_LINE>}<NEW_LINE>if (timeRemainingMs <= 0) {<NEW_LINE>Log.w(TAG, "Ran out of time while waiting for queues to drain.");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Log.w(TAG, "Ran out of time before we could even wait on individual queues!");<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} catch (IOException e) {<NEW_LINE>Log.w(TAG, "Failed to retrieve messages. Resetting the SignalServiceMessageReceiver.", e);<NEW_LINE>ApplicationDependencies.resetSignalServiceMessageReceiver();<NEW_LINE>return false;<NEW_LINE>} finally {<NEW_LINE>jobManager.removeListener(queueListener);<NEW_LINE>}<NEW_LINE>} | > iter = processQueues.iterator(); |
1,667,891 | public void build(final String tokenizerName, final TokenizerFactory tokenizerFactory, final Map<String, CharFilterFactory> charFilters, final Map<String, TokenFilterFactory> tokenFilters) {<NEW_LINE>if (analyzerSettings.get("tokenizer") != null) {<NEW_LINE>throw new IllegalArgumentException(<MASK><NEW_LINE>}<NEW_LINE>List<String> charFilterNames = analyzerSettings.getAsList("char_filter");<NEW_LINE>List<CharFilterFactory> charFiltersList = new ArrayList<>(charFilterNames.size());<NEW_LINE>for (String charFilterName : charFilterNames) {<NEW_LINE>CharFilterFactory charFilter = charFilters.get(charFilterName);<NEW_LINE>if (charFilter == null) {<NEW_LINE>throw new IllegalArgumentException("Custom normalizer [" + name() + "] failed to find char_filter under name [" + charFilterName + "]");<NEW_LINE>}<NEW_LINE>if (charFilter instanceof MultiTermAwareComponent == false) {<NEW_LINE>throw new IllegalArgumentException("Custom normalizer [" + name() + "] may not use char filter [" + charFilterName + "]");<NEW_LINE>}<NEW_LINE>charFilter = (CharFilterFactory) ((MultiTermAwareComponent) charFilter).getMultiTermComponent();<NEW_LINE>charFiltersList.add(charFilter);<NEW_LINE>}<NEW_LINE>List<String> tokenFilterNames = analyzerSettings.getAsList("filter");<NEW_LINE>List<TokenFilterFactory> tokenFilterList = new ArrayList<>(tokenFilterNames.size());<NEW_LINE>for (String tokenFilterName : tokenFilterNames) {<NEW_LINE>TokenFilterFactory tokenFilter = tokenFilters.get(tokenFilterName);<NEW_LINE>if (tokenFilter == null) {<NEW_LINE>throw new IllegalArgumentException("Custom Analyzer [" + name() + "] failed to find filter under name [" + tokenFilterName + "]");<NEW_LINE>}<NEW_LINE>if (tokenFilter instanceof MultiTermAwareComponent == false) {<NEW_LINE>throw new IllegalArgumentException("Custom normalizer [" + name() + "] may not use filter [" + tokenFilterName + "]");<NEW_LINE>}<NEW_LINE>tokenFilter = (TokenFilterFactory) ((MultiTermAwareComponent) tokenFilter).getMultiTermComponent();<NEW_LINE>tokenFilterList.add(tokenFilter);<NEW_LINE>}<NEW_LINE>this.customAnalyzer = new CustomAnalyzer(tokenizerName, tokenizerFactory, charFiltersList.toArray(new CharFilterFactory[charFiltersList.size()]), tokenFilterList.toArray(new TokenFilterFactory[tokenFilterList.size()]));<NEW_LINE>} | "Custom normalizer [" + name() + "] cannot configure a tokenizer"); |
901,895 | public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws InstrumentException {<NEW_LINE>if (className.equals(CLASS_PREPARED_STATEMENT)) {<NEW_LINE>if (instrumentor.exist(loader, CLASS_PREPARED_STATEMENT_WRAPPER, protectionDomain)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final OracleConfig config = new OracleConfig(instrumentor.getProfilerConfig());<NEW_LINE>InstrumentClass target = instrumentor.getInstrumentClass(loader, className, classfileBuffer);<NEW_LINE>target.addField(DatabaseInfoAccessor.class);<NEW_LINE>target.addField(ParsingResultAccessor.class);<NEW_LINE>target.addField(BindValueAccessor.class);<NEW_LINE>int maxBindValueSize = config.getMaxSqlBindValueSize();<NEW_LINE>final Class<? extends Interceptor> preparedStatementInterceptor = PreparedStatementExecuteQueryInterceptor.class;<NEW_LINE>InstrumentUtils.findMethod(target, "execute").addScopedInterceptor(preparedStatementInterceptor, va(maxBindValueSize), ORACLE_SCOPE);<NEW_LINE>InstrumentUtils.findMethod(target, "executeQuery").addScopedInterceptor(preparedStatementInterceptor, va(maxBindValueSize), ORACLE_SCOPE);<NEW_LINE>InstrumentUtils.findMethod(target, "executeUpdate").addScopedInterceptor(preparedStatementInterceptor<MASK><NEW_LINE>if (config.isTraceSqlBindValue()) {<NEW_LINE>MethodFilter filter = new PreparedStatementBindingMethodFilter();<NEW_LINE>List<InstrumentMethod> declaredMethods = target.getDeclaredMethods(filter);<NEW_LINE>for (InstrumentMethod method : declaredMethods) {<NEW_LINE>method.addScopedInterceptor(PreparedStatementBindVariableInterceptor.class, ORACLE_SCOPE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return target.toBytecode();<NEW_LINE>} | , va(maxBindValueSize), ORACLE_SCOPE); |
125,826 | private void drawMask(Bitmap image, Mask mask) {<NEW_LINE>float r = RandomUtils.nextFloat();<NEW_LINE>float g = RandomUtils.nextFloat();<NEW_LINE>float b = RandomUtils.nextFloat();<NEW_LINE>int imageWidth = image.getWidth();<NEW_LINE>int imageHeight = image.getHeight();<NEW_LINE>int x = (int) (mask.getX() * imageWidth);<NEW_LINE>int y = (int) (mask.getY() * imageHeight);<NEW_LINE>float[][] probDist = mask.getProbDist();<NEW_LINE>// Correct some coordinates of box when going out of image<NEW_LINE>if (x < 0) {<NEW_LINE>x = 0;<NEW_LINE>}<NEW_LINE>if (y < 0) {<NEW_LINE>y = 0;<NEW_LINE>}<NEW_LINE>Bitmap maskedImage = Bitmap.createBitmap(probDist.length, probDist[0].length, Bitmap.Config.ARGB_8888);<NEW_LINE>for (int xCor = 0; xCor < probDist.length; xCor++) {<NEW_LINE>for (int yCor = 0; yCor < probDist[xCor].length; yCor++) {<NEW_LINE>float opacity <MASK><NEW_LINE>if (opacity < 0.1) {<NEW_LINE>opacity = 0f;<NEW_LINE>}<NEW_LINE>if (opacity > 0.8) {<NEW_LINE>opacity = 0.8f;<NEW_LINE>}<NEW_LINE>maskedImage.setPixel(xCor, yCor, darker(Color.argb(opacity, r, g, b)));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Canvas canvas = new Canvas(image);<NEW_LINE>canvas.drawBitmap(maskedImage, x, y, null);<NEW_LINE>} | = probDist[xCor][yCor]; |
768,071 | private void correct(char[] argument) {<NEW_LINE>try {<NEW_LINE>String source = this.compilationUnit.getSource();<NEW_LINE>Map<String, String> currentProjectOptions = this.compilationUnit.getJavaProject().getOptions(true);<NEW_LINE>long sourceLevel = CompilerOptions.versionToJdkLevel(currentProjectOptions.get(JavaCore.COMPILER_SOURCE));<NEW_LINE>long complianceLevel = CompilerOptions.versionToJdkLevel(currentProjectOptions.get(JavaCore.COMPILER_COMPLIANCE));<NEW_LINE>Scanner scanner = new Scanner(false, /*comment*/<NEW_LINE>false, /*whitespace*/<NEW_LINE>false, /*nls*/<NEW_LINE>sourceLevel, complianceLevel, null, /*taskTag*/<NEW_LINE>null, /*taskPriorities*/<NEW_LINE>true, /*taskCaseSensitive*/<NEW_LINE>JavaCore.ENABLED.equals(currentProjectOptions.<MASK><NEW_LINE>scanner.setSource(source.toCharArray());<NEW_LINE>scanner.resetTo(this.correctionStart, this.correctionEnd);<NEW_LINE>int token = 0;<NEW_LINE>char[] argumentSource = CharOperation.NO_CHAR;<NEW_LINE>// search last segment position<NEW_LINE>while (true) {<NEW_LINE>token = scanner.getNextToken();<NEW_LINE>if (token == TerminalTokens.TokenNameEOF)<NEW_LINE>return;<NEW_LINE>char[] tokenSource = scanner.getCurrentTokenSource();<NEW_LINE>argumentSource = CharOperation.concat(argumentSource, tokenSource);<NEW_LINE>if (!CharOperation.prefixEquals(argumentSource, argument))<NEW_LINE>return;<NEW_LINE>if (CharOperation.equals(argument, argumentSource)) {<NEW_LINE>this.correctionStart = scanner.startPosition;<NEW_LINE>this.correctionEnd = scanner.currentPosition;<NEW_LINE>this.prefixLength = CharOperation.lastIndexOf('.', argument) + 1;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// search completion position<NEW_LINE>int completionPosition = this.correctionStart;<NEW_LINE>scanner.resetTo(completionPosition, this.correctionEnd);<NEW_LINE>int position = completionPosition;<NEW_LINE>for (int i = 0; i < 4; i++) {<NEW_LINE>if (scanner.getNextCharAsJavaIdentifierPart()) {<NEW_LINE>completionPosition = position;<NEW_LINE>position = scanner.currentPosition;<NEW_LINE>} else {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Hashtable oldOptions = JavaCore.getOptions();<NEW_LINE>try {<NEW_LINE>Hashtable options = new Hashtable(oldOptions);<NEW_LINE>options.put(JavaCore.CODEASSIST_CAMEL_CASE_MATCH, JavaCore.DISABLED);<NEW_LINE>JavaCore.setOptions(options);<NEW_LINE>this.compilationUnit.codeComplete(completionPosition, this.completionRequestor);<NEW_LINE>} finally {<NEW_LINE>JavaCore.setOptions(oldOptions);<NEW_LINE>}<NEW_LINE>} catch (JavaModelException | InvalidInputException e) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} | get(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES))); |
1,713,670 | final DescribeVpcsResult executeDescribeVpcs(DescribeVpcsRequest describeVpcsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeVpcsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeVpcsRequest> request = null;<NEW_LINE>Response<DescribeVpcsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeVpcsRequestMarshaller().marshall(super.beforeMarshalling(describeVpcsRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EC2");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DescribeVpcsResult> responseHandler = new StaxResponseHandler<DescribeVpcsResult>(new DescribeVpcsResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeVpcs"); |
1,849,861 | public String probeContentType(Path path) throws IOException {<NEW_LINE>final Path fileNamePath = path.getFileName();<NEW_LINE>if (fileNamePath == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final <MASK><NEW_LINE>final String lowerCaseFileName = fileName.toLowerCase(Locale.ROOT);<NEW_LINE>for (String candidate : KNOWN_RUBY_SUFFIXES) {<NEW_LINE>if (lowerCaseFileName.endsWith(candidate)) {<NEW_LINE>return RUBY_MIME;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (String candidate : KNOWN_RUBY_FILES) {<NEW_LINE>if (fileName.equals(candidate)) {<NEW_LINE>return RUBY_MIME;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try (BufferedReader fileContent = Files.newBufferedReader(path, StandardCharsets.UTF_8)) {<NEW_LINE>final String firstLine = fileContent.readLine();<NEW_LINE>if (firstLine != null && SHEBANG_REGEXP.matcher(firstLine).matches()) {<NEW_LINE>return RUBY_MIME;<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>// Reading random files as UTF-8 could cause all sorts of errors<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | String fileName = fileNamePath.toString(); |
257,250 | // GEN-LAST:event_createNewPlatform<NEW_LINE>private void librariesBrowseActionPerformed(java.awt.event.ActionEvent evt) {<NEW_LINE>// GEN-FIRST:event_librariesBrowseActionPerformed<NEW_LINE>if (!isSharable) {<NEW_LINE>boolean result = makeSharable(uiProperties);<NEW_LINE>if (result) {<NEW_LINE>isSharable = true;<NEW_LINE>sharedLibrariesLabel.setEnabled(true);<NEW_LINE>librariesLocation.setEnabled(true);<NEW_LINE>librariesLocation.setText(uiProperties.getProject().getAntProjectHelper().getLibrariesLocation());<NEW_LINE>// NOI18N<NEW_LINE>Mnemonics.setLocalizedText(librariesBrowse, NbBundle.getMessage(CustomizerLibraries.class, "LBL_CustomizerLibraries_Browse_JButton"));<NEW_LINE>updateJars(<MASK><NEW_LINE>updateJars(uiProperties.JAVAC_PROCESSORPATH_MODEL);<NEW_LINE>updateJars(uiProperties.JAVAC_TEST_CLASSPATH_MODEL);<NEW_LINE>updateJars(uiProperties.RUN_TEST_CLASSPATH_MODEL);<NEW_LINE>updateJars(uiProperties.ENDORSED_CLASSPATH_MODEL);<NEW_LINE>switchLibrary();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>File prjLoc = FileUtil.toFile(uiProperties.getProject().getProjectDirectory());<NEW_LINE>String[] s = splitPath(librariesLocation.getText().trim());<NEW_LINE>String loc = SharableLibrariesUtils.browseForLibraryLocation(s[0], this, prjLoc);<NEW_LINE>if (loc != null) {<NEW_LINE>librariesLocation.setText(s[1] != null ? loc + File.separator + s[1] : loc + File.separator + SharableLibrariesUtils.DEFAULT_LIBRARIES_FILENAME);<NEW_LINE>switchLibrary();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | uiProperties.JAVAC_CLASSPATH_MODEL.getDefaultListModel()); |
454,081 | protected void appendMemberDeclarationContents(CharArrayBuffer buffer) {<NEW_LINE>if (isConstructor()) {<NEW_LINE>buffer.append(getConstructorName()).append(this.fDocument, this.fNameRange[1] + 1, this.fParameterRange[0] - this.fNameRange[1] - 1);<NEW_LINE>} else {<NEW_LINE>buffer.append(getReturnTypeContents());<NEW_LINE>if (this.fReturnTypeRange[0] >= 0) {<NEW_LINE>buffer.append(this.fDocument, this.fReturnTypeRange[1] + 1, this.fNameRange[0] - this.fReturnTypeRange[1] - 1);<NEW_LINE>} else {<NEW_LINE>buffer.append(' ');<NEW_LINE>}<NEW_LINE>buffer.append(getNameContents()).append(this.fDocument, this.fNameRange[1] + 1, this.fParameterRange[0] - this.fNameRange[1] - 1);<NEW_LINE>}<NEW_LINE>if (this.fParameterList != null) {<NEW_LINE>buffer.append(this.fParameterList);<NEW_LINE>} else {<NEW_LINE>buffer.append(this.fDocument, this.fParameterRange[0], this.fParameterRange[1] + 1 - this.fParameterRange[0]);<NEW_LINE>}<NEW_LINE>int start;<NEW_LINE>if (hasTrailingArrayQualifier() && isReturnTypeAltered()) {<NEW_LINE>start = this.fReturnTypeRange[3] + 1;<NEW_LINE>} else {<NEW_LINE>start = <MASK><NEW_LINE>}<NEW_LINE>if (this.fExceptions != null) {<NEW_LINE>// add 'throws' keyword<NEW_LINE>if (this.fExceptionRange[0] >= 0) {<NEW_LINE>buffer.append(this.fDocument, start, this.fExceptionRange[0] - start);<NEW_LINE>} else {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>buffer.append(" throws ");<NEW_LINE>}<NEW_LINE>// add exception list<NEW_LINE>if (this.fExceptionList != null) {<NEW_LINE>buffer.append(this.fExceptionList);<NEW_LINE>// add space before body<NEW_LINE>if (this.fExceptionRange[0] >= 0) {<NEW_LINE>buffer.append(this.fDocument, this.fExceptionRange[1] + 1, this.fBodyRange[0] - this.fExceptionRange[1] - 1);<NEW_LINE>} else {<NEW_LINE>buffer.append(this.fDocument, this.fParameterRange[1] + 1, this.fBodyRange[0] - this.fParameterRange[1] - 1);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// add list and space before body<NEW_LINE>buffer.append(this.fDocument, this.fExceptionRange[0], this.fBodyRange[0] - this.fExceptionRange[0]);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// add space before body<NEW_LINE>if (this.fExceptionRange[0] >= 0) {<NEW_LINE>buffer.append(this.fDocument, this.fExceptionRange[1] + 1, this.fBodyRange[0] - this.fExceptionRange[1] - 1);<NEW_LINE>} else {<NEW_LINE>buffer.append(this.fDocument, start, this.fBodyRange[0] - start);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | this.fParameterRange[1] + 1; |
33,628 | private void appendMethodHandleInfo(StringBuffer sb, AbstractConstantPoolInfoJava[] constantPool, int argIndex) {<NEW_LINE>ConstantPoolMethodHandleInfo methodHandle = (ConstantPoolMethodHandleInfo) constantPool[argIndex];<NEW_LINE>AbstractConstantPoolInfoJava handleRef = constantPool[methodHandle.getReferenceIndex()];<NEW_LINE>if (handleRef instanceof ConstantPoolFieldReferenceInfo) {<NEW_LINE>ConstantPoolFieldReferenceInfo fieldRef = (ConstantPoolFieldReferenceInfo) handleRef;<NEW_LINE>ConstantPoolClassInfo classInfo = (ConstantPoolClassInfo) constantPool[fieldRef.getClassIndex()];<NEW_LINE>ConstantPoolUtf8Info utf8 = (ConstantPoolUtf8Info) constantPool[classInfo.getNameIndex()];<NEW_LINE>sb.append(utf8.getString());<NEW_LINE>sb.append(".");<NEW_LINE>ConstantPoolNameAndTypeInfo ntInfo = (ConstantPoolNameAndTypeInfo) constantPool[fieldRef.getNameAndTypeIndex()];<NEW_LINE>utf8 = (ConstantPoolUtf8Info) constantPool[ntInfo.getNameIndex()];<NEW_LINE>sb.append(utf8.getString());<NEW_LINE>}<NEW_LINE>if (handleRef instanceof ConstantPoolMethodReferenceInfo) {<NEW_LINE>ConstantPoolMethodReferenceInfo methodRef = (ConstantPoolMethodReferenceInfo) handleRef;<NEW_LINE>ConstantPoolClassInfo classRef = (ConstantPoolClassInfo) <MASK><NEW_LINE>ConstantPoolUtf8Info utf8 = (ConstantPoolUtf8Info) constantPool[classRef.getNameIndex()];<NEW_LINE>sb.append(utf8.getString() + ".");<NEW_LINE>ConstantPoolNameAndTypeInfo nameAndType = (ConstantPoolNameAndTypeInfo) constantPool[methodRef.getNameAndTypeIndex()];<NEW_LINE>utf8 = (ConstantPoolUtf8Info) constantPool[nameAndType.getNameIndex()];<NEW_LINE>sb.append(utf8.getString());<NEW_LINE>}<NEW_LINE>if (handleRef instanceof ConstantPoolInterfaceMethodReferenceInfo) {<NEW_LINE>ConstantPoolInterfaceMethodReferenceInfo mrInfo = (ConstantPoolInterfaceMethodReferenceInfo) handleRef;<NEW_LINE>ConstantPoolClassInfo classRef = (ConstantPoolClassInfo) constantPool[mrInfo.getClassIndex()];<NEW_LINE>ConstantPoolUtf8Info utf8 = (ConstantPoolUtf8Info) constantPool[classRef.getNameIndex()];<NEW_LINE>sb.append(utf8.getString() + ".");<NEW_LINE>ConstantPoolNameAndTypeInfo nameAndType = (ConstantPoolNameAndTypeInfo) constantPool[mrInfo.getNameAndTypeIndex()];<NEW_LINE>utf8 = (ConstantPoolUtf8Info) constantPool[nameAndType.getNameIndex()];<NEW_LINE>sb.append(utf8.getString());<NEW_LINE>}<NEW_LINE>} | constantPool[methodRef.getClassIndex()]; |
136,242 | public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {<NEW_LINE>final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));<NEW_LINE>final String[] types = request.paramAsStringArrayOrEmptyIfAll("type");<NEW_LINE>final String[] fields = Strings.splitStringByCommaToArray(request.param("fields"));<NEW_LINE>final boolean includeTypeName = <MASK><NEW_LINE>if (request.hasParam(INCLUDE_TYPE_NAME_PARAMETER) == false) {<NEW_LINE>deprecationLogger.deprecatedAndMaybeLog("get_field_mapping_with_types", TYPES_DEPRECATION_MESSAGE);<NEW_LINE>}<NEW_LINE>if (includeTypeName == false && types.length > 0) {<NEW_LINE>throw new IllegalArgumentException("Cannot set include_type_name=false and specify types at the same time.");<NEW_LINE>}<NEW_LINE>GetFieldMappingsRequest getMappingsRequest = new GetFieldMappingsRequest();<NEW_LINE>getMappingsRequest.indices(indices).types(types).fields(fields).includeDefaults(request.paramAsBoolean("include_defaults", false));<NEW_LINE>getMappingsRequest.indicesOptions(IndicesOptions.fromRequest(request, getMappingsRequest.indicesOptions()));<NEW_LINE>getMappingsRequest.local(request.paramAsBoolean("local", getMappingsRequest.local()));<NEW_LINE>return channel -> client.admin().indices().getFieldMappings(getMappingsRequest, new RestBuilderListener<GetFieldMappingsResponse>(channel) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public RestResponse buildResponse(GetFieldMappingsResponse response, XContentBuilder builder) throws Exception {<NEW_LINE>Map<String, Map<String, Map<String, FieldMappingMetaData>>> mappingsByIndex = response.mappings();<NEW_LINE>boolean isPossibleSingleFieldRequest = indices.length == 1 && types.length == 1 && fields.length == 1;<NEW_LINE>if (isPossibleSingleFieldRequest && isFieldMappingMissingField(mappingsByIndex)) {<NEW_LINE>return new BytesRestResponse(OK, builder.startObject().endObject());<NEW_LINE>}<NEW_LINE>RestStatus status = OK;<NEW_LINE>if (mappingsByIndex.isEmpty() && fields.length > 0) {<NEW_LINE>status = NOT_FOUND;<NEW_LINE>}<NEW_LINE>response.toXContent(builder, request);<NEW_LINE>return new BytesRestResponse(status, builder);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, DEFAULT_INCLUDE_TYPE_NAME_POLICY); |
1,714,698 | public void run(RegressionEnvironment env) {<NEW_LINE>RegressionPath path = new RegressionPath();<NEW_LINE>String jsonSchemas = "@public @buseventtype create json schema S0_JSON(id String, p00 int);\n" + "@public @buseventtype create json schema S1_JSON(id String, p00 int);\n" + "@public @buseventtype @JsonSchema(className='" + MyLocalJsonProvidedS0.class.getName() + "') create json schema S0_JSONCLASSPROVIDED();\n" + "@public @buseventtype @JsonSchema(className='" + MyLocalJsonProvidedS1.class.getName() + "') create json schema S1_JSONCLASSPROVIDED();\n";<NEW_LINE>env.compileDeploy(jsonSchemas, path);<NEW_LINE>AtomicInteger milestone = new AtomicInteger();<NEW_LINE>for (EventRepresentationChoice rep : EventRepresentationChoice.values()) {<NEW_LINE>String s0Type = "S0_" + rep.getName();<NEW_LINE>String s1Type = "S1_" + rep.getName();<NEW_LINE>String eplOne = "select S0.id as s0id, S1.id as s1id, S0.p00 as s0p00, S1.p00 as s1p00 from " + s0Type + "#keepall as S0, " + s1Type + "#keepall as S1 where S0.id = S1.id";<NEW_LINE>tryJoinAssertion(env, eplOne, rep, "s0id,s1id,s0p00,s1p00", milestone, path, MyLocalJsonProvidedWFields.class);<NEW_LINE>}<NEW_LINE>for (EventRepresentationChoice rep : EventRepresentationChoice.values()) {<NEW_LINE>String s0Type <MASK><NEW_LINE>String s1Type = "S1_" + rep.getName();<NEW_LINE>String eplTwo = "select * from " + s0Type + "#keepall as s0, " + s1Type + "#keepall as s1 where s0.id = s1.id";<NEW_LINE>tryJoinAssertion(env, eplTwo, rep, "s0.id,s1.id,s0.p00,s1.p00", milestone, path, MyLocalJsonProvidedWildcard.class);<NEW_LINE>}<NEW_LINE>env.undeployAll();<NEW_LINE>} | = "S0_" + rep.getName(); |
1,267,982 | public static <T extends CameraModel> void save(T parameters, Writer outputWriter) {<NEW_LINE>PrintWriter out = new PrintWriter(outputWriter);<NEW_LINE>Yaml yaml = createYmlObject();<NEW_LINE>Map<String, Object> <MASK><NEW_LINE>if (parameters instanceof CameraPinholeBrown) {<NEW_LINE>out.println("# Pinhole camera model with radial and tangential distortion");<NEW_LINE>out.println("# (fx,fy) = focal length, (cx,cy) = principle point, (width,height) = image shape");<NEW_LINE>out.println("# radial = radial distortion, (t1,t2) = tangential distortion");<NEW_LINE>out.println();<NEW_LINE>putModelBrown((CameraPinholeBrown) parameters, data);<NEW_LINE>} else if (parameters instanceof CameraUniversalOmni) {<NEW_LINE>out.println("# Omnidirectional camera model with radial and tangential distortion");<NEW_LINE>out.println("# C. Mei, and P. Rives. \"Single view point omnidirectional camera calibration" + " from planar grids.\" ICRA 2007");<NEW_LINE>out.println("# (fx,fy) = focal length, (cx,cy) = principle point, (width,height) = image shape");<NEW_LINE>out.println("# mirror_offset = offset mirror along z-axis in unit circle");<NEW_LINE>out.println("# radial = radial distortion, (t1,t2) = tangential distortion");<NEW_LINE>out.println();<NEW_LINE>putModelUniversalOmni((CameraUniversalOmni) parameters, data);<NEW_LINE>} else if (parameters instanceof CameraKannalaBrandt) {<NEW_LINE>out.println("# A camera model for pinhole, wide angle, and fisheye cameras.");<NEW_LINE>out.println("# Kannala, J., and Brandt, S. S. \"A generic camera model and calibration method for conventional,");<NEW_LINE>out.println("# wide-angle, and fish-eye lenses.\" IEEE transactions on pattern analysis and machine intelligence, 2006");<NEW_LINE>out.println("# (fx,fy) = focal length, (cx,cy) = principle point, (width,height) = image shape");<NEW_LINE>out.println("# Everything else is coefficients for different types of distortion");<NEW_LINE>out.println();<NEW_LINE>putKannalaBrandt((CameraKannalaBrandt) parameters, data);<NEW_LINE>} else {<NEW_LINE>out.println("# Pinhole camera model");<NEW_LINE>out.println("# (fx,fy) = focal length, (cx,cy) = principle point, (width,height) = image shape");<NEW_LINE>out.println();<NEW_LINE>putModelPinhole((CameraPinhole) parameters, data);<NEW_LINE>}<NEW_LINE>yaml.dump(data, out);<NEW_LINE>out.flush();<NEW_LINE>} | data = new HashMap<>(); |
330,246 | protected void activate() {<NEW_LINE>filterBox.activate();<NEW_LINE>sortedList.comparatorProperty().bind(tableView.comparatorProperty());<NEW_LINE>tableView.setItems(sortedList);<NEW_LINE>updateList();<NEW_LINE>reset();<NEW_LINE>amountTextField.<MASK><NEW_LINE>amountTextField.focusedProperty().addListener(amountFocusListener);<NEW_LINE>btcWalletService.addBalanceListener(balanceListener);<NEW_LINE>feeToggleGroup.selectedToggleProperty().addListener(feeToggleGroupListener);<NEW_LINE>inputsToggleGroup.selectedToggleProperty().addListener(inputsToggleGroupListener);<NEW_LINE>if (feeToggleGroup.getSelectedToggle() == null)<NEW_LINE>feeToggleGroup.selectToggle(feeIncludedRadioButton);<NEW_LINE>if (inputsToggleGroup.getSelectedToggle() == null)<NEW_LINE>inputsToggleGroup.selectToggle(useAllInputsRadioButton);<NEW_LINE>useCustomFee.setSelected(false);<NEW_LINE>transactionFeeInputTextField.setEditable(false);<NEW_LINE>transactionFeeInputTextField.setText(String.valueOf(feeService.getTxFeePerVbyte().value));<NEW_LINE>feeService.feeUpdateCounterProperty().addListener(transactionFeeChangeListener);<NEW_LINE>useCustomFee.selectedProperty().addListener(useCustomFeeCheckboxListener);<NEW_LINE>transactionFeeInputTextField.focusedProperty().addListener(transactionFeeFocusedListener);<NEW_LINE>updateInputSelection();<NEW_LINE>GUIUtil.requestFocus(withdrawToTextField);<NEW_LINE>} | textProperty().addListener(amountListener); |
724,671 | public void update(ViewerCell cell) {<NEW_LINE>Object element = cell.getElement();<NEW_LINE>// image<NEW_LINE>cell.setImage<MASK><NEW_LINE>// styled label<NEW_LINE>String label = baseLabels.getText(element);<NEW_LINE>StyledString styledLabel = new StyledString(label);<NEW_LINE>if (filter.accept(label)) {<NEW_LINE>Styler bold = stylers.bold();<NEW_LINE>for (IRegion r : filter.getHighlights(label)) {<NEW_LINE>styledLabel.setStyle(r.getOffset(), r.getLength(), bold);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>cell.setStyleRanges(styledLabel.getStyleRanges());<NEW_LINE>cell.setText(styledLabel.getString());<NEW_LINE>cell.getControl().redraw();<NEW_LINE>// ^^^ Sigh... Yes, this is needed. It seems SWT/Jface isn't smart enough to itself figure out that if<NEW_LINE>// the styleranges change a redraw is needed to make the change visible.<NEW_LINE>} | (baseLabels.getImage(element)); |
228,931 | void update(java.util.Map<String, TemplateDescriptor> descriptors, String[] removeTemplates) throws UpdateFailedException {<NEW_LINE>//<NEW_LINE>// Note: _descriptors is updated by Application<NEW_LINE>//<NEW_LINE>//<NEW_LINE>// One big set of removes<NEW_LINE>//<NEW_LINE>removeChildren(removeTemplates);<NEW_LINE>//<NEW_LINE>// One big set of updates, followed by inserts<NEW_LINE>//<NEW_LINE>java.util.List<TreeNodeBase> newChildren = new java.util.ArrayList<>();<NEW_LINE>java.util.List<TreeNodeBase> updatedChildren = new java.util.LinkedList<>();<NEW_LINE>for (java.util.Map.Entry<String, TemplateDescriptor> p : descriptors.entrySet()) {<NEW_LINE>String name = p.getKey();<NEW_LINE><MASK><NEW_LINE>ServiceTemplate child = (ServiceTemplate) findChild(name);<NEW_LINE>if (child == null) {<NEW_LINE>newChildren.add(new ServiceTemplate(false, this, name, templateDescriptor));<NEW_LINE>} else {<NEW_LINE>child.rebuild(templateDescriptor);<NEW_LINE>updatedChildren.add(child);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>childrenChanged(updatedChildren);<NEW_LINE>insertChildren(newChildren, true);<NEW_LINE>} | TemplateDescriptor templateDescriptor = p.getValue(); |
244,812 | public I_S_Resource findPlant(final int orgRepoId, final I_M_Warehouse warehouse, final int productRepoId, final int attributeSetInstanceRepoId) {<NEW_LINE>//<NEW_LINE>// First: get the plant directly from Warehouse<NEW_LINE>if (warehouse != null) {<NEW_LINE>final ResourceId plantId = ResourceId.ofRepoIdOrNull(warehouse.getPP_Plant_ID());<NEW_LINE>if (plantId != null) {<NEW_LINE>return resourcesRepo.getById(plantId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Try searching for a product planning file and get the warehouse from there<NEW_LINE>{<NEW_LINE>final OrgId orgId = OrgId.ofRepoIdOrAny(orgRepoId);<NEW_LINE>final WarehouseId warehouseId = warehouse != null ? WarehouseId.ofRepoId(warehouse.getM_Warehouse_ID()) : null;<NEW_LINE>final ProductId <MASK><NEW_LINE>final AttributeSetInstanceId attributeSetInstanceId = AttributeSetInstanceId.ofRepoIdOrNone(attributeSetInstanceRepoId);<NEW_LINE>final IQueryBuilder<I_PP_Product_Planning> queryBuilder = // any plant<NEW_LINE>createQueryBuilder(// any plant<NEW_LINE>orgId, // any plant<NEW_LINE>warehouseId, (ResourceId) null, productId, attributeSetInstanceId);<NEW_LINE>final List<ResourceId> plantIds = // get plant<NEW_LINE>queryBuilder.create().stream(I_PP_Product_Planning.class).// get plant<NEW_LINE>map(I_PP_Product_Planning::getS_Resource_ID).filter(plantId -> plantId > 0).distinct().map(ResourceId::ofRepoId).collect(ImmutableList.toImmutableList());<NEW_LINE>if (plantIds.isEmpty()) {<NEW_LINE>throw new NoPlantForWarehouseException(orgId, warehouseId, productId);<NEW_LINE>} else if (plantIds.size() > 1) {<NEW_LINE>// we found more then one Plant => consider it as no plant was found<NEW_LINE>throw new NoPlantForWarehouseException(orgId, warehouseId, productId);<NEW_LINE>} else {<NEW_LINE>return resourcesRepo.getById(plantIds.get(0));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | productId = ProductId.ofRepoId(productRepoId); |
261,283 | private boolean isCertificateTrusted(final X509Certificate signerCertificate, final CMSSignedData cmsSignedData) {<NEW_LINE>LOGGER.trace("Starting CMS certificate validation");<NEW_LINE>try {<NEW_LINE>final CertPathBuilder cpb = CertPathBuilder.getInstance("PKIX");<NEW_LINE>// Define CMS signer certificate as the starting point of the path (leaf certificate)<NEW_LINE>final X509CertSelector targetConstraints = new X509CertSelector();<NEW_LINE>targetConstraints.setCertificate(signerCertificate);<NEW_LINE>// Set parameters for the certificate path building algorithm<NEW_LINE>final PKIXBuilderParameters params = new PKIXBuilderParameters(truststore.getKeyStore(), targetConstraints);<NEW_LINE>// Adding CertStore with CRLs (if present, otherwise disabling revocation check)<NEW_LINE>createCRLCertStore(truststore).ifPresentOrElse(CRLs -> {<NEW_LINE>params.addCertStore(CRLs);<NEW_LINE>PKIXRevocationChecker rc = (PKIXRevocationChecker) cpb.getRevocationChecker();<NEW_LINE>rc.setOptions(EnumSet<MASK><NEW_LINE>params.addCertPathChecker(rc);<NEW_LINE>}, () -> {<NEW_LINE>LOGGER.warn("No CRL CertStore provided. CRL validation will be disabled.");<NEW_LINE>params.setRevocationEnabled(false);<NEW_LINE>});<NEW_LINE>// Read certificates sent on the CMS message and adding it to the path building algorithm<NEW_LINE>final CertStore cmsCertificates = new JcaCertStoreBuilder().addCertificates(cmsSignedData.getCertificates()).build();<NEW_LINE>params.addCertStore(cmsCertificates);<NEW_LINE>// Validate certificate path<NEW_LINE>try {<NEW_LINE>cpb.build(params);<NEW_LINE>return true;<NEW_LINE>} catch (final CertPathBuilderException cpbe) {<NEW_LINE>LOGGER.warn("Untrusted certificate chain", cpbe);<NEW_LINE>LOGGER.trace("Reason for failed validation", cpbe.getCause());<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} catch (final Exception e) {<NEW_LINE>LOGGER.error("Error validating certificate chain");<NEW_LINE>throw new RuntimeException("Error validating certificate chain", e);<NEW_LINE>}<NEW_LINE>} | .of(Option.PREFER_CRLS)); |
412,675 | public ListEndpointsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ListEndpointsResult listEndpointsResult = new ListEndpointsResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return listEndpointsResult;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("Endpoints", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listEndpointsResult.setEndpoints(new ListUnmarshaller<Endpoint>(EndpointJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("NextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listEndpointsResult.setNextToken(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return listEndpointsResult;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
213,344 | public void showError(String title, String message, Throwable ex) {<NEW_LINE>final Alert alert = new Alert(Alert.AlertType.ERROR);<NEW_LINE>final Scene scene = alert.getDialogPane().getScene();<NEW_LINE>BrandUtil.applyBrand(injector, stage, scene);<NEW_LINE>alert.setHeaderText(title);<NEW_LINE>alert.setContentText(message);<NEW_LINE>alert.setGraphic(FontAwesome.EXCLAMATION_TRIANGLE.view());<NEW_LINE>alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);<NEW_LINE>if (ex == null) {<NEW_LINE>alert.setTitle("Error");<NEW_LINE>} else {<NEW_LINE>alert.setTitle(ex.getClass().getSimpleName());<NEW_LINE>final StringWriter sw = new StringWriter();<NEW_LINE>final PrintWriter pw = new PrintWriter(sw);<NEW_LINE>ex.printStackTrace(pw);<NEW_LINE>final Label label = new Label("The exception stacktrace was:");<NEW_LINE>final String exceptionText = sw.toString();<NEW_LINE>final TextArea textArea = new TextArea(exceptionText);<NEW_LINE>textArea.setEditable(false);<NEW_LINE>textArea.setWrapText(true);<NEW_LINE>textArea.setMaxWidth(Double.MAX_VALUE);<NEW_LINE>textArea.setMaxHeight(Double.MAX_VALUE);<NEW_LINE>GridPane.setVgrow(textArea, Priority.ALWAYS);<NEW_LINE>GridPane.setHgrow(textArea, Priority.ALWAYS);<NEW_LINE>final GridPane expContent = new GridPane();<NEW_LINE><MASK><NEW_LINE>expContent.add(label, 0, 0);<NEW_LINE>expContent.add(textArea, 0, 1);<NEW_LINE>alert.getDialogPane().setExpandableContent(expContent);<NEW_LINE>}<NEW_LINE>alert.showAndWait();<NEW_LINE>} | expContent.setMaxWidth(Double.MAX_VALUE); |
1,026,491 | public boolean isAuthorizedForRequest(SingularityRequest request, SingularityUser user, SingularityAuthorizationScope scope, Optional<SingularityUserFacingAction> action) {<NEW_LINE>if (!authEnabled) {<NEW_LINE>// no auth == no rules!<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (!user.isAuthenticated()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>final Set<String> userGroups = user.getGroups();<NEW_LINE>final Set<String> readWriteGroups = Sets.union(request.getGroup().map(Collections::singleton).orElse(Collections.emptySet()), request.getReadWriteGroups().orElse(Collections.emptySet()));<NEW_LINE>final Set<String> readOnlyGroups = request.getReadOnlyGroups().orElse(defaultReadOnlyGroups);<NEW_LINE>final boolean userIsAdmin = !adminGroups.isEmpty(<MASK><NEW_LINE>final boolean userIsJITA = !jitaGroups.isEmpty() && groupsIntersect(userGroups, jitaGroups);<NEW_LINE>final boolean userIsReadWriteUser = readWriteGroups.isEmpty() || groupsIntersect(userGroups, readWriteGroups);<NEW_LINE>final boolean userIsReadOnlyUser = groupsIntersect(userGroups, readOnlyGroups) || (!globalReadOnlyGroups.isEmpty() && groupsIntersect(userGroups, globalReadOnlyGroups));<NEW_LINE>final boolean userIsPartOfRequiredGroups = requiredGroups.isEmpty() || groupsIntersect(userGroups, requiredGroups);<NEW_LINE>if (userIsAdmin) {<NEW_LINE>// Admins Rule Everything Around Me<NEW_LINE>return true;<NEW_LINE>} else if (scope == SingularityAuthorizationScope.READ) {<NEW_LINE>return ((userIsReadOnlyUser || userIsReadWriteUser || userIsJITA) && userIsPartOfRequiredGroups);<NEW_LINE>} else if (scope == SingularityAuthorizationScope.WRITE) {<NEW_LINE>return (userIsReadWriteUser || userIsJITA) && userIsPartOfRequiredGroups;<NEW_LINE>} else {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | ) && groupsIntersect(userGroups, adminGroups); |
1,154,478 | public Client filter(Client client) {<NEW_LINE>ReadOnlyClient pseudoClient = new ReadOnlyClient(client);<NEW_LINE>Map<Account, ReadOnlyAccount> <MASK><NEW_LINE>Map<Portfolio, ReadOnlyPortfolio> portfolio2readonly = new HashMap<>();<NEW_LINE>Function<Account, ReadOnlyAccount> transformAccount = a -> account2readonly.computeIfAbsent(a, aa -> {<NEW_LINE>ReadOnlyAccount readonly = new ReadOnlyAccount(aa);<NEW_LINE>pseudoClient.internalAddAccount(readonly);<NEW_LINE>return readonly;<NEW_LINE>});<NEW_LINE>Function<Portfolio, ReadOnlyPortfolio> transformPortfolio = p -> portfolio2readonly.computeIfAbsent(p, pp -> {<NEW_LINE>ReadOnlyPortfolio pseudoPortfolio = new ReadOnlyPortfolio(pp);<NEW_LINE>pseudoPortfolio.setReferenceAccount(transformAccount.apply(pp.getReferenceAccount()));<NEW_LINE>pseudoClient.internalAddPortfolio(pseudoPortfolio);<NEW_LINE>return pseudoPortfolio;<NEW_LINE>});<NEW_LINE>for (Security security : securities) {<NEW_LINE>pseudoClient.internalAddSecurity(security);<NEW_LINE>addSecurity(client, transformPortfolio, transformAccount, security);<NEW_LINE>}<NEW_LINE>return pseudoClient;<NEW_LINE>} | account2readonly = new HashMap<>(); |
217,034 | public String resolve(IFile file, String baseLocation, String publicId, String systemId) {<NEW_LINE>// systemId is already resolved; so don't touch<NEW_LINE>if (systemId != null && systemId.startsWith("jar:")) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// identify the correct project<NEW_LINE>IProject project = null;<NEW_LINE>if (file != null) {<NEW_LINE>project = getBestMatchingProject(file);<NEW_LINE>} else if (baseLocation != null && baseLocation.startsWith(ProjectAwareUrlStreamHandlerService.PROJECT_AWARE_PROTOCOL_HEADER)) {<NEW_LINE>String nameAndLocation = baseLocation.substring(ProjectAwareUrlStreamHandlerService.PROJECT_AWARE_PROTOCOL_HEADER.length());<NEW_LINE>String projectName = nameAndLocation.substring(0<MASK><NEW_LINE>project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);<NEW_LINE>}<NEW_LINE>// // continue just for identified Spring projects<NEW_LINE>// if (project == null || BeansCorePlugin.getModel().getProject(project) == null) {<NEW_LINE>// return null;<NEW_LINE>// }<NEW_LINE>if (systemId == null && file != null) {<NEW_LINE>systemId = findSystemIdFromFile(file, publicId);<NEW_LINE>}<NEW_LINE>if (systemId == null && publicId == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>ProjectClasspathUriResolver resolver = getProjectResolver(file, project);<NEW_LINE>if (resolver != null) {<NEW_LINE>String resolved = resolver.resolveOnClasspath(publicId, systemId);<NEW_LINE>if (resolved != null) {<NEW_LINE>resolved = ProjectAwareUrlStreamHandlerService.createProjectAwareUrl(project.getName(), resolved);<NEW_LINE>}<NEW_LINE>return resolved;<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | , nameAndLocation.indexOf('/')); |
1,685,348 | protected void startPersistThread() {<NEW_LINE>final Granularity segmentGranularity = schema<MASK><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.getShardSpec().getPartitionNum());<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>} | .getGranularitySpec().getSegmentGranularity(); |
483,084 | public TaskExecutionInformation findTaskExecutionInformation(String taskName, Map<String, String> taskDeploymentProperties, boolean addDatabaseCredentials, Map<String, String> previousTaskDeploymentProperties) {<NEW_LINE>Assert.hasText(taskName, "The provided taskName must not be null or empty.");<NEW_LINE>Assert.notNull(taskDeploymentProperties, "The provided runtimeProperties must not be null.");<NEW_LINE>TaskExecutionInformation taskExecutionInformation = new TaskExecutionInformation();<NEW_LINE>taskExecutionInformation.setTaskDeploymentProperties(taskDeploymentProperties);<NEW_LINE>TaskDefinition originalTaskDefinition = taskDefinitionRepository.findById(taskName).orElseThrow(() -> new NoSuchTaskDefinitionException(taskName));<NEW_LINE>// TODO: This normally called by JPA automatically but `AutoCreateTaskDefinitionTests` fails without this.<NEW_LINE>originalTaskDefinition.initialize();<NEW_LINE>TaskParser taskParser = new TaskParser(originalTaskDefinition.getName(), originalTaskDefinition.getDslText(), true, true);<NEW_LINE>TaskNode taskNode = taskParser.parse();<NEW_LINE>// if composed task definition replace definition with one composed task<NEW_LINE>// runner and executable graph.<NEW_LINE>TaskDefinition taskDefinitionToUse;<NEW_LINE>AppRegistration appRegistration;<NEW_LINE>if (taskNode.isComposed()) {<NEW_LINE>taskDefinitionToUse = new TaskDefinition(originalTaskDefinition.getName(), TaskServiceUtils.createComposedTaskDefinition(taskNode.toExecutableDSL()));<NEW_LINE>taskExecutionInformation.setTaskDeploymentProperties(TaskServiceUtils.establishComposedTaskProperties(taskDeploymentProperties, taskNode));<NEW_LINE>taskDefinitionToUse = TaskServiceUtils.updateTaskProperties(taskDefinitionToUse, dataSourceProperties, addDatabaseCredentials);<NEW_LINE>try {<NEW_LINE>appRegistration = new AppRegistration(ComposedTaskRunnerConfigurationProperties.COMPOSED_TASK_RUNNER_NAME, ApplicationType.task, new URI(TaskServiceUtils.getComposedTaskLauncherUri(this.<MASK><NEW_LINE>} catch (URISyntaxException e) {<NEW_LINE>throw new IllegalStateException("Invalid Compose Task Runner Resource", e);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>taskDefinitionToUse = TaskServiceUtils.updateTaskProperties(originalTaskDefinition, dataSourceProperties, addDatabaseCredentials);<NEW_LINE>String label = null;<NEW_LINE>if (taskNode.getTaskApp() != null) {<NEW_LINE>TaskAppNode taskAppNode = taskNode.getTaskApp();<NEW_LINE>if (taskAppNode.getLabel() != null) {<NEW_LINE>label = taskAppNode.getLabel().stringValue();<NEW_LINE>} else {<NEW_LINE>label = taskAppNode.getName();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String version = taskDeploymentProperties.get("version." + label);<NEW_LINE>if (version == null) {<NEW_LINE>// restore from previous "manifest"<NEW_LINE>version = previousTaskDeploymentProperties.get("version." + label);<NEW_LINE>}<NEW_LINE>// if we have version, use that or rely on default version set<NEW_LINE>if (version == null) {<NEW_LINE>appRegistration = appRegistryService.find(taskDefinitionToUse.getRegisteredAppName(), ApplicationType.task);<NEW_LINE>} else {<NEW_LINE>appRegistration = appRegistryService.find(taskDefinitionToUse.getRegisteredAppName(), ApplicationType.task, version);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Assert.notNull(appRegistration, "Unknown task app: " + taskDefinitionToUse.getRegisteredAppName());<NEW_LINE>taskExecutionInformation.setTaskDefinition(taskDefinitionToUse);<NEW_LINE>taskExecutionInformation.setOriginalTaskDefinition(originalTaskDefinition);<NEW_LINE>taskExecutionInformation.setComposed(taskNode.isComposed());<NEW_LINE>taskExecutionInformation.setAppResource(appRegistryService.getAppResource(appRegistration));<NEW_LINE>taskExecutionInformation.setMetadataResource(appRegistryService.getAppMetadataResource(appRegistration));<NEW_LINE>return taskExecutionInformation;<NEW_LINE>} | taskConfigurationProperties, this.composedTaskRunnerConfigurationProperties))); |
1,297,895 | public void marshall(AthenaDatasetDefinition athenaDatasetDefinition, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (athenaDatasetDefinition == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(athenaDatasetDefinition.getCatalog(), CATALOG_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(athenaDatasetDefinition.getQueryString(), QUERYSTRING_BINDING);<NEW_LINE>protocolMarshaller.marshall(athenaDatasetDefinition.getWorkGroup(), WORKGROUP_BINDING);<NEW_LINE>protocolMarshaller.marshall(athenaDatasetDefinition.getOutputS3Uri(), OUTPUTS3URI_BINDING);<NEW_LINE>protocolMarshaller.marshall(athenaDatasetDefinition.getKmsKeyId(), KMSKEYID_BINDING);<NEW_LINE>protocolMarshaller.marshall(athenaDatasetDefinition.getOutputFormat(), OUTPUTFORMAT_BINDING);<NEW_LINE>protocolMarshaller.marshall(athenaDatasetDefinition.getOutputCompression(), OUTPUTCOMPRESSION_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | athenaDatasetDefinition.getDatabase(), DATABASE_BINDING); |
755,684 | public static void main(String[] args) {<NEW_LINE>// macOS<NEW_LINE>if (SystemInfo.isMacOS) {<NEW_LINE>// enable screen menu bar<NEW_LINE>// (moves menu bar from JFrame window to top of screen)<NEW_LINE>System.setProperty("apple.laf.useScreenMenuBar", "true");<NEW_LINE>// application name used in screen menu bar<NEW_LINE>// (in first menu after the "apple" menu)<NEW_LINE>System.setProperty("apple.awt.application.name", "FlatLaf Demo");<NEW_LINE>// appearance of window title bars<NEW_LINE>// possible values:<NEW_LINE>// - "system": use current macOS appearance (light or dark)<NEW_LINE>// - "NSAppearanceNameAqua": use light appearance<NEW_LINE>// - "NSAppearanceNameDarkAqua": use dark appearance<NEW_LINE>System.setProperty("apple.awt.application.appearance", "system");<NEW_LINE>}<NEW_LINE>// Linux<NEW_LINE>if (SystemInfo.isLinux) {<NEW_LINE>// enable custom window decorations<NEW_LINE>JFrame.setDefaultLookAndFeelDecorated(true);<NEW_LINE>JDialog.setDefaultLookAndFeelDecorated(true);<NEW_LINE>}<NEW_LINE>if (FlatLafDemo.screenshotsMode && !SystemInfo.isJava_9_orLater && System.getProperty("flatlaf.uiScale") == null)<NEW_LINE>System.setProperty("flatlaf.uiScale", "2x");<NEW_LINE>SwingUtilities.invokeLater(() -> {<NEW_LINE>DemoPrefs.init(PREFS_ROOT_PATH);<NEW_LINE>// application specific UI defaults<NEW_LINE>FlatLaf.registerCustomDefaultsSource("com.formdev.flatlaf.demo");<NEW_LINE>// set look and feel<NEW_LINE>DemoPrefs.setupLaf(args);<NEW_LINE>// install inspectors<NEW_LINE>FlatInspector.install("ctrl shift alt X");<NEW_LINE>FlatUIDefaultsInspector.install("ctrl shift alt Y");<NEW_LINE>// create frame<NEW_LINE>DemoFrame frame = new DemoFrame();<NEW_LINE>if (FlatLafDemo.screenshotsMode) {<NEW_LINE>frame.setPreferredSize(SystemInfo.isJava_9_orLater ? new Dimension(830, 440) : <MASK><NEW_LINE>}<NEW_LINE>// show frame<NEW_LINE>frame.pack();<NEW_LINE>frame.setLocationRelativeTo(null);<NEW_LINE>frame.setVisible(true);<NEW_LINE>});<NEW_LINE>} | new Dimension(1660, 880)); |
290,991 | private ConcurrentHashMap<String, Boolean> initDbLockStatus(DataSource dataSource) throws SQLException, TddlNestableRuntimeException {<NEW_LINE>Connection connection = null;<NEW_LINE>Statement statement = null;<NEW_LINE>List<Triple> expiredLocks = new ArrayList();<NEW_LINE>ConcurrentHashMap<String, Boolean> tmpReadOnlyCache = new ConcurrentHashMap<>();<NEW_LINE>try {<NEW_LINE>Date now = generateTimeFromDb(dataSource, 0);<NEW_LINE>connection = dataSource.getConnection();<NEW_LINE>statement = connection.createStatement();<NEW_LINE>ResultSet rs = statement.executeQuery(SELECT_ALL_SQL);<NEW_LINE>while (rs.next()) {<NEW_LINE>String database = rs.getString("db_name");<NEW_LINE>String table = rs.getString("tb_name");<NEW_LINE>int status = rs.getInt("status");<NEW_LINE>// check if expired<NEW_LINE>Date expireTime = rs.getTimestamp("expire_time");<NEW_LINE>if (expireTime.before(now)) {<NEW_LINE>expiredLocks.add(new ImmutableTriple(database, table, expireTime));<NEW_LINE>} else {<NEW_LINE>setReadOnlyCache(tmpReadOnlyCache, <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>if (statement != null) {<NEW_LINE>statement.close();<NEW_LINE>}<NEW_LINE>if (connection != null) {<NEW_LINE>connection.close();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// remove expired locks<NEW_LINE>for (Triple triple : expiredLocks) {<NEW_LINE>setDbStatus((String) triple.getLeft(), DbReadOnlyStatus.WRITEABLE, -1, (Date) triple.getRight());<NEW_LINE>}<NEW_LINE>return tmpReadOnlyCache;<NEW_LINE>} | database, table, status != 0); |
1,477,980 | public ProcessInstanceDto startProcessInstance(UriInfo context, StartProcessInstanceDto parameters) {<NEW_LINE>ProcessInstanceWithVariables instance = null;<NEW_LINE>try {<NEW_LINE>instance = startProcessInstanceAtActivities(parameters);<NEW_LINE>} catch (AuthorizationException e) {<NEW_LINE>throw e;<NEW_LINE>} catch (ProcessEngineException e) {<NEW_LINE>String errorMessage = String.format("Cannot instantiate process definition %s: %s", processDefinitionId, e.getMessage());<NEW_LINE>throw new RestException(Status.INTERNAL_SERVER_ERROR, e, errorMessage);<NEW_LINE>} catch (RestException e) {<NEW_LINE>String errorMessage = String.format("Cannot instantiate process definition %s: %s", processDefinitionId, e.getMessage());<NEW_LINE>throw new InvalidRequestException(e.getStatus(), e, errorMessage);<NEW_LINE>}<NEW_LINE>ProcessInstanceDto result;<NEW_LINE>if (parameters.isWithVariablesInReturn()) {<NEW_LINE>result = ProcessInstanceWithVariablesDto.fromProcessInstance(instance);<NEW_LINE>} else {<NEW_LINE>result = ProcessInstanceDto.fromProcessInstance(instance);<NEW_LINE>}<NEW_LINE>URI uri = context.getBaseUriBuilder().path(rootResourcePath).path(ProcessInstanceRestService.PATH).path(instance.<MASK><NEW_LINE>result.addReflexiveLink(uri, HttpMethod.GET, "self");<NEW_LINE>return result;<NEW_LINE>} | getId()).build(); |
382,694 | public static DWARFCompileUnit read(DIEAggregate diea) throws IOException, DWARFException {<NEW_LINE>if (diea.getTag() != DWARFTag.DW_TAG_compile_unit) {<NEW_LINE>throw new IOException("Expecting a DW_TAG_compile_unit DIE, found " + diea.getTag());<NEW_LINE>}<NEW_LINE>String name = diea.getString(DWARFAttribute.DW_AT_name, null);<NEW_LINE>String producer = diea.getString(DWARFAttribute.DW_AT_producer, null);<NEW_LINE>String comp_dir = diea.getString(DWARFAttribute.DW_AT_comp_dir, null);<NEW_LINE>Number high_pc = null, low_pc = null, language = null;<NEW_LINE>if (diea.hasAttribute(DWARFAttribute.DW_AT_low_pc)) {<NEW_LINE>low_pc = diea.getLowPC(0);<NEW_LINE>}<NEW_LINE>// if lowPC and highPC values are the same, don't read the high value<NEW_LINE>// because Ghidra can't express an empty range.<NEW_LINE>if (diea.hasAttribute(DWARFAttribute.DW_AT_high_pc) && !diea.isLowPCEqualHighPC()) {<NEW_LINE>high_pc = diea.getHighPC();<NEW_LINE>}<NEW_LINE>if (diea.hasAttribute(DWARFAttribute.DW_AT_language)) {<NEW_LINE>language = diea.getUnsignedLong(DWARFAttribute.DW_AT_language, -1);<NEW_LINE>}<NEW_LINE>DWARFIdentifierCase identifier_case = null;<NEW_LINE>if (diea.hasAttribute(DWARFAttribute.DW_AT_identifier_case)) {<NEW_LINE>identifier_case = DWARFIdentifierCase.find(diea.getUnsignedLong(DWARFAttribute.DW_AT_identifier_case, -1));<NEW_LINE>}<NEW_LINE>boolean hasDWO = diea.hasAttribute(DWARFAttribute.DW_AT_GNU_dwo_id) && diea.hasAttribute(DWARFAttribute.DW_AT_GNU_dwo_name);<NEW_LINE>DWARFLine <MASK><NEW_LINE>return new DWARFCompileUnit(name, producer, comp_dir, low_pc, high_pc, language, identifier_case, hasDWO, line);<NEW_LINE>} | line = DWARFLine.read(diea); |
1,401,088 | private <T> Sequence<Object[]> execute(Query<T> query, final List<String> newFields, final List<SqlTypeName> newTypes) {<NEW_LINE>Hook.QUERY_PLAN.run(query);<NEW_LINE>if (query.getId() == null) {<NEW_LINE>final String queryId = UUID.randomUUID().toString();<NEW_LINE>plannerContext.addNativeQueryId(queryId);<NEW_LINE>query = query.withId(queryId);<NEW_LINE>}<NEW_LINE>query = query.withSqlQueryId(plannerContext.getSqlQueryId());<NEW_LINE>final AuthenticationResult authenticationResult = plannerContext.getAuthenticationResult();<NEW_LINE>final Access authorizationResult = plannerContext.getAuthorizationResult();<NEW_LINE>final QueryLifecycle queryLifecycle = queryLifecycleFactory.factorize();<NEW_LINE>// After calling "runSimple" the query will start running. We need to do this before reading the toolChest, since<NEW_LINE>// otherwise it won't yet be initialized. (A bummer, since ideally, we'd verify the toolChest exists and can do<NEW_LINE>// array-based results before starting the query; but in practice we don't expect this to happen since we keep<NEW_LINE>// tight control over which query types we generate in the SQL layer. They all support array-based results.)<NEW_LINE>final Sequence<T> results = queryLifecycle.runSimple(query, authenticationResult, authorizationResult);<NEW_LINE>// noinspection unchecked<NEW_LINE>final QueryToolChest<T, Query<T>> toolChest = queryLifecycle.getToolChest();<NEW_LINE>final List<String> resultArrayFields = toolChest.resultArraySignature(query).getColumnNames();<NEW_LINE>final Sequence<Object[]> resultArrays = toolChest.resultsAsArrays(query, results);<NEW_LINE>return mapResultSequence(<MASK><NEW_LINE>} | resultArrays, resultArrayFields, newFields, newTypes); |
1,205,403 | public static <T> Query applyAndBind(String queryString, Iterable<T> entities, EntityManager entityManager) {<NEW_LINE>Assert.notNull(queryString, "Querystring must not be null!");<NEW_LINE><MASK><NEW_LINE>Assert.notNull(entityManager, "EntityManager must not be null!");<NEW_LINE>Iterator<T> iterator = entities.iterator();<NEW_LINE>if (!iterator.hasNext()) {<NEW_LINE>return entityManager.createQuery(queryString);<NEW_LINE>}<NEW_LINE>String alias = detectAlias(queryString);<NEW_LINE>StringBuilder builder = new StringBuilder(queryString);<NEW_LINE>builder.append(" where");<NEW_LINE>int i = 0;<NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>iterator.next();<NEW_LINE>builder.append(String.format(" %s = ?%d", alias, ++i));<NEW_LINE>if (iterator.hasNext()) {<NEW_LINE>builder.append(" or");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Query query = entityManager.createQuery(builder.toString());<NEW_LINE>iterator = entities.iterator();<NEW_LINE>i = 0;<NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>query.setParameter(++i, iterator.next());<NEW_LINE>}<NEW_LINE>return query;<NEW_LINE>} | Assert.notNull(entities, "Iterable of entities must not be null!"); |
1,376,526 | public void loseFocus() {<NEW_LINE>logger.fine("loseFocus");<NEW_LINE>if (app != null) {<NEW_LINE>app.loseFocus();<NEW_LINE>}<NEW_LINE>if (view != null) {<NEW_LINE>view.onPause();<NEW_LINE>}<NEW_LINE>if (app != null) {<NEW_LINE>// pause the audio<NEW_LINE><MASK><NEW_LINE>if (audioRenderer != null) {<NEW_LINE>audioRenderer.pauseAll();<NEW_LINE>}<NEW_LINE>// pause the sensors (aka joysticks)<NEW_LINE>if (app.getContext() != null) {<NEW_LINE>JoyInput joyInput = app.getContext().getJoyInput();<NEW_LINE>if (joyInput != null) {<NEW_LINE>if (joyInput instanceof AndroidSensorJoyInput) {<NEW_LINE>AndroidSensorJoyInput androidJoyInput = (AndroidSensorJoyInput) joyInput;<NEW_LINE>androidJoyInput.pauseSensors();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>isGLThreadPaused = true;<NEW_LINE>} | AudioRenderer audioRenderer = app.getAudioRenderer(); |
924,365 | public void visit(BLangFunctionTypeNode functionTypeNode, AnalyzerData data) {<NEW_LINE>SymbolEnv currentEnv = data.env;<NEW_LINE>boolean isLambda = false;<NEW_LINE>if (currentEnv.node.getKind() == FUNCTION) {<NEW_LINE>BLangFunction function = (BLangFunction) currentEnv.node;<NEW_LINE>isLambda = function.flagSet.contains(Flag.LAMBDA);<NEW_LINE>}<NEW_LINE>List<BLangVariable> params = functionTypeNode.params;<NEW_LINE>for (BLangVariable param : params) {<NEW_LINE><MASK><NEW_LINE>if (isLambda && param.symbol != null) {<NEW_LINE>symResolver.checkForUniqueSymbol(param.pos, currentEnv, param.symbol);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (functionTypeNode.restParam != null) {<NEW_LINE>analyzeDef(functionTypeNode.restParam.typeNode, data);<NEW_LINE>if (isLambda && functionTypeNode.restParam.symbol != null) {<NEW_LINE>symResolver.checkForUniqueSymbol(functionTypeNode.restParam.pos, currentEnv, functionTypeNode.restParam.symbol);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (functionTypeNode.returnTypeNode != null) {<NEW_LINE>analyzeDef(functionTypeNode.returnTypeNode, data);<NEW_LINE>}<NEW_LINE>} | analyzeDef(param.typeNode, data); |
1,224,227 | protected void readRepo() throws XmlPullParserException, IOException {<NEW_LINE>parser.require(XmlPullParser.START_TAG, NS, "repository");<NEW_LINE>Repository repository = new Repository();<NEW_LINE>repository.isPartial = "true".equals(parser.getAttributeValue(NS, "partial"));<NEW_LINE>repository.partialUrl = parser.getAttributeValue(NS, "partial-url");<NEW_LINE>repository.version = parser.getAttributeValue(NS, "version");<NEW_LINE>while (parser.nextTag() == XmlPullParser.START_TAG) {<NEW_LINE><MASK><NEW_LINE>switch(tagName) {<NEW_LINE>case "name":<NEW_LINE>repository.name = parser.nextText();<NEW_LINE>break;<NEW_LINE>case "module":<NEW_LINE>triggerRepoEvent(repository);<NEW_LINE>Module module = readModule(repository);<NEW_LINE>if (module != null)<NEW_LINE>mCallback.onNewModule(module);<NEW_LINE>break;<NEW_LINE>case "remove-module":<NEW_LINE>triggerRepoEvent(repository);<NEW_LINE>String packageName = readRemoveModule();<NEW_LINE>if (packageName != null)<NEW_LINE>mCallback.onRemoveModule(packageName);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>skip(true);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>mCallback.onCompleted(repository);<NEW_LINE>} | String tagName = parser.getName(); |
159,477 | // implement RexToSqlNodeConverter<NEW_LINE>public SqlNode convertLiteral(RexLiteral literal) {<NEW_LINE>// Numeric<NEW_LINE>if (SqlTypeFamily.EXACT_NUMERIC.getTypeNames().contains(literal.getTypeName())) {<NEW_LINE>return SqlLiteral.createExactNumeric(literal.getValue().toString(), SqlParserPos.ZERO);<NEW_LINE>}<NEW_LINE>if (SqlTypeFamily.APPROXIMATE_NUMERIC.getTypeNames().contains(literal.getTypeName())) {<NEW_LINE>return SqlLiteral.createApproxNumeric(literal.getValue().toString(), SqlParserPos.ZERO);<NEW_LINE>}<NEW_LINE>// Timestamp<NEW_LINE>if (SqlTypeFamily.TIMESTAMP.getTypeNames().contains(literal.getTypeName())) {<NEW_LINE>return SqlLiteral.createTimestamp(literal.getValueAs(TimestampString.class<MASK><NEW_LINE>}<NEW_LINE>// Date<NEW_LINE>if (SqlTypeFamily.DATE.getTypeNames().contains(literal.getTypeName())) {<NEW_LINE>return SqlLiteral.createDate(literal.getValueAs(DateString.class), SqlParserPos.ZERO);<NEW_LINE>}<NEW_LINE>// Time<NEW_LINE>if (SqlTypeFamily.TIME.getTypeNames().contains(literal.getTypeName())) {<NEW_LINE>return SqlLiteral.createTime(literal.getValueAs(TimeString.class), 0, SqlParserPos.ZERO);<NEW_LINE>}<NEW_LINE>// String<NEW_LINE>if (SqlTypeFamily.CHARACTER.getTypeNames().contains(literal.getTypeName())) {<NEW_LINE>return SqlLiteral.createCharString(((NlsString) (literal.getValue())).getValue(), SqlParserPos.ZERO);<NEW_LINE>}<NEW_LINE>// Boolean<NEW_LINE>if (SqlTypeFamily.BOOLEAN.getTypeNames().contains(literal.getTypeName())) {<NEW_LINE>return SqlLiteral.createBoolean((Boolean) literal.getValue(), SqlParserPos.ZERO);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | ), 0, SqlParserPos.ZERO); |
1,711,835 | public Iterator<E> iterator() {<NEW_LINE>final LinkedList<E> list = elements;<NEW_LINE>return new Iterator<E>() {<NEW_LINE><NEW_LINE>ListIterator<E> i = list.listIterator(0);<NEW_LINE><NEW_LINE>public boolean hasNext() {<NEW_LINE>return i.hasNext();<NEW_LINE>}<NEW_LINE><NEW_LINE>public E next() {<NEW_LINE>if (which != Subject.PRIV_CREDENTIAL_SET) {<NEW_LINE>return i.next();<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>if (sm != null) {<NEW_LINE>try {<NEW_LINE>sm.checkPermission(new PrivateCredentialPermission(list.get(i.nextIndex()).getClass().getName(), subject.getPrincipals()));<NEW_LINE>} catch (SecurityException se) {<NEW_LINE>i.next();<NEW_LINE>throw (se);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return i.next();<NEW_LINE>}<NEW_LINE><NEW_LINE>public void remove() {<NEW_LINE>if (subject.isReadOnly()) {<NEW_LINE>throw new IllegalStateException(ResourcesMgr.getString("Subject.is.read.only"));<NEW_LINE>}<NEW_LINE>i.remove();<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | SecurityManager sm = System.getSecurityManager(); |
378,043 | final ListStreamsResult executeListStreams(ListStreamsRequest listStreamsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listStreamsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListStreamsRequest> request = null;<NEW_LINE>Response<ListStreamsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListStreamsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listStreamsRequest));<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, "ivs");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListStreams");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListStreamsResult>> 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 ListStreamsResultJsonUnmarshaller()); |
1,034,497 | public void init() throws StoreInitializationException {<NEW_LINE>if (initialized.get()) {<NEW_LINE>throw new StoreInitializationException("Illegal state while initializing store. Store was already initialized");<NEW_LINE>}<NEW_LINE>localStore.init();<NEW_LINE>createOrVerifySchemaTopic();<NEW_LINE>// set the producer properties and initialize a Kafka producer client<NEW_LINE>Properties props = new Properties();<NEW_LINE>addSchemaRegistryConfigsToClientProperties(this.config, props);<NEW_LINE>props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapBrokers);<NEW_LINE>props.put(ProducerConfig.ACKS_CONFIG, "-1");<NEW_LINE>props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, org.apache.kafka.common.serialization.ByteArraySerializer.class);<NEW_LINE>props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, org.apache.kafka.common.serialization.ByteArraySerializer.class);<NEW_LINE>// Producer should not retry<NEW_LINE>props.put(ProducerConfig.RETRIES_CONFIG, 0);<NEW_LINE>props.put(ProducerConfig.ENABLE_IDEMPOTENCE_CONFIG, false);<NEW_LINE>producer = new KafkaProducer<byte[], byte[]>(props);<NEW_LINE>// start the background thread that subscribes to the Kafka topic and applies updates.<NEW_LINE>// the thread must be created after the schema topic has been created.<NEW_LINE>this.kafkaTopicReader = new KafkaStoreReaderThread<>(this.bootstrapBrokers, topic, groupId, this.storeUpdateHandler, serializer, this.localStore, this.producer, this.noopKey, this.initialized, this.config);<NEW_LINE>this.kafkaTopicReader.start();<NEW_LINE>try {<NEW_LINE>waitUntilKafkaReaderReachesLastOffset(initTimeout);<NEW_LINE>} catch (StoreException e) {<NEW_LINE>throw new StoreInitializationException(e);<NEW_LINE>}<NEW_LINE>boolean isInitialized = initialized.compareAndSet(false, true);<NEW_LINE>if (!isInitialized) {<NEW_LINE>throw new StoreInitializationException("Illegal state while initializing store. Store " + "was already initialized");<NEW_LINE>}<NEW_LINE>this.storeUpdateHandler.cacheInitialized(new HashMap<><MASK><NEW_LINE>initLatch.countDown();<NEW_LINE>} | (kafkaTopicReader.checkpoints())); |
7,121 | protected Object doWork() {<NEW_LINE>inputReports.stream().map(GATKPath::toPath).forEach(IOUtil::assertFileIsReadable);<NEW_LINE>try (final PrintStream tranchesStream = new PrintStream(outputReport.getOutputStream())) {<NEW_LINE>// use a data structure to hold the tranches from each scatter shard in a format that's easy to merge<NEW_LINE>final TreeMap<Double, List<VQSLODTranche>> <MASK><NEW_LINE>for (final GATKPath trancheFile : inputReports) {<NEW_LINE>try {<NEW_LINE>for (final VQSLODTranche currentTranche : VQSLODTranche.readTranches(trancheFile)) {<NEW_LINE>if (scatteredTranches.containsKey(currentTranche.minVQSLod)) {<NEW_LINE>scatteredTranches.get(currentTranche.minVQSLod).add(currentTranche);<NEW_LINE>} else {<NEW_LINE>scatteredTranches.put(currentTranche.minVQSLod, new ArrayList<>(Arrays.asList(currentTranche)));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new UserException.CouldNotReadInputFile(trancheFile, "Error reading tranch input", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>tranchesStream.print(TruthSensitivityTranche.printHeader());<NEW_LINE>tranchesStream.print(Tranche.tranchesString(VQSLODTranche.mergeAndConvertTranches(scatteredTranches, TS_TRANCHES, MODE)));<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>} | scatteredTranches = new TreeMap<>(); |
672,113 | public Document toXml(XmlWriterContext ctx) {<NEW_LINE>String self = ctx.pipelineXmlLink(instance.getName(), instance.getCounter());<NEW_LINE>DocumentBuilder builder = DocumentBuilder.withRoot("pipeline").attr("name", instance.getName()).attr("counter", instance.getCounter()).link(self, "self").cdataNode("id", instance.getPipelineIdentifier().asURN()).textNode("scheduleTime", instance.getScheduledDate());<NEW_LINE>PipelineTimelineEntry pipelineAfter = instance.getPipelineAfter();<NEW_LINE>if (pipelineAfter != null) {<NEW_LINE>builder.link(ctx.pipelineXmlLink(pipelineAfter.getPipelineName(), pipelineAfter.getId()), "insertedBefore");<NEW_LINE>}<NEW_LINE>PipelineTimelineEntry pipelineBefore = instance.getPipelineBefore();<NEW_LINE>if (pipelineBefore != null) {<NEW_LINE>builder.link(ctx.pipelineXmlLink(pipelineBefore.getPipelineName(), pipelineBefore.getId()), "insertedAfter");<NEW_LINE>}<NEW_LINE>builder.node("materials", materialBuilder -> {<NEW_LINE>instance.getLatestRevisions().forEach(revision -> {<NEW_LINE>this.<MASK><NEW_LINE>});<NEW_LINE>});<NEW_LINE>builder.node("stages", stagesBuilder -> {<NEW_LINE>instance.getStageHistory().stream().filter(stage -> !(stage instanceof NullStageHistoryItem)).forEach(stage -> stagesBuilder.node("stage", stageBuilder -> stageBuilder.attr("href", ctx.stageXmlLink(stage.getIdentifier()))));<NEW_LINE>});<NEW_LINE>builder.cdataNode("approvedBy", instance.getApprovedBy());<NEW_LINE>return builder.build();<NEW_LINE>} | populateMaterials(materialBuilder, revision, ctx); |
742,053 | public VoidResponse updateGlossary(String serverName, String userId, String glossaryGUID, GlossaryRequestBody requestBody) {<NEW_LINE>final String methodName = "updateGlossary";<NEW_LINE>RESTCallToken token = restCallLogger.logRESTCall(serverName, userId, methodName);<NEW_LINE>VoidResponse response = new VoidResponse();<NEW_LINE>AuditLog auditLog = null;<NEW_LINE>try {<NEW_LINE>auditLog = instanceHandler.<MASK><NEW_LINE>if (requestBody != null) {<NEW_LINE>GlossaryExchangeHandler handler = instanceHandler.getGlossaryExchangeHandler(userId, serverName, methodName);<NEW_LINE>handler.updateGlossary(userId, requestBody.getMetadataCorrelationProperties(), glossaryGUID, requestBody.getElementProperties(), methodName);<NEW_LINE>} else {<NEW_LINE>restExceptionHandler.handleNoRequestBody(userId, methodName, serverName);<NEW_LINE>}<NEW_LINE>} catch (Exception error) {<NEW_LINE>restExceptionHandler.captureExceptions(response, error, methodName, auditLog);<NEW_LINE>}<NEW_LINE>restCallLogger.logRESTCallReturn(token, response.toString());<NEW_LINE>return response;<NEW_LINE>} | getAuditLog(userId, serverName, methodName); |
718,328 | private ModeImpl unSlide(TopComponent tc, ModeImpl source) {<NEW_LINE>String tcID = WindowManagerImpl.getInstance().findTopComponentID(tc);<NEW_LINE>ModeImpl targetMode = model.getModeTopComponentPreviousMode(source, tcID);<NEW_LINE>int targetIndex = model.getModeTopComponentPreviousIndex(source, tcID);<NEW_LINE>if ((targetMode == null) || !model.getModes().contains(targetMode)) {<NEW_LINE>// mode to return to isn't valid anymore, try constraints<NEW_LINE>SplitConstraint[] constraints = model.getModeTopComponentPreviousConstraints(source, tcID);<NEW_LINE>if (constraints != null) {<NEW_LINE>// create mode with the same constraints to dock topcomponent back into<NEW_LINE>targetMode = WindowManagerImpl.getInstance().createModeImpl(ModeImpl.getUnusedModeName(), source.getKind(), false);<NEW_LINE>model.addMode(targetMode, constraints);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (targetMode == null) {<NEW_LINE>// fallback, previous saved mode not found somehow, use default modes<NEW_LINE>targetMode = source.getKind() == Constants.MODE_KIND_EDITOR ? WindowManagerImpl.getInstance().getDefaultEditorMode() : WindowManagerImpl.getInstance().getDefaultViewMode();<NEW_LINE>}<NEW_LINE>moveTopComponentIntoMode(targetMode, tc, targetIndex);<NEW_LINE>targetMode.setMinimized(false);<NEW_LINE>if (source.isEmpty()) {<NEW_LINE>model.removeMode(source);<NEW_LINE>}<NEW_LINE>if (isVisible()) {<NEW_LINE>viewRequestor.scheduleRequest(new ViewRequest(null, View.CHANGE_TOPCOMPONENT_AUTO_HIDE_DISABLED, null, null));<NEW_LINE>}<NEW_LINE>WindowManagerImpl.getInstance().doFirePropertyChange(WindowManagerImpl.<MASK><NEW_LINE>return targetMode;<NEW_LINE>} | PROP_ACTIVE_MODE, null, getActiveMode()); |
1,425,472 | public Sequence execute(StaticContext sctx, QueryContext ctx, Sequence[] args) {<NEW_LINE>if (args.length != 2 && args.length != 3) {<NEW_LINE>throw new QueryException(new QNm("No valid arguments specified!"));<NEW_LINE>}<NEW_LINE>final JsonDBItem doc = (JsonDBItem) args[0];<NEW_LINE>final JsonNodeReadOnlyTrx rtx = doc.getTrx();<NEW_LINE>final JsonResourceManager manager = rtx.getResourceManager();<NEW_LINE>final Optional<JsonNodeTrx> optionalWriteTrx = manager.getNodeTrx();<NEW_LINE>final JsonNodeTrx wtx = optionalWriteTrx.orElseGet(manager::beginNodeTrx);<NEW_LINE>if (rtx.getRevisionNumber() < manager.getMostRecentRevisionNumber()) {<NEW_LINE>wtx.revertTo(rtx.getRevisionNumber());<NEW_LINE>}<NEW_LINE>final JsonIndexController controller = wtx.getResourceManager().getWtxIndexController(wtx.getRevisionNumber() - 1);<NEW_LINE>if (controller == null) {<NEW_LINE>throw new QueryException(new QNm("Document not found: " + ((Str) args[1]).stringValue()));<NEW_LINE>}<NEW_LINE>Type type = null;<NEW_LINE>if (args[1] != null) {<NEW_LINE>final QNm name = new QNm(Namespaces.XS_NSURI, ((Str) args[1]).stringValue());<NEW_LINE>type = sctx.getTypes().resolveAtomicType(name);<NEW_LINE>}<NEW_LINE>final Set<Path<QNm>> paths = new HashSet<>();<NEW_LINE>if (args.length == 3 && args[2] != null) {<NEW_LINE>final Iter it = args[2].iterate();<NEW_LINE>Item next = it.next();<NEW_LINE>while (next != null) {<NEW_LINE>paths.add(Path.parse(((Str) next).stringValue(), org.brackit.xquery.util.path.PathParser.Type.JSON));<NEW_LINE>next = it.next();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final IndexDef idxDef = IndexDefs.createCASIdxDef(false, type, paths, controller.getIndexes().getNrOfIndexDefsWithType(IndexType.CAS), IndexDef.DbType.JSON);<NEW_LINE>try {<NEW_LINE>controller.createIndexes(Set.of(idxDef), wtx);<NEW_LINE>} catch (final SirixIOException e) {<NEW_LINE>throw new QueryException(new QNm("I/O exception: " + e<MASK><NEW_LINE>}<NEW_LINE>return idxDef.materialize();<NEW_LINE>} | .getMessage()), e); |
65,956 | public void read(Kryo kryo, Input input) {<NEW_LINE><MASK><NEW_LINE>int methodClassID = input.readInt(true);<NEW_LINE>Class methodClass = kryo.getRegistration(methodClassID).getType();<NEW_LINE>byte methodIndex = input.readByte();<NEW_LINE>try {<NEW_LINE>cachedMethod = getMethods(kryo, methodClass)[methodIndex];<NEW_LINE>} catch (IndexOutOfBoundsException ex) {<NEW_LINE>throw new KryoException("Invalid method index " + methodIndex + " for class: " + methodClass.getName());<NEW_LINE>}<NEW_LINE>Serializer[] serializers = cachedMethod.serializers;<NEW_LINE>Class[] parameterTypes = cachedMethod.method.getParameterTypes();<NEW_LINE>Object[] args = new Object[serializers.length];<NEW_LINE>this.args = args;<NEW_LINE>for (int i = 0, n = args.length; i < n; i++) {<NEW_LINE>Serializer serializer = serializers[i];<NEW_LINE>if (serializer != null)<NEW_LINE>args[i] = kryo.readObjectOrNull(input, parameterTypes[i], serializer);<NEW_LINE>else<NEW_LINE>args[i] = kryo.readClassAndObject(input);<NEW_LINE>}<NEW_LINE>responseData = input.readByte();<NEW_LINE>} | objectID = input.readInt(true); |
1,431,344 | public void createTranslation(Properties ctx, TransformerHandler document, PO entity) throws SAXException {<NEW_LINE>if (!MSysConfig.getBooleanValue(HANDLE_TRANSLATION_FLAG, false)) {<NEW_LINE>// translation import option is disabled<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Validate table<NEW_LINE>String tableName = entity.get_TableName() + "_Trl";<NEW_LINE>// Verify if Table Exist<NEW_LINE>MTable table = MTable.get(ctx, tableName);<NEW_LINE>if (table == null || Util.isEmpty(table.getTableName())) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Where clause<NEW_LINE>String whereClause = entity.get_TableName() + "_ID = ? " + "AND EXISTS(SELECT 1 FROM AD_Language l " + "WHERE l.AD_Language = " + tableName + ".AD_Language " + "AND l.IsSystemLanguage = ? " + "AND l.IsBaseLanguage = ?)";<NEW_LINE>// Export<NEW_LINE>List<PO> translationList = new Query(ctx, tableName, whereClause, null).setParameters(entity.get_ID(), true, false).setOnlyActiveRecords(true).list();<NEW_LINE>// Create<NEW_LINE>for (PO translation : translationList) {<NEW_LINE>create(ctx, document, <MASK><NEW_LINE>}<NEW_LINE>} | translation, false, null, true); |
963,283 | public void actionPerformed(ActionEvent e) {<NEW_LINE>if (0 == getModel().getRowCount())<NEW_LINE>return;<NEW_LINE>int currentRow = getSelectedRow();<NEW_LINE>if (currentRow < 0) {<NEW_LINE>currentRow = 0;<NEW_LINE>} else if (!(isFoldingModel() && getFoldingModel().isGroupRow(currentRow))) {<NEW_LINE>currentRow += (navigateToNextTask ? 1 : -1);<NEW_LINE>}<NEW_LINE>TaskListModel tlm = (TaskListModel) getModel();<NEW_LINE>while (true) {<NEW_LINE>if (currentRow < 0)<NEW_LINE>currentRow = tlm.getRowCount() - 1;<NEW_LINE>else if (currentRow >= tlm.getRowCount())<NEW_LINE>currentRow = 0;<NEW_LINE>Task t = tlm.getTaskAtRow(currentRow);<NEW_LINE>if (null != t) {<NEW_LINE>getSelectionModel().setSelectionInterval(currentRow, currentRow);<NEW_LINE>scrollRectToVisible(getCellRect(currentRow, 0, true));<NEW_LINE>Action a = new OpenTaskAction(t);<NEW_LINE>if (a.isEnabled()) {<NEW_LINE>a.actionPerformed(e);<NEW_LINE>} else {<NEW_LINE>TaskListTopComponent.findInstance().requestActive();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>} else if (isFoldingModel()) {<NEW_LINE>FoldingTaskListModel.FoldingGroup fg = getFoldingModel().getGroupAtRow(currentRow);<NEW_LINE>if (!fg.isExpanded())<NEW_LINE>fg.setExpanded(true);<NEW_LINE>}<NEW_LINE>currentRow += <MASK><NEW_LINE>}<NEW_LINE>} | (navigateToNextTask ? 1 : -1); |
1,027,055 | protected SettableBeanProperty _resolveInnerClassValuedProperty(DeserializationContext ctxt, SettableBeanProperty prop) {<NEW_LINE>JsonDeserializer<Object> deser = prop.getValueDeserializer();<NEW_LINE>// ideally wouldn't rely on it being BeanDeserializerBase; but for now it'll have to do<NEW_LINE>if (deser instanceof BeanDeserializerBase) {<NEW_LINE>BeanDeserializerBase bd = (BeanDeserializerBase) deser;<NEW_LINE>ValueInstantiator vi = bd.getValueInstantiator();<NEW_LINE>if (!vi.canCreateUsingDefault()) {<NEW_LINE>// no default constructor<NEW_LINE>Class<?> valueClass = prop.getType().getRawClass();<NEW_LINE>// NOTE: almost same as `isNonStaticInnerClass()` but need to know enclosing...<NEW_LINE>Class<?> enclosing = ClassUtil.getOuterClass(valueClass);<NEW_LINE>// and is inner class of the bean class...<NEW_LINE>if ((enclosing != null) && (enclosing == _beanType.getRawClass())) {<NEW_LINE>for (Constructor<?> ctor : valueClass.getConstructors()) {<NEW_LINE>if (ctor.getParameterCount() == 1) {<NEW_LINE>Class<?>[<MASK><NEW_LINE>if (enclosing.equals(paramTypes[0])) {<NEW_LINE>if (ctxt.canOverrideAccessModifiers()) {<NEW_LINE>ClassUtil.checkAndFixAccess(ctor, ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS));<NEW_LINE>}<NEW_LINE>return new InnerClassProperty(prop, ctor);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return prop;<NEW_LINE>} | ] paramTypes = ctor.getParameterTypes(); |
1,717,223 | static int writeInt(byte[] bytes, int off, int i) {<NEW_LINE>if (i >= BC_INT32_NUM_MIN && i <= BC_INT32_NUM_MAX) {<NEW_LINE>bytes[off++] = (byte) i;<NEW_LINE>return 1;<NEW_LINE>}<NEW_LINE>if (i >= INT32_BYTE_MIN && i <= INT32_BYTE_MAX) {<NEW_LINE>bytes[off++] = (byte) (BC_INT32_BYTE_ZERO + (i >> 8));<NEW_LINE>bytes[off++] = (byte) i;<NEW_LINE>return 2;<NEW_LINE>}<NEW_LINE>if (i >= INT32_SHORT_MIN && i <= INT32_SHORT_MAX) {<NEW_LINE>bytes[off++] = (byte) (BC_INT32_SHORT_ZERO + (i >> 16));<NEW_LINE>bytes[off++] = (byte) (i >> 8);<NEW_LINE>bytes[<MASK><NEW_LINE>return 3;<NEW_LINE>}<NEW_LINE>bytes[off++] = BC_INT32;<NEW_LINE>bytes[off++] = (byte) (i >>> 24);<NEW_LINE>bytes[off++] = (byte) (i >>> 16);<NEW_LINE>bytes[off++] = (byte) (i >>> 8);<NEW_LINE>bytes[off++] = (byte) i;<NEW_LINE>return 5;<NEW_LINE>} | off++] = (byte) i; |
1,472,506 | private void processModule(String module, Map<String, Map<String, String>> file2LicenseHeaders) throws IOException {<NEW_LINE>File d = new File(new File(getProject().getProperty("nb_all"), module), "external");<NEW_LINE>Set<String> hgFiles = VerifyLibsAndLicenses.findHgControlledFiles(d);<NEW_LINE>Map<String, Map<String, String>> binary2License = CreateLicenseSummary.findBinary2LicenseHeaderMapping(hgFiles, d);<NEW_LINE>for (String n : hgFiles) {<NEW_LINE>if (!n.endsWith(".jar") && !n.endsWith(".zip") && !n.endsWith(".xml") && !n.endsWith(".js") && !n.endsWith(".dylib")) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Map<String, String> <MASK><NEW_LINE>if (headers == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// TODO: check unique!<NEW_LINE>file2LicenseHeaders.put(n, headers);<NEW_LINE>}<NEW_LINE>} | headers = binary2License.get(n); |
1,739,563 | public void alarm(Object alarmContext) {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())<NEW_LINE>SibTr.entry(this, tc, "alarm", alarmContext);<NEW_LINE>boolean alarmValid = false;<NEW_LINE>boolean presentInConnectionList = false;<NEW_LINE>Object[] listEntry = null;<NEW_LINE>// Take the pools monitor so that no-one else can try and remove the<NEW_LINE>// connection from the pool while we decide if we should close it or not.<NEW_LINE>synchronized (this) {<NEW_LINE>// The alarm context is a tuple (implemented as an object array of<NEW_LINE>// size 2) containing the connection list to which the connection<NEW_LINE>// belongs and another tuple. This second tuple contains the connection<NEW_LINE>// itself and an object which represents whether it is still valid to<NEW_LINE>// close the connection.<NEW_LINE>Object[] contextArray = (Object[]) alarmContext;<NEW_LINE>LinkedList connectionList <MASK><NEW_LINE>listEntry = (Object[]) contextArray[1];<NEW_LINE>alarmValid = ((AlarmValid) listEntry[1]).isValid();<NEW_LINE>if (alarmValid)<NEW_LINE>presentInConnectionList = connectionList.remove(listEntry);<NEW_LINE>}<NEW_LINE>// If we found (and removed) a connection suitable to be closed, then<NEW_LINE>// close it. As we did all the updates to shared structures in the<NEW_LINE>// above synchronized block, we are safe to do the close without<NEW_LINE>// holding any monitors.<NEW_LINE>if (presentInConnectionList) {<NEW_LINE>OutboundConnection connection = (OutboundConnection) listEntry[0];<NEW_LINE>connection.physicalClose(true);<NEW_LINE>}<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())<NEW_LINE>SibTr.exit(this, tc, "alarm");<NEW_LINE>} | = (LinkedList) contextArray[0]; |
1,208,389 | private // ==================================================================================================<NEW_LINE>void runDecompilerAnalysis(Program program, AddressSetView functionEntries, TaskMonitor monitor) throws InterruptedException, Exception {<NEW_LINE>CachingPool<DecompInterface> decompilerPool = new CachingPool<>(new DecompilerFactory(program));<NEW_LINE>QRunnable<Address> callback <MASK><NEW_LINE>ConcurrentGraphQ<Address> queue = null;<NEW_LINE>monitor.initialize(functionEntries.getNumAddresses());<NEW_LINE>try {<NEW_LINE>monitor.setMessage(NAME + " - creating dependency graph...");<NEW_LINE>AcyclicCallGraphBuilder builder = new AcyclicCallGraphBuilder(program, functionEntries, true);<NEW_LINE>AbstractDependencyGraph<Address> graph = builder.getDependencyGraph(monitor);<NEW_LINE>if (graph.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>GThreadPool pool = AutoAnalysisManager.getSharedAnalsysThreadPool();<NEW_LINE>queue = new ConcurrentGraphQ<>(callback, graph, pool, monitor);<NEW_LINE>monitor.setMessage(NAME + " - analyzing call conventions...");<NEW_LINE>monitor.initialize(graph.size());<NEW_LINE>queue.execute();<NEW_LINE>} finally {<NEW_LINE>if (queue != null) {<NEW_LINE>queue.dispose();<NEW_LINE>}<NEW_LINE>decompilerPool.dispose();<NEW_LINE>}<NEW_LINE>} | = new ParallelDecompilerCallback(decompilerPool, program); |
1,621,165 | public DataFlowOpForgeInitializeResult initializeForge(DataFlowOpForgeInitializeContext context) throws ExprValidationException {<NEW_LINE>if (context.getOutputPorts().size() != 1) {<NEW_LINE>throw new IllegalArgumentException("EventBusSource operator requires one output stream but produces " + context.getOutputPorts().size() + " streams");<NEW_LINE>}<NEW_LINE>DataFlowOpOutputPort portZero = context.getOutputPorts().get(0);<NEW_LINE>if (portZero.getOptionalDeclaredType() == null || portZero.getOptionalDeclaredType().getEventType() == null) {<NEW_LINE>throw new IllegalArgumentException("EventBusSource operator requires an event type declated for the output stream");<NEW_LINE>}<NEW_LINE>EventType eventType = portZero.getOptionalDeclaredType().getEventType();<NEW_LINE>if (!portZero.getOptionalDeclaredType().isUnderlying()) {<NEW_LINE>submitEventBean = true;<NEW_LINE>}<NEW_LINE>DataFlowParameterValidation.validate("filter", filter, eventType, boolean.class, context);<NEW_LINE>try {<NEW_LINE>List<ExprNode<MASK><NEW_LINE>if (filter != null) {<NEW_LINE>filters = Collections.singletonList(filter);<NEW_LINE>}<NEW_LINE>StreamTypeServiceImpl streamTypeService = new StreamTypeServiceImpl(eventType, eventType.getName(), true);<NEW_LINE>FilterSpecCompiledDesc compiledDesc = FilterSpecCompiler.makeFilterSpec(eventType, eventType.getName(), filters, null, null, null, null, streamTypeService, null, context.getStatementRawInfo(), context.getServices());<NEW_LINE>filterSpecCompiled = compiledDesc.getFilterSpecCompiled();<NEW_LINE>} catch (ExprValidationException ex) {<NEW_LINE>throw new ExprValidationException("Failed to obtain filter parameters: " + ex.getMessage(), ex);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | > filters = Collections.emptyList(); |
551,099 | final DescribeQuerySuggestionsBlockListResult executeDescribeQuerySuggestionsBlockList(DescribeQuerySuggestionsBlockListRequest describeQuerySuggestionsBlockListRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeQuerySuggestionsBlockListRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeQuerySuggestionsBlockListRequest> request = null;<NEW_LINE>Response<DescribeQuerySuggestionsBlockListResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeQuerySuggestionsBlockListRequestProtocolMarshaller(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, "kendra");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeQuerySuggestionsBlockList");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeQuerySuggestionsBlockListResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeQuerySuggestionsBlockListResultJsonUnmarshaller());<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(describeQuerySuggestionsBlockListRequest)); |
1,155,156 | private void _startNewLocalityGroup(String name, Set<ByteSequence> columnFamilies) throws IOException {<NEW_LINE>if (dataClosed) {<NEW_LINE>throw new IllegalStateException("data closed");<NEW_LINE>}<NEW_LINE>if (startedDefaultLocalityGroup) {<NEW_LINE>throw new IllegalStateException("Can not start anymore new locality groups after default locality group started");<NEW_LINE>}<NEW_LINE>if (lgWriter != null) {<NEW_LINE>lgWriter.close();<NEW_LINE>}<NEW_LINE>if (currentLocalityGroup != null) {<NEW_LINE>localityGroups.add(currentLocalityGroup);<NEW_LINE>sampleGroups.add(sampleLocalityGroup);<NEW_LINE>}<NEW_LINE>if (columnFamilies == null) {<NEW_LINE>startedDefaultLocalityGroup = true;<NEW_LINE>currentLocalityGroup = new LocalityGroupMetadata(previousColumnFamilies, indexBlockSize, fileWriter);<NEW_LINE>sampleLocalityGroup = new LocalityGroupMetadata(previousColumnFamilies, indexBlockSize, fileWriter);<NEW_LINE>} else {<NEW_LINE>if (!Collections.disjoint(columnFamilies, previousColumnFamilies)) {<NEW_LINE>HashSet<ByteSequence> overlap = new HashSet<>(columnFamilies);<NEW_LINE>overlap.retainAll(previousColumnFamilies);<NEW_LINE>throw new IllegalArgumentException("Column families over lap with previous locality group : " + overlap);<NEW_LINE>}<NEW_LINE>currentLocalityGroup = new LocalityGroupMetadata(name, columnFamilies, indexBlockSize, fileWriter);<NEW_LINE>sampleLocalityGroup = new LocalityGroupMetadata(name, columnFamilies, indexBlockSize, fileWriter);<NEW_LINE>previousColumnFamilies.addAll(columnFamilies);<NEW_LINE>}<NEW_LINE>SampleLocalityGroupWriter sampleWriter = null;<NEW_LINE>if (sampler != null) {<NEW_LINE>sampleWriter = new SampleLocalityGroupWriter(new LocalityGroupWriter(fileWriter, blockSize, maxBlockSize, sampleLocalityGroup, null), sampler);<NEW_LINE>}<NEW_LINE>lgWriter = new LocalityGroupWriter(fileWriter, <MASK><NEW_LINE>} | blockSize, maxBlockSize, currentLocalityGroup, sampleWriter); |
406,181 | public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {<NEW_LINE>FontRenderer fr = minecraft.fontRenderer;<NEW_LINE>String txt = Lang.GUI_COMBGEN_OUTPUT.get("");<NEW_LINE>int sw = fr.getStringWidth(txt);<NEW_LINE>fr.drawStringWithShadow(txt, 89 - sw / 2 - xOff, 0 - yOff, ColorUtil.getRGB(Color.WHITE));<NEW_LINE>txt = "-";<NEW_LINE>sw = fr.getStringWidth(txt);<NEW_LINE>fr.drawStringWithShadow("-", 89 - sw / 2 - xOff, 10 - yOff, ColorUtil.getRGB(Color.WHITE));<NEW_LINE>int y = 21 - yOff - 2;<NEW_LINE>int x = 114 - xOff;<NEW_LINE>txt = mathMax.getTicksPerCoolant() + "-" + LangFluid.tMB(mathMin.getTicksPerCoolant());<NEW_LINE>sw = fr.getStringWidth(txt);<NEW_LINE>fr.drawStringWithShadow(txt, x - sw / 2 + 7, y + fr.FONT_HEIGHT / 2 + 47, ColorUtil.getRGB(Color.WHITE));<NEW_LINE>x = 48 - xOff;<NEW_LINE>txt = mathMax.getTicksPerFuel() + "-" + LangFluid.tMB(mathMin.getTicksPerFuel());<NEW_LINE><MASK><NEW_LINE>fr.drawStringWithShadow(txt, x - sw / 2 + 7, y + fr.FONT_HEIGHT / 2 + 47, ColorUtil.getRGB(Color.WHITE));<NEW_LINE>GlStateManager.color(1, 1, 1, 1);<NEW_LINE>} | sw = fr.getStringWidth(txt); |
378,799 | public static ListOTAModuleByProductResponse unmarshall(ListOTAModuleByProductResponse listOTAModuleByProductResponse, UnmarshallerContext _ctx) {<NEW_LINE>listOTAModuleByProductResponse.setRequestId(_ctx.stringValue("ListOTAModuleByProductResponse.RequestId"));<NEW_LINE>listOTAModuleByProductResponse.setSuccess(_ctx.booleanValue("ListOTAModuleByProductResponse.Success"));<NEW_LINE>listOTAModuleByProductResponse.setCode(_ctx.stringValue("ListOTAModuleByProductResponse.Code"));<NEW_LINE>listOTAModuleByProductResponse.setErrorMessage(_ctx.stringValue("ListOTAModuleByProductResponse.ErrorMessage"));<NEW_LINE>List<OtaModuleDTO> data = new ArrayList<OtaModuleDTO>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListOTAModuleByProductResponse.Data.Length"); i++) {<NEW_LINE>OtaModuleDTO otaModuleDTO = new OtaModuleDTO();<NEW_LINE>otaModuleDTO.setProductKey(_ctx.stringValue("ListOTAModuleByProductResponse.Data[" + i + "].ProductKey"));<NEW_LINE>otaModuleDTO.setModuleName(_ctx.stringValue("ListOTAModuleByProductResponse.Data[" + i + "].ModuleName"));<NEW_LINE>otaModuleDTO.setAliasName(_ctx.stringValue<MASK><NEW_LINE>otaModuleDTO.setDesc(_ctx.stringValue("ListOTAModuleByProductResponse.Data[" + i + "].Desc"));<NEW_LINE>otaModuleDTO.setGmtCreate(_ctx.stringValue("ListOTAModuleByProductResponse.Data[" + i + "].GmtCreate"));<NEW_LINE>otaModuleDTO.setGmtModified(_ctx.stringValue("ListOTAModuleByProductResponse.Data[" + i + "].GmtModified"));<NEW_LINE>data.add(otaModuleDTO);<NEW_LINE>}<NEW_LINE>listOTAModuleByProductResponse.setData(data);<NEW_LINE>return listOTAModuleByProductResponse;<NEW_LINE>} | ("ListOTAModuleByProductResponse.Data[" + i + "].AliasName")); |
520,049 | public BuildCause onModifications(MaterialRevisions originalMaterialRevisions, boolean materialConfigurationChanged, MaterialRevisions previousMaterialRevisions) {<NEW_LINE>if (originalMaterialRevisions == null || originalMaterialRevisions.isEmpty()) {<NEW_LINE>throw new RuntimeException("Cannot find modifications, please check your SCM setting or environment.");<NEW_LINE>}<NEW_LINE>if (!originalMaterialRevisions.hasDependencyMaterials()) {<NEW_LINE>return BuildCause.createWithModifications(originalMaterialRevisions, GoConstants.DEFAULT_APPROVED_BY);<NEW_LINE>}<NEW_LINE>CruiseConfig cruiseConfig = goConfigService.currentCruiseConfig();<NEW_LINE>MaterialRevisions recomputedBasedOnDependencies;<NEW_LINE>if (systemEnvironment.enforceRevisionCompatibilityWithUpstream()) {<NEW_LINE>recomputedBasedOnDependencies = fanInOn(originalMaterialRevisions, cruiseConfig, new CaseInsensitiveString(pipelineName));<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (recomputedBasedOnDependencies != null && canRunWithRecomputedRevisions(materialConfigurationChanged, previousMaterialRevisions, recomputedBasedOnDependencies)) {<NEW_LINE>return BuildCause.createWithModifications(recomputedBasedOnDependencies, GoConstants.DEFAULT_APPROVED_BY);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | recomputedBasedOnDependencies = fanInOffTriangleDependency(originalMaterialRevisions, cruiseConfig); |
967,051 | private boolean updateExperimentStatus(String resourceId, Map<String, Object> updateObject) {<NEW_LINE>ExperimentEntity experimentEntity = experimentService.select(resourceId);<NEW_LINE>if (experimentEntity == null) {<NEW_LINE>throw new SubmarineRuntimeException(Status.NOT_FOUND.getStatusCode(), String.format("cannot find experiment with id:%s", resourceId));<NEW_LINE>}<NEW_LINE>if (updateObject.get("status") != null) {<NEW_LINE>experimentEntity.setExperimentStatus(updateObject.get("status").toString());<NEW_LINE>}<NEW_LINE>if (updateObject.get("acceptedTime") != null) {<NEW_LINE>experimentEntity.setAcceptedTime(DateTime.parse(updateObject.get("acceptedTime").toString()).toDate());<NEW_LINE>}<NEW_LINE>if (updateObject.get("createdTime") != null) {<NEW_LINE>experimentEntity.setCreateTime(DateTime.parse(updateObject.get("createdTime").toString()).toDate());<NEW_LINE>}<NEW_LINE>if (updateObject.get("runningTime") != null) {<NEW_LINE>experimentEntity.setRunningTime(DateTime.parse(updateObject.get("runningTime").toString()).toDate());<NEW_LINE>}<NEW_LINE>if (updateObject.get("finishedTime") != null) {<NEW_LINE>experimentEntity.setFinishedTime(DateTime.parse(updateObject.get("finishedTime").toString<MASK><NEW_LINE>}<NEW_LINE>return experimentService.update(experimentEntity);<NEW_LINE>} | ()).toDate()); |
38,044 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>Player targetPlayer = game.getPlayer(this.getTargetPointer()<MASK><NEW_LINE>Spell spell = game.getStack().getSpell(source.getSourceId());<NEW_LINE>if (controller != null && spell != null && targetPlayer != null) {<NEW_LINE>// AI can't assist other players, maybe for teammates only (but tests must work as normal)<NEW_LINE>int amountToPay = 0;<NEW_LINE>if (!targetPlayer.isComputer()) {<NEW_LINE>amountToPay = targetPlayer.announceXMana(0, unpaid.getMana().getGeneric(), "How much mana to pay as assist for " + controller.getName() + "?", game, source);<NEW_LINE>}<NEW_LINE>if (amountToPay > 0) {<NEW_LINE>Cost cost = ManaUtil.createManaCost(amountToPay, false);<NEW_LINE>if (cost.pay(source, game, source, targetPlayer.getId(), false)) {<NEW_LINE>ManaPool manaPool = controller.getManaPool();<NEW_LINE>manaPool.addMana(Mana.ColorlessMana(amountToPay), game, source);<NEW_LINE>// it's unlock mana for one use/click, but it can gives more<NEW_LINE>manaPool.unlockManaType(ManaType.COLORLESS);<NEW_LINE>game.informPlayers(targetPlayer.getLogName() + " paid {" + amountToPay + "} for " + controller.getLogName());<NEW_LINE>game.getState().setValue(source.getSourceId().toString() + game.getState().getZoneChangeCounter(source.getSourceId()) + "_assisted", true);<NEW_LINE>}<NEW_LINE>// assist must be used before activating mana abilities, so no need to switch step after usage<NEW_LINE>// (mana and other special abilities can be used after assist)<NEW_LINE>// spell.setCurrentActivatingManaAbilitiesStep(ActivationManaAbilityStep.NORMAL);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | .getFirst(game, source)); |
1,739,434 | public void contextInitialized(ServletContextEvent event) {<NEW_LINE>ServletContext servletContext = event.getServletContext();<NEW_LINE>String contextName = servletContext.getContextPath().replaceAll("/", "");<NEW_LINE>if ("".equals(contextName)) {<NEW_LINE>contextName = "root";<NEW_LINE>}<NEW_LINE>System.out.printf("Context init: %s%n", contextName);<NEW_LINE>ConfigurableWebApplicationContext appctx = (ConfigurableWebApplicationContext) servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);<NEW_LINE>if (appctx != null) {<NEW_LINE>System.out.printf("ConfigurableWebApplicationContext is not null in ContextLoggingListener for: %s, this indicates a misconfiguration or load order problem%n", contextName);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>// get the selector<NEW_LINE>ContextSelector selector = Red5LoggerFactory.getContextSelector();<NEW_LINE>// get the logger context for this servlet / app context by name<NEW_LINE>URL url = servletContext.getResource(String.format("/WEB-INF/classes/logback-%s.xml", contextName));<NEW_LINE>if (url != null && Files.exists(Paths.get(url.toURI()))) {<NEW_LINE>System.out.printf("Context logger config found: %s%n", url.toURI());<NEW_LINE>} else {<NEW_LINE>url = servletContext.getResource("/WEB-INF/classes/logback.xml");<NEW_LINE>if (url != null && Files.exists(Paths.get(url.toURI()))) {<NEW_LINE>System.out.printf("Context logger config found: %s%n", url.toURI());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// get the logger context for the servlet context<NEW_LINE>LoggerContext loggerContext = url != null ? ((LoggingContextSelector) selector).getLoggerContext(contextName, url) : selector.getLoggerContext(contextName);<NEW_LINE>// set the logger context for use elsewhere in the servlet context<NEW_LINE>servletContext.setAttribute(Red5LoggerFactory.LOGGER_CONTEXT_ATTRIBUTE, loggerContext);<NEW_LINE>// get the root logger for this context<NEW_LINE>Logger logger = Red5LoggerFactory.<MASK><NEW_LINE>logger.info("Starting up context: {}", contextName);<NEW_LINE>} catch (Exception e) {<NEW_LINE>System.err.printf("LoggingContextSelector is not the correct type: %s%n", e.getMessage());<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>} | getLogger(Logger.ROOT_LOGGER_NAME, contextName); |
1,495,553 | private boolean saveVideoWatchStatus(String videoId, long position, boolean watched) {<NEW_LINE>ContentValues values = new ContentValues();<NEW_LINE>values.put(PlaybackStatusTable.COL_YOUTUBE_VIDEO_ID, videoId);<NEW_LINE>values.put(PlaybackStatusTable.COL_YOUTUBE_VIDEO_POSITION, (int) position);<NEW_LINE>values.put(PlaybackStatusTable.COL_YOUTUBE_VIDEO_WATCHED, watched ? 1 : 0);<NEW_LINE>boolean addSuccessful = getWritableDatabase().insertWithOnConflict(PlaybackStatusTable.TABLE_NAME, null, values, SQLiteDatabase.CONFLICT_REPLACE) != -1;<NEW_LINE>if (addSuccessful) {<NEW_LINE>updateCounter++;<NEW_LINE>}<NEW_LINE>VideoWatchedStatus <MASK><NEW_LINE>if (status == null) {<NEW_LINE>status = new VideoWatchedStatus();<NEW_LINE>playbackHistoryMap.put(videoId, status);<NEW_LINE>}<NEW_LINE>status.position = position;<NEW_LINE>status.watched = watched;<NEW_LINE>return addSuccessful;<NEW_LINE>} | status = playbackHistoryMap.get(videoId); |
1,404,496 | protected void subscribeCommand(final URL url, final CommandListener commandListener) {<NEW_LINE>try {<NEW_LINE>clientLock.lock();<NEW_LINE>ConcurrentHashMap<CommandListener, IZkDataListener> dataChangeListeners = commandListeners.get(url);<NEW_LINE>if (dataChangeListeners == null) {<NEW_LINE>commandListeners.putIfAbsent(url, new ConcurrentHashMap<MASK><NEW_LINE>dataChangeListeners = commandListeners.get(url);<NEW_LINE>}<NEW_LINE>IZkDataListener zkDataListener = dataChangeListeners.get(commandListener);<NEW_LINE>if (zkDataListener == null) {<NEW_LINE>dataChangeListeners.putIfAbsent(commandListener, new IZkDataListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void handleDataChange(String dataPath, Object data) throws Exception {<NEW_LINE>commandListener.notifyCommand(url, (String) data);<NEW_LINE>LoggerUtil.info(String.format("[ZookeeperRegistry] command data change: path=%s, command=%s", dataPath, (String) data));<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void handleDataDeleted(String dataPath) throws Exception {<NEW_LINE>commandListener.notifyCommand(url, null);<NEW_LINE>LoggerUtil.info(String.format("[ZookeeperRegistry] command deleted: path=%s", dataPath));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>zkDataListener = dataChangeListeners.get(commandListener);<NEW_LINE>}<NEW_LINE>String commandPath = ZkUtils.toCommandPath(url);<NEW_LINE>zkClient.subscribeDataChanges(commandPath, zkDataListener);<NEW_LINE>LoggerUtil.info(String.format("[ZookeeperRegistry] subscribe command: path=%s, info=%s", commandPath, url.toFullStr()));<NEW_LINE>} catch (Throwable e) {<NEW_LINE>throw new MotanFrameworkException(String.format("Failed to subscribe %s to zookeeper(%s), cause: %s", url, getUrl(), e.getMessage()), e);<NEW_LINE>} finally {<NEW_LINE>clientLock.unlock();<NEW_LINE>}<NEW_LINE>} | <CommandListener, IZkDataListener>()); |
1,829,488 | private void forEachReplicatedRecord(List keyRecordExpiry, MapContainer mapContainer, RecordStore recordStore, boolean populateIndexes, long nowInMillis) {<NEW_LINE>long ownedEntryCountOnThisNode = entryCountOnThisNode(mapContainer);<NEW_LINE>EvictionConfig evictionConfig = mapContainer.getMapConfig().getEvictionConfig();<NEW_LINE>boolean perNodeEvictionConfigured = mapContainer.getEvictor() != Evictor.NULL_EVICTOR && evictionConfig.getMaxSizePolicy() == PER_NODE;<NEW_LINE>for (int i = 0; i < keyRecordExpiry.size(); i += 3) {<NEW_LINE>Data dataKey = (<MASK><NEW_LINE>Record record = (Record) keyRecordExpiry.get(i + 1);<NEW_LINE>ExpiryMetadata expiryMetadata = (ExpiryMetadata) keyRecordExpiry.get(i + 2);<NEW_LINE>if (perNodeEvictionConfigured) {<NEW_LINE>if (ownedEntryCountOnThisNode >= evictionConfig.getSize()) {<NEW_LINE>if (operation.getReplicaIndex() == 0) {<NEW_LINE>recordStore.doPostEvictionOperations(dataKey, record.getValue(), ExpiryReason.NOT_EXPIRED);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>recordStore.putOrUpdateReplicatedRecord(dataKey, record, expiryMetadata, populateIndexes, nowInMillis);<NEW_LINE>ownedEntryCountOnThisNode++;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>recordStore.putOrUpdateReplicatedRecord(dataKey, record, expiryMetadata, populateIndexes, nowInMillis);<NEW_LINE>if (recordStore.shouldEvict()) {<NEW_LINE>// No need to continue replicating records anymore.<NEW_LINE>// We are already over eviction threshold, each put record will cause another eviction.<NEW_LINE>recordStore.evictEntries(dataKey);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>recordStore.disposeDeferredBlocks();<NEW_LINE>}<NEW_LINE>} | Data) keyRecordExpiry.get(i); |
585,630 | public static void registerType(ModelBuilder modelBuilder) {<NEW_LINE>ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(MultiInstanceLoopCharacteristics.class, BPMN_ELEMENT_MULTI_INSTANCE_LOOP_CHARACTERISTICS).namespaceUri(BPMN20_NS).extendsType(LoopCharacteristics.class).instanceProvider(new ModelTypeInstanceProvider<MultiInstanceLoopCharacteristics>() {<NEW_LINE><NEW_LINE>public MultiInstanceLoopCharacteristics newInstance(ModelTypeInstanceContext instanceContext) {<NEW_LINE>return new MultiInstanceLoopCharacteristicsImpl(instanceContext);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>isSequentialAttribute = typeBuilder.booleanAttribute(BPMN_ELEMENT_IS_SEQUENTIAL).defaultValue(false).build();<NEW_LINE>behaviorAttribute = typeBuilder.enumAttribute(BPMN_ELEMENT_BEHAVIOR, MultiInstanceFlowCondition.class).defaultValue(MultiInstanceFlowCondition.All).build();<NEW_LINE>oneBehaviorEventRefAttribute = typeBuilder.stringAttribute(BPMN_ELEMENT_ONE_BEHAVIOR_EVENT_REF).qNameAttributeReference(EventDefinition.class).build();<NEW_LINE>noneBehaviorEventRefAttribute = typeBuilder.stringAttribute(BPMN_ELEMENT_NONE_BEHAVIOR_EVENT_REF).qNameAttributeReference(EventDefinition.class).build();<NEW_LINE>SequenceBuilder sequenceBuilder = typeBuilder.sequence();<NEW_LINE>loopCardinalityChild = sequenceBuilder.element(LoopCardinality.class).build();<NEW_LINE>loopDataInputRefChild = sequenceBuilder.element(LoopDataInputRef.class).qNameElementReference(DataInput.class).build();<NEW_LINE>loopDataOutputRefChild = sequenceBuilder.element(LoopDataOutputRef.class).qNameElementReference(DataOutput.class).build();<NEW_LINE>outputDataItemChild = sequenceBuilder.element(<MASK><NEW_LINE>inputDataItemChild = sequenceBuilder.element(InputDataItem.class).build();<NEW_LINE>complexBehaviorDefinitionCollection = sequenceBuilder.elementCollection(ComplexBehaviorDefinition.class).build();<NEW_LINE>completionConditionChild = sequenceBuilder.element(CompletionCondition.class).build();<NEW_LINE>camundaAsyncAfter = typeBuilder.booleanAttribute(CAMUNDA_ATTRIBUTE_ASYNC_AFTER).namespace(CAMUNDA_NS).defaultValue(false).build();<NEW_LINE>camundaAsyncBefore = typeBuilder.booleanAttribute(CAMUNDA_ATTRIBUTE_ASYNC_BEFORE).namespace(CAMUNDA_NS).defaultValue(false).build();<NEW_LINE>camundaExclusive = typeBuilder.booleanAttribute(CAMUNDA_ATTRIBUTE_EXCLUSIVE).namespace(CAMUNDA_NS).defaultValue(true).build();<NEW_LINE>camundaCollection = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_COLLECTION).namespace(CAMUNDA_NS).build();<NEW_LINE>camundaElementVariable = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_ELEMENT_VARIABLE).namespace(CAMUNDA_NS).build();<NEW_LINE>typeBuilder.build();<NEW_LINE>} | OutputDataItem.class).build(); |
916,895 | private void computeLineBufferCurve(Coordinate[] inputPts, OffsetSegmentGenerator segGen) {<NEW_LINE>double distTol = simplifyTolerance(distance);<NEW_LINE>// --------- compute points for left side of line<NEW_LINE>// Simplify the appropriate side of the line before generating<NEW_LINE>Coordinate[] simp1 = BufferInputLineSimplifier.simplify(inputPts, distTol);<NEW_LINE>// MD - used for testing only (to eliminate simplification)<NEW_LINE>// Coordinate[] simp1 = inputPts;<NEW_LINE>int n1 = simp1.length - 1;<NEW_LINE>segGen.initSideSegments(simp1[0], simp1[1], Position.LEFT);<NEW_LINE>for (int i = 2; i <= n1; i++) {<NEW_LINE>segGen.addNextSegment(simp1[i], true);<NEW_LINE>}<NEW_LINE>segGen.addLastSegment();<NEW_LINE>// add line cap for end of line<NEW_LINE>segGen.addLineEndCap(simp1[n1 - 1], simp1[n1]);<NEW_LINE>// ---------- compute points for right side of line<NEW_LINE>// Simplify the appropriate side of the line before generating<NEW_LINE>Coordinate[] simp2 = BufferInputLineSimplifier.simplify(inputPts, -distTol);<NEW_LINE>// MD - used for testing only (to eliminate simplification)<NEW_LINE>// Coordinate[] simp2 = inputPts;<NEW_LINE>int n2 = simp2.length - 1;<NEW_LINE>// since we are traversing line in opposite order, offset position is still LEFT<NEW_LINE>segGen.initSideSegments(simp2[n2], simp2[n2 - 1], Position.LEFT);<NEW_LINE>for (int i = n2 - 2; i >= 0; i--) {<NEW_LINE>segGen.addNextSegment(simp2[i], true);<NEW_LINE>}<NEW_LINE>segGen.addLastSegment();<NEW_LINE>// add line cap for start of line<NEW_LINE>segGen.addLineEndCap(simp2[<MASK><NEW_LINE>segGen.closeRing();<NEW_LINE>} | 1], simp2[0]); |
735,617 | public void init() {<NEW_LINE>model = new DefaultDiagramModel();<NEW_LINE>model.setMaxConnections(-1);<NEW_LINE>StateMachineConnector connector = new StateMachineConnector();<NEW_LINE>connector.setOrientation(StateMachineConnector.Orientation.ANTICLOCKWISE);<NEW_LINE>connector.setPaintStyle("{stroke:'#7D7463',strokeWidth:3}");<NEW_LINE>model.setDefaultConnector(connector);<NEW_LINE>Element start = new Element(null, "15em", "5em");<NEW_LINE>start.addEndPoint(new BlankEndPoint(EndPointAnchor.BOTTOM));<NEW_LINE>start.setStyleClass("start-node");<NEW_LINE>Element idle = new Element("Idle", "10em", "20em");<NEW_LINE>idle.addEndPoint(new BlankEndPoint(EndPointAnchor.TOP));<NEW_LINE>idle.addEndPoint(new BlankEndPoint(EndPointAnchor.BOTTOM_RIGHT));<NEW_LINE>idle.addEndPoint(new BlankEndPoint(EndPointAnchor.BOTTOM_LEFT));<NEW_LINE>Element turnedOn = new Element("TurnedOn", "10em", "35em");<NEW_LINE>turnedOn.addEndPoint(new BlankEndPoint(EndPointAnchor.TOP));<NEW_LINE>turnedOn.addEndPoint(<MASK><NEW_LINE>turnedOn.addEndPoint(new BlankEndPoint(EndPointAnchor.BOTTOM_RIGHT));<NEW_LINE>Element activity = new Element("Activity", "45em", "35em");<NEW_LINE>activity.addEndPoint(new BlankEndPoint(EndPointAnchor.LEFT));<NEW_LINE>activity.addEndPoint(new BlankEndPoint(EndPointAnchor.BOTTOM_LEFT));<NEW_LINE>activity.addEndPoint(new BlankEndPoint(EndPointAnchor.TOP));<NEW_LINE>activity.addEndPoint(new BlankEndPoint(EndPointAnchor.TOP_RIGHT));<NEW_LINE>activity.addEndPoint(new BlankEndPoint(EndPointAnchor.TOP_LEFT));<NEW_LINE>model.addElement(start);<NEW_LINE>model.addElement(idle);<NEW_LINE>model.addElement(turnedOn);<NEW_LINE>model.addElement(activity);<NEW_LINE>model.connect(createConnection(start.getEndPoints().get(0), idle.getEndPoints().get(0), null));<NEW_LINE>model.connect(createConnection(idle.getEndPoints().get(1), turnedOn.getEndPoints().get(0), "Turn On"));<NEW_LINE>model.connect(createConnection(turnedOn.getEndPoints().get(0), idle.getEndPoints().get(2), "Turn Off"));<NEW_LINE>model.connect(createConnection(turnedOn.getEndPoints().get(1), activity.getEndPoints().get(0), null));<NEW_LINE>model.connect(createConnection(activity.getEndPoints().get(1), turnedOn.getEndPoints().get(2), "Request Turn Off"));<NEW_LINE>model.connect(createConnection(activity.getEndPoints().get(2), activity.getEndPoints().get(2), "Talk"));<NEW_LINE>model.connect(createConnection(activity.getEndPoints().get(3), activity.getEndPoints().get(3), "Run"));<NEW_LINE>model.connect(createConnection(activity.getEndPoints().get(4), activity.getEndPoints().get(4), "Walk"));<NEW_LINE>} | new BlankEndPoint(EndPointAnchor.RIGHT)); |
572,470 | private static void init() {<NEW_LINE>getConnection(true);<NEW_LINE>if (jadb == null) {<NEW_LINE>try {<NEW_LINE>new AdbServerLauncher().launch();<NEW_LINE><MASK><NEW_LINE>getConnection(false);<NEW_LINE>if (jadb != null) {<NEW_LINE>shouldStopServer = true;<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>// Cannot run program "adb": error=2, No such file or directory<NEW_LINE>if (e.getMessage().startsWith("Cannot run program")) {<NEW_LINE>isAdbAvailable = false;<NEW_LINE>Debug.error("ADBClient: package adb not available. need to be installed");<NEW_LINE>} else {<NEW_LINE>Debug.error("ADBClient: ADBServer problem: %s", e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String serial = null;<NEW_LINE>if (jadb != null) {<NEW_LINE>List<JadbDevice> devices = null;<NEW_LINE>try {<NEW_LINE>devices = jadb.getDevices();<NEW_LINE>} catch (Exception e) {<NEW_LINE>}<NEW_LINE>if (devices != null && devices.size() > 0) {<NEW_LINE>device = devices.get(0);<NEW_LINE>serial = device.getSerial();<NEW_LINE>} else {<NEW_LINE>device = null;<NEW_LINE>Debug.error("ADBClient: init: no devices attached");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (device != null) {<NEW_LINE>Debug.log(3, "ADBClient: init: attached device: serial(%s)", serial);<NEW_LINE>}<NEW_LINE>} | Debug.log(3, "ADBClient: ADBServer started"); |
1,244,773 | public static Optional<MachoSymTabCommand> read(MappedByteBuffer machoFileBuffer) {<NEW_LINE>machoFileBuffer.rewind();<NEW_LINE>try {<NEW_LINE>MachoHeader header = Machos.getHeader(machoFileBuffer);<NEW_LINE>int commandsCount = header.getCommandsCount();<NEW_LINE>for (int i = 0; i < commandsCount; i++) {<NEW_LINE>int command = ObjectFileScrubbers.getLittleEndianInt(machoFileBuffer);<NEW_LINE>int commandSize = ObjectFileScrubbers.getLittleEndianInt(machoFileBuffer);<NEW_LINE>if (Machos.LC_SYMTAB == command) {<NEW_LINE>// https://opensource.apple.com/source/xnu/xnu-1699.32.7/EXTERNAL_HEADERS/mach-o/loader.h<NEW_LINE>//<NEW_LINE>// struct symtab_command {<NEW_LINE>// uint32_t cmd; // LC_SYMTAB<NEW_LINE>// uint32_t cmdsize; // sizeof(struct symtab_command)<NEW_LINE>// uint32_t symoff; // symbol table offset<NEW_LINE>// uint32_t nsyms; // number of symbol table entries<NEW_LINE>// uint32_t stroff; // string table offset<NEW_LINE>// uint32_t strsize; // string table size in bytes<NEW_LINE>// };<NEW_LINE>int <MASK><NEW_LINE>int nsyms = ObjectFileScrubbers.getLittleEndianInt(machoFileBuffer);<NEW_LINE>int stroff = ObjectFileScrubbers.getLittleEndianInt(machoFileBuffer);<NEW_LINE>int strsize = ObjectFileScrubbers.getLittleEndianInt(machoFileBuffer);<NEW_LINE>return Optional.of(ImmutableMachoSymTabCommand.of(command, commandSize, symoff, nsyms, stroff, strsize));<NEW_LINE>}<NEW_LINE>// Skip over command body<NEW_LINE>ObjectFileScrubbers.getBytes(machoFileBuffer, commandSize - 8);<NEW_LINE>}<NEW_LINE>} catch (Machos.MachoException e) {<NEW_LINE>// Handle failure by returning Optional<NEW_LINE>}<NEW_LINE>return Optional.empty();<NEW_LINE>} | symoff = ObjectFileScrubbers.getLittleEndianInt(machoFileBuffer); |
1,146,187 | public void initRuntimeLibraryTypedAsts(Optional<ColorPool.Builder> colorPoolBuilder) {<NEW_LINE><MASK><NEW_LINE>String path = String.join("", "/runtime_libs.typedast");<NEW_LINE>TypedAstDeserializer.DeserializedAst astData = TypedAstDeserializer.deserializeRuntimeLibraries(this, SYNTHETIC_EXTERNS_FILE, colorPoolBuilder, Compiler.class.getResourceAsStream(path));<NEW_LINE>// Re-index the runtime libraries by file name rather than SourceFile object<NEW_LINE>LinkedHashMap<String, Supplier<Node>> runtimeLibraryTypedAsts = new LinkedHashMap<>();<NEW_LINE>for (Map.Entry<SourceFile, Supplier<Node>> library : astData.getFilesystem().entrySet()) {<NEW_LINE>runtimeLibraryTypedAsts.computeIfAbsent(library.getKey().getName(), (f) -> library.getValue());<NEW_LINE>}<NEW_LINE>this.runtimeLibraryTypedAsts = ImmutableMap.copyOf(runtimeLibraryTypedAsts);<NEW_LINE>} | checkState(this.runtimeLibraryTypedAsts == null); |
482,224 | protected JavascriptException toJsException(ExceptionThrown event) {<NEW_LINE>ExceptionDetails details = event.getExceptionDetails();<NEW_LINE>Optional<StackTrace> maybeTrace = details.getStackTrace();<NEW_LINE>Optional<org.openqa.selenium.devtools.v100.runtime.model.RemoteObject> maybeException = details.getException();<NEW_LINE>String message = maybeException.flatMap(obj -> obj.getDescription().map(String::toString)).orElseGet(details::getText);<NEW_LINE><MASK><NEW_LINE>if (!maybeTrace.isPresent()) {<NEW_LINE>StackTraceElement element = new StackTraceElement("unknown", "unknown", details.getUrl().orElse("unknown"), details.getLineNumber());<NEW_LINE>exception.setStackTrace(new StackTraceElement[] { element });<NEW_LINE>return exception;<NEW_LINE>}<NEW_LINE>StackTrace trace = maybeTrace.get();<NEW_LINE>exception.setStackTrace(trace.getCallFrames().stream().map(frame -> new StackTraceElement("", frame.getFunctionName(), frame.getUrl(), frame.getLineNumber())).toArray(StackTraceElement[]::new));<NEW_LINE>return exception;<NEW_LINE>} | JavascriptException exception = new JavascriptException(message); |
281,912 | StoreScan createStoreScan(PageCacheTracer cacheTracer) {<NEW_LINE>int[] entityTokenIds = entityTokenIds();<NEW_LINE>int[] propertyKeyIds = propertyKeyIds();<NEW_LINE>IntPredicate propertyKeyIdFilter = propertyKeyId -> contains(propertyKeyIds, propertyKeyId);<NEW_LINE>if (type == EntityType.RELATIONSHIP) {<NEW_LINE>StoreScan innerStoreScan = storeView.visitRelationships(entityTokenIds, propertyKeyIdFilter, createPropertyScanConsumer(), createTokenScanConsumer(), false, true, cacheTracer, memoryTracker);<NEW_LINE>storeScan = new LoggingStoreScan(innerStoreScan, false);<NEW_LINE>} else {<NEW_LINE>StoreScan innerStoreScan = storeView.visitNodes(entityTokenIds, propertyKeyIdFilter, createPropertyScanConsumer(), createTokenScanConsumer(), <MASK><NEW_LINE>storeScan = new LoggingStoreScan(innerStoreScan, true);<NEW_LINE>}<NEW_LINE>storeScan.setPhaseTracker(phaseTracker);<NEW_LINE>return storeScan;<NEW_LINE>} | false, true, cacheTracer, memoryTracker); |
874,350 | public static KeyValuePart[] splitIntIntVector(MatrixMeta matrixMeta, IntIntVector vector) {<NEW_LINE>IntIntVectorStorage storage = vector.getStorage();<NEW_LINE>if (storage.isSparse()) {<NEW_LINE>// Get keys and values<NEW_LINE>IntIntSparseVectorStorage sparseStorage = (IntIntSparseVectorStorage) storage;<NEW_LINE>int[] keys = sparseStorage.getIndices();<NEW_LINE>int[] values = sparseStorage.getValues();<NEW_LINE>return split(matrixMeta, vector.getRowId(), keys, values, false);<NEW_LINE>} else if (storage.isDense()) {<NEW_LINE>// Get values<NEW_LINE>IntIntDenseVectorStorage denseStorage = (IntIntDenseVectorStorage) storage;<NEW_LINE>int[<MASK><NEW_LINE>return split(matrixMeta, vector.getRowId(), values);<NEW_LINE>} else {<NEW_LINE>// Key and value array pair<NEW_LINE>IntIntSortedVectorStorage sortStorage = (IntIntSortedVectorStorage) storage;<NEW_LINE>int[] keys = sortStorage.getIndices();<NEW_LINE>int[] values = sortStorage.getValues();<NEW_LINE>return split(matrixMeta, vector.getRowId(), keys, values, true);<NEW_LINE>}<NEW_LINE>} | ] values = denseStorage.getValues(); |
1,656,601 | final GetRelationalDatabaseBlueprintsResult executeGetRelationalDatabaseBlueprints(GetRelationalDatabaseBlueprintsRequest getRelationalDatabaseBlueprintsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getRelationalDatabaseBlueprintsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetRelationalDatabaseBlueprintsRequest> request = null;<NEW_LINE>Response<GetRelationalDatabaseBlueprintsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetRelationalDatabaseBlueprintsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getRelationalDatabaseBlueprintsRequest));<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, "Lightsail");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetRelationalDatabaseBlueprints");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetRelationalDatabaseBlueprintsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetRelationalDatabaseBlueprintsResultJsonUnmarshaller());<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); |
520,973 | public static void applyFieldDeclaration(FieldDeclaration declaration, Object target) {<NEW_LINE>Method setterMethod = ReflectUtil.getSetter(declaration.getName(), target.getClass(), declaration.getValue().getClass());<NEW_LINE>if (setterMethod != null) {<NEW_LINE>try {<NEW_LINE>setterMethod.invoke(target, declaration.getValue());<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>throw new ActivitiException("Error while invoking '" + declaration.getName() + "' on class " + target.getClass().getName(), e);<NEW_LINE>} catch (IllegalAccessException e) {<NEW_LINE>throw new ActivitiException("Illegal access when calling '" + declaration.getName() + "' on class " + target.getClass().getName(), e);<NEW_LINE>} catch (InvocationTargetException e) {<NEW_LINE>throw new ActivitiException("Exception while invoking '" + declaration.getName() + "' on class " + target.getClass().getName(), e);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Field field = ReflectUtil.getField(<MASK><NEW_LINE>if (field == null) {<NEW_LINE>throw new ActivitiIllegalArgumentException("Field definition uses unexisting field '" + declaration.getName() + "' on class " + target.getClass().getName());<NEW_LINE>}<NEW_LINE>// Check if the delegate field's type is correct<NEW_LINE>if (!fieldTypeCompatible(declaration, field)) {<NEW_LINE>throw new ActivitiIllegalArgumentException("Incompatible type set on field declaration '" + declaration.getName() + "' for class " + target.getClass().getName() + ". Declared value has type " + declaration.getValue().getClass().getName() + ", while expecting " + field.getType().getName());<NEW_LINE>}<NEW_LINE>ReflectUtil.setField(field, target, declaration.getValue());<NEW_LINE>}<NEW_LINE>} | declaration.getName(), target); |
1,318,573 | public static RADComponent createQueryBean(FormModel model, RADComponent entityManager, String entityName) throws Exception {<NEW_LINE>RADComponent query = new RADComponent();<NEW_LINE>FileObject formFile = FormEditor.getFormDataObject(model).getFormFile();<NEW_LINE>// NOI18N<NEW_LINE>Class<?> queryClass = ClassPathUtils.loadClass("javax.persistence.Query", formFile);<NEW_LINE>query.initialize(model);<NEW_LINE>query.initInstance(queryClass);<NEW_LINE>char c = entityName.<MASK><NEW_LINE>// NOI18N<NEW_LINE>String q = "SELECT " + c + " FROM " + entityName + " " + c;<NEW_LINE>// NOI18N<NEW_LINE>query.getPropertyByName("query").setValue(q);<NEW_LINE>// NOI18N<NEW_LINE>query.getPropertyByName("entityManager").setValue(entityManager);<NEW_LINE>// NOI18N<NEW_LINE>query.setStoredName(c + entityName.substring(1) + "Query");<NEW_LINE>model.addComponent(query, null, true);<NEW_LINE>return query;<NEW_LINE>} | toLowerCase().charAt(0); |
192,465 | final DescribeDBClusterParametersResult executeDescribeDBClusterParameters(DescribeDBClusterParametersRequest describeDBClusterParametersRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeDBClusterParametersRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<DescribeDBClusterParametersRequest> request = null;<NEW_LINE>Response<DescribeDBClusterParametersResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeDBClusterParametersRequestMarshaller().marshall(super.beforeMarshalling(describeDBClusterParametersRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "RDS");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeDBClusterParameters");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DescribeDBClusterParametersResult> responseHandler = new StaxResponseHandler<DescribeDBClusterParametersResult>(new DescribeDBClusterParametersResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
1,783,880 | static Writer writeValue(Writer writer, Object value) throws JSONException, IOException {<NEW_LINE>if (value == null) {<NEW_LINE>writer.write("null");<NEW_LINE>} else if (value instanceof JSONObject) {<NEW_LINE>((JSONObject) value).write(writer);<NEW_LINE>} else if (value instanceof JSONArray) {<NEW_LINE>((JSONArray) value).write(writer);<NEW_LINE>} else if (value instanceof Map) {<NEW_LINE>Map<?, ?> map = (Map<?, ?>) value;<NEW_LINE>new JSONObject(map).write(writer);<NEW_LINE>} else if (value instanceof Collection) {<NEW_LINE>Collection<?> coll = (Collection<?>) value;<NEW_LINE>new JSONArray(coll).write(writer);<NEW_LINE>} else if (value.getClass().isArray()) {<NEW_LINE>new JSONArray(value).write(writer);<NEW_LINE>} else if (value instanceof Number) {<NEW_LINE>writer.write(numberToString((Number) value));<NEW_LINE>} else if (value instanceof Boolean) {<NEW_LINE>writer.<MASK><NEW_LINE>} else {<NEW_LINE>quote(value.toString(), writer);<NEW_LINE>}<NEW_LINE>return writer;<NEW_LINE>} | write(value.toString()); |
416,781 | public boolean onSingleTapConfirmed(MotionEvent motionEvent) {<NEW_LINE>// get the point that was clicked and convert it to a point in the map<NEW_LINE>android.graphics.Point clickLocation = new android.graphics.Point(Math.round(motionEvent.getX()), Math.round(motionEvent.getY()));<NEW_LINE>Point mapPoint = mMapView.screenToLocation(clickLocation);<NEW_LINE>final Point destination = (Point) GeometryEngine.project(mapPoint, SpatialReferences.getWgs84());<NEW_LINE>endLocation.setGeometry(destination);<NEW_LINE>// create a straight line path between the start and end locations<NEW_LINE>PointCollection points = new PointCollection(Arrays.asList(start, destination), SpatialReferences.getWgs84());<NEW_LINE>Polyline polyline = new Polyline(points);<NEW_LINE>// densify the path as a geodesic curve and show it with the path graphic<NEW_LINE>Geometry pathGeometry = GeometryEngine.densifyGeodetic(polyline, 1, mUnitOfMeasurement, GeodeticCurveType.GEODESIC);<NEW_LINE>path.setGeometry(pathGeometry);<NEW_LINE>// calculate the path distance<NEW_LINE>double distance = GeometryEngine.lengthGeodetic(<MASK><NEW_LINE>// create a textview for the callout<NEW_LINE>TextView calloutContent = new TextView(getApplicationContext());<NEW_LINE>calloutContent.setTextColor(Color.BLACK);<NEW_LINE>calloutContent.setSingleLine();<NEW_LINE>// format coordinates to 2 decimal places<NEW_LINE>calloutContent.setText("Distance: " + String.format("%.2f", distance) + " Kilometers");<NEW_LINE>final Callout callout = mMapView.getCallout();<NEW_LINE>callout.setLocation(mapPoint);<NEW_LINE>callout.setContent(calloutContent);<NEW_LINE>callout.show();<NEW_LINE>return true;<NEW_LINE>} | pathGeometry, mUnitOfMeasurement, GeodeticCurveType.GEODESIC); |
972,608 | public String encode() throws IOException {<NEW_LINE>try (FastStringWriter fsw = new FastStringWriter()) {<NEW_LINE>fsw.write("{");<NEW_LINE>ChartUtils.writeDataValue(fsw, "type", <MASK><NEW_LINE>ChartUtils.writeDataValue(fsw, "data", this.data, true);<NEW_LINE>ChartUtils.writeDataValue(fsw, "hidden", this.isHidden(), true);<NEW_LINE>ChartUtils.writeDataValue(fsw, "backgroundColor", this.backgroundColor, true);<NEW_LINE>ChartUtils.writeDataValue(fsw, "borderColor", this.borderColor, true);<NEW_LINE>ChartUtils.writeDataValue(fsw, "borderWidth", this.borderWidth, true);<NEW_LINE>ChartUtils.writeDataValue(fsw, "hoverBackgroundColor", this.hoverBackgroundColor, true);<NEW_LINE>ChartUtils.writeDataValue(fsw, "hoverBorderColor", this.hoverBorderColor, true);<NEW_LINE>ChartUtils.writeDataValue(fsw, "hoverBorderWidth", this.hoverBorderWidth, true);<NEW_LINE>fsw.write("}");<NEW_LINE>return fsw.toString();<NEW_LINE>}<NEW_LINE>} | this.getType(), false); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.