在java服务中,如果没有函数声明,就会有一个函数调用,并且只会出现编译时错误。但输出与预期一致,没有运行时错误。那件事怎么可能?有谁能解释一下吗?
"The method functionName() is undefined“是它显示的错误。
下面是代码。
public static final void documentToStringVals(IData pipeline)
throws ServiceException {
// pipeline
IDataCursor pipelineCursor = pipeline.getCursor();
String success = "false";
IData inputDoc = null;
String outputValue = "";
String headerYN = "N";
boolean headerValue = false;
String delimiter = ",";
String newline = System.getProperty("line.separator");
if (pipelineCursor.first("inputDocument") ) {
inputDoc = (IData) pipelineCursor.getValue();
}
else {
throw new ServiceException("inputDocument is a required parameter");
}
if (pipelineCursor.first("delimiter") ) {
delimiter = (String) pipelineCursor.getValue();
}
if (pipelineCursor.first("headerYN") ) {
headerYN = (String) pipelineCursor.getValue();
}
if (headerYN.equalsIgnoreCase("Y")) {
headerValue = true;
}
try {
outputValue = docValuesToString(inputDoc, headerValue, delimiter);
outputValue += newline;
success = "true";
}
catch (Exception e) {
System.out.println("Exception in getting string from document: " + e.getMessage());
pipelineCursor.insertAfter("errorMessage", e.getMessage());
}
pipelineCursor.insertAfter("success", success);
pipelineCursor.insertAfter("outputValue", outputValue);
pipelineCursor.destroy();
}发布于 2016-03-01 17:50:42
您发布的代码没有引用"functionName",所以我怀疑在共享代码部分或同一文件夹中的另一个Java服务中有对它的引用。假设文件夹中的所有Java服务都被编译到单个类中,因此所有这些服务都需要一起编译,这可能会导致在编译上面的服务时出现错误消息。
https://stackoverflow.com/questions/35695958
复制相似问题