super-cap charger circuit

I did not find suitable circuit on the internet so I made one (untested but I am sure it will work much better then the original one):

R3 MUST be power resistor. Since dropout of LM317 is about 2V connecting a discharged cap will cause 10V over R3. So its value should be 10/(maximum allowable current) Ohm. The maximum safe current for LM317 is about 1A so R3 should be at least 10 Ohm. If power source is rated for less current, R3 must be increased accordingly. I.e. for 500mA power source it should be at least 20 Ohm. Also the power rating is important. Maximum dissipation in R3 is 100/R3 W. It is 10W for 10 Ohm resistor. A huge resistor is needed to survive this!
R5+R6 sets LM317's output voltage as usual. LM317 needs minimal load current of 10mA, this divider MUST be able to sink this current. Since there will be 1.25V over R5 its value MUST be 100 Ohm or less. Otherwise output of LM317 may get out of regulation possibly destroying the supercap.
R1+D1, R2+D2 and R4+D4 are optional for monitoring of the charging. If R4+D4 is used it will inject additional current to LM317's output which must be also consumed by R5+R6 - I think for this reason it is better to use R2+D2 instead.
C1 should be used for LM317's stability according to the datasheet.
In case the supercap is charged and connected and power source is disconnected, the supercap may discharge into the power supply via LM317 possibly damaging the regulator. The R3 may be enough to protect LM317 but adding D3 "to be safe" cannot hurt.