1

我通过这意味着“添加日期”来添加日期, 这是标准程序,但不幸的是我的 Pentaho 应用程序中断了c.setTime(dt);,我显然不知道原因,因为异常没有任何意义。
所以另一种选择是解析日期并提取月、年、日和 +1 到当天,但我必须处理Feburaryand odd months。我脑子里只有这两个选项。

谁能指导我其他选择?

堆栈跟踪是

An unexpected error occurred in Spoon:  
(class: Processor, method: processRow signature: (Lorg/pentaho/di/trans/step/StepMetaInterface;Lorg/pentaho/di/trans/step/StepDataInterface;)Z) Register 11 contains wrong type
java.lang.VerifyError: (class: Processor, method: processRow signature: (Lorg/pentaho/di/trans/step/StepMetaInterface;Lorg/pentaho/di/trans/step/StepDataInterface;)Z) Register 11 contains wrong type
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
    at java.lang.Class.getMethod0(Unknown Source)
    at java.lang.Class.getMethod(Unknown Source)
    at org.pentaho.di.trans.steps.userdefinedjavaclass.UserDefinedJavaClassMeta.getStepIOMeta(UserDefinedJavaClassMeta.java:338)
    at org.pentaho.di.trans.TransPainter.drawLine(TransPainter.java:899)
    at org.pentaho.di.trans.TransPainter.drawHop(TransPainter.java:510)
    at org.pentaho.di.trans.TransPainter.drawHop(TransPainter.java:499)
    at org.pentaho.di.trans.TransPainter.drawTrans(TransPainter.java:184)
    at org.pentaho.di.trans.TransPainter.buildTransformationImage(TransPainter.java:144)
    at org.pentaho.di.ui.spoon.trans.TransGraph.getTransformationImage(TransGraph.java:2728)
    at org.pentaho.di.ui.spoon.trans.TransGraph.paintControl(TransGraph.java:2691)
    at org.pentaho.di.ui.spoon.trans.TransGraph$4.paintControl(TransGraph.java:487)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
    at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Composite.WM_PAINT(Unknown Source)
    at org.eclipse.swt.widgets.Control.windowProc(Unknown Source)
    at org.eclipse.swt.widgets.Canvas.windowProc(Unknown Source)
    at org.eclipse.swt.widgets.Display.windowProc(Unknown Source)
    at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DispatchMessage(Unknown Source)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
    at org.pentaho.di.ui.spoon.Spoon.readAndDispatch(Spoon.java:1169)
    at org.pentaho.di.ui.spoon.Spoon.start(Spoon.java:6940)
    at org.pentaho.di.ui.spoon.Spoon.main(Spoon.java:553)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.pentaho.commons.launcher.Launcher.main(Launcher.java:134)
4

4 回答 4

2

此外,如果您使用的是 Kettle/Pentaho 数据集成,则可以使用该Calculator步骤。提供的计算之一是“日期 A + B 天”。我经常使用它,它对我来说一直很有效。

于 2013-08-22T18:03:36.740 回答
1

我遇到了同样的问题,这是对我有用的解决方案..

这是用户定义的 Java 类中的一个问题

这是在尝试访问在 try/catch 块之外的 try/catch 块中设置的变量时引起的(即,即使事先声明,但直到在 try/catch 中才设置,仍然会出现此错误)。

索鲁斯 - http://jira.pentaho.com/browse/PDI-13032

于 2016-01-20T18:54:41.673 回答
0

另一种方法是使用Joda time

DateTime dateTime = new DateTime(date);
dateTime = dateTime.plusDays(1);
于 2013-08-22T11:14:07.107 回答
0

尝试。

Calender cal=Calender.getInstance();

cal.add(Calender.DATE,1);

一个例子

    Calendar cal = Calendar.getInstance();
    System.out.println(cal.getTime());// out put Thu Aug 22 16:31:56 IST 2013
    cal.add(Calendar.DATE,1);
    System.out.println(cal.getTime());// out put Fri Aug 23 16:31:56 IST 2013

检查这个演示

如果您以这种方式尝试,这应该可以正常工作。请留下评论或在此处发布您的代码,并带有例外。

于 2013-08-22T10:59:27.997 回答