auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void setCategory(SingleSignOnAccount ssoAccount, @NonNull DBNote note, @NonNull String category, @Nullable ISyncCallback callback) { note.setCategory(category); note.setStatus(DBStatus.LOCAL_EDITED); SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(key_status, note.getStatus().getTitle()); if (getCategoryIdByTitle(note.getAccountId(), category, false) == -1 && addCategory(note.getCategory(), note.getAccountId()) == -1) { Log.e(TAG, String.format("Error occurs when creating category: %s", note.getCategory())); } int id = getCategoryIdByTitle(note.getAccountId(), note.getCategory(), true); values.put(key_category, id); db.update(table_notes, values, key_id + " = ?", new String[]{String.valueOf(note.getId())}); if (callback != null) { serverSyncHelper.addCallbackPush(ssoAccount, callback); } serverSyncHelper.scheduleSync(ssoAccount, true); }

Target:
public void setCategory(SingleSignOnAccount ssoAccount, @NonNull DBNote note, @NonNull String category, @Nullable ISyncCallback callback) { note.setCategory(category); note.setStatus(DBStatus.LOCAL_EDITED); SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(key_status, note.getStatus().getTitle()); int id = getCategoryIdByTitle(note.getAccountId(), note.getCategory()); values.put(key_category, id); db.update(table_notes, values, key_id + " = ?", new String[]{String.valueOf(note.getId())}); removeEmptyCategory(note.getAccountId()); if (callback != null) { serverSyncHelper.addCallbackPush(ssoAccount, callback); } serverSyncHelper.scheduleSync(ssoAccount, true); }
Source:
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { if (!LOG_METHOD.matches(tree, state)) { return Description.NO_MATCH; } Optional<Description> wrappedThrowableDescription = checkThrowableArgumentNotWrapped(tree, state); if (wrappedThrowableDescription.isPresent()) { return wrappedThrowableDescription.get(); } List<? extends ExpressionTree> allArgs = tree.getArguments(); int startArgIndex = MARKER.matches(allArgs.get(0), state) ? 2 : 1; int lastArgIndex = allArgs.size() - 1; ExpressionTree lastArg = allArgs.get(lastArgIndex); if (startArgIndex == lastArgIndex && OBJECT_ARRAY.matches(lastArg, state)) { return Description.NO_MATCH; } boolean lastArgIsThrowable = THROWABLE.matches(lastArg, state); int lastNonThrowableArgIndex = lastArgIsThrowable ? lastArgIndex - 1 : lastArgIndex; List<Integer> badArgIndices = IntStream.rangeClosed(startArgIndex, lastNonThrowableArgIndex) .filter(i -> !ARG.matches(allArgs.get(i), state)) .boxed() .collect(Collectors.toList()); if (badArgIndices.isEmpty() || TestCheckUtils.isTestCode(state)) { return Description.NO_MATCH; } else { return buildDescription(tree) .setMessage("slf4j log statement does not use logsafe parameters for arguments " + badArgIndices) .build(); } }

Target:
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { if (!LOG_METHOD.matches(tree, state)) { return Description.NO_MATCH; } Optional<Description> wrappedThrowableDescription = checkThrowableArgumentNotWrapped(tree, state); if (wrappedThrowableDescription.isPresent()) { return wrappedThrowableDescription.get(); } List<? extends ExpressionTree> allArgs = tree.getArguments(); int startArgIndex = MARKER.matches(allArgs.get(0), state) ? 2 : 1; int lastArgIndex = allArgs.size() - 1; ExpressionTree lastArg = allArgs.get(lastArgIndex); if (startArgIndex == lastArgIndex && OBJECT_ARRAY.matches(lastArg, state)) { return Description.NO_MATCH; } boolean lastArgIsThrowable = THROWABLE.matches(lastArg, state); int lastNonThrowableArgIndex = lastArgIsThrowable ? lastArgIndex - 1 : lastArgIndex; List<Integer> badArgs = getBadArgIndices(state, allArgs, startArgIndex, lastNonThrowableArgIndex); if (badArgs.isEmpty() || TestCheckUtils.isTestCode(state)) { return Description.NO_MATCH; } return buildDescription(tree) .setMessage("slf4j log statement does not use logsafe parameters for arguments " + badArgs) .build(); }
Source:
public void storeServerMetrics(final String serverId, final ServerMetrics metrics) { if (metricCollectionEnabled) { if (numBlockByEvalIdForServer != null && numBlockByEvalIdForServer.containsKey(serverId)) { final int numModelBlocks = numBlockByEvalIdForServer.get(serverId); final DataInfo dataInfo = new DataInfoImpl(numModelBlocks); final EvaluatorParameters evaluatorParameters = new ServerEvaluatorParameters(serverId, dataInfo, metrics); synchronized (serverEvalParams) { if (!serverEvalParams.containsKey(serverId)) { serverEvalParams.put(serverId, new ArrayList<>()); } if (initialEpochMetricArrived) { serverEvalParams.get(serverId).add(evaluatorParameters); } } } else { LOG.log(Level.FINE, "No information about {0}. Dropping metric.", serverId); } } else { LOG.log(Level.FINE, "Metric collection disabled. Dropping metric from {0}", serverId); } if (dashboardSetupStatus.dashboardEnabled) { try { metricsRequestQueue.put(String.format("id=%s&metrics=%s&time=%d", serverId, metrics, System.currentTimeMillis())); } catch (InterruptedException e) { LOG.log(Level.WARNING, "Dashboard: Interrupted while taking metrics to send from the queue.", e); } } }

Target:
public void storeServerMetrics(final String serverId, final ServerMetrics metrics) { if (metricCollectionEnabled) { if (numBlockByEvalIdForServer != null && numBlockByEvalIdForServer.containsKey(serverId)) { final int numModelBlocks = numBlockByEvalIdForServer.get(serverId); final DataInfo dataInfo = new DataInfoImpl(numModelBlocks); final EvaluatorParameters evaluatorParameters = new ServerEvaluatorParameters(serverId, dataInfo, metrics); synchronized (serverEvalParams) { if (workerEvalEpochParams.size() == numBlockByEvalIdForWorker.size()) { if (!serverEvalParams.containsKey(serverId)) { serverEvalParams.put(serverId, new ArrayList<>()); } if (metrics.getNumModelBlocks() == numModelBlocks) { serverEvalParams.get(serverId).add(evaluatorParameters); } else { LOG.log(Level.SEVERE, "Inconsistent NumModelBlocks: driver = {0}, {1} = {2}", new Object[] {numModelBlocks, serverId, metrics.getNumModelBlocks()}); } } } } else { LOG.log(Level.FINE, "No information about {0}. Dropping metric.", serverId); } } else { LOG.log(Level.FINE, "Metric collection disabled. Dropping metric from {0}", serverId); } if (dashboardSetupStatus.dashboardEnabled) { try { metricsRequestQueue.put(String.format("id=%s&metrics=%s&time=%d", serverId, metrics, System.currentTimeMillis())); } catch (InterruptedException e) { LOG.log(Level.WARNING, "Dashboard: Interrupted while taking metrics to send from the queue.", e); } } }
Source:
public void start() { try { String localhost = InetAddress.getLocalHost().getCanonicalHostName(); attach(localhost, PORT); List<BreakpointRequest> requests= new ArrayList<>(); for (java.lang.reflect.Method fMethod : fMethods) { requests.add(createBreakpointRequest(fMethod)); } for (Constructor<?> fConstructor : fConstructors) { requests.add(createBreakpointRequest(fConstructor)); } fBreakpointRequests= requests.toArray(new BreakpointRequest[requests.size()]); fEventReader= new EventReader(fVM.eventQueue()); fEventReader.start(); } catch (IOException x) { x.printStackTrace(); } catch (IllegalConnectorArgumentsException x) { x.printStackTrace(); } finally { Assert.assertNotNull("Could not start performance meter, hints:\n1) check the command line arguments (see InvocationCountPerformanceMeter for details)\n2) use a different port number", fEventReader); } }

Target:
public void start() { try { String localhost = InetAddress.getLocalHost().getCanonicalHostName(); attach(localhost, PORT); List<BreakpointRequest> requests= new ArrayList<>(); for (java.lang.reflect.Method method : fMethods) { requests.add(createBreakpointRequest(method)); } for (Constructor<?> constructor : fConstructors) { requests.add(createBreakpointRequest(constructor)); } fBreakpointRequests= requests.toArray(new BreakpointRequest[requests.size()]); fEventReader= new EventReader(fVM.eventQueue()); fEventReader.start(); } catch (IOException x) { x.printStackTrace(); } catch (IllegalConnectorArgumentsException x) { x.printStackTrace(); } finally { Assert.assertNotNull("Could not start performance meter, hints:\n1) check the command line arguments (see InvocationCountPerformanceMeter for details)\n2) use a different port number", fEventReader); } }
Source:
public void sessionCreated(HttpSessionEvent se) { ServletContext servletContext; ApplicationContext ctx; JCommuneProperty property = null; try { servletContext = se.getSession().getServletContext(); ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext); property = (JCommuneProperty) ctx.getBean("sessionTimeoutProperty"); locationService = (LocationService) ctx.getBean("locationService"); } catch (Exception ex) { logger.warn("Bean instantiation error: " + ex.getMessage()); } int value = property != null ? property.intValue() : 0; int timeoutInSeconds = (int) TimeUnit.SECONDS.convert(value, TimeUnit.MINUTES); if (timeoutInSeconds > 0) { se.getSession().setMaxInactiveInterval(timeoutInSeconds); } else { se.getSession().setMaxInactiveInterval(-1); } }

Target:
public void sessionCreated(HttpSessionEvent se) { try { if (sessionTimeoutProperty == null) { synchronized (this) { if (sessionTimeoutProperty == null){ ServletContext context = se.getSession().getServletContext(); sessionTimeoutProperty = getBeanFormApplicationContext(context, JCommuneProperty.class, "sessionTimeoutProperty"); locationService = getBeanFormApplicationContext(context, LocationService.class, "locationService"); int seconds = extractValueFromProperty(sessionTimeoutProperty); TIME_OUT_SECONDS = seconds > 0 ? seconds : -1; } } } se.getSession().setMaxInactiveInterval(TIME_OUT_SECONDS); } catch (Exception ex) { logger.warn("Bean instantiation error: " + ex); throw ex; } }
Source:
static TransactionManagerContext createTransactionManager( TestableTimelockCluster cluster, String agent, AtlasDbRuntimeConfig runtimeConfigTemplate, Optional<LockDiagnosticComponents> diagnosticComponents, Schema... schemas) { List<String> serverUris = cluster.servers().stream() .map(server -> server.serverHolder().getTimelockUri()) .collect(Collectors.toList()); AtlasDbConfig config = ImmutableAtlasDbConfig.builder() .namespace(agent) .keyValueService(new InMemoryAtlasDbConfig()) .timelock(ImmutableTimeLockClientConfig.builder() .serversList(ImmutableServerListConfig.builder() .servers(serverUris) .sslConfiguration(SslConfiguration.of(Paths.get("var/security/trustStore.jks"))) .build()) .client(Optional.of(agent)) .build()) .build(); AtlasDbRuntimeConfig runtimeConfig = ImmutableAtlasDbRuntimeConfig .copyOf(runtimeConfigTemplate) .withRemotingClient(RemotingClientConfigs.DEFAULT); TransactionManager transactionManager = TransactionManagers.builder() .config(config) .userAgent(UserAgent.of(UserAgent.Agent.of("u" + agent, "0.0.0"))) .globalMetricsRegistry(new MetricRegistry()) .globalTaggedMetricRegistry(DefaultTaggedMetricRegistry.getDefault()) .runtimeConfigSupplier(() -> Optional.of(runtimeConfig)) .lockDiagnosticComponents(diagnosticComponents) .addSchemas(schemas) .build() .serializable(); return ImmutableTransactionManagerContext.builder() .transactionManager(transactionManager) .install(config) .runtime(runtimeConfig) .build(); }

Target:
static TransactionManagerContext createTransactionManager( TestableTimelockCluster cluster, String agent, AtlasDbRuntimeConfig runtimeConfigTemplate, Optional<LockDiagnosticComponents> diagnosticComponents, Schema... schemas) { List<String> serverUris = cluster.servers().stream() .map(server -> server.serverHolder().getTimelockUri()) .collect(Collectors.toList()); AtlasDbConfig config = ImmutableAtlasDbConfig.builder() .namespace(agent) .keyValueService(new InMemoryAtlasDbConfig()) .timelock(ImmutableTimeLockClientConfig.builder() .serversList(ImmutableServerListConfig.builder() .servers(serverUris) .sslConfiguration(SslConfiguration.of(Paths.get("var/security/trustStore.jks"))) .build()) .build()) .build(); AtlasDbRuntimeConfig runtimeConfig = ImmutableAtlasDbRuntimeConfig .copyOf(runtimeConfigTemplate) .withRemotingClient(RemotingClientConfigs.DEFAULT); TransactionManager transactionManager = TransactionManagers.builder() .config(config) .userAgent(UserAgent.of(UserAgent.Agent.of("u" + agent, "0.0.0"))) .globalMetricsRegistry(new MetricRegistry()) .globalTaggedMetricRegistry(DefaultTaggedMetricRegistry.getDefault()) .runtimeConfigSupplier(() -> Optional.of(runtimeConfig)) .lockDiagnosticComponents(diagnosticComponents) .addSchemas(schemas) .build() .serializable(); return ImmutableTransactionManagerContext.builder() .transactionManager(transactionManager) .install(config) .runtime(runtimeConfig) .build(); }
Source:
private static List<BaseResource> getInlineResources(Object obj) { ArrayList<BaseResource> ret = new ArrayList<>(); for (Method method : getRelevantMethods(obj.getClass())) { Object inline = null; try { inline = method.invoke(obj); } catch (Exception e) { } if (inline != null) { if (inline instanceof BaseResource) { ret.add((BaseResource) inline); } else if (inline instanceof BaseResources) { BaseResources entities = (BaseResources)inline; Method getter = EntityHelper.getCollectionGetter(entities); try { List<BaseResource> entitiesList = (List<BaseResource>) getter.invoke(entities); for (BaseResource entity : entitiesList) { ret.add(entity); } } catch (Exception e) { log.error("Error invoking " + method.getName() + " on " + entities.getClass().getSimpleName(), e); } } else { ret.addAll(getInlineResources(inline)); } } } return ret; }

Target:
private static List<BaseResource> getInlineResources(Object obj) { ArrayList<BaseResource> ret = new ArrayList<>(); for (Method method : getRelevantMethods(obj.getClass())) { Object inline = null; try { inline = method.invoke(obj); } catch (Exception e) { } if (inline != null) { if (inline instanceof BaseResource) { ret.add((BaseResource) inline); } else if (inline instanceof BaseResources) { BaseResources entities = (BaseResources)inline; Method getter = EntityHelper.getCollectionGetter(entities); try { List<BaseResource> entitiesList = (List<BaseResource>) getter.invoke(entities); for (BaseResource entity : entitiesList) { ret.add(entity); } } catch (Exception e) { log.error( "Error invoking method '{}' on class '{}'.", method.getName(), entities.getClass().getSimpleName() ); log.error("Exception", e); } } else { ret.addAll(getInlineResources(inline)); } } } return ret; }
Source:
public void upsertWifiInfo(final Long accountId, final WifiInfo wifiInfo) { final Optional<DeviceAccountPair> deviceAccountPairOptional = deviceDAO.getMostRecentSensePairByAccountId(accountId); if (deviceAccountPairOptional.isPresent()) { final String mostRecentlyPairedSenseId = deviceAccountPairOptional.get().externalDeviceId; if (mostRecentlyPairedSenseId.equals(wifiInfo.senseId)) { wifiInfoDAO.put(wifiInfo); } else { LOGGER.debug("Account attempted to update wifi info for not sense but the most recently paired sense is {}", accountId, wifiInfo.senseId, mostRecentlyPairedSenseId); } } }

Target:
public Boolean upsertWifiInfo(final Long accountId, final WifiInfo wifiInfo) throws InvalidWifiInfoException { final Optional<DeviceAccountPair> deviceAccountPairOptional = deviceDAO.getMostRecentSensePairByAccountId(accountId); if (deviceAccountPairOptional.isPresent()) { final String mostRecentlyPairedSenseId = deviceAccountPairOptional.get().externalDeviceId; if (mostRecentlyPairedSenseId.equals(wifiInfo.senseId)) { return wifiInfoDAO.put(wifiInfo); } LOGGER.debug("Account attempted to update wifi info for sense but the most recently paired sense is {}", accountId, wifiInfo.senseId, mostRecentlyPairedSenseId); throw new InvalidWifiInfoException(String.format("Mismatch account id from token and input object")); } throw new InvalidWifiInfoException(String.format("No associated account found for sense %s", wifiInfo.senseId)); }
Source:
public void returnsEmptyIteratorOnInvalidPartRequest() throws IOException { final Request req = create( Joiner.on(CR).join( "Content-Disposition: form-data; name=\"address\"", "", "443 N Wolfe Rd, Sunnyvale, CA 94085", "Content-Disposition: form-data; name=\"data\"; filename=\"a.zip\"" ) ); final RqMultipart multi = new RqMultipart(req); MatcherAssert.assertThat( multi.part("fake").iterator().hasNext(), Matchers.is(false) ); }

Target:
public void returnsEmptyIteratorOnInvalidPartRequest() throws IOException { final Request req = create( Joiner.on(CR).join( "Content-Disposition: form-data; name=\"address\"", "", "443 N Wolfe Rd, Sunnyvale, CA 94085" ), "Content-Disposition: form-data; name=\"data\"; filename=\"a.zip\"" ); final RqMultipart multi = new RqMultipart(req); MatcherAssert.assertThat( multi.part("fake").iterator().hasNext(), Matchers.is(false) ); }
Source:
public HiveShellContainer evaluateStatement(List<? extends Script> scripts, Object target, Path temporaryFolder, Statement base) throws Throwable { container = null; File temporaryFile = temporaryFolder.toFile(); if (Files.notExists(temporaryFolder)) { temporaryFile = new File(temporaryFolder.toString()); temporaryFile.mkdirs(); } FileUtil.setPermission(temporaryFile, FsPermission.getDirDefault()); try { LOGGER.info("Setting up in {}", getName(), temporaryFolder.getRoot()); container = createHiveServerContainer(scripts, target, temporaryFolder); base.evaluate(); return container; } finally { tearDown(); } }

Target:
public HiveShellContainer evaluateStatement(List<? extends Script> scripts, Object target, Path temporaryFolder, Statement base) throws Throwable { container = null; File temporaryFile = temporaryFolder.toFile(); if (!temporaryFile.exists()) { temporaryFile.mkdirs(); } FileUtil.setPermission(temporaryFile, FsPermission.getDirDefault()); try { LOGGER.info("Setting up in {}", getName(), temporaryFolder.getRoot()); container = createHiveServerContainer(scripts, target, temporaryFolder); base.evaluate(); return container; } finally { tearDown(); } }
Source:
private ChoiceBuilder(Class<?> clazz, Signature signature) { this.clazz = clazz; this.signature = requireNonNull(signature, "signature is null"); }

Target:
private ChoiceBuilder(Class<?> clazz, Signature signature) { this.clazz = requireNonNull(clazz, "clazz is null"); this.signature = requireNonNull(signature, "signature is null"); }
Source:
public void should_pass_if_size_of_actual_is_greater_than_expected_size() { strings.assertHasSizeLessThanOrEqualTo(someInfo(), "Han", 3); }

Target:
public void should_pass_if_size_of_actual_is_greater_than_expected_size() { strings.assertHasSizeGreaterThanOrEqualTo(someInfo(), "Han", 2); }
Source:
public void testWeldStandaloneInitialisation() throws Exception { WeldContainer weld = new Weld().initialize(); CDITestingBean testedBean = weld.instance().select(CDITestingBean.class).get(); testedBean.putValueInCache("test", "abcd"); String retrievedValue = testedBean.getValueFromCache("test"); assertEquals(retrievedValue, "abcd"); weld.shutdown(); }

Target:
public void testWeldStandaloneInitialisation() throws Exception { WeldContainer weld = null; try { weld = new Weld().initialize(); CDITestingBean testedBean = weld.instance().select(CDITestingBean.class).get(); testedBean.putValueInCache("test", "abcd"); String retrievedValue = testedBean.getValueFromCache("test"); assertEquals(retrievedValue, "abcd"); } finally { if(weld != null) { weld.shutdown(); } } }
Source:
public SavingsTransaction applyFeeToSavingsAccount(String accountId, String amount, String notes) throws MambuApiException { if (accountId == null || accountId.trim().isEmpty()) { throw new IllegalArgumentException("Account ID must not be null or empty"); } ParamsMap paramsMap = new ParamsMap(); paramsMap.addParam(TYPE, TYPE_FEE); paramsMap.addParam(AMOUNT, amount); paramsMap.addParam(NOTES, notes); String urlString = new String(mambuAPIService.createUrl(SAVINGS + "/" + accountId + "/" + TRANSACTIONS)); String jsonResponse = mambuAPIService.executeRequest(urlString, paramsMap, Method.POST); SavingsTransaction transaction = GsonUtils.createGson().fromJson(jsonResponse, SavingsTransaction.class); return transaction; }

Target:
public SavingsTransaction applyFeeToSavingsAccount(String accountId, String amount, String notes) throws MambuApiException { if (accountId == null || accountId.trim().isEmpty()) { throw new IllegalArgumentException("Account ID must not be null or empty"); } if (amount == null || amount.trim().isEmpty()) { throw new IllegalArgumentException("Amount must not be null or empty"); } ParamsMap paramsMap = new ParamsMap(); paramsMap.addParam(TYPE, TYPE_FEE); paramsMap.addParam(AMOUNT, amount); paramsMap.addParam(NOTES, notes); String urlString = new String(mambuAPIService.createUrl(SAVINGS + "/" + accountId + "/" + TRANSACTIONS)); String jsonResponse = mambuAPIService.executeRequest(urlString, paramsMap, Method.POST); SavingsTransaction transaction = GsonUtils.createGson().fromJson(jsonResponse, SavingsTransaction.class); return transaction; }
Source:
public void testClarifiedExceptionsForUnsupportedClassTypes() { class LocalClass implements DataSerializable { @Override public void writeData(ObjectDataOutput out) { } @Override public void readData(ObjectDataInput in) { } } DataSerializable anonymousInstance = new DataSerializable() { @Override public void writeData(ObjectDataOutput out) { } @Override public void readData(ObjectDataInput in) { } }; DataSerializable[] throwingInstances = {new LocalClass(), anonymousInstance, new NonStaticMemberClass()}; for (DataSerializable throwingInstance : throwingInstances) { try { ss.toObject(ss.toData(throwingInstance)); } catch (HazelcastSerializationException e) { assertTrue(e.getCause() instanceof NoSuchMethodException); assertTrue(e.getCause().getMessage().contains("can't conform to DataSerializable")); assertTrue(e.getCause().getCause() instanceof NoSuchMethodException); continue; } fail("deserialization is expected to fail"); } for (DataSerializable throwingInstance : throwingInstances) { try { ss.toObject(ss.toData(throwingInstance), throwingInstance.getClass()); } catch (HazelcastSerializationException e) { assertTrue(e.getCause() instanceof InstantiationException); assertTrue(e.getCause().getMessage().contains("can't conform to DataSerializable")); assertTrue(e.getCause().getCause() instanceof InstantiationException); continue; } fail("deserialization is expected to fail"); } }

Target:
public void testClarifiedExceptionsForUnsupportedClassTypes() { class LocalClass implements DataSerializable { @Override public void writeData(ObjectDataOutput out) { } @Override public void readData(ObjectDataInput in) { } } DataSerializable anonymousInstance = new DataSerializable() { @Override public void writeData(ObjectDataOutput out) { } @Override public void readData(ObjectDataInput in) { } }; DataSerializable[] throwingInstances = {new LocalClass(), anonymousInstance, new NonStaticMemberClass()}; for (DataSerializable throwingInstance : throwingInstances) { try { ss.toObject(ss.toData(throwingInstance)); } catch (HazelcastSerializationException e) { assertInstanceOf(NoSuchMethodException.class, e.getCause()); assertContains(e.getCause().getMessage(), "can't conform to DataSerializable"); assertInstanceOf(NoSuchMethodException.class, e.getCause().getCause()); continue; } fail("deserialization of '" + throwingInstance.getClass() + "' is expected to fail"); } for (DataSerializable throwingInstance : throwingInstances) { try { ss.toObject(ss.toData(throwingInstance), throwingInstance.getClass()); } catch (HazelcastSerializationException e) { assertInstanceOf(InstantiationException.class, e.getCause()); assertContains(e.getCause().getMessage(), "can't conform to DataSerializable"); assertInstanceOf(InstantiationException.class, e.getCause().getCause()); continue; } fail("deserialization of '" + throwingInstance.getClass() + "' is expected to fail"); } }
Source:
public Map<String, Object> saveNewQuestion( @RequestBody QuestionPayload payLoad) { final QuestionDto questionDto = payLoad.getQuestion(); final Map<String, Object> response = new HashMap<String, Object>(); List<QuestionOptionDto> qoResults = new ArrayList<QuestionOptionDto>(); QuestionDto dto = null; RestStatusDto statusDto = new RestStatusDto(); statusDto.setStatus("failed"); statusDto.setMessage("Cannot create question"); if (questionDto != null) { Question q = null; if (questionDto.getSourceId() == null) { q = newQuestion(questionDto); } else { q = copyQuestion(questionDto); } QuestionDtoMapper qdm = new QuestionDtoMapper(); dto = qdm.transform(q); statusDto.setStatus("ok"); statusDto.setMessage(""); if (q.getType() == Question.Type.OPTION) { Map<Integer, QuestionOption> qoMap = questionOptionDao.listOptionByQuestion(dto .getKeyId()); List<Long> qoList = new ArrayList<Long>(); for (QuestionOption qo : qoMap.values()) { QuestionOptionDto qoDto = new QuestionOptionDto(); BeanUtils.copyProperties(qo, qoDto, new String[] { "translationMap" }); qoDto.setKeyId(qo.getKey().getId()); qoList.add(qo.getKey().getId()); qoResults.add(qoDto); } dto.setQuestionOptions(qoList); } } response.put("meta", statusDto); response.put("questionOptions", qoResults); response.put("question", dto); return response; }

Target:
public Map<String, Object> saveNewQuestion( @RequestBody QuestionPayload payLoad) { final QuestionDto questionDto = payLoad.getQuestion(); final Map<String, Object> response = new HashMap<String, Object>(); List<QuestionOptionDto> qoResults = new ArrayList<QuestionOptionDto>(); QuestionDto dto = null; RestStatusDto statusDto = new RestStatusDto(); statusDto.setStatus("failed"); statusDto.setMessage("Cannot create question"); if (questionDto != null) { Question q = null; if (questionDto.getSourceId() == null) { q = newQuestion(questionDto); } else { q = copyQuestion(questionDto); } QuestionDtoMapper qdm = new QuestionDtoMapper(); dto = qdm.transform(q); statusDto.setStatus("ok"); statusDto.setMessage(""); qoResults = attachAnyOptions(dto); } response.put("meta", statusDto); response.put("questionOptions", qoResults); response.put("question", dto); return response; }
Source:
public boolean contains(long address) { int retryCount = 0; while (true) { try { StreamLogSegment segment = segmentManager.getStreamLogSegment(address); return segment.contains(address); } catch (ClosedSegmentException e) { log.warn("Segment channel closed by compactor, retry for another time."); if (retryCount++ == CLOSE_SEGMENT_EXCEPTION_RETRY) { throw e; } } } }

Target:
public boolean contains(long address) { StreamLogSegment segment = segmentManager.getStreamLogSegment(address); return segment.contains(address); }
Source:
public Iterable<ProcessorEntity> getEntitiesWithPartition(String partitionKey) { String partitionFilter = TableQuery.generateFilterCondition(this.PARTITION_KEY, TableQuery.QueryComparisons.EQUAL, partitionKey); TableQuery<ProcessorEntity> partitionQuery = TableQuery.from(ProcessorEntity.class).where(partitionFilter); return table.execute(partitionQuery); }

Target:
public Iterable<ProcessorEntity> getEntitiesWithPartition(String partitionKey) { String partitionFilter = TableQuery.generateFilterCondition(PARTITION_KEY, TableQuery.QueryComparisons.EQUAL, partitionKey); TableQuery<ProcessorEntity> partitionQuery = TableQuery.from(ProcessorEntity.class).where(partitionFilter); return table.execute(partitionQuery); }
Source:
public void testDelayedAuditWithMultipleBookieFailures() throws Exception { LedgerHandle lh1 = createAndAddEntriesToLedger(); Long ledgerId = lh1.getId(); LOG.debug("Created ledger : " + ledgerId); ledgerList.add(ledgerId); lh1.close(); CountDownLatch underReplicaLatch = registerUrLedgerWatcher(ledgerList.size()); baseConf.setLostBookieRecoveryDelay(10); String shutdownBookie1 = shutDownNonAuditorBookie(); assertFalse("audit of lost bookie isn't delayed", underReplicaLatch.await(3, TimeUnit.SECONDS)); assertEquals("under replicated ledgers identified when it was not expected", 0, urLedgerList.size()); String shutdownBookie2 = shutDownNonAuditorBookie(); Thread.sleep(2000); assertTrue("Ledger is not marked as underreplicated:" + ledgerId, urLedgerList.contains(ledgerId)); Map<Long, String> urLedgerData = getUrLedgerData(urLedgerList); String data = urLedgerData.get(ledgerId); assertTrue("Bookie " + shutdownBookie1 + shutdownBookie2 + " are not listed in the ledger as missing replicas :" + data, data.contains(shutdownBookie1) && data.contains(shutdownBookie2)); }

Target:
public void testDelayedAuditWithMultipleBookieFailures() throws Exception { Thread.sleep(1000); LedgerHandle lh1 = createAndAddEntriesToLedger(); Long ledgerId = lh1.getId(); LOG.debug("Created ledger : " + ledgerId); ledgerList.add(ledgerId); lh1.close(); CountDownLatch underReplicaLatch = registerUrLedgerWatcher(ledgerList.size()); baseConf.setLostBookieRecoveryDelay(10); String shutdownBookie1 = shutDownNonAuditorBookie(); assertFalse("audit of lost bookie isn't delayed", underReplicaLatch.await(3, TimeUnit.SECONDS)); assertEquals("under replicated ledgers identified when it was not expected", 0, urLedgerList.size()); String shutdownBookie2 = shutDownNonAuditorBookie(); Thread.sleep(2000); assertTrue("Ledger is not marked as underreplicated:" + ledgerId, urLedgerList.contains(ledgerId)); Map<Long, String> urLedgerData = getUrLedgerData(urLedgerList); String data = urLedgerData.get(ledgerId); assertTrue("Bookie " + shutdownBookie1 + shutdownBookie2 + " are not listed in the ledger as missing replicas :" + data, data.contains(shutdownBookie1) && data.contains(shutdownBookie2)); }
Source:
protected NuxeoPrincipal getAuthor(DocumentModel docModel) { String author = null; if (docModel.hasSchema(COMMENT_SCHEMA)) { author = (String) docModel.getPropertyValue(COMMENT_AUTHOR); } else if (StringUtils.isEmpty(author)) { String[] contributors = (String[]) docModel.getProperty("dublincore", "contributors"); author = contributors[0]; } return Framework.getService(UserManager.class).getPrincipal(author); }

Target:
protected NuxeoPrincipal getAuthor(DocumentModel docModel) { String author = null; if (docModel.hasSchema(COMMENT_SCHEMA)) { author = (String) docModel.getPropertyValue(COMMENT_AUTHOR_PROPERTY); } if (StringUtils.isBlank(author)) { String[] contributors = (String[]) docModel.getPropertyValue("dc:contributors"); author = contributors[0]; } NuxeoPrincipal principal = Framework.getService(UserManager.class).getPrincipal(author); if (principal == null) { log.debug("Principal not found: {}", author); } return principal; }
Source:
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int w = MeasureSpec.getSize(widthMeasureSpec); int h = MeasureSpec.getSize(heightMeasureSpec); if(w == 0 || h == 0) { w = Math.max(w, h); } else { w = Math.min(w, h); } h = w; setMeasuredDimension(w,w); }

Target:
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int canvasWidth = MeasureSpec.getSize(widthMeasureSpec); int canvasHeight = MeasureSpec.getSize(heightMeasureSpec); int squareCanvasDimension = Math.min(canvasWidth, canvasHeight); if (squareCanvasDimension <= 0) { squareCanvasDimension = Math.max(canvasWidth, canvasHeight); } setMeasuredDimension(squareCanvasDimension, squareCanvasDimension); }
Source:
public void publishKeyPressedShort(String id) { for (AKM868BindingProvider provider : providers) { for (String itemName : provider.getItemNames()) { if (provider.getId(itemName).equals(id) && provider.getChannel(itemName).equals("1")) { logger.debug("Publishing state for: "+itemName+" -state: ON"); eventPublisher.postUpdate(itemName, OnOffType.ON ); } } } }

Target:
public void publishKeyPressedShort(String id) { for (AKM868BindingProvider provider : providers) { for (String itemName : provider.getItemNames()) { if (provider.getId(itemName).equals(id) && provider.getChannel(itemName).equals("1")) { logger.debug("Publishing state for -state: ON",itemName); eventPublisher.postUpdate(itemName, OnOffType.ON ); } } } }
Source:
protected void cancel() { setWindow(null); setConfirmWindow(null); }

Target:
protected void cancel() { setWindow(null); }
Source:
public void testRealBbcTxlogRegularExamples() { assertTxlogNitroScore("THE HOUSING ENFORCERS", "Episode 2", "The Housing Enforcers", scoreOnMatch); assertTxlogNitroScore("!MPOSSIBLE", "Episode 7", "Impossible", scoreOnMismatch); }

Target:
public void testRealBbcTxlogRegularExamples() { assertTxlogNitroScore("THE HOUSING ENFORCERS", "Episode 2", "The Housing Enforcers", scoreOnMatch); }
Source:
public Boolean isPasswordEnabled() { return passwordEnabled; }

Target:
public boolean isPasswordEnabled() { return passwordEnabled == null ? false : passwordEnabled; }
Source:
public void addBreakpoint(Breakpoint breakpoint) throws DebuggerException { try { Location location = breakpoint.getLocation(); pendingBreakpoints.add(location); library.setBreakpoint(location.getTarget(), location.getLineNumber()); debuggerCallback.onEvent(new BreakpointActivatedEventImpl(breakpoint)); } catch (NodeJsDebuggerTerminatedException e) { disconnect(); throw e; } catch (NodeJsDebuggerException e) { throw new DebuggerException("Can't add breakpoint: " + breakpoint + ". " + e.getMessage(), e); } }

Target:
public void addBreakpoint(Breakpoint breakpoint) throws DebuggerException { try { Location location = breakpoint.getLocation(); library.setBreakpoint(location.getTarget(), location.getLineNumber()); debuggerCallback.onEvent(new BreakpointActivatedEventImpl(breakpoint)); } catch (NodeJsDebuggerTerminatedException e) { disconnect(); throw e; } catch (NodeJsDebuggerException e) { throw new DebuggerException("Can't add breakpoint: " + breakpoint + ". " + e.getMessage(), e); } }
Source:
public void resourceChanged(IResourceChangeEvent event) { if(!active) { return; } if (event.getType() == IResourceChangeEvent.PRE_CLOSE && event.getResource() != null && event.getResource().getType() == IResource.PROJECT) { final IProject project = (IProject) event.getResource(); try { final JaxrsMetamodel metamodel = JaxrsMetamodelLocator.get(project); if (metamodel != null) { synchronized(metamodel) { Logger.debug("Removing JAX-RS Metamodel before closing project " + project.getName()); metamodel.remove(); } } } catch (CoreException e) { Logger.error("Error while removing JAX-RS Metamodel", e); } } }

Target:
public void resourceChanged(IResourceChangeEvent event) { if(!active) { return; } if (event.getType() == IResourceChangeEvent.PRE_CLOSE && event.getResource() != null && event.getResource().getType() == IResource.PROJECT) { final IProject project = (IProject) event.getResource(); try { final JaxrsMetamodel metamodel = JaxrsMetamodelLocator.get(project); if (metamodel != null) { Logger.debug("Removing JAX-RS Metamodel before closing project " + project.getName()); metamodel.remove(); } } catch (CoreException e) { Logger.error("Error while removing JAX-RS Metamodel", e); } } }
Source:
public List<ChartSeries> getChartSeries() { return checkNotNull(ImmutableList.copyOf(fSeries)); }

Target:
public List<ChartSeries> getChartSeries() { return fSeries; }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } BytesValues that = (BytesValues) o; return values.length == that.values.length && nullAllowed == that.nullAllowed && deepEquals(values, that.values); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } BytesValues that = (BytesValues) o; return nullAllowed == that.nullAllowed && Arrays.deepEquals(values, that.values); }
Source:
private int getUnixFileMode(final String pathAsString) { final Path path = Paths.get(pathAsString); if (this.forcedFileMode != null) { return this.getModeValue(path); } try { int unixMode = (int) Files.getAttribute(path, "unix:mode"); if ("OS/390".equals(SystemUtils.OS_NAME) || "z/OS".equals(SystemUtils.OS_NAME) || "zOS".equals(SystemUtils.OS_NAME) ) { unixMode &= TarConstants.MAXID; unixMode |= Files.isDirectory(path) ? 040000 : 0100000; } return unixMode; } catch (IOException | UnsupportedOperationException e) { int mode = DEFAULT_FILE_MODE; if (Files.isDirectory(path)) { mode = DEFAULT_DIR_MODE; } else if (Files.isExecutable(path)) { mode |= 0111; } return mode; } }

Target:
private int getUnixFileMode(final String pathAsString) { final Path path = Paths.get(pathAsString); if (this.forcedFileMode != null) { return this.getModeValue(path); } return getUnixFileMode(path); }
Source:
public boolean getShowFastViewBars() { return getWindowConfigurer().getShowFastViewBars(); }

Target:
public boolean getShowFastViewBars() { return false; }
Source:
private MethodReference getFactoryMethod(List<MapperReference> mapperReferences, List<SourceMethod> methods, Type returnType) { MethodReference result = null; for ( SourceMethod method : methods ) { if ( !method.requiresImplementation() && !method.isIterableMapping() && !method.isMapMapping() && method.getSourceParameters().size() == 0 ) { List<Type> paramterTypes = MethodSelectors.getParameterTypes( typeFactory, method.getParameters(), null, returnType ); if ( ( paramterTypes.isEmpty() && method.getReturnType().equals( returnType ) ) || method.matches( paramterTypes, returnType ) ) { if ( result == null ) { MapperReference mapperReference = findMapperReference( mapperReferences, method ); result = new MethodReference( method, mapperReference, SourceMethod.containsTargetTypeParameter( method.getParameters() ) ? returnType : null ); } else { messager.printMessage( Kind.ERROR, String.format( "Ambiguous factory methods: \"%s\" conflicts with \"%s\".", result, method ), method.getExecutable() ); } } } } return result; }

Target:
private MethodReference getFactoryMethod(List<MapperReference> mapperReferences, List<SourceMethod> methods, Type returnType) { MethodReference result = null; for ( SourceMethod method : methods ) { if ( !method.requiresImplementation() && !method.isIterableMapping() && !method.isMapMapping() && method.getSourceParameters().size() == 0 ) { List<Type> parameterTypes = MethodSelectors.getParameterTypes( typeFactory, method.getParameters(), null, returnType ); if ( method.matches( parameterTypes, returnType ) ) { if ( result == null ) { MapperReference mapperReference = findMapperReference( mapperReferences, method ); result = new MethodReference( method, mapperReference, null ); } else { messager.printMessage( Kind.ERROR, String.format( "Ambiguous factory methods: \"%s\" conflicts with \"%s\".", result, method ), method.getExecutable() ); } } } } return result; }
Source:
public void testStorage1() throws Exception { HashMapDB<byte[]> stateDb = new HashMapDB<>(); RepositoryRoot repo = new RepositoryRoot(stateDb, null); byte[] addr1 = decode("aaaa"); repo.createAccount(addr1); repo.addStorageRow(addr1, DataWord.of(1), DataWord.of(111)); repo.commit(); byte[] root1 = repo.getRoot(); System.out.println(repo.dumpStateTrie()); RepositoryRoot repo2 = new RepositoryRoot(stateDb, root1); DataWord val1 = repo.getStorageValue(addr1, DataWord.of(1)); assert DataWord.of(111).equals(val1); Repository repo3 = repo2.startTracking(); repo3.addStorageRow(addr1, DataWord.of(2), DataWord.of(222)); repo3.addStorageRow(addr1, DataWord.of(1), DataWord.of(333)); assert DataWord.of(333).equals(repo3.getStorageValue(addr1, DataWord.of(1))); assert DataWord.of(222).equals(repo3.getStorageValue(addr1, DataWord.of(2))); assert DataWord.of(111).equals(repo2.getStorageValue(addr1, DataWord.of(1))); Assert.assertNull(repo2.getStorageValue(addr1, DataWord.of(2))); repo3.commit(); assert DataWord.of(333).equals(repo2.getStorageValue(addr1, DataWord.of(1))); assert DataWord.of(222).equals(repo2.getStorageValue(addr1, DataWord.of(2))); repo2.commit(); RepositoryRoot repo4 = new RepositoryRoot(stateDb, repo2.getRoot()); assert DataWord.of(333).equals(repo4.getStorageValue(addr1, DataWord.of(1))); assert DataWord.of(222).equals(repo4.getStorageValue(addr1, DataWord.of(2))); }

Target:
public void testStorage1() throws Exception { HashMapDB<byte[]> stateDb = new HashMapDB<>(); RepositoryRoot repo = new RepositoryRoot(stateDb, null); byte[] addr1 = decode("aaaa"); repo.createAccount(addr1); repo.addStorageRow(addr1, DataWord.ONE, DataWord.of(111)); repo.commit(); byte[] root1 = repo.getRoot(); System.out.println(repo.dumpStateTrie()); RepositoryRoot repo2 = new RepositoryRoot(stateDb, root1); DataWord val1 = repo.getStorageValue(addr1, DataWord.ONE); assert DataWord.of(111).equals(val1); Repository repo3 = repo2.startTracking(); repo3.addStorageRow(addr1, DataWord.of(2), DataWord.of(222)); repo3.addStorageRow(addr1, DataWord.ONE, DataWord.of(333)); assert DataWord.of(333).equals(repo3.getStorageValue(addr1, DataWord.ONE)); assert DataWord.of(222).equals(repo3.getStorageValue(addr1, DataWord.of(2))); assert DataWord.of(111).equals(repo2.getStorageValue(addr1, DataWord.ONE)); Assert.assertNull(repo2.getStorageValue(addr1, DataWord.of(2))); repo3.commit(); assert DataWord.of(333).equals(repo2.getStorageValue(addr1, DataWord.ONE)); assert DataWord.of(222).equals(repo2.getStorageValue(addr1, DataWord.of(2))); repo2.commit(); RepositoryRoot repo4 = new RepositoryRoot(stateDb, repo2.getRoot()); assert DataWord.of(333).equals(repo4.getStorageValue(addr1, DataWord.ONE)); assert DataWord.of(222).equals(repo4.getStorageValue(addr1, DataWord.of(2))); }
Source:
public void run() { ILogger logger = getLogger(); InternalPartitionServiceImpl partitionService = getService(); if (!partitionService.areMigrationTasksAllowed()) { if (logger.isFinestEnabled()) { logger.finest("Migration is paused! Cannot process request. partitionId=" + getPartitionId() + ", replicaIndex=" + getReplicaIndex() + ", namespaces=" + namespaces); } sendRetryResponse(); return; } final int permits = acquirePermits(); if (permits == 0) { if (logger.isFinestEnabled()) { logger.finest("Not enough permits available! Cannot process request. partitionId=" + getPartitionId() + ", replicaIndex=" + getReplicaIndex() + ", namespaces=" + namespaces); } sendRetryResponse(); return; } sendOperationsForNamespaces(permits); if (!namespaces.isEmpty()) { if (logger.isFinestEnabled()) { logger.finest("Not enough permits available! Cannot process request. partitionId=" + getPartitionId() + ", replicaIndex=" + getReplicaIndex() + ", namespaces=" + namespaces); } sendRetryResponse(); } }

Target:
public void run() { InternalPartitionServiceImpl partitionService = getService(); if (!partitionService.areMigrationTasksAllowed()) { ILogger logger = getLogger(); if (logger.isFinestEnabled()) { logger.finest("Migration is paused! Cannot process request. partitionId=" + getPartitionId() + ", replicaIndex=" + getReplicaIndex() + ", namespaces=" + namespaces); } sendRetryResponse(); return; } if (!checkPartitionOwner()) { sendRetryResponse(); return; } int permits = partitionService.getReplicaManager().tryAcquireReplicaSyncPermits(namespaces.size()); if (permits == 0) { logNotEnoughPermits(); sendRetryResponse(); return; } sendOperationsForNamespaces(permits); if (!namespaces.isEmpty()) { logNotEnoughPermits(); sendRetryResponse(); } }
Source:
private Object invertGeometryCoordinates(Geometry geometry) throws TransformException { return transformer.transform(geometry); }

Target:
private Geometry invertGeometryCoordinates(Geometry geometry) throws TransformException { return transformer.transform(geometry); }
Source:
public void testAddAdminUnit() throws Exception { String label = "admin_label"; MvcResult result = mvc.perform(post("/edit/create/adminUnit/" + CONTENT_ROOT_ID) .param("label", label) .param("patronOnly", (String) null)) .andExpect(status().is2xxSuccessful()) .andReturn(); treeIndexer.indexAll(baseAddress); assertChildContainerAdded(contentRoot, label, AdminUnit.class); Map<String, Object> respMap = getMapFromResponse(result); assertEquals(CONTENT_ROOT_ID, respMap.get("pid")); assertEquals("create", respMap.get("action")); }

Target:
public void testAddAdminUnit() throws Exception { String label = "admin_label"; MvcResult result = mvc.perform(post("/edit/create/adminUnit/" + CONTENT_ROOT_ID) .param("label", label)) .andExpect(status().is2xxSuccessful()) .andReturn(); treeIndexer.indexAll(baseAddress); assertChildContainerAdded(contentRoot, label, AdminUnit.class); Map<String, Object> respMap = getMapFromResponse(result); assertEquals(CONTENT_ROOT_ID, respMap.get("pid")); assertEquals("create", respMap.get("action")); assertPatronDoesNotHaveNonePermission(contentRoot, label); }
Source:
public void eventDispatched(IResumedDMEvent e) { if (e instanceof IContainerResumedDMEvent) { fCommandCache.setContextAvailable(e.getDMContext(), false); } if (e.getReason() != StateChangeReason.STEP) { IMemoryDMContext memoryDMC = DMContexts.getAncestorOfType(e.getDMContext(), IMemoryDMContext.class); if (memoryDMC != null) { fCommandCache.reset(memoryDMC); for (IMemoryDMContext ctx : fMemoryCaches.keySet() ) { if (ctx.equals(memoryDMC) || DMContexts.isAncestorOf(ctx, memoryDMC)) { fMemoryCaches.get(ctx).reset(); } } } } }

Target:
public void eventDispatched(IResumedDMEvent e) { if (e instanceof IContainerResumedDMEvent) { fCommandCache.setContextAvailable(e.getDMContext(), false); } if (e.getReason() != StateChangeReason.STEP) { IMemoryDMContext memoryDMC = DMContexts.getAncestorOfType(e.getDMContext(), IMemoryDMContext.class); if (memoryDMC != null) { fCommandCache.reset(memoryDMC); memoryCacheReset(memoryDMC); } } }
Source:
public static void main(String[] args) { LOGGER.info("Use superpower: sky launch"); Superpower skyLaunch = new SkyLaunch(); skyLaunch.activate(); LOGGER.info("Use superpower: ground dive"); Superpower groundDive = new GroundDive(); groundDive.activate(); }

Target:
public static void main(String[] args) { LOGGER.info("Use superpower: sky launch"); var skyLaunch = new SkyLaunch(); skyLaunch.activate(); LOGGER.info("Use superpower: ground dive"); var groundDive = new GroundDive(); groundDive.activate(); }
Source:
public void onResponse(Frame responseFrame) { if (timeoutFuture != null) { timeoutFuture.cancel(true); } Message message = responseFrame.message; LOG.debug("[{}] Got response {}", logPrefix, responseFrame.message); if (message instanceof Rows) { Rows rows = (Rows) message; ByteBuffer pagingState = rows.getMetadata().pagingState; AdminRequestHandler nextHandler = (pagingState == null) ? null : this.copy(pagingState); setFinalResult(new AdminResult(rows, nextHandler, channel.protocolVersion())); } else if (message instanceof Prepared || message instanceof com.datastax.oss.protocol.internal.response.result.Void) { setFinalResult(null); } else { setFinalError(new UnexpectedResponseException(debugString, message)); } }

Target:
public void onResponse(Frame responseFrame) { if (timeoutFuture != null) { timeoutFuture.cancel(true); } Message message = responseFrame.message; LOG.debug("[{}] Got response {}", logPrefix, responseFrame.message); if (message instanceof Rows) { Rows rows = (Rows) message; ByteBuffer pagingState = rows.getMetadata().pagingState; AdminRequestHandler nextHandler = (pagingState == null) ? null : this.copy(pagingState); setFinalResult(new AdminResult(rows, nextHandler, channel.protocolVersion())); } else if (message instanceof Result) { setFinalResult(null); } else { setFinalError(new UnexpectedResponseException(debugString, message)); } }
Source:
public void applyOpenKey(KeyArgs omKeyArgs, KeyInfo keyInfo, long clientID) throws IOException { if(isAclEnabled) { checkAcls(ResourceType.KEY, StoreType.OZONE, ACLType.READ, omKeyArgs.getVolumeName(), omKeyArgs.getBucketName(), omKeyArgs.getKeyName()); } boolean auditSuccess = true; try { keyManager.applyOpenKey(omKeyArgs, keyInfo, clientID); } catch (Exception ex) { metrics.incNumKeyAllocateFails(); auditSuccess = false; AUDIT.logWriteFailure(buildAuditMessageForFailure( OMAction.APPLY_ALLOCATE_KEY, (omKeyArgs == null) ? null : toAuditMap(omKeyArgs), ex)); throw ex; } finally { if(auditSuccess){ AUDIT.logWriteSuccess(buildAuditMessageForSuccess( OMAction.ALLOCATE_KEY, (omKeyArgs == null) ? null : toAuditMap(omKeyArgs))); } } }

Target:
public void applyOpenKey(KeyArgs omKeyArgs, KeyInfo keyInfo, long clientID) throws IOException { if(isAclEnabled) { checkAcls(ResourceType.KEY, StoreType.OZONE, ACLType.READ, omKeyArgs.getVolumeName(), omKeyArgs.getBucketName(), omKeyArgs.getKeyName()); } boolean auditSuccess = true; try { keyManager.applyOpenKey(omKeyArgs, keyInfo, clientID); } catch (Exception ex) { metrics.incNumKeyAllocateFails(); auditSuccess = false; AUDIT.logWriteFailure(buildAuditMessageForFailure( OMAction.APPLY_ALLOCATE_KEY, (omKeyArgs == null) ? null : toAuditMap(omKeyArgs), ex)); throw ex; } finally { if(auditSuccess){ AUDIT.logWriteSuccess(buildAuditMessageForSuccess( OMAction.APPLY_ALLOCATE_KEY, (omKeyArgs == null) ? null : toAuditMap(omKeyArgs))); } } }