Top icons of STS not visible - spring-tool-suite

My top icons of run, debug search and all icons are not visible
Please have a look
I have also tried discarding this STS and tried another one. Faced same issues. Icons vanish and sometimes STS fails to start.
Another solution was to customize perspective but, when i tried to do that,
1. Window -> Perspective-> Custom Perspective
-- Error Details --
Date: Thu Dec 29 10:36:52 IST 2016 Message: Unhandled event loop
exception Severity: Error Product: Spring Tool Suite
3.8.3.201612191351-RELEASE (org.springsource.sts.ide) Plugin: org.eclipse.ui Session Data:
eclipse.buildId=3.8.3.201612191351-RELEASE-e46 java.version=1.8.0_51
java.vendor=Oracle Corporation BootLoader constants: OS=linux,
ARCH=x86_64, WS=gtk, NL=en_IN Framework arguments: -product
org.springsource.sts.ide Command-line arguments: -os linux -ws gtk
-arch x86_64 -product org.springsource.sts.ide -clean
Exception Stack Trace:
java.lang.StackOverflowError
at org.eclipse.swt.widgets.Control.setLocation(Control.java:1185)
at org.eclipse.e4.ui.widgets.ImageBasedFrame.setFramedControlLocation(ImageBasedFrame.java:124)
at org.eclipse.e4.ui.widgets.ImageBasedFrame.access$0(ImageBasedFrame.java:120)
at org.eclipse.e4.ui.widgets.ImageBasedFrame$4.controlMoved(ImageBasedFrame.java:109)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:225)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5227)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1340)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1366)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1345)
at org.eclipse.swt.widgets.Control.setBounds(Control.java:1100)
at org.eclipse.swt.widgets.Composite.setBounds(Composite.java:1527)
at org.eclipse.swt.widgets.ToolBar.setBounds(ToolBar.java:589)
at org.eclipse.swt.widgets.Control.setLocation(Control.java:1187)
at org.eclipse.e4.ui.widgets.ImageBasedFrame.setFramedControlLocation(ImageBasedFrame.java:124)
at org.eclipse.e4.ui.widgets.ImageBasedFrame.access$0(ImageBasedFrame.java:120)
at org.eclipse.e4.ui.widgets.ImageBasedFrame$4.controlMoved(ImageBasedFrame.java:109)
at ......................
**
Update 1 :
**
Following error is seen immediately after I start STS
!SESSION 2017-01-02 09:42:44.171 -----------------------------------------------
eclipse.buildId=3.8.2.201610040743-RELEASE-e46 java.version=1.8.0_51
java.vendor=Oracle Corporation BootLoader constants: OS=linux,
ARCH=x86_64, WS=gtk, NL=en_IN Framework arguments: -product
org.springsource.sts.ide Command-line arguments: -os linux -ws gtk
-arch x86_64 -product org.springsource.sts.ide
This is a continuation of log file /home/swapnil/Documents/code/workspaces/olabsWorkspace/.metadata/.bak_0.log
Created Time: 2017-01-02 09:44:58.413
!ENTRY org.eclipse.equinox.event 4 0 2017-01-02 09:44:58.414
!MESSAGE Exception while dispatching event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/ElementContainer/children/ADD] {ChangedElement=org.eclipse.e4.ui.model.application.ui.basic.impl.TrimBarImpl#65d23aa3 (elementId: org.eclipse.ui.main.toolbar, tags: [], contributorURI: null) (widget: Composite {}, renderer: org.eclipse.e4.ui.workbench.renderers.swt.TrimBarRenderer#63bdf82d, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (side: Top), org.eclipse.e4.data={ChangedElement=org.eclipse.e4.ui.model.application.ui.basic.impl.TrimBarImpl#65d23aa3 (elementId: org.eclipse.ui.main.toolbar, tags: [], contributorURI: null) (widget: Composite {}, renderer: org.eclipse.e4.ui.workbench.renderers.swt.TrimBarRenderer#63bdf82d, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (side: Top), AttName=children, EventType=ADD, Position=11, Widget=Composite {}, NewValue=org.eclipse.e4.ui.model.application.ui.menu.impl.ToolBarImpl#72f9cd3f (elementId: org.eclipse.m2e.editor.MavenPomEditor, tags: [Draggable], contributorURI: null) (widget: ToolBar {}, renderer: org.eclipse.e4.ui.workbench.renderers.swt.ToolBarManagerRenderer#79177bc, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null)}, AttName=children, EventType=ADD, Position=11, Widget=Composite {}, NewValue=org.eclipse.e4.ui.model.application.ui.menu.impl.ToolBarImpl#72f9cd3f (elementId: org.eclipse.m2e.editor.MavenPomEditor, tags: [Draggable], contributorURI: null) (widget: ToolBar {}, renderer: org.eclipse.e4.ui.workbench.renderers.swt.ToolBarManagerRenderer#79177bc, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null)} to handler org.eclipse.e4.core.di.internal.extensions.EventObjectSupplier$DIEventHandler#374d3128
!STACK 0
java.lang.StackOverflowError
at org.eclipse.swt.events.ControlEvent.<init>(ControlEvent.java:35)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:225)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5219)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1340)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1366)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1345)
at org.eclipse.swt.widgets.Control.setBounds(Control.java:1100)
at org.eclipse.swt.widgets.Composite.setBounds(Composite.java:1524)
at org.eclipse.swt.widgets.ToolBar.setBounds(ToolBar.java:589)
at org.eclipse.swt.widgets.Control.setLocation(Control.java:1187)
at org.eclipse.e4.ui.widgets.ImageBasedFrame.setFramedControlLocation(ImageBasedFrame.java:124)
at org.eclipse.e4.ui.widgets.ImageBasedFrame.access$0(ImageBasedFrame.java:120)
at org.eclipse.e4.ui.widgets.ImageBasedFrame$4.controlMoved(ImageBasedFrame.java:109)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:225)

Related

Need to click on Contacts tab in Salesforce getting error "Cannot read properties of undefined (reading 'defaultView')"

Through automated script wants to click on Contacts tab in Salesforce. But unable to do so.
Getting error:
org.openqa.selenium.JavascriptException: javascript error: Cannot read properties of undefined (reading 'defaultView')
(Session info: chrome=94.0.4606.81)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: '****-****', ip: '***.***.*.*', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '15.0.1'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 94.0.4606.81, chrome: {chromedriverVersion: 93.0.4577.63 (ff5c0da2ec0ad..., userDataDir: C:\Users\Sristi\AppData\Loc...}, goog:chromeOptions: {debuggerAddress: localhost:59263}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
Session ID: 0a464ae7e61949632bc4c84b5e790525
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:285)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84)
at Automation.CreateTPARequest.loginTPAPortal(CreateTPARequest.java:60)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:598)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:824)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.testng.TestRunner.privateRun(TestRunner.java:794)
at org.testng.TestRunner.run(TestRunner.java:596)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:377)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:371)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:332)
at org.testng.SuiteRunner.run(SuiteRunner.java:276)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1212)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1134)
at org.testng.TestNG.runSuites(TestNG.java:1063)
at org.testng.TestNG.run(TestNG.java:1031)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
I have tried below 3 scenarios, but none worked. This code was working till yesterday noon after evening getting above mentioned error :
1.
//driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
WebElement contacts=driver.findElement(By.xpath("//div[#class='slds-context-bar']/one-app-nav-bar[#class='slds-grid slds-has-flexi-truncate']/nav[#class='slds-context-bar__secondary navCenter']/div/one-app-nav-bar-item-root[1]/a[#title='Contacts']/span[#class='slds-truncate' and text()='Contacts']"));
//driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
contacts.click();
//new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//nav[#class='slds-context-bar__secondary navCenter']/div/one-app-nav-bar-item-root[2]/a[#title='Contacts']"))).click();
//driver.findElement(By.xpath("//nav[#class='slds-context-bar__secondary navCenter']/div/one-app-nav-bar-item-root[2]/a[#title='Contacts']")).click();
There are 4 ways to click in Selenium.
I will use this xpath
//span[text()='Contacts']/parent::a[contains(#href,'lightning/o/Contact/home')]
Code trial 1 :
Thread.sleep(5);
driver.findElement(By.xpath("//span[text()='Contacts']/parent::a[contains(#href,'lightning/o/Contact/home')]")).click();
Code trial 2 :
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//span[text()='Contacts']/parent::a[contains(#href,'lightning/o/Contact/home')]"))).click();
Code trial 3 :
Thread.sleep(5);
WebElement button = driver.findElement(By.xpath("//span[text()='Contacts']/parent::a[contains(#href,'lightning/o/Contact/home')]"));
((JavascriptExecutor)driver).executeScript("arguments[0].click();", button);
Code trial 4 :
Thread.sleep(5);
WebElement button = driver.findElement(By.xpath("//span[text()='Contacts']/parent::a[contains(#href,'lightning/o/Contact/home')]"));
new Actions(driver).moveToElement(button).click().build().perform();
PS : Please check in the dev tools (Google chrome) if we have unique entry in HTML DOM or not.
Steps to check:
Press F12 in Chrome -> go to element section -> do a CTRL + F -> then paste the xpath and see, if your desired element is getting highlighted with 1/1 matching node.

Create a Custom Android Plugin: java.lang.NullPointerException (no error message)

I´m developing this Android application to run on device.
I´m using Ionic and Angular to develop the application.
Now I need to create a custom plugin using Plugman. This plugin should allowed user to authentication using IBM APP ID.
I followed the instructions mention here https://github.com/ibm-cloud-security/appid-clientsdk-android
to create my gradle file.
However, when I run ionic cordova run android --verbose --debug
I get this error
What went wrong:
Execution failed for task :app:processDebugManifest.
java.lang.NullPointerException (no error message)
And I have no clue what could be the root cause. This is my first time I develop a custom plugin.
My suspicious relies on the dependency, but I can not tell what part is causing the issue.
Ionic Framework : #ionic/angular 5.0.7
#angular-devkit/build-angular : 0.803.26
#angular-devkit/schematics : 8.3.26
#angular/cli : 8.3.26
#ionic/angular-toolkit : 2.2.0
Cordova:
Cordova CLI : 10.0.0
Cordova Platforms : android 8.1.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 7 other plugins)
Utility:
cordova-res (update available: 0.14.0) : 0.10.0
native-run (update available: 1.0.0) : 0.3.0
System:
Android SDK Tools : 26.1.1 (C:\\Android\\sdk)
NodeJS : v14.2.0 (C:\Program Files\\nodejs\\node.exe)
npm : 6.14.4
OS : Windows 10```
LOG=======================================
C:\project_cren\plugin\ci-uix-mobile-master>ionic cordova run android --verbose --debug
ionic:lib Terminal info: { ci: false, shell: 'C:\\WINDOWS\\system32\\cmd.exe', tty: false, windows: true } +0ms
ionic:lib CLI global options: { _: [ 'cordova', 'run', 'android' ], help: null, h: null, verbose: true, quiet: null, interactive: false, color: true, confirm: null, json: null, debug: true, project: null, '--': [] } +4ms
ionic:lib:project Project type from config: #ionic/angular (angular) +0ms
ionic:lib:project Project details: { configPath: 'C:\\project_cren\\plugin\\ci-uix-mobile-master\\ionic.config.json', errors: [], context: 'app', type: 'angular' } +1ms
ionic Context: { binPath: 'C:\\Users\\AMANDODOSSANTOSNETO\\AppData\\Roaming\\npm\\node_modules\\#ionic\\cli\\bin\\ionic', libPath: 'C:\\Users\\AMANDODOSSANTOSNETO\\AppData\\Roaming\\npm\\node_modules\\#ionic\\cli', execPath: 'C:\\project_cren\\plugin\\ci-uix-mobile-master', version: '6.7.0' } +0ms
ionic:lib:integrations:cordova:config Loading Cordova Config (config.xml: 'C:\\project_cren\\plugin\\ci-uix-mobile-master\\config.xml', package.json: 'C:\\project_cren\\plugin\\ci-uix-mobile-master\\package.json') +0ms
ionic:commands:run Native platform devices: [] +0ms
ionic:lib:integrations:cordova:config Loading Cordova Config (config.xml: 'C:\\project_cren\\plugin\\ci-uix-mobile-master\\config.xml', package.json: 'C:\\project_cren\\plugin\\ci-uix-mobile-master\\package.json') +11s
ionic:lib:build build options: {
ionic:lib:build '--': [],
ionic:lib:build engine: 'cordova',
ionic:lib:build platform: 'android',
ionic:lib:build project: 'app',
ionic:lib:build verbose: false,
ionic:lib:build configuration: undefined,
ionic:lib:build sourcemaps: undefined,
ionic:lib:build cordovaAssets: true,
ionic:lib:build watch: undefined,
ionic:lib:build type: 'angular'
ionic:lib:build } +0ms
ionic:lib:hooks Looking for ionic:build:before npm script. +0ms
ionic:lib:build Looking for ionic:build npm script. +154ms
ng:analytics getGlobalAnalytics +0ms
ng:analytics Client Analytics config found: false +47ms
ng:analytics Analytics disabled. Ignoring all analytics. +1ms
ng:analytics getSharedAnalytics +0ms
WARNING in ./src/app/invoice-detail/invoice-detail.component.scss
Module Warning (from ./node_modules/postcss-loader/src/index.js):
Warning
(4:3) start value has mixed support, consider using flex-start instead
# ./src/app/invoice-detail/invoice-detail.component.ts 27:41-83
# ./src/app/app.module.ts
# ./src/main.ts
# multi ./src/main.ts
ionic:lib:hooks Looking for ionic:build:after npm script. +40s
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> java.lang.NullPointerException (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 13s
C:\project_cren\plugin\ci-uix-mobile-master\platforms\android\gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> java.lang.NullPointerException (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 13s
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android --debug --verbose exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
ionic:utils-process onBeforeExit handler: 'process.exit' received +0ms
ionic:utils-process onBeforeExit handler: running 2 functions +1ms
ionic:utils-process error while killing process tree for 17344: Error: Command failed: taskkill /pid 17344 /T /F
ionic:utils-process ERROR: The process "17344" not found.
ionic:utils-process
ionic:utils-process at ChildProcess.exithandler (child_process.js:303:12)
ionic:utils-process at ChildProcess.emit (events.js:315:20)
ionic:utils-process at maybeClose (internal/child_process.js:1051:16)
ionic:utils-process at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5) {
ionic:utils-process killed: false,
ionic:utils-process code: 128,
ionic:utils-process signal: null,
ionic:utils-process cmd: 'taskkill /pid 17344 /T /F'
ionic:utils-process } +472ms
ionic:utils-process onBeforeExit handler: error from function: Error: Command failed: taskkill /pid 17344 /T /F
ionic:utils-process ERROR: The process "17344" not found.
ionic:utils-process
ionic:utils-process at ChildProcess.exithandler (child_process.js:303:12)
ionic:utils-process at ChildProcess.emit (events.js:315:20)
ionic:utils-process at maybeClose (internal/child_process.js:1051:16)
ionic:utils-process at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5) {
ionic:utils-process killed: false,
ionic:utils-process code: 128,
ionic:utils-process signal: null,
ionic:utils-process cmd: 'taskkill /pid 17344 /T /F'
ionic:utils-process } +21ms
ionic:utils-process error while killing process tree for 2628: Error: Command failed: taskkill /pid 2628 /T /F
ionic:utils-process ERROR: The process "2628" not found.
ionic:utils-process
ionic:utils-process at ChildProcess.exithandler (child_process.js:303:12)
ionic:utils-process at ChildProcess.emit (events.js:315:20)
ionic:utils-process at maybeClose (internal/child_process.js:1051:16)
ionic:utils-process at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5) {
ionic:utils-process killed: false,
ionic:utils-process code: 128,
ionic:utils-process signal: null,
ionic:utils-process cmd: 'taskkill /pid 2628 /T /F'
ionic:utils-process } +40ms
ionic:utils-process onBeforeExit handler: error from function: Error: Command failed: taskkill /pid 2628 /T /F
ionic:utils-process ERROR: The process "2628" not found.
ionic:utils-process
ionic:utils-process at ChildProcess.exithandler (child_process.js:303:12)
ionic:utils-process at ChildProcess.emit (events.js:315:20)
ionic:utils-process at maybeClose (internal/child_process.js:1051:16)
ionic:utils-process at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5) {
ionic:utils-process killed: false,
ionic:utils-process code: 128,
ionic:utils-process signal: null,
ionic:utils-process cmd: 'taskkill /pid 2628 /T /F'
ionic:utils-process } +8ms
ionic:utils-process processExit: exiting (exit code: 1) +4ms
GRADLE FILE=====================================================================
android {
//compileSdkVersion 29
//buildToolsVersion "29.0.3"
defaultConfig {
manifestPlaceholders = ['appIdRedirectScheme': android.defaultConfig.applicationId]
}
}
dependencies {
implementation 'com.github.ibm-cloud-security:appid-clientsdk-android:6.+'
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
JAVA FILE ==============================================
package ibm.com.ibmappidcordovaplugin;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CallbackContext;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.ibm.cloud.appid.android.api.AppID;
import com.ibm.cloud.appid.android.api.AuthorizationException;
import com.ibm.cloud.appid.android.api.AuthorizationListener;
import com.ibm.cloud.appid.android.api.LoginWidget;
import com.ibm.cloud.appid.android.api.tokens.AccessToken;
import com.ibm.cloud.appid.android.api.tokens.IdentityToken;
import com.ibm.cloud.appid.android.api.tokens.RefreshToken;
/**
* This class echoes a string called from JavaScript.
*/
public class ibmappidcordovaplugin extends CordovaPlugin {
//PluginResult result = null;
private CallbackContext callbackContext = null;
private static final String SHOW_AUTH = "authentication";
LoginWidget loginWidget;
loginWidget = AppID.getInstance().getLoginWidget();
public ibmappidcordovaplugin(){
AppID.getInstance().initialize(getApplicationContext(), "cdb1c3ab-e8cf-49cf-9dff-9dfa4bf2a898", AppID.REGION_US_SOUTH);
}
#Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
this.callbackContext = callbackContext;
String msg = args.getJSONObject(0).getString("msg");
if (action.equals("authentication")) {
//String message = args.getString(0);
this.coolMethod(msg, callbackContext);
return true;
}
return false;
}
private void coolMethod(String message, CallbackContext callbackContext) {
if (message != null && message.length() > 0) {
auth();
callbackContext.success(create());
} else {
callbackContext.error("Expected one non-empty string argument.");
}
}
private void auth(){
loginWidget.launch(this, new AuthorizationListener() {
#Override
public void onAuthorizationSuccess(final AccessToken accessToken, final IdentityToken identityToken,
RefreshToken refreshToken) {
cordova.getActivity().runOnUiThread(new Runnable() {
#Override
public void run() {
console.log("Name: " + identityToken.getName());
console.log("user: " + accessToken.getScope());
console.log("getIdentities " + identityToken.getIdentities());
console.log("getRaw " + identityToken.getRaw());
for (String name : identityToken.getAudience() ) {
console.log("AUD: " +name);
}
for (String name : identityToken.getAuthenticationMethods() ) {
console.log("AUTH: " +name);
}
try {
JSONObject ob = identityToken.getPayload();
console.log("getPayload " + ob.getString("preferred_username"));
}
catch (Exception e){
console.log("Error: " + e.getMessage());
}
}
});
}
#Override
public void onAuthorizationCanceled() {
}
#Override
public void onAuthorizationFailure (AuthorizationException exception) {
}
});
}
private String create(/*IdentityToken identityToken*/){
String response = "";
try {
JSONObject token = new JSONObject();
String t = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImFwcElkLWNkYjFjM2FiLWU4Y2YtNDljZi05ZGZmLTlkZmE0YmYyYTg5OC0yMDIwLTA5LTI1VDE1OjE5OjI4LjIxNyIsInZlciI6NH0.eyJpc3MiOiJodHRwczovL3VzLXNvdXRoLmFwcGlkLmNsb3VkLmlibS5jb20vb2F1dGgvdjQvY2RiMWMzYWItZThjZi00OWNmLTlkZmYtOWRmYTRiZjJhODk4IiwiYXVkIjpbIjc5NWUzMmVlZWFjMzIzMTM5YmM5ZWU3YmQ2NWEyMTc5YjNhNzc3ZjgiXSwiZXhwIjoxNjAyOTc2ODg0LCJ0ZW5hbnQiOiJjZGIxYzNhYi1lOGNmLTQ5Y2YtOWRmZi05ZGZhNGJmMmE4OTgiLCJpYXQiOjE2MDI5NzMyODQsImVtYWlsIjoiYW1hbmRvc0Bici5pYm0uY29tIiwibmFtZSI6IlZvbHVudGFyaW8gRmVsaXogZGEgVmlkYSIsInN1YiI6ImMyMjQ3ZWU3LTc3ZDEtNDFhMy04NjQ3LWRmNTNhMWMyMWJiMiIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiIxMjM0NTY3OCIsImdpdmVuX25hbWUiOiJWb2x1bnRhcmlvIiwiZmFtaWx5X25hbWUiOiJGZWxpeiBkYSBWaWRhIiwiaWRlbnRpdGllcyI6W3sicHJvdmlkZXIiOiJjbG91ZF9kaXJlY3RvcnkiLCJpZCI6IjU0NmU5NTk5LWJjMGItNDIxNi04YzljLTQ2N2RjZWQ5NjQ4NCJ9XSwiYW1yIjpbImNsb3VkX2RpcmVjdG9yeSJdfQ.C4_2mj3fx3IwfqH4_O8CR4NtSNpgR7WTbjOz9j1XvrAZS9uiTswMyCn9q8N8pIh6BuP2RTmBhAtnkjAYt0rkHOtEHutf9J79GkpN33-H5P-5k9pqopUuawyFZlfEuH3m76PVnH2XkDUZ1EOTRKrtuHIyYS74tGOYgF8r3hBwjSbFZPTchkNAQmqn5FTgJ6LzUa3xBWt3C1nkvMw3nKrorAUtrsCZXD9PGJKlqJhpZXH9renSRa4KDDwswHzhLGiIghgAmvVoNwOsUWrWbQF88EGDKAkyQRCnTRo2lqdANtYlIwsVitGc9zkje6wDOhjjfZ6g24sj9Id-kK7Sw813aQ";
token.put("name", "Fulando da Silva"/*identityToken.getName()*/);
token.put("email", "fulano#test.com"/*identityToken.getEmail()*/);
token.put("token", t/*identityToken.getRaw()*/);
response = token.toString();
} catch (JSONException e) {
throw new RuntimeException(e);
}
return response;
}
}

Dart if(A is B) condition not working properly

var data = snapshot.data as List;
return ListView.builder(
itemCount: data.length,
itemBuilder: (context, i) {
var item = data[i];
print('instance: $item');
if (item is BookFavorItem) {
return BookItemCard(
bookId: item.bookId,
title: item.title,
author: item.author,
);
} else if (item is BookLentItem) {
return BookItemCard(
bookId: item.bookId,
title: item.title,
author: item.author,
dateRange: '${item.lentDate} - ${item.deadline}',
);
} else {
return ListTile(
title: Text('<$item> not matched'),
);
}
},
);
Console Output
I/flutter ( 6832): instance: Instance of 'BookFavorItem'
I/flutter ( 6832): instance: Instance of 'BookFavorItem'
I/flutter ( 6832): instance: Instance of 'BookFavorItem'
I/chatty ( 6832): uid=10336(com.example.library) 1.ui identical 6 lines
I/flutter ( 6832): instance: Instance of 'BookFavorItem'
I/flutter ( 6832): instance: Instance of 'BookFavorItem'
I/chatty ( 6832): uid=10336(com.example.library) 1.ui identical 5 lines
I/flutter ( 6832): instance: Instance of 'BookFavorItem'
Screen Result
As you can see from the code, I got a variable called item which is an instance of BookFavorItem.
However, when I use condition if( item is BookFavorItem ) to control the flow, it did not work as expected behavior. (I thought this condition should be true, but it didn't)
The evidence is that I got the message of "Instance of BookFavorItem", which is the exact type used for is condition from Debug Console and App Screen
What's wrong with me?
-> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.17.1, on Microsoft Windows [Version 10.0.19041.264], locale zh-CN)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
X Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit visit
https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions.
[!] Android Studio (version 3.6)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.45.1)
[√] Connected device (1 available)

Critical error: Not enough arguments are passed to the wrapper, when loading my xfce plugin

I've written one very simple xfce panel plugin snippet:
#include <gtk/gtk.h>
#include <libxfce4panel/xfce-panel-plugin.h>
static void system_monitor_construct(XfcePanelPlugin *plugin);
XFCE_PANEL_PLUGIN_REGISTER(system_monitor_construct);
static void system_monitor_construct(XfcePanelPlugin *plugin)
{
GtkWidget *hvbox;
GtkWidget *label;
GtkOrientation orientation;
orientation = xfce_panel_plugin_get_orientation (plugin);
hvbox = xfce_hvbox_new (orientation, FALSE, 2);
gtk_widget_show(hvbox);
gtk_container_add (GTK_CONTAINER (plugin), hvbox);
label = gtk_label_new ("Hello GNOME!");
gtk_container_add (GTK_CONTAINER (hvbox), GTK_WIDGET (label));
gtk_widget_show(label);
}
compiled it with:
gcc -Wall -shared -o libtest.so -fPIC main.c `pkg-config --cflags --libs libxfce4panel-1.0` `pkg-config --cflags --libs gtk+-2.0`
copy libtest.so to /usr/lib/xfce4/panel-plugins, and create desktop file test.desktop in /usr/share/xfce4/panel-plugins with the contents:
[Xfce Panel]
Type=X-XFCE-PanelPlugin
Encoding=UTF-8
Name=test
X-XFCE-Module=test
X-XFCE-Module-Path=/usr/lib/xfce4/panel-plugins
When I loading this plugin, I got:
(process:5700): xfce4-panel-wrapper-CRITICAL **: Not enough arguments are passed to the wrapper
xfce4-panel(external): test-8: child exited with status 512
(xfce4-panel:5695): xfce4-panel-WARNING **: Plugin test-8 exited with status 2, removing from panel configuration
xfce4-panel(external): test-8: plugin unrealized; quiting child
xfce4-panel(application): saving /panels/panel-2: ids=true, providers=false
(xfce4-panel:5695): GLib-CRITICAL **: g_child_watch_add_full: assertion 'pid > 0' failed
(xfce4-panel:5695): GLib-GObject-WARNING **: invalid unclassed pointer in cast to 'GtkObject'
(xfce4-panel:5695): exo-CRITICAL **: IA__exo_gtk_object_destroy_later: assertion 'GTK_IS_OBJECT (object)' failed
Where am I wrong? or What things I've missed?
After try and try... This problem is caused by missing of Comment entry in desktop file.

Eclipse can't start after update

After the eclipse update, it can't start up again. Also, it has a warning to check the log.
But I don't know how to fix this problem through the log.
Following is the log.
!SESSION 2012-10-15 08:21:47.367 -----------------------------------------------
eclipse.buildId=M20120914-1800
java.version=1.7.0_01
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32
Command-line arguments: -os win32 -ws win32 -arch x86_64
!ENTRY org.eclipse.equinox.event 2 0 2012-10-15 08:21:48.459
!MESSAGE [SCR] Found components with duplicated names! Details:
Component1 : Component[
name = org.eclipse.equinox.event
activate = activate
deactivate = deactivate
modified =
configuration-policy = optional
factory = null
autoenable = true
immediate = false
implementation = org.eclipse.equinox.internal.event.EventComponent
state = Unsatisfied
properties =
serviceFactory = false
serviceInterface = [org.osgi.service.event.EventAdmin]
references = null
located in bundle = org.eclipse.equinox.event_1.2.100.v20110502 [270]
]
Component2: Component[
name = org.eclipse.equinox.event
activate = activate
deactivate = deactivate
modified =
configuration-policy = optional
factory = null
autoenable = true
immediate = false
implementation = org.eclipse.equinox.internal.event.EventComponent
state = Unsatisfied
properties =
serviceFactory = false
serviceInterface = [org.osgi.service.event.EventAdmin]
references = null
located in bundle = org.eclipse.equinox.event_1.2.200.v20120522-2049 [89]
]
!ENTRY org.eclipse.equinox.p2.transport.ecf 2 0 2012-10-15 08:21:48.474
!MESSAGE [SCR] Found components with duplicated names! Details:
Component1 : Component[
name = org.eclipse.equinox.p2.transport.ecf
activate = activate
deactivate = deactivate
modified =
configuration-policy = optional
factory = null
autoenable = true
immediate = false
implementation = org.eclipse.equinox.internal.p2.transport.ecf.ECFTransportComponent
state = Unsatisfied
properties = {p2.agent.servicename=org.eclipse.equinox.internal.p2.repository.Transport}
serviceFactory = false
serviceInterface = [org.eclipse.equinox.p2.core.spi.IAgentServiceFactory]
references = null
located in bundle = org.eclipse.equinox.p2.transport.ecf_1.0.0.v20111128-0624 [275]
]
Component2: Component[
name = org.eclipse.equinox.p2.transport.ecf
activate = activate
deactivate = deactivate
modified =
configuration-policy = optional
factory = null
autoenable = true
immediate = false
implementation = org.eclipse.equinox.internal.p2.transport.ecf.ECFTransportComponent
state = Unsatisfied
properties = {p2.agent.servicename=org.eclipse.equinox.internal.p2.repository.Transport}
serviceFactory = false
serviceInterface = [org.eclipse.equinox.p2.core.spi.IAgentServiceFactory]
references = null
located in bundle = org.eclipse.equinox.p2.transport.ecf_1.0.100.v20120305-0333 [120]
]
!ENTRY org.eclipse.core.resources 2 10035 2012-10-15 08:21:49.535
!MESSAGE The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes.
!ENTRY org.eclipse.e4.ui.workbench 4 0 2012-10-15 08:21:52.000
!MESSAGE Unable to create class 'org.eclipse.e4.core.commands.CommandServiceAddon' from bundle '53'
!STACK 0
org.eclipse.e4.core.di.InjectionException: java.lang.ClassCastException: Cannot cast org.eclipse.core.commands.CommandManager to org.eclipse.core.commands.CommandManager
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:859)
at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:111)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:319)
at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:253)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:185)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:105)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:71)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:49)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:254)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:557)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
Caused by: java.lang.ClassCastException: Cannot cast org.eclipse.core.commands.CommandManager to org.eclipse.core.commands.CommandManager
at java.lang.Class.cast(Unknown Source)
at org.eclipse.e4.core.internal.contexts.EclipseContext.get(EclipseContext.java:566)
at org.eclipse.e4.core.commands.CommandServiceAddon.init(CommandServiceAddon.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
... 27 more
Basically, it just a part in the log file. From here, I found some post and tried:
1) eclipse -clean
2) delete .snap
3) delete workbench.xmi
4) rename org.eclipse.core.resources
etc..
Unfortunately, they are not work.
go to
Your installation path\configuration\org.eclipse.equinox.simpleconfigurator\
Backup file bundle.info
remove the duplicate entry for "org.eclipse.core.commands" from the file bundle.info
I removed the entry with the lower version.
restart the eclipse with option -clean and you should be fine
i have the same problem, after i updated my pydev.
i re-extract JUNO to my installation dir
problem solved
Try this:
Go into damaged workspace/.metadata and delete the .lock file.
Go to workspace/.metadata/.plugins/org.eclipse.core.resources and delete the .snap file.
Start Eclipse with the command eclipse -clean.
Eclipse should start now. After Eclipse has been started and has initialized and validated the workspace, close Eclipse.
Check the "Name" of your ComponentDefinitions in the Overview Tab(*.xml)
If there are two ComponentDefinitions with different File names but the same "Name"-value in the Overview Tab, then this error occurs.