idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
721,769 | public static void main(String[] args) throws Exception {<NEW_LINE>inputfilepath = // + "/hr.docx";<NEW_LINE>System.getProperty("user.dir") + // + "/sample-docs/word/sample-docx.docx";<NEW_LINE>// + "/sample-docs/word/2003/word2003-vml.docx";<NEW_LINE>// + "/table-nested.docx";<NEW_LINE>"/hlink.docx";<NEW_LINE>WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new java.io.File(inputfilepath));<NEW_LINE>HtmlExporterNonXSLT withoutXSLT = new HtmlExporterNonXSLT(wordMLPackage, new HTMLConversionImageHandler("c:\\temp", "/bar", true));<NEW_LINE>log.info(XmlUtils.w3CDomNodeToString<MASK><NEW_LINE>// Wondering where <META http-equiv="Content-Type" content="text/html; charset=UTF-8"><NEW_LINE>// comes from? See http://stackoverflow.com/questions/1409091/how-do-i-prevent-the-java-xml-transformer-using-html-method-from-adding-meta<NEW_LINE>} | (withoutXSLT.export())); |
1,417,637 | protected AssemblyResolution solveTwoSided(OrExpression exp, MaskedLong goal, Map<String, Long> vals, AssemblyResolvedPatterns cur, Set<SolverHint> hints, String description) throws NeedsBackfillException, SolverException {<NEW_LINE>try {<NEW_LINE>return tryCatenationExpression(exp, goal, vals, cur, hints, description);<NEW_LINE>} catch (Exception e) {<NEW_LINE>dbg.println("while solving: " + goal + "=:" + exp);<NEW_LINE>dbg.println(e.getMessage());<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>return tryCircularShiftExpression(exp, goal, vals, cur, hints, description);<NEW_LINE>} catch (Exception e) {<NEW_LINE>dbg.println("while solving: " + goal + "=:" + exp);<NEW_LINE>dbg.println(e.getMessage());<NEW_LINE>}<NEW_LINE>Map<ExpressionMatcher<?>, PatternExpression> match = MATCHERS.neqConst.match(exp);<NEW_LINE>if (match != null) {<NEW_LINE>long value = MATCHERS.val.<MASK><NEW_LINE>PatternValue field = MATCHERS.fld.get(match);<NEW_LINE>// Solve for equals, then either return that, or forbid it, depending on goal<NEW_LINE>AssemblyResolution solution = solver.solve(field, MaskedLong.fromLong(value), vals, cur, hints, description);<NEW_LINE>if (goal.equals(MaskedLong.fromMaskAndValue(0, 1))) {<NEW_LINE>return solution;<NEW_LINE>}<NEW_LINE>if (goal.equals(MaskedLong.fromMaskAndValue(1, 1))) {<NEW_LINE>if (solution.isError()) {<NEW_LINE>return AssemblyResolution.nop(description);<NEW_LINE>}<NEW_LINE>if (solution.isBackfill()) {<NEW_LINE>throw new AssertionError();<NEW_LINE>}<NEW_LINE>AssemblyResolvedPatterns forbidden = (AssemblyResolvedPatterns) solution;<NEW_LINE>forbidden = forbidden.withDescription("Solved 'not equals'");<NEW_LINE>return AssemblyResolution.nop(description).withForbids(Set.of(forbidden));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw new SolverException("Could not solve two-sided OR");<NEW_LINE>} | get(match).getValue(); |
911,524 | // Submit a group of tasks via untimed invokeAny. Allow the tasks to be enqueued, but blocked from starting because another thread<NEW_LINE>// holds the only permit against maxConcurrency. Then invoke shutdownNow on the executor, all of the queued tasks should be canceled<NEW_LINE>// without starting, allowing invokeAny to raise a CancellationException before reaching the timeout.<NEW_LINE>@Test<NEW_LINE>public void testInvokeAnyShutdownNowWhileEnqueued() throws Exception {<NEW_LINE>PolicyExecutor executor = provider.create("testInvokeAnyShutdownNowWhileEnqueued").maxConcurrency(1).maxPolicy(MaxPolicy.strict).maxQueueSize(2);<NEW_LINE>CountDownLatch blocker = new CountDownLatch(1);<NEW_LINE>CountDownLatch blockerStarted = new CountDownLatch(1);<NEW_LINE>Future<Boolean> blockerFuture = executor.submit(new CountDownTask(blockerStarted, blocker, TIMEOUT_NS * 2));<NEW_LINE>assertTrue(blockerStarted.await(TIMEOUT_NS, TimeUnit.NANOSECONDS));<NEW_LINE>AtomicInteger counter = new AtomicInteger(0);<NEW_LINE>List<Callable<Integer>> tasks = Arrays.<Callable<Integer>>asList(new SharedIncrementTask(counter), new SharedIncrementTask(counter));<NEW_LINE>final CountDownLatch noQueueCapacityRemains = new CountDownLatch(1);<NEW_LINE>// Register a callback to decrement the above latch once queue capacity is used up.<NEW_LINE>assertNull(executor.registerQueueSizeCallback(1, new CountDownCallback(noQueueCapacityRemains)));<NEW_LINE>Future<List<Runnable>> shutdownFuture = testThreads.submit(new ShutdownTask(executor, true, new CountDownLatch(0), noQueueCapacityRemains, TIMEOUT_NS));<NEW_LINE>int expectedCancels = 0;<NEW_LINE>long start = System.nanoTime();<NEW_LINE>try {<NEW_LINE>fail("Should not succeed after shutdownNow: " + executor.invokeAny(tasks));<NEW_LINE>} catch (CancellationException x) {<NEW_LINE>// pass<NEW_LINE>// ShutdownTask triggered by queue size callback runs after invokeAny's second enqueue returns, so there are 2 queued tasks to cancel<NEW_LINE>expectedCancels = 2;<NEW_LINE>} catch (RejectedExecutionException x) {<NEW_LINE>// pass<NEW_LINE>if (// submit rejected due to shutdown<NEW_LINE>!x.getMessage().startsWith("CWWKE1202E"))<NEW_LINE>throw x;<NEW_LINE>// ShutdownTask triggered by queue size callback runs before invokeAny's second enqueue returns, so there is 1 queued task to cancel. The other was rejected.<NEW_LINE>expectedCancels = 1;<NEW_LINE>}<NEW_LINE>long duration = System.nanoTime() - start;<NEW_LINE>// invokeAny must return prematurely due to cancel by shutdownNow<NEW_LINE>assertTrue(duration + "ns", duration < TIMEOUT_NS);<NEW_LINE>List<Runnable> canceledFromQueue = shutdownFuture.get(TIMEOUT_NS, TimeUnit.NANOSECONDS);<NEW_LINE>assertEquals(<MASK><NEW_LINE>} | expectedCancels, canceledFromQueue.size()); |
1,228,184 | public static VariablesFormatter[] loadFormatters() {<NEW_LINE>Properties p = Properties.getDefault().getProperties("debugger.options.JPDA");<NEW_LINE>VariablesFormatter[] formatters = (VariablesFormatter[]) p.getArray("VariableFormatters", null);<NEW_LINE>VariablesFormatter[] defaultFormatters = createDefaultFormatters();<NEW_LINE>if (formatters == null) {<NEW_LINE>formatters = defaultFormatters;<NEW_LINE>} else {<NEW_LINE>Map<String, VariablesFormatter> fm = new LinkedHashMap<String, VariablesFormatter>(defaultFormatters.length);<NEW_LINE>for (VariablesFormatter vf : defaultFormatters) {<NEW_LINE>fm.put(vf.getName(), vf);<NEW_LINE>}<NEW_LINE>for (int i = 0; i < formatters.length; i++) {<NEW_LINE>if (formatters[i].isDefault && fm.containsKey(formatters[i].getName())) {<NEW_LINE>VariablesFormatter ovf = formatters[i];<NEW_LINE>formatters[i] = fm.remove(formatters[i].getName());<NEW_LINE>formatters[i].setEnabled(ovf.isEnabled());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!fm.isEmpty()) {<NEW_LINE>// We have new default formatters<NEW_LINE>VariablesFormatter[] newFormatters = new VariablesFormatter[formatters.length + fm.size()];<NEW_LINE>System.arraycopy(formatters, 0, <MASK><NEW_LINE>System.arraycopy(fm.values().toArray(), 0, newFormatters, formatters.length, fm.size());<NEW_LINE>formatters = newFormatters;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return formatters;<NEW_LINE>} | newFormatters, 0, formatters.length); |
957,522 | // Test that setting the LoginTimeout via URL or properties for DataSources using Driver is rejected and that getLoginTimeout always returns 0.<NEW_LINE>@Test<NEW_LINE>@ExpectedFFDC({ "java.sql.SQLNonTransientException" })<NEW_LINE>public void testGetSetLoginTimeout() throws Exception {<NEW_LINE>InitialContext ctx = new InitialContext();<NEW_LINE>// Ensure URL with loginTimeout specified is not allowed when using Driver<NEW_LINE>try {<NEW_LINE>ctx.lookup("jdbc/fatDriverInvalidURLLoginTimeout");<NEW_LINE>fail("URL containing LoginTimeout should not be allowed when using Driver");<NEW_LINE>} catch (Exception e) {<NEW_LINE>}<NEW_LINE>// expected<NEW_LINE>// Ensure datasource with property loginTimeout is not allowed when using Driver<NEW_LINE>try {<NEW_LINE>ctx.lookup("java:app/env/jdbc/dsd-with-login-timeout");<NEW_LINE>fail("loginTimeout property not allowed when using Driver");<NEW_LINE>} catch (Exception e) {<NEW_LINE>}<NEW_LINE>// expected<NEW_LINE>// Datasource using a driver should return 0 (which means use defaults) for loginTimeout, regardless of value set on DriverManager<NEW_LINE>// 10 minutes<NEW_LINE>DriverManager.setLoginTimeout(10 * 60);<NEW_LINE>assertEquals("Login timeout should be 0 regardless of what is done to DriverManager", <MASK><NEW_LINE>} | 0, fatDriverDS.getLoginTimeout()); |
525,013 | public ExternalEventsDetail unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ExternalEventsDetail externalEventsDetail = new ExternalEventsDetail();<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("dataLocation", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>externalEventsDetail.setDataLocation(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("dataAccessRoleArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>externalEventsDetail.setDataAccessRoleArn(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 externalEventsDetail;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
686,943 | public boolean visit(SQLAlterTableDropPartition x) {<NEW_LINE>boolean printDrop = true;<NEW_LINE>if (x.getParent() instanceof SQLAlterTableStatement) {<NEW_LINE>SQLAlterTableStatement stmt = (SQLAlterTableStatement) x.getParent();<NEW_LINE>int p = stmt.getChildren().indexOf(x);<NEW_LINE>if (p > 0 && stmt.getChildren().get(p - 1) instanceof SQLAlterTableDropPartition) {<NEW_LINE>printDrop = false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (printDrop) {<NEW_LINE>print0(ucase ? "DROP " : "drop ");<NEW_LINE>if (x.isIfExists()) {<NEW_LINE>print0(ucase ? "IF EXISTS " : "if exists ");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>print('\t');<NEW_LINE>indentCount++;<NEW_LINE>}<NEW_LINE>if (x.getAttribute("SIMPLE") != null) {<NEW_LINE>print0(ucase ? "PARTITION " : "partition ");<NEW_LINE>printAndAccept(x.getPartitions(), ",");<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>printAndAccept(x.getPartitions(), ", ");<NEW_LINE>print(')');<NEW_LINE>}<NEW_LINE>if (x.isPurge()) {<NEW_LINE>print0(ucase ? " PURGE" : " purge");<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | print0(ucase ? "PARTITION (" : "partition ("); |
613,163 | public boolean isOneEditDistance(String s, String t) {<NEW_LINE>char[<MASK><NEW_LINE>char[] tchar = t.toCharArray();<NEW_LINE>if (Math.abs(s.length() - t.length()) == 1) {<NEW_LINE>char[] longer = (s.length() > t.length()) ? schar : tchar;<NEW_LINE>char[] shorter = (longer == schar) ? tchar : schar;<NEW_LINE>int diffCnt = 0;<NEW_LINE>int i = 0;<NEW_LINE>int j = 0;<NEW_LINE>for (; i < shorter.length && j < longer.length; ) {<NEW_LINE>if (longer[j] != shorter[i]) {<NEW_LINE>diffCnt++;<NEW_LINE>j++;<NEW_LINE>} else {<NEW_LINE>i++;<NEW_LINE>j++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return diffCnt == 1 || diffCnt == 0;<NEW_LINE>// it could be the last char of the longer is the different one, in that case, diffCnt remains to be zero<NEW_LINE>} else if (s.length() == t.length()) {<NEW_LINE>int diffCnt = 0;<NEW_LINE>for (int i = 0; i < s.length(); i++) {<NEW_LINE>if (schar[i] != tchar[i]) {<NEW_LINE>diffCnt++;<NEW_LINE>}<NEW_LINE>if (diffCnt > 1) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return diffCnt == 1;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | ] schar = s.toCharArray(); |
1,692,874 | private CompletableFuture<Void> updateMessageStateAsync(byte[] deliveryTag, Outcome outcome, TransactionContext transaction) {<NEW_LINE>this.throwIfInUnusableState();<NEW_LINE>CompletableFuture<Void> completeMessageFuture = new CompletableFuture<>();<NEW_LINE>String deliveryTagAsString = StringUtil.convertBytesToString(deliveryTag);<NEW_LINE>TRACE_LOGGER.debug("Updating message state of delivery '{}' to '{}'", deliveryTagAsString, outcome);<NEW_LINE>Delivery delivery = CoreMessageReceiver.this.tagsToDeliveriesMap.get(deliveryTagAsString);<NEW_LINE>if (delivery == null) {<NEW_LINE>TRACE_LOGGER.info("Delivery not found for delivery tag '{}'. Either receive link to '{}' closed with a transient error and reopened or the delivery was already settled by complete/abandon/defer/deadletter.", deliveryTagAsString, this.receivePath);<NEW_LINE>completeMessageFuture.completeExceptionally(generateDeliveryNotFoundException());<NEW_LINE>} else {<NEW_LINE>DeliveryState state;<NEW_LINE>if (transaction != TransactionContext.NULL_TXN) {<NEW_LINE>state = new TransactionalState();<NEW_LINE>((TransactionalState) state).setTxnId(new Binary(transaction.getTransactionId().array()));<NEW_LINE>((TransactionalState<MASK><NEW_LINE>} else {<NEW_LINE>state = (DeliveryState) outcome;<NEW_LINE>}<NEW_LINE>final UpdateStateWorkItem workItem = new UpdateStateWorkItem(completeMessageFuture, state, CoreMessageReceiver.this.operationTimeout);<NEW_LINE>CoreMessageReceiver.this.pendingUpdateStateRequests.put(deliveryTagAsString, workItem);<NEW_LINE>CoreMessageReceiver.this.ensureLinkIsOpen().thenRun(() -> {<NEW_LINE>try {<NEW_LINE>this.underlyingFactory.scheduleOnReactorThread(new DeliveryStateDispatchHandler(delivery, state));<NEW_LINE>} catch (IOException ioException) {<NEW_LINE>completeMessageFuture.completeExceptionally(generateDispatacherSchedulingFailedException("completeMessage", ioException));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>return completeMessageFuture;<NEW_LINE>} | ) state).setOutcome(outcome); |
589,735 | public void onRequestFinish(MegaChatApiJava api, MegaChatRequest request, MegaChatError e) {<NEW_LINE>logDebug("onRequestFinish(CHAT)");<NEW_LINE>if (request.getType() == MegaChatRequest.TYPE_ARCHIVE_CHATROOM) {<NEW_LINE>long chatHandle = request.getChatHandle();<NEW_LINE>MegaChatRoom chat = megaChatApi.getChatRoom(chatHandle);<NEW_LINE>String chatTitle = getTitleChat(chat);<NEW_LINE>if (chatTitle == null) {<NEW_LINE>chatTitle = "";<NEW_LINE>} else if (!chatTitle.isEmpty() && chatTitle.length() > 60) {<NEW_LINE>chatTitle = chatTitle.<MASK><NEW_LINE>}<NEW_LINE>if (!chatTitle.isEmpty() && chat.isGroup() && !chat.hasCustomTitle()) {<NEW_LINE>chatTitle = "\"" + chatTitle + "\"";<NEW_LINE>}<NEW_LINE>if (e.getErrorCode() == MegaChatError.ERROR_OK) {<NEW_LINE>if (request.getFlag()) {<NEW_LINE>logDebug("Chat archived");<NEW_LINE>showSnackbar(getString(R.string.success_archive_chat, chatTitle));<NEW_LINE>} else {<NEW_LINE>logDebug("Chat unarchived");<NEW_LINE>showSnackbar(getString(R.string.success_unarchive_chat, chatTitle));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (request.getFlag()) {<NEW_LINE>logError("ERROR WHEN ARCHIVING CHAT " + e.getErrorString());<NEW_LINE>showSnackbar(getString(R.string.error_archive_chat, chatTitle));<NEW_LINE>} else {<NEW_LINE>logError("ERROR WHEN UNARCHIVING CHAT " + e.getErrorString());<NEW_LINE>showSnackbar(getString(R.string.error_unarchive_chat, chatTitle));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | substring(0, 59) + "..."; |
446,582 | @Override<NEW_LINE>public JPanel createComponentImpl(Disposable parentUIDisposable) {<NEW_LINE>final Module module = getModule();<NEW_LINE>final Project project = module.getProject();<NEW_LINE>myContentEntryEditorListener = new MyContentEntryEditorListener();<NEW_LINE>final JPanel mainPanel = new JPanel(new BorderLayout());<NEW_LINE>final JPanel entriesPanel = new JPanel(new BorderLayout());<NEW_LINE>final AddContentEntryAction action = new AddContentEntryAction();<NEW_LINE>action.registerCustomShortcutSet(KeyEvent.VK_C, InputEvent.ALT_DOWN_MASK, mainPanel);<NEW_LINE>myEditorsPanel = new ScrollablePanel(new VerticalStackLayout());<NEW_LINE>myEditorsPanel.setBackground(UIUtil.getListBackground());<NEW_LINE>JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myEditorsPanel, true);<NEW_LINE>entriesPanel.add(new ToolbarPanel(scrollPane, ActionGroup.newImmutableBuilder().add(action).build()), BorderLayout.CENTER);<NEW_LINE>final JBSplitter splitter = new OnePixelSplitter(false);<NEW_LINE>splitter.setProportion(0.6f);<NEW_LINE>splitter.setHonorComponentsMinimumSize(true);<NEW_LINE>myRootTreeEditor = new ContentEntryTreeEditor(project, myState);<NEW_LINE>JComponent component = myRootTreeEditor.createComponent();<NEW_LINE>component.setBorder(new CustomLineBorder(JBUI.scale(1), 0, 0, 0));<NEW_LINE>splitter.setFirstComponent(component);<NEW_LINE>splitter.setSecondComponent(entriesPanel);<NEW_LINE>JPanel contentPanel = <MASK><NEW_LINE>final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, myRootTreeEditor.getEditingActionsGroup(), true);<NEW_LINE>actionToolbar.setTargetComponent(contentPanel);<NEW_LINE>contentPanel.add(actionToolbar.getComponent(), new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new JBInsets(0, 0, 0, 0), 0, 0));<NEW_LINE>contentPanel.add(splitter, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new JBInsets(0, 0, 0, 0), 0, 0));<NEW_LINE>mainPanel.add(contentPanel, BorderLayout.CENTER);<NEW_LINE>final ModifiableRootModel model = getModel();<NEW_LINE>if (model != null) {<NEW_LINE>final ContentEntry[] contentEntries = model.getContentEntries();<NEW_LINE>if (contentEntries.length > 0) {<NEW_LINE>for (final ContentEntry contentEntry : contentEntries) {<NEW_LINE>addContentEntryPanel(contentEntry);<NEW_LINE>}<NEW_LINE>selectContentEntry(contentEntries[0]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return mainPanel;<NEW_LINE>} | new JPanel(new GridBagLayout()); |
140,669 | Object doGeneric(VirtualFrame frame, @SuppressWarnings("unused") Object cls, Object start, Object stop, Object step, @Shared("stepZeroProfile") @Cached ConditionProfile stepZeroProfile, @Shared("exceptionProfile") @Cached BranchProfile exceptionProfile, @Shared("lenOfRangeNodeExact") @Cached LenOfIntRangeNodeExact lenOfRangeNodeExact, @Shared("createBigRangeNode") @Cached RangeNodes.CreateBigRangeNode createBigRangeNode, @Shared("cast") @Cached CastToJavaIntExactNode cast, @Shared("overflowProfile") @Cached IsBuiltinClassProfile overflowProfile, @Shared("indexNode") @Cached PyNumberIndexNode indexNode) {<NEW_LINE>Object lstart = indexNode.execute(frame, start);<NEW_LINE>Object lstop = indexNode.execute(frame, stop);<NEW_LINE>Object lstep = indexNode.execute(frame, step);<NEW_LINE>try {<NEW_LINE>int <MASK><NEW_LINE>int istop = cast.execute(lstop);<NEW_LINE>int istep = cast.execute(lstep);<NEW_LINE>return doInt(cls, istart, istop, istep, stepZeroProfile, exceptionProfile, lenOfRangeNodeExact, createBigRangeNode);<NEW_LINE>} catch (PException e) {<NEW_LINE>e.expect(OverflowError, overflowProfile);<NEW_LINE>return createBigRangeNode.execute(lstart, lstop, lstep, factory());<NEW_LINE>}<NEW_LINE>} | istart = cast.execute(lstart); |
1,455,334 | private void saveTheme() {<NEW_LINE>IJThemeInfo themeInfo = themesList.getSelectedValue();<NEW_LINE>if (themeInfo == null || themeInfo.resourceName == null)<NEW_LINE>return;<NEW_LINE>JFileChooser fileChooser = new JFileChooser();<NEW_LINE>fileChooser.setSelectedFile(new File(lastDirectory, themeInfo.resourceName));<NEW_LINE>if (fileChooser.showSaveDialog(SwingUtilities.windowForComponent(this)) != JFileChooser.APPROVE_OPTION)<NEW_LINE>return;<NEW_LINE>File file = fileChooser.getSelectedFile();<NEW_LINE>lastDirectory = file.getParentFile();<NEW_LINE>// save theme<NEW_LINE>try {<NEW_LINE>Files.copy(getClass().getResourceAsStream(THEMES_PACKAGE + themeInfo.resourceName), file.toPath(), StandardCopyOption.REPLACE_EXISTING);<NEW_LINE>} catch (IOException ex) {<NEW_LINE>showInformationDialog("Failed to save theme to '" + file + "'.", ex);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// save license<NEW_LINE>if (themeInfo.licenseFile != null) {<NEW_LINE>try {<NEW_LINE>File licenseFile = new File(file.getParentFile(), StringUtils.removeTrailing(file.getName(), ".theme.json") + themeInfo.licenseFile.substring(themeInfo.licenseFile.indexOf('.')));<NEW_LINE>Files.copy(getClass().getResourceAsStream(THEMES_PACKAGE + themeInfo.licenseFile), licenseFile.toPath(), StandardCopyOption.REPLACE_EXISTING);<NEW_LINE>} catch (IOException ex) {<NEW_LINE>showInformationDialog(<MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | "Failed to save theme license to '" + file + "'.", ex); |
392,551 | private void handleCodeCacheFull(CodeCacheEvent event) {<NEW_LINE>String reason = CODE_CACHE_FULL;<NEW_LINE>double score = 0;<NEW_LINE>if (scoreMap.containsKey(reason)) {<NEW_LINE>score = scoreMap.get(reason);<NEW_LINE>} else {<NEW_LINE>logger.warn("No score is set for reason: {}", reason);<NEW_LINE>}<NEW_LINE>StringBuilder builder = new StringBuilder();<NEW_LINE>builder.append(reason).append(C_NEWLINE);<NEW_LINE>builder.append("Occurred at ").append(event.getStamp() / 1000).append(" seconds").append(C_NEWLINE);<NEW_LINE>builder.append("The code cache is a memory region in the VM where JIT-compiled methods are stored. Once this becomes full no further JIT compilation is possible and uncompiled methods will run in the interpreter which may cause performance issues for your application.").append(C_NEWLINE);<NEW_LINE>builder.append("You can control the code cache size with -XX:ReservedCodeCacheSize=<size>m");<NEW_LINE>Report suggestion = new Report(null, -1, -1, builder.toString(), ReportType.CODE_CACHE, (int<MASK><NEW_LINE>if (!reportList.contains(suggestion)) {<NEW_LINE>reportList.add(suggestion);<NEW_LINE>}<NEW_LINE>} | ) Math.ceil(score)); |
1,408,861 | public ResponseEntity<String> fakeOuterStringSerializeWithHttpInfo(String body) throws RestClientException {<NEW_LINE>Object localVarPostBody = body;<NEW_LINE>final MultiValueMap<String, String> localVarQueryParams = new LinkedMultiValueMap<String, String>();<NEW_LINE>final HttpHeaders localVarHeaderParams = new HttpHeaders();<NEW_LINE>final MultiValueMap<String, String> localVarCookieParams = new LinkedMultiValueMap<String, String>();<NEW_LINE>final MultiValueMap<String, Object> localVarFormParams = new <MASK><NEW_LINE>final String[] localVarAccepts = { "*/*" };<NEW_LINE>final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] {};<NEW_LINE>ParameterizedTypeReference<String> localReturnType = new ParameterizedTypeReference<String>() {<NEW_LINE>};<NEW_LINE>return apiClient.invokeAPI("/fake/outer/string", HttpMethod.POST, Collections.<String, Object>emptyMap(), localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType);<NEW_LINE>} | LinkedMultiValueMap<String, Object>(); |
17,973 | public Object execute(ExecutionEvent event) throws ExecutionException {<NEW_LINE>IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();<NEW_LINE>IPath rootPath = root.getLocation();<NEW_LINE>IPath resourcePath = new Path(event.getParameter(PATH));<NEW_LINE>IResource resource = root.findMember<MASK><NEW_LINE>if (resource == null && !(resource instanceof IFile)) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>throw new ExecutionException("cannot find file: " + event.getParameter(PATH));<NEW_LINE>}<NEW_LINE>final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();<NEW_LINE>if (window == null) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>throw new ExecutionException("no active workbench window");<NEW_LINE>}<NEW_LINE>final IWorkbenchPage page = window.getActivePage();<NEW_LINE>if (page == null) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>throw new ExecutionException("no active workbench page");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>IDE.openEditor(page, (IFile) resource, true);<NEW_LINE>} catch (final PartInitException e) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>throw new ExecutionException("error opening file in editor", e);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | (resourcePath.makeRelativeTo(rootPath)); |
1,778,514 | void unparse() {<NEW_LINE>int i, j;<NEW_LINE>Code_attribute ca;<NEW_LINE>byte[] bc;<NEW_LINE>method_info mi;<NEW_LINE>exception_table_entry e;<NEW_LINE>for (i = 0; i < methods_count; i++) {<NEW_LINE>mi = methods[i];<NEW_LINE>// locate code attribute<NEW_LINE>ca = mi.locate_code_attribute();<NEW_LINE>if (ca == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>bc = unparseMethod(mi);<NEW_LINE>if (bc == null) {<NEW_LINE>logger.debug("Recompile of " + mi.toName(constant_pool) + " failed!");<NEW_LINE>} else {<NEW_LINE>ca.code_length = bc.length;<NEW_LINE>ca.code = bc;<NEW_LINE>// also recompile exception table<NEW_LINE>for (j = 0; j < ca.exception_table_length; j++) {<NEW_LINE>e = ca.exception_table[j];<NEW_LINE>e.start_pc = (e.start_inst.label);<NEW_LINE>if (e.end_inst != null) {<NEW_LINE>e.end_pc = (e.end_inst.label);<NEW_LINE>} else {<NEW_LINE>e.end_pc = <MASK><NEW_LINE>}<NEW_LINE>e.handler_pc = (e.handler_inst.label);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (int) (ca.code_length); |
1,578,660 | public UnsuccessfulItemError unmarshall(StaxUnmarshallerContext context) throws Exception {<NEW_LINE>UnsuccessfulItemError unsuccessfulItemError = new UnsuccessfulItemError();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>if (context.isStartOfDocument())<NEW_LINE>targetDepth += 1;<NEW_LINE>while (true) {<NEW_LINE><MASK><NEW_LINE>if (xmlEvent == XmlPullParser.END_DOCUMENT)<NEW_LINE>return unsuccessfulItemError;<NEW_LINE>if (xmlEvent == XmlPullParser.START_TAG) {<NEW_LINE>if (context.testExpression("code", targetDepth)) {<NEW_LINE>unsuccessfulItemError.setCode(StringStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("message", targetDepth)) {<NEW_LINE>unsuccessfulItemError.setMessage(StringStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>} else if (xmlEvent == XmlPullParser.END_TAG) {<NEW_LINE>if (context.getCurrentDepth() < originalDepth) {<NEW_LINE>return unsuccessfulItemError;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | int xmlEvent = context.nextEvent(); |
567,964 | public Object calculate(Context ctx) {<NEW_LINE>if (param == null) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("zip" + mm.getMessage("function.missingParam"));<NEW_LINE>}<NEW_LINE>int size = param.getSubSize();<NEW_LINE>if (size == 0) {<NEW_LINE>Object o = param.getLeafExpression().calculate(ctx);<NEW_LINE>if ((o instanceof ImOpen)) {<NEW_LINE>Map<String, Object> mp = ((ImOpen) o).getParams();<NEW_LINE>doParam(mp);<NEW_LINE>return doQuery(null);<NEW_LINE>}<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("zip" + mm.getMessage("function.paramTypeError"));<NEW_LINE>}<NEW_LINE>Object cli = new Object();<NEW_LINE>Object[] objs = new Object[size - 1];<NEW_LINE>for (int i = 0; i < size; i++) {<NEW_LINE>if (param.getSub(i) == null) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("zip" <MASK><NEW_LINE>}<NEW_LINE>if (i == 0) {<NEW_LINE>cli = param.getSub(i).getLeafExpression().calculate(ctx);<NEW_LINE>if ((cli instanceof ImOpen)) {<NEW_LINE>Map<String, Object> mp = ((ImOpen) cli).getParams();<NEW_LINE>doParam(mp);<NEW_LINE>} else {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("zip" + mm.getMessage("function.paramTypeError"));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>objs[(i - 1)] = param.getSub(i).getLeafExpression().calculate(ctx);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (m_zipfile == null) {<NEW_LINE>throw new RQException("zipfile is null");<NEW_LINE>}<NEW_LINE>if (objs.length < 1) {<NEW_LINE>throw new RQException("param is empty");<NEW_LINE>}<NEW_LINE>return doQuery(objs);<NEW_LINE>} | + mm.getMessage("function.invalidParam")); |
1,036,515 | public void check(HealthCheckRequest request, StreamObserver<HealthCheckResponse> responseObserver) {<NEW_LINE>String service = request.getService();<NEW_LINE>HealthCheck <MASK><NEW_LINE>if (check == null) {<NEW_LINE>// If no health check is registered for the requested service then respond with a not found error.<NEW_LINE>// See method comments:<NEW_LINE>// https://github.com/grpc/grpc-java/blob/7df2d5feebf8bc5ecfcea3edba290db500382dcf/services/src/generated/main/grpc/io/grpc/health/v1/HealthGrpc.java#L149<NEW_LINE>String message = "Service '" + service + "' does not exist or does not have a registered health check";<NEW_LINE>responseObserver.onError(Status.NOT_FOUND.withDescription(message).asException());<NEW_LINE>} else {<NEW_LINE>responseObserver.onNext(toHealthCheckResponse(check.call()));<NEW_LINE>responseObserver.onCompleted();<NEW_LINE>}<NEW_LINE>} | check = mapHealthChecks.get(service); |
406,047 | public void actionPerformed(AnActionEvent e) {<NEW_LINE>final Project project = e.getProject();<NEW_LINE>if (project == null) {<NEW_LINE>fail("The current project is invalid");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final VirtualFile buckFile = findBuckFileFromActionEvent(e);<NEW_LINE>if (buckFile == null) {<NEW_LINE>fail("Unable to find a BUCK file");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final BuckTargetPattern buckTargetPattern = BuckTargetLocator.getInstance(project).findTargetPatternForVirtualFile(buckFile).orElse(null);<NEW_LINE>if (buckTargetPattern == null) {<NEW_LINE>fail("Unable to find a Buck target pattern for " + buckFile.getCanonicalPath());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>BuckCellManager buckCellManager = BuckCellManager.getInstance(project);<NEW_LINE>final BuckCellManager.Cell buckCell = buckCellManager.findCellByVirtualFile(buckFile).orElse(null);<NEW_LINE>String targetPath = buckTargetPattern.toString();<NEW_LINE>if (buckCellManager.getDefaultCell().map(defaultCell -> defaultCell.equals(buckCell)).orElse(false) && targetPath.contains("//")) {<NEW_LINE>// If it is in the default cell, remove the cell name prefix<NEW_LINE>targetPath = "//" + targetPath.split("//")[1];<NEW_LINE>}<NEW_LINE>if (buckFile.equals(e.getData(CommonDataKeys.VIRTUAL_FILE))) {<NEW_LINE><MASK><NEW_LINE>if (targetName != null) {<NEW_LINE>CopyPasteManager.getInstance().setContents(new StringSelection(targetPath + targetName));<NEW_LINE>} else {<NEW_LINE>fail("Unable to get the name of the Buck target");<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final String cellPath = buckTargetPattern.getCellPath().orElse(null);<NEW_LINE>if (cellPath == null) {<NEW_LINE>fail("Unable to get the cell path of " + buckTargetPattern);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final String[] parts = cellPath.split("/");<NEW_LINE>if (parts.length == 0) {<NEW_LINE>fail("Cell path " + cellPath + " is invalid");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>CopyPasteManager.getInstance().setContents(new StringSelection(targetPath + parts[parts.length - 1]));<NEW_LINE>} | final String targetName = getTargetNameFromActionEvent(e); |
1,848,011 | public static DescribeAuditRecordsResponse unmarshall(DescribeAuditRecordsResponse describeAuditRecordsResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeAuditRecordsResponse.setRequestId<MASK><NEW_LINE>describeAuditRecordsResponse.setTotalRecordCount(_ctx.integerValue("DescribeAuditRecordsResponse.TotalRecordCount"));<NEW_LINE>describeAuditRecordsResponse.setPageNumber(_ctx.integerValue("DescribeAuditRecordsResponse.PageNumber"));<NEW_LINE>describeAuditRecordsResponse.setPageRecordCount(_ctx.integerValue("DescribeAuditRecordsResponse.PageRecordCount"));<NEW_LINE>List<SQLRecord> items = new ArrayList<SQLRecord>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeAuditRecordsResponse.Items.Length"); i++) {<NEW_LINE>SQLRecord sQLRecord = new SQLRecord();<NEW_LINE>sQLRecord.setDBName(_ctx.stringValue("DescribeAuditRecordsResponse.Items[" + i + "].DBName"));<NEW_LINE>sQLRecord.setAccountName(_ctx.stringValue("DescribeAuditRecordsResponse.Items[" + i + "].AccountName"));<NEW_LINE>sQLRecord.setHostAddress(_ctx.stringValue("DescribeAuditRecordsResponse.Items[" + i + "].HostAddress"));<NEW_LINE>sQLRecord.setSyntax(_ctx.stringValue("DescribeAuditRecordsResponse.Items[" + i + "].Syntax"));<NEW_LINE>sQLRecord.setTotalExecutionTimes(_ctx.longValue("DescribeAuditRecordsResponse.Items[" + i + "].TotalExecutionTimes"));<NEW_LINE>sQLRecord.setReturnRowCounts(_ctx.longValue("DescribeAuditRecordsResponse.Items[" + i + "].ReturnRowCounts"));<NEW_LINE>sQLRecord.setExecuteTime(_ctx.stringValue("DescribeAuditRecordsResponse.Items[" + i + "].ExecuteTime"));<NEW_LINE>sQLRecord.setThreadID(_ctx.stringValue("DescribeAuditRecordsResponse.Items[" + i + "].ThreadID"));<NEW_LINE>sQLRecord.setTableName(_ctx.stringValue("DescribeAuditRecordsResponse.Items[" + i + "].TableName"));<NEW_LINE>items.add(sQLRecord);<NEW_LINE>}<NEW_LINE>describeAuditRecordsResponse.setItems(items);<NEW_LINE>return describeAuditRecordsResponse;<NEW_LINE>} | (_ctx.stringValue("DescribeAuditRecordsResponse.RequestId")); |
162,636 | private // <editor-fold desc="actions OK/APPLY/CANCEL, dirty "><NEW_LINE>void actionPerformedUpdates(Window _parent) {<NEW_LINE>boolean tempDirty = isDirty();<NEW_LINE>if (paneNaming.isDirty()) {<NEW_LINE>String filename = paneNaming.getAbsolutePath();<NEW_LINE>if (filename.contains("%")) {<NEW_LINE>Debug.error("%s\n%% in filename replaced with _", filename);<NEW_LINE>filename = filename.replace("%", "_");<NEW_LINE>}<NEW_LINE>String oldFilename = imgBtn.getFilename();<NEW_LINE>if (new File(filename).exists()) {<NEW_LINE>String name = new File(filename).getName();<NEW_LINE>int ret = JOptionPane.showConfirmDialog(_parent, SikuliIDEI18N._I("msgFileExists", name), SikuliIDEI18N._I("dlgFileExists"), JOptionPane.WARNING_MESSAGE, JOptionPane.YES_NO_OPTION);<NEW_LINE>if (ret != JOptionPane.YES_OPTION) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (isFileOverwritten) {<NEW_LINE>if (!revertImageRename()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>isFileOverwritten = true;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>FileManager.xcopy(oldFilename, filename);<NEW_LINE>renameScreenshot(oldFilename, filename);<NEW_LINE>imgBtn.setImage(filename);<NEW_LINE>fileRenameOld = oldFilename;<NEW_LINE>fileRenameNew = filename;<NEW_LINE>} catch (IOException ioe) {<NEW_LINE>Debug.error("renaming failed: old: %s \nnew: %s\n%s", oldFilename, filename, ioe.getMessage());<NEW_LINE>isFileOverwritten = false;<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// paneNaming.updateFilename();<NEW_LINE>addDirty(true);<NEW_LINE>}<NEW_LINE>Rectangle changedBounds = _tarOffsetPane.getChangedBounds();<NEW_LINE>if (changedBounds != null) {<NEW_LINE>File file = new File(paneNaming.getAbsolutePath());<NEW_LINE>BufferedImage changedImg = _simg.getImage().getSubimage(changedBounds.x, changedBounds.y, changedBounds.width, changedBounds.height);<NEW_LINE>try {<NEW_LINE>ImageIO.write(changedImg, "png", file);<NEW_LINE>} catch (IOException e) {<NEW_LINE>Debug.error("PatternWindow: Error while saving resized pattern image: %s", e.getMessage());<NEW_LINE>}<NEW_LINE>// TODO imgBtn.reloadImage();<NEW_LINE>_screenshot.reloadImage();<NEW_LINE>paneNaming.reloadImage();<NEW_LINE>currentPane.repaint();<NEW_LINE>if (!currentPane.hasScreenshotImage(file.getName())) {<NEW_LINE>_simg.save(file.getName(), currentPane.context.getScreenshotFolder().getAbsolutePath());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>addDirty(imgBtn.setParameters(_screenshot.isExact(), _screenshot.getSimilarity(), _screenshot.getNumMatches()));<NEW_LINE>addDirty(imgBtn.setTargetOffset(_tarOffsetPane.getTargetOffset()));<NEW_LINE>if (isDirty() || tempDirty) {<NEW_LINE>Debug.log(3, "Preview: update: " + imgBtn.toString());<NEW_LINE>int i = imgBtn.getWindow<MASK><NEW_LINE>imgBtn.getWindow().setMessageApplied(i, true);<NEW_LINE>imgBtn.repaint();<NEW_LINE>}<NEW_LINE>} | ().tabPane.getSelectedIndex(); |
1,110,479 | private ObjectCursor<Note> queryNotesForSearch() {<NEW_LINE>if (!isAdded()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Query<Note> query = Note.all(((Simplenote) requireActivity().getApplication()).getNotesBucket());<NEW_LINE>String searchString = mSearchString;<NEW_LINE>if (hasSearchQuery()) {<NEW_LINE>searchString = queryTags(query, mSearchString);<NEW_LINE>}<NEW_LINE>if (!TextUtils.isEmpty(searchString)) {<NEW_LINE>query.where(new Query.FullTextMatch(new SearchTokenizer(searchString)));<NEW_LINE>query.include(new Query.FullTextOffsets("match_offsets"));<NEW_LINE>query.include(new Query.FullTextSnippet(Note.MATCHED_TITLE_INDEX_NAME, Note.TITLE_INDEX_NAME));<NEW_LINE>query.include(new Query.FullTextSnippet(Note.MATCHED_CONTENT_INDEX_NAME, Note.CONTENT_PROPERTY));<NEW_LINE>query.include(Note.TITLE_INDEX_NAME, Note.CONTENT_PREVIEW_INDEX_NAME);<NEW_LINE>} else {<NEW_LINE>query.include(<MASK><NEW_LINE>}<NEW_LINE>PrefUtils.sortNoteQuery(query, requireContext(), false);<NEW_LINE>return query.execute();<NEW_LINE>} | Note.TITLE_INDEX_NAME, Note.CONTENT_PREVIEW_INDEX_NAME); |
784,309 | public ProvisioningArtifactPreferences unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ProvisioningArtifactPreferences provisioningArtifactPreferences = new ProvisioningArtifactPreferences();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("StackSetAccounts", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>provisioningArtifactPreferences.setStackSetAccounts(new ListUnmarshaller<String>(context.getUnmarshaller(String.class)).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("StackSetRegions", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>provisioningArtifactPreferences.setStackSetRegions(new ListUnmarshaller<String>(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 provisioningArtifactPreferences;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,662,229 | private TaskProvider<ValidatePlugins> configureValidationTask(Project project, List<File> pluginJars, String pluginId) {<NEW_LINE>String idWithoutDots = pluginId.replace('.', '_');<NEW_LINE>return project.getTasks().register(VALIDATE_EXTERNAL_PLUGIN_TASK_PREFIX + idWithoutDots, ValidatePlugins.class, task -> {<NEW_LINE>task.setGroup(PLUGIN_DEVELOPMENT_GROUP);<NEW_LINE>task.setDescription(VALIDATE_PLUGIN_TASK_DESCRIPTION);<NEW_LINE>task.getOutputFile().set(project.getLayout().getBuildDirectory().file("reports/plugins/validation-report-for-" + idWithoutDots + ".txt"));<NEW_LINE>ScriptHandlerInternal scriptHandler = (ScriptHandlerInternal) project.getBuildscript();<NEW_LINE>List<File> scriptClassPath = scriptHandler.getScriptClassPath().getAsFiles();<NEW_LINE>task.getClasses().setFrom(pluginClassesOf(pluginJars));<NEW_LINE>task.<MASK><NEW_LINE>});<NEW_LINE>} | getClasspath().setFrom(scriptClassPath); |
1,404,845 | public BDD bgpWellFormednessConstraints() {<NEW_LINE>// the protocol should be one of the ones allowed in a BgpRoute<NEW_LINE>BDD protocolConstraint = anyProtocolIn(ALL_BGP_PROTOCOLS);<NEW_LINE>// the prefix length should be 32 or less<NEW_LINE>BDD prefLenConstraint = _prefixLength.leq(32);<NEW_LINE>// at most one AS-path regex atomic predicate should be true, since by construction their<NEW_LINE>// regexes are all pairwise disjoint<NEW_LINE>// Note: the same constraint does not apply to community regexes because a route has a set<NEW_LINE>// of communities, so more than one regex can be simultaneously true<NEW_LINE>BDD asPathConstraint = _factory.one();<NEW_LINE>for (int i = 0; i < _asPathRegexAtomicPredicates.length; i++) {<NEW_LINE>for (int j = i + 1; j < _asPathRegexAtomicPredicates.length; j++) {<NEW_LINE>asPathConstraint.andWith(_asPathRegexAtomicPredicates[i].<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>// the next hop should be neither the min nor the max possible IP<NEW_LINE>// this constraint is enforced by NextHopIp's constructor<NEW_LINE>BDD nextHopConstraint = _nextHop.range(Ip.ZERO.asLong() + 1, Ip.MAX.asLong() - 1);<NEW_LINE>return protocolConstraint.andWith(prefLenConstraint).andWith(asPathConstraint).andWith(nextHopConstraint);<NEW_LINE>} | nand(_asPathRegexAtomicPredicates[j])); |
1,640,417 | public TByteBuffer putInt(int index, int value) {<NEW_LINE>if (readOnly) {<NEW_LINE>throw new TReadOnlyBufferException();<NEW_LINE>}<NEW_LINE>if (index < 0 || index + 3 >= limit) {<NEW_LINE>throw new IndexOutOfBoundsException("Index " + index + " is outside of range [0;" + (limit - 3) + ")");<NEW_LINE>}<NEW_LINE>if (order == TByteOrder.BIG_ENDIAN) {<NEW_LINE>array[start + index] = (byte) (value >> 24);<NEW_LINE>array[start + index + 1] = (byte) (value >> 16);<NEW_LINE>array[start + index + 2] = (<MASK><NEW_LINE>array[start + index + 3] = (byte) value;<NEW_LINE>} else {<NEW_LINE>array[start + index] = (byte) value;<NEW_LINE>array[start + index + 1] = (byte) (value >> 8);<NEW_LINE>array[start + index + 2] = (byte) (value >> 16);<NEW_LINE>array[start + index + 3] = (byte) (value >> 24);<NEW_LINE>}<NEW_LINE>return this;<NEW_LINE>} | byte) (value >> 8); |
884,278 | public static QueryRmsDataTopksResponse unmarshall(QueryRmsDataTopksResponse queryRmsDataTopksResponse, UnmarshallerContext _ctx) {<NEW_LINE>queryRmsDataTopksResponse.setRequestId(_ctx.stringValue("QueryRmsDataTopksResponse.RequestId"));<NEW_LINE>queryRmsDataTopksResponse.setResultCode(_ctx.stringValue("QueryRmsDataTopksResponse.ResultCode"));<NEW_LINE>queryRmsDataTopksResponse.setResultMessage(_ctx.stringValue("QueryRmsDataTopksResponse.ResultMessage"));<NEW_LINE>Response response = new Response();<NEW_LINE>response.setError(_ctx.stringValue("QueryRmsDataTopksResponse.Response.Error"));<NEW_LINE>response.setErrorType(_ctx.stringValue("QueryRmsDataTopksResponse.Response.ErrorType"));<NEW_LINE>response.setQuery(_ctx.stringValue("QueryRmsDataTopksResponse.Response.Query"));<NEW_LINE>response.setStatus(_ctx.stringValue("QueryRmsDataTopksResponse.Response.Status"));<NEW_LINE>Data data = new Data();<NEW_LINE>data.setResultType<MASK><NEW_LINE>List<ResultItem> result = new ArrayList<ResultItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("QueryRmsDataTopksResponse.Response.Data.Result.Length"); i++) {<NEW_LINE>ResultItem resultItem = new ResultItem();<NEW_LINE>resultItem.setPort(_ctx.stringValue("QueryRmsDataTopksResponse.Response.Data.Result[" + i + "].Port"));<NEW_LINE>resultItem.setTargetId(_ctx.stringValue("QueryRmsDataTopksResponse.Response.Data.Result[" + i + "].TargetId"));<NEW_LINE>resultItem.setTargetName(_ctx.stringValue("QueryRmsDataTopksResponse.Response.Data.Result[" + i + "].TargetName"));<NEW_LINE>resultItem.setTimestamp(_ctx.stringValue("QueryRmsDataTopksResponse.Response.Data.Result[" + i + "].Timestamp"));<NEW_LINE>resultItem.setValue(_ctx.longValue("QueryRmsDataTopksResponse.Response.Data.Result[" + i + "].Value"));<NEW_LINE>result.add(resultItem);<NEW_LINE>}<NEW_LINE>data.setResult(result);<NEW_LINE>response.setData(data);<NEW_LINE>queryRmsDataTopksResponse.setResponse(response);<NEW_LINE>return queryRmsDataTopksResponse;<NEW_LINE>} | (_ctx.stringValue("QueryRmsDataTopksResponse.Response.Data.ResultType")); |
1,398,955 | public static void buildApiDoc(ApiConfig config, JavaProjectBuilder javaProjectBuilder) {<NEW_LINE>config.setFramework(FrameworkEnum.DUBBO.getFramework());<NEW_LINE>config.setAdoc(true);<NEW_LINE>config.setShowJavaType(true);<NEW_LINE>RpcDocBuilderTemplate builderTemplate = new RpcDocBuilderTemplate();<NEW_LINE>builderTemplate.checkAndInit(config);<NEW_LINE>ProjectDocConfigBuilder configBuilder = new ProjectDocConfigBuilder(config, javaProjectBuilder);<NEW_LINE>IDocBuildTemplate docBuildTemplate = BuildTemplateFactory.getDocBuildTemplate(config.getFramework());<NEW_LINE>List<RpcApiDoc> apiDocList = docBuildTemplate.getApiData(configBuilder);<NEW_LINE>if (config.isAllInOne()) {<NEW_LINE>String docName = builderTemplate.allInOneDocName(config, INDEX_DOC, ".adoc");<NEW_LINE>builderTemplate.buildAllInOne(apiDocList, <MASK><NEW_LINE>} else {<NEW_LINE>builderTemplate.buildApiDoc(apiDocList, config, RPC_API_DOC_ADOC_TPL, API_EXTENSION);<NEW_LINE>builderTemplate.buildErrorCodeDoc(config, ERROR_CODE_LIST_ADOC_TPL, ERROR_CODE_LIST_ADOC);<NEW_LINE>}<NEW_LINE>} | config, javaProjectBuilder, RPC_ALL_IN_ONE_ADOC_TPL, docName); |
944,239 | public static APIAttachDataVolumeToVmEvent __example__() {<NEW_LINE>APIAttachDataVolumeToVmEvent event = new APIAttachDataVolumeToVmEvent();<NEW_LINE>String volumeUuid = uuid();<NEW_LINE>VolumeInventory vol = new VolumeInventory();<NEW_LINE>vol.setName("test-volume");<NEW_LINE>vol.setCreateDate(new Timestamp(org.zstack.header.message.DocUtils.date));<NEW_LINE>vol.setLastOpDate(new Timestamp(org.zstack.header.message.DocUtils.date));<NEW_LINE>vol.setType(VolumeType.Root.toString());<NEW_LINE>vol.setUuid(volumeUuid);<NEW_LINE>vol.setSize(SizeUnit.GIGABYTE.toByte(100));<NEW_LINE>vol.setActualSize(SizeUnit.GIGABYTE.toByte(20));<NEW_LINE>vol.setDeviceId(0);<NEW_LINE>vol.setState(VolumeState.Enabled.toString());<NEW_LINE>vol.setFormat("qcow2");<NEW_LINE>vol.setDiskOfferingUuid(uuid());<NEW_LINE>vol.setInstallPath(String.format("/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-%s/%s.qcow2", volumeUuid, volumeUuid));<NEW_LINE>vol.setStatus(VolumeStatus.Ready.toString());<NEW_LINE><MASK><NEW_LINE>vol.setVmInstanceUuid(uuid());<NEW_LINE>vol.setRootImageUuid(uuid());<NEW_LINE>event.setInventory(vol);<NEW_LINE>return event;<NEW_LINE>} | vol.setPrimaryStorageUuid(uuid()); |
213,221 | public synchronized ProxyQueueConversationGroup create(Conversation conversation) throws IllegalArgumentException {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())<NEW_LINE>SibTr.entry(tc, "create", conversation);<NEW_LINE>if (convToGroupMap.containsKey(conversation)) {<NEW_LINE>// A proxy queue conversation group is associated one-to-one with a conversation. In this<NEW_LINE>// case someone has tried to create 2 for the same conversation.<NEW_LINE>SIErrorException e = new SIErrorException(nls.getFormattedMessage<MASK><NEW_LINE>FFDCFilter.processException(e, CLASS_NAME + ".create", CommsConstants.PQCONVGRPFACTIMPL_CREATE_01, this);<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>ProxyQueueConversationGroup group = new ProxyQueueConversationGroupImpl(conversation, this);<NEW_LINE>convToGroupMap.put(conversation, group);<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())<NEW_LINE>SibTr.exit(tc, "create", group);<NEW_LINE>return group;<NEW_LINE>} | ("PQGROUP_ALREADY_CREATED_SICO1054", null, null)); |
273,049 | public ApiResponse<FileShare> fileSharesPutWithHttpInfo(String id, UpdateShareRequest updateFileShareRequest) throws ApiException {<NEW_LINE>Object localVarPostBody = updateFileShareRequest;<NEW_LINE>// verify the required parameter 'id' is set<NEW_LINE>if (id == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'id' when calling fileSharesPut");<NEW_LINE>}<NEW_LINE>// verify the required parameter 'updateFileShareRequest' is set<NEW_LINE>if (updateFileShareRequest == null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/v4/fileshares/{id}".replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>final String[] localVarAccepts = { "application/json", "text/json" };<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final String[] localVarContentTypes = { "application/json", "text/json" };<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] { "oauth2" };<NEW_LINE>GenericType<FileShare> localVarReturnType = new GenericType<FileShare>() {<NEW_LINE>};<NEW_LINE>return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);<NEW_LINE>} | throw new ApiException(400, "Missing the required parameter 'updateFileShareRequest' when calling fileSharesPut"); |
782,985 | private String generatePasswordResetToken(String email, HttpServletRequest req) {<NEW_LINE>if (StringUtils.isBlank(email)) {<NEW_LINE>return "";<NEW_LINE>}<NEW_LINE>Sysprop <MASK><NEW_LINE>// pass reset emails can be sent once every 12h<NEW_LINE>if (s != null) {<NEW_LINE>if (!s.hasProperty("iforgotTimestamp") || Utils.timestamp() > (Long.valueOf(s.getProperty("iforgotTimestamp").toString()) + TimeUnit.HOURS.toMillis(12))) {<NEW_LINE>String token = Utils.generateSecurityToken(42, true);<NEW_LINE>s.addProperty(Config._RESET_TOKEN, token);<NEW_LINE>s.addProperty("iforgotTimestamp", Utils.timestamp());<NEW_LINE>s.setUpdated(Utils.timestamp());<NEW_LINE>if (pc.update(s) != null) {<NEW_LINE>utils.sendPasswordResetEmail(email, token, req);<NEW_LINE>}<NEW_LINE>return token;<NEW_LINE>} else {<NEW_LINE>logger.warn("Failed to send password reset email to '{}' - this can only be done once every 12h.", email);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>logger.warn("Failed to send password reset email to '{}' - user has not signed in with that email and passowrd.", email);<NEW_LINE>}<NEW_LINE>return "";<NEW_LINE>} | s = pc.read(email); |
1,147,093 | private static void addBoxSetCounts(Context context, BaseItemDto item, LinearLayout layout) {<NEW_LINE>boolean hasSpecificCounts = false;<NEW_LINE>if (item.getMovieCount() != null && item.getMovieCount() > 0) {<NEW_LINE>TextView amt = new TextView(context);<NEW_LINE>amt.setTextSize(textSize);<NEW_LINE>amt.setText(item.getMovieCount().toString() + " " + context.getResources().getString(R<MASK><NEW_LINE>layout.addView(amt);<NEW_LINE>hasSpecificCounts = true;<NEW_LINE>}<NEW_LINE>if (item.getSeriesCount() != null && item.getSeriesCount() > 0) {<NEW_LINE>TextView amt = new TextView(context);<NEW_LINE>amt.setTextSize(textSize);<NEW_LINE>amt.setText(item.getSeriesCount().toString() + " " + context.getResources().getString(R.string.lbl_tv_series) + " ");<NEW_LINE>layout.addView(amt);<NEW_LINE>hasSpecificCounts = true;<NEW_LINE>}<NEW_LINE>if (!hasSpecificCounts && item.getChildCount() != null && item.getChildCount() > 0) {<NEW_LINE>TextView amt = new TextView(context);<NEW_LINE>amt.setTextSize(textSize);<NEW_LINE>amt.setText(item.getChildCount().toString() + " " + context.getResources().getString(item.getChildCount() > 1 ? R.string.lbl_items : R.string.lbl_item) + " ");<NEW_LINE>layout.addView(amt);<NEW_LINE>}<NEW_LINE>} | .string.lbl_movies) + " "); |
11,605 | public CompletionServiceResponse doMultiGetRequest(List<String> serverURLs, String tableNameWithType, boolean multiRequestPerServer, int timeoutMs) {<NEW_LINE>CompletionServiceResponse completionServiceResponse = new CompletionServiceResponse();<NEW_LINE>// TODO: use some service other than completion service so that we know which server encounters the error<NEW_LINE>CompletionService<GetMethod> completionService = new MultiGetRequest(_executor, _httpConnectionManager).execute(serverURLs, timeoutMs);<NEW_LINE>for (int i = 0; i < serverURLs.size(); i++) {<NEW_LINE>GetMethod getMethod = null;<NEW_LINE>try {<NEW_LINE>getMethod = completionService.take().get();<NEW_LINE>URI uri = getMethod.getURI();<NEW_LINE>String instance = _endpointsToServers.get(String.format("%s://%s:%d", uri.getScheme(), uri.getHost(), uri.getPort()));<NEW_LINE>if (getMethod.getStatusCode() >= 300) {<NEW_LINE>LOGGER.error("Server: {} returned error: {}", instance, getMethod.getStatusCode());<NEW_LINE>completionServiceResponse._failedResponseCount++;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>completionServiceResponse._httpResponses.put(multiRequestPerServer ? uri.toString() : instance, getMethod.getResponseBodyAsString());<NEW_LINE>} catch (Exception e) {<NEW_LINE><MASK><NEW_LINE>completionServiceResponse._failedResponseCount++;<NEW_LINE>} finally {<NEW_LINE>if (getMethod != null) {<NEW_LINE>getMethod.releaseConnection();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int numServersResponded = completionServiceResponse._httpResponses.size();<NEW_LINE>if (numServersResponded != serverURLs.size()) {<NEW_LINE>LOGGER.warn("Finished reading information for table: {} with {}/{} server responses", tableNameWithType, numServersResponded, serverURLs.size());<NEW_LINE>} else {<NEW_LINE>LOGGER.info("Finished reading information for table: {}", tableNameWithType);<NEW_LINE>}<NEW_LINE>return completionServiceResponse;<NEW_LINE>} | LOGGER.error("Connection error", e); |
111,802 | public com.squareup.okhttp.Call announcementGetCall(String columns, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/announcement";<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();<NEW_LINE>if (columns != null)<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPair("columns", columns));<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>final String[] localVarAccepts = { "application/json", "application/xml", "text/xml", "application/javascript", "text/javascript" };<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>if (localVarAccept != null)<NEW_LINE>localVarHeaderParams.put("Accept", localVarAccept);<NEW_LINE>final String[] localVarContentTypes = { "application/json", "application/x-www-form-urlencoded" };<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>localVarHeaderParams.put("Content-Type", localVarContentType);<NEW_LINE>if (progressListener != null) {<NEW_LINE>apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {<NEW_LINE>com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());<NEW_LINE>return originalResponse.newBuilder().body(new ProgressResponseBody(originalResponse.body()<MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>String[] localVarAuthNames = new String[] {};<NEW_LINE>return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);<NEW_LINE>} | , progressListener)).build(); |
1,723,112 | private void renderCategoryMeasurements(final TimedOperationCategory category, final Map<String, TimedResult> labeledMeasurements, final Writer writer) throws IOException {<NEW_LINE>renderHeader(category.displayName(), writer);<NEW_LINE>final TimedResult grandTotal = new TimedResult();<NEW_LINE>final TreeSet<Map.Entry<String, TimedResult>> sortedKeySet = new TreeSet<>(new Comparator<Map.Entry<String, TimedResult>>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public int compare(final Entry<String, TimedResult> o1, final Entry<String, TimedResult> o2) {<NEW_LINE>return Long.compare(o1.getValue().selfTimeNanos.get(), o2.getValue(<MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>sortedKeySet.addAll(labeledMeasurements.entrySet());<NEW_LINE>for (final Map.Entry<String, TimedResult> entry : sortedKeySet) {<NEW_LINE>renderMeasurement(entry.getKey(), entry.getValue(), writer);<NEW_LINE>grandTotal.mergeTimes(entry.getValue());<NEW_LINE>}<NEW_LINE>writer.write(PMD.EOL);<NEW_LINE>renderMeasurement("Total " + category.displayName(), grandTotal, writer);<NEW_LINE>writer.write(PMD.EOL);<NEW_LINE>} | ).selfTimeNanos.get()); |
997,169 | public String[] expandOptionFiles(String[] argv, boolean ignoreComments, boolean ignoreBlankLines) throws IOException, HelpRequestedException {<NEW_LINE>// Add all expanded options at the end of the options list, before the<NEW_LINE>// list of<NEW_LINE>// jar/zip/class files and directories.<NEW_LINE>// At the end of the options to preserve the order of the options (e.g.<NEW_LINE>// -adjustPriority<NEW_LINE>// must always come after -pluginList).<NEW_LINE>int lastOptionIndex = parse(argv, true);<NEW_LINE>ArrayList<String> resultList = new ArrayList<>();<NEW_LINE>ArrayList<String> expandedOptionsList = getAnalysisOptionProperties(ignoreComments, ignoreBlankLines);<NEW_LINE>for (int i = 0; i < lastOptionIndex; i++) {<NEW_LINE>String arg = argv[i];<NEW_LINE>if (!arg.startsWith("@")) {<NEW_LINE>resultList.add(arg);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>try (FileInputStream stream = new FileInputStream(arg.substring(1));<NEW_LINE>BufferedReader reader = UTF8.bufferedReader(stream)) {<NEW_LINE>addCommandLineOptions(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>resultList.addAll(expandedOptionsList);<NEW_LINE>for (int i = lastOptionIndex; i < argv.length; i++) {<NEW_LINE>resultList.add(argv[i]);<NEW_LINE>}<NEW_LINE>return resultList.toArray(new String[0]);<NEW_LINE>} | expandedOptionsList, reader, ignoreComments, ignoreBlankLines); |
1,598,295 | public static CacheLine deserializeFromJson(String json) {<NEW_LINE>JSONObject cacheLineJson = JSON.parseObject(json);<NEW_LINE>long rowCount = cacheLineJson.getLong("rowCount");<NEW_LINE>long currentTime = unixTimeStamp();<NEW_LINE>CacheLine cacheLine = new CacheLine(rowCount, currentTime, currentTime);<NEW_LINE>cacheLine.setSampleRate(cacheLineJson.getFloatValue("sampleRate"));<NEW_LINE>Map<String, Long> <MASK><NEW_LINE>JSONObject cardinalityMapJsonObject = cacheLineJson.getJSONObject("cardinalityMap");<NEW_LINE>for (String columnName : cardinalityMapJsonObject.keySet()) {<NEW_LINE>cardinalityMap.put(columnName, cardinalityMapJsonObject.getLongValue(columnName));<NEW_LINE>}<NEW_LINE>cacheLine.setCardinalityMap(cardinalityMap);<NEW_LINE>Map<String, Long> nullCountMap = new HashMap<>();<NEW_LINE>JSONObject nullCountMapJsonObject = cacheLineJson.getJSONObject("nullCountMap");<NEW_LINE>for (String columnName : nullCountMapJsonObject.keySet()) {<NEW_LINE>nullCountMap.put(columnName, nullCountMapJsonObject.getLongValue(columnName));<NEW_LINE>}<NEW_LINE>cacheLine.setNullCountMap(nullCountMap);<NEW_LINE>Map<String, CountMinSketch> countMinSketchMap = new HashMap<>();<NEW_LINE>JSONObject countMinSketchMapJsonObject = cacheLineJson.getJSONObject("countMinSketchMap");<NEW_LINE>for (String columnName : countMinSketchMapJsonObject.keySet()) {<NEW_LINE>countMinSketchMap.put(columnName, CountMinSketch.deserialize(Base64.decodeBase64(countMinSketchMapJsonObject.getString(columnName))));<NEW_LINE>}<NEW_LINE>cacheLine.setCountMinSketchMap(countMinSketchMap);<NEW_LINE>Map<String, Histogram> histogramMap = new HashMap<>();<NEW_LINE>JSONObject histogramMapJsonObject = cacheLineJson.getJSONObject("histogramMap");<NEW_LINE>for (String columnName : histogramMapJsonObject.keySet()) {<NEW_LINE>histogramMap.put(columnName, Histogram.deserializeFromJson(histogramMapJsonObject.getString(columnName)));<NEW_LINE>}<NEW_LINE>cacheLine.setHistogramMap(histogramMap);<NEW_LINE>Map<String, TopN> topNMap = new HashMap<>();<NEW_LINE>JSONObject topNMapJsonObject = cacheLineJson.getJSONObject("topNMap");<NEW_LINE>for (String columnName : topNMapJsonObject.keySet()) {<NEW_LINE>topNMap.put(columnName, TopN.deserializeFromJson(topNMapJsonObject.getString(columnName)));<NEW_LINE>}<NEW_LINE>cacheLine.setTopNMap(topNMap);<NEW_LINE>return cacheLine;<NEW_LINE>} | cardinalityMap = new HashMap<>(); |
408,552 | private HttpURLConnection connect0(final URI ipUri, final String method, final byte[] entity, final Map<String, List<String>> headers, final String endpointHost) throws IOException {<NEW_LINE>if (log.isTraceEnabled()) {<NEW_LINE>log.trace("req: {} {} {} {} {} {}", method, ipUri, headers.size(), Joiner.on(',').withKeyValueSeparator("=").join(headers), entity.length, Json.asPrettyStringUnchecked(entity));<NEW_LINE>} else {<NEW_LINE>log.debug("req: {} {} {} {}", method, ipUri, headers.size(), entity.length);<NEW_LINE>}<NEW_LINE>final HttpURLConnection connection = (HttpURLConnection) ipUri.toURL().openConnection();<NEW_LINE>handleHttps(connection, endpointHost, hostnameVerifierProvider, extraHttpsHandler);<NEW_LINE>connection.setRequestProperty("Accept-Encoding", "gzip");<NEW_LINE>connection.setInstanceFollowRedirects(false);<NEW_LINE>connection.setConnectTimeout(httpTimeoutMillis);<NEW_LINE>connection.setReadTimeout(httpTimeoutMillis);<NEW_LINE>for (final Map.Entry<String, List<String>> header : headers.entrySet()) {<NEW_LINE>for (final String value : header.getValue()) {<NEW_LINE>connection.addRequestProperty(header.getKey(), value);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (entity.length > 0) {<NEW_LINE>connection.setDoOutput(true);<NEW_LINE>connection.getOutputStream().write(entity);<NEW_LINE>}<NEW_LINE>setRequestMethod(<MASK><NEW_LINE>return connection;<NEW_LINE>} | connection, method, connection instanceof HttpsURLConnection); |
1,404,430 | public boolean readIfNull() {<NEW_LINE>if (ch == 'n' && bytes[offset] == 'u' && bytes[offset + 1] == 'l' && bytes[offset + 2] == 'l') {<NEW_LINE>if (offset + 3 == end) {<NEW_LINE>ch = EOI;<NEW_LINE>} else {<NEW_LINE>ch = (<MASK><NEW_LINE>}<NEW_LINE>offset += 4;<NEW_LINE>} else {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>while (ch <= ' ' && ((1L << ch) & SPACE) != 0) {<NEW_LINE>if (offset >= end) {<NEW_LINE>ch = EOI;<NEW_LINE>} else {<NEW_LINE>ch = (char) bytes[offset++];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (ch == ',') {<NEW_LINE>this.comma = true;<NEW_LINE>ch = offset == end ? EOI : (char) bytes[offset++];<NEW_LINE>while (ch <= ' ' && ((1L << ch) & SPACE) != 0) {<NEW_LINE>if (offset >= end) {<NEW_LINE>ch = EOI;<NEW_LINE>} else {<NEW_LINE>ch = (char) bytes[offset++];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | char) bytes[offset + 3]; |
1,517,746 | private static JsExpression simplifyOp(JsBinaryOperation expr) {<NEW_LINE>SourceInfo info = expr.getSourceInfo();<NEW_LINE>JsExpression arg1 = expr.getArg1();<NEW_LINE>JsExpression arg2 = expr.getArg2();<NEW_LINE>JsBinaryOperator op = expr.getOperator();<NEW_LINE>if (op == JsBinaryOperator.ADD && (arg1 instanceof JsStringLiteral || arg2 instanceof JsStringLiteral)) {<NEW_LINE>// cases: number + string or string + number<NEW_LINE>StringBuilder result = new StringBuilder();<NEW_LINE>if (appendLiteral(result, (JsValueLiteral) arg1) && appendLiteral(result, (JsValueLiteral) arg2)) {<NEW_LINE>return new JsStringLiteral(info, result.toString());<NEW_LINE>}<NEW_LINE>return expr;<NEW_LINE>}<NEW_LINE>if (arg1 instanceof JsNumberLiteral && arg2 instanceof JsNumberLiteral) {<NEW_LINE>double num1 = ((JsNumberLiteral) arg1).getValue();<NEW_LINE>double num2 = ((JsNumberLiteral) arg2).getValue();<NEW_LINE>Object result;<NEW_LINE>switch(op) {<NEW_LINE>case ADD:<NEW_LINE>result = Ieee754_64_Arithmetic.add(num1, num2);<NEW_LINE>break;<NEW_LINE>case SUB:<NEW_LINE>result = Ieee754_64_Arithmetic.subtract(num1, num2);<NEW_LINE>break;<NEW_LINE>case MUL:<NEW_LINE>result = Ieee754_64_Arithmetic.multiply(num1, num2);<NEW_LINE>break;<NEW_LINE>case DIV:<NEW_LINE>result = <MASK><NEW_LINE>break;<NEW_LINE>case MOD:<NEW_LINE>result = Ieee754_64_Arithmetic.mod(num1, num2);<NEW_LINE>break;<NEW_LINE>case LT:<NEW_LINE>result = Ieee754_64_Arithmetic.lt(num1, num2);<NEW_LINE>break;<NEW_LINE>case LTE:<NEW_LINE>result = Ieee754_64_Arithmetic.le(num1, num2);<NEW_LINE>break;<NEW_LINE>case GT:<NEW_LINE>result = Ieee754_64_Arithmetic.gt(num1, num2);<NEW_LINE>break;<NEW_LINE>case GTE:<NEW_LINE>result = Ieee754_64_Arithmetic.ge(num1, num2);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new InternalCompilerException("Can't handle simplify of op " + op);<NEW_LINE>}<NEW_LINE>return result instanceof Double ? new JsNumberLiteral(info, ((Double) result).doubleValue()) : JsBooleanLiteral.get(((Boolean) result).booleanValue());<NEW_LINE>}<NEW_LINE>return expr;<NEW_LINE>} | Ieee754_64_Arithmetic.divide(num1, num2); |
1,015,582 | DbInfo.Builder doParse(String jdbcUrl, DbInfo.Builder builder) {<NEW_LINE>DbInfo dbInfo = builder.build();<NEW_LINE>if (dbInfo.getHost() == null) {<NEW_LINE>builder.host(DEFAULT_HOST);<NEW_LINE>}<NEW_LINE>if (dbInfo.getPort() == null) {<NEW_LINE>builder.port(DEFAULT_PORT);<NEW_LINE>}<NEW_LINE>int protoLoc = jdbcUrl.indexOf("://");<NEW_LINE>int typeEndLoc = jdbcUrl.indexOf(':');<NEW_LINE>if (typeEndLoc < protoLoc) {<NEW_LINE>return MARIA_SUBPROTO.doParse(jdbcUrl.substring(protoLoc + 3), builder).subtype(jdbcUrl.substring(typeEndLoc + 1, protoLoc));<NEW_LINE>}<NEW_LINE>if (protoLoc > 0) {<NEW_LINE>return GENERIC_URL_LIKE.doParse(jdbcUrl, builder);<NEW_LINE>}<NEW_LINE>int hostEndLoc;<NEW_LINE>int portLoc = jdbcUrl.indexOf(":", typeEndLoc + 1);<NEW_LINE>int dbLoc = jdbcUrl.indexOf("/", typeEndLoc);<NEW_LINE>int paramLoc = jdbcUrl.indexOf("?", dbLoc);<NEW_LINE>if (paramLoc > 0) {<NEW_LINE>populateStandardProperties(builder, splitQuery(jdbcUrl.substring(paramLoc + 1), "&"));<NEW_LINE>builder.db(jdbcUrl.substring(dbLoc + 1, paramLoc));<NEW_LINE>} else {<NEW_LINE>builder.db(jdbcUrl<MASK><NEW_LINE>}<NEW_LINE>if (portLoc > 0) {<NEW_LINE>hostEndLoc = portLoc;<NEW_LINE>try {<NEW_LINE>builder.port(Integer.parseInt(jdbcUrl.substring(portLoc + 1, dbLoc)));<NEW_LINE>} catch (NumberFormatException e) {<NEW_LINE>logger.log(FINE, e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>hostEndLoc = dbLoc;<NEW_LINE>}<NEW_LINE>builder.host(jdbcUrl.substring(typeEndLoc + 1, hostEndLoc));<NEW_LINE>return builder;<NEW_LINE>} | .substring(dbLoc + 1)); |
1,227,555 | protected void recordNullReference(LocalVariableBinding local, ASTNode expression, int checkType, FlowInfo nullInfo) {<NEW_LINE>if (this.nullCount == 0) {<NEW_LINE>this<MASK><NEW_LINE>this.nullReferences = new ASTNode[5];<NEW_LINE>this.nullCheckTypes = new int[5];<NEW_LINE>this.nullInfos = new UnconditionalFlowInfo[5];<NEW_LINE>} else if (this.nullCount == this.nullLocals.length) {<NEW_LINE>System.arraycopy(this.nullLocals, 0, this.nullLocals = new LocalVariableBinding[this.nullCount * 2], 0, this.nullCount);<NEW_LINE>System.arraycopy(this.nullReferences, 0, this.nullReferences = new ASTNode[this.nullCount * 2], 0, this.nullCount);<NEW_LINE>System.arraycopy(this.nullCheckTypes, 0, this.nullCheckTypes = new int[this.nullCount * 2], 0, this.nullCount);<NEW_LINE>System.arraycopy(this.nullInfos, 0, this.nullInfos = new UnconditionalFlowInfo[this.nullCount * 2], 0, this.nullCount);<NEW_LINE>}<NEW_LINE>this.nullLocals[this.nullCount] = local;<NEW_LINE>this.nullReferences[this.nullCount] = expression;<NEW_LINE>this.nullCheckTypes[this.nullCount] = checkType;<NEW_LINE>this.nullInfos[this.nullCount++] = nullInfo != null ? nullInfo.unconditionalCopy() : null;<NEW_LINE>} | .nullLocals = new LocalVariableBinding[5]; |
69,615 | public static void main(String[] args) {<NEW_LINE>final File in;<NEW_LINE>final File out;<NEW_LINE>if (args.length == 0) {<NEW_LINE><MASK><NEW_LINE>System.err.println("Download the research concepts, developer concepts, and architectural concepts view of the CWE from " + "https://cwe.mitre.org/data/downloads.html");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>in = new File(args[0]);<NEW_LINE>if (!in.isFile()) {<NEW_LINE>System.err.println(String.format("%s does not exist", in.getAbsolutePath()));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>out = new File("cwe.hashmap.serialized");<NEW_LINE>final HashMap<String, String> cwe = readCweData(args);<NEW_LINE>if (cwe != null) {<NEW_LINE>serializeCweData(cwe, out);<NEW_LINE>}<NEW_LINE>} | System.err.println("Incorrect arguments - please provide one or more files as input"); |
369,036 | private MethodLinkMetaData findMethod(String method) {<NEW_LINE>if (method.endsWith("...)")) {<NEW_LINE>// Should reuse the link parsing stuff from JavadocLinkConverter instead<NEW_LINE>method = method.substring(0, method.length() - 4) + "[])";<NEW_LINE>}<NEW_LINE>MethodLinkMetaData <MASK><NEW_LINE>if (metaData != null) {<NEW_LINE>return metaData;<NEW_LINE>}<NEW_LINE>List<MethodLinkMetaData> candidates = new ArrayList<MethodLinkMetaData>();<NEW_LINE>for (MethodLinkMetaData methodLinkMetaData : methods.values()) {<NEW_LINE>if (methodLinkMetaData.name.equals(method)) {<NEW_LINE>candidates.add(methodLinkMetaData);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (candidates.isEmpty()) {<NEW_LINE>String message = String.format("No method '%s' found for class '%s'.\nFound the following methods:", method, className);<NEW_LINE>for (MethodLinkMetaData methodLinkMetaData : methods.values()) {<NEW_LINE>message += "\n " + methodLinkMetaData;<NEW_LINE>}<NEW_LINE>message += "\nThis problem may happen when some apilink from docbook template xmls refers to unknown method." + "\nExample: <apilink class=\"org.gradle.api.Project\" method=\"someMethodThatDoesNotExist\"/>";<NEW_LINE>throw new RuntimeException(message);<NEW_LINE>}<NEW_LINE>if (candidates.size() != 1) {<NEW_LINE>String message = String.format("Found multiple methods called '%s' in class '%s'. Candidates: %s", method, className, CollectionUtils.join(", ", candidates));<NEW_LINE>message += "\nThis problem may happen when some apilink from docbook template xmls is incorrect. Example:" + "\nIncorrect: <apilink class=\"org.gradle.api.Project\" method=\"tarTree\"/>" + "\nCorrect: <apilink class=\"org.gradle.api.Project\" method=\"tarTree(Object)\"/>";<NEW_LINE>throw new RuntimeException(message);<NEW_LINE>}<NEW_LINE>return candidates.get(0);<NEW_LINE>} | metaData = methods.get(method); |
720,103 | final ListReportDefinitionsResult executeListReportDefinitions(ListReportDefinitionsRequest listReportDefinitionsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listReportDefinitionsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListReportDefinitionsRequest> request = null;<NEW_LINE>Response<ListReportDefinitionsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListReportDefinitionsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listReportDefinitionsRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ApplicationCostProfiler");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListReportDefinitions");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListReportDefinitionsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListReportDefinitionsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); |
337,674 | protected void onPing(RTMPConnection conn, Channel channel, Header source, Ping ping) {<NEW_LINE>switch(ping.getEventType()) {<NEW_LINE>case Ping.CLIENT_BUFFER:<NEW_LINE>SetBuffer setBuffer = (SetBuffer) ping;<NEW_LINE>// get the stream id<NEW_LINE>int streamId = setBuffer.getStreamId();<NEW_LINE>// get requested buffer size in milliseconds<NEW_LINE>int buffer = setBuffer.getBufferLength();<NEW_LINE>log.debug("Client sent a buffer size: {} ms for stream id: {}", buffer, streamId);<NEW_LINE>IClientStream stream = null;<NEW_LINE>if (streamId != 0) {<NEW_LINE>// The client wants to set the buffer time<NEW_LINE><MASK><NEW_LINE>if (stream != null) {<NEW_LINE>stream.setClientBufferDuration(buffer);<NEW_LINE>log.trace("Stream type: {}", stream.getClass().getName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// catch-all to make sure buffer size is set<NEW_LINE>if (stream == null) {<NEW_LINE>// Remember buffer time until stream is created<NEW_LINE>conn.rememberStreamBufferDuration(streamId, buffer);<NEW_LINE>log.debug("Remembering client buffer on stream: {}", buffer);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case Ping.PONG_SERVER:<NEW_LINE>// This is the response to an IConnection.ping request<NEW_LINE>conn.pingReceived(ping);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>log.warn("Unhandled ping: {}", ping);<NEW_LINE>}<NEW_LINE>} | stream = conn.getStreamById(streamId); |
189,124 | public static ImmutableMap<Path, SourcePath> parseHeaders(BuildTarget buildTarget, ActionGraphBuilder graphBuilder, ProjectFilesystem projectFilesystem, Optional<CxxPlatform> cxxPlatform, CxxConstructorArg args) {<NEW_LINE>ImmutableMap.Builder<String, SourcePath<MASK><NEW_LINE>// Add platform-agnostic headers.<NEW_LINE>headers.putAll(parseOnlyHeaders(buildTarget, graphBuilder, "headers", args.getHeaders()));<NEW_LINE>// Add platform-specific headers.<NEW_LINE>cxxPlatform.ifPresent(cxxPlatformValue -> headers.putAll(parseOnlyPlatformHeaders(buildTarget, graphBuilder, cxxPlatformValue, "headers", args.getHeaders(), "platform_headers", args.getPlatformHeaders())));<NEW_LINE>return CxxPreprocessables.resolveHeaderMap(args.getHeaderNamespace().map(Paths::get).orElse(buildTarget.getCellRelativeBasePath().getPath().toPath(projectFilesystem.getFileSystem())), headers.build());<NEW_LINE>} | > headers = ImmutableMap.builder(); |
782,270 | public void added(RuleTemplate element) {<NEW_LINE>String templateUID = element.getUID();<NEW_LINE>Set<String> rules = new HashSet<>();<NEW_LINE>synchronized (this) {<NEW_LINE>Set<String> rulesForResolving = mapTemplateToRules.get(templateUID);<NEW_LINE>if (rulesForResolving != null) {<NEW_LINE>rules.addAll(rulesForResolving);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (String rUID : rules) {<NEW_LINE>try {<NEW_LINE>Rule unresolvedRule = get(rUID);<NEW_LINE>if (unresolvedRule != null) {<NEW_LINE>Rule resolvedRule = resolveRuleByTemplate(unresolvedRule);<NEW_LINE>Provider<Rule> provider = getProvider(rUID);<NEW_LINE>if (provider instanceof ManagedRuleProvider) {<NEW_LINE>update(resolvedRule);<NEW_LINE>} else if (provider != null) {<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>logger.error("Resolving the rule '{}' by template '{}' failed because the provider is not known", rUID, templateUID);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>logger.error("Resolving the rule '{}' by template '{}' failed because it is not known to the registry", rUID, templateUID);<NEW_LINE>}<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>logger.error("Resolving the rule '{}' by template '{}' failed", rUID, templateUID, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | updated(provider, unresolvedRule, unresolvedRule); |
1,469,861 | private InputStream decompressResourceFork(FSEntry entry, ReadableRandomAccessStream resourceForkStream, int expectedLength) throws IOException {<NEW_LINE>File tempFile = GFileUtilityMethods.writeTemporaryFile(new DmgInputStream(resourceForkStream));<NEW_LINE>System.err.println("dmg resource fork for " + entry.getName() + ": " + tempFile.getAbsolutePath());<NEW_LINE><MASK><NEW_LINE>for (int i = 0; i < 0x100; ++i) {<NEW_LINE>input.read();<NEW_LINE>}<NEW_LINE>byte[] sizeBytes = new byte[4];<NEW_LINE>input.read(sizeBytes);<NEW_LINE>int size = sizeBytes[0] == 0 ? bedc.getInt(sizeBytes) : ledc.getInt(sizeBytes);<NEW_LINE>byte[] flagsBytes = new byte[4];<NEW_LINE>input.read(flagsBytes);<NEW_LINE>byte[] startDistanceBytes = new byte[4];<NEW_LINE>input.read(startDistanceBytes);<NEW_LINE>int startDistance = ledc.getInt(startDistanceBytes);<NEW_LINE>// skip to the start of the zlib compressed file<NEW_LINE>input.skip(startDistance - 8);<NEW_LINE>File tempCompressedFile = GFileUtilityMethods.writeTemporaryFile(input, size - startDistance);<NEW_LINE>InputStream inputStream = new FileInputStream(tempCompressedFile);<NEW_LINE>ZLIB zlib = new ZLIB();<NEW_LINE>ByteArrayOutputStream uncompressedByteStream = zlib.decompress(inputStream, expectedLength);<NEW_LINE>return new ByteArrayInputStream(uncompressedByteStream.toByteArray());<NEW_LINE>} | InputStream input = new FileInputStream(tempFile); |
51,711 | private Map<String, Object> createResponsesObject(final StructrSchemaDefinition schema, final String tag) {<NEW_LINE>final Map<String, Object> responses = new LinkedHashMap<>();<NEW_LINE>// 200 OK<NEW_LINE>responses.put("ok", new OpenAPIRequestResponse("The request was executed successfully.", new OpenAPISchemaReference("ok"), new OpenAPIExampleAnyResult(List.of(), false)));<NEW_LINE>// 201 Created<NEW_LINE>responses.put("created", new OpenAPIRequestResponse("Created", new OpenAPISchemaReference("#/components/schemas/CreateResponse"), new OpenAPIExampleAnyResult(Arrays.asList(NodeServiceCommand.getNextUuid()), true)));<NEW_LINE>// 400 Bad Request<NEW_LINE>responses.put("badRequest", new OpenAPIRequestResponse("The request was not valid and should not be repeated without modifications.", new OpenAPISchemaReference("#/components/schemas/RESTResponse"), Map.of("code", "400", "message", "Please specify sync file", "errors", List.of())));<NEW_LINE>// 401 Unauthorized<NEW_LINE>responses.put("unauthorized", new OpenAPIRequestResponse("Access denied or wrong password.\n\nIf the error message is \"Access denied\", you need to configure a resource access grant for this endpoint." + " otherwise the error message is \"Wrong username or password, or user is blocked. Check caps lock. Note: Username is case sensitive!\".", new OpenAPISchemaReference("#/components/schemas/RESTResponse"), Map.of("code", "401", "message", "Access denied", "errors", List.of())));<NEW_LINE>responses.put("loginError", new OpenAPIRequestResponse("Wrong username or password, or user is blocked.", new OpenAPISchemaReference("#/components/schemas/RESTResponse"), Map.of("code", "401", "message", "Wrong username or password, or user is blocked. Check caps lock. Note: Username is case sensitive!")));<NEW_LINE>responses.put("loginResponse", new OpenAPIRequestResponse("Login successful.", new OpenAPISchemaReference("LoginResponse")));<NEW_LINE>responses.put("tokenError", new OpenAPIRequestResponse("The given access token or refresh token is invalid.", new OpenAPISchemaReference("#/components/schemas/RESTResponse"), Map.of("code", "401", "message", "The given access_token or refresh_token is invalid!")));<NEW_LINE>responses.put("tokenResponse", new OpenAPIRequestResponse("The request was executed successfully.", new OpenAPISchemaReference("TokenResponse")));<NEW_LINE>// 403 Forbidden<NEW_LINE>responses.put("forbidden", new OpenAPIRequestResponse("The request was denied due to insufficient access rights to the object.", new OpenAPISchemaReference("#/components/schemas/RESTResponse"), Map.of("code", "403", "message", "Forbidden", "errors", List.of())));<NEW_LINE>// 404 Not Found<NEW_LINE>responses.put("notFound", new OpenAPIRequestResponse("The desired object was not found.", new OpenAPISchemaReference("#/components/schemas/RESTResponse"), Map.of("code", "404", "message", "Not Found", "errors", List.of())));<NEW_LINE>// 422 Unprocessable Entity<NEW_LINE>responses.put("validationError", new OpenAPIRequestResponse("The request entity was not valid, or validation failed.", new OpenAPISchemaReference("#/components/schemas/RESTResponse"), Map.of("code", "422", "message", "Unable to commit transaction, validation failed", "errors", List.of(Map.of("type", "ExampleType", "property", "name", "token", "must_not_be_empty"), Map.of("type", "ExampleType", "property", "name", "token", "must_match", "detail", "[^\\\\/\\\\x00]+")))));<NEW_LINE>final <MASK><NEW_LINE>responses.putAll(definitions.serializeOpenAPIResponses(responses, tag));<NEW_LINE>return responses;<NEW_LINE>} | StructrTypeDefinitions definitions = schema.getTypeDefinitionsObject(); |
215,016 | public NameEnvironmentAnswer findClass(String binaryFileName, String qualifiedPackageName, String moduleName, String qualifiedBinaryFileName, boolean asBinaryOnly, Predicate<String> moduleNameFilter) {<NEW_LINE>// most common case<NEW_LINE>if (!isPackage(qualifiedPackageName, moduleName))<NEW_LINE>return null;<NEW_LINE>if (moduleNameFilter != null && this.module != null && !moduleNameFilter.test(String.valueOf(this.module.name())))<NEW_LINE>return null;<NEW_LINE>try {<NEW_LINE>qualifiedBinaryFileName = new String(CharOperation.append(CLASSES_FOLDER, qualifiedBinaryFileName.toCharArray()));<NEW_LINE>IBinaryType reader = ClassFileReader.read(this.zipFile, qualifiedBinaryFileName);<NEW_LINE>if (reader != null) {<NEW_LINE>char[] modName = this.module == null ? null : this.module.name();<NEW_LINE>if (reader instanceof ClassFileReader) {<NEW_LINE>ClassFileReader classReader = (ClassFileReader) reader;<NEW_LINE>if (classReader.moduleName == null)<NEW_LINE>classReader.moduleName = modName;<NEW_LINE>else<NEW_LINE>modName = classReader.moduleName;<NEW_LINE>}<NEW_LINE>String fileNameWithoutExtension = qualifiedBinaryFileName.substring(0, qualifiedBinaryFileName.length(<MASK><NEW_LINE>return createAnswer(fileNameWithoutExtension, reader, modName);<NEW_LINE>}<NEW_LINE>} catch (IOException | ClassFormatException e) {<NEW_LINE>// treat as if class file is missing<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | ) - SuffixConstants.SUFFIX_CLASS.length); |
52,954 | public BufferedImage filter(BufferedImage src, BufferedImage dst) {<NEW_LINE>int width = src.getWidth();<NEW_LINE>int height = src.getHeight();<NEW_LINE>if (dst == null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>int[] inPixels = new int[width * height];<NEW_LINE>int[] outPixels = new int[width * height];<NEW_LINE>getRGB(src, 0, 0, width, height, inPixels);<NEW_LINE>if (premultiplyAlpha) {<NEW_LINE>premultiply(inPixels, 0, inPixels.length);<NEW_LINE>}<NEW_LINE>for (int i = 0; i < iterations; i++) {<NEW_LINE>blur(inPixels, outPixels, width, height, hRadius);<NEW_LINE>blur(outPixels, inPixels, height, width, vRadius);<NEW_LINE>}<NEW_LINE>blurFractional(inPixels, outPixels, width, height, hRadius);<NEW_LINE>blurFractional(outPixels, inPixels, height, width, vRadius);<NEW_LINE>if (premultiplyAlpha) {<NEW_LINE>unpremultiply(inPixels, 0, inPixels.length);<NEW_LINE>}<NEW_LINE>setRGB(dst, 0, 0, width, height, inPixels);<NEW_LINE>return dst;<NEW_LINE>} | dst = createCompatibleDestImage(src, null); |
667,432 | public Bitmap blur(Bitmap original, float radius) {<NEW_LINE>Bitmap bitmapOut = original.copy(Bitmap.Config.ARGB_8888, true);<NEW_LINE>int cores = StackBlurManager.EXECUTOR_THREADS;<NEW_LINE>ArrayList<NativeTask> horizontal = new ArrayList<NativeTask>(cores);<NEW_LINE>ArrayList<NativeTask> vertical = <MASK><NEW_LINE>for (int i = 0; i < cores; i++) {<NEW_LINE>horizontal.add(new NativeTask(bitmapOut, (int) radius, cores, i, 1));<NEW_LINE>vertical.add(new NativeTask(bitmapOut, (int) radius, cores, i, 2));<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>StackBlurManager.EXECUTOR.invokeAll(horizontal);<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>return bitmapOut;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>StackBlurManager.EXECUTOR.invokeAll(vertical);<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>return bitmapOut;<NEW_LINE>}<NEW_LINE>return bitmapOut;<NEW_LINE>} | new ArrayList<NativeTask>(cores); |
162,898 | public static ExecutableDdlJob create(@Deprecated DDL ddl, MoveDatabasePreparedData preparedData, ExecutionContext executionContext) {<NEW_LINE>MoveDatabaseBuilder moveDatabaseBuilder = new MoveDatabaseBuilder(ddl, preparedData, executionContext);<NEW_LINE>Map<String, Map<String, List<List<String>>>> tablesTopologyMap = moveDatabaseBuilder.build().getTablesTopologyMap();<NEW_LINE>Map<String, Map<String, Set<String>>> targetTablesTopology = moveDatabaseBuilder.getTargetTablesTopology();<NEW_LINE>Map<String, Map<String, Set<String>>> sourceTablesTopology = moveDatabaseBuilder.getSourceTablesTopology();<NEW_LINE>Map<String, MoveDatabaseItemPreparedData<MASK><NEW_LINE>Map<String, List<PhyDdlTableOperation>> logicalTablesPhysicalPlansMap = moveDatabaseBuilder.getLogicalTablesPhysicalPlansMap();<NEW_LINE>return new MoveDatabaseJobFactory(ddl, preparedData, moveDatabaseItemPreparedDataMap, logicalTablesPhysicalPlansMap, tablesTopologyMap, targetTablesTopology, sourceTablesTopology, ComplexTaskMetaManager.ComplexTaskType.MOVE_DATABASE, executionContext).create();<NEW_LINE>} | > moveDatabaseItemPreparedDataMap = moveDatabaseBuilder.getTablesPreparedData(); |
78,870 | private Map<String, Map<String, Map<String, String>>> generatePartitionOverrideFromConfigFile(String adminConfigFilePath) throws IOException {<NEW_LINE>Map<String, Map<String, String>> partitionOverrideInfos = new HashMap<>();<NEW_LINE>long maxPartitionId = staticClusterMap.getAllPartitionIds(null).stream().map(p -> Long.parseLong(p.toPathString())).max(Comparator.comparing(Long::valueOf)).get();<NEW_LINE>String partitionStr = readStringFromFile(adminConfigFilePath);<NEW_LINE>for (String partitionName : partitionStr.split(",")) {<NEW_LINE>partitionName = partitionName.trim();<NEW_LINE>if (partitionName.isEmpty()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// if it is not numeric, it should throw exception when parsing long.<NEW_LINE>long id = Long.parseLong(partitionName);<NEW_LINE>if (id < 0 || id > maxPartitionId) {<NEW_LINE>throw new IllegalArgumentException("Partition id is not in valid range: 0 - " + maxPartitionId);<NEW_LINE>}<NEW_LINE>Map<String, String> partitionProperties = new HashMap<>();<NEW_LINE><MASK><NEW_LINE>partitionOverrideInfos.put(partitionName, partitionProperties);<NEW_LINE>}<NEW_LINE>Map<String, Map<String, Map<String, String>>> partitionOverrideByDc = new HashMap<>();<NEW_LINE>for (String dc : dataCenterToZkAddress.keySet()) {<NEW_LINE>partitionOverrideByDc.put(dc, partitionOverrideInfos);<NEW_LINE>}<NEW_LINE>return partitionOverrideByDc;<NEW_LINE>} | partitionProperties.put(PARTITION_STATE, READ_ONLY_STR); |
1,450,460 | public void transformPage(final View view, final float position) {<NEW_LINE>if (position < -1 || position > 1) {<NEW_LINE>view.setAlpha(0f);<NEW_LINE>} else {<NEW_LINE>final float scaleFactor = Math.max(MIN_SCALE, 1 - Math.abs(position));<NEW_LINE>final float verticalMargin = view.getHeight() * (1 - scaleFactor) / 2;<NEW_LINE>final float horizontalMargin = view.getWidth() * (1 - scaleFactor) / 2;<NEW_LINE>if (position < 0)<NEW_LINE>view.setTranslationX(horizontalMargin - verticalMargin / 2);<NEW_LINE>else<NEW_LINE>view.setTranslationX(-horizontalMargin + verticalMargin / 2);<NEW_LINE>view.setScaleX(scaleFactor);<NEW_LINE>view.setScaleY(scaleFactor);<NEW_LINE>view.setAlpha(MIN_ALPHA + (scaleFactor - MIN_SCALE) / (1 - MIN_SCALE<MASK><NEW_LINE>}<NEW_LINE>} | ) * (1 - MIN_ALPHA)); |
933,252 | public static QueryTaskDetailListResponse unmarshall(QueryTaskDetailListResponse queryTaskDetailListResponse, UnmarshallerContext context) {<NEW_LINE>queryTaskDetailListResponse.setRequestId(context.stringValue("QueryTaskDetailListResponse.RequestId"));<NEW_LINE>queryTaskDetailListResponse.setTotalItemNum(context.integerValue("QueryTaskDetailListResponse.TotalItemNum"));<NEW_LINE>queryTaskDetailListResponse.setCurrentPageNum(context.integerValue("QueryTaskDetailListResponse.CurrentPageNum"));<NEW_LINE>queryTaskDetailListResponse.setTotalPageNum<MASK><NEW_LINE>queryTaskDetailListResponse.setPageSize(context.integerValue("QueryTaskDetailListResponse.PageSize"));<NEW_LINE>queryTaskDetailListResponse.setPrePage(context.booleanValue("QueryTaskDetailListResponse.PrePage"));<NEW_LINE>queryTaskDetailListResponse.setNextPage(context.booleanValue("QueryTaskDetailListResponse.NextPage"));<NEW_LINE>List<TaskDetail> data = new ArrayList<TaskDetail>();<NEW_LINE>for (int i = 0; i < context.lengthValue("QueryTaskDetailListResponse.Data.Length"); i++) {<NEW_LINE>TaskDetail taskDetail = new TaskDetail();<NEW_LINE>taskDetail.setTaskNo(context.stringValue("QueryTaskDetailListResponse.Data[" + i + "].TaskNo"));<NEW_LINE>taskDetail.setTaskDetailNo(context.stringValue("QueryTaskDetailListResponse.Data[" + i + "].TaskDetailNo"));<NEW_LINE>taskDetail.setTaskType(context.stringValue("QueryTaskDetailListResponse.Data[" + i + "].TaskType"));<NEW_LINE>taskDetail.setInstanceId(context.stringValue("QueryTaskDetailListResponse.Data[" + i + "].InstanceId"));<NEW_LINE>taskDetail.setDomainName(context.stringValue("QueryTaskDetailListResponse.Data[" + i + "].DomainName"));<NEW_LINE>taskDetail.setTaskStatus(context.stringValue("QueryTaskDetailListResponse.Data[" + i + "].TaskStatus"));<NEW_LINE>taskDetail.setUpdateTime(context.stringValue("QueryTaskDetailListResponse.Data[" + i + "].UpdateTime"));<NEW_LINE>taskDetail.setCreateTime(context.stringValue("QueryTaskDetailListResponse.Data[" + i + "].CreateTime"));<NEW_LINE>taskDetail.setTryCount(context.integerValue("QueryTaskDetailListResponse.Data[" + i + "].TryCount"));<NEW_LINE>taskDetail.setErrorMsg(context.stringValue("QueryTaskDetailListResponse.Data[" + i + "].ErrorMsg"));<NEW_LINE>taskDetail.setTaskStatusCode(context.integerValue("QueryTaskDetailListResponse.Data[" + i + "].TaskStatusCode"));<NEW_LINE>taskDetail.setTaskResult(context.stringValue("QueryTaskDetailListResponse.Data[" + i + "].TaskResult"));<NEW_LINE>taskDetail.setTaskTypeDescription(context.stringValue("QueryTaskDetailListResponse.Data[" + i + "].TaskTypeDescription"));<NEW_LINE>data.add(taskDetail);<NEW_LINE>}<NEW_LINE>queryTaskDetailListResponse.setData(data);<NEW_LINE>return queryTaskDetailListResponse;<NEW_LINE>} | (context.integerValue("QueryTaskDetailListResponse.TotalPageNum")); |
1,305,154 | private // Called by storeNumeric()<NEW_LINE>void storeRealNumber(Token token, Directives directive, ErrorList errors) {<NEW_LINE>int lengthInBytes = DataTypes.getLengthInBytes(directive);<NEW_LINE>double value;<NEW_LINE>if (token.getValue().equals("Inf")) {<NEW_LINE>value = Float.POSITIVE_INFINITY;<NEW_LINE>} else if (token.getValue().equals("-Inf")) {<NEW_LINE>value = Float.NEGATIVE_INFINITY;<NEW_LINE>} else if (TokenTypes.isIntegerTokenType(token.getType()) || TokenTypes.isFloatingTokenType(token.getType())) {<NEW_LINE>try {<NEW_LINE>value = Double.parseDouble(token.getValue());<NEW_LINE>} catch (NumberFormatException nfe) {<NEW_LINE>errors.add(new ErrorMessage(token.getSourceProgram(), token.getSourceLine(), token.getStartPos(), "\"" + token.getValue() + "\" is not a valid floating point constant"));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (DataTypes.outOfRange(directive, value)) {<NEW_LINE>errors.add(new ErrorMessage(token.getSourceProgram(), token.getSourceLine(), token.getStartPos(), "\"" + token.getValue() + "\" is an out-of-range value"));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>errors.add(new ErrorMessage(token.getSourceProgram(), token.getSourceLine(), token.getStartPos(), "\"" + token<MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Value has been validated; let's store it.<NEW_LINE>if (directive == Directives.FLOAT) {<NEW_LINE>writeToDataSegment(Float.floatToIntBits((float) value), lengthInBytes, token, errors);<NEW_LINE>}<NEW_LINE>if (directive == Directives.DOUBLE) {<NEW_LINE>writeDoubleToDataSegment(value, token, errors);<NEW_LINE>}<NEW_LINE>} | .getValue() + "\" is not a valid floating point constant")); |
98,915 | private static byte[][] prepareAdapterSequences(final List<String> adapterSequence) {<NEW_LINE>final Set<String> kmers = new HashSet<>();<NEW_LINE>// Make a set of all kmers of adapterMatchLength<NEW_LINE>for (final String seq : adapterSequence) {<NEW_LINE>for (int i = 0; i <= seq.length() - ADAPTER_MATCH_LENGTH; ++i) {<NEW_LINE>final String kmer = seq.substring(i, i + ADAPTER_MATCH_LENGTH).toUpperCase();<NEW_LINE>int ns = 0;<NEW_LINE>for (final char ch : kmer.toCharArray()) if (ch == 'N')<NEW_LINE>++ns;<NEW_LINE>if (ns <= MAX_ADAPTER_ERRORS) {<NEW_LINE>kmers.add(kmer);<NEW_LINE>kmers.add<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Make an array of byte[] for the kmers<NEW_LINE>final byte[][] adapterKmers = new byte[kmers.size()][];<NEW_LINE>int i = 0;<NEW_LINE>for (final String kmer : kmers) {<NEW_LINE>adapterKmers[i++] = StringUtil.stringToBytes(kmer);<NEW_LINE>}<NEW_LINE>return adapterKmers;<NEW_LINE>} | (SequenceUtil.reverseComplement(kmer)); |
1,765,977 | public Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(String resourceGroupName, String serverName) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>if (serverName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String apiVersion = "2019-06-01-preview";<NEW_LINE>return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), resourceGroupName, serverName, this.client.getSubscriptionId(), apiVersion, context)).subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));<NEW_LINE>} | error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); |
1,056,679 | public ListEnvironmentRevisionsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ListEnvironmentRevisionsResult listEnvironmentRevisionsResult = new ListEnvironmentRevisionsResult();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return listEnvironmentRevisionsResult;<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("revisionIds", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listEnvironmentRevisionsResult.setRevisionIds(new ListUnmarshaller<String>(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 listEnvironmentRevisionsResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
113,525 | private void addAllEntriesForKeyInSegment(List<IndexEntry> entries, IndexSegment indexSegment, IndexEntry entry) throws StoreException {<NEW_LINE>logger.trace("Fetching related entries of a blob with entry {} in index segment with start offset {} in {} " + "because they need to be retained", entry, <MASK><NEW_LINE>NavigableSet<IndexValue> values = indexSegment.find(entry.getKey());<NEW_LINE>if (values.size() > 1) {<NEW_LINE>// we are using a multivalued index segment. Any related values will be in this set<NEW_LINE>values.forEach(valueFromSeg -> entries.add(new IndexEntry(entry.getKey(), valueFromSeg)));<NEW_LINE>} else {<NEW_LINE>// in a non multi valued segment, there can only be PUTs and DELETEs in the same segment<NEW_LINE>entries.add(entry);<NEW_LINE>if (entry.getValue().isFlagSet(IndexValue.Flags.Delete_Index)) {<NEW_LINE>IndexValue putValue = getPutValueFromDeleteEntry(entry.getKey(), entry.getValue(), indexSegment);<NEW_LINE>if (putValue != null) {<NEW_LINE>entries.add(new IndexEntry(entry.getKey(), putValue));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | indexSegment.getStartOffset(), storeId); |
1,067,847 | public Relationships unmarshal(java.io.InputStream is) throws JAXBException {<NEW_LINE>try {<NEW_LINE>XMLInputFactory xif = XMLInputFactory.newInstance();<NEW_LINE>xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);<NEW_LINE>// a DTD is merely ignored, its presence doesn't cause an exception<NEW_LINE>xif.setProperty(XMLInputFactory.SUPPORT_DTD, false);<NEW_LINE>XMLStreamReader xsr = xif.createXMLStreamReader(is);<NEW_LINE>Unmarshaller u = jc.createUnmarshaller();<NEW_LINE>u.setEventHandler(new org.docx4j.jaxb.JaxbValidationEventHandler());<NEW_LINE>log.debug("unmarshalling " + this.getClass().getName());<NEW_LINE>jaxbElement = (<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>resetIdAllocator();<NEW_LINE>// @since 8.1.0, so we can get from a Rel to source part.<NEW_LINE>if (this instanceof RelationshipsPart) {<NEW_LINE>((Relationships) jaxbElement).setParent(this);<NEW_LINE>}<NEW_LINE>return jaxbElement;<NEW_LINE>} | Relationships) u.unmarshal(xsr); |
1,580,278 | public AuthenticationResult authenticate(HttpServletRequest req, HttpServletResponse res, HashMap props) {<NEW_LINE>AuthenticationResult authResult = null;<NEW_LINE>X509Certificate[] certChain = (X509Certificate[]) req.getAttribute(PEER_CERTIFICATES);<NEW_LINE>if (certChain == null || certChain.length == 0) {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "The CLIENT-CERT authentication failed because no client certificate was found.");<NEW_LINE>}<NEW_LINE>authResult = new <MASK><NEW_LINE>authResult.setAuditCredType(AuditEvent.CRED_TYPE_CERTIFICATE);<NEW_LINE>authResult.setAuditCredValue("UNAUTHORIZED");<NEW_LINE>authResult.setAuditOutcome(AuditEvent.OUTCOME_FAILURE);<NEW_LINE>return authResult;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>String thisAuthMech = JaasLoginConfigConstants.SYSTEM_WEB_INBOUND;<NEW_LINE>AuthenticationData authenticationData = new WSAuthenticationData();<NEW_LINE>authenticationData.set(AuthenticationData.HTTP_SERVLET_REQUEST, req);<NEW_LINE>authenticationData.set(AuthenticationData.HTTP_SERVLET_RESPONSE, res);<NEW_LINE>authenticationData.set(AuthenticationData.CERTCHAIN, certChain);<NEW_LINE>Subject authenticatedSubject = authenticationService.authenticate(thisAuthMech, authenticationData, null);<NEW_LINE>String certDN = certChain[0].getSubjectX500Principal().getName();<NEW_LINE>authResult = new AuthenticationResult(AuthResult.SUCCESS, authenticatedSubject, AuditEvent.CRED_TYPE_CERTIFICATE, certDN, AuditEvent.OUTCOME_SUCCESS);<NEW_LINE>} catch (AuthenticationException e) {<NEW_LINE>String certDN = certChain[0].getSubjectX500Principal().getName();<NEW_LINE>authResult = new AuthenticationResult(AuthResult.FAILURE, e.getMessage(), AuditEvent.CRED_TYPE_CERTIFICATE, certDN, AuditEvent.OUTCOME_DENIED);<NEW_LINE>}<NEW_LINE>authResult.certdn = certChain[0].getSubjectX500Principal().getName();<NEW_LINE>if (authResult.getStatus() == AuthResult.SUCCESS) {<NEW_LINE>ssoCookieHelper.addSSOCookiesToResponse(authResult.getSubject(), req, res);<NEW_LINE>}<NEW_LINE>return authResult;<NEW_LINE>} | AuthenticationResult(AuthResult.FAILURE, "The CLIENT-CERT authentication failed because no client certificate was found."); |
815,005 | private BuildRule createCompileDepsRule(CxxPlatformsProvider cxxPlatformsProvider, BuildTarget buildTarget, ActionGraphBuilder graphBuilder, BuildRuleCreationContextWithTargetGraph context, BuildRuleParams params, AppleTestDescriptionArg args) {<NEW_LINE>CxxPlatform cxxPlatform = ApplePlatforms.getCxxPlatformForBuildTarget(cxxPlatformsProvider, buildTarget, args.getDefaultPlatform()).resolve(graphBuilder, buildTarget.getTargetConfiguration());<NEW_LINE>FlavorDomain<UnresolvedAppleCxxPlatform> appleCxxPlatformFlavorDomain = getAppleCxxPlatformsFlavorDomain(buildTarget.getTargetConfiguration());<NEW_LINE>AppleCxxPlatform appleCxxPlatform = verifyAppleCxxPlatform(appleCxxPlatformFlavorDomain, cxxPlatform, buildTarget).resolve(graphBuilder);<NEW_LINE>TargetGraph targetGraph = context.getTargetGraph();<NEW_LINE>AppleBundleResources collectedResources = AppleResources.collectResourceDirsAndFiles(xcodeDescriptions, targetGraph, graphBuilder, Optional.empty(), targetGraph.get(buildTarget), appleCxxPlatform, AppleBuildRules.RecursiveDependenciesMode.COPYING, Predicates.alwaysTrue());<NEW_LINE>ImmutableSortedSet<BuildRule> transitiveStaticLibraryDependencies = collectTransitiveStaticLibraries(targetGraph, buildTarget, cxxPlatform, args, graphBuilder, context, params);<NEW_LINE>BuildRuleParams <MASK><NEW_LINE>ImmutableList<SourcePath> depBuildRuleSourcePaths = transitiveStaticLibraryDependencies.stream().map(BuildRule::getSourcePathToOutput).filter(Objects::nonNull).collect(ImmutableList.toImmutableList());<NEW_LINE>ProjectFilesystem projectFilesystem = context.getProjectFilesystem();<NEW_LINE>Path outputPath = BuildTargetPaths.getGenPath(projectFilesystem, buildTarget, "%s").resolve(AppleTestDescription.COMPILE_DEPS.getName());<NEW_LINE>return new AppleTestAggregatedDependencies(buildTarget, projectFilesystem, newParams, outputPath, collectedResources, appleCxxPlatform, depBuildRuleSourcePaths);<NEW_LINE>} | newParams = params.withExtraDeps(transitiveStaticLibraryDependencies); |
182,859 | public void writeToParcel(final Parcel dest, final int flags) {<NEW_LINE><MASK><NEW_LINE>dest.writeInt(sequenceNumber);<NEW_LINE>if (time == null) {<NEW_LINE>dest.writeByte((byte) 0);<NEW_LINE>} else {<NEW_LINE>dest.writeByte((byte) 1);<NEW_LINE>dest.writeLong(time.getTimeInMillis());<NEW_LINE>}<NEW_LINE>if (glucoseConcentration == null) {<NEW_LINE>dest.writeByte((byte) 0);<NEW_LINE>} else {<NEW_LINE>dest.writeByte((byte) 1);<NEW_LINE>dest.writeFloat(glucoseConcentration);<NEW_LINE>}<NEW_LINE>if (unit == null) {<NEW_LINE>dest.writeByte((byte) 0);<NEW_LINE>} else {<NEW_LINE>dest.writeByte((byte) 1);<NEW_LINE>dest.writeInt(unit);<NEW_LINE>}<NEW_LINE>if (type == null) {<NEW_LINE>dest.writeByte((byte) 0);<NEW_LINE>} else {<NEW_LINE>dest.writeByte((byte) 1);<NEW_LINE>dest.writeInt(type);<NEW_LINE>}<NEW_LINE>if (sampleLocation == null) {<NEW_LINE>dest.writeByte((byte) 0);<NEW_LINE>} else {<NEW_LINE>dest.writeByte((byte) 1);<NEW_LINE>dest.writeInt(sampleLocation);<NEW_LINE>}<NEW_LINE>super.writeToParcel(dest, flags);<NEW_LINE>if (status == null) {<NEW_LINE>dest.writeByte((byte) 0);<NEW_LINE>} else {<NEW_LINE>dest.writeByte((byte) 1);<NEW_LINE>dest.writeInt(status.value);<NEW_LINE>}<NEW_LINE>dest.writeByte((byte) (contextInformationFollows ? 1 : 0));<NEW_LINE>} | super.writeToParcel(dest, flags); |
1,755,892 | protected GraphQLOutputType compute(Column.ColumnType columnType) {<NEW_LINE>if (columnType.isMap()) {<NEW_LINE>GraphQLType keyType = get(columnType.parameters().get(0));<NEW_LINE>GraphQLType valueType = get(columnType.parameters().get(1));<NEW_LINE>return new MapBuilder(keyType, valueType, false).build();<NEW_LINE>} else if (columnType.isList() || columnType.isSet()) {<NEW_LINE>return new GraphQLList(get(columnType.parameters().get(0)));<NEW_LINE>} else if (columnType.isUserDefined()) {<NEW_LINE>UserDefinedType udt = (UserDefinedType) columnType;<NEW_LINE>return computeUdt(udt);<NEW_LINE>} else if (columnType.isTuple()) {<NEW_LINE>List<GraphQLType> subTypes = columnType.parameters().stream().map(this::get).collect(Collectors.toList());<NEW_LINE>return new <MASK><NEW_LINE>} else {<NEW_LINE>return getScalar(columnType.rawType());<NEW_LINE>}<NEW_LINE>} | TupleBuilder(subTypes).buildOutputType(); |
19,862 | public void parameterChanged(ParameterList parameterList, String key, boolean isAdjusting) {<NEW_LINE>if ("normalizeCounts".equals(key)) {<NEW_LINE>boolean doNormalize = params.getBooleanParameterValue("normalizeCounts");<NEW_LINE>// This is rather clumsy (compared to just updating the histogram data),<NEW_LINE>// but the reason is that the animations are poor when the data is updated in-place<NEW_LINE>List<HistogramData> list = new ArrayList<>();<NEW_LINE>for (HistogramData histogramData : panelHistogram.getHistogramData()) {<NEW_LINE>histogramData.setNormalizeCounts(doNormalize);<NEW_LINE>list.add(new HistogramData(histogramData.getHistogram(), false, histogramData.getStroke()));<NEW_LINE>// histogramData.update();<NEW_LINE>}<NEW_LINE>panelHistogram.getHistogramData().setAll(list);<NEW_LINE>return;<NEW_LINE>} else if ("drawGrid".equals(key)) {<NEW_LINE>panelHistogram.getChart().setHorizontalGridLinesVisible<MASK><NEW_LINE>panelHistogram.getChart().setVerticalGridLinesVisible(params.getBooleanParameterValue("drawGrid"));<NEW_LINE>return;<NEW_LINE>} else if ("drawAxes".equals(key)) {<NEW_LINE>panelHistogram.setShowTickLabels(params.getBooleanParameterValue("drawAxes"));<NEW_LINE>return;<NEW_LINE>} else if ("nBins".equals(key)) {<NEW_LINE>setHistogram(model, comboName.getSelectionModel().getSelectedItem());<NEW_LINE>return;<NEW_LINE>} else if ("animate".equals(key)) {<NEW_LINE>panelHistogram.getChart().setAnimated(params.getBooleanParameterValue("animate"));<NEW_LINE>}<NEW_LINE>} | (params.getBooleanParameterValue("drawGrid")); |
1,507,037 | void saveState(Bundle outState) {<NEW_LINE>final int numTabs = getTabCount();<NEW_LINE>if (numTabs == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>long[] ids = new long[numTabs];<NEW_LINE>int i = 0;<NEW_LINE>for (Tab tab : mTabs) {<NEW_LINE><MASK><NEW_LINE>if (tabState != null) {<NEW_LINE>ids[i++] = tab.getId();<NEW_LINE>String key = Long.toString(tab.getId());<NEW_LINE>if (outState.containsKey(key)) {<NEW_LINE>// Dump the tab state for debugging purposes<NEW_LINE>for (Tab dt : mTabs) {<NEW_LINE>Log.e(TAG, dt.toString());<NEW_LINE>}<NEW_LINE>throw new IllegalStateException(String.format("Error saving state, duplicate tab ids: %s!", key));<NEW_LINE>}<NEW_LINE>outState.putBundle(key, tabState);<NEW_LINE>} else {<NEW_LINE>ids[i++] = -1;<NEW_LINE>// Since we won't be restoring the thumbnail, delete it<NEW_LINE>tab.deleteThumbnail();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!outState.isEmpty()) {<NEW_LINE>outState.putLongArray(POSITIONS, ids);<NEW_LINE>Tab current = getCurrentTab();<NEW_LINE>long cid = -1;<NEW_LINE>if (current != null) {<NEW_LINE>cid = current.getId();<NEW_LINE>}<NEW_LINE>outState.putLong(CURRENT, cid);<NEW_LINE>}<NEW_LINE>} | Bundle tabState = tab.saveState(); |
1,706,659 | public Complex[] fft(Complex[] input) {<NEW_LINE>Complex[] x = input;<NEW_LINE>int n = x.length;<NEW_LINE>if (n == 1)<NEW_LINE>return new Complex[] { x[0] };<NEW_LINE>if (n % 2 != 0) {<NEW_LINE>x = Arrays.copyOfRange(x, <MASK><NEW_LINE>}<NEW_LINE>Complex[] halfArray = new Complex[n / 2];<NEW_LINE>for (int k = 0; k < n / 2; k++) {<NEW_LINE>halfArray[k] = x[2 * k];<NEW_LINE>}<NEW_LINE>Complex[] q = fft(halfArray);<NEW_LINE>for (int k = 0; k < n / 2; k++) {<NEW_LINE>halfArray[k] = x[2 * k + 1];<NEW_LINE>}<NEW_LINE>Complex[] r = fft(halfArray);<NEW_LINE>Complex[] y = new Complex[n];<NEW_LINE>for (int k = 0; k < n / 2; k++) {<NEW_LINE>double kth = -2 * k * Math.PI / n;<NEW_LINE>Complex wk = new Complex(Math.cos(kth), Math.sin(kth));<NEW_LINE>if (r[k] == null) {<NEW_LINE>r[k] = new Complex(1);<NEW_LINE>}<NEW_LINE>if (q[k] == null) {<NEW_LINE>q[k] = new Complex(1);<NEW_LINE>}<NEW_LINE>y[k] = q[k].add(wk.multiply(r[k]));<NEW_LINE>y[k + n / 2] = q[k].subtract(wk.multiply(r[k]));<NEW_LINE>}<NEW_LINE>return y;<NEW_LINE>} | 0, x.length - 1); |
855,328 | public static void waitForBulkTransfer(Iterable<? extends ListenableFuture<?>> transfers, boolean cancelRemainingOnInterrupt) throws BulkTransferException, InterruptedException {<NEW_LINE>BulkTransferException bulkTransferException = null;<NEW_LINE>InterruptedException interruptedException = null;<NEW_LINE>boolean interrupted = Thread.currentThread().isInterrupted();<NEW_LINE>for (ListenableFuture<?> transfer : transfers) {<NEW_LINE>try {<NEW_LINE>if (interruptedException == null) {<NEW_LINE>// Wait for all transfers to finish.<NEW_LINE>getFromFuture(transfer, cancelRemainingOnInterrupt);<NEW_LINE>} else {<NEW_LINE>transfer.cancel(true);<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>if (bulkTransferException == null) {<NEW_LINE>bulkTransferException = new BulkTransferException();<NEW_LINE>}<NEW_LINE>bulkTransferException.add(e);<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>interrupted <MASK><NEW_LINE>interruptedException = e;<NEW_LINE>if (!cancelRemainingOnInterrupt) {<NEW_LINE>// leave the rest of the transfers alone<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (interrupted) {<NEW_LINE>Thread.currentThread().interrupt();<NEW_LINE>}<NEW_LINE>if (interruptedException != null) {<NEW_LINE>if (bulkTransferException != null) {<NEW_LINE>interruptedException.addSuppressed(bulkTransferException);<NEW_LINE>}<NEW_LINE>throw interruptedException;<NEW_LINE>}<NEW_LINE>if (bulkTransferException != null) {<NEW_LINE>throw bulkTransferException;<NEW_LINE>}<NEW_LINE>} | = Thread.interrupted() || interrupted; |
1,655,280 | private CompletionStage<WebServer> shutdownThreadGroups() {<NEW_LINE>if (shutdownThreadGroupsInitiated.getAndSet(true)) {<NEW_LINE>return threadGroupsShutdownFuture;<NEW_LINE>}<NEW_LINE>forceQueuesRelease();<NEW_LINE>long maxShutdownTimeoutSeconds = configuration.maxShutdownTimeout().toSeconds();<NEW_LINE>long shutdownQuietPeriod = configuration<MASK><NEW_LINE>Future<?> bossGroupFuture = bossGroup.shutdownGracefully(shutdownQuietPeriod, maxShutdownTimeoutSeconds, TimeUnit.SECONDS);<NEW_LINE>Future<?> workerGroupFuture = workerGroup.shutdownGracefully(shutdownQuietPeriod, maxShutdownTimeoutSeconds, TimeUnit.SECONDS);<NEW_LINE>workerGroupFuture.addListener(workerFuture -> {<NEW_LINE>bossGroupFuture.addListener(bossFuture -> {<NEW_LINE>if (workerFuture.isSuccess() && bossFuture.isSuccess()) {<NEW_LINE>threadGroupsShutdownFuture.complete(this);<NEW_LINE>} else {<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>sb.append(workerFuture.cause() != null ? "Worker Group problem: " + workerFuture.cause().getMessage() : "").append(bossFuture.cause() != null ? "Boss Group problem: " + bossFuture.cause().getMessage() : "");<NEW_LINE>threadGroupsShutdownFuture.completeExceptionally(new IllegalStateException("Unable to shutdown Netty thread groups: " + sb));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>});<NEW_LINE>return threadGroupsShutdownFuture;<NEW_LINE>} | .shutdownQuietPeriod().toSeconds(); |
613,043 | public void run(RegressionEnvironment env) {<NEW_LINE>String epl = "@public @buseventtype " + "@JsonSchemaField(name=point, adapter=" + SupportJsonFieldAdapterStringPoint.class.getSimpleName() + ") " + "@JsonSchemaField(name=mydate, adapter=" + SupportJsonFieldAdapterStringDate.class.getSimpleName() + ") " + "create json schema JsonEvent(point java.awt.Point, mydate Date);\n" + "@name('s0') select point, mydate from JsonEvent;\n" + "@name('s1') select * from JsonEvent;\n";<NEW_LINE>env.compileDeploy(epl).addListener("s0").addListener("s1");<NEW_LINE>String jsonFilled = "{\"point\":\"7,14\",\"mydate\":\"2002-05-01T08:00:01.999\"}";<NEW_LINE>sendAssert(env, jsonFilled, new Object[] { new Point(7, 14), <MASK><NEW_LINE>String jsonNulled = "{\"point\":null,\"mydate\":null}";<NEW_LINE>sendAssert(env, jsonNulled, new Object[] { null, null });<NEW_LINE>env.undeployAll();<NEW_LINE>} | DateTime.parseDefaultDate("2002-05-1T08:00:01.999") }); |
1,180,524 | public static BArray enumerate(BArray arr) {<NEW_LINE>Type arrType = arr.getType();<NEW_LINE>int size = arr.size();<NEW_LINE>TupleType elemType;<NEW_LINE>GetFunction getFn;<NEW_LINE>switch(arrType.getTag()) {<NEW_LINE>case TypeTags.ARRAY_TAG:<NEW_LINE>elemType = TypeCreator.createTupleType(Arrays.asList(PredefinedTypes.TYPE_INT, arr.getElementType()));<NEW_LINE>getFn = BArray::get;<NEW_LINE>break;<NEW_LINE>case TypeTags.TUPLE_TAG:<NEW_LINE>TupleType tupleType = (TupleType) arrType;<NEW_LINE>UnionType tupElemType = TypeCreator.createUnionType(tupleType.getTupleTypes(), tupleType.getTypeFlags());<NEW_LINE>elemType = TypeCreator.createTupleType(Arrays.asList(PredefinedTypes.TYPE_INT, tupElemType));<NEW_LINE>getFn = BArray::getRefValue;<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw createOpNotSupportedError(arrType, "enumerate()");<NEW_LINE>}<NEW_LINE>ArrayType newArrType = TypeCreator.createArrayType(elemType);<NEW_LINE>// TODO: 7/8/19 Verify whether this needs to be<NEW_LINE>BArray newArr = ValueCreator.createArrayValue(newArrType);<NEW_LINE>// sealed<NEW_LINE>for (int i = 0; i < size; i++) {<NEW_LINE>BArray entry = ValueCreator.createTupleValue(elemType);<NEW_LINE>entry.add(0, Long.valueOf(i));<NEW_LINE>entry.add(1, getFn<MASK><NEW_LINE>newArr.add(i, entry);<NEW_LINE>}<NEW_LINE>return newArr;<NEW_LINE>} | .get(arr, i)); |
207,004 | public static PricingConditionsBreak toPricingConditionsBreak(@NonNull final I_M_DiscountSchemaBreak schemaBreakRecord) {<NEW_LINE>final int discountSchemaBreakId = schemaBreakRecord.getM_DiscountSchemaBreak_ID();<NEW_LINE>final PricingConditionsBreakId id = discountSchemaBreakId > 0 ? PricingConditionsBreakId.of(schemaBreakRecord.<MASK><NEW_LINE>final PaymentTermId paymentTermIdOrNull = PaymentTermId.ofRepoIdOrNull(schemaBreakRecord.getC_PaymentTerm_ID());<NEW_LINE>final Percent paymentDiscount = Percent.ofNullable(schemaBreakRecord.getPaymentDiscount());<NEW_LINE>final PaymentTermService paymentTermService = SpringContextHolder.instance.getBean(PaymentTermService.class);<NEW_LINE>final PaymentTermId derivedPaymentTermId = paymentTermService.getOrCreateDerivedPaymentTerm(paymentTermIdOrNull, paymentDiscount);<NEW_LINE>return //<NEW_LINE>PricingConditionsBreak.builder().id(id).matchCriteria(toPricingConditionsBreakMatchCriteria(schemaBreakRecord)).seqNo(schemaBreakRecord.getSeqNo()).priceSpecification(//<NEW_LINE>toPriceSpecification(schemaBreakRecord)).bpartnerFlatDiscount(schemaBreakRecord.isBPartnerFlatDiscount()).discount(//<NEW_LINE>Percent.of(schemaBreakRecord.getBreakDiscount())).paymentTermIdOrNull(paymentTermIdOrNull).paymentDiscountOverrideOrNull(paymentDiscount).derivedPaymentTermIdOrNull(//<NEW_LINE>derivedPaymentTermId).qualityDiscountPercentage(//<NEW_LINE>schemaBreakRecord.getQualityIssuePercentage()).pricingSystemSurchargeAmt(//<NEW_LINE>schemaBreakRecord.getPricingSystemSurchargeAmt()).//<NEW_LINE>dateCreated(TimeUtil.asInstant(schemaBreakRecord.getCreated())).createdById(UserId.ofRepoIdOrNull(schemaBreakRecord.getCreatedBy())).hasChanges(false).build();<NEW_LINE>} | getM_DiscountSchema_ID(), discountSchemaBreakId) : null; |
1,250,778 | public static void colorizeSign(GrayF32 input, float maxAbsValue, Bitmap output, @Nullable DogArray_I8 _storage) {<NEW_LINE>shapeShape(input, output);<NEW_LINE>_storage = ConvertBitmap.resizeStorage(output, _storage);<NEW_LINE>final <MASK><NEW_LINE>if (maxAbsValue < 0)<NEW_LINE>maxAbsValue = ImageStatistics.maxAbs(input);<NEW_LINE>int indexDst = 0;<NEW_LINE>for (int y = 0; y < input.height; y++) {<NEW_LINE>int indexSrc = input.startIndex + y * input.stride;<NEW_LINE>for (int x = 0; x < input.width; x++) {<NEW_LINE>float value = input.data[indexSrc++];<NEW_LINE>if (value > 0) {<NEW_LINE>storage[indexDst++] = (byte) (255f * value / maxAbsValue);<NEW_LINE>storage[indexDst++] = 0;<NEW_LINE>storage[indexDst++] = 0;<NEW_LINE>} else {<NEW_LINE>storage[indexDst++] = 0;<NEW_LINE>storage[indexDst++] = (byte) (-255f * value / maxAbsValue);<NEW_LINE>storage[indexDst++] = 0;<NEW_LINE>}<NEW_LINE>storage[indexDst++] = (byte) 0xFF;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>output.copyPixelsFromBuffer(ByteBuffer.wrap(storage));<NEW_LINE>} | byte[] storage = _storage.data; |
740,804 | private JCTree.JCExpression makeUnaryIncDecCall(JCTree.JCUnary tree, TreeMaker make, Symbol.MethodSymbol operatorMethod, JCExpression operand) {<NEW_LINE>if (operatorMethod == null) {<NEW_LINE>Type unboxedType = _tp.getTypes(<MASK><NEW_LINE>if (unboxedType != null && !unboxedType.hasTag(NONE)) {<NEW_LINE>operand = unbox(_tp.getTypes(), _tp.getTreeMaker(), Names.instance(JavacPlugin.instance().getContext()), _tp.getContext(), _tp.getCompilationUnit(), operand, unboxedType);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// the only way operatorMethod can be null is when the inc/dec operand is indexed, but not an array and the indexed elems are primitive<NEW_LINE>JCTree.JCExpression one = make.Literal(1);<NEW_LINE>one.pos = tree.pos;<NEW_LINE>one = make.TypeCast(operand.type, one);<NEW_LINE>one.pos = tree.pos;<NEW_LINE>JCTree.JCBinary binary = make.Binary(tree.getTag() == JCTree.Tag.PREINC || tree.getTag() == JCTree.Tag.POSTINC ? JCTree.Tag.PLUS : JCTree.Tag.MINUS, operand, one);<NEW_LINE>binary.pos = tree.pos;<NEW_LINE>binary.type = operand.type;<NEW_LINE>Env<AttrContext> env = new AttrContextEnv(tree, new AttrContext());<NEW_LINE>env.toplevel = (JCTree.JCCompilationUnit) _tp.getCompilationUnit();<NEW_LINE>env.enclClass = getEnclosingClass(tree);<NEW_LINE>binary.operator = resolveMethod(tree.pos(), Names.instance(_tp.getContext()).fromString(binary.getTag() == JCTree.Tag.PLUS ? "+" : "-"), _tp.getSymtab().predefClass.type, List.of(binary.lhs.type, binary.rhs.type));<NEW_LINE>return binary;<NEW_LINE>// maybe unbox here?<NEW_LINE>} else {<NEW_LINE>JCTree.JCMethodInvocation methodCall = make.Apply(List.nil(), make.Select(operand, operatorMethod), List.nil());<NEW_LINE>methodCall.setPos(tree.pos);<NEW_LINE>methodCall.type = operatorMethod.getReturnType();<NEW_LINE>// If methodCall is an extension method, rewrite it accordingly<NEW_LINE>methodCall = maybeReplaceWithExtensionMethod(methodCall);<NEW_LINE>return methodCall;<NEW_LINE>}<NEW_LINE>} | ).unboxedType(operand.type); |
1,384,255 | private void transitionToFinalBatchStatus() {<NEW_LINE>// Store in local variable to facilitate Ctrl+Shift+G search in Eclipse<NEW_LINE>StopLock stopLock = getStopLock();<NEW_LINE>synchronized (stopLock) {<NEW_LINE><MASK><NEW_LINE>if (currentBatchStatus.equals(BatchStatus.STARTED)) {<NEW_LINE>updateStepBatchStatus(BatchStatus.COMPLETED);<NEW_LINE>} else if (currentBatchStatus.equals(BatchStatus.STOPPING)) {<NEW_LINE>updateStepBatchStatus(BatchStatus.STOPPED);<NEW_LINE>} else if (currentBatchStatus.equals(BatchStatus.FAILED)) {<NEW_LINE>// Should have already been done but maybe better for possible code refactoring to have it here.<NEW_LINE>updateStepBatchStatus(BatchStatus.FAILED);<NEW_LINE>} else {<NEW_LINE>throw new IllegalStateException("Step batch status should not be in a " + currentBatchStatus.name() + " state");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | BatchStatus currentBatchStatus = runtimeStepExecution.getBatchStatus(); |
1,011,630 | List<ImapResponse> readStatusResponse(String tag, String commandToLog, String logId, UntaggedHandler untaggedHandler) throws IOException, NegativeImapResponseException {<NEW_LINE>List<ImapResponse> <MASK><NEW_LINE>ImapResponse response;<NEW_LINE>do {<NEW_LINE>response = readResponse();<NEW_LINE>if (K9MailLib.isDebug() && DEBUG_PROTOCOL_IMAP) {<NEW_LINE>Timber.v("%s<<<%s", logId, response);<NEW_LINE>}<NEW_LINE>if (response.getTag() != null && !response.getTag().equalsIgnoreCase(tag)) {<NEW_LINE>Timber.w("After sending tag %s, got tag response from previous command %s for %s", tag, response, logId);<NEW_LINE>Iterator<ImapResponse> responseIterator = responses.iterator();<NEW_LINE>while (responseIterator.hasNext()) {<NEW_LINE>ImapResponse delResponse = responseIterator.next();<NEW_LINE>if (delResponse.getTag() != null || delResponse.size() < 2 || (!equalsIgnoreCase(delResponse.get(1), Responses.EXISTS) && !equalsIgnoreCase(delResponse.get(1), Responses.EXPUNGE))) {<NEW_LINE>responseIterator.remove();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>response = null;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (response.getTag() == null && untaggedHandler != null) {<NEW_LINE>untaggedHandler.handleAsyncUntaggedResponse(response);<NEW_LINE>}<NEW_LINE>responses.add(response);<NEW_LINE>} while (response == null || response.getTag() == null);<NEW_LINE>if (response.size() < 1 || !equalsIgnoreCase(response.get(0), Responses.OK)) {<NEW_LINE>String message = "Command: " + commandToLog + "; response: " + response.toString();<NEW_LINE>throw new NegativeImapResponseException(message, responses);<NEW_LINE>}<NEW_LINE>return responses;<NEW_LINE>} | responses = new ArrayList<>(); |
1,606,883 | final CreatePredictorBacktestExportJobResult executeCreatePredictorBacktestExportJob(CreatePredictorBacktestExportJobRequest createPredictorBacktestExportJobRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createPredictorBacktestExportJobRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreatePredictorBacktestExportJobRequest> request = null;<NEW_LINE>Response<CreatePredictorBacktestExportJobResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreatePredictorBacktestExportJobRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createPredictorBacktestExportJobRequest));<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, "forecast");<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<CreatePredictorBacktestExportJobResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreatePredictorBacktestExportJobResultJsonUnmarshaller());<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, "CreatePredictorBacktestExportJob"); |
1,147,304 | private String updateTo(final IParams params) {<NEW_LINE>String toTmp = "";<NEW_LINE>if (!params.hasParameter(I_C_BPartner.COLUMNNAME_C_BPartner_ID)) {<NEW_LINE>throw new IllegalArgumentException("Process instance doesn't contain a business partner as parameter");<NEW_LINE>}<NEW_LINE>// find the C_BPartner_ID parameter<NEW_LINE>final int bpartnerId = params.getParameterAsInt(I_C_BPartner.COLUMNNAME_C_BPartner_ID, -1);<NEW_LINE>if (bpartnerId <= 0) {<NEW_LINE>logger.info(<MASK><NEW_LINE>} else {<NEW_LINE>final int userId = MBPartner.getDefaultContactId(bpartnerId);<NEW_LINE>if (userId > 0) {<NEW_LINE>final I_AD_User contanct = Services.get(IUserDAO.class).retrieveUserOrNull(Env.getCtx(), userId);<NEW_LINE>if (contanct.getEMail() == null || "".equals(contanct.getEMail())) {<NEW_LINE>logger.info("Default contact " + contanct + " doesn't have an email address");<NEW_LINE>} else {<NEW_LINE>toTmp = contanct.getEMail();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return toTmp;<NEW_LINE>} | "Process parameter " + I_C_BPartner.COLUMNNAME_C_BPartner_ID + " didn't contain a value"); |
1,709,345 | private void initialize(@NonNull Context context) {<NEW_LINE>inflate(context, R.layout.verification_code_view, this);<NEW_LINE>codes.add(findViewById(R.id.code_zero));<NEW_LINE>codes.add(findViewById(R.id.code_one));<NEW_LINE>codes.add(findViewById(R.id.code_two));<NEW_LINE>codes.add(findViewById(R.id.code_three));<NEW_LINE>codes.add(findViewById(R.id.code_four));<NEW_LINE>codes.add(findViewById(R.id.code_five));<NEW_LINE>containers.add(findViewById(R.id.container_zero));<NEW_LINE>containers.add(findViewById(R.id.container_one));<NEW_LINE>containers.add(findViewById(R.id.container_two));<NEW_LINE>containers.add(findViewById<MASK><NEW_LINE>containers.add(findViewById(R.id.container_four));<NEW_LINE>containers.add(findViewById(R.id.container_five));<NEW_LINE>} | (R.id.container_three)); |
754,169 | private HttpServer configHttpServer(URI uri, ResourceConfig rc) {<NEW_LINE>String protocol = uri.getScheme();<NEW_LINE>final HttpServer server;<NEW_LINE>if (protocol != null && protocol.equals("https")) {<NEW_LINE>SSLContextConfigurator sslContext = new SSLContextConfigurator();<NEW_LINE>String keystoreFile = this.<MASK><NEW_LINE>String keystorePass = this.conf.get(ServerOptions.SSL_KEYSTORE_PASSWORD);<NEW_LINE>sslContext.setKeyStoreFile(keystoreFile);<NEW_LINE>sslContext.setKeyStorePass(keystorePass);<NEW_LINE>SSLEngineConfigurator sslConfig = new SSLEngineConfigurator(sslContext);<NEW_LINE>sslConfig.setClientMode(false);<NEW_LINE>sslConfig.setWantClientAuth(true);<NEW_LINE>server = GrizzlyHttpServerFactory.createHttpServer(uri, rc, true, sslConfig);<NEW_LINE>} else {<NEW_LINE>server = GrizzlyHttpServerFactory.createHttpServer(uri, rc, false);<NEW_LINE>}<NEW_LINE>Collection<NetworkListener> listeners = server.getListeners();<NEW_LINE>E.checkState(listeners.size() > 0, "Http Server should have some listeners, but now is none");<NEW_LINE>NetworkListener listener = listeners.iterator().next();<NEW_LINE>// Option max_worker_threads<NEW_LINE>int maxWorkerThreads = this.conf.get(ServerOptions.MAX_WORKER_THREADS);<NEW_LINE>listener.getTransport().getWorkerThreadPoolConfig().setCorePoolSize(maxWorkerThreads).setMaxPoolSize(maxWorkerThreads);<NEW_LINE>// Option keep_alive<NEW_LINE>int idleTimeout = this.conf.get(ServerOptions.CONN_IDLE_TIMEOUT);<NEW_LINE>int maxRequests = this.conf.get(ServerOptions.CONN_MAX_REQUESTS);<NEW_LINE>listener.getKeepAlive().setIdleTimeoutInSeconds(idleTimeout);<NEW_LINE>listener.getKeepAlive().setMaxRequestsCount(maxRequests);<NEW_LINE>// Option transaction timeout<NEW_LINE>int transactionTimeout = this.conf.get(ServerOptions.REQUEST_TIMEOUT);<NEW_LINE>listener.setTransactionTimeout(transactionTimeout);<NEW_LINE>return server;<NEW_LINE>} | conf.get(ServerOptions.SSL_KEYSTORE_FILE); |
104,033 | private void addSubqueryJoinStatements(PostgresGlobalState globalState, List<PostgresJoin> joinStatements, PostgresTable fromTable) {<NEW_LINE>// JOIN with subquery<NEW_LINE>for (int i = 0; i < Randomly.smallNumber(); i++) {<NEW_LINE>PostgresTables subqueryTables = new PostgresTables(Randomly.nonEmptySubset(localTables));<NEW_LINE>List<PostgresColumn> columns = new ArrayList<>();<NEW_LINE>columns.addAll(subqueryTables.getColumns());<NEW_LINE>columns.addAll(fromTable.getColumns());<NEW_LINE>PostgresExpression subquery = createSubquery(globalState, String.format("sub%d", i), subqueryTables);<NEW_LINE>PostgresExpressionGenerator subqueryJoinGen = new PostgresExpressionGenerator(globalState).setColumns(columns);<NEW_LINE>PostgresExpression joinClause = subqueryJoinGen.generateExpression(PostgresDataType.BOOLEAN);<NEW_LINE><MASK><NEW_LINE>PostgresJoin j = new PostgresJoin(subquery, joinClause, options);<NEW_LINE>joinStatements.add(j);<NEW_LINE>}<NEW_LINE>} | PostgresJoinType options = PostgresJoinType.getRandom(); |
146,912 | public static void check_reset_2nd_coeffs(MacroblockD x, PlaneType type, FullAccessIntArrPointer a, FullAccessIntArrPointer l) {<NEW_LINE>int sum = 0;<NEW_LINE>int i;<NEW_LINE>BlockD bd = x.block.getRel(24);<NEW_LINE>if (bd.dequant.get() >= 35 && bd.dequant.get() >= 35)<NEW_LINE>return;<NEW_LINE>for (i = 0; i < bd.eob.get(); ++i) {<NEW_LINE>int coef = bd.dqcoeff.getRel<MASK><NEW_LINE>sum += (coef >= 0) ? coef : -coef;<NEW_LINE>if (sum >= 35)<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (sum < 35) {<NEW_LINE>for (i = 0; i < bd.eob.get(); ++i) {<NEW_LINE>int rc = VPXConst.zigzag[i];<NEW_LINE>bd.qcoeff.setRel(rc, (short) 0);<NEW_LINE>bd.dqcoeff.setRel(rc, (short) 0);<NEW_LINE>}<NEW_LINE>bd.eob.set((short) 0);<NEW_LINE>a.set(l.set((short) (((bd.eob.get() != type.start_coeff) ? 1 : 0))));<NEW_LINE>}<NEW_LINE>} | (VPXConst.zigzag[i]); |
916,029 | private Combo createInputWidget(Composite parent, String label, List<String> history) {<NEW_LINE>Label labelWidget = new Label(parent, SWT.NONE);<NEW_LINE>labelWidget.setText(label);<NEW_LINE>labelWidget.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, true));<NEW_LINE>final Combo input = new Combo(parent, SWT.SINGLE | <MASK><NEW_LINE>GridData layoutData = new GridData(SWT.FILL, SWT.CENTER, true, true);<NEW_LINE>layoutData.widthHint = 200;<NEW_LINE>input.setLayoutData(layoutData);<NEW_LINE>for (String t : history) {<NEW_LINE>input.add(t);<NEW_LINE>}<NEW_LINE>if (!history.isEmpty()) {<NEW_LINE>input.setText(history.get(0));<NEW_LINE>}<NEW_LINE>input.addListener(SWT.Modify, eventHandler);<NEW_LINE>input.addListener(SWT.FocusIn, eventHandler);<NEW_LINE>return input;<NEW_LINE>} | SWT.BORDER | SWT.DROP_DOWN); |
643,038 | private void checkConcatArgs(ConcatArgument[] chunks) {<NEW_LINE>// Validate parameters<NEW_LINE>Preconditions.checkArgument(null != chunks, "chunks must not be null");<NEW_LINE>Preconditions.checkArgument(chunks.length >= 2, "There must be at least two chunks");<NEW_LINE>Preconditions.checkArgument(null != chunks[0], "target chunk must not be null");<NEW_LINE>Preconditions.checkArgument(chunks[0].getLength() >= 0, "target chunk length must be non negative.");<NEW_LINE>checkChunkName(chunks<MASK><NEW_LINE>for (int i = 1; i < chunks.length; i++) {<NEW_LINE>Preconditions.checkArgument(null != chunks[i], "source chunk must not be null");<NEW_LINE>checkChunkName(chunks[i].getName());<NEW_LINE>Preconditions.checkArgument(chunks[i].getLength() >= 0, "source chunk length must be non negative.");<NEW_LINE>Preconditions.checkArgument(!chunks[i].getName().equals(chunks[0].getName()), "source chunk is same as target");<NEW_LINE>Preconditions.checkArgument(!chunks[i].getName().equals(chunks[i - 1].getName()), "duplicate chunk found");<NEW_LINE>}<NEW_LINE>} | [0].getName()); |
242,294 | private Map<String, Map<Server, Long>> findAvaliableGpToSvrs() {<NEW_LINE>Map<String, Map<Server, Long>> results = new HashMap<String, Map<Server, Long>>();<NEW_LINE>Map<String, Server> servers = m_configManager.queryEnableServers();<NEW_LINE>RouterConfig routerConfig = m_configManager.getRouterConfig();<NEW_LINE>Map<String, ServerGroup> groups = routerConfig.getServerGroups();<NEW_LINE>for (Entry<String, NetworkPolicy> entry : routerConfig.getNetworkPolicies().entrySet()) {<NEW_LINE><MASK><NEW_LINE>ServerGroup serverGroup = groups.get(networkPolicy.getServerGroup());<NEW_LINE>if (!networkPolicy.isBlock() && serverGroup != null) {<NEW_LINE>Map<Server, Long> networkResults = new HashMap<Server, Long>();<NEW_LINE>for (GroupServer s : serverGroup.getGroupServers().values()) {<NEW_LINE>Server server = servers.get(s.getId());<NEW_LINE>if (server != null) {<NEW_LINE>networkResults.put(server, 0L);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>results.put(entry.getKey(), networkResults);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return results;<NEW_LINE>} | NetworkPolicy networkPolicy = entry.getValue(); |
881,951 | private void ensureSummaryField(DocumentSummary summary, String fieldName, DataType dataType, Source source, SummaryTransform transform) {<NEW_LINE>SummaryField oldField = schema.getSummaryField(fieldName);<NEW_LINE>if (oldField == null) {<NEW_LINE>if (useV8GeoPositions)<NEW_LINE>return;<NEW_LINE>SummaryField newField = new SummaryField(fieldName, dataType, transform);<NEW_LINE>newField.addSource(source);<NEW_LINE>summary.add(newField);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!oldField.getDataType().equals(dataType)) {<NEW_LINE>fail(oldField, "exists with type '" + oldField.getDataType().toString() + "', should be of type '" + <MASK><NEW_LINE>}<NEW_LINE>if (oldField.getTransform() != transform) {<NEW_LINE>fail(oldField, "has summary transform '" + oldField.getTransform().toString() + "', should have transform '" + transform.toString() + "'");<NEW_LINE>}<NEW_LINE>if (oldField.getSourceCount() != 1 || !oldField.getSingleSource().equals(source.getName())) {<NEW_LINE>fail(oldField, "has source '" + oldField.getSources().toString() + "', should have source '" + source + "'");<NEW_LINE>}<NEW_LINE>if (useV8GeoPositions)<NEW_LINE>return;<NEW_LINE>summary.add(oldField);<NEW_LINE>} | dataType.toString() + "'"); |
1,420,295 | public void prunePoints(int count) {<NEW_LINE>// Remove all observations of the Points which are going to be removed<NEW_LINE>for (int viewIndex = observations.views.size - 1; viewIndex >= 0; viewIndex--) {<NEW_LINE>SceneObservations.View v = observations.views.data[viewIndex];<NEW_LINE>for (int pointIndex = v.point.size - 1; pointIndex >= 0; pointIndex--) {<NEW_LINE>SceneStructureCommon.Point p = structure.points.data[v.getPointId(pointIndex)];<NEW_LINE>if (p.views.size < count) {<NEW_LINE>v.remove(pointIndex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Create a look up table containing from old to new indexes for each point<NEW_LINE>int[] oldToNew = new <MASK><NEW_LINE>// crash is bug<NEW_LINE>Arrays.fill(oldToNew, -1);<NEW_LINE>// List of point ID's which are to be removed.<NEW_LINE>DogArray_I32 prune = new DogArray_I32();<NEW_LINE>for (int i = 0; i < structure.points.size; i++) {<NEW_LINE>if (structure.points.data[i].views.size < count) {<NEW_LINE>prune.add(i);<NEW_LINE>} else {<NEW_LINE>oldToNew[i] = i - prune.size;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>pruneUpdatePointID(oldToNew, prune);<NEW_LINE>} | int[structure.points.size]; |
371,283 | public void run(RegressionEnvironment env) {<NEW_LINE>String text = "@name('s0') select * from SupportBean " + "match_recognize (" + " partition by intPrimitive, longPrimitive" + " measures A.theString as a, B.theString as b" + " pattern (A B)" + " define" + " A as A.doublePrimitive = 1," + " B as B.doublePrimitive = 2" + ")";<NEW_LINE>env.compileDeploy(text).addListener("s0");<NEW_LINE>sendSB(env, <MASK><NEW_LINE>sendSB(env, "E2", 1, 3, 1);<NEW_LINE>sendSB(env, "E3", 2, 2, 1);<NEW_LINE>env.milestone(0);<NEW_LINE>sendSB(env, "E10", 2, 2, 2);<NEW_LINE>assertReceived(env, "E3", "E10");<NEW_LINE>sendSB(env, "E11", 1, 3, 2);<NEW_LINE>assertReceived(env, "E2", "E11");<NEW_LINE>sendSB(env, "E12", 1, 2, 2);<NEW_LINE>assertReceived(env, "E1", "E12");<NEW_LINE>env.undeployAll();<NEW_LINE>} | "E1", 1, 2, 1); |
1,240,919 | private void parseTopologyConfig(final JsonNode allTopologies, final Map<String, DeliveryService> deliveryServiceMap, final CacheRegister cacheRegister) {<NEW_LINE>final Map<String, List<String>> topologyMap = new HashMap<>();<NEW_LINE>final Map<String, List<String>> statMap = new HashMap<>();<NEW_LINE>final String tld = JsonUtils.optString(cacheRegister.getConfig(), "domain_name");<NEW_LINE>allTopologies.fieldNames().forEachRemaining((String topologyName) -> {<NEW_LINE>final List<String> <MASK><NEW_LINE>allTopologies.get(topologyName).get("nodes").forEach((JsonNode cache) -> nodes.add(cache.textValue()));<NEW_LINE>topologyMap.put(topologyName, nodes);<NEW_LINE>});<NEW_LINE>deliveryServiceMap.forEach((xmlId, ds) -> {<NEW_LINE>final List<DeliveryServiceReference> dsReferences = new ArrayList<>();<NEW_LINE>// for stats<NEW_LINE>final List<String> dsNames = new ArrayList<>();<NEW_LINE>Stream.of(ds.getTopology()).filter(topologyName -> !Objects.isNull(topologyName) && topologyMap.containsKey(topologyName)).flatMap(topologyName -> {<NEW_LINE>statMap.put(ds.getId(), dsNames);<NEW_LINE>return topologyMap.get(topologyName).stream();<NEW_LINE>}).filter(node -> cacheRegister.getCacheLocation(node) != null).flatMap(node -> cacheRegister.getCacheLocation(node).getCaches().stream()).filter(cache -> ds.hasRequiredCapabilities(cache.getCapabilities())).forEach(cache -> {<NEW_LINE>cacheRegister.getDeliveryServiceMatchers(ds).stream().flatMap(deliveryServiceMatcher -> deliveryServiceMatcher.getRequestMatchers().stream()).map(requestMatcher -> requestMatcher.getPattern().pattern()).forEach(pattern -> {<NEW_LINE>final String remap = ds.getRemap(pattern);<NEW_LINE>final String fqdn = pattern.contains(".*") && !ds.isDns() ? cache.getId() + "." + remap : remap;<NEW_LINE>dsNames.add(getDsName(fqdn, tld));<NEW_LINE>if (!remap.equals(ds.isDns() ? ds.getRoutingName() + "." + ds.getDomain() : ds.getDomain())) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>dsReferences.add(new DeliveryServiceReference(ds.getId(), fqdn));<NEW_LINE>} catch (ParseException e) {<NEW_LINE>LOGGER.error("Unable to create a DeliveryServiceReference from DeliveryService '" + ds.getId() + "'", e);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>cache.setDeliveryServices(dsReferences);<NEW_LINE>});<NEW_LINE>});<NEW_LINE>statTracker.initialize(statMap, cacheRegister);<NEW_LINE>} | nodes = new ArrayList<>(); |
185,913 | public void printDenseDocumentTopics(PrintWriter out) {<NEW_LINE>@Var<NEW_LINE>int docLen;<NEW_LINE>int[] topicCounts = new int[numTopics];<NEW_LINE>for (int doc = 0; doc < data.size(); doc++) {<NEW_LINE>LabelSequence topicSequence = (LabelSequence) data.get(doc).topicSequence;<NEW_LINE>int[<MASK><NEW_LINE>StringBuilder builder = new StringBuilder();<NEW_LINE>builder.append(doc);<NEW_LINE>builder.append("\t");<NEW_LINE>if (data.get(doc).instance.getName() != null) {<NEW_LINE>builder.append(data.get(doc).instance.getName());<NEW_LINE>} else {<NEW_LINE>builder.append("no-name");<NEW_LINE>}<NEW_LINE>docLen = topicSequence.size();<NEW_LINE>// Count up the tokens<NEW_LINE>for (int token = 0; token < docLen; token++) {<NEW_LINE>topicCounts[currentDocTopics[token]]++;<NEW_LINE>}<NEW_LINE>// And normalize<NEW_LINE>for (int topic = 0; topic < numTopics; topic++) {<NEW_LINE>builder.append("\t" + ((alpha[topic] + topicCounts[topic]) / (docLen + alphaSum)));<NEW_LINE>}<NEW_LINE>out.println(builder);<NEW_LINE>Arrays.fill(topicCounts, 0);<NEW_LINE>}<NEW_LINE>} | ] currentDocTopics = topicSequence.getFeatures(); |
1,019,138 | public void run() {<NEW_LINE>status = Status.PLAYING;<NEW_LINE>AudioFormat audioFormat = ais.getFormat();<NEW_LINE>if (audioFormat.getChannels() == 1) {<NEW_LINE>if (outputMode != MONO) {<NEW_LINE>// mono -> convert to stereo<NEW_LINE>ais = new StereoAudioInputStream(ais, outputMode);<NEW_LINE>audioFormat = ais.getFormat();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// 2 channels<NEW_LINE>assert audioFormat.getChannels() == 2 : "Unexpected number of channels: " + audioFormat.getChannels();<NEW_LINE>if (outputMode == MONO) {<NEW_LINE>ais = new MonoAudioInputStream(ais);<NEW_LINE>} else if (outputMode == LEFT_ONLY) {<NEW_LINE>ais = new StereoAudioInputStream(ais, outputMode);<NEW_LINE>} else if (outputMode == RIGHT_ONLY) {<NEW_LINE>ais = new StereoAudioInputStream(ais, outputMode);<NEW_LINE>} else {<NEW_LINE>assert outputMode == STEREO : "Unexpected output mode: " + outputMode;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat);<NEW_LINE>try {<NEW_LINE>if (line == null) {<NEW_LINE>boolean bIsSupportedDirectly = AudioSystem.isLineSupported(info);<NEW_LINE>if (!bIsSupportedDirectly) {<NEW_LINE>AudioFormat sourceFormat = audioFormat;<NEW_LINE>AudioFormat targetFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, sourceFormat.getSampleRate(), sourceFormat.getSampleSizeInBits(), sourceFormat.getChannels(), sourceFormat.getChannels() * (sourceFormat.getSampleSizeInBits() / 8), sourceFormat.getSampleRate(<MASK><NEW_LINE>ais = AudioSystem.getAudioInputStream(targetFormat, ais);<NEW_LINE>audioFormat = ais.getFormat();<NEW_LINE>}<NEW_LINE>info = new DataLine.Info(SourceDataLine.class, audioFormat);<NEW_LINE>line = (SourceDataLine) AudioSystem.getLine(info);<NEW_LINE>}<NEW_LINE>if (lineListener != null)<NEW_LINE>line.addLineListener(lineListener);<NEW_LINE>line.open(audioFormat);<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>line.start();<NEW_LINE>int nRead = 0;<NEW_LINE>// needs to be a multiple of 4 and 6, to support both 16 and 24 bit stereo<NEW_LINE>byte[] abData = new byte[65532];<NEW_LINE>while (nRead != -1 && !exitRequested) {<NEW_LINE>try {<NEW_LINE>nRead = ais.read(abData, 0, abData.length);<NEW_LINE>} catch (IOException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>if (nRead >= 0) {<NEW_LINE>line.write(abData, 0, nRead);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!exitRequested) {<NEW_LINE>line.drain();<NEW_LINE>}<NEW_LINE>line.close();<NEW_LINE>} | ), sourceFormat.isBigEndian()); |
1,545,324 | public void onPageFinished(WebView view, String url) {<NEW_LINE>super.onPageFinished(view, url);<NEW_LINE>ninjaWebView.isBackPressed = false;<NEW_LINE>if (ninjaWebView.isForeground()) {<NEW_LINE>ninjaWebView.invalidate();<NEW_LINE>} else {<NEW_LINE>ninjaWebView.postInvalidate();<NEW_LINE>}<NEW_LINE>if (sp.getBoolean("onPageFinished", false)) {<NEW_LINE>view.evaluateJavascript(Objects.requireNonNull(sp.getString("sp_onPageFinished", "")), null);<NEW_LINE>}<NEW_LINE>if (ninjaWebView.isSaveData()) {<NEW_LINE>view.evaluateJavascript("var links=document.getElementsByTagName('video'); for(let i=0;i<links.length;i++){links[i].pause()};", null);<NEW_LINE>}<NEW_LINE>if (ninjaWebView.isHistory()) {<NEW_LINE>RecordAction action = new RecordAction(ninjaWebView.getContext());<NEW_LINE>action.open(true);<NEW_LINE>if (action.checkUrl(ninjaWebView.getUrl(), RecordUnit.TABLE_HISTORY)) {<NEW_LINE>action.deleteURL(ninjaWebView.<MASK><NEW_LINE>}<NEW_LINE>action.addHistory(new Record(ninjaWebView.getTitle(), ninjaWebView.getUrl(), System.currentTimeMillis(), 0, 0, ninjaWebView.isDesktopMode(), ninjaWebView.isNightMode(), 0));<NEW_LINE>action.close();<NEW_LINE>}<NEW_LINE>} | getUrl(), RecordUnit.TABLE_HISTORY); |
1,099,241 | public static AutogenGitCodeBlob fromProto(ai.verta.modeldb.versioning.GitCodeBlob blob) {<NEW_LINE>if (blob == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>AutogenGitCodeBlob obj = new AutogenGitCodeBlob();<NEW_LINE>{<NEW_LINE>Function<ai.verta.modeldb.versioning.GitCodeBlob, String> f = x <MASK><NEW_LINE>obj.setBranch(f.apply(blob));<NEW_LINE>}<NEW_LINE>{<NEW_LINE>Function<ai.verta.modeldb.versioning.GitCodeBlob, String> f = x -> (blob.getHash());<NEW_LINE>obj.setHash(f.apply(blob));<NEW_LINE>}<NEW_LINE>{<NEW_LINE>Function<ai.verta.modeldb.versioning.GitCodeBlob, Boolean> f = x -> (blob.getIsDirty());<NEW_LINE>obj.setIsDirty(f.apply(blob));<NEW_LINE>}<NEW_LINE>{<NEW_LINE>Function<ai.verta.modeldb.versioning.GitCodeBlob, String> f = x -> (blob.getRepo());<NEW_LINE>obj.setRepo(f.apply(blob));<NEW_LINE>}<NEW_LINE>{<NEW_LINE>Function<ai.verta.modeldb.versioning.GitCodeBlob, String> f = x -> (blob.getTag());<NEW_LINE>obj.setTag(f.apply(blob));<NEW_LINE>}<NEW_LINE>return obj;<NEW_LINE>} | -> (blob.getBranch()); |
1,526,905 | private void populateSDEAccumulators(Measure measure, Context context, Patient patient, HashMap<String, HashMap<String, Integer>> sdeAccumulators, List<Measure.MeasureSupplementalDataComponent> sde) {<NEW_LINE>context.setContextValue("Patient", patient.<MASK><NEW_LINE>List<Object> sdeList = sde.stream().map(sdeItem -> context.resolveExpressionRef(sdeItem.getCriteria().getExpression()).evaluate(context)).collect(Collectors.toList());<NEW_LINE>if (!sdeList.isEmpty()) {<NEW_LINE>for (int i = 0; i < sdeList.size(); i++) {<NEW_LINE>Object sdeListItem = sdeList.get(i);<NEW_LINE>if (null != sdeListItem) {<NEW_LINE>String sdeAccumulatorKey = sde.get(i).getCode().getText();<NEW_LINE>if (null == sdeAccumulatorKey || sdeAccumulatorKey.length() < 1) {<NEW_LINE>sdeAccumulatorKey = sde.get(i).getCriteria().getExpression();<NEW_LINE>}<NEW_LINE>HashMap<String, Integer> sdeItemMap = sdeAccumulators.get(sdeAccumulatorKey);<NEW_LINE>String code = "";<NEW_LINE>switch(sdeListItem.getClass().getSimpleName()) {<NEW_LINE>case "Code":<NEW_LINE>code = ((Code) sdeListItem).getCode();<NEW_LINE>break;<NEW_LINE>case "ArrayList":<NEW_LINE>if (((ArrayList<?>) sdeListItem).size() > 0) {<NEW_LINE>if (((ArrayList<?>) sdeListItem).get(0).getClass().getSimpleName().equals("Coding")) {<NEW_LINE>code = ((Coding) ((ArrayList<?>) sdeListItem).get(0)).getCode();<NEW_LINE>} else {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (null == code) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (null != sdeItemMap && null != sdeItemMap.get(code)) {<NEW_LINE>Integer sdeItemValue = sdeItemMap.get(code);<NEW_LINE>sdeItemValue++;<NEW_LINE>sdeItemMap.put(code, sdeItemValue);<NEW_LINE>sdeAccumulators.get(sdeAccumulatorKey).put(code, sdeItemValue);<NEW_LINE>} else {<NEW_LINE>if (null == sdeAccumulators.get(sdeAccumulatorKey)) {<NEW_LINE>HashMap<String, Integer> newSDEItem = new HashMap<>();<NEW_LINE>newSDEItem.put(code, 1);<NEW_LINE>sdeAccumulators.put(sdeAccumulatorKey, newSDEItem);<NEW_LINE>} else {<NEW_LINE>sdeAccumulators.get(sdeAccumulatorKey).put(code, 1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getIdElement().getIdPart()); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.