idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
628,920 | protected ByteBuffer control(EPID caller, int command, ByteBuffer cmd) throws Pausable {<NEW_LINE>switch(command) {<NEW_LINE>case INFLATE_INIT:<NEW_LINE>{<NEW_LINE>this.inflater = new Inflater();<NEW_LINE>this.inflater.inflateInit(true);<NEW_LINE>return reply_ok();<NEW_LINE>}<NEW_LINE>case INFLATE_INIT2:<NEW_LINE>{<NEW_LINE>int ws = cmd.getInt();<NEW_LINE>this.inflater = new Inflater();<NEW_LINE>this.inflater.inflateInit(ws);<NEW_LINE>return reply_ok();<NEW_LINE>}<NEW_LINE>case DEFLATE_INIT2:<NEW_LINE>{<NEW_LINE><MASK><NEW_LINE>int method = cmd.getInt();<NEW_LINE>int bits = cmd.getInt();<NEW_LINE>int memlevel = cmd.getInt();<NEW_LINE>int strategy = cmd.getInt();<NEW_LINE>this.deflater = new Deflater();<NEW_LINE>this.deflater.deflateInit(level, bits, memlevel);<NEW_LINE>this.deflater.deflateParams(level, strategy);<NEW_LINE>return reply_ok();<NEW_LINE>}<NEW_LINE>case INFLATE:<NEW_LINE>{<NEW_LINE>int flush_mode = cmd.getInt();<NEW_LINE>int err = do_inflate(flush_mode);<NEW_LINE>if (err == JZlib.Z_NEED_DICT) {<NEW_LINE>return reply_need_dict(inflater.getAdler());<NEW_LINE>}<NEW_LINE>return reply_ok();<NEW_LINE>}<NEW_LINE>case INFLATE_END:<NEW_LINE>{<NEW_LINE>do_inflate(Z_FINISH);<NEW_LINE>return reply_ok();<NEW_LINE>}<NEW_LINE>case DEFLATE:<NEW_LINE>{<NEW_LINE>int flush_mode = cmd.getInt();<NEW_LINE>do_deflate(flush_mode);<NEW_LINE>return reply_ok();<NEW_LINE>}<NEW_LINE>case DEFLATE_END:<NEW_LINE>{<NEW_LINE>do_deflate(Z_FINISH);<NEW_LINE>return reply_ok();<NEW_LINE>}<NEW_LINE>case CRC32_0:<NEW_LINE>{<NEW_LINE>if (deflater != null) {<NEW_LINE>return reply_int(deflater.getAdler());<NEW_LINE>}<NEW_LINE>if (inflater != null) {<NEW_LINE>return reply_int(inflater.getAdler());<NEW_LINE>}<NEW_LINE>return reply_int(0);<NEW_LINE>}<NEW_LINE>case CRC32_1:<NEW_LINE>{<NEW_LINE>CRC32 crc = new CRC32();<NEW_LINE>crc.update(cmd.array(), cmd.arrayOffset() + cmd.position(), cmd.remaining());<NEW_LINE>return reply_int((int) crc.getValue());<NEW_LINE>}<NEW_LINE>case CRC32_2:<NEW_LINE>{<NEW_LINE>CRC32 crc = new CRC32();<NEW_LINE>long init = cmd.getInt() & 0xffffffffL;<NEW_LINE>crc.reset(init);<NEW_LINE>crc.update(cmd.array(), cmd.arrayOffset() + cmd.position(), cmd.remaining());<NEW_LINE>return reply_int((int) crc.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw new erjang.NotImplemented("command=" + command + "; data=" + EBinary.make(cmd));<NEW_LINE>} | int level = cmd.getInt(); |
1,422,223 | private static void runAssertion(RegressionEnvironment env, String eventTypeName, RegressionPath path) {<NEW_LINE>String xml = "<Event IsTriggering=\"True\">\n" + "<Field Name=\"A\" Value=\"987654321\"/>\n" + "<Field Name=\"B\" Value=\"2196958725202\"/>\n" + "<Field Name=\"C\" Value=\"1232363702\"/>\n" + "<Participants>\n" + "<Participant>\n" + "<Field Name=\"A\" Value=\"9876543210\"/>\n" + "<Field Name=\"B\" Value=\"966607340\"/>\n" <MASK><NEW_LINE>env.compileDeploy("@name('s0') select * from " + eventTypeName, path).addListener("s0");<NEW_LINE>sendXMLEvent(env, xml, eventTypeName);<NEW_LINE>env.assertPropsNew("s0", "A".split(","), new Object[] { new Object[] { "987654321", "9876543210" } });<NEW_LINE>env.undeployAll();<NEW_LINE>} | + "<Field Name=\"D\" Value=\"353263010930650\"/>\n" + "</Participant>\n" + "</Participants>\n" + "</Event>"; |
605,346 | private SAML11AssertionType parseBaseAttributes(StartElement nextElement) throws ParsingException {<NEW_LINE>Attribute idAttribute = nextElement.getAttributeByName(new QName(SAML11Constants.ASSERTIONID));<NEW_LINE>if (idAttribute == null)<NEW_LINE>throw logger.parserRequiredAttribute("AssertionID");<NEW_LINE>String id = StaxParserUtil.getAttributeValue(idAttribute);<NEW_LINE>Attribute majVersionAttribute = nextElement.getAttributeByName(<MASK><NEW_LINE>String majVersion = StaxParserUtil.getAttributeValue(majVersionAttribute);<NEW_LINE>StringUtil.match("1", majVersion);<NEW_LINE>Attribute minVersionAttribute = nextElement.getAttributeByName(new QName(SAML11Constants.MINOR_VERSION));<NEW_LINE>String minVersion = StaxParserUtil.getAttributeValue(minVersionAttribute);<NEW_LINE>StringUtil.match("1", minVersion);<NEW_LINE>Attribute issueInstantAttribute = nextElement.getAttributeByName(new QName(JBossSAMLConstants.ISSUE_INSTANT.get()));<NEW_LINE>XMLGregorianCalendar issueInstant = XMLTimeUtil.parse(StaxParserUtil.getAttributeValue(issueInstantAttribute));<NEW_LINE>return new SAML11AssertionType(id, issueInstant);<NEW_LINE>} | new QName(SAML11Constants.MAJOR_VERSION)); |
1,362,149 | public com.amazonaws.services.cloudtrail.model.TrailNotFoundException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.cloudtrail.model.TrailNotFoundException trailNotFoundException = new com.amazonaws.services.<MASK><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>} 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 trailNotFoundException;<NEW_LINE>} | cloudtrail.model.TrailNotFoundException(null); |
1,377,612 | protected void configureGraphicalViewer() {<NEW_LINE>super.configureGraphicalViewer();<NEW_LINE>this.getGraphicalViewer().getControl().setBackground(UIUtils.getColorRegistry().get(ERDUIConstants.COLOR_ERD_DIAGRAM_BACKGROUND));<NEW_LINE>GraphicalViewer graphicalViewer = getGraphicalViewer();<NEW_LINE>DBPPreferenceStore store = ERDUIActivator.getDefault().getPreferences();<NEW_LINE>graphicalViewer.setProperty(SnapToGrid.PROPERTY_GRID_ENABLED, store.getBoolean(ERDUIConstants.PREF_GRID_ENABLED));<NEW_LINE>graphicalViewer.setProperty(SnapToGrid.PROPERTY_GRID_VISIBLE, store.getBoolean(ERDUIConstants.PREF_GRID_ENABLED));<NEW_LINE>graphicalViewer.setProperty(SnapToGrid.PROPERTY_GRID_SPACING, new Dimension(store.getInt(ERDUIConstants.PREF_GRID_WIDTH), store.getInt(ERDUIConstants.PREF_GRID_HEIGHT)));<NEW_LINE>// initialize actions<NEW_LINE>createActions();<NEW_LINE>// Setup zoom manager<NEW_LINE>ZoomManager zoomManager = rootPart.getZoomManager();<NEW_LINE>List<String> zoomLevels = new ArrayList<>(3);<NEW_LINE>zoomLevels.add(ZoomManager.FIT_ALL);<NEW_LINE>zoomLevels.add(ZoomManager.FIT_WIDTH);<NEW_LINE>zoomLevels.add(ZoomManager.FIT_HEIGHT);<NEW_LINE>zoomManager.setZoomLevelContributions(zoomLevels);<NEW_LINE>zoomManager.setZoomLevels(new double[] { .1, .1, .2, .3, .5, .6, .7, .8, .9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.5, 3, 4 });<NEW_LINE>IAction zoomIn = new ZoomInAction(zoomManager);<NEW_LINE>IAction zoomOut = new ZoomOutAction(zoomManager);<NEW_LINE>addAction(zoomIn);<NEW_LINE>addAction(zoomOut);<NEW_LINE>addAction(new DiagramToggleHandAction<MASK><NEW_LINE>graphicalViewer.addSelectionChangedListener(event -> {<NEW_LINE>String status;<NEW_LINE>IStructuredSelection selection = (IStructuredSelection) event.getSelection();<NEW_LINE>if (selection.isEmpty()) {<NEW_LINE>status = "";<NEW_LINE>} else if (selection.size() == 1) {<NEW_LINE>status = CommonUtils.toString(selection.getFirstElement());<NEW_LINE>} else {<NEW_LINE>status = selection.size() + " objects";<NEW_LINE>}<NEW_LINE>if (progressControl != null) {<NEW_LINE>progressControl.setInfo(status);<NEW_LINE>}<NEW_LINE>updateActions(editPartActionIDs);<NEW_LINE>});<NEW_LINE>} | (editDomain.getPaletteViewer())); |
385,429 | public int numDecodings(String s) {<NEW_LINE>if (s == null || s.length() == 0) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>char[] chars = s.toCharArray();<NEW_LINE>int[] memo = new <MASK><NEW_LINE>memo[chars.length] = 1;<NEW_LINE>int before = 0;<NEW_LINE>for (int i = chars.length - 1; i >= 0; i--) {<NEW_LINE>int curNum = chars[i] - '0';<NEW_LINE>if (curNum == 0) {<NEW_LINE>memo[i] = 0;<NEW_LINE>} else if (curNum == 1 || (curNum == 2 && before < 7)) {<NEW_LINE>memo[i] = memo[i + 1] + memo[i + 2];<NEW_LINE>} else {<NEW_LINE>memo[i] = memo[i + 1];<NEW_LINE>}<NEW_LINE>before = curNum;<NEW_LINE>}<NEW_LINE>return memo[0];<NEW_LINE>} | int[chars.length + 2]; |
843,609 | public static <T> ProcessorMetaSupplier streamJmsTopicP(@Nullable String destination, boolean isSharedConsumer, @Nonnull ProcessingGuarantee maxGuarantee, @Nonnull EventTimePolicy<? super T> eventTimePolicy, @Nonnull SupplierEx<? extends Connection> newConnectionFn, @Nonnull FunctionEx<? super Session, ? extends MessageConsumer> consumerFn, @Nonnull FunctionEx<? super Message, ?> messageIdFn, @Nonnull FunctionEx<? super Message, ? extends T> projectionFn) {<NEW_LINE>ProcessorSupplier pSupplier = new StreamJmsP.Supplier<>(destination, maxGuarantee, eventTimePolicy, newConnectionFn, consumerFn, messageIdFn, projectionFn);<NEW_LINE>ConnectorPermission permission = ConnectorPermission.jms(destination, ACTION_READ);<NEW_LINE>return isSharedConsumer ? ProcessorMetaSupplier.preferLocalParallelismOne(permission, pSupplier) : ProcessorMetaSupplier.forceTotalParallelismOne(<MASK><NEW_LINE>} | pSupplier, newUnsecureUuidString(), permission); |
1,464,500 | protected void internalRollback(Xid xid) throws XAException {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())<NEW_LINE>SibTr.entry(this, tc, "internalRollback", xid);<NEW_LINE>try {<NEW_LINE>CommsByteBuffer request = getCommsByteBuffer();<NEW_LINE>request.putInt(getTransactionId());<NEW_LINE>request.putXid(xid);<NEW_LINE>if (fapLevel >= JFapChannelConstants.FAP_VERSION_5) {<NEW_LINE>request.put((byte) <MASK><NEW_LINE>}<NEW_LINE>CommsByteBuffer reply = jfapExchange(request, JFapChannelConstants.SEG_XAROLLBACK, getLowestMessagePriority(), true);<NEW_LINE>try {<NEW_LINE>reply.checkXACommandCompletionStatus(JFapChannelConstants.SEG_XAROLLBACK_R, getConversation());<NEW_LINE>} finally {<NEW_LINE>reply.release();<NEW_LINE>}<NEW_LINE>} catch (XAException xa) {<NEW_LINE>// No FFDC Code needed<NEW_LINE>// Simply re-throw...<NEW_LINE>throw xa;<NEW_LINE>} catch (Exception e) {<NEW_LINE>FFDCFilter.processException(e, CLASS_NAME + ".internalRollback", CommsConstants.SIXARESOURCEPROXY_ROLLBACK_01, this);<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())<NEW_LINE>SibTr.debug(this, tc, "Caught a comms problem:", e);<NEW_LINE>throw new XAException(XAException.XAER_RMFAIL);<NEW_LINE>}<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())<NEW_LINE>SibTr.exit(this, tc, "internalRollback");<NEW_LINE>} | (isMSResource ? 0x01 : 0x00)); |
653,062 | private void predictSubXFullYUnSafe(byte[] ref, int rx, int ix, int ry, int refW, int refH, int refVertStep, int refVertOff, int[] tgt, int tgtY, int tgtW, int tgtH, int tgtVertStep) {<NEW_LINE>int[] coeff = COEFF[ix];<NEW_LINE>int tgtOff = tgtW * tgtY;<NEW_LINE>int lfTgt = tgtVertStep * tgtW;<NEW_LINE>for (int i = 0; i < tgtH; i++) {<NEW_LINE>int y = ((i + ry) << refVertStep) + refVertOff;<NEW_LINE>for (int j = 0; j < tgtW; j++) {<NEW_LINE>tgt[tgtOff++] = (getPix6(ref, refW, refH, j + rx, y, refVertStep, refVertOff, <MASK><NEW_LINE>}<NEW_LINE>tgtOff += lfTgt;<NEW_LINE>}<NEW_LINE>} | coeff) + 64) >> 7; |
1,066,966 | public void openJuliLog() {<NEW_LINE>// ensure only one thread will be opened<NEW_LINE>synchronized (juliLogLock) {<NEW_LINE>if (juliLogViewer == null || !juliLogViewer.isOpen()) {<NEW_LINE>if (juliLogViewer != null) {<NEW_LINE>juliLogViewer.removeAllLogViewerStopListener();<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>TomcatProperties tp = manager.getTomcatProperties();<NEW_LINE>// NOI18N<NEW_LINE>juliLogViewer = new LogViewer(manager, null, null, null, <MASK><NEW_LINE>juliLogViewer.setDisplayName(NbBundle.getMessage(LogManager.class, "TXT_JuliLogDisplayName", tp.getDisplayName()));<NEW_LINE>} catch (UnsupportedLoggerException e) {<NEW_LINE>// should never occur<NEW_LINE>Logger.getLogger(LogManager.class.getName()).log(Level.INFO, null, e);<NEW_LINE>return;<NEW_LINE>} catch (NullPointerException npe) {<NEW_LINE>Logger.getLogger(LogManager.class.getName()).log(Level.INFO, null, npe);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>juliLogViewer.addLogViewerStopListener(new LogViewer.LogViewerStopListener() {<NEW_LINE><NEW_LINE>public void callOnStop() {<NEW_LINE>synchronized (juliLogLock) {<NEW_LINE>juliLogViewer = null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>juliLogViewer.start();<NEW_LINE>}<NEW_LINE>juliLogViewer.takeFocus();<NEW_LINE>}<NEW_LINE>} | "localhost.", null, true, false); |
1,172,155 | private void addDyeRecipes(Consumer<FinishedRecipe> consumer, String basePath) {<NEW_LINE>// Black<NEW_LINE>dye(consumer, basePath, Items.BLACK_DYE, <MASK><NEW_LINE>// Blue<NEW_LINE>dye(consumer, basePath, Items.BLUE_DYE, false, EnumColor.DARK_BLUE, "blue_dye");<NEW_LINE>dye(consumer, basePath, Items.BLUE_DYE, true, EnumColor.DARK_BLUE, "double_blue_dye");<NEW_LINE>// Brown<NEW_LINE>dye(consumer, basePath, Items.BROWN_DYE, false, EnumColor.BROWN, "brown_dye");<NEW_LINE>// Cyan<NEW_LINE>dye(consumer, basePath, Items.CYAN_DYE, false, EnumColor.DARK_AQUA, "cyan_dye", BYGBlocks.WARPED_CACTUS);<NEW_LINE>dye(consumer, basePath, Items.CYAN_DYE, true, EnumColor.DARK_AQUA, "double_cyan_dye");<NEW_LINE>// Green<NEW_LINE>dye(consumer, basePath, Items.GREEN_DYE, false, EnumColor.DARK_GREEN, "green_dye");<NEW_LINE>// Light Blue<NEW_LINE>dye(consumer, basePath, Items.LIGHT_BLUE_DYE, false, EnumColor.INDIGO, "light_blue_dye");<NEW_LINE>// Light Gray<NEW_LINE>dye(consumer, basePath, Items.LIGHT_GRAY_DYE, false, EnumColor.GRAY, "light_gray_dye");<NEW_LINE>// Lime<NEW_LINE>dye(consumer, basePath, Items.LIME_DYE, false, EnumColor.BRIGHT_GREEN, "lime_dye");<NEW_LINE>// Magenta<NEW_LINE>dye(consumer, basePath, Items.MAGENTA_DYE, false, EnumColor.PINK, "magenta_dye");<NEW_LINE>// Orange<NEW_LINE>dye(consumer, basePath, Items.ORANGE_DYE, false, EnumColor.ORANGE, "orange_dye");<NEW_LINE>// Pink<NEW_LINE>dye(consumer, basePath, Items.PINK_DYE, false, EnumColor.BRIGHT_PINK, "pink_dye");<NEW_LINE>dye(consumer, basePath, Items.PINK_DYE, true, EnumColor.BRIGHT_PINK, "double_pink_dye");<NEW_LINE>// Purple<NEW_LINE>dye(consumer, basePath, Items.PURPLE_DYE, false, EnumColor.PURPLE, "purple_dye");<NEW_LINE>dye(consumer, basePath, Items.PURPLE_DYE, true, EnumColor.PURPLE, "double_purple_dye");<NEW_LINE>// Red<NEW_LINE>dye(consumer, basePath, Items.RED_DYE, false, EnumColor.RED, "red_dye");<NEW_LINE>// White<NEW_LINE>dye(consumer, basePath, Items.WHITE_DYE, false, EnumColor.WHITE, "white_dye", BYGBlocks.ODDITY_CACTUS);<NEW_LINE>// Yellow<NEW_LINE>dye(consumer, basePath, Items.YELLOW_DYE, false, EnumColor.YELLOW, "yellow_dye");<NEW_LINE>} | false, EnumColor.BLACK, "black_dye"); |
1,691,872 | private ModifiersTree changeModifiers(ModifiersTree modifiersTree, boolean usageOutsideOfPackage, boolean usageOutsideOfType) {<NEW_LINE>final Set<Modifier> flags = modifiersTree.getFlags();<NEW_LINE>Set<Modifier> newModifiers = flags.isEmpty() ? EnumSet.noneOf(Modifier.class) : EnumSet.copyOf(flags);<NEW_LINE>switch(visibility) {<NEW_LINE>case ESCALATE:<NEW_LINE>if (usageOutsideOfPackage) {<NEW_LINE>if (!flags.contains(Modifier.PUBLIC)) {<NEW_LINE>// TODO: if only subtype, change protected<NEW_LINE>newModifiers.removeAll(ALL_ACCESS_MODIFIERS);<NEW_LINE>newModifiers.add(Modifier.PUBLIC);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (usageOutsideOfType) {<NEW_LINE>if (flags.contains(Modifier.PRIVATE)) {<NEW_LINE>newModifiers.removeAll(ALL_ACCESS_MODIFIERS);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case ASIS:<NEW_LINE>default:<NEW_LINE>break;<NEW_LINE>case PUBLIC:<NEW_LINE>newModifiers.removeAll(ALL_ACCESS_MODIFIERS);<NEW_LINE>newModifiers.add(Modifier.PUBLIC);<NEW_LINE>break;<NEW_LINE>case PROTECTED:<NEW_LINE>newModifiers.removeAll(ALL_ACCESS_MODIFIERS);<NEW_LINE>newModifiers.add(Modifier.PROTECTED);<NEW_LINE>break;<NEW_LINE>case DEFAULT:<NEW_LINE>newModifiers.removeAll(ALL_ACCESS_MODIFIERS);<NEW_LINE>break;<NEW_LINE>case PRIVATE:<NEW_LINE>newModifiers.removeAll(ALL_ACCESS_MODIFIERS);<NEW_LINE><MASK><NEW_LINE>break;<NEW_LINE>}<NEW_LINE>ModifiersTree modifiers = make.Modifiers(newModifiers, modifiersTree.getAnnotations());<NEW_LINE>return modifiers;<NEW_LINE>} | newModifiers.add(Modifier.PRIVATE); |
396,005 | public void init(ServletConfig servletConfig) throws ServletException {<NEW_LINE>super.init(servletConfig);<NEW_LINE>ConfigManager config = (ConfigManager) getServletContext().getAttribute(ConfigManager.CONFIG_MANAGER);<NEW_LINE>enabled = !config.getBoolean(DISABLE_PROXY, false);<NEW_LINE>if (!enabled) {<NEW_LINE>LOG.info("Proxy servlet is disabled");<NEW_LINE>// proxy servlet is disabled so won't run any further initialisation<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String allowlistStr = config.get(PROXY_ALLOWLIST, servletConfig.getInitParameter(PROXY_ALLOWLIST));<NEW_LINE>boolean probeLocal = config.getBoolean(LOCAL_ADDRESS_PROBING, true);<NEW_LINE>allowlist <MASK><NEW_LINE>String doForwardIPString = servletConfig.getInitParameter(P_FORWARDEDFOR);<NEW_LINE>if (doForwardIPString != null) {<NEW_LINE>this.doForwardIP = Boolean.parseBoolean(doForwardIPString);<NEW_LINE>}<NEW_LINE>String doLogStr = servletConfig.getInitParameter(P_LOG);<NEW_LINE>if (doLogStr != null) {<NEW_LINE>this.doLog = Boolean.parseBoolean(doLogStr);<NEW_LINE>}<NEW_LINE>cookieStore = new BasicCookieStore();<NEW_LINE>HttpClientBuilder httpClientBuilder = HttpClients.custom().setDefaultCookieStore(cookieStore).useSystemProperties();<NEW_LINE>if (System.getProperty(PROXY_ACCEPT_SELF_SIGNED_CERTS) != null) {<NEW_LINE>acceptSelfSignedCerts = Boolean.parseBoolean(System.getProperty(PROXY_ACCEPT_SELF_SIGNED_CERTS));<NEW_LINE>} else if (System.getenv(PROXY_ACCEPT_SELF_SIGNED_CERTS_ENV) != null) {<NEW_LINE>acceptSelfSignedCerts = Boolean.parseBoolean(System.getenv(PROXY_ACCEPT_SELF_SIGNED_CERTS_ENV));<NEW_LINE>}<NEW_LINE>if (acceptSelfSignedCerts) {<NEW_LINE>try {<NEW_LINE>SSLContextBuilder builder = new SSLContextBuilder();<NEW_LINE>builder.loadTrustMaterial(null, (X509Certificate[] x509Certificates, String s) -> true);<NEW_LINE>SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(builder.build(), SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);<NEW_LINE>httpClientBuilder.setSSLSocketFactory(sslsf);<NEW_LINE>} catch (NoSuchAlgorithmException e) {<NEW_LINE>throw new ServletException(e);<NEW_LINE>} catch (KeyStoreException e) {<NEW_LINE>throw new ServletException(e);<NEW_LINE>} catch (KeyManagementException e) {<NEW_LINE>throw new ServletException(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>proxyClient = httpClientBuilder.build();<NEW_LINE>} | = new ProxyAllowlist(allowlistStr, probeLocal); |
1,764,982 | public static // fun_name? argument_definition_list clause_guard? clause_body<NEW_LINE>boolean fun_clause(PsiBuilder b, int l) {<NEW_LINE>if (!recursion_guard_(b, l, "fun_clause"))<NEW_LINE>return false;<NEW_LINE>if (!nextTokenIs(b, "<fun clause>", ERL_PAR_LEFT, ERL_VAR))<NEW_LINE>return false;<NEW_LINE>boolean r, p;<NEW_LINE>Marker m = enter_section_(b, l, _NONE_, ERL_FUN_CLAUSE, "<fun clause>");<NEW_LINE>r = <MASK><NEW_LINE>r = r && argument_definition_list(b, l + 1);<NEW_LINE>// pin = 2<NEW_LINE>p = r;<NEW_LINE>r = r && report_error_(b, fun_clause_2(b, l + 1));<NEW_LINE>r = p && clause_body(b, l + 1) && r;<NEW_LINE>exit_section_(b, l, m, r, p, null);<NEW_LINE>return r || p;<NEW_LINE>} | fun_clause_0(b, l + 1); |
454,911 | private boolean fromPlatform(FileObject fo) {<NEW_LINE>boolean fromPlatform = false;<NEW_LINE>FileObject archive = FileUtil.getArchiveFile(fo);<NEW_LINE>if (archive != null) {<NEW_LINE>FileObject <MASK><NEW_LINE>if (root != null) {<NEW_LINE>if (cachedPlatformRoots.contains(root)) {<NEW_LINE>fromPlatform = true;<NEW_LINE>}<NEW_LINE>JavaPlatformManager manager = JavaPlatformManager.getDefault();<NEW_LINE>for (JavaPlatform javaPlatform : manager.getInstalledPlatforms()) {<NEW_LINE>if (javaPlatform.getSourceFolders().contains(root) || javaPlatform.getStandardLibraries().contains(root) || javaPlatform.getBootstrapLibraries().contains(root)) {<NEW_LINE>fromPlatform = true;<NEW_LINE>if (DEPENDENCIES) {<NEW_LINE>usedFilters.add(JavaWhereUsedFilters.PLATFORM.getKey());<NEW_LINE>}<NEW_LINE>cachedPlatformRoots.add(root);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return fromPlatform;<NEW_LINE>} | root = FileUtil.getArchiveRoot(archive); |
1,451,305 | private static void visitEnvironmentSquenceItems(@NotNull Consumer<Pair<String, PsiElement>> consumer, @NotNull YAMLKeyValue yamlKeyValue) {<NEW_LINE>YAMLKeyValue environment = YamlHelper.getYamlKeyValue(yamlKeyValue, "environment");<NEW_LINE>if (environment != null) {<NEW_LINE>// FOOBAR=0<NEW_LINE>for (YAMLSequenceItem yamlSequenceItem : YamlHelper.getSequenceItems(environment)) {<NEW_LINE>YAMLValue value = yamlSequenceItem.getValue();<NEW_LINE>if (value instanceof YAMLScalar) {<NEW_LINE>String textValue = ((YAMLScalar) value).getTextValue();<NEW_LINE>if (StringUtils.isNotBlank(textValue)) {<NEW_LINE>String[] split = textValue.split("=");<NEW_LINE>if (split.length > 1) {<NEW_LINE>consumer.accept(Pair.create(split[0], value));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// FOOBAR: 0<NEW_LINE>YAMLMapping childOfType = PsiTreeUtil.<MASK><NEW_LINE>if (childOfType != null) {<NEW_LINE>for (Map.Entry<String, YAMLValue> entry : YamlHelper.getYamlArrayKeyMap(childOfType).entrySet()) {<NEW_LINE>consumer.accept(Pair.create(entry.getKey(), entry.getValue()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getChildOfType(environment, YAMLMapping.class); |
1,460,328 | public void addResourceHandlers(ResourceHandlerRegistry registry) {<NEW_LINE>// For examples using Spring 4.1.0<NEW_LINE>if ((env.getProperty("resource.handler.conf")).equals("4.1.0")) {<NEW_LINE>registry.addResourceHandler("/js/**").addResourceLocations("/js/").setCachePeriod(3600).resourceChain(true).addResolver(new EncodedResourceResolver())<MASK><NEW_LINE>registry.addResourceHandler("/resources/**").addResourceLocations("/resources/", "classpath:/other-resources/").setCachePeriod(3600).resourceChain(true).addResolver(new PathResourceResolver());<NEW_LINE>registry.addResourceHandler("/files/**").addResourceLocations("file:/Users/Elena/").setCachePeriod(3600).resourceChain(true).addResolver(new PathResourceResolver());<NEW_LINE>registry.addResourceHandler("/other-files/**").addResourceLocations("file:/Users/Elena/").setCachePeriod(3600).resourceChain(true).addResolver(new EncodedResourceResolver());<NEW_LINE>} else // For examples using Spring 4.0.7<NEW_LINE>if ((env.getProperty("resource.handler.conf")).equals("4.0.7")) {<NEW_LINE>registry.addResourceHandler("/resources/**").addResourceLocations("/", "/resources/", "classpath:/other-resources/");<NEW_LINE>registry.addResourceHandler("/files/**").addResourceLocations("file:/Users/Elena/");<NEW_LINE>}<NEW_LINE>} | .addResolver(new PathResourceResolver()); |
700,675 | public void adjustMouseSpeedLive() {<NEW_LINE>AlertDialog.Builder b = new AlertDialog.Builder(this);<NEW_LINE>b.setTitle(R.string.mcl_setting_title_mousespeed);<NEW_LINE>View v = LayoutInflater.from(this).inflate(R.layout.dialog_live_mouse_speed_editor, null);<NEW_LINE>final SeekBar sb = v.<MASK><NEW_LINE>final TextView tv = v.findViewById(R.id.mouseSpeedTV);<NEW_LINE>sb.setMax(275);<NEW_LINE>tmpMouseSpeed = (int) ((LauncherPreferences.PREF_MOUSESPEED * 100));<NEW_LINE>sb.setProgress(tmpMouseSpeed - 25);<NEW_LINE>tv.setText(tmpMouseSpeed + " %");<NEW_LINE>sb.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onProgressChanged(SeekBar seekBar, int i, boolean b) {<NEW_LINE>tmpMouseSpeed = i + 25;<NEW_LINE>tv.setText(tmpMouseSpeed + " %");<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onStartTrackingTouch(SeekBar seekBar) {<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onStopTrackingTouch(SeekBar seekBar) {<NEW_LINE>}<NEW_LINE>});<NEW_LINE>b.setView(v);<NEW_LINE>b.setPositiveButton(android.R.string.ok, (dialogInterface, i) -> {<NEW_LINE>LauncherPreferences.PREF_MOUSESPEED = ((float) tmpMouseSpeed) / 100f;<NEW_LINE>LauncherPreferences.DEFAULT_PREF.edit().putInt("mousespeed", tmpMouseSpeed).commit();<NEW_LINE>dialogInterface.dismiss();<NEW_LINE>System.gc();<NEW_LINE>});<NEW_LINE>b.setNegativeButton(android.R.string.cancel, (dialogInterface, i) -> {<NEW_LINE>dialogInterface.dismiss();<NEW_LINE>System.gc();<NEW_LINE>});<NEW_LINE>b.show();<NEW_LINE>} | findViewById(R.id.mouseSpeed); |
490,025 | private static BundleEntryComponent medicationClaim(Person person, BundleEntryComponent personEntry, Bundle bundle, BundleEntryComponent encounterEntry, Claim claim, BundleEntryComponent medicationEntry) {<NEW_LINE>org.hl7.fhir.r4.model.Claim claimResource = new org.hl7.fhir.r4.model.Claim();<NEW_LINE>org.hl7.fhir.r4.model.Encounter encounterResource = (org.hl7.fhir.r4.model.Encounter) encounterEntry.getResource();<NEW_LINE>claimResource.setStatus(ClaimStatus.ACTIVE);<NEW_LINE>CodeableConcept type = new CodeableConcept();<NEW_LINE>type.getCodingFirstRep().setSystem("http://terminology.hl7.org/CodeSystem/claim-type").setCode("pharmacy");<NEW_LINE>claimResource.setType(type);<NEW_LINE>claimResource.setUse(org.hl7.fhir.r4.model.Claim.Use.CLAIM);<NEW_LINE>// Get the insurance info at the time that the encounter occurred.<NEW_LINE>InsuranceComponent insuranceComponent = new InsuranceComponent();<NEW_LINE>insuranceComponent.setSequence(1);<NEW_LINE>insuranceComponent.setFocal(true);<NEW_LINE>insuranceComponent.setCoverage(new Reference().setDisplay(claim.payer.getName()));<NEW_LINE>claimResource.addInsurance(insuranceComponent);<NEW_LINE>// duration of encounter<NEW_LINE>claimResource.setBillablePeriod(encounterResource.getPeriod());<NEW_LINE>claimResource.setCreated(encounterResource.<MASK><NEW_LINE>claimResource.setPatient(new Reference(personEntry.getFullUrl()));<NEW_LINE>claimResource.setProvider(encounterResource.getServiceProvider());<NEW_LINE>// set the required priority<NEW_LINE>CodeableConcept priority = new CodeableConcept();<NEW_LINE>priority.getCodingFirstRep().setSystem("http://terminology.hl7.org/CodeSystem/processpriority").setCode("normal");<NEW_LINE>claimResource.setPriority(priority);<NEW_LINE>// add item for encounter<NEW_LINE>claimResource.addItem(new ItemComponent(new PositiveIntType(1), encounterResource.getTypeFirstRep()).addEncounter(new Reference(encounterEntry.getFullUrl())));<NEW_LINE>// add prescription.<NEW_LINE>claimResource.setPrescription(new Reference(medicationEntry.getFullUrl()));<NEW_LINE>Money moneyResource = new Money();<NEW_LINE>moneyResource.setValue(claim.getTotalClaimCost());<NEW_LINE>moneyResource.setCurrency("USD");<NEW_LINE>claimResource.setTotal(moneyResource);<NEW_LINE>return newEntry(person, bundle, claimResource);<NEW_LINE>} | getPeriod().getEnd()); |
201,415 | public StringAggState removeFromAggregatedState(RamAccounting ramAccounting, StringAggState previousAggState, Input[] stateToRemove) {<NEW_LINE>String expression = (String) stateToRemove[0].value();<NEW_LINE>if (expression == null) {<NEW_LINE>return previousAggState;<NEW_LINE>}<NEW_LINE>String delimiter = (String) stateToRemove[1].value();<NEW_LINE>int indexOfExpression = previousAggState.values.indexOf(expression);<NEW_LINE>if (indexOfExpression > -1) {<NEW_LINE>ramAccounting.addBytes(-LIST_ENTRY_OVERHEAD + StringSizeEstimator.estimate(expression));<NEW_LINE>if (delimiter != null) {<NEW_LINE>String elementNextToExpression = previousAggState.values.get(indexOfExpression + 1);<NEW_LINE>if (elementNextToExpression.equalsIgnoreCase(delimiter)) {<NEW_LINE>previousAggState.values.remove(indexOfExpression + 1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>return previousAggState;<NEW_LINE>} | previousAggState.values.remove(indexOfExpression); |
1,484,658 | private void processHeadOrGetSingleClient(String clientId, OidcOAuth20ClientProvider clientProvider, HttpServletRequest request, HttpServletResponse response) throws IOException, OidcServerException {<NEW_LINE>OidcBaseClient client = clientProvider.get(clientId);<NEW_LINE>if (client == null) {<NEW_LINE>// CWWKS1424E<NEW_LINE>BrowserAndServerLogMessage errorMsg = new BrowserAndServerLogMessage(tc, "OAUTH_CLIENT_REGISTRATION_CLIENTID_NOT_FOUND", new Object[] { clientId });<NEW_LINE>Tr.event(tc, errorMsg.getServerErrorMessage());<NEW_LINE>throw new OidcServerException(errorMsg, OIDCConstants.ERROR_INVALID_CLIENT, HttpServletResponse.SC_NOT_FOUND);<NEW_LINE>}<NEW_LINE>// Remove empty initialized JSON Arrays<NEW_LINE>omitEmptyArrays(client);<NEW_LINE>// Calculate eTag<NEW_LINE>String eTag = computeETag(client);<NEW_LINE>// Calculate and add Registration URI<NEW_LINE>processClientRegistationUri(client, request);<NEW_LINE>// Set Headers<NEW_LINE>setCommonResponseHeaders(eTag, response, true);<NEW_LINE>// Check for conditional method execution<NEW_LINE>OidcServerException preconditionException = checkConditionalExecution(request, true, true, eTag, null);<NEW_LINE>if (preconditionException != null) {<NEW_LINE>response.setStatus(preconditionException.getHttpStatus());<NEW_LINE>response.flushBuffer();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Set response body for GET requests<NEW_LINE>if (request.getMethod().equalsIgnoreCase(HTTP_METHOD_GET)) {<NEW_LINE>decodeClientName(client);<NEW_LINE>byte[] b = GSON.toJson(client).<MASK><NEW_LINE>response.getOutputStream().write(b);<NEW_LINE>}<NEW_LINE>response.setStatus(HttpServletResponse.SC_OK);<NEW_LINE>response.flushBuffer();<NEW_LINE>return;<NEW_LINE>} | toString().getBytes("UTF-8"); |
752,374 | protected Number runThread(AbstractEmulator<?> emulator) {<NEW_LINE>Backend backend = emulator.getBackend();<NEW_LINE>UnidbgPointer stack = allocateStack(emulator);<NEW_LINE>if (emulator.is32Bit()) {<NEW_LINE>Pointer tls = thread.share(0x48);<NEW_LINE>this.errno = tls.share(8);<NEW_LINE>backend.reg_write(ArmConst.UC_ARM_REG_R0, UnidbgPointer.nativeValue(thread));<NEW_LINE>backend.reg_write(ArmConst.UC_ARM_REG_SP, stack.peer);<NEW_LINE>backend.reg_write(ArmConst.UC_ARM_REG_C13_C0_3, UnidbgPointer.nativeValue(tls));<NEW_LINE>backend.reg_write(ArmConst.UC_ARM_REG_LR, until);<NEW_LINE>} else {<NEW_LINE>Pointer tls = thread.share(0xb0);<NEW_LINE>this.errno = tls.share(16);<NEW_LINE>backend.reg_write(Arm64Const.UC_ARM64_REG_X0, UnidbgPointer.nativeValue(thread));<NEW_LINE>backend.reg_write(<MASK><NEW_LINE>backend.reg_write(Arm64Const.UC_ARM64_REG_TPIDR_EL0, UnidbgPointer.nativeValue(tls));<NEW_LINE>backend.reg_write(Arm64Const.UC_ARM64_REG_LR, until);<NEW_LINE>}<NEW_LINE>return emulator.emulate(this.fn.peer, until);<NEW_LINE>} | Arm64Const.UC_ARM64_REG_SP, stack.peer); |
1,484,723 | public long add(String str) throws CoreException {<NEW_LINE>long record = find(str);<NEW_LINE>if (record != 0)<NEW_LINE>return record;<NEW_LINE>IString string = this.db.newString(str);<NEW_LINE>record = string.getRecord();<NEW_LINE>long new_node = this.db.malloc(<MASK><NEW_LINE>NodeType.Next.put(this.db, new_node, getHead());<NEW_LINE>NodeType.Item.put(this.db, new_node, record);<NEW_LINE>if (this.lazyCache == null)<NEW_LINE>this.lazyCache = new HashMap<String, Long>();<NEW_LINE>this.lazyCache.put(str, record);<NEW_LINE>// If the Database has already been partially searched, then the loaded pointer will be after the<NEW_LINE>// head. Since we've already put this new record into the lazy cache, there is no reason to try to<NEW_LINE>// load it again. We put the new node at the start of the list so that it will be before the loaded<NEW_LINE>// pointer.<NEW_LINE>this.head = new_node;<NEW_LINE>if (this.loaded == 0)<NEW_LINE>this.loaded = new_node;<NEW_LINE>this.db.putRecPtr(this.ptr, new_node);<NEW_LINE>return record;<NEW_LINE>} | NodeType.sizeof, Database.POOL_STRING_SET); |
1,776,502 | final PutFunctionConcurrencyResult executePutFunctionConcurrency(PutFunctionConcurrencyRequest putFunctionConcurrencyRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(putFunctionConcurrencyRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<PutFunctionConcurrencyRequest> request = null;<NEW_LINE>Response<PutFunctionConcurrencyResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new PutFunctionConcurrencyRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(putFunctionConcurrencyRequest));<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, "Lambda");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "PutFunctionConcurrency");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<PutFunctionConcurrencyResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new PutFunctionConcurrencyResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
496,169 | public int nextc() {<NEW_LINE>if (lex_p == lex_pend) {<NEW_LINE>line_offset += lex_pend;<NEW_LINE>ByteList v = lex_nextline;<NEW_LINE>lex_nextline = null;<NEW_LINE>if (v == null) {<NEW_LINE>if (eofp)<NEW_LINE>return EOF;<NEW_LINE>if (src == null || (v = src.gets()) == null) {<NEW_LINE>eofp = true;<NEW_LINE>lex_goto_eol();<NEW_LINE>return EOF;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (heredoc_end > 0) {<NEW_LINE>ruby_sourceline = heredoc_end;<NEW_LINE>heredoc_end = 0;<NEW_LINE>}<NEW_LINE>ruby_sourceline++;<NEW_LINE>line_count++;<NEW_LINE>lex_pbeg = lex_p = 0;<NEW_LINE>lex_pend <MASK><NEW_LINE>lexb = v;<NEW_LINE>flush();<NEW_LINE>lex_lastline = v;<NEW_LINE>}<NEW_LINE>int c = p(lex_p);<NEW_LINE>lex_p++;<NEW_LINE>if (c == '\r') {<NEW_LINE>if (peek('\n')) {<NEW_LINE>lex_p++;<NEW_LINE>c = '\n';<NEW_LINE>} else if (ruby_sourceline > last_cr_line) {<NEW_LINE>last_cr_line = ruby_sourceline;<NEW_LINE>warnings.warn(ID.VOID_VALUE_EXPRESSION, getFile(), ruby_sourceline, "encountered \\r in middle of line, treated as a mere space");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return c;<NEW_LINE>} | = lex_p + v.length(); |
599,146 | public void init(final DaemonContext context) {<NEW_LINE>final File confFile = PropertiesUtil.findConfigFile("server.properties");<NEW_LINE>if (confFile == null) {<NEW_LINE>LOG.warn(String.format("Server configuration file not found. Initializing server daemon on %s, with http.enable=%s, http.port=%s, https.enable=%s, https.port=%s, context.path=%s", bindInterface, httpEnable, httpPort, httpsEnable, httpsPort, contextPath));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>LOG.info("Server configuration file found: " + confFile.getAbsolutePath());<NEW_LINE>try {<NEW_LINE>InputStream is = new FileInputStream(confFile);<NEW_LINE>final Properties properties = ServerProperties.getServerProperties(is);<NEW_LINE>if (properties == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>setBindInterface(properties.getProperty(BIND_INTERFACE, null));<NEW_LINE>setContextPath(properties.getProperty(CONTEXT_PATH, "/client"));<NEW_LINE>setHttpEnable(Boolean.valueOf(properties.getProperty(HTTP_ENABLE, "true")));<NEW_LINE>setHttpPort(Integer.valueOf(properties.getProperty(HTTP_PORT, "8080")));<NEW_LINE>setHttpsEnable(Boolean.valueOf(properties.<MASK><NEW_LINE>setHttpsPort(Integer.valueOf(properties.getProperty(HTTPS_PORT, "8443")));<NEW_LINE>setKeystoreFile(properties.getProperty(KEYSTORE_FILE));<NEW_LINE>setKeystorePassword(properties.getProperty(KEYSTORE_PASSWORD));<NEW_LINE>setWebAppLocation(properties.getProperty(WEBAPP_DIR));<NEW_LINE>setAccessLogFile(properties.getProperty(ACCESS_LOG, "access.log"));<NEW_LINE>setSessionTimeout(Integer.valueOf(properties.getProperty(SESSION_TIMEOUT, "30")));<NEW_LINE>} catch (final IOException e) {<NEW_LINE>LOG.warn("Failed to read configuration from server.properties file", e);<NEW_LINE>} finally {<NEW_LINE>// make sure that at least HTTP is enabled if both of them are set to false (misconfiguration)<NEW_LINE>if (!httpEnable && !httpsEnable) {<NEW_LINE>setHttpEnable(true);<NEW_LINE>LOG.warn("Server configuration malformed, neither http nor https is enabled, http will be enabled.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>LOG.info(String.format("Initializing server daemon on %s, with http.enable=%s, http.port=%s, https.enable=%s, https.port=%s, context.path=%s", bindInterface, httpEnable, httpPort, httpsEnable, httpsPort, contextPath));<NEW_LINE>} | getProperty(HTTPS_ENABLE, "false"))); |
462,943 | protected Object decode(Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {<NEW_LINE>ByteBuf buf = (ByteBuf) msg;<NEW_LINE>int type = buf.readUnsignedByte();<NEW_LINE>int index = buf.readUnsignedByte();<NEW_LINE>// length<NEW_LINE>buf.readUnsignedShort();<NEW_LINE>if (type == MSG_LOGIN_REQUEST) {<NEW_LINE>// protocol major version<NEW_LINE>buf.readUnsignedByte();<NEW_LINE>// protocol minor version<NEW_LINE>buf.readUnsignedByte();<NEW_LINE>String id = buf.readCharSequence(buf.readUnsignedByte(), StandardCharsets.US_ASCII).toString();<NEW_LINE>DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, id);<NEW_LINE>ByteBuf content = Unpooled.buffer();<NEW_LINE>content.writeByte(deviceSession != null ? 0 : 4);<NEW_LINE>sendResponse(channel, MSG_LOGIN_RESPONSE, index, content);<NEW_LINE>} else if (type == MSG_HEARTBEAT_REQUEST) {<NEW_LINE>sendResponse(channel, MSG_HEARTBEAT_RESPONSE, index, null);<NEW_LINE>} else if (type == MSG_RECORD_REPORT) {<NEW_LINE>DeviceSession deviceSession = getDeviceSession(channel, remoteAddress);<NEW_LINE>if (deviceSession == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// count<NEW_LINE>buf.readUnsignedByte();<NEW_LINE>Position position = new Position(getProtocolName());<NEW_LINE>position.setDeviceId(deviceSession.getDeviceId());<NEW_LINE>position.setTime(new Date(buf.readUnsignedInt() * 1000));<NEW_LINE>while (buf.readableBytes() > 2) {<NEW_LINE>decodeValue(position, <MASK><NEW_LINE>}<NEW_LINE>sendResponse(channel, MSG_RECORD_RESPONSE, index, null);<NEW_LINE>return position;<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | buf.readUnsignedByte(), buf); |
507,511 | public BlockManagementTaskResult run() {<NEW_LINE>LOG.debug("Running align task.");<NEW_LINE>// Acquire align range from the configuration.<NEW_LINE>// This will limit swap operations in a single run.<NEW_LINE>final int alignRange = ServerConfiguration.getInt(PropertyKey.WORKER_MANAGEMENT_TIER_ALIGN_RANGE);<NEW_LINE>BlockManagementTaskResult result = new BlockManagementTaskResult();<NEW_LINE>// Align each tier intersection by swapping blocks.<NEW_LINE>for (Pair<BlockStoreLocation, BlockStoreLocation> intersection : mMetadataManager.getStorageTierAssoc().intersectionList()) {<NEW_LINE>BlockStoreLocation tierUpLoc = intersection.getFirst();<NEW_LINE>BlockStoreLocation tierDownLoc = intersection.getSecond();<NEW_LINE>// Get list per tier that will be swapped for aligning the intersection.<NEW_LINE>Pair<List<Long>, List<Long>> swapLists = mMetadataManager.getBlockIterator().getSwaps(tierUpLoc, BlockOrder.NATURAL, tierDownLoc, BlockOrder.REVERSE, alignRange, BlockOrder.REVERSE, (blockId) -> !mEvictorView.isBlockEvictable(blockId));<NEW_LINE>Preconditions.checkArgument(swapLists.getFirst().size() == swapLists.getSecond().size());<NEW_LINE>LOG.debug("Acquired {} block pairs to align tiers {} - {}", swapLists.getFirst().size(), tierUpLoc.tierAlias(), tierDownLoc.tierAlias());<NEW_LINE>// Create exception handler to trigger swap-restore task when swap fails<NEW_LINE>// due to insufficient reserved space.<NEW_LINE>Consumer<Exception> excHandler = (e) -> {<NEW_LINE>if (e instanceof WorkerOutOfSpaceException) {<NEW_LINE>LOG.warn("Insufficient space for worker swap space, swap restore task called.");<NEW_LINE>// Mark the need for running swap-space restoration task.<NEW_LINE>TierManagementTaskProvider.setSwapRestoreRequired(true);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>// Execute swap transfers.<NEW_LINE>BlockOperationResult tierResult = mTransferExecutor.executeTransferList<MASK><NEW_LINE>result.addOpResults(BlockOperationType.ALIGN_SWAP, tierResult);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | (generateSwapTransferInfos(swapLists), excHandler); |
1,510,610 | public void start(Stage stage) {<NEW_LINE>stage.setTitle("Path Anti-Aliasing Test");<NEW_LINE>Scene scene = new Scene(new Group(), 800.0f, 800.0f);<NEW_LINE>scene<MASK><NEW_LINE>scene.setFill(Color.BEIGE);<NEW_LINE>Path path = new Path();<NEW_LINE>path.setRotate(40.0F);<NEW_LINE>path.setRotationAxis(Rotate.Y_AXIS);<NEW_LINE>path.setStroke(Color.RED);<NEW_LINE>path.setStrokeWidth(8.0F);<NEW_LINE>path.getElements().clear();<NEW_LINE>path.getElements().addAll(new MoveTo(100.0F, 600.0F), new LineTo(100.0F, 550.0F), new CubicCurveTo(100.0F, 450.0F, 600.0F, 600.0F, 600.0F, 300.0F), new VLineTo(150.0F), new CubicCurveTo(600.0F, 40.0F, 700.0F, 80.0F, 700.0F, 200.0F), new VLineTo(450.0F), new QuadCurveTo(700.0F, 650.0F, 600.0F, 650.0F), new HLineTo(150.0F), new QuadCurveTo(100.0F, 650.0F, 100.0F, 600.0F), new ClosePath());<NEW_LINE>((Group) scene.getRoot()).getChildren().addAll(path);<NEW_LINE>stage.setScene(scene);<NEW_LINE>stage.sizeToScene();<NEW_LINE>if (!Platform.isSupported(ConditionalFeature.SCENE3D)) {<NEW_LINE>System.out.println("*************************************************************");<NEW_LINE>System.out.println("* WARNING: common conditional SCENE3D isn\'t supported *");<NEW_LINE>System.out.println("*************************************************************");<NEW_LINE>}<NEW_LINE>stage.show();<NEW_LINE>} | .setCamera(new PerspectiveCamera()); |
1,272,139 | public void validateEmbargoDate(FacesContext context, UIComponent component, Object value) throws ValidatorException {<NEW_LINE>if (isEmbargoAllowed()) {<NEW_LINE>UIComponent <MASK><NEW_LINE>UIInput endComponent = (UIInput) cb;<NEW_LINE>boolean removedState = false;<NEW_LINE>if (endComponent != null) {<NEW_LINE>try {<NEW_LINE>removedState = (Boolean) endComponent.getSubmittedValue();<NEW_LINE>} catch (NullPointerException npe) {<NEW_LINE>// Do nothing - checkbox is not being shown (and is therefore not checked)<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!removedState && value == null) {<NEW_LINE>String msgString = BundleUtil.getStringFromBundle("embargo.date.required");<NEW_LINE>FacesMessage msg = new FacesMessage(msgString);<NEW_LINE>msg.setSeverity(FacesMessage.SEVERITY_ERROR);<NEW_LINE>throw new ValidatorException(msg);<NEW_LINE>}<NEW_LINE>Embargo newE = new Embargo(((LocalDate) value), null);<NEW_LINE>if (!isValidEmbargoDate(newE)) {<NEW_LINE>String minDate = getMinEmbargoDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));<NEW_LINE>String maxDate = getMaxEmbargoDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));<NEW_LINE>String msgString = BundleUtil.getStringFromBundle("embargo.date.invalid", Arrays.asList(minDate, maxDate));<NEW_LINE>// If we don't throw an exception here, the datePicker will use it's own<NEW_LINE>// vaidator and display a default message. The value for that can be set by<NEW_LINE>// adding validatorMessage="#{bundle['embargo.date.invalid']}" (a version with<NEW_LINE>// no params) to the datepicker<NEW_LINE>// element in file-edit-popup-fragment.html, but it would be better to catch all<NEW_LINE>// problems here (so we can show a message with the min/max dates).<NEW_LINE>FacesMessage msg = new FacesMessage(msgString);<NEW_LINE>msg.setSeverity(FacesMessage.SEVERITY_ERROR);<NEW_LINE>throw new ValidatorException(msg);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | cb = component.findComponent("embargoCheckbox"); |
371,284 | private void recursivelyCollectDescendants(final List<ObjectInFolderContainer> list, final AbstractFile child, final int maxDepth, final int depth, final Boolean includeAllowableActions) throws FrameworkException {<NEW_LINE>if (depth > maxDepth) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final PropertyKey<Folder> parent = StructrApp.key(AbstractFile.class, "parent");<NEW_LINE>final PropertyKey<Boolean> hasParent = StructrApp.key(AbstractFile.class, "hasParent");<NEW_LINE>final PropertyKey<Boolean> isThumbnail = StructrApp.key(Image.class, "isThumbnail");<NEW_LINE>final CMISObjectInFolderWrapper wrapper = new CMISObjectInFolderWrapper(includeAllowableActions);<NEW_LINE>final ObjectInFolderContainerImpl impl = new ObjectInFolderContainerImpl();<NEW_LINE>final List<ObjectInFolderContainer> childContainerList = new LinkedList<>();<NEW_LINE>final String pathSegment = child.getName();<NEW_LINE>impl.setObject(wrapper.wrapObjectData(wrapper.wrapGraphObject(child), pathSegment));<NEW_LINE>impl.setChildren(childContainerList);<NEW_LINE>// add wrapped object to current list<NEW_LINE>list.add(impl);<NEW_LINE>if (child.getProperty(AbstractNode.type).equals("Folder")) {<NEW_LINE>final <MASK><NEW_LINE>// descend into children<NEW_LINE>for (final AbstractFile folderChild : app.nodeQuery(AbstractFile.class).sort(AbstractNode.name).and(parent, (Folder) child).and(isThumbnail, false).getAsList()) {<NEW_LINE>recursivelyCollectDescendants(childContainerList, folderChild, maxDepth, depth + 1, includeAllowableActions);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | App app = StructrApp.getInstance(); |
570,252 | public boolean isValid() {<NEW_LINE>if (!isListenerSelected()) {<NEW_LINE>// NOI18N<NEW_LINE>// NOI18N<NEW_LINE>wizard.// NOI18N<NEW_LINE>putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, org.openide.util.NbBundle.getMessage(ListenerPanel.class, "MSG_noListenerSelected"));<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>Project project = Templates.getProject(wizard);<NEW_LINE>Sources sources = ProjectUtils.getSources(project);<NEW_LINE>SourceGroup[] groups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);<NEW_LINE>ClassPath cp = null;<NEW_LINE>String resource = null;<NEW_LINE>if (groups != null && groups.length != 0) {<NEW_LINE>cp = ClassPath.getClassPath(groups[0].getRootFolder(), ClassPath.COMPILE);<NEW_LINE>if (isContextListener()) {<NEW_LINE>resource = SERVLET_CONTEXT_LISTENER;<NEW_LINE>} else if (isContextAttrListener()) {<NEW_LINE>resource = SERVLET_CONTEXT_ATTRIBUTE_LISTENER;<NEW_LINE>} else if (isSessionListener()) {<NEW_LINE>resource = HTTP_SESSION_LISTENER;<NEW_LINE>} else if (isSessionAttrListener()) {<NEW_LINE>resource = HTTP_SESSION_ATTRIBUTE_LISTENER;<NEW_LINE>} else if (isRequestListener()) {<NEW_LINE>resource = SERVLET_REQUEST_LISTENER;<NEW_LINE>} else if (isRequestAttrListener()) {<NEW_LINE>resource = SERVLET_REQUEST_ATTRIBUTE_LISTENER;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (cp != null && resource != null && cp.findResource(resource.replace('.', '/') + ".class") == null) {<NEW_LINE>// NOI18N<NEW_LINE>wizard.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, org.openide.util.NbBundle.getMessage(ListenerPanel.class, "MSG_noResourceInClassPath", resource));<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>WebModule module = WebModule.getWebModule(project.getProjectDirectory());<NEW_LINE>if (createElementInDD() && (module == null || module.getWebInf() == null)) {<NEW_LINE>// NOI18N<NEW_LINE>wizard.putProperty(WizardDescriptor.PROP_WARNING_MESSAGE, org.openide.util.NbBundle.getMessage(ListenerPanel.class, "MSG_noWebInfDirectory", resource));<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>wizard.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, "");<NEW_LINE>// NOI18N<NEW_LINE>wizard.<MASK><NEW_LINE>return true;<NEW_LINE>} | putProperty(WizardDescriptor.PROP_WARNING_MESSAGE, ""); |
910,605 | Temporal isOk(final Temporal t) {<NEW_LINE>if (checker.matches(t)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Temporal out = t.plus(1, type.getBaseUnit());<NEW_LINE>// Fall-through switch case. for example if type is year all cases below must also be handled.<NEW_LINE>switch(type) {<NEW_LINE>case YEAR:<NEW_LINE>out = out.with(ChronoField.MONTH_OF_YEAR, 1);<NEW_LINE>case MONTH_OF_YEAR:<NEW_LINE>out = out.with(ChronoField.DAY_OF_MONTH, 1);<NEW_LINE>case DAY_OF_WEEK:<NEW_LINE>case DAY_OF_MONTH:<NEW_LINE>out = out.<MASK><NEW_LINE>case HOUR_OF_DAY:<NEW_LINE>out = out.with(ChronoField.MINUTE_OF_HOUR, 0);<NEW_LINE>case MINUTE_OF_HOUR:<NEW_LINE>out = out.with(ChronoField.SECOND_OF_MINUTE, 0);<NEW_LINE>case SECOND_OF_MINUTE:<NEW_LINE>return out;<NEW_LINE>default:<NEW_LINE>throw new IllegalArgumentException("Invalid field type " + type);<NEW_LINE>}<NEW_LINE>} | with(ChronoField.HOUR_OF_DAY, 0); |
1,788,743 | protected BeanDefinitionBuilder parseHandler(Element gatewayElement, ParserContext parserContext) {<NEW_LINE>BeanDefinitionBuilder jpaOutboundGatewayBuilder = super.parseHandler(gatewayElement, parserContext);<NEW_LINE>BeanDefinitionBuilder jpaExecutorBuilder = JpaParserUtils.getOutboundGatewayJpaExecutorBuilder(gatewayElement, parserContext);<NEW_LINE>IntegrationNamespaceUtils.setValueIfAttributeDefined(jpaExecutorBuilder, gatewayElement, "persist-mode");<NEW_LINE>IntegrationNamespaceUtils.setValueIfAttributeDefined(jpaExecutorBuilder, gatewayElement, "flush");<NEW_LINE>IntegrationNamespaceUtils.setValueIfAttributeDefined(jpaExecutorBuilder, gatewayElement, "flush-size");<NEW_LINE>IntegrationNamespaceUtils.setValueIfAttributeDefined(jpaExecutorBuilder, gatewayElement, "clear-on-flush");<NEW_LINE>final BeanDefinition jpaExecutorBuilderBeanDefinition = jpaExecutorBuilder.getBeanDefinition();<NEW_LINE>final String gatewayId = resolveId(gatewayElement, jpaOutboundGatewayBuilder.getRawBeanDefinition(), parserContext);<NEW_LINE>final String jpaExecutorBeanName = gatewayId + ".jpaExecutor";<NEW_LINE>parserContext.registerBeanComponent(<MASK><NEW_LINE>return jpaOutboundGatewayBuilder.addPropertyReference("jpaExecutor", jpaExecutorBeanName).addPropertyValue("gatewayType", OutboundGatewayType.UPDATING);<NEW_LINE>} | new BeanComponentDefinition(jpaExecutorBuilderBeanDefinition, jpaExecutorBeanName)); |
1,532,368 | protected void checkRenewTimeAgainstCertValidityPeriod(Date notBefore, Date notAfter, String serialNumber) {<NEW_LINE>long notBeforems = notBefore.getTime();<NEW_LINE>long notAfterms = notAfter.getTime();<NEW_LINE>long renewCertMin = acmeConfig.getRenewCertMin();<NEW_LINE>long validityPeriod = notAfterms - notBeforems;<NEW_LINE>long renewBeforeExpirationMs = acmeConfig.getRenewBeforeExpirationMs();<NEW_LINE>if (tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "Validity versus renew check", notBeforems, notAfterms, validityPeriod, renewBeforeExpirationMs);<NEW_LINE>}<NEW_LINE>if (validityPeriod <= renewBeforeExpirationMs) {<NEW_LINE>if (validityPeriod <= renewCertMin) {<NEW_LINE>Tr.warning(tc, "CWPKI2056W", serialNumber, renewCertMin + "ms", validityPeriod, renewCertMin + "ms");<NEW_LINE><MASK><NEW_LINE>} else if (validityPeriod <= AcmeConstants.RENEW_DEFAULT_MS) {<NEW_LINE>long resetRenew = Math.round(validityPeriod * AcmeConstants.RENEW_DIVISOR);<NEW_LINE>long priorRenew = renewBeforeExpirationMs;<NEW_LINE>acmeConfig.setRenewBeforeExpirationMs(resetRenew <= renewCertMin ? renewCertMin : resetRenew, false);<NEW_LINE>Tr.warning(tc, "CWPKI2054W", priorRenew + "ms", serialNumber, validityPeriod, renewBeforeExpirationMs + "ms");<NEW_LINE>} else {<NEW_LINE>Tr.warning(tc, "CWPKI2054W", renewBeforeExpirationMs + "ms", serialNumber, validityPeriod + "ms", AcmeConstants.RENEW_DEFAULT_MS + "ms");<NEW_LINE>acmeConfig.setRenewBeforeExpirationMs(AcmeConstants.RENEW_DEFAULT_MS, false);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | acmeConfig.setRenewBeforeExpirationMs(renewCertMin, false); |
335,751 | public void onClick(View view) {<NEW_LINE>BluetoothDevice device = foundDevices.get(getDeviceAddress());<NEW_LINE>SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(requireContext());<NEW_LINE>prefs.edit().putString(PREFERENCE_KEY_BLUETOOTH_HW_ADDRESS, device.getAddress()).putString(PREFERENCE_KEY_BLUETOOTH_DEVICE_NAME, device.getName()).apply();<NEW_LINE>Timber.d("Saved Bluetooth device " + device.getName() + <MASK><NEW_LINE>stopBluetoothDiscovery();<NEW_LINE>if (getActivity().findViewById(R.id.nav_host_fragment) != null) {<NEW_LINE>Navigation.findNavController(requireActivity(), R.id.nav_host_fragment).getPreviousBackStackEntry().getSavedStateHandle().set("update", true);<NEW_LINE>Navigation.findNavController(requireActivity(), R.id.nav_host_fragment).navigateUp();<NEW_LINE>} else<NEW_LINE>getActivity().finish();<NEW_LINE>} | " with address " + device.getAddress()); |
654 | public static List<String> validateValues(final StoredConfiguration storedConfiguration) {<NEW_LINE>final Function<StoredConfigKey, Stream<String>> validateSettingFunction = storedConfigItemKey -> {<NEW_LINE>final PwmSetting pwmSetting = storedConfigItemKey.toPwmSetting();<NEW_LINE>final String profileID = storedConfigItemKey.getProfileID();<NEW_LINE>final Optional<StoredValue> loopValue = storedConfiguration.readStoredValue(storedConfigItemKey);<NEW_LINE>if (loopValue.isPresent()) {<NEW_LINE>try {<NEW_LINE>final List<String> errors = loopValue.get().validateValue(pwmSetting);<NEW_LINE>for (final String loopError : errors) {<NEW_LINE>return Stream.of(pwmSetting.toMenuLocationDebug(storedConfigItemKey.getProfileID(), PwmConstants<MASK><NEW_LINE>}<NEW_LINE>} catch (final Exception e) {<NEW_LINE>LOGGER.error(() -> "unexpected error during validate value for " + pwmSetting.toMenuLocationDebug(profileID, PwmConstants.DEFAULT_LOCALE) + ", error: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return Stream.empty();<NEW_LINE>};<NEW_LINE>final Instant startTime = Instant.now();<NEW_LINE>final List<String> errorStrings = CollectionUtil.iteratorToStream(storedConfiguration.keys()).filter(key -> key.isRecordType(StoredConfigKey.RecordType.SETTING)).flatMap(validateSettingFunction).collect(Collectors.toList());<NEW_LINE>LOGGER.trace(() -> "StoredConfiguration validator completed", () -> TimeDuration.fromCurrent(startTime));<NEW_LINE>return Collections.unmodifiableList(errorStrings);<NEW_LINE>} | .DEFAULT_LOCALE) + " - " + loopError); |
285,744 | public void createControl(Composite parent) {<NEW_LINE>Composite cfgGroup = new Composite(parent, SWT.NONE);<NEW_LINE>GridLayout gl = new GridLayout(1, false);<NEW_LINE>gl.marginHeight = 10;<NEW_LINE>gl.marginWidth = 10;<NEW_LINE>cfgGroup.setLayout(gl);<NEW_LINE>GridData gd = new GridData(GridData.FILL_BOTH);<NEW_LINE>cfgGroup.setLayoutData(gd);<NEW_LINE>enableTraceCheck = UIUtils.createCheckbox(cfgGroup, DB2Messages.db2_connection_trace_page_checkbox_enable_trace, false);<NEW_LINE>traceGroup = new Composite(cfgGroup, SWT.NONE);<NEW_LINE>traceGroup.setLayout(new GridLayout(2, false));<NEW_LINE>traceGroup.setLayoutData(<MASK><NEW_LINE>folderText = DialogUtils.createOutputFolderChooser(traceGroup, DB2Messages.db2_connection_trace_page_label_folder, null);<NEW_LINE>fileNameText = UIUtils.createLabelText(traceGroup, DB2Messages.db2_connection_trace_page_label_file_name, DB2Messages.db2_connection_trace_page_string_trace);<NEW_LINE>traceAppendCheck = UIUtils.createLabelCheckbox(traceGroup, DB2Messages.db2_connection_trace_page_checkbox_append, false);<NEW_LINE>Group levelsGroup = UIUtils.createControlGroup(traceGroup, DB2Messages.db2_connection_trace_page_header_levels, 2, 0, 0);<NEW_LINE>gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);<NEW_LINE>gd.horizontalSpan = 2;<NEW_LINE>levelsGroup.setLayoutData(gd);<NEW_LINE>for (LevelConfig level : levels) {<NEW_LINE>level.checkbox = UIUtils.createCheckbox(levelsGroup, level.label, false);<NEW_LINE>}<NEW_LINE>enableTraceCheck.addSelectionListener(new SelectionAdapter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void widgetSelected(SelectionEvent e) {<NEW_LINE>if (traceEnableState == null) {<NEW_LINE>traceEnableState = ControlEnableState.disable(traceGroup);<NEW_LINE>} else {<NEW_LINE>traceEnableState.restore();<NEW_LINE>traceEnableState = null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>setControl(cfgGroup);<NEW_LINE>loadSettings();<NEW_LINE>} | new GridData(GridData.FILL_HORIZONTAL)); |
1,536,985 | public synchronized void revert(MediaElement shaper, boolean releaseElement) throws OpenViduException {<NEW_LINE>final String elementId = shaper.getId();<NEW_LINE>if (!elements.containsKey(elementId)) {<NEW_LINE>throw new OpenViduException(Code.MEDIA_ENDPOINT_ERROR_CODE, "This endpoint (" + getEndpointName() + ") has no media element with id " + elementId);<NEW_LINE>}<NEW_LINE>MediaElement element = elements.remove(elementId);<NEW_LINE>unregisterElementErrListener(element, elementsErrorSubscriptions.remove(elementId));<NEW_LINE>// careful, the order in the elems list is reverted<NEW_LINE>if (connected) {<NEW_LINE>String nextId = getNext(elementId);<NEW_LINE>String prevId = getPrevious(elementId);<NEW_LINE>// next connects to prev<NEW_LINE>MediaElement prev = null;<NEW_LINE>MediaElement next = null;<NEW_LINE>if (nextId != null) {<NEW_LINE>next = elements.get(nextId);<NEW_LINE>} else {<NEW_LINE>next = this.getEndpoint();<NEW_LINE>}<NEW_LINE>if (prevId != null) {<NEW_LINE>prev = elements.get(prevId);<NEW_LINE>} else {<NEW_LINE>prev = passThru;<NEW_LINE>}<NEW_LINE>internalSinkConnect(next, prev, false);<NEW_LINE>}<NEW_LINE>elementIds.remove(elementId);<NEW_LINE>if (releaseElement) {<NEW_LINE>if (!RemoteOperationUtils.mustSkipRemoteOperation()) {<NEW_LINE>element.release(new Continuation<Void>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onSuccess(Void result) throws Exception {<NEW_LINE>log.trace(<MASK><NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onError(Throwable cause) throws Exception {<NEW_LINE>log.error("EP {}: Failed to release media element {}", getEndpointName(), elementId, cause);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>}<NEW_LINE>this.filter = null;<NEW_LINE>} | "EP {}: Released media element {}", getEndpointName(), elementId); |
540,743 | public void addSystemTray(final LooksFrame frame) {<NEW_LINE>if (SystemTray.isSupported()) {<NEW_LINE><MASK><NEW_LINE>Image trayIconImage = resolveTrayIcon();<NEW_LINE>PopupMenu popup = new PopupMenu();<NEW_LINE>MenuItem defaultItem = new MenuItem(Messages.getString("LooksFrame.5"));<NEW_LINE>MenuItem traceItem = new MenuItem(Messages.getString("LooksFrame.6"));<NEW_LINE>defaultItem.addActionListener(new ActionListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(ActionEvent e) {<NEW_LINE>frame.quit();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>traceItem.addActionListener(new ActionListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(ActionEvent e) {<NEW_LINE>frame.setVisible(true);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>if (PMS.getConfiguration().useWebInterfaceServer()) {<NEW_LINE>MenuItem webInterfaceItem = new MenuItem(Messages.getString("LooksFrame.29"));<NEW_LINE>webInterfaceItem.addActionListener(new ActionListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(ActionEvent e) {<NEW_LINE>browseURI(PMS.get().getWebInterfaceServer().getUrl());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>popup.add(webInterfaceItem);<NEW_LINE>}<NEW_LINE>popup.add(traceItem);<NEW_LINE>popup.add(defaultItem);<NEW_LINE>final TrayIcon trayIcon = new TrayIcon(trayIconImage, PropertiesUtil.getProjectProperties().get("project.name"), popup);<NEW_LINE>trayIcon.setImageAutoSize(true);<NEW_LINE>trayIcon.addActionListener(new ActionListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(ActionEvent e) {<NEW_LINE>frame.setVisible(true);<NEW_LINE>frame.setFocusable(true);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>try {<NEW_LINE>tray.add(trayIcon);<NEW_LINE>} catch (AWTException e) {<NEW_LINE>LOGGER.debug("Caught exception", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | SystemTray tray = SystemTray.getSystemTray(); |
1,426,096 | private void updateAdditionalInfoVisibility() {<NEW_LINE>View line3 = view.findViewById(R.id.context_menu_line3);<NEW_LINE>View additionalInfoImageView = view.findViewById(R.id.additional_info_image_view);<NEW_LINE>View additionalInfoTextView = view.findViewById(R.id.additional_info_text_view);<NEW_LINE>View compassView = view.findViewById(R.id.compass_layout);<NEW_LINE>View titleButtonContainer = view.findViewById(R.id.title_button_container);<NEW_LINE>View downloadButtonsContainer = view.findViewById(R.id.download_buttons_container);<NEW_LINE>View titleBottomButtonContainer = view.<MASK><NEW_LINE>View titleProgressContainer = view.findViewById(R.id.title_progress_container);<NEW_LINE>if (line3.getVisibility() == View.GONE && additionalInfoImageView.getVisibility() == View.GONE && additionalInfoTextView.getVisibility() == View.GONE && compassView.getVisibility() == View.INVISIBLE && titleButtonContainer.getVisibility() == View.GONE && downloadButtonsContainer.getVisibility() == View.GONE && titleBottomButtonContainer.getVisibility() == View.GONE) {<NEW_LINE>if (titleProgressContainer.getVisibility() == View.VISIBLE) {<NEW_LINE>view.findViewById(R.id.additional_info_row_container).setVisibility(View.GONE);<NEW_LINE>}<NEW_LINE>view.findViewById(R.id.additional_info_row).setVisibility(View.GONE);<NEW_LINE>} else {<NEW_LINE>view.findViewById(R.id.additional_info_row_container).setVisibility(View.VISIBLE);<NEW_LINE>view.findViewById(R.id.additional_info_row).setVisibility(View.VISIBLE);<NEW_LINE>}<NEW_LINE>} | findViewById(R.id.title_bottom_button_container); |
1,182,063 | public Object execute(ExecutionEvent event) throws ExecutionException {<NEW_LINE>ListDialog dlg = new ListDialog(UIUtils.getActiveShell());<NEW_LINE>dlg.setContentProvider(ArrayContentProvider.getInstance());<NEW_LINE>dlg.setLabelProvider(new LabelProvider() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Image getImage(Object element) {<NEW_LINE>if (element instanceof Identifiable) {<NEW_LINE>Identifiable identifiable = (Identifiable) element;<NEW_LINE>String id = identifiable.getId();<NEW_LINE>ImageRegistry imageRegistry = WebServerUIPlugin.getDefault().getImageRegistry();<NEW_LINE>Image image = imageRegistry.get(id);<NEW_LINE>if (image != null) {<NEW_LINE>return image;<NEW_LINE>}<NEW_LINE>ImageDescriptor desc = ImageAssociations.getInstance().getImageDescriptor(id);<NEW_LINE>if (desc != null) {<NEW_LINE><MASK><NEW_LINE>return imageRegistry.get(id);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return WebServerUIPlugin.getImage(WebServerUIPlugin.SERVER_ICON);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String getText(Object element) {<NEW_LINE>if (element instanceof IServerType) {<NEW_LINE>return ((IServerType) element).getName();<NEW_LINE>}<NEW_LINE>return super.getText(element);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>dlg.setInput(WebServerCorePlugin.getDefault().getServerManager().getServerTypes());<NEW_LINE>dlg.setTitle(Messages.ServersPreferencePage_Title);<NEW_LINE>if (dlg.open() != Window.OK) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Object[] result = dlg.getResult();<NEW_LINE>if (result != null && result.length == 1) {<NEW_LINE>String typeId = ((IServerType) result[0]).getId();<NEW_LINE>createServer(typeId);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | imageRegistry.put(id, desc); |
744,519 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>if (controller != null) {<NEW_LINE>controller.<MASK><NEW_LINE>game.fireUpdatePlayersEvent();<NEW_LINE>Choice manaChoice = new ChoiceImpl();<NEW_LINE>Set<String> choices = new LinkedHashSet<>();<NEW_LINE>choices.add("White");<NEW_LINE>choices.add("Blue");<NEW_LINE>choices.add("Black");<NEW_LINE>choices.add("Red");<NEW_LINE>choices.add("Green");<NEW_LINE>manaChoice.setChoices(choices);<NEW_LINE>manaChoice.setMessage("Select color of mana to add");<NEW_LINE>Mana mana = new Mana();<NEW_LINE>if (!controller.choose(Outcome.Benefit, manaChoice, game)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>switch(manaChoice.getChoice()) {<NEW_LINE>case "White":<NEW_LINE>mana.increaseWhite();<NEW_LINE>break;<NEW_LINE>case "Blue":<NEW_LINE>mana.increaseBlue();<NEW_LINE>break;<NEW_LINE>case "Black":<NEW_LINE>mana.increaseBlack();<NEW_LINE>break;<NEW_LINE>case "Red":<NEW_LINE>mana.increaseRed();<NEW_LINE>break;<NEW_LINE>case "Green":<NEW_LINE>mana.increaseGreen();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>controller.getManaPool().addMana(mana, game, source);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | drawCards(1, source, game); |
1,123,186 | private boolean checkResetPassword(final Authenticator auth, final HttpServletRequest request, final HttpServletResponse response, final String path) throws FrameworkException, IOException {<NEW_LINE>logger.debug("Checking reset password ...");<NEW_LINE>final String key = request.getParameter(CONFIRMATION_KEY_KEY);<NEW_LINE>if (StringUtils.isEmpty(key)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>final PropertyKey<String> confirmationKeyKey = StructrApp.key(User.class, "confirmationKey");<NEW_LINE>if (RESET_PASSWORD_PAGE.equals(path)) {<NEW_LINE>final App app = StructrApp.getInstance();<NEW_LINE>List<Principal> results;<NEW_LINE>try (final Tx tx = app.tx()) {<NEW_LINE>results = app.nodeQuery(Principal.class).and(confirmationKeyKey, key).getAsList();<NEW_LINE>tx.success();<NEW_LINE>}<NEW_LINE>if (!results.isEmpty()) {<NEW_LINE>final Principal user = results.get(0);<NEW_LINE>try (final Tx tx = app.tx()) {<NEW_LINE>// Clear confirmation key and set session id<NEW_LINE>user.setProperty(confirmationKeyKey, null);<NEW_LINE>if (AuthHelper.isConfirmationKeyValid(key, Settings.ConfirmationKeyPasswordResetValidityPeriod.getValue())) {<NEW_LINE>if (Settings.RestUserAutologin.getValue()) {<NEW_LINE>if (Settings.PasswordResetFailedCounterOnPWReset.getValue()) {<NEW_LINE>AuthHelper.resetFailedLoginAttemptsCounter(user);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>logger.warn("Refusing login because {} is disabled", Settings.RestUserAutologin.getKey());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>logger.warn("Confirmation key for user {} is not valid anymore - refusing login.", user.getName());<NEW_LINE>}<NEW_LINE>tx.success();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Redirect to target path<NEW_LINE>final String targetPath = filterMaliciousRedirects(request.getParameter(TARGET_PATH_KEY));<NEW_LINE>if (StringUtils.isNotBlank(targetPath)) {<NEW_LINE>// user-provided, should be already prefixed<NEW_LINE>sendRedirectHeader(response, targetPath, false);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | AuthHelper.doLogin(request, user); |
1,111,988 | public void postUsabilityStats(int seqNum, boolean isSameBssidAndFreq, WifiUsabilityStatsEntryBuilder statsBuilder) {<NEW_LINE><MASK><NEW_LINE>Set<Map.Entry<WifiManager.OnWifiUsabilityStatsListener, Executor>> toNotify = new ArraySet<>();<NEW_LINE>toNotify.addAll(wifiUsabilityStatsListeners.entrySet());<NEW_LINE>for (Map.Entry<WifiManager.OnWifiUsabilityStatsListener, Executor> entry : toNotify) {<NEW_LINE>entry.getValue().execute(new Runnable() {<NEW_LINE><NEW_LINE>// Using a lambda here means loading the ShadowWifiManager class tries<NEW_LINE>// to load the WifiManager.OnWifiUsabilityStatsListener which fails if<NEW_LINE>// not building against a system API.<NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>entry.getKey().onWifiUsabilityStats(seqNum, isSameBssidAndFreq, stats);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | WifiUsabilityStatsEntry stats = statsBuilder.build(); |
1,115,688 | private Map<String, String> generateWlpBasedMap(String serverName) {<NEW_LINE>Map<String, String> resultMap = new <MASK><NEW_LINE>resultMap.put("wlp.install.dir", wlpDir);<NEW_LINE>resultMap.put("wlp.user.dir", wlpUsrDir);<NEW_LINE>resultMap.put("usr.extension.dir", userExtensionDir);<NEW_LINE>resultMap.put("shared.app.dir", sharedAppDir);<NEW_LINE>resultMap.put("shared.config.dir", sharedConfigDir);<NEW_LINE>resultMap.put("shared.resource.dir", sharedResourceDir);<NEW_LINE>resultMap.put("shared.stackgroup.dir", sharedStackGroupsDir);<NEW_LINE>resultMap.put("server.config.dir", wlpUsrDir + "/servers/" + serverName);<NEW_LINE>resultMap.put("server.output.dir", serverOutputDir + "/" + serverName);<NEW_LINE>return resultMap;<NEW_LINE>} | HashMap<String, String>(); |
876,223 | public void exitL_login_authentication(L_login_authenticationContext ctx) {<NEW_LINE>String list;<NEW_LINE>if (ctx.DEFAULT() != null) {<NEW_LINE>list = ctx.DEFAULT().getText();<NEW_LINE>} else if (ctx.name != null) {<NEW_LINE>list = ctx.name.getText();<NEW_LINE>} else {<NEW_LINE>throw new BatfishException("Invalid list name");<NEW_LINE>}<NEW_LINE>// get the authentication list or null if Aaa, AaaAuthentication, or AaaAuthenticationLogin is<NEW_LINE>// null or the list is not defined<NEW_LINE>AaaAuthenticationLoginList authList = Optional.ofNullable(_configuration.getCf().getAaa()).map(Aaa::getAuthentication).map(AaaAuthentication::getLogin).map(AaaAuthenticationLogin::getLists).map(lists -> lists.get(<MASK><NEW_LINE>// if the authentication list has been defined, apply it to all lines in _currentLineNames<NEW_LINE>for (String line : _currentLineNames) {<NEW_LINE>if (authList != null) {<NEW_LINE>_configuration.getCf().getLines().get(line).setAaaAuthenticationLoginList(authList);<NEW_LINE>}<NEW_LINE>// set the name of the login list even if the list hasn't been defined yet because it may be<NEW_LINE>// defined later<NEW_LINE>_configuration.getCf().getLines().get(line).setLoginAuthentication(list);<NEW_LINE>}<NEW_LINE>} | list)).orElse(null); |
333,481 | final GetFunctionResult executeGetFunction(GetFunctionRequest getFunctionRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getFunctionRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetFunctionRequest> request = null;<NEW_LINE>Response<GetFunctionResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetFunctionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getFunctionRequest));<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, "Lambda");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetFunction");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetFunctionResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetFunctionResultJsonUnmarshaller());<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.ADVANCED_CONFIG, advancedConfig); |
439,491 | public CodeGenEdge unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>CodeGenEdge codeGenEdge = new CodeGenEdge();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><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("Source", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>codeGenEdge.setSource(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("Target", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>codeGenEdge.setTarget(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("TargetParameter", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>codeGenEdge.setTargetParameter(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 codeGenEdge;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
478,255 | private void performStop(@NotNull final State desiredState, @NotNull final List<CompletableFuture<Void>> startFutures, @NotNull final List<CompletableFuture<Void>> stopFutures) {<NEW_LINE>try {<NEW_LINE>final long startTime = System.currentTimeMillis();<NEW_LINE>try {<NEW_LINE>hiveMQServer.stop();<NEW_LINE>} catch (final Exception ex) {<NEW_LINE>if (desiredState == State.CLOSED) {<NEW_LINE>log.error("Exception during running shutdown hook.", ex);<NEW_LINE>} else {<NEW_LINE>throw ex;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>hiveMQServer = null;<NEW_LINE>failFutureList(<MASK><NEW_LINE>succeedFutureList(stopFutures);<NEW_LINE>currentState = State.STOPPED;<NEW_LINE>log.info("Stopped EmbeddedHiveMQ in {}ms", System.currentTimeMillis() - startTime);<NEW_LINE>} catch (final Exception ex) {<NEW_LINE>currentState = State.FAILED;<NEW_LINE>failedException = ex;<NEW_LINE>failFutureLists(ex, startFutures, stopFutures);<NEW_LINE>}<NEW_LINE>} | new AbortedStateChangeException("EmbeddedHiveMQ was stopped"), startFutures); |
650,507 | // ///////////// Emit Terminator instructions ////////////////////<NEW_LINE>static String emitTerminator(BIRTerminator term, int tabs) {<NEW_LINE>switch(term.kind) {<NEW_LINE>case WAIT:<NEW_LINE>return emitWait((BIRTerminator.Wait) term, tabs);<NEW_LINE>case FLUSH:<NEW_LINE>return emitFlush((BIRTerminator.Flush) term, tabs);<NEW_LINE>case WK_RECEIVE:<NEW_LINE>return emitWorkerReceive((BIRTerminator.WorkerReceive) term, tabs);<NEW_LINE>case WK_SEND:<NEW_LINE>return emitWorkerSend((BIRTerminator.WorkerSend) term, tabs);<NEW_LINE>case CALL:<NEW_LINE>return emitCall((BIRTerminator.Call) term, tabs);<NEW_LINE>case ASYNC_CALL:<NEW_LINE>return emitAsyncCall((BIRTerminator.AsyncCall) term, tabs);<NEW_LINE>case BRANCH:<NEW_LINE>return emitBranch((BIRTerminator.Branch) term, tabs);<NEW_LINE>case GOTO:<NEW_LINE>return emitGOTO((BIRTerminator.GOTO) term, tabs);<NEW_LINE>case LOCK:<NEW_LINE>return emitLock((BIRTerminator.Lock) term, tabs);<NEW_LINE>case FIELD_LOCK:<NEW_LINE>return emitFieldLock((BIRTerminator.FieldLock) term, tabs);<NEW_LINE>case UNLOCK:<NEW_LINE>return emitUnlock((BIRTerminator.Unlock) term, tabs);<NEW_LINE>case RETURN:<NEW_LINE>return emitReturn((BIRTerminator.Return) term, tabs);<NEW_LINE>case PANIC:<NEW_LINE>return emitPanic((BIRTerminator.Panic) term, tabs);<NEW_LINE>case FP_CALL:<NEW_LINE>return emitFPCall((BIRTerminator.FPCall) term, tabs);<NEW_LINE>case WAIT_ALL:<NEW_LINE>return emitWaitAll((<MASK><NEW_LINE>default:<NEW_LINE>throw new IllegalStateException("Not a terminator instruction");<NEW_LINE>}<NEW_LINE>} | BIRTerminator.WaitAll) term, tabs); |
63,306 | public void handle(HttpExchange exchange) {<NEW_LINE>try {<NEW_LINE>Response response = getResponse(exchange);<NEW_LINE>response.getHeaders().putIfAbsent("Access-Control-Allow-Origin", config.get(WebserverSettings.CORS_ALLOW_ORIGIN));<NEW_LINE>response.getHeaders().putIfAbsent("Access-Control-Allow-Methods", "GET, OPTIONS");<NEW_LINE>response.getHeaders(<MASK><NEW_LINE>response.getHeaders().putIfAbsent("X-Robots-Tag", "noindex, nofollow");<NEW_LINE>ResponseSender sender = new ResponseSender(addresses, exchange, response);<NEW_LINE>sender.send();<NEW_LINE>} catch (Exception e) {<NEW_LINE>if (config.isTrue(PluginSettings.DEV_MODE)) {<NEW_LINE>logger.warn("THIS ERROR IS ONLY LOGGED IN DEV MODE:");<NEW_LINE>errorLogger.warn(e, ErrorContext.builder().whatToDo("THIS ERROR IS ONLY LOGGED IN DEV MODE").related(exchange.getRequestMethod(), exchange.getRemoteAddress(), exchange.getRequestHeaders(), exchange.getResponseHeaders(), exchange.getRequestURI()).build());<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>exchange.close();<NEW_LINE>}<NEW_LINE>} | ).putIfAbsent("Access-Control-Allow-Credentials", "true"); |
85,187 | public void init() throws IOException {<NEW_LINE>int flushLen = conf.getInt(AngelConf.ANGEL_LOG_FLUSH_MIN_SIZE, AngelConf.DEFAULT_ANGEL_LOG_FLUSH_MIN_SIZE);<NEW_LINE>conf.setInt(DFSConfigKeys.DFS_CLIENT_WRITE_PACKET_SIZE_KEY, flushLen);<NEW_LINE>conf.setInt(DFSConfigKeys.DFS_BYTES_PER_CHECKSUM_KEY, flushLen);<NEW_LINE>String pathStr = conf.get(AngelConf.ANGEL_LOG_PATH);<NEW_LINE>if (pathStr == null) {<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>LOG.info("algorithm log output directory=" + pathStr);<NEW_LINE>Path path = new Path(pathStr + "/log");<NEW_LINE>FileSystem fs = path.getFileSystem(conf);<NEW_LINE>if (fs.exists(path)) {<NEW_LINE>fs.delete(path, true);<NEW_LINE>}<NEW_LINE>outputStream = fs.create(path, true);<NEW_LINE>} | IOException("log directory is null. you must set " + AngelConf.ANGEL_LOG_PATH); |
152,261 | public static void quickContrast3(int[] arr, int extra_contrast, int delta_brightness) {<NEW_LINE>int lum;<NEW_LINE>// Use linear contrast variation; extra_contrast=0 = no change,<NEW_LINE>// extra_contrast=100 = 2x contrast<NEW_LINE>double contrast = (100 + extra_contrast) / 100.0;<NEW_LINE>int hash = extra_contrast * 3 + delta_brightness * 2;<NEW_LINE>if (simpleHash != hash) {<NEW_LINE>// each of the 256 values we can read is mapped to the output values<NEW_LINE>// we<NEW_LINE>// will write<NEW_LINE>for (int i = 0; i < 256; i++) {<NEW_LINE>// take the input<NEW_LINE>lum = i;<NEW_LINE>// apply brightness variation<NEW_LINE>lum = lum - delta_brightness;<NEW_LINE>// apply contrast<NEW_LINE>lum = (int) (((lum - 128) * contrast) + 128);<NEW_LINE>if (lum < 0) {<NEW_LINE>// flatten excess<NEW_LINE>lum = 0;<NEW_LINE>} else if (lum > 255) {<NEW_LINE>lum = 255;<NEW_LINE>}<NEW_LINE>// compose<NEW_LINE>brightnessContrastMap[i] = (lum << 16) + (lum << 8) + lum;<NEW_LINE>// greyscale<NEW_LINE>}<NEW_LINE>simpleHash = hash;<NEW_LINE>}<NEW_LINE>// process the real image<NEW_LINE>for (int i = 0; i < arr.length; i++) {<NEW_LINE>// Get luminosity. Also use G and B, with 2x R<NEW_LINE>int temp = arr[i];<NEW_LINE>if (temp == Color.WHITE || temp == Color.BLACK) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>lum = ((temp & 0x00FF0000) >> 17) + ((temp & 0x0000FF00) >> 10) + ((temp & 0x000000FF) >> 2);<NEW_LINE>// retrieve output from map<NEW_LINE>arr<MASK><NEW_LINE>}<NEW_LINE>} | [i] = brightnessContrastMap[lum]; |
688,012 | public void onCreate(final Bundle savedInstanceState) {<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>activityViewModel = new ViewModelProvider(activity).get(NetworkMonitorViewModel.class);<NEW_LINE>activityViewModel.selectedItem.observe(this, item -> {<NEW_LINE>if (item instanceof HostAndPort) {<NEW_LINE><MASK><NEW_LINE>adapter.setSelectedPeer(peerHostAndPort);<NEW_LINE>final int position = adapter.positionOf(peerHostAndPort);<NEW_LINE>if (position != RecyclerView.NO_POSITION)<NEW_LINE>recyclerView.smoothScrollToPosition(position);<NEW_LINE>} else {<NEW_LINE>adapter.setSelectedPeer(null);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>viewModel = new ViewModelProvider(this).get(PeerListViewModel.class);<NEW_LINE>viewModel.peers.observe(this, peers -> {<NEW_LINE>viewGroup.setDisplayedChild((peers == null || peers.isEmpty()) ? 1 : 2);<NEW_LINE>maybeSubmitList();<NEW_LINE>if (peers != null)<NEW_LINE>for (final Peer peer : peers) viewModel.getHostnames().reverseLookup(peer.getAddress().getAddr());<NEW_LINE>});<NEW_LINE>viewModel.getHostnames().observe(this, hostnames -> maybeSubmitList());<NEW_LINE>adapter = new PeerListAdapter(activity, this);<NEW_LINE>} | final HostAndPort peerHostAndPort = (HostAndPort) item; |
1,769,893 | private void addIgnoreActionForNotification(Context context, NotificationCompat.Builder builder, int postId, boolean isPage) {<NEW_LINE>// Call processing service when user taps on IGNORE - we should remember this decision for this post<NEW_LINE>Intent ignoreIntent = new Intent(context, NotificationsProcessingService.class);<NEW_LINE>ignoreIntent.putExtra(NotificationsProcessingService.ARG_ACTION_TYPE, NotificationsProcessingService.ARG_ACTION_DRAFT_PENDING_IGNORE);<NEW_LINE><MASK><NEW_LINE>ignoreIntent.putExtra(IS_PAGE_EXTRA, isPage);<NEW_LINE>ignoreIntent.putExtra(ARG_NOTIFICATION_TYPE, NotificationType.PENDING_DRAFTS);<NEW_LINE>PendingIntent ignorePendingIntent = // need to add + 2 so the request code is different, otherwise they overlap<NEW_LINE>PendingIntent.// need to add + 2 so the request code is different, otherwise they overlap<NEW_LINE>getService(// need to add + 2 so the request code is different, otherwise they overlap<NEW_LINE>context, BASE_REQUEST_CODE + 2 + PendingDraftsNotificationsUtils.makePendingDraftNotificationId(postId), ignoreIntent, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);<NEW_LINE>builder.addAction(R.drawable.ic_close_white_24dp, context.getText(R.string.ignore), ignorePendingIntent);<NEW_LINE>} | ignoreIntent.putExtra(POST_ID_EXTRA, postId); |
1,255,246 | public static Spectrum readSpectrum(BufferedImage image, Rectangle area, int precision) throws IOException {<NEW_LINE>if (precision < 8)<NEW_LINE>throw new IllegalArgumentException("Color size should not be less then 8");<NEW_LINE>if (precision > 256)<NEW_LINE>throw new IllegalArgumentException("Color size should not be bigger then 256");<NEW_LINE>int[][][] spectrum = new int[precision][precision][precision];<NEW_LINE>int width = image.getWidth();<NEW_LINE>int height = image.getHeight();<NEW_LINE>int[] a = new int[width * height];<NEW_LINE>image.getRGB(0, 0, width, height, a, 0, width);<NEW_LINE>int spectrumWidth = width;<NEW_LINE>int spectrumHeight = height;<NEW_LINE>if (area == null) {<NEW_LINE>area = new Rectangle(0, 0, width, height);<NEW_LINE>} else {<NEW_LINE>spectrumWidth = area.width;<NEW_LINE>spectrumHeight = area.height;<NEW_LINE>}<NEW_LINE>int k = 0;<NEW_LINE>int r, g, b;<NEW_LINE>for (int y = area.y; y < area.y + area.height; y++) {<NEW_LINE>for (int x = area.x; x < area.x + area.width; x++) {<NEW_LINE>k = y * width + x;<NEW_LINE>r = ((a[k] >> 16) & 0xff) * precision / 256;<NEW_LINE>g = ((a[k] >> 8) & 0xff) * precision / 256;<NEW_LINE>b = ((a[k]<MASK><NEW_LINE>spectrum[Math.min(r, precision - 1)][Math.min(g, precision - 1)][Math.min(b, precision - 1)] += 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new Spectrum(spectrum, spectrumWidth, spectrumHeight);<NEW_LINE>} | ) & 0xff) * precision / 256; |
1,303,281 | private void saveLine(@NonNull final IQualityInvoiceLine line) {<NEW_LINE>final I_C_Invoice_Candidate invoiceCandidate = getC_Invoice_Candidate();<NEW_LINE>final int seqNo = _seqNoNext;<NEW_LINE>final Quantity lineQty = line.getQty();<NEW_LINE>// Pricing<NEW_LINE>final IPricingResult pricingResult = line.getPrice();<NEW_LINE>final UomId priceUOMId;<NEW_LINE>final BigDecimal price;<NEW_LINE>final BigDecimal discount;<NEW_LINE>final BigDecimal qtyEnteredInPriceUOM;<NEW_LINE>if (pricingResult != null) {<NEW_LINE>priceUOMId = pricingResult.getPriceUomId();<NEW_LINE>price = pricingResult.getPriceStd();<NEW_LINE>discount = pricingResult.getDiscount().toBigDecimal();<NEW_LINE>final IUOMConversionBL uomConversionBL = Services.get(IUOMConversionBL.class);<NEW_LINE>qtyEnteredInPriceUOM = uomConversionBL.convertQuantityTo(lineQty, UOMConversionContext.of(line.getProductId()), priceUOMId).toBigDecimal();<NEW_LINE>} else {<NEW_LINE>priceUOMId = lineQty.getUomId();<NEW_LINE>price = null;<NEW_LINE>discount = null;<NEW_LINE>qtyEnteredInPriceUOM = lineQty.toBigDecimal();<NEW_LINE>}<NEW_LINE>final I_C_Invoice_Detail invoiceDetail = InterfaceWrapperHelper.newInstance(I_C_Invoice_Detail.class, getContext());<NEW_LINE>invoiceDetail.setAD_Org_ID(invoiceCandidate.getAD_Org_ID());<NEW_LINE>invoiceDetail.setC_Invoice_Candidate(invoiceCandidate);<NEW_LINE>invoiceDetail.setSeqNo(seqNo);<NEW_LINE>invoiceDetail.setIsActive(true);<NEW_LINE>invoiceDetail.setIsDetailOverridesLine(isPrintOverride());<NEW_LINE>// the override-details line is always printed<NEW_LINE>invoiceDetail.setIsPrinted(isPrintOverride() ? true : line.isDisplayed());<NEW_LINE>invoiceDetail.setDescription(line.getDescription());<NEW_LINE>invoiceDetail.setIsPrintBefore(isPrintBefore());<NEW_LINE>invoiceDetail.setM_Product_ID(ProductId.toRepoId(line.getProductId()));<NEW_LINE>invoiceDetail.setNote(line.getProductName());<NEW_LINE>// invoiceDetail.setM_AttributeSetInstance(M_AttributeSetInstance);<NEW_LINE>invoiceDetail.setQty(lineQty.toBigDecimal());<NEW_LINE>invoiceDetail.setC_UOM_ID(lineQty.<MASK><NEW_LINE>invoiceDetail.setDiscount(discount);<NEW_LINE>invoiceDetail.setPriceEntered(price);<NEW_LINE>invoiceDetail.setPriceActual(price);<NEW_LINE>invoiceDetail.setQtyEnteredInPriceUOM(qtyEnteredInPriceUOM);<NEW_LINE>invoiceDetail.setPrice_UOM_ID(UomId.toRepoId(priceUOMId));<NEW_LINE>invoiceDetail.setPercentage(line.getPercentage());<NEW_LINE>invoiceDetail.setPP_Order(line.getPP_Order());<NEW_LINE>// Set Handling Units specific infos<NEW_LINE>handlingUnitsInfoFactory.updateInvoiceDetail(invoiceDetail, line.getHandlingUnitsInfo());<NEW_LINE>//<NEW_LINE>// Save detail line<NEW_LINE>InterfaceWrapperHelper.save(invoiceDetail);<NEW_LINE>I_C_Invoice_Detail.DYNATTR_C_Invoice_Detail_IQualityInvoiceLine.setValue(invoiceDetail, line);<NEW_LINE>_createdLines.add(invoiceDetail);<NEW_LINE>_seqNoNext += 10;<NEW_LINE>} | getUomId().getRepoId()); |
1,164,567 | public static BigDecimal computeChildInvoiceAmount(final Currency currency, @Nullable final Iterable<InvoiceItem> invoiceItems) {<NEW_LINE>if (invoiceItems == null) {<NEW_LINE>return BigDecimal.ZERO;<NEW_LINE>}<NEW_LINE>final Iterable<InvoiceItem> chargeItems = Iterables.filter(invoiceItems, new Predicate<InvoiceItem>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean apply(final InvoiceItem input) {<NEW_LINE>return isCharge(input);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>if (Iterables.isEmpty(chargeItems)) {<NEW_LINE>// return only credit amount to be subtracted to parent item amount<NEW_LINE>return computeInvoiceAmountCredited(<MASK><NEW_LINE>}<NEW_LINE>final BigDecimal chargedAmount = computeInvoiceAmountCharged(currency, invoiceItems).add(computeInvoiceAmountCredited(currency, invoiceItems)).add(computeInvoiceAmountAdjustedForAccountCredit(currency, invoiceItems));<NEW_LINE>return KillBillMoney.of(chargedAmount, currency);<NEW_LINE>} | currency, invoiceItems).negate(); |
1,100,162 | public void bindView(View view, Context context, Cursor cursor) {<NEW_LINE>View square = view.findViewById(R.id.color_square);<NEW_LINE>int color = Utils.getDisplayColorFromColor(context, cursor.getInt(AlertActivity.INDEX_COLOR));<NEW_LINE>square.setBackgroundColor(color);<NEW_LINE>// Repeating info<NEW_LINE>View repeatContainer = view.<MASK><NEW_LINE>String rrule = cursor.getString(AlertActivity.INDEX_RRULE);<NEW_LINE>if (!TextUtils.isEmpty(rrule)) {<NEW_LINE>repeatContainer.setVisibility(View.VISIBLE);<NEW_LINE>} else {<NEW_LINE>repeatContainer.setVisibility(View.GONE);<NEW_LINE>}<NEW_LINE>String eventName = cursor.getString(AlertActivity.INDEX_TITLE);<NEW_LINE>String location = cursor.getString(AlertActivity.INDEX_EVENT_LOCATION);<NEW_LINE>long startMillis = cursor.getLong(AlertActivity.INDEX_BEGIN);<NEW_LINE>long endMillis = cursor.getLong(AlertActivity.INDEX_END);<NEW_LINE>boolean allDay = cursor.getInt(AlertActivity.INDEX_ALL_DAY) != 0;<NEW_LINE>updateView(context, view, eventName, location, startMillis, endMillis, allDay);<NEW_LINE>} | findViewById(R.id.repeat_icon); |
381,123 | public static <T> MouseMotionListener installAutoSelectOnMouseMove(@Nonnull JList<T> list) {<NEW_LINE>final MouseMotionAdapter listener = new MouseMotionAdapter() {<NEW_LINE><NEW_LINE>boolean myIsEngaged = false;<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void mouseMoved(MouseEvent e) {<NEW_LINE>Component focusOwner = KeyboardFocusManager<MASK><NEW_LINE>if (myIsEngaged && !UIUtil.isSelectionButtonDown(e) && !(focusOwner instanceof JRootPane)) {<NEW_LINE>Point point = e.getPoint();<NEW_LINE>int index = list.locationToIndex(point);<NEW_LINE>list.putClientProperty(SELECTED_BY_MOUSE_EVENT, Boolean.TRUE);<NEW_LINE>list.setSelectedIndex(index);<NEW_LINE>list.putClientProperty(SELECTED_BY_MOUSE_EVENT, Boolean.FALSE);<NEW_LINE>} else {<NEW_LINE>myIsEngaged = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>list.addMouseMotionListener(listener);<NEW_LINE>return listener;<NEW_LINE>} | .getCurrentKeyboardFocusManager().getFocusOwner(); |
95,522 | private void initWindow() {<NEW_LINE>logger.info("Initializing display (if last line in log then likely the game crashed from an issue with your " + "video card)");<NEW_LINE>// set opengl core profile to 3.3<NEW_LINE>GLFW.glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MAJOR, 3);<NEW_LINE>GLFW.glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MINOR, 3);<NEW_LINE>GLFW.glfwWindowHint(<MASK><NEW_LINE>long window = GLFW.glfwCreateWindow(config.getWindowWidth(), config.getWindowHeight(), "Terasology Alpha", 0, 0);<NEW_LINE>if (window == 0) {<NEW_LINE>throw new RuntimeException("Failed to create window");<NEW_LINE>}<NEW_LINE>GLFW.glfwMakeContextCurrent(window);<NEW_LINE>if (!config.isVSync()) {<NEW_LINE>GLFW.glfwSwapInterval(0);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>String root = "org/terasology/engine/icons/";<NEW_LINE>ClassLoader classLoader = getClass().getClassLoader();<NEW_LINE>BufferedImage icon16 = ImageIO.read(classLoader.getResourceAsStream(root + "gooey_sweet_16.png"));<NEW_LINE>BufferedImage icon32 = ImageIO.read(classLoader.getResourceAsStream(root + "gooey_sweet_32.png"));<NEW_LINE>BufferedImage icon64 = ImageIO.read(classLoader.getResourceAsStream(root + "gooey_sweet_64.png"));<NEW_LINE>BufferedImage icon128 = ImageIO.read(classLoader.getResourceAsStream(root + "gooey_sweet_128.png"));<NEW_LINE>GLFWImage.Buffer buffer = GLFWImage.create(4);<NEW_LINE>buffer.put(0, LwjglGraphicsUtil.convertToGLFWFormat(icon16));<NEW_LINE>buffer.put(1, LwjglGraphicsUtil.convertToGLFWFormat(icon32));<NEW_LINE>buffer.put(2, LwjglGraphicsUtil.convertToGLFWFormat(icon64));<NEW_LINE>buffer.put(3, LwjglGraphicsUtil.convertToGLFWFormat(icon128));<NEW_LINE>GLFW.glfwSetWindowIcon(window, buffer);<NEW_LINE>} catch (IOException | IllegalArgumentException e) {<NEW_LINE>logger.warn("Could not set icon", e);<NEW_LINE>}<NEW_LINE>lwjglDisplay.setDisplayModeSetting(config.getDisplayModeSetting(), false);<NEW_LINE>GLFW.glfwShowWindow(window);<NEW_LINE>} | GLFW.GLFW_OPENGL_PROFILE, GLFW.GLFW_OPENGL_CORE_PROFILE); |
1,743,861 | public static Dataset<Row> buildGraph(Dataset<Row> vertices, Dataset<Row> edges) {<NEW_LINE>// we need to transform the input here by using stop words<NEW_LINE>// rename id field which is a common field in data to another field as it<NEW_LINE>// clashes with graphframes :-(<NEW_LINE>vertices = vertices.withColumnRenamed(ColName.ID_EXTERNAL_ORIG_COL, ColName.ID_EXTERNAL_COL);<NEW_LINE>Dataset<Row> v1 = vertices.withColumnRenamed(ColName.ID_COL, "id");<NEW_LINE>Dataset<Row> v = v1.select("id").cache();<NEW_LINE>List<Column> cols = new ArrayList<Column>();<NEW_LINE>cols.add(edges.col(ColName.ID_COL));<NEW_LINE>cols.add(edges.col(ColName<MASK><NEW_LINE>Dataset<Row> e = edges.select(JavaConverters.asScalaIteratorConverter(cols.iterator()).asScala().toSeq());<NEW_LINE>e = e.toDF("src", "dst").cache();<NEW_LINE>GraphFrame gf = new GraphFrame(v, e);<NEW_LINE>// gf = gf.dropIsolatedVertices();<NEW_LINE>// Dataset<Row> returnGraph = gf.connectedComponents().setAlgorithm("graphx").run().cache();<NEW_LINE>Dataset<Row> returnGraph = gf.connectedComponents().run().cache();<NEW_LINE>// reverse back o avoid graphframes id :-()<NEW_LINE>returnGraph = returnGraph.join(vertices, returnGraph.col("id").equalTo(vertices.col(ColName.ID_COL)));<NEW_LINE>returnGraph = returnGraph.drop(ColName.ID_COL).withColumnRenamed("id", ColName.ID_COL);<NEW_LINE>returnGraph = returnGraph.withColumnRenamed("component", ColName.CLUSTER_COLUMN);<NEW_LINE>returnGraph = returnGraph.withColumnRenamed(ColName.ID_EXTERNAL_COL, ColName.ID_EXTERNAL_ORIG_COL);<NEW_LINE>return returnGraph;<NEW_LINE>} | .COL_PREFIX + ColName.ID_COL)); |
1,072,370 | final PutSessionResult executePutSession(PutSessionRequest putSessionRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(putSessionRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<PutSessionRequest> request = null;<NEW_LINE>Response<PutSessionResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new PutSessionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(putSessionRequest));<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, "Lex Runtime Service");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "PutSession");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<PutSessionResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(false).withHasStreamingSuccessResponse(true), new PutSessionResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>request.addHandlerContext(HandlerContextKey.HAS_STREAMING_OUTPUT, Boolean.TRUE);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); |
768,472 | private void throwInvalidImportedModuleError(Toml toml, Module module) {<NEW_LINE>String moduleKey = getModuleKey(module);<NEW_LINE>TomlNode errorNode = null;<NEW_LINE>Optional<TomlValueNode> valueNode = toml.get(moduleKey);<NEW_LINE>List<Toml> tomlTables = toml.getTables(moduleKey);<NEW_LINE>String moduleName = module.getName();<NEW_LINE>if (valueNode.isEmpty()) {<NEW_LINE>valueNode = toml.get(moduleName);<NEW_LINE>}<NEW_LINE>if (tomlTables.isEmpty()) {<NEW_LINE>tomlTables = toml.getTables(moduleName);<NEW_LINE>}<NEW_LINE>Optional<Toml> tableNode = toml.getTable(moduleName);<NEW_LINE>if (tableNode.isPresent()) {<NEW_LINE>errorNode = tableNode.get().rootNode();<NEW_LINE>} else if (valueNode.isPresent()) {<NEW_LINE>errorNode = valueNode.get();<NEW_LINE>} else if (!tomlTables.isEmpty()) {<NEW_LINE>errorNode = tomlTables.get(0).rootNode();<NEW_LINE>}<NEW_LINE>if (errorNode != null) {<NEW_LINE>invalidRequiredModuleSet.add(module.toString());<NEW_LINE>invalidTomlLines.add(errorNode.<MASK><NEW_LINE>throw new ConfigException(CONFIG_TOML_INVALID_MODULE_STRUCTURE, getLineRange(errorNode), moduleKey, moduleKey);<NEW_LINE>}<NEW_LINE>} | location().lineRange()); |
854,996 | /*<NEW_LINE>* Validate the classpaths of the projects affected by the given delta.<NEW_LINE>* Create markers if necessary.<NEW_LINE>* Returns whether cycle markers should be recomputed.<NEW_LINE>*/<NEW_LINE>private boolean validateClasspaths(IResourceDelta delta) {<NEW_LINE>Set<IPath> affectedProjects = new HashSet<>(5);<NEW_LINE>validateClasspaths(delta, affectedProjects);<NEW_LINE>boolean needCycleValidation = false;<NEW_LINE>// validate classpaths of affected projects (dependent projects<NEW_LINE>// or projects that reference a library in one of the projects that have changed)<NEW_LINE>if (!affectedProjects.isEmpty()) {<NEW_LINE>IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();<NEW_LINE>IProject[<MASK><NEW_LINE>int length = projects.length;<NEW_LINE>for (int i = 0; i < length; i++) {<NEW_LINE>IProject project = projects[i];<NEW_LINE>JavaProject javaProject = (JavaProject) JavaCore.create(project);<NEW_LINE>try {<NEW_LINE>IPath projectPath = project.getFullPath();<NEW_LINE>// allowed to reuse model cache<NEW_LINE>IClasspathEntry[] classpath = javaProject.getResolvedClasspath();<NEW_LINE>for (int j = 0, cpLength = classpath.length; j < cpLength; j++) {<NEW_LINE>IClasspathEntry entry = classpath[j];<NEW_LINE>switch(entry.getEntryKind()) {<NEW_LINE>case IClasspathEntry.CPE_PROJECT:<NEW_LINE>if (affectedProjects.contains(entry.getPath())) {<NEW_LINE>this.state.addClasspathValidation(javaProject);<NEW_LINE>needCycleValidation = true;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case IClasspathEntry.CPE_LIBRARY:<NEW_LINE>IPath entryPath = entry.getPath();<NEW_LINE>IPath libProjectPath = entryPath.removeLastSegments(entryPath.segmentCount() - 1);<NEW_LINE>if (// if library contained in another project<NEW_LINE>!libProjectPath.equals(projectPath) && affectedProjects.contains(libProjectPath)) {<NEW_LINE>this.state.addClasspathValidation(javaProject);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (JavaModelException e) {<NEW_LINE>// project no longer exists<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return needCycleValidation;<NEW_LINE>} | ] projects = workspaceRoot.getProjects(); |
93,629 | public void testAsyncInvoker_getConnectionTimeout(Map<String, String> param, StringBuilder ret) {<NEW_LINE>String target = null;<NEW_LINE>if (isZOS()) {<NEW_LINE>// https://stackoverflow.com/a/904609/6575578<NEW_LINE>target = "http://example.com:81";<NEW_LINE>} else {<NEW_LINE>// Connect to telnet port - which should be disabled on all non-Z test machines - so we should expect a timeout<NEW_LINE>target = "http://localhost:23/blah";<NEW_LINE>}<NEW_LINE>ClientBuilder cb = ClientBuilder.newBuilder();<NEW_LINE>cb.property("com.ibm.ws.jaxrs.client.connection.timeout", TIMEOUT);<NEW_LINE>Client c = cb.build();<NEW_LINE>WebTarget t = c.target(target);<NEW_LINE>Builder builder = t.request();<NEW_LINE>AsyncInvoker asyncInvoker = builder.async();<NEW_LINE>long startTime = System.currentTimeMillis();<NEW_LINE>Future<Response> future = asyncInvoker.get();<NEW_LINE>long elapsed = System.currentTimeMillis() - startTime;<NEW_LINE>System.out.println("testAsyncInvoker_getConnectionTimeout with TIMEOUT " + TIMEOUT + " asyncInvoker.get elapsed time " + elapsed);<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>System.out.println("testAsyncInvoker_getConnectionTimeout before future.get()");<NEW_LINE>Response response = future.get();<NEW_LINE>System.out.println("testAsyncInvoker_getConnectionTimeout Did not time out as expected");<NEW_LINE>// Did not time out as expected<NEW_LINE>ret.append(response.readEntity(String.class));<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>System.out.println("testAsyncInvoker_getConnectionTimeout Failed InterruptedException " + e);<NEW_LINE>ret.append("InterruptedException");<NEW_LINE>e.printStackTrace();<NEW_LINE>} catch (ExecutionException e) {<NEW_LINE>System.out.println("testAsyncInvoker_getConnectionTimeout ExecutionException " + e);<NEW_LINE>if (e.getCause().toString().contains("ProcessingException")) {<NEW_LINE>System.out.println("testAsyncInvoker_getConnectionTimeout Timeout as expected");<NEW_LINE>ret.append("Timeout as expected");<NEW_LINE>} else {<NEW_LINE>System.out.println("testAsyncInvoker_getConnectionTimeout Failed ExecutionException");<NEW_LINE>ret.append("ExecutionException");<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>long elapsed2 = System.currentTimeMillis() - startTime2;<NEW_LINE>System.out.println("testAsyncInvoker_getConnectionTimeout with TIMEOUT " + TIMEOUT + " future.get() elapsed2 time " + elapsed2);<NEW_LINE>c.close();<NEW_LINE>} | long startTime2 = System.currentTimeMillis(); |
1,511,211 | public void onScroll(int dragDirection, int moveEdge, float scrollPercent) {<NEW_LINE>scrollPercent = Math.max(0f, Math.min(1f, scrollPercent));<NEW_LINE>QMUIFragmentContainerProvider provider = findFragmentContainerProvider(false);<NEW_LINE>if (provider == null || provider.getFragmentContainerView() == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>FragmentContainerView container = provider.getFragmentContainerView();<NEW_LINE>int targetOffset = (int) (Math.abs(backViewInitOffset(container.getContext(), dragDirection, moveEdge)) * (1 - scrollPercent));<NEW_LINE>int childCount = container.getChildCount();<NEW_LINE>for (int i = childCount - 1; i >= 0; i--) {<NEW_LINE>View view = container.getChildAt(i);<NEW_LINE>Object tag = view.getTag(R.id.qmui_arch_swipe_layout_in_back);<NEW_LINE>if (SWIPE_BACK_VIEW.equals(tag)) {<NEW_LINE>SwipeBackLayout.translateInSwipeBack(view, moveEdge, targetOffset);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (mSwipeBackgroundView != null) {<NEW_LINE>SwipeBackLayout.<MASK><NEW_LINE>}<NEW_LINE>} | translateInSwipeBack(mSwipeBackgroundView, moveEdge, targetOffset); |
654,455 | static List<PartitionDefinition> findShardPartitions(Settings settings, MappingSet mappingSet, Map<String, NodeInfo> nodes, List<List<Map<String, Object>>> shards, Log log) {<NEW_LINE>Mapping resolvedMapping = mappingSet == null <MASK><NEW_LINE>List<PartitionDefinition> partitions = new ArrayList<PartitionDefinition>(shards.size());<NEW_LINE>PartitionDefinition.PartitionDefinitionBuilder partitionBuilder = PartitionDefinition.builder(settings, resolvedMapping);<NEW_LINE>for (List<Map<String, Object>> group : shards) {<NEW_LINE>String index = null;<NEW_LINE>int shardId = -1;<NEW_LINE>List<String> locationList = new ArrayList<String>();<NEW_LINE>for (Map<String, Object> replica : group) {<NEW_LINE>ShardInfo shard = new ShardInfo(replica);<NEW_LINE>index = shard.getIndex();<NEW_LINE>shardId = shard.getName();<NEW_LINE>if (nodes.containsKey(shard.getNode())) {<NEW_LINE>locationList.add(nodes.get(shard.getNode()).getPublishAddress());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (index == null) {<NEW_LINE>// Could not find shards for this partition. Continue anyway?<NEW_LINE>if (settings.getIndexReadAllowRedStatus()) {<NEW_LINE>log.warn("Shard information is missing from an index and will not be reached during job execution. " + "Assuming shard is unavailable and cluster is red! Continuing with read operation by " + "skipping this shard! This may result in incomplete data retrieval!");<NEW_LINE>} else {<NEW_LINE>throw new IllegalStateException("Could not locate shard information for one of the read indices. " + "Check your cluster status to see if it is unstable!");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>PartitionDefinition partition = partitionBuilder.build(index, shardId, locationList.toArray(new String[0]));<NEW_LINE>partitions.add(partition);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return partitions;<NEW_LINE>} | ? null : mappingSet.getResolvedView(); |
1,572,552 | public void addSpnToKeytab(String user, String spn) throws Exception {<NEW_LINE>String methodName = "addSpnToKeytab";<NEW_LINE>Log.info(thisClass, methodName, "Adding SPN: " + "spn" + " for user: " + user + " to existing keytab file");<NEW_LINE>String localScriptName = SPNEGOConstants.ADD_SPN_TO_KEYTAB_LOCAL_FILE;<NEW_LINE>String remoteScriptName = getUniqueRemoteFileName(SPNEGOConstants.ADD_SPN_TO_KEYTAB_REMOTE_FILE);<NEW_LINE>server.copyFileToLibertyServerRoot(SPNEGOConstants.KERBEROS, localScriptName);<NEW_LINE>if (InitClass.needToPushaddSPNKeytab) {<NEW_LINE>Log.info(thisClass, methodName, "We need to push the addSPNKeytab script to the KDC");<NEW_LINE>pushLocalFileToRemoteMachine(getKdcMachine(), localScriptName, remoteScriptName);<NEW_LINE>} else {<NEW_LINE>Log.info(thisClass, methodName, "We don't need to push the addSPNKeytab script to the KDC");<NEW_LINE>}<NEW_LINE>String shortHostName = InitClass.serverShortHostName;<NEW_LINE>String addSpnToKeytabCommand = "./" + remoteScriptName + " " + user + " " + InitClass.USER_PWD + " HTTP " + spn + " " + shortHostName + SPNEGOConstants.KRB5_KEYTAB_TEMP_SUFFIX + " " + getKdcRealm();<NEW_LINE>ProgramOutput output = executeRemoteCommand(remoteScriptName, addSpnToKeytabCommand, true);<NEW_LINE>InitClass.needToPushaddSPNKeytab = false;<NEW_LINE>if (output.getReturnCode() != 0) {<NEW_LINE>throw new RemoteException("Adding SPN to keytab failed with return code " + output.getReturnCode());<NEW_LINE>}<NEW_LINE>// Retrieve the new keytab file from the KDC machine<NEW_LINE>String remoteKeytabPath = SPNEGOConstants<MASK><NEW_LINE>String localKeytabPath = server.getServerRoot() + SPNEGOConstants.KRB_RESOURCE_LOCATION + shortHostName + SPNEGOConstants.KRB5_KEYTAB_TEMP_SUFFIX;<NEW_LINE>Machine kdcMachine = getKdcMachine();<NEW_LINE>retrieveFile(kdcMachine, remoteKeytabPath, localKeytabPath);<NEW_LINE>renameKeytabToDefaultName(shortHostName + SPNEGOConstants.KRB5_KEYTAB_TEMP_SUFFIX);<NEW_LINE>} | .CYGWIN_HOME_REALM_1 + shortHostName + SPNEGOConstants.KRB5_KEYTAB_TEMP_SUFFIX; |
919,812 | private boolean verifyGoogDefine(Node callNode) {<NEW_LINE>this.knownGoogDefineCalls.add(callNode);<NEW_LINE>Node parent = callNode.getParent();<NEW_LINE>Node methodName = callNode.getFirstChild();<NEW_LINE>Node args = callNode.getSecondChild();<NEW_LINE>// Calls to goog.define must be in the global hoist scope after module rewriting<NEW_LINE>if (NodeUtil.getEnclosingFunction(callNode) != null) {<NEW_LINE>compiler.report(JSError.make(methodName<MASK><NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// It is an error for goog.define to show up anywhere except immediately after =.<NEW_LINE>if (parent.isAssign() && parent.getParent().isExprResult()) {<NEW_LINE>parent = parent.getParent();<NEW_LINE>} else if (parent.isName() && NodeUtil.isNameDeclaration(parent.getParent())) {<NEW_LINE>parent = parent.getParent();<NEW_LINE>} else {<NEW_LINE>compiler.report(JSError.make(methodName.getParent(), DEFINE_CALL_WITHOUT_ASSIGNMENT));<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// Verify first arg<NEW_LINE>Node arg = args;<NEW_LINE>if (!verifyNotNull(methodName, arg) || !verifyOfType(methodName, arg, Token.STRINGLIT)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// Verify second arg<NEW_LINE>arg = arg.getNext();<NEW_LINE>if (!args.isFromExterns() && (!verifyNotNull(methodName, arg) || !verifyIsLast(methodName, arg))) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>String name = args.getString();<NEW_LINE>if (!NodeUtil.isValidQualifiedName(compiler.getOptions().getLanguageIn().toFeatureSet(), name)) {<NEW_LINE>compiler.report(JSError.make(args, INVALID_DEFINE_NAME_ERROR, name));<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>JSDocInfo info = (parent.isExprResult() ? parent.getFirstChild() : parent).getJSDocInfo();<NEW_LINE>if (info == null || !info.isDefine()) {<NEW_LINE>compiler.report(JSError.make(parent, MISSING_DEFINE_ANNOTATION));<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | .getParent(), INVALID_CLOSURE_CALL_SCOPE_ERROR)); |
445,222 | void dumpStats() {<NEW_LINE>if (parserPhaseTime.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>LOG.finer("Phase times:");<NEW_LINE>for (int i = 0; i <= Phases.ALL; i++) {<NEW_LINE>Long d = parserPhaseTime.get(i);<NEW_LINE>if (d == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>LOG.log(Level.FINER, "\t" + phaseToString(i) + ":\t" + avg(d));<NEW_LINE>}<NEW_LINE>LOG.log(Level.FINER, "\nPhase - visitor statistics:");<NEW_LINE>for (int i = Phases.INITIALIZATION; i <= Phases.ALL; i++) {<NEW_LINE>Map<String, Long> vc = visitorCounters.get(i);<NEW_LINE>if (vc == null || vc.isEmpty()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>LOG.log(Level.FINER, "Visitors from {0}", phaseToString(i));<NEW_LINE>List<String> visitors = new ArrayList<>(vc.keySet());<NEW_LINE>Collections.sort(visitors);<NEW_LINE>for (String c : visitors) {<NEW_LINE>LOG.log(Level.FINER, "\t{0}:\t{1}", new Object[] { c, avg(vc.get(c)) });<NEW_LINE>}<NEW_LINE>}<NEW_LINE>LOG.log(Level.FINER, "Performance counters:");<NEW_LINE>List<String> keys = new ArrayList<<MASK><NEW_LINE>Collections.sort(keys);<NEW_LINE>for (String s : keys) {<NEW_LINE>LOG.log(Level.FINER, "\t{0}:\t{1}", new Object[] { s, avg(perfCounters.get(s)) });<NEW_LINE>}<NEW_LINE>} | >(perfCounters.keySet()); |
1,125,302 | public void run() {<NEW_LINE>CoapResponse response;<NEW_LINE>try {<NEW_LINE>CoapClient client = new CoapClient(uri);<NEW_LINE>response = client.get();<NEW_LINE>} catch (Exception ex) {<NEW_LINE>Log.e("coap", <MASK><NEW_LINE>response = null;<NEW_LINE>}<NEW_LINE>final CoapResponse finalResponse = response;<NEW_LINE>handler.post(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>if (finalResponse != null) {<NEW_LINE>((TextView) findViewById(R.id.textCode)).setText(finalResponse.getCode().toString());<NEW_LINE>((TextView) findViewById(R.id.textCodeName)).setText(finalResponse.getCode().name());<NEW_LINE>Long rtt = finalResponse.advanced().getApplicationRttNanos();<NEW_LINE>if (rtt != null) {<NEW_LINE>((TextView) findViewById(R.id.textRtt)).setText(TimeUnit.NANOSECONDS.toMillis(rtt) + " ms");<NEW_LINE>}<NEW_LINE>((TextView) findViewById(R.id.textContent)).setText(finalResponse.getResponseText());<NEW_LINE>} else {<NEW_LINE>((TextView) findViewById(R.id.textCodeName)).setText("No response");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | ex.getMessage(), ex); |
1,492,379 | BacktrackSteps[][] evaluateSteps(final List leftList, final List rightList) {<NEW_LINE>final int leftDim = leftList.size() + 1;<NEW_LINE>final int rightDim = rightList.size() + 1;<NEW_LINE>final BacktrackSteps[][] steps = new BacktrackSteps[leftDim][rightDim];<NEW_LINE>final int[][] <MASK><NEW_LINE>for (int i = 1; i < leftDim; ++i) {<NEW_LINE>for (int j = 1; j < rightDim; ++j) {<NEW_LINE>int skipLeft = scores[i - 1][j] - PENALTY;<NEW_LINE>int skipRight = scores[i][j - 1] - PENALTY;<NEW_LINE>int take = scores[i - 1][j - 1] - compareListElements(leftList.get(i - 1), rightList.get(j - 1));<NEW_LINE>int max = Math.max(skipLeft, Math.max(skipRight, take));<NEW_LINE>final BacktrackSteps step;<NEW_LINE>if (max == skipLeft) {<NEW_LINE>step = BacktrackSteps.SKIP_LEFT;<NEW_LINE>} else if (max == skipRight) {<NEW_LINE>step = BacktrackSteps.SKIP_RIGHT;<NEW_LINE>} else {<NEW_LINE>step = BacktrackSteps.TAKE;<NEW_LINE>}<NEW_LINE>scores[i][j] = max;<NEW_LINE>steps[i][j] = step;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return steps;<NEW_LINE>} | scores = initScores(leftDim, rightDim); |
1,192,462 | public void run(RegressionEnvironment env) {<NEW_LINE>RegressionPath path = new RegressionPath();<NEW_LINE>env.compileDeploy("@public create json schema Book(bookId string, price BigDecimal);\n", path);<NEW_LINE>env.compileDeploy("@public create json schema Shelf(shelfId string, book Book);\n", path);<NEW_LINE><MASK><NEW_LINE>env.compileDeploy("@public @buseventtype create json schema Library(libraryId string, isle Isle);\n", path);<NEW_LINE>env.compileDeploy("@name('s0') select * from Library;\n", path).addListener("s0");<NEW_LINE>String json;<NEW_LINE>json = "{\n" + " \"libraryId\": \"L\",\n" + " \"isle\": {\n" + " \"isleId\": \"I1\",\n" + " \"shelf\": {\n" + " \"shelfId\": \"S11\",\n" + " \"book\": {\n" + " \"bookId\": \"B111\",\n" + " \"price\": 20\n" + " }\n" + " }\n" + " }\n" + "}";<NEW_LINE>sendAssertLibrary(env, json, "L", "I1", "S11", "B111");<NEW_LINE>json = "{\n" + " \"libraryId\": \"L\",\n" + " \"isle\": null\n" + "}";<NEW_LINE>sendAssertLibrary(env, json, "L", null, null, null);<NEW_LINE>json = "{\n" + " \"libraryId\": \"L\",\n" + " \"isle\": {\n" + " \"isleId\": \"I1\",\n" + " \"shelf\": null\n" + " }\n" + "}";<NEW_LINE>sendAssertLibrary(env, json, "L", "I1", null, null);<NEW_LINE>json = "{\n" + " \"libraryId\": \"L\",\n" + " \"isle\": {\n" + " \"isleId\": \"I1\",\n" + " \"shelf\": {\n" + " \"shelfId\": \"S11\",\n" + " \"book\": null\n" + " }\n" + " }\n" + "}";<NEW_LINE>sendAssertLibrary(env, json, "L", "I1", "S11", null);<NEW_LINE>env.undeployAll();<NEW_LINE>} | env.compileDeploy("@public create json schema Isle(isleId string, shelf Shelf);\n", path); |
85,870 | protected void onPostExecute(Integer result) {<NEW_LINE>EventBus.getDefault().removeStickyEvent(BaseMessageActivity.ServiceActiveEvent.class);<NEW_LINE>boolean displaySuccess;<NEW_LINE>String confirmationText;<NEW_LINE>if (result == SUCCESS) {<NEW_LINE>// success!<NEW_LINE>displaySuccess = true;<NEW_LINE>confirmationText = getSuccessTextResId() != 0 ? context.getString(getSuccessTextResId()) : null;<NEW_LINE>} else {<NEW_LINE>// handle errors<NEW_LINE>displaySuccess = false;<NEW_LINE>switch(result) {<NEW_LINE>case ERROR_NETWORK:<NEW_LINE>confirmationText = context.getString(R.string.offline);<NEW_LINE>break;<NEW_LINE>case ERROR_DATABASE:<NEW_LINE>confirmationText = context.getString(R.string.database_error);<NEW_LINE>break;<NEW_LINE>case ERROR_TRAKT_AUTH:<NEW_LINE>confirmationText = context.getString(R.string.trakt_error_credentials);<NEW_LINE>break;<NEW_LINE>case ERROR_TRAKT_API:<NEW_LINE>confirmationText = context.getString(R.string.api_error_generic, context.getString<MASK><NEW_LINE>break;<NEW_LINE>case ERROR_TRAKT_API_NOT_FOUND:<NEW_LINE>confirmationText = context.getString(R.string.trakt_error_not_exists);<NEW_LINE>break;<NEW_LINE>case ERROR_HEXAGON_API:<NEW_LINE>confirmationText = context.getString(R.string.api_error_generic, context.getString(R.string.hexagon));<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>confirmationText = null;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>EventBus.getDefault().post(new BaseMessageActivity.ServiceCompletedEvent(confirmationText, displaySuccess, null));<NEW_LINE>} | (R.string.trakt)); |
314,351 | public Entity deleteEntity(String domainName, String entityName, String auditRef) {<NEW_LINE>WebTarget target = base.path("/domain/{domainName}/entity/{entityName}").resolveTemplate("domainName", domainName).resolveTemplate("entityName", entityName);<NEW_LINE>Invocation.Builder invocationBuilder = target.request("application/json");<NEW_LINE>if (credsHeader != null) {<NEW_LINE>invocationBuilder = credsHeader.startsWith("Cookie.") ? invocationBuilder.cookie(credsHeader.substring(7), credsToken) : invocationBuilder.header(credsHeader, credsToken);<NEW_LINE>}<NEW_LINE>if (auditRef != null) {<NEW_LINE>invocationBuilder = invocationBuilder.header("Y-Audit-Ref", auditRef);<NEW_LINE>}<NEW_LINE>Response response = invocationBuilder.delete();<NEW_LINE><MASK><NEW_LINE>switch(code) {<NEW_LINE>case 204:<NEW_LINE>return null;<NEW_LINE>default:<NEW_LINE>throw new ResourceException(code, response.readEntity(ResourceError.class));<NEW_LINE>}<NEW_LINE>} | int code = response.getStatus(); |
930,649 | public void handleStatement(@Nullable final Statement st) {<NEW_LINE>checkNotNull(st);<NEW_LINE>assert st != null;<NEW_LINE>String subjectString;<NEW_LINE>String objectString;<NEW_LINE>if (st.getSubject() instanceof BNode) {<NEW_LINE>subjectString = st.getSubject().stringValue();<NEW_LINE>// it is not mandatory for BNode.stringValue() to return a string<NEW_LINE>// prefixed with the turtle blank node syntax, so we check here to<NEW_LINE>// make sure<NEW_LINE>subjectString = "_:genid-nodeid-" + subjectString;<NEW_LINE>} else {<NEW_LINE>subjectString = st.getSubject().stringValue();<NEW_LINE>}<NEW_LINE>if (st.getObject() instanceof BNode) {<NEW_LINE>objectString = st.getObject().stringValue();<NEW_LINE>// it is not mandatory for BNode.stringValue() to return a string<NEW_LINE>// prefixed with the turtle blank node syntax, so we check here to<NEW_LINE>// make sure<NEW_LINE>objectString = "_:genid-nodeid-" + objectString;<NEW_LINE>} else {<NEW_LINE>objectString = st.getObject().stringValue();<NEW_LINE>}<NEW_LINE>if (st.getObject() instanceof Resource) {<NEW_LINE>LOGGER.trace("statement with resource value");<NEW_LINE>statementWithResourceValue(subjectString, st.getPredicate().stringValue(), objectString);<NEW_LINE>} else {<NEW_LINE>final Literal literalObject = (Literal) st.getObject();<NEW_LINE>String literalDatatype = null;<NEW_LINE>final String literalLanguage = literalObject.<MASK><NEW_LINE>if (literalLanguage == null) {<NEW_LINE>literalDatatype = literalObject.getDatatype().stringValue();<NEW_LINE>}<NEW_LINE>LOGGER.trace("statement with literal value");<NEW_LINE>statementWithLiteralValue(subjectString, st.getPredicate().stringValue(), objectString, literalLanguage, literalDatatype);<NEW_LINE>}<NEW_LINE>} | getLanguage().orElse(null); |
447,278 | private void addConstructorRenames(TextChangeManager manager) throws CoreException {<NEW_LINE>ICompilationUnit cu = fType.getCompilationUnit();<NEW_LINE>IMethod[] methods = fType.getMethods();<NEW_LINE>int typeNameLength = fType.getElementName().length();<NEW_LINE>for (int i = 0; i < methods.length; i++) {<NEW_LINE>if (methods[i].isConstructor()) {<NEW_LINE>String methodName = methods[i].getElementName();<NEW_LINE>ISourceRange range = methods[i].getNameRange();<NEW_LINE>String sourceName = cu.getBuffer().getText(range.getOffset(), range.getLength());<NEW_LINE>boolean isValid = methodName.equals(sourceName);<NEW_LINE>if (isValid) {<NEW_LINE>String name = RefactoringCoreMessages.RenameTypeRefactoring_rename_constructor;<NEW_LINE>TextChangeCompatibility.addTextEdit(manager.get(cu), name, new ReplaceEdit(methods[i].getNameRange().getOffset()<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | , typeNameLength, getNewElementName())); |
104,824 | private void serializIt(final String resource, final Integer revision, final OutputStream output, final boolean nodeid) throws JaxRxException, SirixException {<NEW_LINE>// Connection to sirix, creating a session<NEW_LINE>Database database = null;<NEW_LINE>Session session = null;<NEW_LINE>// INodeReadTrx rtx = null;<NEW_LINE>try {<NEW_LINE>database = Databases.openDatabase(mStoragePath);<NEW_LINE>session = database.getSession(new SessionConfiguration.Builder(resource).build());<NEW_LINE>// and creating a transaction<NEW_LINE>// if (revision == null) {<NEW_LINE>// rtx = session.beginReadTransaction();<NEW_LINE>// } else {<NEW_LINE>// rtx = session.beginReadTransaction(revision);<NEW_LINE>// }<NEW_LINE>final XMLSerializerBuilder builder;<NEW_LINE>if (revision == null)<NEW_LINE>builder = new XMLSerializerBuilder(session, output);<NEW_LINE>else<NEW_LINE>builder = new XMLSerializerBuilder(session, output, revision);<NEW_LINE>if (nodeid) {<NEW_LINE>builder.emitRESTful().emitIDs();<NEW_LINE>}<NEW_LINE>final XMLSerializer serializer = builder.build();<NEW_LINE>serializer.call();<NEW_LINE>} catch (final Exception exce) {<NEW_LINE>throw new JaxRxException(exce);<NEW_LINE>} finally {<NEW_LINE>// closing the sirix storage<NEW_LINE>WorkerHelper.<MASK><NEW_LINE>}<NEW_LINE>} | closeRTX(null, session, database); |
1,707,594 | public void afterInit() {<NEW_LINE>threadService.runActionLater(() -> {<NEW_LINE>getWindow(<MASK><NEW_LINE>ReadOnlyObjectProperty<Worker.State> stateProperty = webEngine().getLoadWorker().stateProperty();<NEW_LINE>WebView popupView = new WebView();<NEW_LINE>Stage stage = new Stage();<NEW_LINE>stage.initModality(Modality.WINDOW_MODAL);<NEW_LINE>stage.setScene(new Scene(popupView));<NEW_LINE>stage.setTitle("AsciidocFX");<NEW_LINE>InputStream logoStream = SlidePane.class.getResourceAsStream("/logo.png");<NEW_LINE>stage.getIcons().add(new Image(logoStream));<NEW_LINE>webEngine().setCreatePopupHandler(param -> {<NEW_LINE>if (!stage.isShowing()) {<NEW_LINE>stage.show();<NEW_LINE>popupView.requestFocus();<NEW_LINE>}<NEW_LINE>return popupView.getEngine();<NEW_LINE>});<NEW_LINE>stateProperty.addListener(this::stateListener);<NEW_LINE>});<NEW_LINE>} | ).setMember("afx", controller); |
787,074 | public CreateClusterResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>CreateClusterResult createClusterResult = new CreateClusterResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return createClusterResult;<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("cluster", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createClusterResult.setCluster(ClusterJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return createClusterResult;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
1,771,176 | final DeleteSafetyRuleResult executeDeleteSafetyRule(DeleteSafetyRuleRequest deleteSafetyRuleRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteSafetyRuleRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteSafetyRuleRequest> request = null;<NEW_LINE>Response<DeleteSafetyRuleResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteSafetyRuleRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteSafetyRuleRequest));<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, "Route53 Recovery Control Config");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteSafetyRule");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteSafetyRuleResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteSafetyRuleResultJsonUnmarshaller());<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,592,184 | public void actionPerformed(ActionEvent e) {<NEW_LINE>Object source = e.getSource();<NEW_LINE>if (source == addFolderButton) {<NEW_LINE>// Let user search for the Jar file<NEW_LINE>FileChooserBuilder builder = new FileChooserBuilder(SourceRootsUi.class).setDirectoriesOnly(true);<NEW_LINE>builder.setDefaultWorkingDirectory(FileUtil.toFile(this<MASK><NEW_LINE>String type = RootsAccessor.getInstance().getType(sourceRoots);<NEW_LINE>boolean isModule = JavaProjectConstants.SOURCES_TYPE_MODULES.equals(type);<NEW_LINE>if (sourceRoots.isTest()) {<NEW_LINE>// NOI18N<NEW_LINE>builder.setTitle(NbBundle.getMessage(SourceRootsUi.class, isModule ? "LBL_TestModuleFolder_DialogTitle" : "LBL_TestFolder_DialogTitle"));<NEW_LINE>} else {<NEW_LINE>// NOI18N<NEW_LINE>builder.setTitle(NbBundle.getMessage(SourceRootsUi.class, isModule ? "LBL_ModuleFolder_DialogTitle" : "LBL_SourceFolder_DialogTitle"));<NEW_LINE>}<NEW_LINE>File[] files = builder.showMultiOpenDialog();<NEW_LINE>if (files != null) {<NEW_LINE>addFolders(files);<NEW_LINE>}<NEW_LINE>} else if (source == removeButton) {<NEW_LINE>removeElements();<NEW_LINE>} else if (source == upButton) {<NEW_LINE>moveUp();<NEW_LINE>} else if (source == downButton) {<NEW_LINE>moveDown();<NEW_LINE>}<NEW_LINE>} | .project.getProjectDirectory())); |
195,231 | public IMqttToken connect(MqttConnectOptions options, Object userContext, IMqttActionListener callback) throws MqttException {<NEW_LINE>IMqttToken token = new MqttTokenAndroid(this, userContext, callback);<NEW_LINE>connectOptions = options;<NEW_LINE>connectToken = token;<NEW_LINE>if (mqttService == null) {<NEW_LINE>// First time - must bind to the service<NEW_LINE>Intent serviceStartIntent = new Intent();<NEW_LINE>serviceStartIntent.setClassName(myContext, SERVICE_NAME);<NEW_LINE>Object service = myContext.startService(serviceStartIntent);<NEW_LINE>if (service == null) {<NEW_LINE>IMqttActionListener listener = token.getActionCallback();<NEW_LINE>if (listener != null) {<NEW_LINE>listener.onFailure(token, <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>// We bind with BIND_SERVICE_FLAG (0), leaving us the manage the lifecycle<NEW_LINE>// until the last time it is stopped by a call to stopService()<NEW_LINE>myContext.bindService(serviceStartIntent, serviceConnection, Context.BIND_AUTO_CREATE);<NEW_LINE>if (!receiverRegistered)<NEW_LINE>registerReceiver(this);<NEW_LINE>} else {<NEW_LINE>pool.execute(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>doConnect();<NEW_LINE>// Register receiver to show shoulder tap.<NEW_LINE>if (!receiverRegistered)<NEW_LINE>registerReceiver(MqttAndroidClient.this);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>return token;<NEW_LINE>} | new RuntimeException("cannot start service " + SERVICE_NAME)); |
1,562,543 | final DescribeManagedRuleGroupResult executeDescribeManagedRuleGroup(DescribeManagedRuleGroupRequest describeManagedRuleGroupRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeManagedRuleGroupRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeManagedRuleGroupRequest> request = null;<NEW_LINE>Response<DescribeManagedRuleGroupResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeManagedRuleGroupRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeManagedRuleGroupRequest));<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, "WAFV2");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeManagedRuleGroupResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeManagedRuleGroupResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeManagedRuleGroup"); |
1,255,247 | public <T> int readFieldNumber(final Schema<T> schema) throws IOException {<NEW_LINE>if (emptyMessage) {<NEW_LINE>emptyMessage = false;<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>if (parser.getEventType() == END_ELEMENT)<NEW_LINE>return 0;<NEW_LINE>final String name = parser.getLocalName();<NEW_LINE>final int num = schema.getFieldNumber(name);<NEW_LINE>if (num == 0) {<NEW_LINE>while (true) {<NEW_LINE>switch(next()) {<NEW_LINE>case END_ELEMENT:<NEW_LINE>if (name.equals(parser.getLocalName())) {<NEW_LINE>// we can skip this unknown scalar field.<NEW_LINE>nextTag();<NEW_LINE>return readFieldNumber(schema);<NEW_LINE>}<NEW_LINE>throw new XmlInputException("Unknown field: " + name + <MASK><NEW_LINE>case END_DOCUMENT:<NEW_LINE>// malformed xml.<NEW_LINE>case START_ELEMENT:<NEW_LINE>// message field<NEW_LINE>// we do not know how deep this message is<NEW_LINE>throw new XmlInputException("Unknown field: " + name + " on message " + schema.messageFullName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return num;<NEW_LINE>} | " on message " + schema.messageFullName()); |
824,344 | private void checkPermissions(RepositoryModel model) {<NEW_LINE>boolean authenticateAdmin = app().settings().getBoolean(Keys.web.authenticateAdminPages, true);<NEW_LINE>boolean allowAdmin = app().settings().getBoolean(Keys.web.allowAdministration, true);<NEW_LINE>GitBlitWebSession session = GitBlitWebSession.get();<NEW_LINE>UserModel user = session.getUser();<NEW_LINE>if (allowAdmin) {<NEW_LINE>if (authenticateAdmin) {<NEW_LINE>if (user == null) {<NEW_LINE>// No Login Available<NEW_LINE>error(getString("gb.errorAdminLoginRequired"), true);<NEW_LINE>}<NEW_LINE>if (isCreate) {<NEW_LINE>// Create Repository<NEW_LINE>if (!user.canCreate() && !user.canAdmin()) {<NEW_LINE>// Only administrators or permitted users may create<NEW_LINE>error(getString("gb.errorOnlyAdminMayCreateRepository"), true);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// Edit Repository<NEW_LINE>if (user.canAdmin()) {<NEW_LINE>// Admins can edit everything<NEW_LINE>isAdmin = true;<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>if (!model.isOwner(user.username)) {<NEW_LINE>// User is not an Admin nor Owner<NEW_LINE>error<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// No Administration Permitted<NEW_LINE>error(getString("gb.errorAdministrationDisabled"), true);<NEW_LINE>}<NEW_LINE>} | (getString("gb.errorOnlyAdminOrOwnerMayEditRepository"), true); |
976,254 | private void createInitCheck(Program program, BasicBlock block, String className, BasicBlock continueBlock, BasicBlock initBlock, TextLocation location) {<NEW_LINE>Variable clsVariable = program.createVariable();<NEW_LINE><MASK><NEW_LINE>ClassConstantInstruction clsConstant = new ClassConstantInstruction();<NEW_LINE>clsConstant.setReceiver(clsVariable);<NEW_LINE>clsConstant.setConstant(ValueType.object(className));<NEW_LINE>clsConstant.setLocation(location);<NEW_LINE>block.add(clsConstant);<NEW_LINE>InvokeInstruction checkInitialized = new InvokeInstruction();<NEW_LINE>checkInitialized.setType(InvocationType.SPECIAL);<NEW_LINE>checkInitialized.setMethod(new MethodReference(Allocator.class, "isInitialized", Class.class, boolean.class));<NEW_LINE>checkInitialized.setArguments(clsVariable);<NEW_LINE>checkInitialized.setReceiver(initializedVariable);<NEW_LINE>checkInitialized.setLocation(location);<NEW_LINE>block.add(checkInitialized);<NEW_LINE>BranchingInstruction branching = new BranchingInstruction(BranchingCondition.NOT_EQUAL);<NEW_LINE>branching.setOperand(initializedVariable);<NEW_LINE>branching.setConsequent(continueBlock);<NEW_LINE>branching.setAlternative(initBlock);<NEW_LINE>branching.setLocation(location);<NEW_LINE>block.add(branching);<NEW_LINE>} | Variable initializedVariable = program.createVariable(); |
319,205 | private void removePreferencesWithGPVersion() {<NEW_LINE>PreferenceScreen dnscryptSettings = findPreference("dnscrypt_settings");<NEW_LINE>ArrayList<PreferenceCategory> categories = new ArrayList<>();<NEW_LINE>categories<MASK><NEW_LINE>categories.add(findPreference("pref_dnscrypt_cloaking_rules"));<NEW_LINE>categories.add(findPreference("pref_dnscrypt_blacklist"));<NEW_LINE>categories.add(findPreference("pref_dnscrypt_ipblacklist"));<NEW_LINE>categories.add(findPreference("pref_dnscrypt_whitelist"));<NEW_LINE>for (PreferenceCategory category : categories) {<NEW_LINE>if (dnscryptSettings != null && category != null) {<NEW_LINE>dnscryptSettings.removePreference(category);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>PreferenceCategory requireServersCategory = findPreference("dnscrypt_require_servers_prop_summ");<NEW_LINE>Preference requireNofilter = findPreference("require_nofilter");<NEW_LINE>if (!accelerated && requireServersCategory != null && requireNofilter != null) {<NEW_LINE>requireServersCategory.removePreference(requireNofilter);<NEW_LINE>}<NEW_LINE>PreferenceCategory queryLogCategory = findPreference("pref_dnscrypt_query_log");<NEW_LINE>Preference ignoredQtypes = findPreference("ignored_qtypes");<NEW_LINE>if (queryLogCategory != null && ignoredQtypes != null) {<NEW_LINE>queryLogCategory.removePreference(ignoredQtypes);<NEW_LINE>}<NEW_LINE>PreferenceCategory otherCategory = findPreference("pref_dnscrypt_other");<NEW_LINE>Preference editDNSTomlDirectly = findPreference("editDNSTomlDirectly");<NEW_LINE>if (otherCategory != null && editDNSTomlDirectly != null) {<NEW_LINE>otherCategory.removePreference(editDNSTomlDirectly);<NEW_LINE>}<NEW_LINE>} | .add(findPreference("pref_dnscrypt_forwarding_rules")); |
738,332 | public com.amazonaws.services.applicationdiscovery.model.ConflictErrorException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.applicationdiscovery.model.ConflictErrorException conflictErrorException = new com.amazonaws.services.<MASK><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>} 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 conflictErrorException;<NEW_LINE>} | applicationdiscovery.model.ConflictErrorException(null); |
91,017 | private Map<String, String> autoConfigure(Map<String, String> localSettings) {<NEW_LINE>Map<String, String> mutableLocalSettings = new HashMap<>(localSettings);<NEW_LINE>if (Boolean.parseBoolean(system2.envVariable("GITLAB_CI"))) {<NEW_LINE>// GitLab CI auto configuration<NEW_LINE>if (system2.envVariable("CI_MERGE_REQUEST_IID") != null) {<NEW_LINE>// we are inside a merge request<NEW_LINE>Optional.ofNullable(system2.envVariable("CI_MERGE_REQUEST_IID")).ifPresent(v -> mutableLocalSettings.putIfAbsent(ScannerProperties.PULL_REQUEST_KEY, v));<NEW_LINE>Optional.ofNullable(system2.envVariable("CI_MERGE_REQUEST_SOURCE_BRANCH_NAME")).ifPresent(v -> mutableLocalSettings.putIfAbsent(ScannerProperties.PULL_REQUEST_BRANCH, v));<NEW_LINE>Optional.ofNullable(system2.envVariable("CI_MERGE_REQUEST_TARGET_BRANCH_NAME")).ifPresent(v -> mutableLocalSettings.putIfAbsent(ScannerProperties.PULL_REQUEST_BASE, v));<NEW_LINE>} else {<NEW_LINE>// branch or tag<NEW_LINE>Optional.ofNullable(system2.envVariable("CI_COMMIT_REF_NAME")).ifPresent(v -> mutableLocalSettings.putIfAbsent(ScannerProperties.BRANCH_NAME, v));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (Boolean.parseBoolean(system2.envVariable("TF_BUILD"))) {<NEW_LINE>Optional.ofNullable(system2.envVariable("SYSTEM_PULLREQUEST_PULLREQUESTID")).ifPresent(v -> mutableLocalSettings.putIfAbsent(ScannerProperties.PULL_REQUEST_KEY, v));<NEW_LINE>Optional.ofNullable(system2.envVariable("SYSTEM_PULLREQUEST_SOURCEBRANCH")).ifPresent(v -> mutableLocalSettings.putIfAbsent<MASK><NEW_LINE>Optional.ofNullable(system2.envVariable("SYSTEM_PULLREQUEST_TARGETBRANCH")).ifPresent(v -> mutableLocalSettings.putIfAbsent(ScannerProperties.PULL_REQUEST_BASE, v));<NEW_LINE>}<NEW_LINE>return Collections.unmodifiableMap(mutableLocalSettings);<NEW_LINE>} | (ScannerProperties.PULL_REQUEST_BRANCH, v)); |
1,586,153 | public okhttp3.Call readNamespacedServiceCall(String name, String namespace, String pretty, final ApiCallback _callback) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/api/v1/namespaces/{namespace}/services/{name}".replaceAll("\\{" + "name" + "\\}", localVarApiClient.escapeString(name.toString())).replaceAll("\\{" + "namespace" + "\\}", localVarApiClient.escapeString(namespace.toString()));<NEW_LINE>List<Pair> localVarQueryParams <MASK><NEW_LINE>List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();<NEW_LINE>if (pretty != null) {<NEW_LINE>localVarQueryParams.addAll(localVarApiClient.parameterToPair("pretty", pretty));<NEW_LINE>}<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, String> localVarCookieParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>final String[] localVarAccepts = { "application/json", "application/yaml", "application/vnd.kubernetes.protobuf" };<NEW_LINE>final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>if (localVarAccept != null) {<NEW_LINE>localVarHeaderParams.put("Accept", localVarAccept);<NEW_LINE>}<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>localVarHeaderParams.put("Content-Type", localVarContentType);<NEW_LINE>String[] localVarAuthNames = new String[] { "BearerToken" };<NEW_LINE>return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);<NEW_LINE>} | = new ArrayList<Pair>(); |
872,196 | private void validateFields(int line, boolean isConfig, FileTab fileTab) throws IOException, ClassNotFoundException {<NEW_LINE>List<String> relationalFieldList = fileTab.getFileFieldList().stream().filter(field -> !Strings.isNullOrEmpty(field.getSubImportField())).map(field -> field.getImportField().getName() + "." + field.getSubImportField()).collect(Collectors.toList());<NEW_LINE>for (FileField fileField : fileTab.getFileFieldList()) {<NEW_LINE>MetaField importField = fileField.getImportField();<NEW_LINE>if (importField != null && Strings.isNullOrEmpty(fileField.getSubImportField())) {<NEW_LINE>if (importField.getRelationship() != null) {<NEW_LINE>logService.addLog(IExceptionMessage.ADVANCED_IMPORT_LOG_4, importField.getName(), line);<NEW_LINE>}<NEW_LINE>this.validateImportRequiredField(line, Class.forName(fileTab.getMetaModel().getFullName()), importField.getName(), fileField, null);<NEW_LINE>this.validateDateField(line, fileField);<NEW_LINE>} else if (!Strings.isNullOrEmpty(fileField.getSubImportField())) {<NEW_LINE>Mapper mapper = advancedImportService.getMapper(importField.getMetaModel().getFullName());<NEW_LINE>Property parentProp = mapper.<MASK><NEW_LINE>if (parentProp == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Property subProperty = this.getAndValidateSubField(line, parentProp, fileField, false);<NEW_LINE>if (subProperty != null) {<NEW_LINE>this.validateImportRequiredField(line, subProperty.getEntity(), subProperty.getName(), fileField, relationalFieldList);<NEW_LINE>this.validateDateField(line, fileField);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getProperty(importField.getName()); |
669,282 | private void sendSupportEmail(ErrorInfo jXErrorPaneInfo) {<NEW_LINE>Configuration configuration = AppBeans.get(Configuration.NAME);<NEW_LINE>ExceptionReportService reportService = AppBeans.get(ExceptionReportService.NAME);<NEW_LINE>ClientConfig clientConfig = configuration.getConfig(ClientConfig.class);<NEW_LINE>TopLevelFrame mainFrame = App.getInstance().getMainFrame();<NEW_LINE>Messages messages = AppBeans.get(Messages.NAME);<NEW_LINE>Locale locale = App.getInstance().getLocale();<NEW_LINE>try {<NEW_LINE>TimeSource timeSource = AppBeans.get(TimeSource.NAME);<NEW_LINE>String date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(timeSource.currentTimestamp());<NEW_LINE>UserSessionSource userSessionSource = AppBeans.get(UserSessionSource.NAME);<NEW_LINE>User user = userSessionSource.getUserSession().getUser();<NEW_LINE>Map<String, Object> binding = new HashMap<>();<NEW_LINE>binding.put("timestamp", date);<NEW_LINE>binding.put("errorMessage", jXErrorPaneInfo.getBasicErrorMessage());<NEW_LINE>binding.put("stacktrace", getStackTrace(jXErrorPaneInfo.getErrorException()));<NEW_LINE>binding.put("systemId", clientConfig.getSystemID());<NEW_LINE>binding.put("userLogin", user.getLogin());<NEW_LINE>if (MapUtils.isNotEmpty(additionalExceptionReportBinding)) {<NEW_LINE>binding.putAll(additionalExceptionReportBinding);<NEW_LINE>}<NEW_LINE>reportService.sendExceptionReport(clientConfig.getSupportEmail(), ImmutableMap.copyOf(binding));<NEW_LINE>mainFrame.showNotification(messages.getMainMessage("errorPane.emailSent", locale), Frame.NotificationType.TRAY);<NEW_LINE>} catch (Throwable e) {<NEW_LINE>mainFrame.showNotification(messages.getMainMessage("errorPane.emailSendingErr", locale), Frame.NotificationType.ERROR);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | log.error("Can't send error report", e); |
94,218 | private static void gatherNormally(final List<File> inputs, final File output, final boolean createIndex, final boolean createMd5, final File referenceFasta) {<NEW_LINE>final SAMFileHeader header;<NEW_LINE>{<NEW_LINE>header = SamReaderFactory.makeDefault().referenceSequence(referenceFasta).getFileHeader(inputs.get(0));<NEW_LINE>}<NEW_LINE>final SAMFileWriter out = new SAMFileWriterFactory().setCreateIndex(createIndex).setCreateMd5File(createMd5).makeWriter(header, true, output, referenceFasta);<NEW_LINE>for (final File f : inputs) {<NEW_LINE>log.info("Gathering " + f.getAbsolutePath());<NEW_LINE>final SamReader in = SamReaderFactory.makeDefault().referenceSequence(referenceFasta).open(f);<NEW_LINE>for (final SAMRecord rec : <MASK><NEW_LINE>CloserUtil.close(in);<NEW_LINE>}<NEW_LINE>out.close();<NEW_LINE>} | in) out.addAlignment(rec); |
372,760 | private Object executeGetter(ObjectTemplate template, Object holder, Object[] arguments) {<NEW_LINE>Object result = null;<NEW_LINE>Object key = arguments[3];<NEW_LINE>PropertyHandler indexedHandler = template.getIndexedPropertyHandler();<NEW_LINE><MASK><NEW_LINE>if (!(key instanceof HiddenKey)) {<NEW_LINE>if (JSRuntime.isArrayIndex(key)) {<NEW_LINE>if (indexedHandler != null) {<NEW_LINE>result = NativeAccess.executePropertyHandlerGetter(indexedHandler.getGetter(), holder, arguments, indexedHandler.getData(), false);<NEW_LINE>}<NEW_LINE>} else if (namedHandler != null) {<NEW_LINE>if (!(key instanceof Symbol)) {<NEW_LINE>key = JSRuntime.toString(key);<NEW_LINE>}<NEW_LINE>if (!template.getStringKeysOnly() || key instanceof TruffleString) {<NEW_LINE>result = NativeAccess.executePropertyHandlerGetter(namedHandler.getGetter(), holder, arguments, namedHandler.getData(), true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (result == null) {<NEW_LINE>result = JSObject.get((JSDynamicObject) arguments[2], key);<NEW_LINE>} else {<NEW_LINE>GraalJSAccess graalAccess = GraalJSAccess.get(this);<NEW_LINE>result = graalAccess.correctReturnValue(result);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | PropertyHandler namedHandler = template.getNamedPropertyHandler(); |
1,268,644 | private void upgradeDolphinSchedulerDDL(String schemaDir, String scriptFile) {<NEW_LINE>Resource sqlFilePath = new ClassPathResource(String.format("sql/upgrade/%s/%s/%s", schemaDir, getDbType().name().toLowerCase(), scriptFile));<NEW_LINE>Connection conn = null;<NEW_LINE>PreparedStatement pstmt = null;<NEW_LINE>try {<NEW_LINE>conn = dataSource.getConnection();<NEW_LINE>String dbName = conn.getCatalog();<NEW_LINE>logger.info(dbName);<NEW_LINE>conn.setAutoCommit(true);<NEW_LINE>// Execute the dolphinscheduler ddl.sql for the upgrade<NEW_LINE>ScriptRunner scriptRunner = new ScriptRunner(conn, true, true);<NEW_LINE>Reader sqlReader = new InputStreamReader(sqlFilePath.getInputStream());<NEW_LINE>scriptRunner.runScript(sqlReader);<NEW_LINE>} catch (FileNotFoundException e) {<NEW_LINE>logger.error(<MASK><NEW_LINE>throw new RuntimeException("sql file not found ", e);<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.error(e.getMessage(), e);<NEW_LINE>throw new RuntimeException(e.getMessage(), e);<NEW_LINE>} finally {<NEW_LINE>ConnectionUtils.releaseResource(pstmt, conn);<NEW_LINE>}<NEW_LINE>} | e.getMessage(), e); |
809,858 | private static void packColumn(JTable table, int columnIndex) {<NEW_LINE>TableColumn tableColumn = table.getColumnModel().getColumn(columnIndex);<NEW_LINE>Object value = tableColumn.getHeaderValue();<NEW_LINE>TableCellRenderer columnRenderer = tableColumn.getHeaderRenderer();<NEW_LINE>if (columnRenderer == null) {<NEW_LINE>columnRenderer = table.getTableHeader().getDefaultRenderer();<NEW_LINE>}<NEW_LINE>Component c = columnRenderer.getTableCellRendererComponent(table, value, false<MASK><NEW_LINE>int width = c.getPreferredSize().width + 6;<NEW_LINE>int intercellSpacing = table.getIntercellSpacing().width;<NEW_LINE>for (int i = 0, n = table.getRowCount(); i < n; i++) {<NEW_LINE>TableCellRenderer cellRenderer = table.getCellRenderer(i, columnIndex);<NEW_LINE>value = table.getValueAt(i, columnIndex);<NEW_LINE>c = cellRenderer.getTableCellRendererComponent(table, value, false, false, i, columnIndex);<NEW_LINE>int w = c.getPreferredSize().width + intercellSpacing + 2;<NEW_LINE>if (w > width) {<NEW_LINE>width = w;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>table.getTableHeader().setResizingColumn(tableColumn);<NEW_LINE>tableColumn.setWidth(width);<NEW_LINE>tableColumn.setPreferredWidth(width);<NEW_LINE>} | , false, -1, columnIndex); |
1,055,404 | protected BoltDeclarer grouping(String componentId, String streamId, Grouping grouping) {<NEW_LINE>// Check if bolt is KvStateBolt, if so, enable the key range hash in upstream component<NEW_LINE>TransactionBolt bolt = (TransactionBolt) _bolts.get(_boltId);<NEW_LINE>if (bolt.getBoltExecutor() instanceof KvStatefulBoltExecutor) {<NEW_LINE>ComponentCommon <MASK><NEW_LINE>Map<String, Object> conf = new HashMap<>();<NEW_LINE>conf.put(ConfigExtension.ENABLE_KEY_RANGE_FIELD_GROUP, true);<NEW_LINE>String currConf = common.get_json_conf();<NEW_LINE>common.set_json_conf(JStormUtils.mergeIntoJson(JStormUtils.parseJson(currConf), conf));<NEW_LINE>}<NEW_LINE>// Add barrier snapshot stream for transaction topology<NEW_LINE>Set<String> downstreamBolts = upToDownstreamComponentsMap.get(componentId);<NEW_LINE>if (downstreamBolts != null && !downstreamBolts.contains(_boltId)) {<NEW_LINE>downstreamBolts.add(_boltId);<NEW_LINE>_commons.get(_boltId).put_to_inputs(new GlobalStreamId(componentId, TransactionCommon.BARRIER_STREAM_ID), Grouping.all(new NullStruct()));<NEW_LINE>}<NEW_LINE>_commons.get(_boltId).put_to_inputs(new GlobalStreamId(componentId, streamId), grouping);<NEW_LINE>// return this;<NEW_LINE>return super.grouping(componentId, streamId, grouping);<NEW_LINE>} | common = _commons.get(componentId); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.