为什么会出现未知错误?
Why the unknown error?
这是我的错误信息:
ColdFusion could not delete the file
C:\path\guid.png
for an unknown reason.
我已经按照建议 here 检查以确保我的 coldFusion 用户有权这样做。那不是问题,用户拥有所有权限。不幸的是,代码在生产服务器上被破坏了,不是我自己的本地服务器(可能是相关的)。生产是在 CF11 上,但我在 CF9 上。
代码如下:
<cffunction name="svgToPDF" access="public" output="false" returntype="string">
<cfargument name="svg" required="true" type="string" />
<cfset var local = {} />
<cfset local.guid = CreateUUID() />
<cfset local.outPDF = ExpandPath(local.guid & '.pdf') />
<cfset local.svg = DeserializeJSON(exportToImage(svg=arguments.svg)) />
<cfif local.svg.error>
<!-- Conversion error -->
<cfset FileDelete(#local.svg.file#) />
<cfreturn '' />
</cfif>
<!--- rotate the png --->
<cfimage
action="read"
source="#local.svg.file#"
name="local.objImage" />
<cfimage
action="rotate"
source="#local.objImage#"
angle="90"
name="local.objImage" />
<cfimage
action="write"
source="#local.objImage#"
destination="#local.svg.file#"
overwrite="yes" />
<!--- Add the png to the pdf, write the pdf file, and delete the png --->
<cfscript>
img = CreateObject("java", "com.lowagie.text.Image");
png = img.getInstance(local.svg.file);
document = CreateObject("java", "com.lowagie.text.Document");
document.init(png);
fileIO = CreateObject("java", "java.io.FileOutputStream");
fileIO.init(local.outPDF);
writer = CreateObject("java", "com.lowagie.text.pdf.PdfWriter");
writer.getInstance(document, fileIO);
document.setMargins(0, 0, 0, 0);
document.open();
document.add(png);
document.close();
FileDelete(#local.svg.file#); <!--- This is the line where it breaks--->
</cfscript>
<cfreturn local.outPDF />
</cffunction>
如何修复此功能?
谢谢
如果您的生产服务器是 CF11,那么这是一个在错误# 4031026 中提到的错误 - http://bugbase.adobe.com/index.cfm?event=bug&id=4031026
该错误已由 Adobe 验证并修复,很可能在他们的下一个修补程序中。
JPEG 似乎是目前唯一没有锁定问题的可用格式。
这是我的错误信息:
ColdFusion could not delete the file C:\path\guid.png for an unknown reason.
我已经按照建议 here 检查以确保我的 coldFusion 用户有权这样做。那不是问题,用户拥有所有权限。不幸的是,代码在生产服务器上被破坏了,不是我自己的本地服务器(可能是相关的)。生产是在 CF11 上,但我在 CF9 上。
代码如下:
<cffunction name="svgToPDF" access="public" output="false" returntype="string">
<cfargument name="svg" required="true" type="string" />
<cfset var local = {} />
<cfset local.guid = CreateUUID() />
<cfset local.outPDF = ExpandPath(local.guid & '.pdf') />
<cfset local.svg = DeserializeJSON(exportToImage(svg=arguments.svg)) />
<cfif local.svg.error>
<!-- Conversion error -->
<cfset FileDelete(#local.svg.file#) />
<cfreturn '' />
</cfif>
<!--- rotate the png --->
<cfimage
action="read"
source="#local.svg.file#"
name="local.objImage" />
<cfimage
action="rotate"
source="#local.objImage#"
angle="90"
name="local.objImage" />
<cfimage
action="write"
source="#local.objImage#"
destination="#local.svg.file#"
overwrite="yes" />
<!--- Add the png to the pdf, write the pdf file, and delete the png --->
<cfscript>
img = CreateObject("java", "com.lowagie.text.Image");
png = img.getInstance(local.svg.file);
document = CreateObject("java", "com.lowagie.text.Document");
document.init(png);
fileIO = CreateObject("java", "java.io.FileOutputStream");
fileIO.init(local.outPDF);
writer = CreateObject("java", "com.lowagie.text.pdf.PdfWriter");
writer.getInstance(document, fileIO);
document.setMargins(0, 0, 0, 0);
document.open();
document.add(png);
document.close();
FileDelete(#local.svg.file#); <!--- This is the line where it breaks--->
</cfscript>
<cfreturn local.outPDF />
</cffunction>
如何修复此功能? 谢谢
如果您的生产服务器是 CF11,那么这是一个在错误# 4031026 中提到的错误 - http://bugbase.adobe.com/index.cfm?event=bug&id=4031026
该错误已由 Adobe 验证并修复,很可能在他们的下一个修补程序中。
JPEG 似乎是目前唯一没有锁定问题的可用格式。