Consecutive log prints - only the first printed (no visible error) - java

I have this code fragment in my java class:
catch (AuthenticationFailedException afe) {
IlientConf.logger.error("[" + accountID + "," + emailConf.getIncomingUser() + "#" + emailConf.getIncomingMailServer() + "] " + "E-Mail " + protocol + encStr + " login failed on " + emailConf.getIncomingUser() + "#" + emailConf.getIncomingMailServer());
IlientConf.logger.error("[" + accountID + "," + emailConf.getIncomingUser() + "#" + emailConf.getIncomingMailServer() + "] " + afe.getMessage());
IlientConf.logger.debug("Email integration AuthenticationFailedException", afe);
return false;
}
IlientConf.logger is a log4j logger.
The actual log that is printed contains only the first line. This is it:
[someuser,sapunlock#someuser.com#outlook.office365.com] E-Mail pop3
(SSL) login failed on sapunlock#someuser.com#outlook.office365.com
The second and the third log statements are lost somehow.
I really need the stack trace of the error, but I can't get it.
No other related error is shown in the log.
Please help me understand what the reason for this is.
P.S.: Of course I can change the log statements to show this better, but this is deployed at a customers environment and needs to be solved before the next version.

Related

TranslatableText inside a LiteralText SendMessage

I want to program an item that posts the coordinates of certain ores in the chat.
But now my question is whether I can also put parts of the chat message as a translation or only hardcoded, so that it only outputs what I programmed.
I work with Minecraft fabric for 1.18.2 and the code below is what i have:
private void outputValuableCoordinates(BlockPos blockPos, PlayerEntity player, Block blockBelow) {
player.sendMessage(new LiteralText("Found "
+ blockBelow.asItem().getName().getString()
+ " at " +
"(" + blockPos.getX() + ", " + blockPos.getY() + "," + blockPos.getZ() + ")"), false);
}
And i would make a TranslatableText out of "Found" and "at"

How to get input data in textArea

I am a new programmer in javafx.
Using java FX in IDE I want to make a student information application.
I want to print the input data into the text area but it prints out in the console now.
(After clicking display button I want to show all the input data in textarea)
please help me out to solve this problem.
I am attaching my code below for your suggestion..
Main.java
Just place
textArea.setText("Name: " + t1.getText() +"\nAddress: " + t2.getText()
+"\nProvince: " + t3.getText() +"\nCity: " + t4.getText()
+"\nPostal Code: " + t5.getText() +"\nPhone Number: " + t6.getText()
+"\nEmail: " + t7.getText() + "\nCourses: "+comboBox.getItems()
+ "\nActivities: "+c1.getText() + "\n"+c2.getText());
into the action handler.
And remove the imports
import javax.swing.JTextArea;
import java.awt.*;
They are not JavaFX.
You are printing your result into the standard output stream (System.out). I assume you want to display what is printed by:
System.out.println("Name: " + t1.getText() +"\nAddress: " + t2.getText()
+"\nProvince: " + t3.getText() +"\nCity: " + t4.getText()
+"\nPostal Code: " + t5.getText() +"\nPhone Number: " + t6.getText()
+"\nEmail: " + t7.getText() + "\nCourses: "+comboBox.getItems()
+ "\nActivities: "+c1.getText() + "\n"+c2.getText());
Please visit the documentation of the TextArea class. Printing your result into the standard output stream has nothing to do with printing your result in your TextArea. Simply use a normal String that contains your result and set the text of your TextArea accordingly.

Sending Calendar Events (Invitations) using iCal4j library (Java - Spring)

This question is relating to iCal4j library integration with a Java (Spring) application.
Use case -
In my application, when a user creates an event from the UI, the invitees should receive a calendar invitation, which they can add to their personal calendar (Google calendar, Outlook calendar or even Thundarbird calendar) by simply clicking on the event. Also, the event organizer should receive a calendar invitation of the same event.
Concern -
While attendees receive the calendar invitation to the created event in the correct format (Google Calendar, Outlook and Thundarbird) via an email, the organizer receives an empty email with an attachment (invite.ics). Please note that this concern only raises in Gmail mail and Outlook mail clients. In Thunderbird, even the organizer receives a complete event request.
(Please refer the attached code snippet and images for further clarification).
Please let me know how to resolve this issue or any alternate libraries or solutions I can use to get this done.
Thanks in advance.
StringBuffer buffer = sb.append( "BEGIN:VCALENDAR\n" +
"PRODID:-//PROD_NAME//PROD_ORG//EN\n" +
"VERSION:2.0\n" +
"X-WR-RELCALID:"+calendarEmail.getxWrRelcalid()+"\n" +
"METHOD:REQUEST\n" +
"BEGIN:VEVENT\n" +
calendarEmail.getAttendeeString() +
calendarEmail.getOrganizerString() +
"DTSTART:" + calendarEmail.getDtStart() + "\n" +
calendarEmail.getRruleString() +
"DTEND:" + calendarEmail.getDtEnd() + "\n" +
"LOCATION:" + calendarEmail.getLocation() + "\n" +
"TRANSP:OPAQUE\n" +
"SEQUENCE:"+calendarEmail.getSequence()+"\n" +
"UID:" + calendarEmail.getUid() + "\n" +
"DTSTAMP:" + calendarEmail.getDtStamp() + "\n" +
"STATUS:"+calendarEmail.getEventStatusString()+"\n" +
"CATEGORIES:" + calendarEmail.getCategory() + "\n" +
"DESCRIPTION:" + calendarEmail.getDescription() + "\n" +
"SUMMARY:" + calendarEmail.getSummary() + "\n" +
"PRIORITY:5\n" +
"CLASS:" + calendarEmail.getPublicity() + "\n" +
"BEGIN:VALARM\n" +
"TRIGGER:" + calendarEmail.getAlarmTrigger() + "\n" +
"ACTION:" + calendarEmail.getAlarmAction() + "\n" +
"DESCRIPTION:Reminder\n" +
"END:VALARM\n" +
"END:VEVENT\n" +
"END:VCALENDAR" );
I think this is more a question of how the iCalendar specification works. Specifically you may want to look at:
https://www.rfc-editor.org/rfc/rfc5546#section-3.2.2
In your case your program is acting on behalf of the Organizer, so I'm not sure you can send a "REQUEST" to the Organizer user.
You probably need to send a "PUBLISH" method to the Organizer user:
https://www.rfc-editor.org/rfc/rfc5546#section-3.2.1
You may also want to consider the SENT-BY parameter on your Organizer property to indicate the Organizer user didn't send the request (unless you want REPLYs to go back to your program):
https://www.rfc-editor.org/rfc/rfc5545#section-3.2.18

AWS Lambda Java Function is successful but times out

I created a basic AWS Lambda java function to convert an xml message to json. The function is triggered off of an S3 event (message is converted and dropped in different S3 bucket). It appears to be successful, I can see the steps in cloudwatch and the converted message is in the S3 destination bucket. However, I see the timeout warning in the cloud watch logs (set timeout to 15 seconds). I must be missing something, definitely a newby when it comes to Lambda. Do I need to provide the context with a done or success? Any suggestions or tips would be greatly appreciated.
Code Snippet:
public void msgConvertToJson(S3Event s3event, Context context) {
final String key = s3event.getRecords().get(0).getS3().getObject().getKey();
final String bucketName = s3event.getRecords().get(0).getS3().getBucket().getName();
log.info("key: " + key + " bucketName:" + bucketName);
String action = "";
try {
//Attempt to retrieve the message from S3 on notification
log.info("attempting to get message");
action = "get";
final String message = s3Client.getObjectAsString(bucketName, key);
//Attempt to parse and convert the message to JSON
log.info("attempting to parse message");
String msgJson = new MessageParser(message).getMessageJson();
//Attempt to write the converted message to a new S3 bucket
final String parsedBucket = "parsed-" + bucketName;
final String newKey = key.replace(".xml",".json");
log.info("newKey: " + newKey + " parsedBucketName:" + parsedBucket);
log.info("attempting to put message");
action = "put";
s3Client.putObject(parsedBucket, newKey, msgJson );
} catch (AmazonServiceException ase) {
log.error("Caught an AmazonServiceException trying to " + action + " file " + key + ", which " +
"means your request made it " +
"to Amazon S3, but was rejected with an error response" +
" for some reason.");
log.error("Error Message: " + ase.getMessage());
log.error("HTTP Status Code: " + ase.getStatusCode());
log.error("AWS Error Code: " + ase.getErrorCode());
log.error("Error Type: " + ase.getErrorType());
log.error("Request ID: " + ase.getRequestId());
} catch (AmazonClientException ace) {
log.error("Caught an AmazonClientException while trying to " + action + " file " + key + ", which " +
"means the client encountered " +
"an internal error while trying to " +
"communicate with S3, " +
"such as not being able to access the network.");
log.error("Error Message: " + ace.getMessage());
}
}
It actually turned out that it was just the timeout was too short. The cold start for the JVM, must be taking longer than I would have thought. I was just assuming I had another issue in my code. Bumped memory to 192 and timeout to 45 seconds. Hope this helps someone else.
Really unfortunate I was marked down by someone that was pointing me at the wrong information (NodeJS) instead of Java.

GWT Java calculate days between two dates on the server side

I am using GWT java. I have a report on the client side that I want to export to csv. So I am trying to create the report on the server side to pass back to the client side as a csv file so the user can store the csv file in their selected destination.
The following code works on the client side; however, does not work on the server side (i.e., "Print 6." is displayed and "Print 7." is not displayed on the server side). There is no error message. The dates are "2016-11-09" and "2000-02-02".
System.out.println(todays_date);
System.out.println(pack.getDob());
System.out.println("Print 6.");
float diffDOB = (CalendarUtil.getDaysBetween(pack.getDob(), todays_date));
System.out.println("Print 7.");
I was talking about this with a fiend, who is not a programmer, and she said why not just send the MS Excel formula. Brilliant! So I have removed all the calclations and am now sending:
fileContent.append(pack.getSurname() + "," + pack.getFirstname() + "," + pack.getScout_no() + "," +
pack.getgroup() + "," + pack.getDob() + "," + '"' + "=ROUNDDOWN(((TODAY()-E"+row+")/365),1)" + '"' + "," +
pack.getstartDate() + "," + '"' + "=ROUNDDOWN(((TODAY()-G"+row+")/365),1)" + '"' + "," +
'"' + "=EDATE(E"+row+",216)" + '"' + "\n");
The only issue now is that spaces in the string fields appear as + in the output file.

Categories

Resources