You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2012/12/27 12:03:28 UTC
svn commit: r1426160 -
/felix/sandbox/cziegeler/status-printer/src/main/java/org/apache/felix/status/impl/AbstractWebConsolePlugin.java
Author: cziegeler
Date: Thu Dec 27 11:03:28 2012
New Revision: 1426160
URL: http://svn.apache.org/viewvc?rev=1426160&view=rev
Log:
Clean up code
Modified:
felix/sandbox/cziegeler/status-printer/src/main/java/org/apache/felix/status/impl/AbstractWebConsolePlugin.java
Modified: felix/sandbox/cziegeler/status-printer/src/main/java/org/apache/felix/status/impl/AbstractWebConsolePlugin.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/status-printer/src/main/java/org/apache/felix/status/impl/AbstractWebConsolePlugin.java?rev=1426160&r1=1426159&r2=1426160&view=diff
==============================================================================
--- felix/sandbox/cziegeler/status-printer/src/main/java/org/apache/felix/status/impl/AbstractWebConsolePlugin.java (original)
+++ felix/sandbox/cziegeler/status-printer/src/main/java/org/apache/felix/status/impl/AbstractWebConsolePlugin.java Thu Dec 27 11:03:28 2012
@@ -106,6 +106,7 @@ public abstract class AbstractWebConsole
return;
}
}
+
if ( request.getPathInfo().endsWith( ".txt" ) ) { //$NON-NLS-2$
response.setContentType( "text/plain; charset=utf-8" ); //$NON-NLS-2$
final ConfigurationWriter pw = new PlainTextConfigurationWriter( response.getWriter() );
@@ -386,12 +387,16 @@ public abstract class AbstractWebConsole
this.zip = zip;
}
+ private String getFormattedTitle(final String title) {
+ return MessageFormat.format( "{0,number,000}-{1}", new Object[]
+ { new Integer( counter ), title } );
+ }
+
@Override
protected void title( final String title ) throws IOException {
counter++;
- final String name = MessageFormat.format( "{0,number,000}-{1}.txt", new Object[]
- { new Integer( counter ), title } );
+ final String name = getFormattedTitle(title).concat(".txt");
final ZipEntry entry = new ZipEntry( name );
zip.putNextEntry( entry );
@@ -404,21 +409,16 @@ public abstract class AbstractWebConsole
zip.closeEntry();
}
- private String getAttachmentPrefix(final String title) {
- return MessageFormat.format( "{0,number,000}-{1}/", new Object[]
- { new Integer( counter ), title } );
- }
-
@Override
public void printStatus(
final PrinterMode mode,
final StatusPrinterHandler handler)
throws IOException {
super.printStatus(mode, handler);
- handler.addAttachments(this.getAttachmentPrefix(handler.getTitle()), this.zip);
+ final String title = getFormattedTitle(handler.getTitle());
+ handler.addAttachments(title.concat("/"), this.zip);
if ( handler.supports(PrinterMode.JSON) ) {
- final String name = MessageFormat.format( "json/{0,number,000}-{1}.json", new Object[]
- { new Integer( counter ), handler.getTitle() } );
+ final String name = "json/".concat(title).concat(".json");
final ZipEntry entry = new ZipEntry( name );
zip.putNextEntry( entry );