java-curl icon indicating copy to clipboard operation
java-curl copied to clipboard

cURL Upload File - Illegal reflective access Error

Open MarcWoodyard opened this issue 5 years ago • 0 comments

I'm trying to upload a file using cURL and I keep getting an illegal reflective access error message.

Code:

PrintWriter writer = new PrintWriter("ptz-move.xml", StandardCharsets.UTF_8);
writer.println("<PTZData><pan>-50</pan><tilt>0</tilt><speed>1</speed></PTZData>");
writer.close();

CUrl curl = new CUrl("http://" + username + ":" + password + "@" + ip + "/PTZCtrl/channels/1/Continuous");
curl.opt("-X", "PUT");
curl.form("file", new CUrl.FileIO(new File("ptz-move.xml").getAbsolutePath()));
curl.exec();

Error Message:

WARNING: Illegal reflective access by com.roxstudio.utils.CUrl$Util (file:/home/user/code-projects/project/lib/java-curl/java-curl-1.2.2.2.jar) to field sun.net.www.protocol.http.HttpURLConnection.responses
WARNING: Please consider reporting this to the maintainers of com.roxstudio.utils.CUrl$Util
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

When I run this command on Linux, it works as it's expected to.

curl -X PUT -T /home/user/desktop/ptz-move.xml http://username:[email protected]/PTZCtrl/channels/1/Continuous

MarcWoodyard avatar Feb 23 '20 00:02 MarcWoodyard