auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private Path getCurrentLoadPath() throws IOException, SemanticException { Path loadPathBase = new Path(conf.getVar(HiveConf.ConfVars.REPLDIR), Base64.getEncoder().encodeToString(sourceDbNameOrPattern.toLowerCase() .getBytes(StandardCharsets.UTF_8.name()))); final FileSystem fs = loadPathBase.getFileSystem(conf); loadPathBase = fs.makeQualified(loadPathBase); if (!fs.exists(loadPathBase)) { LOG.error("File not found " + loadPathBase.toUri().toString()); throw new FileNotFoundException(ErrorMsg.REPL_LOAD_PATH_NOT_FOUND.getMsg()); } FileStatus[] statuses = loadPathBase.getFileSystem(conf).listStatus(loadPathBase); if (statuses.length > 0) { Arrays.sort(statuses, new Comparator<FileStatus>() { public int compare(FileStatus f1, FileStatus f2) { return Long.compare(f1.getModificationTime(), f2.getModificationTime()); } }); if (replScope.getDbName() != null) { String currentReplStatusOfTarget = getReplStatus(replScope.getDbName()); if (currentReplStatusOfTarget == null) { return statuses[0].getPath(); } else { DumpMetaData latestDump = new DumpMetaData(statuses[statuses.length - 1].getPath(), conf); if (Long.parseLong(currentReplStatusOfTarget) >= latestDump.getEventTo().longValue()) { isTargetAlreadyLoaded = true; } else { for (FileStatus status : statuses) { DumpMetaData dmd = new DumpMetaData(status.getPath(), conf); if (dmd.isIncrementalDump() && Long.parseLong(currentReplStatusOfTarget) < dmd.getEventTo().longValue()) { return status.getPath(); } } } } } return statuses[statuses.length - 1].getPath(); } return null; }

Target:
private Path getCurrentLoadPath() throws IOException, SemanticException { Path loadPathBase = new Path(conf.getVar(HiveConf.ConfVars.REPLDIR), Base64.getEncoder().encodeToString(sourceDbNameOrPattern.toLowerCase() .getBytes(StandardCharsets.UTF_8.name()))); final FileSystem fs = loadPathBase.getFileSystem(conf); loadPathBase = fs.makeQualified(loadPathBase); if (!fs.exists(loadPathBase)) { LOG.error("File not found " + loadPathBase.toUri().toString()); throw new FileNotFoundException(ErrorMsg.REPL_LOAD_PATH_NOT_FOUND.getMsg()); } FileStatus[] statuses = loadPathBase.getFileSystem(conf).listStatus(loadPathBase); if (statuses.length > 0) { Arrays.sort(statuses, new Comparator<FileStatus>() { public int compare(FileStatus f1, FileStatus f2) { return Long.compare(f1.getModificationTime(), f2.getModificationTime()); } }); if (replScope.getDbName() != null) { String currentReplStatusOfTarget = getReplStatus(replScope.getDbName()); if (currentReplStatusOfTarget == null) { return statuses[0].getPath(); } else { DumpMetaData latestDump = new DumpMetaData(statuses[statuses.length - 1].getPath(), conf); if (Long.parseLong(currentReplStatusOfTarget.trim()) >= latestDump.getEventTo()) { isTargetAlreadyLoaded = true; } else { for (FileStatus status : statuses) { DumpMetaData dmd = new DumpMetaData(status.getPath(), conf); if (dmd.isIncrementalDump() && Long.parseLong(currentReplStatusOfTarget.trim()) < dmd.getEventTo()) { return status.getPath(); } } } } } else { throw new UnsupportedOperationException("REPL LOAD * is not supported"); } } return null; }
Source:
private byte newCellState(byte cellSelf, byte neighbourCount) { if (cellSelf == 0) { if (neighbourCount == 3) return (byte) 1; else return (byte) 0; } else { if (neighbourCount == 2 || neighbourCount == 3) return (byte) 1; else return (byte) 0; } }

Target:
private byte newCellState(byte cellSelf, byte neighbourCount) { if (cellSelf == 0) { if (neighbourCount == 3) { return (byte) 1; } else { return (byte) 0; } } else { if (neighbourCount == 2 || neighbourCount == 3) { return (byte) 1; } else { return (byte) 0; } } }
Source:
public ZkclientZookeeperClient(URL url) { super(url); long timeout = url.getParameter("timeout", 30000L); client = new ZkClientWrapper(url.getBackupAddress(), timeout); client.addListener(new IZkStateListener() { @Override public void handleStateChanged(KeeperState state) throws Exception { ZkclientZookeeperClient.this.state = state; if (state == KeeperState.Disconnected) { stateChanged(StateListener.DISCONNECTED); } else if (state == KeeperState.SyncConnected) { stateChanged(StateListener.CONNECTED); } } @Override public void handleNewSession() throws Exception { stateChanged(StateListener.RECONNECTED); } }); client.start(); }

Target:
public ZkclientZookeeperClient(URL url) { super(url); long timeout = url.getParameter(Constants.TIMEOUT_KEY, 30000L); client = new ZkClientWrapper(url.getBackupAddress(), timeout); client.addListener(new IZkStateListener() { @Override public void handleStateChanged(KeeperState state) throws Exception { ZkclientZookeeperClient.this.state = state; if (state == KeeperState.Disconnected) { stateChanged(StateListener.DISCONNECTED); } else if (state == KeeperState.SyncConnected) { stateChanged(StateListener.CONNECTED); } } @Override public void handleNewSession() throws Exception { stateChanged(StateListener.RECONNECTED); } }); client.start(); }
Source:
public Handle open() { try { final long start = System.nanoTime(); Connection conn = connectionFactory.openConnection(); final long stop = System.nanoTime(); StatementBuilder cache = statementBuilderFactory.get().createStatementBuilder(conn); Handle h = new BasicHandle(transactionhandler.get(), statementLocator.get(), cache, statementRewriter.get(), conn, globalStatementAttributes, timingCollector.get(), MappingRegistry.copyOf(mappingRegistry), foreman.createChild(), collectorFactoryRegistry.createChild()); plugins.forEach(p -> p.customizeHandle(h)); LOG.trace("DBI obtain handle in {}ms", this, h, (stop - start) / 1000000L); return h; } catch (SQLException e) { throw new UnableToObtainConnectionException(e); } }

Target:
public Handle open() { try { final long start = System.nanoTime(); Connection conn = connectionFactory.openConnection(); final long stop = System.nanoTime(); StatementBuilder cache = statementBuilderFactory.get().createStatementBuilder(conn); Handle h = new BasicHandle(transactionhandler.get(), statementLocator.get(), cache, statementRewriter.get(), conn, globalStatementAttributes, timingCollector.get(), MappingRegistry.copyOf(mappingRegistry), foreman.createChild(), collectorFactoryRegistry.createChild()); for (JdbiPlugin p : plugins) { h = p.customizeHandle(h); } LOG.trace("DBI obtain handle in {}ms", this, h, (stop - start) / 1000000L); return h; } catch (SQLException e) { throw new UnableToObtainConnectionException(e); } }
Source:
public UpdateGlusterHostPubKeyToSlaveParameters(Guid vdsId, List<String> pubKeys) { this(vdsId, pubKeys, "root"); }

Target:
public UpdateGlusterHostPubKeyToSlaveParameters(Guid vdsId, List<String> pubKeys) { this(vdsId, pubKeys, null); }
Source:
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack heldItem = player.getHeldItem(hand); if (!heldItem.isEmpty()) { TileCookingTable tileEntity = (TileCookingTable) world.getTileEntity(pos); if (tileEntity != null) { if (DyeUtils.isDye(heldItem)) { Optional<EnumDyeColor> dyeColor = DyeUtils.colorFromStack(heldItem); if (dyeColor.isPresent() && recolorBlock(world, pos, facing, dyeColor.get())) { if (!player.isCreative()) { heldItem.shrink(1); } } return true; } if (!tileEntity.hasNoFilterBook() && heldItem.getItem() == ModItems.recipeBook && heldItem.getItemDamage() == 0) { tileEntity.setNoFilterBook(heldItem.splitStack(1)); return true; } } } else if (player.isSneaking()) { TileCookingTable tileEntity = (TileCookingTable) world.getTileEntity(pos); if (tileEntity != null) { ItemStack noFilterBook = tileEntity.getNoFilterBook(); if (!noFilterBook.isEmpty()) { if (!player.inventory.addItemStackToInventory(noFilterBook)) { player.dropItem(noFilterBook, false); } tileEntity.setNoFilterBook(ItemStack.EMPTY); return true; } } } if (!world.isRemote) { player.openGui(CookingForBlockheads.instance, GuiHandler.COOKING_TABLE, world, pos.getX(), pos.getY(), pos.getZ()); } return true; }

Target:
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack heldItem = player.getHeldItem(hand); if (!heldItem.isEmpty()) { TileCookingTable tileEntity = (TileCookingTable) world.getTileEntity(pos); if (tileEntity != null) { if (DyeUtils.isDye(heldItem)) { Optional<EnumDyeColor> dyeColor = DyeUtils.colorFromStack(heldItem); if (dyeColor.isPresent() && recolorBlock(world, pos, facing, dyeColor.get())) { if (!player.capabilities.isCreativeMode) { heldItem.shrink(1); } } return true; } if (!tileEntity.hasNoFilterBook() && heldItem.getItem() == ModItems.recipeBook && heldItem.getItemDamage() == 0) { tileEntity.setNoFilterBook(heldItem.splitStack(1)); return true; } } } else if (player.isSneaking()) { TileCookingTable tileEntity = (TileCookingTable) world.getTileEntity(pos); if (tileEntity != null) { ItemStack noFilterBook = tileEntity.getNoFilterBook(); if (!noFilterBook.isEmpty()) { if (!player.inventory.addItemStackToInventory(noFilterBook)) { player.dropItem(noFilterBook, false); } tileEntity.setNoFilterBook(ItemStack.EMPTY); return true; } } } if (!world.isRemote) { player.openGui(CookingForBlockheads.instance, GuiHandler.COOKING_TABLE, world, pos.getX(), pos.getY(), pos.getZ()); } return true; }
Source:
public static Map<String, DcZkInfo> parseDcJsonAndPopulateDcInfo(String dcInfoJsonString) throws JSONException { Map<String, DcZkInfo> dataCenterToZkAddress = new HashMap<>(); JSONObject root = new JSONObject(dcInfoJsonString); JSONArray all = root.getJSONArray(ZKINFO_STR); for (int i = 0; i < all.length(); i++) { JSONObject entry = all.getJSONObject(i); String name = entry.getString(DATACENTER_STR); byte id = (byte) entry.getInt(DATACENTER_ID_STR); ReplicaType replicaType = entry.optEnum(ReplicaType.class, REPLICA_TYPE_STR, ReplicaType.DISK_BACKED); String[] zkConnectStrs = (replicaType == ReplicaType.DISK_BACKED) ? entry.getString(ZKCONNECTSTR_STR).split(ZKCONNECTSTR_DELIMITER) : entry.optString(ZKCONNECTSTR_STR).split(ZKCONNECTSTR_DELIMITER); DcZkInfo dcZkInfo = new DcZkInfo(name, id, Arrays.asList(zkConnectStrs), replicaType); dataCenterToZkAddress.put(dcZkInfo.dcName, dcZkInfo); } return dataCenterToZkAddress; }

Target:
public static Map<String, DcZkInfo> parseDcJsonAndPopulateDcInfo(String dcInfoJsonString) throws JSONException { Map<String, DcZkInfo> dataCenterToZkAddress = new HashMap<>(); JSONObject root = new JSONObject(dcInfoJsonString); JSONArray all = root.getJSONArray(ZKINFO_STR); for (int i = 0; i < all.length(); i++) { JSONObject entry = all.getJSONObject(i); String name = entry.getString(DATACENTER_STR); byte id = (byte) entry.getInt(DATACENTER_ID_STR); ReplicaType replicaType = entry.optEnum(ReplicaType.class, REPLICA_TYPE_STR, ReplicaType.DISK_BACKED); ArrayList<String> zkConnectStrs = (replicaType == ReplicaType.DISK_BACKED) ? Utils.splitString(entry.getString(ZKCONNECT_STR), ZKCONNECT_STR_DELIMITER) : Utils.splitString(entry.optString(ZKCONNECT_STR), ZKCONNECT_STR_DELIMITER); DcZkInfo dcZkInfo = new DcZkInfo(name, id, zkConnectStrs, replicaType); dataCenterToZkAddress.put(dcZkInfo.dcName, dcZkInfo); } return dataCenterToZkAddress; }
Source:
public void defaultRealm() throws InterruptedException { SyncCredentials credentials = SyncCredentials.nickname("test", true); SyncUser user = SyncUser.login(credentials, Constants.AUTH_URL); SyncConfiguration config = SyncConfiguration.automatic(); Realm realm = Realm.getInstance(config); SyncManager.getSession(config).downloadAllServerChanges(); realm.refresh(); try { assertFalse(realm.isEmpty()); } finally { realm.close(); user.logout(); } }

Target:
public void defaultRealm() throws InterruptedException { SyncCredentials credentials = SyncCredentials.nickname("test", true); SyncUser user = SyncUser.logIn(credentials, Constants.AUTH_URL); SyncConfiguration config = SyncConfiguration.automatic(); Realm realm = Realm.getInstance(config); SyncManager.getSession(config).downloadAllServerChanges(); realm.refresh(); try { assertFalse(realm.isEmpty()); } finally { realm.close(); user.logOut(); } }
Source:
public void process() { Class<?> cls; try { cls = this.getKlass(); } catch (final ClassNotFoundException e) { try { this.fail("missing class", this.klass); } catch (final IOException ex) { throw new QlessException(ex); } throw new QlessException("class not found: " + this.klass, e); } Method method; try { method = cls.getMethod(this.queueName, Job.class); } catch (NoSuchMethodException | SecurityException e) { try { this.fail(e.getMessage(), this.klass + ":" + this.queueName); } catch (final IOException ex) { throw new QlessException(ex); } throw new QlessException("method not found: " + this.queueName, e); } try { if (Modifier.isStatic(method.getModifiers())) { method.invoke(cls, this); } else { method.invoke(cls.newInstance(), this); } } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | InstantiationException e) { try { this.fail(e.getMessage(), this.klass + ":" + this.queueName); } catch (final IOException ex) { throw new QlessException(ex); } throw new QlessException("fail to invoke " + this.queueName, e); } }

Target:
public void process() throws IOException { Class<?> cls; try { cls = this.getKlass(); } catch (final ClassNotFoundException e) { try { this.fail("missing class", this.klass); } catch (final IOException ex) { throw new QlessException(ex); } throw new QlessException("class not found: " + this.klass, e); } Method method; try { method = cls.getMethod(this.queueName, Job.class); } catch (final NoSuchMethodException e) { try { method = cls.getMethod(ClientHelper.DEFAULT_JOB_METHOD, Job.class); } catch (NoSuchMethodException | SecurityException ex) { this.fail(ex.getMessage(), this.klass + ":" + this.queueName); throw new QlessException("method not found: " + this.queueName, e); } } try { if (Modifier.isStatic(method.getModifiers())) { method.invoke(cls, this); } else { method.invoke(cls.newInstance(), this); } } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | InstantiationException e) { try { this.fail(e.getMessage(), this.klass + ":" + this.queueName); } catch (final IOException ex) { throw new QlessException(ex); } throw new QlessException("fail to invoke " + this.queueName, e); } }
Source:
public void queueEvent(FacesEvent event) { if (event instanceof FileUploadEvent) { queuedFileUploadEvents += 1; } super.queueEvent(event); }

Target:
public void queueEvent(FacesEvent event) { if (event instanceof FileUploadEvent) { queuedFileUploadEvents().addAndGet(1); } super.queueEvent(event); }
Source:
public boolean canContinue(CruiseConfig cruiseConfig) { if (!goConfigService.isUserAdmin(user)) { result.unauthorized(LocalizedMessage.string("UNAUTHORIZED_TO_OPERATE"), HealthStateType.unauthorised()); return false; } CaseInsensitiveString environmentName = environmentConfig.name(); if (goConfigService.hasEnvironmentNamed(environmentName)) { result.conflict(LocalizedMessage.string("CANNOT_ADD_ENV_ALREADY_EXISTS", environmentName)); return false; } return true; }

Target:
public boolean canContinue(CruiseConfig cruiseConfig) { if (!goConfigService.isUserAdmin(user)) { result.unauthorized(LocalizedMessage.string("UNAUTHORIZED_TO_OPERATE"), HealthStateType.unauthorised()); return false; } CaseInsensitiveString environmentName = environmentConfig.name(); if (goConfigService.hasEnvironmentNamed(environmentName)) { result.conflict(LocalizedMessage.string("RESOURCE_ALREADY_EXISTS", "environment", environmentName)); return false; } return true; }
Source:
public Optional<Key> authenticate(BasicCredentials credentials) throws AuthenticationException { Key key = new Key(credentials.getUsername(), credentials.getPassword()); if (key == null) { return Optional.absent(); } if (!allKeys.contains(key)) { return Optional.absent(); } return Optional.of(key); }

Target:
public Optional<Key> authenticate(BasicCredentials credentials) throws AuthenticationException { Key key = new Key(credentials.getUsername(), credentials.getPassword()); if (!allKeys.contains(key)) { return Optional.absent(); } return Optional.of(key); }
Source:
private PostgresDatabase() { try { Class.forName("org.postgresql.Driver"); PostgresDatabase.connectionURL = "jdbc:postgresql:" + getDatabasePath() + File.separator + getDatabaseName(); LOGGER.debug("Database connection URL is: " + PostgresDatabase.connectionURL); storeResponseSerialNumberLock = new Object(); } catch (ClassNotFoundException cnf_ex) { LOGGER.error("Database class could not be loaded", cnf_ex); throw new UnsupportedDatabaseException("The database class could not be loaded."); } }

Target:
private PostgresDatabase() { try { Class.forName("org.postgresql.Driver"); PostgresDatabase.connectionURL = "jdbc:postgresql:" + getDatabasePath() + File.separator + getDatabaseName(); LOGGER.debug("Database connection URL is: " + PostgresDatabase.connectionURL); storeResponseSerialNumberLock = new Object(); PropertyUtil propertyUtil = new PropertyUtil(server.getDatabase().getPropertyArray(), KEY_DATABASE_ROOT); if (propertyUtil.extractBoolean(KEY_DATABASE_WIPE_ENABLED, DEFAULT_DATABASE_WIPE_ENABLED)) { long periodMillis = propertyUtil.extractPeriodAsMillis(KEY_DATABASE_WIPE_PERIOD, DEFAULT_DATABASE_WIPE_PERIOD); long thresholdMillis = propertyUtil.extractPeriodAsMillis(KEY_DATABASE_WIPE_THRESHOLD, DEFAULT_DATABASE_WIPE_THRESHOLD); wipeTimer = new Timer(getClass().getSimpleName() + " Postgres Wiper", true); wipeTimer.scheduleAtFixedRate(new PostgresDatabase.WipeTimerTask(thresholdMillis), 0, periodMillis); LOGGER.info("Started Postgres wiper timer; period ms, threshold ms", new Object[]{getDatabaseName(), periodMillis, thresholdMillis}); } else { wipeTimer = null; } } catch (ClassNotFoundException cnf_ex) { LOGGER.error("Database class could not be loaded", cnf_ex); throw new UnsupportedDatabaseException("The database class could not be loaded."); } }
Source:
private void setupDynamicItems() { if (usernameContainer == null) { usernameContainer = getView().findViewById(R.id.nav_item_username); usernamePrimaryText = (TextView) usernameContainer.findViewById(R.id.nav_item_username_primary_text); loginContainer = getView().findViewById(R.id.nav_item_login); } if (app.getUserInfoStorage().isLoggedIn()) { loginContainer.setVisibility(View.GONE); usernameContainer.setVisibility(View.VISIBLE); usernamePrimaryText.setText(app.getUserInfoStorage().getUser().getUsername()); } else { usernameContainer.setVisibility(View.GONE); loginContainer.setVisibility(View.VISIBLE); } if (wikipediaZeroText == null) { wikipediaZeroText = (TextView) getView().findViewById(R.id.nav_item_zero); } if (WikipediaApp.isWikipediaZeroDevmodeOn() && WikipediaApp.getWikipediaZeroDisposition()) { wikipediaZeroText.setText(WikipediaApp.getCarrierMessage()); wikipediaZeroText.setVisibility(View.VISIBLE); } else { wikipediaZeroText.setText(""); wikipediaZeroText.setVisibility(View.GONE); } }

Target:
private void setupDynamicItems() { if (usernameContainer == null) { usernameContainer = getView().findViewById(R.id.nav_item_username); usernamePrimaryText = (TextView) usernameContainer.findViewById(R.id.nav_item_username_primary_text); loginContainer = getView().findViewById(R.id.nav_item_login); } if (app.getUserInfoStorage().isLoggedIn()) { loginContainer.setVisibility(View.GONE); usernameContainer.setVisibility(View.VISIBLE); usernamePrimaryText.setText(app.getUserInfoStorage().getUser().getUsername()); } else { usernameContainer.setVisibility(View.GONE); loginContainer.setVisibility(View.VISIBLE); } if (WikipediaApp.isWikipediaZeroDevmodeOn() && WikipediaApp.getWikipediaZeroDisposition()) { wikipediaZeroText.setText(WikipediaApp.getCarrierMessage()); wikipediaZeroText.setVisibility(View.VISIBLE); } else { wikipediaZeroText.setVisibility(View.GONE); } }
Source:
public SpongePotionBuilder() { super(PotionEffect.class, 2); }

Target:
public SpongePotionBuilder() { super(PotionEffect.class, DataVersions.Potion.CURRENT_VERSION); }
Source:
private static void setPermissions(Path path) throws IOException { if (path.getFileSystem().supportedFileAttributeViews().contains("posix")) { Files.setPosixFilePermissions(path, ONLY_OWNER_FILE_PERMISSIONS); } else { path.toFile().setReadable(false, false); path.toFile().setWritable(false, false); path.toFile().setExecutable(false, false); path.toFile().setReadable(true, true); path.toFile().setWritable(true, true); } }

Target:
private static void setPermissions(Path path) throws IOException { path.toFile().setReadable(false, false); path.toFile().setWritable(false, false); path.toFile().setExecutable(false, false); path.toFile().setReadable(true, true); path.toFile().setWritable(true, true); }
Source:
public void shouldNotRaiseAlertIfRequestParamsHaveNoValues() throws URIException, NullPointerException { HttpMessage msg = createMessage(); msg.getRequestHeader().setURI(new URI("<LINK_0>", false)); msg.getResponseHeader().setHeader(HttpResponseHeader.SET_COOKIE, "Set-Cookie: aCookie=aValue; Secure"); rule.scanHttpResponseReceive(msg, -1, createSource(msg)); assertThat(alertsRaised.size(), equalTo(0)); }

Target:
public void shouldNotRaiseAlertIfRequestParamsHaveNoValues() throws Exception { HttpMessage msg = createMessage(); msg.getRequestHeader().setURI(new URI("<LINK_0>", false)); rule.scanHttpResponseReceive(msg, -1, createSource(msg)); assertThat(alertsRaised.size(), equalTo(0)); }
Source:
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { final IndentingPrintWriter ipw = new IndentingPrintWriter(pw, " "); ipw.println("DeviceStateMonitor:"); ipw.increaseIndent(); ipw.println("mIsTetheringOn=" + mIsTetheringOn); ipw.println("mIsInteractive=" + mIsInteractive); ipw.println("mIsCharging=" + mIsCharging); ipw.println("mIsPowerSaveOn=" + mIsPowerSaveOn); ipw.println("mLegacyScreenState=" + mLegacyScreenState); ipw.println("mIsLowDataExpected=" + mIsLowDataExpected); ipw.println("mUnsolicitedResponseFilter=" + mUnsolicitedResponseFilter); ipw.println("++++++++++++++++++++++++++++++++"); ipw.println("Local logs:") ipw.increaseIndent(); mLocalLog.dump(fd, ipw, args); ipw.decreaseIndent(); ipw.decreaseIndent(); ipw.println("++++++++++++++++++++++++++++++++"); ipw.flush(); }

Target:
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { final IndentingPrintWriter ipw = new IndentingPrintWriter(pw, " "); ipw.println("DeviceStateMonitor:"); ipw.increaseIndent(); ipw.println("mIsTetheringOn=" + mIsTetheringOn); ipw.println("mIsInteractive=" + mIsInteractive); ipw.println("mIsCharging=" + mIsCharging); ipw.println("mIsPowerSaveOn=" + mIsPowerSaveOn); ipw.println("mLegacyScreenState=" + mLegacyScreenState); ipw.println("mIsLowDataExpected=" + mIsLowDataExpected); ipw.println("mUnsolicitedResponseFilter=" + mUnsolicitedResponseFilter); ipw.println("++++++++++++++++++++++++++++++++"); ipw.println("Local logs:"); ipw.increaseIndent(); mLocalLog.dump(fd, ipw, args); ipw.decreaseIndent(); ipw.decreaseIndent(); ipw.println("++++++++++++++++++++++++++++++++"); ipw.flush(); }
Source:
private String generateSnapshotTimestamp() { int counter = 1; SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd.hhmmss"); String timestamp = sdf.format(new Date()); StringBuilder builder = new StringBuilder(); builder.append(timestamp).append("-").append(counter); return builder.toString(); }

Target:
private String generateSnapshotTimestamp() { SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd.hhmmss"); String timestamp = sdf.format(new Date()); StringBuilder builder = new StringBuilder(); builder.append(timestamp).append("-1"); return builder.toString(); }
Source:
public long indexGetCommittedId( IndexReference index ) throws SchemaRuleNotFoundException { sharedOptimisticLock( ResourceTypes.LABEL, index.label() ); ktx.assertOpen(); if ( index instanceof StoreIndexDescriptor ) { return ((StoreIndexDescriptor) index).getId(); } else { return -1L; } }

Target:
public long indexGetCommittedId( IndexReference index ) throws SchemaRuleNotFoundException { sharedOptimisticLock( ResourceTypes.LABEL, index.label() ); ktx.assertOpen(); if ( index instanceof StoreIndexDescriptor ) { return ((StoreIndexDescriptor) index).getId(); } else { throw new SchemaRuleNotFoundException( SchemaRule.Kind.INDEX_RULE, ((IndexDescriptor)index).schema() ); } }
Source:
public void showError() { Snackbar snackbar = SnackBarHandler.create(coordinatorLayout, getString(no_account_signed_in)); snackbar.show(); }

Target:
public void showError() { SnackBarHandler.create(coordinatorLayout, getString(no_account_signed_in)).show(); }
Source:
public IndexWorker readObject(ObjectInput input) throws IOException, ClassNotFoundException { String cacheName = (String) input.readObject(); int typesSize = input.readInt(); Set<IndexedTypeIdentifier> types = new HashSet<>(typesSize); if (typesSize > 0) { for (int i = 0; i < typesSize; i++) { types.add(PojoIndexedTypeIdentifier.convertFromLegacy((Class<?>) input.readObject())); } } boolean flush = input.readBoolean(); boolean clean = input.readBoolean(); boolean primaryOwner = input.readBoolean(); boolean skipIndex = input.readBoolean(); Set<Object> keys = (Set<Object>) input.readObject(); return new IndexWorker(cacheName, types, flush, clean, skipIndex, primaryOwner, keys); }

Target:
public IndexWorker readObject(ObjectInput input) throws IOException, ClassNotFoundException { String cacheName = (String) input.readObject(); int typesSize = input.readInt(); Set<IndexedTypeIdentifier> types = new HashSet<>(typesSize); for (int i = 0; i < typesSize; i++) { types.add(PojoIndexedTypeIdentifier.convertFromLegacy((Class<?>) input.readObject())); } boolean flush = input.readBoolean(); boolean clean = input.readBoolean(); boolean primaryOwner = input.readBoolean(); boolean skipIndex = input.readBoolean(); Set<Object> keys = (Set<Object>) input.readObject(); return new IndexWorker(cacheName, types, flush, clean, skipIndex, primaryOwner, keys); }
Source:
protected void executeCommand() { List<VM> vms = runInternalQuery(VdcQueryType.GetVmsByStorageDomain, new IdQueryParameters(getStorageDomain().getId())) .getReturnValue(); Map<Guid, Guid> vmIdSnapshotIdMap = new HashMap<>(); for (VM vm : vms) { try { Future<VdcReturnValueBase> future = CommandCoordinatorUtil.executeAsyncCommand( VdcActionType.CreateAllSnapshotsFromVm, getCreateSnapshotParameters(vm), cloneContextAndDetachFromParent()); vmIdSnapshotIdMap.put(vm.getId(), future.get().getActionReturnValue()); } catch (InterruptedException | ExecutionException e) { log.error("Error creating VM snapshots for DR sync", e.getMessage()); log.debug("Exception", e); endWithFailure(); getParameters().setTaskGroupSuccess(false); } } getParameters().setVmIdSnapshotIds(vmIdSnapshotIdMap); getParameters().setNextStep(DRStep.GEO_REP); persistCommandIfNeeded(); setSucceeded(true); }

Target:
protected void executeCommand() { List<VM> vms = runInternalQuery(VdcQueryType.GetVmsByStorageDomain, new IdQueryParameters(getStorageDomain().getId())) .getReturnValue(); Map<Guid, Guid> vmIdSnapshotIdMap = new HashMap<>(); for (VM vm : vms) { try { Future<VdcReturnValueBase> future = CommandCoordinatorUtil.executeAsyncCommand( VdcActionType.CreateAllSnapshotsFromVm, getCreateSnapshotParameters(vm), cloneContextAndDetachFromParent()); vmIdSnapshotIdMap.put(vm.getId(), future.get().getActionReturnValue()); } catch (InterruptedException | ExecutionException e) { log.error("Error creating VM snapshot for VM with id '{}', name '{}' for DR sync", vm.getId(), vm.getName(), e.getMessage()); log.debug("Exception", e); endWithFailure(); getParameters().setTaskGroupSuccess(false); } } getParameters().setVmIdSnapshotIds(vmIdSnapshotIdMap); getParameters().setNextStep(DRStep.GEO_REP); persistCommandIfNeeded(); setSucceeded(true); }
Source:
public void handleError(String error) { if (!TextUtils.isEmpty(error)) { Spanned result = Html.fromHtml(error); mErrorTextView.setText(result); mErrorTextView.setVisibility(View.VISIBLE); mTextInputLayout.setContentDescription(String.format("%s. %s. Error, %s.", mField.getLabel(), mField.getInstructions(), error)); } else { logger.warn("error message not provided, so not informing the user about this error"); } }

Target:
public void handleError(String error) { if (!TextUtils.isEmpty(error)) { Spanned result = Html.fromHtml(error); mErrorTextView.setText(result); mErrorTextView.setVisibility(View.VISIBLE); final String errorTag = mTextInputLayout.getResources().getString(R.string.label_error); mTextInputLayout.setContentDescription(String.format("%s. %s. %s, %s.", mField.getLabel(), mField.getInstructions(), errorTag, error)); } else { logger.warn("error message not provided, so not informing the user about this error"); } }
Source:
protected ActionProxy getActionProxy(String httpMethod, String uri) { request.setRequestURI(uri); request.setMethod(httpMethod); ActionMapping mapping = getActionMapping(request); String namespace = mapping.getNamespace(); String name = mapping.getName(); String method = mapping.getMethod(); Configuration config = configurationManager.getConfiguration(); ActionProxy proxy = config.getContainer() .getInstance(ActionProxyFactory.class) .createActionProxy(namespace, name, method, new HashMap<>(), true, false); ActionContext invocationContext = proxy.getInvocation().getInvocationContext(); invocationContext.getContextMap().put(ServletActionContext.ACTION_MAPPING, mapping); invocationContext.setParameters(HttpParameters.create(request.getParameterMap()).build()); ActionContext.bound(invocationContext); ServletActionContext.setServletContext(servletContext); ServletActionContext.setRequest(request); ServletActionContext.setResponse(response); return proxy; }

Target:
protected ActionProxy getActionProxy(String httpMethod, String uri) { request.setRequestURI(uri); request.setMethod(httpMethod); ActionMapping mapping = getActionMapping(request); String namespace = mapping.getNamespace(); String name = mapping.getName(); String method = mapping.getMethod(); Configuration config = configurationManager.getConfiguration(); ActionProxy proxy = config.getContainer() .getInstance(ActionProxyFactory.class) .createActionProxy(namespace, name, method, new HashMap<>(), true, false); ActionContext invocationContext = proxy.getInvocation().getInvocationContext(); invocationContext.getContextMap().put(ServletActionContext.ACTION_MAPPING, mapping); invocationContext.setParameters(HttpParameters.create(request.getParameterMap()).build()); ActionContext.bind(invocationContext); ServletActionContext.setServletContext(servletContext); ServletActionContext.setRequest(request); ServletActionContext.setResponse(response); return proxy; }
Source:
public ValueRange range(final TemporalField field) { boolean special = isYearDay() || isLeapDay(); if (field instanceof ChronoField) { if (isSupported(field)) { ChronoField f = (ChronoField) field; switch (f) { case ALIGNED_DAY_OF_WEEK_IN_MONTH: case ALIGNED_DAY_OF_WEEK_IN_YEAR: case DAY_OF_WEEK: return special ? InternationalFixedChronology.EMPTY_RANGE : InternationalFixedChronology.DAY_OF_WEEK_RANGE; case ALIGNED_WEEK_OF_MONTH: return special ? InternationalFixedChronology.EMPTY_RANGE : InternationalFixedChronology.WEEK_OF_MONTH_RANGE; case ALIGNED_WEEK_OF_YEAR: return special ? InternationalFixedChronology.EMPTY_RANGE : InternationalFixedChronology.WEEK_OF_YEAR_RANGE; case DAY_OF_MONTH: return special ? InternationalFixedChronology.EMPTY_RANGE : InternationalFixedChronology.DAY_OF_MONTH_RANGE; case DAY_OF_YEAR: return special ? ValueRange.of(getDayOfYear(), getDayOfYear()) : isLeapYear() ? InternationalFixedChronology.DAY_OF_YEAR_LEAP_RANGE : InternationalFixedChronology.DAY_OF_YEAR_NORMAL_RANGE; case EPOCH_DAY: return InternationalFixedChronology.EPOCH_DAY_RANGE; case ERA: return InternationalFixedChronology.ERA_RANGE; case MONTH_OF_YEAR: return special ? InternationalFixedChronology.EMPTY_RANGE : InternationalFixedChronology.MONTH_OF_YEAR_RANGE; default: break; } } } return super.range(field); }

Target:
public ValueRange range(final TemporalField field) { boolean special = this.day < 1; if (field instanceof ChronoField) { if (isSupported(field)) { ChronoField f = (ChronoField) field; switch (f) { case ALIGNED_DAY_OF_WEEK_IN_MONTH: case ALIGNED_DAY_OF_WEEK_IN_YEAR: case DAY_OF_WEEK: return special ? EMPTY_RANGE : ValueRange.of(1, DAYS_IN_WEEK); case ALIGNED_WEEK_OF_MONTH: return special ? EMPTY_RANGE : ValueRange.of(1, WEEKS_IN_MONTH); case ALIGNED_WEEK_OF_YEAR: return special ? EMPTY_RANGE : ValueRange.of(1, WEEKS_IN_YEAR); case DAY_OF_MONTH: return this.isYearDay ? EMPTY_RANGE : this.isLeapDay ? ValueRange.of(-1, -1) : ValueRange.of(1, DAYS_IN_MONTH); case DAY_OF_YEAR: return this.isLeapYear ? DAY_OF_YEAR_LEAP_RANGE : DAY_OF_YEAR_NORMAL_RANGE; case EPOCH_DAY: return EPOCH_DAY_RANGE; case ERA: return ERA_RANGE; case MONTH_OF_YEAR: return MONTH_OF_YEAR_RANGE; default: break; } } else { throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } } return super.range(field); }
Source:
public void testGetMicrosoftTimeZoneNameBad() { try { Assert.fail(TimeZoneUtils.getMicrosoftTimeZoneName(null)); } catch (final IllegalArgumentException ignored) final TimeZone trollZone = TimeZone.getTimeZone("Antarctica/Troll"); final String trollZoneName = TimeZoneUtils.getMicrosoftTimeZoneName(trollZone); Assert.assertTrue(trollZoneName == null || StringUtils.equals(trollZoneName, "UTC")); checkGetMicrosoftTimeZoneName("africa/abidjan", "UTC"); }

Target:
public void testGetMicrosoftTimeZoneNameBad() { try { Assert.fail(TimeZoneUtils.getMicrosoftTimeZoneName(null)); } catch (final IllegalArgumentException ignored) checkGetMicrosoftTimeZoneName("africa/abidjan", "UTC"); }
Source:
VCFReaderIterator(final InputStream inputStream) { this.inputStream = inputStream; this.lineIterator = new AsciiLineReaderIterator(AsciiLineReader.from(inputStream)); this.vcfHeader = (VCFHeader) this.codec.readActualHeader(this.lineIterator); }

Target:
VCFReaderIterator(final InputStream inputStream) { this.inputStream = inputStream; this.lineIterator = this.codec.makeSourceFromStream(this.inputStream); this.vcfHeader = (VCFHeader) this.codec.readActualHeader(this.lineIterator); }
Source:
private void quote(StringBuilder sb, String value) { char quote = value.contains("'") ? '"' : '\''; sb.append(quote); sb.append(value); sb.append(quote); }

Target:
private void quote(StringBuilder sb, String value) { char quote = '\''; if (value.contains("'")) { if (value.contains("\"")) { throw new IllegalArgumentException( "Cannot query for a job which contains both a single and double quote in its name"); } quote = '"'; } sb.append(quote); sb.append(value); sb.append(quote); }
Source:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) { Preconditions.checkArgument(!Strings.isNullOrEmpty(config.name), "Stream name should be non-null, non-empty."); Preconditions.checkArgument(!Strings.isNullOrEmpty(config.awsAccessKey), "Access Key required"); Preconditions.checkArgument(!Strings.isNullOrEmpty(config.awsAccessSecret), "Access Key secret required"); Preconditions.checkArgument(!Strings.isNullOrEmpty(config.partition), "partition name should be non-null, non-empty."); Preconditions.checkArgument(!Strings.isNullOrEmpty(config.bodyField), "Please map the input field containing data"); BasicAWSCredentials awsCred = new BasicAWSCredentials(config.awsAccessKey, config.awsAccessSecret); kinesisClient = new AmazonKinesisClient(awsCred); createAndWaitForStreamToBecomeAvailable(kinesisClient, config.name, config.shardCount); }

Target:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) { Preconditions.checkArgument(!Strings.isNullOrEmpty(config.name), "Stream name should be non-null, non-empty."); Preconditions.checkArgument(!Strings.isNullOrEmpty(config.awsAccessKey), "Access Key should be non-null, non-empty."); Preconditions.checkArgument(!Strings.isNullOrEmpty(config.awsAccessSecret), "Access Key secret should be non-null, non-empty."); Preconditions.checkArgument(!Strings.isNullOrEmpty(config.partition), "Partition name should be non-null, non-empty."); Preconditions.checkArgument(!Strings.isNullOrEmpty(config.bodyField), "Input field should be non-null, non-empty."); Schema inputSchema = pipelineConfigurer.getStageConfigurer().getInputSchema(); validateInputSchema(inputSchema); }
Source:
public void post(String url, HttpResponse response, Map<String, Object> headers, File file) { HttpPost methodPost = new HttpPost(url); MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.addBinaryBody(file.getName(), new File(file.getAbsolutePath()), ContentType.APPLICATION_OCTET_STREAM, file.getName()); HttpEntity multipart = builder.build(); methodPost.setEntity(multipart); getResponse(url, response, methodPost, headers); }

Target:
public void post(String url, HttpResponse response, Map<String, Object> headers, File file) { HttpPost methodPost = new HttpPost(url); MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.addBinaryBody(file.getName(), file, ContentType.APPLICATION_OCTET_STREAM, file.getName()); HttpEntity multipart = builder.build(); methodPost.setEntity(multipart); getResponse(url, response, methodPost, headers); }
Source:
public long getSessionSeqId() { if (sessionSeqId == null) { sessionSeqId = -1L; String sessionId = getContext().getEngineContext().getSessionId(); if (getSessionDataContainer().isSessionExists(sessionId)) { sessionSeqId = getSessionDataContainer().getEngineSessionSeqId(sessionId); } } return sessionSeqId; }

Target:
public long getSessionSeqId() { if (sessionSeqId == null) { String sessionId = getContext().getEngineContext().getSessionId(); sessionSeqId = getSessionDataContainer().isSessionExists(sessionId) ? getSessionDataContainer().getEngineSessionSeqId(sessionId) : -1L; } return sessionSeqId; }
Source:
private void executeFolderRemoval(FolderDeletedActivity activity) throws IOException { SPath path = activity.getPath(); IFolder folder = path.getFolder(); this.editorManager.closeEditorsInFolder(path); folder.delete(IResource.NONE); }

Target:
private void executeFolderRemoval(FolderDeletedActivity activity) throws IOException { SPath path = activity.getPath(); IFolder folder = path.getFolder(); folder.delete(IResource.NONE); editorManager.closeEditorsInFolder(path); }
Source:
private Map<String, String> getAttributeData(String id) { Map<String, String> map = attributesById.get(id); if (map == null) { map = new HashMap<>(); attributesById.put(id, map); } return map; }

Target:
private Map<String, String> getAttributeData(String id) { return attributesById.computeIfAbsent(id, key -> new HashMap<>()); }
Source:
public TimestampRangeAndPartition getFreshTimestampsForClient(UUID clientIdentifier, int numTransactionsRequested) { while (true) { TimestampRange timestampRange = delegate.getFreshTimestamps(NUM_PARTITIONS * numTransactionsRequested); int targetResidue = allocator.getRelevantModuli(clientIdentifier).iterator().next(); OptionalLong startTimestamp = TimestampRanges.getLowestTimestampMatchingModulus( timestampRange, targetResidue, NUM_PARTITIONS); if (startTimestamp.isPresent()) { OptionalLong endTimestamp = TimestampRanges.getHighestTimestampMatchingModulus( timestampRange, targetResidue, NUM_PARTITIONS); return TimestampRangeAndPartition.of( TimestampRange.createInclusiveRange(startTimestamp.getAsLong(), endTimestamp.getAsLong()), targetResidue); } log.info("The timestamp range we received from the underlying timestamp service - -" + " did not contain a value with residue modulo {}. We will try again." + " This is not a bug; but if it happens excessively frequently, please contact support.", SafeArg.of("timestampRange", timestampRange), SafeArg.of("targetResidue", targetResidue), SafeArg.of("modulus", NUM_PARTITIONS)); } }

Target:
public PartitionedTimestamps getFreshTimestampsForClient(UUID clientIdentifier, int numTransactionsRequested) { while (true) { TimestampRange timestampRange = delegate.getFreshTimestamps(NUM_PARTITIONS * numTransactionsRequested); int targetResidue = allocator.getRelevantModuli(clientIdentifier).iterator().next(); PartitionedTimestamps partitionedTimestamps = TimestampRanges.getPartitionedTimestamps( timestampRange, targetResidue, NUM_PARTITIONS); if (partitionedTimestamps.count() > 0) { return partitionedTimestamps; } log.info("The timestamp range we received from the underlying timestamp service - -" + " did not contain a value with residue modulo {}. We will try again." + " This is not a bug; but if it happens excessively frequently, please contact support.", SafeArg.of("timestampRange", timestampRange), SafeArg.of("targetResidue", targetResidue), SafeArg.of("modulus", NUM_PARTITIONS)); } }
Source:
public static Symbol from(Expression expression) { return optionalFrom(expression).orElseThrow(() -> new IllegalArgumentException("Unexpected expression: %s" + expression)); }

Target:
public static Symbol from(Expression expression) { checkArgument(expression instanceof SymbolReference, "Unexpected expression: %s", expression); return new Symbol(((SymbolReference) expression).getName()); }
Source:
public MigrateBrokerVDSCommand(P parameters) { super(parameters); String migMethod = VdsProperties.MigrationMethostoString(parameters.getMigrationMethod()); log.infoFormat("VdsBroker::migrate::Entered (vm_guid='{0}', srcHost='{1}', dstHost='{2}', method='{3}'", parameters.getVmId().toString(), parameters.getSrcHost(), parameters.getDstHost(), migMethod); migrationInfo = new HashMap<String, String>(); migrationInfo.put(VdsProperties.vm_guid, parameters.getVmId().toString()); migrationInfo.put(VdsProperties.src, String.format("%1$s", parameters.getSrcHost())); migrationInfo.put(VdsProperties.dst, String.format("%1$s", parameters.getDstHost())); migrationInfo.put(VdsProperties.method, migMethod); if (parameters.getTunnelMigration() != null) { migrationInfo.put(VdsProperties.tunneled, String.valueOf(parameters.getTunnelMigration())); } }

Target:
public MigrateBrokerVDSCommand(P parameters) { super(parameters); String migMethod = VdsProperties.MigrationMethostoString(parameters.getMigrationMethod()); log.infoFormat("VdsBroker::migrate::Entered (vm_guid='{0}', srcHost='{1}', dstHost='{2}', method='{3}'", parameters.getVmId().toString(), parameters.getSrcHost(), parameters.getDstHost(), migMethod); migrationInfo = new HashMap<String, String>(); migrationInfo.put(VdsProperties.vm_guid, parameters.getVmId().toString()); migrationInfo.put(VdsProperties.src, String.format("%1$s", parameters.getSrcHost())); migrationInfo.put(VdsProperties.dst, String.format("%1$s", parameters.getDstHost())); migrationInfo.put(VdsProperties.method, migMethod); if (parameters.getTunnelMigration() != null) { migrationInfo.put(VdsProperties.TUNNELED, parameters.getTunnelMigration().toString()); } }
Source:
private void validateRowsAreNotMaskedUsingCounts(long probeTimestamp, DataReader dataReader, SchemaBuilder schemaBuilder) throws SQLException { String tenantConnectUrl = getUrl() + ';' + TENANT_ID_ATTRIB + '=' + schemaBuilder.getDataOptions() .getTenantId(); long scnTimestamp = EnvironmentEdgeManager.currentTimeMillis(); Properties props = new Properties(); props.setProperty("CurrentSCN", Long.toString(scnTimestamp )); try (Connection readConnection = DriverManager.getConnection(tenantConnectUrl, props)) { dataReader.setConnection(readConnection); com.google.common.collect.Table<String, String, Object> fetchedData = fetchData(dataReader); assertTrue("Fetched data should not be null", fetchedData != null); assertTrue("Rows should exists before ttl expiration (now)", fetchedData.rowKeySet().size() > 0); } props.setProperty("CurrentSCN", Long.toString(probeTimestamp)); try (Connection readConnection = DriverManager.getConnection(tenantConnectUrl, props)) { dataReader.setConnection(readConnection); com.google.common.collect.Table<String, String, Object> fetchedData = fetchData(dataReader); assertTrue("Fetched data should not be null", fetchedData != null); assertTrue("Rows should exists before ttl expiration (probe-timestamp)", fetchedData.rowKeySet().size() > 0); } }

Target:
private void validateRowsAreNotMaskedUsingCounts(long probeTimestamp, DataReader dataReader, SchemaBuilder schemaBuilder) throws SQLException { String tenantConnectUrl = getUrl() + ';' + TENANT_ID_ATTRIB + '=' + schemaBuilder.getDataOptions() .getTenantId(); long scnTimestamp = EnvironmentEdgeManager.currentTimeMillis(); Properties props = new Properties(); props.setProperty("CurrentSCN", Long.toString(scnTimestamp )); try (Connection readConnection = DriverManager.getConnection(tenantConnectUrl, props)) { dataReader.setConnection(readConnection); com.google.common.collect.Table<String, String, Object> fetchedData = fetchData(dataReader); assertNotNull("Fetched data should not be null", fetchedData); assertTrue("Rows should exists before ttl expiration (now)", fetchedData.rowKeySet().size() > 0); } props.setProperty("CurrentSCN", Long.toString(probeTimestamp)); try (Connection readConnection = DriverManager.getConnection(tenantConnectUrl, props)) { dataReader.setConnection(readConnection); com.google.common.collect.Table<String, String, Object> fetchedData = fetchData(dataReader); assertNotNull("Fetched data should not be null", fetchedData); assertTrue("Rows should exists before ttl expiration (probe-timestamp)", fetchedData.rowKeySet().size() > 0); } }
Source:
protected RevCommit commitFile(String filename, String contents, String branch) { try { Git git = new Git(db); String originalBranch = git.getRepository().getBranch(); if (git.getRepository().getRef(branch) == null) git.branchCreate().setName(branch).call(); git.checkout().setName(branch).call(); writeTrashFile(filename, contents); git.add().addFilepattern(filename).call(); RevCommit commit = git.commit() .setMessage(branch + ": " + filename).call(); if (originalBranch != null) git.checkout().setName(originalBranch).call(); return commit; } catch (IOException e) { throw new RuntimeException(e); } catch (GitAPIException e) { throw new RuntimeException(e); } }

Target:
protected RevCommit commitFile(String filename, String contents, String branch) { try { Git git = new Git(db); String originalBranch = git.getRepository().getFullBranch(); if (git.getRepository().getRef(branch) == null) git.branchCreate().setName(branch).call(); git.checkout().setName(branch).call(); writeTrashFile(filename, contents); git.add().addFilepattern(filename).call(); RevCommit commit = git.commit() .setMessage(branch + ": " + filename).call(); if (originalBranch != null) git.checkout().setName(originalBranch).call(); return commit; } catch (IOException e) { throw new RuntimeException(e); } catch (GitAPIException e) { throw new RuntimeException(e); } }
Source:
public String parseMessage(HttpResponse response) { if (response.getPayload() == null) return null; try { return Strings2.toString(response.getPayload()); } catch (IOException e) { throw new RuntimeException(e); } finally { try { response.getPayload().getInput().close(); } catch (IOException e) { Throwables.propagate(e); } } }

Target:
public String parseMessage(HttpResponse response) { if (response.getPayload() == null) return null; try { return Strings2.toString(response.getPayload()); } catch (IOException e) { throw Throwables.propagate(e); } finally { try { response.getPayload().getInput().close(); } catch (IOException e) { throw Throwables.propagate(e); } } }
Source:
protected Session getSession() { Session session = null; if (HibernateUtilFactory.getAsyncMsgsHibernateUtil() != null) { session = HibernateUtilFactory.getAsyncMsgsHibernateUtil().getSessionFactory().openSession(); } else { LOG.error("Session is null"); } return session; }

Target:
protected Session getSession() { Session session = null; HibernateUtil util = HibernateUtilFactory.getAsyncMsgsHibernateUtil(); if (util != null) { session = util.getSessionFactory().openSession(); } else { LOG.error("Session is null"); } return session; }
Source:
private void typeSearchQuery(String query) { waitForElementByElement(searchField); searchField.sendKeys(query); }

Target:
public void typeSearchQuery(String query) { searchField.sendKeys(query); }