modify transfer to add try catch exception
This commit is contained in:
parent
27e52518f8
commit
ef65d3e927
|
@ -4,6 +4,7 @@ import java.text.DateFormat;
|
|||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
@ -46,13 +47,15 @@ public class TestDate {
|
|||
}
|
||||
|
||||
public void start_test(){
|
||||
String homepage = "http://github.com/apache/abdera;http://incubator.apache.org/abdera/";
|
||||
String homepage1 = "http://incubator.apache.org/abdera/";
|
||||
String arr[] = homepage1.split(";");
|
||||
System.out.println(arr.length);
|
||||
for(String a : arr){
|
||||
System.out.println(a);
|
||||
}
|
||||
// String homepage = "http://github.com/apache/abdera;http://incubator.apache.org/abdera/";
|
||||
// String homepage1 = "http://incubator.apache.org/abdera/";
|
||||
// String arr[] = homepage1.split(";");
|
||||
// System.out.println(arr.length);
|
||||
// for(String a : arr){
|
||||
// System.out.println(a);
|
||||
// }
|
||||
Set<Integer> set = dbDest.selectOpenSourceProjectsIds("gather_projects_test");
|
||||
System.out.println(set.size());
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ public class TransferProjects {
|
|||
}
|
||||
|
||||
public void start(){
|
||||
boolean isUpdate = false;
|
||||
|
||||
haveTransferSet = new HashSet<Integer>();
|
||||
haveTransferSet = dbDest.selectOpenSourceProjectsIds(targetTableName);
|
||||
int delCount = 0;
|
||||
|
@ -85,6 +85,7 @@ public class TransferProjects {
|
|||
}
|
||||
}
|
||||
for(EddRelations relation:eddRelationList){
|
||||
boolean isUpdate = false;
|
||||
String gather_projects_ids = relation.getGather_projects_ids();
|
||||
try {
|
||||
gather_projects_ids = gather_projects_ids.substring(1, gather_projects_ids.length() - 1);
|
||||
|
|
|
@ -16,6 +16,7 @@ import javax.annotation.Resource;
|
|||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -213,7 +214,13 @@ public class TransferProjectsUtil2 {
|
|||
dbSource.deleteTaggingsByTaggableId(taggingTableName, formerOsp.getId()); //由于没有级联删除 因此需要手动删除
|
||||
dbDest.deleteMatchResult(formerOsp.getId(), getTargetTable(formerOsp.getId()));
|
||||
}
|
||||
dbDest.insertOsp(openSourceProjectTableName, osp);//将数据插入open_source_projects表中
|
||||
try{
|
||||
dbDest.insertOsp(openSourceProjectTableName, osp);//将数据插入open_source_projects表中
|
||||
}catch (DuplicateKeyException e){
|
||||
System.out.println(isUpdate);
|
||||
System.out.println(e);
|
||||
}
|
||||
|
||||
int osp_id = osp.getId();
|
||||
String tags = osp.getTags();//tag分离
|
||||
if(tags != null){//表示该项目没有标签
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
destroy-method="close">
|
||||
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
|
||||
<property name="url"
|
||||
value="jdbc:mysql://localhost/ossean?characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true" />
|
||||
value="jdbc:mysql://localhost/ossean_production?characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true" />
|
||||
<property name="username" value="root" />
|
||||
<property name="password" value="123456" />
|
||||
<property name="password" value="1234" />
|
||||
<property name="validationQuery" value="SELECT 1" />
|
||||
<property name="testOnBorrow" value="true"/>
|
||||
</bean>
|
||||
|
@ -38,9 +38,9 @@
|
|||
destroy-method="close">
|
||||
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
|
||||
<property name="url"
|
||||
value="jdbc:mysql://localhost:3306/ossean?characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true" />
|
||||
value="jdbc:mysql://localhost:3306/ossean_production?characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true" />
|
||||
<property name="username" value="root" />
|
||||
<property name="password" value="123456" />
|
||||
<property name="password" value="1234" />
|
||||
<property name="validationQuery" value="SELECT 1" />
|
||||
<property name="testOnBorrow" value="true"/>
|
||||
</bean>
|
||||
|
|
Loading…
Reference in New Issue