Skip to content

String Formatter error when key or value of Qualifier has character "%" #886

Closed

Description

@chenzhiw

feature.addQualifier("note", new Qualifier("note", "coding sequ%_ece", true));
GenbankWriterHelper.writeNucleotideSequence(......)

Exception in thread "main" java.util.UnknownFormatConversionException: Conversion = '_'
        at java.util.Formatter.checkText(Formatter.java:2579)
        at java.util.Formatter.parse(Formatter.java:2555)
        at java.util.Formatter.format(Formatter.java:2501)
        at java.io.PrintWriter.format(PrintWriter.java:905)
        at org.biojava.nbio.core.sequence.io.GenbankWriter.process(GenbankWriter.java:95)
        at org.biojava.nbio.core.sequence.io.GenbankWriterHelper.writeNucleotideSequence(GenbankWriterHelper.java:135)
        at GenBank.main(GenBank.java:41)

Activity

  1. enilapb commented on Sep 23, 2020

    @enilapb

    Have you tested doubling %% to scape % ?

  2. sbliven commented on Sep 25, 2020

    @sbliven
    Member

    I think it probably makes sense for BioJava to handle the escaping rather than forcing the user to do it.

    Actually, I don't understand why format is getting called in GenbankWriter.java:95 as all. Does calling PrintWriter.format(s) have any effect without additional arguments? It seems like all the formatting (and escaping) should be done within GenericGenbankHeaderFormat.

  3. added
    bugBugs and bugfixes
    help wantedQuestions and support for users
    on Sep 25, 2020
  4. emckee2006 commented on Sep 25, 2020

    @emckee2006
    Contributor
  5. sbliven commented on Sep 25, 2020

    @sbliven
    Member

    @emckee2006 Is there any reason why those couldn't be moved inside the HeaderFormat? It would still require escaping some sequences, but at least it only has to happen once.

  6. jamesmorris commented on Jul 1, 2021

    @jamesmorris
    Contributor

    Hello, I have recently come across this issue myself. Is anybody currently working on a fix for this problem?

    If not I am happy to have a go at proposing a solution

  7. josemduarte commented on Jul 1, 2021

    @josemduarte
    Contributor

    Thanks @jamesmorris , I don't think anyone is working on it. We're always happy with pull requests :)

  8. emckee2006 commented on Jul 1, 2021

    @emckee2006
    Contributor
  9. added a commit that references this issue on Jul 11, 2022
  10. added 3 commits that reference this issue on Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugBugs and bugfixeshelp wantedQuestions and support for users

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions