Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #3994 Duplicate unmodifiable list for sorting #3996

Merged
merged 1 commit into from
Apr 29, 2018

Conversation

stefan-kolb
Copy link
Member

@stefan-kolb stefan-kolb commented Apr 29, 2018

Fix #3994

runCommand error: null
java.lang.UnsupportedOperationException
	at java.util.Collections$UnmodifiableList.sort(Unknown Source)
	at org.jabref.gui.exporter.ExportToClipboardAction.run(ExportToClipboardAction.java:59)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at spin.Invocation.evaluate(Invocation.java:175)
	at spin.off.SpinOffEvaluator$1.run(SpinOffEvaluator.java:108)
	at java.lang.Thread.run(Unknown Source)

@stefan-kolb stefan-kolb added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Apr 29, 2018
List<Exporter> exporters = Globals.exportFactory.getExporters();
exporters.sort(Comparator.comparing(Exporter::getDisplayName));
List<String> exportFormatDisplayNames = exporters.stream().map(Exporter::getDisplayName).collect(Collectors.toList());
List<Exporter> sortedExporters = Globals.exportFactory.getExporters().stream().sorted(Comparator.comparing(Exporter::getDisplayName)).collect(Collectors.toList());
Copy link
Member

Choose a reason for hiding this comment

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

I think you can improve this a bit, if you return here only the stream, and reuse it for the displayName. Is more efficent then adding it to a list and iterating that list again.

Copy link
Member Author

Choose a reason for hiding this comment

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

I need the list in line 70?! Once the Stream is terminated I cannot reuse it.

@stefan-kolb stefan-kolb merged commit 3c1336d into master Apr 29, 2018
@stefan-kolb stefan-kolb deleted the clipboard-export branch April 29, 2018 12:07
Siedlerchr added a commit that referenced this pull request May 5, 2018
…rsectionnew

* upstream/maintable-beta: (88 commits)
  set look and feel to windows, aqua or nimbus for swing in case
  fix import
  remove look and feel
  New translations JabRef_en.properties (French) (#4009)
  Fix Look and Feel related issues (#4002)
  Fix statement in changelog
  [WIP] Add Text File Export for "Find Unlinked Files" (#3979)
  Fix IEEE preview does not display month  (#3983)
  Activate context menu on key press (#4004)
  Improve code layout
  Fix concurrent modification exception when adding entries to groups
  Fix build
  Typo
  Add fix
  Rename test
  Fix #3994 Duplicate unmodifiable list for sorting (#3996)
  Remove deprecated and unused method (#3993)
  Improvements around external file types (#3887)
  Migrate to native gradle test task (#3987)
  Do not run checkstyle as part of the gradle check task (#3985)
  ...
Siedlerchr added a commit that referenced this pull request May 10, 2018
…drop

* upstream/maintable-beta: (174 commits)
  Fix ACM fetcher import of entries (#4019)
  Reimplement tooltips for file and identifier columns (#4011)
  Add button-icon for union/intersection in the groups side panel (#3954)
  Update Dependencies (#4012)
  set look and feel to windows, aqua or nimbus for swing in case
  fix import
  remove look and feel
  New translations JabRef_en.properties (French) (#4009)
  Fix Look and Feel related issues (#4002)
  Fix statement in changelog
  [WIP] Add Text File Export for "Find Unlinked Files" (#3979)
  Fix IEEE preview does not display month  (#3983)
  Activate context menu on key press (#4004)
  Improve code layout
  Fix concurrent modification exception when adding entries to groups
  Fix build
  Typo
  Add fix
  Rename test
  Fix #3994 Duplicate unmodifiable list for sorting (#3996)
  ...

# Conflicts:
#	src/main/java/org/jabref/gui/actions/CleanupAction.java
#	src/main/java/org/jabref/gui/maintable/MainTable.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants