[go: up one dir, main page]

Menu

Code Merge Request #9: [#636] Fixed: DTD declaration is replaced with DTD file content in translated document (merged)

Merging...

Merged

Something went wrong. Please, merge manually

Checking if merge is possible...

Something went wrong. Please, merge manually

Martin Dufour wants to merge 1 commit from /u/martid1/omegat/ to master, 2019-08-25

Solves both the original issue described in ticket [bugs:#636], and the scenario we hit with use of an external entity file ('globals.ent'). Added a unit test which covers this last case.

Commit Date  
[59a641] (HEADmaster) by Martin Dufour Martin Dufour

[bugs:#636] Fixed: DTD declaration is replaced with DTD file content in translated document

Change-Id: I6b3416189c997011216767c8af1e7abdc7e667b2

2019-08-25 01:41:25 Tree

Discussion

  • Aaron Madlon-Kay

    • Description:

    Diff:

    --- old
    +++ new
    @@ -1 +1 @@
    -Solves both the original issue described in ticket [#636], and the scenario we hit with use of an external entity file ('globals.ent'). Added a unit test which covers this last case.
    +Solves both the original issue described in ticket [bugs:#636], and the scenario we hit with use of an external entity file ('globals.ent'). Added a unit test which covers this last case.
    
     

    Related

    Bugs: #636
    Feature Requests: #636

  • Martin Dufour

    Martin Dufour - 2019-08-19

    Thanks! Shall I recreate the merge request with the corrected ticket mention in the commit message?

     
  • Aaron Madlon-Kay

    Sure. If SourceForge is anything like GitHub, you can simply reword your commit message and force-push over the existing remote branch (no need to make a new merge request).

     
  • Martin Dufour

    Martin Dufour - 2019-08-19

    Done; let me know if you'd like more details about the included changes!

     
  • Aaron Madlon-Kay

    Thanks. I'll hopefully be able to take a look this weekend.

     
  • Aaron Madlon-Kay

    Unfortunately it seems I can't comment on lines of your code on SourceForge :(

    It's a very minor point, but appends like res.append("%" + name + ";"); would be nicer as res.append('%').append(name).append(';'); so you don't build an unneeded intermediary string. (I know the original code was like the former, so I don't blame you for copying its style.)

     
  • Aaron Madlon-Kay

    In Handler.localizeSystemId, please don't swallow the IllegalArgumentException. At the very least it should be logged.

    Is there a reason you do new URL(systemId).toURI() instead of simply new URI(systemId)?

    We might as well fix the typo in the local variable parameterEntiry in the doEndEntity method.

    I'm a little concerned about the if (extWriter != null) condition at the end of doEndEntity. Previously it was assumed that extWriter was not null, so it would be an error for it to be null at that point. Now such an error would not be revealed. However this class is extremely stateful and to be honest I don't understand it fully, so maybe it's not a problem. But I would prefer to remove the if if possible (maybe it should be only in one branch of the if (dtd != null) conditional immediately above).

    There are several places where you have an open bracket attached to a parenthesis: ){; please put a space between.

     
  • Aaron Madlon-Kay

    Thanks very much for the unit test. I confirmed that it passes with your changes, and fails when they are reverted.

    Please take a look at my feedback above and let me know when you're done with any additional changes.

     
  • Martin Dufour

    Martin Dufour - 2019-08-24

    I haven't touched Java code in decades, so I'm grateful for the thorough code review.

    About Handler.localizeSystemId: swallowing IllegalArgumentException is in line with the previous behavior: if the path can't be relativized, the absolute path is preserved without any fuss. It is not an actual error case.

    As for the extra condition in doEndEntity, this is due to my decoupling of extEntity and extWriter in doResolve; this corrects the behavior when referring to an extEntity that is in a parent directory of the current output directory (in which case we don't want to be writing in the output path's parent).

    All the other items you mentioned, I will correct and resubmit.

     
  • Martin Dufour

    Martin Dufour - 2019-08-25

    This merge request is now up-to-date with the corrections.

     
  • Aaron Madlon-Kay

    Thanks for the update.

    Is there a reason you do new URL(systemId).toURI() instead of simply new URI(systemId)?

    I just realized this was a dumb question; the smart question would have been "why not do Paths.get(systemId)?" Unfortunately it seems like I can't push to your branch (unlike GitHub) so I will cherry pick your commit and push it to master manually.

     
    • Martin Dufour

      Martin Dufour - 2019-08-25

      I can't figure out how to make your last improvement work, so I will indeed let you make that final change.

      Do I understand that GitHub is the preferred channel for code contributions?

       
      • Aaron Madlon-Kay

        Well it wasn't an improvement so I skipped it.

        Per the developers' readme, yes, we (actually, mostly "I") do prefer GitHub:
        https://sourceforge.net/p/omegat/code/ci/master/tree/docs_devel/README.txt#l115

        Historically people have mostly either submitted file diffs or GitHub PRs. SourceForge is OK for trivial patches, but in general it leaves a lot to be desired.

        Thanks for a quality patch (with unit test!).

         
  • Aaron Madlon-Kay

    Actually Paths.get(systemId) is wrong because first you need to parse it as a URI, otherwise you get file: in your path. Duh.

     
  • Aaron Madlon-Kay

    • Status: open --> merged
     

Log in to post a comment.