idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,506,264 | private State checkh(State state) throws DatatypeException, IOException {<NEW_LINE>if (state.context.length() == 0) {<NEW_LINE>state = appendToContext(state);<NEW_LINE>}<NEW_LINE>state.current = state.reader.read();<NEW_LINE>state = appendToContext(state);<NEW_LINE>state = skipSpaces(state);<NEW_LINE>boolean expectNumber = true;<NEW_LINE>for (; ; ) {<NEW_LINE>switch(state.current) {<NEW_LINE>default:<NEW_LINE>if (expectNumber)<NEW_LINE>reportNonNumber('h', <MASK><NEW_LINE>return state;<NEW_LINE>case '+':<NEW_LINE>case '-':<NEW_LINE>case '.':<NEW_LINE>case '0':<NEW_LINE>case '1':<NEW_LINE>case '2':<NEW_LINE>case '3':<NEW_LINE>case '4':<NEW_LINE>case '5':<NEW_LINE>case '6':<NEW_LINE>case '7':<NEW_LINE>case '8':<NEW_LINE>case '9':<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>state = checkArg('h', "x coordinate", state);<NEW_LINE>state = skipCommaSpaces2(state);<NEW_LINE>expectNumber = state.skipped;<NEW_LINE>}<NEW_LINE>} | state.current, state.context); |
413,136 | public int doMain(String[] args) throws InvocationTargetException, InterruptedException {<NEW_LINE>GCViewerArgsParser argsParser = gcViewerArgsParser;<NEW_LINE>try {<NEW_LINE>argsParser.parseArguments(args);<NEW_LINE>} catch (GCViewerArgsParserException e) {<NEW_LINE>usage();<NEW_LINE>LOGGER.log(Level.SEVERE, e.getMessage(), e);<NEW_LINE>return EXIT_ARGS_PARSE_FAILED;<NEW_LINE>}<NEW_LINE>if (argsParser.getArgumentCount() > 3) {<NEW_LINE>usage();<NEW_LINE>return EXIT_TOO_MANY_ARGS;<NEW_LINE>} else if (argsParser.getArgumentCount() >= 2) {<NEW_LINE>LOGGER.info("GCViewer command line mode");<NEW_LINE>GCResource gcResource = argsParser.getGcResource();<NEW_LINE>String summaryFilePath = argsParser.getSummaryFilePath();<NEW_LINE>String chartFilePath = argsParser.getChartFilePath();<NEW_LINE>DataWriterType type = argsParser.getType();<NEW_LINE>// export summary:<NEW_LINE>try {<NEW_LINE>export(<MASK><NEW_LINE>LOGGER.info("export completed successfully");<NEW_LINE>return EXIT_OK;<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.log(Level.SEVERE, "Error during report generation", e);<NEW_LINE>return EXIT_EXPORT_FAILED;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>gcViewerGuiController.startGui(argsParser.getArgumentCount() == 1 ? argsParser.getGcResource() : null);<NEW_LINE>return EXIT_OK;<NEW_LINE>}<NEW_LINE>} | gcResource, summaryFilePath, chartFilePath, type); |
1,080,038 | public IStatus run(IProgressMonitor monitor) {<NEW_LINE>SubMonitor sub = SubMonitor.convert(monitor, files.size());<NEW_LINE>if (sub.isCanceled()) {<NEW_LINE>return Status.CANCEL_STATUS;<NEW_LINE>}<NEW_LINE>if (!project.isAccessible() || getContainerURI() == null) {<NEW_LINE>return Status.CANCEL_STATUS;<NEW_LINE>}<NEW_LINE>Index index = getIndex();<NEW_LINE>if (index == null) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>IdeLog.// $NON-NLS-1$<NEW_LINE>logError(// $NON-NLS-1$<NEW_LINE>IndexPlugin.getDefault(), MessageFormat.format<MASK><NEW_LINE>return Status.CANCEL_STATUS;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>// Cleanup indices for files<NEW_LINE>for (IFile file : files) {<NEW_LINE>if (monitor.isCanceled()) {<NEW_LINE>return Status.CANCEL_STATUS;<NEW_LINE>}<NEW_LINE>index.remove(file.getLocationURI());<NEW_LINE>sub.worked(1);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>try {<NEW_LINE>index.save();<NEW_LINE>} catch (IOException e) {<NEW_LINE>IdeLog.logError(IndexPlugin.getDefault(), e);<NEW_LINE>}<NEW_LINE>sub.done();<NEW_LINE>}<NEW_LINE>return Status.OK_STATUS;<NEW_LINE>} | ("Index is null for container: {0}", getContainerURI())); |
669,714 | public boolean onInterceptTouchEvent(MotionEvent ev) {<NEW_LINE>if (!mEnabled)<NEW_LINE>return false;<NEW_LINE>final int action = ev.getAction() & MotionEventCompat.ACTION_MASK;<NEW_LINE>if (action == MotionEvent.ACTION_DOWN && DEBUG)<NEW_LINE>Log.v(TAG, "Received ACTION_DOWN");<NEW_LINE>if (action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_UP || (action != MotionEvent.ACTION_DOWN && mIsUnableToDrag)) {<NEW_LINE>endDrag();<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>switch(action) {<NEW_LINE>case MotionEvent.ACTION_MOVE:<NEW_LINE>try {<NEW_LINE>final int activePointerId = mActivePointerId;<NEW_LINE>if (activePointerId == INVALID_POINTER)<NEW_LINE>break;<NEW_LINE>final int pointerIndex = this.getPointerIndex(ev, activePointerId);<NEW_LINE>final float x = MotionEventCompat.getX(ev, pointerIndex);<NEW_LINE>final float dx = x - mLastMotionX;<NEW_LINE>final float <MASK><NEW_LINE>final float y = MotionEventCompat.getY(ev, pointerIndex);<NEW_LINE>final float yDiff = Math.abs(y - mLastMotionY);<NEW_LINE>if (DEBUG)<NEW_LINE>Log.v(TAG, "onInterceptTouch moved to:(" + x + ", " + y + "), diff:(" + xDiff + ", " + yDiff + "), mLastMotionX:" + mLastMotionX);<NEW_LINE>if (xDiff > mTouchSlop && xDiff > yDiff && thisSlideAllowed(dx)) {<NEW_LINE>if (DEBUG)<NEW_LINE>Log.v(TAG, "Starting drag! from onInterceptTouch");<NEW_LINE>startDrag();<NEW_LINE>mLastMotionX = x;<NEW_LINE>setScrollingCacheEnabled(true);<NEW_LINE>} else if (yDiff > mTouchSlop) {<NEW_LINE>mIsUnableToDrag = true;<NEW_LINE>}<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case MotionEvent.ACTION_DOWN:<NEW_LINE>mActivePointerId = ev.getAction() & ((Build.VERSION.SDK_INT >= 8) ? MotionEvent.ACTION_POINTER_INDEX_MASK : MotionEvent.ACTION_POINTER_INDEX_MASK);<NEW_LINE>mLastMotionX = mInitialMotionX = MotionEventCompat.getX(ev, mActivePointerId);<NEW_LINE>mLastMotionY = MotionEventCompat.getY(ev, mActivePointerId);<NEW_LINE>if (thisTouchAllowed(ev)) {<NEW_LINE>mIsBeingDragged = false;<NEW_LINE>mIsUnableToDrag = false;<NEW_LINE>if (isMenuOpen() && mViewBehind.menuTouchInQuickReturn(mContent, mCurItem, ev.getX() + mScrollX)) {<NEW_LINE>mQuickReturn = true;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>mIsUnableToDrag = true;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case MotionEventCompat.ACTION_POINTER_UP:<NEW_LINE>onSecondaryPointerUp(ev);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (!mIsBeingDragged) {<NEW_LINE>if (mVelocityTracker == null) {<NEW_LINE>mVelocityTracker = VelocityTracker.obtain();<NEW_LINE>}<NEW_LINE>mVelocityTracker.addMovement(ev);<NEW_LINE>}<NEW_LINE>return mIsBeingDragged || mQuickReturn;<NEW_LINE>} | xDiff = Math.abs(dx); |
805,713 | public void updateCachingAndArtifacts(ParsedDeployment parsedDeployment) {<NEW_LINE>EventRegistryEngineConfiguration eventRegistryEngineConfiguration = CommandContextUtil.getEventRegistryConfiguration();<NEW_LINE>DeploymentCache<EventDefinitionCacheEntry> eventDefinitionCache = eventRegistryEngineConfiguration.getDeploymentManager().getEventDefinitionCache();<NEW_LINE>EventDeploymentEntity deployment = parsedDeployment.getDeployment();<NEW_LINE>EventJsonConverter eventJsonConverter = eventRegistryEngineConfiguration.getEventJsonConverter();<NEW_LINE>for (EventDefinitionEntity eventDefinition : parsedDeployment.getAllEventDefinitions()) {<NEW_LINE>EventModel eventModel = parsedDeployment.getEventModelForEventDefinition(eventDefinition);<NEW_LINE>EventDefinitionCacheEntry cacheEntry = new EventDefinitionCacheEntry(eventDefinition, eventJsonConverter.convertToJson(eventModel));<NEW_LINE>eventDefinitionCache.add(eventDefinition.getId(), cacheEntry);<NEW_LINE>// Add to deployment for further usage<NEW_LINE>deployment.addDeployedArtifact(eventDefinition);<NEW_LINE>}<NEW_LINE>DeploymentCache<ChannelDefinitionCacheEntry> channelDefinitionCache = eventRegistryEngineConfiguration.getDeploymentManager().getChannelDefinitionCache();<NEW_LINE>for (ChannelDefinitionEntity channelDefinition : parsedDeployment.getAllChannelDefinitions()) {<NEW_LINE>ChannelModel channelModel = parsedDeployment.getChannelModelForChannelDefinition(channelDefinition);<NEW_LINE>ChannelDefinitionCacheEntry cacheEntry = new ChannelDefinitionCacheEntry(channelDefinition, channelModel);<NEW_LINE>channelDefinitionCache.add(<MASK><NEW_LINE>registerChannelModel(channelModel, channelDefinition, eventRegistryEngineConfiguration);<NEW_LINE>// Add to deployment for further usage<NEW_LINE>deployment.addDeployedArtifact(channelDefinition);<NEW_LINE>}<NEW_LINE>} | channelDefinition.getId(), cacheEntry); |
1,574,338 | public void operationComplete(Future<Channel> future) throws Exception {<NEW_LINE>Throwable cause = null;<NEW_LINE>if (future.isSuccess()) {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>send(channel, endpointMatcher, msg);<NEW_LINE>} catch (Throwable t) {<NEW_LINE>cause = t;<NEW_LINE>} finally {<NEW_LINE>try {<NEW_LINE>channelPool.release(channel);<NEW_LINE>} catch (RejectedExecutionException e) {<NEW_LINE>LOGGER.debug("{}", e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (future.isCancelled()) {<NEW_LINE>cause = new CancellationException();<NEW_LINE>} else {<NEW_LINE>cause = future.cause();<NEW_LINE>}<NEW_LINE>if (cause != null) {<NEW_LINE>if (cause instanceof ConnectTimeoutException) {<NEW_LINE>LOGGER.debug("{}", cause.getMessage());<NEW_LINE>} else if (cause instanceof CancellationException) {<NEW_LINE>if (isRunning()) {<NEW_LINE>LOGGER.debug("{}", cause.getMessage());<NEW_LINE>} else {<NEW_LINE>LOGGER.trace("{}", cause.getMessage());<NEW_LINE>}<NEW_LINE>} else if (cause instanceof IllegalStateException) {<NEW_LINE>if (isRunning()) {<NEW_LINE>LOGGER.debug("{}", cause.getMessage());<NEW_LINE>} else {<NEW_LINE>LOGGER.trace("{}", cause.getMessage());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>LOGGER.warn("Unable to open connection to {}", StringUtil.toLog(msg.getInetSocketAddress()), future.cause());<NEW_LINE>}<NEW_LINE>msg.onError(future.cause());<NEW_LINE>}<NEW_LINE>} | Channel channel = future.getNow(); |
255,262 | public ErrorDetails unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ErrorDetails errorDetails = new ErrorDetails();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("code", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>errorDetails.setCode(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("message", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>errorDetails.setMessage(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 errorDetails;<NEW_LINE>} | class).unmarshall(context)); |
920,610 | private static <T> OptionType<T> defaultEnumType(Class<T> clazz) {<NEW_LINE>return new OptionType<>(clazz.getSimpleName(), new Function<String, T>() {<NEW_LINE><NEW_LINE>final Map<String, Enum<?>> validValues = new HashMap<>();<NEW_LINE><NEW_LINE>{<NEW_LINE>Class<? extends Enum<?>> enumType = (Class<? extends Enum<?>>) clazz;<NEW_LINE>for (Enum<?> constant : enumType.getEnumConstants()) {<NEW_LINE>validValues.put(constant.toString(), constant);<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@SuppressWarnings("rawtypes")<NEW_LINE>public T apply(String t) {<NEW_LINE>Class<? extends Enum> enumType = (Class<? extends Enum>) clazz;<NEW_LINE>if (t != null) {<NEW_LINE>Enum <MASK><NEW_LINE>if (value != null) {<NEW_LINE>return (T) value;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// fallthrough to failed<NEW_LINE>StringBuilder b = new StringBuilder();<NEW_LINE>String sep = "";<NEW_LINE>for (Enum constant : enumType.getEnumConstants()) {<NEW_LINE>b.append(sep);<NEW_LINE>b.append('\'');<NEW_LINE>b.append(constant.toString());<NEW_LINE>b.append('\'');<NEW_LINE>sep = ", ";<NEW_LINE>}<NEW_LINE>throw new IllegalArgumentException("Invalid option value '" + t + "'. Valid options values are: " + b.toString());<NEW_LINE>}<NEW_LINE>}, true);<NEW_LINE>} | value = validValues.get(t); |
1,851,704 | public Dialog onCreateDialog(Bundle savedInstanceState) {<NEW_LINE>@SuppressLint("InflateParams")<NEW_LINE>View view = LayoutInflater.from(getContext()).inflate(R.layout.preference_dialog_now_playing_screen, null);<NEW_LINE>ViewPager viewPager = view.findViewById(R.id.now_playing_screen_view_pager);<NEW_LINE>viewPager.setAdapter(new NowPlayingScreenAdapter(getContext()));<NEW_LINE>viewPager.addOnPageChangeListener(this);<NEW_LINE>viewPager.setPageMargin((int) ViewUtil.convertDpToPixel<MASK><NEW_LINE>viewPager.setCurrentItem(PreferenceUtil.getInstance(getContext()).getNowPlayingScreen().ordinal());<NEW_LINE>InkPageIndicator pageIndicator = view.findViewById(R.id.page_indicator);<NEW_LINE>pageIndicator.setViewPager(viewPager);<NEW_LINE>pageIndicator.onPageSelected(viewPager.getCurrentItem());<NEW_LINE>return new MaterialDialog.Builder(getContext()).title(R.string.pref_title_now_playing_screen_appearance).positiveText(android.R.string.ok).negativeText(android.R.string.cancel).onAny(this).customView(view, false).build();<NEW_LINE>} | (32, getResources())); |
701,341 | public MessageCommentReactionEntity postMessageCommentReactions(MessageCommentReactionsBody body) throws ApiException {<NEW_LINE>Object localVarPostBody = body;<NEW_LINE>// verify the required parameter 'body' is set<NEW_LINE>if (body == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'body' when calling postMessageCommentReactions");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/message_comment_reactions";<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>final String[] localVarAccepts = { "application/json" };<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final <MASK><NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] {};<NEW_LINE>GenericType<MessageCommentReactionEntity> localVarReturnType = new GenericType<MessageCommentReactionEntity>() {<NEW_LINE>};<NEW_LINE>return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);<NEW_LINE>} | String[] localVarContentTypes = { "application/json" }; |
255,204 | public List<SyntheticResultRollup0> readLastFromRollup0(String agentRollupId, String syntheticMonitorId, int x) throws Exception {<NEW_LINE>BoundStatement boundStatement = readLastFromRollup0.bind();<NEW_LINE>int i = 0;<NEW_LINE>boundStatement.setString(i++, agentRollupId);<NEW_LINE>boundStatement.setString(i++, syntheticMonitorId);<NEW_LINE>boundStatement.setInt(i++, x);<NEW_LINE>ResultSet <MASK><NEW_LINE>List<SyntheticResultRollup0> syntheticResults = new ArrayList<>();<NEW_LINE>for (Row row : results) {<NEW_LINE>i = 0;<NEW_LINE>long captureTime = checkNotNull(row.getTimestamp(i++)).getTime();<NEW_LINE>double totalDurationNanos = row.getDouble(i++);<NEW_LINE>ByteBuffer errorIntervalsBytes = row.getBytes(i++);<NEW_LINE>syntheticResults.add(ImmutableSyntheticResultRollup0.builder().captureTime(captureTime).totalDurationNanos(totalDurationNanos).error(errorIntervalsBytes != null).build());<NEW_LINE>}<NEW_LINE>return syntheticResults;<NEW_LINE>} | results = session.read(boundStatement); |
100,085 | public static BufferedImage extractBuffered(InterleavedU8 img) {<NEW_LINE>if (img.isSubimage())<NEW_LINE>throw new IllegalArgumentException("Sub-images are not supported for this operation");<NEW_LINE>final int width = img.width;<NEW_LINE>final int height = img.height;<NEW_LINE>final int numBands = img.numBands;<NEW_LINE>// wrap the byte array<NEW_LINE>DataBuffer bufferByte = new DataBufferByte(img.data, width * height * numBands, 0);<NEW_LINE>ColorModel colorModel;<NEW_LINE>int[] bOffs = null;<NEW_LINE>if (numBands == 3) {<NEW_LINE>ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);<NEW_LINE>int[] nBits = { 8, 8, 8 };<NEW_LINE>bOffs = new int[] { 2, 1, 0 };<NEW_LINE>colorModel = new ComponentColorModel(cs, nBits, false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE);<NEW_LINE>} else if (numBands == 1) {<NEW_LINE>ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);<NEW_LINE><MASK><NEW_LINE>bOffs = new int[] { 0 };<NEW_LINE>colorModel = new ComponentColorModel(cs, nBits, false, true, Transparency.OPAQUE, DataBuffer.TYPE_BYTE);<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("Only 1 or 3 bands supported");<NEW_LINE>}<NEW_LINE>// Create a raster using the sample model and data buffer<NEW_LINE>WritableRaster raster = Raster.createInterleavedRaster(bufferByte, width, height, img.stride, numBands, bOffs, new Point(0, 0));<NEW_LINE>// Combine the color model and raster into a buffered image<NEW_LINE>return new BufferedImage(colorModel, raster, false, null);<NEW_LINE>} | int[] nBits = { 8 }; |
192,563 | public void update(AnActionEvent e) {<NEW_LINE>e.getPresentation().setText(CommonActionsPanel.Buttons.EDIT.getText());<NEW_LINE>e.getPresentation().setIcon(CommonActionsPanel.<MASK><NEW_LINE>e.getPresentation().setEnabled(true);<NEW_LINE>Project project = e.getProject();<NEW_LINE>FavoritesViewTreeBuilder treeBuilder = e.getDataContext().getData(FavoritesTreeViewPanel.FAVORITES_TREE_BUILDER_KEY);<NEW_LINE>String listName = e.getDataContext().getData(FavoritesTreeViewPanel.FAVORITES_LIST_NAME_DATA_KEY);<NEW_LINE>if (project == null || treeBuilder == null || listName == null) {<NEW_LINE>e.getPresentation().setEnabled(false);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>FavoritesManager favoritesManager = FavoritesManager.getInstance(project);<NEW_LINE>FavoritesListProvider provider = favoritesManager.getListProvider(listName);<NEW_LINE>Set<Object> selection = treeBuilder.getSelectedElements();<NEW_LINE>if (provider != null) {<NEW_LINE>e.getPresentation().setEnabled(provider.willHandle(CommonActionsPanel.Buttons.EDIT, project, selection));<NEW_LINE>e.getPresentation().setText(provider.getCustomName(CommonActionsPanel.Buttons.EDIT));<NEW_LINE>}<NEW_LINE>} | Buttons.EDIT.getIcon()); |
517,165 | public ContainerGroupImpl withNewAzureFileShareVolume(String volumeName, String shareName) {<NEW_LINE>if (this.newFileShares == null || this.creatableStorageAccountKey == null) {<NEW_LINE>StorageAccount.DefinitionStages.WithGroup definitionWithGroup = manager().storageManager().storageAccounts().define(manager().resourceManager().internalContext().randomResourceName("fs", 24)).withRegion(this.regionName());<NEW_LINE>Creatable<StorageAccount> creatable;<NEW_LINE>if (this.creatableGroup != null) {<NEW_LINE>creatable = <MASK><NEW_LINE>} else {<NEW_LINE>creatable = definitionWithGroup.withExistingResourceGroup(this.resourceGroupName());<NEW_LINE>}<NEW_LINE>this.creatableStorageAccountKey = this.addDependency(creatable);<NEW_LINE>this.newFileShares = new HashMap<>();<NEW_LINE>}<NEW_LINE>this.newFileShares.put(volumeName, shareName);<NEW_LINE>return this;<NEW_LINE>} | definitionWithGroup.withNewResourceGroup(this.creatableGroup); |
1,519,962 | public ResultQuery<Record12<String, String, String, String, Integer, Integer, Long, Long, BigDecimal, BigDecimal, Boolean, Long>> sequences(List<String> schemas) {<NEW_LINE>Field<Long> minValue = is2_0_202() ? field(SEQUENCES.getQualifiedName().append("MINIMUM_VALUE"), SEQUENCES.MIN_VALUE.getDataType()) : SEQUENCES.MIN_VALUE;<NEW_LINE>Field<Long> maxValue = is2_0_202() ? field(SEQUENCES.getQualifiedName().append("MAXIMUM_VALUE"), SEQUENCES.MAX_VALUE.getDataType()) : SEQUENCES.MAX_VALUE;<NEW_LINE>Field<Boolean> isCycle = is2_0_202() ? field(field(SEQUENCES.getQualifiedName().append("CYCLE_OPTION")).eq(inline(<MASK><NEW_LINE>return create().select(inline(null, VARCHAR).as("catalog"), SEQUENCES.SEQUENCE_SCHEMA, SEQUENCES.SEQUENCE_NAME, inline("BIGINT").as("type_name"), inline(null, INTEGER).as("precision"), inline(null, INTEGER).as("scale"), inline(null, BIGINT).as("start_value"), nullif(SEQUENCES.INCREMENT, inline(1L)).as(SEQUENCES.INCREMENT), nullif(minValue, inline(1L)).coerce(NUMERIC).as(SEQUENCES.MIN_VALUE), nullif(maxValue, inline(DEFAULT_SEQUENCE_MAXVALUE)).coerce(NUMERIC).as(SEQUENCES.MAX_VALUE), isCycle.as(SEQUENCES.IS_CYCLE), nullif(SEQUENCES.CACHE, inline(DEFAULT_SEQUENCE_CACHE)).as(SEQUENCES.CACHE)).from(SEQUENCES).where(SEQUENCES.SEQUENCE_SCHEMA.in(schemas)).and(!getIncludeSystemSequences() ? upper(SEQUENCES.SEQUENCE_NAME).notLike(inline("SYSTEM!_SEQUENCE!_%"), '!') : noCondition()).orderBy(SEQUENCES.SEQUENCE_SCHEMA, SEQUENCES.SEQUENCE_NAME);<NEW_LINE>} | "YES"))) : SEQUENCES.IS_CYCLE; |
75,131 | private void unRegisterDataSourceDefinitions(String appName, Descriptor descriptor) {<NEW_LINE>if (descriptor instanceof JndiNameEnvironment) {<NEW_LINE>JndiNameEnvironment env = (JndiNameEnvironment) descriptor;<NEW_LINE>for (Descriptor dsd : env.getResourceDescriptors(DSD)) {<NEW_LINE>unregisterDSDReferredByApplication(appName, (DataSourceDefinitionDescriptor) dsd);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// EJB descriptor<NEW_LINE>if (descriptor instanceof EjbBundleDescriptor) {<NEW_LINE>EjbBundleDescriptor ejbDesc = (EjbBundleDescriptor) descriptor;<NEW_LINE>for (EjbDescriptor ejbDescriptor : ejbDesc.getEjbs()) {<NEW_LINE>for (Descriptor dsd : ejbDescriptor.getResourceDescriptors(DSD)) {<NEW_LINE>unregisterDSDReferredByApplication(appName, (DataSourceDefinitionDescriptor) dsd);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// EJB interceptors<NEW_LINE>for (EjbInterceptor ejbInterceptor : ejbDesc.getInterceptors()) {<NEW_LINE>for (Descriptor dsd : ejbInterceptor.getResourceDescriptors(DSD)) {<NEW_LINE>unregisterDSDReferredByApplication(appName, (DataSourceDefinitionDescriptor) dsd);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Managed bean descriptors<NEW_LINE>if (descriptor instanceof BundleDescriptor) {<NEW_LINE>Set<ManagedBeanDescriptor> managedBeanDescriptors = ((BundleDescriptor) descriptor).getManagedBeans();<NEW_LINE>for (ManagedBeanDescriptor mbd : managedBeanDescriptors) {<NEW_LINE>for (Descriptor dsd : mbd.getResourceDescriptors(DSD)) {<NEW_LINE>unregisterDSDReferredByApplication<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (appName, (DataSourceDefinitionDescriptor) dsd); |
1,291,926 | protected String doIt() throws Exception {<NEW_LINE>// Instance current Payment Selection<NEW_LINE>MPaySelection paySelection = new MPaySelection(getCtx(), getRecord_ID(), get_TrxName());<NEW_LINE>sequence.set(paySelection.getLastLineNo());<NEW_LINE>// Loop for keys<NEW_LINE>getSelectionKeys().forEach(key -> {<NEW_LINE>// get values from result set<NEW_LINE>int movementId = key;<NEW_LINE>String paymentRule = getSelectionAsString(key, "HRM_PaymentRule");<NEW_LINE>BigDecimal sourceAmount = getSelectionAsBigDecimal(key, "HRM_Amount");<NEW_LINE>BigDecimal convertedAmount = getSelectionAsBigDecimal(key, "HRM_ConvertedAmount");<NEW_LINE>MPaySelectionLine line = new MPaySelectionLine(paySelection, sequence.getAndAdd(10), paymentRule);<NEW_LINE>// Add Order<NEW_LINE>X_HR_Movement payrollMovement = new X_HR_Movement(getCtx(), movementId, get_TrxName());<NEW_LINE>Optional<X_HR_Process> mybePayrollProcess = Optional.ofNullable(payrollProcessMap.get(payrollMovement.getHR_Process_ID()));<NEW_LINE>X_HR_Process payrollProcess = mybePayrollProcess.orElseGet(() -> {<NEW_LINE>X_HR_Process processFromMovement = (X_HR_Process) payrollMovement.getHR_Process();<NEW_LINE>payrollProcessMap.put(payrollMovement.getHR_Process_ID(), processFromMovement);<NEW_LINE>return processFromMovement;<NEW_LINE>});<NEW_LINE>// Set from Payroll Movement and conversion type<NEW_LINE>line.setHRMovement(payrollMovement, payrollProcess.<MASK><NEW_LINE>// Save<NEW_LINE>line.saveEx();<NEW_LINE>});<NEW_LINE>// Default Ok<NEW_LINE>return "@OK@";<NEW_LINE>} | getC_ConversionType_ID(), sourceAmount, convertedAmount); |
601,328 | protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {<NEW_LINE>JsonObject input = InputParser.parseJsonObjectOrThrowError(req);<NEW_LINE>String sessionHandle = InputParser.parseStringOrThrowError(input, "sessionHandle", false);<NEW_LINE>assert sessionHandle != null;<NEW_LINE>JsonObject userDataInJWT = InputParser.parseJsonObjectOrThrowError(input, "userDataInJWT", false);<NEW_LINE>assert userDataInJWT != null;<NEW_LINE>try {<NEW_LINE>Session.updateSession(main, sessionHandle, null, userDataInJWT, null);<NEW_LINE>JsonObject result = new JsonObject();<NEW_LINE>result.addProperty("status", "OK");<NEW_LINE>super.<MASK><NEW_LINE>} catch (StorageQueryException e) {<NEW_LINE>throw new ServletException(e);<NEW_LINE>} catch (UnauthorisedException e) {<NEW_LINE>Logging.debug(main, Utils.exceptionStacktraceToString(e));<NEW_LINE>JsonObject reply = new JsonObject();<NEW_LINE>reply.addProperty("status", "UNAUTHORISED");<NEW_LINE>reply.addProperty("message", e.getMessage());<NEW_LINE>super.sendJsonResponse(200, reply, resp);<NEW_LINE>}<NEW_LINE>} | sendJsonResponse(200, result, resp); |
1,315,702 | public DescribeGlobalTableSettingsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>DescribeGlobalTableSettingsResult describeGlobalTableSettingsResult = new DescribeGlobalTableSettingsResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return describeGlobalTableSettingsResult;<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("GlobalTableName", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>describeGlobalTableSettingsResult.setGlobalTableName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("ReplicaSettings", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>describeGlobalTableSettingsResult.setReplicaSettings(new ListUnmarshaller<ReplicaSettingsDescription>(ReplicaSettingsDescriptionJsonUnmarshaller.getInstance(<MASK><NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return describeGlobalTableSettingsResult;<NEW_LINE>} | )).unmarshall(context)); |
1,667,811 | final UpdatePricingRuleResult executeUpdatePricingRule(UpdatePricingRuleRequest updatePricingRuleRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updatePricingRuleRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdatePricingRuleRequest> request = null;<NEW_LINE>Response<UpdatePricingRuleResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdatePricingRuleRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updatePricingRuleRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdatePricingRule");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdatePricingRuleResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdatePricingRuleResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.SERVICE_ID, "billingconductor"); |
1,050,328 | public void loadIcons(IconPack pack) {<NEW_LINE>_pack = pack;<NEW_LINE>_query = null;<NEW_LINE>_icons = new ArrayList<>(_pack.getIcons());<NEW_LINE>_categories.clear();<NEW_LINE>Comparator<IconPack.Icon> iconCategoryComparator = (i1, i2) -> {<NEW_LINE>String c1 = getCategoryString(i1.getCategory());<NEW_LINE>String c2 = getCategoryString(i2.getCategory());<NEW_LINE>return c1.compareTo(c2);<NEW_LINE>};<NEW_LINE>Collections.sort(_icons, iconCategoryComparator.thenComparing(IconPack.Icon::getName));<NEW_LINE>long categoryCount = _icons.stream().map(IconPack.Icon::getCategory).filter(Objects::nonNull).distinct().count();<NEW_LINE>List<IconPack.Icon> suggested = pack.getSuggestedIcons(_issuer);<NEW_LINE>suggested.add(0, new DummyIcon(_context.getString(R.string.icon_custom)));<NEW_LINE>if (suggested.size() > 0) {<NEW_LINE>CategoryHeader category = new CategoryHeader(_context.getString(R.string.suggested));<NEW_LINE>category.setIsCollapsed(false);<NEW_LINE>category.getIcons().addAll(suggested);<NEW_LINE>_categories.add(category);<NEW_LINE>}<NEW_LINE>CategoryHeader category = null;<NEW_LINE>for (IconPack.Icon icon : _icons) {<NEW_LINE>String iconCategory = <MASK><NEW_LINE>if (category == null || !getCategoryString(category.getCategory()).equals(iconCategory)) {<NEW_LINE>boolean collapsed = !(categoryCount == 0 && category == null);<NEW_LINE>category = new CategoryHeader(iconCategory);<NEW_LINE>category.setIsCollapsed(collapsed);<NEW_LINE>_categories.add(category);<NEW_LINE>}<NEW_LINE>category.getIcons().add(icon);<NEW_LINE>}<NEW_LINE>_icons.addAll(0, suggested);<NEW_LINE>updateCategoryPositions();<NEW_LINE>notifyDataSetChanged();<NEW_LINE>} | getCategoryString(icon.getCategory()); |
1,174,959 | private boolean validateSend() {<NEW_LINE>String recipientAddress = Helper.getValue(inputSendAddress.getText());<NEW_LINE>String amountString = Helper.getValue(inputSendAmount.getText());<NEW_LINE>if (!recipientAddress.matches(LbryUri.REGEX_ADDRESS)) {<NEW_LINE>Snackbar.make(getView(), R.string.invalid_recipient_address, Snackbar.LENGTH_LONG).setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (!Helper.isNullOrEmpty(amountString)) {<NEW_LINE>try {<NEW_LINE>double amountValue = Double.valueOf(amountString);<NEW_LINE>double availableAmount = Lbry.walletBalance.getAvailable().doubleValue();<NEW_LINE>if (availableAmount < amountValue) {<NEW_LINE>Snackbar.make(getView(), R.string.insufficient_balance, Snackbar.LENGTH_LONG).setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} catch (NumberFormatException ex) {<NEW_LINE>// pass<NEW_LINE>Snackbar.make(getView(), R.string.invalid_amount, Snackbar.LENGTH_LONG).setBackgroundTint(Color.RED).setTextColor(<MASK><NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | Color.WHITE).show(); |
450,418 | public void validatePeriods(final I_C_Flatrate_Term term) {<NEW_LINE>if (term.getStartDate() != null && !term.isProcessed()) {<NEW_LINE>Services.get(IFlatrateBL.class).updateNoticeDateAndEndDate(term);<NEW_LINE>setMasterEndDate(term);<NEW_LINE>}<NEW_LINE>final Properties <MASK><NEW_LINE>final String trxName = InterfaceWrapperHelper.getTrxName(term);<NEW_LINE>final List<String> errors = new ArrayList<>();<NEW_LINE>final IMsgBL msgBL = Services.get(IMsgBL.class);<NEW_LINE>if (term.getStartDate() != null && term.getEndDate() != null && !X_C_Flatrate_Conditions.TYPE_CONDITIONS_Subscription.equals(term.getType_Conditions())) {<NEW_LINE>final ICalendarDAO calendarDAO = Services.get(ICalendarDAO.class);<NEW_LINE>final I_C_Calendar invoicingCal = term.getC_Flatrate_Conditions().getC_Flatrate_Transition().getC_Calendar_Contract();<NEW_LINE>final List<I_C_Period> periodsOfTerm = calendarDAO.retrievePeriods(ctx, invoicingCal, term.getStartDate(), term.getEndDate(), trxName);<NEW_LINE>if (periodsOfTerm.isEmpty()) {<NEW_LINE>errors.add(msgBL.getMsg(ctx, MSG_TERM_ERROR_YEAR_WITHOUT_PERIODS_2P, new Object[] { term.getStartDate(), term.getEndDate() }));<NEW_LINE>} else {<NEW_LINE>if (periodsOfTerm.get(0).getStartDate().after(term.getStartDate())) {<NEW_LINE>errors.add(msgBL.getMsg(ctx, MSG_TERM_ERROR_PERIOD_START_DATE_AFTER_TERM_START_DATE_2P, new Object[] { term.getStartDate(), invoicingCal.getName() }));<NEW_LINE>}<NEW_LINE>final I_C_Period lastPeriodOfTerm = periodsOfTerm.get(periodsOfTerm.size() - 1);<NEW_LINE>if (lastPeriodOfTerm.getEndDate().before(term.getEndDate())) {<NEW_LINE>errors.add(msgBL.getMsg(ctx, MSG_TERM_ERROR_PERIOD_END_DATE_BEFORE_TERM_END_DATE_2P, new Object[] { lastPeriodOfTerm.getEndDate(), invoicingCal.getName() }));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!errors.isEmpty()) {<NEW_LINE>throw new AdempiereException(concatStrings(errors)).markAsUserValidationError();<NEW_LINE>}<NEW_LINE>} | ctx = InterfaceWrapperHelper.getCtx(term); |
533,460 | public static ReaderGroupConfigRecord update(ReaderGroupConfig rgConfig, long generation, boolean isUpdating) {<NEW_LINE>Map<String, RGStreamCutRecord> startStreamCuts = rgConfig.getStartingStreamCuts().entrySet().stream().collect(Collectors.toMap(e -> e.getKey().getScopedName(), e -> new RGStreamCutRecord(ModelHelper.getStreamCutMap(e<MASK><NEW_LINE>Map<String, RGStreamCutRecord> endStreamCuts = rgConfig.getEndingStreamCuts().entrySet().stream().collect(Collectors.toMap(e -> e.getKey().getScopedName(), e -> new RGStreamCutRecord(ModelHelper.getStreamCutMap(e.getValue()))));<NEW_LINE>return ReaderGroupConfigRecord.builder().generation(generation).groupRefreshTimeMillis(rgConfig.getGroupRefreshTimeMillis()).automaticCheckpointIntervalMillis(rgConfig.getAutomaticCheckpointIntervalMillis()).maxOutstandingCheckpointRequest(rgConfig.getMaxOutstandingCheckpointRequest()).retentionTypeOrdinal(rgConfig.getRetentionType().ordinal()).startingStreamCuts(startStreamCuts).endingStreamCuts(endStreamCuts).updating(isUpdating).build();<NEW_LINE>} | .getValue())))); |
714,158 | private boolean transitionPowerState(OutOfBandManagement.PowerState.Event event, OutOfBandManagement outOfBandManagementHost) {<NEW_LINE>if (outOfBandManagementHost == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>OutOfBandManagement.PowerState currentPowerState = outOfBandManagementHost.getPowerState();<NEW_LINE>Host host = hostDao.findById(outOfBandManagementHost.getHostId());<NEW_LINE>try {<NEW_LINE>OutOfBandManagement.PowerState newPowerState = OutOfBandManagement.PowerState.getStateMachine(<MASK><NEW_LINE>boolean result = OutOfBandManagement.PowerState.getStateMachine().transitTo(outOfBandManagementHost, event, null, outOfBandManagementDao);<NEW_LINE>if (result) {<NEW_LINE>final String message = String.format("Transitioned out-of-band management power state from %s to %s due to event: %s for %s", currentPowerState, newPowerState, event, host);<NEW_LINE>LOG.debug(message);<NEW_LINE>if (newPowerState == OutOfBandManagement.PowerState.Unknown) {<NEW_LINE>ActionEventUtils.onActionEvent(CallContext.current().getCallingUserId(), CallContext.current().getCallingAccountId(), Domain.ROOT_DOMAIN, EventTypes.EVENT_HOST_OUTOFBAND_MANAGEMENT_POWERSTATE_TRANSITION, message);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} catch (NoTransitionException ignored) {<NEW_LINE>LOG.trace(String.format("Unable to transition out-of-band management power state for %s for the event: %s and current power state: %s", host, event, currentPowerState));<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | ).getNextState(currentPowerState, event); |
1,823,168 | public void transfer(final Session<?> source, final Session<?> destination, final Path file, final Local local, final TransferOptions options, final TransferStatus overall, final TransferStatus segment, final ConnectionCallback connectionCallback, final ProgressListener listener, final StreamListener streamListener) throws BackgroundException {<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug(String.format("Transfer file %s with options %s", file, options));<NEW_LINE>}<NEW_LINE>if (file.isSymbolicLink()) {<NEW_LINE>if (symlinkResolver.resolve(file)) {<NEW_LINE>// Make relative symbolic link<NEW_LINE>final String target = symlinkResolver.relativize(file.getAbsolute(), file.getSymlinkTarget().getAbsolute());<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug(String.format("Create symbolic link from %s to %s", local, target));<NEW_LINE>}<NEW_LINE>final Symlink symlink = LocalSymlinkFactory.get();<NEW_LINE>symlink.symlink(local, target);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (file.isFile()) {<NEW_LINE>listener.message(MessageFormat.format(LocaleFactory.localizedString("Downloading {0}", "Status"), file.getName()));<NEW_LINE>final <MASK><NEW_LINE>if (!folder.exists()) {<NEW_LINE>new DefaultLocalDirectoryFeature().mkdir(folder);<NEW_LINE>}<NEW_LINE>// Transfer<NEW_LINE>final Download download = source.getFeature(Download.class);<NEW_LINE>download.download(file, local, bandwidth, new DownloadStreamListener(this, this.options.icon && segment.getLength() > PreferencesFactory.get().getLong("queue.download.icon.threshold") && !overall.isSegmented() ? new IconUpdateStreamListener(streamListener, segment, local) : streamListener), segment, connectionCallback);<NEW_LINE>}<NEW_LINE>} | Local folder = local.getParent(); |
336,868 | private String dumpZoneNAryDetails(StoreRoutingPlan storeRoutingPlan) {<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>sb.append("\tDetailed Dump (Zone N-Aries):").append(Utils.NEWLINE);<NEW_LINE>for (Node node : storeRoutingPlan.getCluster().getNodes()) {<NEW_LINE>int zoneId = node.getZoneId();<NEW_LINE>int nodeId = node.getId();<NEW_LINE>sb.append("\tNode ID: " + nodeId + " in zone " + zoneId).append(Utils.NEWLINE);<NEW_LINE>List<Integer> naries = storeRoutingPlan.getZoneNAryPartitionIds(nodeId);<NEW_LINE>Map<Integer, List<Integer>> zoneNaryTypeToPartitionIds = new HashMap<Integer<MASK><NEW_LINE>for (int nary : naries) {<NEW_LINE>int zoneReplicaType = storeRoutingPlan.getZoneNaryForNodesPartition(zoneId, nodeId, nary);<NEW_LINE>if (!zoneNaryTypeToPartitionIds.containsKey(zoneReplicaType)) {<NEW_LINE>zoneNaryTypeToPartitionIds.put(zoneReplicaType, new ArrayList<Integer>());<NEW_LINE>}<NEW_LINE>zoneNaryTypeToPartitionIds.get(zoneReplicaType).add(nary);<NEW_LINE>}<NEW_LINE>for (int replicaType : new TreeSet<Integer>(zoneNaryTypeToPartitionIds.keySet())) {<NEW_LINE>sb.append("\t\t" + replicaType + " : ");<NEW_LINE>sb.append(zoneNaryTypeToPartitionIds.get(replicaType).toString());<NEW_LINE>sb.append(Utils.NEWLINE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return sb.toString();<NEW_LINE>} | , List<Integer>>(); |
1,204,860 | private void fillSpecific(int position, Recycler recycler, State state) {<NEW_LINE>if (state.getItemCount() <= 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>makeAndAddView(position, Direction.END, recycler);<NEW_LINE>final int extraSpaceBefore;<NEW_LINE>final int extraSpaceAfter;<NEW_LINE>final int extraSpace = getExtraLayoutSpace(state);<NEW_LINE>if (state.getTargetScrollPosition() < position) {<NEW_LINE>extraSpaceAfter = 0;<NEW_LINE>extraSpaceBefore = extraSpace;<NEW_LINE>} else {<NEW_LINE>extraSpaceAfter = extraSpace;<NEW_LINE>extraSpaceBefore = 0;<NEW_LINE>}<NEW_LINE>fillBefore(position - 1, recycler, extraSpaceBefore);<NEW_LINE>// This will correct for the top of the first view not<NEW_LINE>// touching the top of the parent.<NEW_LINE>adjustViewsStartOrEnd();<NEW_LINE>fillAfter(position + 1, recycler, state, extraSpaceAfter);<NEW_LINE>correctTooHigh(<MASK><NEW_LINE>} | getChildCount(), recycler, state); |
1,620,811 | public void write(byte[] b, int off, int len) throws IOException {<NEW_LINE>int remaining = len;<NEW_LINE>int relativeOffset = off;<NEW_LINE>// Write the remainder of the part size to the staging file<NEW_LINE>// and continue to write new staging files if the write is<NEW_LINE>// larger than the part size.<NEW_LINE>while (stream.getCount() + remaining > multiPartSize) {<NEW_LINE>int writeSize = multiPartSize - (int) stream.getCount();<NEW_LINE>stream.write(b, relativeOffset, writeSize);<NEW_LINE>remaining -= writeSize;<NEW_LINE>relativeOffset += writeSize;<NEW_LINE>newStream();<NEW_LINE>uploadParts();<NEW_LINE>}<NEW_LINE>stream.<MASK><NEW_LINE>pos += len;<NEW_LINE>writeBytes.increment((long) len);<NEW_LINE>writeOperations.increment();<NEW_LINE>// switch to multipart upload<NEW_LINE>if (multipartUploadId == null && pos >= multiPartThresholdSize) {<NEW_LINE>initializeMultiPartUpload();<NEW_LINE>uploadParts();<NEW_LINE>}<NEW_LINE>} | write(b, relativeOffset, remaining); |
699,218 | public Request<DescribePrincipalIdFormatRequest> marshall(DescribePrincipalIdFormatRequest describePrincipalIdFormatRequest) {<NEW_LINE>if (describePrincipalIdFormatRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>Request<DescribePrincipalIdFormatRequest> request = new DefaultRequest<DescribePrincipalIdFormatRequest>(describePrincipalIdFormatRequest, "AmazonEC2");<NEW_LINE>request.addParameter("Action", "DescribePrincipalIdFormat");<NEW_LINE>request.addParameter("Version", "2016-11-15");<NEW_LINE><MASK><NEW_LINE>com.amazonaws.internal.SdkInternalList<String> describePrincipalIdFormatRequestResourcesList = (com.amazonaws.internal.SdkInternalList<String>) describePrincipalIdFormatRequest.getResources();<NEW_LINE>if (!describePrincipalIdFormatRequestResourcesList.isEmpty() || !describePrincipalIdFormatRequestResourcesList.isAutoConstruct()) {<NEW_LINE>int resourcesListIndex = 1;<NEW_LINE>for (String describePrincipalIdFormatRequestResourcesListValue : describePrincipalIdFormatRequestResourcesList) {<NEW_LINE>if (describePrincipalIdFormatRequestResourcesListValue != null) {<NEW_LINE>request.addParameter("Resource." + resourcesListIndex, StringUtils.fromString(describePrincipalIdFormatRequestResourcesListValue));<NEW_LINE>}<NEW_LINE>resourcesListIndex++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (describePrincipalIdFormatRequest.getMaxResults() != null) {<NEW_LINE>request.addParameter("MaxResults", StringUtils.fromInteger(describePrincipalIdFormatRequest.getMaxResults()));<NEW_LINE>}<NEW_LINE>if (describePrincipalIdFormatRequest.getNextToken() != null) {<NEW_LINE>request.addParameter("NextToken", StringUtils.fromString(describePrincipalIdFormatRequest.getNextToken()));<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | request.setHttpMethod(HttpMethodName.POST); |
521,847 | void update() {<NEW_LINE>SwingUtilities.invokeLater(() -> {<NEW_LINE>Book customerBook = library.getCustomerBook();<NEW_LINE>for (Map.Entry<Book, BookPanel> b : bookPanels.entrySet()) {<NEW_LINE>final Book book = b.getKey();<NEW_LINE>final BookPanel panel = b.getValue();<NEW_LINE>panel.setIsTarget(customerBook == book);<NEW_LINE>panel.setIsHeld<MASK><NEW_LINE>}<NEW_LINE>HashMap<Book, HashSet<String>> bookLocations = new HashMap<>();<NEW_LINE>for (Bookcase bookcase : library.getBookcases()) {<NEW_LINE>if (bookcase.getBook() != null) {<NEW_LINE>bookLocations.computeIfAbsent(bookcase.getBook(), a -> new HashSet<>()).add(bookcase.getLocationString());<NEW_LINE>} else {<NEW_LINE>for (Book book : bookcase.getPossibleBooks()) {<NEW_LINE>if (book != null) {<NEW_LINE>bookLocations.computeIfAbsent(book, a -> new HashSet<>()).add(bookcase.getLocationString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Map.Entry<Book, BookPanel> e : bookPanels.entrySet()) {<NEW_LINE>HashSet<String> locs = bookLocations.get(e.getKey());<NEW_LINE>if (locs == null || locs.size() > 3) {<NEW_LINE>e.getValue().setLocation("Unknown");<NEW_LINE>} else {<NEW_LINE>e.getValue().setLocation("<html>" + locs.stream().collect(Collectors.joining("<br>")) + "</html>");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | (plugin.doesPlayerContainBook(book)); |
375,534 | public List<FeedEntryStatus> findBySubscriptions(User user, List<FeedSubscription> subs, boolean unreadOnly, List<FeedEntryKeyword> keywords, Date newerThan, int offset, int limit, ReadingOrder order, boolean includeContent, boolean onlyIds, String tag) {<NEW_LINE>int capacity = offset + limit;<NEW_LINE>Comparator<FeedEntryStatus> comparator = order == ReadingOrder.desc ? STATUS_COMPARATOR_DESC : STATUS_COMPARATOR_ASC;<NEW_LINE>FixedSizeSortedSet<FeedEntryStatus> set = new FixedSizeSortedSet<>(capacity, comparator);<NEW_LINE>for (FeedSubscription sub : subs) {<NEW_LINE>FeedEntryStatus last = (order != null && set.isFull()) ? set.last() : null;<NEW_LINE>JPAQuery<FeedEntry> query = buildQuery(user, sub, unreadOnly, keywords, newerThan, -1, capacity, order, last, tag);<NEW_LINE>List<Tuple> tuples = query.select(entry.id, entry.updated, status.id, entry.content.title).fetch();<NEW_LINE>for (Tuple tuple : tuples) {<NEW_LINE>Long id = tuple.get(entry.id);<NEW_LINE>Date updated = tuple.get(entry.updated);<NEW_LINE>Long statusId = tuple.get(status.id);<NEW_LINE>FeedEntryContent content = new FeedEntryContent();<NEW_LINE>content.setTitle(tuple.get(entry.content.title));<NEW_LINE>FeedEntry entry = new FeedEntry();<NEW_LINE>entry.setId(id);<NEW_LINE>entry.setUpdated(updated);<NEW_LINE>entry.setContent(content);<NEW_LINE>FeedEntryStatus status = new FeedEntryStatus();<NEW_LINE>status.setId(statusId);<NEW_LINE>status.setEntryUpdated(updated);<NEW_LINE>status.setEntry(entry);<NEW_LINE>status.setSubscription(sub);<NEW_LINE>set.add(status);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<FeedEntryStatus> placeholders = set.asList();<NEW_LINE>int size = placeholders.size();<NEW_LINE>if (size < offset) {<NEW_LINE>return new ArrayList<>();<NEW_LINE>}<NEW_LINE>placeholders = placeholders.subList(Math.max(offset, 0), size);<NEW_LINE>List<FeedEntryStatus> statuses = null;<NEW_LINE>if (onlyIds) {<NEW_LINE>statuses = placeholders;<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>for (FeedEntryStatus placeholder : placeholders) {<NEW_LINE>Long statusId = placeholder.getId();<NEW_LINE>FeedEntry entry = feedEntryDAO.findById(placeholder.getEntry().getId());<NEW_LINE>FeedEntryStatus status = handleStatus(user, statusId == null ? null : findById(statusId), placeholder.getSubscription(), entry);<NEW_LINE>status = fetchTags(user, status);<NEW_LINE>statuses.add(status);<NEW_LINE>}<NEW_LINE>statuses = lazyLoadContent(includeContent, statuses);<NEW_LINE>}<NEW_LINE>return statuses;<NEW_LINE>} | statuses = new ArrayList<>(); |
1,106,927 | public void writeCandlestickChart(JRChart chart) throws IOException {<NEW_LINE>writer.startElement(<MASK><NEW_LINE>writeChart(chart);<NEW_LINE>writeHighLowDataset((JRHighLowDataset) chart.getDataset());<NEW_LINE>JRCandlestickPlot plot = (JRCandlestickPlot) chart.getPlot();<NEW_LINE>writer.startElement(JRXmlConstants.ELEMENT_candlestickPlot);<NEW_LINE>writer.addAttribute(JRXmlConstants.ATTRIBUTE_isShowVolume, plot.getShowVolume());<NEW_LINE>writePlot(plot);<NEW_LINE>writeExpression(JRXmlConstants.ELEMENT_timeAxisLabelExpression, plot.getTimeAxisLabelExpression(), false);<NEW_LINE>writeAxisFormat(JRXmlConstants.ELEMENT_timeAxisFormat, plot.getTimeAxisLabelFont(), plot.getOwnTimeAxisLabelColor(), plot.getTimeAxisTickLabelFont(), plot.getOwnTimeAxisTickLabelColor(), plot.getTimeAxisTickLabelMask(), plot.getTimeAxisVerticalTickLabels(), plot.getOwnTimeAxisLineColor());<NEW_LINE>writeExpression(JRXmlConstants.ELEMENT_valueAxisLabelExpression, plot.getValueAxisLabelExpression(), false);<NEW_LINE>writeAxisFormat(JRXmlConstants.ELEMENT_valueAxisFormat, plot.getValueAxisLabelFont(), plot.getOwnValueAxisLabelColor(), plot.getValueAxisTickLabelFont(), plot.getOwnValueAxisTickLabelColor(), plot.getValueAxisTickLabelMask(), plot.getValueAxisVerticalTickLabels(), plot.getOwnValueAxisLineColor());<NEW_LINE>if (isNewerVersionOrEqual(JRConstants.VERSION_3_5_0)) {<NEW_LINE>writeExpression(JRXmlConstants.ELEMENT_domainAxisMinValueExpression, plot.getDomainAxisMinValueExpression(), false);<NEW_LINE>writeExpression(JRXmlConstants.ELEMENT_domainAxisMaxValueExpression, plot.getDomainAxisMaxValueExpression(), false);<NEW_LINE>writeExpression(JRXmlConstants.ELEMENT_rangeAxisMinValueExpression, plot.getRangeAxisMinValueExpression(), false);<NEW_LINE>writeExpression(JRXmlConstants.ELEMENT_rangeAxisMaxValueExpression, plot.getRangeAxisMaxValueExpression(), false);<NEW_LINE>}<NEW_LINE>writer.closeElement();<NEW_LINE>writer.closeElement();<NEW_LINE>} | JRXmlConstants.ELEMENT_candlestickChart, getNamespace()); |
168,239 | private void init(String query) throws ParseCancellationException {<NEW_LINE>if (Objects.equals(this.query, query)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>SearchLexer lexer = new SearchLexer(new ANTLRInputStream(query));<NEW_LINE>// no infos on file system<NEW_LINE>lexer.removeErrorListeners();<NEW_LINE>lexer.addErrorListener(ThrowingErrorListener.INSTANCE);<NEW_LINE>SearchParser parser = new SearchParser(new CommonTokenStream(lexer));<NEW_LINE>// no infos on file system<NEW_LINE>parser.removeErrorListeners();<NEW_LINE><MASK><NEW_LINE>// ParseCancelationException on parse errors<NEW_LINE>parser.setErrorHandler(new BailErrorStrategy());<NEW_LINE>tree = parser.start();<NEW_LINE>this.query = query;<NEW_LINE>if (!searchFlags.contains(SearchRules.SearchFlags.FULLTEXT) || (databaseContext == null)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>PdfSearcher searcher = PdfSearcher.of(databaseContext);<NEW_LINE>PdfSearchResults results = searcher.search(query, 5);<NEW_LINE>searchResults = results.getSortedByScore();<NEW_LINE>} catch (IOException e) {<NEW_LINE>LOGGER.error("Could not retrieve search results!", e);<NEW_LINE>}<NEW_LINE>} | parser.addErrorListener(ThrowingErrorListener.INSTANCE); |
380,823 | public void writeToParcel(Parcel dest, int flags) {<NEW_LINE>dest.writeLong(this.id);<NEW_LINE>dest.writeString(this.url);<NEW_LINE>dest.writeString(this.body);<NEW_LINE>dest.writeString(this.title);<NEW_LINE>dest.writeInt(this.comments);<NEW_LINE>dest.writeInt(this.number);<NEW_LINE>dest.writeByte(this.locked ? (byte) 1 : (byte) 0);<NEW_LINE>dest.writeByte(this.mergable ? (byte) 1 : (byte) 0);<NEW_LINE>dest.writeByte(this.merged ? (byte) 1 : (byte) 0);<NEW_LINE>dest.writeByte(this.mergeable ? (byte) 1 : (byte) 0);<NEW_LINE><MASK><NEW_LINE>dest.writeInt(this.additions);<NEW_LINE>dest.writeInt(this.deletions);<NEW_LINE>dest.writeInt(this.state == null ? -1 : this.state.ordinal());<NEW_LINE>dest.writeString(this.bodyHtml);<NEW_LINE>dest.writeString(this.htmlUrl);<NEW_LINE>dest.writeLong(this.closedAt != null ? this.closedAt.getTime() : -1);<NEW_LINE>dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1);<NEW_LINE>dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1);<NEW_LINE>dest.writeInt(this.changedFiles);<NEW_LINE>dest.writeString(this.diffUrl);<NEW_LINE>dest.writeString(this.patchUrl);<NEW_LINE>dest.writeString(this.mergeCommitSha);<NEW_LINE>dest.writeLong(this.mergedAt != null ? this.mergedAt.getTime() : -1);<NEW_LINE>dest.writeString(this.mergeState);<NEW_LINE>dest.writeInt(this.reviewComments);<NEW_LINE>dest.writeString(this.repoId);<NEW_LINE>dest.writeString(this.login);<NEW_LINE>dest.writeString(this.mergeableState);<NEW_LINE>dest.writeList(this.assignees);<NEW_LINE>dest.writeParcelable(this.mergedBy, flags);<NEW_LINE>dest.writeParcelable(this.closedBy, flags);<NEW_LINE>dest.writeParcelable(this.user, flags);<NEW_LINE>dest.writeParcelable(this.assignee, flags);<NEW_LINE>dest.writeList(this.labels);<NEW_LINE>dest.writeParcelable(this.milestone, flags);<NEW_LINE>dest.writeParcelable(this.base, flags);<NEW_LINE>dest.writeParcelable(this.head, flags);<NEW_LINE>dest.writeParcelable(this.pullRequest, flags);<NEW_LINE>dest.writeParcelable(this.reactions, flags);<NEW_LINE>} | dest.writeInt(this.commits); |
233,484 | @Consumes(MediaType.APPLICATION_JSON)<NEW_LINE>@Produces(MediaType.APPLICATION_JSON)<NEW_LINE>@Operation(externalDocs = @ExternalDocumentation(description = "Apache Drill REST API documentation:", url = "https://drill.apache.org/docs/rest-api-introduction/"))<NEW_LINE>public Response enablePlugin(@PathParam("name") String name, @PathParam("val") Boolean enable) {<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>return Response.ok().entity(message("Success")).build();<NEW_LINE>} catch (PluginNotFoundException e) {<NEW_LINE>return Response.status(Response.Status.NOT_FOUND).entity(message("No plugin exists with the given name: " + name)).build();<NEW_LINE>} catch (PluginException e) {<NEW_LINE>logger.info("Error when enabling storage name: {} flag: {}", name, enable);<NEW_LINE>return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message("Unable to enable/disable plugin: %s", e.getMessage())).build();<NEW_LINE>}<NEW_LINE>} | storage.setEnabled(name, enable); |
1,355,651 | private Optional<DocumentOperationMessageV3> pullMessageFromRequest(FeederSettings settings, InputStream requestInputStream, BlockingQueue<OperationStatus> repliesFromOldMessages) {<NEW_LINE>while (true) {<NEW_LINE>Optional<String> operationId;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>if (operationId.isEmpty())<NEW_LINE>return Optional.empty();<NEW_LINE>} catch (IOException ioe) {<NEW_LINE>log.log(Level.FINE, () -> Exceptions.toMessageString(ioe));<NEW_LINE>return Optional.empty();<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>DocumentOperationMessageV3 message = getNextMessage(operationId.get(), requestInputStream, settings);<NEW_LINE>if (message != null)<NEW_LINE>setRoute(message, settings);<NEW_LINE>return Optional.ofNullable(message);<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.log(Level.WARNING, () -> Exceptions.toMessageString(e));<NEW_LINE>metric.add(MetricNames.PARSE_ERROR, 1, null);<NEW_LINE>repliesFromOldMessages.add(new OperationStatus(Exceptions.toMessageString(e), operationId.get(), ErrorCode.ERROR, false, ""));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | operationId = streamReaderV3.getNextOperationId(requestInputStream); |
1,346,464 | public Store.ValueHolder<V> putIfAbsent(final K key, final V value, Consumer<Boolean> put) throws NullPointerException, StoreAccessException {<NEW_LINE>checkKey(key);<NEW_LINE>checkValue(value);<NEW_LINE>putIfAbsentObserver.begin();<NEW_LINE>final AtomicReference<Store.ValueHolder<V>> returnValue = new AtomicReference<>();<NEW_LINE>final StoreEventSink<K, V<MASK><NEW_LINE>try {<NEW_LINE>BiFunction<K, OffHeapValueHolder<V>, OffHeapValueHolder<V>> mappingFunction = (mappedKey, mappedValue) -> {<NEW_LINE>long now = timeSource.getTimeMillis();<NEW_LINE>if (mappedValue == null || mappedValue.isExpired(now)) {<NEW_LINE>if (mappedValue != null) {<NEW_LINE>onExpiration(mappedKey, mappedValue, eventSink);<NEW_LINE>}<NEW_LINE>return newCreateValueHolder(mappedKey, value, now, eventSink);<NEW_LINE>}<NEW_LINE>mappedValue.forceDeserialization();<NEW_LINE>returnValue.set(mappedValue);<NEW_LINE>return setAccessTimeAndExpiryThenReturnMapping(mappedKey, mappedValue, now, eventSink);<NEW_LINE>};<NEW_LINE>computeWithRetry(key, mappingFunction, false);<NEW_LINE>eventDispatcher.releaseEventSink(eventSink);<NEW_LINE>ValueHolder<V> resultHolder = returnValue.get();<NEW_LINE>if (resultHolder == null) {<NEW_LINE>putIfAbsentObserver.end(StoreOperationOutcomes.PutIfAbsentOutcome.PUT);<NEW_LINE>return null;<NEW_LINE>} else {<NEW_LINE>putIfAbsentObserver.end(StoreOperationOutcomes.PutIfAbsentOutcome.HIT);<NEW_LINE>return resultHolder;<NEW_LINE>}<NEW_LINE>} catch (StoreAccessException | RuntimeException caex) {<NEW_LINE>eventDispatcher.releaseEventSinkAfterFailure(eventSink, caex);<NEW_LINE>throw caex;<NEW_LINE>}<NEW_LINE>} | > eventSink = eventDispatcher.eventSink(); |
1,739,184 | private FindResult doFindString(@Nonnull CharSequence text, @Nullable char[] textArray, int offset, @Nonnull FindModel findmodel, @Nullable VirtualFile file) {<NEW_LINE>FindModel model = normalizeIfMultilined(findmodel);<NEW_LINE><MASK><NEW_LINE>if (toFind.isEmpty()) {<NEW_LINE>return NOT_FOUND_RESULT;<NEW_LINE>}<NEW_LINE>if (model.isInCommentsOnly() || model.isInStringLiteralsOnly()) {<NEW_LINE>if (file == null)<NEW_LINE>return NOT_FOUND_RESULT;<NEW_LINE>return findInCommentsAndLiterals(text, textArray, offset, model, file);<NEW_LINE>}<NEW_LINE>if (model.isRegularExpressions()) {<NEW_LINE>return findStringByRegularExpression(text, offset, model);<NEW_LINE>}<NEW_LINE>final StringSearcher searcher = createStringSearcher(model);<NEW_LINE>int index;<NEW_LINE>if (model.isForward()) {<NEW_LINE>final int res = searcher.scan(text, textArray, offset, text.length());<NEW_LINE>index = res < 0 ? -1 : res;<NEW_LINE>} else {<NEW_LINE>index = offset == 0 ? -1 : searcher.scan(text, textArray, 0, offset - 1);<NEW_LINE>}<NEW_LINE>if (index < 0) {<NEW_LINE>return NOT_FOUND_RESULT;<NEW_LINE>}<NEW_LINE>return new FindResultImpl(index, index + toFind.length());<NEW_LINE>} | String toFind = model.getStringToFind(); |
1,541,141 | public void drawShadow(final Graphics2D g2d, final Point from, final Point to) {<NEW_LINE>final int w = (int) to.getX();<NEW_LINE>final int h = (int) to.getY();<NEW_LINE>if (h == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final Color bg = getShadowColor();<NEW_LINE>g2d.setColor(ColorUtil.toAlpha(bg, 50));<NEW_LINE>g2d.drawLine(0, h - 1, w, h - 1);<NEW_LINE>// draw the drop-shadow<NEW_LINE>final Color mid = ColorUtil.toAlpha(bg, 40);<NEW_LINE>g2d.setColor(mid);<NEW_LINE>g2d.drawLine(0, h - 2, w, h - 2);<NEW_LINE>// draw the drop-shadow<NEW_LINE>final Color mid2 = ColorUtil.toAlpha(bg, 30);<NEW_LINE>g2d.setColor(mid2);<NEW_LINE>g2d.drawLine(0, h - <MASK><NEW_LINE>g2d.drawLine(0, h - 4, w, h - 4);<NEW_LINE>final Color edge = ColorUtil.toAlpha(bg, 25);<NEW_LINE>g2d.setColor(edge);<NEW_LINE>g2d.drawLine(0, h - 5, w, h - 5);<NEW_LINE>} | 3, w, h - 3); |
1,093,102 | public static Table downLoadFromHttp(String urlStr, String charset, String method, String content, ArrayList<String> headers) throws IOException {<NEW_LINE>URL url = new URL(urlStr);<NEW_LINE>HttpURLConnection conn = (HttpURLConnection) url.openConnection();<NEW_LINE>conn.setConnectTimeout(3 * 1000);<NEW_LINE>conn.setRequestMethod(method);<NEW_LINE>conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");<NEW_LINE>for (int i = 0; i < headers.size(); i++) {<NEW_LINE>String[] ss = headers.get<MASK><NEW_LINE>conn.setRequestProperty(ss[0].trim(), ss[1].trim());<NEW_LINE>}<NEW_LINE>if (content != null) {<NEW_LINE>conn.setDoOutput(true);<NEW_LINE>conn.getOutputStream().write(content.getBytes());<NEW_LINE>}<NEW_LINE>InputStream inputStream = conn.getInputStream();<NEW_LINE>byte[] getData = readInputStream(inputStream);<NEW_LINE>ArrayList<String> names = new ArrayList<String>();<NEW_LINE>ArrayList<String> al = new ArrayList<String>();<NEW_LINE>names.add("Message");<NEW_LINE>al.add(conn.getResponseMessage());<NEW_LINE>Map<String, List<String>> map = conn.getHeaderFields();<NEW_LINE>for (Map.Entry<String, List<String>> entry : map.entrySet()) {<NEW_LINE>// rm += "\n"+("Key : " + entry.getKey() + " ,Value : " + entry.getValue());<NEW_LINE>if (entry.getKey() == null || entry.getKey().length() == 0)<NEW_LINE>continue;<NEW_LINE>names.add(entry.getKey());<NEW_LINE>String ss = "";<NEW_LINE>for (int i = 0; i < entry.getValue().size(); i++) {<NEW_LINE>if (i > 0)<NEW_LINE>ss += ";";<NEW_LINE>ss += entry.getValue().get(i);<NEW_LINE>}<NEW_LINE>al.add(ss);<NEW_LINE>}<NEW_LINE>if (inputStream != null) {<NEW_LINE>inputStream.close();<NEW_LINE>}<NEW_LINE>names.add("Content");<NEW_LINE>al.add(new String(getData, charset));<NEW_LINE>Table t = new Table(names.toArray(new String[names.size()]));<NEW_LINE>t.insert(0, al.toArray(new String[names.size()]));<NEW_LINE>return t;<NEW_LINE>} | (i).split(":"); |
518,483 | public static Collection<ErrorDescription> run(HintContext hintContext) {<NEW_LINE>List<ErrorDescription> problems = new ArrayList<>();<NEW_LINE>final JsfHintsContext ctx = JsfHintsUtils.getOrCacheContext(hintContext);<NEW_LINE>if (ctx.getJsfVersion() == null || !ctx.getJsfVersion().isAtLeast(JSFVersion.JSF_2_2)) {<NEW_LINE>return problems;<NEW_LINE>}<NEW_LINE>CompilationInfo info = hintContext.getInfo();<NEW_LINE>for (TypeElement typeElement : info.getTopLevelElements()) {<NEW_LINE>for (AnnotationMirror annotationMirror : typeElement.getAnnotationMirrors()) {<NEW_LINE>if (annotationMirror.getAnnotationType().toString().startsWith(JAVAX_FACES_BEAN)) {<NEW_LINE>// it's javax.faces.bean annotation<NEW_LINE>Tree tree = info.getTrees().getTree(typeElement, annotationMirror);<NEW_LINE>List<Fix> fixes = <MASK><NEW_LINE>problems.add(JsfHintsUtils.createProblem(tree, info, Bundle.JavaxFacesBeanIsGonnaBeDeprecated_display_name(), Severity.HINT, fixes));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return problems;<NEW_LINE>} | getFixesForType(info, typeElement, annotationMirror); |
891,610 | public int compareTo(startGetSummaries_result other) {<NEW_LINE>if (!getClass().equals(other.getClass())) {<NEW_LINE>return getClass().getName().compareTo(other.getClass().getName());<NEW_LINE>}<NEW_LINE>int lastComparison = 0;<NEW_LINE>lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetSuccess()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>lastComparison = java.lang.Boolean.compare(isSetSec(), other.isSetSec());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetSec()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sec, other.sec);<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>lastComparison = java.lang.Boolean.compare(isSetTope(), other.isSetTope());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetTope()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(<MASK><NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>} | this.tope, other.tope); |
635,542 | public void waitUntilAvailable(long timeout, TimeUnit unit, final URL... urls) throws TimeoutException {<NEW_LINE>long start = System.nanoTime();<NEW_LINE>log.fine("Waiting for " + Arrays.toString(urls));<NEW_LINE>try {<NEW_LINE>Future<Void> callback = EXECUTOR.submit(() -> {<NEW_LINE>HttpURLConnection connection = null;<NEW_LINE>long sleepMillis = MIN_POLL_INTERVAL_MS;<NEW_LINE>while (true) {<NEW_LINE>if (Thread.interrupted()) {<NEW_LINE>throw new InterruptedException();<NEW_LINE>}<NEW_LINE>for (URL url : urls) {<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>connection = connectToUrl(url);<NEW_LINE>if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>// Ok, try again.<NEW_LINE>} finally {<NEW_LINE>if (connection != null) {<NEW_LINE>connection.disconnect();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>MILLISECONDS.sleep(sleepMillis);<NEW_LINE>sleepMillis = (sleepMillis >= MAX_POLL_INTERVAL_MS) ? sleepMillis : sleepMillis * 2;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>callback.get(timeout, unit);<NEW_LINE>} catch (java.util.concurrent.TimeoutException e) {<NEW_LINE>throw new TimeoutException(String.format("Timed out waiting for %s to be available after %d ms", Arrays.toString(urls), MILLISECONDS.convert(System.nanoTime() - start, NANOSECONDS)), e);<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>Thread.currentThread().interrupt();<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>} catch (ExecutionException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>} | log.fine("Polling " + url); |
323,213 | public Optional<Response> handle(HandlerInput input) {<NEW_LINE>Permissions permission = input.getRequestEnvelope().getContext().getSystem()<MASK><NEW_LINE>if (permission != null) {<NEW_LINE>String deviceId = input.getRequestEnvelope().getContext().getSystem().getDevice().getDeviceId();<NEW_LINE>DeviceAddressServiceClient deviceAddressServiceClient = input.getServiceClientFactory().getDeviceAddressService();<NEW_LINE>Address address = deviceAddressServiceClient.getFullAddress(deviceId);<NEW_LINE>if (address == null) {<NEW_LINE>return input.getResponseBuilder().withSpeech(Constants.NO_ADDRESS).build();<NEW_LINE>} else {<NEW_LINE>String addressMessage = Constants.ADDRESS_AVAILABLE + " " + address.getAddressLine1() + " " + address.getStateOrRegion() + " " + address.getPostalCode();<NEW_LINE>return input.getResponseBuilder().withSpeech(addressMessage).build();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>return input.getResponseBuilder().withSpeech(Constants.NOTIFY_MISSING_PERMISSIONS).withAskForPermissionsConsentCard(Collections.singletonList(Constants.ALL_ADDRESS_PERMISSION)).build();<NEW_LINE>}<NEW_LINE>} | .getUser().getPermissions(); |
1,741,391 | public Outcome<VirtualMachine> migrateVmThroughJobQueue(final String vmUuid, final long srcHostId, final DeployDestination dest) {<NEW_LINE>Map<Volume, StoragePool> volumeStorageMap = dest.getStorageForDisks();<NEW_LINE>if (volumeStorageMap != null) {<NEW_LINE>for (Volume vol : volumeStorageMap.keySet()) {<NEW_LINE>checkConcurrentJobsPerDatastoreThreshhold(volumeStorageMap.get(vol));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>VMInstanceVO vm = _vmDao.findByUuid(vmUuid);<NEW_LINE>Long vmId = vm.getId();<NEW_LINE>String commandName = VmWorkMigrate.class.getName();<NEW_LINE>Pair<VmWorkJobVO, Long> pendingWorkJob = retrievePendingWorkJob(vmId, vmUuid, <MASK><NEW_LINE>VmWorkJobVO workJob = pendingWorkJob.first();<NEW_LINE>if (workJob == null) {<NEW_LINE>Pair<VmWorkJobVO, VmWork> newVmWorkJobAndInfo = createWorkJobAndWorkInfo(commandName, vmId);<NEW_LINE>workJob = newVmWorkJobAndInfo.first();<NEW_LINE>VmWorkMigrate workInfo = new VmWorkMigrate(newVmWorkJobAndInfo.second(), srcHostId, dest);<NEW_LINE>setCmdInfoAndSubmitAsyncJob(workJob, workInfo, vmId);<NEW_LINE>}<NEW_LINE>AsyncJobExecutionContext.getCurrentExecutionContext().joinJob(workJob.getId());<NEW_LINE>return new VmStateSyncOutcome(workJob, VirtualMachine.PowerState.PowerOn, vmId, vm.getPowerHostId());<NEW_LINE>} | VirtualMachine.Type.Instance, commandName); |
950,487 | public void actionPerformed(ActionEvent ae) {<NEW_LINE>if ("pressed".equals(ae.getActionCommand())) {<NEW_LINE>// NOI18N<NEW_LINE>JComponent jc = (JComponent) ae.getSource();<NEW_LINE>Point p = new Point(jc.getWidth(), jc.getHeight());<NEW_LINE>SwingUtilities.convertPointToScreen(p, jc);<NEW_LINE>if (!ButtonPopupSwitcher.isShown()) {<NEW_LINE>ButtonPopupSwitcher.showPopup(jc, displayer, p.x, p.y);<NEW_LINE>} else {<NEW_LINE>ButtonPopupSwitcher.hidePopup();<NEW_LINE>}<NEW_LINE>// Other portion of issue 37487, looks funny if the<NEW_LINE>// button becomes pressed<NEW_LINE>if (jc instanceof AbstractButton) {<NEW_LINE>AbstractButton jb = (AbstractButton) jc;<NEW_LINE>jb.getModel().setPressed(false);<NEW_LINE>jb.getModel().setRollover(false);<NEW_LINE>jb.<MASK><NEW_LINE>jb.repaint();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getModel().setArmed(false); |
436,857 | // -------------------------------------------------------------------------<NEW_LINE>private Function<ResolvedCdsTrade, CdsQuote> createQuoteValueFunction(CreditRatesProvider ratesProviderNew, CdsQuoteConvention targetConvention, ReferenceData refData) {<NEW_LINE>Function<ResolvedCdsTrade, CdsQuote> quoteValueFunction;<NEW_LINE>if (targetConvention.equals(CdsQuoteConvention.POINTS_UPFRONT)) {<NEW_LINE>quoteValueFunction = new Function<ResolvedCdsTrade, CdsQuote>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public CdsQuote apply(ResolvedCdsTrade x) {<NEW_LINE>double puf = <MASK><NEW_LINE>return CdsQuote.of(targetConvention, puf);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} else if (targetConvention.equals(CdsQuoteConvention.QUOTED_SPREAD)) {<NEW_LINE>quoteValueFunction = new Function<ResolvedCdsTrade, CdsQuote>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public CdsQuote apply(ResolvedCdsTrade x) {<NEW_LINE>double puf = pointsUpfront(x, ratesProviderNew, refData);<NEW_LINE>return quotedSpreadFromPointsUpfront(x, CdsQuote.of(CdsQuoteConvention.POINTS_UPFRONT, puf), ratesProviderNew, refData);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("unsuported CDS quote convention");<NEW_LINE>}<NEW_LINE>return quoteValueFunction;<NEW_LINE>} | pointsUpfront(x, ratesProviderNew, refData); |
1,339,407 | protected void estimateCase2(double[] betas) {<NEW_LINE>x.reshape(3, 1, false);<NEW_LINE>if (numControl == 4) {<NEW_LINE>L.reshape(6, 3, false);<NEW_LINE>UtilLepetitEPnP.constraintMatrix6x3(L_full, L);<NEW_LINE>} else {<NEW_LINE>L.reshape(3, 3, false);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (!solver.setA(L))<NEW_LINE>throw new RuntimeException("Oh crap");<NEW_LINE>solver.solve(y, x);<NEW_LINE>betas[0] = Math.sqrt(Math.abs(x.get(0)));<NEW_LINE>betas[1] = Math.sqrt(Math.abs(x.get(2)));<NEW_LINE>betas[1] *= Math.signum(x.get(0)) * Math.signum(x.get(1));<NEW_LINE>betas[2] = 0;<NEW_LINE>betas[3] = 0;<NEW_LINE>refine(betas);<NEW_LINE>} | UtilLepetitEPnP.constraintMatrix3x3(L_full, L); |
794,971 | private void runAssertion(RegressionEnvironment env, AtomicInteger milestone, boolean advanced, String filter) {<NEW_LINE>String epl = "create context MyContext start SupportBean_S0 as s0 end SupportBean_S2;\n" + HOOK + "@name('s0') context MyContext select * from SupportBean_S1(" + filter + ");\n";<NEW_LINE>SupportFilterPlanHook.reset();<NEW_LINE>env.compileDeploy(epl).addListener("s0");<NEW_LINE>SupportFilterPlanTriplet tripletOne = makeTriplet("p10", EQUAL, "a");<NEW_LINE>SupportFilterPlanTriplet tripletTwo = makeTriplet("p11", EQUAL, "b");<NEW_LINE>if (advanced) {<NEW_LINE>assertPlanSingleByType("SupportBean_S1", new SupportFilterPlan(null, "context.s0.p00=\"x\"", new SupportFilterPlanPath(tripletOne), new SupportFilterPlanPath(tripletTwo)));<NEW_LINE>}<NEW_LINE>env.milestoneInc(milestone);<NEW_LINE>env.sendEventBean(<MASK><NEW_LINE>if (advanced) {<NEW_LINE>assertFilterSvcNone(env, "s0", "SupportBean_S1");<NEW_LINE>}<NEW_LINE>sendS1Assert(env, 10, "a", "b", false);<NEW_LINE>env.sendEventBean(new SupportBean_S2(1));<NEW_LINE>env.sendEventBean(new SupportBean_S0(2, "x"));<NEW_LINE>if (advanced) {<NEW_LINE>assertFilterSvcByTypeMulti(env, "s0", "SupportBean_S1", new FilterItem[][] { new FilterItem[] { new FilterItem("p10", EQUAL) }, new FilterItem[] { new FilterItem("p11", EQUAL) } });<NEW_LINE>}<NEW_LINE>sendS1Assert(env, 20, "-", "-", false);<NEW_LINE>sendS1Assert(env, 21, "a", "-", true);<NEW_LINE>sendS1Assert(env, 22, "-", "b", true);<NEW_LINE>env.sendEventBean(new SupportBean_S2(2));<NEW_LINE>env.undeployAll();<NEW_LINE>} | new SupportBean_S0(1, "-")); |
1,382,937 | private Predicate workCompletedPredicate_creator(CriteriaBuilder cb, Root<WorkCompleted> root) throws Exception {<NEW_LINE>List<String> _creatorUnits = ListTools.extractField(this.creatorUnitList, "name", String.class, true, true);<NEW_LINE>List<String> _creatorPersons = ListTools.extractField(this.creatorPersonList, "name", String.class, true, true);<NEW_LINE>List<String> _creatorIdentitys = ListTools.extractField(this.creatorIdentityList, "name", String.class, true, true);<NEW_LINE>if (_creatorUnits.isEmpty() && _creatorPersons.isEmpty() && _creatorIdentitys.isEmpty()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>if (!_creatorUnits.isEmpty()) {<NEW_LINE>p = cb.or(p, root.get(WorkCompleted_.creatorUnit).in(_creatorUnits));<NEW_LINE>}<NEW_LINE>if (!_creatorPersons.isEmpty()) {<NEW_LINE>p = cb.or(p, root.get(WorkCompleted_.creatorPerson).in(_creatorPersons));<NEW_LINE>}<NEW_LINE>if (!_creatorIdentitys.isEmpty()) {<NEW_LINE>p = cb.or(p, root.get(WorkCompleted_.creatorIdentity).in(_creatorIdentitys));<NEW_LINE>}<NEW_LINE>return p;<NEW_LINE>} | Predicate p = cb.disjunction(); |
1,530,838 | private static String buildMessage(int M_Product_ID, int C_UOM_ID, int C_UOM_To_ID) {<NEW_LINE>StringBuffer sb = new StringBuffer("@" + AD_Message + "@ - ");<NEW_LINE>//<NEW_LINE>sb.append("@M_Product_ID@:");<NEW_LINE>MProduct product = MProduct.get(Env.getCtx(), M_Product_ID);<NEW_LINE>if (product != null) {<NEW_LINE>sb.append(product.getValue()).append("_").append(product.getName());<NEW_LINE>}<NEW_LINE>//<NEW_LINE>if (C_UOM_ID > 0 || product == null) {<NEW_LINE>sb.append(" @C_UOM_ID@:");<NEW_LINE>MUOM uom = MUOM.get(Env.getCtx(), C_UOM_ID);<NEW_LINE>if (uom != null) {<NEW_LINE>sb.append(uom.getUOMSymbol());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>//<NEW_LINE>sb.append(" @C_UOM_To_ID@:");<NEW_LINE>MUOM uomTo = MUOM.get(Env.getCtx(), C_UOM_To_ID);<NEW_LINE>if (uomTo != null) {<NEW_LINE>sb.<MASK><NEW_LINE>}<NEW_LINE>//<NEW_LINE>return sb.toString();<NEW_LINE>} | append(uomTo.getUOMSymbol()); |
1,517,679 | private static boolean createAndStartContainer(String name, String image, String cmd, Map<String, String> env, List<String> linkHosts, Map<Integer, Integer> mapPorts, Map<String, String> volumes, List<String> opts) {<NEW_LINE>if (containerExists(name)) {<NEW_LINE>killAndRemoveContainer(name);<NEW_LINE>}<NEW_LINE>List<String> args = new ArrayList<>(opts);<NEW_LINE>// set name<NEW_LINE>args.add("-h " + name);<NEW_LINE>args.add("--name " + name);<NEW_LINE>// set env variables<NEW_LINE>env.forEach((k, v) -> args.add(String.format("-e %s=%s", k, v)));<NEW_LINE>// set links<NEW_LINE>linkHosts.forEach(host -> args.add("--link " + host));<NEW_LINE>// set volumes<NEW_LINE>volumes.forEach((from, to) -> args.add(String.format("-v %s:%s", from, to)));<NEW_LINE>// set ports<NEW_LINE>mapPorts.forEach((hPort, cPort) -> args.add(String.format(<MASK><NEW_LINE>args.add(image);<NEW_LINE>args.add(cmd);<NEW_LINE>return ShellExec.run("docker run " + Joiner.on(" ").join(args), LOG::info);<NEW_LINE>} | "-p %d:%d", hPort, cPort))); |
37,761 | private static void writeForDdlInternalProperty(Element properties) throws Exception {<NEW_LINE>Element property = properties.addElement("property");<NEW_LINE>property.addAttribute("name", "javax.persistence.jdbc.driver");<NEW_LINE>property.addAttribute("value", SlicePropertiesBuilder.driver_h2);<NEW_LINE>property = properties.addElement("property");<NEW_LINE>property.addAttribute("name", "javax.persistence.jdbc.url");<NEW_LINE>Node node = Config.currentNode();<NEW_LINE>String url = "jdbc:h2:tcp://" + Config.node() + ":" + node.getData().getTcpPort() + "/X;JMX=" + (node.getData().getJmxEnable() ? "TRUE" : "FALSE") + ";CACHE_SIZE=" + (node.getData().getCacheSize() * 1024);<NEW_LINE>property.addAttribute("value", url);<NEW_LINE>property = properties.addElement("property");<NEW_LINE>property.addAttribute("name", "javax.persistence.jdbc.user");<NEW_LINE><MASK><NEW_LINE>property = properties.addElement("property");<NEW_LINE>property.addAttribute("name", "javax.persistence.jdbc.password");<NEW_LINE>property.addAttribute("value", Config.token().getPassword());<NEW_LINE>property = properties.addElement("property");<NEW_LINE>property.addAttribute("name", "openjpa.DynamicEnhancementAgent");<NEW_LINE>property.addAttribute("value", "false");<NEW_LINE>} | property.addAttribute("value", "sa"); |
1,483,051 | public void onUpOrCancelMotionEvent(ScrollState scrollState) {<NEW_LINE>mBaseTranslationY = 0;<NEW_LINE>Fragment fragment = getCurrentFragment();<NEW_LINE>if (fragment == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>View view = fragment.getView();<NEW_LINE>if (view == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int toolbarHeight = mToolbarView.getHeight();<NEW_LINE>final ObservableListView listView = (ObservableListView) view.findViewById(R.id.scroll);<NEW_LINE>if (listView == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>if (scrollState == ScrollState.DOWN) {<NEW_LINE>showToolbar();<NEW_LINE>} else if (scrollState == ScrollState.UP) {<NEW_LINE>if (toolbarHeight <= scrollY) {<NEW_LINE>hideToolbar();<NEW_LINE>} else {<NEW_LINE>showToolbar();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// Even if onScrollChanged occurs without scrollY changing, toolbar should be adjusted<NEW_LINE>if (toolbarIsShown() || toolbarIsHidden()) {<NEW_LINE>// Toolbar is completely moved, so just keep its state<NEW_LINE>// and propagate it to other pages<NEW_LINE>propagateToolbarState(toolbarIsShown());<NEW_LINE>} else {<NEW_LINE>// Toolbar is moving but doesn't know which to move:<NEW_LINE>// you can change this to hideToolbar()<NEW_LINE>showToolbar();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | int scrollY = listView.getCurrentScrollY(); |
1,296,019 | public PlayerSaveResult savePlayerData(UUID uniqueId, String username) {<NEW_LINE>username = username.toLowerCase(Locale.ROOT);<NEW_LINE>MongoCollection<Document> c = this.database.getCollection(this.prefix + "uuid");<NEW_LINE>// find any existing mapping<NEW_LINE>String oldUsername = getPlayerName(uniqueId);<NEW_LINE>// do the insert<NEW_LINE>if (!username.equalsIgnoreCase(oldUsername)) {<NEW_LINE>c.replaceOne(new Document("_id", uniqueId), new Document("_id", uniqueId).append("name", username), new ReplaceOptions<MASK><NEW_LINE>}<NEW_LINE>PlayerSaveResultImpl result = PlayerSaveResultImpl.determineBaseResult(username, oldUsername);<NEW_LINE>Set<UUID> conflicting = new HashSet<>();<NEW_LINE>try (MongoCursor<Document> cursor = c.find(new Document("name", username)).iterator()) {<NEW_LINE>while (cursor.hasNext()) {<NEW_LINE>conflicting.add(getDocumentId(cursor.next()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>conflicting.remove(uniqueId);<NEW_LINE>if (!conflicting.isEmpty()) {<NEW_LINE>// remove the mappings for conflicting uuids<NEW_LINE>c.deleteMany(Filters.and(conflicting.stream().map(u -> Filters.eq("_id", u)).collect(Collectors.toList())));<NEW_LINE>result = result.withOtherUuidsPresent(conflicting);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | ().upsert(true)); |
1,315,347 | public static byte[] derivePasswordBasedKey(final byte[] salt, final char[] password, final AesKeyStrength aesKeyStrength) throws ZipException {<NEW_LINE>final PBKDF2Parameters parameters = new PBKDF2Parameters(AES_MAC_ALGORITHM, AES_HASH_CHARSET, salt, AES_HASH_ITERATIONS);<NEW_LINE>final PBKDF2Engine engine = new PBKDF2Engine(parameters);<NEW_LINE>final int keyLength = aesKeyStrength.getKeyLength();<NEW_LINE>final int macLength = aesKeyStrength.getMacLength();<NEW_LINE>final int derivedKeyLength = keyLength + macLength + AES_PASSWORD_VERIFIER_LENGTH;<NEW_LINE>final byte[] derivedKey = engine.deriveKey(password, derivedKeyLength);<NEW_LINE>if (derivedKey != null && derivedKey.length == derivedKeyLength) {<NEW_LINE>return derivedKey;<NEW_LINE>} else {<NEW_LINE>final String message = String.<MASK><NEW_LINE>throw new ZipException(message);<NEW_LINE>}<NEW_LINE>} | format("Derived Key invalid for Key Length [%d] MAC Length [%d]", keyLength, macLength); |
1,623,646 | private void criar_usuario_servidor(String url, String username, InetAddress ip) throws Exception {<NEW_LINE>HttpClient httpclient = HttpClients.createDefault();<NEW_LINE>HttpPost httppost = new HttpPost(url + "/api/users");<NEW_LINE>DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");<NEW_LINE>Date today = Calendar.getInstance().getTime();<NEW_LINE>String date = df.format(today);<NEW_LINE>// Request parameters and other properties.<NEW_LINE>List<BasicNameValuePair> params = new ArrayList<>(3);<NEW_LINE>params.add(new BasicNameValuePair("user", username));<NEW_LINE>params.add(new BasicNameValuePair("operational_system", System.getProperty("os.name")));<NEW_LINE>params.add(new BasicNameValuePair("is_online", "true"));<NEW_LINE>params.add(new BasicNameValuePair("portugol_version", PortugolStudio.getInstancia().getVersao()));<NEW_LINE>params.add(new BasicNameValuePair("last_use", "" + date));<NEW_LINE>params.add(new BasicNameValuePair("ip", ip.toString()));<NEW_LINE>httppost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));<NEW_LINE>// Execute and get the response.<NEW_LINE>HttpResponse response = httpclient.execute(httppost);<NEW_LINE>HttpEntity entity = response.getEntity();<NEW_LINE>if (entity != null) {<NEW_LINE>InputStream instream = entity.getContent();<NEW_LINE>try {<NEW_LINE>// do something useful<NEW_LINE>} finally {<NEW_LINE>instream.close();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String id = "undefined";<NEW_LINE>String data = getHTML(url + "/api/users/" + username);<NEW_LINE>String[] dados = data.split(",");<NEW_LINE>for (String dado : dados) {<NEW_LINE>String[] obj = dado.split(":");<NEW_LINE>if (obj[0].contains("_id")) {<NEW_LINE>String aid = obj[1<MASK><NEW_LINE>id = aid.replaceAll(" ", "");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Configuracoes.getInstancia().setUserAnalyticsID(id);<NEW_LINE>} | ].replaceAll("\"", ""); |
524,942 | public void write(CompoundTag compound, boolean clientPacket) {<NEW_LINE>super.write(compound, clientPacket);<NEW_LINE>compound.put(<MASK><NEW_LINE>compound.put("OutputItems", outputInventory.serializeNBT());<NEW_LINE>if (preferredSpoutput != null)<NEW_LINE>NBTHelper.writeEnum(compound, "PreferredSpoutput", preferredSpoutput);<NEW_LINE>ListTag disabledList = new ListTag();<NEW_LINE>disabledSpoutputs.forEach(d -> disabledList.add(StringTag.valueOf(d.name())));<NEW_LINE>compound.put("DisabledSpoutput", disabledList);<NEW_LINE>compound.put("Overflow", NBTHelper.writeItemList(spoutputBuffer));<NEW_LINE>compound.put("FluidOverflow", NBTHelper.writeCompoundList(spoutputFluidBuffer, fs -> fs.writeToNBT(new CompoundTag())));<NEW_LINE>if (!clientPacket)<NEW_LINE>return;<NEW_LINE>compound.put("VisualizedItems", NBTHelper.writeCompoundList(visualizedOutputItems, ia -> ia.getValue().serializeNBT()));<NEW_LINE>compound.put("VisualizedFluids", NBTHelper.writeCompoundList(visualizedOutputFluids, ia -> ia.getValue().writeToNBT(new CompoundTag())));<NEW_LINE>visualizedOutputItems.clear();<NEW_LINE>visualizedOutputFluids.clear();<NEW_LINE>} | "InputItems", inputInventory.serializeNBT()); |
1,138,018 | void handleFailedPromote(PromoteBean promoteBean, EnvironBean currEnvBean, String deployId) throws Exception {<NEW_LINE>PromoteFailPolicy autoPromotePolicy = promoteBean.getFail_policy();<NEW_LINE>if (autoPromotePolicy == PromoteFailPolicy.DISABLE) {<NEW_LINE>LOG.info("Disable auto deploy for env {}/{} since its current deploy {} failed, and " + " and its current auto deploy fail policy is DISABLE!", currEnvBean.getEnv_name(), currEnvBean.getStage_name(), deployId);<NEW_LINE>deployHandler.disableAutoPromote(currEnvBean, AUTO_PROMOTER_NAME, true);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (autoPromotePolicy == PromoteFailPolicy.ROLLBACK) {<NEW_LINE>LOG.info("Rollback deploy {} and disable auto deploy for env {}/{} since deploy failed and" + " env " + "fail policy is ROLLBACK!", currEnvBean.getEnv_name(), currEnvBean.getStage_name(), deployId);<NEW_LINE>deployHandler.rollback(currEnvBean, null, null, AUTO_PROMOTER_NAME);<NEW_LINE>deployHandler.<MASK><NEW_LINE>}<NEW_LINE>LOG.error("Unexpected policy {} for Env {}", autoPromotePolicy, currEnvBean.getEnv_id());<NEW_LINE>} | disableAutoPromote(currEnvBean, AUTO_PROMOTER_NAME, true); |
957,792 | private // converts them to proto, then exports them to OC-Agent.<NEW_LINE>void export() {<NEW_LINE>if (exportRpcHandler == null || exportRpcHandler.isCompleted()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ArrayList<Metric<MASK><NEW_LINE>for (MetricProducer metricProducer : metricProducerManager.getAllMetricProducer()) {<NEW_LINE>metricsList.addAll(metricProducer.getMetrics());<NEW_LINE>}<NEW_LINE>List<io.opencensus.proto.metrics.v1.Metric> metricProtos = Lists.newArrayList();<NEW_LINE>for (Metric metric : metricsList) {<NEW_LINE>// TODO(songya): determine if we should make the optimization on not sending already-existed<NEW_LINE>// MetricDescriptors.<NEW_LINE>// boolean registered = true;<NEW_LINE>// if (!registeredDescriptors.contains(metric.getMetricDescriptor())) {<NEW_LINE>// registered = false;<NEW_LINE>// registeredDescriptors.add(metric.getMetricDescriptor());<NEW_LINE>// }<NEW_LINE>metricProtos.add(MetricsProtoUtils.toMetricProto(metric, null));<NEW_LINE>}<NEW_LINE>// For now don't include Resource in the following messages, i.e don't allow Resource to<NEW_LINE>exportRpcHandler.// For now don't include Resource in the following messages, i.e don't allow Resource to<NEW_LINE>onExport(// mutate after the initial message.<NEW_LINE>ExportMetricsServiceRequest.newBuilder().addAllMetrics(metricProtos).build());<NEW_LINE>} | > metricsList = Lists.newArrayList(); |
230,560 | static TraceParams fromTraceConfigProto(TraceConfig traceConfigProto, TraceParams currentTraceParams) {<NEW_LINE>TraceParams.Builder builder = currentTraceParams.toBuilder();<NEW_LINE>if (traceConfigProto.hasConstantSampler()) {<NEW_LINE>ConstantSampler constantSampler = traceConfigProto.getConstantSampler();<NEW_LINE>ConstantDecision decision = constantSampler.getDecision();<NEW_LINE>if (ConstantDecision.ALWAYS_ON.equals(decision)) {<NEW_LINE>builder.setSampler(Samplers.alwaysSample());<NEW_LINE>} else if (ConstantDecision.ALWAYS_OFF.equals(decision)) {<NEW_LINE>builder.<MASK><NEW_LINE>}<NEW_LINE>// else if (ConstantDecision.ALWAYS_PARENT.equals(decision)) {<NEW_LINE>// For ALWAYS_PARENT, don't need to update configs since in Java by default parent sampling<NEW_LINE>// decision always takes precedence.<NEW_LINE>// }<NEW_LINE>} else if (traceConfigProto.hasProbabilitySampler()) {<NEW_LINE>builder.setSampler(Samplers.probabilitySampler(traceConfigProto.getProbabilitySampler().getSamplingProbability()));<NEW_LINE>}<NEW_LINE>// TODO: add support for RateLimitingSampler.<NEW_LINE>return builder.build();<NEW_LINE>} | setSampler(Samplers.neverSample()); |
666,834 | public Optional<IExpression<?>> extractDefaultValueExpression(final String defaultValueStr, final String columnName, final DocumentFieldWidgetType widgetType, final Class<?> fieldValueClass, final boolean isMandatory, final boolean allowUsingAutoSequence) {<NEW_LINE>final boolean isDetailTab = isDetailTab();<NEW_LINE>//<NEW_LINE>// Case: "Line" field in included tabs<NEW_LINE>if (// only on included tabs<NEW_LINE>WindowConstants.FIELDNAME_Line.equals(columnName) && isDetailTab) {<NEW_LINE>return DEFAULT_VALUE_EXPRESSION_NextLineNo;<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// If there is no default value expression, use some defaults<NEW_LINE>if (Check.isEmpty(defaultValueStr)) {<NEW_LINE>if (WindowConstants.FIELDNAME_AD_Client_ID.equals(columnName)) {<NEW_LINE>return DEFAULT_VALUE_AD_Client_ID;<NEW_LINE>} else if (WindowConstants.FIELDNAME_AD_Org_ID.equals(columnName)) {<NEW_LINE>return DEFAULT_VALUE_AD_Org_ID;<NEW_LINE>} else if (WindowConstants.FIELDNAME_Created.equals(columnName) || WindowConstants.FIELDNAME_Updated.equals(columnName)) {<NEW_LINE>return DEFAULT_VALUE_ContextDate;<NEW_LINE>} else if (WindowConstants.FIELDNAME_CreatedBy.equals(columnName) || WindowConstants.FIELDNAME_UpdatedBy.equals(columnName)) {<NEW_LINE>return DEFAULT_VALUE_ContextUser_ID;<NEW_LINE>} else //<NEW_LINE>if (WindowConstants.FIELDNAME_Value.equals(columnName) && getTableName() != null && allowUsingAutoSequence) {<NEW_LINE>return Optional.of(AutoSequenceDefaultValueExpression<MASK><NEW_LINE>} else if (Boolean.class.equals(fieldValueClass)) {<NEW_LINE>if (WindowConstants.FIELDNAME_IsActive.equals(columnName)) {<NEW_LINE>return DEFAULT_VALUE_EXPRESSION_Yes;<NEW_LINE>} else {<NEW_LINE>return DEFAULT_VALUE_EXPRESSION_No;<NEW_LINE>}<NEW_LINE>} else if (Integer.class.equals(fieldValueClass)) {<NEW_LINE>if (isMandatory) {<NEW_LINE>return DEFAULT_VALUE_EXPRESSION_Zero_Integer;<NEW_LINE>}<NEW_LINE>} else if (BigDecimal.class.equals(fieldValueClass)) {<NEW_LINE>if (isMandatory) {<NEW_LINE>// e.g. C_OrderLine.QtyReserved<NEW_LINE>return DEFAULT_VALUE_EXPRESSION_Zero_BigDecimal;<NEW_LINE>}<NEW_LINE>} else if (widgetType == DocumentFieldWidgetType.ProductAttributes) {<NEW_LINE>return DEFAULT_VALUE_EXPRESSION_M_AttributeSetInstance_ID;<NEW_LINE>}<NEW_LINE>return Optional.empty();<NEW_LINE>} else // Explicit NULL<NEW_LINE>if ("null".equalsIgnoreCase(defaultValueStr.trim())) {<NEW_LINE>return Optional.of(IStringExpression.NULL);<NEW_LINE>} else // If it's a SQL expression => compile it as SQL expression<NEW_LINE>if (defaultValueStr.startsWith("@SQL=")) {<NEW_LINE>final String sqlTemplate = defaultValueStr.substring(5).trim();<NEW_LINE>final IStringExpression sqlTemplateStringExpression = expressionFactory.compile(sqlTemplate, IStringExpression.class);<NEW_LINE>return Optional.of(SqlDefaultValueExpression.of(sqlTemplateStringExpression, fieldValueClass));<NEW_LINE>} else // Regular default value expression<NEW_LINE>{<NEW_LINE>return buildExpression(expressionFactory, defaultValueStr, fieldValueClass);<NEW_LINE>}<NEW_LINE>} | .of(getTableName())); |
1,146,487 | public void insertPush2(int opcode, JumpInsnNode position, InsnList list) {<NEW_LINE>list.insertBefore(position, <MASK><NEW_LINE>// list.insertBefore(position, new InsnNode(Opcodes.ISUB));<NEW_LINE>MethodInsnNode sub = new MethodInsnNode(Opcodes.INVOKESTATIC, Type.getInternalName(BooleanHelper.class), "intSub", Type.getMethodDescriptor(Type.INT_TYPE, Type.INT_TYPE, Type.INT_TYPE), false);<NEW_LINE>list.insertBefore(position, sub);<NEW_LINE>insertBranchIdPlaceholder(currentMethodNode, position);<NEW_LINE>// list.insertBefore(position,<NEW_LINE>// new LdcInsnNode(getBranchID(currentMethodNode, position)));<NEW_LINE>MethodInsnNode push = new MethodInsnNode(Opcodes.INVOKESTATIC, Type.getInternalName(BooleanHelper.class), "pushPredicate", Type.getMethodDescriptor(Type.VOID_TYPE, Type.INT_TYPE, Type.INT_TYPE), false);<NEW_LINE>list.insertBefore(position, push);<NEW_LINE>} | new InsnNode(Opcodes.DUP2)); |
1,219,868 | private void parseEdgeTrafficRouterLocations(final JsonNode jo, final CacheRegister cacheRegister) throws JsonUtilsException {<NEW_LINE>final String locationKey = "location";<NEW_LINE>final JsonNode trafficRouterJo = JsonUtils.getJsonNode(jo, "contentRouters");<NEW_LINE>final Map<Geolocation, TrafficRouterLocation> locations = new HashMap<>();<NEW_LINE>final JsonNode trafficRouterLocJo = jo.get("trafficRouterLocations");<NEW_LINE>if (trafficRouterLocJo == null) {<NEW_LINE>LOGGER.warn("No trafficRouterLocations key found in configuration; unable to configure localized traffic routers");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final Map<String, Location> allLocations = getEdgeTrafficRouterLocationMap(trafficRouterLocJo);<NEW_LINE>for (final Iterator<String> trafficRouterNames = trafficRouterJo.fieldNames(); trafficRouterNames.hasNext(); ) {<NEW_LINE>final String trafficRouterName = trafficRouterNames.next();<NEW_LINE>final JsonNode trafficRouter = trafficRouterJo.get(trafficRouterName);<NEW_LINE>// define here to log invalid ip/ip6 input on catch below<NEW_LINE>String ip = null;<NEW_LINE>String ip6 = null;<NEW_LINE>try {<NEW_LINE>final String trLoc = JsonUtils.getString(trafficRouter, locationKey);<NEW_LINE>final Location cl = allLocations.get(trLoc);<NEW_LINE>if (cl != null) {<NEW_LINE>TrafficRouterLocation trafficRouterLocation = locations.get(cl.getGeolocation());<NEW_LINE>if (trafficRouterLocation == null) {<NEW_LINE>trafficRouterLocation = new TrafficRouterLocation(trLoc, cl.getGeolocation());<NEW_LINE>locations.put(<MASK><NEW_LINE>}<NEW_LINE>final JsonNode status = trafficRouter.get("status");<NEW_LINE>if (status == null || (!"ONLINE".equals(status.asText()) && !"REPORTED".equals(status.asText()))) {<NEW_LINE>LOGGER.warn(String.format("Skipping Edge Traffic Router %s due to %s status", trafficRouterName, status));<NEW_LINE>continue;<NEW_LINE>} else {<NEW_LINE>LOGGER.info(String.format("Edge Traffic Router %s %s @ %s; %s", status, trafficRouterName, trLoc, cl.getGeolocation().toString()));<NEW_LINE>}<NEW_LINE>final Node edgeTrafficRouter = new Node(trafficRouterName, trafficRouterName, JsonUtils.optInt(jo, "hashCount"));<NEW_LINE>ip = JsonUtils.getString(trafficRouter, "ip");<NEW_LINE>ip6 = JsonUtils.optString(trafficRouter, "ip6");<NEW_LINE>edgeTrafficRouter.setFqdn(JsonUtils.getString(trafficRouter, "fqdn"));<NEW_LINE>edgeTrafficRouter.setPort(JsonUtils.getInt(trafficRouter, "port"));<NEW_LINE>edgeTrafficRouter.setIpAddress(ip, ip6, 0);<NEW_LINE>trafficRouterLocation.addTrafficRouter(trafficRouterName, edgeTrafficRouter);<NEW_LINE>} else {<NEW_LINE>LOGGER.error("No Location found for " + trLoc + "; unable to use Edge Traffic Router " + trafficRouterName);<NEW_LINE>}<NEW_LINE>} catch (JsonUtilsException e) {<NEW_LINE>LOGGER.warn(e, e);<NEW_LINE>} catch (UnknownHostException ex) {<NEW_LINE>LOGGER.warn(String.format("%s; input was ip=%s, ip6=%s", ex, ip, ip6), ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>cacheRegister.setEdgeTrafficRouterLocations(locations.values());<NEW_LINE>} | cl.getGeolocation(), trafficRouterLocation); |
215,825 | public void writeRawBytes(final ByteString value, int offset, int length) throws IOException {<NEW_LINE>if (limit - position >= length) {<NEW_LINE>// We have room in the current buffer.<NEW_LINE>value.copyTo(buffer, offset, position, length);<NEW_LINE>position += length;<NEW_LINE>} else {<NEW_LINE>// Write extends past current buffer. Fill the rest of this buffer and<NEW_LINE>// flush.<NEW_LINE>final int bytesWritten = limit - position;<NEW_LINE>value.copyTo(buffer, offset, position, bytesWritten);<NEW_LINE>offset += bytesWritten;<NEW_LINE>length -= bytesWritten;<NEW_LINE>position = limit;<NEW_LINE>refreshBuffer();<NEW_LINE>// Now deal with the rest.<NEW_LINE>// Since we have an output stream, this is our buffer<NEW_LINE>// and buffer offset == 0<NEW_LINE>if (length <= limit) {<NEW_LINE>// Fits in new buffer.<NEW_LINE>value.copyTo(buffer, offset, 0, length);<NEW_LINE>position = length;<NEW_LINE>} else {<NEW_LINE>// Write is very big, but we can't do it all at once without allocating<NEW_LINE>// an a copy of the byte array since ByteString does not give us access<NEW_LINE>// to the underlying bytes. Use the InputStream interface on the<NEW_LINE>// ByteString and our buffer to copy between the two.<NEW_LINE><MASK><NEW_LINE>if (offset != inputStreamFrom.skip(offset)) {<NEW_LINE>throw new IllegalStateException("Skip failed? Should never happen.");<NEW_LINE>}<NEW_LINE>// Use the buffer as the temporary buffer to avoid allocating memory.<NEW_LINE>while (length > 0) {<NEW_LINE>int bytesToRead = Math.min(length, limit);<NEW_LINE>int bytesRead = inputStreamFrom.read(buffer, 0, bytesToRead);<NEW_LINE>if (bytesRead != bytesToRead) {<NEW_LINE>throw new IllegalStateException("Read failed? Should never happen");<NEW_LINE>}<NEW_LINE>output.write(buffer, 0, bytesRead);<NEW_LINE>writtenBytes += bytesRead;<NEW_LINE>length -= bytesRead;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | InputStream inputStreamFrom = value.newInput(); |
738,055 | // --- DataSourceView implementation ---------------------------------------<NEW_LINE>protected DataViewComponent createComponent() {<NEW_LINE>PackagesView packagesView = new PackagesView(model, controller);<NEW_LINE>timelineView = new TimelineView(model);<NEW_LINE>detailsView = new DetailsView(model);<NEW_LINE>MasterViewSupport masterView = new MasterViewSupport();<NEW_LINE>dvc = new DataViewComponent(masterView.getView(), new DataViewComponent.MasterViewConfiguration(false));<NEW_LINE>dvc.configureDetailsView(new DataViewComponent.DetailsViewConfiguration(0.33, 0, 0.33, 0, 0.5, 0.5));<NEW_LINE>String initiallyOpened = TracerOptions.getInstance().getInitiallyOpened();<NEW_LINE>dvc.configureDetailsArea(new DataViewComponent.DetailsAreaConfiguration("Probes", true), DataViewComponent.TOP_LEFT);<NEW_LINE>dvc.addDetailsView(packagesView.<MASK><NEW_LINE>if (!initiallyOpened.contains(TracerOptions.VIEW_PROBES))<NEW_LINE>dvc.hideDetailsArea(DataViewComponent.TOP_LEFT);<NEW_LINE>dvc.configureDetailsArea(new DataViewComponent.DetailsAreaConfiguration("Timeline", true), DataViewComponent.TOP_RIGHT);<NEW_LINE>dvc.addDetailsView(timelineView.getView(), DataViewComponent.TOP_RIGHT);<NEW_LINE>if (!initiallyOpened.contains(TracerOptions.VIEW_TIMELINE))<NEW_LINE>dvc.hideDetailsArea(DataViewComponent.TOP_RIGHT);<NEW_LINE>dvc.configureDetailsArea(new DataViewComponent.DetailsAreaConfiguration("Details", true), DataViewComponent.BOTTOM_RIGHT);<NEW_LINE>dvc.addDetailsView(detailsView.getView(), DataViewComponent.BOTTOM_RIGHT);<NEW_LINE>if (!initiallyOpened.contains(TracerOptions.VIEW_DETAILS))<NEW_LINE>dvc.hideDetailsArea(DataViewComponent.BOTTOM_RIGHT);<NEW_LINE>return dvc;<NEW_LINE>} | getView(), DataViewComponent.TOP_LEFT); |
806,011 | public BaseFont awtToPdf(Font awtFont) {<NEW_LINE>ourLogger.debug("Searching for BaseFont for awtFont={} charset={} cache={}", awtFont, charset, myFontCache);<NEW_LINE>if (myFontCache.containsKey(awtFont)) {<NEW_LINE>ourLogger.debug("Found in cache.");<NEW_LINE>return myFontCache.get(awtFont);<NEW_LINE>}<NEW_LINE>String family = awtFont.getFamily().toLowerCase();<NEW_LINE>Function<String, BaseFont> <MASK><NEW_LINE>ourLogger.debug("Searching for supplier: family={} size={}", family, awtFont.getSize());<NEW_LINE>if (f != null) {<NEW_LINE>BaseFont result = f.apply(charset);<NEW_LINE>if (result == null) {<NEW_LINE>ourLogger.warn("... failed to find the base font for family={} charset={}", family, charset);<NEW_LINE>} else {<NEW_LINE>ourLogger.debug("... created BaseFont: {}", getInfo(result));<NEW_LINE>myFontCache.put(awtFont, result);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>family = family.replace(' ', '_');<NEW_LINE>if (myProperties.containsKey("font." + family)) {<NEW_LINE>family = String.valueOf(myProperties.get("font." + family));<NEW_LINE>}<NEW_LINE>ourLogger.debug("Searching for substitution. Family={}", family);<NEW_LINE>FontSubstitution substitution = substitutions.getSubstitution(family);<NEW_LINE>if (substitution != null) {<NEW_LINE>family = substitution.getSubstitutionFamily();<NEW_LINE>}<NEW_LINE>f = myMap_Family_ItextFont.get(family);<NEW_LINE>ourLogger.debug("substitution family={} supplier={}", family, f);<NEW_LINE>if (f != null) {<NEW_LINE>BaseFont result = f.apply(charset);<NEW_LINE>ourLogger.debug("created base font={}", result);<NEW_LINE>myFontCache.put(awtFont, result);<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>BaseFont result = getFallbackFont(charset);<NEW_LINE>ourLogger.debug("so, trying fallback font={}", result);<NEW_LINE>if (result == null) {<NEW_LINE>ourLogger.error("Can't find a PDF font corresponding to AWT font with family={}. " + "Also tried substitution family={} and fallback font. Charset={}", awtFont.getFamily(), family, charset);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | f = myMap_Family_ItextFont.get(family); |
558,089 | public void marshall(PendingMaintenanceAction pendingMaintenanceAction, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (pendingMaintenanceAction == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(pendingMaintenanceAction.getAction(), ACTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(pendingMaintenanceAction.getAutoAppliedAfterDate(), AUTOAPPLIEDAFTERDATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(pendingMaintenanceAction.getForcedApplyDate(), FORCEDAPPLYDATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(pendingMaintenanceAction.getOptInStatus(), OPTINSTATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(pendingMaintenanceAction.getCurrentApplyDate(), CURRENTAPPLYDATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | pendingMaintenanceAction.getDescription(), DESCRIPTION_BINDING); |
279,762 | public GetGroupCertificateAuthorityResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>GetGroupCertificateAuthorityResult getGroupCertificateAuthorityResult = new GetGroupCertificateAuthorityResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return getGroupCertificateAuthorityResult;<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("GroupCertificateAuthorityArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getGroupCertificateAuthorityResult.setGroupCertificateAuthorityArn(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("GroupCertificateAuthorityId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getGroupCertificateAuthorityResult.setGroupCertificateAuthorityId(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("PemEncodedCertificate", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getGroupCertificateAuthorityResult.setPemEncodedCertificate(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 getGroupCertificateAuthorityResult;<NEW_LINE>} | class).unmarshall(context)); |
1,012,638 | final SetInstanceProtectionResult executeSetInstanceProtection(SetInstanceProtectionRequest setInstanceProtectionRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(setInstanceProtectionRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<SetInstanceProtectionRequest> request = null;<NEW_LINE>Response<SetInstanceProtectionResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new SetInstanceProtectionRequestMarshaller().marshall(super.beforeMarshalling(setInstanceProtectionRequest));<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, "Auto Scaling");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "SetInstanceProtection");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<SetInstanceProtectionResult> responseHandler = new StaxResponseHandler<SetInstanceProtectionResult>(new SetInstanceProtectionResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | endClientExecution(awsRequestMetrics, request, response); |
1,137,330 | private Stream<MapResult> parse(InputStream data, boolean simpleMode, String path, boolean failOnError) throws Exception {<NEW_LINE>List<MapResult> result = new ArrayList<>();<NEW_LINE>try {<NEW_LINE>DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();<NEW_LINE>documentBuilderFactory.setNamespaceAware(true);<NEW_LINE>documentBuilderFactory.setIgnoringElementContentWhitespace(true);<NEW_LINE>documentBuilderFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);<NEW_LINE><MASK><NEW_LINE>documentBuilder.setEntityResolver((publicId, systemId) -> new InputSource(new StringReader("")));<NEW_LINE>Document doc = documentBuilder.parse(data);<NEW_LINE>XPathFactory xPathFactory = XPathFactory.newInstance();<NEW_LINE>XPath xPath = xPathFactory.newXPath();<NEW_LINE>path = StringUtils.isEmpty(path) ? "/" : path;<NEW_LINE>XPathExpression xPathExpression = xPath.compile(path);<NEW_LINE>NodeList nodeList = (NodeList) xPathExpression.evaluate(doc, XPathConstants.NODESET);<NEW_LINE>for (int i = 0; i < nodeList.getLength(); i++) {<NEW_LINE>final Deque<Map<String, Object>> stack = new LinkedList<>();<NEW_LINE>handleNode(stack, nodeList.item(i), simpleMode);<NEW_LINE>for (int index = 0; index < stack.size(); index++) {<NEW_LINE>result.add(new MapResult(stack.pollFirst()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (FileNotFoundException e) {<NEW_LINE>if (!failOnError)<NEW_LINE>return Stream.of(new MapResult(Collections.emptyMap()));<NEW_LINE>else<NEW_LINE>throw e;<NEW_LINE>} catch (Exception e) {<NEW_LINE>if (!failOnError)<NEW_LINE>return Stream.of(new MapResult(Collections.emptyMap()));<NEW_LINE>else<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>return result.stream();<NEW_LINE>} | DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); |
477,960 | private void createAddFolderItem(@NonNull LayoutInflater inflater) {<NEW_LINE>View view = inflater.inflate(R.layout.bottom_sheet_item_simple_pad_32dp, null);<NEW_LINE>TextView title = view.<MASK><NEW_LINE>title.setTypeface(FontCache.getRobotoMedium(app));<NEW_LINE>BaseBottomSheetItem item = new SimpleBottomSheetItem.Builder().setTitle(getString(R.string.favorite_category_add_new)).setTitleColorId(ColorUtilities.getActiveColorId(nightMode)).setIcon(getActiveIcon(R.drawable.ic_action_folder_add)).setOnClickListener(v -> {<NEW_LINE>FragmentActivity activity = getActivity();<NEW_LINE>if (activity != null) {<NEW_LINE>AddNewTrackFolderBottomSheet.showInstance(activity.getSupportFragmentManager(), suggestedDirName, SelectTrackDirectoryBottomSheet.this, usedOnMap);<NEW_LINE>}<NEW_LINE>}).setCustomView(view).create();<NEW_LINE>items.add(item);<NEW_LINE>} | findViewById(R.id.title); |
767,374 | public void checkRepoAndAddWarningIfRequired() {<NEW_LINE>try {<NEW_LINE>if (configRepository.getLooseObjectCount() >= systemEnvironment.get(SystemEnvironment.GO_CONFIG_REPO_GC_LOOSE_OBJECT_WARNING_THRESHOLD)) {<NEW_LINE>String message = "Action required: Run 'git gc' on config.git repo";<NEW_LINE>String description = "Number of loose objects in your Configuration repository(config.git) has grown beyond " + "the configured threshold. As the size of config repo increases, the config save operations tend to slow down " + "drastically. It is recommended that you run 'git gc' from " + "'<go server installation directory>/db/config.git/' to address this problem. Go can do this " + "automatically on a periodic basis if you enable automatic GC. <a target='_blank' href='" + docsUrl("/advanced_usage/config_repo.html") + "'>read more...</a>";<NEW_LINE>serverHealthService.update(ServerHealthState.warningWithHtml(message, description, HealthStateType.general(HealthStateScope.forConfigRepo(SCOPE))));<NEW_LINE>LOGGER.warn("{}:{}", message, description);<NEW_LINE>} else {<NEW_LINE>serverHealthService.removeByScope(HealthStateScope.forConfigRepo(SCOPE));<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error(<MASK><NEW_LINE>}<NEW_LINE>} | e.getMessage(), e); |
862,660 | private static ArrayList<KeyValue> parseResult(final ChannelBuffer buf) {<NEW_LINE>final int length = buf.readInt();<NEW_LINE>HBaseRpc.checkArrayLength(buf, length);<NEW_LINE>// LOG.debug("total Result response length={}", length);<NEW_LINE>final int num_kv = numberOfKeyValuesAhead(buf, length);<NEW_LINE>final ArrayList<KeyValue> results = new ArrayList<KeyValue>(num_kv);<NEW_LINE>KeyValue kv = null;<NEW_LINE>for (int i = 0; i < num_kv; i++) {<NEW_LINE>// Previous loop checked it's >0.<NEW_LINE>final int kv_length = buf.readInt();<NEW_LINE>// Now read a KeyValue that spans over kv_length bytes.<NEW_LINE>kv = KeyValue.fromBuffer(buf, kv);<NEW_LINE>final int key_length = (// XXX DEBUG<NEW_LINE>2 + kv.key().length + 1 + kv.family().length + kv.qualifier(<MASK><NEW_LINE>if (key_length + kv.value().length + 4 + 4 != kv_length) {<NEW_LINE>badResponse("kv_length=" + kv_length + " doesn't match key_length + value_length (" + key_length + " + " + kv.value().length + ") in " + buf + '=' + Bytes.pretty(buf));<NEW_LINE>}<NEW_LINE>results.add(kv);<NEW_LINE>}<NEW_LINE>return results;<NEW_LINE>} | ).length + 8 + 1); |
230,948 | public static TruffleString toDisplayStringImpl(Object value, boolean allowSideEffects, ToDisplayStringFormat format, int depth, Object parent) {<NEW_LINE>CompilerAsserts.neverPartOfCompilation();<NEW_LINE>if (value == parent) {<NEW_LINE>return Strings.PARENS_THIS;<NEW_LINE>} else if (value == Undefined.instance) {<NEW_LINE>return Undefined.NAME;<NEW_LINE>} else if (value == Null.instance) {<NEW_LINE>return Null.NAME;<NEW_LINE>} else if (value instanceof Boolean) {<NEW_LINE>return booleanToString((Boolean) value);<NEW_LINE>} else if (value instanceof TruffleString) {<NEW_LINE>return format.quoteString() ? quote((TruffleString) value) : (TruffleString) value;<NEW_LINE>} else if (value instanceof String) {<NEW_LINE>return format.quoteString() ? quote(Strings.fromJavaString((String) value)) : Strings.fromJavaString((String) value);<NEW_LINE>} else if (JSDynamicObject.isJSDynamicObject(value)) {<NEW_LINE>return ((JSDynamicObject) value).toDisplayStringImpl(allowSideEffects, format, depth);<NEW_LINE>} else if (value instanceof Symbol) {<NEW_LINE>return ((Symbol) value).toTString();<NEW_LINE>} else if (value instanceof BigInt) {<NEW_LINE>return Strings.concat(((BigInt) value).toTString(), Strings.N);<NEW_LINE>} else if (isNumber(value)) {<NEW_LINE>Number number = (Number) value;<NEW_LINE>if (JSRuntime.isNegativeZero(number.doubleValue())) {<NEW_LINE>return Strings.NEGATIVE_ZERO;<NEW_LINE>} else {<NEW_LINE>return numberToString(number);<NEW_LINE>}<NEW_LINE>} else if (value instanceof InteropFunction) {<NEW_LINE>return toDisplayStringImpl(((InteropFunction) value).getFunction(), <MASK><NEW_LINE>} else if (value instanceof TruffleObject) {<NEW_LINE>assert !isJSNative(value) : value;<NEW_LINE>return foreignToString(value, allowSideEffects, format, depth);<NEW_LINE>} else {<NEW_LINE>return Strings.fromObject(value);<NEW_LINE>}<NEW_LINE>} | allowSideEffects, format, depth, parent); |
660,666 | private void postProcessCaches() {<NEW_LINE>IClassPath classPath = analysisCache.getClassPath();<NEW_LINE>Map<ClassDescriptor, Object> classAnalysis = analysisCache.getClassAnalysis(ClassData.class);<NEW_LINE>if (classAnalysis == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Set<Entry<ClassDescriptor, Object>> entrySet = classAnalysis.entrySet();<NEW_LINE>AnalysisData data = new AnalysisData();<NEW_LINE>for (Entry<ClassDescriptor, Object> entry : entrySet) {<NEW_LINE>data.classCount++;<NEW_LINE>if (!(entry.getValue() instanceof ClassData)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>ClassData cd = (ClassData) entry.getValue();<NEW_LINE>data.byteSize += cd.getData().length;<NEW_LINE>}<NEW_LINE>Set<Entry<String, ICodeBaseEntry>> entrySet2 = classPath.getApplicationCodebaseEntries().entrySet();<NEW_LINE><MASK><NEW_LINE>for (Entry<String, ICodeBaseEntry> entry : entrySet2) {<NEW_LINE>String className = entry.getKey();<NEW_LINE>if (cacheClassData) {<NEW_LINE>if (className.endsWith(".class")) {<NEW_LINE>className = className.substring(0, className.length() - 6);<NEW_LINE>}<NEW_LINE>classAnalysis.remove(descriptorFactory.getClassDescriptor(className));<NEW_LINE>}<NEW_LINE>data.byteSizeApp += entry.getValue().getNumBytes();<NEW_LINE>}<NEW_LINE>if (cacheClassData) {<NEW_LINE>// create new reference not reachable to anyone except us<NEW_LINE>classAnalysis = new HashMap<>(classAnalysis);<NEW_LINE>classAnalysisCache.put(project, new SoftReference<>(classAnalysis));<NEW_LINE>}<NEW_LINE>reportExtraData(data);<NEW_LINE>} | DescriptorFactory descriptorFactory = DescriptorFactory.instance(); |
1,563,497 | private void addResponse(RequestMethod requestMethod, String operationPath, ApiResponses apiResponses, ApiResponse apiResponse) {<NEW_LINE>switch(requestMethod) {<NEW_LINE>case GET:<NEW_LINE>addResponse200(apiResponses, apiResponse);<NEW_LINE>if (operationPath.contains("/{id}"))<NEW_LINE>addResponse404(apiResponses);<NEW_LINE>break;<NEW_LINE>case POST:<NEW_LINE>apiResponses.put(String.valueOf(HttpStatus.CREATED.value()), apiResponse.description(HttpStatus<MASK><NEW_LINE>break;<NEW_LINE>case DELETE:<NEW_LINE>addResponse204(apiResponses);<NEW_LINE>addResponse404(apiResponses);<NEW_LINE>break;<NEW_LINE>case PUT:<NEW_LINE>addResponse200(apiResponses, apiResponse);<NEW_LINE>apiResponses.put(String.valueOf(HttpStatus.CREATED.value()), new ApiResponse().content(apiResponse.getContent()).description(HttpStatus.CREATED.getReasonPhrase()));<NEW_LINE>addResponse204(apiResponses);<NEW_LINE>break;<NEW_LINE>case PATCH:<NEW_LINE>addResponse200(apiResponses, apiResponse);<NEW_LINE>addResponse204(apiResponses);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new IllegalArgumentException(requestMethod.name());<NEW_LINE>}<NEW_LINE>} | .CREATED.getReasonPhrase())); |
302,939 | // start lifecycle<NEW_LINE>@Override<NEW_LINE>protected void onCreate(Bundle savedInstanceState) {<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>setContentView(R.layout.activity_password);<NEW_LINE>// For set status bar<NEW_LINE>ChinaPhoneHelper.setStatusBar(this, true);<NEW_LINE>// Get this page mode<NEW_LINE>currentMode = getIntent().getIntExtra("password_mode", FAIL);<NEW_LINE>showReleaseNote = getIntent().getBooleanExtra("showReleaseNote", false);<NEW_LINE>if (currentMode == FAIL) {<NEW_LINE>finish();<NEW_LINE>}<NEW_LINE>IV_password_number_1 = (ImageView) findViewById(R.id.IV_password_number_1);<NEW_LINE>IV_password_number_2 = (ImageView) findViewById(R.id.IV_password_number_2);<NEW_LINE>IV_password_number_3 = (ImageView) findViewById(R.id.IV_password_number_3);<NEW_LINE>IV_password_number_4 = (ImageView) findViewById(R.id.IV_password_number_4);<NEW_LINE>TV_password_message = (TextView) findViewById(R.id.TV_password_message);<NEW_LINE>TV_password_sub_message = (TextView) findViewById(R.id.TV_password_sub_message);<NEW_LINE>But_password_key_1 = (Button) findViewById(R.id.But_password_key_1);<NEW_LINE>But_password_key_2 = (Button) findViewById(R.id.But_password_key_2);<NEW_LINE>But_password_key_3 = (Button) <MASK><NEW_LINE>But_password_key_4 = (Button) findViewById(R.id.But_password_key_4);<NEW_LINE>But_password_key_5 = (Button) findViewById(R.id.But_password_key_5);<NEW_LINE>But_password_key_6 = (Button) findViewById(R.id.But_password_key_6);<NEW_LINE>But_password_key_7 = (Button) findViewById(R.id.But_password_key_7);<NEW_LINE>But_password_key_8 = (Button) findViewById(R.id.But_password_key_8);<NEW_LINE>But_password_key_9 = (Button) findViewById(R.id.But_password_key_9);<NEW_LINE>But_password_key_cancel = (Button) findViewById(R.id.But_password_key_cancel);<NEW_LINE>But_password_key_0 = (Button) findViewById(R.id.But_password_key_0);<NEW_LINE>But_password_key_backspace = (ImageButton) findViewById(R.id.But_password_key_backspace);<NEW_LINE>But_password_key_1.setOnClickListener(this);<NEW_LINE>But_password_key_2.setOnClickListener(this);<NEW_LINE>But_password_key_3.setOnClickListener(this);<NEW_LINE>But_password_key_4.setOnClickListener(this);<NEW_LINE>But_password_key_5.setOnClickListener(this);<NEW_LINE>But_password_key_6.setOnClickListener(this);<NEW_LINE>But_password_key_7.setOnClickListener(this);<NEW_LINE>But_password_key_8.setOnClickListener(this);<NEW_LINE>But_password_key_9.setOnClickListener(this);<NEW_LINE>But_password_key_0.setOnClickListener(this);<NEW_LINE>But_password_key_backspace.setOnClickListener(this);<NEW_LINE>But_password_key_cancel.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>finish();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>clearUiPassword();<NEW_LINE>initUI();<NEW_LINE>} | findViewById(R.id.But_password_key_3); |
53,067 | public Observable<ServiceResponse<ImageDescription>> describeImageInStreamWithServiceResponseAsync(byte[] image, DescribeImageInStreamOptionalParameter describeImageInStreamOptionalParameter) {<NEW_LINE>if (this.client.endpoint() == null) {<NEW_LINE>throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");<NEW_LINE>}<NEW_LINE>if (image == null) {<NEW_LINE>throw new IllegalArgumentException("Parameter image is required and cannot be null.");<NEW_LINE>}<NEW_LINE>final Integer maxCandidates = describeImageInStreamOptionalParameter != null ? describeImageInStreamOptionalParameter.maxCandidates() : null;<NEW_LINE>final String language = describeImageInStreamOptionalParameter != null ? describeImageInStreamOptionalParameter.language() : null;<NEW_LINE>final List<DescriptionExclude> descriptionExclude = describeImageInStreamOptionalParameter != null <MASK><NEW_LINE>final String modelVersion = describeImageInStreamOptionalParameter != null ? describeImageInStreamOptionalParameter.modelVersion() : null;<NEW_LINE>return describeImageInStreamWithServiceResponseAsync(image, maxCandidates, language, descriptionExclude, modelVersion);<NEW_LINE>} | ? describeImageInStreamOptionalParameter.descriptionExclude() : null; |
1,474,837 | public static void createPid(String dir) throws Exception {<NEW_LINE>File file = new File(dir);<NEW_LINE>if (!file.exists()) {<NEW_LINE>file.mkdirs();<NEW_LINE>} else if (!file.isDirectory()) {<NEW_LINE>throw new RuntimeException("pid dir:" + dir + " isn't directory");<NEW_LINE>}<NEW_LINE>String[<MASK><NEW_LINE>if (existPids == null) {<NEW_LINE>existPids = new String[] {};<NEW_LINE>}<NEW_LINE>for (String existPid : existPids) {<NEW_LINE>try {<NEW_LINE>JStormUtils.kill(Integer.valueOf(existPid));<NEW_LINE>PathUtils.rmpath(dir + File.separator + existPid);<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.warn(e.getMessage(), e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// touch pid before<NEW_LINE>String pid = JStormUtils.process_pid();<NEW_LINE>String pidPath = dir + File.separator + pid;<NEW_LINE>PathUtils.touch(pidPath);<NEW_LINE>LOG.info("Successfully touch pid " + pidPath);<NEW_LINE>} | ] existPids = file.list(); |
64,200 | static <T> DecodePropertyInfo<T>[] prepare(DecodePropertyInfo<T>[] initial, int argumentCount) {<NEW_LINE>final DecodePropertyInfo<T>[] decoders = initial.clone();<NEW_LINE>final HashSet<Integer> hashes = new HashSet<Integer>();<NEW_LINE>int mandatoryIndex = 0;<NEW_LINE>boolean needsSorting = false;<NEW_LINE>for (int i = 0; i < decoders.length; i++) {<NEW_LINE>DecodePropertyInfo<T> ri = decoders[i];<NEW_LINE>if (!hashes.add(ri.hash)) {<NEW_LINE>for (int j = 0; j < decoders.length; j++) {<NEW_LINE>final DecodePropertyInfo si = decoders[j];<NEW_LINE>if (si.hash == ri.hash && !si.exactName) {<NEW_LINE>decoders[j] = new DecodePropertyInfo<>(ri.name, true, ri.mandatory, ~0, ri.index, ri.nonNull, ri.hash, ri.weakHash, ri.value, ri.nameBytes);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (ri.mandatory) {<NEW_LINE>ri = decoders[i];<NEW_LINE>if (mandatoryIndex > 63) {<NEW_LINE>throw new ConfigurationException("Only up to 64 mandatory properties are supported");<NEW_LINE>}<NEW_LINE>decoders[i] = new DecodePropertyInfo<>(ri.name, ri.exactName, true, ~(1 << mandatoryIndex), ri.index, ri.nonNull, ri.hash, ri.weakHash, ri.value, ri.nameBytes);<NEW_LINE>mandatoryIndex++;<NEW_LINE>}<NEW_LINE>needsSorting = needsSorting || ri.index >= 0;<NEW_LINE>}<NEW_LINE>if (argumentCount != initial.length)<NEW_LINE>return decoders;<NEW_LINE>if (needsSorting) {<NEW_LINE>Arrays.sort(decoders, new Comparator<DecodePropertyInfo<T>>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public int compare(DecodePropertyInfo<T> a, DecodePropertyInfo<T> b) {<NEW_LINE>if (b.index == -1)<NEW_LINE>return -1;<NEW_LINE>else if (a.index == -1)<NEW_LINE>return 1;<NEW_LINE>return a.index - b.index;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>final HashMap<String, Integer> nameOrder = new HashMap<>();<NEW_LINE>for (int i = 0; i < decoders.length; i++) {<NEW_LINE>final DecodePropertyInfo<T> ri = decoders[i];<NEW_LINE>Integer index = nameOrder.get(ri.name);<NEW_LINE>if (index == null) {<NEW_LINE>index = nameOrder.size();<NEW_LINE>nameOrder.<MASK><NEW_LINE>}<NEW_LINE>decoders[i] = new DecodePropertyInfo<>(ri.name, ri.exactName, ri.mandatory, ri.mandatoryValue, index, ri.nonNull, ri.hash, ri.weakHash, ri.value, ri.nameBytes);<NEW_LINE>}<NEW_LINE>return decoders;<NEW_LINE>} | put(ri.name, index); |
98,160 | BlockEntryStreamMerger<KEY, VALUE> startMerge() {<NEW_LINE>List<BlockEntryCursor<KEY, VALUE>> remainingParts = new ArrayList<>(parts);<NEW_LINE>while (remainingParts.size() > MERGE_FACTOR) {<NEW_LINE>// Build one "level" of mergers, each merger in this level merging "merge factor" number of streams<NEW_LINE>List<BlockEntryCursor<KEY, VALUE>> current = new ArrayList<>();<NEW_LINE>List<BlockEntryCursor<KEY, VALUE>> levelParts = new ArrayList<>();<NEW_LINE>for (BlockEntryCursor<KEY, VALUE> remainingPart : remainingParts) {<NEW_LINE>current.add(remainingPart);<NEW_LINE>if (current.size() == MERGE_FACTOR) {<NEW_LINE>BlockEntryStreamMerger<KEY, VALUE> merger = new BlockEntryStreamMerger<>(current, layout, <MASK><NEW_LINE>allMergers.add(merger);<NEW_LINE>levelParts.add(merger);<NEW_LINE>current = new ArrayList<>();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>levelParts.addAll(current);<NEW_LINE>remainingParts = levelParts;<NEW_LINE>}<NEW_LINE>BlockEntryStreamMerger<KEY, VALUE> merger = new BlockEntryStreamMerger<>(remainingParts, layout, samplingComparator, cancellation, batchSize, QUEUE_SIZE);<NEW_LINE>allMergers.add(merger);<NEW_LINE>allMergers.forEach(merge -> mergeHandles.add(populationWorkScheduler.schedule(indexName -> "Part merger while writing scan update for " + indexName, merge)));<NEW_LINE>return merger;<NEW_LINE>} | null, cancellation, batchSize, QUEUE_SIZE); |
877,872 | public boolean shouldOverrideUrlLoading(WebView view, String url) {<NEW_LINE>final RNCWebView rncWebView = (RNCWebView) view;<NEW_LINE>final boolean isJsDebugging = ((ReactContext) view.getContext()).getJavaScriptContextHolder().get() == 0;<NEW_LINE>if (!isJsDebugging && rncWebView.mCatalystInstance != null) {<NEW_LINE>final Pair<Integer, AtomicReference<ShouldOverrideCallbackState>> lock = RNCWebViewModule.shouldOverrideUrlLoadingLock.getNewLock();<NEW_LINE>final int lockIdentifier = lock.first;<NEW_LINE>final AtomicReference<ShouldOverrideCallbackState> lockObject = lock.second;<NEW_LINE>final WritableMap event = createWebViewEvent(view, url);<NEW_LINE>event.putInt("lockIdentifier", lockIdentifier);<NEW_LINE>rncWebView.sendDirectMessage("onShouldStartLoadWithRequest", event);<NEW_LINE>try {<NEW_LINE>assert lockObject != null;<NEW_LINE>synchronized (lockObject) {<NEW_LINE>final long startTime = SystemClock.elapsedRealtime();<NEW_LINE>while (lockObject.get() == ShouldOverrideCallbackState.UNDECIDED) {<NEW_LINE>if (SystemClock.elapsedRealtime() - startTime > SHOULD_OVERRIDE_URL_LOADING_TIMEOUT) {<NEW_LINE>FLog.w(TAG, "Did not receive response to shouldOverrideUrlLoading in time, defaulting to allow loading.");<NEW_LINE>RNCWebViewModule.shouldOverrideUrlLoadingLock.removeLock(lockIdentifier);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>lockObject.wait(SHOULD_OVERRIDE_URL_LOADING_TIMEOUT);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>FLog.e(TAG, "shouldOverrideUrlLoading was interrupted while waiting for result.", e);<NEW_LINE>RNCWebViewModule.shouldOverrideUrlLoadingLock.removeLock(lockIdentifier);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>final boolean shouldOverride = lockObject.get() == ShouldOverrideCallbackState.SHOULD_OVERRIDE;<NEW_LINE>RNCWebViewModule.shouldOverrideUrlLoadingLock.removeLock(lockIdentifier);<NEW_LINE>return shouldOverride;<NEW_LINE>} else {<NEW_LINE>FLog.w(TAG, "Couldn't use blocking synchronous call for onShouldStartLoadWithRequest due to debugging or missing Catalyst instance, falling back to old event-and-load.");<NEW_LINE>progressChangedFilter.setWaitingForCommandLoadUrl(true);<NEW_LINE>((RNCWebView) view).dispatchEvent(view, new TopShouldStartLoadWithRequestEvent(view.getId(), <MASK><NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>} | createWebViewEvent(view, url))); |
710,466 | protected ProcessDefinition resolveProcessDefinition(String processDefinitionKey, Integer processDefinitionVersion, String tenantId, CommandContext commandContext) {<NEW_LINE>ProcessDefinitionEntityManager processDefinitionEntityManager = CommandContextUtil.getProcessDefinitionEntityManager(commandContext);<NEW_LINE>ProcessDefinition processDefinition;<NEW_LINE>if (processDefinitionVersion != null) {<NEW_LINE>processDefinition = processDefinitionEntityManager.findProcessDefinitionByKeyAndVersionAndTenantId(processDefinitionKey, processDefinitionVersion, tenantId);<NEW_LINE>} else {<NEW_LINE>if (tenantId == null || ProcessEngineConfiguration.NO_TENANT_ID.equals(tenantId)) {<NEW_LINE>processDefinition = processDefinitionEntityManager.findLatestProcessDefinitionByKey(processDefinitionKey);<NEW_LINE>} else {<NEW_LINE>processDefinition = processDefinitionEntityManager.findLatestProcessDefinitionByKeyAndTenantId(processDefinitionKey, tenantId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (processDefinition == null) {<NEW_LINE>DeploymentManager deploymentManager = CommandContextUtil.getProcessEngineConfiguration(commandContext).getDeploymentManager();<NEW_LINE>if (tenantId == null || ProcessEngineConfiguration.NO_TENANT_ID.equals(tenantId)) {<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>processDefinition = deploymentManager.findDeployedLatestProcessDefinitionByKeyAndTenantId(processDefinitionKey, tenantId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return processDefinition;<NEW_LINE>} | processDefinition = deploymentManager.findDeployedLatestProcessDefinitionByKey(processDefinitionKey); |
333,087 | final DeleteAlarmResult executeDeleteAlarm(DeleteAlarmRequest deleteAlarmRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteAlarmRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteAlarmRequest> request = null;<NEW_LINE>Response<DeleteAlarmResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteAlarmRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteAlarmRequest));<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, "DeleteAlarm");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteAlarmResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteAlarmResultJsonUnmarshaller());<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); |
1,661,160 | public boolean forward(ByteBuffer packet) throws IOException {<NEW_LINE>NatAddress incoming;<NEW_LINE>NatAddress destination;<NEW_LINE>boolean first;<NEW_LINE>synchronized (this) {<NEW_LINE>incoming = this.incoming;<NEW_LINE>destination = this.destination;<NEW_LINE>first = this.first;<NEW_LINE>this.first = false;<NEW_LINE>}<NEW_LINE>if (incoming == null) {<NEW_LINE>LOGGER.debug("forward drops {} bytes, no incoming address.", packet.limit());<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>incoming.updateUsage();<NEW_LINE>if (!first && !destination.usable()) {<NEW_LINE>destination = getRandomDestination();<NEW_LINE>setDestination(destination);<NEW_LINE>}<NEW_LINE>MessageDropping dropping = forward;<NEW_LINE>if (dropping != null && dropping.dropMessage()) {<NEW_LINE>LOGGER.debug("forward drops {} bytes from {} to {} via {}", packet.limit(), incoming.name, destination.name, natName);<NEW_LINE>} else {<NEW_LINE>MessageSizeLimit limit = forwardSizeLimit;<NEW_LINE>MessageSizeLimit.Manipulation manipulation = limit != null ? limit.limitMessageSize(packet) : MessageSizeLimit.Manipulation.NONE;<NEW_LINE>switch(manipulation) {<NEW_LINE>case NONE:<NEW_LINE>LOGGER.debug("forward {} bytes from {} to {} via {}", packet.limit(), incoming.name, destination.name, natName);<NEW_LINE>break;<NEW_LINE>case DROP:<NEW_LINE>LOGGER.debug("forward drops {} bytes from {} to {} via {}", packet.limit(), incoming.name, destination.name, natName);<NEW_LINE>break;<NEW_LINE>case LIMIT:<NEW_LINE>LOGGER.debug("forward limited {} bytes from {} to {} via {}", packet.limit(), incoming.name, destination.name, natName);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (manipulation != MessageSizeLimit.Manipulation.DROP) {<NEW_LINE>if (outgoing.send(packet, destination.address) == 0) {<NEW_LINE>LOGGER.info("forward overloaded {} bytes from {} to {} via {}", packet.limit(), incoming.name, destination.name, natName);<NEW_LINE>return false;<NEW_LINE>} else {<NEW_LINE>destination.updateSend();<NEW_LINE>forwardCounter.incrementAndGet();<NEW_LINE>LOGGER.debug("forwarded {} bytes from {} to {} via {}", packet.limit(), incoming.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | name, destination.name, natName); |
1,299,253 | public static void main(String[] args) {<NEW_LINE>// Create a report to log multi-threaded messages.<NEW_LINE>AsyncReport rep = new AsyncReport();<NEW_LINE>// Create a user-defined event handler to catch plugin events.<NEW_LINE>EventHandler handler = new EventHandler();<NEW_LINE>// Create a TS processor using the report.<NEW_LINE>TSProcessor tsp = new TSProcessor(rep);<NEW_LINE>// Register our event handler in the TS processor.<NEW_LINE><MASK><NEW_LINE>// Set the plugin chain.<NEW_LINE>tsp.input = new String[] { "http", "https://github.com/tsduck/tsduck-test/raw/master/input/test-016.ts" };<NEW_LINE>tsp.plugins = new String[][] { { "mpe", "--pid", "2001", "--max-datagram", "2", "--event-code", String.valueOf(EVENT_CODE) } };<NEW_LINE>tsp.output = new String[] { "drop" };<NEW_LINE>// Run the TS processing and wait until completion.<NEW_LINE>tsp.start();<NEW_LINE>tsp.waitForTermination();<NEW_LINE>tsp.delete();<NEW_LINE>// Delete the event handler.<NEW_LINE>handler.delete();<NEW_LINE>// Terminate the asynchronous report.<NEW_LINE>rep.terminate();<NEW_LINE>rep.delete();<NEW_LINE>} | tsp.registerEventHandler(handler, EVENT_CODE); |
1,184,835 | public DataSource createDataSource(Configuration dbConfig) throws PropertyVetoException, SQLException {<NEW_LINE>ComboPooledDataSource ds = new ComboPooledDataSource();<NEW_LINE>ds.setDriverClass(dbConfig.getProperty("db.driver"));<NEW_LINE>ds.setJdbcUrl(dbConfig.getProperty("db.url"));<NEW_LINE>ds.setUser(dbConfig.getProperty("db.user"));<NEW_LINE>ds.setPassword(dbConfig.getProperty("db.pass"));<NEW_LINE>ds.setAcquireIncrement(Integer.parseInt(dbConfig.getProperty("db.pool.acquireIncrement", "3")));<NEW_LINE>ds.setAcquireRetryAttempts(Integer.parseInt(dbConfig.getProperty("db.pool.acquireRetryAttempts", "10")));<NEW_LINE>ds.setAcquireRetryDelay(Integer.parseInt(dbConfig.getProperty("db.pool.acquireRetryDelay", "1000")));<NEW_LINE>ds.setCheckoutTimeout(Integer.parseInt(dbConfig.getProperty("db.pool.timeout", "5000")));<NEW_LINE>ds.setBreakAfterAcquireFailure(Boolean.parseBoolean(dbConfig.getProperty("db.pool.breakAfterAcquireFailure", "false")));<NEW_LINE>ds.setMaxPoolSize(Integer.parseInt(dbConfig.getProperty("db.pool.maxSize", "30")));<NEW_LINE>ds.setMinPoolSize(Integer.parseInt(dbConfig.<MASK><NEW_LINE>ds.setInitialPoolSize(Integer.parseInt(dbConfig.getProperty("db.pool.initialSize", "1")));<NEW_LINE>ds.setMaxIdleTimeExcessConnections(Integer.parseInt(dbConfig.getProperty("db.pool.maxIdleTimeExcessConnections", "0")));<NEW_LINE>ds.setIdleConnectionTestPeriod(Integer.parseInt(dbConfig.getProperty("db.pool.idleConnectionTestPeriod", "10")));<NEW_LINE>ds.setMaxIdleTime(Integer.parseInt(dbConfig.getProperty("db.pool.maxIdleTime", "0")));<NEW_LINE>ds.setTestConnectionOnCheckin(Boolean.parseBoolean(dbConfig.getProperty("db.pool.testConnectionOnCheckin", "true")));<NEW_LINE>ds.setTestConnectionOnCheckout(Boolean.parseBoolean(dbConfig.getProperty("db.pool.testConnectionOnCheckout", "false")));<NEW_LINE>ds.setLoginTimeout(Integer.parseInt(dbConfig.getProperty("db.pool.loginTimeout", "0")));<NEW_LINE>ds.setMaxAdministrativeTaskTime(Integer.parseInt(dbConfig.getProperty("db.pool.maxAdministrativeTaskTime", "0")));<NEW_LINE>ds.setMaxConnectionAge(Integer.parseInt(dbConfig.getProperty("db.pool.maxConnectionAge", "0")));<NEW_LINE>ds.setMaxStatements(Integer.parseInt(dbConfig.getProperty("db.pool.maxStatements", "0")));<NEW_LINE>ds.setMaxStatementsPerConnection(Integer.parseInt(dbConfig.getProperty("db.pool.maxStatementsPerConnection", "0")));<NEW_LINE>ds.setNumHelperThreads(Integer.parseInt(dbConfig.getProperty("db.pool.numHelperThreads", "3")));<NEW_LINE>ds.setUnreturnedConnectionTimeout(Integer.parseInt(dbConfig.getProperty("db.pool.unreturnedConnectionTimeout", "0")));<NEW_LINE>ds.setDebugUnreturnedConnectionStackTraces(Boolean.parseBoolean(dbConfig.getProperty("db.pool.debugUnreturnedConnectionStackTraces", "false")));<NEW_LINE>ds.setContextClassLoaderSource("library");<NEW_LINE>ds.setPrivilegeSpawnedThreads(true);<NEW_LINE>if (dbConfig.getProperty("db.testquery") != null) {<NEW_LINE>ds.setPreferredTestQuery(dbConfig.getProperty("db.testquery"));<NEW_LINE>} else {<NEW_LINE>String driverClass = dbConfig.getProperty("db.driver");<NEW_LINE>if (driverClass.equals("com.mysql.jdbc.Driver")) {<NEW_LINE>ds.setPreferredTestQuery("/* ping */ SELECT 1");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// This check is not required, but here to make it clear that nothing changes for people<NEW_LINE>// that don't set this configuration property. It may be safely removed.<NEW_LINE>if (dbConfig.getProperty("db.isolation") != null) {<NEW_LINE>ds.setConnectionCustomizerClassName(PlayConnectionCustomizer.class.getName());<NEW_LINE>}<NEW_LINE>return ds;<NEW_LINE>} | getProperty("db.pool.minSize", "1"))); |
1,219,303 | private static boolean gfvSmallerOrEqual(GlassFishVersion gfv, List<Integer> versionNumbers) {<NEW_LINE>if (gfv.getMajor() < versionNumbers.get(0)) {<NEW_LINE>return true;<NEW_LINE>} else if (gfv.getMajor() == versionNumbers.get(0)) {<NEW_LINE>if (gfv.getMinor() < versionNumbers.get(1)) {<NEW_LINE>return true;<NEW_LINE>} else if (gfv.getMinor() == versionNumbers.get(1)) {<NEW_LINE>if (gfv.getUpdate() < versionNumbers.get(2)) {<NEW_LINE>return true;<NEW_LINE>} else if (gfv.getUpdate() == versionNumbers.get(2)) {<NEW_LINE>return gfv.getBuild(<MASK><NEW_LINE>} else {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | ) <= versionNumbers.get(3); |
1,252,091 | // LIDB4147-9 End<NEW_LINE>public void forward(String relativeUrlPath) throws ServletException, IOException {<NEW_LINE>// JSP.4.5 If the buffer was flushed, throw IllegalStateException<NEW_LINE>try {<NEW_LINE>out.clear();<NEW_LINE>} catch (IOException ex) {<NEW_LINE>throw new IllegalStateException("jsp.error.attempt_to_clear_flushed_buffer");<NEW_LINE>}<NEW_LINE>// Make sure that the response object is not the wrapper for include<NEW_LINE>while (response instanceof ServletResponseWrapperInclude) {<NEW_LINE>response = ((ServletResponseWrapperInclude) response).getResponse();<NEW_LINE>}<NEW_LINE>final String path = getAbsolutePathRelativeToContext(relativeUrlPath);<NEW_LINE>String includeUri = (String) <MASK><NEW_LINE>final ServletResponse fresponse = response;<NEW_LINE>final ServletRequest frequest = request;<NEW_LINE>if (includeUri != null)<NEW_LINE>request.removeAttribute(Constants.INC_SERVLET_PATH);<NEW_LINE>try {<NEW_LINE>context.getRequestDispatcher(path).forward(request, response);<NEW_LINE>} finally {<NEW_LINE>if (includeUri != null)<NEW_LINE>request.setAttribute(Constants.INC_SERVLET_PATH, includeUri);<NEW_LINE>request.setAttribute(Constants.FORWARD_SEEN, "true");<NEW_LINE>}<NEW_LINE>} | request.getAttribute(Constants.INC_SERVLET_PATH); |
1,178,460 | void project(Model model) {<NEW_LINE>String name = model.getName();<NEW_LINE>if (name == null) {<NEW_LINE>name = model.getArtifactId();<NEW_LINE>}<NEW_LINE>p.printStartBlock("project", name, model.getUrl());<NEW_LINE>p.println();<NEW_LINE>p.println("model_version", model.getModelVersion());<NEW_LINE>p.println("inception_year", model.getInceptionYear());<NEW_LINE>id(model);<NEW_LINE>parent(model.getParent());<NEW_LINE>p.println("packaging", model.getPackaging());<NEW_LINE>p.println();<NEW_LINE>description(model.getDescription());<NEW_LINE>developers(model.getDevelopers());<NEW_LINE>issueManagement(model.getIssueManagement());<NEW_LINE>mailingLists(model.getMailingLists());<NEW_LINE>repositories(toRepositoryArray(model.getRepositories()));<NEW_LINE>pluginRepositories(toRepositoryArray(model.getPluginRepositories()));<NEW_LINE>sourceControl(model.getScm());<NEW_LINE>distribution(model.getDistributionManagement());<NEW_LINE><MASK><NEW_LINE>dependencies(model.getDependencies());<NEW_LINE>modules(model.getModules());<NEW_LINE>managements(model.getDependencyManagement(), model.getBuild());<NEW_LINE>build(model.getBuild(), model.getBuild());<NEW_LINE>profiles(model.getProfiles());<NEW_LINE>reporting(model.getReporting());<NEW_LINE>p.printEndBlock();<NEW_LINE>} | properties(model.getProperties()); |
115,469 | private LinkDomainToLdapResponse linkDomainToLdap(Long domainId, String type, String name, Account.Type accountType) {<NEW_LINE>Validate.notNull(type, "type cannot be null. It should either be GROUP or OU");<NEW_LINE>Validate.notNull(domainId, "domainId cannot be null.");<NEW_LINE>Validate.notEmpty(name, "GROUP or OU name cannot be empty");<NEW_LINE>// Account type should be 0 or 2. check the constants in com.cloud.user.Account<NEW_LINE>Validate.isTrue(accountType == Account.Type.NORMAL || accountType == Account.Type.DOMAIN_ADMIN, "accountype should be either 0(normal user) or 2(domain admin)");<NEW_LINE>LinkType linkType = LdapManager.LinkType.valueOf(type.toUpperCase());<NEW_LINE>LdapTrustMapVO vo = _ldapTrustMapDao.persist(new LdapTrustMapVO(domainId, linkType<MASK><NEW_LINE>DomainVO domain = domainDao.findById(vo.getDomainId());<NEW_LINE>String domainUuid = "<unknown>";<NEW_LINE>if (domain == null) {<NEW_LINE>LOGGER.error("no domain in database for id " + vo.getDomainId());<NEW_LINE>} else {<NEW_LINE>domainUuid = domain.getUuid();<NEW_LINE>}<NEW_LINE>LinkDomainToLdapResponse response = new LinkDomainToLdapResponse(domainUuid, vo.getType().toString(), vo.getName(), vo.getAccountType().ordinal());<NEW_LINE>return response;<NEW_LINE>} | , name, accountType, 0)); |
1,786,878 | private static void tryMT(RegressionEnvironment env, int numSeconds, int numWriteThreads) throws InterruptedException {<NEW_LINE>RegressionPath path = new RegressionPath();<NEW_LINE>String eplCreateVariable = "@public create table varagg (c0 int, c1 int, c2 int, c3 int, c4 int, c5 int)";<NEW_LINE><MASK><NEW_LINE>String eplMerge = "on SupportBean_S0 merge varagg " + "when not matched then insert select -1 as c0, -1 as c1, -1 as c2, -1 as c3, -1 as c4, -1 as c5 " + "when matched then update set c0=id, c1=id, c2=id, c3=id, c4=id, c5=id";<NEW_LINE>env.compileDeploy(eplMerge, path);<NEW_LINE>String eplQuery = "@name('s0') select varagg.c0 as c0, varagg.c1 as c1, varagg.c2 as c2," + "varagg.c3 as c3, varagg.c4 as c4, varagg.c5 as c5 from SupportBean_S1";<NEW_LINE>env.compileDeploy(eplQuery, path).addListener("s0");<NEW_LINE>Thread[] writeThreads = new Thread[numWriteThreads];<NEW_LINE>WriteRunnable[] writeRunnables = new WriteRunnable[numWriteThreads];<NEW_LINE>for (int i = 0; i < writeThreads.length; i++) {<NEW_LINE>writeRunnables[i] = new WriteRunnable(env, i);<NEW_LINE>writeThreads[i] = new Thread(writeRunnables[i], InfraTableMTUngroupedAccessReadMergeWrite.class.getSimpleName() + "-write");<NEW_LINE>writeThreads[i].start();<NEW_LINE>}<NEW_LINE>ReadRunnable readRunnable = new ReadRunnable(env, env.listener("s0"));<NEW_LINE>Thread readThread = new Thread(readRunnable, InfraTableMTUngroupedAccessReadMergeWrite.class.getSimpleName() + "-read");<NEW_LINE>readThread.start();<NEW_LINE>Thread.sleep(numSeconds * 1000);<NEW_LINE>// join<NEW_LINE>log.info("Waiting for completion");<NEW_LINE>for (int i = 0; i < writeThreads.length; i++) {<NEW_LINE>writeRunnables[i].setShutdown(true);<NEW_LINE>writeThreads[i].join();<NEW_LINE>assertNull(writeRunnables[i].getException());<NEW_LINE>}<NEW_LINE>readRunnable.setShutdown(true);<NEW_LINE>readThread.join();<NEW_LINE>env.undeployAll();<NEW_LINE>assertNull(readRunnable.getException());<NEW_LINE>} | env.compileDeploy(eplCreateVariable, path); |
198,870 | protected void attachVolume(final AttachVolumeToVmOnHypervisorMsg msg, final NoErrorCompletion completion) {<NEW_LINE>checkStateAndStatus();<NEW_LINE>KVMHostInventory host = (KVMHostInventory) getSelfInventory();<NEW_LINE>final VolumeInventory vol = msg.getInventory();<NEW_LINE>final VmInstanceInventory vm = msg.getVmInventory();<NEW_LINE>VolumeTO to = VolumeTO.valueOfWithOutExtension(vol, host, vm.getPlatform());<NEW_LINE>final AttachVolumeToVmOnHypervisorReply reply = new AttachVolumeToVmOnHypervisorReply();<NEW_LINE>final AttachDataVolumeCmd cmd = new AttachDataVolumeCmd();<NEW_LINE>cmd.setVolume(to);<NEW_LINE>cmd.setVmUuid(msg.getVmInventory().getUuid());<NEW_LINE>cmd.getAddons().put("attachedDataVolumes", VolumeTO.valueOf(msg.getAttachedDataVolumes(), host));<NEW_LINE>Map data = new HashMap();<NEW_LINE>extEmitter.beforeAttachVolume((KVMHostInventory) getSelfInventory(), vm, vol, cmd, data);<NEW_LINE>new Http<>(attachDataVolumePath, cmd, AttachDataVolumeResponse.class).call(new ReturnValueCompletion<AttachDataVolumeResponse>(msg, completion) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void success(AttachDataVolumeResponse ret) {<NEW_LINE>if (!ret.isSuccess()) {<NEW_LINE>reply.setError(operr("failed to attach data volume[uuid:%s, installPath:%s] to vm[uuid:%s, name:%s]" + " on kvm host[uuid:%s, ip:%s], because %s", vol.getUuid(), vol.getInstallPath(), vm.getUuid(), vm.getName(), getSelf().getUuid(), getSelf().getManagementIp(), ret.getError()));<NEW_LINE>extEmitter.attachVolumeFailed((KVMHostInventory) getSelfInventory(), vm, vol, cmd, reply.getError(), data);<NEW_LINE>} else {<NEW_LINE>extEmitter.afterAttachVolume((KVMHostInventory) getSelfInventory(), vm, vol, cmd);<NEW_LINE>}<NEW_LINE>bus.reply(msg, reply);<NEW_LINE>completion.done();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void fail(ErrorCode err) {<NEW_LINE>extEmitter.attachVolumeFailed((KVMHostInventory) getSelfInventory(), vm, <MASK><NEW_LINE>reply.setError(err);<NEW_LINE>bus.reply(msg, reply);<NEW_LINE>completion.done();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | vol, cmd, err, data); |
803,722 | public static List<String> extractGivenNames(FhirContext theFhirContext, IBase theBase) {<NEW_LINE>switch(theFhirContext.getVersion().getVersion()) {<NEW_LINE>case R4:<NEW_LINE>HumanName humanNameR4 = (HumanName) theBase;<NEW_LINE>return humanNameR4.getGiven().stream().map(PrimitiveType::getValueAsString).filter(s -> !StringUtils.isEmpty(s)).<MASK><NEW_LINE>case DSTU3:<NEW_LINE>org.hl7.fhir.dstu3.model.HumanName humanNameDSTU3 = (org.hl7.fhir.dstu3.model.HumanName) theBase;<NEW_LINE>return humanNameDSTU3.getGiven().stream().map(given -> given.toString()).filter(s -> !StringUtils.isEmpty(s)).collect(Collectors.toList());<NEW_LINE>default:<NEW_LINE>throw new UnsupportedOperationException(Msg.code(1491) + "Version not supported: " + theFhirContext.getVersion().getVersion());<NEW_LINE>}<NEW_LINE>} | collect(Collectors.toList()); |
578,063 | private Item buildWand(OperatorNode<ExpressionOperator> ast) {<NEW_LINE>List<OperatorNode<ExpressionOperator>> args = ast.getArgument(1);<NEW_LINE>Preconditions.checkArgument(args.size() == 2, "Expected 2 arguments, got %s.", args.size());<NEW_LINE>Integer targetNumHits = getAnnotation(ast, TARGET_HITS, Integer.class, null, "desired number of hits to accumulate in wand");<NEW_LINE>if (targetNumHits == null) {<NEW_LINE>targetNumHits = getAnnotation(ast, TARGET_NUM_HITS, Integer.class, DEFAULT_TARGET_NUM_HITS, "desired number of hits to accumulate in wand");<NEW_LINE>}<NEW_LINE>WandItem out = new WandItem(getIndex(args.get(0)), targetNumHits);<NEW_LINE>Double scoreThreshold = getAnnotation(ast, SCORE_THRESHOLD, Double.class, null, "min score for hit inclusion");<NEW_LINE>if (scoreThreshold != null) {<NEW_LINE>out.setScoreThreshold(scoreThreshold);<NEW_LINE>}<NEW_LINE>Double thresholdBoostFactor = getAnnotation(ast, THRESHOLD_BOOST_FACTOR, Double.class, null, "boost factor used to boost threshold before comparing against upper bound score");<NEW_LINE>if (thresholdBoostFactor != null) {<NEW_LINE>out.setThresholdBoostFactor(thresholdBoostFactor);<NEW_LINE>}<NEW_LINE>return fillWeightedSet(ast, args<MASK><NEW_LINE>} | .get(1), out); |
1,232,007 | public JsonResponseManufacturingOrdersBulk execute() {<NEW_LINE>final APITransactionId transactionKey = APITransactionId.random();<NEW_LINE>try (final MDCCloseable ignore = MDC.putCloseable("TransactionIdAPI", transactionKey.toJson())) {<NEW_LINE>final List<I_PP_Order> orders = getOrders();<NEW_LINE>if (orders.isEmpty()) {<NEW_LINE>return JsonResponseManufacturingOrdersBulk.empty(transactionKey.toJson());<NEW_LINE>}<NEW_LINE>final ManufacturingOrderExportAuditBuilder auditCollector = ManufacturingOrderExportAudit.builder().transactionId(transactionKey);<NEW_LINE>final ArrayList<JsonResponseManufacturingOrder> <MASK><NEW_LINE>for (final I_PP_Order order : orders) {<NEW_LINE>try {<NEW_LINE>jsonOrders.add(toJson(order));<NEW_LINE>auditCollector.item(createExportedAuditItem(order));<NEW_LINE>} catch (final Exception ex) {<NEW_LINE>final AdIssueId adIssueId = createAdIssueId(ex);<NEW_LINE>auditCollector.item(createExportErrorAuditItem(order, adIssueId));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final ManufacturingOrderExportAudit audit = auditCollector.build();<NEW_LINE>orderAuditRepo.save(audit);<NEW_LINE>ppOrderDAO.exportStatusMassUpdate(audit.getExportStatusesByOrderId());<NEW_LINE>final int exportSequenceNumber = exportSequenceNumberProvider.provideNextExportSequenceNumber();<NEW_LINE>return JsonResponseManufacturingOrdersBulk.builder().transactionKey(transactionKey.toJson()).exportSequenceNumber(exportSequenceNumber).items(jsonOrders).hasMoreItems(query.getLimit().isLimitHitOrExceeded(jsonOrders)).build();<NEW_LINE>}<NEW_LINE>} | jsonOrders = new ArrayList<>(); |
606,852 | private boolean addFrameworkFiles() {<NEW_LINE>List<WebFrameworkProvider> providers = WebFrameworks.getFrameworks();<NEW_LINE>boolean result = false;<NEW_LINE>start: for (int i = 0; i < providers.size(); i++) {<NEW_LINE>WebFrameworkProvider provider = (WebFrameworkProvider) providers.get(i);<NEW_LINE>FileObject wmBase = getWebModule().getDocumentBase();<NEW_LINE>File[] files = null;<NEW_LINE>if (wmBase != null) {<NEW_LINE>WebModule wm = WebModule.getWebModule(wmBase);<NEW_LINE>if (wm != null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (files != null) {<NEW_LINE>for (int j = 0; j < files.length; j++) {<NEW_LINE>FileObject fo = FileUtil.toFileObject(files[j]);<NEW_LINE>if (fo != null) {<NEW_LINE>myKeys.add(fo);<NEW_LINE>// XXX - do we need listeners on these files?<NEW_LINE>// fo.addFileChangeListener(anyFileListener);<NEW_LINE>}<NEW_LINE>if (Thread.interrupted()) {<NEW_LINE>result = true;<NEW_LINE>break start;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | files = provider.getConfigurationFiles(wm); |
34,629 | final CancelRetrievalResult executeCancelRetrieval(CancelRetrievalRequest cancelRetrievalRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(cancelRetrievalRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CancelRetrievalRequest> request = null;<NEW_LINE>Response<CancelRetrievalResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CancelRetrievalRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(cancelRetrievalRequest));<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, "Storage Gateway");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CancelRetrieval");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CancelRetrievalResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CancelRetrievalResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | endClientExecution(awsRequestMetrics, request, response); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.