diff -Nru zentyal-common-3.1.1/ChangeLog zentyal-common-3.1.2/ChangeLog --- zentyal-common-3.1.1/ChangeLog 2013-06-10 20:05:56.000000000 +0000 +++ zentyal-common-3.1.2/ChangeLog 2013-09-03 16:26:54.000000000 +0000 @@ -1,3 +1,10 @@ +3.1.2 + + Exception stacktraces are now properly logged or shown in the interface + according to the debug and dump_exceptions confkeys + + Add new exception InvalidArgument + + EBox::Validate::checkEmailAddress does not ignore any longer white spaces + at the begin and end of the address + + Always show proper language name for english locales 3.1.1 + Removed dependencies on prototype and scriptaculous javascript libraries + Removed deprecated configuration key override_user_modification diff -Nru zentyal-common-3.1.1/debian/changelog zentyal-common-3.1.2/debian/changelog --- zentyal-common-3.1.1/debian/changelog 2013-06-10 20:05:57.000000000 +0000 +++ zentyal-common-3.1.2/debian/changelog 2013-09-03 16:26:54.000000000 +0000 @@ -1,3 +1,9 @@ +zentyal-common (3.1.2) precise; urgency=low + + * New upstream release + + -- José A. Calvo Tue, 03 Sep 2013 18:26:54 +0200 + zentyal-common (3.1.1) precise; urgency=low * New upstream release diff -Nru zentyal-common-3.1.1/src/EBox/Exceptions/Base.pm zentyal-common-3.1.2/src/EBox/Exceptions/Base.pm --- zentyal-common-3.1.1/src/EBox/Exceptions/Base.pm 2013-06-10 20:05:56.000000000 +0000 +++ zentyal-common-3.1.2/src/EBox/Exceptions/Base.pm 2013-09-03 16:26:54.000000000 +0000 @@ -17,9 +17,10 @@ use base 'Error'; -use Log::Log4perl; -use EBox::Gettext; use EBox; +use EBox::Gettext; + +use Log::Log4perl; # Constructor: new # @@ -35,43 +36,43 @@ # sub new # (text) { - my $class = shift; - my $text = shift; - my (%opts) = @_; - - local $Error::Depth = $Error::Depth + 1; - local $Error::Debug = 1; - - $self = $class->SUPER::new(-text => $text, @_); - if (exists $opts{silent} and $opts{silent}) { - $self->{silent} = 1; - } else { - $self->{silent} = 0; - } + my $class = shift; + my $text = shift; + my (%opts) = @_; + + local $Error::Depth = $Error::Depth + 1; + local $Error::Debug = 1; + + $self = $class->SUPER::new(-text => $text, @_); + if (exists $opts{silent} and $opts{silent}) { + $self->{silent} = 1; + } else { + $self->{silent} = 0; + } - bless ($self, $class); - return $self; + bless ($self, $class); + return $self; } sub toStderr { - $self = shift; - print STDERR "[EBox::Exceptions] ". $self->stringify() ."\n"; + my $self = shift; + print STDERR "[EBox::Exceptions] ". $self->stringify() ."\n"; } sub _logfunc # (logger, msg) { - my ($self, $logger, $msg) = @_; - $logger->debug($msg); + my ($self, $logger, $msg) = @_; + $logger->debug($msg); } sub log { - $self = shift; - my $log = EBox::logger(); - $Log::Log4perl::caller_depth +=3; - $self->_logfunc($log, $self->stringify()) unless $self->{silent}; - $Log::Log4perl::caller_depth -=3; + my $self = shift; + my $log = EBox::logger(); + $Log::Log4perl::caller_depth +=3; + $self->_logfunc($log, $self->stacktrace()) unless $self->{silent}; + $Log::Log4perl::caller_depth -=3; } 1; diff -Nru zentyal-common-3.1.1/src/EBox/Exceptions/InvalidArgument.pm zentyal-common-3.1.2/src/EBox/Exceptions/InvalidArgument.pm --- zentyal-common-3.1.1/src/EBox/Exceptions/InvalidArgument.pm 1970-01-01 00:00:00.000000000 +0000 +++ zentyal-common-3.1.2/src/EBox/Exceptions/InvalidArgument.pm 2013-09-03 16:26:54.000000000 +0000 @@ -0,0 +1,58 @@ +# Copyright (C) 2013 Zentyal S.L. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License, version 2, as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +use strict; +use warnings; + +# Class: EBox::Exceptions::InvalidArgument +# +# Internal exception raised when an argument passed to a function +# is invalid + +package EBox::Exceptions::InvalidArgument; + +use base 'EBox::Exceptions::External'; +use Log::Log4perl; +use EBox::Gettext; + +# Constructor: new +# +# An exception called when an argument passed to a function +# is invalid +# +# Parameters: +# +# arg - the argument name +# +sub new +{ + my $class = shift; + my $arg = shift; + + my $error = __x('Invalid argument: {data}', data => $arg); + + local $Error::Depth = $Error::Depth + 1; + local $Error::Debug = 1; + + $Log::Log4perl::caller_depth++; + my $self = $class->SUPER::new($error, @_); + $Log::Log4perl::caller_depth--; + + bless ($self, $class); + + return $self; +} + +1; diff -Nru zentyal-common-3.1.1/src/EBox/Gettext.pm zentyal-common-3.1.2/src/EBox/Gettext.pm --- zentyal-common-3.1.1/src/EBox/Gettext.pm 2013-06-10 20:05:56.000000000 +0000 +++ zentyal-common-3.1.2/src/EBox/Gettext.pm 2013-09-03 16:26:54.000000000 +0000 @@ -151,11 +151,7 @@ $langs->{'da_DK.UTF-8'} = 'Dansk'; $langs->{'de_DE.UTF-8'} = 'Deutsch'; $langs->{'el_GR.UTF-8'} = 'ελληνικά'; - if (EBox::Config::configkey('english_locale')) { - $langs->{'en_US.UTF-8'} = 'English'; - } else { - $langs->{'C'} = 'English'; - } + $langs->{'en_US.UTF-8'} = 'English'; $langs->{'eu_ES.UTF-8'} = 'Euskara'; $langs->{'fa_IR.UTF-8'} = 'فارسی'; $langs->{'fr_FR.UTF-8'} = 'Français'; diff -Nru zentyal-common-3.1.1/src/EBox/Validate.pm zentyal-common-3.1.2/src/EBox/Validate.pm --- zentyal-common-3.1.1/src/EBox/Validate.pm 2013-06-10 20:05:56.000000000 +0000 +++ zentyal-common-3.1.2/src/EBox/Validate.pm 2013-09-03 16:26:54.000000000 +0000 @@ -716,8 +716,14 @@ sub checkEmailAddress { my ($address, $name) = @_; + my $valid = 0; + if (($address =~ m/^\s/) or ($address =~ m/\s$/)) { + $valid = 0; + } else { + $valid = Mail::RFC822::Address::valid($address); + } - unless (Mail::RFC822::Address::valid($address)) { + unless ($valid) { if ($name) { throw EBox::Exceptions::InvalidData ('data' => $name, 'value' => $address);