Commit fbbb8a10 authored by Nils Christian Ehmke's avatar Nils Christian Ehmke

Fixed some (potential) bugs

parent 39ed6689
......@@ -20,6 +20,11 @@ public enum ClassAppearance {
public String convert( final String aClass ) {
String clazz = aClass;
// This can only happen when the records contains null values. Ugly but possible.
if ( clazz == null ) {
return null;
}
if ( this == SHORT ) {
final int lastPoint = clazz.lastIndexOf( '.' );
if ( lastPoint != -1 ) {
......
......@@ -14,25 +14,30 @@ public enum MethodAppearance {
private static final Pattern cvMethodPattern = Pattern.compile( "(.*)\\(.*\\)" );
public String convert( final String aClass ) {
String clazz = aClass;
public String convert( final String aMethod ) {
String method = aMethod;
// This can only happen when the records contains null values. Ugly but possible.
if ( method == null ) {
return null;
}
if ( this == SHORT ) {
final Matcher matcher = cvMethodPattern.matcher( clazz );
final Matcher matcher = cvMethodPattern.matcher( method );
if ( matcher.find( ) ) {
// Replace the parenthesis
clazz = matcher.group( 1 );
clazz = clazz + "(...)";
method = matcher.group( 1 );
method = method + "(...)";
// Remove the class part
final int lastPointPos = clazz.lastIndexOf( '.', clazz.length( ) - 5 );
final int lastPointPos = method.lastIndexOf( '.', method.length( ) - 5 );
if ( lastPointPos != -1 ) {
clazz = clazz.substring( lastPointPos + 1 );
method = method.substring( lastPointPos + 1 );
}
}
}
return clazz.intern( );
return method.intern( );
}
}
......@@ -2,6 +2,8 @@ package kieker.diagnosis.ui.monitoring;
import com.google.inject.Singleton;
import kieker.diagnosis.architecture.exception.BusinessException;
import kieker.diagnosis.architecture.exception.BusinessRuntimeException;
import kieker.diagnosis.architecture.monitoring.MonitoringConfiguration;
import kieker.diagnosis.architecture.monitoring.Status;
import kieker.diagnosis.architecture.service.monitoring.MonitoringService;
......@@ -27,14 +29,18 @@ public class MonitoringDialogController extends ControllerBase<MonitoringDialogV
* @return
*/
public void performSaveAndClose( ) {
// Get the configuration...
final MonitoringConfiguration configuration = getViewModel( ).savePresentationConfiguration( );
// ...and apply it
final MonitoringService monitoringService = getService( MonitoringService.class );
monitoringService.configureMonitoring( configuration );
getViewModel( ).close( );
try {
// Get the configuration...
final MonitoringConfiguration configuration = getViewModel( ).savePresentationConfiguration( );
// ...and apply it
final MonitoringService monitoringService = getService( MonitoringService.class );
monitoringService.configureMonitoring( configuration );
getViewModel( ).close( );
} catch ( final BusinessException ex ) {
throw new BusinessRuntimeException( ex );
}
}
public void performClose( ) {
......
......@@ -2,6 +2,7 @@ package kieker.diagnosis.ui.monitoring;
import com.google.inject.Singleton;
import kieker.diagnosis.architecture.exception.BusinessException;
import kieker.diagnosis.architecture.monitoring.MonitoringConfiguration;
import kieker.diagnosis.architecture.monitoring.Status;
import kieker.diagnosis.architecture.ui.ViewModelBase;
......@@ -47,16 +48,34 @@ public class MonitoringDialogViewModel extends ViewModelBase<MonitoringDialogVie
getView( ).getBuffer( ).setText( Integer.toString( aConfiguration.getBuffer( ) ) );
}
public MonitoringConfiguration savePresentationConfiguration( ) {
public MonitoringConfiguration savePresentationConfiguration( ) throws BusinessException {
final MonitoringConfiguration configuration = new MonitoringConfiguration( );
configuration.setActive( getView( ).getActive( ).isSelected( ) );
configuration.setOutputDirectory( getView( ).getOutputDirectory( ).getText( ) );
configuration.setTimer( getView( ).getTimer( ).getValue( ) );
configuration.setWriter( getView( ).getWriter( ).getValue( ) );
configuration.setMaxEntriesPerFile( Integer.parseInt( getView( ).getMaxEntriesPerFile( ).getText( ) ) );
configuration.setQueueSize( Integer.parseInt( getView( ).getQueueSize( ).getText( ) ) );
configuration.setBuffer( Integer.parseInt( getView( ).getBuffer( ).getText( ) ) );
final String maxEntriesPerFile = getView( ).getMaxEntriesPerFile( ).getText( );
try {
configuration.setMaxEntriesPerFile( Integer.parseInt( maxEntriesPerFile ) );
} catch ( final NumberFormatException ex ) {
throw new BusinessException( getLocalizedString( "errorNotAValidInteger" ), maxEntriesPerFile );
}
final String queueSize = getView( ).getQueueSize( ).getText( );
try {
configuration.setQueueSize( Integer.parseInt( queueSize ) );
} catch ( final NumberFormatException ex ) {
throw new BusinessException( getLocalizedString( "errorNotAValidInteger" ), queueSize );
}
final String buffer = getView( ).getBuffer( ).getText( );
try {
configuration.setBuffer( Integer.parseInt( buffer ) );
} catch ( final NumberFormatException ex ) {
throw new BusinessException( getLocalizedString( "errorNotAValidInteger" ), buffer );
}
return configuration;
}
......
noMonitoringStarted=No monitoring started
monitoringTerminated=Monitoring terminated
monitoringRunning=Monitoring running
\ No newline at end of file
monitoringRunning=Monitoring running
errorNotAValidInteger=The value '%s' is not a valid integer.
\ No newline at end of file
noMonitoringStarted=Kein Monitoring gestartet
monitoringTerminated=Monitoring terminiert
monitoringRunning=Monitoring luft
\ No newline at end of file
monitoringRunning=Monitoring luft
errorNotAValidInteger=Der Wert '%s' ist keine gltige Ganzzahl.
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment