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

Occasional NPEs from ERXTimeZoneDetector #774

Closed
paulhoadley opened this issue Jun 27, 2016 · 1 comment
Closed

Occasional NPEs from ERXTimeZoneDetector #774

paulhoadley opened this issue Jun 27, 2016 · 1 comment
Assignees
Labels

Comments

@paulhoadley
Copy link
Contributor

I started a mailing list thread on this issue back in April. I’m seeing occasional NPEs from ERXTimeZoneDetector like this:

java.lang.NullPointerException: timeZone must not be set to null
    at er.extensions.appserver.ERXSession.setTimeZone(ERXSession.java:810)
    at er.extensions.components.ERXTimeZoneDetector.takeValuesFromRequest(ERXTimeZoneDetector.java:148)
    at com.webobjects.appserver._private.WOComponentReference.takeValuesFromRequest(WOComponentReference.java:119)

ERXSession.setTimeZone() doesn’t like nulls, and that’s fair enough. It’s being called from here:

public void takeValuesFromRequest(WORequest request, WOContext context) {
    super.takeValuesFromRequest(request, context);
    if (shouldPostData() && request.formValueForKey(TIMEZONE_DATA_KEY) != null) {
        ...
        TimeZone tz = zoneWithRawOffset(rawOffset, dst, southern);
        session.setTimeZone(tz);
    }
}

That is, when ERXTimeZoneDetector thinks it’s found the TimeZone, it calls setTimeZone(), except sometimes tz is null. In the resulting log output, ERXBasicBrowser is suggesting the culprit is usually IE 8, sometimes IE 9 and IE 7. I don’t know whether this is a legitimate app user, or someone browsing the login page, or a bot.

It turns out that detectedTimeZone is consistently “180,1,0”. It’s the DST parameter that’s causing the problem. zonesWithRawOffset(180, true, false) returns null, but zonesWithRawOffset(180, false, false) returns an array of 27 zones. This is using a recent Java 8 release, so presumably the timezones should be quite up to date.

Again, I don't know what the root cause is here (real user with misconfigured user agent, misconfigured bot, real timezone that Java doesn't know about, bug in the detection Javascript...), but in any case I would argue that it's a bug for ERXTimeZoneDetector to call setTimeZone(tz) when it knows tz is null. I propose that ERXTimeZoneDetector guards its call to setTimeZone()with a check for null. and logs something informational if it's unable to detect the timezone. I'll submit a pull request soon.

@paulhoadley
Copy link
Contributor Author

Fixed by #775.

mypompon added a commit to bebook/wonder that referenced this issue Jan 27, 2017
* explain behavior of ERXDisplayGroup for setSelectedObjects

* remove unused logger objects

add logger object where a "foreign" one was used

* use private slf4j logger where possible

logger objects should be always a private var internal to the specific class

* fix binding using remove method

* fix imports

* remove project specific compiler settings

* fix for calendar js if there is no Modalbox

* Add highlightColor and effects bindings and AjaxOptions to AjaxSortableList.
highlightColor will create a start effect and a endeffect that change the background color of the moved element.

* Add type to generics to remove warnings.

* Change the highlight to a class added when moving. This allows a greater customization.

* Enhanced ERXRequest cookieValues to not get an empty dictionary when cookie parsing fails

* fix NPE

* remove deprecated components

* remove deprecated interface methods

* remove deprecated methods

* remove deprecated class

* remove support for long deprecated delimiter '@'

* no need for the different flavours of getting current WO version

* remove unused logger

* remove unnecessary getName()

* update libs to current version

Maven files should be on par with ant for new libs.

* replace removed properties with current properties

* fix ERXTest

* When ERXWOComponentContent has a single children WODynamicElement, this element is removed and only it's children are used.
This only occur when the single children is a dynamic element since they are subclass of WODynamicGroup. If a space or anything else exists before or after the element, a WODynamicGroup is created as the content container and the problem does not occur.

* Fix an NPE.

* refer to releases page for download of binaries

* Utilities for dealing with UUID.

* Add support and prototype for UUID primary key with "in application" key generation.

* Fix the UUID string format.
Fix internal version and variation bits.

* Add conversion of UUID primary key to and from string.

* Add support of binary sql type in Frontbase plugin.

* Add method to create a uuid column in migration.

* Fix ERRest to support uuid primary keys as filter and print then correctly on output.

* Encourage named threads for easier debugging

* Bugfix AjaxProxy

* Set proper class name for removeButton.

* When the last batch of related objects is being displayed and the sole object in that batch is removed, set the new last batch as the DG's current batch.

* fixes arrayMinusObject if object is contained more than once

* Replace date.js by a compatible successor.
The current version breaks d3pie.js and probably other things...

* Add ERXRest.includeNullValues property to show/hide null values on Rest responses

Using the boolean ERXRest.includeNullValues it`s either possible to return null values or simply not showing them, use Properties file to set it. Supported formats are json, xml and plist formats.

* Substitutes for missing method.

AjaxUtils.stringValueForBinding() was deprecated some time ago, and
then removed in Wonder 7. Here we substitute the API-identical
ERXComponentUtilities.stringValueForBinding().

* Apparently the groupId of javax.mail [was changed](https://java.net/projects/javamail/pages/Home) to com.sun.mail and the artifactId is now javax.mail instead of mail.

* Add missing dependency.

* Stay with httpclient 3.0.1 for now, as moving to a current version would require more than just updating of imports.

* Update to latest firefox driver.

* Adds log warning to parseTemplatedStringWithObject().

Mike Schrag wrote in a comment here, long ago: "Should we warn here?
This is awfully quiet..." Yes it is, and yes we should. I am tired of
scratching my head at unmodified templates. Adding a LOG.warn() here
seems like the least we should do.

(Also changes 'log' to 'LOG' by convention for a public static final
variable.)

* update various libraries to current version

* replace deprecated constants

* Reverts to lowercase constant name for 'log'.

* Add properties to ERXDatabase to define initial snapshot cache HashMap parameters, and add the possibility to use a customer ERXDatabase subclass with ERXDatabaseContext

* Removing necessary boolean comparison

* Correcting property name

* Prevent a ClassCastException in ERTaggableEntity that would occur when using left outer joins for the tag relationships.

* Add an identity qualifier and a builder for a list of identity qualifiers.

* Add containsAnyOfTheseObjects that build a qualifier to find objects where a to many key contains at least one the the objects found in the array specified.
Add versions of containsAnyObjectSatisfying and doesNotContainsAnyObjectSatisfying that uses the IN version of ERXExistsQualifier.

* Clarify comments.

* Add flattened relationship support for many to many in ERXExistsQualifier.
Fix date typos in comments.

* Fix the generic types in operators that works on array. The type of the new key remains the same, it is known.

* Remove unnecessary imports.

* When clearing validation errors, also reset the errorMessage iVar.

* Fix a SOE that would occur when using audit trails with self-referencing relationships.

* Add generic params to clean the code.

* If the request specify the UUID of the new object use this value as primary key when creating new EOs.

* Adds automated handling of navigation state to ERXNavigation. To achieve this, we store each menu item's navigation state string in a dictionary ("NavigationMap"), using its relative URI as the key. In this way we can reliably determine the navigation state, when a request is due to the user clicking a navigation link.
Obviously this will not work when a user clicks somewhere outside of the navigation menu. For the case of D2W, we can apply a simple heuristic that should be "good enough" for the majority of such cases (e.g. a click on a "Find" button on a query page).
For non-D2W applications, you should retrieve the navigation state via ERXNavigationManager.manager().navigationStateFromMap() and apply it as you see fit, e.g. in Session.awake().

Also adds a defaultChild attribute to navigation elements. Instead of specifying the same action as on one of the children, one can now simply specify a defaultChild to achieve the same result.

* Removing all navigationState rules from ERModernMoviesTest, except one for "Home", for which the pageConfiguration is null. Add functional tests.

* Add 'skip' copy type to ERXCopyable to enable ignoring of attributes, mostly to keep values that are applied during EO initialization.

* Apache 2.4 needs a Location setting for the path to the WO module, or else requests will return a 403 status code.

* Fix for upgrades. It should't delete the adaptor anymore.

* using ERXProperties.*ForKeyWithDefault to be able to set theese properties in a framework Properties file

* In case the menu is not properly configured, displaying an error message is betten than throwing an uncought exeption.

* ERMDNestingListPageRepetition is a special list page repetition for hierarchical object structures that extends ERMDListPageRepetition. Allows recursive access to a relationship specified via the "nestedRelationship" key. To use it, set it via "toManyRepetitionComponentName".

As an example, you could use this for a hierarchy of locations (think "continent > country > city > quarter"), with "containedLocations" as the nestedRelationship key. This will allow a "drill-down" access to locations.

* Fix tests that contains no longer needed casts.

* Adds ERMDebuggingHelp, a modernised variant of the ERDDebuggingHelp component that uses ajax to make querying keys on the D2WContext easier. Also gets rid of some cruft and defaults to hiding the details.
When no D2W key is entered, it uses the ERD2WContextInspector component to show keys on the context in a (hopefully) sensible way. ERD2WContextInspector shows the bound context's local values, using a shorter representation instead of toString() for WOSession, EOAttribute, EOEntity and EORelationship objects and skips the contextDictionary key.

* The tests where using a constant now reference in the system time zone and doing comparison with expected results in tested timezone. This ensure the now used is in the testes time zone.

* Fix wrong update container ID.

* Syntactic sugar for dictionaryFromObjectWithKeys

This version of the dictionaryFromObjectWithKeys method accepts a varargs of `String` keys and delegates the execution to the original method.

* update some libs

* update build files for new libs

* deprecater ERXFile

* add support for plain arrays to AjaxAutoComplete

Add support of Object[] besides NSArray and List. Output warning if we get an unsupported class type for list binding.

* Adds proxy binding for AjaxProxy component. wocommunity#768

When the proxy binding is not set, AjaxProxy uses its containing
component (so, in this case, the AjaxFlexibleFileUpload component) as
its server-side proxy object. This exposes all public methods of that
component to the client-side Javascript object. At that point, a
malicious user can fairly easily call some significant methods, such
as Application.terminate() to shut down the application instance.

Here we add a single-purpose Proxy object as an inner class of
AjaxFlexibleFileUpload which simply wraps the methods that we need to
call from the client.

* Revert back to what the startup scripts for RedHat were before. The previous scripts are creating problems when you upgrade from a RPM.

* Add support for Apache mod-proxy's in any app that extends ERXApplication. Code coming from the Mod_Proxy page in JavaMonitor.

* Code formatting in ERXApplication is a mess. Let's clean it up.

* remove that class altogether

* Revert "Code formatting in ERXApplication is a mess. Let's clean it up."

This reverts commit 4e269fe.

* Only reformat new code.

* Add an jQuery and Foundation integration example and a d3 example.

* new approach to fix automatic Framework embedding

* Guards against calling setTimeZone() with null argument. wocommunity#774

* wrong param

* parent class already checks for these associations

* wrong assignment in validateValueForKey

do not throw away return value of _validateValueForKey that is used e.g. in ERXPartialGenericRecord

* add null param check in NSSet

* hide date picker if field is disabled or readonly

* Fix an NPE when session time out, the context does not have a response and raise an NPE.

* add binding to force usage of date picker

* Fix the manualInput so the form value is sent but the user input is disabled in browser. We need to uses otherTagString because readonly disable the input reading in ERXWOTextField takeValueForKey.

* Fix path handling for embedded frameworks

* ERXDeployedBundler: default is old style

* ERXDeployedBundle fix custom WOFrameworksBaseURL recognition

* Fix NPE in UUID primary key generation code when primary key isn't based on any prototype

* Get frameworks base URL from application object instead of ERXProperties

The frameworks base URL can also be set directly through the `WOApplication.setFrameworksBaseURL` method. In that case, `ERXProperties.stringForKey("WOFrameworksBaseURL")` returns `null`. Getting that information from the application object is guaranteed to return the correct value. It's also how that information is retrieved in other parts of the code of `ERXDeployedBundle` class.

* % Fix to allow for providing double value constants in both inline and WOD bindings (e.g. value="$1.5" or value = 1.5) instead of passing in Strings, which then need to be converted (mimics standard WO behavior without OGNL enabled)

* api entry added

* update ognl lib

* Logs a warning instead of throwing IllegalStateException. wocommunity#784

stop() is called when ApplicationWillTerminateNotification is
posted. If _queueThread is null or not alive, throwing an
IllegalStateException here just prevents the application from
terminating.

* Add json-simple dependency for AjaxExample2.

* set correct content type for AjaxProxy responses

* remove deprecated ERXRandomGUID

* fix some Javadocs

* Added support for filtering by a list of restricted choices, e.g. to apply status or category choices as filter.

* Make ERMD2WListFilter work with relationship components.
 * retrieve the entity in a way that will work with all types of data source
 * use ERXOptionalForm

Modified ERMDBatchSizeControl to return correct object count when the display group has an EODetailDataSource and is being filtered.

Modified ERD2WListPage to use the displayedObjects count for the listSize. This ensures a list that's been filtered so it's empty, shows the same UI behaviour as any other empty list.

* Add caching of filtered objects to ERXDisplayGroup.

* Add ERMDListFilter and use an ERXDisplayGroup as with other ERD2W components, mostly to enable access to the filtered objects count.

* Add functional tests for new ERMDListFilter features.

* fix param for _validateValueForKey

default implementation returns the value of the first param unaltered and resets any data coercion made in validateValueForKey

* ERXEC handles correct initialization of values itself

* prevent autoboxing

* Javadocs

* add SameSite support to cookies

* cleanup

* change serialVersionUID as we added to serialization

* consistently pass through current value for validation

this fixes the situation where you have validation rules at multiple places where coerced values could have been lost or the wrong values validated

* clarify Javadocs for validation

* Update README.mkd

Fix broken link for changelog.

* Updated POI to 3.14 and added EGXLSXWrapper to support generation of xlsx files

* make poi version for maven match updated version

* Added multiple file selection button to ERDragAndDropUpload, with the option to show a button or use the ID from an external button. The component can also be used without content to just show a button. Included is a fix from Michael Kondratov for the completeAllFunction in dndupload.js. completeAllFunction now works as advertised.

* prevent NPE when baseKeyPath is null and therefore no relationship is found

* increase z-index for wolips toolbar

* update ERJavaMail libraries

* add missing attachment icons for quicktime

* prevent wrong SQL generation in ERXExistsQualifier

* Deletes duplicate ERJavaMail framework.

* Updates build.xml to build framework in Core.

* New ERMD2WColumnSelector component that adds a small drop-down menu to list table headers, allowing the user to choose which columns to hide or display. The choices are persisted via the ERCoreBusinessLogic preferences system. To enable it, a rule as per the component java doc has to be added.

Also includes a corresponding functional test case for the ERModernMoviesTest application.

* Add missing dependency that was introduced in beea23f.

* Use same version as the ant build.

* make SameSite setting for cookies configurable

* added methods for getting enum property values

* actually call that sameSite method

* use try-with-resource

* some Generics and diamond operator

* remove unused code

* deprecate duplicate method

* use own log object

* use diamond operator

* close resource after usage

* fix stopping previous dev instance

If you are using a different value for adaptor URL (i.e. something different than cgi-bin by setting system property application.cgiAdaptorUrl) that fragile string replacement breaks. Using our own mutable URL class which resolves the issue.

* Javadoc fix

* use ThreadLocalRandom instead of Random

ThreadLocalRandom is thread safe and improves performance

* For partial entities, fix handling of the "locking" setting on attributes and the "class property" setting on attributes and relationships.
Add reminders for missing functionality to deal with user info data.

* use interface instead of specific class

* add generics and use diamond operator

* fix Javadocs

* A simple component that localizes string and enum values.

* Prevent batching display group to remember its row count.

* Fixes a typo.

* Ensures generated URL stays secure if request secure.

* Fix ERXExistsQualifier regex pattern to match oracle expressions.

* Added accept attribute to AjaxFlexibleFileUpload to optionally limit what file types can be uploaded

* update library dependencies

updates the following libraries:

• Apache Commons Lang 3.4 -> 3.5
• Joda Time 2.9.3 -> 2.9.6
• Ognl 3.1.10 -> 3.1.12
• Flying Saucer 9.0.7 -> 9.1.0
• h2 Database 1.4.191 -> 1.4.193

* fix StringBuilder creation

passing a char to constructor will not put char into string but take int value for capacity initialization

* use newer commons-lang objects

* some Javadoc fixes

* Generate https URLs for https test suite

* add some missing bindings to API file

* accept more general interface instead of specific class

now you can choose as to either use StringBuffer or StringBuilder for AjaxOptions

* add some generics

* deprecate AjaxRoundEffect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant