anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: dita-ot/dita-ot
Issue: Keyref on longdescref element inside image is not resolved to an href

Started from:
https://www.oxygenxml.com/forum/viewtopic.php?p=68639#p68639

Let's say I have an image element with a longdescref inside it having a keyref:

    <image href="image.jpg">
      <longdescref keyref="targetKey"/>
    </image>

I publish the DITA Map to HTML5, look in the temporary files folder at the temp DITA topic and it does not contain an @href on the &lt;longdescref> element.

As a possible suggested fix in this field org.dita.dost.writer.KeyrefPaser.keyrefInfos probably an extra definition needs to be added:

    ki.add(new KeyrefInfo(TOPIC_LONGDESCREF, ATTRIBUTE_NAME_HREF, false, false));

Changed files:
src/main/java/org/dita/dost/writer/KeyrefPaser.java

diff --git a/src/main/java/org/dita/dost/writer/KeyrefPaser.java b/src/main/java/org/dita/dost/writer/KeyrefPaser.java
index 92c55a32d..93eecf211 100644
--- a/src/main/java/org/dita/dost/writer/KeyrefPaser.java
+++ b/src/main/java/org/dita/dost/writer/KeyrefPaser.java
@@ -103,6 +103,7 @@ public final class KeyrefPaser extends AbstractXMLFilter {
         ki.add(new KeyrefInfo(TOPIC_INDEX_BASE, ATTRIBUTE_NAME_HREF, false, false));
         ki.add(new KeyrefInfo(TOPIC_INDEXTERMREF, ATTRIBUTE_NAME_HREF, false, false));
         ki.add(new KeyrefInfo(TOPIC_LONGQUOTEREF, ATTRIBUTE_NAME_HREF, false, false));
+        ki.add(new KeyrefInfo(TOPIC_LONGDESCREF, ATTRIBUTE_NAME_HREF, false, false));
         final Map<String, String> objectAttrs = new HashMap<>();
         objectAttrs.put(ATTRIBUTE_NAME_ARCHIVEKEYREFS, ATTRIBUTE_NAME_ARCHIVE);
         objectAttrs.put(ATTRIBUTE_NAME_CLASSIDKEYREF, ATTRIBUTE_NAME_CLASSID);
Repository: dita-ot/dita-ot
Issue: Strict mode doesn't cause failure when images are missing, though it reports that as an ERROR

## Expected Behavior
When processing-mode=strict, builds fail when any missing file is reported (error [DOTX008E][ERROR])

## Actual Behavior
When using strict, I get build failures when a file referenced by a topicref in a ditamap isn't found. But I don't get failures for missing images, although strict mode is supposed to fail on any error. 



## Copy of the error message, log file or stack trace
[dita-ot] [topic-reader] [DOTX008E][ERROR] File 'file:/C:/workgit/dt-pipeline/dita-test/content/images/NONEXISTENTnote.png' does not exist or cannot be loaded.

## Environment
<!-- Include relevant details about the environment you experienced this in. -->

* DITA-OT version: 3.6.1
* Operating system and version: Windows 10, LInux

* How did you run DITA-OT?  command line
* Transformation type: HTML and PDF


Changed files:
src/main/java/org/dita/dost/module/reader/TopicReaderModule.java

diff --git a/src/main/java/org/dita/dost/module/reader/TopicReaderModule.java b/src/main/java/org/dita/dost/module/reader/TopicReaderModule.java
index 01542c227..3176209e3 100644
--- a/src/main/java/org/dita/dost/module/reader/TopicReaderModule.java
+++ b/src/main/java/org/dita/dost/module/reader/TopicReaderModule.java
@@ -12,12 +12,14 @@ import net.sf.saxon.s9api.QName;
 import net.sf.saxon.s9api.XdmNode;
 import org.dita.dost.exception.DITAOTException;
 import org.dita.dost.exception.DITAOTXMLErrorHandler;
+import org.dita.dost.exception.UncheckedDITAOTException;
 import org.dita.dost.log.MessageUtils;
 import org.dita.dost.module.filter.SubjectScheme;
 import org.dita.dost.pipeline.AbstractPipelineInput;
 import org.dita.dost.pipeline.AbstractPipelineOutput;
 import org.dita.dost.reader.GenListModuleReader.Reference;
 import org.dita.dost.reader.SubjectSchemeReader;
+import org.dita.dost.util.Configuration;
 import org.dita.dost.util.Job.FileInfo;
 import org.dita.dost.writer.DebugFilter;
 import org.dita.dost.writer.NormalizeFilter;
@@ -296,7 +298,11 @@ public final class TopicReaderModule extends AbstractReaderModule {
             } else if (ATTR_FORMAT_VALUE_IMAGE.equals(file.format)) {
                 formatSet.add(file);
                 if (!exists(file.filename)) {
-                    logger.warn(MessageUtils.getMessage("DOTX008E", file.filename.toString()).toString());
+                    if (processingMode == Configuration.Mode.STRICT) {
+                        throw new UncheckedDITAOTException(MessageUtils.getMessage("DOTX008E", file.filename.toString()).toException());
+                    } else {
+                        logger.warn(MessageUtils.getMessage("DOTX008E", file.filename.toString()).toString());
+                    }
                 }
             } else {
                 htmlSet.put(file.format, file.filename);
Repository: dita-ot/dita-ot
Issue: Error in HTML publishing if any topic has apostrophe in its name

Create a topic with apostrophe in its name e.g. i'm_topic.dita. Put it in ditamap and publish.
PDF works fine but xhtml and html5 give NullPointerException.

Changed files:
src/test/java/org/dita/dost/util/URLUtilsTest.java, src/main/java/org/dita/dost/util/URLUtils.java

diff --git a/src/main/java/org/dita/dost/util/URLUtils.java b/src/main/java/org/dita/dost/util/URLUtils.java
index 3915bb3ca..1e5e7e0a7 100644
--- a/src/main/java/org/dita/dost/util/URLUtils.java
+++ b/src/main/java/org/dita/dost/util/URLUtils.java
@@ -313,7 +313,10 @@ public final class URLUtils {
                 //'%',
                 '"', '{', '}',
                 //'?',
-                '|', '\\\\', '^', '~', '[', ']', '`', '\\'',
+                '|', '\\\\', '^',
+                //'~',
+                '[', ']', '`',
+                //'\\'',
                 //'&'
                 };
         char ch;
diff --git a/src/test/java/org/dita/dost/util/URLUtilsTest.java b/src/test/java/org/dita/dost/util/URLUtilsTest.java
index fa1b43f4d..b89e5d03f 100644
--- a/src/test/java/org/dita/dost/util/URLUtilsTest.java
+++ b/src/test/java/org/dita/dost/util/URLUtilsTest.java
@@ -140,6 +140,7 @@ public class URLUtilsTest {
         assertEquals(new URI("foo%20bar.txt"), URLUtils.toURI("foo bar.txt"));
         assertEquals(new URI("foo/bar.txt"), URLUtils.toURI("foo" + Constants.WINDOWS_SEPARATOR + "bar.txt"));
         assertEquals(new URI("foo%20bar.txt"), URLUtils.toURI(" foo bar.txt "));
+        assertEquals(new URI("user's%20manual.txt"), URLUtils.toURI("user's manual.txt"));
         assertEquals(new URI("http://www.example.com/"), URLUtils.toURI(" http://www.example.com/ "));
     }
Repository: dita-ot/dita-ot
Issue: Chunk to content on DITA Map fails when the DITA Map has spaces in file name

I have a DITA Map with spaces in its file name "flowers by season_map.ditamap" which has chunk=to-content set on the root element.

Publishing it to HTML5 fails with:

        /.../plugins/org.dita.base/build_preprocess.xml:260: java.lang.IllegalArgumentException: Illegal character in path at index 7: flowers by season_map.dita
	at java.base/java.net.URI.create(URI.java:906)
	at java.base/java.net.URI.resolve(URI.java:1089)
	at org.dita.dost.reader.ChunkMapReader.chunkMap(ChunkMapReader.java:209)
	at org.dita.dost.reader.ChunkMapReader.process(ChunkMapReader.java:136)
	at org.dita.dost.writer.AbstractDomFilter.read(AbstractDomFilter.java:41)

[flowers22.zip](https://github.com/dita-ot/dita-ot/files/10089903/flowers22.zip)


Changed files:
src/main/java/org/dita/dost/reader/ChunkMapReader.java

diff --git a/src/main/java/org/dita/dost/reader/ChunkMapReader.java b/src/main/java/org/dita/dost/reader/ChunkMapReader.java
index c28621c16..584e596e2 100644
--- a/src/main/java/org/dita/dost/reader/ChunkMapReader.java
+++ b/src/main/java/org/dita/dost/reader/ChunkMapReader.java
@@ -35,6 +35,7 @@ import org.dita.dost.module.reader.TempFileNameScheme;
 import org.dita.dost.util.DitaClass;
 import org.dita.dost.util.Job;
 import org.dita.dost.util.Job.FileInfo;
+import org.dita.dost.util.URLUtils;
 import org.dita.dost.util.XMLSerializer;
 import org.dita.dost.writer.AbstractDomFilter;
 import org.dita.dost.writer.ChunkTopicParser;
@@ -208,11 +209,11 @@ public final class ChunkMapReader extends AbstractDomFilter {
    */
   private void chunkMap(final Element root) {
     // create the reference to the new file on root element.
-    String newFilename = replaceExtension(new File(currentFile).getName(), FILE_EXTENSION_DITA);
+    URI newFilename = URLUtils.toURI(replaceExtension(new File(currentFile).getName(), FILE_EXTENSION_DITA));
     URI newFile = currentFile.resolve(newFilename);
     if (job.getStore().exists(newFile)) {
       final URI oldFile = newFile;
-      newFilename = chunkFilenameGenerator.generateFilename(CHUNK_PREFIX, FILE_EXTENSION_DITA);
+      newFilename = URLUtils.toURI(chunkFilenameGenerator.generateFilename(CHUNK_PREFIX, FILE_EXTENSION_DITA));
       newFile = currentFile.resolve(newFilename);
       // Mark up the possible name changing, in case that references might be updated.
       conflictTable.put(newFile, oldFile.normalize());
@@ -222,7 +223,7 @@ public final class ChunkMapReader extends AbstractDomFilter {
     // change the class attribute to "topicref"
     final String origCls = root.getAttribute(ATTRIBUTE_NAME_CLASS);
     root.setAttribute(ATTRIBUTE_NAME_CLASS, origCls + MAP_TOPICREF.matcher);
-    root.setAttribute(ATTRIBUTE_NAME_HREF, toURI(newFilename).toString());
+    root.setAttribute(ATTRIBUTE_NAME_HREF, newFilename.toString());
 
     createTopicStump(newFile);
Repository: dita-ot/dita-ot
Issue: DITAOTXMLErrorHandler no longer shows line/column number for error messages

On the callback method "org.dita.dost.exception.DITAOTXMLErrorHandler.error(SAXParseException)" if the processing is not strict, line column information is no longer logged in the console. So for example if there are validator errors in the XML document, their message is shown in the console but not their system id, line and column information.

I suggest we replace:

		  public void error(final SAXParseException saxException) throws SAXException {
		    if (mode == Configuration.Mode.STRICT) {
		      throw new SAXExceptionWrapper(filePath, saxException);
		    } else {
		      logger.error(new SAXExceptionWrapper(filePath, saxException).getMessage(), saxException);
		    }
		  }

with:

		  public void error(final SAXParseException saxException) throws SAXException {
			  SAXExceptionWrapper ex =  new SAXExceptionWrapper(filePath, saxException);
		    if (mode == Configuration.Mode.STRICT) {
		      throw ex;
		    } else {
		      logger.error(ex.getMessage(), saxException);
		    }
		  }

Changed files:
src/main/java/org/dita/dost/exception/DITAOTXMLErrorHandler.java

diff --git a/src/main/java/org/dita/dost/exception/DITAOTXMLErrorHandler.java b/src/main/java/org/dita/dost/exception/DITAOTXMLErrorHandler.java
index 09bc39c7b..e913b2d30 100644
--- a/src/main/java/org/dita/dost/exception/DITAOTXMLErrorHandler.java
+++ b/src/main/java/org/dita/dost/exception/DITAOTXMLErrorHandler.java
@@ -45,10 +45,11 @@ public final class DITAOTXMLErrorHandler implements ErrorHandler {
    */
   @Override
   public void error(final SAXParseException saxException) throws SAXException {
+    final SAXExceptionWrapper ex = new SAXExceptionWrapper(filePath, saxException);
     if (mode == Configuration.Mode.STRICT) {
-      throw new SAXExceptionWrapper(filePath, saxException);
+      throw ex;
     } else {
-      logger.error(saxException.getMessage(), saxException);
+      logger.error(ex.getMessage(), ex);
     }
   }
Repository: cloudnetservice/cloudnet-v3
Issue: Wrapper log on startup doesn't contain line breaks

**Describe the bug**<br>
If you use "System.out.println" more than once in the Wrapper before the application (e. g. spigot) is running, all lines are printed in one line, only if you add the line seperator to the end of the string, all lines are printed seperately.


**Steps for reproducing**<br>
1. print some lines on wrapper startup (in a module in the wrapper on the STARTED or LOADED state or directly in the wrapper)
2. see the log using the screen command or in temp/services/SERVICE/.wrapper/logs/ (or for static services in local/services)

**Expected behavior**<br>
The printed lines using "System.out.println" should all be printed seperately without the line seperator at the end of the string

**Please provide us information about your environment and used assets**
System specs: CPU = Intel i7 6700k, RAM = 16 GB DDR4 2400 MHz
OS: Windows 10
Version: Current dev version


Changed files:
cloudnet/src/main/java/de/dytanic/cloudnet/console/JLine2Console.java

diff --git a/cloudnet/src/main/java/de/dytanic/cloudnet/console/JLine2Console.java b/cloudnet/src/main/java/de/dytanic/cloudnet/console/JLine2Console.java
index e6391d49f..b4888cfb8 100644
--- a/cloudnet/src/main/java/de/dytanic/cloudnet/console/JLine2Console.java
+++ b/cloudnet/src/main/java/de/dytanic/cloudnet/console/JLine2Console.java
@@ -1,6 +1,7 @@
 package de.dytanic.cloudnet.console;
 
 import jline.console.ConsoleReader;
+import org.fusesource.jansi.Ansi;
 import org.fusesource.jansi.AnsiConsole;
 
 public final class JLine2Console implements IConsole {
@@ -51,7 +52,7 @@ public final class JLine2Console implements IConsole {
         text = ConsoleColor.toColouredString('&', text);
 
         try {
-            this.consoleReader.print(ConsoleReader.RESET_LINE + text + ConsoleColor.DEFAULT);
+            this.consoleReader.print(Ansi.ansi().eraseLine(Ansi.Erase.ALL).toString() + ConsoleReader.RESET_LINE + text + ConsoleColor.DEFAULT);
             this.consoleReader.flush();
         } catch (Exception ex) {
             ex.printStackTrace();
@@ -73,7 +74,7 @@ public final class JLine2Console implements IConsole {
         }
 
         try {
-            this.consoleReader.print(ConsoleReader.RESET_LINE + text + ConsoleColor.DEFAULT);
+            this.consoleReader.print(Ansi.ansi().eraseLine(Ansi.Erase.ALL).toString() + ConsoleReader.RESET_LINE + text + ConsoleColor.DEFAULT);
             this.consoleReader.drawLine();
             this.consoleReader.flush();
         } catch (Exception exception) {
@@ -126,4 +127,4 @@ public final class JLine2Console implements IConsole {
     public void setScreenName(String screenName) {
         this.screenName = screenName;
     }
-}
\\ No newline at end of file
+}