nus-yam/ex-repair huggingface dataset:
Program: 37524
Project: 37524
Buggy source:
private KafkaCfg getKafkaCfg(String password,RedisRequest request) throws InvalidRequestExistsException {
  String topic=new String(request.getArgs()[1]);
  KafkaCfg kafkaCfg=RedisEngineCtx.INSTANCE().getKafkaMap().get(topic);
  if (kafkaCfg == null) {
    throw new InvalidRequestExistsException("String_Node_Str");
  }
  if (!kafkaCfg.isProducer(password)) {
    throw new InvalidRequestExistsException("String_Node_Str");
  }
  if (kafkaCfg.getMetaData() == null) {
    throw new InvalidRequestExistsException("String_Node_Str");
  }
  return kafkaCfg;
}

Fixed version (ground truth):
private KafkaCfg getKafkaCfg(String password,RedisRequest request,boolean isConsumer) throws InvalidRequestExistsException {
  String topic=new String(request.getArgs()[1]);
  KafkaCfg kafkaCfg=RedisEngineCtx.INSTANCE().getKafkaMap().get(topic);
  if (kafkaCfg == null) {
    throw new InvalidRequestExistsException("String_Node_Str");
  }
  if (!isConsumer && !kafkaCfg.isProducer(password)) {
    throw new InvalidRequestExistsException("String_Node_Str");
  }
  if (isConsumer && !kafkaCfg.isConsumer(password)) {
    throw new InvalidRequestExistsException("String_Node_Str");
  }
  if (kafkaCfg.getMetaData() == null) {
    throw new InvalidRequestExistsException("String_Node_Str");
  }
  return kafkaCfg;
}
Program: 37527
Project: 37527
Buggy source:
public List<SlowKey> getSlowKeys(){
  try {
    while (!blocking.compareAndSet(false,true)) {
    }
    sort();
    return keys.subList(0,100);
  }
  finally {
    blocking.set(false);
  }
}

Fixed version (ground truth):
public List<SlowKey> getSlowKeys(){
  try {
    while (!blocking.compareAndSet(false,true)) {
    }
    sort();
    return keys.subList(0,keys.size() > 100 ? 100 : keys.size());
  }
  finally {
    blocking.set(false);
  }
}
Program: 37529
Project: 37529
Buggy source:
public int getSlot(String cmd,String key){
  if (key == null)   return 0;
  int slot=0;
  Byte isCached=cmds.get(cmd);
  if (isCached != null && isCached == B1) {
    try {
      slot=cache.get(key);
    }
 catch (    Exception e) {
      slot=ClusterCRC16Util.getSlot(key,false);
    }
  }
 else {
    slot=ClusterCRC16Util.getSlot(key,false);
  }
  return slot;
}

Fixed version (ground truth):
public int getSlot(String cmd,String key){
  if (key == null)   return 0;
  int slot=0;
  Byte isCached=cmds.get(cmd);
  if (isCached != null && isCached == B1) {
    try {
      slot=cache.get(key);
    }
 catch (    Exception e) {
      slot=ClusterCRC16Util.getSlot(key);
    }
  }
 else {
    slot=ClusterCRC16Util.getSlot(key);
  }
  return slot;
}
Program: 37530
Project: 37530
Buggy source:
@Override public Integer load(String key) throws Exception {
  int slot=ClusterCRC16Util.getSlot(key,false);
  cache.put(key,slot);
  return slot;
}

Fixed version (ground truth):
@Override public Integer load(String key) throws Exception {
  int slot=ClusterCRC16Util.getSlot(key);
  cache.put(key,slot);
  return slot;
}
Program: 37531
Project: 37531
Buggy source:
public static int getSlot(byte[] key,boolean isHashTag){
  if (isHashTag) {
    int s=-1;
    int e=-1;
    boolean sFound=false;
    for (int i=0; i < key.length; i++) {
      if (key[i] == '{' && !sFound) {
        s=i;
        sFound=true;
      }
      if (key[i] == '}' && sFound) {
        e=i;
        break;
      }
    }
    if (s > -1 && e > -1 && e != s + 1) {
      return getCRC16(key,s + 1,e) & 16383;
    }
  }
  return getCRC16(key) & 16383;
}

Fixed version (ground truth):
public static int getSlot(byte[] key){
  int s=-1;
  int e=-1;
  boolean sFound=false;
  for (int i=0; i < key.length; i++) {
    if (key[i] == '{' && !sFound) {
      s=i;
      sFound=true;
    }
    if (key[i] == '}' && sFound) {
      e=i;
      break;
    }
  }
  if (s > -1 && e > -1 && e != s + 1) {
    return getCRC16(key,s + 1,e) & 16383;
  }
  return getCRC16(key) & 16383;
}
Program: 37532
Project: 37532
Buggy source:
public static void main(String[] args){
  long begin=System.currentTimeMillis();
  for (int n=0; n <= TOTAL_OPERATIONS; n++) {
    ClusterCRC16Util.getSlot((TEST_SET[n % TEST_SET.length]),false);
  }
  long elapsed=System.currentTimeMillis() - begin;
  System.out.println(((1000 * TOTAL_OPERATIONS) / elapsed) + "String_Node_Str");
}

Fixed version (ground truth):
public static void main(String[] args){
  long begin=System.currentTimeMillis();
  for (int n=0; n <= TOTAL_OPERATIONS; n++) {
    ClusterCRC16Util.getSlot((TEST_SET[n % TEST_SET.length]));
  }
  long elapsed=System.currentTimeMillis() - begin;
  System.out.println(((1000 * TOTAL_OPERATIONS) / elapsed) + "String_Node_Str");
}
Program: 37533
Project: 37533
Buggy source:
@Override public PhysicalNode getPhysicalNode(String cmd,byte[] key){
  int slot=0;
  if (key != null) {
    slot=ClusterCRC16Util.getSlot(key,false);
  }
  PhysicalNode node=getPhysicalNodeBySlot(slot);
  return node;
}

Fixed version (ground truth):
@Override public PhysicalNode getPhysicalNode(String cmd,byte[] key){
  int slot=0;
  if (key != null) {
    slot=ClusterCRC16Util.getSlot(key);
  }
  PhysicalNode node=getPhysicalNodeBySlot(slot);
  return node;
}
Program: 37535
Project: 37535
Buggy source:
@Override public void setOnErrorListener(IMediaPlayer.OnErrorListener var1){
  setOnErrorListener((MediaPlayer.OnErrorListener)var1::onError);
}

Fixed version (ground truth):
@Override public void setOnErrorListener(IMediaPlayer.OnErrorListener var1){
  setOnErrorListener((MediaPlayer.OnErrorListener)(mp,what,extra) -> var1.onError(DefaultMediaPlayer.this,what,extra));
}
Program: 37536
Project: 37536
Buggy source:
/** 
 * Called to indicate an error.
 * @param mp    the MediaPlayer the error pertains to
 * @param what  the type of error that has occurred:
 * @param extra an extra code, specific to the error. Typically implementation dependent.
 * @return True if the method handled the error, false if it didn't.Returning false, or not having an OnErrorListener at all, will cause the OnCompletionListener to be called.
 */
boolean onError(MediaPlayer mp,int what,int extra);

Fixed version (ground truth):
/** 
 * Called to indicate an error.
 * @param mp    the MediaPlayer the error pertains to
 * @param what  the type of error that has occurred:
 * @param extra an extra code, specific to the error. Typically implementation dependent.
 * @return True if the method handled the error, false if it didn't.Returning false, or not having an OnErrorListener at all, will cause the OnCompletionListener to be called.
 */
boolean onError(IMediaPlayer mp,int what,int extra);
Program: 37538
Project: 37538
Buggy source:
@Override public void onTextureAcceptable(int texture,GLRender source){
  super.onTextureAcceptable(texture,source);
synchronized (this) {
    if (mVideoEncoder != null) {
      int oldTexture=mVideoEncoder.getInputTextureId();
      if (texture != oldTexture) {
        mVideoEncoder.setInputTextureId(texture);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onTextureAcceptable(int texture,GLRender source){
  super.onTextureAcceptable(texture,source);
  try {
    if (mVideoEncoder != null) {
      int oldTexture=mVideoEncoder.getInputTextureId();
      if (texture != oldTexture) {
        mVideoEncoder.setInputTextureId(texture);
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 37539
Project: 37539
Buggy source:
/** 
 * 设置视频编码器
 * @param encoder
 */
public void setVideoEncoder(final MediaVideoEncoder encoder){
synchronized (this) {
    mVideoEncoder=encoder;
  }
}

Fixed version (ground truth):
/** 
 * 设置视频编码器
 * @param encoder
 */
public void setVideoEncoder(final MediaVideoEncoder encoder){
  mVideoEncoder=encoder;
}
Program: 37540
Project: 37540
Buggy source:
@Override protected void drawFrame(){
  super.drawFrame();
synchronized (this) {
    if (mVideoEncoder != null) {
      mVideoEncoder.frameAvailableSoon();
    }
  }
}

Fixed version (ground truth):
@Override protected void drawFrame(){
  super.drawFrame();
  try {
    if (mVideoEncoder != null) {
      mVideoEncoder.frameAvailableSoon();
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 37541
Project: 37541
Buggy source:
static String convert(InputStream stream) throws IOException {
  BufferedReader r=new BufferedReader(new InputStreamReader(stream));
  StringBuilder total=new StringBuilder();
  String line;
  while ((line=r.readLine()) != null) {
    total.append(line);
    total.append('\n');
  }
  return total.toString();
}

Fixed version (ground truth):
static String convert(InputStream stream) throws IOException {
  BufferedReader r=new BufferedReader(new InputStreamReader(stream));
  StringBuilder total=new StringBuilder();
  String line;
  while ((line=r.readLine()) != null) {
    total.append(line);
    total.append(RETURN_SYMBOL);
  }
  return total.toString();
}
Program: 37543
Project: 37543
Buggy source:
@Override public void onMessage(String message){
  Log.i(TAG,message);
  String[] messages=message.split(SPECIAL_SYMBOL);
  for (  String m : messages) {
    SignalRMessage element=gson.fromJson(m,SignalRMessage.class);
    if (element.getType() == 1) {
      HubMessage hubMessage=new HubMessage(element.getInvocationId(),element.getTarget(),element.getArguments());
      for (      HubConnectionListener listener : listeners) {
        listener.onMessage(hubMessage);
      }
      List<HubEventListener> hubEventListeners=eventListeners.get(hubMessage.getTarget());
      if (hubEventListeners != null) {
        for (        HubEventListener listener : hubEventListeners) {
          listener.onEventMessage(hubMessage);
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onMessage(String message){
  Log.i(TAG,message);
  String[] messages=message.split(SPECIAL_SYMBOL);
  for (  String m : messages) {
    SignalRMessage element=gson.fromJson(m,SignalRMessage.class);
    Integer type=element.getType();
    if (type != null && type == 1) {
      HubMessage hubMessage=new HubMessage(element.getInvocationId(),element.getTarget(),element.getArguments());
      for (      HubConnectionListener listener : listeners) {
        listener.onMessage(hubMessage);
      }
      List<HubEventListener> hubEventListeners=eventListeners.get(hubMessage.getTarget());
      if (hubEventListeners != null) {
        for (        HubEventListener listener : hubEventListeners) {
          listener.onEventMessage(hubMessage);
        }
      }
    }
  }
}
Program: 37544
Project: 37544
Buggy source:
/** 
 * Replace the variables in the given   {@code InputStream} and produce a new stream.If the  {@code variableResolver} is null, the original {@code InputStream} will be returned.<p> Note that although we're processing streams, all the contents will be loaded and returned for this substitution.
 * @param original         the original {@code InputStream}
 * @param variableResolver the variable resolver
 * @return a new {@code InputStream} with the variables replaced by their values,or the original if the  {@code variableResolver} is {@code null}.
 * @throws IOException error on reading the original InputStream.
 */
public static InputStream replaceMacro(InputStream original,VariableResolver<String> variableResolver) throws IOException {
  try {
    if (variableResolver == null) {
      return original;
    }
    String content=IOUtils.toString(original,Constants.DEFAULT_CHARSET);
    content=Util.replaceMacro(content,variableResolver);
    if (content != null) {
      return new ByteArrayInputStream(content.getBytes(Constants.DEFAULT_CHARSET));
    }
 else {
      throw new IllegalArgumentException(Messages.JobContext_nullContent());
    }
  }
  finally {
    original.close();
  }
}

Fixed version (ground truth):
/** 
 * Replace the variables in the given   {@code InputStream} and produce a new stream.If the  {@code variableResolver} is null, the original {@code InputStream} will be returned.<p> Note that although we're processing streams, all the contents will be loaded and returned for this substitution.
 * @param original         the original {@code InputStream}
 * @param variableResolver the variable resolver
 * @return a new {@code InputStream} with the variables replaced by their values,or the original if the  {@code variableResolver} is {@code null}.
 * @throws IOException error on reading the original InputStream.
 */
public static InputStream replaceMacro(InputStream original,VariableResolver<String> variableResolver) throws IOException {
  if (variableResolver == null) {
    return original;
  }
  try {
    String content=IOUtils.toString(original,Constants.DEFAULT_CHARSET);
    content=Util.replaceMacro(content,variableResolver);
    if (content != null) {
      return new ByteArrayInputStream(content.getBytes(Constants.DEFAULT_CHARSET));
    }
 else {
      throw new IllegalArgumentException(Messages.JobContext_nullContent());
    }
  }
  finally {
    original.close();
  }
}
Program: 37545
Project: 37545
Buggy source:
private void testReplaceMacro(String expected,String original,Map<String,String> variables) throws Exception {
  ByteArrayInputStream in=new ByteArrayInputStream(original.getBytes(Constants.DEFAULT_CHARSET));
  InputStream result=CommonUtils.replaceMacro(in,new VariableResolver.ByMap<>(variables));
  assertEquals(expected,IOUtils.toString(result,Constants.DEFAULT_CHARSET));
}

Fixed version (ground truth):
private void testReplaceMacro(String expected,String original,Map<String,String> variables) throws Exception {
  ByteArrayInputStream in=new ByteArrayInputStream(original.getBytes(Constants.DEFAULT_CHARSET));
  InputStream result=CommonUtils.replaceMacro(in,variables == null ? null : new VariableResolver.ByMap<>(variables));
  assertEquals(expected,IOUtils.toString(result,Constants.DEFAULT_CHARSET));
}
Program: 37546
Project: 37546
Buggy source:
public void refresh(){
  refreshLegend();
  getAdapter().notifyDataSetChanged();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void refresh(){
  refreshLegend();
  getAdapter().notifyDataSetChanged();
}
Program: 37547
Project: 37547
Buggy source:
void bind(CalendarMonth month){
  if (title != null) {
    title.setText(month.getReadableMonthName());
  }
  for (int i=1; i <= weeks.length; i++) {
    weeks[i - 1].display(i,month,filterWeekDays(i,month));
  }
}

Fixed version (ground truth):
void bind(CalendarMonth month){
  if (title != null) {
    title.setText(month.getReadableMonthName());
  }
  for (int i=0; i <= weeks.length - 1; i++) {
    weeks[i].display(i,month,filterWeekDays(i,month));
  }
}
Program: 37548
Project: 37548
Buggy source:
private boolean isRightAligned(int week){
  return week == 1;
}

Fixed version (ground truth):
private boolean isRightAligned(int week){
  return week <= 1;
}
Program: 37550
Project: 37550
Buggy source:
public CommandQueue(ServerConnection serverConnection){
  EventBus.getDefault().register(this);
  mServerConnection=serverConnection;
}

Fixed version (ground truth):
public CommandQueue(Activity ctx,ServerConnection serverConnection){
  EventBus.getDefault().register(this);
  mCtx=ctx;
  mServerConnection=serverConnection;
}
Program: 37551
Project: 37551
Buggy source:
@Override public void itemUpdated(String name,String value){
  if (value != null && !value.isEmpty()) {
    try {
synchronized (mHandlers) {
        for (        CommandHandler mHandler : mHandlers) {
          try {
            if (mHandler.handleCommand(value)) {
              mCmdLog.add(new CommandInfo(value,true));
              return;
            }
          }
 catch (          Throwable t) {
            Log.e("String_Node_Str","String_Node_Str",t);
            mCmdLog.add(new CommandInfo(value,true,t));
            return;
          }
        }
      }
      Log.w("String_Node_Str","String_Node_Str" + value);
      mCmdLog.add(new CommandInfo(value,false));
    }
  finally {
      mServerConnection.updateState(name,"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
@Override public void itemUpdated(String name,String value){
  if (value != null && !value.isEmpty()) {
    try {
synchronized (mHandlers) {
        for (        CommandHandler mHandler : mHandlers) {
          try {
            if (mHandler.handleCommand(value)) {
              addToCmdLog(new CommandInfo(value,true));
              return;
            }
          }
 catch (          Throwable t) {
            Log.e("String_Node_Str","String_Node_Str",t);
            addToCmdLog(new CommandInfo(value,true,t));
            return;
          }
        }
      }
      Log.w("String_Node_Str","String_Node_Str" + value);
      addToCmdLog(new CommandInfo(value,false));
    }
  finally {
      mServerConnection.updateState(name,"String_Node_Str");
    }
  }
}
Program: 37552
Project: 37552
Buggy source:
public void updateFromPreferences(SharedPreferences prefs){
  mCmdItemName=prefs.getString("String_Node_Str","String_Node_Str");
  mCmdLog.setSize(prefs.getInt("String_Node_Str",100));
  if (mServerConnection.subscribeItems(this,false,mCmdItemName)) {
    mServerConnection.updateState(mCmdItemName,"String_Node_Str");
  }
}

Fixed version (ground truth):
public void updateFromPreferences(final SharedPreferences prefs){
  mCmdItemName=prefs.getString("String_Node_Str","String_Node_Str");
  mCtx.runOnUiThread(new Runnable(){
    @Override public void run(){
      mCmdLog.setSize(prefs.getInt("String_Node_Str",100));
    }
  }
);
  if (mServerConnection.subscribeItems(this,false,mCmdItemName)) {
    mServerConnection.updateState(mCmdItemName,"String_Node_Str");
  }
}
Program: 37553
Project: 37553
Buggy source:
public void add(CommandInfo commandInfo){
synchronized (mCommands) {
    mCommands.add(commandInfo);
  }
}

Fixed version (ground truth):
public void add(CommandInfo commandInfo){
synchronized (mCommands) {
    if (mCommands.isEmpty()) {
      mCommands.add(commandInfo);
    }
 else {
      mCommands.add(0,commandInfo);
    }
  }
  if (mCommands.size() > mSize) {
    mCommands.remove(mSize);
  }
  notifyListeners();
}
Program: 37554
Project: 37554
Buggy source:
public void trim(){
synchronized (mCommands) {
    while (mCommands.size() > mSize) {
      mCommands.remove(0);
    }
  }
}

Fixed version (ground truth):
private void trim(){
synchronized (mCommands) {
    while (mCommands.size() > mSize) {
      mCommands.remove(mSize);
    }
  }
  notifyListeners();
}
Program: 37555
Project: 37555
Buggy source:
@Override public void run(){
  if (adapter != null) {
    adapter.notifyDataSetChanged();
  }
}

Fixed version (ground truth):
@Override public void run(){
  notifyDataSetChanged();
}
Program: 37556
Project: 37556
Buggy source:
private void installAdapter(CommandLog cmdLog){
  final ListView listView=findViewById(R.id.command_log_listview);
  adapter=new CommandInfoAdapter(this,cmdLog.getCommands());
  listView.setAdapter(adapter);
}

Fixed version (ground truth):
private void installAdapter(CommandLog cmdLog){
  final ListView listView=findViewById(R.id.command_log_listview);
  adapter=new CommandInfoAdapter(this,cmdLog.getCommands());
  cmdLog.addListener(adapter);
  listView.setAdapter(adapter);
}
Program: 37557
Project: 37557
Buggy source:
/** 
 * This method checks the replace functions. The following scenarios are checked: <ol> <li>The functions do not throw an exception when invoked using sample values <li> <li>The function is null-safe if null strategy is not skip-when-null</li> </ol>
 */
@SuppressWarnings("String_Node_Str") private void checkReplaceFunctions(){
  Set<Transformation> mappings=mapper.getMapping().getMappings();
  mappings.stream().filter(t -> {
    return (t instanceof ReplaceTransformation);
  }
).map(t -> {
    return (ReplaceTransformation)t;
  }
).forEach(r -> {
    Transform<?,?> transformation=r.getTransformation();
    if (!r.isSkipWhenNull()) {
      try {
        transformation.transform(null);
      }
 catch (      NullPointerException t) {
        throw new AssertionError(NOT_NULL_SAFE + r.toString(),t);
      }
catch (      Throwable t) {
        throw new AssertionError(UNEXPECTED_EXCEPTION + r.toString(),t);
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * This method checks the replace functions. The following scenarios are checked: <ol> <li>The functions do not throw an exception when invoked using sample values <li> <li>The function is null-safe if null strategy is not skip-when-null</li> </ol>
 */
@SuppressWarnings("String_Node_Str") private void checkReplaceFunctions(){
  Set<Transformation> mappings=mapper.getMapping().getMappings();
  mappings.stream().filter(t -> {
    return (t instanceof SkipWhenNullTransformation);
  }
).map(t -> {
    return (SkipWhenNullTransformation)t;
  }
).forEach(r -> {
    Transform<?,?> transformation=r.getTransformation();
    if (!r.isSkipWhenNull()) {
      try {
        transformation.transform(null);
      }
 catch (      NullPointerException t) {
        throw new AssertionError(NOT_NULL_SAFE + r.toString(),t);
      }
catch (      Throwable t) {
        throw new AssertionError(UNEXPECTED_EXCEPTION + r.toString(),t);
      }
    }
  }
);
}
Program: 37558
Project: 37558
Buggy source:
/** 
 * This method checks that the expected replace transformations and the actual replace transformations have equal null strategies.
 */
@SuppressWarnings("String_Node_Str") private void checkReplaceTransformations(){
  Set<Transformation> mappings=mapper.getMapping().getMappings();
  mappings.stream().filter(t -> {
    return (t instanceof ReplaceTransformation);
  }
).map(t -> {
    return (ReplaceTransformation)t;
  }
).forEach(replace -> {
    Optional<ReplaceTransformation> sameTransformation=assertedTransformations().stream().filter(t -> {
      return (t instanceof ReplaceTransformation);
    }
).map(t -> {
      return (ReplaceTransformation)t;
    }
).filter(r -> {
      return r.getSourceProperty().equals(replace.getSourceProperty());
    }
).filter(r -> {
      return r.getDestinationProperty().equals(replace.getDestinationProperty());
    }
).findFirst();
    if (sameTransformation.isPresent()) {
      ReplaceTransformation assertedReplaceTransformation=sameTransformation.get();
      if (replace.isSkipWhenNull() != assertedReplaceTransformation.isSkipWhenNull()) {
        throw new AssertionError(DIFFERENT_NULL_STRATEGY + replace.toString() + "String_Node_Str"+ assertedTransformations.toString());
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * This method checks that the expected replace transformations and the actual replace transformations have equal null strategies.
 */
@SuppressWarnings("String_Node_Str") private void checkReplaceTransformations(){
  Set<Transformation> mappings=mapper.getMapping().getMappings();
  mappings.stream().filter(t -> {
    return (t instanceof SkipWhenNullTransformation);
  }
).map(t -> {
    return (SkipWhenNullTransformation)t;
  }
).forEach(replace -> {
    Optional<SkipWhenNullTransformation> sameTransformation=assertedTransformations().stream().filter(t -> {
      return (t instanceof SkipWhenNullTransformation);
    }
).map(t -> {
      return (SkipWhenNullTransformation)t;
    }
).filter(r -> {
      return r.getSourceProperty().equals(replace.getSourceProperty());
    }
).filter(r -> {
      return r.getDestinationProperty().equals(replace.getDestinationProperty());
    }
).findFirst();
    if (sameTransformation.isPresent()) {
      SkipWhenNullTransformation assertedReplaceTransformation=sameTransformation.get();
      if (replace.isSkipWhenNull() != assertedReplaceTransformation.isSkipWhenNull()) {
        throw new AssertionError(DIFFERENT_NULL_STRATEGY + replace.toString() + "String_Node_Str"+ assertedTransformations.toString());
      }
    }
  }
);
}
Program: 37559
Project: 37559
Buggy source:
/** 
 * Specifies the transformation function that will be checked against null input.
 * @param transformation The transformation to test.
 * @return Returns the {@link AssertMapping} for further configuration.
 */
public AssertMapping<S,D> andTest(Transform<RS,RD> transformation){
  denyNull("String_Node_Str",transformation);
  ReplaceTransformation<RS,RD> replace=new ReplaceTransformation<>(asserts.getMapping(),sourceProperty.property,destProperty.property,transformation,false);
  asserts.addAssertion(replace);
  return asserts;
}

Fixed version (ground truth):
/** 
 * Specifies the transformation function that will be checked against null input.
 * @param transformation The transformation to test.
 * @return Returns the {@link AssertMapping} for further configuration.
 */
public AssertMapping<S,D> andTest(Transform<RS,RD> transformation){
  denyNull("String_Node_Str",transformation);
  ReplaceCollectionTransformation<RS,RD> replace=new ReplaceCollectionTransformation<>(asserts.getMapping(),sourceProperty.property,destProperty.property,transformation,false);
  asserts.addAssertion(replace);
  return asserts;
}
Program: 37560
Project: 37560
Buggy source:
/** 
 * Transforms the items in the collection held by the selected field by applying the specified transform function on each item. <b>Note: The transform function must check the value for <code>null</code> itself. Use   {@link #withSkipWhenNull(Transform)} to skip on <code>null</code> items.</b>
 * @param transformation The transform function.
 * @return Returns the {@link Mapping} for further mapping configuration.
 */
public Mapping<S,D> with(Transform<RS,RD> transformation){
  denyNull("String_Node_Str",transformation);
  ReplaceTransformation<RS,RD> replace=new ReplaceTransformation<>(mapping,sourceProperty.property,destProperty.property,transformation,false);
  mapping.addMapping(sourceProperty.property,destProperty.property,replace);
  return mapping;
}

Fixed version (ground truth):
/** 
 * Transforms the items in the collection held by the selected field by applying the specified transform function on each item. <b>Note: The transform function must check the value for <code>null</code> itself. Use   {@link #withSkipWhenNull(Transform)} to skip on <code>null</code> items.</b>
 * @param transformation The transform function.
 * @return Returns the {@link Mapping} for further mapping configuration.
 */
public Mapping<S,D> with(Transform<RS,RD> transformation){
  denyNull("String_Node_Str",transformation);
  ReplaceCollectionTransformation<RS,RD> replace=new ReplaceCollectionTransformation<>(mapping,sourceProperty.property,destProperty.property,transformation,false);
  mapping.addMapping(sourceProperty.property,destProperty.property,replace);
  return mapping;
}
Program: 37561
Project: 37561
Buggy source:
/** 
 * Transforms the items in the collection held by the selected field by applying the specified transform function on each item if the item is not <code>null</code>. <b>This method skips the execution of the transform function if the source value is <code>null</code>.</b>
 * @param transformation The transform function.
 * @return Returns the {@link Mapping} for further mapping configuration.
 */
public Mapping<S,D> withSkipWhenNull(Transform<RS,RD> transformation){
  denyNull("String_Node_Str",transformation);
  ReplaceTransformation<RS,RD> replace=new ReplaceTransformation<>(mapping,sourceProperty.property,destProperty.property,transformation,true);
  mapping.addMapping(sourceProperty.property,destProperty.property,replace);
  return mapping;
}

Fixed version (ground truth):
/** 
 * Transforms the items in the collection held by the selected field by applying the specified transform function on each item if the item is not <code>null</code>. <b>This method skips the execution of the transform function if the source value is <code>null</code>.</b>
 * @param transformation The transform function.
 * @return Returns the {@link Mapping} for further mapping configuration.
 */
public Mapping<S,D> withSkipWhenNull(Transform<RS,RD> transformation){
  denyNull("String_Node_Str",transformation);
  ReplaceCollectionTransformation<RS,RD> replace=new ReplaceCollectionTransformation<>(mapping,sourceProperty.property,destProperty.property,transformation,true);
  mapping.addMapping(sourceProperty.property,destProperty.property,replace);
  return mapping;
}
Program: 37562
Project: 37562
Buggy source:
@Override @SuppressWarnings({"String_Node_Str","String_Node_Str"}) protected void performTransformation(PropertyDescriptor sourceProperty,Object source,PropertyDescriptor destinationProperty,Object destination) throws MappingException {
  Object sourceValue=readOrFail(sourceProperty,source);
  if (isCollection(sourceProperty.getPropertyType())) {
    if (sourceValue == null) {
      return;
    }
 else {
      Collection collection=(Collection)sourceValue;
      Collection<RD> destinationValue=null;
      if (skipWhenNull) {
        destinationValue=(Collection<RD>)collection.stream().filter(i -> (i != null)).map(sourceItem -> transformation.transform((RS)sourceItem)).collect(getCollector(collection));
      }
 else {
        destinationValue=(Collection<RD>)collection.stream().map(sourceItem -> transformation.transform((RS)sourceItem)).collect(getCollector(collection));
      }
      writeOrFail(destinationProperty,destination,destinationValue);
    }
  }
 else {
    if (sourceValue == null && skipWhenNull) {
      return;
    }
    RD destinationValue=transformation.transform((RS)sourceValue);
    writeOrFail(destinationProperty,destination,destinationValue);
  }
}

Fixed version (ground truth):
@Override @SuppressWarnings({"String_Node_Str"}) protected void performTransformation(PropertyDescriptor sourceProperty,Object source,PropertyDescriptor destinationProperty,Object destination) throws MappingException {
  Object sourceValue=readOrFail(sourceProperty,source);
  if (sourceValue == null && skipWhenNull) {
    return;
  }
  RD destinationValue=transformation.transform((RS)sourceValue);
  writeOrFail(destinationProperty,destination,destinationValue);
}
Program: 37563
Project: 37563
Buggy source:
Transform<RS,RD> getTransformation(){
  return transformation;
}

Fixed version (ground truth):
@Override Transform<RS,RD> getTransformation(){
  return transformation;
}
Program: 37564
Project: 37564
Buggy source:
boolean isSkipWhenNull(){
  return skipWhenNull;
}

Fixed version (ground truth):
@Override boolean isSkipWhenNull(){
  return skipWhenNull;
}
Program: 37565
Project: 37565
Buggy source:
@Test public void shouldSkipNullItems(){
  Mapper<Source,Destination> mapper=Mapping.from(Source.class).to(Destination.class).replaceCollection(Source::getIds,Destination::getIds).withSkipWhenNull(idBuilder()).mapper();
  Source source=Source.builder().ids(Arrays.asList(1L,null,2L,null,3L)).build();
  Destination map=mapper.map(source);
  List<Id> expected=Arrays.asList(idBuilder().transform(1L),idBuilder().transform(2L),idBuilder().transform(3L));
  List<Id> actual=map.getIds();
  assertEquals(expected,actual);
  AssertMapping.of(mapper).expectReplaceCollection(Source::getIds,Destination::getIds).andTestButSkipWhenNull(idBuilder()).ensure();
}

Fixed version (ground truth):
@Test public void shouldSkipNullItems(){
  Mapper<Source,Destination> mapper=Mapping.from(Source.class).to(Destination.class).replaceCollection(Source::getIds,Destination::getIds).withSkipWhenNull(idBuilder()).mapper();
  Source source=Source.builder().ids(Arrays.asList(1L,null,2L,null,3L)).build();
  Destination map=mapper.map(source);
  List<Id> expected=Arrays.asList(idBuilder().transform(1L),idBuilder().transform(2L),idBuilder().transform(3L));
  List<Id> actual=map.getIds();
  assertEquals(expected,actual);
  AssertMapping.of(mapper).expectReplaceCollection(Source::getIds,Destination::getIds).andSkipWhenNull().ensure();
}
Program: 37566
Project: 37566
Buggy source:
@Test public void shouldDetectDifferentNullStrategy(){
  Mapper<Source,Destination> mapper=Mapping.from(Source.class).to(Destination.class).replaceCollection(Source::getIds,Destination::getIds).with(idBuilder()).mapper();
  assertThatThrownBy(() -> {
    AssertMapping.of(mapper).expectReplaceCollection(Source::getIds,Destination::getIds).andTestButSkipWhenNull(idBuilder()).ensure();
  }
).isInstanceOf(AssertionError.class).hasMessageContaining(DIFFERENT_NULL_STRATEGY).hasNoCause();
}

Fixed version (ground truth):
@Test public void shouldDetectDifferentNullStrategy(){
  Mapper<Source,Destination> mapper=Mapping.from(Source.class).to(Destination.class).replaceCollection(Source::getIds,Destination::getIds).with(idBuilder()).mapper();
  assertThatThrownBy(() -> {
    AssertMapping.of(mapper).expectReplaceCollection(Source::getIds,Destination::getIds).andSkipWhenNull().ensure();
  }
).isInstanceOf(AssertionError.class).hasMessageContaining(DIFFERENT_NULL_STRATEGY).hasNoCause();
}
Program: 37567
Project: 37567
Buggy source:
static boolean isBool(Class<?> type){
  return type == Boolean.TYPE || type == Boolean.class;
}

Fixed version (ground truth):
static boolean isBool(Class<?> type){
  return type == Boolean.TYPE;
}
Program: 37569
Project: 37569
Buggy source:
/** 
 * Handles the case where the response body is empty
 * @param responseHeaders the response headers
 * @param clazz           the type of the response object
 * @return                the JSON object
 */
private <Result>Result handleEmptyResponse(Map<String,List<String>> responseHeaders,final Class<Result> clazz){
  InputStream in=new ByteArrayInputStream("String_Node_Str".getBytes());
  return handleJsonResponse(in,responseHeaders,clazz);
}

Fixed version (ground truth):
/** 
 * Handles the case where the response body is empty
 * @param responseHeaders the response headers
 * @param clazz           the type of the response object
 * @return                the JSON object
 */
private <Result>Result handleEmptyResponse(Map<String,List<String>> responseHeaders,final Class<Result> clazz) throws UnsupportedEncodingException {
  InputStream in=new ByteArrayInputStream("String_Node_Str".getBytes(JSON_ENCODING));
  return handleJsonResponse(in,responseHeaders,clazz);
}
Program: 37571
Project: 37571
Buggy source:
/** 
 * Handles the case where the response body is empty
 * @param responseHeaders the response headers
 * @param clazz           the type of the response object
 * @return                the JSON object
 */
private <Result>Result handleEmptyResponse(Map<String,List<String>> responseHeaders,final Class<Result> clazz){
  InputStream in=new ByteArrayInputStream("String_Node_Str".getBytes());
  return handleJsonResponse(in,responseHeaders,clazz);
}

Fixed version (ground truth):
/** 
 * Handles the case where the response body is empty
 * @param responseHeaders the response headers
 * @param clazz           the type of the response object
 * @return                the JSON object
 */
private <Result>Result handleEmptyResponse(Map<String,List<String>> responseHeaders,final Class<Result> clazz){
  InputStream in=null;
  try {
    in=new ByteArrayInputStream("String_Node_Str".getBytes(ENCODING_TYPE));
  }
 catch (  UnsupportedEncodingException ex) {
    ex.printStackTrace();
  }
  return handleJsonResponse(in,responseHeaders,clazz);
}
Program: 37573
Project: 37573
Buggy source:
/** 
 * Gets the response type.
 * @return The response type.
 */
@SuppressWarnings("String_Node_Str") public <T>Class<T> getResponseType(){
  return (Class<T>)responseClass;
}

Fixed version (ground truth):
/** 
 * Gets the response type.
 * @return The response type.
 */
@SuppressWarnings("String_Node_Str") public Class getResponseType(){
  return responseClass;
}
Program: 37575
Project: 37575
Buggy source:
@Override public void processLineForFile(BufferedReader output,IFile file) throws IOException {
  String line;
  String issue="String_Node_Str";
  line=output.readLine();
  final List<String> issues=Lists.newArrayList();
  while (line != null && !Thread.currentThread().isInterrupted()) {
    if (!line.isEmpty()) {
      issue=processLine(line,issue,issues,file);
    }
    line=output.readLine();
  }
  creator.createMarkers(issues,file);
}

Fixed version (ground truth):
@Override public void processLineForFile(BufferedReader output,IFile file) throws IOException {
  String line;
  String issue="String_Node_Str";
  line=output.readLine();
  final List<String> issues=Lists.newArrayList();
  while (line != null && !Thread.currentThread().isInterrupted()) {
    if (!line.isEmpty()) {
      issue=processLine(line,issue,issues,file);
    }
    line=output.readLine();
  }
  if (!issue.isEmpty()) {
    issues.add(issue);
  }
  creator.createMarkers(issues,file);
}
Program: 37576
Project: 37576
Buggy source:
@Override public void processLine(String line){
  if (line.startsWith(fileLocation())) {
    if (!issue.isEmpty()) {
      String[] parts=line.split("String_Node_Str");
      if (parts.length < 6) {
        return;
      }
      createMarker(parts);
      issue="String_Node_Str";
    }
    issue+=line;
  }
 else {
    issue+=(LINE_BREAK + line);
  }
}

Fixed version (ground truth):
@Override public void processLine(String line){
  if (line.startsWith(fileLocation())) {
    if (!issue.isEmpty()) {
      String[] parts=issue.split("String_Node_Str");
      if (parts.length < 6) {
        return;
      }
      createMarker(parts);
      issue="String_Node_Str";
    }
    issue+=line;
  }
 else {
    issue+=(LINE_BREAK + line);
  }
}
Program: 37577
Project: 37577
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  View v;
  AppData a;
  if (convertView == null) {
    LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    if (curMode == GRID)     v=inflater.inflate(R.layout.iconbutton,parent,false);
 else     v=inflater.inflate(R.layout.oneline,parent,false);
  }
 else {
    v=convertView;
  }
  a=toDisplay.get(position);
  img=(ImageView)v.findViewById(R.id.icon);
  v.setTag(a);
  tv=(TextView)v.findViewById(R.id.text);
  if (appShortcut != Options.ICON) {
    if (appShortcut == Options.TEXT) {
      img.setVisibility(View.GONE);
    }
    tv.setText(a.name);
    tv.setTextSize(textSize);
    if (theme == Options.LIGHT || theme == Options.WALLPAPER_DARK || theme == Options.DEFAULT_THEME) {
      tv.setTextColor(Color.BLACK);
    }
 else {
      tv.setTextColor(Color.WHITE);
    }
    tv.setTypeface(Typeface.DEFAULT,Integer.parseInt(options.getString(Options.PREF_FONT_STYLE,"String_Node_Str")));
  }
 else {
    tv.setVisibility(View.GONE);
  }
  if (appShortcut >= Options.ICON) {
    IconPackManager.setIcon(Apps.this,img,a);
    img.setVisibility(View.VISIBLE);
    ViewGroup.LayoutParams p=img.getLayoutParams();
    p.width=iconSize;
    p.height=iconSize;
    img.setLayoutParams(p);
  }
  v.setOnClickListener(onClickListener);
  v.setOnLongClickListener(onLongClickListener);
  return v;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  View v;
  AppData a;
  if (convertView == null) {
    LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    if (options.getBoolean(Options.PREF_TILE,true))     v=inflater.inflate(R.layout.iconbutton,parent,false);
 else     v=inflater.inflate(R.layout.oneline,parent,false);
  }
 else {
    v=convertView;
  }
  a=toDisplay.get(position);
  img=(ImageView)v.findViewById(R.id.icon);
  v.setTag(a);
  tv=(TextView)v.findViewById(R.id.text);
  if (appShortcut != Options.ICON) {
    if (appShortcut == Options.TEXT) {
      img.setVisibility(View.GONE);
    }
    tv.setText(a.name);
    tv.setTextSize(textSize);
    if (theme == Options.LIGHT || theme == Options.WALLPAPER_DARK || theme == Options.DEFAULT_THEME) {
      tv.setTextColor(Color.BLACK);
    }
 else {
      tv.setTextColor(Color.WHITE);
    }
    tv.setTypeface(Typeface.DEFAULT,Integer.parseInt(options.getString(Options.PREF_FONT_STYLE,"String_Node_Str")));
  }
 else {
    tv.setVisibility(View.GONE);
  }
  if (appShortcut >= Options.ICON) {
    IconPackManager.setIcon(Apps.this,img,a);
    img.setVisibility(View.VISIBLE);
    ViewGroup.LayoutParams p=img.getLayoutParams();
    p.width=iconSize;
    p.height=iconSize;
    img.setLayoutParams(p);
  }
  v.setOnClickListener(onClickListener);
  v.setOnLongClickListener(onLongClickListener);
  return v;
}
Program: 37578
Project: 37578
Buggy source:
public void loadFilteredApps(){
  curCatData=categories.filterApps(map);
  if (options.getBoolean(Options.PREF_TILE,true)) {
    makeAppGrid();
  }
 else {
    makeAppList();
  }
}

Fixed version (ground truth):
public void loadFilteredApps(){
  curCatData=categories.filterApps(map);
  adapter.update(curCatData);
}
Program: 37579
Project: 37579
Buggy source:
@Override public boolean onKeyDown(int keyCode,KeyEvent event){
  if (keyCode == KeyEvent.KEYCODE_MENU) {
    menu();
    return true;
  }
 else   if (keyCode == KeyEvent.KEYCODE_BACK) {
    if (searchIsOpened) {
      closeSearch();
      searchIsOpened=false;
    }
    if (categories.getCurCategory().equals(CategoryManager.HIDDEN)) {
      findViewById(R.id.quit_hidden_apps).setVisibility(View.GONE);
      findViewById(R.id.tabs).setVisibility(View.VISIBLE);
    }
    categories.prevCategory();
    loadFilteredApps();
    setSpinner();
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean onKeyDown(int keyCode,KeyEvent event){
  if (keyCode == KeyEvent.KEYCODE_MENU) {
    menu();
    return true;
  }
 else   if (keyCode == KeyEvent.KEYCODE_BACK) {
    if (searchIsOpened) {
      closeSearch();
      searchIsOpened=false;
    }
    if (categories.getCurCategory().equals(CategoryManager.HIDDEN)) {
      findViewById(R.id.quit_hidden_apps).setVisibility(View.GONE);
      findViewById(R.id.tabs).setVisibility(View.VISIBLE);
      categories.setCurCategory(CategoryManager.ALL);
    }
 else {
      categories.prevCategory();
    }
    loadFilteredApps();
    setSpinner();
    return true;
  }
  return false;
}
Program: 37581
Project: 37581
Buggy source:
public void onMyClick(View v){
switch (v.getId()) {
case R.id.searchButton:
    openSearch();
  break;
case R.id.menuButton:
menu();
break;
case R.id.quit_hidden_apps:
categories.setCurCategory(CategoryManager.ALL);
v.setVisibility(View.GONE);
findViewById(R.id.tabs).setVisibility(View.VISIBLE);
loadFilteredApps();
break;
}
}

Fixed version (ground truth):
public void onMyClick(View v){
switch (v.getId()) {
case R.id.searchButton:
    openSearch();
  break;
case R.id.menuButton:
menu();
break;
case R.id.quit_hidden_apps:
categories.setCurCategory(CategoryManager.ALL);
v.setVisibility(View.GONE);
findViewById(R.id.tabs).setVisibility(View.VISIBLE);
loadFilteredApps();
setSpinner();
break;
}
}
Program: 37583
Project: 37583
Buggy source:
public Bitmap transformDrawable(Drawable d){
  Bitmap b=((BitmapDrawable)d).getBitmap();
  if ((iconBacks == null && iconMask == null && iconUpon == null && factor == 1.f) || !transformDrawable) {
    return b;
  }
  int w, h;
  Paint paint;
  if (iconBacks != null) {
    w=iconBacks.get(0).getWidth();
    h=iconBacks.get(0).getHeight();
  }
 else {
    w=b.getWidth();
    h=b.getHeight();
  }
  Bitmap result=Bitmap.createBitmap(w,h,Bitmap.Config.ARGB_8888);
  Canvas canvas=new Canvas(result);
  if (iconBacks != null) {
    canvas.drawBitmap(iconBacks.get((int)(Math.random() * iconBacks.size())),0,0,null);
  }
  paint=new Paint(Paint.ANTI_ALIAS_FLAG);
  Bitmap scaledBitmap=Bitmap.createScaledBitmap(b,(int)(w * factor),(int)(h * factor),false);
  canvas.drawBitmap(scaledBitmap,w * (1 - factor) / 2,h * (1 - factor) / 2,paint);
  if (iconMask != null) {
    paint.setXfermode(new PorterDuffXfermode(Mode.DST_OUT));
    canvas.drawBitmap(iconMask,0.f,0.f,paint);
    paint.setXfermode(null);
  }
  if (iconUpon != null) {
    canvas.drawBitmap(iconUpon,0,0,null);
  }
  return result;
}

Fixed version (ground truth):
public Bitmap transformDrawable(Drawable d){
  Bitmap b=((BitmapDrawable)d).getBitmap();
  if ((iconBacks == null && iconMask == null && iconUpon == null && factor == 1.f) || !transformDrawable) {
    return b;
  }
  int w, h;
  Paint paint;
  if (iconBacks != null) {
    if (iconBacks.size() > 0) {
      w=iconBacks.get(0).getWidth();
      h=iconBacks.get(0).getHeight();
    }
 else {
      w=b.getWidth();
      h=b.getHeight();
    }
  }
 else {
    w=b.getWidth();
    h=b.getHeight();
  }
  Bitmap result=Bitmap.createBitmap(w,h,Bitmap.Config.ARGB_8888);
  Canvas canvas=new Canvas(result);
  if (iconBacks != null) {
    if (iconBacks.size() > 0) {
      canvas.drawBitmap(iconBacks.get((int)(Math.random() * iconBacks.size())),0,0,null);
    }
  }
  paint=new Paint(Paint.ANTI_ALIAS_FLAG);
  Bitmap scaledBitmap=Bitmap.createScaledBitmap(b,(int)(w * factor),(int)(h * factor),false);
  canvas.drawBitmap(scaledBitmap,w * (1 - factor) / 2,h * (1 - factor) / 2,paint);
  if (iconMask != null) {
    paint.setXfermode(new PorterDuffXfermode(Mode.DST_OUT));
    canvas.drawBitmap(iconMask,0.f,0.f,paint);
    paint.setXfermode(null);
  }
  if (iconUpon != null) {
    canvas.drawBitmap(iconUpon,0,0,null);
  }
  return result;
}
Program: 37585
Project: 37585
Buggy source:
@Override public Observable<TrafficManagerProfile> updateResourceAsync(){
  final TrafficManagerProfileImpl self=this;
  final ProfilesInner innerCollection=this.manager().inner().profiles();
  return self.endpoints.commitAndGetAllAsync().flatMap(new Func1<List<TrafficManagerEndpointImpl>,Observable<? extends TrafficManagerProfile>>(){
    public Observable<? extends TrafficManagerProfile> call(    List<TrafficManagerEndpointImpl> endpoints){
      return innerCollection.createOrUpdateAsync(resourceGroupName(),name(),inner()).map(new Func1<ProfileInner,TrafficManagerProfile>(){
        @Override public TrafficManagerProfile call(        ProfileInner profileInner){
          self.setInner(profileInner);
          return self;
        }
      }
);
    }
  }
);
}

Fixed version (ground truth):
@Override public Observable<TrafficManagerProfile> updateResourceAsync(){
  final TrafficManagerProfileImpl self=this;
  final ProfilesInner innerCollection=this.manager().inner().profiles();
  return self.endpoints.commitAndGetAllAsync().flatMap(new Func1<List<TrafficManagerEndpointImpl>,Observable<? extends TrafficManagerProfile>>(){
    public Observable<? extends TrafficManagerProfile> call(    List<TrafficManagerEndpointImpl> endpoints){
      List<EndpointInner> innerEndpoints=new ArrayList<>();
      for (      TrafficManagerEndpointImpl ei : endpoints) {
        innerEndpoints.add(ei.inner());
      }
      inner().withEndpoints(innerEndpoints);
      return innerCollection.createOrUpdateAsync(resourceGroupName(),name(),inner()).map(new Func1<ProfileInner,TrafficManagerProfile>(){
        @Override public TrafficManagerProfile call(        ProfileInner profileInner){
          self.setInner(profileInner);
          return self;
        }
      }
);
    }
  }
);
}
Program: 37587
Project: 37587
Buggy source:
@Override public DeploymentImpl beginCreate(){
  if (creatableResourceGroup != null) {
    creatableResourceGroup.create();
  }
  DeploymentInner inner=new DeploymentInner().withProperties(new DeploymentProperties());
  inner.properties().withMode(mode());
  inner.properties().withTemplate(template());
  inner.properties().withTemplateLink(templateLink());
  inner.properties().withParameters(parameters());
  inner.properties().withParametersLink(parametersLink());
  this.manager().inner().deployments().beginCreateOrUpdate(resourceGroupName(),name(),inner);
  return this;
}

Fixed version (ground truth):
@Override public DeploymentImpl beginCreate(){
  if (creatableResourceGroup != null) {
    creatableResourceGroup.create();
  }
  DeploymentInner inner=new DeploymentInner().withProperties(new DeploymentProperties());
  inner.properties().withMode(mode());
  inner.properties().withTemplate(template());
  inner.properties().withTemplateLink(templateLink());
  inner.properties().withParameters(parameters());
  inner.properties().withParametersLink(parametersLink());
  setInner(this.manager().inner().deployments().beginCreateOrUpdate(resourceGroupName(),name(),inner));
  return this;
}