auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void addPLCookie(HttpServletRequest httpRequest, HttpServletResponse response) { Cookie plCookie = null; if (httpRequest.getCookies() != null) { for (Cookie c : httpRequest.getCookies()) { if (PL.equals(c.getName()) && c.getName() != null) { plCookie = c; break; } } } if (plCookie == null || !PL_SETTING.getValue().equalsIgnoreCase(plCookie.getValue())) { String plValue = PL_SETTING.getValue(); try { plValue = URLEncoder.encode(PL_SETTING.getValue(), "UTF-8"); } catch (IOException e) { log.error("Failed to encode PL value with UTF-8.", e); } plCookie = new Cookie(PL, plValue); plCookie.setPath("/"); response.addCookie(plCookie); } }

Target:
private void addPLCookie(HttpServletRequest httpRequest, HttpServletResponse response) { Cookie plCookie = null; if (httpRequest.getCookies() != null) { for (Cookie c : httpRequest.getCookies()) { if (PL.equals(c.getName()) && c.getName() != null) { plCookie = c; break; } } } if (plCookie == null || !PL_SETTING.getValue().equalsIgnoreCase(plCookie.getValue())) { String plValue = PL_SETTING.getValue(); try { plValue = URLEncoder.encode(PL_SETTING.getValue(), "UTF-8"); } catch (IOException e) { log.error("Failed to encode PL value with UTF-8.", e); return; } plCookie = new Cookie(PL, plValue); plCookie.setPath("/"); response.addCookie(plCookie); } }
Source:
public AxisAlignedBB getRenderBoundingBox() { return box == null ? super.getRenderBoundingBox() : BoundingBoxUtil.makeFrom(getPos(), box); }

Target:
public AxisAlignedBB getRenderBoundingBox() { return BoundingBoxUtil.makeFrom(getPos(), box); }
Source:
public void testClientQueryExecutedEvents() throws Exception { CountDownLatch execLatch = new CountDownLatch(9); IgnitePredicate<Event> lsnr = evt -> { assert evt instanceof QueryExecutionEvent; System.out.println(">>> EVENT: " + evt); QueryExecutionEvent qe = (QueryExecutionEvent)evt; assertNotNull(qe.clause()); execLatch.countDown(); return true; }; ignite().events().localListen(lsnr, EVT_QUERY_EXECUTION); ClientConfiguration cc = new ClientConfiguration().setAddresses(Config.SERVER); try (IgniteClient client = Ignition.startClient(cc)) { client.query(new SqlFieldsQuery("create table TEST_TABLE(key int primary key, val int)")) .getAll(); client.query(new SqlFieldsQuery("insert into TEST_TABLE values (?, ?)").setArgs(1, 1)) .getAll(); client.query(new SqlFieldsQuery("update TEST_TABLE set val = ?2 where key = ?1").setArgs(1, 2)) .getAll(); client.query(new SqlFieldsQuery("select * from TEST_TABLE")) .getAll(); client.query(new SqlFieldsQuery("create index idx_1 on TEST_TABLE(key)")) .getAll(); client.query(new SqlFieldsQuery("drop index idx_1")) .getAll(); client.query(new SqlFieldsQuery("alter table TEST_TABLE add column val2 int")) .getAll(); client.query(new SqlFieldsQuery("alter table TEST_TABLE drop val2")) .getAll(); client.query(new SqlFieldsQuery("drop table TEST_TABLE")) .getAll(); assert execLatch.await(3_000, MILLISECONDS); } finally { ignite().events().stopLocalListen(lsnr, EVT_QUERY_EXECUTION); } }

Target:
public void testClientQueryExecutedEvents() throws Exception { CountDownLatch execLatch = new CountDownLatch(9); IgnitePredicate<SqlQueryExecutionEvent> lsnr = evt -> { assertNotNull(evt.text()); execLatch.countDown(); return true; }; ignite().events().localListen(lsnr, EVT_SQL_QUERY_EXECUTION); ClientConfiguration cc = new ClientConfiguration().setAddresses(Config.SERVER); try (IgniteClient client = Ignition.startClient(cc)) { client.query(new SqlFieldsQuery("create table TEST_TABLE(key int primary key, val int)")) .getAll(); client.query(new SqlFieldsQuery("insert into TEST_TABLE values (?, ?)").setArgs(1, 1)) .getAll(); client.query(new SqlFieldsQuery("update TEST_TABLE set val = ?2 where key = ?1").setArgs(1, 2)) .getAll(); client.query(new SqlFieldsQuery("select * from TEST_TABLE")) .getAll(); client.query(new SqlFieldsQuery("create index idx_1 on TEST_TABLE(key)")) .getAll(); client.query(new SqlFieldsQuery("drop index idx_1")) .getAll(); client.query(new SqlFieldsQuery("alter table TEST_TABLE add column val2 int")) .getAll(); client.query(new SqlFieldsQuery("alter table TEST_TABLE drop val2")) .getAll(); client.query(new SqlFieldsQuery("drop table TEST_TABLE")) .getAll(); assert execLatch.await(3_000, MILLISECONDS); } finally { ignite().events().stopLocalListen(lsnr, EVT_SQL_QUERY_EXECUTION); } }
Source:
private void timeoutAsyncQuery() { DataStoreTransaction tx = elide.getDataStore().beginTransaction(); try { EntityDictionary dictionary = elide.getElideSettings().getDictionary(); RSQLFilterDialect filterParser = new RSQLFilterDialect(dictionary); RequestScope scope = new RequestScope(null, null, tx, null, null, elide.getElideSettings()); FilterExpression filter = filterParser.parseFilterExpression("status=in=(" + QueryStatus.PROCESSING.toString() + "," + QueryStatus.QUEUED.toString() + ")", AsyncQuery.class, false); EntityProjection asyncQueryCollection = EntityProjection.builder() .type(AsyncQuery.class) .filterExpression(filter) .build(); Iterable<Object> loaded = tx.loadObjects(asyncQueryCollection, scope); Iterator<Object> itr = loaded.iterator(); while(itr.hasNext()) { AsyncQuery query = (AsyncQuery) itr.next(); long differenceInMillies = Math.abs((new Date()).getTime() - query.getCreatedOn().getTime()); long difference = TimeUnit.MINUTES.convert(differenceInMillies, TimeUnit.MILLISECONDS); if(difference > maxRunTime * 2) { log.info("Updating Async Query Status to TIMEDOUT"); query.setQueryStatus(QueryStatus.TIMEDOUT); tx.save(query, scope); tx.commit(scope); tx.flush(scope); } } } catch (Exception e) { log.error("Exception: {}", e.getMessage()); } finally { try { tx.close(); } catch (IOException e) { log.error("IOException: {}", e.getMessage()); } } }

Target:
private void timeoutAsyncQuery() { String filterDateFormatted = evaluateFormattedFilterDate(Calendar.MINUTE, maxRunTimeMinutes); String filterExpression = "status=in=(" + QueryStatus.PROCESSING.toString() + "," + QueryStatus.QUEUED.toString() + ");createdOn=le='" + filterDateFormatted + "'"; asyncQueryDao.updateStatusAsyncQueryCollection(filterExpression, QueryStatus.TIMEDOUT); }
Source:
@Test public void unexpectedSignatureToAdapters() throws Exception { try { Moshi moshi = new Moshi.Builder() .add(new UnexpectedSignatureToJsonAdapter()).build(); } catch (IllegalArgumentException expected){ assertThat(expected.getMessage()).contains( "<any access modifier> void toJson(JsonWriter writer, T value) throws <any>;", "pointToJson" ); } }

Target:
@Test public void unexpectedSignatureToAdapters() throws Exception { Moshi.Builder builder = new Moshi.Builder(); try { builder.add(new UnexpectedSignatureToJsonAdapter()).build(); fail(); } catch (IllegalArgumentException expected) { assertThat(expected).hasMessage("Unexpected signature for void " + "com.squareup.moshi.AdapterMethodsTest$UnexpectedSignatureToJsonAdapter.pointToJson" + "(com.squareup.moshi.AdapterMethodsTest$Point).\n" + "@ToJson method signatures may have one of the following structures:\n" + " <any access modifier> void toJson(JsonWriter writer, T value) throws <any>;\n" + " <any access modifier> R toJson(T value) throws <any>;\n"); } }
Source:
public static Path getPath(URI uri, Map<String, String> env) throws IOException, URISyntaxException { String uriString = uri.toString(); int indexOfExclamationMark = uriString.indexOf('!'); if (indexOfExclamationMark == -1) { return Paths.get(uri); } String zipFile = uriString.substring(0, indexOfExclamationMark); FileSystem fileSystem = fileSystemURIs.get(uri); if (fileSystem == null) { if (env == null) { env = new HashMap<>(); env.put("create", "true"); env.put("encoding", "UTF-8"); } fileSystem = FileSystems.newFileSystem(new URI(zipFile), env); fileSystemURIs.put(uri, fileSystem); } String fileName = uriString.substring(uriString.indexOf('!') + 1); return fileSystem.getPath(fileName); }

Target:
public static Path getPath(URI uri, Map<String, String> env) throws IOException, URISyntaxException { String uriString = uri.toString(); int indexOfExclamationMark = uriString.indexOf('!'); if (indexOfExclamationMark == -1) { return Paths.get(uri); } String zipFile = uriString.substring(0, indexOfExclamationMark); FileSystem fileSystem = null; synchronized (FILE_SYSTEM_META_DATA_KEY) { Map<URI, FileSystem> metaData = Application.get() .getMetaData(FILE_SYSTEM_META_DATA_KEY); if (metaData == null) { metaData = new HashMap<URI, FileSystem>(); Application.get().setMetaData(FILE_SYSTEM_META_DATA_KEY, metaData); } if (fileSystem == null) { if (env == null) { env = new HashMap<>(); env.put("create", "true"); env.put("encoding", "UTF-8"); } fileSystem = FileSystems.newFileSystem(new URI(zipFile), env); metaData.put(uri, fileSystem); } } String fileName = uriString.substring(uriString.indexOf('!') + 1); return fileSystem.getPath(fileName); }
Source:
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Timber.i("Upgrading database from version %d to %d", oldVersion, newVersion); switch (oldVersion) { case 1: upgradeToVersion2(db); case 2: case 3: upgradeToVersion4(db, oldVersion); case 4: upgradeToVersion5(db); case 5: upgradeToVersion6(db); case 6: upgradeToVersion7(db); break; default: Timber.i("Unknown version %s", oldVersion); } Timber.i("Upgrading database from version %d to %d completed with success.", oldVersion, newVersion); isDatabaseBeingMigrated = false; }

Target:
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { try { Timber.i("Upgrading database from version %d to %d", oldVersion, newVersion); switch (oldVersion) { case 1: upgradeToVersion2(db); case 2: case 3: upgradeToVersion4(db, oldVersion); case 4: upgradeToVersion5(db); case 5: upgradeToVersion6(db); case 6: upgradeToVersion7(db); break; default: Timber.i("Unknown version %s", oldVersion); } Timber.i("Upgrading database from version %d to %d completed with success.", oldVersion, newVersion); isDatabaseBeingMigrated = false; } catch (SQLException e) { isDatabaseBeingMigrated = false; throw e; } }
Source:
private void addLastReplNameIfEmptyText(Paragraph p) { String replName = lastReplName.get(); if (StringUtils.isEmpty(p.getText()) && StringUtils.isNotEmpty(replName) && factory.isBinding(getId(), replName)) { p.setText(getInterpreterName(replName) + " "); } }

Target:
private void addLastReplNameIfEmptyText(Paragraph p) { String replName = lastReplName.get(); if (isEmpty(p.getText()) && isNotEmpty(replName) && isBinding(replName)) { p.setText(getInterpreterName(replName) + " "); } }
Source:
private Handler buildBaseHandler(Class<?> sqlObjectType, Method method) { return Stream.of(method.getAnnotations()) .map(a -> a.annotationType().getAnnotation(SqlMethodAnnotation.class)) .filter(Objects::nonNull) .map(a -> buildFactory(a.value())) .map(factory -> factory.buildHandler(sqlObjectType, method)) .findFirst() .orElseGet(PassThroughHandler::new); }

Target:
private Handler buildBaseHandler(Class<?> sqlObjectType, Method method) { Set<Class<?>> sqlMethodAnnotations = Stream.of(method.getAnnotations()) .map(Annotation::annotationType) .filter(type -> type.isAnnotationPresent(SqlMethodAnnotation.class)) .collect(toSet()); if (sqlMethodAnnotations.size() > 1) { throw new IllegalStateException( String.format("Mutually exclusive annotations on method %s.%s: %s", sqlObjectType.getName(), method.getName(), sqlMethodAnnotations)); } return sqlMethodAnnotations.stream() .map(type -> type.getAnnotation(SqlMethodAnnotation.class)) .map(a -> buildFactory(a.value())) .map(factory -> factory.buildHandler(sqlObjectType, method)) .findFirst() .orElseGet(PassThroughHandler::new); }
Source:
private void logSecurityAuditRole() { SecurityToken IdpSecToken = getIdpSecurityToken(); if (shouldAuditSubject()) { SecurityLogger.audit( "Subject with admin privileges has logged out: {}", new SecurityAssertionImpl(IdpSecToken).getPrincipal().getName()); } }

Target:
private void logSecurityAuditRole() { SecurityToken idpSecToken = getIdpSecurityToken(); if (idpSecToken != null) { if (shouldAuditSubject(idpSecToken)) { SecurityLogger.audit( "Subject with admin privileges has logged out: {}", new SecurityAssertionImpl(idpSecToken).getPrincipal().getName()); } } }
Source:
private void copyAllMemoryImages(Guid containerID) { for (Snapshot snapshot : snapshotsWithMemory) { List<Guid> guids = Guid.createGuidListFromString(snapshot.getMemoryVolume()); ActionReturnValue vdcRetValue = runInternalActionWithTasksContext( ActionType.CopyImageGroup, buildMoveOrCopyImageGroupParametersForMemoryDumpImage( containerID, guids.get(0), guids.get(2), guids.get(3))); if (!vdcRetValue.getSucceeded()) { throw new EngineException(vdcRetValue.getFault().getError(), "Failed during ExportVmCommand"); } getReturnValue().getVdsmTaskIdList().addAll(vdcRetValue.getVdsmTaskIdList()); vdcRetValue = runInternalActionWithTasksContext( ActionType.CopyImageGroup, buildMoveOrCopyImageGroupParametersForMemoryConfImage( containerID, guids.get(0), guids.get(4), guids.get(5))); if (!vdcRetValue.getSucceeded()) { throw new EngineException(vdcRetValue.getFault().getError(), "Failed during ExportVmCommand"); } getReturnValue().getVdsmTaskIdList().addAll(vdcRetValue.getVdsmTaskIdList()); } }

Target:
private void copyAllMemoryImages(Guid containerID) { for (Snapshot snapshot : snapshotsWithMemory) { List<Guid> guids = Guid.createGuidListFromString(snapshot.getMemoryVolume()); ActionReturnValue vdcRetValue = runInternalActionWithTasksContext( ActionType.CopyImageGroup, buildMoveOrCopyImageGroupParametersForMemoryDumpImage( containerID, guids.get(0), guids.get(2), guids.get(3))); if (!vdcRetValue.getSucceeded()) { throw new EngineException(vdcRetValue.getFault().getError(), "Failed during ExportVmCommand"); } getTaskIdList().addAll(vdcRetValue.getVdsmTaskIdList()); vdcRetValue = runInternalActionWithTasksContext( ActionType.CopyImageGroup, buildMoveOrCopyImageGroupParametersForMemoryConfImage( containerID, guids.get(0), guids.get(4), guids.get(5))); if (!vdcRetValue.getSucceeded()) { throw new EngineException(vdcRetValue.getFault().getError(), "Failed during ExportVmCommand"); } getTaskIdList().addAll(vdcRetValue.getVdsmTaskIdList()); } }
Source:
public void testShallowIsMinimal() throws Exception { FileRepository repo = createBareRepository(); TestRepository<Repository> r = new TestRepository<Repository>(repo); BranchBuilder bb = r.branch("refs/heads/master"); RevBlob contentA = r.blob("A"); RevBlob contentB = r.blob("B"); RevBlob contentC = r.blob("C"); RevBlob contentD = r.blob("D"); RevBlob contentE = r.blob("E"); RevCommit c1 = bb.commit().add("a", contentA).create(); RevCommit c2 = bb.commit().add("b", contentB).create(); RevCommit c3 = bb.commit().add("c", contentC).create(); RevCommit c4 = bb.commit().add("d", contentD).create(); RevCommit c5 = bb.commit().add("e", contentE).create(); r.getRevWalk().parseHeaders(c1); r.getRevWalk().parseHeaders(c2); r.getRevWalk().parseHeaders(c3); r.getRevWalk().parseHeaders(c4); r.getRevWalk().parseHeaders(c5); PackIndex idx = writeShallowPack(repo, 1, Collections.singleton(c2), NONE, NONE); assertContent(idx, Arrays.asList(c1.getId(), c2.getId(), c1.getTree().getId(), c2.getTree().getId(), contentA.getId(), contentB.getId())); Set<ObjectId> haves = new HashSet<>(); haves.add(c1); haves.add(c2); idx = writeShallowPack(repo, 1, Collections.singleton(c5), haves, Collections.singleton(c1)); assertContent(idx, Arrays.asList(c4.getId(), c5.getId(), c4.getTree().getId(), c5.getTree().getId(), contentC.getId(), contentD.getId(), contentE.getId())); }

Target:
public void testShallowIsMinimal() throws Exception { FileRepository repo = createBareRepository(); TestRepository<Repository> r = new TestRepository<Repository>(repo); BranchBuilder bb = r.branch("refs/heads/master"); RevBlob contentA = r.blob("A"); RevBlob contentB = r.blob("B"); RevBlob contentC = r.blob("C"); RevBlob contentD = r.blob("D"); RevBlob contentE = r.blob("E"); RevCommit c1 = bb.commit().add("a", contentA).create(); RevCommit c2 = bb.commit().add("b", contentB).create(); RevCommit c3 = bb.commit().add("c", contentC).create(); RevCommit c4 = bb.commit().add("d", contentD).create(); RevCommit c5 = bb.commit().add("e", contentE).create(); r.getRevWalk().parseHeaders(c1); r.getRevWalk().parseHeaders(c2); r.getRevWalk().parseHeaders(c3); r.getRevWalk().parseHeaders(c4); r.getRevWalk().parseHeaders(c5); PackIndex idx = writeShallowPack(repo, 1, wants(c2), NONE, NONE); assertContent(idx, Arrays.asList(c1.getId(), c2.getId(), c1.getTree().getId(), c2.getTree().getId(), contentA.getId(), contentB.getId())); idx = writeShallowPack(repo, 1, wants(c5), haves(c1, c2), shallows(c1)); assertContent(idx, Arrays.asList(c4.getId(), c5.getId(), c4.getTree().getId(), c5.getTree().getId(), contentC.getId(), contentD.getId(), contentE.getId())); }
Source:
protected void recordLineage(BatchSourceContext context, String outputName, Schema tableSchema, String operationName, String description) { if (tableSchema == null) { LOG.warn("Schema for output %s is null. Field-level lineage will not be recorded.", outputName); return; } if (tableSchema.getFields() == null) { LOG.warn("schema.getFields() for output %s is null. Field-level lineage will not be recorded.", outputName); return; } LineageRecorder lineageRecorder = new LineageRecorder(context, outputName); lineageRecorder.createExternalDataset(tableSchema); List<String> fieldNames = tableSchema.getFields().stream().map(Schema.Field::getName).collect(Collectors.toList()); if (!fieldNames.isEmpty()) { lineageRecorder.recordRead(operationName, description, fieldNames); } }

Target:
protected void recordLineage(BatchSourceContext context, String outputName, Schema tableSchema, String operationName, String description) { if (tableSchema == null) { LOG.warn("Schema for output %s is null. Field-level lineage will not be recorded.", outputName); return; } if (tableSchema.getFields() == null) { LOG.warn("Schema fields for output %s is empty. Field-level lineage will not be recorded", outputName); return; } LineageRecorder lineageRecorder = new LineageRecorder(context, outputName); lineageRecorder.createExternalDataset(tableSchema); List<String> fieldNames = tableSchema.getFields().stream().map(Schema.Field::getName).collect(Collectors.toList()); if (!fieldNames.isEmpty()) { lineageRecorder.recordRead(operationName, description, fieldNames); } }
Source:
public void shouldCreateNewAutoGenerationOptionWithoutLocation() throws Exception { long originalCount = getAllCount(); boolean automaticGenerationEnabled = true; boolean manualEntryEnabled = true; SimpleObject autoGenerationOption = new SimpleObject(); autoGenerationOption.add("identifierType", IDENTIFIER_TYPE_UUID); autoGenerationOption.add("source", SOURCE); autoGenerationOption.add("automaticGenerationEnabled", automaticGenerationEnabled); autoGenerationOption.add("manualEntryEnabled", manualEntryEnabled); String json = new ObjectMapper().writeValueAsString(autoGenerationOption); MockHttpServletRequest req = request(RequestMethod.POST, getURI()); req.setContent(json.getBytes()); SimpleObject newAutoGenerationOption = deserialize(handle(req)); assertNotNull(PropertyUtils.getProperty(newAutoGenerationOption, "uuid")); assertEquals(originalCount + 1, getAllCount()); assertEquals(SOURCE, PropertyUtils.getProperty(newAutoGenerationOption, "source")); assertEquals(UNKNOWN_LOCATION, PropertyUtils.getProperty(newAutoGenerationOption, "location")); assertEquals(IDENTIFIER_TYPE_UUID, PropertyUtils.getProperty(newAutoGenerationOption, "identifierType")); }

Target:
public void shouldCreateNewAutoGenerationOptionWithoutLocation() throws Exception { long originalCount = getAllCount(); SimpleObject autoGenerationOption = new SimpleObject(); autoGenerationOption.add("identifierType", IDENTIFIER_TYPE_UUID); autoGenerationOption.add("source", SOURCE); autoGenerationOption.add("automaticGenerationEnabled", true); autoGenerationOption.add("manualEntryEnabled", true); String json = new ObjectMapper().writeValueAsString(autoGenerationOption); MockHttpServletRequest req = request(RequestMethod.POST, getURI()); req.setContent(json.getBytes()); SimpleObject newAutoGenerationOption = deserialize(handle(req)); assertNotNull(PropertyUtils.getProperty(newAutoGenerationOption, "uuid")); assertEquals(originalCount + 1, getAllCount()); assertEquals(SOURCE, PropertyUtils.getProperty(newAutoGenerationOption, "source")); assertEquals(UNKNOWN_LOCATION, PropertyUtils.getProperty(newAutoGenerationOption, "location")); assertEquals(IDENTIFIER_TYPE_UUID, PropertyUtils.getProperty(newAutoGenerationOption, "identifierType")); }
Source:
public void tearDown() throws Exception { System.clearProperty("CONTAINER"); System.clearProperty("CONNECTIONS"); System.clearProperty("ACCOUNT_NAME"); System.clearProperty("ALLOW_ENV_PARAMETRIZATION"); }

Target:
public void tearDown() throws Exception { System.clearProperty("CONTAINER"); System.clearProperty("CONNECTIONS"); System.clearProperty("ACCOUNT_NAME"); System.clearProperty("ACCOUNT_KEY"); System.clearProperty("ALLOW_ENV_PARAMETRIZATION"); }
Source:
public int selectAndUpdateExecutionWithLocking(final int executorId, final boolean isActive) throws ExecutorManagerException { final String UPDATE_EXECUTION = "UPDATE execution_flows SET executor_id = ?, update_time = ? " + "where exec_id = ?"; final String selectExecutionForUpdate = isActive ? SelectFromExecutionFlows.SELECT_EXECUTION_FOR_UPDATE_ACTIVE : SelectFromExecutionFlows.SELECT_EXECUTION_FOR_UPDATE_INACTIVE; final SQLTransaction<Integer> selectAndUpdateExecution = transOperator -> { int execId = -1; final boolean hasLocked = transOperator.query(PollingLockResultHandler.GET_POLLING_LOCK, new PollingLockResultHandler()); logger.info("ExecutionFlow polling lock value: " + hasLocked + " for executorId: " + executorId); if (hasLocked) { try { final List<Integer> execIds = transOperator.query(selectExecutionForUpdate, new SelectFromExecutionFlows(), executorId); if (CollectionUtils.isNotEmpty(execIds)) { execId = execIds.get(0); transOperator.update(UPDATE_EXECUTION, executorId, System.currentTimeMillis(), execId); } } finally { transOperator.query(PollingLockResultHandler.RELEASE_POLLING_LOCK, new PollingLockResultHandler()); logger.info("Released polling lock for executorId: " + executorId); } } return execId; }; try { return this.dbOperator.transaction(selectAndUpdateExecution); } catch (final SQLException e) { throw new ExecutorManagerException("Error selecting and updating execution with executor " + executorId, e); } }

Target:
public int selectAndUpdateExecutionWithLocking(final int executorId, final boolean isActive) throws ExecutorManagerException { final String UPDATE_EXECUTION = "UPDATE execution_flows SET executor_id = ?, update_time = ? " + "where exec_id = ?"; final String selectExecutionForUpdate = isActive ? SelectFromExecutionFlows.SELECT_EXECUTION_FOR_UPDATE_ACTIVE : SelectFromExecutionFlows.SELECT_EXECUTION_FOR_UPDATE_INACTIVE; final SQLTransaction<Integer> selectAndUpdateExecution = transOperator -> { final String POLLING_LOCK_NAME = "execution_flows_polling"; final int GET_LOCK_TIMEOUT_IN_SECONDS = 5; int execId = -1; final boolean hasLocked = this.mysqlNamedLock.getLock(transOperator, POLLING_LOCK_NAME, GET_LOCK_TIMEOUT_IN_SECONDS); logger.info("ExecutionFlow polling lock value: " + hasLocked + " for executorId: " + executorId); if (hasLocked) { try { final List<Integer> execIds = transOperator.query(selectExecutionForUpdate, new SelectFromExecutionFlows(), executorId); if (CollectionUtils.isNotEmpty(execIds)) { execId = execIds.get(0); transOperator.update(UPDATE_EXECUTION, executorId, System.currentTimeMillis(), execId); } } finally { this.mysqlNamedLock.releaseLock(transOperator, POLLING_LOCK_NAME); logger.info("Released polling lock for executorId: " + executorId); } } else { logger.info("Could not acquire polling lock for executorId: " + executorId); } return execId; }; try { return this.dbOperator.transaction(selectAndUpdateExecution); } catch (final SQLException e) { throw new ExecutorManagerException("Error selecting and updating execution with executor " + executorId, e); } }
Source:
public void before() throws InterruptedException { builder = new StreamsBuilder(); CLUSTER.createTopics(STREAM_INPUT, STREAM_OUTPUT_1, STREAM_OUTPUT_2, STREAM_OUTPUT_3, STREAM_OUTPUT_4); streamsConfiguration = new Properties(); streamsConfiguration.put(StreamsConfig.APPLICATION_ID_CONFIG, APPLICATION_ID_VALUE); streamsConfiguration.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, CLUSTER.bootstrapServers()); streamsConfiguration.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.Integer().getClass()); streamsConfiguration.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.String().getClass()); streamsConfiguration.put(StreamsConfig.METRICS_RECORDING_LEVEL_CONFIG, Sensor.RecordingLevel.DEBUG.name); streamsConfiguration.put(StreamsConfig.CACHE_MAX_BYTES_BUFFERING_CONFIG, 10 * 1024 * 1024L); streamsConfiguration.put(StreamsConfig.NUM_STREAM_THREADS_CONFIG, 2); streamsConfiguration.put(StreamsConfig.STATE_DIR_CONFIG, TestUtils.tempDirectory().getPath()); }

Target:
public void before() throws InterruptedException { builder = new StreamsBuilder(); CLUSTER.createTopics(STREAM_INPUT, STREAM_OUTPUT_1, STREAM_OUTPUT_2, STREAM_OUTPUT_3, STREAM_OUTPUT_4); streamsConfiguration = new Properties(); streamsConfiguration.put(StreamsConfig.APPLICATION_ID_CONFIG, APPLICATION_ID_VALUE); streamsConfiguration.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, CLUSTER.bootstrapServers()); streamsConfiguration.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.Integer().getClass()); streamsConfiguration.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.String().getClass()); streamsConfiguration.put(StreamsConfig.METRICS_RECORDING_LEVEL_CONFIG, Sensor.RecordingLevel.DEBUG.name); streamsConfiguration.put(StreamsConfig.CACHE_MAX_BYTES_BUFFERING_CONFIG, 10 * 1024 * 1024L); streamsConfiguration.put(StreamsConfig.NUM_STREAM_THREADS_CONFIG, NUM_THREADS); streamsConfiguration.put(StreamsConfig.STATE_DIR_CONFIG, TestUtils.tempDirectory().getPath()); }
Source:
private AggregatorFactory[] getCombiningFactories(AggregatorFactory[] aggregatorFactories) { final AggregatorFactory[] combiningFactories = new AggregatorFactory[aggregatorFactories.length]; for (int i = 0; i < aggregatorFactories.length; i++) { combiningFactories[i] = aggregatorFactories[i].getCombiningFactory(); } return combiningFactories; }

Target:
private AggregatorFactory[] getCombiningFactories(AggregatorFactory[] aggregatorFactories) { final AggregatorFactory[] combiningFactories = new AggregatorFactory[aggregatorFactories.length]; Arrays.setAll(combiningFactories, i -> aggregatorFactories[i].getCombiningFactory()); return combiningFactories; }
Source:
public void addRepresentation (ImageData srcImageData, int zoom) { if (srcImageData == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); int imageSelectorIndex = DPIUtil.mapZoomToImageSelectorIndex(zoom); if (imageSelectorIndex == device.getImageSelector ()) { init(srcImageData); init(); } else { data [imageSelectorIndex] = srcImageData; } }

Target:
public void addRepresentation (ImageData srcImageData, int zoom) { if (srcImageData == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); int imageSelectorIndex = DPIUtil.mapZoomToImageSelectorIndex(zoom); if (imageSelectorIndex == getImageSelector ()) { init(srcImageData); init(); } data [imageSelectorIndex] = srcImageData; }
Source:
public Aws create(final TwilioRestClient client) { Request request = new Request( HttpMethod.POST, Domains.ACCOUNTS.toString(), "/v1/Credentials/AWS", client.getRegion() ); addPostParams(request); Response response = client.request(request); if (response == null) { throw new ApiConnectionException("Aws creation failed: Unable to connect to server"); } else if (!TwilioRestClient.SUCCESS.apply(response.getStatusCode())) { RestException restException = RestException.fromJson(response.getStream(), client.getObjectMapper()); if (restException == null) { throw new ApiException("Server Error, no content"); } throw new ApiException( restException.getMessage(), restException.getCode(), restException.getMoreInfo(), restException.getStatus(), restException.getDetails(), null ); } return Aws.fromJson(response.getStream(), client.getObjectMapper()); }

Target:
public Aws create(final TwilioRestClient client) { Request request = new Request( HttpMethod.POST, Domains.ACCOUNTS.toString(), "/v1/Credentials/AWS", client.getRegion() ); addPostParams(request); Response response = client.request(request); if (response == null) { throw new ApiConnectionException("Aws creation failed: Unable to connect to server"); } else if (!TwilioRestClient.SUCCESS.apply(response.getStatusCode())) { RestException restException = RestException.fromJson(response.getStream(), client.getObjectMapper()); if (restException == null) { throw new ApiException("Server Error, no content"); } throw new ApiException(restException); } return Aws.fromJson(response.getStream(), client.getObjectMapper()); }
Source:
public Map<String, AttributeValue> transform(final Parameters<?> parameters) { final ModelClassMetadata metadata = getModelClassMetadata(parameters); final Map<String, AttributeValue> attributeValues = parameters.getAttributeValues(); if (metadata.doNotTouch) { return attributeValues; } if (parameters.isPartialUpdate()) { LOG.error("Use of AttributeEncryptor without SaveBehavior.CLOBBER is an error and may result in data-corruption. " + "This occured while trying to save " + parameters.getModelClass()); } try { return encryptor.encryptRecord( attributeValues, metadata.getEncryptionFlags(), paramsToContext(parameters)); } catch (Exception ex) { throw new DynamoDBMappingException(ex); } }

Target:
public Map<String, AttributeValue> transform(final Parameters<?> parameters) { final ModelClassMetadata metadata = getModelClassMetadata(parameters); final Map<String, AttributeValue> attributeValues = parameters.getAttributeValues(); if (metadata.doNotTouch) { return attributeValues; } if (parameters.isPartialUpdate()) { LOG.error("Use of AttributeEncryptor without SaveBehavior.CLOBBER is an error and can result in data-corruption. " + "This occured while trying to save " + parameters.getModelClass()); } try { return encryptor.encryptRecord( attributeValues, metadata.getEncryptionFlags(), paramsToContext(parameters)); } catch (Exception ex) { throw new DynamoDBMappingException(ex); } }
Source:
private synchronized void tryRollOver(AffinityTopologyVersion topVer) { if (entries == null) return; long ackedUpdCntr0 = ackedUpdCntr; if (endCntr < ackedUpdCntr0) rollOver(ackedUpdCntr0 + 1, 0, topVer); }

Target:
private synchronized Object tryRollOver(AffinityTopologyVersion topVer) { if (entries == null) return RETRY; long ackedUpdCntr0 = ackedUpdCntr.get(); if (endCntr < ackedUpdCntr0) { rollOver(ackedUpdCntr0 + 1, 0, topVer); return RETRY; } return null; }
Source:
public void testCacheHitsAndMissesTheExpectedNumberOfTimes() throws IOException { try(final CachingBAMFileIndex index = getIndexWith200Contigs()) { index.getQueryResults(1); assertCacheStats(index, 0, 1); index.getQueryResults(1); assertCacheStats(index, 1, 1); index.getQueryResults(150); assertCacheStats(index, 1, 2); index.getQueryResults(150); assertCacheStats(index,2,2); index.getQueryResults(150); assertCacheStats(index,3,2); index.getQueryResults(1); assertCacheStats(index, 3, 3); } }

Target:
public void testCacheHitsAndMissesTheExpectedNumberOfTimes() throws IOException { try(final CachingBAMFileIndex index = getIndexWith200Contigs()) { index.getQueryResults(1); assertCacheStats(index, 0, 1); index.getQueryResults(1); assertCacheStats(index, 1, 1); index.getQueryResults(150); assertCacheStats(index, 1, 2); index.getQueryResults(150); assertCacheStats(index,2,2); index.getQueryResults(150); assertCacheStats(index,3,2); index.getQueryResults(1); assertCacheStats(index, 3, 3); index.getQueryResults(1); assertCacheStats(index, 4, 3); index.getQueryResults(1000); assertCacheStats(index,4,4); } }
Source:
public void handleException(Exception e, HttpServletResponse response, HttpServletRequest request) throws IOException { logger.error("Internal Server Error", e); storeException(request, response, e); ResponseStatus responseStatus = e.getClass().getAnnotation(ResponseStatus.class); if (responseStatus != null) { response.sendError(responseStatus.value().value(), e.getMessage()); } else { response.sendError(HttpStatus.INTERNAL_SERVER_ERROR.value(), e.getMessage()); } }

Target:
public void handleException(Exception e, HttpServletResponse response, HttpServletRequest request) throws IOException { logger.error("Internal Server Error", e); storeException(request, response, e); ResponseStatus responseStatus = e.getClass().getAnnotation(ResponseStatus.class); if (responseStatus != null) { String message = e.getMessage(); if (message == null || message.trim().isEmpty()) { message = responseStatus.reason(); } response.sendError(responseStatus.value().value(), message); } else { response.sendError(HttpStatus.INTERNAL_SERVER_ERROR.value(), e.getMessage()); } }
Source:
public void setParams(Object[] params) { if (this.hasDimension) { if (params.length != dim) { throw new IllegalArgumentException("expected " + dim + " arguments to setParams for UniformVector distribution. Got " + params.length + " dimensions"); } } else { this.numFilled = 0; this.dim = params.length; this.hasDimension = true; this.mins = new double[dim]; this.maxes = new double[dim]; this.dimensionSet = new boolean[dim]; } MatrixLib[] m = new MatrixLib[dim]; for (int i = 0; i < dim; i++) { m[i] = (MatrixLib) params[i]; } setParams(m); }

Target:
public void setParams(Object[] params) { if (this.hasDimension) { if (params.length != dim) { throw new IllegalArgumentException("expected " + dim + " arguments to setParams for UniformVector distribution. Got " + params.length + " dimensions"); } } else { this.numFilled = 0; this.dim = params.length; this.hasDimension = true; this.mins = new double[dim]; this.maxes = new double[dim]; this.dimensionSet = new boolean[dim]; } MatrixLib[] m = new MatrixLib[dim]; System.arraycopy(params, 0, m, 0, params.length); setParams(m); }
Source:
public static BinaryData fromString(String data) { if (Objects.isNull(data)) { return new BinaryData(EMPTY_DATA); } else { return new BinaryData(data.getBytes(StandardCharsets.UTF_8)); } }

Target:
public static BinaryData fromString(String data) { if (Objects.isNull(data) || data.length() == 0) { return EMPTY_DATA; } return new BinaryData(data.getBytes(StandardCharsets.UTF_8)); }
Source:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("( "); for (Entry<K, V> entry : entrySet()) { sb.append('{').append(entry.getKey()).append(':').append(entry.getValue()).append("}, "); } final String result; if (!isEmpty()) { result = sb.substring(0, sb.length() - 2); } else { result = sb.toString(); } return result + " )"; }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("( "); for (Entry<K, V> entry : entrySet()) { sb.append('{').append(entry.getKey()).append(':').append(entry.getValue()).append("}, "); } if (!isEmpty()) { sb.replace(sb.length() - 2, sb.length(), ""); } return sb.append(" )").toString(); }
Source:
public static SimpleBlobStore create( RemoteOptions options, @Nullable Credentials creds, @Nullable Path workingDirectory) throws IOException { if (isRestUrlOptions(options) && isDiskCache(options)) { return createCombinedCache(workingDirectory, options.diskCache, options, creds); } if (isRestUrlOptions(options)) { return createRest(options, creds); } if (workingDirectory != null && isDiskCache(options)) { return createDiskCache(workingDirectory, options.diskCache); } throw new IllegalArgumentException( "Unrecognized concurrent map RemoteOptions: must specify " + "either Rest URL, or local cache options."); }

Target:
public static SimpleBlobStore create( RemoteOptions options, @Nullable Credentials creds, @Nullable Path workingDirectory) throws IOException { if (isHttpUrlOptions(options) && isDiskCache(options)) { return createCombinedCache(workingDirectory, options.diskCache, options, creds); } if (isHttpUrlOptions(options)) { return createHttp(options, creds); } if (workingDirectory != null && isDiskCache(options)) { return createDiskCache(workingDirectory, options.diskCache); } throw new IllegalArgumentException( "Unrecognized RemoteOptions configuration: remote Http cache URL and/or local disk cache options expected."); }
Source:
public void testLogAnnotation() { assertNotNull(this.loggingHandler); org.apache.commons.logging.Log log = spy(TestUtils.getPropertyValue(this.loggingHandler, "messageLogger", org.apache.commons.logging.Log.class)); given(log.isWarnEnabled()) .willReturn(true); new DirectFieldAccessor(this.loggingHandler) .setPropertyValue("messageLogger", log); this.loggingChannel.send(MessageBuilder.withPayload("foo") .setHeader("bar", "baz") .build()); ArgumentCaptor<Object> argumentCaptor = ArgumentCaptor.forClass(Object.class); verify(log) .warn(argumentCaptor.capture()); assertEquals("foo for baz", argumentCaptor.getValue()); }

Target:
public void testLogAnnotation() { assertNotNull(this.loggingHandler); Log log = spy(TestUtils.getPropertyValue(this.loggingHandler, "messageLogger", Log.class)); given(log.isWarnEnabled()) .willReturn(true); new DirectFieldAccessor(this.loggingHandler) .setPropertyValue("messageLogger", log); this.loggingChannel.send(MessageBuilder.withPayload("foo") .setHeader("bar", "baz") .build()); ArgumentCaptor<Object> argumentCaptor = ArgumentCaptor.forClass(Object.class); verify(log) .warn(argumentCaptor.capture()); assertEquals("foo for baz", argumentCaptor.getValue()); }
Source:
private List<String> buildTestScannerArgs(Path path, ClassPath classPath, String... args) { List<String> scannerArgs = new ArrayList<>(); scannerArgs.add("java"); scannerArgs.add("-cp"); if (classPath == null) { scannerArgs.add(generateClassPath(path).toString()); } else { scannerArgs.add(classPath.toString()); } scannerArgs.add("fi.helsinki.cs.tmc.testscanner.TestScanner"); path = path.toAbsolutePath(); scannerArgs.add(path.toString() + testDir); if (args != null) { for (String arg : args) { scannerArgs.add(arg); } } return scannerArgs; }

Target:
private List<String> buildTestScannerArgs(Path path, ClassPath classPath, String... args) { List<String> scannerArgs = new ArrayList<>(); scannerArgs.add("java"); scannerArgs.add("-cp"); if (classPath == null) { scannerArgs.add(generateClassPath(path).toString()); } else { scannerArgs.add(classPath.toString()); } scannerArgs.add("fi.helsinki.cs.tmc.testscanner.TestScanner"); path = path.toAbsolutePath(); scannerArgs.add(path.toString() + testDir); if (args != null) { Collections.addAll(scannerArgs, args); } return scannerArgs; }
Source:
public static BlobProperties getBlobPropertiesFromStream(DataInputStream stream) throws IOException { short version = stream.readShort(); BlobProperties toReturn; long ttl = stream.readLong(); boolean isPrivate = stream.readByte() == 1; long creationTime = stream.readLong(); long blobSize = stream.readLong(); String contentType = Utils.readIntString(stream); String ownerId = Utils.readIntString(stream); String serviceId = Utils.readIntString(stream); switch (version) { case VERSION_1: toReturn = new BlobProperties(blobSize, serviceId, ownerId, contentType, isPrivate, ttl, creationTime, Account.UNKNOWN_ACCOUNT_ID, Container.UNKNOWN_CONTAINER_ID, false); break; case VERSION_2: { short accountId = stream.readShort(); short containerId = stream.readShort(); toReturn = new BlobProperties(blobSize, serviceId, ownerId, contentType, isPrivate, ttl, creationTime, accountId, containerId, false); } break; case VERSION_3: { short accountId = stream.readShort(); short containerId = stream.readShort(); boolean isEncrypted = stream.readByte() == (byte) 1; toReturn = new BlobProperties(blobSize, serviceId, ownerId, contentType, isPrivate, ttl, creationTime, accountId, containerId, isEncrypted); } break; default: throw new IllegalArgumentException("stream has unknown blob property version " + version); } return toReturn; }

Target:
public static BlobProperties getBlobPropertiesFromStream(DataInputStream stream) throws IOException { short version = stream.readShort(); if (version < VERSION_1 || version > VERSION_3) { throw new IllegalArgumentException("stream has unknown blob property version " + version); } long ttl = stream.readLong(); boolean isPrivate = stream.readByte() == 1; long creationTime = stream.readLong(); long blobSize = stream.readLong(); String contentType = Utils.readIntString(stream); String ownerId = Utils.readIntString(stream); String serviceId = Utils.readIntString(stream); short accountId = version > VERSION_1 ? stream.readShort() : Account.UNKNOWN_ACCOUNT_ID; short containerId = version > VERSION_1 ? stream.readShort() : Container.UNKNOWN_CONTAINER_ID; boolean isEncrypted = version > VERSION_2 && stream.readByte() == (byte) 1; return new BlobProperties(blobSize, serviceId, ownerId, contentType, isPrivate, ttl, creationTime, accountId, containerId, isEncrypted); }
Source:
private boolean updateNumberRuns(AppAggregationKey appAggKey, HTable aggTable, JobDetails jobDetails) throws IOException { byte[] rowKey = aggConv.toBytes(appAggKey); Get g = new Get(rowKey); g.addColumn(AggregationConstants.INFO_FAM_BYTES, AggregationConstants.NUMBER_RUNS_BYTES); byte[] numberRowsCol = Bytes.toBytes(jobDetails.getJobKey().getRunId()); g.addColumn(AggregationConstants.SCRATCH_FAM_BYTES, numberRowsCol); Result r = aggTable.get(g); LOG.trace(" jobkey " + jobDetails.getJobKey().toString() + " runid in updateNumberRuns " + jobDetails.getJobKey().getRunId()); long numberRuns = getNumberRunsScratch(r.getFamilyMap (AggregationConstants.SCRATCH_FAM_BYTES)); if (numberRuns == 1L) { return incrNumberRuns(r.getColumn (AggregationConstants.INFO_FAM_BYTES, AggregationConstants.NUMBER_RUNS_BYTES), aggTable, appAggKey); } else { return true; } }

Target:
private boolean updateNumberRuns(AppAggregationKey appAggKey, HTable aggTable, JobDetails jobDetails) throws IOException { byte[] rowKey = aggConv.toBytes(appAggKey); Get g = new Get(rowKey); g.addColumn(AggregationConstants.INFO_FAM_BYTES, AggregationConstants.NUMBER_RUNS_BYTES); byte[] numberRowsCol = Bytes.toBytes(jobDetails.getJobKey().getRunId()); g.addColumn(AggregationConstants.SCRATCH_FAM_BYTES, numberRowsCol); Result r = aggTable.get(g); if (LOG.isTraceEnabled()) { LOG.trace(" jobkey " + jobDetails.getJobKey().toString() + " runid in updateNumberRuns " + jobDetails.getJobKey().getRunId()); } long numberRuns = getNumberRunsScratch(r.getFamilyMap (AggregationConstants.SCRATCH_FAM_BYTES)); if (numberRuns == 1L) { return incrNumberRuns(r.getColumn (AggregationConstants.INFO_FAM_BYTES, AggregationConstants.NUMBER_RUNS_BYTES), aggTable, appAggKey); } else { return true; } }
Source:
private AnnotationProcessorConstraintTarget getConstraintTarget(AnnotationMirror annotation) { AnnotationValue validationAppliesTo = annotationApiHelper.getAnnotationValue( annotation, "validationAppliesTo" ); if(validationAppliesTo==null) { for(Element e : annotation.getAnnotationType().asElement().getEnclosedElements()) { Boolean isValidationAppliesToMethod = e.accept( new ElementKindVisitor6<Boolean, Void>() { @Override public Boolean visitExecutableAsMethod(ExecutableElement e, Void p) { if(e.getSimpleName().contentEquals( "validationAppliesTo" )) { return true; } return super.visitExecutableAsMethod( e, p ); } }, null ); if(Boolean.TRUE.equals( isValidationAppliesToMethod )) { return AnnotationProcessorConstraintTarget.IMPLICIT; } } return null; } return validationAppliesTo.accept( new SimpleAnnotationValueVisitor6<AnnotationProcessorConstraintTarget, Void>() { private TypeMirror constraintTargetMirror = annotationApiHelper.getDeclaredTypeByName( "javax.validation.ConstraintTarget" ); @Override public AnnotationProcessorConstraintTarget visitEnumConstant(VariableElement c, Void p) { if(typeUtils.isSameType( c.asType(), constraintTargetMirror )) { return AnnotationProcessorConstraintTarget.valueOf( c.getSimpleName().toString() ); } return null; } }, null ); }

Target:
private AnnotationProcessorConstraintTarget getConstraintTarget(AnnotationMirror annotation) { AnnotationValue validationAppliesTo = annotationApiHelper.getAnnotationValue( annotation, "validationAppliesTo" ); if(validationAppliesTo==null) { for(Element e : annotation.getAnnotationType().asElement().getEnclosedElements()) { Boolean isValidationAppliesToMethod = e.accept( new ElementKindVisitor6<Boolean, Void>() { @Override public Boolean visitExecutableAsMethod(ExecutableElement e, Void p) { if(e.getSimpleName().contentEquals( "validationAppliesTo" )) { return true; } return false; } }, null ); if(Boolean.TRUE.equals( isValidationAppliesToMethod )) { return AnnotationProcessorConstraintTarget.IMPLICIT; } } return null; } return validationAppliesTo.accept( new SimpleAnnotationValueVisitor6<AnnotationProcessorConstraintTarget, Void>() { private TypeMirror constraintTargetMirror = annotationApiHelper.getDeclaredTypeByName( BeanValidationTypes.CONSTRAINT_TARGET ); @Override public AnnotationProcessorConstraintTarget visitEnumConstant(VariableElement c, Void p) { if(typeUtils.isSameType( c.asType(), constraintTargetMirror )) { return AnnotationProcessorConstraintTarget.valueOf( c.getSimpleName().toString() ); } return null; } }, null ); }
Source:
protected void showDialog(Bundle state) { super.showDialog(state); updateSaveButtonState(); }

Target:
protected void showDialog(Bundle state) { WifiConfiguration[] networks = loadConfiguredNetworksSorted(); if (networks != null) { Set<String> selected = getSharedPreferences().getStringSet(getKey(), new HashSet<String>()); selected = new HashSet<>(selected); CharSequence[] all = extractSsid(networks, false); filterRemovedNetworks(selected, all); setEntries(extractSsid(networks, true)); setEntryValues(all); setValues(selected); super.showDialog(state); } else { Toast.makeText(getContext(), R.string.sync_only_wifi_ssids_wifi_turn_on_wifi, Toast.LENGTH_LONG).show(); } }
Source:
public double getBatteryResistance() { try { return getBatteryResistanceSafely(); } catch (InvalidSensorException e) { LogKitten.ex(e); return 80.0; } }

Target:
public double getBatteryResistance() { try { return getBatteryResistanceSafely(); } catch (InvalidSensorException e) { LogKitten.ex(e); return cachedResistance; } }
Source:
public Collection<ActiveRuleDto> selectByRulesAndRuleProfileUuids(DbSession dbSession, Collection<RuleDefinitionDto> rules, Collection<String> ruleProfileUuids) { if (rules.isEmpty()) { return emptyList(); } checkArgument(rules.size() < PARTITION_SIZE_FOR_ORACLE, "too many rules (got %s, max is %s)", rules.size(), PARTITION_SIZE_FOR_ORACLE); List<Integer> ruleIds = rules.stream().map(RuleDefinitionDto::getId).collect(MoreCollectors.toArrayList(rules.size())); return executeLargeInputs(ruleProfileUuids, chunk -> mapper(dbSession).selectByRuleIdsAndRuleProfileUuids(ruleIds, chunk)); }

Target:
public Collection<ActiveRuleDto> selectByRulesAndRuleProfileUuids(DbSession dbSession, Collection<RuleDefinitionDto> rules, Collection<String> ruleProfileUuids) { if (rules.isEmpty() || ruleProfileUuids.isEmpty()) { return emptyList(); } List<Integer> ruleIds = rules.stream().map(RuleDefinitionDto::getId).collect(MoreCollectors.toArrayList(rules.size())); ActiveRuleMapper mapper = mapper(dbSession); return executeLargeInputs(ruleIds, ruleIdsChunk -> executeLargeInputs(ruleProfileUuids, chunk -> mapper.selectByRuleIdsAndRuleProfileUuids(ruleIdsChunk, chunk))); }
Source:
public String resolve(HttpServletRequest request) { String authorizationHeaderToken = resolveFromAuthorizationHeader(request); String parameterToken = request.getParameter("access_token"); if (authorizationHeaderToken != null) { if (parameterToken != null) { BearerTokenError error = new BearerTokenError(BearerTokenErrorCodes.INVALID_REQUEST, HttpStatus.BAD_REQUEST, "Found multiple bearer tokens in the request", "<LINK_0>"); throw new OAuth2AuthenticationException(error); } return authorizationHeaderToken; } else if (parameterToken != null && isParameterTokenSupportedForRequest(request)) { return parameterToken; } return null; }

Target:
public String resolve(HttpServletRequest request) { String authorizationHeaderToken = resolveFromAuthorizationHeader(request); String parameterToken = resolveFromRequestParameters(request); if (authorizationHeaderToken != null) { if (parameterToken != null) { BearerTokenError error = new BearerTokenError(BearerTokenErrorCodes.INVALID_REQUEST, HttpStatus.BAD_REQUEST, "Found multiple bearer tokens in the request", "<LINK_0>"); throw new OAuth2AuthenticationException(error); } return authorizationHeaderToken; } else if (parameterToken != null && isParameterTokenSupportedForRequest(request)) { return parameterToken; } return null; }