下面列出了怎么用org.apache.commons.lang.builder.ReflectionToStringBuilder的API类实例代码及写法,或者点击链接到github查看源代码。
public static String getPrintableValue(final Value value) {
if ((value != null) && (value.getSize() > 0)) {
try {
final Uid.List uidList = Uid.List.parseFrom(value.get());
return (uidList.getUIDList().toString());
} catch (final InvalidProtocolBufferException e1) {
try {
return (ReflectionToStringBuilder.toString(EdgeValue.decode(value), ToStringStyle.SHORT_PREFIX_STYLE));
} catch (final Exception e2) {
try {
final ExtendedHyperLogLogPlus ehllp = new ExtendedHyperLogLogPlus(value);
return (String.valueOf(ehllp.getCardinality()));
} catch (final Exception e3) {
logger.error("Could not deserialize protobuff" + e2);
}
}
}
}
return ("");
}
/**
* The <code>toString()</code> method retrieves its value
* by reflection, so overriding this method is mostly not
* usefull.
* @see ToStringBuilder#reflectionToString
*
**/
@Override
public String toString() {
try {
return (new ReflectionToStringBuilder(this) {
@Override
protected boolean accept(Field f) {
//TODO create a blacklist or whitelist
return super.accept(f) && !f.getName().contains("appConstants");
}
}).toString();
} catch (Throwable t) {
log.warn("exception getting string representation of pipe ["+getName()+"]", t);
}
return null;
}
protected CommandResult execute(List<String> commands) {
if (log.isDebugEnabled()) {
log.debug(commands);
}
// タイムアウトしないようにする
long timeout = Long.MAX_VALUE;
CommandResult result = CommandUtils.execute(commands, timeout);
if (log.isDebugEnabled()) {
log.debug(ReflectionToStringBuilder.toString(result));
}
return result;
}
/**
* {@inheritDoc}
*/
@Override
public void addCanonicalName(String fqdn, String canonicalName) {
List<String> commands = createCommands();
List<String> stdins = createAddCanonicalName(fqdn, canonicalName);
CommandResult result = execute(commands, stdins);
if (result.getExitValue() != 0) {
// CNAMEレコードの追加に失敗
AutoException exception = new AutoException("ECOMMON-000205", fqdn, canonicalName);
exception.addDetailInfo(
"result=" + ReflectionToStringBuilder.toString(result, ToStringStyle.SHORT_PREFIX_STYLE));
throw exception;
}
// CNAMEの確認はしない(参照先ホスト名を解決できない場合もあるため)
}
public InstanceDto waitInstance(String instanceId) {
// インスタンスの処理待ち
String[] stableStatus = new String[] { "running", "stopped" };
// TODO: ニフティクラウドAPIの経過観察(インスタンスのステータス warning はAPIリファレンスに記載されていない)
String[] unstableStatus = new String[] { "pending", "warning" };//
InstanceDto instance;
while (true) {
instance = describeInstance(instanceId);
String status = instance.getState().getName();
if (ArrayUtils.contains(stableStatus, status)) {
break;
}
if (!ArrayUtils.contains(unstableStatus, status)) {
// 予期しないステータス
AutoException exception = new AutoException("EPROCESS-000604", instanceId, status);
exception.addDetailInfo("result=" + ReflectionToStringBuilder.toString(instance));
throw exception;
}
}
return instance;
}
protected VolumeDto waitVolume(String volumeId) {
// Volumeの処理待ち
String[] stableStatus = new String[] { "available", "in-use" };
String[] unstableStatus = new String[] { "creating" };
VolumeDto volume = null;
while (true) {
volume = describeVolume(volumeId);
String status;
status = volume.getStatus();
if (ArrayUtils.contains(stableStatus, status)) {
break;
}
if (!ArrayUtils.contains(unstableStatus, status)) {
// 予期しないステータス
AutoException exception = new AutoException("EPROCESS-000620", volumeId, status);
exception.addDetailInfo("result=" + ReflectionToStringBuilder.toString(volume));
throw exception;
}
}
return volume;
}
/**
* @see org.kuali.kfs.module.tem.batch.service.ImportedExpensePendingEntryService#buildDebitPendingEntry(org.kuali.kfs.module.tem.businessobject.AgencyStagingData, org.kuali.kfs.module.tem.businessobject.TripAccountingInformation, org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySequenceHelper, java.lang.String, org.kuali.rice.kns.util.KualiDecimal, boolean)
*/
@Override
public List<GeneralLedgerPendingEntry> buildDebitPendingEntry(AgencyStagingData agencyData, TripAccountingInformation info, GeneralLedgerPendingEntrySequenceHelper sequenceHelper, String objectCode, KualiDecimal amount, boolean generateOffset){
List<GeneralLedgerPendingEntry> entryList = new ArrayList<GeneralLedgerPendingEntry>();
GeneralLedgerPendingEntry pendingEntry = buildGeneralLedgerPendingEntry(agencyData, info, sequenceHelper, info.getTripChartCode(), objectCode, amount, KFSConstants.GL_DEBIT_CODE);
if(ObjectUtils.isNotNull(pendingEntry )) {
pendingEntry.setAccountNumber(info.getTripAccountNumber());
pendingEntry.setSubAccountNumber(StringUtils.defaultIfEmpty(info.getTripSubAccountNumber(), GENERAL_LEDGER_PENDING_ENTRY_CODE.getBlankSubAccountNumber()));
LOG.info("Created DEBIT GLPE: " + pendingEntry.getDocumentNumber() + " for AGENCY Import Expense: " + agencyData.getId() + " TripId: " + agencyData.getTripId()
+ "\n\n" + ReflectionToStringBuilder.reflectionToString(pendingEntry, ToStringStyle.MULTI_LINE_STYLE));
//add to list if entry was created successfully
entryList.add(pendingEntry);
//handling offset
if (generateOffset){
generateOffsetPendingEntry(entryList, sequenceHelper, pendingEntry);
}
}
return entryList;
}
/**
* @see org.kuali.kfs.module.tem.batch.service.ImportedExpensePendingEntryService#buildCreditPendingEntry(org.kuali.kfs.module.tem.businessobject.AgencyStagingData, org.kuali.kfs.module.tem.businessobject.TripAccountingInformation, org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySequenceHelper, java.lang.String, org.kuali.rice.kns.util.KualiDecimal, boolean)
*/
@Override
public List<GeneralLedgerPendingEntry> buildServiceFeeCreditPendingEntry(AgencyStagingData agencyData, TripAccountingInformation info, GeneralLedgerPendingEntrySequenceHelper sequenceHelper, AgencyServiceFee serviceFee, KualiDecimal amount, boolean generateOffset){
List<GeneralLedgerPendingEntry> entryList = new ArrayList<GeneralLedgerPendingEntry>();
GeneralLedgerPendingEntry pendingEntry = buildGeneralLedgerPendingEntry(agencyData, info, sequenceHelper, serviceFee.getCreditChartCode(), serviceFee.getCreditObjectCode(), amount, KFSConstants.GL_CREDIT_CODE);
if(ObjectUtils.isNotNull(pendingEntry )) {
pendingEntry.setAccountNumber(serviceFee.getCreditAccountNumber());
pendingEntry.setSubAccountNumber(GENERAL_LEDGER_PENDING_ENTRY_CODE.getBlankSubAccountNumber());
}
LOG.info("Created ServiceFee CREDIT GLPE: " + pendingEntry.getDocumentNumber() + " for AGENCY Import Expense: " + agencyData.getId() + " TripId: " + agencyData.getTripId()
+ "\n\n" + ReflectionToStringBuilder.reflectionToString(pendingEntry, ToStringStyle.MULTI_LINE_STYLE));
//add to list if entry was created successfully
if (ObjectUtils.isNotNull(pendingEntry)) {
entryList.add(pendingEntry);
//handling offset
if (generateOffset){
generateOffsetPendingEntry(entryList, sequenceHelper, pendingEntry);
}
}
return entryList;
}
@Override
public String toString() {
class VendorTaxChangeToStringBuilder extends ReflectionToStringBuilder {
private VendorTaxChangeToStringBuilder(Object object) {
super(object);
}
@Override
public boolean accept(Field field) {
if (BusinessObject.class.isAssignableFrom(field.getType())) {
return false;
}
DataDictionaryService dataDictionaryService = SpringContext.getBean(DataDictionaryService.class);
AttributeSecurity attributeSecurity = dataDictionaryService.getAttributeSecurity(VendorTaxChange.class.getName(), field.getName());
if (ObjectUtils.isNotNull(attributeSecurity)
&& (attributeSecurity.isHide() || attributeSecurity.isMask() || attributeSecurity.isPartialMask())) {
return false;
}
return super.accept(field);
}
};
ReflectionToStringBuilder toStringBuilder = new VendorTaxChangeToStringBuilder(this);
return toStringBuilder.toString();
}
@Override
public String toString() {
class VendorHeaderToStringBuilder extends ReflectionToStringBuilder {
private VendorHeaderToStringBuilder(Object object) {
super(object);
}
@Override
public boolean accept(Field field) {
if (BusinessObject.class.isAssignableFrom(field.getType())) {
return false;
}
DataDictionaryService dataDictionaryService = SpringContext.getBean(DataDictionaryService.class);
AttributeSecurity attributeSecurity = dataDictionaryService.getAttributeSecurity(VendorHeader.class.getName(), field.getName());
if (ObjectUtils.isNotNull(attributeSecurity)
&& (attributeSecurity.isHide() || attributeSecurity.isMask() || attributeSecurity.isPartialMask())) {
return false;
}
return super.accept(field);
}
};
ReflectionToStringBuilder toStringBuilder = new VendorHeaderToStringBuilder(this);
return toStringBuilder.toString();
}
@Override
public String toString() {
class DataObjectToStringBuilder extends ReflectionToStringBuilder {
private DataObjectToStringBuilder(Object object) {
super(object);
}
@Override
public boolean accept(Field field) {
if (field.getType().isPrimitive()
|| field.getType().isEnum()
|| java.lang.String.class.isAssignableFrom(field.getType())
|| java.lang.Number.class.isAssignableFrom(field.getType())
|| java.util.Collection.class.isAssignableFrom(field.getType())) {
return super.accept(field);
}
return false;
}
};
return new DataObjectToStringBuilder(this).toString();
}
@Override
public String toString() {
class BusinessObjectToStringBuilder extends ReflectionToStringBuilder {
private BusinessObjectToStringBuilder(Object object) {
super(object);
}
@Override
public boolean accept(Field field) {
return String.class.isAssignableFrom(field.getType())
|| ClassUtils.isPrimitiveOrWrapper(field.getType());
}
}
return new BusinessObjectToStringBuilder(this).toString();
}
/**
* Replaces field values with annotation {@link ConfigXmlSecretField} by "******".
* @param configObject
* @return String representation of the given object.
* @see ReflectionToStringBuilder#ReflectionToStringBuilder(Object)
*/
public static String toString(final Object configObject)
{
return new ReflectionToStringBuilder(configObject) {
@Override
protected Object getValue(final Field field) throws IllegalArgumentException, IllegalAccessException
{
if (field.isAnnotationPresent(ConfigXmlSecretField.class) == true) {
return SECRET_PROPERTY_STRING;
}
return super.getValue(field);
};
}.toString();
}
@Test
public void testInspect() {
ListMultimap<CustomizationType, Customization> customizationMap = loadCustomizationMap();
List<Customization> curCustomizations = customizationMap.get(CustomizationType.INFO);
for(Customization cur : curCustomizations) {
System.out.println(ReflectionToStringBuilder.toString(cur, ToStringStyle.MULTI_LINE_STYLE));
}
}
@Override
public String toString() {
//return ToStringBuilder.reflectionToString(this);
return (new ReflectionToStringBuilder(this) {
@Override
protected boolean accept(Field f) {
return super.accept(f) && !f.getName().equals("passwd");
}
}).toString(); }
private void logAttributes(HttpServletRequest req) {
Enumeration items = req.getAttributeNames();
while (items.hasMoreElements()) {
String name = (String) items.nextElement();
Object obj = req.getAttribute(name);
if (obj != null) {
log.debug("Attribute: name [" + name + "] value [" +
ReflectionToStringBuilder.toString(obj) + "]");
}
else {
log.debug("Attribute: name [" + name + "] value [null]");
}
}
}
@GetMapping()
@JsonView(User.UserSimpleView.class)
@ApiOperation(value = "查询用户")
public List<User> query(UserQueryCondition condition, @PageableDefault(page=2,size=20,sort="age,asc") Pageable pageable){
System.out.println(ReflectionToStringBuilder.toString(condition, ToStringStyle.MULTI_LINE_STYLE));
System.out.println(pageable.getPageSize());
System.out.println(pageable.getPageNumber());
System.out.println(pageable.getSort());
List<User> users = new ArrayList<>();
users.add(new User());
users.add(new User());
users.add(new User());
return users;
}
protected void touchFile(String file) {
List<String> commands = new ArrayList<String>();
commands.add("/bin/touch");
commands.add(file);
CommandResult result = execute(commands);
if (result.getExitValue() != 0) {
// ファイルのtouchに失敗
AutoException exception = new AutoException("EPUPPET-000004", file);
exception.addDetailInfo(
"result=" + ReflectionToStringBuilder.toString(result, ToStringStyle.SHORT_PREFIX_STYLE));
throw exception;
}
}
@Test
@Ignore
public void testGetMetricsResources() {
Map<String, Object> report = reportLoader.loadReport("test", "test.yaml");
List<MetricsResource> metricsResources = reportAnalyzer.getMetricsResources(report);
for (MetricsResource metricsResource : metricsResources) {
log.trace(ReflectionToStringBuilder.toString(metricsResource, ToStringStyle.SHORT_PREFIX_STYLE));
}
assertEquals(8, metricsResources.size());
}
/**
* {@inheritDoc}
*/
@Override
public void addForward(String fqdn, String ipAddress) {
List<String> commands = createCommands();
List<String> stdins = createAddForward(fqdn, ipAddress);
CommandResult result = execute(commands, stdins);
if (result.getExitValue() != 0) {
// 正引きレコードの追加に失敗
AutoException exception = new AutoException("ECOMMON-000201", fqdn, ipAddress);
exception.addDetailInfo(
"result=" + ReflectionToStringBuilder.toString(result, ToStringStyle.SHORT_PREFIX_STYLE));
throw exception;
}
// 正引きの確認
long timeout = 10000L;
long startTime = System.currentTimeMillis();
while (true) {
String hostAddress = getHostAddress(fqdn);
if (StringUtils.equals(ipAddress, hostAddress)) {
break;
}
if (System.currentTimeMillis() - startTime > timeout) {
// タイムアウト発生時
throw new AutoException("ECOMMON-000202", fqdn, ipAddress, hostAddress);
}
try {
Thread.sleep(1000);
} catch (InterruptedException ignore) {
}
}
}
/**
* {@inheritDoc}
*/
@Override
public void addReverse(String fqdn, String ipAddress) {
List<String> commands = createCommands();
List<String> stdins = createAddReverse(fqdn, ipAddress);
CommandResult result = execute(commands, stdins);
if (result.getExitValue() != 0) {
// 逆引きレコードの追加に失敗
AutoException exception = new AutoException("ECOMMON-000203", fqdn, ipAddress);
exception.addDetailInfo(
"result=" + ReflectionToStringBuilder.toString(result, ToStringStyle.SHORT_PREFIX_STYLE));
throw exception;
}
// 逆引きの確認
long timeout = 10000L;
long startTime = System.currentTimeMillis();
while (true) {
String hostName = getHostName(ipAddress);
if (StringUtils.equals(fqdn, hostName)) {
break;
}
if (System.currentTimeMillis() - startTime > timeout) {
// タイムアウト発生時
throw new AutoException("ECOMMON-000204", ipAddress, fqdn, hostName);
}
try {
Thread.sleep(1000);
} catch (InterruptedException ignore) {
}
}
}
/**
* {@inheritDoc}
*/
@Override
public void deleteForward(String fqdn) {
List<String> commands = createCommands();
List<String> stdins = createDeleteForward(fqdn);
CommandResult result = execute(commands, stdins);
if (result.getExitValue() != 0) {
// 正引きレコードの削除に失敗
AutoException exception = new AutoException("ECOMMON-000207", fqdn);
exception.addDetailInfo(
"result=" + ReflectionToStringBuilder.toString(result, ToStringStyle.SHORT_PREFIX_STYLE));
throw exception;
}
// 正引きの確認
long timeout = 10000L;
long startTime = System.currentTimeMillis();
while (true) {
String hostAddress = getHostAddress(fqdn);
if (hostAddress == null) {
break;
}
if (System.currentTimeMillis() - startTime > timeout) {
// タイムアウト発生時
throw new AutoException("ECOMMON-000208", fqdn, hostAddress);
}
try {
Thread.sleep(1000);
} catch (InterruptedException ignore) {
}
}
}
/**
* {@inheritDoc}
*/
@Override
public void deleteReverse(String ipAddress) {
List<String> commands = createCommands();
List<String> stdins = createDeleteReverse(ipAddress);
CommandResult result = execute(commands, stdins);
if (result.getExitValue() != 0) {
// 逆引きレコードの削除に失敗
AutoException exception = new AutoException("ECOMMON-000209", ipAddress);
exception.addDetailInfo(
"result=" + ReflectionToStringBuilder.toString(result, ToStringStyle.SHORT_PREFIX_STYLE));
throw exception;
}
// 逆引きの確認
long timeout = 10000L;
long startTime = System.currentTimeMillis();
while (true) {
String hostName = getHostName(ipAddress);
if (StringUtils.equals(ipAddress, hostName)) {
break;
}
if (System.currentTimeMillis() - startTime > timeout) {
// タイムアウト発生時
throw new AutoException("ECOMMON-000210", ipAddress, hostName);
}
try {
Thread.sleep(1000);
} catch (InterruptedException ignore) {
}
}
}
/**
* {@inheritDoc}
*/
@Override
public void deleteCanonicalName(String fqdn) {
List<String> commands = createCommands();
List<String> stdins = createDeleteCanonicalName(fqdn);
CommandResult result = execute(commands, stdins);
if (result.getExitValue() != 0) {
// CNAMEレコードの削除に失敗
AutoException exception = new AutoException("ECOMMON-000211", fqdn);
exception.addDetailInfo(
"result=" + ReflectionToStringBuilder.toString(result, ToStringStyle.SHORT_PREFIX_STYLE));
throw exception;
}
// CNAMEの確認
long timeout = 10000L;
long startTime = System.currentTimeMillis();
while (true) {
String cname = getCanonicalName(fqdn);
if (cname == null) {
break;
}
if (System.currentTimeMillis() - startTime > timeout) {
// タイムアウト発生時
throw new AutoException("ECOMMON-000212", fqdn, cname);
}
try {
Thread.sleep(1000);
} catch (InterruptedException ignore) {
}
}
}
protected CommandResult execute(List<String> commands, List<String> stdins) {
if (log.isDebugEnabled()) {
log.debug(commands);
log.debug(stdins);
}
CommandResult result = CommandUtils.execute(commands, stdins);
if (log.isDebugEnabled()) {
log.debug(ReflectionToStringBuilder.toString(result));
}
return result;
}
public Volume waitVolume(AwsProcessClient awsProcessClient, String volumeId) {
// ボリュームの処理待ち
Volume volume;
while (true) {
try {
Thread.sleep(1000L * awsProcessClient.getDescribeInterval());
} catch (InterruptedException ignore) {
}
volume = describeVolume(awsProcessClient, volumeId);
VolumeState state;
try {
state = VolumeState.fromValue(volume.getState());
} catch (IllegalArgumentException e) {
// 予期しないステータス
AutoException exception = new AutoException("EPROCESS-000112", volume, volume.getState());
exception.addDetailInfo("result=" + ReflectionToStringBuilder.toString(volume));
throw exception;
}
// 安定状態のステータスになったら終了
if (state == VolumeState.Available || state == VolumeState.InUse || state == VolumeState.Deleted
|| state == VolumeState.Error) {
break;
}
}
return volume;
}
public void waitRun(AwsProcessClient awsProcessClient, Long instanceNo) {
AwsInstance awsInstance = awsInstanceDao.read(instanceNo);
String instanceId = awsInstance.getInstanceId();
// インスタンスの作成待ち
com.amazonaws.services.ec2.model.Instance instance = awsCommonProcess.waitInstance(awsProcessClient,
instanceId);
if (!instance.getState().getName().equals(InstanceStateName.Running.toString())) {
// インスタンス作成失敗時
AutoException exception = new AutoException("EPROCESS-000106", instanceId, instance.getState().getName());
exception.addDetailInfo("result=" + ReflectionToStringBuilder.toString(instance));
throw exception;
}
// ログ出力
if (log.isInfoEnabled()) {
log.info(MessageUtils.getMessage("IPROCESS-100116", instanceId));
}
// イベントログ出力
Instance instance2 = instanceDao.read(instanceNo);
processLogger.debug(null, instance2, "AwsInstanceCreateFinish",
new Object[] { awsProcessClient.getPlatform().getPlatformName(), instanceId });
// データベース更新
awsInstance.setAvailabilityZone(instance.getPlacement().getAvailabilityZone());
awsInstance.setStatus(instance.getState().getName());
awsInstance.setDnsName(instance.getPublicDnsName());
awsInstance.setPrivateDnsName(instance.getPrivateDnsName());
awsInstance.setIpAddress(instance.getPublicIpAddress());
awsInstance.setPrivateIpAddress(instance.getPrivateIpAddress());
awsInstanceDao.update(awsInstance);
}
public void waitStart(AwsProcessClient awsProcessClient, Long instanceNo) {
AwsInstance awsInstance = awsInstanceDao.read(instanceNo);
String instanceId = awsInstance.getInstanceId();
// インスタンスの起動待ち
com.amazonaws.services.ec2.model.Instance instance = awsCommonProcess.waitInstance(awsProcessClient,
instanceId);
if (!instance.getState().getName().equals(InstanceStateName.Running.toString())) {
// インスタンス起動失敗時
AutoException exception = new AutoException("EPROCESS-000126", instanceId, instance.getState().getName());
exception.addDetailInfo("result=" + ReflectionToStringBuilder.toString(instance));
throw exception;
}
// ログ出力
if (log.isInfoEnabled()) {
log.info(MessageUtils.getMessage("IPROCESS-100112", instanceId));
}
// イベントログ出力
Instance instance2 = instanceDao.read(instanceNo);
processLogger.debug(null, instance2, "AwsInstanceStartFinish",
new Object[] { awsProcessClient.getPlatform().getPlatformName(), instanceId });
// データベース更新
awsInstance.setAvailabilityZone(instance.getPlacement().getAvailabilityZone());
awsInstance.setStatus(instance.getState().getName());
awsInstance.setDnsName(instance.getPublicDnsName());
awsInstance.setPrivateDnsName(instance.getPrivateDnsName());
awsInstance.setIpAddress(instance.getPublicIpAddress());
awsInstance.setPrivateIpAddress(instance.getPrivateIpAddress());
awsInstanceDao.update(awsInstance);
}
public void waitStop(AwsProcessClient awsProcessClient, Long instanceNo) {
AwsInstance awsInstance = awsInstanceDao.read(instanceNo);
String instanceId = awsInstance.getInstanceId();
// インスタンスの停止待ち
com.amazonaws.services.ec2.model.Instance instance = awsCommonProcess.waitInstance(awsProcessClient,
instanceId);
if (!instance.getState().getName().equals(InstanceStateName.Stopped.toString())) {
// インスタンス停止失敗時
AutoException exception = new AutoException("EPROCESS-000129", instanceId, instance.getState().getName());
exception.addDetailInfo("result=" + ReflectionToStringBuilder.toString(instance));
throw exception;
}
// ログ出力
if (log.isInfoEnabled()) {
log.info(MessageUtils.getMessage("IPROCESS-100114", instanceId));
}
// イベントログ出力
Instance instance2 = instanceDao.read(instanceNo);
processLogger.debug(null, instance2, "AwsInstanceStopFinish",
new Object[] { awsProcessClient.getPlatform().getPlatformName(), instanceId });
// データベース更新
awsInstance.setAvailabilityZone(instance.getPlacement().getAvailabilityZone());
awsInstance.setStatus(instance.getState().getName());
awsInstance.setDnsName(instance.getPublicDnsName());
awsInstance.setPrivateDnsName(instance.getPrivateDnsName());
awsInstance.setIpAddress(instance.getPublicIpAddress());
awsInstance.setPrivateIpAddress(instance.getPrivateIpAddress());
awsInstanceDao.update(awsInstance);
}
/**
* {@inheritDoc}
*/
@Override
public void execute(String hookName, Object... args) {
String scriptDir = Config.getProperty("hook.scriptDir");
File scriptFile = new File(scriptDir, hookName + scriptExt);
// スクリプトファイルが存在しなければ何もしない
if (!scriptFile.exists()) {
return;
}
List<String> commands = new ArrayList<String>();
commands.add(scriptFile.getAbsolutePath());
if (args != null) {
for (Object arg : args) {
String str = (arg == null) ? "" : arg.toString();
commands.add(str);
}
}
try {
// フック処理のスクリプト実行
CommandResult result = CommandUtils.execute(commands, 60 * 1000L);
if (result.getExitValue() != 0) {
// フック処理のスクリプト実行に失敗
AutoException exception = new AutoException("EPROCESS-000701", hookName);
exception.addDetailInfo("commands=" + commands);
exception.addDetailInfo(
"result=" + ReflectionToStringBuilder.toString(result, ToStringStyle.SHORT_PREFIX_STYLE));
throw exception;
}
} catch (Exception e) {
// XXX: フック処理におけるエラーはPCCの範囲外であるため、エラーが発生しても例外をスローしない
log.error(e.getMessage(), e);
}
}