Bug 26599 BadLocationException in JavaAutoIndentStrategy
I20021115: - Open the Java editor - select/copy a couple of lines with soem indentation - select all lines and delete them - paste them into the empty editor -> JavaAutoIndentStrategy.calcShiftBackReplace: BadLocationException
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaAutoIndentStrategy.java
private static String createPrefix(int displayedWidth) {
		StringBuffer buffer= new StringBuffer();
		if (useSpaces()) {
			for (int i= 0; i != displayedWidth; ++i)	
				buffer.append(' ');
		} else {
			int tabWidth= getPreferenceStore().getInt(PreferenceConstants.EDITOR_TAB_WIDTH);
			int div= displayedWidth / tabWidth;
			int mod= displayedWidth % tabWidth;
			for (int i= 0; i != div; ++i)
				buffer.append('\t');	
			for (int i= 0; i != mod; ++i)	
				buffer.append(' ');				 
		} 
		return buffer.toString();
	}
	
	private String stripIndent(String paragraph, String lineDelimiter) {
		final StringBuffer buffer= new StringBuffer();		
		
		int minIndentWidth= Integer.MAX_VALUE;				
		for (final Iterator iterator= new LineIterator(paragraph); iterator.hasNext();) {
			String line= (String) iterator.next();
			String trimmedLine= line.trim();			
			if (trimmedLine.length() == 0)
				continue;
			int index= line.indexOf(trimmedLine);
			String indent= line.substring(0, index);
			int width= calculateDisplayedWidth(indent);
			minIndentWidth= Math.min(minIndentWidth, width);