You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2018/08/20 09:18:31 UTC

[Bug 62639] New: DataFormatter can never set its provided locale

https://bz.apache.org/bugzilla/show_bug.cgi?id=62639

            Bug ID: 62639
           Summary: DataFormatter can never set its provided locale
           Product: POI
           Version: 3.17-FINAL
          Hardware: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: POI Overall
          Assignee: dev@poi.apache.org
          Reporter: patrice.rochemont@gmail.com
  Target Milestone: ---

Hi, 
I use POI 3.17 version. 
And i found that the formated date cell for instance allways follow the current
locale. 

Analysis : 

With "this.localeIsAdapting = true;" in the constructor with 3 arguments 
we can never set localsAdapting to <code>false</code> in the Construstor with 2
arguments. 

it will always be <code>true</code> for field localIsAdapting. 

in  "this(locale, false, emulateCSV);"


//snipppet org.apache.poi.ss.usermodel.DataFormatter -------------

    /**
     * Creates a formatter using the given locale.
     *
     * @param  emulateCSV whether to emulate CSV output.
     */
    public DataFormatter(Locale locale, boolean emulateCSV) {
        this(locale, false, emulateCSV);
    }

    /**
     * Creates a formatter using the given locale.
     * @param  localeIsAdapting (true only if locale is not user-specified)
     * @param  emulateCSV whether to emulate CSV output.
     */
    private DataFormatter(Locale locale, boolean localeIsAdapting, boolean
emulateCSV) {
        this.localeIsAdapting = true;
        localeChangedObservable.addObserver(this);
        // localeIsAdapting must be true prior to this first
checkForLocaleChange call.
        localeChangedObservable.checkForLocaleChange(locale);
        // set localeIsAdapting so subsequent checks perform correctly
        // (whether a specific locale was provided to this DataFormatter or
DataFormatter should
        // adapt to the current user locale as the locale changes)
        this.localeIsAdapting = localeIsAdapting;
        this.emulateCSV = emulateCSV;
    }


Best Regards,
Rochemont Patrice.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62639] DataFormatter can never set its provided locale

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62639

Patrice ROCHEMONT <pa...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All
           Keywords|                            |APIBug

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62639] DataFormatter can never set its provided locale

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62639

Patrice ROCHEMONT <pa...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62639] DataFormatter can never set its provided locale

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62639

PJ Fanning <fa...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|INVALID                     |FIXED

--- Comment #1 from PJ Fanning <fa...@yahoo.com> ---
Resolved in trunk and will appear in 4.0.0 release.

https://github.com/apache/poi/commit/a611b66fd195952c6262cb5eb49da1a740cf2aaa

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Re: [Bug 62639] DataFormatter can never set its provided locale

Posted by "pj.fanning" <fa...@yahoo.com>.
The DataFormatter class has been like this for a number of years, so it would
not be a good idea to make big changes to its behaviour. Plenty of people
rely on it working the way it works right now.
We could add a 2nd DataFormatter that behaves the way you want it to - but
right now, we are busy with a major release and I think it's not a good time
to make changes.

Individuals can create their own subclasses of DataFormatter, for now.
A lot of the implementation of DataFormatter is private but you could copy
paste any private methods that you need into your own subclass.




--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-Dev-f2312866.html

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62639] DataFormatter can never set its provided locale

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62639

--- Comment #2 from Patrice ROCHEMONT <pa...@gmail.com> ---
Why not enable to use the exact locale used when creating the cell style in the
document ?

see https://stackoverflow.com/a/51939623/10252155

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org