how to give file uri in build method of docusign android sdk - docusignapi

i am trying to pass uri as
File file = new File(Environment.getExternalStorageDirectory(), "/c4611_sample_explain.pdf");
Log.e( "error" ,file.toURI().toString());/in logcat E/error:file:/storage/emulated/0/c4611_sample_explain.pdf/
.uri (file.toURI().toString())
.name("c4611_sample_explain.pdf")
in build method of docusign android sdk however its giving me error
11121-11121/com.example.docusignapp E/main: Unknown exception in loading document: File not found at specified URI.
tried
.uri("file:///storage/emulated/0/c4611_sample_explain.pdf")
.name("c4611_sample_explain.pdf")
also tried
.uri("file:///storage/emulated/0")
.name("c4611_sample_explain.pdf")
In android phone file is in path /storage/emulated/0/downloads
kindly help

Can you try the following:
File file = new File(Environment.getExternalStorageDirectory(), "/c4611_sample_explain.pdf");
URI fileURI = file.toURI();
Then,
.uri(fileURI.toString());

Related

java.io.FileNotFoundException: Resource not found: /credentials.json on Java QuickStart for Classroom API

I have implemented the Java QuickStart for the Classroom API and am getting an error message "java.io.FileNotFoundException: Resource not found: /credentials.json" at run-time. I copied my credentials.json file to the Project res directory, but continue to get this error. Any suggestions?
I tried it in a different way than I found on other websites, and it worked for me.
replace below code:
InputStream in = GoogleSheetAPIHandler.class.getClass().getResourceAsStream(CREDENTIALS_FILE_PATH);
With this code:
InputStream in = new FileInputStream(CREDENTIALS_FILE_PATH);
You need to import credential.json file into the src/main/resources folder in eclipse. You may be included in the project folder. But you need to import it into eclipse.
locate your credentials.json file in the folder.
click and drag it
drop it in src/main/resource and click ok.
After importing into eclipse it should show like the below image.
There are two steps needed to find the resource in Eclipse:
To have the file in the resources folder
Create the resource folder (if it does not exist): src/main/resouces
Add the credential file to the resource folder: src/main/resouces/credential.json
To have the resources folder in the Source Java Build Path
Go to Eclipse Path Source: Project > Properties > Java Build Path > Source (tab)
Add resources folder: Add Folder ... (button) > resources (check box) > OK (button)
https://stackoverflow.com/a/46950488/10850340
The name of your file has to be credentials only, if you have credentials.json as the name of your file in your folder you will get this error.

Flutter: Permission denied writing file

I am having a problem writing a file in Flutter. I keep getting this error:
FileSystemException: Cannot create file, path = '/data/local/tmp/temp.png' (OS Error: Permission denied, errno = 13)
For some reason, it's only happening on some devices. I can't seem to duplicate the problem myself, but people are reporting it to me.
Here's the basic code:
final Io.Directory systemTempDir = Io.Directory.systemTemp;
final Io.File file = await new Io.File('${systemTempDir.path}/temp.png').create();
file.writeAsBytes(finalImage);
In Android Q, just add the Following Lines in AndroidManifest file:
<application
android:requestLegacyExternalStorage="true"
There may be a problem with the paths depending on the device being used. Have a look at the path_provider plugin: https://pub.dartlang.org/packages/path_provider
There's a good write-up of how to read and write files in the Flutter Cookbook on flutter.io: https://flutter.io/cookbook/persistence/reading-writing-files/
final Io.Directory systemTempDir = Io.Directory.systemTemp; seems to not work in release mode.
I had to do as below:
Directory tempDir = await getTemporaryDirectory();
final File file = File("${tempDir.path}/$fileName");
getTemporaryDirectory() is provided by path_provider.

How to define a file in Kotlin

I need to use a xml file in my code,
in Java it looks like this:
File inputFile = new File("test.xml"); //Path: C:\Users\...
however, when i try the same in kotlin, it does not work:
val inputFile = File("test.xml")
I always get an "File not found" exception.
I can't find anything on google on how to include files with Kotlin.
val inputStream: InputStream = File("test.xml").inputStream()
val inputString = inputStream.bufferedReader().use { it.readText() }
println(inputString)
Source : kotlination.com
The file must be in the root of your project, the same folder containing your src/ folder.
These should give the exact same results, if you run both with the same working directory. You can check or set the working directory (relative to which file.xml will be looked for) in the Run/Debug configuration.
Since you have Android Studio tag: if you are creating an Android application/library and want the file to be included with it, you should read https://developer.android.com/guide/topics/resources/index.html.

%AddJar for hellospark_2.10-1.0.jar giving Name: java.util.zip.ZipException Message

I am trying to run AddJar in my new notebook in ibm bluemix.
%AddJar https://github.com/ibm-cds-labs/spark.samples/blob/master/dist/helloSpark-assembly-2.1.jar -f
However, I keep receiving this error -
Starting download from https://github.com/ibm-cds-labs/spark.samples/blob/master/dist/helloSpark-assembly-2.1.jar
Finished download of helloSpark-assembly-2.1.jar
Out[8]:
Name: java.util.zip.ZipException
Message: error in opening zip file
StackTrace: java.util.zip.ZipFile.open(Native Method)
java.util.zip.ZipFile.<init>(ZipFile.java:235)
java.util.zip.ZipFile.<init>(ZipFile.java:165)
java.util.zip.ZipFile.<init>(ZipFile.java:179)
I tried all sort of URLs - raw, file etc. as specified in this other link, but no help.
%AddJar for hellospark_2.10-1.0.jar giving Name: java.util.zip.ZipException Message: error in opening zip file
Please advice.
Thanks
Raj
Your URL points to an HTML page with a download button. You must use a URL that points to the actual JAR file instead. I got it by right-clicking on the download button and selecting "Copy Link Address". The URL has /raw/ instead of /blob/ in the path:
%AddJar https://github.com/ibm-cds-labs/spark.samples/raw/master/dist/helloSpark-assembly-2.1.jar -f
That line "worked" for me, in the sense that I got a totally different error messages on the first try: Assertion failed. After restarting the kernel and re-executing the %AddJar, the error was gone. Maybe my service didn't have the download directory yet when I executed the line for the first time.

Using groovy-wslite in SoapUI

I'm using SoapUI version 4.5.1 on a Windows 7 box to create a mock webservice. It includes a Groovy script that is fired at an OnRequest event which attempts to create and send a second response.
The issue is to do with the installation of the groovy-wslite library, which I'm trying to use in order to instantiate a SoapClient object which sends the additional response.
If I include the following at the top of the script (as per the wslite github site at https://github.com/jwagenleitner/groovy-wslite):
#Grab(group='com.github.groovy-wslite', module='groovy-wslite', version='0.7.1')
... I get the following error:
java.lang.NoClassDefFoundError: org/apache/ivy/core/settings/IvySettings
If I remove it from the script, I get the following error:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script6.groovy: 23: unable to resolve class SOAPClient # line 23, column 18.
def client = new SOAPClient(clientURL)
^
org.codehaus.groovy.syntax.SyntaxException: unable to resolve class SOAPClient # line 23, column 18.
Can anyone suggest what I'm doing wrong, please? Do I need to install groovy-wslite separately within SoapUI?
Thanks in advance for any advice.
I have downloaded the groovy-wslite jar and added it to my SoapUI installation's bin/ext directory.

Resources