Sheet naming checks caused a test failure in cloneSheet.

CloneSheet used an invalid character, which we now dont allow! Corrected.
Good thing we have tests!!


git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/branches/REL_2_BRANCH@353393 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Avik Sengupta 2003-10-13 16:45:01 +00:00
parent db23532059
commit 926262df8d
2 changed files with 6 additions and 2 deletions

View File

@ -384,7 +384,11 @@ public class HSSFWorkbook
windowTwo.setPaged(sheets.size() == 1); windowTwo.setPaged(sheets.size() == 1);
sheets.add(clonedSheet); sheets.add(clonedSheet);
workbook.setSheetName(sheets.size()-1, srcName+"[1]"); if (srcName.length()<28) {
workbook.setSheetName(sheets.size()-1, srcName+"(2)");
}else {
workbook.setSheetName(sheets.size()-1,srcName.substring(0,28)+"(2)");
}
return clonedSheet; return clonedSheet;
} }
return null; return null;

View File

@ -79,7 +79,7 @@ public class TestCloneSheet extends TestCase {
s.addMergedRegion(new Region((short)0,(short)0,(short)1,(short)1)); s.addMergedRegion(new Region((short)0,(short)0,(short)1,(short)1));
b.cloneSheet(0); b.cloneSheet(0);
} }
catch(Exception e){fail(e.getMessage());} catch(Exception e){e.printStackTrace();fail(e.getMessage());}
} }
} }