add check openhub prj to MergerProjectsNew2.java
This commit is contained in:
parent
3631f4178b
commit
c8bef39062
|
|
@ -88,10 +88,12 @@ public class MergeProjectNew2 {
|
|||
if(prjHomepage == null || prjHomepage.equals(""))
|
||||
if(model.getSource().equals("apache"))
|
||||
prjHomepage = model.getUrl();
|
||||
// if(model.getSource().equals("openhub"))
|
||||
// if(!isRightUrlByRegex(model.getHomepage())){
|
||||
// prjHomepage=null;
|
||||
// }
|
||||
//暂时性对openhub项目进行处理
|
||||
if(model.getSource().equals("openhub")){
|
||||
if(!isRightUrlByRegex(model.getHomepage())||includeSubStringNum(model.getHomepage(), "http")>1){
|
||||
prjHomepage=null;
|
||||
}
|
||||
}
|
||||
//homepage相同认为一定是相同的项目
|
||||
if(prjHomepage != null && !prjHomepage.equals("")){
|
||||
prjHomepage = deleteHttpPre(prjHomepage);//去掉“http&https”前缀及“/”后缀
|
||||
|
|
@ -422,5 +424,20 @@ public class MergeProjectNew2 {
|
|||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int includeSubStringNum(String str,String subStr){
|
||||
int count = 0;
|
||||
if (str.indexOf(subStr)==-1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if(str.indexOf(subStr) != -1)
|
||||
{
|
||||
count++;
|
||||
count += includeSubStringNum(str.substring(str.indexOf(subStr)+subStr.length()),subStr);
|
||||
return count;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@ public class URLAvailability {
|
|||
|
||||
public static void main(String[] args) {
|
||||
//URLAvailability u = new URLAvailability();
|
||||
System.out.println(isConnect2("http://www.oschina.nethttps://market.aliyun.com/software?spm=5176.1846502.0.0.CpQnwc"));
|
||||
//System.out.println(isRightUrlByRegex("https://www.openhub.net/p/tesseract"));
|
||||
//System.out.println(isConnect2("http://www.oschina.nethttps://market.aliyun.com/software?spm=5176.1846502.0.0.CpQnwc"));
|
||||
System.out.println(isRightUrlByRegex("https://www.openhub.net/p/tesseracthttp://abc.com"));
|
||||
//System.out.println(isConnect("http://www.freecode.com/projects/pdfsam"));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue