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

SyntaxException for DateTimeParser::parse not working #569

Closed
aleks-f opened this issue Oct 13, 2014 · 11 comments
Closed

SyntaxException for DateTimeParser::parse not working #569

aleks-f opened this issue Oct 13, 2014 · 11 comments
Assignees
Labels
breaking A breaking change bug fixed

Comments

@aleks-f
Copy link
Member

aleks-f commented Oct 13, 2014

From http://stackoverflow.com/questions/25285740/syntex-exception-for-datetimeparserparse-of-poco-not-working :

In the documentation to Poco::DateTimeParser:.parse(const
std::string& fmt, const std::string& str, int& timeZoneDifferential)

Parses a date and time in the given format from the given string.
Throws a SyntaxException if the string cannot be successfully parsed.

As I understand this sentence the given datestring "str" must be in
the format described in paramter "fmt", otherwise a SyntaxException is thrown - or do I miss something ?

But even if i give wrong format like "sjdcg-12987-kjchsjkc" or an empty format. its parsing the string and giving some garbage value.

How can i solve this issue:

the code is like this-

string datetime="jnghjgnbcfjb";

try
{
  DateTimeParser::parse(DateTimeFormat::ISO8601_FRAC_FORMAT,datetime,dt,tzd);
}
catch(const Poco::Exception& exc)
{
  cout << exc.displayText() << endl;
}
@aleks-f aleks-f added the bug label Oct 13, 2014
@obiltschnig obiltschnig added this to the Unspecified milestone Nov 19, 2014
@obiltschnig
Copy link
Member

Will update documentation to reflect current behavior.

@aleks-f
Copy link
Member Author

aleks-f commented Oct 20, 2017

@obiltschnig note that some changes in this fix will potentially break some users code - we have been accepting letter timezones other than USA for RFC822 format, which is not allowed by standard (maybe open another bug for this, just so we don't lose record of it?)

zone        =  "UT"  / "GMT"                ; Universal Time
                                                 ; North American : UT
                 /  "EST" / "EDT"                ;  Eastern:  - 5/ - 4
                 /  "CST" / "CDT"                ;  Central:  - 6/ - 5
                 /  "MST" / "MDT"                ;  Mountain: - 7/ - 6
                 /  "PST" / "PDT"                ;  Pacific:  - 8/ - 7
                 /  1ALPHA                       ; Military: Z = UT;
                                                 ;  A:-1; (J not used)
                                                 ;  M:-12; N:+1; Y:+12
                 / ( ("+" / "-") 4DIGIT )        ; Local differential
                                                 ;  hours+min. (HHMM)

aleks-f pushed a commit that referenced this issue Oct 27, 2017
* Fix ".. has no member named ... compile error" (#1938)

* Fix ".. has no member named ... compile error" by renaming apache conn_rec
attributes

 - conn_rec attributes remote_ip and remote_addr were replaced by client_ip
 and client_addr once they have been renamed in Apache 2.4
 - a server_rec pointer must be passed to ap_log_error() since apache 2.4,
 therefore, a change was necessary at the ap_log_error log function.
 A null pointer has been passed for avoiding deeper changes at the function.
 - the smart pointer auto_ptr was replaced by unique_ptr once it was made
 deprecated in C++11 standard, it has been replaced by unique_ptr.

* Add the properly #ifdef directives for backward compatibility purposes

 - Adding proper #ifdef preprocessor directives to keeping backward
 compatibility with older apache versions.

* Update ApacheConnector.cpp

* Add Gradle build.scripts

Signed-off-by: zosrothko <zosrothko@orange.fr>

* New files

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Add distrib directory

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Add PostgreSQL. Remove POCO_NO_WSTRING

Signed-off-by: zosrothko <zosrothko@orange.fr>

* CYgwin: remove -DPOCO_NO_WSTRING & build Data/PostgreSQL (#1942)

* Upgrade to mysql-5.7.19-win32 (#1944)

* fix -Woverloaded-virtual

* remove return

* SyntaxException for DateTimeParser::parse not working #569

* remove leftover comment

* fix some warnings

* purge trailing whitespace (#1947)

* add Poco::makeUnique()

* NTP Packet impl not according to RFC958? #749

* Poco::Data ODBC impl doesn't bind to unsigned numeric types properly #1683

* Remove useless windows commands (#1948)

* Remove useless Windows commands

* Generate build_cmd only for VS140 & VS150

* Display target configuration

* Upgrade to mysql-5.7.19 (#1951)

* Travis & AppVeyor: Unbind PDF module (#1953)

* Unbind PDF

* Upgrade to mysql-5.7.19

* Put Cygwin ahead

* Add --omit=PDF

* Display target configuration (#1952)

* #1878 Add OrangePi on Build Support (#1949)

- Created the configuration `OrangePi`, based on ARM-Linux,
  with fine tune for OrangePi
- I tested using Poco samples on OrangePi Zero

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* fix mysql odbc tests

* Renamed directory distrib to packaging

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Update .gradle/

* Restore lost changes by git

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Update openssl path

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Comment out displaying the compiler log

* Create issue_template.md

* Compile all C source as C++ source

* Add gradle submodule

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Remove /TP for compiling C code

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Reinsert SemiStaticLibrary build

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Fixed invalid merge

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Missing files

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Rebuild PocoDoc

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Remove deleted includes

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Align with develop branch

* Add task pocoTasks and dependency with nuget & candle
aleks-f pushed a commit that referenced this issue Dec 11, 2017
* Workaround bug in SolarisStudio 12.4 on RVO-ed objects.

* HttpClientSession set specific proxysettings for attached socket

If we have a global proxy settings and we attach an external socket to the HTTPClientSession there's no way to use different proxy settings for that connection. For example if you do not need for that connection httpproxy because is already attached to the correct and point

* Fix ".. has no member named ... compile error" (#1938)

* Fix ".. has no member named ... compile error" by renaming apache conn_rec
attributes

 - conn_rec attributes remote_ip and remote_addr were replaced by client_ip
 and client_addr once they have been renamed in Apache 2.4
 - a server_rec pointer must be passed to ap_log_error() since apache 2.4,
 therefore, a change was necessary at the ap_log_error log function.
 A null pointer has been passed for avoiding deeper changes at the function.
 - the smart pointer auto_ptr was replaced by unique_ptr once it was made
 deprecated in C++11 standard, it has been replaced by unique_ptr.

* Add the properly #ifdef directives for backward compatibility purposes

 - Adding proper #ifdef preprocessor directives to keeping backward
 compatibility with older apache versions.

* Update ApacheConnector.cpp

* Add Gradle build.scripts

Signed-off-by: zosrothko <zosrothko@orange.fr>

* New files

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Add distrib directory

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Add PostgreSQL. Remove POCO_NO_WSTRING

Signed-off-by: zosrothko <zosrothko@orange.fr>

* CYgwin: remove -DPOCO_NO_WSTRING & build Data/PostgreSQL (#1942)

* Upgrade to mysql-5.7.19-win32 (#1944)

* fix -Woverloaded-virtual

* remove return

* SyntaxException for DateTimeParser::parse not working #569

* remove leftover comment

* fix some warnings

* purge trailing whitespace (#1947)

* add Poco::makeUnique()

* NTP Packet impl not according to RFC958? #749

* Poco::Data ODBC impl doesn't bind to unsigned numeric types properly #1683

* Remove useless windows commands (#1948)

* Remove useless Windows commands

* Generate build_cmd only for VS140 & VS150

* Display target configuration

* Upgrade to mysql-5.7.19 (#1951)

* Travis & AppVeyor: Unbind PDF module (#1953)

* Unbind PDF

* Upgrade to mysql-5.7.19

* Put Cygwin ahead

* Add --omit=PDF

* Display target configuration (#1952)

* #1878 Add OrangePi on Build Support (#1949)

- Created the configuration `OrangePi`, based on ARM-Linux,
  with fine tune for OrangePi
- I tested using Poco samples on OrangePi Zero

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* fix mysql odbc tests

* Renamed directory distrib to packaging

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Update .gradle/

* Restore lost changes by git

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Update openssl path

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Comment out displaying the compiler log

* Create issue_template.md

* Compile all C source as C++ source

* Add gradle submodule

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Remove /TP for compiling C code

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Reinsert SemiStaticLibrary build

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Fixed invalid merge

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Missing files

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Oracle ODBC fixes

* restore deleted documentation

* wrong field size calculation in ODBC code #1659; other max size excession checks and testcase

* Rebuild PocoDoc

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Remove deleted includes

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Align with develop branch

* Add task pocoTasks and dependency with nuget & candle

* some fixes (mostly unicode/bulk)

* #264, #1684, #1950

* Buffer<> swap miss ownMem #1964

* speling fix

* speling fix

* make uninstall does not remove .so symlinks #1017

* add uninstall to phony

* Base64Encoder/Decoder: added support for 'base64url' encoding

* removed $ tags

* remove remaining $Id$ tags from file headers

* Fix/tcp dispatcher (#1965)

* TCPServerDispatcher::run() issue #1884; make integral members atomic and minimize locking

* Update TCPServerDispatcher.cpp

* fix test

* fix test with gcc

* fixed GH #1934: File::setExecutable() on POSIX should set executable bit for group and other if corresponding readable bit is set

* Implement MailMessage::decode #1543 (wip)

* added PollSet class

* updated VS project files for PollSet

* PollSet: on Windows, use WSAPoll if available

* GH #1412: added Poco::DigestEngine::constantTimeEquals()

* - fix Zip Decompress Parent Path Injection #1968 bug
- add valid patch check test
- add vulnearbility triggering zip archive and test
- remove temporary test output files
- if possible, redirect temporary file generation to temp directory or
- delete temporary files after tests

* fix relative path check, eliminate unused warnings

* minor fixes

* minor fixes

* Implement MailMessage::decode #1543 (wip 2)

* fix warning

* only convert encoded-word if explicitly requested

* Add kit version 10 for message compiler (#1978)

* Restore _ostr(std::cout) to avoid timeouts on AppVeyor (#1980)

* additional fix for GH #1212: WebSocketImpl::available() now reports number of bytes in internal buffer.

* fixed GH #1828: DeflatingStreamBuf::sync() should also flush underlying stream.

* Implement MailMessage::decode #1543 (tentatively done); add encode 'B', decode 'Q' and 'B'

* TextEncodingRegistry documentation

* merged connection string URI support from 1.8

* fixed GH #1425: Workaround bug in SolarisStudio 12.4 on RVO-ed objects.

* Remove Cygwin build (#1985)

* fixed GH #1404: Add Poco::Data::Statement::bind() method

* GH #1988: Remove OpenVMS support

* replace strerror() with Poco::Error::getMessage()

* replace strerror() with Poco::Error::getMessage()

* upgraded bundled SQLite to 3.21.0

* Fix writing into closed socket from streambuf

In case of error occured in writeToDevice pptr may become one byte
farther than epptr. This can lead to crash in streambuf::xsputn from
libstdc++.

* CMake patches for FreeBSD (#1989)

* Switch FreeBSD to poll

* Link against dl and rt on FreeBSD

* pd_json strerror deprecation warning on Windows #1984

* revert #1828

* Backport from poco-1.8.0

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Add coverage directory

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Backport from poco-1.8.0

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Add coverage task & tools

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Removed

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Backport from poco-1.8.0

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Added

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Add OpenCppCoverage & ReportGenerator tasks

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Add CPPUNIT_IGNORE variable

Signed-off-by: zosrothko <zosrothko@orange.fr>

* style fix

* updated README.md

* Add mechanism to start a task from within a task (#1287)

* Add mechanism to start a task from within a task

Staying in the same thread.

* Provide seeds for a task queue creation

TaskManager::taskFinished removes the finished task from the task list
before dispatching the taskFinished notification

* fixup! Add mechanism to start a task from within a task

* fixup! Add mechanism to start a task from within a task

* Add Task::yield

on the same model as Task::sleep

* implement Poco::SharedPtr using std::shared_ptr (#1993)

* added additional move constructor and assignment operators

* Fix building XMLStreamParser with unbundled expat

* Add Directory for coverage task

* Remove Cygwin build that exceeds 2 hours and reaches the timeout

* WiX Poco wxs should not port the Poco version

* Harden RecursiveDirectoryIterator when walking the filesystem. (#2001)

* In the implementation for the *Traverse strategies the next method performs an unguarded list directory.  If the directory is not accessible an unrecoverable error is raised thus ruining the walk.  This changeset adopts and adapts the error handling protocol as defined in Python's os.walk function where errors from listdir are ignored or are reported to an optional on error callback function.

* Expand DirectoryIteratorsTest testsuite to confirm the hardened iterator behaviour over unreadable directories.

* Expand DirectoryIteratorsTest testsuite to confirm the hardened iterator behaviour over
  unreadable directories.  Correct bad formatting

* fix clang compile

* SharePtr fix for gcc 7.2 (#2004)

* Fix EVPTest on RHEL/Fedora by removing hard-coded EC curve name (#2002)

RHEL/Fedora seem to have a much more limited set of EC curves available by
default.  This change will instead use the first curve name as used in other
places.

* Parallel C++ compiler jobs limited to 2

* Add missing '\''

* Removed

* Cleanup

* Cleanup

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Remove removed XXXX_WIN32.h includes

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Update for VisualStudio 2017

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Add debug log

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Refactoring

Signed-off-by: zosrothko <zosrothko@orange.fr>

* dos2unix

Signed-off-by: zosrothko <zosrothko@orange.fr>

* SQLToMongoDB does not build

* Merge

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Exclude Crypto testsuite for now

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Update for VS2017

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Update for VS2017

Signed-off-by: zosrothko <zosrothko@orange.fr>
aleks-f pushed a commit that referenced this issue Dec 21, 2017
* Workaround bug in SolarisStudio 12.4 on RVO-ed objects.

* HttpClientSession set specific proxysettings for attached socket

If we have a global proxy settings and we attach an external socket to the HTTPClientSession there's no way to use different proxy settings for that connection. For example if you do not need for that connection httpproxy because is already attached to the correct and point

* Fix ".. has no member named ... compile error" (#1938)

* Fix ".. has no member named ... compile error" by renaming apache conn_rec
attributes

 - conn_rec attributes remote_ip and remote_addr were replaced by client_ip
 and client_addr once they have been renamed in Apache 2.4
 - a server_rec pointer must be passed to ap_log_error() since apache 2.4,
 therefore, a change was necessary at the ap_log_error log function.
 A null pointer has been passed for avoiding deeper changes at the function.
 - the smart pointer auto_ptr was replaced by unique_ptr once it was made
 deprecated in C++11 standard, it has been replaced by unique_ptr.

* Add the properly #ifdef directives for backward compatibility purposes

 - Adding proper #ifdef preprocessor directives to keeping backward
 compatibility with older apache versions.

* Update ApacheConnector.cpp

* Add Gradle build.scripts

Signed-off-by: zosrothko <zosrothko@orange.fr>

* New files

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Add distrib directory

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Add PostgreSQL. Remove POCO_NO_WSTRING

Signed-off-by: zosrothko <zosrothko@orange.fr>

* CYgwin: remove -DPOCO_NO_WSTRING & build Data/PostgreSQL (#1942)

* Upgrade to mysql-5.7.19-win32 (#1944)

* fix -Woverloaded-virtual

* remove return

* SyntaxException for DateTimeParser::parse not working #569

* remove leftover comment

* fix some warnings

* purge trailing whitespace (#1947)

* add Poco::makeUnique()

* NTP Packet impl not according to RFC958? #749

* Poco::Data ODBC impl doesn't bind to unsigned numeric types properly #1683

* Remove useless windows commands (#1948)

* Remove useless Windows commands

* Generate build_cmd only for VS140 & VS150

* Display target configuration

* Upgrade to mysql-5.7.19 (#1951)

* Travis & AppVeyor: Unbind PDF module (#1953)

* Unbind PDF

* Upgrade to mysql-5.7.19

* Put Cygwin ahead

* Add --omit=PDF

* Display target configuration (#1952)

* #1878 Add OrangePi on Build Support (#1949)

- Created the configuration `OrangePi`, based on ARM-Linux,
  with fine tune for OrangePi
- I tested using Poco samples on OrangePi Zero

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* fix mysql odbc tests

* Renamed directory distrib to packaging

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Update .gradle/

* Restore lost changes by git

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Update openssl path

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Comment out displaying the compiler log

* Create issue_template.md

* Compile all C source as C++ source

* Add gradle submodule

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Remove /TP for compiling C code

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Reinsert SemiStaticLibrary build

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Fixed invalid merge

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Missing files

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Oracle ODBC fixes

* restore deleted documentation

* wrong field size calculation in ODBC code #1659; other max size excession checks and testcase

* Rebuild PocoDoc

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Remove deleted includes

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Align with develop branch

* Add task pocoTasks and dependency with nuget & candle

* some fixes (mostly unicode/bulk)

* #264, #1684, #1950

* Buffer<> swap miss ownMem #1964

* speling fix

* speling fix

* make uninstall does not remove .so symlinks #1017

* add uninstall to phony

* Base64Encoder/Decoder: added support for 'base64url' encoding

* removed $ tags

* remove remaining $Id$ tags from file headers

* Fix/tcp dispatcher (#1965)

* TCPServerDispatcher::run() issue #1884; make integral members atomic and minimize locking

* Update TCPServerDispatcher.cpp

* fix test

* fix test with gcc

* fixed GH #1934: File::setExecutable() on POSIX should set executable bit for group and other if corresponding readable bit is set

* Implement MailMessage::decode #1543 (wip)

* added PollSet class

* updated VS project files for PollSet

* PollSet: on Windows, use WSAPoll if available

* GH #1412: added Poco::DigestEngine::constantTimeEquals()

* - fix Zip Decompress Parent Path Injection #1968 bug
- add valid patch check test
- add vulnearbility triggering zip archive and test
- remove temporary test output files
- if possible, redirect temporary file generation to temp directory or
- delete temporary files after tests

* fix relative path check, eliminate unused warnings

* minor fixes

* minor fixes

* Implement MailMessage::decode #1543 (wip 2)

* fix warning

* only convert encoded-word if explicitly requested

* Add kit version 10 for message compiler (#1978)

* Restore _ostr(std::cout) to avoid timeouts on AppVeyor (#1980)

* additional fix for GH #1212: WebSocketImpl::available() now reports number of bytes in internal buffer.

* fixed GH #1828: DeflatingStreamBuf::sync() should also flush underlying stream.

* Implement MailMessage::decode #1543 (tentatively done); add encode 'B', decode 'Q' and 'B'

* TextEncodingRegistry documentation

* merged connection string URI support from 1.8

* fixed GH #1425: Workaround bug in SolarisStudio 12.4 on RVO-ed objects.

* Remove Cygwin build (#1985)

* fixed GH #1404: Add Poco::Data::Statement::bind() method

* GH #1988: Remove OpenVMS support

* replace strerror() with Poco::Error::getMessage()

* replace strerror() with Poco::Error::getMessage()

* upgraded bundled SQLite to 3.21.0

* Fix writing into closed socket from streambuf

In case of error occured in writeToDevice pptr may become one byte
farther than epptr. This can lead to crash in streambuf::xsputn from
libstdc++.

* CMake patches for FreeBSD (#1989)

* Switch FreeBSD to poll

* Link against dl and rt on FreeBSD

* pd_json strerror deprecation warning on Windows #1984

* revert #1828

* Backport from poco-1.8.0

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Add coverage directory

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Backport from poco-1.8.0

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Add coverage task & tools

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Removed

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Backport from poco-1.8.0

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Added

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Add OpenCppCoverage & ReportGenerator tasks

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Add CPPUNIT_IGNORE variable

Signed-off-by: zosrothko <zosrothko@orange.fr>

* style fix

* updated README.md

* Add mechanism to start a task from within a task (#1287)

* Add mechanism to start a task from within a task

Staying in the same thread.

* Provide seeds for a task queue creation

TaskManager::taskFinished removes the finished task from the task list
before dispatching the taskFinished notification

* fixup! Add mechanism to start a task from within a task

* fixup! Add mechanism to start a task from within a task

* Add Task::yield

on the same model as Task::sleep

* implement Poco::SharedPtr using std::shared_ptr (#1993)

* added additional move constructor and assignment operators

* Fix building XMLStreamParser with unbundled expat

* Add Directory for coverage task

* Remove Cygwin build that exceeds 2 hours and reaches the timeout

* WiX Poco wxs should not port the Poco version

* Harden RecursiveDirectoryIterator when walking the filesystem. (#2001)

* In the implementation for the *Traverse strategies the next method performs an unguarded list directory.  If the directory is not accessible an unrecoverable error is raised thus ruining the walk.  This changeset adopts and adapts the error handling protocol as defined in Python's os.walk function where errors from listdir are ignored or are reported to an optional on error callback function.

* Expand DirectoryIteratorsTest testsuite to confirm the hardened iterator behaviour over unreadable directories.

* Expand DirectoryIteratorsTest testsuite to confirm the hardened iterator behaviour over
  unreadable directories.  Correct bad formatting

* fix clang compile

* SharePtr fix for gcc 7.2 (#2004)

* Fix EVPTest on RHEL/Fedora by removing hard-coded EC curve name (#2002)

RHEL/Fedora seem to have a much more limited set of EC curves available by
default.  This change will instead use the first curve name as used in other
places.

* Parallel C++ compiler jobs limited to 2

* Updated to PCRE version 8.41

Testing Done: Built on Windows OS for all configurations.

* Add missing '\''

* Removed

* Cleanup

* Cleanup

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Remove removed XXXX_WIN32.h includes

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Update for VisualStudio 2017

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Add debug log

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Refactoring

Signed-off-by: zosrothko <zosrothko@orange.fr>

* dos2unix

Signed-off-by: zosrothko <zosrothko@orange.fr>

* SQLToMongoDB does not build

* Merge

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Exclude Crypto testsuite for now

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Update for VS2017

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Update for VS2017

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Fixed performance issue: destructor of Poco::Timespan was not inlined [#CLICKHOUSE-3458].

* fixed GH #2038: Poco::Net::MultipartWriter::createBoundary() always returns the same string.

* GH #2039: support for nested multi-part content

* Small code style change (#2043)

Making operator precedence explicit.

* Add JSON in the includes path (#2027)

* merge File::linkTo() from 1.8.1

* remove volatile

* # 2042

* SQLite not handling parameter count mismatch correctly #2020

* Data/SQLite: Exception messages contain duplicate text #2012

* Travis CI (#2050)

* Factorize info into new verbose file. Refactor Makefile, global, cpp11*. Add Linux32-clang

* Display used config with POCO_VERBOSE

* Add cross compilation toward x86 with host amd64

* Refactor config names

* Add lib32gcc runtime

* Add g++-5-multilib

* Use OSARCH=i386 for OSX x86

* Avoid building Crypto since OpenSSL is only x64 on OSX

* Avoid building Crypto since OpenSSL is only x64

* Avoid Data/* on cross compilation to x86

* Add gcc-5-multilib to clang 4.0 x86

* Ignore TimerTest on OSX for now.

* Cleanup

* Add other set of TimerTest.

* New test that fails on OSX

* Add TimerTest.testScheduleInterval() (#2053)

* Poco::Net::NetworkInterface::list does not list inactive interfaces even when explicitly being asked for it #2044

* remove deprecated NetworkInterface typedef

* move upgraded PDF from 1.8

* Update for VS2017

* Add Util::TimerTest

* fix OSX NetworkInterface test

* fix NetworkInterface test
@matejk
Copy link
Contributor

matejk commented May 15, 2020

Is there any chance that the changes to improve reliability to parse date/time get merged to stable release branches?

@aleks-f
Copy link
Member Author

aleks-f commented Nov 11, 2023

@matejk would you be willing to merge this for 1.13 (due December 11)? It's a core functionality and we may break things a mentioned above, so lets test it well and we will make a release note about breaking changes.

The fix is here

@matejk
Copy link
Contributor

matejk commented Nov 12, 2023

Of course I'd be willing.

@matejk matejk self-assigned this Nov 12, 2023
matejk added a commit that referenced this issue Nov 13, 2023
@matejk matejk reopened this Nov 13, 2023
@matejk
Copy link
Contributor

matejk commented Nov 13, 2023

Parser code is cherry picked from develop-experimental and corrected. Code is available on branch 569-DateTimeParser-cherry-pick.

Few observations:

  • regex contains all of the available timezone codes. That list must be kept in sync with the table in the parser.
    • Would it make sense that timezone strings are validated when interpreting them?
  • RFC 822 and RFC 112 timezone differential hours are not recognised (parsing fails)
  • Specifications for RFC 822 and RFC 1123 use less timezone strings as defined in Poco
    • Shall that be corrected in the parser?

https://datatracker.ietf.org/doc/html/rfc822#section-5

@aleks-f

matejk added a commit that referenced this issue Dec 9, 2023
matejk added a commit that referenced this issue Dec 9, 2023
matejk added a commit that referenced this issue Dec 9, 2023
matejk added a commit that referenced this issue Dec 9, 2023
@matejk matejk closed this as completed in 4f1cf68 Dec 11, 2023
@matejk matejk added the fixed label Dec 11, 2023
@matejk matejk reopened this Dec 11, 2023
@aleks-f aleks-f closed this as completed Dec 22, 2023
@killerbot242
Copy link

killerbot242 commented Jan 7, 2024

I wonder if the solution is fully ok, in our code base it seems to break things. One could also argue the old code was doing an improper job.
For example : the following used to be accepted (note a space in front and at the end, both accepted and nicely ignored) with Poco 12.x and earlier.

const std::string input{" 2024-01-06 11:05:24 "}; int ignoreTz{}; const auto dateTime = Poco::DateTimeParser::parse("%Y-%m-%d %H:%M:%S", input, ignoreTz);

Poco 13.x raises the exception. Code breakage code be less impacting if the implementation would continue to remove the whitespace, well most probably it does, it is the addition of the regexes that don't like the whitespace.

@aleks-f
Copy link
Member Author

aleks-f commented Jan 7, 2024

The old code was indeed accepting garbage silently. I'm thinking trimming spaces may be an acceptable preprocessing step. @matejk what do you think?

@matejk
Copy link
Contributor

matejk commented Jan 7, 2024

Taking a look at the pattern and the input it somehow seems to be correct that the input is rejected, because it does not match the pattern.

Yes, it would be possible to use Poco::trim or Poco::trimInPlace in preprocessing step inside the parse, however it is really easy to use one of those before calling the parse function if it is expected that the input might contain some excess whitespace.

My recommendation is to do cleaning of the input before calling parse.

@killerbot242
Copy link

I agree that trimming being done by the user code, makes much sense, and would be the way to go when this was a new feature.
I am not so sure, for an existing feature, things will break, and unfortunately not a compile time, but a run-time.
This might be an expensive side effect, maybe justifying for the sake of backwards compatibility to trim on the inside ?

@matejk matejk added the breaking A breaking change label Jan 7, 2024
@matejk
Copy link
Contributor

matejk commented Jan 7, 2024

We marked this change as breaking only in the release notes and not here, unfortunately.

And you are right, a compromise between the previous implementation and the strict one could be implemented to avoid some unexpected run-time side effects.

@aleks-f, what if we introduce a parameter strict to parse that defaults to false and do cleaning of the input only in that case? In 1.14 we could perhaps make that variant of the parse deprecated.

aleks-f added a commit that referenced this issue Feb 6, 2024
* doc(ReleaseNotes): fix formatting, add PR links

* Incorporated Debian patches (#4380)

* Debian: Use null as device file as console might not be there

* Debian: Add GNU Hurd support

* Debian: Includes not available on Hurd

* Debian: Disable SHA2 test on platforms where it's broken

* Debian: Set POCO_NO_FPENVIRONMENT for armel

---------

Co-authored-by: Jochen Sprickerhof <git@jochen.sprickerhof.de>

* fix(UUID): UUID parser silently ignores too long strings #4375 (#4384)

* fix(Crypto): EVP_CIPHER_CTX_init is incorrectly defined in Envelope.cpp if it is not defined already by OpenSSL. Fixed to properly use EVP_CIPHER_CTX_reset.

* enh(ci): Add macos sanitizers job (#4313)

* enh(ci): macOS thread sanitizer

* enh(ci): macOS sanitize jobs for undefined and address.

* fix(test): lock std:cerr to prevent data race in TCP server tests (reported by clang thread sanitizer) #4313

* fix(test): Use 96-bit IV with aes-256-gcm to fix (#4347):

I/O error: error:1C800066:Provider routines::cipher operation failed

* mingw compile and link improvements (#4019) (#4391)

* fix(platform): MinGW Compile and link errors: undefined reference to `WinMain'

* fix(platform): MinGW compile UUID tests (conflicting UUID defined as GUID in rpcdce.h via windows.h)

* enh(DateTimeParser): option to cleanup input string before parsing (#569).

* fix(CppUnit): do not install #4398

* fix(DataTest): do not install #4398

* chore(SingleSocketPoller): spelling

* fix(MailMessage): Compare lowercase content disposition headers when reading parts (#3650).

* chore(cmake): CppUnit Foundation dependency documentation; fix indentation

* fix(SocketReactorTest): deadlock test intermittently hangs #4400

* gcc/clang (-fvisibility=hidden): corrections to compile and work properly (#4394)

* fix(ActiveRecord): missing ActiveRecordLib_API definitions for clang/gcc.

* fix(FPEnvironment): export FPEnvironmentImpl classes (#4393, #3331)

* fix(Crypto): export *Impl classes used from inlines (#4393, #3331)

* fix(Dynamic): explicitly instantiate and export Dynamic::Struct for string and int (-fvisibility=hidden) (#4393, #3331)

* fix(JSON): explicitly instantiate and export SharedPtr for JSON::Array and JSON::Object (-fvisibility=hidden) (#4393, #3331)

* enh(CMake): Set symbol visibility to hidden (#4393, #3331)

* enh(configure): user c++17 standard for iphone, Darwin and ARM-Linux.

* fix(UTF): explicitly instantiate and export 16 and 32-bit strings (-fvisibility=hidden) (#4393, #3331)

* fix(RecordSet): make Extraction.h internal and instantiate RecordsSet::column template functions only for supported types. (-fvisibility=hidden) (#4393, #3331)

* fix(UTF): fix explicitly instantiation on Windows (-fvisibility=hidden) (#4393, #3331)

* enh(CMake): Add github jobs for macOS with visibility set to hidden (#4393, #3331)

* fix(CppParser): Add missing declarations for CppParser_API (#4393, #3331)

* enh(CMake): Enable more options in github jobs for macOS with visibility set to hidden (#4393, #3331)

* fix(MongoDB): Add missing MongoDB_API (#4393, #3331)

* Implemented automated network library initialization for Windows MinGW targets (#4402)

* Implemented automated network library initialization for Windows MinGW/GCC targets

* Using POCO_COMPILER_MINGW instead of __GNUC__

---------

Co-authored-by: Jesse Hoogervorst <jesse@deltaxlab.com>

* fix(Thread_POSIX): qnx build error: 'prctl' was not declared in this scope #4404

* fix: NULL pointer strategy when setting rotation never #4411

Regression from 66e93f9.

* fix(progen): add LanguageStandard (stdcpp17, stdc11); regenerate vs170 projects

* Implement GetAdaptersAddresses API (#4419)

* Upgrade from GetAdaptersInfo to GetAdaptersAddresses API. The code has been swapped back to a buffer of bytes because the data structure built by GetAdaptersAddresses is a linked list and the returned size is not a multiple of the IP_ADAPTERS_ADDRESSES struct.

* Adding back Poco/UnWindows.h

* Undoing indents.

* test(ThreadPool): unit test for thread pool shutdown when no worker is running. (#2450)

* enh: #4216: use std::string literals

* enh: #3890: Get rid of SingletonHolder

* enh(File): Linux, macOS: microsecond precision for file times (create and modification time).

* enh(tests): Ability to enable/disable testing of deprecated functionality. (#4425)

* fix(SSLManager): Fixed regression introduced in PR #4103, fixes #4421

* fix(LogFile): Unify flushing behaviour of WIN32 and STD implementation (#2443)

* chore(buildwin): remove old vs versions from build and progen scripts; update documentation

* chore(buildwin): remove leftover closing curly

* enh(SQLite): SQLite FTS5 #4367

* Release 1.13.1: Update release notes, changelog, contributors, version files. (#4440)

* Update CONTRIBUTORS

* fix(CppParser): Documentation generation (some minor fixes, WiP) #4441

* feat(CppParser): C++11 attributes support

* feat(PocoDoc): C++11 attributes support

* chore(doc): Changelog and release notes formatting

* fix(CppParser): parsing of function template parameters and namespace imports

* fix: make headers parseable by CppParser/PocoDoc

* fix(PocoDoc): add -DPOCO_DOC

* fix(PocoDoc): postgres headers not found

* fix(PocoDoc): libpq include path

* fix(XML): #4443: Upgrade libexpat to 2.6.0

* doc: updated changelog

---------

Co-authored-by: Günter Obiltschnig <guenter.obiltschnig@appinf.com>
Co-authored-by: Matej Kenda <matejken@gmail.com>
Co-authored-by: Jochen Sprickerhof <git@jochen.sprickerhof.de>
Co-authored-by: Jesse Hoogervorst <hoogervorstjesse@gmail.com>
Co-authored-by: Jesse Hoogervorst <jesse@deltaxlab.com>
Co-authored-by: Aron Budea <aron.budea@collabora.com>
Co-authored-by: Andrew Auclair <andrewauclair@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking A breaking change bug fixed
Projects
None yet
Development

No branches or pull requests

4 participants