auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private synchronized boolean tryEvict() { ReadBuffer nodeToEvict = null; if (completedReadList.size() <= 0) { return false; } for (ReadBuffer buf : completedReadList) { if (buf.isFirstByteConsumed() && buf.isLastByteConsumed()) { nodeToEvict = buf; break; } } if (nodeToEvict != null) { return evict(nodeToEvict); } for (ReadBuffer buf : completedReadList) { if (buf.isAnyByteConsumed()) { nodeToEvict = buf; break; } } if (nodeToEvict != null) { return evict(nodeToEvict); } long earliestBirthday = Long.MAX_VALUE; ArrayList<ReadBuffer> oldFailedBuffers = new ArrayList<>(); for (ReadBuffer buf : completedReadList) { if ((buf.getBufferindex() != -1) && (buf.getTimeStamp() < earliestBirthday)) { nodeToEvict = buf; earliestBirthday = buf.getTimeStamp(); } else if ((buf.getBufferindex() == -1) && (currentTimeMillis() - buf.getTimeStamp()) > thresholdAgeMilliseconds) { oldFailedBuffers.add(buf); } } for (ReadBuffer buf : oldFailedBuffers) { evict(buf); } if ((currentTimeMillis() - earliestBirthday > thresholdAgeMilliseconds) && (nodeToEvict != null)) { return evict(nodeToEvict); } return false; }

Target:
private synchronized boolean tryEvict() { ReadBuffer nodeToEvict = null; if (completedReadList.size() <= 0) { return false; } long currentTimeInMs = currentTimeMillis(); for (ReadBuffer buf : completedReadList) { if (buf.isFirstByteConsumed() && buf.isLastByteConsumed()) { nodeToEvict = buf; break; } } if (nodeToEvict != null) { return evict(nodeToEvict); } for (ReadBuffer buf : completedReadList) { if (buf.isAnyByteConsumed()) { nodeToEvict = buf; break; } } if (nodeToEvict != null) { return evict(nodeToEvict); } long earliestBirthday = Long.MAX_VALUE; ArrayList<ReadBuffer> oldFailedBuffers = new ArrayList<>(); for (ReadBuffer buf : completedReadList) { if ((buf.getBufferindex() != -1) && (buf.getTimeStamp() < earliestBirthday)) { nodeToEvict = buf; earliestBirthday = buf.getTimeStamp(); } else if ((buf.getBufferindex() == -1) && (currentTimeInMs - buf.getTimeStamp()) > thresholdAgeMilliseconds) { oldFailedBuffers.add(buf); } } for (ReadBuffer buf : oldFailedBuffers) { evict(buf); } if ((currentTimeInMs - earliestBirthday > thresholdAgeMilliseconds) && (nodeToEvict != null)) { return evict(nodeToEvict); } return false; }
Source:
private NumberSchema.Builder buildNumberSchema() { NumberSchema.Builder builder = NumberSchema.builder(); ls.schemaJson().maybe("minimum").map(JsonValue::requireNumber).ifPresent(builder::minimum); ls.schemaJson().maybe("maximum").map(JsonValue::requireNumber).ifPresent(builder::maximum); if (config.useDefaults) ls.schemaJson().maybe("default").map(JsonValue::requireNumber).ifPresent(builder::defaultValue); ls.schemaJson().maybe("multipleOf").map(JsonValue::requireNumber).ifPresent(builder::multipleOf); ls.schemaJson().maybe("exclusiveMinimum") .ifPresent(exclMin -> exclusiveLimitHandler.handleExclusiveMinimum(exclMin, builder)); ls.schemaJson().maybe("exclusiveMaximum") .ifPresent(exclMax -> exclusiveLimitHandler.handleExclusiveMaximum(exclMax, builder)); return builder; }

Target:
private NumberSchema.Builder buildNumberSchema() { NumberSchema.Builder builder = NumberSchema.builder(); ls.schemaJson().maybe("minimum").map(JsonValue::requireNumber).ifPresent(builder::minimum); ls.schemaJson().maybe("maximum").map(JsonValue::requireNumber).ifPresent(builder::maximum); ls.schemaJson().maybe("multipleOf").map(JsonValue::requireNumber).ifPresent(builder::multipleOf); ls.schemaJson().maybe("exclusiveMinimum") .ifPresent(exclMin -> exclusiveLimitHandler.handleExclusiveMinimum(exclMin, builder)); ls.schemaJson().maybe("exclusiveMaximum") .ifPresent(exclMax -> exclusiveLimitHandler.handleExclusiveMaximum(exclMax, builder)); return builder; }
Source:
public ReadableByteChannel get(PageId pageId, int pageOffset) throws IOException, PageNotFoundException { try { byte[] page = mDb.get(getPageKey(pageId)); if (page == null) { throw new PageNotFoundException(new String(getPageKey(pageId))); } ByteArrayInputStream bais = new ByteArrayInputStream(page); bais.skip(pageOffset); return Channels.newChannel(bais); } catch (RocksDBException e) { throw new IOException("Failed to retrieve page", e); } }

Target:
public ReadableByteChannel get(PageId pageId, int pageOffset) throws IOException, PageNotFoundException { Preconditions.checkArgument(pageOffset >= 0, "page offset should be non-negative"); try { byte[] page = mDb.get(getPageKey(pageId)); if (page == null) { throw new PageNotFoundException(new String(getPageKey(pageId))); } Preconditions.checkArgument(pageOffset <= page.length, "page offset %s exceeded page size %s", pageOffset, page.length); ByteArrayInputStream bais = new ByteArrayInputStream(page); bais.skip(pageOffset); return Channels.newChannel(bais); } catch (RocksDBException e) { throw new IOException("Failed to retrieve page", e); } }
Source:
public int getSmsCapacityOnIccForSubscriber(int subId) { IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null ) { return iccSmsIntMgr.getSmsCapacityOnIcc(); } else { Rlog.e(LOG_TAG, "iccSmsIntMgr is null for " + " subId: " + subId); return -1; } }

Target:
public int getSmsCapacityOnIccForSubscriber(int subId) { IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null ) { return iccSmsIntMgr.getSmsCapacityOnIcc(); } else { Rlog.e(LOG_TAG, "iccSmsIntMgr is null for " + " subId: " + subId); return 0; } }
Source:
public void testDeleteScene() { Map<String, Scene> scenes = mockController.getModel().getScenes(); scenes.clear(); scenes.put("initial", new Scene()); mockController.action(DeleteScene.NAME, "initial"); assertEquals(scenes.size(), 1); scenes.put("second", new Scene()); mockController.action(DeleteScene.NAME, "second"); assertEquals(scenes.size(), 1); scenes.put("newInitial", new Scene()); mockController.getModel().getGame().setInitialScene("initial"); mockController.action(DeleteScene.NAME, "initial"); assertEquals("newInitial", mockController.getModel().getGame() .getInitialScene()); }

Target:
public void testDeleteScene() { Map<String, EditorScene> scenes = mockModel.getScenes(); scenes.clear(); scenes.put("initial", new EditorScene()); mockController.action(DeleteScene.class, "initial"); assertEquals(scenes.size(), 1); scenes.put("second", new EditorScene()); mockController.action(DeleteScene.class, "second"); assertEquals(scenes.size(), 1); scenes.put("newInitial", new EditorScene()); mockModel.getGame().setEditScene("initial"); mockController.getModel().getGame().setInitialScene("initial"); mockController.action(DeleteScene.class, "initial"); assertEquals("newInitial", mockModel.getGame().getInitialScene()); assertEquals("newInitial", mockModel.getGame().getEditScene()); }
Source:
private Set<String> validateGracePeriodAndExternalPorts(final Job job) { final Integer gracePeriod = job.getGracePeriod(); if (gracePeriod != null && gracePeriod > 0 && job.hasExternalPorts()) { return singleton( "Job has a grace period and static/external ports. Please choose one or the other."); } return emptySet(); }

Target:
private Set<String> validateGracePeriodAndExternalPorts(final Job job) { final Integer gracePeriod = job.getGracePeriod(); if (gracePeriod != null && gracePeriod > 0 && job.hasExternalPorts()) { return singleton("This configuration will prevent new containers from deploying during the " + "gracePeriod because of port conflicts."); } return emptySet(); }
Source:
public boolean matchingValues(Object object1, Object object2) { final boolean equal; if (object1 == object2) { equal = true; } else if (object1 == null) { equal = "".equals(object2); } else if (object2 == null) { equal = "".equals(object1); } else if (object1 instanceof EObject) { if (object2 instanceof EObject) { equal = matchingEObjects((EObject)object1, (EObject)object2); } else { equal = false; } } else if (object1 instanceof String || object1 instanceof Integer || object1 instanceof Boolean) { equal = object1.equals(object2); } else if (object1.getClass().isArray() && object2.getClass().isArray()) { equal = matchingArrays(object1, object2); } else if (object1 instanceof FeatureMap.Entry && object2 instanceof FeatureMap.Entry) { FeatureMap.Entry featureMapEntry1 = (FeatureMap.Entry)object1; EStructuralFeature key1 = featureMapEntry1.getEStructuralFeature(); FeatureMap.Entry featureMapEntry2 = (FeatureMap.Entry)object2; EStructuralFeature key2 = featureMapEntry2.getEStructuralFeature(); Object value1 = featureMapEntry1.getValue(); Object value2 = featureMapEntry2.getValue(); equal = key1 == key2 && matchingValues(value1, value2); } else { equal = object1.equals(object2); } return equal; }

Target:
public boolean matchingValues(Object object1, Object object2) { final boolean equal; if (object1 == object2) { equal = true; } else if (object1 == null) { equal = "".equals(object2); } else if (object2 == null) { equal = "".equals(object1); } else if (object1 instanceof EObject) { if (object2 instanceof EObject) { equal = matchingEObjects((EObject)object1, (EObject)object2); } else { equal = false; } } else if (object1 instanceof String || object1 instanceof Integer || object1 instanceof Boolean) { equal = object1.equals(object2); } else if (object1.getClass().isArray() && object2.getClass().isArray()) { equal = matchingArrays(object1, object2); } else if (object1 instanceof FeatureMap.Entry && object2 instanceof FeatureMap.Entry) { FeatureMap.Entry featureMapEntry1 = (FeatureMap.Entry)object1; EStructuralFeature key1 = featureMapEntry1.getEStructuralFeature(); FeatureMap.Entry featureMapEntry2 = (FeatureMap.Entry)object2; EStructuralFeature key2 = featureMapEntry2.getEStructuralFeature(); Object value1 = featureMapEntry1.getValue(); Object value2 = featureMapEntry2.getValue(); equal = key1.equals(key2) && matchingValues(value1, value2); } else { equal = object1.equals(object2); } return equal; }
Source:
private boolean activeSDsExist(List<LUNs> luns, String vgId, Guid poolId) { List<String> storageIDs = new ArrayList<>(luns.size()); for (LUNs lun : luns) { if (lun.getStorageDomainId() != null && !lun.getvolume_group_id().equals(vgId)) { storageIDs.add(lun.getStorageDomainId().toString()); } } if (!storageIDs.isEmpty()) { String ids = StringUtils.join(storageIDs, ","); List<StoragePoolIsoMap> isomaps = DbFacade.getInstance().getStoragePoolIsoMapDao().getAllForStorages(ids, poolId); return isomaps.size() > 0; } return false; }

Target:
private boolean activeSDsExist(List<LUNs> luns, String vgId, Guid poolId) { if (poolId == null) { return true; } Set<Guid> storageIDs = new HashSet<>(luns.size()); for (LUNs lun : luns) { if (lun.getStorageDomainId() != null && !lun.getvolume_group_id().equals(vgId)) { storageIDs.add(lun.getStorageDomainId()); } } if (storageIDs.isEmpty()) { return false; } String ids = StringUtils.join(storageIDs, ","); List<StoragePoolIsoMap> isomaps = DbFacade.getInstance().getStoragePoolIsoMapDao().getAllForStorages(ids, poolId); for (StoragePoolIsoMap isomap : isomaps) { if (isomap.getStatus() != StorageDomainStatus.Maintenance) { return true; } } return false; }
Source:
public void sendMessagesToPushNetwork(@Observes @Dequeue MessageHolderWithTokens msg) { final Variant variant = msg.getVariant(); final UnifiedPushMessage unifiedPushMessage = msg.getUnifiedPushMessage(); final Collection<String> deviceTokens = msg.getDeviceTokens(); logger.info(String.format("UnifiedPushMessage was successfully received. Push Notification delivery for the variant ({}) will now be triggered.", variant.getType().getTypeName(), variant.getVariantID())); senders.select(new SenderTypeLiteral(variant.getType())).get() .sendPushMessage(variant, deviceTokens, unifiedPushMessage, msg.getPushMessageInformation().getId(), new SenderServiceCallback( variant, deviceTokens.size(), msg.getPushMessageInformation() ) ); }

Target:
public void sendMessagesToPushNetwork(@Observes @Dequeue MessageHolderWithTokens msg) { final Variant variant = msg.getVariant(); final UnifiedPushMessage unifiedPushMessage = msg.getUnifiedPushMessage(); final Collection<String> deviceTokens = msg.getDeviceTokens(); logger.info("UnifiedPushMessage was successfully received. Push Notification delivery for the variant ({}) will now be triggered.", variant.getType().getTypeName(), variant.getVariantID()); senders.select(new SenderTypeLiteral(variant.getType())).get() .sendPushMessage(variant, deviceTokens, unifiedPushMessage, msg.getPushMessageInformation().getId(), new SenderServiceCallback( variant, deviceTokens.size(), msg.getPushMessageInformation() ) ); }
Source:
public OVirtNodeUpgrade(VDS vds, File iso) { _vds = vds; _iso = iso; _messages = new InstallerMessages(_vds); _dialog = new EngineSSHDialog(); long softTimeout = 2 * Config.<Integer>getValue(ConfigValues.SSHInactivityTimeoutSeconds) * 1000; long hardTimeout = Config.<Integer>getValue(ConfigValues.SSHInactivityHardTimeoutSeconds) * 1000; _dialog.setSoftTimeout(softTimeout); _dialog.setHardTimeout( softTimeout > hardTimeout ? softTimeout : hardTimeout); _thread = new Thread( this::threadMain, "OVirtNodeUpgrade" ); }

Target:
public OVirtNodeUpgrade(VDS vds, File iso) { _vds = vds; _iso = iso; _messages = new InstallerMessages(_vds); _dialog = new EngineSSHDialog( 2 * TimeUnit.SECONDS.toMillis( Config.<Integer>getValue(ConfigValues.SSHInactivityTimeoutSeconds)), TimeUnit.SECONDS.toMillis( Config.<Integer>getValue(ConfigValues.SSHInactivityHardTimeoutSeconds))); _thread = new Thread( this::threadMain, "OVirtNodeUpgrade" ); }
Source:
public void begin() { if ( !session.isOpen() ) { throw new IllegalStateException( "Cannot begin Transaction on closed Session/EntityManager" ); } if ( transactionDriverControl == null ) { transactionDriverControl = transactionCoordinator.getTransactionDriverControl(); } if ( isActive() ) { throw new IllegalStateException( "Transaction already active" ); } if ( LOG.isDebugEnabled() ) { LOG.debug( "begin" ); } this.transactionDriverControl.begin(); }

Target:
public void begin() { if ( !session.isOpen() ) { throw new IllegalStateException( "Cannot begin Transaction on closed Session/EntityManager" ); } if ( transactionDriverControl == null ) { transactionDriverControl = transactionCoordinator.getTransactionDriverControl(); } if ( isActive() ) { throw new IllegalStateException( "Transaction already active" ); } LOG.debug( "begin" ); this.transactionDriverControl.begin(); }
Source:
public Boolean isWmtsCiteCompliant() { return wmtsCiteCompliant; }

Target:
public boolean isWmtsCiteCompliant() { return wmtsCiteCompliant != null ? wmtsCiteCompliant : false; }
Source:
public void leaveToken(DetailAST token) { switch (token.getType()) { case TokenTypes.CLASS_DEF: hasServiceClientBuilderAnnotation = hasServiceClientBuilderAnnotationStack.pop(); break; default: break; } }

Target:
public void leaveToken(DetailAST token) { if (token.getType() == TokenTypes.CLASS_DEF) { hasServiceClientBuilderAnnotation = hasServiceClientBuilderAnnotationStack.pop(); hasBuildMethod = hasBuildMethodStack.pop(); if (hasServiceClientBuilderAnnotation && !hasBuildMethod) { log(token, "Class with @ServiceClientBuilder annotation must have a method starting with ''build'' and ending with ''Client''."); } } }
Source:
protected void incrementCounter() { for (int i = iv.length - 1; i >= iv.length - Long.BYTES; i--) { iv[i]++; if (iv[i] != 0) { break; } } }

Target:
protected void incrementCounter() { int off = iv.length - Long.BYTES; long counter = BufferUtils.getLong(iv, off, Long.BYTES); BufferUtils.putLong(Math.addExact(counter, 1L), iv, off, Long.BYTES); }
Source:
private void registerPlayStatusMessageHandler() { this.messageDispatch.registerHandler(PlayStatusMessage.class, new IMessageHandler<PlayStatusMessage>() { @Override public void handleMessage(int messageNo, PlayStatusMessage message, String fromAddr) { new BroadcastIntent(ACTION_PLAY_STATUS_MESSAGE) .putExtra( EXTRA_IS_PLAYING, message.getString().equals( PlayStatusMessage.PLAY_MESSAGE)) .send(MessagingService.this); } }); }

Target:
private void registerPlayStatusMessageHandler() { this.messageDispatch.registerHandler(PlayStatusMessage.class, new IMessageHandler<PlayStatusMessage>() { @Override public void handleMessage(int messageNo, PlayStatusMessage message, String fromAddr) { new BroadcastIntent(ACTION_PLAY_STATUS_MESSAGE) .putExtra(EXTRA_IS_PLAYING, message.isPlaying()) .putExtra(EXTRA_ADDRESS, message.getMacAddress()) .putExtra(EXTRA_SONG_ID, message.getId()) .send(MessagingService.this); } }); }
Source:
public CoordinatorDynamicConfig build() { return new CoordinatorDynamicConfig( millisToWaitBeforeDeleting == null ? 15 * 60 * 1000L : millisToWaitBeforeDeleting, mergeBytesLimit == null ? 524288000L : mergeBytesLimit, mergeSegmentsLimit == null ? 100 : mergeSegmentsLimit, maxSegmentsToMove == null ? 5 : maxSegmentsToMove, replicantLifetime == null ? 15 : replicantLifetime, replicationThrottleLimit == null ? 10 : replicationThrottleLimit, balancerComputeThreads == null ? 1 : balancerComputeThreads, emitBalancingStats == null ? false : emitBalancingStats, killDataSourceWhitelist, killAllDataSources == null ? false : killAllDataSources, maxSegmentsInNodeLoadingQueue == null ? 0 : maxSegmentsInNodeLoadingQueue ); }

Target:
public CoordinatorDynamicConfig build() { return new CoordinatorDynamicConfig( millisToWaitBeforeDeleting == null ? DEFAULT_MILLIS_TO_WAIT_BEFORE_DELETING : millisToWaitBeforeDeleting, mergeBytesLimit == null ? DEFAULT_MERGE_BYTES_LIMIT : mergeBytesLimit, mergeSegmentsLimit == null ? DEFAULT_MERGE_SEGMENTS_LIMIT : mergeSegmentsLimit, maxSegmentsToMove == null ? DEFAULT_MAX_SEGMENTS_TO_MOVE : maxSegmentsToMove, replicantLifetime == null ? DEFAULT_REPLICANT_LIFETIME : replicantLifetime, replicationThrottleLimit == null ? DEFAULT_REPLICATION_THROTTLE_LIMIT : replicationThrottleLimit, balancerComputeThreads == null ? DEFAULT_BALANCER_COMPUTE_THREADS : balancerComputeThreads, emitBalancingStats == null ? DEFAULT_EMIT_BALANCING_STATS : emitBalancingStats, killDataSourceWhitelist, killAllDataSources == null ? DEFAULT_KILL_ALL_DATA_SOURCES : killAllDataSources, maxSegmentsInNodeLoadingQueue == null ? DEFAULT_MAX_SEGMENTS_IN_NODE_LOADING_QUEUE : maxSegmentsInNodeLoadingQueue ); }
Source:
static String getEnvironmentalVariable (String envVarName) { String envVarValue = System.getProperty(envVarName); if (envVarValue == null) { long ptr = OS.getenv(ascii(envVarName)); if (ptr != 0) { int length = OS.strlen(ptr); byte[] buffer = new byte[length]; OS.memmove(buffer, ptr, length); char[] convertedChar = new char[buffer.length]; for (int i = 0; i < buffer.length; i++) { convertedChar[i]=(char)buffer[i]; } envVarValue = new String(convertedChar); } } return envVarValue; }

Target:
private static String getEnvironmentalVariable (String envVarName) { String envVarValue = System.getProperty(envVarName); if (envVarValue == null) { long ptr = OS.getenv(ascii(envVarName)); if (ptr != 0) { int length = OS.strlen(ptr); byte[] buffer = new byte[length]; OS.memmove(buffer, ptr, length); char[] convertedChar = new char[buffer.length]; for (int i = 0; i < buffer.length; i++) { convertedChar[i]=(char)buffer[i]; } envVarValue = new String(convertedChar); } } return envVarValue; }
Source:
public Mono<T> one(T object) { return Mono.just(object).flatMap(o -> { CouchbaseDocument converted = template.support().encodeEntity(o); return template.getCollection(collection).reactive() .replace(converted.getId(), converted.export(), buildReplaceOptions(object)).map(result -> { template.support().applyUpdatedCas(object, result.cas()); return o; }); }).onErrorMap(throwable -> { if (throwable instanceof RuntimeException) { return template.potentiallyConvertRuntimeException((RuntimeException) throwable); } else { return throwable; } }); }

Target:
public Mono<T> one(T object) { return Mono.just(object).flatMap(o -> { CouchbaseDocument converted = template.support().encodeEntity(o); return template.getCollection(collection).reactive() .replace(converted.getId(), converted.export(), buildReplaceOptions(o)).map(result -> { template.support().applyUpdatedCas(o, result.cas()); return o; }); }).onErrorMap(throwable -> { if (throwable instanceof RuntimeException) { return template.potentiallyConvertRuntimeException((RuntimeException) throwable); } else { return throwable; } }); }
Source:
private void deleteVolume(VolumeInfo volumeInfo, long storagePoolId) { try { long volumeId = volumeInfo.getId(); SolidFireUtil.SolidFireConnection sfConnection = SolidFireUtil.getSolidFireConnection(storagePoolId, _storagePoolDetailsDao); deleteSolidFireVolume(sfConnection, volumeInfo); _volumeDetailsDao.removeDetails(volumeId); StoragePoolVO storagePool = _storagePoolDao.findById(storagePoolId); long usedBytes = getUsedBytes(storagePool, volumeId); storagePool.setUsedBytes(usedBytes < 0 ? 0 : usedBytes); _storagePoolDao.update(storagePoolId, storagePool); } catch (Exception ex) { s_logger.debug(SolidFireUtil.LOG_PREFIX + "Failed to delete SolidFire volume. CloudStack volume ID: " + volumeInfo.getId(), ex); throw ex; } }

Target:
private void deleteVolume(VolumeInfo volumeInfo, long storagePoolId) { try { long volumeId = volumeInfo.getId(); SolidFireUtil.SolidFireConnection sfConnection = SolidFireUtil.getSolidFireConnection(storagePoolId, storagePoolDetailsDao); deleteSolidFireVolume(sfConnection, volumeInfo); volumeDetailsDao.removeDetails(volumeId); StoragePoolVO storagePool = storagePoolDao.findById(storagePoolId); long usedBytes = getUsedBytes(storagePool, volumeId); storagePool.setUsedBytes(usedBytes < 0 ? 0 : usedBytes); storagePoolDao.update(storagePoolId, storagePool); } catch (Exception ex) { LOGGER.debug(SolidFireUtil.LOG_PREFIX + "Failed to delete SolidFire volume. CloudStack volume ID: " + volumeInfo.getId(), ex); throw ex; } }
Source:
private void ensureCredential() throws Exception { if(credential ==null){ try { credential = BuildCredentialForCredentialsFile(ParseCredentialsFile(filepath)); } catch (Exception e){ throw new Exception("Error parsing SDK Auth File", e); } } }

Target:
void ensureCredential() { if (credential == null) { try { credential = buildCredentialForCredentialsFile(parseCredentialsFile(filepath)); } catch (Exception e) { throw logger.logExceptionAsError(new RuntimeException("Error parsing SDK Auth File", e)); } } }
Source:
public static ResultSet lookupUniversityID(Connection connection, int univid) throws ServiceException{ CodeContract.assertNotNull(univid, "univid"); try{ PreparedStatement lookupStatement = connection.prepareStatement(LOOKUP_UNIVERSITY_ID_QUERY); lookupStatement.setInt(1, univid); return lookupStatement.executeQuery(); }catch (SQLException ex) { throw new ServiceException(ServiceStatus.DATABASE_ERROR, ex); } }

Target:
public static ResultSet lookupUniversityID(Connection connection, int univid) throws ServiceException { CodeContract.assertNotNull(connection, "connection"); try { PreparedStatement lookupStatement = connection.prepareStatement(LOOKUP_UNIVERSITY_ID_QUERY); lookupStatement.setInt(1, univid); return lookupStatement.executeQuery(); } catch (SQLException ex) { throw new ServiceException(ServiceStatus.DATABASE_ERROR, ex); } }
Source:
public boolean exec() throws CliException { String path = args[1]; CompletableFuture<Integer> cf = new CompletableFuture<>(); try { zk.sync(path, new AsyncCallback.VoidCallback() { public void processResult(int rc, String path, Object ctx) { cf.complete(rc); } }, null); int resultCode = cf.get(SYNC_TIMEOUT, TimeUnit.MILLISECONDS); if (resultCode == 0) { out.println("Sync is OK"); } else { throw new CliWrapperException(new KeeperException.NoNodeException(path)); } } catch (IllegalArgumentException ex) { throw new MalformedPathException(ex.getMessage()); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new CliWrapperException(ie); } catch (TimeoutException | ExecutionException ex) { throw new CliWrapperException(ex); } return false; }

Target:
public boolean exec() throws CliException { String path = args[1]; CompletableFuture<Integer> cf = new CompletableFuture<>(); try { zk.sync(path, (rc, path1, ctx) -> cf.complete(rc), null); int resultCode = cf.get(SYNC_TIMEOUT, TimeUnit.MILLISECONDS); if (resultCode == 0) { out.println("Sync is OK"); } else if (resultCode == KeeperException.Code.NONODE.intValue()) { throw new KeeperException.NoNodeException(path); } else { out.println("Sync has failed. rc=" + resultCode); } } catch (IllegalArgumentException ex) { throw new MalformedPathException(ex.getMessage()); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new CliWrapperException(ie); } catch (TimeoutException | ExecutionException | KeeperException ex) { throw new CliWrapperException(ex); } return false; }
Source:
private static PageSizes computePageSizesAssumingNormalDistribution( int cellBatchHint, double columnsPerRowMean, double columnsPerRowStdDev) { double sigma = Math.min(columnsPerRowStdDev, cellBatchHint * 0.2); double logArg = Math.min(1.0, SQRT_2_PI * sigma / cellBatchHint); double extraColumnsToFetch = logArg < 1e-12 ? 0.0 : sigma * Math.sqrt(-2.0 * Math.log(logArg)); return negotiateExactPageSize(columnsPerRowMean + 1.0 + extraColumnsToFetch, cellBatchHint); }

Target:
private static PageSizes computePageSizesAssumingNormalDistribution( int cellBatchHint, double columnsPerRowMean, double columnsPerRowStdDev) { double sigma = Math.min(columnsPerRowStdDev, cellBatchHint * 0.2); double logArg = Math.min(1.0, SQRT_2_PI * sigma / cellBatchHint); double extraColumnsToFetch = logArg < 1e-12 ? 0.0 : sigma * Math.sqrt(-2.0 * Math.log(logArg)); return getExactPageSize(columnsPerRowMean + 1.0 + extraColumnsToFetch, cellBatchHint); }
Source:
public GMFUMLElementAdapter(View view, ExtendedCSSEngine engine) { super(view, engine); super.helper = new CSSDOMUMLSemanticElementHelper(); }

Target:
public GMFUMLElementAdapter(View view, ExtendedCSSEngine engine) { super(view, engine); helper = CSSDOMUMLSemanticElementHelper.getInstance(); }
Source:
public Builder adapt(Scan scan, ReadHooks readHooks) { throwIfUnsupportedScan(scan); byte[] startRowBytes = scan.getStartRow(); byte[] stopRowBytes = scan.getStopRow(); ByteString startRow = ByteStringer.wrap(startRowBytes); ByteString stopRow = startRowBytes == stopRowBytes ? startRow : ByteStringer.wrap(stopRowBytes); RowFilter filter = buildFilter(scan, readHooks); return ReadRowsRequest.newBuilder() .setFilter(filter) .setRowRange( RowRange.newBuilder() .setStartKey(startRow) .setEndKey(stopRow)); }

Target:
public Builder adapt(Scan scan, ReadHooks readHooks) { throwIfUnsupportedScan(scan); RowFilter filter = buildFilter(scan, readHooks); return ReadRowsRequest.newBuilder() .setFilter(filter) .setRowRange( RowRange.newBuilder() .setStartKey(ByteStringer.wrap(scan.getStartRow())) .setEndKey(ByteStringer.wrap(scan.getStopRow()))); }
Source:
public void deleteSurveyPermanently(GuidCreatedOnVersionHolder keys) { Survey existing = new QueryBuilder().setSurvey(keys.getGuid()).setCreatedOn(keys.getCreatedOn()) .setSkipElements(true).getOne(false); if (existing != null) { deleteAllElements(existing.getGuid(), existing.getCreatedOn()); surveyMapper.delete(existing); try { StudyIdentifier studyId = new StudyIdentifierImpl(existing.getStudyIdentifier()); uploadSchemaService.deleteUploadSchemaById(studyId, existing.getIdentifier()); } catch(EntityNotFoundException e) { } } }

Target:
public void deleteSurveyPermanently(GuidCreatedOnVersionHolder keys) { Survey existing = new QueryBuilder().setSurvey(keys.getGuid()).setCreatedOn(keys.getCreatedOn()) .setSkipElements(true).getOne(true); deleteAllElements(existing.getGuid(), existing.getCreatedOn()); surveyMapper.delete(existing); try { StudyIdentifier studyId = new StudyIdentifierImpl(existing.getStudyIdentifier()); uploadSchemaService.deleteUploadSchemaById(studyId, existing.getIdentifier()); } catch(EntityNotFoundException e) { } }
Source:
public static void validateGranularity(String granularity) { Preconditions.checkNotNull(granularity, "Granularity string in dateTimeFieldSpec must not be null"); String[] granularityTokens = granularity.split(COLON_SEPARATOR); Preconditions.checkArgument(granularityTokens.length == MAX_GRANULARITY_TOKENS, "Incorrect granularity:%. Must be of format size:timeunit", granularity); Preconditions.checkArgument(granularityTokens[GRANULARITY_SIZE_POSITION].matches(NUMBER_REGEX), "Incorrect granularity size:%. Must be of format [0-9]+:<TimeUnit>", granularityTokens[GRANULARITY_SIZE_POSITION]); Preconditions.checkArgument(EnumUtils.isValidEnum(TimeUnit.class, granularityTokens[GRANULARITY_UNIT_POSITION]), "Incorrect granularity size:%. Must be of format [0-9]+:<TimeUnit>", granularityTokens[GRANULARITY_SIZE_POSITION]); }

Target:
public static void validateGranularity(String granularity) { Preconditions.checkNotNull(granularity, "Granularity string in dateTimeFieldSpec must not be null"); String[] granularityTokens = granularity.split(COLON_SEPARATOR); Preconditions.checkState(granularityTokens.length == MAX_GRANULARITY_TOKENS, "Incorrect granularity: %s. Must be of format 'size:timeunit'", granularity); Preconditions.checkState(granularityTokens[GRANULARITY_SIZE_POSITION].matches(NUMBER_REGEX), "Incorrect granularity size: %s. Must be of format '[0-9]+:<TimeUnit>'", granularityTokens[GRANULARITY_SIZE_POSITION]); Preconditions.checkState(EnumUtils.isValidEnum(TimeUnit.class, granularityTokens[GRANULARITY_UNIT_POSITION]), "Incorrect granularity size: %s. Must be of format '[0-9]+:<TimeUnit>'", granularityTokens[GRANULARITY_SIZE_POSITION]); }
Source:
private static boolean jniIsAlreadyLoaded(String libName){ String foundLib = System.mapLibraryName(libName); try { java.lang.reflect.Field LIBRARIES = null; LIBRARIES = ClassLoader.class.getDeclaredField("loadedLibraryNames"); LIBRARIES.setAccessible(true); final Vector<String> libs = (Vector<String>) LIBRARIES.get(ClassLoader.getSystemClassLoader()); for (String l : libs){ System.out.println(l); if (l.contains(foundLib)) return true; } return false; } catch (Throwable e) { return false; } }

Target:
private static boolean jniIsAlreadyLoaded(String libName){ String foundLib = System.mapLibraryName(libName); try { java.lang.reflect.Field LIBRARIES = null; LIBRARIES = ClassLoader.class.getDeclaredField("loadedLibraryNames"); LIBRARIES.setAccessible(true); final Vector<String> libs = (Vector<String>) LIBRARIES.get(ClassLoader.getSystemClassLoader()); for (String l : libs){ if (l.contains(foundLib)) return true; } return false; } catch (Throwable e) { return false; } }
Source:
public ExtractModuleTask() { try { this.moduleFile = getProject().getObjects().fileProperty(); } catch(NoSuchMethodError e) { this.moduleFile = getProject().getLayout().fileProperty(); } }

Target:
public ExtractModuleTask() { try { this.moduleFile = getProject().getObjects().fileProperty(); } catch (NoSuchMethodError e) { this.moduleFile = invokeMethod(getProject().getLayout(), "fileProperty"); } }
Source:
public void serialize(final Host host, final JsonGenerator jgen, final SerializerProvider sp) throws IOException, JsonProcessingException { jgen.writeStartObject(); jgen.writeNumberField("hostId", host.getHostId()); jgen.writeStringField("ipAddress", host.getIp().toSimpleString()); jgen.writeStringField("mac", host.getMac().toString()); jgen.writeStringField("vdpid", host.getPort().getParentSwitch() .getSwitchName()); jgen.writeNumberField("vport", host.getPort().getPortNumber()); jgen.writeEndObject(); }

Target:
public void serialize(final Host host, final JsonGenerator jgen, final SerializerProvider sp) throws IOException, JsonProcessingException { jgen.writeStartObject(); jgen.writeNumberField(TenantHandler.HOST, host.getHostId()); jgen.writeStringField(TenantHandler.IFADDR, host.getIp().toSimpleString()); jgen.writeStringField(TenantHandler.MAC, host.getMac().toString()); jgen.writeStringField(TenantHandler.VDPID, host.getPort().getParentSwitch() .getSwitchName()); jgen.writeNumberField(TenantHandler.VPORT, host.getPort().getPortNumber()); jgen.writeEndObject(); }
Source:
Data(JSONObject o) { this.sourceId = (String)o.get("id"); JSONObject c = o.optJSONObject("core"); if (c!=null) { core = new Entry(sourceId, c, url); } else { core = null; } JSONArray w = o.optJSONArray("warnings"); if (w != null) { for (int i = 0; i < w.size(); i++) { warnings.add(new Warning(w.getJSONObject(i))); } } for(Map.Entry<String,JSONObject> e : (Set<Map.Entry<String,JSONObject>>)o.getJSONObject("plugins").entrySet()) { Plugin p = new Plugin(sourceId, e.getValue()); List<PluginWrapper.Dependency> implicitDeps = ClassicPluginStrategy.getImpliedDependencies(p.name, p.requiredCore); if(!implicitDeps.isEmpty()) { for(PluginWrapper.Dependency dep : implicitDeps) { if(!p.dependencies.containsKey(dep.shortName)) { p.dependencies.put(dep.shortName, dep.version); } } } plugins.put(e.getKey(), p); } connectionCheckUrl = (String)o.get("connectionCheckUrl"); }

Target:
Data(JSONObject o) { this.sourceId = (String)o.get("id"); JSONObject c = o.optJSONObject("core"); if (c!=null) { core = new Entry(sourceId, c, url); } else { core = null; } JSONArray w = o.optJSONArray("warnings"); if (w != null) { for (int i = 0; i < w.size(); i++) { try { warnings.add(new Warning(w.getJSONObject(i))); } catch (JSONException ex) { LOGGER.log(Level.WARNING, "Failed to parse JSON for warning", ex); } } } for(Map.Entry<String,JSONObject> e : (Set<Map.Entry<String,JSONObject>>)o.getJSONObject("plugins").entrySet()) { Plugin p = new Plugin(sourceId, e.getValue()); List<PluginWrapper.Dependency> implicitDeps = ClassicPluginStrategy.getImpliedDependencies(p.name, p.requiredCore); if(!implicitDeps.isEmpty()) { for(PluginWrapper.Dependency dep : implicitDeps) { if(!p.dependencies.containsKey(dep.shortName)) { p.dependencies.put(dep.shortName, dep.version); } } } plugins.put(e.getKey(), p); } connectionCheckUrl = (String)o.get("connectionCheckUrl"); }
Source:
private static void reboot(@NonNull String endpoint, @NonNull CorfuRuntimeParameters corfuRuntimeParameters, int retries, @NonNull Duration retryDuration, boolean resetData) { IClientRouter router = new NettyClientRouter(NodeLocator.parseString(endpoint), corfuRuntimeParameters); router.addClient(new BaseHandler()); BaseClient baseClient = new BaseClient(router, Layout.INVALID_EPOCH); while (retries-- > 0) { try { if (resetData) { log.info("Attempting to reset server: {}", endpoint); CFUtils.getUninterruptibly(baseClient.reset()); } else { log.info("Attempting to restart server: {}", endpoint); CFUtils.getUninterruptibly(baseClient.restart()); } break; } catch (Exception e) { log.error("Reboot node: failed with exception:", endpoint, e); if (retries == 0) { throw new RuntimeException(e); } log.warn("Retrying times in {}ms.", retries, retryDuration.toMillis()); Sleep.MILLISECONDS.sleepUninterruptibly(retryDuration.toMillis()); } } log.info("Successfully rebooted server:{}", endpoint); router.stop(); }

Target:
private static void reboot(@NonNull String endpoint, @NonNull CorfuRuntimeParameters corfuRuntimeParameters, int retries, @NonNull Duration retryDuration, boolean resetData) { IClientRouter router = new NettyClientRouter(NodeLocator.parseString(endpoint), corfuRuntimeParameters); router.addClient(new BaseHandler()); BaseClient baseClient = new BaseClient(router, Layout.INVALID_EPOCH); while (retries-- > 0) { try { if (resetData) { log.info("Attempting to reset server: {}", endpoint); CFUtils.getUninterruptibly(baseClient.reset()); } else { log.info("Attempting to restart server: {}", endpoint); CFUtils.getUninterruptibly(baseClient.restart()); } break; } catch (Exception e) { log.error("Rebooting node: failed with exception:", endpoint, e); if (retries == 0) { throw new RetryExhaustedException("Rebooting node: retry exhausted"); } log.warn("Retrying reboot times in {}ms.", retries, retryDuration.toMillis()); Sleep.MILLISECONDS.sleepUninterruptibly(retryDuration.toMillis()); } } log.info("Successfully rebooted server:{}", endpoint); router.stop(); }
Source:
private void setResponseHeaders(BlobInfo blobInfo, RestResponseChannel restResponseChannel) throws RestServiceException { BlobProperties blobProperties = blobInfo.getBlobProperties(); restResponseChannel.setStatus(ResponseStatus.Ok); restResponseChannel.setHeader(RestUtils.Headers.LAST_MODIFIED, new Date(blobProperties.getCreationTimeInMs())); restResponseChannel.setHeader(RestUtils.Headers.CONTENT_LENGTH, blobProperties.getBlobSize()); if (blobProperties.getContentType() != null) { restResponseChannel.setHeader(RestUtils.Headers.CONTENT_TYPE, blobProperties.getContentType()); } setBlobPropertiesHeaders(blobProperties, restResponseChannel); }

Target:
private void setResponseHeaders(BlobInfo blobInfo, RestResponseChannel restResponseChannel) throws RestServiceException { BlobProperties blobProperties = blobInfo.getBlobProperties(); restResponseChannel.setHeader(RestUtils.Headers.LAST_MODIFIED, new Date(blobProperties.getCreationTimeInMs())); restResponseChannel.setHeader(RestUtils.Headers.CONTENT_LENGTH, blobProperties.getBlobSize()); if (blobProperties.getContentType() != null) { restResponseChannel.setHeader(RestUtils.Headers.CONTENT_TYPE, blobProperties.getContentType()); } setBlobPropertiesHeaders(blobProperties, restResponseChannel); }
Source:
private List<String> getHeaderRow() { List<String> row = new ArrayList<String>(); row.add("ACB"); row.add("Developer"); row.add("Product"); row.add("Version"); row.add("CHPL Product Number"); row.add("Current Certification Status"); row.add("Link"); row.add("Activity Timestamp"); row.add("Responsible User"); row.add("Activity Type"); row.add("Activity"); row.add("Reason for Status Change"); row.add("Reason"); return row; }

Target:
private List<String> getHeaderRow() { List<String> row = new ArrayList<String>(); row.add("ONC-ACB"); row.add("Developer"); row.add("Product"); row.add("Version"); row.add("CHPL Product Number"); row.add("Current Certification Status"); row.add("Link"); row.add("Activity Timestamp"); row.add("Responsible User"); row.add("Activity Type"); row.add("Activity"); row.add("Reason for Status Change"); row.add("Reason"); return row; }
Source:
static Optional<Pattern> getEndpointsPatterns(ServerProperties serverProperties, WebEndpointProperties webEndpointProperties, EndpointsSupplier<ExposableWebEndpoint> endpointsSupplier) { Collection<ExposableWebEndpoint> endpoints = endpointsSupplier.getEndpoints(); if (endpoints.isEmpty()) { return Optional.empty(); } String contextPath = serverProperties.getServlet().getContextPath(); int size = endpoints.size(); int i = 0; StringBuilder sb = new StringBuilder(); for (ExposableWebEndpoint endpoint : endpoints) { i++; if (StringUtils.hasText(contextPath)) { sb.append(contextPath); } if (!webEndpointProperties.getBasePath().equals("/")) { sb.append(webEndpointProperties.getBasePath()); } sb.append("/") .append(endpoint.getRootPath()) .append(".*"); if (i < size) { sb.append("|"); } } String pattern = sb.toString(); if (StringUtils.hasText(pattern)) { return Optional.of(Pattern.compile(pattern)); } return Optional.empty(); }

Target:
static Optional<Pattern> getEndpointsPatterns(ServerProperties serverProperties, WebEndpointProperties webEndpointProperties, EndpointsSupplier<ExposableWebEndpoint> endpointsSupplier) { Collection<ExposableWebEndpoint> endpoints = endpointsSupplier.getEndpoints(); if (endpoints.isEmpty()) { return Optional.empty(); } String contextPath = serverProperties.getServlet().getContextPath(); String pattern = endpoints.stream().map(PathMappedEndpoint::getRootPath) .map(path -> path + "|" + path + "/.*").collect( Collectors.joining("|", getPathPrefix(contextPath, webEndpointProperties.getBasePath()) + "/(", ")")); if (StringUtils.hasText(pattern)) { return Optional.of(Pattern.compile(pattern)); } return Optional.empty(); }
Source:
protected void doWork(IProgressMonitor monitor) throws Exception { if (originalBranch != null && !BranchManager.hasMergeBranches( originalBranch) && !originalBranch.getBranchState().isCommitted()) { performUpdate(monitor, originalBranch); activityLog.createEntry(BRANCH_OPERATION_TYPEID, ActivityLog.INITIAL_STATUS, String.format( "Branch Operation Update Branch {branchUUID: %s, branchName: %s parentBranchUUID: %s parentBranchName: %s}", originalBranch.getUuid(), originalBranch.getName(), BranchManager.getParentBranch(originalBranch).getUuid(), BranchManager.getParentBranch(originalBranch).getName())); } }

Target:
protected void doWork(IProgressMonitor monitor) throws Exception { if (originalBranch != null && !BranchManager.hasMergeBranches( originalBranch) && !originalBranch.getBranchState().isCommitted()) { performUpdate(monitor, originalBranch); try { activityLog.createEntry(BRANCH_OPERATION_TYPEID, ActivityLog.INITIAL_STATUS, String.format( "Branch Operation Update Branch {branchUUID: %s, branchName: %s parentBranchUUID: %s parentBranchName: %s}", originalBranch.getUuid(), originalBranch.getName(), BranchManager.getParentBranch(originalBranch).getUuid(), BranchManager.getParentBranch(originalBranch).getName())); } catch (OseeCoreException ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } } }
Source:
public void should_fail_if_actual_has_at_least_one_element() { SoftAssertions softly = new SoftAssertions(); softly.assertThat(newArrayList(1).iterator()).isExhausted(); AssertionError error = catchThrowableOfType(softly::assertAll, AssertionError.class); assertThat(error).hasMessageContaining("\nExpecting iterator to be exhausted."); }

Target:
public void should_fail_if_actual_has_at_least_one_element() { IteratorAssert iteratorAssert = assertThat(newArrayList(1).iterator()); AssertionError error = catchThrowableOfType(iteratorAssert::isExhausted, AssertionError.class); assertThat(error).hasMessageContaining("\nExpecting iterator to be exhausted."); }
Source:
public void logExtendedCommitInformation() { if (!commitTimeoutReached) { return; } final List<EventTypePartition> toCheck = offsets.entrySet().stream() .filter(e -> !e.getValue().isCommitted()) .map(Map.Entry::getKey) .collect(Collectors.toList()); try { final Map<EventTypePartition, SubscriptionCursorWithoutToken> realCommitted = getZk().getOffsets(toCheck); final List<EventTypePartition> bustedPartitions = offsets.entrySet().stream() .filter(v -> realCommitted.containsKey(v.getKey())) .filter(v -> { final SubscriptionCursorWithoutToken remembered = getContext().getCursorConverter().convertToNoToken(v.getValue().getCommitOffset()); final SubscriptionCursorWithoutToken real = realCommitted.get(v.getKey()); return real.getOffset().compareTo(remembered.getOffset()) > 0; }) .map(Map.Entry::getKey) .collect(Collectors.toList()); if (!bustedPartitions.isEmpty()) { final String bustedData = bustedPartitions.stream().map(etp -> { final PartitionData pd = offsets.get(etp); return "(ETP: " + etp + ", StreamCommitted: " + pd.getCommitOffset() + ", StreamSent: " + pd.getSentOffset() + ", ZkCommitted: " + realCommitted.get(etp) + ")"; }).collect(Collectors.joining(", ")); getLog().warn("Stale offsets during streaming commit timeout: {}", bustedData); TracingService.logWarning(getContext().getCurrentSpan(), "Stale offsets during streaming commit timeout: " + bustedData); } } catch (NakadiRuntimeException ex) { getLog().warn("Failed to get nakadi cursors for logging purposes."); TracingService.logWarning(getContext().getCurrentSpan(), "Failed to get nakadi cursors for logging purposes."); } }

Target:
public void logExtendedCommitInformation() { if (!commitTimeoutReached) { return; } final List<EventTypePartition> toCheck = offsets.entrySet().stream() .filter(e -> !e.getValue().isCommitted()) .map(Map.Entry::getKey) .collect(Collectors.toList()); try { final Map<EventTypePartition, SubscriptionCursorWithoutToken> realCommitted = getZk().getOffsets(toCheck); final List<EventTypePartition> bustedPartitions = offsets.entrySet().stream() .filter(v -> realCommitted.containsKey(v.getKey())) .filter(v -> { final SubscriptionCursorWithoutToken remembered = getContext().getCursorConverter().convertToNoToken(v.getValue().getCommitOffset()); final SubscriptionCursorWithoutToken real = realCommitted.get(v.getKey()); return real.getOffset().compareTo(remembered.getOffset()) > 0; }) .map(Map.Entry::getKey) .collect(Collectors.toList()); if (!bustedPartitions.isEmpty()) { final String bustedData = bustedPartitions.stream().map(etp -> { final PartitionData pd = offsets.get(etp); return "(ETP: " + etp + ", StreamCommitted: " + pd.getCommitOffset() + ", StreamSent: " + pd.getSentOffset() + ", ZkCommitted: " + realCommitted.get(etp) + ")"; }).collect(Collectors.joining(", ")); getLog().warn("Stale offsets during streaming commit timeout: {}", bustedData); } } catch (NakadiRuntimeException ex) { getLog().warn("Failed to get nakadi cursors for logging purposes."); } }
Source:
private void loadDownloadedProject(String name) { try { ProjectManager.getInstance().loadProject(name, getContext()); Intent intent = new Intent(getContext(), ProjectActivity.class); intent.putExtra(ProjectActivity.EXTRA_FRAGMENT_POSITION, ProjectActivity.FRAGMENT_SCENES); startActivity(intent); } catch (ProjectException e) { Log.e(TAG, Log.getStackTraceString(e)); } }

Target:
private void loadDownloadedProject(String name) { try { ProjectManager.getInstance().loadProject(name, getContext()); Intent intent = new Intent(getContext(), ProjectActivity.class); intent.putExtra(ProjectActivity.EXTRA_FRAGMENT_POSITION, ProjectActivity.FRAGMENT_SCENES); startActivity(intent); } catch (ProjectException e) { Log.e(TAG, Log.getStackTraceString(e)); ToastUtil.showError(getActivity(), R.string.error_load_project); } }
Source:
public boolean onTouchEvent(MotionEvent event) { if (getParent() instanceof View) { final View parent = (View)getParent(); View view = ViewUtil.hitTest(parent, event.getX(), event.getY(), mViewSelector); if (event.getAction() != MotionEvent.ACTION_CANCEL) { if (view != null) { mHighlighter.setHighlightedView(view, 0x404040ff); if (event.getAction() == MotionEvent.ACTION_UP) { mListener.onInspectRequested(view); } } } } return true; }

Target:
public boolean onTouchEvent(MotionEvent event) { if (getParent() instanceof View) { final View parent = (View)getParent(); View view = ViewUtil.hitTest(parent, event.getX(), event.getY(), mViewSelector); if (event.getAction() != MotionEvent.ACTION_CANCEL) { if (view != null) { mHighlighter.setHighlightedView(view, INSPECT_HOVER_COLOR); if (event.getAction() == MotionEvent.ACTION_UP) { mListener.onInspectRequested(view); } } } } return true; }
Source:
public final String getAuthority() { return mCloudInstanceName; }

Target:
public final String getAuthority() { return mAuthority; }
Source:
private MkIssueEvents issueEvents() throws Exception { return (MkIssueEvents) (new MkGithub().repos().create( Json.createObjectBuilder().add("name", "test").build() ).issueEvents()); }

Target:
private MkIssueEvents issueEvents() throws Exception { return MkIssueEvents.class.cast( new MkGithub().repos().create( Json.createObjectBuilder() .add(MkIssueEventsTest.NAME, "test") .build() ).issueEvents() ); }
Source:
private List<AccountInfo> suggestAccountFullSearch( VisibilityControl visibilityControl) throws OrmException { String lCsubstr = query.toLowerCase(); LinkedHashMap<Account.Id, AccountInfo> accountMap = Maps.newLinkedHashMap(); List<Account> accounts = dbProvider.get().accounts().all().toList(); for (Account acc : accounts) { if (acc.getFullName() != null && acc.getFullName().toLowerCase().contains(lCsubstr)) { addSuggestion(accountMap, acc, new AccountInfo(acc.getId()), visibilityControl); } if (accountMap.size() >= limit) { break; } } if (accountMap.size() < limit) { for (Account acc : accounts) { if (acc.getPreferredEmail().toLowerCase().contains(lCsubstr)) { addSuggestion(accountMap, acc, new AccountInfo(acc.getId()), visibilityControl); } if (accountMap.size() >= limit) { break; } } } return Lists.newArrayList(accountMap.values()); }

Target:
private List<AccountInfo> suggestAccountFullSearch( VisibilityControl visibilityControl) throws OrmException { String str = query.toLowerCase(); LinkedHashMap<Account.Id, AccountInfo> accountMap = Maps.newLinkedHashMap(); List<Account> emailMatches = Lists.newArrayList(); for (Account a : dbProvider.get().accounts().all()) { if (a.getFullName() != null && a.getFullName().toLowerCase().contains(str)) { addSuggestion(accountMap, a, new AccountInfo(a.getId()), visibilityControl); } if (a.getPreferredEmail() != null && a.getPreferredEmail().toLowerCase().contains(str)) { emailMatches.add(a); } if (accountMap.size() >= limit) { break; } } if (accountMap.size() < limit) { for (Account a : emailMatches) { addSuggestion(accountMap, a, new AccountInfo(a.getId()), visibilityControl); if (accountMap.size() >= limit) { break; } } } return Lists.newArrayList(accountMap.values()); }