You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Michael Osipov (JIRA)" <ji...@apache.org> on 2016/01/05 22:42:40 UTC
[jira] [Updated] (MSHARED-489)
AbstractMavenReportRenderer#linkPatternedText ignores name if href is
invalid
[ https://issues.apache.org/jira/browse/MSHARED-489?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Osipov updated MSHARED-489:
-----------------------------------
Description:
Consider this input:
{noformat}
{My Text, ftp://host/file.txt} or {My Text, http:/host/file.txt} (typo)
{noformat}
The current output simply be {{ftp://host/file.txt}} or {{http:/host/file.txt}} but I would expect it to be {{My Text}} in both cases.
The problem is burried in the current code:
{code:java}
for ( Iterator<String> it = segments.iterator(); it.hasNext(); )
{
String name = it.next();
String href = it.next();
if ( href == null )
{
text( name );
}
else
{
if ( getValidHref( href ) != null )
{
link( getValidHref( href ), name );
}
else
{
text( href );
}
}
}
{code}
The invalid {{href}} would be printed out instead of {{name}}. I think the code should read:
{code:java}
for ( Iterator<String> it = segments.iterator(); it.hasNext(); )
{
String name = it.next();
String href = it.next();
if ( getValidHref( href ) == null )
{
text( name );
}
else
{
link( getValidHref( href ), name );
}
}
{code}
Produce link if href isn't null and is valid otherwise add name (text) only.
was:
Consider this input:
{noformat}
{My Text, ftp://host/file.txt} or {My Text, http:/host/file.txt} (typo)
{noformat}
Given the current code:
{code:java}
for ( Iterator<String> it = segments.iterator(); it.hasNext(); )
{
String name = it.next();
String href = it.next();
if ( href == null )
{
text( name );
}
else
{
if ( getValidHref( href ) != null )
{
link( getValidHref( href ), name );
}
else
{
text( href );
}
}
}
{code}
The invalid {{href}} would be printed out instead of {{name}}. I think the code should read:
{code:java}
for ( Iterator<String> it = segments.iterator(); it.hasNext(); )
{
String name = it.next();
String href = it.next();
if ( getValidHref( href ) == null )
{
text( name );
}
else
{
link( getValidHref( href ), name );
}
}
{code}
Produce link if href isn't null and is valid otherwise add name (text) only.
> AbstractMavenReportRenderer#linkPatternedText ignores name if href is invalid
> -----------------------------------------------------------------------------
>
> Key: MSHARED-489
> URL: https://issues.apache.org/jira/browse/MSHARED-489
> Project: Maven Shared Components
> Issue Type: Bug
> Components: maven-reporting-impl
> Affects Versions: maven-reporting-impl 2.4
> Reporter: Michael Osipov
>
> Consider this input:
> {noformat}
> {My Text, ftp://host/file.txt} or {My Text, http:/host/file.txt} (typo)
> {noformat}
> The current output simply be {{ftp://host/file.txt}} or {{http:/host/file.txt}} but I would expect it to be {{My Text}} in both cases.
> The problem is burried in the current code:
> {code:java}
> for ( Iterator<String> it = segments.iterator(); it.hasNext(); )
> {
> String name = it.next();
> String href = it.next();
> if ( href == null )
> {
> text( name );
> }
> else
> {
> if ( getValidHref( href ) != null )
> {
> link( getValidHref( href ), name );
> }
> else
> {
> text( href );
> }
> }
> }
> {code}
> The invalid {{href}} would be printed out instead of {{name}}. I think the code should read:
> {code:java}
> for ( Iterator<String> it = segments.iterator(); it.hasNext(); )
> {
> String name = it.next();
> String href = it.next();
> if ( getValidHref( href ) == null )
> {
> text( name );
> }
> else
> {
> link( getValidHref( href ), name );
> }
> }
> {code}
> Produce link if href isn't null and is valid otherwise add name (text) only.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)