Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSPWIKI-1158 -Remove unnecessary ToString #147

Merged
merged 1 commit into from
Oct 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions jspwiki-main/src/main/java/org/apache/wiki/WikiPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,7 @@ public WikiPage clone() {
p.m_version = m_version;
p.m_lastModified = m_lastModified != null ? (Date)m_lastModified.clone() : null;
p.m_fileSize = m_fileSize;
for( final Map.Entry< String, Object > entry : m_attributes.entrySet() ) {
p.m_attributes.put( entry.getKey(), entry.getValue() );
}
p.m_attributes.putAll( m_attributes );

if( m_accessList != null ) {
p.m_accessList = new AclImpl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ public void actionPerformed( final WikiEvent event ) {
// Oooo! This is really bad...
log.error( "Could not change user name in Group lists because of GroupDatabase error:" + e.getMessage() );
}
log.info( "Profile name change for '" + newPrincipal.toString() + "' caused " + groupsChanged + " groups to change also." );
log.info( "Profile name change for '" + newPrincipal + "' caused " + groupsChanged + " groups to change also." );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,10 +459,7 @@ private UserProfile findByAttribute( final String matchAttribute, String index )
}

// check if we have to do a case insensitive compare
boolean caseSensitiveCompare = true;
if (matchAttribute.equals(EMAIL)) {
caseSensitiveCompare = false;
}
boolean caseSensitiveCompare = !matchAttribute.equals( EMAIL );

for( int i = 0; i < users.getLength(); i++ ) {
final Element user = (Element) users.item( i );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ public void actionPerformed( final WikiEvent event ) {
pagesChanged++;
}
}
LOG.info( "Profile name change for '" + newPrincipal.toString() + "' caused " + pagesChanged + " page ACLs to change also." );
LOG.info( "Profile name change for '" + newPrincipal + "' caused " + pagesChanged + " page ACLs to change also." );
} catch( final ProviderException e ) {
// Oooo! This is really bad...
LOG.error( "Could not change user name in Page ACLs because of Provider error:" + e.getMessage(), e );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,7 @@ protected String callMutatorChain( final Collection< StringTransmutator > list,
* @param param A Heading object.
*/
protected void callHeadingListenerChain( final Heading param ) {
final List< HeadingListener > list = m_headingListenerChain;
for( final HeadingListener h : list ) {
for( final HeadingListener h : m_headingListenerChain ) {
h.headingAdded( m_context, param );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public String execute( final Context context, final Map<String, String> params )
parser.addHeadingListener( this );
parser.parse();

sb.append( "<ul>\n" ).append( m_buf.toString() ).append( "</ul>\n" );
sb.append( "<ul>\n" ).append( m_buf ).append( "</ul>\n" );
} catch( final IOException e ) {
log.error("Could not construct table of contents", e);
throw new PluginException("Unable to construct table of contents (see logs)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ protected String getAttachmentContent( final Attachment att ) {
if( searchSuffix ) {
try( final InputStream attStream = mgr.getAttachmentStream( att ); final StringWriter sout = new StringWriter() ) {
FileUtil.copyContents( new InputStreamReader( attStream ), sout );
out = out + " " + sout.toString();
out = out + " " + sout;
} catch( final ProviderException | IOException e ) {
log.error("Attachment cannot be loaded", e);
}
Expand Down
6 changes: 3 additions & 3 deletions jspwiki-main/src/main/java/org/apache/wiki/tags/LinkTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,9 @@ private String addParamsForRecipient( final String addTo, final Map< String, Str
return buf.toString();
}
if( !addTo.endsWith( "&amp;" ) ) {
return addTo + "&amp;" + buf.toString();
return addTo + "&amp;" + buf;
}
return addTo + buf.toString();
return addTo + buf;
}

private String makeBasicURL( final String context, final String page, String parms ) {
Expand Down Expand Up @@ -358,7 +358,7 @@ public int doEndTag() {
break;
default:
case ANCHOR:
out.print("<a "+sb.toString()+" href=\""+url+"\">");
out.print("<a "+ sb +" href=\""+url+"\">");
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public final String toString() {
"[context=" + m_requestContext + "," +
"urlPattern=" + m_urlPattern + "," +
"jsp=" + m_jsp +
( m_target == null ? "" : ",target=" + m_target + m_target.toString() ) +
( m_target == null ? "" : ",target=" + m_target + m_target ) +
"]";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,6 @@ public int hashCode()
*/
public String toString()
{
return "[Fact:" + m_obj.toString() + "]";
return "[Fact:" + m_obj + "]";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ protected String getAttachmentContent( final Attachment att ) {
// -1 disables the character size limit; otherwise only the first 100.000 characters are indexed

parser.parse( attStream, handler, metadata );
out.append( handler.toString() );
out.append( handler );

final String[] names = metadata.names();
for( final String name : names ) {
Expand Down