The following java code lists all the bare metal servers in softlayer for a specific SL account and filters for servers which are powered on (e.g. powerState='on'.
public void listServers(Account.Service service, ApiClient client) throws Exception {
service.withMask().hardware().fullyQualifiedDomainName().primaryIpAddress();
service.withMask().hardware().hardwareStatus();
service.withMask().hardware().id();
Account account = service.getObject();
//
// list of softlayer servers for the client account
//
for (Hardware hardware : account.getHardware()) {
String hostname = hardware.getFullyQualifiedDomainName();
String hardwareStatus = (hardware.getHardwareStatus() == null) ? null : hardware.getHardwareStatus().getStatus();
Long serverId = hardware.getId();
String powerState = null;
if (serverId != null) {
Hardware.Service hardwareService = Hardware.service(client, serverId);
hardwareService.setMask("mask[serverPowerState");
try {
powerState = hardwareService.getServerPowerState();
} catch (Exception ex) {
System.out.println("Error, cannot get powerState, hostname=" + hostname + ", msg=" + ex.getMessage());
}
}
System.out.println("Hostname=" + hostname + ", hwStatus=" + hardwareStatus + ", powerState=" + powerState);
}
}
Code seems to work, but for at least one of the servers, it fails on the call to hardwareService.getServerPowerState()
"Unable to establish IPMI v2 / RMCP+ session".
Any ideas why this is failing ?
Related
On my app log in process, I have a service that get the latest datas from aws amplify
DataStore Events
private String processName = "Checking network status...";
private SubscriptionToken subscriptionToken;
public void sync() {
AmplifyDataStoreManager.start();
subscriptionToken = Amplify.Hub.subscribe(
HubChannel.DATASTORE,
hubEvent -> DataStoreChannelEventName.NETWORK_STATUS.toString().equals(hubEvent.getName()) ||
DataStoreChannelEventName.SUBSCRIPTION_DATA_PROCESSED.toString().equals(hubEvent.getName()) ||
DataStoreChannelEventName.MODEL_SYNCED.toString().equals(hubEvent.getName()) ||
DataStoreChannelEventName.READY.toString().equals(hubEvent.getName()),
hubEvent -> {
Log.d("DataStore - Hub Event Name: " + hubEvent.getName());
if (hubEvent.getData() != null) {
Log.d("DataStore - Hub Event Data: " + hubEvent.getData());
}
if (DataStoreChannelEventName.NETWORK_STATUS.toString().equals(hubEvent.getName())) {
NetworkStatusEvent networkStatusEvent = (NetworkStatusEvent) hubEvent.getData();
if (networkStatusEvent != null && !networkStatusEvent.getActive()) {
onProcessError("Device not connected to internet");
}
} else if (DataStoreChannelEventName.SUBSCRIPTION_DATA_PROCESSED.toString().equals(hubEvent.getName())) {
ModelWithMetadata modelWithMetadata = ((ModelWithMetadata) hubEvent.getData());
ModelMetadata modelMetadata = modelWithMetadata.getSyncMetadata();
Log.d("DataStore - Model ID: " + modelWithMetadata.getModel().getId());
Log.d("DataStore - Model Name: " + modelWithMetadata.getModel().getModelName());
processName = "Syncing " + modelWithMetadata.getModel().getModelName() + "...";
EventBus.getDefault().post(new ProcessEvent(this));
if (TextUtils.equals(AmplifyDataModel.Transaction.name(), modelWithMetadata.getModel().getModelName()) && (modelMetadata.isDeleted() == null || !modelMetadata.isDeleted())) {
AppAmplifyDataAccessManager.saveAppTransaction(AppAmplifyConfiguration.getDataSyncManager().mapAppTransaction(modelWithMetadata.getModel()));
} else if (TextUtils.equals(AmplifyDataModel.Configuration.name(), modelWithMetadata.getModel().getModelName()) && (modelMetadata.isDeleted() == null || !modelMetadata.isDeleted())) {
AppAmplifyConfiguration.getDataSyncManager().mapConfigurations(modelWithMetadata.getModel());
}
} else if (DataStoreChannelEventName.MODEL_SYNCED.toString().equals(hubEvent.getName())) {
ModelSyncedEvent modelSyncedEvent = (ModelSyncedEvent) hubEvent.getData();
if (modelSyncedEvent != null) {
processName = "Syncing " + modelSyncedEvent.getModel() + "...";
EventBus.getDefault().post(new ProcessEvent(this));
}
} else {
Amplify.Hub.unsubscribe(subscriptionToken);
onProcessCompleted();
}
}
);
}
Configuration Model data sample:
double grandTotal;
aws configuration: grandTotal = 100;
local configuration: grandTotal = 100;
The scenario is, the device is offline, did transaction, local configuration: grandTotal is now 200. The sync configuration is called and enqueued because the device is offline.
Closed the app, the internet is back, opens the app, in the login process, sync() method is called. What happens is the local configuration: grandTotal is 100 again, because of sync(), then after that, the enqueued sync when the device is offline runs(but I was not able to debug this, its not going to the sync method of configuration). And the result is:
aws configuration: grandTotal = 200;
local configuration: grandTotal = 100;
What I want is if there is a pending sync, do that first before syncing aws data to local.
After reading DataStoreChannelEventName enum descriptions, I tried adding OUTBOX_STATUS and fixed my problem, I'm not sure how but I tested all the scenario and its working.
else if (DataStoreChannelEventName.OUTBOX_STATUS.toString().equals(hubEvent.getName())){
OutboxStatusEvent outBoxStatusEvent = (OutboxStatusEvent) hubEvent.getData();
if (outBoxStatusEvent != null) {
Log.d("DataStore - Hub Event Data: " + hubEvent.getData());
}
I want to discover all the destinations from solace (queues and topics)
I tried using MBeanServerConnection and query after names (but I didn't find a proper way to use this) or JNDI lookups Destination dest = (Destination) context.lookup(Dest_name), but I don't have the names of the queues/topics.
I am using solace - jms library.
I am searching for smth like this: (but for solace, not activeMq)
get all Queue from activeMQ
You will need to make use of SEMP over the management interface for this.
Sample commands:
curl -d '<rpc><show><queue><name>*</name></queue></show></rpc>' -u semp_username:semp_password http://your_management_ip:your_management_port/SEMP
curl -d '<rpc><show><topic-endpoint><name>*</name></topic-endpoint></show></rpc>' -u semp_username:semp_password http://your_management_ip:your_management_port/SEMP
Note that I'm using curl for simplicity, but any application can perform HTTP POSTs to execute these commands.
If you are using Java, you can refer to the SempHttpSetRequest sample found within the Solace API samples.
Documentation on SEMP can be found here.
However, the larger question here is why do you need to discover all destinations?
One of the features of the message broker is to decouple the publishers and consumers.
If you need to know if your persistent message is being published to a topic with no consumers, you can make use of the reject-msg-to-sender-on-no-subscription-match setting in the publishing application's client-profile.
This means that the publisher will obtain a negative acknowledgement in the event that it tries to publish a message on a topic that has no matching subscribers.
You can refer to "Handling Guaranteed Messages with No Matches" at https://docs.solace.com/Configuring-and-Managing/Configuring-Client-Profiles.htm for further details.
Here is some source code that might help. With the appliance configured correctly, SEMP is also available over JMS on topic "#SEMP/(router)/SHOW".
/**
* Return the SolTopicInfo for this topic (or all topics if 'topic' is null).
*
* #param session
* #param endpointName
* #return
*/
public static SolTopicInfo[] getTopicInfo(JCSMPSession session, String endpointName, String vpn,
String sempVersion) {
XMLMessageConsumer cons = null;
XMLMessageProducer prod = null;
Map<String, SolTopicInfo> tiMap = new HashMap<String, SolTopicInfo>();
try {
// Create a producer and a consumer, and connect to appliance.
prod = session.getMessageProducer(new PubCallback());
cons = session.getMessageConsumer(new SubCallback());
cons.start();
if (vpn == null) vpn = (String) session.getProperty(JCSMPProperties.VPN_NAME);
if (sempVersion == null) sempVersion = getSempVersion(session);
// Extract the router name.
final String SEMP_SHOW_TE_TOPICS = "<rpc semp-version=\""
+ sempVersion
+ "\"><show><topic-endpoint><name>"
+ endpointName
+ "</name><vpn-name>"+ vpn + "</vpn-name></topic-endpoint></show></rpc>";
RpcReply teTopics = sendRequest(session, SEMP_SHOW_TE_TOPICS);
for (TopicEndpoint2 te : teTopics.getRpc().getShow().getTopicEndpoint().getTopicEndpoints()
.getTopicEndpointArray()) {
SolTopicInfo ti = new SolTopicInfo();
ti.setBindCount(te.getInfo().getBindCount());
//qi.setDescription(qt.getInfo().getNetworkTopic());
ti.setEndpoint(te.getName());
ti.setMessageVPN(te.getInfo().getMessageVpn());
ti.setTopic(te.getInfo().getDestination());
ti.setDurable(te.getInfo().getDurable());
ti.setInSelPres(te.getInfo().getIngressSelectorPresent());
ti.setHwmMB(formatter.format(te.getInfo().getHighWaterMarkInMb()));
ti.setSpoolUsageMB(formatter.format(te.getInfo().getCurrentSpoolUsageInMb()));
ti.setMessagesSpooled(te.getInfo().getNumMessagesSpooled().longValue());
String status = te.getInfo().getIngressConfigStatus().substring(0, 1).toUpperCase();
status += " " + te.getInfo().getEgressConfigStatus().substring(0, 1).toUpperCase();
status += " " + te.getInfo().getIngressSelectorPresent().substring(0, 1).toUpperCase();
status += " " + te.getInfo().getType().substring(0, 1).toUpperCase();
ti.setStatus(status);
tiMap.put(ti.getEndpoint(), ti);
}
} catch (JCSMPException e) {
throw new RuntimeException(e.getMessage(), e);
} finally {
if (cons != null)
cons.close();
if (prod != null)
prod.close();
}
return tiMap.values().toArray(new SolTopicInfo[0]);
}
/**
* Return the SolQueueInfo for this queue (or all queues if 'queue' is null).
*
* #param session
* #param queue
* #param vpn (if null, use the session's vpn name)
* #param sempVersion, if null use 'soltr/7_1_1'
* #return
*/
public static SolQueueInfo[] getQueueInfo(JCSMPSession session, String queue, String vpn,
String sempVersion) {
XMLMessageConsumer cons = null;
XMLMessageProducer prod = null;
Map<String, SolQueueInfo> qiMap = new HashMap<String, SolQueueInfo>();
try {
// Create a producer and a consumer, and connect to appliance.
prod = session.getMessageProducer(new PubCallback());
cons = session.getMessageConsumer(new SubCallback());
cons.start();
if (vpn == null) vpn = (String) session.getProperty(JCSMPProperties.VPN_NAME);
if (sempVersion == null) sempVersion = getSempVersion(session);
// Extract the router name.
final String SEMP_SHOW_QUEUE_SUBS = "<rpc semp-version=\""
+ sempVersion
+ "\"><show><queue><name>"
+ queue
+ "</name><vpn-name>"+ vpn + "</vpn-name><subscriptions/><count/><num-elements>200</num-elements></queue></show></rpc>";
RpcReply queueSubs = sendRequest(session, SEMP_SHOW_QUEUE_SUBS);
for (QueueType qt : queueSubs.getRpc().getShow().getQueue().getQueues().getQueueArray()) {
SolQueueInfo qi = new SolQueueInfo();
qi.setBindCount(qt.getInfo().getBindCount());
//qi.setDescription(qt.getInfo().getNetworkTopic());
qi.setName(qt.getName());
qi.setMessageVPN(qt.getInfo().getMessageVpn());
qi.setDurable(qt.getInfo().getDurable());
qi.setEgSelPres(qt.getInfo().getEgressSelectorPresent());
qi.setHwmMB(formatter.format(qt.getInfo().getHighWaterMarkInMb()));
qi.setMessagesSpooled(qt.getInfo().getNumMessagesSpooled().longValue());
qi.setSpoolUsageMB(formatter.format(qt.getInfo().getCurrentSpoolUsageInMb()));
String status = qt.getInfo().getIngressConfigStatus().substring(0, 1).toUpperCase();
status += " " + qt.getInfo().getEgressConfigStatus().substring(0, 1).toUpperCase();
status += " " + qt.getInfo().getAccessType().substring(0, 1).toUpperCase();
status += " " + qt.getInfo().getEgressSelectorPresent().substring(0, 1).toUpperCase();
status += " " + qt.getInfo().getType().substring(0, 1).toUpperCase();
status += qt.getInfo().getDurable() ? " D" : " N";
qi.setStatus(status);
for (Subscription sub : qt.getSubscriptions().getSubscriptionArray()) {
qi.addSubscription(sub.getTopic());
}
qiMap.put(qi.getName(), qi);
}
} catch (JCSMPException e) {
throw new RuntimeException(e.getMessage(), e);
} finally {
if (cons != null)
cons.close();
if (prod != null)
prod.close();
}
return qiMap.values().toArray(new SolQueueInfo[0]);
}
private static String getSempVersion(JCSMPSession session)
{
String retval = "soltr/7_1_1";
try {
String peerVersion = (String)session.getCapability(CapabilityType.PEER_SOFTWARE_VERSION);
if (peerVersion != null)
{
retval = "soltr/";
String[] version = peerVersion.split("\\.");
retval += version[0];
retval += "_" + version[1];
if (!version[2].equals("0")) retval += "_" + version[2];
}
} catch (Throwable e) {
System.err.println(e);
}
return retval;
}
private static RpcReply sendRequest(JCSMPSession session,
final String requestStr) {
try {
// Set up the requestor and request message.
String routerName = (String) session
.getCapability(CapabilityType.PEER_ROUTER_NAME);
final String SEMP_TOPIC_STRING = String.format("#SEMP/%s/SHOW",
routerName);
final Topic SEMP_TOPIC = JCSMPFactory.onlyInstance().createTopic(
SEMP_TOPIC_STRING);
Requestor requestor = session.createRequestor();
BytesXMLMessage requestMsg = JCSMPFactory.onlyInstance().createMessage(
BytesXMLMessage.class);
requestMsg.writeAttachment(requestStr.getBytes());
BytesXMLMessage replyMsg = requestor
.request(requestMsg, 5000, SEMP_TOPIC);
String replyStr = new String();
if (replyMsg.getAttachmentContentLength() > 0) {
byte[] bytes = new byte[replyMsg.getAttachmentContentLength()];
replyMsg.readAttachmentBytes(bytes);
replyStr = new String(bytes, "US-ASCII");
}
RpcReplyDocument doc = RpcReplyDocument.Factory.parse(replyStr);
RpcReply reply = doc.getRpcReply();
if (reply.isSetPermissionError()) {
throw new RuntimeException(
"Permission Error: Make sure SEMP over message bus SHOW commands are enabled for this VPN");
}
if( reply.isSetParseError() ) {
throw new RuntimeException( "SEMP Parse Error: " + reply.getParseError() );
}
if( reply.isSetLimitError() ) {
throw new RuntimeException( "SEMP Limit Error: " + reply.getLimitError() );
}
if( reply.isSetExecuteResult() && reply.getExecuteResult().isSetReason() ) { // axelp: encountered this error on invalid 'queue' name
throw new RuntimeException( "SEMP Execution Error: " + reply.getExecuteResult().getReason() );
}
return reply;
} catch (JCSMPException e) {
throw new RuntimeException(e.getMessage(), e);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e.getMessage(), e);
} catch (XmlException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
You can get message VPN specific queues and topics using following SEMPv2 command.
curl -s -X GET -u semp_user:semp_pass management_host:management_port/SEMP/v2/monitor/msgVpns/{vpn-name}/queues?select="queueName"
curl -s -X GET -u semp_user:semp_pass management_host:management_port/SEMP/v2/monitor/msgVpns/{vpn-name}/topicEndpoints?select="topicEndpointName"
I Know this question has been asked multiple times, but I couldn't find one working for me.
Basically I am trying to get a youtube video basic info which I get the proper result for that but then when I trigger to get the comments of that video the error pops out saying:
There was a service error: 403 : Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.
My code:
public String getyoutubeitemfull_details(String URI) throws SQLException, IOException{
try {
YouTube youtube = new YouTube.Builder(Auth.HTTP_TRANSPORT, Auth.JSON_FACTORY, new HttpRequestInitializer() {
#Override
public void initialize(HttpRequest request) throws IOException {
}
}).setApplicationName("APP_ID").build();
String apiKey = "API Key";
YouTube.Videos.List listVideosRequest = youtube.videos().list("statistics");
listVideosRequest.setId("qUvPzjSWMSM");
listVideosRequest.setKey(apiKey);
VideoListResponse listResponse = listVideosRequest.execute();
Video video = listResponse.getItems().get(0);
BigInteger viewCount = video.getStatistics().getViewCount();
BigInteger Likes = video.getStatistics().getLikeCount();
BigInteger DisLikes = video.getStatistics().getDislikeCount();
BigInteger Comments = video.getStatistics().getCommentCount();
System.out.println("[View Count] " + viewCount);
System.out.println("[Likes] " + Likes);
System.out.println("[Dislikes] " + DisLikes);
System.out.println("[Comments] " + Comments);
CommentThreadListResponse videoCommentsListResponse = youtube.commentThreads()
.list("snippet").setVideoId("qUvPzjSWMSM").setMaxResults(50l).setTextFormat("plainText").execute();
List<CommentThread> videoComments = videoCommentsListResponse.getItems();
for (CommentThread videoComment : videoComments) {
CommentSnippet snippet = videoComment.getSnippet().getTopLevelComment().getSnippet();
System.out.println(" - Author: " + snippet.getAuthorDisplayName());
System.out.println(" - Comment: " + snippet.getTextDisplay());
System.out.println("\n-------------------------------------------------------------\n");
}
} catch (GoogleJsonResponseException e) {
System.err.println("There was a service error: " + e.getDetails().getCode() + " : "
+ e.getDetails().getMessage());
} catch (IOException e) {
System.err.println("There was an IO error: " + e.getCause() + " : " + e.getMessage());
} catch (Throwable t) {
t.printStackTrace();
}
return null;
}
FYI: So much of question that I have been through so far talk about adding listVideosRequest.setKey(apiKey); which I have it done. I also Have enable OAuth 2.0 enabled in my google console.
Thanks to #DalmTo for throwing to its direction.
Basically Api Key doesn't have priviledges to retrieve comments and things like that. for deep priviledges I had to use Oauth, which basically is being created the same was as API Key but in Oauth you receive a client_secrets.json file containing: client secret, client ID and etc...
Then you call that in you code.
Note: Their is verious ways of calling you client_secrets.json file but it depends on your need.
My way: Reader clientSecretReader = new InputStreamReader(
new FileInputStream("/home/Downloads/src/client_secrets.json"));
I have a web app which uses JNDI for connection polling (DB server is MySql),
There is many request to web application and it has a web service used by one other web application.
It work fine but after a while in not works and after some no-processed commands in web service, the error below appears:
java.sql.SQLException: Cannot get a connection, general error
javax.naming.NameNotFoundException: Name [java:/comp/env] is not bound in this Context. Unable to find [java:].
I copy app aout put in below.
please notice i force app to print "+++++=====>>>> number of connection X"
when for new connection ( if it was new connection X increased)
and after closing connection "------=====>>>> number of connection X"
note 2: Whenever web service is called a "%%%%>>>>> web Service request for" string will be printed in the out put and then a "SELECT" command will run and print in the out put,but when system crashed the request to the web service received, but not proceed.
So look up for "+++++=====>>>>" and "+++++=====>>>>" and pay attention in defrence between "%%%%>>>>> web Service request for" in the beginning and at the end.
The out put is like below:
java out put file
public void close() throws SQLException {
connection.close();
counter--;
ServerLog.Print("------=====>>>> number of connection " + counter);
ServerLog.Print("Database connection is closed ...");
}
This are some methods in below:
public jjDatabaseWeb() throws SQLException, NamingException {
ctx = new InitialContext();
Context initCtx = (Context) ctx.lookup("java:/comp/env");
DataSource ds = (DataSource) initCtx.lookup("jdbc/MyDB");
connection = ds.getConnection();
counter++;
ServerLog.Print("+++++=====>>>> number of connection " + counter);
}
And in below is web service method that which calls whit other services in LAN :
/**
* this Method returns a string result; if(result =="" OR result==null){ do
* your work }else{ show user result as message (result is HTML ) }
*
* #param stdNubmer
* #param nationalId Is not important
* #return String result (as HTML )
* #throws javax.naming.NamingException
*/
#WebMethod(operationName = "studentCheck")
public String studentCheck(#WebParam(name = "stdNubmer") String stdNubmer, #WebParam(name = "nationalId") String nationalId) {
try {
ServerLog.Print("%%%%>>>>> web Service request for :" + stdNubmer);
try {
jjDatabaseWeb db = new jjDatabaseWeb();
DefaultTableModel dtm = db.Select(StdInfo.tableName, StdInfo._step + "," + StdInfo._alerts + "," + StdInfo._lastAertDate + "," + StdInfo._name + "," + StdInfo._family, StdInfo._stdNumber + "=" + stdNubmer);
List<Map<String, Object>> row = jjDatabaseWeb.separateRow(dtm);
db.close();//
if (row.size() == 1) {
if (!row.get(0).get(StdInfo._step).toString().equalsIgnoreCase("5")) {
int date = new jjCalendar_IR().getDBFormat_8length();
int lastAlertDate = Integer.parseInt(row.get(0).get(StdInfo._lastAertDate).toString());
int alerts = Integer.parseInt(row.get(0).get(StdInfo._alerts).toString());
if ((date - 5) <= lastAlertDate) {
return "";
}
StringBuilder html = new StringBuilder("");
html.append("<HTML>...</HTML>");
return html.toString();
}
}
return "";
} catch (NamingException ex) {
Logger.getLogger(csaWebService.class.getName()).log(Level.SEVERE, null, ex);
}
} catch (SQLException ex) {
Logger.getLogger(csaWebService.class.getName()).log(Level.SEVERE, null, ex);
ServerLog.Print(ex);
Server.ErrorHandler(ex);
return "";
}
return "";
}
}
There was so many connections that witch opened and not closed .
Be careful about close() for connections.
When I try to save a captured image into Google Drive, I get the following error:
java.lang.IllegalArgumentException: the name must not be empty: null
at android.accounts.Account.<init>(Account.java:48)
at com.google.android.gms.auth.zzd.getToken(Unknown Source)
at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential.getToken(GoogleAccountCredential.java:255)
at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential$RequestHandler.intercept(GoogleAccountCredential.java:279)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:859)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
at com.amrutpatil.makeanote.GDActions.search(GDActions.java:290)
at com.amrutpatil.makeanote.GDActions.search(GDActions.java:211)
I can successfully sign in and select a folder on Google Drive, however, when I try to save an image, I get the issue above.
I am currently running Marshmallow on a Nexus 6 physical device.
My GDActions.java code:
private static ArrayList<GF> search(ArrayList<GF> gfs, com.google.api.services.drive.Drive.Files.List qry) throws IOException {
String npTok = null;
if (qry != null) do {
FileList gLst = qry.execute(); //get an error here
if (gLst != null) {
for (File gFl : gLst.getItems()) {
if (gFl.getLabels().getTrashed()) continue;
gfs.add(new GF(gFl.getTitle(), gFl.getId()));
}
npTok = gLst.getNextPageToken();
qry.setPageToken(npTok);
}
} while (npTok != null && npTok.length() > 0);
return gfs;
}
I get an error at FileList gLst = qry.execute() above.
This happens when the search method is invoked here:
static ArrayList<GF> search(String prId, String titl, String mime) {
ArrayList<GF> gfs = new ArrayList<>();
String qryClause = "'me' in owners and ";
if (prId != null) qryClause += "'" + prId + "' in parents and ";
if (titl != null) qryClause += "title = '" + titl + "' and ";
if (mime != null) qryClause += "mimeType = '" + mime + "' and ";
qryClause = qryClause.substring(0, qryClause.length() - " and ".length());
com.google.api.services.drive.Drive.Files.List qry = null;
try {
qry = mGOOSvc.files().list().setQ(qryClause)
.setFields("items(id, labels/trashed, title), nextPageToken");
gfs = search(gfs, qry);
} catch (GoogleAuthIOException gaiEx) {
try {
gfs = search(gfs, qry); //Invoked here
} catch (Exception g) {
GDUT.le(g);
}
} catch (Exception e) {
GDUT.le(e);
}
return gfs;
}
java.lang.IllegalArgumentException: the name must not be empty: null.
The "name" it is referring to is the account name. Ensure that you are setting the GoogleAccountCredential object.
mAccountCredential.setSelectedAccountName("user123#gmail.com");
Note: Set the account name as the full email; user123#gmail.com, instead of just user123.
Turns out that there was a permissions issue. Although I had GET_ACCOUNTS permission set in my AndroidManifest.xml file, I needed to manually enable Contacts permissions in my app settings.
It may be a device specific issue as I was running my app on a Nexus 6 physical device with Android Marshmallow 6.0.1.
You might want to check you app settings just to be safe.