Your given factory method is compatible both with JForex API versions 2.6.38 and 2.6.43. If it is illegal argument exception then it is rather because of the parameters you pass to the method, not the API, consider the following example:
package charts.test;
import com.dukascopy.api.*;
import com.dukascopy.api.drawings.IShortLineChartObject;
public class ShortLine implements IStrategy {
private IChart chart;
private IHistory history;
@Override
public void onStart(IContext context) throws JFException {
this.chart = context.getChart(Instrument.EURUSD);
this.history = context.getHistory();
ITick tick = history.getLastTick(Instrument.EURUSD);
long firstBarTime = history.getBarStart(chart.getSelectedPeriod(), tick.getTime());
double max = tick.getBid();
IShortLineChartObject line = chart.getChartObjectFactory().createShortLine("shortLine", firstBarTime, max, firstBarTime+15000, max);
chart.addToMainChart(line);
}
@Override
public void onTick(Instrument instrument, ITick tick) throws JFException {}
@Override
public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {}
@Override
public void onMessage(IMessage message) throws JFException {}
@Override
public void onAccount(IAccount account) throws JFException {}
@Override
public void onStop() throws JFException {}
}