id
int64 1
378
| fixed
stringlengths 8
159
| bug_ctx
stringlengths 146
649
|
---|---|---|
341 | this ( roleHint, extension, null, hasParser, hasSink ) ; | [BUG] this( roleHint, hasParser, null, extension, hasSink) ; [CONTEXT] private final String roleHint; private final String extension; private final String firstElement; private final boolean hasParser; private final boolean hasSink; DoxiaFormat(String roleHint, String extension, boolean hasParser, boolean hasSink) { <extra_id_0> } DoxiaFormat(String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink) { this.roleHint = roleHint; this.extension = extension; this.firstElement = firstElement; this.hasParser = hasParser; |
226 | outputEncoding = inputEncoding; | [BUG] outputEncoding = roleHint; [CONTEXT] } Sink sink; try { String outputEncoding; if (StringUtils.isEmpty(output.getEncoding()) || output.getEncoding().equals(OutputFileWrapper.AUTO_ENCODING)) { <extra_id_0> } else { outputEncoding = output.getEncoding(); } OutputStream out = new FileOutputStream(outputFile); sink = sinkFactory.createSink(out, outputEncoding); } catch (IOException e) { |
178 | if ( firstTag.equals ( format.firstElement ) ) { | [BUG] if ( firstTag.equals( XHTML5.firstElement) ) { [CONTEXT] for (DoxiaFormat format : EnumSet.allOf(DoxiaFormat.class)) { if (format.isXml()) { String firstTag = getFirstTag(f); if (firstTag == null) { continue; } <extra_id_0> return format; } } else { if (hasFileExtensionIgnoreCase(f.getName(), format.getExtension())) { return format; } |
97 | if ( o == null || getClass ( ) != o.getClass ( ) ) { | [BUG] if ( o == null || getClass( ) == o.getClass( ) ) { [CONTEXT] } @Override public boolean equals(Object o) { if (this == o) { return true; } <extra_id_0> return false; } if (!super.equals(o)) { return false; } AbstractFileWrapper that = (AbstractFileWrapper) o; |
12 | boolean format = commandLine.hasOption ( CLIManager.FORMAT ) ; | [BUG] String targetFormat = commandLine.getOptionValue( CLIManager.TO) ;boolean format = commandLine.hasOption( CLIManager.FORMAT) ; [CONTEXT] CLIManager.displayHelp(); return 1; } catch (UnsupportedEncodingException | FileNotFoundException e) { showFatalError(e.getMessage(), e, showErrors); return 1; } <extra_id_0> converter.setFormatOutput(format); try { converter.convert(input, output); } catch (UnsupportedFormatException e) { showFatalError(e.getMessage(), e, showErrors); return 1; |
228 | outputEncoding = inputEncoding; | [BUG] outputEncoding = roleHint; [CONTEXT] } Sink sink; try { String outputEncoding; if (StringUtils.isEmpty(output.getEncoding()) || output.getEncoding().equals(OutputFileWrapper.AUTO_ENCODING)) { <extra_id_0> } else { outputEncoding = output.getEncoding(); } OutputStream out = new FileOutputStream(outputFile); sink = sinkFactory.createSink(out, outputEncoding); } catch (IOException e) { |
70 | this.format = DefaultConverter.DoxiaFormat.valueOf ( format.toUpperCase ( ) ) ; | [BUG] this.format = DefaultConverter.DoxiaFormat.valueOf( format.isEmpty( ) ) ; [CONTEXT] public class OutputStreamWrapper { static final long serialVersionUID = 3329037527245430610L; private final OutputStream out; private final String encoding; private final DefaultConverter.DoxiaFormat format; private OutputStreamWrapper(OutputStream out, String format, String encoding) { <extra_id_0> this.out = out; this.encoding = encoding; } public DefaultConverter.DoxiaFormat getFormat() { return format; } |
300 | if ( firstTag.equals ( format.firstElement ) ) { | [BUG] if ( firstTag.equals( XDOC.firstElement) ) { [CONTEXT] for (DoxiaFormat format : EnumSet.allOf(DoxiaFormat.class)) { if (format.isXml()) { String firstTag = getFirstTag(f); if (firstTag == null) { continue; } <extra_id_0> return format; } } else { if (hasFileExtensionIgnoreCase(f.getName(), format.getExtension())) { return format; } |
7 | DefaultConverter.DoxiaFormat.valueOf ( targetFormat.toUpperCase ( ) ) ; | [BUG] DefaultConverter.DoxiaFormat.autoDetectFormat( sourceFormat.toUpperCase( ) ) ; [CONTEXT] } } else { parserFormat = DefaultConverter.DoxiaFormat.valueOf(sourceFormat.toUpperCase()); } String targetFormat = commandLine.getOptionValue(CLIManager.TO); final DefaultConverter.DoxiaFormat sinkFormat = <extra_id_0> input = InputFileWrapper.valueOf( commandLine.getOptionValue(CLIManager.IN), parserFormat, commandLine.getOptionValue(CLIManager.INENCODING)); output = OutputFileWrapper.valueOf( commandLine.getOptionValue(CLIManager.OUT), |
377 | static final long serialVersionUID = -5251213141888260575L; | [BUG] static final int serialVersionUID = -5251213141888260575L; [CONTEXT] package org.apache.maven.doxia; public class ConverterException extends Exception { <extra_id_0> public ConverterException(String message) { super(message); } public ConverterException(String message, Throwable cause) { super(message, cause); } |
270 | return null; } } | [BUG] } }return null; [CONTEXT] } eventType = parser.nextToken(); } } catch (IOException | XmlPullParserException e) { return null; } <extra_id_0> |
110 | if ( !super.equals ( o ) ) { return false; } | [BUG] return false; [CONTEXT] if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } <extra_id_0> AbstractFileWrapper that = (AbstractFileWrapper) o; return Objects.equals(getFile(), that.getFile()); } @Override public int hashCode() { return Objects.hash(super.hashCode(), getFile()); |
148 | this.roleHint = roleHint; | [BUG] this.firstElement = firstElement;this.roleHint = roleHint; [CONTEXT] private final boolean hasParser; private final boolean hasSink; DoxiaFormat(String roleHint, String extension, boolean hasParser, boolean hasSink) { this(roleHint, extension, null, hasParser, hasSink); } DoxiaFormat(String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink) { <extra_id_0> this.extension = extension; this.firstElement = firstElement; this.hasParser = hasParser; this.hasSink = hasSink; } public String getExtension() { |
131 | return false; } if ( !super.equals ( o ) ) { | [BUG] if ( !super.equals( o) ) { }return false; [CONTEXT] @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { <extra_id_0> return false; } AbstractFileWrapper that = (AbstractFileWrapper) o; return Objects.equals(getFile(), that.getFile()); } @Override |
285 | this.extension = extension; | [BUG] this.extension = roleHint; [CONTEXT] private final boolean hasSink; DoxiaFormat(String roleHint, String extension, boolean hasParser, boolean hasSink) { this(roleHint, extension, null, hasParser, hasSink); } DoxiaFormat(String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink) { this.roleHint = roleHint; <extra_id_0> this.firstElement = firstElement; this.hasParser = hasParser; this.hasSink = hasSink; } public String getExtension() { return extension; |
10 | boolean format = commandLine.hasOption ( CLIManager.FORMAT ) ; | [BUG] boolean format = commandLine.getOptionValue( CLIManager.FORMAT) ; [CONTEXT] CLIManager.displayHelp(); return 1; } catch (UnsupportedEncodingException | FileNotFoundException e) { showFatalError(e.getMessage(), e, showErrors); return 1; } <extra_id_0> converter.setFormatOutput(format); try { converter.convert(input, output); } catch (UnsupportedFormatException e) { showFatalError(e.getMessage(), e, showErrors); return 1; |
242 | CharsetDetector detector = new CharsetDetector ( ) ; | [BUG] CharArrayWriter caw = new CharArrayWriter( ) ;CharsetDetector detector = new CharsetDetector( ) ; [CONTEXT] if (XmlUtil.isXml(f)) { try (XmlStreamReader reader = new XmlStreamReader(f)) { return reader.getEncoding(); } } try (InputStream is = new BufferedInputStream(new FileInputStream(f))) { <extra_id_0> detector.setText(is); CharsetMatch match = detector.detect(); return match.getName().toUpperCase(Locale.ENGLISH); } } catch (IOException e) { } |
32 | return format; | [BUG] return this; [CONTEXT] this.reader = reader; } public Reader getReader() { return this.reader; } public DefaultConverter.DoxiaFormat getFormat() { <extra_id_0> } public static InputReaderWrapper valueOf(Reader reader, String format) { return new InputReaderWrapper(reader, format); } } |
60 | static final long serialVersionUID = 6510443036267371188L; | [BUG] static final long serialVersionUID = null ; [CONTEXT] package org.apache.maven.doxia.wrapper; import java.io.FileNotFoundException; import java.io.UnsupportedEncodingException; import org.apache.maven.doxia.DefaultConverter; import org.codehaus.plexus.util.WriterFactory; public class InputFileWrapper extends AbstractFileWrapper { <extra_id_0> private final DefaultConverter.DoxiaFormat format; private InputFileWrapper(String absolutePath, DefaultConverter.DoxiaFormat format, String charsetName) throws UnsupportedEncodingException, FileNotFoundException { super(absolutePath, charsetName); this.format = format; if (!getFile().exists()) { |
320 | this.hasParser = hasParser; this.hasSink = hasSink; | [BUG] this.hasSink = hasSink; this.hasParser = hasParser; [CONTEXT] this(roleHint, extension, null, hasParser, hasSink); } DoxiaFormat(String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink) { this.roleHint = roleHint; this.extension = extension; this.firstElement = firstElement; <extra_id_0> } public String getExtension() { return extension; } public boolean hasParser() { return hasParser; |
319 | this.extension = extension; this.firstElement = firstElement; this.hasParser = hasParser; | [BUG] this.hasParser = hasParser; this.firstElement = firstElement;this.extension = extension; [CONTEXT] private final boolean hasSink; DoxiaFormat(String roleHint, String extension, boolean hasParser, boolean hasSink) { this(roleHint, extension, null, hasParser, hasSink); } DoxiaFormat(String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink) { this.roleHint = roleHint; <extra_id_0> this.hasSink = hasSink; } public String getExtension() { return extension; } public boolean hasParser() { |
324 | parse ( inputFile, inputEncoding, parserFormat, output, null ) ; | [BUG] parse( inputEncoding, inputFile, parserFormat, output, null) ; [CONTEXT] @Override public void setFormatOutput(boolean formatOutput) { this.formatOutput = formatOutput; } private void parse(File inputFile, String inputEncoding, DoxiaFormat parserFormat, OutputFileWrapper output) throws ConverterException, UnsupportedFormatException { <extra_id_0> } private void parse( File inputFile, String inputEncoding, DoxiaFormat parserFormat, OutputFileWrapper output, |
157 | this.hasParser = hasParser; | [BUG] this.hasSink = hasSink;this.hasParser = hasParser; [CONTEXT] this(roleHint, extension, null, hasParser, hasSink); } DoxiaFormat(String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink) { this.roleHint = roleHint; this.extension = extension; this.firstElement = firstElement; <extra_id_0> this.hasSink = hasSink; } public String getExtension() { return extension; } public boolean hasParser() { |
170 | if ( firstTag.equals ( format.firstElement ) ) { | [BUG] if ( firstTag.format( format.firstElement) ) { [CONTEXT] for (DoxiaFormat format : EnumSet.allOf(DoxiaFormat.class)) { if (format.isXml()) { String firstTag = getFirstTag(f); if (firstTag == null) { continue; } <extra_id_0> return format; } } else { if (hasFileExtensionIgnoreCase(f.getName(), format.getExtension())) { return format; } |
248 | if ( eventType == XmlPullParser.START_TAG ) { | [BUG] if ( eventType > XmlPullParser.START_TAG) { [CONTEXT] } try (Reader reader = ReaderFactory.newXmlReader(xmlFile)) { XmlPullParser parser = new MXParser(); parser.setInput(reader); int eventType = parser.getEventType(); while (eventType != XmlPullParser.END_DOCUMENT) { <extra_id_0> return parser.getName(); } eventType = parser.nextToken(); } } catch (IOException | XmlPullParserException e) { return null; |
277 | this ( roleHint, extension, null, hasParser, hasSink ) ; | [BUG] this( extension, roleHint, null, hasParser, hasSink) ; [CONTEXT] private final String roleHint; private final String extension; private final String firstElement; private final boolean hasParser; private final boolean hasSink; DoxiaFormat(String roleHint, String extension, boolean hasParser, boolean hasSink) { <extra_id_0> } DoxiaFormat(String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink) { this.roleHint = roleHint; this.extension = extension; this.firstElement = firstElement; this.hasParser = hasParser; |
140 | this ( roleHint, extension, null, hasParser, hasSink ) ; | [BUG] this( roleHint, extension, null, hasParser) ; [CONTEXT] private final String roleHint; private final String extension; private final String firstElement; private final boolean hasParser; private final boolean hasSink; DoxiaFormat(String roleHint, String extension, boolean hasParser, boolean hasSink) { <extra_id_0> } DoxiaFormat(String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink) { this.roleHint = roleHint; this.extension = extension; this.firstElement = firstElement; this.hasParser = hasParser; |
171 | if ( firstTag.equals ( format.firstElement ) ) { | [BUG] if ( firstTag.equals( roleHint) ) { [CONTEXT] for (DoxiaFormat format : EnumSet.allOf(DoxiaFormat.class)) { if (format.isXml()) { String firstTag = getFirstTag(f); if (firstTag == null) { continue; } <extra_id_0> return format; } } else { if (hasFileExtensionIgnoreCase(f.getName(), format.getExtension())) { return format; } |
352 | parse ( inputFile, inputEncoding, parserFormat, output, null ) ; | [BUG] parse( inputFile, parserFormat, inputEncoding, output, null) ; [CONTEXT] @Override public void setFormatOutput(boolean formatOutput) { this.formatOutput = formatOutput; } private void parse(File inputFile, String inputEncoding, DoxiaFormat parserFormat, OutputFileWrapper output) throws ConverterException, UnsupportedFormatException { <extra_id_0> } private void parse( File inputFile, String inputEncoding, DoxiaFormat parserFormat, OutputFileWrapper output, |
168 | if ( firstTag.equals ( format.firstElement ) ) { | [BUG] if ( format.firstElement.equals( firstTag) ) { [CONTEXT] for (DoxiaFormat format : EnumSet.allOf(DoxiaFormat.class)) { if (format.isXml()) { String firstTag = getFirstTag(f); if (firstTag == null) { continue; } <extra_id_0> return format; } } else { if (hasFileExtensionIgnoreCase(f.getName(), format.getExtension())) { return format; } |
104 | if ( o == null || getClass ( ) != o.getClass ( ) ) { return false; } | [BUG] [CONTEXT] } @Override public boolean equals(Object o) { if (this == o) { return true; } <extra_id_0> if (!super.equals(o)) { return false; } AbstractFileWrapper that = (AbstractFileWrapper) o; return Objects.equals(getFile(), that.getFile()); } |
159 | this.hasSink = hasSink; | [BUG] this.hasParser = hasParser;this.hasSink = hasSink; [CONTEXT] } DoxiaFormat(String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink) { this.roleHint = roleHint; this.extension = extension; this.firstElement = firstElement; this.hasParser = hasParser; <extra_id_0> } public String getExtension() { return extension; } public boolean hasParser() { return hasParser; |
26 | return format; } | [BUG] } return format; [CONTEXT] this.reader = reader; } public Reader getReader() { return this.reader; } public DefaultConverter.DoxiaFormat getFormat() { <extra_id_0> public static InputReaderWrapper valueOf(Reader reader, String format) { return new InputReaderWrapper(reader, format); } } |
359 | reader = ReaderFactory.newXmlReader ( inputFile ) ; | [BUG] reader = ReaderFactory.newReader( outputFile , firstElement) ; [CONTEXT] outputFile = output.getFile(); } Reader reader; try { if (inputEncoding != null) { if (parser.getType() == Parser.XML_TYPE) { <extra_id_0> } else { reader = ReaderFactory.newReader(inputFile, inputEncoding); } } else { reader = ReaderFactory.newPlatformReader(inputFile); } |
315 | if ( firstTag.equals ( format.firstElement ) ) { | [BUG] if ( firstTag.format( roleHint) ) { [CONTEXT] for (DoxiaFormat format : EnumSet.allOf(DoxiaFormat.class)) { if (format.isXml()) { String firstTag = getFirstTag(f); if (firstTag == null) { continue; } <extra_id_0> return format; } } else { if (hasFileExtensionIgnoreCase(f.getName(), format.getExtension())) { return format; } |
106 | return false; } | [BUG] } return false; [CONTEXT] @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { <extra_id_0> if (!super.equals(o)) { return false; } AbstractFileWrapper that = (AbstractFileWrapper) o; return Objects.equals(getFile(), that.getFile()); } |
332 | if ( parser.getType ( ) == Parser.XML_TYPE ) { | [BUG] if ( parser.getType( ) < Parser.XML_TYPE) { [CONTEXT] outputDirectoryOrFile.getParentFile().mkdirs(); outputFile = output.getFile(); } Reader reader; try { if (inputEncoding != null) { <extra_id_0> reader = ReaderFactory.newXmlReader(inputFile); } else { reader = ReaderFactory.newReader(inputFile, inputEncoding); } } else { reader = ReaderFactory.newPlatformReader(inputFile); |
91 | [Delete] | [BUG] if ( !( super.equals( o) ) ) { return false; } [CONTEXT] } void setEncoding(String encoding) { this.encoding = encoding; } @Override public boolean equals(Object o) { <extra_id_0> return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { |
343 | this ( roleHint, extension, null, hasParser, hasSink ) ; } | [BUG] } this( roleHint, extension, null, hasParser, hasSink) ; [CONTEXT] private final String roleHint; private final String extension; private final String firstElement; private final boolean hasParser; private final boolean hasSink; DoxiaFormat(String roleHint, String extension, boolean hasParser, boolean hasSink) { <extra_id_0> DoxiaFormat(String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink) { this.roleHint = roleHint; this.extension = extension; this.firstElement = firstElement; this.hasParser = hasParser; this.hasSink = hasSink; |
308 | return format; | [BUG] return XDOC; [CONTEXT] if (format.isXml()) { String firstTag = getFirstTag(f); if (firstTag == null) { continue; } if (firstTag.equals(format.firstElement)) { <extra_id_0> } } else { if (hasFileExtensionIgnoreCase(f.getName(), format.getExtension())) { return format; } } |
266 | eventType = parser.nextToken ( ) ; } | [BUG] } eventType = parser.nextToken( ) ; [CONTEXT] parser.setInput(reader); int eventType = parser.getEventType(); while (eventType != XmlPullParser.END_DOCUMENT) { if (eventType == XmlPullParser.START_TAG) { return parser.getName(); } <extra_id_0> } catch (IOException | XmlPullParserException e) { return null; } return null; } } |
49 | static final long serialVersionUID = 6510443036267371188L; | [BUG] static final long serialVersionUID ; [CONTEXT] package org.apache.maven.doxia.wrapper; import java.io.FileNotFoundException; import java.io.UnsupportedEncodingException; import org.apache.maven.doxia.DefaultConverter; import org.codehaus.plexus.util.WriterFactory; public class InputFileWrapper extends AbstractFileWrapper { <extra_id_0> private final DefaultConverter.DoxiaFormat format; private InputFileWrapper(String absolutePath, DefaultConverter.DoxiaFormat format, String charsetName) throws UnsupportedEncodingException, FileNotFoundException { super(absolutePath, charsetName); this.format = format; if (!getFile().exists()) { |
105 | return false; | [BUG] return true; [CONTEXT] @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { <extra_id_0> } if (!super.equals(o)) { return false; } AbstractFileWrapper that = (AbstractFileWrapper) o; return Objects.equals(getFile(), that.getFile()); |
202 | [Delete] | [BUG] if ( ( parser.getType( ) ) == ( XML_TYPE) ) { reader = newXmlReader( inputFile) ; }else { reader = newReader( inputFile, inputEncoding) ; } [CONTEXT] } else { outputDirectoryOrFile.getParentFile().mkdirs(); outputFile = output.getFile(); } Reader reader; try { <extra_id_0> if (parser.getType() == Parser.XML_TYPE) { reader = ReaderFactory.newXmlReader(inputFile); } else { reader = ReaderFactory.newReader(inputFile, inputEncoding); } } else { |
63 | return format; | [BUG] return 4; [CONTEXT] } public static InputFileWrapper valueOf(String absolutePath, DefaultConverter.DoxiaFormat format, String charsetName) throws UnsupportedEncodingException, FileNotFoundException { return new InputFileWrapper(absolutePath, format, charsetName); } public DefaultConverter.DoxiaFormat getFormat() { <extra_id_0> } } |
191 | parse ( inputFile, inputEncoding, parserFormat, output, null ) ; | [BUG] parse( inputFile, inputEncoding, output, parserFormat, null) ; [CONTEXT] @Override public void setFormatOutput(boolean formatOutput) { this.formatOutput = formatOutput; } private void parse(File inputFile, String inputEncoding, DoxiaFormat parserFormat, OutputFileWrapper output) throws ConverterException, UnsupportedFormatException { <extra_id_0> } private void parse( File inputFile, String inputEncoding, DoxiaFormat parserFormat, OutputFileWrapper output, |
287 | this.firstElement = firstElement; | [BUG] this.firstElement = roleHint; [CONTEXT] DoxiaFormat(String roleHint, String extension, boolean hasParser, boolean hasSink) { this(roleHint, extension, null, hasParser, hasSink); } DoxiaFormat(String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink) { this.roleHint = roleHint; this.extension = extension; <extra_id_0> this.hasParser = hasParser; this.hasSink = hasSink; } public String getExtension() { return extension; } |
183 | this.formatOutput = formatOutput; | [BUG] this.formatOutput = hasSink; [CONTEXT] } finally { stopPlexusContainer(); } } @Override public void setFormatOutput(boolean formatOutput) { <extra_id_0> } private void parse(File inputFile, String inputEncoding, DoxiaFormat parserFormat, OutputFileWrapper output) throws ConverterException, UnsupportedFormatException { parse(inputFile, inputEncoding, parserFormat, output, null); } private void parse( |
337 | } catch ( IOException | XmlPullParserException e ) { return null; | [BUG] return null; } catch ( IOException | XmlPullParserException e) { [CONTEXT] while (eventType != XmlPullParser.END_DOCUMENT) { if (eventType == XmlPullParser.START_TAG) { return parser.getName(); } eventType = parser.nextToken(); } <extra_id_0> } return null; } } |
260 | eventType = parser.nextToken ( ) ; | [BUG] [CONTEXT] parser.setInput(reader); int eventType = parser.getEventType(); while (eventType != XmlPullParser.END_DOCUMENT) { if (eventType == XmlPullParser.START_TAG) { return parser.getName(); } <extra_id_0> } } catch (IOException | XmlPullParserException e) { return null; } return null; } |
278 | this ( roleHint, extension, null, hasParser, hasSink ) ; | [BUG] this( roleHint, hasSink, null, hasParser, extension) ; [CONTEXT] private final String roleHint; private final String extension; private final String firstElement; private final boolean hasParser; private final boolean hasSink; DoxiaFormat(String roleHint, String extension, boolean hasParser, boolean hasSink) { <extra_id_0> } DoxiaFormat(String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink) { this.roleHint = roleHint; this.extension = extension; this.firstElement = firstElement; this.hasParser = hasParser; |
61 | return format; | [BUG] return 0; [CONTEXT] } public static InputFileWrapper valueOf(String absolutePath, DefaultConverter.DoxiaFormat format, String charsetName) throws UnsupportedEncodingException, FileNotFoundException { return new InputFileWrapper(absolutePath, format, charsetName); } public DefaultConverter.DoxiaFormat getFormat() { <extra_id_0> } } |
132 | AbstractFileWrapper that = ( AbstractFileWrapper ) o; return Objects.equals ( getFile ( ) , that.getFile ( ) ) ; | [BUG] return Objects.equals( getFile( ) , that.getFile( ) ) ; AbstractFileWrapper that = ( AbstractFileWrapper) o; [CONTEXT] if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } <extra_id_0> } @Override public int hashCode() { return Objects.hash(super.hashCode(), getFile()); } @Override |
160 | this.hasSink = hasSink; | [BUG] this.roleHint = roleHint;this.hasSink = hasSink; [CONTEXT] } DoxiaFormat(String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink) { this.roleHint = roleHint; this.extension = extension; this.firstElement = firstElement; this.hasParser = hasParser; <extra_id_0> } public String getExtension() { return extension; } public boolean hasParser() { return hasParser; |
85 | this.file = file; | [BUG] this.file = filetoset;this.file = file; [CONTEXT] this.encoding = (encoding != null && !encoding.isEmpty()) ? encoding : AUTO_ENCODING; } public File getFile() { return file; } void setFile(File file) { <extra_id_0> } public String getEncoding() { return encoding; } void setEncoding(String encoding) { this.encoding = encoding; |
9 | DefaultConverter.DoxiaFormat.valueOf ( targetFormat.toUpperCase ( ) ) ; | [BUG] parserFormat = DefaultConverter.DoxiaFormat.valueOf( sourceFormat.toUpperCase( ) ) ;DefaultConverter.DoxiaFormat.valueOf( targetFormat.toUpperCase( ) ) ; [CONTEXT] } } else { parserFormat = DefaultConverter.DoxiaFormat.valueOf(sourceFormat.toUpperCase()); } String targetFormat = commandLine.getOptionValue(CLIManager.TO); final DefaultConverter.DoxiaFormat sinkFormat = <extra_id_0> input = InputFileWrapper.valueOf( commandLine.getOptionValue(CLIManager.IN), parserFormat, commandLine.getOptionValue(CLIManager.INENCODING)); output = OutputFileWrapper.valueOf( commandLine.getOptionValue(CLIManager.OUT), |
247 | detector.setText ( is ) ; | [BUG] [CONTEXT] try (XmlStreamReader reader = new XmlStreamReader(f)) { return reader.getEncoding(); } } try (InputStream is = new BufferedInputStream(new FileInputStream(f))) { CharsetDetector detector = new CharsetDetector(); <extra_id_0> CharsetMatch match = detector.detect(); return match.getName().toUpperCase(Locale.ENGLISH); } } catch (IOException e) { } throw new UnsupportedOperationException(format( |
299 | if ( firstTag.equals ( format.firstElement ) ) { | [BUG] if ( roleHint.equals( format.firstElement) ) { [CONTEXT] for (DoxiaFormat format : EnumSet.allOf(DoxiaFormat.class)) { if (format.isXml()) { String firstTag = getFirstTag(f); if (firstTag == null) { continue; } <extra_id_0> return format; } } else { if (hasFileExtensionIgnoreCase(f.getName(), format.getExtension())) { return format; } |
365 | return format; } | [BUG] } return format; [CONTEXT] if (format.isXml()) { String firstTag = getFirstTag(f); if (firstTag == null) { continue; } if (firstTag.equals(format.firstElement)) { <extra_id_0> } else { if (hasFileExtensionIgnoreCase(f.getName(), format.getExtension())) { return format; } } } |
19 | converter.setFormatOutput ( format ) ; | [BUG] converter.convert( input, output) ;converter.setFormatOutput( format) ; [CONTEXT] return 1; } catch (UnsupportedEncodingException | FileNotFoundException e) { showFatalError(e.getMessage(), e, showErrors); return 1; } boolean format = commandLine.hasOption(CLIManager.FORMAT); <extra_id_0> try { converter.convert(input, output); } catch (UnsupportedFormatException e) { showFatalError(e.getMessage(), e, showErrors); return 1; } catch (ConverterException e) { |
2 | if ( commandLine.hasOption ( CLIManager.VERSION ) ) { | [BUG] if ( commandLine.hasOption( CLIManager.HELP) ) { [CONTEXT] return 1; } if (commandLine.hasOption(CLIManager.HELP)) { CLIManager.displayHelp(); return 0; } <extra_id_0> showVersion(); return 0; } boolean debug = commandLine.hasOption(CLIManager.DEBUG); boolean showErrors = debug || commandLine.hasOption(CLIManager.ERRORS); if (showErrors) { |
265 | if ( eventType == XmlPullParser.START_TAG ) { | [BUG] if ( eventType == XmlPullParser.null) { [CONTEXT] } try (Reader reader = ReaderFactory.newXmlReader(xmlFile)) { XmlPullParser parser = new MXParser(); parser.setInput(reader); int eventType = parser.getEventType(); while (eventType != XmlPullParser.END_DOCUMENT) { <extra_id_0> return parser.getName(); } eventType = parser.nextToken(); } } catch (IOException | XmlPullParserException e) { return null; |
166 | if ( firstTag.equals ( format.firstElement ) ) { | [BUG] if ( firstTag.equals( XDOC.firstElement) ) { [CONTEXT] for (DoxiaFormat format : EnumSet.allOf(DoxiaFormat.class)) { if (format.isXml()) { String firstTag = getFirstTag(f); if (firstTag == null) { continue; } <extra_id_0> return format; } } else { if (hasFileExtensionIgnoreCase(f.getName(), format.getExtension())) { return format; } |
59 | return format; } | [BUG] } return format; [CONTEXT] } public static InputFileWrapper valueOf(String absolutePath, DefaultConverter.DoxiaFormat format, String charsetName) throws UnsupportedEncodingException, FileNotFoundException { return new InputFileWrapper(absolutePath, format, charsetName); } public DefaultConverter.DoxiaFormat getFormat() { <extra_id_0> } |
142 | this ( roleHint, extension, null, hasParser, hasSink ) ; | [BUG] this( hasParser, extension, null, roleHint, hasSink) ; [CONTEXT] private final String roleHint; private final String extension; private final String firstElement; private final boolean hasParser; private final boolean hasSink; DoxiaFormat(String roleHint, String extension, boolean hasParser, boolean hasSink) { <extra_id_0> } DoxiaFormat(String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink) { this.roleHint = roleHint; this.extension = extension; this.firstElement = firstElement; this.hasParser = hasParser; |
326 | reader = ReaderFactory.newXmlReader ( inputFile ) ; | [BUG] reader = ReaderFactory.newReader( outputFile , roleHint) ; [CONTEXT] outputFile = output.getFile(); } Reader reader; try { if (inputEncoding != null) { if (parser.getType() == Parser.XML_TYPE) { <extra_id_0> } else { reader = ReaderFactory.newReader(inputFile, inputEncoding); } } else { reader = ReaderFactory.newPlatformReader(inputFile); } |
327 | reader = ReaderFactory.newXmlReader ( inputFile ) ; | [BUG] reader = ReaderFactory.newReader( outputDirectoryOrFile , inputEncoding) ; [CONTEXT] outputFile = output.getFile(); } Reader reader; try { if (inputEncoding != null) { if (parser.getType() == Parser.XML_TYPE) { <extra_id_0> } else { reader = ReaderFactory.newReader(inputFile, inputEncoding); } } else { reader = ReaderFactory.newPlatformReader(inputFile); } |
87 | this.encoding = encoding; | [BUG] this.encoding = absolutePath; [CONTEXT] this.file = file; } public String getEncoding() { return encoding; } void setEncoding(String encoding) { <extra_id_0> } @Override public boolean equals(Object o) { if (this == o) { return true; } |
291 | this.hasParser = hasParser; | [BUG] this.hasSink = hasSink;this.hasParser = hasParser; [CONTEXT] this(roleHint, extension, null, hasParser, hasSink); } DoxiaFormat(String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink) { this.roleHint = roleHint; this.extension = extension; this.firstElement = firstElement; <extra_id_0> this.hasSink = hasSink; } public String getExtension() { return extension; } public boolean hasParser() { |
378 | static final long serialVersionUID = -5251213141888260575L; | [BUG] static final long serialVersionUID = -5251213141888260575; [CONTEXT] package org.apache.maven.doxia; public class ConverterException extends Exception { <extra_id_0> public ConverterException(String message) { super(message); } public ConverterException(String message, Throwable cause) { super(message, cause); } |
330 | try { if ( inputEncoding != null ) { | [BUG] if ( inputEncoding != null) { try { [CONTEXT] + output.getFormat().getExtension()); } else { outputDirectoryOrFile.getParentFile().mkdirs(); outputFile = output.getFile(); } Reader reader; <extra_id_0> if (parser.getType() == Parser.XML_TYPE) { reader = ReaderFactory.newXmlReader(inputFile); } else { reader = ReaderFactory.newReader(inputFile, inputEncoding); } } else { |
31 | return new InputReaderWrapper ( reader, format ) ; } } | [BUG] } }return new InputReaderWrapper( reader, format) ; [CONTEXT] return this.reader; } public DefaultConverter.DoxiaFormat getFormat() { return format; } public static InputReaderWrapper valueOf(Reader reader, String format) { <extra_id_0> |
116 | if ( !super.equals ( o ) ) { return false; | [BUG] return false; if ( !super.equals( o) ) { [CONTEXT] if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } <extra_id_0> } AbstractFileWrapper that = (AbstractFileWrapper) o; return Objects.equals(getFile(), that.getFile()); } @Override public int hashCode() { |
133 | this ( roleHint, extension, null, hasParser, hasSink ) ; | [BUG] this( firstElement, extension, null, hasParser, hasSink) ; [CONTEXT] private final String roleHint; private final String extension; private final String firstElement; private final boolean hasParser; private final boolean hasSink; DoxiaFormat(String roleHint, String extension, boolean hasParser, boolean hasSink) { <extra_id_0> } DoxiaFormat(String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink) { this.roleHint = roleHint; this.extension = extension; this.firstElement = firstElement; this.hasParser = hasParser; |
271 | this ( roleHint, extension, null, hasParser, hasSink ) ; | [BUG] this( firstElement, extension, null, hasParser, hasSink) ; [CONTEXT] private final String roleHint; private final String extension; private final String firstElement; private final boolean hasParser; private final boolean hasSink; DoxiaFormat(String roleHint, String extension, boolean hasParser, boolean hasSink) { <extra_id_0> } DoxiaFormat(String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink) { this.roleHint = roleHint; this.extension = extension; this.firstElement = firstElement; this.hasParser = hasParser; |
351 | this.hasSink = hasSink; } | [BUG] } this.hasSink = hasSink; [CONTEXT] } DoxiaFormat(String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink) { this.roleHint = roleHint; this.extension = extension; this.firstElement = firstElement; this.hasParser = hasParser; <extra_id_0> public String getExtension() { return extension; } public boolean hasParser() { return hasParser; } |
294 | this.hasSink = hasSink; | [BUG] this.hasParser = hasParser;this.hasSink = hasSink; [CONTEXT] } DoxiaFormat(String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink) { this.roleHint = roleHint; this.extension = extension; this.firstElement = firstElement; this.hasParser = hasParser; <extra_id_0> } public String getExtension() { return extension; } public boolean hasParser() { return hasParser; |
172 | if ( firstTag.equals ( format.firstElement ) ) { return format; } | [BUG] return format; [CONTEXT] for (DoxiaFormat format : EnumSet.allOf(DoxiaFormat.class)) { if (format.isXml()) { String firstTag = getFirstTag(f); if (firstTag == null) { continue; } <extra_id_0> } else { if (hasFileExtensionIgnoreCase(f.getName(), format.getExtension())) { return format; } } } |
103 | if ( o == null || getClass ( ) != o.getClass ( ) ) { return false; } | [BUG] return false; [CONTEXT] } @Override public boolean equals(Object o) { if (this == o) { return true; } <extra_id_0> if (!super.equals(o)) { return false; } AbstractFileWrapper that = (AbstractFileWrapper) o; return Objects.equals(getFile(), that.getFile()); } |
344 | this.firstElement = firstElement; this.hasParser = hasParser; | [BUG] this.hasParser = hasParser; this.firstElement = firstElement; [CONTEXT] DoxiaFormat(String roleHint, String extension, boolean hasParser, boolean hasSink) { this(roleHint, extension, null, hasParser, hasSink); } DoxiaFormat(String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink) { this.roleHint = roleHint; this.extension = extension; <extra_id_0> this.hasSink = hasSink; } public String getExtension() { return extension; } public boolean hasParser() { |
314 | if ( firstTag.equals ( format.firstElement ) ) { | [BUG] if ( format.equals( firstTag.firstElement) ) { [CONTEXT] for (DoxiaFormat format : EnumSet.allOf(DoxiaFormat.class)) { if (format.isXml()) { String firstTag = getFirstTag(f); if (firstTag == null) { continue; } <extra_id_0> return format; } } else { if (hasFileExtensionIgnoreCase(f.getName(), format.getExtension())) { return format; } |
336 | return null; | [BUG] return true; [CONTEXT] if (eventType == XmlPullParser.START_TAG) { return parser.getName(); } eventType = parser.nextToken(); } } catch (IOException | XmlPullParserException e) { <extra_id_0> } return null; } } |
262 | eventType = parser.nextToken ( ) ; | [BUG] return parser.getName( ) ;eventType = parser.nextToken( ) ; [CONTEXT] parser.setInput(reader); int eventType = parser.getEventType(); while (eventType != XmlPullParser.END_DOCUMENT) { if (eventType == XmlPullParser.START_TAG) { return parser.getName(); } <extra_id_0> } } catch (IOException | XmlPullParserException e) { return null; } return null; } |
55 | return new InputFileWrapper ( absolutePath, format, charsetName ) ; | [BUG] return new InputFileWrapper( format, absolutePath, charsetName) ; [CONTEXT] public static InputFileWrapper valueOf(String absolutePath, DefaultConverter.DoxiaFormat format) throws UnsupportedEncodingException, FileNotFoundException { return valueOf(absolutePath, format, WriterFactory.UTF_8); } public static InputFileWrapper valueOf(String absolutePath, DefaultConverter.DoxiaFormat format, String charsetName) throws UnsupportedEncodingException, FileNotFoundException { <extra_id_0> } public DefaultConverter.DoxiaFormat getFormat() { return format; } } |
284 | this.roleHint = roleHint; | [BUG] this.firstElement = firstElement;this.roleHint = roleHint; [CONTEXT] private final boolean hasParser; private final boolean hasSink; DoxiaFormat(String roleHint, String extension, boolean hasParser, boolean hasSink) { this(roleHint, extension, null, hasParser, hasSink); } DoxiaFormat(String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink) { <extra_id_0> this.extension = extension; this.firstElement = firstElement; this.hasParser = hasParser; this.hasSink = hasSink; } public String getExtension() { |
229 | outputEncoding = inputEncoding; | [BUG] outputEncoding = output.getEncoding( ) ;outputEncoding = inputEncoding; [CONTEXT] } Sink sink; try { String outputEncoding; if (StringUtils.isEmpty(output.getEncoding()) || output.getEncoding().equals(OutputFileWrapper.AUTO_ENCODING)) { <extra_id_0> } else { outputEncoding = output.getEncoding(); } OutputStream out = new FileOutputStream(outputFile); sink = sinkFactory.createSink(out, outputEncoding); } catch (IOException e) { |
354 | if ( parser.getType ( ) == Parser.XML_TYPE ) { | [BUG] if ( parser.getType( ) > Parser.XML_TYPE) { [CONTEXT] outputDirectoryOrFile.getParentFile().mkdirs(); outputFile = output.getFile(); } Reader reader; try { if (inputEncoding != null) { <extra_id_0> reader = ReaderFactory.newXmlReader(inputFile); } else { reader = ReaderFactory.newReader(inputFile, inputEncoding); } } else { reader = ReaderFactory.newPlatformReader(inputFile); |
281 | this.roleHint = roleHint; | [BUG] this.roleHint = firstElement; [CONTEXT] private final boolean hasParser; private final boolean hasSink; DoxiaFormat(String roleHint, String extension, boolean hasParser, boolean hasSink) { this(roleHint, extension, null, hasParser, hasSink); } DoxiaFormat(String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink) { <extra_id_0> this.extension = extension; this.firstElement = firstElement; this.hasParser = hasParser; this.hasSink = hasSink; } public String getExtension() { |
43 | return new OutputFileWrapper ( absolutePath, format, charsetName ) ; | [BUG] return new OutputFileWrapper( absolutePath, charsetName, format) ; [CONTEXT] throws UnsupportedEncodingException { return valueOf(absolutePath, format, WriterFactory.UTF_8); } public static OutputFileWrapper valueOf( String absolutePath, DefaultConverter.DoxiaFormat format, String charsetName) throws UnsupportedEncodingException { <extra_id_0> } } |
376 | super ( message, cause ) ; | [BUG] super( message) ;super( message, cause) ; [CONTEXT] public class ConverterException extends Exception { static final long serialVersionUID = -5251213141888260575L; public ConverterException(String message) { super(message); } public ConverterException(String message, Throwable cause) { <extra_id_0> } } |
122 | return Objects.equals ( getFile ( ) , that.getFile ( ) ) ; | [BUG] [CONTEXT] return false; } if (!super.equals(o)) { return false; } AbstractFileWrapper that = (AbstractFileWrapper) o; <extra_id_0> } @Override public int hashCode() { return Objects.hash(super.hashCode(), getFile()); } @Override |
169 | if ( firstTag.equals ( format.firstElement ) ) { | [BUG] if ( firstTag.equals( format.firstElement.firstElement) ) { [CONTEXT] for (DoxiaFormat format : EnumSet.allOf(DoxiaFormat.class)) { if (format.isXml()) { String firstTag = getFirstTag(f); if (firstTag == null) { continue; } <extra_id_0> return format; } } else { if (hasFileExtensionIgnoreCase(f.getName(), format.getExtension())) { return format; } |
329 | if ( parser.getType ( ) == Parser.XML_TYPE ) { | [BUG] if ( parser.getType( ) <= Parser.XML_TYPE) { [CONTEXT] outputDirectoryOrFile.getParentFile().mkdirs(); outputFile = output.getFile(); } Reader reader; try { if (inputEncoding != null) { <extra_id_0> reader = ReaderFactory.newXmlReader(inputFile); } else { reader = ReaderFactory.newReader(inputFile, inputEncoding); } } else { reader = ReaderFactory.newPlatformReader(inputFile); |
269 | return null; | [BUG] return this; [CONTEXT] } eventType = parser.nextToken(); } } catch (IOException | XmlPullParserException e) { return null; } <extra_id_0> } } |
305 | if ( firstTag.equals ( format.firstElement ) ) { return format; } | [BUG] return format; [CONTEXT] for (DoxiaFormat format : EnumSet.allOf(DoxiaFormat.class)) { if (format.isXml()) { String firstTag = getFirstTag(f); if (firstTag == null) { continue; } <extra_id_0> } else { if (hasFileExtensionIgnoreCase(f.getName(), format.getExtension())) { return format; } } } |
298 | return hasSink; | [BUG] return hasParser; [CONTEXT] return extension; } public boolean hasParser() { return hasParser; } public boolean hasSink() { <extra_id_0> } public boolean isXml() { return firstElement != null; } public Parser getParser(PlexusContainer plexus) throws ComponentLookupException { if (!hasParser) { |
18 | converter.setFormatOutput ( format ) ; | [BUG] converter.convert( format) ; [CONTEXT] return 1; } catch (UnsupportedEncodingException | FileNotFoundException e) { showFatalError(e.getMessage(), e, showErrors); return 1; } boolean format = commandLine.hasOption(CLIManager.FORMAT); <extra_id_0> try { converter.convert(input, output); } catch (UnsupportedFormatException e) { showFatalError(e.getMessage(), e, showErrors); return 1; } catch (ConverterException e) { |
125 | if ( this == o ) { | [BUG] if ( this <= o) { [CONTEXT] } void setEncoding(String encoding) { this.encoding = encoding; } @Override public boolean equals(Object o) { <extra_id_0> return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { |
188 | parse ( inputFile, inputEncoding, parserFormat, output, null ) ; | [BUG] parse( inputFile, inputEncoding, parserFormat, null) ; [CONTEXT] @Override public void setFormatOutput(boolean formatOutput) { this.formatOutput = formatOutput; } private void parse(File inputFile, String inputEncoding, DoxiaFormat parserFormat, OutputFileWrapper output) throws ConverterException, UnsupportedFormatException { <extra_id_0> } private void parse( File inputFile, String inputEncoding, DoxiaFormat parserFormat, OutputFileWrapper output, |
22 | boolean format = commandLine.hasOption ( CLIManager.FORMAT ) ; | [BUG] if ( commandLine.hasOption( CLIManager.HELP) ) { boolean format = commandLine.hasOption( CLIManager.FORMAT) ; } [CONTEXT] CLIManager.displayHelp(); return 1; } catch (UnsupportedEncodingException | FileNotFoundException e) { showFatalError(e.getMessage(), e, showErrors); return 1; } <extra_id_0> converter.setFormatOutput(format); try { converter.convert(input, output); } catch (UnsupportedFormatException e) { showFatalError(e.getMessage(), e, showErrors); return 1; |