auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void doAppLogAggregationPostCleanUp() { List<Path> localAppLogDirs = new ArrayList<Path>(); for (String rootLogDir : dirsHandler.getLogDirsForCleanup()) { Path logPath = new Path(rootLogDir, applicationId); try { lfs.getFileStatus(logPath); localAppLogDirs.add(logPath); } catch (UnsupportedFileSystemException ue) { LOG.warn("Log dir " + rootLogDir + " is in an unsupported file system", ue); continue; } catch (IOException fe) { LOG.warn("An exception occurred while getting file information", fe); continue; } } if (localAppLogDirs.size() > 0) { LOG.debug("Cleaning up files", localAppLogDirs.size()); List<Path> localAppLogDirsList = new ArrayList<>(); localAppLogDirsList.addAll(localAppLogDirs); DeletionTask deletionTask = new FileDeletionTask(delService, this.userUgi.getShortUserName(), null, localAppLogDirsList); this.delService.delete(deletionTask); } }

Target:
private void doAppLogAggregationPostCleanUp() { List<Path> localAppLogDirs = new ArrayList<Path>(); for (String rootLogDir : dirsHandler.getLogDirsForCleanup()) { Path logPath = new Path(rootLogDir, applicationId); try { lfs.getFileStatus(logPath); localAppLogDirs.add(logPath); } catch (UnsupportedFileSystemException ue) { LOG.warn("Log dir is in an unsupported file system", rootLogDir, ue); continue; } catch (IOException fe) { LOG.warn("An exception occurred while getting file information", fe); continue; } } if (localAppLogDirs.size() > 0) { LOG.debug("Cleaning up files", localAppLogDirs.size()); List<Path> localAppLogDirsList = new ArrayList<>(); localAppLogDirsList.addAll(localAppLogDirs); DeletionTask deletionTask = new FileDeletionTask(delService, this.userUgi.getShortUserName(), null, localAppLogDirsList); this.delService.delete(deletionTask); } }
Source:
public static QueryOriginContext create(HttpServletRequest httpServletRequest, String query) { String userAgent = httpServletRequest.getHeader("User-Agent"); String clientId = httpServletRequest.getHeader("X-Alient-Client-Id"); return QueryOriginContext.of(httpServletRequest.getRemoteAddr(), httpServletRequest.getRemoteHost(), httpServletRequest.getRemotePort(), userAgent == null ? "" : userAgent, clientId == null ? "" : clientId, query); }

Target:
public static QueryOriginContext create(HttpServletRequest httpServletRequest, String query) { String userAgent = httpServletRequest.getHeader("User-Agent"); String clientId = httpServletRequest.getHeader("X-Client-Id"); return QueryOriginContext.of(httpServletRequest.getRemoteAddr(), httpServletRequest.getRemoteHost(), httpServletRequest.getRemotePort(), userAgent == null ? "" : userAgent, clientId == null ? "" : clientId, query); }
Source:
public String doGetContent(String path) { try { byte[] dataBytes = client.getData().forPath(path); if (dataBytes == null || dataBytes.length == 0) { return null; } return new String(dataBytes, charset); } catch (NodeExistsException e) { } catch (NoNodeException e) { } catch (Exception e) { throw new IllegalStateException(e.getMessage(), e); } return null; }

Target:
public String doGetContent(String path) { try { byte[] dataBytes = client.getData().forPath(path); return (dataBytes == null || dataBytes.length == 0) ? null : new String(dataBytes, charset); } catch (NoNodeException e) { } catch (Exception e) { throw new IllegalStateException(e.getMessage(), e); } return null; }
Source:
public void run() { Shell parent = Display.getDefault().getActiveShell(); FileDialog fileDialog = new FileDialog(parent, SWT.SAVE); String filePath = fileDialog.open(); if (filePath != null) { File file = new File(filePath); if (file.exists()) { MessageDialog messageDialog = new MessageDialog(parent, "File already exists", null, "File \"" + file.toString() + "\" already exists. Do you want to replace the existing one?", MessageDialog.WARNING, DIALOG_BUTTON_LABELS.toArray(new String[DIALOG_BUTTON_LABELS .size()]), 1); int open = messageDialog.open(); if (open == DIALOG_BUTTON_LABELS.indexOf("Replace")) { saveComparison(file); refreshLocation(filePath); } } else { saveComparison(file); refreshLocation(filePath); } } super.run(); }

Target:
public void run() { Shell parent = getShell(); FileDialog fileDialog = new FileDialog(parent, SWT.SAVE); String filePath = fileDialog.open(); if (filePath != null) { File file = new File(filePath); if (file.exists()) { MessageDialog messageDialog = new MessageDialog(parent, "File already exists", null, "File \"" + file.toString() + "\" already exists. Do you want to replace the existing one?", MessageDialog.WARNING, DIALOG_BUTTON_LABELS.toArray(new String[DIALOG_BUTTON_LABELS .size()]), 1); int open = messageDialog.open(); if (open == DIALOG_BUTTON_LABELS.indexOf("Replace")) { saveComparison(file); refreshLocation(filePath); } } else { saveComparison(file); refreshLocation(filePath); } } super.run(); }
Source:
public void testAddHostedEngineStorageFails() { when(command.getLUNsFromVgInfo(parameters.getStorageDomain().getStorage())).thenReturn(getLUNs()); doReturn(new ArrayList<LUNs>()).when(command).getAllLuns(); parameters.getStorageDomain().setStorageName(StorageConstants.HOSTED_ENGINE_STORAGE_DOMAIN_NAME); assertFalse(command.canAddDomain()); CanDoActionTestUtils.assertCanDoActionMessages("", command, VdcBllMessages.ACTION_TYPE_FAILED_HOSTED_ENGINE_STORAGE); }

Target:
public void testAddHostedEngineStorageFails() { when(command.getLUNsFromVgInfo(parameters.getStorageDomain().getStorage())).thenReturn(getLUNs()); doReturn(new ArrayList<LUNs>()).when(command).getAllLuns(); parameters.getStorageDomain().setStorageName(StorageConstants.HOSTED_ENGINE_STORAGE_DOMAIN_NAME); assertFalse(command.canAddDomain()); CanDoActionTestUtils.assertCanDoActionMessages("Add self hosted engine storage domain succeeded where it should have failed", command, VdcBllMessages.ACTION_TYPE_FAILED_HOSTED_ENGINE_STORAGE); }
Source:
public void retrievesForks() throws Exception { final RtForks forks = new RtForks(new FakeRequest(), this.repo()); MatcherAssert.assertThat( forks.iterate("newest"), Matchers.notNullValue() ); }

Target:
public void retrievesForks() throws Exception { }
Source:
public CalibrationSet getMostRecentCalibrations(DataSource dataSource, long instrumentId, LocalDateTime date) throws CalibrationException, DatabaseException, MissingParamException, RecordNotFoundException { CalibrationSet result = new CalibrationSet(instrumentId, getCalibrationType(), getTargets(dataSource, instrumentId)); Connection conn = null; PreparedStatement stmt = null; ResultSet records = null; try { conn = dataSource.getConnection(); stmt = conn.prepareStatement(GET_RECENT_CALIBRATIONS_QUERY); stmt.setLong(1, instrumentId); stmt.setString(2, getCalibrationType()); stmt.setLong(3, date.toEpochSecond(ZoneOffset.UTC) * 1000); records = stmt.executeQuery(); while (!result.isComplete() && records.next()) { String target = records.getString(1); if (!result.containsTarget(target)) { LocalDateTime deploymentDate = DateTimeUtils.longToDate(records.getLong(2)); List<Double> coefficients = StringUtils.delimitedToDoubleList(records.getString(3)); String calibrationClass = records.getString(4); Calibration calibration = CalibrationFactory.createCalibration(getCalibrationType(), calibrationClass, instrumentId, deploymentDate, target, coefficients); result.add(calibration); } } } catch (SQLException e) { throw new DatabaseException("Error while retrieving calibrations", e); } finally { DatabaseUtils.closeResultSets(records); DatabaseUtils.closeStatements(stmt); DatabaseUtils.closeConnection(conn); } return result; }

Target:
public CalibrationSet getMostRecentCalibrations(DataSource dataSource, long instrumentId, LocalDateTime date) throws CalibrationException, DatabaseException, MissingParamException, RecordNotFoundException { CalibrationSet result = new CalibrationSet(instrumentId, getCalibrationType(), getTargets(dataSource, instrumentId)); Connection conn = null; PreparedStatement stmt = null; ResultSet records = null; try { conn = dataSource.getConnection(); stmt = conn.prepareStatement(GET_RECENT_CALIBRATIONS_QUERY); stmt.setLong(1, instrumentId); stmt.setString(2, getCalibrationType()); stmt.setLong(3, DateTimeUtils.dateToLong(date)); records = stmt.executeQuery(); while (!result.isComplete() && records.next()) { String target = records.getString(1); if (!result.containsTarget(target)) { LocalDateTime deploymentDate = DateTimeUtils.longToDate(records.getLong(2)); List<Double> coefficients = StringUtils.delimitedToDoubleList(records.getString(3)); String calibrationClass = records.getString(4); Calibration calibration = CalibrationFactory.createCalibration(getCalibrationType(), calibrationClass, instrumentId, deploymentDate, target, coefficients); result.add(calibration); } } } catch (SQLException e) { throw new DatabaseException("Error while retrieving calibrations", e); } finally { DatabaseUtils.closeResultSets(records); DatabaseUtils.closeStatements(stmt); DatabaseUtils.closeConnection(conn); } return result; }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ApplyStaticNatVspCommand that = (ApplyStaticNatVspCommand) o; if (_isL3Network != that._isL3Network) return false; if (_isVpc != that._isVpc) return false; if (_networkDomainUuid != null ? !_networkDomainUuid.equals(that._networkDomainUuid) : that._networkDomainUuid != null) return false; if (_networkUuid != null ? !_networkUuid.equals(that._networkUuid) : that._networkUuid != null) return false; if (_staticNatDetails != null ? !_staticNatDetails.equals(that._staticNatDetails) : that._staticNatDetails != null) return false; if (_vpcOrSubnetUuid != null ? !_vpcOrSubnetUuid.equals(that._vpcOrSubnetUuid) : that._vpcOrSubnetUuid != null) return false; return true; }

Target:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ApplyStaticNatVspCommand)) return false; if (!super.equals(o)) return false; ApplyStaticNatVspCommand that = (ApplyStaticNatVspCommand) o; if (_isL3Network != that._isL3Network) return false; if (_isVpc != that._isVpc) return false; if (_networkDomainUuid != null ? !_networkDomainUuid.equals(that._networkDomainUuid) : that._networkDomainUuid != null) return false; if (_networkUuid != null ? !_networkUuid.equals(that._networkUuid) : that._networkUuid != null) return false; if (_staticNatDetails != null ? !_staticNatDetails.equals(that._staticNatDetails) : that._staticNatDetails != null) return false; if (_vpcOrSubnetUuid != null ? !_vpcOrSubnetUuid.equals(that._vpcOrSubnetUuid) : that._vpcOrSubnetUuid != null) return false; return true; }
Source:
private boolean nullOrEmpty(List<?> list) { return list == null || list.isEmpty(); }

Target:
private static boolean nullOrEmpty(List<?> list) { return list == null || list.isEmpty(); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (finishIfNotRoot()) { return; } if (savedInstanceState != null) { shortcutExtraWasConsumed = savedInstanceState.getBoolean(EXTRA_CONSUMED_KEY); } shouldCheckForLocalAppFilesChange = CommCareApplication._().isConsumerApp(); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (finishIfNotRoot()) { return; } if (savedInstanceState != null) { shortcutExtraWasConsumed = savedInstanceState.getBoolean(EXTRA_CONSUMED_KEY); alreadyCheckedForAppFilesChange = savedInstanceState.getBoolean(KEY_APP_FILES_CHECK_OCCURRED); } }
Source:
public void shouldReturnSome() { Option<String> oneToOne = HashMap.of(1, "One").lift().apply(1); assertThat(oneToOne instanceof Option.Some); }

Target:
public void shouldReturnSome() { Option<String> oneToOne = HashMap.of(1, "One").lift().apply(1); assertThat(oneToOne).isEqualTo(Option.some("One")); }
Source:
private void handle(final APIChangeInstanceOfferingMsg msg) { thdf.chainSubmit(new ChainTask(msg) { @Override public String getSyncSignature() { return syncThreadName; } @Override public void run(SyncTaskChain chain) { APIChangeInstanceOfferingEvent evt = new APIChangeInstanceOfferingEvent(msg.getId()); refreshVO(); ErrorCode allowed = validateOperationByState(msg, self.getState(), SysErrors.OPERATION_ERROR); if (allowed != null) { bus.replyErrorByMessageType(msg, allowed); return; } changeOffering(msg, new Completion(msg, chain) { @Override public void success() { refreshVO(); evt.setInventory(getSelfInventory()); bus.publish(evt); chain.next(); } @Override public void fail(ErrorCode errorCode) { evt.setError(errorCode); bus.publish(evt); chain.next(); } }); } @Override public String getName() { return "change-instance-offering"; } }); }

Target:
private void handle(final APIChangeInstanceOfferingMsg msg) { thdf.chainSubmit(new ChainTask(msg) { @Override public String getSyncSignature() { return syncThreadName; } @Override public void run(SyncTaskChain chain) { APIChangeInstanceOfferingEvent evt = new APIChangeInstanceOfferingEvent(msg.getId()); refreshVO(); ErrorCode allowed = validateOperationByState(msg, self.getState(), SysErrors.OPERATION_ERROR); if (allowed != null) { throw new OperationFailureException(operr("operation is not allowed to vm[uuid:%s] which is in the state of state:%s", self.getUuid(), self.getState())); } changeOffering(msg, new Completion(msg, chain) { @Override public void success() { refreshVO(); evt.setInventory(getSelfInventory()); bus.publish(evt); chain.next(); } @Override public void fail(ErrorCode errorCode) { evt.setError(errorCode); bus.publish(evt); chain.next(); } }); } @Override public String getName() { return "change-instance-offering"; } }); }
Source:
public boolean set(PermanentProperty prop, Object value, Flag flag) { synchronized (coreLock) { boolean result = false; if (prop == Value.POSITION && value instanceof String) { team.field(this, team.getPosition(FloorPosition.fromString((String)value))); } else if (prop == Value.ROLE && value instanceof String) { team.field(this, Role.fromString((String)value)); } else { requestBatchStart(); Object last = get(prop); result = super.set(prop, value, flag); if(result) { if (prop == Value.PENALTY_BOX && getPosition() != null) { if ((Boolean)value && getPosition().getFloorPosition() == FloorPosition.JAMMER && team.getLeadJammer().equals(Team.LEAD_LEAD)) { team.setLeadJammer(Team.LEAD_LOST_LEAD); } getPosition().set(Position.Value.PENALTY_BOX, value); } if (getPosition() != null && (prop == Value.NAME || prop == Value.NUMBER || prop == Value.FLAGS)) { scoreBoardChange(new ScoreBoardEvent(getPosition(), Position.Value.valueOf(((Value)prop).name()), value, last)); } if (prop == Value.BASE_ROLE && get(Value.ROLE) == last) { set(Value.ROLE, value); } } requestBatchEnd(); } return result; } }

Target:
public boolean set(PermanentProperty prop, Object value, Flag flag) { synchronized (coreLock) { boolean result = false; if (prop == Value.POSITION && value instanceof String) { team.field(this, team.getPosition(FloorPosition.fromString((String)value))); } else if (prop == Value.ROLE && value instanceof String) { team.field(this, Role.fromString((String)value)); } else { requestBatchStart(); Object last = get(prop); result = super.set(prop, value, flag); if(result) { if (prop == Value.PENALTY_BOX && getPosition() != null) { if ((Boolean)value && getPosition().getFloorPosition() == FloorPosition.JAMMER && team.getLeadJammer().equals(Team.LEAD_LEAD)) { team.setLeadJammer(Team.LEAD_LOST_LEAD); } getPosition().set(Position.Value.PENALTY_BOX, value); } if (getPosition() != null && (prop == Value.NAME || prop == Value.NUMBER || prop == Value.FLAGS)) { scoreBoardChange(new ScoreBoardEvent(getPosition(), Position.Value.valueOf(((Value)prop).name()), value, last)); } if (prop == Value.BASE_ROLE && get(Value.ROLE) == last) { set(Value.ROLE, value); } if (prop == Value.SORT_PENALTIES && (Boolean)value) { sortPenalties(); } } requestBatchEnd(); } return result; } }
Source:
protected List<ExecutionStatus> getFilteredItems() { ProcessStatusTracker tracker = GeoServerApplication.get().getBeanOfType( ProcessStatusTracker.class); ProcessStatusStore store = tracker.getStore(); Query query = new Query("status", getFilter()); if(count>0) { query.setStartIndex(first); query.setMaxFeatures(count); } SortParam sort = getSort(); if(sort!=null) { SortByImpl[] sortBys = new SortByImpl[1]; final Property<?> property = getProperty(sort); if(property.isSearchable()) { sortBys[0] = new SortByImpl(new PropertyName() { @Override public <T> T evaluate(Object object, Class<T> context) { return null; } @Override public Object evaluate(Object object) { return null; } @Override public Object accept(ExpressionVisitor visitor, Object extraData) { return null; } @Override public String getPropertyName() { return property.getName(); } @Override public NamespaceSupport getNamespaceContext() { return null; } }, SortOrder.ASCENDING); if(sort.isAscending()) { sortBys[0].setSortOrder(SortOrder.ASCENDING); }else { sortBys[0].setSortOrder(SortOrder.DESCENDING); } query.setSortBy(sortBys); } } LOGGER.info("built query "+query+" to filter statuses"); return store.list(query); }

Target:
protected List<ExecutionStatus> getFilteredItems() { ProcessStatusTracker tracker = GeoServerApplication.get().getBeanOfType( ProcessStatusTracker.class); ProcessStatusStore store = tracker.getStore(); Query query = new Query("status", getFilter()); if(count>0) { query.setStartIndex(first); query.setMaxFeatures(count); } SortParam sort = getSort(); if(sort!=null) { SortByImpl[] sortBys = new SortByImpl[1]; final Property<?> property = getProperty(sort); if(property.isSearchable()) { FF.sort(property.getName(), SortOrder.ASCENDING); if(!sort.isAscending()) { sortBys[0].setSortOrder(SortOrder.DESCENDING); } query.setSortBy(sortBys); } } LOGGER.fine("built query "+query+" to filter statuses"); return store.list(query); }
Source:
public boolean isReadOnly() throws SQLException { checkClosed(); if (!cacheXactState) { ResultSet rs = null; try { rs = execSQLQuery("show transaction_read_only"); if (rs.next()) { String transaction_read_only = rs.getString(1); if ("on".equals(transaction_read_only)) { this.readOnly = true; } else if ("off".equals(transaction_read_only)) { this.readOnly = false; } } } finally { if (rs != null) { rs.close(); } } } LOGGER.log(Level.FINE, " isReadOnly = {0}", this.readOnly); return this.readOnly; }

Target:
public boolean isReadOnly() throws SQLException { checkClosed(); if (!cacheReadOnlyState) { ResultSet rs = null; try { rs = execSQLQuery("show transaction_read_only"); if (rs.next()) { String transaction_read_only = rs.getString(1); this.readOnly = "on".equals(transaction_read_only); } } finally { if (rs != null) { rs.close(); } } } LOGGER.log(Level.FINE, " isReadOnly = {0}", this.readOnly); return this.readOnly; }
Source:
public void getServiceInvalidConfig() throws Exception { assertThrows(IllegalArgumentException.class, ()-> { OOOMessageHandlerProvider provider = new OOOMessageHandlerProvider(); provider.getService(1L, mock(ServiceConfiguration.class)); }); }

Target:
public void getServiceInvalidConfig() throws Exception { OOOMessageHandlerProvider provider = new OOOMessageHandlerProvider(); assertThrows(IllegalArgumentException.class, ()-> { provider.getService(1L, mock(ServiceConfiguration.class)); }); }
Source:
protected boolean isLocationAllowed(Rectangle newBounds, Rectangle parentBounds, GraphicalEditPart containerEditpart) { boolean allowed = false; if (null != containerEditpart) { Rectangle absoluteBounds = newBounds.getTranslated(parentBounds.getLocation()); if (null != containerEditpart && containerEditpart.getFigure().getBounds().contains(absoluteBounds)) { allowed = true; } } return allowed; }

Target:
protected boolean isLocationAllowed(Rectangle newBounds, Rectangle parentBounds, GraphicalEditPart containerEditpart) { boolean allowed = false; if (null != containerEditpart) { Rectangle absoluteBounds = newBounds.getTranslated(parentBounds.getLocation()); if (containerEditpart.getFigure().getBounds().contains(absoluteBounds)) { allowed = true; } } return allowed; }
Source:
public void writeToParcel(Parcel dest, int flags) { dest.writeString(getInterfaceName()); dest.writeInt(mLinkAddresses.size()); for(LinkAddress linkAddress : mLinkAddresses) { dest.writeParcelable(linkAddress, flags); } dest.writeInt(mDnses.size()); for(InetAddress d : mDnses) { dest.writeByteArray(d.getAddress()); } dest.writeString(mDomains); dest.writeInt(mRoutes.size()); for(RouteInfo route : mRoutes) { dest.writeParcelable(route, flags); } if (mHttpProxy != null) { dest.writeByte((byte)1); dest.writeParcelable(mHttpProxy, flags); } else { dest.writeByte((byte)0); } ArrayList<LinkProperties> stackedLinks = new ArrayList(mStackedLinks.values()); dest.writeList(stackedLinks); }

Target:
public void writeToParcel(Parcel dest, int flags) { dest.writeString(getInterfaceName()); dest.writeInt(mLinkAddresses.size()); for(LinkAddress linkAddress : mLinkAddresses) { dest.writeParcelable(linkAddress, flags); } dest.writeInt(mDnses.size()); for(InetAddress d : mDnses) { dest.writeByteArray(d.getAddress()); } dest.writeString(mDomains); dest.writeInt(mMtu); dest.writeInt(mRoutes.size()); for(RouteInfo route : mRoutes) { dest.writeParcelable(route, flags); } if (mHttpProxy != null) { dest.writeByte((byte)1); dest.writeParcelable(mHttpProxy, flags); } else { dest.writeByte((byte)0); } ArrayList<LinkProperties> stackedLinks = new ArrayList(mStackedLinks.values()); dest.writeList(stackedLinks); }
Source:
protected void internalReceiveCommand(String itemName, Command command) { logger.debug("internalReceiveCommand() is called!"); for (WemoBindingProvider provider : providers) { String switchFriendlyName = provider.getWemoFriendlyName(itemName); logger.info("item '{}' is configured as '{}'",itemName, switchFriendlyName); } try { if (OnOffType.ON.equals(command)) { logger.trace("Command ON is about to be send to item '{}'",itemName ); boolean onOff = true; sendCommand(itemName, onOff); } else if (OnOffType.OFF.equals(command)) { logger.trace("Command OFF is about to be send to item '{}'",itemName ); boolean onOff = false; sendCommand(itemName, onOff); } } catch (Exception e) { logger.error("Failed to send command", command, e); } }

Target:
protected void internalReceiveCommand(String itemName, Command command) { logger.debug("internalReceiveCommand() is called!"); for (WemoBindingProvider provider : providers) { String switchFriendlyName = provider.getWemoFriendlyName(itemName); logger.info("item '{}' is configured as '{}'",itemName, switchFriendlyName); } try { logger.trace("Command '{}' is about to be send to item '{}'",command, itemName ); sendCommand(itemName, command); } catch (Exception e) { logger.error("Failed to send command", command, e); } }
Source:
private void closeConnection(final PoolEntry poolEntry, final String closureReason) { closeConnection(poolEntry, closureReason, true); }

Target:
final void closeConnection(final PoolEntry poolEntry, final String closureReason) { if (connectionBag.remove(poolEntry)) { final int tc = totalConnections.decrementAndGet(); if (tc < 0) { LOGGER.warn("{} - Unexpected value of totalConnections={}", poolName, tc, new Exception()); } final Connection connection = poolEntry.close(); closeConnectionExecutor.execute(new Runnable() { @Override public void run() { quietlyCloseConnection(connection, closureReason); } }); } }
Source:
private static String nextSafeReplacementFilename(String desired, Set<String> existing) { if (! existing.contains(desired)) return desired; for (int counter = 1; counter < 1000; counter++) { int dot = desired.lastIndexOf("."); String candidate = dot >= 0 ? desired.substring(0, dot) + "[" + counter + "]" + desired.substring(dot) : desired + "[" + counter + "]"; if (! existing.contains(candidate)) return candidate; } throw new IllegalStateException("Too many concurrent writes trying to add a file of the saem name!"); }

Target:
private static String nextSafeReplacementFilename(String desired, Set<String> existing) { if (! existing.contains(desired)) return desired; for (int counter = 1; counter < 1000; counter++) { int dot = desired.lastIndexOf("."); String candidate = dot >= 0 ? desired.substring(0, dot) + "[" + counter + "]" + desired.substring(dot) : desired + "[" + counter + "]"; if (! existing.contains(candidate)) return candidate; } throw new IllegalStateException("Too many concurrent writes trying to add a file of the same name!"); }
Source:
protected void createWidgets(final String popupText, final String currentPageLink) { projectsTab = new ProjectsTable() { @Override protected void movePointerTo(final int row, final boolean scroll) { super.movePointerTo(row, scroll); handlerManager.fireEvent(new ProjectListPopupOnMovePointerEvent( popingUp, getRowItem(row).getName())); } @Override protected void onOpenRow(final int row) { super.onOpenRow(row); handlerManager.fireEvent(new ProjectListPopupOnOpenRowEvent(getRowItem( row).getName())); } }; projectsTab.setSavePointerId(currentPageLink); close = new Button(Util.C.projectsClose()); close.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { closePopup(); handlerManager.fireEvent(new ProjectListPopupOnCloseEvent()); } }); popup = new PluginSafeDialogBox(); popup.setModal(false); popup.setText(popupText); }

Target:
protected void createWidgets(final String popupText, final String currentPageLink) { projectsTab = new ProjectsTable() { @Override protected void movePointerTo(final int row, final boolean scroll) { super.movePointerTo(row, scroll); if (nameBox != null) { nameBox.setText(getRowItem(row).getName()); } } @Override protected void onOpenRow(final int row) { super.onOpenRow(row); handlerManager.fireEvent(new ProjectListPopupOnOpenRowEvent(getRowItem( row).getName())); } }; projectsTab.setSavePointerId(currentPageLink); close = new Button(Util.C.projectsClose()); close.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { closePopup(); } }); popup = new PluginSafeDialogBox(); popup.setModal(false); popup.setText(popupText); }
Source:
public void testEmptyInput() { GroupedTopNBuilder groupedTopNBuilder = new GroupedTopNBuilder( ImmutableList.of(BIGINT), new SimplePageComparator(ImmutableList.of(1), ImmutableList.of(ASC_NULLS_LAST), ImmutableList.of(BIGINT)), 5, ImmutableList.of(), ImmutableList.of(), null); assertFalse(groupedTopNBuilder.buildResult().hasNext()); }

Target:
public void testEmptyInput() { GroupedTopNBuilder groupedTopNBuilder = new GroupedTopNBuilder( ImmutableList.of(BIGINT), (left, leftPosition, right, rightPosition) -> { throw new UnsupportedOperationException(); }, 5, false, new NoChannelGroupByHash()); assertFalse(groupedTopNBuilder.buildResult().hasNext()); }
Source:
protected InputStream downloadRemoteFile(EncryptedSecret encryptedSecret) { String bucket = encryptedSecret.getParams().get(STORAGE_BUCKET); String objName = encryptedSecret.getParams().get(STORAGE_FILE_URI); ByteArrayOutputStream output = new ByteArrayOutputStream(); log.info("Getting contents of object from bucket {}", objName, bucket); try { applicationDefaultGoogleStorage .objects() .get(bucket, objName) .executeMediaAndDownloadTo(output); } catch (IOException e) { log.info( "Getting object contents of failed. Retrying with no authentication.", objName, e); output = new ByteArrayOutputStream(); try { unauthenticatedGoogleStorage .objects() .get(bucket, objName) .executeMediaAndDownloadTo(output); } catch (IOException otherEx) { throw new SecretException( String.format( "Error reading contents of GCS. Bucket: %s, Object: %s.\nError: %s", bucket, objName, otherEx.toString())); } } return new ByteArrayInputStream(output.toByteArray()); }

Target:
protected InputStream downloadRemoteFile(EncryptedSecret encryptedSecret) { String bucket = encryptedSecret.getParams().get(STORAGE_BUCKET); String objName = encryptedSecret.getParams().get(STORAGE_FILE_URI); log.info("Getting contents of object from bucket {}", objName, bucket); try { return googleStorage.objects().get(bucket, objName).executeMediaAsInputStream(); } catch (IOException e) { throw new SecretException( String.format( "Error reading contents of GCS. Bucket: %s, Object: %s.\nError: %s", bucket, objName, e.toString())); } }
Source:
private boolean isBeingPassedElsewhere(Symbol objectSymbol, Tree element) { if (element.parent().is(Tree.Kind.INITIALIZED_BINDING_ELEMENT)) { return !sameSymbol(objectSymbol, retrieveAssignmentIdentifier(element)); } if (element.parent().is(Tree.Kind.ASSIGNMENT)) { AssignmentExpressionTree assignment = (AssignmentExpressionTree) element.parent(); if (assignment.variable().is(Tree.Kind.IDENTIFIER_REFERENCE)) { IdentifierTree identifier = (IdentifierTree) assignment.variable(); return !sameSymbol(objectSymbol, identifier); } } if (element.parent().is(Tree.Kind.ARGUMENT_LIST)) { return true; } if (element.parent().parent() != null && element.parent().parent().is(Tree.Kind.ARROW_FUNCTION)) { return true; } return false; }

Target:
private static boolean isBeingPassedElsewhere(Symbol objectSymbol, Tree element) { if (element.parent().is(Tree.Kind.ASSIGNMENT)) { AssignmentExpressionTree assignment = (AssignmentExpressionTree) element.parent(); if (assignment.variable().is(Tree.Kind.IDENTIFIER_REFERENCE)) { IdentifierTree identifier = (IdentifierTree) assignment.variable(); return !sameSymbol(objectSymbol, identifier); } } return element.parent().is(Tree.Kind.ARGUMENT_LIST, Tree.Kind.INITIALIZED_BINDING_ELEMENT); }
Source:
public List<ImplementingTypeDefinition> getImplementationsOf(InterfaceTypeDefinition targetInterface) { List<ImplementingTypeDefinition> objectTypeDefinitions = getTypes(ImplementingTypeDefinition.class); return objectTypeDefinitions.stream().filter(objectTypeDefinition -> { List<Type> implementsList = objectTypeDefinition.getImplements(); for (Type iFace : implementsList) { Optional<InterfaceTypeDefinition> interfaceTypeDef = getType(iFace, InterfaceTypeDefinition.class); if (interfaceTypeDef.isPresent()) { boolean equals = interfaceTypeDef.get().getName().equals(targetInterface.getName()); if (equals) { return true; } } } return false; }).collect(Collectors.toList()); }

Target:
public List<ObjectTypeDefinition> getImplementationsOf(InterfaceTypeDefinition targetInterface) { return this.getAllImplementationsOf(targetInterface) .stream() .filter(typeDefinition -> typeDefinition instanceof ObjectTypeDefinition) .map(typeDefinition -> (ObjectTypeDefinition) typeDefinition) .collect(Collectors.toList()); }
Source:
public Map<String, Object> getHintsOnCluster(Cluster cluster) { Map<String, Object> hintClusterMap = new HashMap<>(); try (KafkaMetadataService kafkaMetadataService = KafkaMetadataService.newInstance(catalogService, cluster.getId())) { KafkaMetadataService.KafkaZkConnection zkConnection = kafkaMetadataService.getKafkaZkConnection(); KafkaMetadataService.Topics topics = kafkaMetadataService.getTopicsFromZk(); String zkUrl = zkConnection.createZkConnString(); hintClusterMap.put(FIELD_NAME_ZK_URL, zkUrl); hintClusterMap.put(FIELD_NAME_TOPICS, topics.getTopics()); } catch (ServiceNotFoundException e) { throw new IllegalStateException("Service " + SERVICE_NAME + " in cluster " + cluster.getName() + " not found but mapping information exists."); } catch (ServiceConfigurationNotFoundException e) { } catch (Exception e) { throw new RuntimeException(e); } return hintClusterMap; }

Target:
public Map<String, Object> getHintsOnCluster(Cluster cluster) { Map<String, Object> hintClusterMap = new HashMap<>(); try (KafkaMetadataService kafkaMetadataService = KafkaMetadataService.newInstance(environmentService, cluster.getId())) { KafkaMetadataService.KafkaZkConnection zkConnection = kafkaMetadataService.getKafkaZkConnection(); KafkaMetadataService.Topics topics = kafkaMetadataService.getTopicsFromZk(); String zkUrl = zkConnection.createZkConnString(); String brokerPath = DEFAULT_BROKER_ZK_PATH; String zkRoot = zkConnection.getChRoot(); if (StringUtils.isNotEmpty(zkRoot)) { if (zkRoot.endsWith("/")) { brokerPath = zkRoot + brokerPath.substring(1); } else { brokerPath = zkRoot + brokerPath; } } hintClusterMap.put(FIELD_NAME_ZK_URL, zkUrl); hintClusterMap.put(FIELD_NAME_TOPIC, topics.getTopics()); hintClusterMap.put(FIELD_NAME_BROKER_ZK_PATH, brokerPath); fillZookeeperHints(cluster, hintClusterMap); } catch (ServiceNotFoundException e) { throw new IllegalStateException("Service " + SERVICE_NAME + " in cluster " + cluster.getName() + " not found but mapping information exists."); } catch (ServiceConfigurationNotFoundException e) { } catch (Exception e) { throw new RuntimeException(e); } return hintClusterMap; }
Source:
public static void ensureEnvironmentIsSet() throws IOException, ParseException { if (suiteRunning) return; if (initialized) return; try { Field field = ClassLoader.class.getDeclaredField("classes"); field.setAccessible(true); System.out.println("Tests Running Standalone."); System.out.println("Test Classes To Run:"); @SuppressWarnings({ "unchecked", "rawtypes" }) Vector<Class> classes = (Vector<Class>) field.get(BaseTestCase.class.getClassLoader()); for (Class<?> clazz : classes) { if (!clazz.getSimpleName().equals("Test") && clazz.getName().endsWith("Test")) { System.out.println("\t"+clazz.getSimpleName()); System.out.println("\t\tTests:"); for (Method method : clazz.getDeclaredMethods()) { if (method.isAnnotationPresent(Test.class)) { System.out.println("\t\t\t"+method.getName()); } } testClassToRun++; } } } catch (Exception ignore) { } TmdbTestSuite.initializeEnvironment(); }

Target:
public static void ensureEnvironmentIsSet() throws IOException, ParseException, InterruptedException { if (initialized) { return; } initializeEnvironment(); initialized = true; }
Source:
public static boolean awaitInactivity(long timeout, TimeUnit unit) throws InterruptedException { Thread watcherThread = ThreadDeathWatcher.watcherThread; if (watcherThread != null) { watcherThread.join( ObjectUtil.checkNotNull(unit, "unit").toMillis(timeout)); return !watcherThread.isAlive(); } else { return true; } }

Target:
public static boolean awaitInactivity(long timeout, TimeUnit unit) throws InterruptedException { ObjectUtil.checkNotNull(unit, "unit"); Thread watcherThread = ThreadDeathWatcher.watcherThread; if (watcherThread != null) { watcherThread.join(unit.toMillis(timeout)); return !watcherThread.isAlive(); } else { return true; } }
Source:
protected void addDirectMember(PerunSession sess, Group group, Member member) throws InternalErrorException, AlreadyMemberException, WrongAttributeValueException, WrongReferenceAttributeValueException, GroupNotExistsException, GroupOperationsException { if(this.groupsManagerImpl.isDirectGroupMember(sess, group, member)) throw new AlreadyMemberException(member); member = getGroupsManagerImpl().addMember(sess, group, member, MembershipType.DIRECT, group.getId()); getPerunBl().getAuditer().log(sess, "{} added to {}.", member, group); setRequiredAttributes(sess, member, group); List<Integer> relations = groupsManagerImpl.getGroupRelations(sess, group.getId()); for (Integer groupId : relations) { processRelationMembers(sess, groupsManagerImpl.getGroupById(sess, groupId), Collections.singletonList(member), group.getId(), true); } }

Target:
protected void addDirectMember(PerunSession sess, Group group, Member member) throws InternalErrorException, AlreadyMemberException, WrongAttributeValueException, WrongReferenceAttributeValueException, GroupNotExistsException, GroupOperationsException { if(this.groupsManagerImpl.isDirectGroupMember(sess, group, member)) throw new AlreadyMemberException(member); member = getGroupsManagerImpl().addMember(sess, group, member, MembershipType.DIRECT, group.getId()); getPerunBl().getAuditer().log(sess, "{} added to {}.", member, group); List<Integer> relations = groupsManagerImpl.getGroupRelations(sess, group.getId()); for (Integer groupId : relations) { processRelationMembers(sess, groupsManagerImpl.getGroupById(sess, groupId), Collections.singletonList(member), group.getId(), true); } setRequiredAttributes(sess, member, group); }
Source:
protected Object doExecute() throws Exception { printInitCommand("Map Virtual Network Request"); try { VNTRequest vnt = new VNTRequest(); vnt = vnt.readVNTRequestFromXMLFile(requestFileURL); IResource resource = getResourceFromFriendlyName(resourceName); VNMappingCapability capab = (VNMappingCapability) resource.getCapabilityByType(VNMappingCapability.CAPABILITY_TYPE); String resourceId = resource.getResourceIdentifier().getId(); VNMapperOutput capabOutput = capab.mapVN(resourceId, vnt); System.out.println(capabOutput.toString()); } catch (Exception e) { printError("Error mapping with resource " + resourceName); printError(e); } finally { printEndCommand(); } printEndCommand(); return null; }

Target:
protected Object doExecute() throws Exception { printInitCommand("Map Virtual Network Request"); try { VNTRequest vnt = new VNTRequest(); vnt = vnt.readVNTRequestFromXMLFile(requestFileURL); IResource vnmapperResource = getResourceFromFriendlyName(vnmapperResourceName); VNMappingCapability capab = (VNMappingCapability) vnmapperResource.getCapabilityByType(VNMappingCapability.CAPABILITY_TYPE); IResource networkResource = getResourceFromFriendlyName(networkResourceName); String resourceId = networkResource.getResourceIdentifier().getId(); VNMapperOutput capabOutput = capab.mapVN(resourceId, vnt); System.out.println(capabOutput.toString()); } catch (Exception e) { printError("Error mapping with resource " + vnmapperResourceName); printError(e); } finally { printEndCommand(); } printEndCommand(); return null; }
Source:
private Map<String, Map> mergeMaps(Map<String, Map> configuration, Map<String, Map> servicesConfig) { if (servicesConfig == null) { return configuration; } MutableMap<String, Map> newConfigurationMap = MutableMap.copyOf(configuration); for (Map.Entry<String, Map> stringMapEntry : servicesConfig.entrySet()) { if(!newConfigurationMap.containsKey(stringMapEntry.getKey())) { newConfigurationMap.put(stringMapEntry.getKey(), stringMapEntry.getValue()); } else { if(stringMapEntry.getValue() != null) { newConfigurationMap.putAll(stringMapEntry.getValue()); } } } return newConfigurationMap; }

Target:
protected Map<String, Map> mergeMaps(Map<String, Map> configuration, Map<String, Map> servicesConfig) { if (servicesConfig == null) { return configuration; } MutableMap<String, Map> newConfigurationMap = MutableMap.copyOf(configuration); for (Map.Entry<String, Map> stringMapEntry : servicesConfig.entrySet()) { if(!newConfigurationMap.containsKey(stringMapEntry.getKey())) { newConfigurationMap.put(stringMapEntry.getKey(), stringMapEntry.getValue()); } else { if(stringMapEntry.getValue() != null) { MutableMap<String, Map> tmpMap = MutableMap.copyOf(stringMapEntry.getValue()); tmpMap.putAll(newConfigurationMap.get(stringMapEntry.getKey())); newConfigurationMap.put(stringMapEntry.getKey(), ImmutableMap.copyOf(tmpMap)); } } } return newConfigurationMap; }
Source:
protected Builder() { super(ShipyardApi.class); id("shipyard") .name("Shipyard Remote Docker Management API") .identityName("<service-key>") .credentialName(null) .documentation(URI.create("<LINK_0>")) .version("2.0.4") .defaultEndpoint("<LINK_1>") .defaultProperties(ShipyardApiMetadata.defaultProperties()) .view(typeToken(ComputeServiceContext.class)) .defaultModules(ImmutableSet.<Class<? extends Module>>of( OkHttpCommandExecutorServiceModule.class, ShipyardHttpApiModule.class)); }

Target:
protected Builder() { super(ShipyardApi.class); id("shipyard") .name("Shipyard Remote Docker Management API") .identityName("<shipyard-service-key>") .credentialName("not used") .documentation(URI.create("<LINK_0>")) .version("2.0.4") .defaultEndpoint("<LINK_1>") .defaultProperties(ShipyardApiMetadata.defaultProperties()) .defaultModules(ImmutableSet.<Class<? extends Module>>of( ShipyardHttpApiModule.class)); }
Source:
private static void validateValue(Object value) { Class<?> clazz = value.getClass(); if (simples.contains(clazz)) return; if (simpleArrays.contains(clazz) || primitiveArrays.contains(clazz)) return; if (value instanceof Collection) { Collection<?> valueCollection = (Collection<?>) value; for (Object name : valueCollection) { Class<?> containedClazz = name.getClass(); if (!simples.contains(containedClazz)) { throw new IllegalArgumentException(containedClazz.getName() + " in " + clazz.getName()); } } return; } throw new IllegalArgumentException(clazz.getName()); }

Target:
private static void validateValue(Object value) { Class<?> clazz = value.getClass(); if (simples.contains(clazz)) return; if (simpleArrays.contains(clazz) || primitiveArrays.contains(clazz)) return; if (value instanceof Collection) { for (Object simple : (Collection<?>) value) { Class<?> containedClazz = simple.getClass(); if (!simples.contains(containedClazz)) { throw new IllegalArgumentException(containedClazz.getName() + " in " + clazz.getName()); } } return; } throw new IllegalArgumentException(clazz.getName()); }
Source:
@Override protected IgniteConfiguration getConfiguration(final String gridName) throws Exception { final IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setPeerClassLoadingEnabled(true); cfg.setClientMode(gridName.contains("client")); return cfg; }

Target:
@Override protected IgniteConfiguration getConfiguration(final String gridName) throws Exception { final IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setClientMode(gridName.contains("client")); return cfg; }
Source:
public void setThreadKeepAliveTime(int threadKeepAliveTime) { this.threadKeepAliveTime = threadKeepAliveTime; executor.setKeepAliveTime(threadKeepAliveTime, TimeUnit.SECONDS); }

Target:
public void setThreadKeepAliveTime(int threadKeepAliveTime) { this.threadKeepAliveTime = Math.max(MIN_RECEIVE_THREAD_KEEP_ALIVE_TIME, threadKeepAliveTime); executor.setKeepAliveTime(threadKeepAliveTime, TimeUnit.SECONDS); }
Source:
private String histItemFilterQueryProvider(FilterCriteria filter, int numberDecimalcount, String table, String simpleName) { logger.debug("JDBC::getHistItemFilterQueryProvider filter = {}, numberDecimalcount = {}, table = {}, simpleName = {}", filter.toString(), numberDecimalcount, table, simpleName); SimpleDateFormat jdbcDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String filterString = ""; if (filter.getBeginDate() != null) { filterString += filterString.isEmpty() ? " WHERE" : " AND"; filterString += " TIME>'" + jdbcDateFormat.format(filter.getBeginDate()) + "'"; } if (filter.getEndDate() != null) { filterString += filterString.isEmpty() ? " WHERE" : " AND"; filterString += " TIME<'" + jdbcDateFormat.format(filter.getEndDate().getTime()) + "'"; } filterString += (filter.getOrdering() == Ordering.ASCENDING) ? " ORDER BY time ASC" : " ORDER BY time DESC"; if (filter.getPageSize() != 0x7fffffff) { filterString += " OFFSET " + filter.getPageSize() + " ROWS FETCH FIRST " + (filter.getPageNumber() * filter.getPageSize() + 1) + " ROWS ONLY"; } String queryString = "SELECT time,"; if( "NUMBERITEM".equalsIgnoreCase(simpleName) && numberDecimalcount > -1){ queryString += "CAST(value 0."; for(int i= 0; i<numberDecimalcount; i++) queryString += "0"; queryString += "5 AS DECIMAL(31," + numberDecimalcount + "))"; }else{ queryString += "SELECT time, value FROM " + table; } if (!filterString.isEmpty()) { queryString += filterString; } logger.debug("JDBC::query queryString = {}", queryString); return queryString; }

Target:
private String histItemFilterQueryProvider(FilterCriteria filter, int numberDecimalcount, String table, String simpleName) { logger.debug( "JDBC::getHistItemFilterQueryProvider filter = {}, numberDecimalcount = {}, table = {}, simpleName = {}", filter.toString(), numberDecimalcount, table, simpleName); String filterString = ""; if (filter.getBeginDate() != null) { filterString += filterString.isEmpty() ? " WHERE" : " AND"; filterString += " TIME>'" + jdbcDateFormat.print(new DateTime(filter.getBeginDate().getTime())) + "'"; } if (filter.getEndDate() != null) { filterString += filterString.isEmpty() ? " WHERE" : " AND"; filterString += " TIME>'" + jdbcDateFormat.print(new DateTime(filter.getEndDate().getTime())) + "'"; } filterString += (filter.getOrdering() == Ordering.ASCENDING) ? " ORDER BY time ASC" : " ORDER BY time DESC"; if (filter.getPageSize() != 0x7fffffff) { filterString += " OFFSET " + filter.getPageSize() + " ROWS FETCH FIRST " + (filter.getPageNumber() * filter.getPageSize() + 1) + " ROWS ONLY"; } String queryString = "SELECT time,"; if ("NUMBERITEM".equalsIgnoreCase(simpleName) && numberDecimalcount > -1) { queryString += "CAST(value 0."; for (int i = 0; i < numberDecimalcount; i++) queryString += "0"; queryString += "5 AS DECIMAL(31," + numberDecimalcount + "))"; } else { queryString += "SELECT time, value FROM " + table; } if (!filterString.isEmpty()) { queryString += filterString; } logger.debug("JDBC::query queryString = {}", queryString); return queryString; }
Source:
public static DFSHedgedReadMetrics getDFSHedgedReadMetrics(final Configuration c) throws IOException { if (!isHDFS(c)) return null; final String name = "getHedgedReadMetrics"; DFSClient dfsclient = ((DistributedFileSystem)FileSystem.get(c)).getClient(); Method m; try { m = dfsclient.getClass().getDeclaredMethod(name); } catch (NoSuchMethodException e) { LOG.warn("Failed find method " + name + " in dfsclient; no hedged read metrics: " + e.getMessage()); return null; } catch (SecurityException e) { LOG.warn("Failed find method " + name + " in dfsclient; no hedged read metrics: " + e.getMessage()); return null; } m.setAccessible(true); try { return (DFSHedgedReadMetrics)m.invoke(dfsclient); } catch (IllegalAccessException e) { LOG.warn("Failed invoking method " + name + " on dfsclient; no hedged read metrics: " + e.getMessage()); return null; } catch (IllegalArgumentException e) { LOG.warn("Failed invoking method " + name + " on dfsclient; no hedged read metrics: " + e.getMessage()); return null; } catch (InvocationTargetException e) { LOG.warn("Failed invoking method " + name + " on dfsclient; no hedged read metrics: " + e.getMessage()); return null; } }

Target:
public static DFSHedgedReadMetrics getDFSHedgedReadMetrics(final Configuration c) throws IOException { if (!isHDFS(c)) { return null; } final String name = "getHedgedReadMetrics"; DFSClient dfsclient = ((DistributedFileSystem)FileSystem.get(c)).getClient(); Method m; try { m = dfsclient.getClass().getDeclaredMethod(name); } catch (NoSuchMethodException e) { LOG.warn("Failed find method " + name + " in dfsclient; no hedged read metrics: " + e.getMessage()); return null; } catch (SecurityException e) { LOG.warn("Failed find method " + name + " in dfsclient; no hedged read metrics: " + e.getMessage()); return null; } m.setAccessible(true); try { return (DFSHedgedReadMetrics)m.invoke(dfsclient); } catch (IllegalAccessException e) { LOG.warn("Failed invoking method " + name + " on dfsclient; no hedged read metrics: " + e.getMessage()); return null; } catch (IllegalArgumentException e) { LOG.warn("Failed invoking method " + name + " on dfsclient; no hedged read metrics: " + e.getMessage()); return null; } catch (InvocationTargetException e) { LOG.warn("Failed invoking method " + name + " on dfsclient; no hedged read metrics: " + e.getMessage()); return null; } }
Source:
void highlightView(View view, int mainColor) { mHighlightDrawables[0].setColor(mainColor); for (HighlightDrawable mHighlightDrawable : mHighlightDrawables) { mHighlightDrawable.highlightView(view); } }

Target:
void highlightView(View view, int mainColor) { mMainHighlightDrawable.setColor(mainColor); int total = mHighlightDrawables.length; for (int i = 0; i < total; i++) { HighlightDrawable drawable = mHighlightDrawables[i]; drawable.highlightView(view); view.getOverlay().add(drawable); } }