@@ -340,10 +340,10 @@ private void doLoad(SchedulingSubpart ss, String subpartId ) {
340340 form .setCreditType (credit .getCreditType ().getUniqueId ());
341341 form .setCreditUnitType (credit .getCreditUnitType ().getUniqueId ());
342342 if (credit instanceof FixedCreditUnitConfig ){
343- form .setUnits ((( FixedCreditUnitConfig ) credit ).getFixedUnits ());
343+ form .setUnits (float2string ((( FixedCreditUnitConfig ) credit ).getFixedUnits () ));
344344 } else if (credit instanceof VariableFixedCreditUnitConfig ){
345- form .setUnits ((( VariableFixedCreditUnitConfig ) credit ).getMinUnits ());
346- form .setMaxUnits ((( VariableFixedCreditUnitConfig ) credit ).getMaxUnits ());
345+ form .setUnits (float2string ((( VariableFixedCreditUnitConfig ) credit ).getMinUnits () ));
346+ form .setMaxUnits (float2string ((( VariableFixedCreditUnitConfig ) credit ).getMaxUnits () ));
347347 if (credit instanceof VariableRangeCreditUnitConfig ){
348348 form .setFractionalIncrementsAllowed (((VariableRangeCreditUnitConfig ) credit ).isFractionalIncrementsAllowed ());
349349 }
@@ -444,18 +444,27 @@ private void doUpdate(SchedulingSubpart ss, SchedulingSubpartDAO sdao, boolean t
444444 CourseCreditUnitConfig origConfig = ss .getCredit ();
445445 ss .setCredit (null );
446446 sdao .getSession ().remove (origConfig );
447- ss .setCredit (CourseCreditUnitConfig .createCreditUnitConfigOfFormat (form .getCreditFormat (), form .getCreditType (), form .getCreditUnitType (), form .getUnits (), form .getMaxUnits (), form .getFractionalIncrementsAllowed (), Boolean .valueOf (false )));
447+ ss .setCredit (CourseCreditUnitConfig .createCreditUnitConfigOfFormat (
448+ form .getCreditFormat (), form .getCreditType (), form .getCreditUnitType (),
449+ string2float (form .getUnits ()), string2float (form .getMaxUnits ()),
450+ form .getFractionalIncrementsAllowed (), Boolean .valueOf (false )));
448451 ss .getCredit ().setOwner (ss );
449452 }
450453 } else {
451454 CourseCreditUnitConfig origConfig = ss .getCredit ();
452455 ss .setCredit (null );
453456 sdao .getSession ().remove (origConfig );
454- ss .setCredit (CourseCreditUnitConfig .createCreditUnitConfigOfFormat (form .getCreditFormat (), form .getCreditType (), form .getCreditUnitType (), form .getUnits (), form .getMaxUnits (), form .getFractionalIncrementsAllowed (), Boolean .valueOf (false )));
457+ ss .setCredit (CourseCreditUnitConfig .createCreditUnitConfigOfFormat (
458+ form .getCreditFormat (), form .getCreditType (), form .getCreditUnitType (),
459+ string2float (form .getUnits ()), string2float (form .getMaxUnits ()),
460+ form .getFractionalIncrementsAllowed (), Boolean .valueOf (false )));
455461 ss .getCredit ().setOwner (ss );
456462 }
457463 } else {
458- ss .setCredit (CourseCreditUnitConfig .createCreditUnitConfigOfFormat (form .getCreditFormat (), form .getCreditType (), form .getCreditUnitType (), form .getUnits (), form .getMaxUnits (), form .getFractionalIncrementsAllowed (), Boolean .valueOf (false )));
464+ ss .setCredit (CourseCreditUnitConfig .createCreditUnitConfigOfFormat (
465+ form .getCreditFormat (), form .getCreditType (), form .getCreditUnitType (),
466+ string2float (form .getUnits ()), string2float (form .getMaxUnits ()),
467+ form .getFractionalIncrementsAllowed (), Boolean .valueOf (false )));
459468 ss .getCredit ().setOwner (ss );
460469 }
461470 }
@@ -485,6 +494,19 @@ private void doUpdate(SchedulingSubpart ss, SchedulingSubpartDAO sdao, boolean t
485494 sdao .getSession ().flush ();
486495 }
487496
497+ protected static Float string2float (String value ) {
498+ try {
499+ return Float .valueOf (value );
500+ } catch (Exception e ) {
501+ return 0f ;
502+ }
503+ }
504+
505+ protected static String float2string (Float value ) {
506+ if (value == null ) return "" ;
507+ return value .toString ();
508+ }
509+
488510 protected void setupChildren (SchedulingSubpart ss ) {
489511 DatePattern selectedDatePattern = (form .getDatePattern () < 0 ? (ss .canInheritParentPreferences () ? ss .getParentSubpart ().effectiveDatePattern () : ss .getSession ().getDefaultDatePatternNotNull ()) : DatePatternDAO .getInstance ().get (form .getDatePattern ()));
490512 try {
0 commit comments