Catching the right exception

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-lib@124342 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2016-02-19 10:49:07 +00:00
parent 1ef3cedd3d
commit c4fd8c253c
5 changed files with 51 additions and 33 deletions

View File

@ -93,13 +93,13 @@ public class AggregatedJobUsageRecord extends AbstractJobUsageRecord implements
public AggregatedJobUsageRecord aggregate(AggregatedJobUsageRecord record)
throws NotAggregatableRecordsExceptions {
try {
/*
/* TODO
AggregationUtility<AggregatedJobUsageRecord> aggregationUtility = new AggregationUtility<AggregatedJobUsageRecord>(this);
aggregationUtility.aggregate(record);
*/
// TODO
}catch(Exception e){
throw new UnsupportedOperationException(e);
} catch(NotAggregatableRecordsExceptions e){
throw e; */
} catch(Exception ex){
throw new NotAggregatableRecordsExceptions(ex);
}
//return this;
@ -114,8 +114,10 @@ public class AggregatedJobUsageRecord extends AbstractJobUsageRecord implements
throws NotAggregatableRecordsExceptions {
try {
return aggregate(new AggregatedJobUsageRecord(record));
} catch (InvalidValueException e) {
throw new NotAggregatableRecordsExceptions(e.getCause());
} catch(NotAggregatableRecordsExceptions e){
throw e;
} catch(Exception ex){
throw new NotAggregatableRecordsExceptions(ex);
}
}
@ -136,8 +138,10 @@ public class AggregatedJobUsageRecord extends AbstractJobUsageRecord implements
public boolean isAggregable(JobUsageRecord record) throws NotAggregatableRecordsExceptions {
try {
return isAggregable(new AggregatedJobUsageRecord(record));
} catch (InvalidValueException e) {
throw new NotAggregatableRecordsExceptions(e.getCause());
} catch(NotAggregatableRecordsExceptions e){
throw e;
} catch(Exception ex){
throw new NotAggregatableRecordsExceptions(ex);
}
}

View File

@ -95,13 +95,13 @@ public class AggregatedPortletUsageRecord extends AbstractPortletUsageRecord imp
AggregatedPortletUsageRecord record)
throws NotAggregatableRecordsExceptions {
try {
/*
/* TODO
AggregationUtility<AggregatedPortletUsageRecord> aggregationUtility = new AggregationUtility<AggregatedPortletUsageRecord>(this);
aggregationUtility.aggregate(record);
*/
// TODO
}catch(Exception e){
throw new UnsupportedOperationException(e);
} catch(NotAggregatableRecordsExceptions e){
throw e; */
} catch(Exception ex){
throw new NotAggregatableRecordsExceptions(ex);
}
//return this;

View File

@ -171,8 +171,10 @@ public class AggregatedServiceUsageRecord extends AbstractServiceUsageRecord imp
throws NotAggregatableRecordsExceptions {
try {
return aggregate(new AggregatedServiceUsageRecord(record));
} catch (InvalidValueException e) {
throw new NotAggregatableRecordsExceptions(e.getCause());
} catch(NotAggregatableRecordsExceptions e){
throw e;
} catch(Exception ex){
throw new NotAggregatableRecordsExceptions(ex);
}
}
@ -194,8 +196,10 @@ public class AggregatedServiceUsageRecord extends AbstractServiceUsageRecord imp
throws NotAggregatableRecordsExceptions {
try {
return isAggregable(new AggregatedServiceUsageRecord(record));
} catch (InvalidValueException e) {
throw new NotAggregatableRecordsExceptions(e.getCause());
} catch(NotAggregatableRecordsExceptions e){
throw e;
} catch(Exception ex){
throw new NotAggregatableRecordsExceptions(ex);
}
}

View File

@ -109,8 +109,10 @@ public class AggregatedStorageUsageRecord extends AbstractStorageUsageRecord imp
AggregationUtility<AggregatedStorageUsageRecord> aggregationUtility = new AggregationUtility<AggregatedStorageUsageRecord>(this);
aggregationUtility.aggregate(record);
this.setDataVolume(this.getDataVolume() + record.getDataVolume());
}catch(Exception e){
throw new UnsupportedOperationException(e);
}catch(NotAggregatableRecordsExceptions e){
throw e;
} catch(Exception ex){
throw new NotAggregatableRecordsExceptions(ex);
}
return this;
}
@ -123,8 +125,10 @@ public class AggregatedStorageUsageRecord extends AbstractStorageUsageRecord imp
throws NotAggregatableRecordsExceptions {
try {
return aggregate(new AggregatedStorageUsageRecord(record));
} catch (InvalidValueException e) {
throw new NotAggregatableRecordsExceptions(e.getCause());
} catch(NotAggregatableRecordsExceptions e){
throw e;
} catch(Exception ex){
throw new NotAggregatableRecordsExceptions(ex);
}
}
@ -146,8 +150,10 @@ public class AggregatedStorageUsageRecord extends AbstractStorageUsageRecord imp
throws NotAggregatableRecordsExceptions {
try {
return isAggregable(new AggregatedStorageUsageRecord(record));
} catch (InvalidValueException e) {
throw new NotAggregatableRecordsExceptions(e.getCause());
} catch(NotAggregatableRecordsExceptions e){
throw e;
} catch(Exception ex){
throw new NotAggregatableRecordsExceptions(ex);
}
}

View File

@ -94,13 +94,13 @@ public class AggregatedTaskUsageRecord extends AbstractTaskUsageRecord implement
public AggregatedTaskUsageRecord aggregate(AggregatedTaskUsageRecord record)
throws NotAggregatableRecordsExceptions {
try {
/*
/* TODO
AggregationUtility<AggregatedTaskUsageRecord> aggregationUtility = new AggregationUtility<AggregatedTaskUsageRecord>(this);
aggregationUtility.aggregate(record);
*/
// TODO
}catch(Exception e){
throw new UnsupportedOperationException(e);
} catch(NotAggregatableRecordsExceptions e){
throw e; */
} catch(Exception ex){
throw new NotAggregatableRecordsExceptions(ex);
}
//return this;
@ -115,8 +115,10 @@ public class AggregatedTaskUsageRecord extends AbstractTaskUsageRecord implement
throws NotAggregatableRecordsExceptions {
try {
return aggregate(new AggregatedTaskUsageRecord(record));
} catch (InvalidValueException e) {
throw new NotAggregatableRecordsExceptions(e.getCause());
} catch(NotAggregatableRecordsExceptions e){
throw e;
} catch(Exception ex){
throw new NotAggregatableRecordsExceptions(ex);
}
}
@ -136,8 +138,10 @@ public class AggregatedTaskUsageRecord extends AbstractTaskUsageRecord implement
public boolean isAggregable(TaskUsageRecord record) throws NotAggregatableRecordsExceptions {
try {
return isAggregable(new AggregatedTaskUsageRecord(record));
} catch (InvalidValueException e) {
throw new NotAggregatableRecordsExceptions(e.getCause());
} catch(NotAggregatableRecordsExceptions e){
throw e;
} catch(Exception ex){
throw new NotAggregatableRecordsExceptions(ex);
}
}