Skip to content

Refactor BibtexEntryType#352

Merged
stefan-kolb merged 23 commits into
masterfrom
refactor-entrytype
Nov 19, 2015
Merged

Refactor BibtexEntryType#352
stefan-kolb merged 23 commits into
masterfrom
refactor-entrytype

Conversation

@stefan-kolb

Copy link
Copy Markdown
Member

This is a massive refactoring of BibtexEntryTypes.

Changes

  • Divided EntryTypes into subclasses BibtexEbtryTypes, IEEETranEntryTpes, BiblatexEntryTypes and introduced a new EntryType interface.
  • EntryTypes are now clustered per group on the 'add new entry' GUI screen.
  • BibtexTypes and IEEETranTypes required field checking is consistent now.
  • Entry type 'Other' is not selectable anymore as it is no real entry type.
  • Removed getUtilityFields method from EntryType
  • Removed getRequiredFieldsForCustomization as its result is equal with getRequiredFields now
  • Removed isVisibleAtNewEntryDialog, visibility is controlled via an internal List for each EntryTypes collection

Further TODOs see #366

@JabRef/developers Everyone, please take a close look before merging this into master.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final?

@stefan-kolb stefan-kolb changed the title [WIP] Refactor BibtexEntryType Refactor BibtexEntryType Nov 18, 2015
@stefan-kolb stefan-kolb added this to the v3.0 milestone Nov 18, 2015
@stefan-kolb stefan-kolb added review and removed review labels Nov 19, 2015
stefan-kolb added a commit that referenced this pull request Nov 19, 2015
@stefan-kolb stefan-kolb merged commit 88ec354 into master Nov 19, 2015
@stefan-kolb stefan-kolb deleted the refactor-entrytype branch November 19, 2015 13:02
@koppor

koppor commented Nov 19, 2015

Copy link
Copy Markdown
Member

@Other is used in many bib files. Including my personal bib file. We have to offer a migration path. Currently, the entry editor does not open, because of java.util.Objects.requireNonNull (see below). One cannot quit JabRef after this error.

With othertype.bib, I get the error message unknown entry type: other:test. Did the parsing of the lines changed? Did the parsing change? Why is the colon (:) not recognized any more as separator?

In general: JabRef should still be able to handle arbitrary custom types. Even if not configured in the bib file. I heard from some persons that they manage contacts and we cannot forsee all customized types. To test that, I added reallyunknowntype.bib.

Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
    at net.sf.jabref.gui.entryeditor.EntryEditor.updateSource(EntryEditor.java:571)
    at net.sf.jabref.gui.entryeditor.EntryEditor.setupSourcePanel(EntryEditor.java:555)
    at net.sf.jabref.gui.entryeditor.EntryEditor.<init>(EntryEditor.java:194)
    at net.sf.jabref.gui.BasePanel.getEntryEditor(BasePanel.java:2075)
    at net.sf.jabref.gui.MainTableSelectionListener.editSignalled(MainTableSelectionListener.java:241)
    at net.sf.jabref.gui.MainTableSelectionListener.mouseClicked(MainTableSelectionListener.java:284)
    at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:270)
    at java.awt.Component.processMouseEvent(Component.java:6528)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
    at java.awt.Component.processEvent(Component.java:6290)
    at java.awt.Container.processEvent(Container.java:2234)
    at java.awt.Component.dispatchEventImpl(Component.java:4881)
    at java.awt.Container.dispatchEventImpl(Container.java:2292)
    at java.awt.Component.dispatchEvent(Component.java:4703)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4542)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)
    at java.awt.Container.dispatchEventImpl(Container.java:2278)
    at java.awt.Window.dispatchEventImpl(Window.java:2750)
    at java.awt.Component.dispatchEvent(Component.java:4703)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.awt.EventQueue$4.run(EventQueue.java:729)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.NullPointerException
    at java.util.Objects.requireNonNull(Objects.java:203)
    at java.util.Arrays$ArrayList.<init>(Arrays.java:3813)
    at java.util.Arrays.asList(Arrays.java:3800)
    at net.sf.jabref.model.entry.CustomEntryType.getRequiredFields(CustomEntryType.java:91)
    at net.sf.jabref.model.entry.EntryType.getRequiredFieldsFlat(EntryType.java:44)
    at net.sf.jabref.bibtex.BibtexEntryWriter.<clinit>(BibtexEntryWriter.java:72)
    ... 38 more

@koppor

koppor commented Nov 19, 2015

Copy link
Copy Markdown
Member

The closing seems to be prevented by

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at net.sf.jabref.model.entry.CustomEntryType.getRequiredFieldsString(CustomEntryType.java:112)
        at net.sf.jabref.JabRefPreferences.storeCustomEntryType(JabRefPreferences.java:1338)
        at net.sf.jabref.logic.CustomEntryTypesManager.saveCustomEntryTypes(CustomEntryTypesManager.java:44)
        at net.sf.jabref.gui.JabRefFrame.tearDownJabRef(JabRefFrame.java:812)
        at net.sf.jabref.gui.JabRefFrame.quit(JabRefFrame.java:917)
        at net.sf.jabref.gui.JabRefFrame$CloseAction.actionPerformed(JabRefFrame.java:1759)
        at net.sf.jabref.gui.JabRefFrame$3.windowClosing(JabRefFrame.java:563)

@lenhard

lenhard commented Nov 19, 2015

Copy link
Copy Markdown
Member

Is the closing bug fixed with e725a5e ?

@stefan-kolb

Copy link
Copy Markdown
Member Author

I'll take a look after the lecture. Thanks for the Testing!

@koppor

koppor commented Nov 19, 2015

Copy link
Copy Markdown
Member

Saving works now.

@stefan-kolb

Copy link
Copy Markdown
Member Author

I don't get any exceptions. Except that you get the message that the type is unknown which is expected. What should change in your opinion? I also got these messages before the current change.
Only Other gets the same message know as it must be changed by the user to a known type or set as custom type. I can also migrate it to 'Misc' automatically if prefered.

@koppor

koppor commented Nov 20, 2015

Copy link
Copy Markdown
Member

Fixed in master 🐅 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants