JavaMail api: error on copyMessages - jakarta-mail

We are using javamail-1.4.5-mailapi.jar to copy messages from a folder to another:
_folder.copyMessages(new Message[] { getMail().getMessage() }, destination);
Where getMail().getMessage() returns a MimeMessage,
This function used to work a long time ago (maybe with older version of javamail jars), but recently it is throwing this error:
javax.mail.internet.MimeMessage cannot be cast to com.sun.mail.imap.IMAPMessage
Does anyone know what is causing this issue?
Thank you,
Karine

Just ran across a very closely related issue myself. I had to set a header on a message and then copy it to a folder, which meant I had to create a MimeMessage copy of an IMAPMessage and then set the header and then copy it. What I did, and I have to admit it's counter-intuitive, was to cast the folder to an IMapFolder:
((IMAPFolder)_folder).copyMessages(new Message[] { getMail().getMessage() }, destination);
should work for you. Still this should not be necessary, but this seems a fairly safe workaround.

Related

Could not find file 'C:\Users\crims\AppData\Local\Microsoft\VisualStudio\10.0\ProjectAssemblies\...\MonitoringSystemDatabase.mdb'

I have a Menu Form and it has 7 UserControls every time I execute my program I keep seeing this error.
I have no idea what error is this. I tried searching but there are no error close related to mine. Then I compare my error with this Project Assemblies error
Can anyone help me with this? I have no idea what causes this error.
The error is caused by your code looking for the MS Access database file called:
MonitoringSystemDatabase.mdb
...is located at path:
C:\Users\crims\AppData\Local\Microsoft\VisualStudio\10.0\ProjectAssemblies\cjz5kapb01\
...but it is not.
Locate file MonitoringSystemDatabase.mdb (perhaps with +E to Search), note the actual path of the file, and correct the path in MainMenu.vb.
The error message is very clear, so why all the searching?
Either the file isn't there, or the application can't see it where it expects to find it.
Try moving the file to:
C:\Users\Public\Documents\MonitoringSystemDatabase.mdb
and adjust you project accordingly.

Error listing directory: Invalid Argument to date encode [3082-80-91]

Currently working with WinSCP through the command line. Simple process that when run, copies remote files to local directory. I get a good way through the first-time download of files when I encounter this error:
Error listing directory '/FE_HDD_SyncFolder/Diags Old PC and Tape/DIAGS NON DG/QAPLUS 5.5 pc diags'.
Unexpected directory listing line 'EMM386.EXE////120926/0/0/3082/80/91/40/24/1/1/1'.
Invalid argument to date encode [3082-80-91]
(A)bort, (R)etry, (S)kip: Abort
I am unsure what it means and I can't find any other questions here that give a straight answer to what this error means. Is the [3082-80-91] the error code or the date that the code is reaching and reading it as invalid?
Let me know if you need anything else to answer the question.
Thanks again!
EDIT: Tried doing it though the client. I get the same error. With the client I can skip the file causing the error. I did that and the rest seems to be downloading just fin. Maybe it's just that specific file that is causing the error? Still don't know what the error is so if someone could lend a hand still, I'd appreciate it.

Gatling not honouring -bdf parameter

I am doing a post(someUrl).body(RawFileBody("100_msg.json")).asJSON.
However I keep getting an error file 100_msgs.json doesn't exist.
I am passing a -bdf parameter that is pointing to a folder that contains the said json, but the same result. (At some point, I definitely saw something work, but not anymore)
I am using IntelliJ IDEA and configured a gradle to invoke Gatling. Am new to Scala, so debugging this seems a herculean task. Any pointers ?
Oops my bad. I had a space in the file name.

Arduino: Error: 'PubNub' was not declared in this scope

I'm new to Arduino. When Arduino verifies this sketch https://github.com/MediaTek-Labs/Real-Time-Bicycle-Tracking-Map-using-PubNub throws the following:
Build options changed, rebuilding all
BikeTracker.ino: In function 'void setup()':
BikeTracker.ino:45:5: error: 'PubNub' was not declared in this scope
BikeTracker.ino: In function 'void loop()':
BikeTracker.ino:91:14: error: 'PubNub' was not declared in this scope
I've read most answers are pointing out to https://www.arduino.cc/en/Guide/Libraries some people say it's common Arduino linking issue (easy to fix) after tried out multiple approaches with no dice.
I've also followed PubNub customer support advice (with list of steps below) but no avail:
I got this from our hardware/IoT/embedded engineer:
You are probably not including all the libraries, or has the wrong
path for them.
When you download the source at
MediaTek-Labs/Real-Time-Bicycle-Tracking-Map-using-PubNub on GitHub:
Click .ino file and a pop up will ask if you need a new folder for the
sketch – click Yes.
Then copy the rest of the files from the source to
this new folder.
Compile it and see if you get any library path errors
that you need to provide. Let me know if you require further
assistance.
BTW this is my PubNub.h. Hope someone can shed some lights.
It turns out my Arduino IDE could not find PubNub.* files until I manually added them as Library.

Lua loadfile not finding a file

I had some lua code with the following line:
JSON = loadfile("JSON.lua")()
The file JSON.lua is in the same directory as the lua code that line came from. This code worked for me for a while, and then, without my changing either the lua source, or the JSON.lua, or permission of any of the files, or the directory from where I was running the lua code, I started getting a nil error on that line. (I simply recall NO relevant changes that could have any impact on the lua code.)
Adding an assert revealed that the error was caused by the file not being found. Playing with file permissions, restarting my machine didn't resolve the issue, and pulling back code that I had checked in and was working perfectly did not resolve the error.
I resolved the error by changing the line above to provide the absolute path to that JSON.lua file.
Is there anything explaining why the code without the absolute path could have worked for a while and then stopped working?
Note: This behavior of working and then not working happened to me twice over a week. I am puzzled and though I have now found a fix, I am really curious as to the explanation for that intermittent behavior.
Lua uses package.path, whose default value comes from the environment variable LUA_PATH if it is set, as the list of directories to search. You can put . of the front of this list to load files from the current directory, or you can put your files in a path on the list.
A late answer on this, as I found exactly the same problem.
First, contrary to the previous answer, loadfile doesn't use the package.path search path. It only looks in the specified directory. And if you don't specify a directory, it only look in the 'current directory'. I can't explain exactly why it stopped working for you, but probably your Lua code is somehow being run with a different 'current directory' than previous.
There are two possible fixes: One is to specify an absolute path to loadfile.
JSON = loadfile("c:\\my_folder\\JSON.lua")()
The alternative fix depends on the particular library you're using, which I suspect is Jeffrey Friedl's Lua JSON lilbrary. Because this supports the newer Lua module mechanism, you can just load the module with require, which does support the package.path search path.
JSON = require("JSON")

Resources