Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 439083 - [preferences] ArithmeticException while editing formatter profile from preference page
Summary: [preferences] ArithmeticException while editing formatter profile from prefer...
Status: RESOLVED DUPLICATE of bug 303519
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.7 M1   Edit
Assignee: Mateusz Matela CLA
QA Contact:
URL:
Whiteboard: To be verified for 4.7 M1
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-07 20:38 EDT by Martin Mathew CLA
Modified: 2016-06-24 13:29 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Mathew CLA 2014-07-07 20:38:01 EDT
Go to Windows > Preferences > Java > Code Style > Formatter and edit the formatter profile. In the 'Indentation' tab, change Tab policy to 'Spaces only' and set Indentation size to '0':

!MESSAGE The formatter threw an unhandled exception while formatting the preview.
!STACK 0
java.lang.ArithmeticException: / by zero
	at org.eclipse.jdt.internal.formatter.Scribe.setIndentation(Scribe.java:1510)
	at org.eclipse.jdt.internal.formatter.CodeFormatterVisitor.visit(CodeFormatterVisitor.java:5496)
	at org.eclipse.jdt.internal.compiler.ast.SwitchStatement.traverse(SwitchStatement.java:610)
	at org.eclipse.jdt.internal.formatter.CodeFormatterVisitor.formatStatements(CodeFormatterVisitor.java:2108)
	at org.eclipse.jdt.internal.formatter.CodeFormatterVisitor.visit(CodeFormatterVisitor.java:4683)
	at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.traverse(MethodDeclaration.java:317)
	at org.eclipse.jdt.internal.formatter.CodeFormatterVisitor.format(CodeFormatterVisitor.java:615)
	at org.eclipse.jdt.internal.formatter.CodeFormatterVisitor.formatTypeMembers(CodeFormatterVisitor.java:2275)
	at org.eclipse.jdt.internal.formatter.CodeFormatterVisitor.format(CodeFormatterVisitor.java:1258)
	at org.eclipse.jdt.internal.formatter.CodeFormatterVisitor.visit(CodeFormatterVisitor.java:5805)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1338)
	at org.eclipse.jdt.internal.formatter.CodeFormatterVisitor.visit(CodeFormatterVisitor.java:3440)
	at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.traverse(CompilationUnitDeclaration.java:712)
	at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.traverse(CompilationUnitDeclaration.java:706)
	at org.eclipse.jdt.internal.formatter.CodeFormatterVisitor.format(CodeFormatterVisitor.java:904)
	at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.formatCompilationUnit(DefaultCodeFormatter.java:244)
	at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.format(DefaultCodeFormatter.java:166)
	at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.format(DefaultCodeFormatter.java:149)
	at org.eclipse.jdt.internal.corext.util.CodeFormatterUtil.reformat(CodeFormatterUtil.java:288)
	at org.eclipse.jdt.internal.ui.text.java.JavaFormattingStrategy.format(JavaFormattingStrategy.java:67)
	at org.eclipse.jface.text.formatter.MultiPassContentFormatter.formatMaster(MultiPassContentFormatter.java:193)
	at org.eclipse.jface.text.formatter.MultiPassContentFormatter.format(MultiPassContentFormatter.java:142)
	at org.eclipse.jdt.internal.ui.preferences.formatter.CompilationUnitPreview.doFormatPreview(CompilationUnitPreview.java:61)
	at org.eclipse.jdt.internal.ui.preferences.formatter.JavaPreview.update(JavaPreview.java:174)
	at org.eclipse.jdt.internal.ui.preferences.formatter.IndentationTabPage.doUpdatePreview(IndentationTabPage.java:141)
	at org.eclipse.jdt.internal.ui.preferences.formatter.ModifyDialogTabPage$1.update(ModifyDialogTabPage.java:71)
	at java.util.Observable.notifyObservers(Observable.java:159)
	at java.util.Observable.notifyObservers(Observable.java:115)
	at org.eclipse.jdt.internal.ui.preferences.formatter.ModifyDialogTabPage$NumberPreference.saveSelected(ModifyDialogTabPage.java:434)
	at org.eclipse.jdt.internal.ui.preferences.formatter.ModifyDialogTabPage$NumberPreference.focusLost(ModifyDialogTabPage.java:396)
	at org.eclipse.jdt.internal.ui.preferences.formatter.ModifyDialogTabPage$NumberPreference$1.focusLost(ModifyDialogTabPage.java:367)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:143)
Comment 1 Mateusz Matela CLA 2016-06-24 13:29:38 EDT
This problem no longer occurs after the formatter redesign.

*** This bug has been marked as a duplicate of bug 303519 ***