auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static String getLocalizedState(Context c, String state, int percentage) { switch (state) { case "idle": return c.getString(R.string.state_idle); case "scanning": return c.getString(R.string.state_scanning); case "cleaning": return c.getString(R.string.state_cleaning); case "syncing": return c.getString(R.string.state_syncing, percentage); case "error": return c.getString(R.string.state_error); case "unknown": return c.getString(R.string.state_unknown); case "": return c.getString(R.string.state_paused); } Log.w(TAG, "Unexpected folder state " + state); return ""; }

Target:
private static String getLocalizedState(Context c, String state, int percentage) { switch (state) { case "idle": return c.getString(R.string.state_idle); case "scanning": return c.getString(R.string.state_scanning); case "syncing": return c.getString(R.string.state_syncing, percentage); case "error": return c.getString(R.string.state_error); case "unknown": return c.getString(R.string.state_unknown); default: return state; } }
Source:
protected void onFinishInflate() { super.onFinishInflate(); View.inflate(getContext(), R.layout.merge_login_view, this); loginButton = Views.findById(this, R.id.sign_in_button); loginButton.setSize(SignInButton.SIZE_WIDE); }

Target:
protected void onFinishInflate() { super.onFinishInflate(); View.inflate(getContext(), R.layout.merge_login_view, this); loginButton = Views.findById(this, R.id.sign_in_button); }
Source:
static int decodeInt(byte[] addr, int index) { return ByteBuffer.wrap(addr, index, 4).getInt(); }

Target:
static int decodeInt(byte[] addr, int index) { return (addr[index] & 0xff) << 24 | (addr[index + 1] & 0xff) << 16 | (addr[index + 2] & 0xff) << 8 | addr[index + 3] & 0xff; }
Source:
private void resurrectCheckpoints() { ExecutorService executorService = Executors.newFixedThreadPool(numOfWorkers, new ThreadFactoryBuilder() .setNameFormat("FastObjectLoaderResurrectCheckpointsThread-%d").build()); CompletableFuture[] cfs = new CompletableFuture[streamsMetaData.size()]; int i = 0; try { for (Map.Entry<UUID, StreamMetaData> entry : streamsMetaData.entrySet()) { cfs[i++] = CompletableFuture.runAsync(() -> { CheckPoint checkPoint = null; try { checkPoint = entry.getValue().getLatestCheckPoint(); if (checkPoint == null) { log.info("resurrectCheckpoints[{}]: Truncated checkpoint for this stream", Utils.toReadableId(entry.getKey())); return; } for (long address : checkPoint.getAddresses()) { updateCorfuObject(getLogData(runtime, loadInCache, address)); } } catch (Throwable t) { if (checkPoint != null) { log.error("resurrectCheckpoints: error on addresses {}", checkPoint.getAddresses()); } log.error("resurrectCheckpoints: ", t); throw t; } }, executorService); } executorService.shutdown(); executorService.awaitTermination(timeoutInMinutesForLoading, TimeUnit.MINUTES); for (CompletableFuture future : cfs) { if (!future.isDone() || future.isCancelled() || future.isCompletedExceptionally()) { throw new FastObjectLoaderException("Failed to load checkpoints"); } } } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new FastObjectLoaderException("Failed to resurrectCheckpoints"); } finally { executorService.shutdownNow(); } }

Target:
private void resurrectCheckpoints() { ExecutorService executorService = Executors.newFixedThreadPool(numOfWorkers, new ThreadFactoryBuilder() .setNameFormat("FastObjectLoaderResurrectCheckpointsThread-%d").build()); CompletableFuture[] cfs = new CompletableFuture[streamsMetaData.size()]; int i = 0; try { for (Map.Entry<UUID, StreamMetaData> entry : streamsMetaData.entrySet()) { cfs[i++] = CompletableFuture.runAsync(() -> { CheckPoint checkPoint = entry.getValue().getLatestCheckPoint(); try { if (checkPoint == null) { log.info("resurrectCheckpoints[{}]: Truncated checkpoint for this stream", Utils.toReadableId(entry.getKey())); return; } for (long address : checkPoint.getAddresses()) { updateCorfuObject(getLogData(runtime, loadInCache, address)); } } catch (Throwable t) { log.error("resurrectCheckpoints[{}]: error on addresses {}", checkPoint.getCheckPointId(), checkPoint.getAddresses(), t); throw t; } }, executorService); } executorService.shutdown(); executorService.awaitTermination(timeoutInMinutesForLoading, TimeUnit.MINUTES); for (CompletableFuture future : cfs) { if (!future.isDone() || future.isCancelled() || future.isCompletedExceptionally()) { throw new FastObjectLoaderException("Failed to load checkpoints"); } } } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new FastObjectLoaderException("Failed to resurrectCheckpoints"); } finally { executorService.shutdownNow(); } }
Source:
public Message decodeLogData(@Nonnull final CloudWatchLogEvent logEvent, @Nonnull final String logGroup, @Nonnull final String logStream) { try { final FlowLogMessage flowLogMessage = FlowLogMessage.fromLogEvent(logEvent); if (flowLogMessage == null) { return null; } final String source = configuration.getString(CloudTrailCodec.Config.CK_OVERRIDE_SOURCE, "aws-flowlogs"); final Message result = new Message( buildSummary(flowLogMessage), source, flowLogMessage.getTimestamp() ); result.addFields(buildFields(flowLogMessage)); result.addField("aws_log_group", logGroup); result.addField("aws_log_stream", logStream); result.addField(AWS.SOURCE_GROUP_IDENTIFIER, true); return result; } catch (Exception e) { throw new RuntimeException("Could not deserialize AWS FlowLog record.", e); } }

Target:
public Message decodeLogData(@Nonnull final CloudWatchLogEvent logEvent, @Nonnull final String logGroup, @Nonnull final String logStream) { try { final FlowLogMessage flowLogMessage = FlowLogMessage.fromLogEvent(logEvent); if (flowLogMessage == null) { return null; } final String source = configuration.getString(CloudTrailCodec.Config.CK_OVERRIDE_SOURCE, "aws-flowlogs"); final Message result = new Message( buildSummary(flowLogMessage), source, flowLogMessage.getTimestamp() ); result.addFields(buildFields(flowLogMessage)); result.addField(AWS.FIELD_LOG_GROUP, logGroup); result.addField(AWS.FIELD_LOG_STREAM, logStream); result.addField(AWS.SOURCE_GROUP_IDENTIFIER, true); return result; } catch (Exception e) { throw new RuntimeException("Could not deserialize AWS FlowLog record.", e); } }
Source:
public FlatRow next() throws IOException { while (true) { try { FlatRow result = currentDelegate.next(); if (result != null) { requestManager.updateLastFoundKey(result.getRowKey()); currentErrorBackoff = null; timeoutRetryCount = null; } return result; } catch (ScanTimeoutException rte) { closeRpcContext(); closeCurrentDelegate(); ReadRowsRequest newRequest = handleScanTimeout(rte); currentDelegate = scannerFactory.createScanner(newRequest); this.rpcContext = rpcMetrics.timeRpc(); } catch (IOExceptionWithStatus ioe) { closeRpcContext(); closeCurrentDelegate(); ReadRowsRequest newRequest = handleIOException(ioe); currentDelegate = scannerFactory.createScanner(newRequest); this.rpcContext = rpcMetrics.timeRpc(); } } }

Target:
public FlatRow next() throws IOException { while (true) { try { FlatRow result = currentDelegate.next(); if (result != null) { requestManager.updateLastFoundKey(result.getRowKey()); currentErrorBackoff = null; timeoutRetryCount = 0; } return result; } catch (ScanTimeoutException rte) { closeRpcContext(); closeCurrentDelegate(); ReadRowsRequest newRequest = handleScanTimeout(rte); currentDelegate = scannerFactory.createScanner(newRequest); this.rpcContext = rpcMetrics.timeRpc(); } catch (IOExceptionWithStatus ioe) { closeRpcContext(); closeCurrentDelegate(); ReadRowsRequest newRequest = handleIOException(ioe); currentDelegate = scannerFactory.createScanner(newRequest); this.rpcContext = rpcMetrics.timeRpc(); } } }
Source:
private static Iterable<Long> getList(Context context) { Optional<String> strLists = new NullSafe<>(PreferenceManager.getDefaultSharedPreferences(context) .getString(PREFERENCE_KEY, null)); Log.v(RecentlyUsedLists.class.getSimpleName(), "getList: " + strLists.value("empty")); if (!strLists.isPresent()) { return new EmptyIterable<>(); } return new Mapped<>(cs -> Long.valueOf(cs.toString()), new Filtered<>( new Split(strLists.value(), ','), Objects::nonNull)); }

Target:
private static List<Long> getList(Context context) { Optional<String> listStrOpt = new NullSafe<>(PreferenceManager.getDefaultSharedPreferences(context).getString(PREFERENCE_KEY, null)); Log.v(RecentlyUsedLists.class.getSimpleName(), "getList: " + listStrOpt.value("empty")); if (!listStrOpt.isPresent()) { return new ArrayList<>(0); } String listStr = listStrOpt.value(); if (listStr.contains("null")) { setList(context, toList(new Fluent<>(new Split(listStr, ',')) .mapped(Object::toString) .filtered(s -> !s.isEmpty()) .filtered(s -> !s.equals("null")) .mapped(Long::valueOf))); return getList(context); } return toList(new Fluent<>(new Split(listStr, ',')) .mapped(Object::toString) .filtered(s -> !s.isEmpty()) .mapped(Long::valueOf)); }
Source:
public String toString() { ToStringHelper toStringHelper = toStringHelper(this) .add("outputSymbolAliases", this.outputSymbolAliases); if (expectedOutputSymbolCount.isPresent()) { toStringHelper.add("expectedOutputSymbolCount", expectedOutputSymbolCount); } if (expectedRows.isPresent()) { toStringHelper.add("expectedRows", expectedRows); } return toStringHelper.toString(); }

Target:
public String toString() { return toStringHelper(this) .omitNullValues() .add("outputSymbolAliases", outputSymbolAliases) .add("expectedOutputSymbolCount", expectedOutputSymbolCount) .add("expectedRows", expectedRows) .toString(); }
Source:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } ClassTree classTree = (ClassTree) tree; if (isNonStatic(classTree)) { List<MethodTree> methodsToAnalyze = Lists.newArrayList(); List<VariableSymbol> staticNonFinalFields = Lists.newArrayList(); extractMembers(classTree, staticNonFinalFields, methodsToAnalyze); checkMethods(staticNonFinalFields, methodsToAnalyze); } }

Target:
public void visitNode(Tree tree) { super.visitNode(tree); if (tree.is(Kind.METHOD)) { withinStaticMethod.push(isMethodStatic((MethodTree) tree)); } else if (hasSemantic() && !isInSyncBlock() && isInInstancecMethod()) { if (tree.is(ASSIGNMENT_EXPRESSIONS)) { checkAssignement(((AssignmentExpressionTree) tree).variable()); } else if (tree.is(UNARY_EXPRESSIONS)) { checkAssignement(((UnaryExpressionTree) tree).expression()); } } }
Source:
private CompletableFuture<Boolean> updatedSharedWithCache(FileWrapper file, Set<String> usersToAdd, SharedWithCache.Access access) { return file.getPath(network).thenCompose(path -> { network.sharedWithCache.addSharedWith(access, file.getPointer().capability, usersToAdd); CompletableFuture<Boolean> res = new CompletableFuture<>(); res.complete(true); return res; }); }

Target:
private CompletableFuture<Boolean> updatedSharedWithCache(FileWrapper file, Set<String> usersToAdd, SharedWithCache.Access access) { sharedWithCache.addSharedWith(access, file.getPointer().capability, usersToAdd); CompletableFuture<Boolean> res = new CompletableFuture<>(); res.complete(true); return res; }
Source:
private GlusterVolumeTaskStatusEntity fetchTaskStatusDetails() { VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeRebalanceStatus, new GlusterVolumeVDSParameters(getUpServerId(clusterId), volume.getName())); GlusterVolumeTaskStatusEntity entity = (GlusterVolumeTaskStatusEntity)returnValue.getReturnValue(); List<Step> stepsList = getDbFacade().getStepDao().getStepsByExternalId(volume.getAsyncTask().getStepId()); if (stepsList != null && !stepsList.isEmpty()) { entity.setStartTime(stepsList.get(0).getStartTime()); } return entity; }

Target:
private GlusterVolumeTaskStatusEntity fetchTaskStatusDetails() { VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeRebalanceStatus, new GlusterVolumeVDSParameters(getUpServerId(clusterId), volume.getName())); GlusterVolumeTaskStatusEntity entity = (GlusterVolumeTaskStatusEntity)returnValue.getReturnValue(); List<Step> stepsList = getDbFacade().getStepDao().getStepsByExternalId(asyncTask.getStepId()); if (stepsList != null && !stepsList.isEmpty()) { entity.setStartTime(stepsList.get(0).getStartTime()); } return entity; }
Source:
public <T> void query() throws Exception { String query = "SELECT * FROM r"; Consumer<CosmosAsyncContainer> func = (container) -> { InternalObjectNode docDefinition = getDocumentDefinition(); container.createItem(docDefinition).block(); CosmosQueryRequestOptions requestOptions = new CosmosQueryRequestOptions(); CosmosPagedFlux<InternalObjectNode> queryFlux = container.queryItems(query, requestOptions, InternalObjectNode.class); FeedResponseListValidator<InternalObjectNode> queryValidator = new FeedResponseListValidator.Builder<InternalObjectNode>() .totalSize(1) .numberOfPages(1) .build(); validateQuerySuccess(queryFlux.byPage(10), queryValidator); }; createDeleteContainerWithSameName(func); }

Target:
public <T> void query() throws Exception { String query = "SELECT * FROM r"; Consumer<CosmosAsyncContainer> func = (container) -> { TestObject docDefinition = getDocumentDefinition(); container.createItem(docDefinition).block(); CosmosQueryRequestOptions requestOptions = new CosmosQueryRequestOptions(); CosmosPagedFlux<TestObject> queryFlux = container.queryItems(query, requestOptions, TestObject.class); FeedResponseListValidator<TestObject> queryValidator = new FeedResponseListValidator.Builder<TestObject>() .totalSize(1) .numberOfPages(1) .build(); validateQuerySuccess(queryFlux.byPage(10), queryValidator); }; createDeleteContainerWithSameName(func); }
Source:
public void backfillExpirationTest() throws Exception { byte[] certs = Resources.toByteArray(Resources.getResource("fixtures/expiring-certificates.crt")); byte[] pubring = Resources.toByteArray(Resources.getResource("fixtures/expiring-pubring.gpg")); byte[] p12 = Resources.toByteArray(Resources.getResource("fixtures/expiring-keystore.p12")); create(CreateSecretRequestV2.builder() .name("certificate-chain.crt") .content(encoder.encodeToString(certs)) .build()); create(CreateSecretRequestV2.builder() .name("public-keyring.gpg") .content(encoder.encodeToString(pubring)) .build()); create(CreateSecretRequestV2.builder() .name("keystore.p12") .content(encoder.encodeToString(p12)) .build()); Response response = backfillExpiration("certificate-chain.crt", ""); assertThat(response.isSuccessful()).isTrue(); response = backfillExpiration("public-keyring.gpg", ""); assertThat(response.isSuccessful()).isTrue(); response = backfillExpiration("keystore.p12", "password"); assertThat(response.isSuccessful()).isTrue(); SecretDetailResponseV2 details = lookup("certificate-chain.crt"); assertThat(details.expiry()).isEqualTo(1501533950); details = lookup("public-keyring.gpg"); assertThat(details.expiry()).isEqualTo(1536442365); details = lookup("keystore.p12"); assertThat(details.expiry()).isEqualTo(1681596851); }

Target:
public void backfillExpirationTest() throws Exception { byte[] certs = Resources.toByteArray(Resources.getResource("fixtures/expiring-certificates.crt")); byte[] pubring = Resources.toByteArray(Resources.getResource("fixtures/expiring-pubring.gpg")); byte[] p12 = Resources.toByteArray(Resources.getResource("fixtures/expiring-keystore.p12")); byte[] jceks = Resources.toByteArray(Resources.getResource("fixtures/expiring-keystore.jceks")); create(CreateSecretRequestV2.builder() .name("certificate-chain.crt") .content(encoder.encodeToString(certs)) .build()); create(CreateSecretRequestV2.builder() .name("public-keyring.gpg") .content(encoder.encodeToString(pubring)) .build()); create(CreateSecretRequestV2.builder() .name("keystore.p12") .content(encoder.encodeToString(p12)) .build()); create(CreateSecretRequestV2.builder() .name("keystore.jceks") .content(encoder.encodeToString(jceks)) .build()); Response response = backfillExpiration("certificate-chain.crt", ImmutableList.of()); assertThat(response.isSuccessful()).isTrue(); response = backfillExpiration("public-keyring.gpg", ImmutableList.of()); assertThat(response.isSuccessful()).isTrue(); response = backfillExpiration("keystore.p12", ImmutableList.of("password")); assertThat(response.isSuccessful()).isTrue(); response = backfillExpiration("keystore.jceks", ImmutableList.of("password")); assertThat(response.isSuccessful()).isTrue(); SecretDetailResponseV2 details = lookup("certificate-chain.crt"); assertThat(details.expiry()).isEqualTo(1501533950); details = lookup("public-keyring.gpg"); assertThat(details.expiry()).isEqualTo(1536442365); details = lookup("keystore.p12"); assertThat(details.expiry()).isEqualTo(1681596851); details = lookup("keystore.jceks"); assertThat(details.expiry()).isEqualTo(1681596851); }
Source:
public int process(boolean shouldForceWrite) throws IOException { forceWriteQueueSize.dec(); if (isMarker) { return 0; } try { if (shouldForceWrite) { long startTime = MathUtils.nowInNano(); this.logFile.forceWrite(false); journalSyncStats.registerSuccessfulEvent(MathUtils.elapsedNanos(startTime), TimeUnit.NANOSECONDS); } LOG.info("setCurLogMark at {}", lastLogMark.getCurMark()); LOG.info("setCurLogMark at {}, {}", this.logId, this.lastFlushedPosition); lastLogMark.setCurLogMark(this.logId, this.lastFlushedPosition); for (int i = 0; i < forceWriteWaiters.size(); i++) { QueueEntry qe = forceWriteWaiters.get(i); if (qe != null) { cbThreadPool.execute(qe); } } return forceWriteWaiters.size(); } finally { closeFileIfNecessary(); } }

Target:
public int process(boolean shouldForceWrite) throws IOException { forceWriteQueueSize.dec(); if (isMarker) { return 0; } try { if (shouldForceWrite) { long startTime = MathUtils.nowInNano(); this.logFile.forceWrite(false); journalSyncStats.registerSuccessfulEvent(MathUtils.elapsedNanos(startTime), TimeUnit.NANOSECONDS); } LOG.info("setCurLogMark at {}", lastLogMark.getCurMark()); LOG.info("setCurLogMark at {}, {}", this.logId, this.lastFlushedPosition); lastLogMark.setCurLogMark(this.logId, this.lastFlushedPosition); for (int i = 0; i < forceWriteWaiters.size(); i++) { QueueEntry qe = forceWriteWaiters.get(i); if (qe != null) { cbThreadPool.execute(qe); } journalCbQueueSize.inc(); } return forceWriteWaiters.size(); } finally { closeFileIfNecessary(); } }
Source:
public void execute() throws InsufficientCapacityException, ConcurrentOperationException { User callerUser = _accountService.getActiveUser(CallContext.current().getCallingUserId()); Account callerAccount = _accountService.getActiveAccountById(callerUser.getAccountId()); Vpc result = _networkService.migrateVpcNetwork(getId(), getVpcOfferingId(), getTierNetworkOfferings(), callerAccount, callerUser, getResume()); if (result != null) { VpcResponse response = _responseGenerator.createVpcResponse(ResponseObject.ResponseView.Restricted, result); response.setResponseName(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate vpc"); } }

Target:
public void execute() { User callerUser = _accountService.getActiveUser(CallContext.current().getCallingUserId()); Account callerAccount = _accountService.getActiveAccountById(callerUser.getAccountId()); Vpc result = _networkService.migrateVpcNetwork(getId(), getVpcOfferingId(), getTierNetworkOfferings(), callerAccount, callerUser, getResume()); if (result != null) { VpcResponse response = _responseGenerator.createVpcResponse(ResponseObject.ResponseView.Restricted, result); response.setResponseName(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate vpc"); } }
Source:
private void vmInitEnabledChanged() { if(!getVmInitEnabled().getEntity()) { getSysprepEnabled().setEntity(false); getCloudInitEnabled().setEntity(false); } else { getSysprepEnabled().setEntity(getIsWindowsOS()); getCloudInitEnabled().setEntity(!getIsWindowsOS()); autoSetHostname(); if (getSysprepEnabled().getEntity()) { getVmInitModel().updateSysprepDomain(null); } } }

Target:
private void vmInitEnabledChanged() { if(!getVmInitEnabled().getEntity()) { getSysprepEnabled().setEntity(false); getCloudInitEnabled().setEntity(false); } else { getSysprepEnabled().setEntity(getIsWindowsOS()); getCloudInitEnabled().setEntity(!getIsWindowsOS()); autoSetHostname(); if (getSysprepEnabled().getEntity()) { getVmInitModel().updateSysprepDomain(getVmInitModel().getSysprepDomain().getSelectedItem()); } } }
Source:
public boolean mkdirs(Path f, FsPermission permission) throws IOException { LOG.trace("mkdir() path:{} ", f); String key = pathToKey(f); if (StringUtils.isEmpty(key)) { return false; } return mkdir(f); }

Target:
public boolean mkdirs(Path f, FsPermission permission) throws IOException { LOG.trace("mkdir() path:{} ", f); String key = pathToKey(f); if (isEmpty(key)) { return false; } return mkdir(f); }
Source:
protected boolean validateSignature(SignedJWT jwtToken) { boolean valid = false; if (JWSObject.State.SIGNED == jwtToken.getState()) { if (jwtToken.getSignature() != null) { try { RSAPublicKey publicKey = parseRSAPublicKey(publicKeyPath); JWSVerifier verifier = new RSASSAVerifier(publicKey); if (verifier != null && jwtToken.verify(verifier)) { valid = true; } else { } } catch (Exception e) { LOGGER.info("Exception in validateSignature nothing to worry", e); } } } return valid; }

Target:
protected boolean validateSignature(SignedJWT jwtToken) { boolean valid = false; if (JWSObject.State.SIGNED == jwtToken.getState()) { if (jwtToken.getSignature() != null) { try { RSAPublicKey publicKey = parseRSAPublicKey(publicKeyPath); JWSVerifier verifier = new RSASSAVerifier(publicKey); if (verifier != null && jwtToken.verify(verifier)) { valid = true; } } catch (Exception e) { LOGGER.info("Exception in validateSignature", e); } } } return valid; }
Source:
private static <T, U> GenericIndexed<U> fromIterableVersionOne( Iterable<T> objectsIterable, ObjectStrategy<T> strategy, boolean allowReverseLookup, ObjectStrategy<U> resultObjectStrategy ) { Iterator<T> objects = objectsIterable.iterator(); if (!objects.hasNext()) { final ByteBuffer buffer = ByteBuffer.allocate(Ints.BYTES).putInt(0); buffer.flip(); return new GenericIndexed<>(buffer, resultObjectStrategy, allowReverseLookup); } int count = 0; HeapByteBufferWriteOutBytes headerOut = new HeapByteBufferWriteOutBytes(); HeapByteBufferWriteOutBytes valuesOut = new HeapByteBufferWriteOutBytes(); try { T prevVal = null; do { count++; T next = objects.next(); if (allowReverseLookup && prevVal != null && !(strategy.compare(prevVal, next) < 0)) { allowReverseLookup = false; } valuesOut.writeInt(next == null ? NULL_VALUE_SIZE_MARKER : 0); if (next != null) { strategy.writeTo(next, valuesOut); } headerOut.writeInt(Ints.checkedCast(valuesOut.size())); if (prevVal instanceof Closeable) { CloseQuietly.close((Closeable) prevVal); } prevVal = next; } while (objects.hasNext()); if (prevVal instanceof Closeable) { CloseQuietly.close((Closeable) prevVal); } } catch (IOException e) { throw new RuntimeException(e); } ByteBuffer theBuffer = ByteBuffer.allocate(Ints.checkedCast(Ints.BYTES + headerOut.size() + valuesOut.size())); theBuffer.putInt(count); headerOut.writeTo(theBuffer); valuesOut.writeTo(theBuffer); theBuffer.flip(); return new GenericIndexed<>(theBuffer.asReadOnlyBuffer(), resultObjectStrategy, allowReverseLookup); }

Target:
private static <T, U> GenericIndexed<U> fromIterableVersionOne( Iterable<T> objectsIterable, ObjectStrategy<T> strategy, boolean allowReverseLookup, ObjectStrategy<U> resultObjectStrategy ) { Iterator<T> objects = objectsIterable.iterator(); if (!objects.hasNext()) { final ByteBuffer buffer = ByteBuffer.allocate(Integer.BYTES).putInt(0); buffer.flip(); return new GenericIndexed<>(buffer, resultObjectStrategy, allowReverseLookup); } int count = 0; HeapByteBufferWriteOutBytes headerOut = new HeapByteBufferWriteOutBytes(); HeapByteBufferWriteOutBytes valuesOut = new HeapByteBufferWriteOutBytes(); try { T prevVal = null; do { count++; T next = objects.next(); if (allowReverseLookup && prevVal != null && !(strategy.compare(prevVal, next) < 0)) { allowReverseLookup = false; } valuesOut.writeInt(next == null ? NULL_VALUE_SIZE_MARKER : 0); if (next != null) { strategy.writeTo(next, valuesOut); } headerOut.writeInt(Ints.checkedCast(valuesOut.size())); if (prevVal instanceof Closeable) { CloseQuietly.close((Closeable) prevVal); } prevVal = next; } while (objects.hasNext()); if (prevVal instanceof Closeable) { CloseQuietly.close((Closeable) prevVal); } } catch (IOException e) { throw new RuntimeException(e); } ByteBuffer theBuffer = ByteBuffer.allocate(Ints.checkedCast(Integer.BYTES + headerOut.size() + valuesOut.size())); theBuffer.putInt(count); headerOut.writeTo(theBuffer); valuesOut.writeTo(theBuffer); theBuffer.flip(); return new GenericIndexed<>(theBuffer.asReadOnlyBuffer(), resultObjectStrategy, allowReverseLookup); }
Source:
public void dumpTopRequestPath(PrintWriter pwriter, String requestTypeName, int queryMaxDepth) { if (queryMaxDepth < 1) return; PathStatsQueue pathStatsQueue = immutableRequestsMap.get(requestTypeName); if (pathStatsQueue == null) { pwriter.println("Can not find path stats for type: " + requestTypeName); return; } else { pwriter.println("The top requests of type: " + requestTypeName); } Map<String, Integer> combinedMap; final int maxDepth = Math.min(queryMaxDepth, REQUEST_PREPROCESS_PATH_DEPTH); combinedMap = pathStatsQueue.collectStats(maxDepth); logTopPaths(combinedMap, entry -> pwriter.println(entry.getKey() + " : " + entry.getValue())); }

Target:
public void dumpTopRequestPath(PrintWriter pwriter, String requestTypeName, int queryMaxDepth) { if (queryMaxDepth < 1) { return; } PathStatsQueue pathStatsQueue = immutableRequestsMap.get(requestTypeName); if (pathStatsQueue == null) { pwriter.println("Can not find path stats for type: " + requestTypeName); return; } else { pwriter.println("The top requests of type: " + requestTypeName); } Map<String, Integer> combinedMap; final int maxDepth = Math.min(queryMaxDepth, REQUEST_PREPROCESS_PATH_DEPTH); combinedMap = pathStatsQueue.collectStats(maxDepth); logTopPaths(combinedMap, entry -> pwriter.println(entry.getKey() + " : " + entry.getValue())); }
Source:
public void testCalculationOfTaskExecutorUtilization() throws Exception { try (final SlotPoolImpl slotPool = createAndSetUpSlotPool()) { slotPool.registerTaskManager(taskManagerLocation.getResourceID()); final TaskManagerLocation firstTaskManagerLocation = new LocalTaskManagerLocation(); final TaskManagerLocation secondTaskManagerLocation = new LocalTaskManagerLocation(); final List<AllocationID> firstTaskManagersSlots = offerSlots(firstTaskManagerLocation, slotPool, 4); final List<AllocationID> secondTaskManagersSlots = offerSlots(secondTaskManagerLocation, slotPool, 4); slotPool.allocateAvailableSlot(new SlotRequestId(), firstTaskManagersSlots.get(0)); slotPool.allocateAvailableSlot(new SlotRequestId(), firstTaskManagersSlots.get(1)); slotPool.allocateAvailableSlot(new SlotRequestId(), secondTaskManagersSlots.get(3)); final Collection<SlotInfoWithUtilization> availableSlotsInformation = slotPool.getAvailableSlotsInformation(); final Map<TaskManagerLocation, Double> utilizationPerTaskExecutor = ImmutableMap.of( firstTaskManagerLocation, 2.0 / 4, secondTaskManagerLocation, 1.0 / 4); for (SlotInfoWithUtilization slotInfoWithUtilization : availableSlotsInformation) { final double expectedTaskExecutorUtilization = utilizationPerTaskExecutor.get(slotInfoWithUtilization.getTaskManagerLocation()); assertThat(slotInfoWithUtilization.getTaskExecutorUtilization(), is(closeTo(expectedTaskExecutorUtilization, 0.1))); } } }

Target:
public void testCalculationOfTaskExecutorUtilization() throws Exception { try (final SlotPoolImpl slotPool = createAndSetUpSlotPool(resourceManagerGateway)) { final TaskManagerLocation firstTaskManagerLocation = new LocalTaskManagerLocation(); final TaskManagerLocation secondTaskManagerLocation = new LocalTaskManagerLocation(); final List<AllocationID> firstTaskManagersSlots = registerAndOfferSlots(firstTaskManagerLocation, slotPool, 4); final List<AllocationID> secondTaskManagersSlots = registerAndOfferSlots(secondTaskManagerLocation, slotPool, 4); slotPool.allocateAvailableSlot(new SlotRequestId(), firstTaskManagersSlots.get(0)); slotPool.allocateAvailableSlot(new SlotRequestId(), firstTaskManagersSlots.get(1)); slotPool.allocateAvailableSlot(new SlotRequestId(), secondTaskManagersSlots.get(3)); final Collection<SlotInfoWithUtilization> availableSlotsInformation = slotPool.getAvailableSlotsInformation(); final Map<TaskManagerLocation, Double> utilizationPerTaskExecutor = ImmutableMap.of( firstTaskManagerLocation, 2.0 / 4, secondTaskManagerLocation, 1.0 / 4); for (SlotInfoWithUtilization slotInfoWithUtilization : availableSlotsInformation) { final double expectedTaskExecutorUtilization = utilizationPerTaskExecutor.get(slotInfoWithUtilization.getTaskManagerLocation()); assertThat(slotInfoWithUtilization.getTaskExecutorUtilization(), is(closeTo(expectedTaskExecutorUtilization, 0.1))); } } }
Source:
public void testOperatorsImplemented() { for (Type type : typeRegistry.getTypes()) { if (type.isComparable()) { Stream.of(IS_DISTINCT_FROM, EQUAL, NOT_EQUAL) .forEach(operatorType -> functionRegistry.resolveOperator(operatorType, ImmutableList.of(type, type))); functionRegistry.resolveOperator(HASH_CODE, ImmutableList.of(type)); } if (type.isOrderable()) { Stream.of(GREATER_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN, LESS_THAN_OR_EQUAL) .forEach(operatorType -> functionRegistry.resolveOperator(operatorType, ImmutableList.of(type, type))); } } }

Target:
public void testOperatorsImplemented() { for (Type type : typeRegistry.getTypes()) { if (type.isComparable()) { functionRegistry.resolveOperator(EQUAL, ImmutableList.of(type, type)); functionRegistry.resolveOperator(NOT_EQUAL, ImmutableList.of(type, type)); functionRegistry.resolveOperator(IS_DISTINCT_FROM, ImmutableList.of(type, type)); functionRegistry.resolveOperator(HASH_CODE, ImmutableList.of(type)); } if (type.isOrderable()) { functionRegistry.resolveOperator(LESS_THAN, ImmutableList.of(type, type)); functionRegistry.resolveOperator(LESS_THAN_OR_EQUAL, ImmutableList.of(type, type)); functionRegistry.resolveOperator(GREATER_THAN_OR_EQUAL, ImmutableList.of(type, type)); functionRegistry.resolveOperator(GREATER_THAN, ImmutableList.of(type, type)); } } }
Source:
private Session getSession(URI sessionModelURI, boolean restore) { Session sessionFromURI = null; try { sessionFromURI = SessionManager.INSTANCE.getExistingSession(sessionModelURI); sessionFromURI = trySessionOpening(sessionModelURI, restore); } catch (SiriusResourceVersionMismatchException e) { UICallBack uiCallback = SiriusEditPlugin.getPlugin().getUiCallback(); if (uiCallback != null && uiCallback.askSessionReopeningWithResourceVersionMismatch(e)) { try { MigrationUtil.ignoreVersionMismatch = true; sessionFromURI = trySessionOpening(sessionModelURI, restore); } catch (OperationCanceledException ex) { sessionFromURI = null; status = new Status(IStatus.CANCEL, SiriusEditPlugin.ID, ex.getLocalizedMessage(), ex); } catch (RuntimeException ex) { sessionFromURI = null; status = new Status(IStatus.ERROR, SiriusEditPlugin.ID, ex.getLocalizedMessage(), ex); } finally { MigrationUtil.ignoreVersionMismatch = false; } } } catch (OperationCanceledException e) { sessionFromURI = null; status = new Status(IStatus.CANCEL, SiriusEditPlugin.ID, e.getLocalizedMessage(), e); } catch (RuntimeException e) { sessionFromURI = null; status = new Status(IStatus.ERROR, SiriusEditPlugin.ID, e.getLocalizedMessage(), e); } return sessionFromURI; }

Target:
private Session getSession(URI sessionModelURI, boolean restore) { Session sessionFromURI; try { sessionFromURI = SessionManager.INSTANCE.getExistingSession(sessionModelURI); if (sessionFromURI == null && restore) { status = Status.OK_STATUS; sessionFromURI = attemptSessionGetting(sessionModelURI); if (sessionFromURI != null && !sessionFromURI.isOpen()) { sessionFromURI.open(new NullProgressMonitor()); } } if (sessionFromURI != null && sessionFromURI.isOpen()) { IEditingSession uiSession = SessionUIManager.INSTANCE.getUISession(sessionFromURI); if (uiSession == null && restore) { uiSession = SessionUIManager.INSTANCE.getOrCreateUISession(sessionFromURI); } if (uiSession != null && !uiSession.isOpen()) { uiSession.open(); } } } catch (OperationCanceledException e) { sessionFromURI = null; status = new Status(IStatus.CANCEL, SiriusEditPlugin.ID, e.getLocalizedMessage(), e); } catch (RuntimeException e) { sessionFromURI = null; status = new Status(IStatus.ERROR, SiriusEditPlugin.ID, e.getLocalizedMessage(), e); } return sessionFromURI; }
Source:
public void init(Cache<?, ?> cache, GlobalConfiguration globalConfiguration, Configuration configuration, GlobalSecurityManager globalSecurityManager) { this.globalConfiguration = globalConfiguration.security(); this.configuration = configuration.security().authorization(); this.authzHelper = new AuthorizationHelper(this.globalConfiguration, AuditContext.CACHE, cache.getName(), globalSecurityManager.getGlobalACLCache()); }

Target:
public void init(Cache<?, ?> cache, GlobalConfiguration globalConfiguration, Configuration configuration, GlobalSecurityManager globalSecurityManager) { this.configuration = configuration.security().authorization(); this.authzHelper = new AuthorizationHelper(globalConfiguration.security(), AuditContext.CACHE, cache.getName(), (ConcurrentMap<CachePrincipalPair, SubjectACL>) globalSecurityManager.globalACLCache()); }
Source:
public static Optional<JsonNode> convertFromStringToJSONNode(String json) { if (json == null || json.isEmpty()) { return Optional.empty(); } try { ObjectMapper objectMapper = new ObjectMapper(); JsonNode jsonNode = objectMapper.readTree(json); return Optional.of(jsonNode); } catch (IOException e) { return Optional.empty(); } }

Target:
public static Optional<JsonNode> convertFromStringToJSONNode(String json) { if (json == null || json.isEmpty()) { return Optional.empty(); } try { ObjectMapper objectMapper = new ObjectMapper(); JsonNode jsonNode = objectMapper.readTree(json); return Optional.of(jsonNode); } catch (JsonParseException e) { return Optional.empty(); } catch (IOException e) { throw new IllegalArgumentException("Generic error during json parsing: " + json, e); } }
Source:
public static Sensor activeBufferedRecordsSensor(final String threadId, final String taskId, final StreamsMetricsImpl streamsMetrics) { final String name = ACTIVE_TASK_PREFIX + BUFFERED + StreamsMetricsImpl.RECORDS_SUFFIX; final Sensor sensor = streamsMetrics.taskLevelSensor(threadId, taskId, name, Sensor.RecordingLevel.DEBUG); addValueMetricToSensor( sensor, TASK_LEVEL_GROUP, streamsMetrics.taskLevelTagMap(threadId, taskId), name, NUM_BUFFERED_RECORDS_DESCRIPTION ); return sensor; }

Target:
public static Sensor activeBufferedRecordsSensor(final String threadId, final String taskId, final StreamsMetricsImpl streamsMetrics) { final String name = ACTIVE_TASK_PREFIX + BUFFER_COUNT; final Sensor sensor = streamsMetrics.taskLevelSensor(threadId, taskId, name, Sensor.RecordingLevel.DEBUG); addValueMetricToSensor( sensor, TASK_LEVEL_GROUP, streamsMetrics.taskLevelTagMap(threadId, taskId), name, NUM_BUFFERED_RECORDS_DESCRIPTION ); return sensor; }
Source:
public String save() { if (this.template != null && this.template.getTitle() != null) { if (!this.template.getTitle().equals(this.title) && this.title != null && !renameAfterProcessTitleChanged()) { return null; } try { if (this.template.getTasks().isEmpty()) { Reader reader = new Reader(this.template.getWorkflow().getFileName()); this.template = reader.convertWorkflowToTemplate(this.template); } } catch (IOException e) { logger.error("Problem with diagram"); } try { serviceManager.getTemplateService().save(this.template); } catch (DataException e) { Helper.setErrorMessage("errorSaving", new Object[] {Helper.getTranslation("template") }, logger, e); } } else { Helper.setErrorMessage("titleEmpty"); } return null; }

Target:
public String save() { if (this.template != null && this.template.getTitle() != null) { if (!this.template.getTitle().equals(this.title) && this.title != null && !renameAfterProcessTitleChanged()) { return null; } try { if (this.template.getTasks().isEmpty()) { Reader reader = new Reader(this.template.getWorkflow().getFileName()); this.template = reader.convertWorkflowToTemplate(this.template); } } catch (IOException e) { Helper.setErrorMessage("errorDiagram", new Object[] {this.template.getWorkflow().getId() }, logger, e); } try { serviceManager.getTemplateService().save(this.template); } catch (DataException e) { Helper.setErrorMessage("errorSaving", new Object[] {Helper.getTranslation("template") }, logger, e); } } else { Helper.setErrorMessage("titleEmpty"); } return null; }
Source:
public static String processTemplateContents(String templateContents, EntityDriver driver, Map<String,? extends Object> extraSubstitutions) { Map<String, Object> config = driver.getEntity().getApplication().getManagementContext().getConfig().asMapWithStringKeys(); Map<String, Object> substitutions = ImmutableMap.<String, Object>builder() .putAll(config) .put("driver", driver) .put("entity", driver.getEntity()) .put("location", driver.getLocation()) .put("config", ((EntityInternal) driver.getEntity()).getConfigMap().asMapWithStringKeys()) .putAll(extraSubstitutions) .build(); return processTemplateContents(templateContents, substitutions); }

Target:
public static String processTemplateContents(String templateContents, EntityDriver driver, Map<String,? extends Object> extraSubstitutions) { Map<String, Object> config = driver.getEntity().getApplication().getManagementContext().getConfig().asMapWithStringKeys(); ImmutableMap.Builder<String, Object> builder = ImmutableMap.<String, Object>builder() .putAll(config) .put("driver", driver) .put("entity", driver.getEntity()) .put("config", ((EntityInternal) driver.getEntity()).getConfigMap().asMapWithStringKeys()); if (driver.getLocation() != null) builder.put("location", driver.getLocation()); builder.putAll(extraSubstitutions); return processTemplateContents(templateContents, builder.build()); }
Source:
public void Distinct_OrderBy2() { QCat cat = QCat.cat; assertEquals(4, query() .distinct() .from(cat) .orderBy(cat.mate.id.asc()) .list(cat.id, cat.mate.id).size()); }

Target:
public void Distinct_OrderBy2() { QCat cat = QCat.cat; List<Tuple> result = query() .distinct() .from(cat) .orderBy(cat.mate.id.asc().nullsFirst()) .list(cat.id, cat.mate.id); assertThat(result, Matchers.<Tuple>contains( new MockTuple(new Object[]{2, 1}), new MockTuple(new Object[]{3, 2}), new MockTuple(new Object[]{4, 3}), new MockTuple(new Object[]{5, 4}) )); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mSceneView = (SceneView) findViewById(sceneView); ArcGISScene agsScene = new ArcGISScene(); agsScene.setBasemap(Basemap.createImagery()); mSceneView.setScene(agsScene); ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource( getResources().getString(R.string.elevation_image_service)); Surface surface = new Surface(); surface.getElevationSources().add(elevationSource); agsScene.setBaseSurface(surface); Camera camera = new Camera(28.4, 83.9, 10010.0, 10.0, 80.0, 300.0); mSceneView.setViewpointCamera(camera); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mSceneView = (SceneView) findViewById(R.id.sceneView); ArcGISScene agsScene = new ArcGISScene(); agsScene.setBasemap(Basemap.createImagery()); mSceneView.setScene(agsScene); ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource( getResources().getString(R.string.elevation_image_service)); agsScene.getBaseSurface().getElevationSources().add(elevationSource); Camera camera = new Camera(28.4, 83.9, 10010.0, 10.0, 80.0, 300.0); mSceneView.setViewpointCamera(camera); }
Source:
public int getDownloadableVideosCount(IStorage storage) { int downloadableCount = 0; List<HasDownloadEntry> videos = getVideos(); int size = videos.size(); for (int i = 0; i < size; i++) { if (!videos.get(i).getDownloadEntry(storage).isVideoForWebOnly()) { downloadableCount++; } } return downloadableCount; }

Target:
public int getDownloadableVideosCount(IStorage storage) { int downloadableCount = 0; List<HasDownloadEntry> videos = getVideos(); for (int i = 0, size = videos.size(); i < size; i++) { if (!videos.get(i).getDownloadEntry(storage).isVideoForWebOnly()) { downloadableCount++; } } return downloadableCount; }
Source:
private boolean alreadyContainsBatch(CompletedDownloadBatch completedDownloadBatch) { return downloadBatchMap.get(completedDownloadBatch.downloadBatchId()) != null; }

Target:
private boolean alreadyContainsBatch(CompletedDownloadBatch completedDownloadBatch) { return downloadBatchMap.containsKey(completedDownloadBatch.downloadBatchId()); }
Source:
public void setUserVisibleHint(boolean visible) { super.setUserVisibleHint(visible); if (!isAdded()) { return; } if (visible) { funnel.enter(); feedAdapter.notifyDataSetChanged(); } else { funnel.exit(); } }

Target:
public void setUserVisibleHint(boolean visible) { super.setUserVisibleHint(visible); if (!isAdded()) { return; } if (visible) { funnel.enter(); } else { funnel.exit(); } }
Source:
void sendMessage(final String message) { Preconditions.checkState(!closed); if (!client.isOpen()) { try { Awaitility.await() .atMost(connectTimeoutMillis, TimeUnit.MILLISECONDS) .until(() -> client.isOpen()); } catch (final ConditionTimeoutException ignored) { throw new CouldNotConnect(serverUri); } } client.send(message); }

Target:
void sendMessage(final String message) { Preconditions.checkState(!closed); if (!client.isOpen()) { try { Awaitility.await() .atMost(connectTimeoutMillis, TimeUnit.MILLISECONDS) .until(client::isOpen); } catch (final ConditionTimeoutException ignored) { throw new CouldNotConnect(serverUri); } } client.send(message); }
Source:
public static Expression rewrite(Expression expression, Session session, Metadata metadata, SqlParser sqlParser, SymbolAllocator symbolAllocator) { requireNonNull(metadata, "metadata is null"); requireNonNull(sqlParser, "sqlParser is null"); if (expression instanceof SymbolReference) { return expression; } return new AnalyzedExpressionRewriter(session, metadata, sqlParser, symbolAllocator.getTypes()).rewriteWith(Visitor::new, expression); }

Target:
public static Expression rewrite(Expression expression, Session session, Metadata metadata, SqlParser sqlParser, SymbolAllocator symbolAllocator) { requireNonNull(metadata, "metadata is null"); requireNonNull(sqlParser, "sqlParser is null"); return new AnalyzedExpressionRewriter(session, metadata, sqlParser, symbolAllocator.getTypes()).rewriteWith(Visitor::new, expression); }
Source:
public void shouldFailWhenCreateDuplicateEntries() { try { Session session = directoryService.open("continentDirectory"); Map<String, Object> continent = Map.of("id", "middle-earth", "label", "Middle Earth"); List<Map<String, Object>> entries = Arrays.asList(continent, continent); entries.forEach(session::createEntry); fail(); } catch (DirectoryException de) { assertEquals("Entry with id middle-earth already exists in directory 'continentDirectory'", de.getMessage()); } }

Target:
public void shouldFailWhenCreateDuplicateEntries() { try { Session session = directoryService.open("continentDirectory"); Map<String, Object> continent = Map.of("id", "middle-earth", "label", "Middle Earth"); List<Map<String, Object>> entries = List.of(continent, continent); entries.forEach(session::createEntry); fail("Should raise a DirectoryException"); } catch (DirectoryException de) { assertEquals("Entry with id middle-earth already exists in directory continentDirectory", de.getMessage()); } }
Source:
public void onLiveInstanceChange(List<LiveInstance> liveInstances, NotificationContext changeContext) { if(changeContext.getType() == NotificationContext.Type.INIT){ _listenerInitiated = true; } if(_lastEventTimestamp == null || _lastEventTimestamp <= changeContext.getCreationTime()) { _liveInstances = liveInstances; _lastEventTimestamp = changeContext.getCreationTime(); } }

Target:
public synchronized void onLiveInstanceChange(List<LiveInstance> liveInstances, NotificationContext changeContext) { if (changeContext.getType() == NotificationContext.Type.INIT) { _listenerInitiated = true; } if(_lastEventTimestamp > changeContext.getCreationTime()) { LOGGER.warn("RECEIVED OUT OF ORDER EVENT"); } if (_lastEventTimestamp <= changeContext.getCreationTime()) { _liveInstances = liveInstances; _lastEventTimestamp = changeContext.getCreationTime(); } }
Source:
private Map<String, String> createFileExtensionsMap() { Map<String, String> extensionContentTypeMap = new HashMap(); extensionContentTypeMap.put(".xml", "application/xml"); extensionContentTypeMap.put(".js", "application/javascript"); extensionContentTypeMap.put(".css", "text/css"); extensionContentTypeMap.put(".html", "text/html"); extensionContentTypeMap.put(".sql", "text/plain"); extensionContentTypeMap.put(".xsd", "Schema"); extensionContentTypeMap.put(".xsl", "application/xsl+xml"); extensionContentTypeMap.put(".xslt", "application/xslt+xml"); extensionContentTypeMap.put(".dmc", "application/datamapper"); extensionContentTypeMap.put(".zip", "application/zip"); extensionContentTypeMap.put(".wsdl", "WSDL"); return extensionContentTypeMap; }

Target:
private Map<String, String> createFileExtensionsMap() { Map<String, String> extensionContentTypeMap = new HashMap<>(); extensionContentTypeMap.put(".xml", "application/xml"); extensionContentTypeMap.put(".js", "application/javascript"); extensionContentTypeMap.put(".css", "text/css"); extensionContentTypeMap.put(".html", "text/html"); extensionContentTypeMap.put(".sql", "text/plain"); extensionContentTypeMap.put(".xsd", "Schema"); extensionContentTypeMap.put(".xsl", "application/xsl+xml"); extensionContentTypeMap.put(".xslt", "application/xslt+xml"); extensionContentTypeMap.put(".dmc", "application/datamapper"); extensionContentTypeMap.put(".zip", "application/zip"); extensionContentTypeMap.put(".wsdl", "WSDL"); return extensionContentTypeMap; }
Source:
private List<Ref> getBranches() { List<Ref> ref = new ArrayList<Ref>(); try { ref.addAll(db.getRefDatabase().getRefs(Constants.R_HEADS).values()); ref.addAll(db.getRefDatabase().getRefs(Constants.R_REMOTES).values()); } catch (IOException e) { e.printStackTrace(); } return ref; }

Target:
private List<Ref> getBranches() { List<Ref> ref = new ArrayList<Ref>(); try { ref.addAll(db.getRefDatabase().getRefs(Constants.R_HEADS).values()); ref.addAll(db.getRefDatabase().getRefs(Constants.R_REMOTES).values()); } catch (IOException e) { Activator.logError(e.getMessage(), e); } return ref; }
Source:
private void findAllPresenters(PresenterDefinitions presenterDefinitions) throws UnableToCompleteException { for (JClassType type : getTypeOracle().getTypes()) { if (type.isAnnotationPresent(ProxyStandard.class)) { presenterDefinitions.addStandardPresenter(type.getEnclosingType()); } else if (type.isAnnotationPresent(ProxyCodeSplit.class)) { presenterDefinitions.addCodeSplitPresenter(type.getEnclosingType()); } else if (type.isAnnotationPresent(ProxyCodeSplitBundle.class)) { presenterDefinitions.addCodeSplitBundlePresenter(type.getAnnotation(ProxyCodeSplitBundle.class).value(), type.getEnclosingType()); } if (type.isAnnotationPresent(UseGatekeeper.class)) { final String gkName = type.getAnnotation(UseGatekeeper.class).value().getName(); try { presenterDefinitions.addGatekeeper(getTypeOracle().getType(gkName)); } catch (NotFoundException e) { getTreeLogger().log(TreeLogger.ERROR, "Cannot find Gatekeeper " + gkName, e); throw new UnableToCompleteException(); } } } }

Target:
private void findAllPresenters(PresenterDefinitions presenterDefinitions) throws UnableToCompleteException { for (JClassType type : getTypeOracle().getTypes()) { if (type.isAnnotationPresent(ProxyStandard.class)) { presenterDefinitions.addStandardPresenter(type.getEnclosingType()); } else if (type.isAnnotationPresent(ProxyCodeSplit.class)) { presenterDefinitions.addCodeSplitPresenter(type.getEnclosingType()); } else if (type.isAnnotationPresent(ProxyCodeSplitBundle.class)) { ProxyCodeSplitBundle annotation = type.getAnnotation(ProxyCodeSplitBundle.class); verifyCodeSplitBundleConfiguration(type.getName(), annotation); presenterDefinitions.addCodeSplitBundlePresenter(annotation.value(), type.getEnclosingType()); } if (type.isAnnotationPresent(UseGatekeeper.class)) { presenterDefinitions.addGatekeeper(getType(type.getAnnotation(UseGatekeeper.class).value().getName())); } } }