nus-yam/ex-repair huggingface dataset:
Program: 25141
Project: 25141
Buggy source:
private CommandStatus verifyState(CommandSender sender,String... args){
  if (this.restriction != null && !this.restriction.verifySender(sender)) {
    return this.restriction;
  }
  if (!this.allowProxies && sender instanceof ProxiedCommandSender) {
    return CommandStatus.NO_PROXIES;
  }
  if (args.length < this.minArgs) {
    return CommandStatus.BAD_ARGS;
  }
  return null;
}

Fixed version (ground truth):
private CommandStatus verifyState(CommandNode<?> child,CommandSender sender,String... args){
  if (child.restriction != null && !child.restriction.verifySender(sender)) {
    return this.restriction;
  }
  if (!child.allowProxies && sender instanceof ProxiedCommandSender) {
    return CommandStatus.NO_PROXIES;
  }
  if (args.length < child.minArgs) {
    return CommandStatus.BAD_ARGS;
  }
  return null;
}
Program: 25142
Project: 25142
Buggy source:
public <K1 extends K,V1 extends V>Builder<K1,V1> onExpiry(Consumer<? extends ExpiringEntry<? super K,? super V>> expired){
  this.onExpire=expired;
  return (Builder<K1,V1>)this;
}

Fixed version (ground truth):
public <K1 extends K,V1 extends V>Builder<K1,V1> onExpiry(Consumer<? extends ExpiringEntry<? super K,? super V>> expired){
  return (Builder<K1,V1>)this;
}
Program: 25143
Project: 25143
Buggy source:
@Override public void onDisable(){
  Scheduler.cancelAllTasks();
}

Fixed version (ground truth):
@Override public void onDisable(){
  Scheduler.cancelAllTasks();
  Scheduler.getService().shutdown();
}
Program: 25144
Project: 25144
Buggy source:
/** 
 * Runs a Callable
 * @since 0.1.0
 * @version 0.1.0
 * @param c The callable to execute
 * @param delay Time (in seconds) to wait before execution
 * @return The scheduled Task
 */
public static ScheduledFuture<?> runCallable(Callable<?> c,long delay){
  ScheduledFuture<?> sch=Scheduler.es.schedule(c,delay,TimeUnit.SECONDS);
  Scheduler.executives.add(sch);
  return sch;
}

Fixed version (ground truth):
/** 
 * Runs a Callable
 * @since 0.1.0
 * @version 0.1.0
 * @param c The callable to execute
 * @param delay Time (in seconds) to wait before execution
 * @return The scheduled Task
 */
public static ScheduledFuture<?> runCallable(Callable<?> c,long delay){
  ScheduledFuture<?> sch=Scheduler.getService().schedule(c,delay,TimeUnit.SECONDS);
  Scheduler.executives.add(sch);
  return sch;
}
Program: 25145
Project: 25145
Buggy source:
/** 
 * Cancels all running tasks/threads and clears the cached queue.
 * @since 0.1.0
 * @version 0.1.0
 */
public static void cancelAllTasks(){
  Scheduler.executives.forEach(s -> s.cancel(false));
  Scheduler.executives.clear();
  try {
    Scheduler.getService().awaitTermination(1,TimeUnit.SECONDS);
    Scheduler.getService().shutdown();
  }
 catch (  InterruptedException ex) {
    DebugUtil.error("String_Node_Str",ex);
  }
}

Fixed version (ground truth):
/** 
 * Cancels all running tasks/threads and clears the cached queue.
 * @since 0.1.0
 * @version 0.1.0
 */
public static void cancelAllTasks(){
  Scheduler.executives.forEach(s -> s.cancel(false));
  Scheduler.executives.clear();
  try {
    Scheduler.getService().awaitTermination(2,TimeUnit.SECONDS);
  }
 catch (  InterruptedException ex) {
    DebugUtil.error("String_Node_Str",ex);
  }
}
Program: 25146
Project: 25146
Buggy source:
/** 
 * Runs a repeating asynchronous task
 * @since 0.1.0
 * @version 0.1.0
 * @param r The runnable to execute
 * @param startAfter Time (in seconds) to wait before execution
 * @param delay Time (in seconds) between execution to wait
 * @return The scheduled Task
 */
public static ScheduledFuture<?> runAsyncTaskRepeat(Runnable r,long startAfter,long delay){
  ScheduledFuture<?> sch=Scheduler.es.scheduleWithFixedDelay(r,startAfter,delay,TimeUnit.SECONDS);
  Scheduler.executives.add(sch);
  return sch;
}

Fixed version (ground truth):
/** 
 * Runs a repeating asynchronous task
 * @since 0.1.0
 * @version 0.1.0
 * @param r The runnable to execute
 * @param startAfter Time (in seconds) to wait before execution
 * @param delay Time (in seconds) between execution to wait
 * @return The scheduled Task
 */
public static ScheduledFuture<?> runAsyncTaskRepeat(Runnable r,long startAfter,long delay){
  ScheduledFuture<?> sch=Scheduler.getService().scheduleWithFixedDelay(r,startAfter,delay,TimeUnit.SECONDS);
  Scheduler.executives.add(sch);
  return sch;
}
Program: 25147
Project: 25147
Buggy source:
/** 
 * Returns the underlying   {@link ScheduledExecutorService} used for thisutility class
 * @since 0.1.0
 * @version 0.1.0
 * @return The underlying {@link ScheduledExecutorService}
 */
public static ScheduledExecutorService getService(){
  return Scheduler.es;
}

Fixed version (ground truth):
/** 
 * Returns the underlying   {@link ScheduledExecutorService} used for thisutility class
 * @since 0.1.0
 * @version 0.1.0
 * @return The underlying {@link ScheduledExecutorService}
 */
public static ScheduledExecutorService getService(){
  if (Scheduler.es.isShutdown()) {
    Scheduler.es=Executors.newScheduledThreadPool(10);
  }
  return Scheduler.es;
}
Program: 25148
Project: 25148
Buggy source:
/** 
 * Runs a single asynchronous task
 * @since 0.1.0
 * @version 0.1.0
 * @param r The runnable to execute
 * @param delay Time (in seconds) to wait before execution
 * @return The scheduled Task
 */
public static ScheduledFuture<?> runAsyncTask(Runnable r,long delay){
  ScheduledFuture<?> sch=Scheduler.es.schedule(r,delay,TimeUnit.SECONDS);
  Scheduler.executives.add(sch);
  return sch;
}

Fixed version (ground truth):
/** 
 * Runs a single asynchronous task
 * @since 0.1.0
 * @version 0.1.0
 * @param r The runnable to execute
 * @param delay Time (in seconds) to wait before execution
 * @return The scheduled Task
 */
public static ScheduledFuture<?> runAsyncTask(Runnable r,long delay){
  ScheduledFuture<?> sch=Scheduler.getService().schedule(r,delay,TimeUnit.SECONDS);
  Scheduler.executives.add(sch);
  return sch;
}
Program: 25149
Project: 25149
Buggy source:
/** 
 * Returns the save location for passed   {@link PluginFile} argument
 * @since 0.1.0
 * @version 0.1.0
 * @param clazz
 * @return 
 */
public static File getFileLocation(Class<? extends PluginFile> clazz){
  if (!(AnnotationUtil.hasAnnotation(clazz,PluginClass.class) && AnnotationUtil.hasAnnotation(clazz,RelativePath.class))) {
    throw new IllegalStateException("String_Node_Str");
  }
  return new File(AnnotationUtil.getPlugin(clazz).getDataFolder(),clazz.getAnnotation(RelativePath.class).value());
}

Fixed version (ground truth):
/** 
 * Returns the save location for passed   {@link PluginFile} argument
 * @since 0.1.0
 * @version 0.1.0
 * @param clazz
 * @return 
 */
public static File getFileLocation(Class<? extends PluginFile> clazz){
  if (!(AnnotationUtil.hasAnnotation(clazz,PluginClass.class) && AnnotationUtil.hasAnnotation(clazz,RelativePath.class))) {
    throw new IllegalStateException("String_Node_Str" + clazz.getName() + "String_Node_Str");
  }
  return new File(AnnotationUtil.getPlugin(clazz).getDataFolder(),clazz.getAnnotation(RelativePath.class).value());
}
Program: 25150
Project: 25150
Buggy source:
protected final String generateSeed(int length){
  StringBuilder sb=new StringBuilder();
  ChatColor[] vals=ChatColor.values();
  Random rand=new Random();
  for (int i=0; i < length; i++) {
    sb.append('&').append(vals[rand.nextInt(vals.length)]);
  }
  return ChatColor.translateAlternateColorCodes('&',sb.toString());
}

Fixed version (ground truth):
protected final String generateSeed(int length){
  StringBuilder sb=new StringBuilder();
  ChatColor[] vals=ChatColor.values();
  Random rand=new Random();
  for (int i=0; i < length; i++) {
    sb.append(vals[rand.nextInt(vals.length)]);
  }
  return sb.toString();
}
Program: 25151
Project: 25151
Buggy source:
@Override public void run(){
  CoverageUtil.marks.entrySet().forEach((ent) -> {
    try {
      File data=new File(ent.getKey().getDataFolder(),"String_Node_Str" + File.separator);
      File log=new File(data,"String_Node_Str");
      if (log.exists()) {
        Files.move(log,new File(data,"String_Node_Str" + log.lastModified() + "String_Node_Str"));
      }
      try (FileWriter f=new FileWriter(log)){
        f.write(CoverageUtil.serialize(ent.getValue()));
      }
     }
 catch (    IOException ex) {
      DebugUtil.error(String.format("String_Node_Str",ent.getKey().getName()),ex);
    }
  }
);
}

Fixed version (ground truth):
@Override public void run(){
  System.out.println("String_Node_Str");
  CoverageUtil.marks.entrySet().forEach((ent) -> {
    System.out.println("String_Node_Str" + ent.getKey().getName() + "String_Node_Str");
    try {
      File data=new File(ent.getKey().getDataFolder(),"String_Node_Str" + File.separator);
      data.mkdirs();
      File log=new File(data,"String_Node_Str");
      if (log.exists()) {
        Files.move(log,new File(data,"String_Node_Str" + log.lastModified() + "String_Node_Str"));
      }
      try (FileWriter f=new FileWriter(log)){
        f.write(CoverageUtil.serialize(ent.getValue()));
      }
     }
 catch (    IOException ex) {
      System.out.println(String.format("String_Node_Str",ent.getKey().getName()));
      ex.printStackTrace();
    }
  }
);
}
Program: 25154
Project: 25154
Buggy source:
@Override public void handleError(ClientHttpResponse response){
  ErrorStructure error=null;
  try {
    error=gdcErrorExtractor.extractData(response);
  }
 catch (  RestClientException|IOException ignored) {
  }
  final String requestId=response.getHeaders().getFirst(GDC_REQUEST_ID_HEADER);
  int statusCode;
  try {
    statusCode=response.getRawStatusCode();
  }
 catch (  IOException e) {
    statusCode=0;
  }
  String statusText;
  try {
    statusText=response.getStatusText();
  }
 catch (  IOException e) {
    statusText=null;
  }
  throw new GoodDataRestException(statusCode,requestId,statusText,error);
}

Fixed version (ground truth):
@Override public void handleError(ClientHttpResponse response){
  ErrorStructure error=null;
  try {
    error=gdcErrorExtractor.extractData(response);
  }
 catch (  RestClientException|IOException|HttpMessageConversionException ignored) {
  }
  final String requestId=response.getHeaders().getFirst(GDC_REQUEST_ID_HEADER);
  int statusCode;
  try {
    statusCode=response.getRawStatusCode();
  }
 catch (  IOException e) {
    statusCode=0;
  }
  String statusText;
  try {
    statusText=response.getStatusText();
  }
 catch (  IOException e) {
    statusText=null;
  }
  throw new GoodDataRestException(statusCode,requestId,statusText,error);
}
Program: 25155
Project: 25155
Buggy source:
/** 
 * Construct a GoodDataRestException with specified details.
 * @param statusCode the HTTP status code of the response
 * @param requestId  the GoodData request ID (from header)
 * @param statusText the HTTP status text of the response
 * @param error      the GoodData REST API error structure
 */
public GoodDataRestException(int statusCode,String requestId,String statusText,GdcError error){
  this(statusCode,error != null && error.getRequestId() != null ? error.getRequestId() : requestId,error != null && error.getMessage() != null ? error.getFormattedMessage() : statusText,error != null ? error.getComponent() : null,error != null ? error.getErrorClass() : null,error != null ? error.getErrorCode() : null);
}

Fixed version (ground truth):
/** 
 * Construct a GoodDataRestException with specified details.
 * @param statusCode the HTTP status code of the response
 * @param requestId  the GoodData request ID (from header)
 * @param statusText the HTTP status text of the response
 * @param error      the GoodData REST API error structure
 */
public GoodDataRestException(int statusCode,String requestId,String statusText,ErrorStructure error){
  this(statusCode,error != null && error.getRequestId() != null ? error.getRequestId() : requestId,error != null && error.getMessage() != null ? error.getFormattedMessage() : statusText,error != null ? error.getComponent() : null,error != null ? error.getErrorClass() : null,error != null ? error.getErrorCode() : null);
}
Program: 25156
Project: 25156
Buggy source:
public ResponseErrorHandler(List<HttpMessageConverter<?>> messageConverters){
  gdcErrorExtractor=new HttpMessageConverterExtractor<>(GdcError.class,noNullElements(messageConverters,"String_Node_Str"));
}

Fixed version (ground truth):
public ResponseErrorHandler(List<HttpMessageConverter<?>> messageConverters){
  gdcErrorExtractor=new HttpMessageConverterExtractor<>(ErrorStructure.class,noNullElements(messageConverters,"String_Node_Str"));
}
Program: 25157
Project: 25157
Buggy source:
@Override public void handleError(ClientHttpResponse response){
  GdcError error=null;
  try {
    error=gdcErrorExtractor.extractData(response);
  }
 catch (  RestClientException|IOException ignored) {
  }
  final String requestId=response.getHeaders().getFirst(GDC_REQUEST_ID_HEADER);
  int statusCode;
  try {
    statusCode=response.getRawStatusCode();
  }
 catch (  IOException e) {
    statusCode=0;
  }
  String statusText;
  try {
    statusText=response.getStatusText();
  }
 catch (  IOException e) {
    statusText=null;
  }
  throw new GoodDataRestException(statusCode,requestId,statusText,error);
}

Fixed version (ground truth):
@Override public void handleError(ClientHttpResponse response){
  ErrorStructure error=null;
  try {
    error=gdcErrorExtractor.extractData(response);
  }
 catch (  RestClientException|IOException ignored) {
  }
  final String requestId=response.getHeaders().getFirst(GDC_REQUEST_ID_HEADER);
  int statusCode;
  try {
    statusCode=response.getRawStatusCode();
  }
 catch (  IOException e) {
    statusCode=0;
  }
  String statusText;
  try {
    statusText=response.getStatusText();
  }
 catch (  IOException e) {
    statusText=null;
  }
  throw new GoodDataRestException(statusCode,requestId,statusText,error);
}
Program: 25158
Project: 25158
Buggy source:
/** 
 * Account creation constructor
 */
public Account(String email,String password,String firstName,String lastName){
  this(email,email,password,password,firstName,lastName,null);
}

Fixed version (ground truth):
/** 
 * Account creation constructor
 * @param email email
 * @param firstName first name
 * @param lastName last name
 * @param password password
 */
public Account(String email,String password,String firstName,String lastName){
  this(email,email,password,password,firstName,lastName,null);
}
Program: 25159
Project: 25159
Buggy source:
/** 
 * Get account for given account id
 * @param id to search for
 * @return account for id
 * @throws AccountNotFoundException when account for given id can't be found
 * @throws GoodDataException
 */
public Account getAccountById(String id){
  try {
    return restTemplate.getForObject(Account.URI,Account.class,id);
  }
 catch (  GoodDataRestException e) {
    if (HttpStatus.NOT_FOUND.value() == e.getStatusCode()) {
      throw new AccountNotFoundException(Account.TEMPLATE.expand(id).toString(),e);
    }
 else {
      throw e;
    }
  }
catch (  RestClientException e) {
    throw new GoodDataException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Get account for given account id
 * @param id to search for
 * @return account for id
 * @throws AccountNotFoundException when account for given id can't be found
 * @throws GoodDataException when different error occurs
 */
public Account getAccountById(String id){
  try {
    return restTemplate.getForObject(Account.URI,Account.class,id);
  }
 catch (  GoodDataRestException e) {
    if (HttpStatus.NOT_FOUND.value() == e.getStatusCode()) {
      throw new AccountNotFoundException(Account.TEMPLATE.expand(id).toString(),e);
    }
 else {
      throw e;
    }
  }
catch (  RestClientException e) {
    throw new GoodDataException("String_Node_Str",e);
  }
}
Program: 25160
Project: 25160
Buggy source:
/** 
 * Get account for given account id
 * @param uri to search for
 * @return account for uri
 * @throws AccountNotFoundException when account for given uri can't be found
 * @throws GoodDataException
 */
public Account getAccountByUri(String uri){
  return getAccountById(Account.getId(uri));
}

Fixed version (ground truth):
/** 
 * Get account for given account id
 * @param uri to search for
 * @return account for uri
 * @throws AccountNotFoundException when account for given uri can't be found
 * @throws GoodDataException when different error occurs
 */
public Account getAccountByUri(String uri){
  return getAccountById(Account.getId(uri));
}
Program: 25161
Project: 25161
Buggy source:
/** 
 * @deprecated for backward compatibility only. Do not use this method, it always returns null.
 */
@Deprecated public List<String> getVals(){
  return null;
}

Fixed version (ground truth):
/** 
 * @return list of values
 * @deprecated for backward compatibility only. Do not use this method, it always returns null.
 */
@Deprecated public List<String> getVals(){
  return null;
}
Program: 25162
Project: 25162
Buggy source:
/** 
 * Returns list of IDs. IDs are primary property of this param.
 */
public List<String> getIds(){
  return ids;
}

Fixed version (ground truth):
/** 
 * @return list of IDs. IDs are primary property of this param.
 */
public List<String> getIds(){
  return ids;
}
Program: 25163
Project: 25163
Buggy source:
/** 
 * Returns list of values. Values have only informative character and are connected to IDs.
 * @see #getIds()
 */
public List<String> getVals(){
  return vals;
}

Fixed version (ground truth):
/** 
 * @return list of values. Values have only informative character and are connected to IDs.
 * @see #getIds()
 */
public List<String> getVals(){
  return vals;
}
Program: 25164
Project: 25164
Buggy source:
/** 
 * Remove given user from warehouse instance
 * @param user to remove from warehouse
 * @throws WarehouseUserNotFoundException when user for removal can't be found
 * @throws GoodDataException any other reason
 */
public FutureResult<Void> removeUserFromWarehouse(final WarehouseUser user){
  notNull(user,"String_Node_Str");
  final WarehouseTask task;
  try {
    task=restTemplate.exchange(user.getUri(),HttpMethod.DELETE,null,WarehouseTask.class).getBody();
  }
 catch (  GoodDataRestException e) {
    if (HttpStatus.NOT_FOUND.value() == e.getStatusCode()) {
      throw new WarehouseUserNotFoundException(user.getUri(),e);
    }
 else {
      throw e;
    }
  }
catch (  RestClientException e) {
    throw new GoodDataException("String_Node_Str" + user.getUri(),e);
  }
  if (task == null) {
    throw new GoodDataException("String_Node_Str");
  }
  return new PollResult<>(this,new AbstractPollHandler<WarehouseTask,Void>(task.getPollUri(),WarehouseTask.class,Void.class){
    @Override public boolean isFinished(    ClientHttpResponse response) throws IOException {
      return HttpStatus.CREATED.equals(response.getStatusCode());
    }
    @Override public void handlePollResult(    WarehouseTask pollResult){
      setResult(null);
    }
    @Override public void handlePollException(    final GoodDataRestException e){
      throw new GoodDataException("String_Node_Str",e);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Remove given user from warehouse instance
 * @param user to remove from warehouse
 * @return empty future result
 * @throws WarehouseUserNotFoundException when user for removal can't be found
 * @throws GoodDataException any other reason
 */
public FutureResult<Void> removeUserFromWarehouse(final WarehouseUser user){
  notNull(user,"String_Node_Str");
  final WarehouseTask task;
  try {
    task=restTemplate.exchange(user.getUri(),HttpMethod.DELETE,null,WarehouseTask.class).getBody();
  }
 catch (  GoodDataRestException e) {
    if (HttpStatus.NOT_FOUND.value() == e.getStatusCode()) {
      throw new WarehouseUserNotFoundException(user.getUri(),e);
    }
 else {
      throw e;
    }
  }
catch (  RestClientException e) {
    throw new GoodDataException("String_Node_Str" + user.getUri(),e);
  }
  if (task == null) {
    throw new GoodDataException("String_Node_Str");
  }
  return new PollResult<>(this,new AbstractPollHandler<WarehouseTask,Void>(task.getPollUri(),WarehouseTask.class,Void.class){
    @Override public boolean isFinished(    ClientHttpResponse response) throws IOException {
      return HttpStatus.CREATED.equals(response.getStatusCode());
    }
    @Override public void handlePollResult(    WarehouseTask pollResult){
      setResult(null);
    }
    @Override public void handlePollException(    final GoodDataRestException e){
      throw new GoodDataException("String_Node_Str",e);
    }
  }
);
}
Program: 25165
Project: 25165
Buggy source:
@Test public void shouldZipDirWithoutRoot() throws Exception {
  Path toZipDir=temporaryFolder.resolve("String_Node_Str");
  toZipDir.toFile().mkdirs();
  File toZipFile=toZipDir.resolve("String_Node_Str").toFile();
  toZipFile.getParentFile().mkdirs();
  toZipFile.createNewFile();
  try (ByteArrayOutputStream output=new ByteArrayOutputStream()){
    ZipUtils.zip(toZipDir.toFile(),output);
    output.close();
    verifyZipContent(output,"String_Node_Str");
  }
 }

Fixed version (ground truth):
@Test public void shouldZipDirWithoutRoot() throws Exception {
  Path toZipDir=temporaryFolder.resolve("String_Node_Str");
  toZipDir.toFile().mkdirs();
  File toZipFile=toZipDir.resolve(SOME_FILE_PATH).toFile();
  toZipFile.getParentFile().mkdirs();
  toZipFile.createNewFile();
  try (ByteArrayOutputStream output=new ByteArrayOutputStream()){
    ZipUtils.zip(toZipDir.toFile(),output);
    output.close();
    verifyZipContent(output,Paths.get("String_Node_Str","String_Node_Str",SOME_FILE).toString());
  }
 }
Program: 25166
Project: 25166
Buggy source:
@Test public void shouldNotZipAlreadyZipped() throws Exception {
  final File file=temporaryFolder.resolve("String_Node_Str").toFile();
  file.createNewFile();
  final File zipped=temporaryFolder.resolve("String_Node_Str").toFile();
  try (FileOutputStream zipStream=new FileOutputStream(zipped)){
    ZipUtils.zip(file,zipStream);
    zipStream.close();
  }
   try (ByteArrayOutputStream output=new ByteArrayOutputStream()){
    ZipUtils.zip(zipped,output);
    output.close();
    verifyZipContent(output,"String_Node_Str");
  }
 }

Fixed version (ground truth):
@Test public void shouldNotZipAlreadyZipped() throws Exception {
  final File file=temporaryFolder.resolve(SOME_FILE).toFile();
  file.createNewFile();
  final File zipped=temporaryFolder.resolve("String_Node_Str").toFile();
  try (FileOutputStream zipStream=new FileOutputStream(zipped)){
    ZipUtils.zip(file,zipStream);
    zipStream.close();
  }
   try (ByteArrayOutputStream output=new ByteArrayOutputStream()){
    ZipUtils.zip(zipped,output);
    output.close();
    verifyZipContent(output,SOME_FILE);
  }
 }
Program: 25167
Project: 25167
Buggy source:
@Test public void shouldZipSingleFile() throws Exception {
  final File file=temporaryFolder.resolve("String_Node_Str").toFile();
  file.createNewFile();
  try (ByteArrayOutputStream output=new ByteArrayOutputStream()){
    ZipUtils.zip(file,output);
    output.close();
    verifyZipContent(output,"String_Node_Str");
  }
 }

Fixed version (ground truth):
@Test public void shouldZipSingleFile() throws Exception {
  final File file=temporaryFolder.resolve(SOME_FILE).toFile();
  file.createNewFile();
  try (ByteArrayOutputStream output=new ByteArrayOutputStream()){
    ZipUtils.zip(file,output);
    output.close();
    verifyZipContent(output,SOME_FILE);
  }
 }
Program: 25168
Project: 25168
Buggy source:
@Test public void shouldZipDir() throws Exception {
  Path toZipDir=temporaryFolder.resolve("String_Node_Str");
  toZipDir.toFile().mkdirs();
  File toZipFile=toZipDir.resolve("String_Node_Str").toFile();
  toZipFile.getParentFile().mkdirs();
  toZipFile.createNewFile();
  try (ByteArrayOutputStream output=new ByteArrayOutputStream()){
    ZipUtils.zip(toZipDir.toFile(),output,true);
    output.close();
    verifyZipContent(output,"String_Node_Str");
  }
 }

Fixed version (ground truth):
@Test public void shouldZipDir() throws Exception {
  Path toZipDir=temporaryFolder.resolve("String_Node_Str");
  toZipDir.toFile().mkdirs();
  File toZipFile=toZipDir.resolve(SOME_FILE_PATH).toFile();
  toZipFile.getParentFile().mkdirs();
  toZipFile.createNewFile();
  try (ByteArrayOutputStream output=new ByteArrayOutputStream()){
    ZipUtils.zip(toZipDir.toFile(),output,true);
    output.close();
    verifyZipContent(output,Paths.get("String_Node_Str","String_Node_Str","String_Node_Str",SOME_FILE).toString());
  }
 }
Program: 25169
Project: 25169
Buggy source:
@Test public void shouldSetUploadModeForAllParts() throws Exception {
  final DatasetManifest manifest=new DatasetManifest("String_Node_Str","String_Node_Str",asList(new DatasetManifest.Part("String_Node_Str","String_Node_Str",asList("String_Node_Str"),1,null),new DatasetManifest.Part("String_Node_Str","String_Node_Str",asList("String_Node_Str"),1,null)));
  manifest.setUploadMode(UploadMode.INCREMENTAL);
  assertThat(manifest.getParts().get(0).getUploadMode(),is("String_Node_Str"));
  assertThat(manifest.getParts().get(1).getUploadMode(),is("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void shouldSetUploadModeForAllParts() throws Exception {
  final DatasetManifest manifest=new DatasetManifest("String_Node_Str","String_Node_Str",asList(new DatasetManifest.Part("String_Node_Str","String_Node_Str",asList("String_Node_Str"),true,null),new DatasetManifest.Part("String_Node_Str","String_Node_Str",asList("String_Node_Str"),true,null)));
  manifest.setUploadMode(UploadMode.INCREMENTAL);
  assertThat(manifest.getParts().get(0).getUploadMode(),is("String_Node_Str"));
  assertThat(manifest.getParts().get(1).getUploadMode(),is("String_Node_Str"));
}
Program: 25170
Project: 25170
Buggy source:
@Test public void shouldSetMapping() throws Exception {
  final DatasetManifest manifest=new DatasetManifest("String_Node_Str","String_Node_Str",asList(new DatasetManifest.Part("String_Node_Str","String_Node_Str",asList("String_Node_Str"),1,null),new DatasetManifest.Part("String_Node_Str","String_Node_Str",asList("String_Node_Str"),1,null)));
  manifest.setMapping("String_Node_Str","String_Node_Str");
  manifest.setMapping("String_Node_Str","String_Node_Str");
  assertThat(manifest.getParts().get(0).getColumnName(),is("String_Node_Str"));
  assertThat(manifest.getParts().get(1).getColumnName(),is("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void shouldSetMapping() throws Exception {
  final DatasetManifest manifest=new DatasetManifest("String_Node_Str","String_Node_Str",asList(new DatasetManifest.Part("String_Node_Str","String_Node_Str",asList("String_Node_Str"),true,null),new DatasetManifest.Part("String_Node_Str","String_Node_Str",asList("String_Node_Str"),true,null)));
  manifest.setMapping("String_Node_Str","String_Node_Str");
  manifest.setMapping("String_Node_Str","String_Node_Str");
  assertThat(manifest.getParts().get(0).getColumnName(),is("String_Node_Str"));
  assertThat(manifest.getParts().get(1).getColumnName(),is("String_Node_Str"));
}
Program: 25171
Project: 25171
Buggy source:
@Test(expectedExceptions=IllegalStateException.class) public void shouldFailOnMultiPopulates() throws Exception {
  final DatasetManifest manifest=new DatasetManifest("String_Node_Str","String_Node_Str",asList(new DatasetManifest.Part("String_Node_Str","String_Node_Str",asList("String_Node_Str","String_Node_Str"),1,null)));
  manifest.setMapping("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Test(expectedExceptions=IllegalStateException.class) public void shouldFailOnMultiPopulates() throws Exception {
  final DatasetManifest manifest=new DatasetManifest("String_Node_Str","String_Node_Str",asList(new DatasetManifest.Part("String_Node_Str","String_Node_Str",asList("String_Node_Str","String_Node_Str"),true,null)));
  manifest.setMapping("String_Node_Str","String_Node_Str");
}
Program: 25172
Project: 25172
Buggy source:
@JsonCreator protected ErrorStructure(@JsonProperty("String_Node_Str") String errorClass,@JsonProperty("String_Node_Str") String component,@JsonProperty("String_Node_Str") String[] parameters,@JsonProperty("String_Node_Str") String message,@JsonProperty("String_Node_Str") String errorCode,@JsonProperty("String_Node_Str") String errorId,@JsonProperty("String_Node_Str") String trace,@JsonProperty("String_Node_Str") String requestId){
  this.errorClass=errorClass;
  this.component=component;
  this.parameters=parameters;
  this.message=notNull(message,"String_Node_Str");
  this.errorCode=errorCode;
  this.errorId=errorId;
  this.trace=trace;
  this.requestId=requestId;
}

Fixed version (ground truth):
@JsonCreator protected ErrorStructure(@JsonProperty("String_Node_Str") String errorClass,@JsonProperty("String_Node_Str") String component,@JsonProperty("String_Node_Str") Object[] parameters,@JsonProperty("String_Node_Str") String message,@JsonProperty("String_Node_Str") String errorCode,@JsonProperty("String_Node_Str") String errorId,@JsonProperty("String_Node_Str") String trace,@JsonProperty("String_Node_Str") String requestId){
  this.errorClass=errorClass;
  this.component=component;
  this.parameters=parameters;
  this.message=notNull(message,"String_Node_Str");
  this.errorCode=errorCode;
  this.errorId=errorId;
  this.trace=trace;
  this.requestId=requestId;
}
Program: 25173
Project: 25173
Buggy source:
public String[] getParameters(){
  return parameters == null ? null : copyOf(parameters,parameters.length);
}

Fixed version (ground truth):
public Object[] getParameters(){
  return parameters == null ? null : copyOf(parameters,parameters.length);
}
Program: 25174
Project: 25174
Buggy source:
@Test public void testDeserialization() throws Exception {
  final InputStream inputStream=getClass().getResourceAsStream("String_Node_Str");
  final ErrorStructure errStructure=new ObjectMapper().readValue(inputStream,ErrorStructure.class);
  assertThat(errStructure,is(notNullValue()));
  assertThat(errStructure.getErrorClass(),is("String_Node_Str"));
  assertThat(errStructure.getTrace(),is("String_Node_Str"));
  assertThat(errStructure.getMessage(),is("String_Node_Str"));
  assertThat(errStructure.getComponent(),is("String_Node_Str"));
  assertThat(errStructure.getErrorId(),is("String_Node_Str"));
  assertThat(errStructure.getErrorCode(),is("String_Node_Str"));
  assertThat(errStructure.getRequestId(),is("String_Node_Str"));
  assertThat(errStructure.getParameters(),is(notNullValue()));
  assertThat(errStructure.getParameters().length,is(2));
  assertThat(errStructure.getParameters()[0],is("String_Node_Str"));
  assertThat(errStructure.getParameters()[1],is("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testDeserialization() throws Exception {
  final InputStream inputStream=getClass().getResourceAsStream("String_Node_Str");
  final ErrorStructure errStructure=new ObjectMapper().readValue(inputStream,ErrorStructure.class);
  assertThat(errStructure,is(notNullValue()));
  assertThat(errStructure.getErrorClass(),is("String_Node_Str"));
  assertThat(errStructure.getTrace(),is("String_Node_Str"));
  assertThat(errStructure.getMessage(),is("String_Node_Str"));
  assertThat(errStructure.getComponent(),is("String_Node_Str"));
  assertThat(errStructure.getErrorId(),is("String_Node_Str"));
  assertThat(errStructure.getErrorCode(),is("String_Node_Str"));
  assertThat(errStructure.getRequestId(),is("String_Node_Str"));
  assertThat(errStructure.getParameters(),is(notNullValue()));
  assertThat(errStructure.getParameters().length,is(3));
  assertThat(errStructure.getParameters()[0].toString(),is("String_Node_Str"));
  assertThat(errStructure.getParameters()[1].toString(),is("String_Node_Str"));
  assertThat(errStructure.getParameters()[2].toString(),is("String_Node_Str"));
  assertThat(errStructure.getFormattedMessage(),is("String_Node_Str"));
}
Program: 25175
Project: 25175
Buggy source:
@Test public void testDeserialization() throws Exception {
  final InputStream inputStream=getClass().getResourceAsStream("String_Node_Str");
  final GdcError err=new ObjectMapper().readValue(inputStream,GdcError.class);
  assertThat(err,is(notNullValue()));
  assertThat(err.getErrorClass(),is("String_Node_Str"));
  assertThat(err.getTrace(),is("String_Node_Str"));
  assertThat(err.getMessage(),is("String_Node_Str"));
  assertThat(err.getComponent(),is("String_Node_Str"));
  assertThat(err.getErrorId(),is("String_Node_Str"));
  assertThat(err.getErrorCode(),is("String_Node_Str"));
  assertThat(err.getRequestId(),is("String_Node_Str"));
  assertThat(err.getParameters(),is(notNullValue()));
  assertThat(err.getParameters().length,is(2));
  assertThat(err.getParameters()[0],is("String_Node_Str"));
  assertThat(err.getParameters()[1],is("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testDeserialization() throws Exception {
  final InputStream inputStream=getClass().getResourceAsStream("String_Node_Str");
  final GdcError err=new ObjectMapper().readValue(inputStream,GdcError.class);
  assertThat(err,is(notNullValue()));
  assertThat(err.getErrorClass(),is("String_Node_Str"));
  assertThat(err.getTrace(),is("String_Node_Str"));
  assertThat(err.getMessage(),is("String_Node_Str"));
  assertThat(err.getComponent(),is("String_Node_Str"));
  assertThat(err.getErrorId(),is("String_Node_Str"));
  assertThat(err.getErrorCode(),is("String_Node_Str"));
  assertThat(err.getRequestId(),is("String_Node_Str"));
  assertThat(err.getParameters(),is(notNullValue()));
  assertThat(err.getParameters().length,is(2));
  assertThat(err.getParameters()[0].toString(),is("String_Node_Str"));
  assertThat(err.getParameters()[1].toString(),is("String_Node_Str"));
}
Program: 25176
Project: 25176
Buggy source:
/** 
 * This method compresses the input file to zip format. If the given file is a directory, it recursively packs the directory into the output.
 * @param file file to be zipped
 * @param output stream where the output will be written
 * @param includeRoot if root dir should be included
 */
public static void zip(File file,OutputStream output,boolean includeRoot) throws IOException {
  notNull(file,"String_Node_Str");
  notNull(output,"String_Node_Str");
  try (ZipOutputStream zos=new ZipOutputStream(output)){
    if (file.isDirectory()) {
      zipDir(includeRoot ? file.getParentFile().toPath() : file.toPath(),file,zos);
    }
 else {
      zipFile(file.getParentFile().toPath(),file,zos);
    }
  }
 }

Fixed version (ground truth):
/** 
 * This method compresses the input file to zip format. If the given file is a directory, it recursively packs the directory into the output.
 * @param file file to be zipped
 * @param output stream where the output will be written
 * @param includeRoot if root dir should be included
 * @throws IOException if zip creation fails
 */
public static void zip(File file,OutputStream output,boolean includeRoot) throws IOException {
  notNull(file,"String_Node_Str");
  notNull(output,"String_Node_Str");
  try (ZipOutputStream zos=new ZipOutputStream(output)){
    if (file.isDirectory()) {
      zipDir(includeRoot ? file.getParentFile().toPath() : file.toPath(),file,zos);
    }
 else {
      zipFile(file.getParentFile().toPath(),file,zos);
    }
  }
 }
Program: 25177
Project: 25177
Buggy source:
/** 
 * Get list of URIs of the given   {@link Obj}s
 * @param objs metadata objects
 * @return list of URIs
 */
@SafeVarargs protected static <T extends Obj>String[] uris(T... objs){
  noNullElements(objs,"String_Node_Str");
  final String[] uris=new String[objs.length];
  for (int i=0; i < objs.length; i++) {
    uris[i]=objs[i].getUri();
  }
  return uris;
}

Fixed version (ground truth):
/** 
 * Get list of URIs of the given   {@link Obj}s
 * @param objs metadata objects
 * @param < T > Obj type
 * @return list of URIs
 */
@SafeVarargs protected static <T extends Obj>String[] uris(T... objs){
  noNullElements(objs,"String_Node_Str");
  final String[] uris=new String[objs.length];
  for (int i=0; i < objs.length; i++) {
    uris[i]=objs[i].getUri();
  }
  return uris;
}
Program: 25178
Project: 25178
Buggy source:
/** 
 * Returns desired target state of project model
 */
public String getTargetModel(){
  return targetModel;
}

Fixed version (ground truth):
/** 
 * Returns desired target state of project model
 * @return desired target state of project model
 */
public String getTargetModel(){
  return targetModel;
}
Program: 25179
Project: 25179
Buggy source:
/** 
 * Returns several variants of MAQL DDL evolution scripts that should be executed to update the source model to the target state. Individual variants differ in their side-effects (truncation of loaded data, drops of related objects...) <p/> Will be empty for empty diff.
 */
List<UpdateScript> getUpdateScripts(){
  return unmodifiableList(updateScripts);
}

Fixed version (ground truth):
/** 
 * Returns several variants of MAQL DDL evolution scripts that should be executed to update the source model to the target state. Individual variants differ in their side-effects (truncation of loaded data, drops of related objects...) <p> Will be empty for empty diff.
 */
List<UpdateScript> getUpdateScripts(){
  return unmodifiableList(updateScripts);
}
Program: 25180
Project: 25180
Buggy source:
/** 
 * Returns MAQL DDL update script that should be executed to update the source model to the target state. <p/> It picks the best possible variant by it's side-effects (truncation of loaded data, drops of related objects). It returns first present variant by order: <ol> <li>preserve data + no cascade drops</li> <li>no preserve data + no cascade drops</li> <li>preserve data + cascade drops</li> <li>no preserve data + cascade drops</li> </ol> <p/> Returned list will be empty if there are no differences.
 * @return MAQL DDL update scripts. Empty list if there are no differences.
 */
public List<String> getUpdateMaql(){
  if (updateScripts.isEmpty()) {
    return emptyList();
  }
  UpdateScript chosenScript;
  if ((chosenScript=getUpdateScriptByFlags(true,false)) != null) {
    return unmodifiableList(chosenScript.getMaqlChunks());
  }
  if ((chosenScript=getUpdateScriptByFlags(false,false)) != null) {
    return unmodifiableList(chosenScript.getMaqlChunks());
  }
  if ((chosenScript=getUpdateScriptByFlags(true,true)) != null) {
    return unmodifiableList(chosenScript.getMaqlChunks());
  }
  return unmodifiableList(updateScripts.get(0).getMaqlChunks());
}

Fixed version (ground truth):
/** 
 * Returns MAQL DDL update script that should be executed to update the source model to the target state. <p> It picks the best possible variant by it's side-effects (truncation of loaded data, drops of related objects). It returns first present variant by order: <ol> <li>preserve data + no cascade drops</li> <li>no preserve data + no cascade drops</li> <li>preserve data + cascade drops</li> <li>no preserve data + cascade drops</li> </ol> Returned list will be empty if there are no differences.
 * @return MAQL DDL update scripts. Empty list if there are no differences.
 */
public List<String> getUpdateMaql(){
  if (updateScripts.isEmpty()) {
    return emptyList();
  }
  UpdateScript chosenScript;
  if ((chosenScript=getUpdateScriptByFlags(true,false)) != null) {
    return unmodifiableList(chosenScript.getMaqlChunks());
  }
  if ((chosenScript=getUpdateScriptByFlags(false,false)) != null) {
    return unmodifiableList(chosenScript.getMaqlChunks());
  }
  if ((chosenScript=getUpdateScriptByFlags(true,true)) != null) {
    return unmodifiableList(chosenScript.getMaqlChunks());
  }
  return unmodifiableList(updateScripts.get(0).getMaqlChunks());
}
Program: 25181
Project: 25181
Buggy source:
public String[] getParameters(){
  return parameters;
}

Fixed version (ground truth):
public String[] getParameters(){
  return parameters == null ? null : copyOf(parameters,parameters.length);
}
Program: 25182
Project: 25182
Buggy source:
/** 
 * Restore session from previous instance of lens server.
 * @param sessionHandle the session handle
 * @param userName      the user name
 * @param password      the password
 * @throws LensException the lens exception
 */
void restoreSession(LensSessionHandle sessionHandle,String userName,String password) throws LensException ;

Fixed version (ground truth):
/** 
 * Restore session from previous instance of lens server.
 * @param sessionHandle the session handle
 * @param userName      the user name
 * @param password      the password
 * @throws LensException the lens exception
 */
void restoreSession(LensSessionHandle sessionHandle,String userName,String password,Map<String,String> configuration) throws LensException ;
Program: 25183
Project: 25183
Buggy source:
/** 
 * Restore session from previous instance of lens server.
 * @param sessionHandle the session handle
 * @param userName      the user name
 * @param password      the password
 * @throws LensException the lens exception
 */
public void restoreSession(LensSessionHandle sessionHandle,String userName,String password) throws LensException {
  HandleIdentifier handleIdentifier=new HandleIdentifier(sessionHandle.getPublicId(),sessionHandle.getSecretId());
  SessionHandle hiveSessionHandle=new SessionHandle(new TSessionHandle(handleIdentifier.toTHandleIdentifier()));
  try {
    cliService.createSessionWithSessionHandle(hiveSessionHandle,userName,password,new HashMap<String,String>());
    LensSessionHandle restoredSession=new LensSessionHandle(hiveSessionHandle.getHandleIdentifier().getPublicId(),hiveSessionHandle.getHandleIdentifier().getSecretId());
    SESSION_MAP.put(restoredSession.getPublicId().toString(),restoredSession);
    SessionUser sessionUser=SESSION_USER_INSTANCE_MAP.get(userName);
    if (sessionUser == null) {
      sessionUser=new SessionUser(userName);
      SESSION_USER_INSTANCE_MAP.put(userName,sessionUser);
    }
    updateSessionsPerUser(userName);
  }
 catch (  HiveSQLException e) {
    throw new LensException("String_Node_Str" + sessionHandle,e);
  }
}

Fixed version (ground truth):
/** 
 * Restore session from previous instance of lens server.
 * @param sessionHandle the session handle
 * @param userName      the user name
 * @param password      the password
 * @throws LensException the lens exception
 */
public void restoreSession(LensSessionHandle sessionHandle,String userName,String password,Map<String,String> configuration) throws LensException {
  HandleIdentifier handleIdentifier=new HandleIdentifier(sessionHandle.getPublicId(),sessionHandle.getSecretId());
  SessionHandle hiveSessionHandle=new SessionHandle(new TSessionHandle(handleIdentifier.toTHandleIdentifier()));
  try {
    cliService.createSessionWithSessionHandle(hiveSessionHandle,userName,password,new HashMap<>());
    LensSessionHandle restoredSession=new LensSessionHandle(hiveSessionHandle.getHandleIdentifier().getPublicId(),hiveSessionHandle.getHandleIdentifier().getSecretId());
    SESSION_MAP.put(restoredSession.getPublicId().toString(),restoredSession);
    String loggedinUser=userName;
    if (configuration != null) {
      loggedinUser=configuration.getOrDefault(LensConfConstants.SESSION_LOGGEDIN_USER,userName);
    }
    SessionUser sessionUser=SESSION_USER_INSTANCE_MAP.get(loggedinUser);
    if (sessionUser == null) {
      sessionUser=new SessionUser(loggedinUser);
      SESSION_USER_INSTANCE_MAP.put(loggedinUser,sessionUser);
    }
    updateSessionsPerUser(loggedinUser);
  }
 catch (  HiveSQLException e) {
    throw new LensException("String_Node_Str" + sessionHandle,e);
  }
}
Program: 25185
Project: 25185
Buggy source:
private void replacePickedExpressions(DimHQLContext sc) throws LensException {
  QueryAST queryAST=sc.getQueryAst();
  replaceAST(cubeql,queryAST.getSelectAST());
  if (sc.getStorageCandidate() != null) {
    replaceAST(cubeql,sc.getQueryAst().getWhereAST());
  }
 else {
    replaceAST(cubeql,queryAST.getWhereAST());
  }
  replaceAST(cubeql,queryAST.getJoinAST());
  replaceAST(cubeql,queryAST.getGroupByAST());
  if (queryAST.getHavingAST() != null) {
    replaceAST(cubeql,queryAST.getHavingAST());
  }
 else {
    replaceAST(cubeql,cubeql.getHavingAST());
  }
  replaceAST(cubeql,queryAST.getOrderByAST());
}

Fixed version (ground truth):
private void replacePickedExpressions(DimHQLContext sc) throws LensException {
  QueryAST queryAST=sc.getQueryAst();
  replaceAST(cubeql,queryAST.getSelectAST());
  if (sc.getStorageCandidate() != null) {
    replaceAST(cubeql,sc.getQueryAst().getWhereAST());
  }
 else {
    replaceAST(cubeql,queryAST.getWhereAST());
  }
  replaceAST(cubeql,queryAST.getJoinAST());
  replaceAST(cubeql,queryAST.getGroupByAST());
  if (queryAST.getHavingAST() != null) {
    replaceAST(cubeql,queryAST.getHavingAST());
  }
 else   if (cubeql.getHavingAST() != null) {
    replaceAST(cubeql,cubeql.getHavingAST());
    queryAST.setHavingAST(MetastoreUtil.copyAST(cubeql.getHavingAST()));
  }
  replaceAST(cubeql,queryAST.getOrderByAST());
}
Program: 25186
Project: 25186
Buggy source:
private ASTNode processOrderbyExpression(ASTNode astNode) throws LensException {
  if (astNode == null) {
    return null;
  }
  ASTNode outerExpression=new ASTNode(astNode);
  for (  Node node : astNode.getChildren()) {
    ASTNode child=(ASTNode)node;
    ASTNode outerOrderby=new ASTNode(child);
    ASTNode tokNullsChild=(ASTNode)child.getChild(0);
    ASTNode outerTokNullsChild=new ASTNode(tokNullsChild);
    outerTokNullsChild.addChild(innerToOuterSelectASTs.get(new HQLParser.HashableASTNode((ASTNode)tokNullsChild)));
    outerOrderby.addChild(outerTokNullsChild);
    outerExpression.addChild(outerOrderby);
  }
  return outerExpression;
}

Fixed version (ground truth):
private ASTNode processOrderbyExpression(ASTNode astNode) throws LensException {
  if (astNode == null) {
    return null;
  }
  ASTNode outerExpression=new ASTNode(astNode);
  for (  Node node : astNode.getChildren()) {
    ASTNode child=(ASTNode)node;
    ASTNode outerOrderby=new ASTNode(child);
    ASTNode tokNullsChild=(ASTNode)child.getChild(0);
    ASTNode outerTokNullsChild=new ASTNode(tokNullsChild);
    if (((ASTNode)tokNullsChild.getChild(0)).getToken().getType() == HiveParser.DOT) {
      outerTokNullsChild.addChild(innerToOuterSelectASTs.get(new HQLParser.HashableASTNode((ASTNode)tokNullsChild)));
    }
 else {
      outerTokNullsChild.addChild(tokNullsChild);
    }
    outerOrderby.addChild(outerTokNullsChild);
    outerExpression.addChild(outerOrderby);
  }
  return outerExpression;
}
Program: 25187
Project: 25187
Buggy source:
/** 
 * Set having, order by and limit clauses to null for inner queries being constructed from StorageCandidate.
 */
private void updateAsts(){
  for (  StorageCandidateHQLContext sc : storageCandidates) {
    storageCandidateToSelectAstMap.put(sc.getStorageCandidate().toString(),new ASTNode(new CommonToken(TOK_SELECT,"String_Node_Str")));
    sc.getQueryAst().setHavingAST(null);
    sc.getQueryAst().setOrderByAST(null);
    sc.getQueryAst().setLimitValue(null);
  }
}

Fixed version (ground truth):
/** 
 * Set having, order by and limit clauses to null for inner queries being constructed from StorageCandidate.
 */
private void updateAsts(){
  for (  StorageCandidateHQLContext sc : storageCandidates) {
    storageCandidateToSelectAstMap.put(sc.getStorageCandidate().toString(),new ASTNode(new CommonToken(TOK_SELECT,"String_Node_Str")));
    if (sc.getQueryAst().getHavingAST() != null) {
      cubeql.setHavingAST(sc.getQueryAst().getHavingAST());
    }
    sc.getQueryAst().setHavingAST(null);
    sc.getQueryAst().setOrderByAST(null);
    sc.getQueryAst().setLimitValue(null);
  }
}