Fixed the DOI connection Error by Automatically Removing all Special Characters at the end of DOI#8215
Fixed the DOI connection Error by Automatically Removing all Special Characters at the end of DOI#8215jiezheng5 wants to merge 14 commits into
Conversation
|
I fixed all the checkstyle errors. |
| } | ||
| } | ||
|
|
||
| // char[] lcharDoi = doiStr.toCharArray(); |
There was a problem hiding this comment.
This is not really in the spirit of open source contribution. You requested to work on this issue after me and I have started working on it.
There was a problem hiding this comment.
This is not really in the spirit of open source contribution. You requested to work on this issue after me and I have started working on it.
I started working on this issue 3 weeks ago. Then I saw your request, I thought maybe I should also post my progress. Do we have to get permission before we can work on any open issues? This is my first time contributing to open source, I am sorry that if I have done something wrong.
thanks,
There was a problem hiding this comment.
remove commented out code
thanks very much for the suggestions, will do.
There was a problem hiding this comment.
and I have started working on it.
@mrcstan May we see your approach? Maybe it differs significantly of this one - and we can make use of your ideas, too?
| <option name="MAIN_CLASS_NAME" value="org.jabref.gui.JabRefMain" /> | ||
| <module name="JabRef.main" /> | ||
| <option name="VM_PARAMETERS" value="--patch-module test=fastparse_2.12-1.0.0.jar --patch-module test2=fastparse-utils_2.12-1.0.0.jar --patch-module test3=sourcecode_2.12-0.1.4.jar --patch-module org.jabref=build/resources/main --add-exports javafx.controls/com.sun.javafx.scene.control=org.jabref --add-exports org.controlsfx.controls/impl.org.controlsfx.skin=org.jabref --add-opens javafx.controls/javafx.scene.control=org.jabref --add-opens org.controlsfx.controls/org.controlsfx.control.textfield=org.jabref --add-exports javafx.graphics/com.sun.javafx.scene=org.controlsfx.controls --add-exports javafx.graphics/com.sun.javafx.scene.traversal=org.controlsfx.controls --add-exports javafx.graphics/com.sun.javafx.css=org.controlsfx.controls --add-exports javafx.controls/com.sun.javafx.scene.control.behavior=org.controlsfx.controls --add-exports javafx.controls/com.sun.javafx.scene.control=org.controlsfx.controls --add-exports javafx.controls/com.sun.javafx.scene.control.inputmap=org.controlsfx.controls --add-exports javafx.base/com.sun.javafx.event=org.controlsfx.controls --add-exports javafx.base/com.sun.javafx.collections=org.controlsfx.controls --add-exports javafx.base/com.sun.javafx.runtime=org.controlsfx.controls --add-exports javafx.web/com.sun.webkit=org.controlsfx.controls --add-exports javafx.graphics/com.sun.javafx.css=org.controlsfx.controls --add-opens javafx.controls/javafx.scene.control.skin=org.controlsfx.controls --add-opens javafx.graphics/javafx.scene=org.controlsfx.controls --add-exports com.oracle.truffle.regex/com.oracle.truffle.regex=org.graalvm.truffle --add-exports javafx.graphics/com.sun.javafx.stage=com.jfoenix --add-exports javafx.controls/com.sun.javafx.scene.control.behavior=com.jfoenix" /> | ||
| <option name="VM_PARAMETERS" value="--patch-module test=fastparse_2.12-1.0.0.jar --patch-module test2=fastparse-utils_2.12-1.0.0.jar --patch-module test3=sourcecode_2.12-0.1.4.jar --patch-module org.jabref=build/resources/main --add-exports javafx.controls/com.sun.javafx.scene.control=org.jabref --add-exports org.controlsfx.controls/impl.org.controlsfx.skin=org.jabref --add-opens javafx.controls/javafx.scene.control=org.jabref --add-opens org.controlsfx.controls/org.controlsfx.control.textfield=org.jabref --add-exports javafx.graphics/com.sun.javafx.scene=org.controlsfx.controls --add-exports javafx.graphics/com.sun.javafx.scene.traversal=org.controlsfx.controls --add-exports javafx.graphics/com.sun.javafx.css=org.controlsfx.controls --add-exports javafx.controls/com.sun.javafx.scene.control.behavior=org.controlsfx.controls --add-exports javafx.controls/com.sun.javafx.scene.control=org.controlsfx.controls --add-exports javafx.controls/com.sun.javafx.scene.control.inputmap=org.controlsfx.controls --add-exports javafx.base/com.sun.javafx.event=org.controlsfx.controls --add-exports javafx.base/com.sun.javafx.collections=org.controlsfx.controls --add-exports javafx.base/com.sun.javafx.runtime=org.controlsfx.controls --add-exports javafx.web/com.sun.webkit=org.controlsfx.controls --add-exports javafx.graphics/com.sun.javafx.css=org.controlsfx.controls --add-opens javafx.controls/javafx.scene.control.skin=org.controlsfx.controls --add-opens javafx.graphics/javafx.scene=org.controlsfx.controls --add-exports com.oracle.truffle.regex/com.oracle.truffle.regex=org.graalvm.truffle --add-exports javafx.graphics/com.sun.javafx.stage=com.jfoenix --add-exports javafx.controls/com.sun.javafx.scene.control.behavior=com.jfoenix -ea --add-exports=javafx.controls/com.sun.javafx.scene.control=org.jabref --add-exports=org.controlsfx.controls/impl.org.controlsfx.skin=org.jabref --add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.stage=com.jfoenix" /> |
There was a problem hiding this comment.
May I ask of the reasons why this file mas modified? IntelliJ runs fine as is.
There was a problem hiding this comment.
May I ask of the reasons why this file mas modified? IntelliJ runs fine as is.
Hi, Kopper:
Thanks very much for the feedback. I think IntelliJ automatically did it. I had lots of trouble running using IntelliJ both on windows and Linux. So I just used gradlew to run, which worked perfectly.
Thanks
| ### Fixed | ||
|
|
||
| - We fixed an issue where an invalid DOI should not show "Connection error" [#8127](https://github.com/JabRef/jabref/issues/8127) | ||
| - We fixed an issue where an exception ocurred when a linked online file was edited in the entry editor [#8008](https://github.com/JabRef/jabref/issues/8008) |
There was a problem hiding this comment.
Please remove this duplicted line
There was a problem hiding this comment.
sure, will do. Thanks very much.
| // Remove whitespace | ||
| String trimmedDoi = doi.trim(); | ||
|
|
||
| // jie add------------------------- |
There was a problem hiding this comment.
thanks very much for your patience, I forgot to remove it after debugging. will do.
have a great night.
| /** | ||
| * Removes all special characters at the end of the DOI string | ||
| * | ||
| * @param doiStr the DOI/Short DOI string | ||
| * @return an DOI string with the special character at the end removed | ||
| */ | ||
| public static String removeScharDOI(String doiStr) { | ||
| // jie add | ||
| char[] lcharDoi = doiStr.toCharArray(); | ||
| int i = lcharDoi.length - 1; | ||
| // valid DOI characters are a-z(97-122), A-Z(65-90), 0-9(48-57), -(45), .(46), _(95), ;(59), ( (40), ) (41), /(47) | ||
| for (; i >= 0; i--) { | ||
| if ((lcharDoi[i] >= 45 && lcharDoi[i] <= 47) || | ||
| (lcharDoi[i] >= 48 && lcharDoi[i] <= 57) || | ||
| (lcharDoi[i] >= 65 && lcharDoi[i] <= 90) || | ||
| (lcharDoi[i] >= 97 && lcharDoi[i] <= 122) || | ||
| lcharDoi[i] == 95 || | ||
| lcharDoi[i] == 59 || | ||
| lcharDoi[i] == 40 || | ||
| lcharDoi[i] == 41 | ||
| ) { | ||
| // System.out.println(i); | ||
| break; | ||
| } | ||
| } |
There was a problem hiding this comment.
This approach feels a bit hacky. I thought that it is about DOI parsing with the RegEx. Could you please test the RegEx whether it removes the bad character?
There was a problem hiding this comment.
ok, great suggestion. I will refactor the code and test the RegEx.
greatly appreciated all the suggestions
|
Fixes #8127 |
|
With more than 3 core developers, we looked at this issue in today's dev call. We found out, that there is @jiezheng5 Could you add your test cases to that PR? I would like to ask you to add a new test section below |
|
I am closing this one, as we think, the tests should be merged with #8227 |
|
I guess I just missed this one. I created a PR that uses regexp #8288. Seems like it has been fixed elsewhere. Let me know if I can contribute anything else. |
my pleasure. will do. |
CHANGELOG.mddescribed in a way that is understandable for the average user (if applicable)