VM1.3対応
変更点を、ちょっとづつ書いていく。
途中で、断念するかもしれないけど。。。(w
public final class TagHandlerContext {private static void remoteLastPath(StringBuffer path) {
int start = path.toString().lastIndexOf("/");
int end = path.length();
path.delete(start, end);
}
public class SRuntimeException extends NestableRuntimeException {
public final class PointcutImpl implements Pointcut, Serializable {//private Pattern[] patterns_;
private RE[] patterns_;public boolean isApplied(String methodName) {
for (int i = 0; i < patterns_.length; ++i) {
//if (patterns_[i].matcher(methodName).matches()) {
// return true;
//}
if (patterns_[i].match(methodName)) {
return true;
}
}
return false;
}private void setMethodNames(String[] methodNames) {
methodNames_ = methodNames;
//patterns_ = new Pattern[methodNames.length];
//for (int i = 0; i < patterns_.length; ++i) {
// patterns_[i] = Pattern.compile(methodNames[i]);
//}
patterns_ = new RE[methodNames.length];
RECompiler reCompiler = new RECompiler();
for (int i = 0; i < methodNames.length; ++i) {
REProgram reProgram = reCompiler.compile(methodNames[i]);
patterns_[i] = new RE(reProgram);
}
}
追記:
終了〜!
S2Dao使うの、これだけで、いけた。(^^)v
AOPで、トランザクションとかログとかも出来てるし。
statementFactoryがnullになってたのは、j2ee.diconが古かっただけだった。(^^;
追記:追加したjarファイル
commons-lang-2.0.jar
jakarta-regexp-1.3.jar
jdbc2_0-stdext.jar
xercesImpl.jar
xml-apis.jar
public class XlsReader implements DataReader, DataSetConstants {
public Object getValue(HSSFCell cell) {
//略
//return Boolean.valueOf(b);
return new Boolean(b);
public final class ConnectionWrapperImpl implements ConnectionWrapper {
//このメソッド以下をリフレクションで実行
public int getHoldability() throws SQLException {
assertOpened();
//physicalConnection_.setHoldability(holdability);
invokePhysicalConnectionMethod( "setHoldability",
new Class[] { Integer.TYPE },
new Object[] { new Integer(holdability) });
}
// 以下略private Object invokePhysicalConnectionMethod(String methodName, Class[] argTypes, Object[] args) throws SQLException {
try {
//physicalConnection_.setHoldability(holdability);
Method method = ClassUtil.getMethod(Connection.class, methodName, argTypes);
return MethodUtil.invoke(method, physicalConnection_, args);
//} catch (SQLException ex) {
} catch (Exception ex) {
release();
if (ex instanceof SQLException) {
throw (SQLException) ex;
} else {
throw (RuntimeException) ex;
}
}
}
public final class BooleanConversionUtil {
public static Boolean toBoolean(Object o) {
if (o == null) {
return null;
} else if (o instanceof Boolean) {
return (Boolean) o;
} else if (o instanceof Number) {
int num = ((Number) o).intValue();
// return Boolean.valueOf(num != 0);
return new Boolean(num != 0);
public final class DateConversionUtil {
public static String findDelimiter(String value) {
for (int i = 0; i < value.length(); ++i) {
char c = value.charAt(i);
if (Character.isDigit(c)) {
continue;
}
//return Character.toString(c);
return String.valueOf(c);
}
return null;
}
public class LocaleUtil {
public static Locale getLocale(String localeStr) {
Locale locale = Locale.getDefault();
if (localeStr != null) {
int index = localeStr.indexOf('_');
if (index < 0) {
//locale = new Locale(localeStr);
locale = new Locale(localeStr, null);
public final class MethodUtil {
public static Object invoke(Method method, Object target, Object[] args)
throws InstantiationRuntimeException, IllegalAccessRuntimeException {try {
return method.invoke(target, args);
} catch (InvocationTargetException ex) {
//Throwable t = ex.getCause();
Throwable t = ex.getTargetException();
public final class ResourceUtil {
public static String toExternalForm(URL url) {
String s = url.toExternalForm();
return URLDecoder.decode(s);
//try {
// return URLDecoder.decode(s, "UTF8");
//} catch (UnsupportedEncodingException ex) {
// ex.printStackTrace();
// throw new RuntimeException(ex);
//}
}
public static String getFileName(URL url) {
String s = url.getFile();
return URLDecoder.decode(s);
//try {
// return URLDecoder.decode(s, "UTF8");
//} catch (UnsupportedEncodingException ex) {
// ex.printStackTrace();
// throw new RuntimeException(ex);
//}
}
public final class TransactionImpl implements Transaction {
public boolean enlistResource(XAResource xaResource)
throws RollbackException, IllegalStateException, SystemException {boolean oracled = xaResource.getClass().getName().startsWith("oracle");
assertNotSuspended();
assertActive();
Xid xid = null;
for (int i = 0; i < getXAResourceWrapperSize(); ++i) {
XAResourceWrapper xarw = getXAResourceWrapper(i);
if (xaResource.equals(xarw.getXAResource())) {
return false;
} else if (oracled) {
continue;
} else {
try {
if (xaResource.isSameRM(xarw.getXAResource())) {
xid = xarw.getXid();
break;
}
} catch (XAException ex) {
throw new IllegalStateException(ex.toString());
}
}
}
int flag = xid == null ? XAResource.TMNOFLAGS : XAResource.TMJOIN;
boolean commitTarget = xid == null ? true : false;
if (xid == null) {
xid = createXidBranch();
}
try {
xaResource.start(xid, flag);
xaResourceWrappers_.add(
new XAResourceWrapper(xaResource, xid, commitTarget));
return true;
} catch (XAException ex) {
IllegalStateException ise = new IllegalStateException(ex.toString());
// TODO あとで
//ise.initCause(ex);
throw ise;
}
}
public final class LikeUtil {
public static final boolean match(String patternStr, String value) {
if (StringUtil.isEmpty(patternStr)) {
return false;
}
//Pattern pattern = (Pattern) patterns_.get(patternStr);
RE pattern = (RE) patterns_.get(patternStr);
if (pattern == null) {
String regexp = StringUtil.replace(patternStr, "_", ".");
regexp = StringUtil.replace(regexp, "%", ".*");
//pattern = Pattern.compile(regexp);
RECompiler reCompiler = new RECompiler();
REProgram reProgram = reCompiler.compile(regexp);
pattern = new RE(reProgram);
patterns_.put(patternStr, pattern);
}
//return pattern.matcher(value).matches();
return pattern.match(value);
}
public final class ValueTypes {
public static ValueType getValueType(int type) {
// 略
//case Types.BOOLEAN :
// return getValueType(Boolean.class);
public class BooleanType implements ValueType {
public void bindValue(PreparedStatement ps, int index, Object value)
throws SQLException {if (value == null) {
//ps.setNull(index, Types.BOOLEAN);
ps.setNull(index, Types.OTHER);
以下、後で。
public class BooleanToIntCallableStatement extends CallableStatementWrapper {
public class BooleanToIntPreparedStatement extends PreparedStatementWrapper {
public class CallableStatementWrapper implements CallableStatement {
public class PreparedStatementWrapper implements PreparedStatement {
Throwable#initCause()を使ってるとこ
public class ResultSetWrapper implements ResultSet {