id
int64
1
378
fixed
stringlengths
8
159
bug_ctx
stringlengths
146
649
21
DefaultConverter.DoxiaFormat.valueOf ( targetFormat.toUpperCase ( ) ) ;
[BUG] DefaultConverter.DoxiaFormat.autoDetectFormat( inputFile) ; [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),
146
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() {
273
this ( roleHint, extension, null, hasParser, hasSink ) ;
[BUG] this( 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;
15
boolean format = commandLine.hasOption ( CLIManager.FORMAT ) ;
[BUG] boolean debug = commandLine.hasOption( CLIManager.DEBUG) ;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;
62
return new InputFileWrapper ( absolutePath, format, charsetName ) ;
[BUG] return new InputFileWrapper( absolutePath, format, absolutePath) ; [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; } }
264
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;
207
reader = ReaderFactory.newXmlReader ( inputFile ) ;
[BUG] reader = ReaderFactory.newPlatformReader( 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); }
93
return true; } if ( o == null || getClass ( ) != o.getClass ( ) ) {
[BUG] if ( o == null || getClass( ) != o.getClass( ) ) { }return true; [CONTEXT] void setEncoding(String encoding) { this.encoding = encoding; } @Override public boolean equals(Object o) { if (this == o) { <extra_id_0> return false; } if (!super.equals(o)) { return false; } AbstractFileWrapper that = (AbstractFileWrapper) o;
244
detector.setText ( is ) ;
[BUG] detector.detect( ) ; [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(
5
DefaultConverter.DoxiaFormat.valueOf ( targetFormat.toUpperCase ( ) ) ;
[BUG] DefaultConverter.DoxiaFormat.valueOf( 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),
301
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; }
83
return format;
[BUG] return 1; [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;
154
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() {
239
return; }
[BUG] } return; [CONTEXT] containerConfiguration.setAutoWiring(true); containerConfiguration.setClassPathScanning(PlexusConstants.SCANNING_INDEX); plexus = new DefaultPlexusContainer(containerConfiguration); } private void stopPlexusContainer() { if (plexus == null) { <extra_id_0> plexus.dispose(); plexus = null; } static String autoDetectEncoding(File f) { if (!f.isFile()) { throw new IllegalArgumentException(
279
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;
200
if ( inputEncoding != null ) {
[BUG] if ( inputEncoding != false) { [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 {
297
return hasParser;
[BUG] return hasSink; [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;
42
return new OutputFileWrapper ( absolutePath, format, charsetName ) ;
[BUG] return new OutputFileWrapper( charsetName, format, absolutePath) ; [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> } }
311
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; } }
96
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;
40
return new OutputFileWrapper ( absolutePath, format, charsetName ) ;
[BUG] return new OutputFileWrapper( absolutePath, 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> } }
51
return new InputFileWrapper ( absolutePath, format, charsetName ) ;
[BUG] return new InputFileWrapper( 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; } }
156
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; }
231
if ( plexus == null ) {
[BUG] if ( plexus != 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) {
164
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) {
216
reader = ReaderFactory.newXmlReader ( inputFile ) ;
[BUG] reader = ReaderFactory.newReader( inputFile , firstTag) ; [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); }
77
this.out = out; this.encoding = encoding; }
[BUG] } this.encoding = encoding;this.out = out; [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> public DefaultConverter.DoxiaFormat getFormat() { return format; } public OutputStream getOutputStream() { return this.out; }
161
return extension;
[BUG] return roleHint; [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;
223
reader = ReaderFactory.newXmlReader ( inputFile ) ;
[BUG] reader = ReaderFactory.newReader( outputDirectoryOrFile , 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); }
28
return new InputReaderWrapper ( reader, format ) ;
[BUG] return new InputReaderWrapper( reader) ; [CONTEXT] return this.reader; } public DefaultConverter.DoxiaFormat getFormat() { return format; } public static InputReaderWrapper valueOf(Reader reader, String format) { <extra_id_0> } }
130
if ( o == null || getClass ( ) != o.getClass ( ) ) {
[BUG] if ( o == this || 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;
46
return new OutputFileWrapper ( absolutePath, format, charsetName ) ;
[BUG] return new OutputFileWrapper( charsetName, 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> } }
361
if ( plexus == null ) {
[BUG] if ( plexus == true) { [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) {
257
eventType = parser.nextToken ( ) ;
[BUG] eventType = parser.getName( ) ; [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; }
68
this.format = DefaultConverter.DoxiaFormat.valueOf ( format.toUpperCase ( ) ) ;
[BUG] this.format = DefaultConverter.DoxiaFormat.valueOf( encoding.toUpperCase( ) ) ; [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; }
238
[Delete]
[BUG] if ( firstTag == null) { continue; } [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) {
225
outputEncoding = inputEncoding;
[BUG] outputEncoding = outputEncoding; [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) {
254
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) { if (eventType == XmlPullParser.START_TAG) { <extra_id_0> eventType = parser.nextToken(); } } catch (IOException | XmlPullParserException e) { return null; } return null;
1
if ( commandLine.hasOption ( CLIManager.VERSION ) ) {
[BUG] if ( commandLine.getOptionValue( CLIManager.VERSION) ) { [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) {
318
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;
316
this ( roleHint, extension, null, hasParser, hasSink ) ;
[BUG] this( hasSink, extension, null, hasParser, roleHint) ; [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;
363
this.firstElement = firstElement; this.hasParser = hasParser; this.hasSink = hasSink;
[BUG] this.hasSink = hasSink; 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> } public String getExtension() { return extension; } public boolean hasParser() { return hasParser;
76
this.format = DefaultConverter.DoxiaFormat.valueOf ( format.toUpperCase ( ) ) ;
[BUG] this.format = DefaultConverter.DoxiaFormat.valueOf( null.toUpperCase( ) ) ; [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; }
293
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; }
368
super ( message ) ; }
[BUG] } super( message) ; [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); } }
165
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; }
197
if ( inputEncoding != null ) {
[BUG] if ( inputEncoding == 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 {
69
this.format = DefaultConverter.DoxiaFormat.valueOf ( format.toUpperCase ( ) ) ; this.out = out;
[BUG] this.out = out; this.format = DefaultConverter.DoxiaFormat.valueOf( format.toUpperCase( ) ) ; [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.encoding = encoding; } public DefaultConverter.DoxiaFormat getFormat() { return format; } public OutputStream getOutputStream() {
193
parse ( inputFile, inputEncoding, parserFormat, output, null ) ;
[BUG] parse( inputFile, inputEncoding, format, 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,
358
reader = ReaderFactory.newXmlReader ( inputFile ) ;
[BUG] reader = ReaderFactory.newReader( outputDirectoryOrFile , 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); }
227
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) {
255
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) { if (eventType == XmlPullParser.START_TAG) { <extra_id_0> } eventType = parser.nextToken(); } } catch (IOException | XmlPullParserException e) { return null; }
30
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> }
185
parse ( inputFile, inputEncoding, parserFormat, output, null ) ;
[BUG] parse( inputEncoding, 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,
346
if ( firstTag.equals ( format.firstElement ) ) {
[BUG] if ( roleHint.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; }
6
DefaultConverter.DoxiaFormat.valueOf ( targetFormat.toUpperCase ( ) ) ;
[BUG] DefaultConverter.DoxiaFormat.autoDetectFormat( 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),
129
this.file = file;
[BUG] this.file = null; [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;
240
try ( InputStream is = new BufferedInputStream ( new FileInputStream ( f ) ) ) { CharsetDetector detector = new CharsetDetector ( ) ; detector.setText ( is ) ;
[BUG] detector.setText( is) ; 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> CharsetMatch match = detector.detect(); return match.getName().toUpperCase(Locale.ENGLISH); } } catch (IOException e) { } throw new UnsupportedOperationException(format(
196
parse ( inputFile, inputEncoding, parserFormat, output, null ) ;
[BUG] parse( input.getFile( ) , input.getEncoding( ) , input.getFormat( ) , output) ;parse( inputFile, inputEncoding, 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,
198
if ( inputEncoding != null ) {
[BUG] if ( roleHint != 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 {
33
return valueOf ( absolutePath, format, WriterFactory.UTF_8 ) ;
[BUG] return valueOf( format, 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); }
371
super ( message, cause ) ;
[BUG] super( 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> } }
348
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; } } }
79
static final long serialVersionUID = 3329037527245430610L;
[BUG] static final int serialVersionUID = 3329037527245430610L; [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;
57
return new InputFileWrapper ( absolutePath, format, charsetName ) ;
[BUG] return new InputFileWrapper( charsetName, format, absolutePath) ; [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; } }
25
[Delete]
[BUG] if ( reader == null) { throw new IllegalArgumentException( "input reader is required") ; } [CONTEXT] static final long serialVersionUID = 3260213754615748766L; private final Reader reader; private final DefaultConverter.DoxiaFormat format; private InputReaderWrapper(Reader reader, String format) { this.format = DefaultConverter.DoxiaFormat.valueOf(format.toUpperCase()); if (reader == null) { <extra_id_0> } this.reader = reader; } public Reader getReader() { return this.reader; }
47
return new OutputFileWrapper ( absolutePath, format, charsetName ) ;
[BUG] return new OutputFileWrapper( absolutePath, 2, 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> } }
253
return parser.getName ( ) ; } eventType = parser.nextToken ( ) ;
[BUG] eventType = parser.nextToken( ) ; }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) { if (eventType == XmlPullParser.START_TAG) { <extra_id_0> } } catch (IOException | XmlPullParserException e) { return null; } return null; }
261
eventType = parser.nextToken ( ) ;
[BUG] int eventType = parser.getEventType( ) ;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; }
71
this.format = DefaultConverter.DoxiaFormat.valueOf ( format.toUpperCase ( ) ) ; this.out = out; this.encoding = encoding;
[BUG] this.encoding = encoding; this.out = out;this.format = DefaultConverter.DoxiaFormat.valueOf( format.toUpperCase( ) ) ; [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> } public DefaultConverter.DoxiaFormat getFormat() { return format; } public OutputStream getOutputStream() { return this.out;
295
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;
323
parse ( inputFile, inputEncoding, parserFormat, output, null ) ;
[BUG] parse( inputFile, inputEncoding, XDOC, 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,
205
[Delete]
[BUG] if ( inputEncoding != null) { if ( ( parser.getType( ) ) == ( XML_TYPE) ) { reader = newXmlReader( inputFile) ; }else { reader = newReader( inputFile, inputEncoding) ; } }else { reader = newPlatformReader( inputFile) ; } [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);
220
reader = ReaderFactory.newXmlReader ( inputFile ) ;
[BUG] reader = ReaderFactory.newReader( inputFile , outputEncoding) ; [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); }
135
this ( roleHint, extension, null, hasParser, hasSink ) ;
[BUG] this( roleHint, extension, null, hasSink, 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;
276
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;
127
if ( !super.equals ( o ) ) {
[BUG] if ( !super.equals( o) ) { [CONTEXT] if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } <extra_id_0> return false; } AbstractFileWrapper that = (AbstractFileWrapper) o; return Objects.equals(getFile(), that.getFile()); } @Override
373
super ( message, cause ) ;
[BUG] super( cause, message) ; [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> } }
334
reader = ReaderFactory.newXmlReader ( inputFile ) ;
[BUG] reader = ReaderFactory.newReader( relativeOutputDirectory , outputEncoding) ; [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); }
74
this.out = out; this.encoding = encoding;
[BUG] this.encoding = encoding; this.out = out; [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> } public DefaultConverter.DoxiaFormat getFormat() { return format; } public OutputStream getOutputStream() { return this.out;
235
if ( plexus == null ) { return; }
[BUG] return ; [CONTEXT] containerConfiguration.setContext(context); containerConfiguration.setAutoWiring(true); containerConfiguration.setClassPathScanning(PlexusConstants.SCANNING_INDEX); plexus = new DefaultPlexusContainer(containerConfiguration); } private void stopPlexusContainer() { <extra_id_0> plexus.dispose(); plexus = null; } static String autoDetectEncoding(File f) { if (!f.isFile()) { throw new IllegalArgumentException(
203
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);
256
eventType = parser.nextToken ( ) ;
[BUG] eventType = parser.setInput( ) ; [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; }
325
if ( inputEncoding != null ) {
[BUG] if ( outputEncoding != 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 {
290
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; }
109
if ( !super.equals ( o ) ) {
[BUG] if ( super.equals( o) ) { [CONTEXT] if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } <extra_id_0> return false; } AbstractFileWrapper that = (AbstractFileWrapper) o; return Objects.equals(getFile(), that.getFile()); } @Override
34
return valueOf ( absolutePath, format, WriterFactory.UTF_8 ) ;
[BUG] return valueOf( 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); }
138
this ( roleHint, extension, null, hasParser, hasSink ) ;
[BUG] this( 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;
206
reader = ReaderFactory.newXmlReader ( inputFile ) ;
[BUG] reader = ReaderFactory.newXmlReader( relativeOutputDirectory) ; [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); }
162
return hasParser;
[BUG] return hasSink; [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;
366
static final long serialVersionUID = -5251213141888260575L;
[BUG] static final short 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); }
118
return Objects.equals ( getFile ( ) , that.getFile ( ) ) ;
[BUG] return Objects.hash( 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
29
return new InputReaderWrapper ( reader, format ) ;
[BUG] return new InputReaderWrapper( format, reader) ; [CONTEXT] return this.reader; } public DefaultConverter.DoxiaFormat getFormat() { return format; } public static InputReaderWrapper valueOf(Reader reader, String format) { <extra_id_0> } }
167
if ( firstTag.equals ( format.firstElement ) ) {
[BUG] if ( firstTag.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; }
353
if ( inputEncoding != null ) {
[BUG] if ( roleHint != false) { [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 {
286
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() {
139
this ( roleHint, extension, null, hasParser, hasSink ) ;
[BUG] this( roleHint, extension, null, 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;
313
return format; } } else {
[BUG] } else { }return format; [CONTEXT] if (format.isXml()) { String firstTag = getFirstTag(f); if (firstTag == null) { continue; } if (firstTag.equals(format.firstElement)) { <extra_id_0> if (hasFileExtensionIgnoreCase(f.getName(), format.getExtension())) { return format; } } } throw new UnsupportedOperationException(format(
237
[Delete]
[BUG] if ( ( plexus) != null) { return ; } [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) {
360
outputEncoding = inputEncoding;
[BUG] outputEncoding = null; [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) {