anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: apache/eventmesh
Issue: [Bug] Forget to override hashcode()

### Search before asking

- [X] I had searched in the [issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue) and found no similar issues.


### Environment

Mac

### EventMesh version

master

### What happened

This class overrides equals(Object), but does not override hashCode(). It just inherits the implementation of hashCode() from java.lang.Object. 

### How to reproduce

In module eventmesh-runtime
In class org.apache.eventmesh.runtime.core.protocol.tcp.client.session.Session
In method org.apache.eventmesh.runtime.core.protocol.tcp.client.session.Session.equals(Object)
In [lines 257-273]

### Debug logs

_No response_

### Are you willing to submit PR?

- [ ] Yes I am willing to submit a PR!

Changed files:
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/Session.java

diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/Session.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/Session.java
index 52b8d751b..5d2424988 100644
--- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/Session.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/Session.java
@@ -280,7 +280,24 @@ public class Session {
         }
         return true;
     }
+    
+    @Override
+    public int hashCode() {
+        int result = 1001;   //primeNumber
+        if (null != client) {
+            result += 31 * result + Objects.hash(client);
+        }
+
+        if (null != context) {
+            result += 31 * result + Objects.hash(context);
+        }
 
+        if (null != sessionState) {
+            result += 31 * result + Objects.hash(sessionState);
+        }
+        return result;
+    }
+    
     public WeakReference<ClientGroupWrapper> getClientGroupWrapper() {
         return clientGroupWrapper;
     }
Repository: apache/eventmesh
Issue: [Bug] Incorrect validation may cause the batch send of events to fail

### Search before asking

- [X] I had searched in the [issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue) and found no similar issues.


### Environment

Windows

### EventMesh version

master

### What happened

path is `org/apache/eventmesh/runtime/core/protocol/http/processor/BatchSendMessageProcessor.java`

i think this is a bug when i read code of master branch. This will cause the batch send of events to fail.
```java
            if (eventData != null || StringUtils.isBlank(batchId)
                    || StringUtils.isBlank(producerGroup)
                    || eventSize != eventList.size()) {
                responseEventMeshCommand = asyncContext.getRequest().createHttpCommandResponse(
                        sendMessageBatchResponseHeader,
                        SendMessageBatchResponseBody.buildBody(EventMeshRetCode.EVENTMESH_PROTOCOL_BODY_ERR.getRetCode(),
                                EventMeshRetCode.EVENTMESH_PROTOCOL_BODY_ERR.getErrMsg()));
                asyncContext.onComplete(responseEventMeshCommand);
                return;
            }
```
The validation of `eventData` should be changed to '==null'.

### How to reproduce

just read the code

### Debug logs

_No response_

### Are you willing to submit PR?

- [X] Yes I am willing to submit a PR!

Changed files:
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/BatchSendMessageProcessor.java

diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/BatchSendMessageProcessor.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/BatchSendMessageProcessor.java
index 8ae17b524..434be4c59 100644
--- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/BatchSendMessageProcessor.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/BatchSendMessageProcessor.java
@@ -177,7 +177,7 @@ public class BatchSendMessageProcessor implements HttpRequestProcessor {
             eventSize = Integer.parseInt(Objects.requireNonNull(event.getExtension(SendMessageBatchRequestBody.SIZE)).toString());
             CloudEventData eventData = event.getData();
 
-            if (eventData != null || StringUtils.isBlank(batchId)
+            if (eventData == null || StringUtils.isBlank(batchId)
                 || StringUtils.isBlank(producerGroup)
                 || eventSize != eventList.size()) {
                 responseEventMeshCommand = asyncContext.getRequest().createHttpCommandResponse(
Repository: apache/eventmesh
Issue: [Bug] Kafka Consumer Closing Twice

### Search before asking

- [X] I had searched in the [issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue) and found no similar issues.


### Environment

Mac

### EventMesh version

master

### What happened

It is possible that the Kafka consumer will be closed twice. It will raise an `IllegalStateException` when being closed again.

### How to reproduce

1. Run Eventmesh on Kafka
2. Call `shutdown` to the consumer implementation

The exception will be raised. 

### Debug logs

_No response_

### Are you willing to submit PR?

- [X] Yes I am willing to submit a PR!

Changed files:
eventmesh-connector-plugin/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/consumer/ConsumerImpl.java

diff --git a/eventmesh-connector-plugin/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/consumer/ConsumerImpl.java b/eventmesh-connector-plugin/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/consumer/ConsumerImpl.java
index eb370c459..99c492d06 100644
--- a/eventmesh-connector-plugin/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/consumer/ConsumerImpl.java
+++ b/eventmesh-connector-plugin/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/consumer/ConsumerImpl.java
@@ -82,7 +82,9 @@ public class ConsumerImpl {
 
     public synchronized void shutdown() {
         if (this.started.compareAndSet(true, false)) {
-            this.kafkaConsumer.close();
+            // Shutdown the executor and interrupt any running tasks
+            kafkaConsumerRunner.shutdown();
+            executorService.shutdown();
         }
     }
Repository: apache/eventmesh
Issue: [Bug] This method needlessly uses a String literal as a Charset encoding [SendSyncMessageProcessor]

### Search before asking

- [X] I had searched in the [issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue) and found no similar issues.


### Environment

Linux

### EventMesh version

master

### What happened

This method needlessly uses a String literal as a Charset encoding [SendSyncMessageProcessor]

### How to reproduce

SendSyncMessageProcessor类中第283行不要指定"UTF-8"，使用StandardCharsets.UTF_8。

### Debug logs

_No response_

### Are you willing to submit PR?

- [X] Yes I am willing to submit a PR!

Changed files:
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/SendSyncMessageProcessor.java

diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/SendSyncMessageProcessor.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/SendSyncMessageProcessor.java
index dfd79556a..436006976 100644
--- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/SendSyncMessageProcessor.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/SendSyncMessageProcessor.java
@@ -281,7 +281,7 @@ public class SendSyncMessageProcessor implements HttpRequestProcessor {
                                         String.valueOf(System.currentTimeMillis()))
                                 .build();
                         final String rtnMsg = new String(Objects.requireNonNull(event.getData()).toBytes(),
-                                EventMeshConstants.DEFAULT_CHARSET);
+                                StandardCharsets.UTF_8);
 
                         HttpCommand succ = asyncContext.getRequest().createHttpCommandResponse(
                                 sendMessageResponseHeader,
Repository: apache/eventmesh
Issue: [Bug] usage "in.array()" in Codec.java will cause exception

### Search before asking

- [X] I had searched in the [issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue) and found no similar issues.


### Environment

Windows

### EventMesh version

master

### What happened

When exception happen while Decoder is decoding inbound stream, code org/apache/eventmesh/common/protocol/tcp/codec/Codec.java:137 will be executed and print out a log, however, because Decoder extends from the ReplayingDecoder, and it will take ReplayingDecoderByteBuf as inbound stream, which will throw UnsupportedOperationException when method array() is being called, causing another exception at this time.

### How to reproduce

1. try to make some exception during the Decoder is decoding inbound stream.
2. Then the exception will be catch and shown in console.

### Debug logs

_No response_

### Are you willing to submit PR?

- [X] Yes I am willing to submit a PR!

Changed files:
eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/tcp/codec/Codec.java

diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/tcp/codec/Codec.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/tcp/codec/Codec.java
index 296d6c50a..16cc962eb 100644
--- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/tcp/codec/Codec.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/tcp/codec/Codec.java
@@ -29,7 +29,6 @@ import org.apache.eventmesh.common.utils.JsonUtils;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
 
-import java.nio.charset.Charset;
 import java.util.Arrays;
 import java.util.List;
 import java.util.TimeZone;
@@ -134,7 +133,7 @@ public class Codec {
                 Package pkg = new Package(header, body);
                 out.add(pkg);
             } catch (Exception e) {
-                log.error("decode error| receive: {}.", deserializeBytes(in.array()));
+                log.error("tcp decoder error: ", e);
                 throw e;
             }
         }
Repository: apache/eventmesh
Issue: [Bug] Fix IOException in SSLContextFactory

### Search before asking

- [X] I had searched in the [issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue) and found no similar issues.


### Environment

Mac

### EventMesh version

master

### What happened

Unreported exception IOException must be caught or declared to be thrown.


### How to reproduce

When inputStream.close() is not enclosed in a try-catch block, IOException occurs

### Debug logs

_No response_

### Are you willing to submit PR?

- [X] Yes I am willing to submit a PR!

Changed files:
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/SSLContextFactory.java

diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/SSLContextFactory.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/SSLContextFactory.java
index 446155a1b..f90c1521b 100644
--- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/SSLContextFactory.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/SSLContextFactory.java
@@ -25,6 +25,7 @@ import org.apache.eventmesh.runtime.constants.EventMeshConstants;
 import org.apache.commons.lang3.StringUtils;
 
 import java.io.File;
+import java.io.IOException;
 import java.io.InputStream;
 import java.nio.file.Files;
 import java.nio.file.Paths;
@@ -49,7 +50,7 @@ public class SSLContextFactory {
 
     public static SSLContext getSslContext(EventMeshHTTPConfiguration eventMeshHttpConfiguration) {
         SSLContext sslContext;
-        InputStream inputStream;
+        InputStream inputStream = null;
         try {
             protocol = eventMeshHttpConfiguration.eventMeshServerSSLProtocol;
 
@@ -64,7 +65,7 @@ public class SSLContextFactory {
             KeyStore keyStore = KeyStore.getInstance("JKS");
             inputStream = Files.newInputStream(Paths.get(EventMeshConstants.EVENTMESH_CONF_HOME
                                               + File.separator
-                                              + fileName), StandardOpenOption.READ)
+                                              + fileName), StandardOpenOption.READ);
             keyStore.load(inputStream, filePass);
             KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
             kmf.init(keyStore, filePass);
@@ -72,9 +73,14 @@ public class SSLContextFactory {
         } catch (Exception e) {
             httpLogger.warn("sslContext init failed", e);
             sslContext = null;
-        } finally {
+        }
+        finally {
             if (inputStream != null) {
-                inputStream.close();
+                try{
+                    inputStream.close();
+                }catch(IOException e){
+                    httpLogger.warn("IOException found", e);
+                }
             }
         }
         return sslContext;
Repository: apache/eventmesh
Issue: [Bug] ConsumerGroup subscribes multiple topics, only first topic can invoke url

### Search before asking

- [X] I had searched in the [issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue) and found no similar issues.


### Environment

Windows

### EventMesh version

master

### What happened

When one consumer group subscribes multiple topics, only first subscription can invoke the url.

### How to reproduce

You can subscribe multiple topics by one consumer group, then publish an event with second topic. You will find that first topic works, but the second topic happens nothing.

### Debug logs

_No response_

### Are you willing to submit PR?

- [X] Yes I am willing to submit a PR!

Changed files:
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/consumer/EventMeshConsumer.java
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/consumer/ConsumerGroupManager.java

diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/consumer/ConsumerGroupManager.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/consumer/ConsumerGroupManager.java
index 7d4ddab9b..640ed86ac 100644
--- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/consumer/ConsumerGroupManager.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/consumer/ConsumerGroupManager.java
@@ -78,6 +78,7 @@ public class ConsumerGroupManager {
         }
 
         this.consumerGroupConfig = consumerGroupConfig;
+        this.eventMeshConsumer.setConsumerGroupConf(consumerGroupConfig);
         init();
         start();
     }
diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/consumer/EventMeshConsumer.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/consumer/EventMeshConsumer.java
index c571413a8..a4d57f291 100644
--- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/consumer/EventMeshConsumer.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/consumer/EventMeshConsumer.java
@@ -298,6 +298,10 @@ public class EventMeshConsumer {
         return consumerGroupConf;
     }
 
+    public void setConsumerGroupConf(ConsumerGroupConf consumerGroupConf) {
+        this.consumerGroupConf = consumerGroupConf;
+    }
+
     public EventMeshHTTPServer getEventMeshHTTPServer() {
         return eventMeshHTTPServer;
     }
Repository: ebean-orm/ebean
Issue: LimitOffsetSqlLimiter applies 'LIMIT 0' if firstRow is set only.

When `Query::setFirstRow` is used, it's expected to produce the OFFSET only. However, it produces LIMIT clause also.

## Example:
```java
  someQuery.setFirstRow(5);
```

### Expected behavior
The generated query contains `OFFSET 5` and no `LIMIT` at all
### Actual behavior
The generated query contains `LIMIT 0 OFFSET 5`

I've created PR that fixes this issue: https://github.com/ebean-orm/ebean/pull/2904


Changed files:
ebean-api/src/main/java/io/ebean/config/dbplatform/LimitOffsetSqlLimiter.java, ebean-test/src/test/java/org/tests/basic/TestLimitQuery.java

diff --git a/ebean-api/src/main/java/io/ebean/config/dbplatform/LimitOffsetSqlLimiter.java b/ebean-api/src/main/java/io/ebean/config/dbplatform/LimitOffsetSqlLimiter.java
index 63534a27f..846ee8056 100644
--- a/ebean-api/src/main/java/io/ebean/config/dbplatform/LimitOffsetSqlLimiter.java
+++ b/ebean-api/src/main/java/io/ebean/config/dbplatform/LimitOffsetSqlLimiter.java
@@ -31,12 +31,12 @@ public class LimitOffsetSqlLimiter implements SqlLimiter {
     int firstRow = request.getFirstRow();
     int maxRows = request.getMaxRows();
 
-    if (maxRows > 0 || firstRow > 0) {
+    if (maxRows > 0) {
       sb.append(" ").append(LIMIT).append(" ").append(maxRows);
-      if (firstRow > 0) {
-        sb.append(" ").append(OFFSET).append(" ");
-        sb.append(firstRow);
-      }
+    }
+    if (firstRow > 0) {
+      sb.append(" ").append(OFFSET).append(" ");
+      sb.append(firstRow);
     }
 
     String sql = request.getDbPlatform().completeSql(sb.toString(), request.getOrmQuery());
diff --git a/ebean-test/src/test/java/org/tests/basic/TestLimitQuery.java b/ebean-test/src/test/java/org/tests/basic/TestLimitQuery.java
index 63183c7db..090efec8a 100644
--- a/ebean-test/src/test/java/org/tests/basic/TestLimitQuery.java
+++ b/ebean-test/src/test/java/org/tests/basic/TestLimitQuery.java
@@ -40,7 +40,7 @@ public class TestLimitQuery extends BaseTestCase {
     String sql = query.getGeneratedSql();
     if (isH2()) {
       assertThat(sql).contains("offset 3");
-      assertThat(sql).contains("limit 0");
+      assertThat(sql).doesNotContain("limit");
     }
   }
Repository: ebean-orm/ebean
Issue: NullPointerException in EntityBeanIntercept

## Expected behavior
Clean execution.

## Actual behavior
Works more than 99.9% of the times, *rarely* a stacktrace with NPE. Approx once every >1'000 execution fails.
I don't think I've seen it more than one time for any unique test case. We have not upgraded production yet, so this is only in tests.

### Steps to reproduce

Not sure. I *suspect* a race condition, but we are completely unable to reproduce it reliably.

We do NOT have any pre-getter interceptors registered, but one IS attached (internal ebean hook).

Could it be because we do multiple saves on the same object instance?
Another possible reason it happens for us is that in tests we do 
`serverConfig.backgroundExecutorSchedulePoolSize = 1`, because we want to make sure all background tasks have been finished before moving on to the next test.

The code that blows up is trivial:
```kotlin
        if (bean.deleted) {
```

```console
Stacktrace
java.lang.NullPointerException
	at io.ebean.bean.EntityBeanIntercept.preGetterCallback(EntityBeanIntercept.java:917)
	at io.ebean.bean.EntityBeanIntercept.preGetter(EntityBeanIntercept.java:932)
	at OurDBO._ebean_get_deleted(OurDBO.kt:999)
	at OurDBO.getDeleted(OurDBO.kt:999)
	at OurBeanPersistListener.inserted(OurBeanPersistListener.kt:999)
	at io.ebeaninternal.server.core.PersistRequestBean.notifyLocalPersistListener(PersistRequestBean.java:565)
	at io.ebeaninternal.server.transaction.PostCommitProcessing.localPersistListenersNotify(PostCommitProcessing.java:160)
	at io.ebeaninternal.server.transaction.PostCommitProcessing.lambda$backgroundNotify$0(PostCommitProcessing.java:134)
	at io.ebeaninternal.server.core.DefaultBackgroundExecutor.lambda$execute$0(DefaultBackgroundExecutor.java:43)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)```


Changed files:
src/main/java/io/ebean/bean/EntityBeanIntercept.java

diff --git a/src/main/java/io/ebean/bean/EntityBeanIntercept.java b/src/main/java/io/ebean/bean/EntityBeanIntercept.java
index 1b03b47be..837d3db29 100644
--- a/src/main/java/io/ebean/bean/EntityBeanIntercept.java
+++ b/src/main/java/io/ebean/bean/EntityBeanIntercept.java
@@ -913,6 +913,7 @@ public final class EntityBeanIntercept implements Serializable {
   }
 
   private void preGetterCallback(int propertyIndex) {
+    PreGetterCallback preGetterCallback = this.preGetterCallback;
     if (preGetterCallback != null) {
       preGetterCallback.preGetterTrigger(propertyIndex);
     }
Repository: knowm/xchart
Issue: IndexOutOfBoundsException introduced in 3.7.0 or 3.8.0

Hi, attached date+value series can be plotted in 3.6.6 without any errors. Yet in 3.8.0 (cannot use 3.7.0 as this release doesn't contain some of the class that 3.6.6 and 3.8.0 have) I got:

`java.lang.IndexOutOfBoundsException: Index 46 out of bounds for length 46
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
	at java.base/java.util.Objects.checkIndex(Objects.java:372)
	at java.base/java.util.ArrayList.get(ArrayList.java:458)
	at org.knowm.xchart.internal.chartpart.AxisTickCalculator_Date.calculate(AxisTickCalculator_Date.java:201)
	at org.knowm.xchart.internal.chartpart.AxisTickCalculator_Date.<init>(AxisTickCalculator_Date.java:103)
	at org.knowm.xchart.internal.chartpart.Axis.getAxisTickCalculator(Axis.java:454)
	at org.knowm.xchart.internal.chartpart.Axis.getXAxisHeightHint(Axis.java:289)
	at org.knowm.xchart.internal.chartpart.Axis.preparePaint(Axis.java:155)
	at org.knowm.xchart.internal.chartpart.AxisPair.paint(AxisPair.java:121)
	at org.knowm.xchart.XYChart.paint(XYChart.java:416)
	at org.knowm.xchart.BitmapEncoder.getBufferedImage(BitmapEncoder.java:281)
	at org.knowm.xchart.BitmapEncoder.saveBitmap(BitmapEncoder.java:134)
	at org.knowm.xchart.BitmapEncoder.saveBitmap(BitmapEncoder.java:109)
`

which corresponds to unverified use of index in a loop here:

`double gridStep =
          timeSpans.get(++index).getUnitAmount()
              * timeSpans.get(index).getMagnitude(); // in time units (ms)
              *
`

This error most probably has been introduced as part of this fix: https://github.com/knowm/XChart/issues/527 (@timmolter)


example data that leads to this error:

[in.csv](https://github.com/knowm/XChart/files/6569374/in.csv)


Changed files:
xchart/src/main/java/org/knowm/xchart/internal/chartpart/AxisTickCalculator_Date.java

diff --git a/xchart/src/main/java/org/knowm/xchart/internal/chartpart/AxisTickCalculator_Date.java b/xchart/src/main/java/org/knowm/xchart/internal/chartpart/AxisTickCalculator_Date.java
index 226c2350..f19ead80 100644
--- a/xchart/src/main/java/org/knowm/xchart/internal/chartpart/AxisTickCalculator_Date.java
+++ b/xchart/src/main/java/org/knowm/xchart/internal/chartpart/AxisTickCalculator_Date.java
@@ -242,6 +242,9 @@ class AxisTickCalculator_Date extends AxisTickCalculator_ {
         // }
       }
       //      System.out.println("************");
+      if(index >= timeSpans.size() - 1)
+        break; // We reached the end, even though we might not yet have the result we want,
+               // continuing will lead to an Exception!
     } while (skip
         || !areAllTickLabelsUnique(tickLabels)
         || !willLabelsFitInTickSpaceHint(tickLabels, gridStepInChartSpace));
Repository: knowm/xchart
Issue: Impossible to save jpg images

After resolving issue 488 adding alpha channels, it is no longer possible to save jpg files. This (implementation of this) format doesn't support alpha channels.

Changed files:
xchart/src/main/java/org/knowm/xchart/BitmapEncoder.java
xchart-demo/src/main/java/org/knowm/xchart/standalone/issues/TestForIssue488.java

diff --git a/xchart-demo/src/main/java/org/knowm/xchart/standalone/issues/TestForIssue488.java b/xchart-demo/src/main/java/org/knowm/xchart/standalone/issues/TestForIssue488.java
index 144ac4a2..9c5d160d 100644
--- a/xchart-demo/src/main/java/org/knowm/xchart/standalone/issues/TestForIssue488.java
+++ b/xchart-demo/src/main/java/org/knowm/xchart/standalone/issues/TestForIssue488.java
@@ -28,6 +28,12 @@ public class TestForIssue488 {
     chart.getStyler().setSeriesColors(sliceColors);
     chart.getStyler().setChartTitleBoxVisible(false);
     chart.getStyler().setHasAnnotations(false);
+    chart.getStyler().setChartBackgroundColor(new Color(255, 255, 255));
+    //    chart.getStyler().setChartBackgroundColor(new Color(0, 255, 0, 25));
+    //    chart.getStyler().setChartBackgroundColor(new Color(0, 255, 0));
+    chart.getStyler().setPlotBackgroundColor(new Color(255, 255, 255));
+//        chart.getStyler().setPlotBackgroundColor(new Color(0, 0, 255, 20));
+//        chart.getStyler().setPlotBackgroundColor(new Color(0, 0, 255));
     //    chart.getStyler().setChartBackgroundColor(new Color(255, 255, 255));
     //    chart.getStyler().setChartBackgroundColor(new Color(0, 255, 0, 25));
     //    chart.getStyler().setChartBackgroundColor(new Color(0, 255, 0));
diff --git a/xchart/src/main/java/org/knowm/xchart/BitmapEncoder.java b/xchart/src/main/java/org/knowm/xchart/BitmapEncoder.java
index d6670b59..2e9cf41c 100644
--- a/xchart/src/main/java/org/knowm/xchart/BitmapEncoder.java
+++ b/xchart/src/main/java/org/knowm/xchart/BitmapEncoder.java
@@ -275,7 +275,7 @@ public final class BitmapEncoder {
   public static BufferedImage getBufferedImage(Chart chart) {
 
     BufferedImage bufferedImage =
-        new BufferedImage(chart.getWidth(), chart.getHeight(), BufferedImage.TYPE_INT_ARGB);
+        new BufferedImage(chart.getWidth(), chart.getHeight(), BufferedImage.TYPE_INT_RGB);
     Graphics2D graphics2D = bufferedImage.createGraphics();
     chart.paint(graphics2D, chart.getWidth(), chart.getHeight());
     return bufferedImage;
Repository: mit-cml/appinventor-sources
Issue: Update phone call to work on latest Android OS

**Describe the bug**

the make phone call method does nothing.

One possible approach is to use activity starter?
Is there anything we can do for iOS



Changed files:
appinventor/components/src/com/google/appinventor/components/runtime/PhoneCall.java

diff --git a/appinventor/components/src/com/google/appinventor/components/runtime/PhoneCall.java b/appinventor/components/src/com/google/appinventor/components/runtime/PhoneCall.java
index 238106d00..c82603167 100644
--- a/appinventor/components/src/com/google/appinventor/components/runtime/PhoneCall.java
+++ b/appinventor/components/src/com/google/appinventor/components/runtime/PhoneCall.java
@@ -26,6 +26,7 @@ import com.google.appinventor.components.annotations.SimpleFunction;
 import com.google.appinventor.components.annotations.SimpleObject;
 import com.google.appinventor.components.annotations.SimpleProperty;
 import com.google.appinventor.components.annotations.UsesPermissions;
+import com.google.appinventor.components.annotations.UsesQueries;
 import com.google.appinventor.components.common.ComponentCategory;
 import com.google.appinventor.components.common.EndedStatus;
 import com.google.appinventor.components.common.PropertyTypeConstants;
@@ -34,6 +35,10 @@ import com.google.appinventor.components.common.YaVersion;
 import com.google.appinventor.components.runtime.util.BulkPermissionRequest;
 import com.google.appinventor.components.runtime.util.PhoneCallUtil;
 
+import com.google.appinventor.components.annotations.androidmanifest.ActionElement;
+import com.google.appinventor.components.annotations.androidmanifest.ActivityElement;
+import com.google.appinventor.components.annotations.androidmanifest.IntentFilterElement;
+
 /**
  * ![PhoneCall component icon](images/phonecall.png)
  *
@@ -80,6 +85,11 @@ import com.google.appinventor.components.runtime.util.PhoneCallUtil;
     nonVisible = true,
     iconName = "images/phoneCall.png")
 @SimpleObject
+@UsesQueries(intents = {
+    @IntentFilterElement(
+      actionElements = {@ActionElement(name = Intent.ACTION_DIAL)}
+      )
+  })
 public class PhoneCall extends AndroidNonvisibleComponent implements Component, OnDestroyListener,
     ActivityResultListener {