我必须在服务器启动时而不是在第一个请求上执行struts2操作.
我将存储过程可能抛出的错误代码(通过调用 raise_application_error)存储为常量。我的一个程序必须捕获另一个程序抛出的错误,我正在尝试使用 pragma exception_init 来执行此操作。看起来它只接受数字文字(因为它在我收到的错误消息中明确说明了这一点),但是如果能够不硬连线我存储在常量中的错误代码,那就太好了。是否有一些解决方法,以便我可以实现与我写的相同的效果:
pragma exception_init(myException, pkg_constants.error_not_null);
我正在使用 iTextSharp 从模板生成 pdf 文件,填充此代码部分中的每个字段:
PdfReader pdfReader = new PdfReader(templatePath);
try
{
using (FileStream newFileStream = new FileStream(newFilePath, FileMode.Create))
{
using (PdfStamper stamper = new PdfStamper(pdfReader, newFileStream))
{
// fill each field
AcroFields pdfFormFields = stamper.AcroFields;
foreach (KeyValuePair<string, string> entry in content)
{
if (!String.IsNullOrEmpty(entry.Value))
pdfFormFields.SetField(entry.Key, entry.Value);
}
//The below will make sure the fields are not editable in
//the output PDF.
stamper.FormFlattening = true;
stamper.Close();
}
}
}
finally
{
pdfReader.Close();
}
Run Code Online (Sandbox Code Playgroud)
一切顺利,文件看起来不错,但是当我尝试重新打开文件以将其与我在一个唯一文档中生成的其他一些文件合并时,我收到此错误:
2015-11-23 09:46:54,651||ERROR|UrbeWeb|System.IO.IOException: The process cannot access …Run Code Online (Sandbox Code Playgroud) 当使用java.util.Date.getTime()方法对java Date对象求和时,我得到了意想不到的结果.
这是示例代码:
System.out.println(d1.toString());
System.out.println(d2.toString());
System.out.println(new Date(d1.getTime() + d2.getTime()));
Run Code Online (Sandbox Code Playgroud)
这是输出:
Mon Mar 20 00:00:00 CET 2017
Thu Jan 01 10:44:00 CET 1970
Mon Mar 20 09:44:00 CET 2017
Run Code Online (Sandbox Code Playgroud)
我希望2017年3月20日10:44:00 CET 2017而不是Mon Mar 20 09:44:00 CET 2017.
我错过了什么?
提前致谢.