Towards Generating Functionally Correct Code Edits from Natural Language Issue Descriptions
Paper • 2304.03816 • Published • 1
defects4j_project stringclasses 12
values | defects4j_bug_id stringlengths 1 3 | file_path stringlengths 38 95 | bug_start_line stringlengths 1 4 | bug_end_line stringlengths 2 4 | issue_title stringlengths 13 150 | issue_description stringlengths 4 8.74k | original_src stringlengths 44 9k | original_src_wo_comments stringlengths 38 5.83k | fixed_src stringlengths 40 9.55k | fixed_src_wo_comments stringlengths 34 5.76k |
|---|---|---|---|---|---|---|---|---|---|---|
Math | 19 | src/main/java/org/apache/commons/math3/optimization/direct/CMAESOptimizer.java | 504 | 561 | Wide bounds to CMAESOptimizer result in NaN parameters passed to fitness function | If you give large values as lower/upper bounds (for example -Double.MAX_VALUE as a lower bound), the optimizer can call the fitness function with parameters set to NaN. My guess is this is due to FitnessFunction.encode/decode generating NaN when normalizing/denormalizing parameters. For example, if the difference bet... | private void checkParameters() {
final double[] init = getStartPoint();
final double[] lB = getLowerBound();
final double[] uB = getUpperBound();
// Checks whether there is at least one finite bound value.
boolean hasFiniteBounds = false;
for (int i = 0; i < lB.length; i... | private void checkParameters ( ) { final double [ ] init = getStartPoint ( ) ; final double [ ] lB = getLowerBound ( ) ; final double [ ] uB = getUpperBound ( ) ; boolean hasFiniteBounds = false ; for ( int i = 0 ; i < lB . length ; i ++ ) { if ( ! Double . isInfinite ( lB [ i ] ) || ! Double . isInfinite ( uB [ i ] ) ... | private void checkParameters() {
final double[] init = getStartPoint();
final double[] lB = getLowerBound();
final double[] uB = getUpperBound();
// Checks whether there is at least one finite bound value.
boolean hasFiniteBounds = false;
for (int i = 0; i < lB.length; i... | private void checkParameters ( ) { final double [ ] init = getStartPoint ( ) ; final double [ ] lB = getLowerBound ( ) ; final double [ ] uB = getUpperBound ( ) ; boolean hasFiniteBounds = false ; for ( int i = 0 ; i < lB . length ; i ++ ) { if ( ! Double . isInfinite ( lB [ i ] ) || ! Double . isInfinite ( uB [ i ] ) ... |
Compress | 16 | src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java | 197 | 258 | Too relaxed tar detection in ArchiveStreamFactory | The relaxed tar detection logic added in COMPRESS-117 unfortunately matches also some non-tar files like a [test AIFF file|https://svn.apache.org/repos/asf/tika/trunk/tika-parsers/src/test/resources/test-documents/testAIFF.aif] that Apache Tika uses. It would be good to improve the detection heuristics to still match f... | public ArchiveInputStream createArchiveInputStream(final InputStream in)
throws ArchiveException {
if (in == null) {
throw new IllegalArgumentException("Stream must not be null.");
}
if (!in.markSupported()) {
throw new IllegalArgumentException("Mark is not s... | public ArchiveInputStream createArchiveInputStream ( final InputStream in ) throws ArchiveException { if ( in == null ) { throw new IllegalArgumentException ( "Stream must not be null." ) ; } if ( ! in . markSupported ( ) ) { throw new IllegalArgumentException ( "Mark is not supported." ) ; } final byte [ ] signature =... | public ArchiveInputStream createArchiveInputStream(final InputStream in)
throws ArchiveException {
if (in == null) {
throw new IllegalArgumentException("Stream must not be null.");
}
if (!in.markSupported()) {
throw new IllegalArgumentException("Mark is not s... | public ArchiveInputStream createArchiveInputStream ( final InputStream in ) throws ArchiveException { if ( in == null ) { throw new IllegalArgumentException ( "Stream must not be null." ) ; } if ( ! in . markSupported ( ) ) { throw new IllegalArgumentException ( "Mark is not supported." ) ; } final byte [ ] signature =... |
Compress | 41 | src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java | 219 | 324 | ZipArchiveInputStream.getNextZipEntry() should differentiate between "invalid entry encountered" and "no more entries" | ZipArchiveInputStream.getNextZipEntry() currently returns null if an invalid entry is encountered. Thus, it's not possible to differentiate between "no more entries" and "invalid entry encountered" conditions.
Instead, it should throw an exception if an invalid entry is encountered.
I've created a test case and fix.... | public ZipArchiveEntry getNextZipEntry() throws IOException {
boolean firstEntry = true;
if (closed || hitCentralDirectory) {
return null;
}
if (current != null) {
closeEntry();
firstEntry = false;
}
try {
if (firstEntry) {... | public ZipArchiveEntry getNextZipEntry ( ) throws IOException { boolean firstEntry = true ; if ( closed || hitCentralDirectory ) { return null ; } if ( current != null ) { closeEntry ( ) ; firstEntry = false ; } try { if ( firstEntry ) { readFirstLocalFileHeader ( LFH_BUF ) ; } else { readFully ( LFH_BUF ) ; } } catch ... | public ZipArchiveEntry getNextZipEntry() throws IOException {
boolean firstEntry = true;
if (closed || hitCentralDirectory) {
return null;
}
if (current != null) {
closeEntry();
firstEntry = false;
}
try {
if (firstEntry) {... | public ZipArchiveEntry getNextZipEntry ( ) throws IOException { boolean firstEntry = true ; if ( closed || hitCentralDirectory ) { return null ; } if ( current != null ) { closeEntry ( ) ; firstEntry = false ; } try { if ( firstEntry ) { readFirstLocalFileHeader ( LFH_BUF ) ; } else { readFully ( LFH_BUF ) ; } } catch ... |
JacksonDatabind | 93 | src/main/java/com/fasterxml/jackson/databind/jsontype/impl/SubTypeValidator.java | 67 | 99 | `NullPointerException` in `SubTypeValidator.validateSubType` when validating Spring interface | In jackson-databind-2.8.11 jackson-databind-2.9.3 and jackson-databind-2.9.4-SNAPSHOT `SubTypeValidator.validateSubType` fails with a `NullPointerException` if the `JavaType.getRawClass()` is an interface that starts with `org.springframework.` For example, the following will fail:
```java
package org.springframew... | public void validateSubType(DeserializationContext ctxt, JavaType type) throws JsonMappingException
{
// There are certain nasty classes that could cause problems, mostly
// via default typing -- catch them here.
final Class<?> raw = type.getRawClass();
String full = raw.getName();
... | public void validateSubType ( DeserializationContext ctxt , JavaType type ) throws JsonMappingException { final Class < ? > raw = type . getRawClass ( ) ; String full = raw . getName ( ) ; main_check : do { if ( _cfgIllegalClassNames . contains ( full ) ) { break ; } if ( full . startsWith ( PREFIX_STRING ) ) { for ( C... | public void validateSubType(DeserializationContext ctxt, JavaType type) throws JsonMappingException
{
// There are certain nasty classes that could cause problems, mostly
// via default typing -- catch them here.
final Class<?> raw = type.getRawClass();
String full = raw.getName();
... | public void validateSubType ( DeserializationContext ctxt , JavaType type ) throws JsonMappingException { final Class < ? > raw = type . getRawClass ( ) ; String full = raw . getName ( ) ; main_check : do { if ( _cfgIllegalClassNames . contains ( full ) ) { break ; } if ( ! raw . isInterface ( ) && full . startsWith ( ... |
Math | 2 | src/main/java/org/apache/commons/math3/distribution/HypergeometricDistribution.java | 267 | 269 | HypergeometricDistribution.sample suffers from integer overflow | Hi, I have an application which broke when ported from commons math 2.2 to 3.2. It looks like the HypergeometricDistribution.sample() method doesn't work as well as it used to with large integer values -- the example code below should return a sample between 0 and 50, but usually returns -50.
{code}
import org.apache.... | public double getNumericalMean() {
return (double) (getSampleSize() * getNumberOfSuccesses()) / (double) getPopulationSize();
} | public double getNumericalMean ( ) { return ( double ) ( getSampleSize ( ) * getNumberOfSuccesses ( ) ) / ( double ) getPopulationSize ( ) ; } | public double getNumericalMean() {
return getSampleSize() * (getNumberOfSuccesses() / (double) getPopulationSize());
} | public double getNumericalMean ( ) { return getSampleSize ( ) * ( getNumberOfSuccesses ( ) / ( double ) getPopulationSize ( ) ) ; } |
Math | 58 | src/main/java/org/apache/commons/math/optimization/fitting/GaussianFitter.java | 119 | 122 | GaussianFitter Unexpectedly Throws NotStrictlyPositiveException | Running the following:
double[] observations =
{
1.1143831578403364E-29,
4.95281403484594E-28,
1.1171347211930288E-26,
1.7044813962636277E-25,
1.9784716574832164E-24,
1.8630236407866774E-23,
1.4820532905097742E-22,
1.0241963854632831E-21... | public double[] fit() {
final double[] guess = (new ParameterGuesser(getObservations())).guess();
return fit(new Gaussian.Parametric(), guess);
} | public double [ ] fit ( ) { final double [ ] guess = ( new ParameterGuesser ( getObservations ( ) ) ) . guess ( ) ; return fit ( new Gaussian . Parametric ( ) , guess ) ; } | public double[] fit() {
final double[] guess = (new ParameterGuesser(getObservations())).guess();
return fit(guess);
} | public double [ ] fit ( ) { final double [ ] guess = ( new ParameterGuesser ( getObservations ( ) ) ) . guess ( ) ; return fit ( guess ) ; } |
JacksonDatabind | 85 | src/main/java/com/fasterxml/jackson/databind/ser/std/DateTimeSerializerBase.java | 48 | 95 | `DateTimeSerializerBase` ignores configured date format when creating contextual | `DateTimeSerializerBase#createContextual` creates a new serializer with `StdDateFormat.DATE_FORMAT_STR_ISO8601` format instead of re-using the actual format that may have been specified on the configuration. See the following code:
```
final String pattern = format.hasPattern()
... | @Override
public JsonSerializer<?> createContextual(SerializerProvider serializers,
BeanProperty property) throws JsonMappingException
{
if (property == null) {
return this;
}
JsonFormat.Value format = findFormatOverrides(serializers, property, handledType());
... | @ Override public JsonSerializer < ? > createContextual ( SerializerProvider serializers , BeanProperty property ) throws JsonMappingException { if ( property == null ) { return this ; } JsonFormat . Value format = findFormatOverrides ( serializers , property , handledType ( ) ) ; if ( format == null ) { return this ; ... | @Override
public JsonSerializer<?> createContextual(SerializerProvider serializers,
BeanProperty property) throws JsonMappingException
{
if (property == null) {
return this;
}
JsonFormat.Value format = findFormatOverrides(serializers, property, handledType());
... | @ Override public JsonSerializer < ? > createContextual ( SerializerProvider serializers , BeanProperty property ) throws JsonMappingException { if ( property == null ) { return this ; } JsonFormat . Value format = findFormatOverrides ( serializers , property , handledType ( ) ) ; if ( format == null ) { return this ; ... |
JacksonDatabind | 1 | src/main/java/com/fasterxml/jackson/databind/ser/BeanPropertyWriter.java | 582 | 624 | NULL values are duplicated when serializing as array [via @JsonFormat(shape = JsonFormat.Shape.ARRAY)] | Example:
``` java
public class TestOuter {
@JsonFormat(shape = JsonFormat.Shape.ARRAY)
public ArrayList<TestInner> array;
public TestOuter() {
this.array = new ArrayList<TestInner>();
this.array.add(new TestInner(1, "one"));
this.array.add(new TestInner(0, null));
}
priva... | public void serializeAsColumn(Object bean, JsonGenerator jgen, SerializerProvider prov)
throws Exception
{
Object value = get(bean);
if (value == null) { // nulls need specialized handling
if (_nullSerializer != null) {
_nullSerializer.serialize(null, jgen, prov);... | public void serializeAsColumn ( Object bean , JsonGenerator jgen , SerializerProvider prov ) throws Exception { Object value = get ( bean ) ; if ( value == null ) { if ( _nullSerializer != null ) { _nullSerializer . serialize ( null , jgen , prov ) ; } else { jgen . writeNull ( ) ; } } JsonSerializer < Object > ser = _... | public void serializeAsColumn(Object bean, JsonGenerator jgen, SerializerProvider prov)
throws Exception
{
Object value = get(bean);
if (value == null) { // nulls need specialized handling
if (_nullSerializer != null) {
_nullSerializer.serialize(null, jgen, prov);... | public void serializeAsColumn ( Object bean , JsonGenerator jgen , SerializerProvider prov ) throws Exception { Object value = get ( bean ) ; if ( value == null ) { if ( _nullSerializer != null ) { _nullSerializer . serialize ( null , jgen , prov ) ; } else { jgen . writeNull ( ) ; } return ; } JsonSerializer < Object ... |
Math | 74 | src/main/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java | 191 | 359 | Wrong parameter for first step size guess for Embedded Runge Kutta methods | In a space application using DOP853 i detected what seems to be a bad parameter in the call to the method initializeStep of class AdaptiveStepsizeIntegrator.
Here, DormandPrince853Integrator is a subclass for EmbeddedRungeKuttaIntegrator which perform the call to initializeStep at the beginning of its method integrat... | @Override
public double integrate(final FirstOrderDifferentialEquations equations,
final double t0, final double[] y0,
final double t, final double[] y)
throws DerivativeException, IntegratorException {
sanityChecks(equations, t0, y0, t, y);
setEquations(... | @ Override public double integrate ( final FirstOrderDifferentialEquations equations , final double t0 , final double [ ] y0 , final double t , final double [ ] y ) throws DerivativeException , IntegratorException { sanityChecks ( equations , t0 , y0 , t , y ) ; setEquations ( equations ) ; resetEvaluations ( ) ; final... | @Override
public double integrate(final FirstOrderDifferentialEquations equations,
final double t0, final double[] y0,
final double t, final double[] y)
throws DerivativeException, IntegratorException {
sanityChecks(equations, t0, y0, t, y);
setEquations(... | @ Override public double integrate ( final FirstOrderDifferentialEquations equations , final double t0 , final double [ ] y0 , final double t , final double [ ] y ) throws DerivativeException , IntegratorException { sanityChecks ( equations , t0 , y0 , t , y ) ; setEquations ( equations ) ; resetEvaluations ( ) ; final... |
JacksonCore | 6 | src/main/java/com/fasterxml/jackson/core/JsonPointer.java | 185 | 206 | `JsonPointer` should not consider "00" to be valid index | Although `00` can be parsed as `0` in some cases, it is not a valid JSON number; and is also not legal numeric index for JSON Pointer. As such, `JsonPointer` class should ensure it can only match property name "00" and not array index.
| private final static int _parseIndex(String str) {
final int len = str.length();
// [core#133]: beware of super long indexes; assume we never
// have arrays over 2 billion entries so ints are fine.
if (len == 0 || len > 10) {
return -1;
}
// [core#176]: no lea... | private final static int _parseIndex ( String str ) { final int len = str . length ( ) ; if ( len == 0 || len > 10 ) { return - 1 ; } for ( int i = 0 ; i < len ; ++ i ) { char c = str . charAt ( i ) ; if ( c > '9' || c < '0' ) { return - 1 ; } } if ( len == 10 ) { long l = NumberInput . parseLong ( str ) ; if ( l > Int... | private final static int _parseIndex(String str) {
final int len = str.length();
// [core#133]: beware of super long indexes; assume we never
// have arrays over 2 billion entries so ints are fine.
if (len == 0 || len > 10) {
return -1;
}
// [core#176]: no lea... | private final static int _parseIndex ( String str ) { final int len = str . length ( ) ; if ( len == 0 || len > 10 ) { return - 1 ; } char c = str . charAt ( 0 ) ; if ( c <= '0' ) { return ( len == 1 && c == '0' ) ? 0 : - 1 ; } if ( c > '9' ) { return - 1 ; } for ( int i = 1 ; i < len ; ++ i ) { c = str . charAt ( i ) ... |
JacksonDatabind | 46 | src/main/java/com/fasterxml/jackson/databind/type/ReferenceType.java | 150 | 158 | Incorrect signature for generic type via `JavaType.getGenericSignature | (see https://github.com/FasterXML/jackson-modules-base/issues/8 for background)
It looks like generic signature generation is missing one closing `>` character to produce:
```
()Ljava/util/concurrent/atomic/AtomicReference<Ljava/lang/String;;
```
instead of expected
```
()Ljava/util/concurrent/atomic/AtomicReferenc... | @Override
public StringBuilder getGenericSignature(StringBuilder sb)
{
_classSignature(_class, sb, false);
sb.append('<');
sb = _referencedType.getGenericSignature(sb);
sb.append(';');
return sb;
} | @ Override public StringBuilder getGenericSignature ( StringBuilder sb ) { _classSignature ( _class , sb , false ) ; sb . append ( '<' ) ; sb = _referencedType . getGenericSignature ( sb ) ; sb . append ( ';' ) ; return sb ; } | @Override
public StringBuilder getGenericSignature(StringBuilder sb)
{
_classSignature(_class, sb, false);
sb.append('<');
sb = _referencedType.getGenericSignature(sb);
sb.append(">;");
return sb;
} | @ Override public StringBuilder getGenericSignature ( StringBuilder sb ) { _classSignature ( _class , sb , false ) ; sb . append ( '<' ) ; sb = _referencedType . getGenericSignature ( sb ) ; sb . append ( ">;" ) ; return sb ; } |
Math | 23 | src/main/java/org/apache/commons/math3/optimization/univariate/BrentOptimizer.java | 114 | 281 | "BrentOptimizer" not always reporting the best point | {{BrentOptimizer}} (package "o.a.c.m.optimization.univariate") does not check that the point it is going to return is indeed the best one it has encountered. Indeed, the last evaluated point might be slightly worse than the one before last. | @Override
protected UnivariatePointValuePair doOptimize() {
final boolean isMinim = getGoalType() == GoalType.MINIMIZE;
final double lo = getMin();
final double mid = getStartValue();
final double hi = getMax();
// Optional additional convergence criteria.
final Conv... | @ Override protected UnivariatePointValuePair doOptimize ( ) { final boolean isMinim = getGoalType ( ) == GoalType . MINIMIZE ; final double lo = getMin ( ) ; final double mid = getStartValue ( ) ; final double hi = getMax ( ) ; final ConvergenceChecker < UnivariatePointValuePair > checker = getConvergenceChecker ( ) ;... | @Override
protected UnivariatePointValuePair doOptimize() {
final boolean isMinim = getGoalType() == GoalType.MINIMIZE;
final double lo = getMin();
final double mid = getStartValue();
final double hi = getMax();
// Optional additional convergence criteria.
final Conv... | @ Override protected UnivariatePointValuePair doOptimize ( ) { final boolean isMinim = getGoalType ( ) == GoalType . MINIMIZE ; final double lo = getMin ( ) ; final double mid = getStartValue ( ) ; final double hi = getMax ( ) ; final ConvergenceChecker < UnivariatePointValuePair > checker = getConvergenceChecker ( ) ;... |
JacksonDatabind | 102 | src/main/java/com/fasterxml/jackson/databind/ser/std/DateTimeSerializerBase.java | 61 | 136 | Cannot set custom format for `SqlDateSerializer` globally | Version: 2.9.5
After https://github.com/FasterXML/jackson-databind/issues/219 was fixed, the default format for `java.sql.Date` serialization switched from string to numeric, following the default value of `WRITE_DATES_AS_TIMESTAMPS`.
In order to prevent breaks, I want `java.sql.Date` to serialize as a string, wi... | @Override
public JsonSerializer<?> createContextual(SerializerProvider serializers,
BeanProperty property) throws JsonMappingException
{
// Note! Should not skip if `property` null since that'd skip check
// for config overrides, in case of root value
if (property == null) {
... | @ Override public JsonSerializer < ? > createContextual ( SerializerProvider serializers , BeanProperty property ) throws JsonMappingException { if ( property == null ) { return this ; } JsonFormat . Value format = findFormatOverrides ( serializers , property , handledType ( ) ) ; if ( format == null ) { return this ; ... | @Override
public JsonSerializer<?> createContextual(SerializerProvider serializers,
BeanProperty property) throws JsonMappingException
{
// Note! Should not skip if `property` null since that'd skip check
// for config overrides, in case of root value
JsonFormat.Value format ... | @ Override public JsonSerializer < ? > createContextual ( SerializerProvider serializers , BeanProperty property ) throws JsonMappingException { JsonFormat . Value format = findFormatOverrides ( serializers , property , handledType ( ) ) ; if ( format == null ) { return this ; } JsonFormat . Shape shape = format . getS... |
JacksonDatabind | 11 | src/main/java/com/fasterxml/jackson/databind/type/TypeFactory.java | 889 | 930 | Problem resolving locally declared generic type | (reported by Hal H)
Case like:
``` java
class Something {
public <T extends Ruleform> T getEntity()
public <T extends Ruleform> void setEntity(T entity)
}
```
appears to fail on deserialization.
| protected JavaType _fromVariable(TypeVariable<?> type, TypeBindings context)
{
final String name = type.getName();
// 19-Mar-2015: Without context, all we can check are bounds.
if (context == null) {
// And to prevent infinite loops, now need this:
return _unknownType... | protected JavaType _fromVariable ( TypeVariable < ? > type , TypeBindings context ) { final String name = type . getName ( ) ; if ( context == null ) { return _unknownType ( ) ; } else { JavaType actualType = context . findType ( name ) ; if ( actualType != null ) { return actualType ; } } Type [ ] bounds = type . getB... | protected JavaType _fromVariable(TypeVariable<?> type, TypeBindings context)
{
final String name = type.getName();
// 19-Mar-2015: Without context, all we can check are bounds.
if (context == null) {
// And to prevent infinite loops, now need this:
context = new TypeB... | protected JavaType _fromVariable ( TypeVariable < ? > type , TypeBindings context ) { final String name = type . getName ( ) ; if ( context == null ) { context = new TypeBindings ( this , ( Class < ? > ) null ) ; } else { JavaType actualType = context . findType ( name , false ) ; if ( actualType != null ) { return act... |
Cli | 4 | src/java/org/apache/commons/cli/Parser.java | 290 | 309 | PosixParser interupts "-target opt" as "-t arget opt" | This was posted on the Commons-Developer list and confirmed as a bug.
> Is this a bug? Or am I using this incorrectly?
> I have an option with short and long values. Given code that is
> essentially what is below, with a PosixParser I see results as
> follows:
>
> A command line with just "-t" prints out the resu... | private void checkRequiredOptions()
throws MissingOptionException
{
// if there are required options that have not been
// processsed
if (requiredOptions.size() > 0)
{
Iterator iter = requiredOptions.iterator();
StringBuffer buff = new StringBuffer();
... | private void checkRequiredOptions ( ) throws MissingOptionException { if ( requiredOptions . size ( ) > 0 ) { Iterator iter = requiredOptions . iterator ( ) ; StringBuffer buff = new StringBuffer ( ) ; while ( iter . hasNext ( ) ) { buff . append ( iter . next ( ) ) ; } throw new MissingOptionException ( buff . toStrin... | private void checkRequiredOptions()
throws MissingOptionException
{
// if there are required options that have not been
// processsed
if (requiredOptions.size() > 0)
{
Iterator iter = requiredOptions.iterator();
StringBuffer buff = new StringBuffer("Mi... | private void checkRequiredOptions ( ) throws MissingOptionException { if ( requiredOptions . size ( ) > 0 ) { Iterator iter = requiredOptions . iterator ( ) ; StringBuffer buff = new StringBuffer ( "Missing required option" ) ; buff . append ( requiredOptions . size ( ) == 1 ? "" : "s" ) ; buff . append ( ": " ) ; whil... |
Codec | 9 | src/java/org/apache/commons/codec/binary/Base64.java | 822 | 837 | Base64.encodeBase64(byte[] binaryData, boolean isChunked, boolean urlSafe, int maxResultSize) throws IAE for valid maxResultSize if isChunked is false | If isChunked is false, Base64.encodeBase64(byte[] binaryData, boolean isChunked, boolean urlSafe, int maxResultSize) throws IAE for valid maxResultSize.
Test case and fix will be applied shortly. | public static byte[] encodeBase64(byte[] binaryData, boolean isChunked, boolean urlSafe, int maxResultSize) {
if (binaryData == null || binaryData.length == 0) {
return binaryData;
}
long len = getEncodeLength(binaryData, MIME_CHUNK_SIZE, CHUNK_SEPARATOR);
if (len > maxResul... | public static byte [ ] encodeBase64 ( byte [ ] binaryData , boolean isChunked , boolean urlSafe , int maxResultSize ) { if ( binaryData == null || binaryData . length == 0 ) { return binaryData ; } long len = getEncodeLength ( binaryData , MIME_CHUNK_SIZE , CHUNK_SEPARATOR ) ; if ( len > maxResultSize ) { throw new Ill... | public static byte[] encodeBase64(byte[] binaryData, boolean isChunked, boolean urlSafe, int maxResultSize) {
if (binaryData == null || binaryData.length == 0) {
return binaryData;
}
long len = getEncodeLength(binaryData, isChunked ? MIME_CHUNK_SIZE : 0, CHUNK_SEPARATOR);
if... | public static byte [ ] encodeBase64 ( byte [ ] binaryData , boolean isChunked , boolean urlSafe , int maxResultSize ) { if ( binaryData == null || binaryData . length == 0 ) { return binaryData ; } long len = getEncodeLength ( binaryData , isChunked ? MIME_CHUNK_SIZE : 0 , CHUNK_SEPARATOR ) ; if ( len > maxResultSize )... |
JacksonCore | 26 | src/main/java/com/fasterxml/jackson/core/json/async/NonBlockingJsonParser.java | 87 | 112 | Non-blocking parser reports incorrect locations when fed with non-zero offset | When feeding a non-blocking parser, the input array offset leaks into the offsets reported by `getCurrentLocation()` and `getTokenLocation()`.
For example, feeding with an offset of 7 yields tokens whose reported locations are 7 greater than they should be. Likewise the current location reported by the parser is 7 g... | @Override
public void feedInput(byte[] buf, int start, int end) throws IOException
{
// Must not have remaining input
if (_inputPtr < _inputEnd) {
_reportError("Still have %d undecoded bytes, should not call 'feedInput'", _inputEnd - _inputPtr);
}
if (end < start) {
... | @ Override public void feedInput ( byte [ ] buf , int start , int end ) throws IOException { if ( _inputPtr < _inputEnd ) { _reportError ( "Still have %d undecoded bytes, should not call 'feedInput'" , _inputEnd - _inputPtr ) ; } if ( end < start ) { _reportError ( "Input end (%d) may not be before start (%d)" , end , ... | @Override
public void feedInput(byte[] buf, int start, int end) throws IOException
{
// Must not have remaining input
if (_inputPtr < _inputEnd) {
_reportError("Still have %d undecoded bytes, should not call 'feedInput'", _inputEnd - _inputPtr);
}
if (end < start) {
... | @ Override public void feedInput ( byte [ ] buf , int start , int end ) throws IOException { if ( _inputPtr < _inputEnd ) { _reportError ( "Still have %d undecoded bytes, should not call 'feedInput'" , _inputEnd - _inputPtr ) ; } if ( end < start ) { _reportError ( "Input end (%d) may not be before start (%d)" , end , ... |
Mockito | 5 | src/org/mockito/internal/verification/VerificationOverTimeImpl.java | 75 | 99 | Mockito 1.10.x timeout verification needs JUnit classes (VerifyError, NoClassDefFoundError) | If JUnit is not on the classpath and mockito is version 1.10.x (as of now 1.10.1 up to 1.10.19) and the code is using the timeout verification which is not supposed to be related to JUnit, then the JVM may fail with a `VerifyError` or a `NoClassDefFoundError`.
This issue has been reported on the [mailing list](https:/... | public void verify(VerificationData data) {
AssertionError error = null;
timer.start();
while (timer.isCounting()) {
try {
delegate.verify(data);
if (returnOnSuccess) {
return;
} else {
error = ... | public void verify ( VerificationData data ) { AssertionError error = null ; timer . start ( ) ; while ( timer . isCounting ( ) ) { try { delegate . verify ( data ) ; if ( returnOnSuccess ) { return ; } else { error = null ; } } catch ( MockitoAssertionError e ) { error = handleVerifyException ( e ) ; } catch ( org . m... | public void verify(VerificationData data) {
AssertionError error = null;
timer.start();
while (timer.isCounting()) {
try {
delegate.verify(data);
if (returnOnSuccess) {
return;
} else {
error = ... | public void verify ( VerificationData data ) { AssertionError error = null ; timer . start ( ) ; while ( timer . isCounting ( ) ) { try { delegate . verify ( data ) ; if ( returnOnSuccess ) { return ; } else { error = null ; } } catch ( MockitoAssertionError e ) { error = handleVerifyException ( e ) ; } catch ( Asserti... |
JacksonDatabind | 50 | src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializer.java | 376 | 474 | `@JsonIdentityInfo` deserialization fails with combination of forward references, `@JsonCreator` | As a follow-up to bug #1255, the patch I provided exposes related deserialization problems.
I have attached a small project ('jackson-test.zip') to demonstrate these issues. When run with both patches from #1255, the output is provided in the attached 'both.txt'. When run with just the first patch from #1255, the outpu... | @Override
@SuppressWarnings("resource")
protected Object _deserializeUsingPropertyBased(final JsonParser p, final DeserializationContext ctxt)
throws IOException
{
final PropertyBasedCreator creator = _propertyBasedCreator;
PropertyValueBuffer buffer = creator.startBuilding(p, ctxt, ... | @ Override @ SuppressWarnings ( "resource" ) protected Object _deserializeUsingPropertyBased ( final JsonParser p , final DeserializationContext ctxt ) throws IOException { final PropertyBasedCreator creator = _propertyBasedCreator ; PropertyValueBuffer buffer = creator . startBuilding ( p , ctxt , _objectIdReader ) ; ... | @Override
@SuppressWarnings("resource")
protected Object _deserializeUsingPropertyBased(final JsonParser p, final DeserializationContext ctxt)
throws IOException
{
final PropertyBasedCreator creator = _propertyBasedCreator;
PropertyValueBuffer buffer = creator.startBuilding(p, ctxt, ... | @ Override @ SuppressWarnings ( "resource" ) protected Object _deserializeUsingPropertyBased ( final JsonParser p , final DeserializationContext ctxt ) throws IOException { final PropertyBasedCreator creator = _propertyBasedCreator ; PropertyValueBuffer buffer = creator . startBuilding ( p , ctxt , _objectIdReader ) ; ... |
JacksonDatabind | 27 | src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializer.java | 773 | 857 | Problem deserializing External Type Id if type id comes before POJO | (note: seems to be similar or related to https://github.com/FasterXML/jackson-module-afterburner/issues/58)
With 2.6, looks like handling of External Type Id is broken in some rare (?) cases; existing unit tests did not catch this. At this point I am speculating this is due to some refactoring, or change to use more e... | @SuppressWarnings("resource")
protected Object deserializeUsingPropertyBasedWithExternalTypeId(JsonParser p, DeserializationContext ctxt)
throws IOException
{
final ExternalTypeHandler ext = _externalTypeIdHandler.start();
final PropertyBasedCreator creator = _propertyBasedCreator;
... | @ SuppressWarnings ( "resource" ) protected Object deserializeUsingPropertyBasedWithExternalTypeId ( JsonParser p , DeserializationContext ctxt ) throws IOException { final ExternalTypeHandler ext = _externalTypeIdHandler . start ( ) ; final PropertyBasedCreator creator = _propertyBasedCreator ; PropertyValueBuffer buf... | @SuppressWarnings("resource")
protected Object deserializeUsingPropertyBasedWithExternalTypeId(JsonParser p, DeserializationContext ctxt)
throws IOException
{
final ExternalTypeHandler ext = _externalTypeIdHandler.start();
final PropertyBasedCreator creator = _propertyBasedCreator;
... | @ SuppressWarnings ( "resource" ) protected Object deserializeUsingPropertyBasedWithExternalTypeId ( JsonParser p , DeserializationContext ctxt ) throws IOException { final ExternalTypeHandler ext = _externalTypeIdHandler . start ( ) ; final PropertyBasedCreator creator = _propertyBasedCreator ; PropertyValueBuffer buf... |
Cli | 14 | src/java/org/apache/commons/cli2/option/GroupImpl.java | 237 | 282 | adding a FileValidator results in ClassCastException in parser.parseAndHelp(args) | When I add a FileValidator.getExistingFileInstance() to an Argument, I get a ClassCastException when I parse args.
Below is a testcase invoke with
java org.apache.commons.cli2.issues.CLI2Sample -classpath commons-cli-2.0-SNAPSHOT.jar --file-name path-to-an-existing-file
Run it and you get:
Exception in thread "m... | public void validate(final WriteableCommandLine commandLine)
throws OptionException {
// number of options found
int present = 0;
// reference to first unexpected option
Option unexpected = null;
for (final Iterator i = options.iterator(); i.hasNext();) {
fi... | public void validate ( final WriteableCommandLine commandLine ) throws OptionException { int present = 0 ; Option unexpected = null ; for ( final Iterator i = options . iterator ( ) ; i . hasNext ( ) ; ) { final Option option = ( Option ) i . next ( ) ; boolean validate = option . isRequired ( ) || option instanceof Gr... | public void validate(final WriteableCommandLine commandLine)
throws OptionException {
// number of options found
int present = 0;
// reference to first unexpected option
Option unexpected = null;
for (final Iterator i = options.iterator(); i.hasNext();) {
fi... | public void validate ( final WriteableCommandLine commandLine ) throws OptionException { int present = 0 ; Option unexpected = null ; for ( final Iterator i = options . iterator ( ) ; i . hasNext ( ) ; ) { final Option option = ( Option ) i . next ( ) ; boolean validate = option . isRequired ( ) || option instanceof Gr... |
@article{fakhoury2023towards,
title={Towards generating functionally correct code edits from natural language issue descriptions},
author={Fakhoury, Sarah and Chakraborty, Saikat and Musuvathi, Madan and Lahiri, Shuvendu K},
journal={arXiv preprint arXiv:2304.03816},
year={2023}
}