id
int64 1
378
| fixed
stringlengths 8
159
| bug_ctx
stringlengths 146
649
|
---|---|---|
179 | 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; } |
209 | reader = ReaderFactory.newXmlReader ( inputFile ) ; } else { | [BUG] } else { reader = ReaderFactory.newXmlReader( inputFile) ; [CONTEXT] outputFile = output.getFile(); } Reader reader; try { if (inputEncoding != null) { if (parser.getType() == Parser.XML_TYPE) { <extra_id_0> reader = ReaderFactory.newReader(inputFile, inputEncoding); } } else { reader = ReaderFactory.newPlatformReader(inputFile); } } catch (IOException e) { |
54 | return new InputFileWrapper ( absolutePath, format, charsetName ) ; | [BUG] return new InputFileWrapper( charsetName, format, 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; } } |
35 | return valueOf ( absolutePath, format, WriterFactory.UTF_8 ) ; | [BUG] return valueOf( format, absolutePath, WriterFactory.UTF_8) ; [CONTEXT] } public DefaultConverter.DoxiaFormat getFormat() { return format; } public static OutputFileWrapper valueOf(String absolutePath, DefaultConverter.DoxiaFormat format) throws UnsupportedEncodingException { <extra_id_0> } public static OutputFileWrapper valueOf( String absolutePath, DefaultConverter.DoxiaFormat format, String charsetName) throws UnsupportedEncodingException { return new OutputFileWrapper(absolutePath, format, charsetName); } |
335 | 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; |
67 | this.format = DefaultConverter.DoxiaFormat.valueOf ( format.toUpperCase ( ) ) ; | [BUG] this.format = DefaultConverter.DoxiaFormat.valueOf( out , format , encoding) ; [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; } |
212 | reader = ReaderFactory.newXmlReader ( inputFile ) ; | [BUG] [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); } |
258 | eventType = parser.nextToken ( ) ; | [BUG] eventType = null.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; } |
249 | if ( eventType == XmlPullParser.START_TAG ) { return parser.getName ( ) ; } | [BUG] return parser.getName(); [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> eventType = parser.nextToken(); } } catch (IOException | XmlPullParserException e) { return null; } return null; |
243 | CharsetDetector detector = new CharsetDetector ( ) ; | [BUG] CharsetMatch match = detector.detect( ) ;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) { } |
92 | return true; | [BUG] return false; [CONTEXT] void setEncoding(String encoding) { this.encoding = encoding; } @Override public boolean equals(Object o) { if (this == o) { <extra_id_0> } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; |
356 | reader = ReaderFactory.newXmlReader ( inputFile ) ; | [BUG] reader = ReaderFactory.newReader( inputFile , 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); } |
292 | this.hasSink = hasSink; | [BUG] this.hasSink = hasParser; [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; |
252 | return parser.getName ( ) ; | [BUG] return parser.getPath( ) ; [CONTEXT] try (Reader reader = ReaderFactory.newXmlReader(xmlFile)) { XmlPullParser parser = new MXParser(); parser.setInput(reader); int eventType = parser.getEventType(); while (eventType != XmlPullParser.END_DOCUMENT) { if (eventType == XmlPullParser.START_TAG) { <extra_id_0> } eventType = parser.nextToken(); } } catch (IOException | XmlPullParserException e) { return null; } |
94 | return true; } | [BUG] } return true; [CONTEXT] void setEncoding(String encoding) { this.encoding = encoding; } @Override public boolean equals(Object o) { if (this == o) { <extra_id_0> if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } |
204 | if ( parser.getType ( ) == Parser.XML_TYPE ) { | [BUG] if ( parser.getClass( ) == 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); |
222 | reader = ReaderFactory.newXmlReader ( inputFile ) ; | [BUG] reader = ReaderFactory.newReader( relativeOutputDirectory , 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); } |
342 | this ( roleHint, extension, null, hasParser, hasSink ) ; | [BUG] this( roleHint, extension, null, hasSink, 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; |
95 | 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; |
90 | if ( this == o ) { return true; } | [BUG] [CONTEXT] } void setEncoding(String encoding) { this.encoding = encoding; } @Override public boolean equals(Object o) { <extra_id_0> if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } |
81 | private final DefaultConverter.DoxiaFormat format; | [BUG] private DefaultConverter.DoxiaFormat format; [CONTEXT] import java.util.Objects; import org.apache.maven.doxia.DefaultConverter; public class OutputStreamWrapper { static final long serialVersionUID = 3329037527245430610L; private final OutputStream out; private final String encoding; <extra_id_0> private OutputStreamWrapper(OutputStream out, String format, String encoding) { this.format = DefaultConverter.DoxiaFormat.valueOf(format.toUpperCase()); this.out = out; this.encoding = encoding; } public DefaultConverter.DoxiaFormat getFormat() { |
312 | [Delete] | [BUG] if ( firstTag.equals( format.firstElement) ) { return format; } [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; } |
232 | if ( plexus == null ) { | [BUG] if ( plexus == this) { [CONTEXT] containerConfiguration.setContext(context); containerConfiguration.setAutoWiring(true); containerConfiguration.setClassPathScanning(PlexusConstants.SCANNING_INDEX); plexus = new DefaultPlexusContainer(containerConfiguration); } private void stopPlexusContainer() { <extra_id_0> return; } plexus.dispose(); plexus = null; } static String autoDetectEncoding(File f) { |
340 | this ( roleHint, extension, null, hasParser, hasSink ) ; | [BUG] this( roleHint, extension, null, hasParser, 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; |
114 | return false; } AbstractFileWrapper that = ( AbstractFileWrapper ) o; | [BUG] AbstractFileWrapper that = ( AbstractFileWrapper) o; }return false; [CONTEXT] return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { <extra_id_0> return Objects.equals(getFile(), that.getFile()); } @Override public int hashCode() { return Objects.hash(super.hashCode(), getFile()); } |
355 | reader = ReaderFactory.newXmlReader ( inputFile ) ; | [BUG] reader = ReaderFactory.newReader( outputFile , extension) ; [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); } |
123 | return Objects.equals ( getFile ( ) , that.getFile ( ) ) ; } | [BUG] } return Objects.equals( getFile( ) , that.getFile( ) ) ; [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 public java.lang.String toString() { |
101 | if ( o == null || getClass ( ) != o.getClass ( ) ) { | [BUG] if ( o == null || getClass( ) != o.equals( ) ) { [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; |
349 | this ( roleHint, extension, null, hasParser, hasSink ) ; | [BUG] this( roleHint, extension, null, formatOutput, 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; |
213 | reader = ReaderFactory.newXmlReader ( inputFile ) ; | [BUG] try ( Reader r = ReaderFactory.newXmlReader( outputFile) ;reader = ReaderFactory.newXmlReader( inputFile) ; [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); } |
267 | return null; | [BUG] return this; [CONTEXT] if (eventType == XmlPullParser.START_TAG) { return parser.getName(); } eventType = parser.nextToken(); } } catch (IOException | XmlPullParserException e) { <extra_id_0> } return null; } } |
331 | if ( inputEncoding != null ) { | [BUG] if ( inputEncoding != this) { [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 { |
208 | reader = ReaderFactory.newXmlReader ( inputFile ) ; | [BUG] reader = ReaderFactory.newReader( inputFile , extension) ; [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); } |
210 | reader = ReaderFactory.newXmlReader ( inputFile ) ; | [BUG] reader = ReaderFactory.newPlatformReader( inputFile) ;reader = ReaderFactory.newXmlReader( inputFile) ; [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); } |
218 | if ( inputEncoding != null ) { | [BUG] if ( inputEncoding != true) { [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 { |
268 | } 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; } } |
306 | if ( firstTag.equals ( format.firstElement ) ) { return format; } | [BUG] [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; } } } |
128 | 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() { return Objects.hash(super.hashCode(), getFile()); |
119 | return Objects.equals ( getFile ( ) , that.getFile ( ) ) ; | [BUG] return Objects.equals( getFile( ) , that.setFile( ) ) ; [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 |
86 | return encoding; | [BUG] return absolutePath; [CONTEXT] return file; } void setFile(File file) { this.file = file; } public String getEncoding() { <extra_id_0> } void setEncoding(String encoding) { this.encoding = encoding; } @Override public boolean equals(Object o) { |
73 | this.out = out; | [BUG] this.out = null; [CONTEXT] 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) { this.format = DefaultConverter.DoxiaFormat.valueOf(format.toUpperCase()); <extra_id_0> this.encoding = encoding; } public DefaultConverter.DoxiaFormat getFormat() { return format; } public OutputStream getOutputStream() { |
369 | super ( message ) ; | [BUG] [CONTEXT] package org.apache.maven.doxia; public class ConverterException extends Exception { static final long serialVersionUID = -5251213141888260575L; public ConverterException(String message) { <extra_id_0> } public ConverterException(String message, Throwable cause) { super(message, cause); } } |
134 | this ( roleHint, extension, null, hasParser, hasSink ) ; | [BUG] this( roleHint, 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; |
192 | parse ( inputFile, inputEncoding, parserFormat, output, null ) ; | [BUG] parse( output, inputEncoding, parserFormat, inputFile, 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, |
78 | return format; } | [BUG] } return format; [CONTEXT] private OutputStreamWrapper(OutputStream out, String format, String encoding) { this.format = DefaultConverter.DoxiaFormat.valueOf(format.toUpperCase()); this.out = out; this.encoding = encoding; } public DefaultConverter.DoxiaFormat getFormat() { <extra_id_0> public OutputStream getOutputStream() { return this.out; } public String getEncoding() { return encoding; } |
250 | if ( eventType == XmlPullParser.START_TAG ) { return parser.getName ( ) ; } | [BUG] [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> eventType = parser.nextToken(); } } catch (IOException | XmlPullParserException e) { return null; } return null; |
124 | this.encoding = encoding; } | [BUG] } this.encoding = encoding; [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; } if (o == null || getClass() != o.getClass()) { |
245 | try ( InputStream is = new BufferedInputStream ( new FileInputStream ( f ) ) ) { CharsetDetector detector = new CharsetDetector ( ) ; | [BUG] CharsetDetector detector = new CharsetDetector( ) ; try ( InputStream is = new BufferedInputStream( new FileInputStream( f) ) ) { [CONTEXT] try { if (XmlUtil.isXml(f)) { try (XmlStreamReader reader = new XmlStreamReader(f)) { return reader.getEncoding(); } } <extra_id_0> detector.setText(is); CharsetMatch match = detector.detect(); return match.getName().toUpperCase(Locale.ENGLISH); } } catch (IOException e) { } |
189 | parse ( inputFile, inputEncoding, parserFormat, output, null ) ; | [BUG] parse( parserFormat, inputEncoding, inputFile, 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, |
27 | return new InputReaderWrapper ( reader, format ) ; | [BUG] return new InputReaderWrapper( format) ; [CONTEXT] return this.reader; } public DefaultConverter.DoxiaFormat getFormat() { return format; } public static InputReaderWrapper valueOf(Reader reader, String format) { <extra_id_0> } } |
307 | return format; | [BUG] return XHTML5; [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; } } |
221 | if ( parser.getType ( ) == Parser.XML_TYPE ) { reader = ReaderFactory.newXmlReader ( inputFile ) ; } else { | [BUG] } else { reader = ReaderFactory.newXmlReader( inputFile) ;if ( parser.getType( ) == Parser.XML_TYPE) { [CONTEXT] outputDirectoryOrFile.getParentFile().mkdirs(); outputFile = output.getFile(); } Reader reader; try { if (inputEncoding != null) { <extra_id_0> reader = ReaderFactory.newReader(inputFile, inputEncoding); } } else { reader = ReaderFactory.newPlatformReader(inputFile); } } catch (IOException e) { |
3 | [Delete] | [BUG] if ( commandLine.hasOption( CLIManager.HELP) ) { displayHelp( ) ; return 0; } [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) { |
39 | return new OutputFileWrapper ( absolutePath, format, charsetName ) ; | [BUG] return new OutputFileWrapper( absolutePath, charsetName) ; [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> } } |
263 | 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; |
152 | 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() { |
89 | if ( this == o ) { return true; } | [BUG] return true; [CONTEXT] } void setEncoding(String encoding) { this.encoding = encoding; } @Override public boolean equals(Object o) { <extra_id_0> if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } |
374 | super ( message, cause ) ; } | [BUG] } 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> } |
150 | this.extension = extension; this.firstElement = firstElement; | [BUG] 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.hasParser = hasParser; this.hasSink = hasSink; } public String getExtension() { return extension; } |
174 | 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; } } |
153 | this.firstElement = firstElement; | [BUG] this.roleHint = roleHint;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.hasParser = hasParser; this.hasSink = hasSink; } public String getExtension() { return extension; } |
56 | return new InputFileWrapper ( absolutePath, format, charsetName ) ; | [BUG] return new InputFileWrapper( absolutePath, charsetName, format) ; [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; } } |
44 | return new OutputFileWrapper ( absolutePath, format, charsetName ) ; } } | [BUG] } }return new OutputFileWrapper( absolutePath, format, charsetName) ; [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> |
224 | reader = ReaderFactory.newXmlReader ( inputFile ) ; | [BUG] reader = ReaderFactory.newReader( inputFile , 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); } |
272 | this ( roleHint, extension, null, hasParser, hasSink ) ; | [BUG] this( roleHint, firstElement, 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; |
121 | return Objects.equals ( getFile ( ) , that.getFile ( ) ) ; | [BUG] return Objects.equals( getFile( ) , that.setFile( filetoset) ) ; [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 |
11 | boolean format = commandLine.hasOption ( CLIManager.FORMAT ) ; converter.setFormatOutput ( format ) ; | [BUG] converter.setFormatOutput( format) ; 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> try { converter.convert(input, output); } catch (UnsupportedFormatException e) { showFatalError(e.getMessage(), e, showErrors); return 1; } catch (ConverterException e) { |
66 | private final String encoding; | [BUG] private final char encoding; [CONTEXT] import java.io.OutputStream; import java.util.Objects; import org.apache.maven.doxia.DefaultConverter; public class OutputStreamWrapper { static final long serialVersionUID = 3329037527245430610L; private final OutputStream out; <extra_id_0> private final DefaultConverter.DoxiaFormat format; private OutputStreamWrapper(OutputStream out, String format, String encoding) { this.format = DefaultConverter.DoxiaFormat.valueOf(format.toUpperCase()); this.out = out; this.encoding = encoding; } |
289 | this.hasParser = hasParser; | [BUG] this.hasParser = hasSink; [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() { |
201 | if ( inputEncoding != null ) { | [BUG] if ( plexus != null) { [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 { |
199 | if ( inputEncoding != null ) { | [BUG] if ( parser.getType() == XML_TYPE) { [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 { |
65 | static final long serialVersionUID = 3329037527245430610L; | [BUG] static final long serialVersionUID = 3329037527245430610; [CONTEXT] package org.apache.maven.doxia.wrapper; import java.io.OutputStream; import java.util.Objects; import org.apache.maven.doxia.DefaultConverter; public class OutputStreamWrapper { <extra_id_0> private final OutputStream out; private final String encoding; private final DefaultConverter.DoxiaFormat format; private OutputStreamWrapper(OutputStream out, String format, String encoding) { this.format = DefaultConverter.DoxiaFormat.valueOf(format.toUpperCase()); this.out = out; |
321 | return extension; } | [BUG] } return extension; [CONTEXT] this.extension = extension; this.firstElement = firstElement; this.hasParser = hasParser; this.hasSink = hasSink; } public String getExtension() { <extra_id_0> public boolean hasParser() { return hasParser; } public boolean hasSink() { return hasSink; } |
219 | 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); |
251 | return parser.getName ( ) ; | [BUG] return parser.setInput( ) ; [CONTEXT] try (Reader reader = ReaderFactory.newXmlReader(xmlFile)) { XmlPullParser parser = new MXParser(); parser.setInput(reader); int eventType = parser.getEventType(); while (eventType != XmlPullParser.END_DOCUMENT) { if (eventType == XmlPullParser.START_TAG) { <extra_id_0> } eventType = parser.nextToken(); } } catch (IOException | XmlPullParserException e) { return null; } |
241 | CharsetDetector detector = new CharsetDetector ( ) ; detector.setText ( is ) ; | [BUG] detector.setText( is) ; 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> CharsetMatch match = detector.detect(); return match.getName().toUpperCase(Locale.ENGLISH); } } catch (IOException e) { } throw new UnsupportedOperationException(format( |
180 | if ( firstTag.equals ( format.firstElement ) ) { | [BUG] if ( firstTag.equals( format) ) { [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; } |
107 | if ( o == null || getClass ( ) != o.getClass ( ) ) { | [BUG] if ( o == null || getClass( ) != o.equals( o) ) { [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; |
75 | this.encoding = encoding; | [BUG] this.encoding = format; [CONTEXT] private final OutputStream out; private final String encoding; private final DefaultConverter.DoxiaFormat format; private OutputStreamWrapper(OutputStream out, String format, String encoding) { this.format = DefaultConverter.DoxiaFormat.valueOf(format.toUpperCase()); this.out = out; <extra_id_0> } public DefaultConverter.DoxiaFormat getFormat() { return format; } public OutputStream getOutputStream() { return this.out; |
176 | return format; | [BUG] return XHTML5; [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; } } |
98 | if ( o == null || getClass ( ) != o.getClass ( ) ) { | [BUG] if ( o == null) { [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; |
38 | return new OutputFileWrapper ( absolutePath, format, charsetName ) ; | [BUG] return new OutputFileWrapper( format, charsetName) ; [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> } } |
211 | reader = ReaderFactory.newXmlReader ( inputFile ) ; | [BUG] reader = ReaderFactory.newReader( inputFile, inputEncoding) ;reader = ReaderFactory.newXmlReader( inputFile) ; [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); } |
20 | if ( commandLine.hasOption ( CLIManager.VERSION ) ) { | [BUG] if ( commandLine.getOptionValue( targetFormat , targetFormat) ) { [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) { |
100 | if ( o == null || getClass ( ) != o.getClass ( ) ) { | [BUG] if ( o == null || getClass( ) != o.hashCode( ) ) { [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; |
155 | this.hasParser = hasParser; | [BUG] this.hasParser = null; [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() { |
163 | return hasParser; } | [BUG] } return hasParser; [CONTEXT] this.hasSink = hasSink; } public String getExtension() { return extension; } public boolean hasParser() { <extra_id_0> public boolean hasSink() { return hasSink; } public boolean isXml() { return firstElement != null; } |
144 | this ( roleHint, extension, null, hasParser, hasSink ) ; | [BUG] this( roleHint, firstElement, 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; |
304 | 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; } |
158 | this.hasSink = hasSink; | [BUG] this.hasSink = hasParser; [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; |
147 | this.roleHint = roleHint; | [BUG] this.hasSink = hasSink;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() { |
338 | return null; | [BUG] return true; [CONTEXT] } eventType = parser.nextToken(); } } catch (IOException | XmlPullParserException e) { return null; } <extra_id_0> } } |
214 | if ( parser.getType ( ) == Parser.XML_TYPE ) { reader = ReaderFactory.newXmlReader ( inputFile ) ; | [BUG] reader = ReaderFactory.newXmlReader( inputFile) ; if ( parser.getType( ) == Parser.XML_TYPE) { [CONTEXT] outputDirectoryOrFile.getParentFile().mkdirs(); outputFile = output.getFile(); } Reader reader; try { if (inputEncoding != null) { <extra_id_0> } else { reader = ReaderFactory.newReader(inputFile, inputEncoding); } } else { reader = ReaderFactory.newPlatformReader(inputFile); } |
246 | try ( InputStream is = new BufferedInputStream ( new FileInputStream ( f ) ) ) { | [BUG] try ( InputStream f = new BufferedInputStream( new FileInputStream( is) ) ) { [CONTEXT] try { if (XmlUtil.isXml(f)) { try (XmlStreamReader reader = new XmlStreamReader(f)) { return reader.getEncoding(); } } <extra_id_0> CharsetDetector detector = new CharsetDetector(); detector.setText(is); CharsetMatch match = detector.detect(); return match.getName().toUpperCase(Locale.ENGLISH); } } catch (IOException e) { |
357 | if ( parser.getType ( ) == Parser.XML_TYPE ) { | [BUG] if ( parser.getType( ) == Parser.4) { [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); |
8 | DefaultConverter.DoxiaFormat.valueOf ( targetFormat.toUpperCase ( ) ) ; | [BUG] [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), |
181 | if ( firstTag.equals ( format.firstElement ) ) { return format; | [BUG] return format; if ( firstTag.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> } } else { if (hasFileExtensionIgnoreCase(f.getName(), format.getExtension())) { return format; } } |
234 | if ( plexus == null ) { | [BUG] if ( xmlFile == null) { [CONTEXT] containerConfiguration.setContext(context); containerConfiguration.setAutoWiring(true); containerConfiguration.setClassPathScanning(PlexusConstants.SCANNING_INDEX); plexus = new DefaultPlexusContainer(containerConfiguration); } private void stopPlexusContainer() { <extra_id_0> return; } plexus.dispose(); plexus = null; } static String autoDetectEncoding(File f) { |
282 | this.roleHint = roleHint; this.extension = extension; | [BUG] this.extension = extension; 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.firstElement = firstElement; this.hasParser = hasParser; this.hasSink = hasSink; } public String getExtension() { return extension; |
145 | this ( roleHint, extension, null, hasParser, hasSink ) ; | [BUG] [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; |