Java Code Examples for org.apache.commons.lang.StringUtils.removeEnd()

The following are Jave code examples for showing how to use removeEnd() of the org.apache.commons.lang.StringUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: util4j   File: HexStrBytes.java   View Source Code Vote up 5 votes
/**
 * 根据字节数组拆分若干个字字节数组
 * @param data    待拆分数组
 * @param separator 分割数组
 * @return 
 */
public byte[][] getSonArrays(byte[] data,byte[] separator)
{
	if(data==null||data.length<=0||separator==null||separator.length<=0)
	{
		System.out.println("data||separator数据无效!");
		return null;
	}
	String[] dataHexArray=toHexArray(data);
	String dataHexStr=StringUtils.substringBetween(Arrays.toString(dataHexArray), "[", "]").replaceAll("\\s","");
	//System.out.println("待拆分字符串:"+dataHexStr);
	String[] separatorHexhArray=toHexArray(separator);
	String separatorHexStr=StringUtils.substringBetween(Arrays.toString(separatorHexhArray), "[", "]").replaceAll("\\s","");
	//System.out.println("字符串拆分符:"+separatorHexStr);
	//得到拆分后的数组
	String[] arrays=StringUtils.splitByWholeSeparator(dataHexStr, separatorHexStr);
	//System.out.println("拆分后的数组:"+Arrays.toString(arrays));
	if(arrays==null||arrays.length<=0)
	{
		System.out.println("注意:数组拆分为0");
		return null;
	}
	byte[][] result=new byte[arrays.length][];
	//对子数组进行重组
	for(int i=0;i<arrays.length;i++)
	{
		String arrayStr=arrays[i];
		arrayStr=StringUtils.removeStart(arrayStr, ",");//去掉两端的逗号
		arrayStr=StringUtils.removeEnd(arrayStr, ",");//去掉两端的逗号
		String[] array=arrayStr.split(",");//根据子字符串中间剩余的逗号重组为hex字符串
		result[i]=toBtyeArray(array);
	}
	return result;
}
 
Example 2
Project: util4j   File: DataTools.java   View Source Code Vote up 5 votes
/**
 * 根据字节数组拆分若干个字字节数组
 * @param data
 * @param separator
 * @return
 */
public byte[][] getsonArrays(byte[] data,byte[] separator)
{
	if(data==null||data.length<=0||separator==null||separator.length<=0)
	{
		System.out.println("data||separator数据无效!");
		return null;
	}
	String[] dataHexArray=byteArrayToHexArray(data);
	String dataHexStr=StringUtils.substringBetween(Arrays.toString(dataHexArray), "[", "]").replaceAll("\\s","");
	//System.out.println("待拆分字符串:"+dataHexStr);
	String[] separatorHexhArray=byteArrayToHexArray(separator);
	String separatorHexStr=StringUtils.substringBetween(Arrays.toString(separatorHexhArray), "[", "]").replaceAll("\\s","");
	//System.out.println("字符串拆分符:"+separatorHexStr);
	//得到拆分后的数组
	String[] arrays=StringUtils.splitByWholeSeparator(dataHexStr, separatorHexStr);
	//System.out.println("拆分后的数组:"+Arrays.toString(arrays));
	if(arrays==null||arrays.length<=0)
	{
		System.out.println("注意:数组拆分为0");
		return null;
	}
	byte[][] result=new byte[arrays.length][];
	//对子数组进行重组
	for(int i=0;i<arrays.length;i++)
	{
		String arrayStr=arrays[i];
		arrayStr=StringUtils.removeStart(arrayStr, ",");//去掉两端的逗号
		arrayStr=StringUtils.removeEnd(arrayStr, ",");//去掉两端的逗号
		String[] array=arrayStr.split(",");//根据子字符串中间剩余的逗号重组为hex字符串
		result[i]=hexArrayToBtyeArray(array);
	}
	return result;
}
 
Example 3
Project: otter-G   File: AttachmentHttpPipe.java   View Source Code Vote up 5 votes
private File unpackFile(HttpPipeKey key) {
    Pipeline pipeline = configClientService.findPipeline(key.getIdentity().getPipelineId());
    DataRetriever dataRetriever = dataRetrieverFactory.createRetriever(pipeline.getParameters().getRetriever(),
                                                                       key.getUrl(), downloadDir);
    File archiveFile = null;
    try {
        dataRetriever.connect();
        dataRetriever.doRetrieve();
        archiveFile = dataRetriever.getDataAsFile();
    } catch (Exception e) {
        dataRetriever.abort();
        throw new PipeException("download_error", e);
    } finally {
        dataRetriever.disconnect();
    }

    // 处理下有加密的数据
    if (StringUtils.isNotEmpty(key.getKey()) && StringUtils.isNotEmpty(key.getCrc())) {
        decodeFile(archiveFile, key.getKey(), key.getCrc());
    }

    // 去除末尾的.gzip后缀,做为解压目录
    String dir = StringUtils.removeEnd(archiveFile.getPath(),
                                       FilenameUtils.EXTENSION_SEPARATOR_STR
                                               + FilenameUtils.getExtension(archiveFile.getPath()));
    File unpackDir = new File(dir);
    // 开始解压
    getArchiveBean().unpack(archiveFile, unpackDir);
    return unpackDir;
}
 
Example 4
Project: Hydrograph   File: OutputMysqlUiConverter.java   View Source Code Vote up 5 votes
/**
 * Appends primary keys using a comma
 * @param newTable
 */
private String getLoadTypePrimaryKeyUIValue(TypePrimaryKeys newTable) {
	StringBuffer stringBuffer = new StringBuffer();
	if(newTable !=null && newTable.getPrimaryKeys() !=null){
		TypeKeyFields typeKeyFields = newTable.getPrimaryKeys();
		for(TypeFieldName typeFieldName : typeKeyFields.getField()){
			stringBuffer.append(typeFieldName.getName());
			stringBuffer.append(",");
		}
	}
	return StringUtils.removeEnd(stringBuffer.toString(), ",");
}
 
Example 5
Project: Hydrograph   File: OutputMysqlUiConverter.java   View Source Code Vote up 5 votes
/**
 *  Appends update keys using a comma
 * @param update
 */
private String getLoadTypeUpdateKeyUIValue(TypeUpdateKeys update) {
	StringBuffer buffer=new StringBuffer();
		if(update!=null && update.getUpdateByKeys()!=null){
			TypeKeyFields keyFields=update.getUpdateByKeys();
			for(TypeFieldName fieldName:keyFields.getField()){
				buffer.append(fieldName.getName());
				buffer.append(",");
				}
		}
	
	return StringUtils.removeEnd(buffer.toString(), ",");
}
 
Example 6
Project: Hydrograph   File: OutputTeradataUiConverter.java   View Source Code Vote up 5 votes
/**
 * Appends primary keys using a comma
 * @param newTable
 */
private String getLoadTypePrimaryKeyUIValue(TypePrimaryKeys newTable) {
	StringBuffer stringBuffer = new StringBuffer();
	if(newTable !=null && newTable.getPrimaryKeys() !=null){
		TypeKeyFields typeKeyFields = newTable.getPrimaryKeys();
		for(TypeFieldName typeFieldName : typeKeyFields.getField()){
			stringBuffer.append(typeFieldName.getName());
			stringBuffer.append(",");
		}
	}
	return StringUtils.removeEnd(stringBuffer.toString(), ",");
}
 
Example 7
Project: Hydrograph   File: OutputTeradataUiConverter.java   View Source Code Vote up 5 votes
/**
 *  Appends update keys using a comma
 * @param update
 */
private String getLoadTypeUpdateKeyUIValue(TypeUpdateKeys update) {
	StringBuffer buffer=new StringBuffer();
		if(update!=null && update.getUpdateByKeys()!=null){
			TypeKeyFields keyFields=update.getUpdateByKeys();
			for(TypeFieldName fieldName:keyFields.getField()){
				buffer.append(fieldName.getName());
				buffer.append(",");
				}
		}
	return StringUtils.removeEnd(buffer.toString(), ",");
}
 
Example 8
Project: Hydrograph   File: OutputRedshiftUiConverter.java   View Source Code Vote up 5 votes
/**
 *  Appends primary keys using a comma
 * @param newTable
 * @return
 */
private String getLoadTypePrimaryKeyUIValue(TypePrimaryKeys newTable) {
	StringBuffer stringBuffer = new StringBuffer();
	if(newTable !=null && newTable.getPrimaryKeys() !=null){
		TypeKeyFields typeKeyFields = newTable.getPrimaryKeys();
		for(TypeFieldName typeFieldName : typeKeyFields.getField()){
			stringBuffer.append(typeFieldName.getName());
			stringBuffer.append(",");
		}
	}
	return StringUtils.removeEnd(stringBuffer.toString(), ",");
}
 
Example 9
Project: Hydrograph   File: OutputRedshiftUiConverter.java   View Source Code Vote up 5 votes
/**
 *  Appends update keys using a comma
 * @param update
 * @return
 */
private String getLoadTypeUpdateKeyUIValue(TypeUpdateKeys update) {
	StringBuffer buffer=new StringBuffer();
		if(update!=null && update.getUpdateByKeys()!=null){
			TypeKeyFields keyFields=update.getUpdateByKeys();
			for(TypeFieldName fieldName:keyFields.getField()){
				buffer.append(fieldName.getName());
				buffer.append(",");
				}
		}
	
	return StringUtils.removeEnd(buffer.toString(), ",");
}
 
Example 10
Project: Hydrograph   File: OutputOracleUiConverter.java   View Source Code Vote up 5 votes
/**
 * Appends primary keys using a comma
 * @param newTable
 */
private String getLoadTypePrimaryKeyUIValue(TypePrimaryKeys newTable) {
	StringBuffer stringBuffer = new StringBuffer();
	if(newTable !=null && newTable.getPrimaryKeys() !=null){
		TypeKeyFields typeKeyFields = newTable.getPrimaryKeys();
		for(TypeFieldName typeFieldName : typeKeyFields.getField()){
			stringBuffer.append(typeFieldName.getName());
			stringBuffer.append(",");
		}
	}
	return StringUtils.removeEnd(stringBuffer.toString(), ",");
}
 
Example 11
Project: Hydrograph   File: OutputOracleUiConverter.java   View Source Code Vote up 5 votes
/**
 *  Appends update keys using a comma
 * @param update
 */
private String getLoadTypeUpdateKeyUIValue(TypeUpdateKeys update) {
	StringBuffer buffer=new StringBuffer();
		if(update!=null && update.getUpdateByKeys()!=null){
			TypeKeyFields keyFields=update.getUpdateByKeys();
			for(TypeFieldName fieldName:keyFields.getField()){
				buffer.append(fieldName.getName());
				buffer.append(",");
				}
		}
	
	return StringUtils.removeEnd(buffer.toString(), ",");
}
 
Example 12
Project: Hydrograph   File: OutputDBUpdateUiConverter.java   View Source Code Vote up 5 votes
/**
 *  Appends update keys using a comma
 * @param typeUpdateKeys
 */
private String getUpdateKeyUIValue(TypeUpdateKeys typeUpdateKeys) {
	StringBuffer buffer=new StringBuffer();
		if(typeUpdateKeys!=null && typeUpdateKeys.getUpdateByKeys()!=null){
			TypeKeyFields keyFields=typeUpdateKeys.getUpdateByKeys();
			for(TypeFieldName fieldName:keyFields.getField()){
				buffer.append(fieldName.getName());
				buffer.append(",");
				}
		}
	
	return StringUtils.removeEnd(buffer.toString(), ",");
}
 
Example 13
Project: Hydrograph   File: OutputSparkRedshiftUiConverter.java   View Source Code Vote up 5 votes
/**
 *  Appends primary keys using a comma
 * @param newTable
 * @return
 */
private String getLoadTypePrimaryKeyUIValue(TypePrimaryKeys newTable) {
	StringBuffer stringBuffer = new StringBuffer();
	if(newTable !=null && newTable.getPrimaryKeys() !=null){
		TypeKeyFields typeKeyFields = newTable.getPrimaryKeys();
		for(TypeFieldName typeFieldName : typeKeyFields.getField()){
			stringBuffer.append(typeFieldName.getName());
			stringBuffer.append(",");
		}
	}
	return StringUtils.removeEnd(stringBuffer.toString(), ",");
}
 
Example 14
Project: maven-release-yearly-policy   File: YearlyVersionPolicy.java   View Source Code Vote up 5 votes
/**
 * {@inheritDoc}
 */
public VersionPolicyResult getReleaseVersion(final VersionPolicyRequest versionPolicyRequest)
        throws PolicyException, VersionParseException {
    final String version = versionPolicyRequest.getVersion();
    final String cleanedVersion = StringUtils.removeEnd(version, snapshotPostfix);
    final String majorVersionComponent = StringUtils.substringBefore(cleanedVersion, ".");

    final String releaseVersion = matchesYear(majorVersionComponent, currentYear) ? cleanedVersion : firstOfYear();

    return new VersionPolicyResult()
            .setVersion(releaseVersion);
}
 
Example 15
Project: SugarOnRest   File: QueryBuilder.java   View Source Code Vote up 4 votes
/**
 * Build the where clause part of a SugarCRM query.
 *
 *  @param predicates The json predicates.
 *  @return The formatted query.
 */
public static String getWhereClause(List<JsonPredicate> predicates) {
    if ((predicates == null) || (predicates.size() == 0)) {
        return StringUtils.EMPTY;
    }

    StringBuilder queryBuilder = new StringBuilder();
    String subQuery = StringUtils.EMPTY;
    for (JsonPredicate predicate : predicates)
    {
        switch(predicate.operator) {
            case Equal:
                subQuery = predicate.isNumeric ? String.format("%s = %s", predicate.jsonName, predicate.value) : String.format("%s = '%s'", predicate.jsonName, predicate.value);
                break;

            case GreaterThan:
                subQuery = predicate.isNumeric ? String.format("%s > %s", predicate.jsonName, predicate.value) : String.format("%s > '%s'", predicate.jsonName, predicate.value);
                break;

            case GreaterThanOrEqualTo:
                subQuery = predicate.isNumeric ? String.format("%s >= %s", predicate.jsonName, predicate.value) : String.format("%s >= '%s'", predicate.jsonName, predicate.value);
                break;

            case LessThan:
                subQuery = predicate.isNumeric ? String.format("%s < %s", predicate.jsonName, predicate.value) : String.format("%s < '%s'", predicate.jsonName, predicate.value);
                break;

            case LessThanOrEqualTo:
                subQuery = predicate.isNumeric ? String.format("%s <= %s", predicate.jsonName, predicate.value) : String.format("%s <= '%s'", predicate.jsonName, predicate.value);
                break;

            case Contains:
                subQuery = predicate.jsonName + " LIKE '%" + predicate.value + "%'";
                break;

            case StartsWith:
                subQuery = predicate.jsonName + " LIKE '" + predicate.value + "%'";
                break;

            case EndsWith:
                subQuery = predicate.jsonName + " LIKE '%" + predicate.value + "'";
                break;

            case Between:
                subQuery = predicate.isNumeric ? String.format("%s BETWEEN %s AND %s", predicate.jsonName, predicate.fromValue, predicate.toValue) : String.format("%s BETWEEN '%s' AND '%s'", predicate.jsonName, predicate.fromValue, predicate.toValue);
                break;

            case WhereIn:
                subQuery = String.format("%s IN (%s)", predicate.jsonName, predicate.value);
                break;
        }

        queryBuilder.append(subQuery);
        queryBuilder.append(" AND ");
    }

    String query = queryBuilder.toString();
    if (!StringUtils.isNotBlank(query))
    {
        return StringUtils.EMPTY;
    }

    query = StringUtils.removeEnd(query.trim(),"AND");
    query = " " + query.trim() + " ";
    return query;
}
 
Example 16
Project: SugarOnRest   File: QueryTests.java   View Source Code Vote up 4 votes
@Test
public void readBulkWithQuery2Test() {

    SugarRestRequest request = new SugarRestRequest("Leads", RequestType.BulkRead);
    request.setUrl(TestAccount.Url);
    request.setUsername(TestAccount.Username);
    request.setPassword(TestAccount.Password);

    request.getOptions().setMaxResult(10);

    SugarRestClient client = new SugarRestClient();
    SugarRestResponse response = client.execute(request);

    assertNotNull(response);
    assertEquals(response.getStatusCode(), HttpStatus.SC_OK);

    List<Leads> readLeads = (List<Leads>)response.getData();
    assertNotNull(readLeads);

    // Read back with query
    // Get all identifiers
    List<String> identifiers = new ArrayList<String>();
    for (Leads lead : readLeads) {
        identifiers.add(lead.getId());
    }

    // Reset options
    request.setOptions(new Options());
    List<QueryPredicate> queryPredicates = new ArrayList<QueryPredicate>();

    // Set query in this format:
    // "leads.id IN('10d82d59-08eb-8f0d-28e0-5777b57af47c', '12037cd0-ead2-402e-e1d0-5777b5dfb965', '13d4109d-c5ca-7dd1-99f1-5777b57ef30f', '14c136e5-1a67-eeba-581c-5777b5c8c463', '14e4825e-9573-4d75-2dbe-5777b5b7ee85', '1705b33a-3fad-aa70-77ef-5777b5b081f1', '171c1d8b-e34f-3a1f-bef7-5777b5ecc823', '174a8fc4-56e6-3471-46d8-5777b565bf5b', '17c9c496-90a1-02f5-87bd-5777b51ab086', '1d210352-7a1f-2c5d-04ae-5777b5a3312f')");

    StringBuilder builder = new StringBuilder();
    for (String id : identifiers) {
        builder.append(" '" + id + "', ");
    }
    String builderResult = builder.toString().trim();
    builderResult = StringUtils.removeEnd(builderResult, ",");
    String query = "leads.id IN(" + builderResult + ")";

    // Since query is set, the query predicates will be ignore.
    request.getOptions().setQuery(query);
    queryPredicates.add(new QueryPredicate("last_name", Equal, "Johnson"));
    request.getOptions().setQueryPredicates(queryPredicates);

    response = client.execute(request);

    assertNotNull(response);
    assertEquals(response.getStatusCode(), HttpStatus.SC_OK);

    List<Leads> readLeadsWithQuery = (List<Leads>)response.getData();
    assertNotNull(readLeadsWithQuery);

    assertEquals(identifiers.size(), readLeads.size());
    assertEquals(identifiers.size(), readLeadsWithQuery.size());
    assertEquals(readLeads.size(), readLeadsWithQuery.size());
}
 
Example 17
Project: monarch   File: PreprocessorUtils.java   View Source Code Vote up 4 votes
/**
 * 
 * This function will trim the given input string. It will not only remove the spaces and tabs at
 * the end but also compress multiple spaces and tabs to a single space
 * 
 * @param input The input string on which the trim operation needs to be performed
 * @param retainLineSeparator whether to retain the line separator.
 * 
 * @return String
 */
public static TrimmedInput trim(final String input, final boolean retainLineSeparator) {
  if (input != null) {
    String inputCopy = input;
    StringBuffer output = new StringBuffer();
    // First remove the trailing white spaces, we do not need those
    inputCopy = StringUtils.stripEnd(inputCopy, null);
    // As this parser is for optionParsing, we also need to remove
    // the trailing optionSpecifiers provided it has previous
    // options. Remove the trailing LONG_OPTION_SPECIFIERs
    // in a loop. It is necessary to check for previous options for
    // the case of non-mandatory arguments.
    // "^(.*)(\\s-+)$" - something that ends with a space followed by a series of hyphens.
    while (Pattern.matches("^(.*)(\\s-+)$", inputCopy)) {
      inputCopy = StringUtils.removeEnd(inputCopy, SyntaxConstants.SHORT_OPTION_SPECIFIER);

      // Again we need to trim the trailing white spaces
      // As we are in a loop
      inputCopy = StringUtils.stripEnd(inputCopy, null);
    }
    // Here we made use of the String class function trim to remove the
    // space and tabs if any at the
    // beginning and the end of the string
    int noOfSpacesRemoved = 0;
    {
      int length = inputCopy.length();
      inputCopy = inputCopy.trim();
      noOfSpacesRemoved += length - inputCopy.length();
    }
    // Now we need to compress the multiple spaces and tabs to single space
    // and tabs but we also need to ignore the white spaces inside the
    // quotes and parentheses

    StringBuffer buffer = new StringBuffer();

    boolean startWhiteSpace = false;
    for (int i = 0; i < inputCopy.length(); i++) {
      char ch = inputCopy.charAt(i);
      buffer.append(ch);
      if (PreprocessorUtils.isWhitespace(ch)) {
        if (PreprocessorUtils.isSyntaxValid(buffer.toString())) {
          if (startWhiteSpace) {
            noOfSpacesRemoved++;
          } else {
            startWhiteSpace = true;
            if (ch == '\n') {
              if (retainLineSeparator) {
                output.append("\n");
              }
            } else {
              output.append(" ");
            }
          }
          buffer.delete(0, buffer.length());
        } else {
          output.append(ch);
        }
      } else {
        startWhiteSpace = false;
        output.append(ch);
      }
    }
    return new TrimmedInput(output.toString(), noOfSpacesRemoved);
  } else {
    return null;
  }
}
 
Example 18
Project: hadoop   File: AzureNativeFileSystemStore.java   View Source Code Vote up 4 votes
/**
 * Trims a suffix/prefix from the given string. For example if
 * s is given as "/xy" and toTrim is "/", this method returns "xy"
 */
private static String trim(String s, String toTrim) {
  return StringUtils.removeEnd(StringUtils.removeStart(s, toTrim),
      toTrim);
}
 
Example 19
Project: htmldoclet4jdk8   File: ConfigurationImpl.java   View Source Code Vote up 4 votes
/**
 * Depending upon the command line options provided by the user, set
 * configure the output generation environment.
 * 
 * @param options
 *            The array of option names and values.
 */
public void setSpecificDocletOptions(String[][] options) {
	for (int oi = 0; oi < options.length; ++oi) {
		String[] os = options[oi];
		String opt = os[0].toLowerCase();
		if (opt.equals("-charset")) {
			charset = os[1];
		} else if (opt.equals("-noframe")) {
			noframe = true;
		} else if (opt.equals("-dubboconfigpath")) {
			dubboconfigpath = os[1];
		} else if (opt.equals("-springcontextconfigpath")) {
			springcontextconfigpath = os[1];
		} else if (opt.equals("-excludedurlsxpath")) {
			excludedurlsxpath = os[1];
		} else if (opt.equals("-systemname")) {
			systemname = os[1];
		} else if (opt.equals("-branchname")) {
			branchname = os[1];
		} else if (opt.equals("-searchengine")) {
			searchengine = os[1];
		} else if (opt.equals("-codeurl")) {
			codeurl = os[1];
		} else if (opt.equals("-buildid")) {
			buildid = os[1];
		}
	}
	// if branchname is not specified, try to resolve it from codeurl.
	if (StringUtils.isEmpty(branchname) && StringUtils.isNotEmpty(codeurl)) {
		codeurl = StringUtils.removeEnd(codeurl, "/");
		String[] parts = StringUtils.split(codeurl, '/');
		branchname = parts[parts.length - 1];
	}
	if (root.specifiedClasses().length > 0) {
		Map<String, PackageDoc> map = new HashMap<String, PackageDoc>();
		PackageDoc pd;
		ClassDoc[] classes = root.classes();
		for (int i = 0; i < classes.length; i++) {
			pd = classes[i].containingPackage();
			if (!map.containsKey(pd.name())) {
				map.put(pd.name(), pd);
			}
		}
	}
}
 
Example 20
Project: htmldoclet4jdk7   File: ConfigurationImpl.java   View Source Code Vote up 4 votes
/**
 * Depending upon the command line options provided by the user, set
 * configure the output generation environment.
 * 
 * @param options
 *            The array of option names and values.
 */
public void setSpecificDocletOptions(String[][] options) {
	for (int oi = 0; oi < options.length; ++oi) {
		String[] os = options[oi];
		String opt = os[0].toLowerCase();
		if (opt.equals("-charset")) {
			charset = os[1];
		} else if (opt.equals("-noframe")) {
			noframe = true;
		} else if (opt.equals("-dubboconfigpath")) {
			dubboconfigpath = os[1];
		} else if (opt.equals("-springcontextconfigpath")) {
			springcontextconfigpath = os[1];
		} else if (opt.equals("-excludedurlsxpath")) {
			excludedurlsxpath = os[1];
		} else if (opt.equals("-systemname")) {
			systemname = os[1];
		} else if (opt.equals("-branchname")) {
			branchname = os[1];
		} else if (opt.equals("-searchengine")) {
			searchengine = os[1];
		} else if (opt.equals("-codeurl")) {
			codeurl = os[1];
		} else if (opt.equals("-buildid")) {
			buildid = os[1];
		}
	}
	// if branchname is not specified, try to resolve it from codeurl.
	if (StringUtils.isEmpty(branchname) && StringUtils.isNotEmpty(codeurl)) {
		codeurl = StringUtils.removeEnd(codeurl, "/");
		String[] parts = StringUtils.split(codeurl, '/');
		branchname = parts[parts.length - 1];
	}
	if (root.specifiedClasses().length > 0) {
		Map<String, PackageDoc> map = new HashMap<String, PackageDoc>();
		PackageDoc pd;
		ClassDoc[] classes = root.classes();
		for (int i = 0; i < classes.length; i++) {
			pd = classes[i].containingPackage();
			if (!map.containsKey(pd.name())) {
				map.put(pd.name(), pd);
			}
		}
	}
}