auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Object visitGetAllCommand(InvocationContext ctx, GetAllCommand command) throws Throwable { if (command.hasAnyFlag(FlagBitSets.CACHE_MODE_LOCAL | FlagBitSets.SKIP_REMOTE_LOOKUP)) { return invokeNext(ctx, command); } if (!ctx.isOriginLocal()) { for (Object key : command.getKeys()) { if (ctx.lookupEntry(key) == null) { return UnsureResponse.INSTANCE; } } return invokeNext(ctx, command); } LocalizedCacheTopology cacheTopology = checkTopologyId(command); Map<Address, List<Object>> requestedKeys = getKeysByOwner(ctx, command.getKeys(), cacheTopology, null, null); if (requestedKeys.isEmpty()) { return invokeNext(ctx, command); } GlobalTransaction gtx = ctx.isInTxScope() ? ((TxInvocationContext) ctx).getGlobalTransaction() : null; ClusteredGetAllFuture allFuture = new ClusteredGetAllFuture(requestedKeys.size(), command); for (Map.Entry<Address, List<Object>> pair : requestedKeys.entrySet()) { ClusteredGetAllCommand clusteredGetAllCommand = cf.buildClusteredGetAllCommand(pair.getValue(), command.getFlagsBitSet(), gtx); clusteredGetAllCommand.setTopologyId(command.getTopologyId()); Set<Address> target = Collections.singleton(pair.getKey()); rpcManager.invokeRemotelyAsync(target, clusteredGetAllCommand, syncIgnoreLeavers) .whenComplete(new ClusteredGetAllHandler(allFuture, ctx, command, pair.getValue(), target)); } return asyncValue(handleRemotelyRetrievedKeys(ctx, allFuture, allFuture)).thenApply(ctx, command, allFuture); }

Target:
public Object visitGetAllCommand(InvocationContext ctx, GetAllCommand command) throws Throwable { if (command.hasAnyFlag(FlagBitSets.CACHE_MODE_LOCAL | FlagBitSets.SKIP_REMOTE_LOOKUP)) { return invokeNext(ctx, command); } if (!ctx.isOriginLocal()) { for (Object key : command.getKeys()) { if (ctx.lookupEntry(key) == null) { return UnsureResponse.INSTANCE; } } return invokeNext(ctx, command); } LocalizedCacheTopology cacheTopology = checkTopologyId(command); Map<Address, List<Object>> requestedKeys = getKeysByOwner(ctx, command.getKeys(), cacheTopology, null, null); if (requestedKeys.isEmpty()) { return invokeNext(ctx, command); } GlobalTransaction gtx = ctx.isInTxScope() ? ((TxInvocationContext) ctx).getGlobalTransaction() : null; ClusteredGetAllFuture allFuture = new ClusteredGetAllFuture(requestedKeys.size(), command); for (Map.Entry<Address, List<Object>> pair : requestedKeys.entrySet()) { ClusteredGetAllCommand clusteredGetAllCommand = cf.buildClusteredGetAllCommand(pair.getValue(), command.getFlagsBitSet(), gtx); clusteredGetAllCommand.setTopologyId(command.getTopologyId()); rpcManager.invokeRemotelyAsync(Collections.singleton(pair.getKey()), clusteredGetAllCommand, syncIgnoreLeavers) .whenComplete(new ClusteredGetAllHandler(pair.getKey(), allFuture, ctx, command, pair.getValue(), null)); } return asyncValue(allFuture).thenApply(ctx, command, allFuture); }
Source:
protected boolean wordMatches(String text) { if (text != null) { if (fMatchers == null || fMatchers.length == 0) { return true; } for (StringMatcher fMatcher : fMatchers) { if (fMatcher.match(text)) { return true; } } } return false; }

Target:
protected boolean wordMatches(String text) { if (text != null) { if (fMatchers == null || fMatchers.length == 0) { return true; } for (StringMatcher matcher : fMatchers) { if (matcher.match(text)) { return true; } } } return false; }
Source:
public void testOnlyReduceTaskRun() throws Exception { ScriptingManager scriptingManager = getScriptingManager(manager(0)); Cache<String, String> cache = cache(0); loadData(cache, "/macbeth.txt"); loadScript(scriptingManager, "/wordCountReducer.js"); CompletableFuture<Object> future = scriptingManager.runScript("wordCountReducer.js", new TaskContext().cache(cache)); }

Target:
public void testOnlyReduceTaskRun() throws Exception { ScriptingManager scriptingManager = getScriptingManager(manager(0)); Cache<String, String> cache = cache(0); loadData(cache, "/macbeth.txt"); loadScript(scriptingManager, "/wordCountReducer.js"); scriptingManager.runScript("wordCountReducer.js", new TaskContext().cache(cache)); }
Source:
public void viewTest() { onView(withId(R.id.faceView)).check(matches(isDisplayed())); activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); onView(withId(R.id.faceView)).check(matches(isDisplayed())); activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); onView(withId(R.id.eyeView)).check(matches(isDisplayed())); activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); onView(withId(R.id.eyeView)).check(matches(isDisplayed())); activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); onView(withId(R.id.hairView)).check(matches(isDisplayed())); activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); onView(withId(R.id.hairView)).check(matches(isDisplayed())); activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); onView(withId(R.id.clothView)).check(matches(isDisplayed())); activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); onView(withId(R.id.clothView)).check(matches(isDisplayed())); activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); onView(withId(R.id.continueButton)).check(matches(isDisplayed())); activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); onView(withId(R.id.continueButton)).check(matches(isDisplayed())); activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); }

Target:
public void viewTest() { onView(withId(R.id.faceView)).check(matches(isDisplayed())); onView(withId(R.id.eyeView)).check(matches(isDisplayed())); onView(withId(R.id.hairView)).check(matches(isDisplayed())); onView(withId(R.id.clothView)).check(matches(isDisplayed())); onView(withId(R.id.continueButton)).check(matches(isDisplayed())); }
Source:
public void upgrade(User userEntity) { userEntity.getBuddies() .forEach(buddy -> buddy.setLastStatusChangeTime(buddy.getBuddyAnonymized().getLastStatusChangeTime())); }

Target:
public void upgrade(User userEntity) { userEntity.getBuddies().forEach(buddy -> upgradeBuddy(buddy)); }
Source:
private void findNegotiatingProfiles(ServletRequest req) { List<String> schemes = new ArrayList<String>(); if (profiles == null) { synchronized (this) { if (profiles == null) { schemes = new ArrayList<>(); profiles = new ArrayList<AuthenticationProfile>(1); long caps = 0; for (String nego : req.getServletContext().getInitParameter(CAPABILITIES_PARAMETER).trim().split("\\|")) { try { caps |= Authn.Capabilities.class.getField(nego).getInt(null); } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException ex) { } } for (AuthenticationProfile profile : AuthenticationProfileRepository.getInstance().getProfiles()) { if (profile != null) { ExtMap authnContext = profile.getAuthn().getContext(); if ((authnContext.<Long> get(Authn.ContextKeys.CAPABILITIES).longValue() & caps) != caps) { profiles.add(0, profile); } schemes.addAll(authnContext.<List<String>>get(Authn.ContextKeys.HTTP_AUTHENTICATION_SCHEME, Collections.<String>emptyList())); } } } } } ((HttpServletRequest) req).setAttribute(FiltersHelper.Constants.SCHEMES_KEY, schemes); }

Target:
private void findNegotiatingProfiles(ServletRequest req) { List<String> schemes = new ArrayList<String>(); if (profiles == null) { synchronized (this) { if (profiles == null) { schemes = new ArrayList<>(); profiles = new ArrayList<AuthenticationProfile>(1); for (AuthenticationProfile profile : AuthenticationProfileRepository.getInstance().getProfiles()) { if (profile != null) { ExtMap authnContext = profile.getAuthn().getContext(); if ((authnContext.<Long> get(Authn.ContextKeys.CAPABILITIES).longValue() & caps) != caps) { profiles.add(0, profile); } schemes.addAll(authnContext.<List<String>>get(Authn.ContextKeys.HTTP_AUTHENTICATION_SCHEME, Collections.<String>emptyList())); } } } } } ((HttpServletRequest) req).setAttribute(FiltersHelper.Constants.SCHEMES_KEY, schemes); }
Source:
public SqmRoot visitPathRoot(HqlParser.PathRootContext ctx) { final String name = ctx.entityName().fullNameText; log.debugf( "Handling root path - %s", name ); final EntityDomainType entityDescriptor = getCreationContext().getJpaMetamodel().resolveHqlEntityReference( name ); if ( name.equals( entityDescriptor.getHibernateEntityName() ) && getCreationOptions().useStrictJpaCompliance() ) { throw new StrictJpaComplianceViolation( "Encountered FQN entity name [" + name + "], but strict JPQL compliance was requested", StrictJpaComplianceViolation.Type.FQN_ENTITY_NAME ); } if ( entityDescriptor instanceof SqmPolymorphicRootDescriptor ) { if ( getCreationOptions().useStrictJpaCompliance() ) { throw new StrictJpaComplianceViolation( "Encountered unmapped polymorphic reference [" + entityDescriptor.getHibernateEntityName() + "], but strict JPQL compliance was requested", StrictJpaComplianceViolation.Type.UNMAPPED_POLYMORPHISM ); } if ( processingStateStack.depth() > 1 ) { throw new SemanticException( "Illegal implicit-polymorphic domain path in sub-query : " + entityDescriptor.getName() ); } } final String alias = visitIdentificationVariableDef( ctx.identificationVariableDef() ); final SqmRoot sqmRoot = new SqmRoot( entityDescriptor, alias, creationContext.getNodeBuilder() ); processingStateStack.getCurrent().getPathRegistry().register( sqmRoot ); return sqmRoot; }

Target:
public SqmRoot visitPathRoot(HqlParser.PathRootContext ctx) { final String name = ctx.entityName().fullNameText; log.debugf( "Handling root path - %s", name ); final EntityDomainType entityDescriptor = getCreationContext().getJpaMetamodel().resolveHqlEntityReference( name ); checkFQNEntityNameJpaComplianceViolationIfNeeded( name, entityDescriptor ); if ( entityDescriptor instanceof SqmPolymorphicRootDescriptor ) { if ( getCreationOptions().useStrictJpaCompliance() ) { throw new StrictJpaComplianceViolation( "Encountered unmapped polymorphic reference [" + entityDescriptor.getHibernateEntityName() + "], but strict JPQL compliance was requested", StrictJpaComplianceViolation.Type.UNMAPPED_POLYMORPHISM ); } if ( processingStateStack.depth() > 1 ) { throw new SemanticException( "Illegal implicit-polymorphic domain path in sub-query : " + entityDescriptor.getName() ); } } final String alias = visitIdentificationVariableDef( ctx.identificationVariableDef() ); final SqmRoot sqmRoot = new SqmRoot( entityDescriptor, alias, creationContext.getNodeBuilder() ); processingStateStack.getCurrent().getPathRegistry().register( sqmRoot ); return sqmRoot; }
Source:
protected void setResult(Collection<T> newUserSelection) { if (newUserSelection == null) { result = null; } else { result = newUserSelection; } }

Target:
protected void setResult(Collection<T> newUserSelection) { result = newUserSelection; }
Source:
public void onActivate(ActivateEvent event, EntityRef entity) { LASTeamComponent baseTeamComponent = entity.getComponent(LASTeamComponent.class); EntityRef player = event.getInstigator(); CharacterHeldItemComponent characterHeldItemComponent = player.getComponent(CharacterHeldItemComponent.class); if (characterHeldItemComponent != null) { EntityRef heldItem = characterHeldItemComponent.selectedItem; if (baseTeamComponent.team.equals(baseTeamComponent.RED) && heldItem.getComponent(BlockItemComponent.class).blockFamily.getURI().toString() .equalsIgnoreCase("LightAndShadowResources:BlackFlag")) { redScore++; } if (baseTeamComponent.team.equals(baseTeamComponent.BLACK) && heldItem.getComponent(BlockItemComponent.class).blockFamily.getURI().toString() .equalsIgnoreCase("LightAndShadowResources:RedFlag")) { blackScore++; } } }

Target:
public void onActivate(ActivateEvent event, EntityRef entity) { LASTeamComponent baseTeamComponent = entity.getComponent(LASTeamComponent.class); EntityRef player = event.getInstigator(); CharacterHeldItemComponent characterHeldItemComponent = player.getComponent(CharacterHeldItemComponent.class); if (characterHeldItemComponent != null) { EntityRef heldItem = characterHeldItemComponent.selectedItem; if (baseTeamComponent.team.equals(LASUtils.RED_TEAM) && heldItem.getComponent(BlockItemComponent.class).blockFamily.getURI().toString().equals(LASUtils.BLACK_FLAG_URI)) { redScore++; } if (baseTeamComponent.team.equals(LASUtils.BLACK_TEAM) && heldItem.getComponent(BlockItemComponent.class).blockFamily.getURI().toString().equals(LASUtils.RED_FLAG_URI)) { blackScore++; } } }
Source:
private static File zip(String component, String... files) { try { File temporaryZip = Files.createTempFile("tmp", null).toFile(); try (FileOutputStream fos = new FileOutputStream(temporaryZip); ZipOutputStream zos = new ZipOutputStream(fos)) { zos.putNextEntry(new ZipEntry(component + "/")); zos.closeEntry(); for (String file : files) { String entryName = component + "/" + file; zos.putNextEntry(new ZipEntry(entryName)); String filePath = String.format("components/" + entryName); try (InputStream in = ComponentZipUtil.class.getClassLoader().getResourceAsStream(filePath)) { IOUtils.copy(in, zos); } zos.closeEntry(); } } return temporaryZip; } catch (IOException ex) { throw new RuntimeException(ex); } }

Target:
private static File zip(String component, String... files) { try { File temporaryZip = Files.createTempFile("tmp", null).toFile(); try (FileOutputStream fos = new FileOutputStream(temporaryZip); ZipOutputStream zos = new ZipOutputStream(fos)) { zos.putNextEntry(new ZipEntry(component + "/")); zos.closeEntry(); for (String file : files) { String entryName = component + "/" + file; zos.putNextEntry(new ZipEntry(entryName)); String filePath = "components/" + entryName; try (InputStream in = ComponentZipUtil.class.getClassLoader().getResourceAsStream(filePath)) { IOUtils.copy(in, zos); } zos.closeEntry(); } } return temporaryZip; } catch (IOException ex) { throw new RuntimeException(ex); } }
Source:
private String notional(SwapLeg leg) { if (leg instanceof RateCalculationSwapLeg) { RateCalculationSwapLeg rcLeg = (RateCalculationSwapLeg) leg; NotionalSchedule notionalSchedule = rcLeg.getNotionalSchedule(); ValueSchedule amount = notionalSchedule.getAmount(); double notional = amount.getInitialValue(); String varying = !amount.getSteps().isEmpty() || amount.getStepSequence().isPresent() ? " varying" : ""; Currency currency = notionalSchedule.getFxReset().map(fxr -> fxr.getReferenceCurrency()).orElse(rcLeg.getCurrency()); return SummarizerUtils.amount(currency, notional) + varying; } if (leg instanceof RatePeriodSwapLeg) { RatePeriodSwapLeg rpLeg = (RatePeriodSwapLeg) leg; return SummarizerUtils.amount(rpLeg.getPaymentPeriods().get(0).getNotionalAmount()); } return ""; }

Target:
private String notional(SwapLeg leg) { if (leg instanceof RateCalculationSwapLeg) { RateCalculationSwapLeg rcLeg = (RateCalculationSwapLeg) leg; NotionalSchedule notionalSchedule = rcLeg.getNotionalSchedule(); ValueSchedule amount = notionalSchedule.getAmount(); double notional = amount.getInitialValue(); String vary = !amount.getSteps().isEmpty() || amount.getStepSequence().isPresent() ? " variable" : ""; Currency currency = notionalSchedule.getFxReset().map(fxr -> fxr.getReferenceCurrency()).orElse(rcLeg.getCurrency()); return SummarizerUtils.amount(currency, notional) + vary; } if (leg instanceof RatePeriodSwapLeg) { RatePeriodSwapLeg rpLeg = (RatePeriodSwapLeg) leg; return SummarizerUtils.amount(rpLeg.getPaymentPeriods().get(0).getNotionalAmount()); } return ""; }
Source:
public void getFilePathFromProjectRoot() throws Exception { final Path repositoryRoot = getPath("file:/ "/"); final Path pathToFile = getPath("file:/ "file.txt"); assertEquals("/org/test/file.txt", Paths.removePrefix(pathToFile, repositoryRoot)); }

Target:
public void getFilePathFromProjectRoot() throws Exception { final Path repositoryRoot = getPath("file:/ "/"); final Path pathToFile = getPath("file:/ "file.txt"); assertEquals("org/test/file.txt", Paths.removePrefix(pathToFile, repositoryRoot)); }
Source:
public int visit(IASTStatement stmt) { if (stmt instanceof IASTReturnStatement) { IASTReturnStatement ret = (IASTReturnStatement) stmt; IASTInitializerClause returnValue = ret.getReturnArgument(); if (returnValue != null) { hasret = true; } ReturnTypeKind returnKind = getReturnTypeKind(func); if (returnKind == ReturnTypeKind.NonVoid && !isConstructorDestructor(func)) { if (checkImplicitReturn(RET_NO_VALUE_ID) || isExplicitReturn(func)) { if (returnValue == null) reportProblem(RET_NO_VALUE_ID, ret); else if (analizer != null) analizer.visit(ret.getReturnValue()); } } else if (returnKind == ReturnTypeKind.Void) { if (returnValue instanceof IASTExpression) { IType type = ((IASTExpression) returnValue).getExpressionType(); if (isVoid(type)) return PROCESS_SKIP; reportProblem(RET_ERR_VALUE_ID, returnValue); } } return PROCESS_SKIP; } return PROCESS_CONTINUE; }

Target:
public int visit(IASTStatement stmt) { if (stmt instanceof IASTReturnStatement) { IASTReturnStatement ret = (IASTReturnStatement) stmt; IASTInitializerClause returnValue = ret.getReturnArgument(); if (returnValue != null) { hasret = true; } ReturnTypeKind returnKind = getReturnTypeKind(func, getType()); if (returnKind == ReturnTypeKind.NonVoid && !isConstructorDestructor(func)) { if (checkImplicitReturn(RET_NO_VALUE_ID) || isExplicitReturn(func)) { if (returnValue == null) reportProblem(RET_NO_VALUE_ID, ret); else if (analyzer != null) analyzer.visit(ret.getReturnValue()); } } else if (returnKind == ReturnTypeKind.Void) { if (returnValue instanceof IASTExpression) { IType type = ((IASTExpression) returnValue).getExpressionType(); if (isVoid(type)) return PROCESS_SKIP; reportProblem(RET_ERR_VALUE_ID, returnValue); } } return PROCESS_SKIP; } return PROCESS_CONTINUE; }
Source:
public boolean onUnbind(Intent intent) { isBound = false; connectivityChangesRegister.unregister(); connectivityChangesForwarder = null; connectivityChangesRegister = null; binder = null; return super.onUnbind(intent); }

Target:
public boolean onUnbind(Intent intent) { isBound = false; if (connectivityChangesRegister != null) { connectivityChangesRegister.unregister(); connectivityChangesRegister = null; } if (connectivityChangesForwarder != null) { connectivityChangesForwarder = null; } binder = null; return super.onUnbind(intent); }
Source:
private void setReplDumpTablesList(Tree replTablesNode) throws HiveException { assert(replTablesNode.getChildCount() <= 2); for (int listIdx = 0; listIdx < replTablesNode.getChildCount(); listIdx++) { Tree tablesListNode = replTablesNode.getChild(listIdx); assert(tablesListNode.getType() == TOK_REPL_TABLES_LIST); List<String> tablesList = new ArrayList<>(); for (int child = 0; child < tablesListNode.getChildCount(); child++) { Tree tablePatternNode = tablesListNode.getChild(child); if (tablePatternNode.getType() == TOK_NULL) { LOG.error(ErrorMsg.REPL_INVALID_DB_OR_TABLE_PATTERN.getMsg()); throw new SemanticException(ErrorMsg.REPL_INVALID_DB_OR_TABLE_PATTERN.getMsg()); } tablesList.add(unescapeSQLString(tablePatternNode.getText())); } if (listIdx == 0) { LOG.info("ReplScope: Set Included Tables List: {}", tablesList); replScope.setIncludedTablePatterns(tablesList); } else { LOG.info("ReplScope: Set Excluded Tables List: {}", tablesList); replScope.setExcludedTablePatterns(tablesList); } } }

Target:
private void setReplDumpTablesList(Tree replTablesNode) throws HiveException { int childCount = replTablesNode.getChildCount(); assert(childCount <= 2); for (int listIdx = 0; listIdx < childCount; listIdx++) { Tree tablesListNode = replTablesNode.getChild(listIdx); assert(tablesListNode.getType() == TOK_REPL_TABLES_LIST); List<String> tablesList = new ArrayList<>(); for (int child = 0; child < tablesListNode.getChildCount(); child++) { Tree tablePatternNode = tablesListNode.getChild(child); if (tablePatternNode.getType() == TOK_NULL) { LOG.error(ErrorMsg.REPL_INVALID_DB_OR_TABLE_PATTERN.getMsg()); throw new SemanticException(ErrorMsg.REPL_INVALID_DB_OR_TABLE_PATTERN.getMsg()); } tablesList.add(unescapeSQLString(tablePatternNode.getText())); } if (listIdx == 0) { LOG.info("ReplScope: Set Included Tables List: {}", tablesList); replScope.setIncludedTablePatterns(tablesList); } else { LOG.info("ReplScope: Set Excluded Tables List: {}", tablesList); replScope.setExcludedTablePatterns(tablesList); } } }
Source:
private byte[] unwrapConfidentialityProtectedMessage(byte[] message, int offset, int len) throws SaslException { int messageType = DigestUtils.decodeByteOrderedInteger(message, offset + len - 6, 2); int extractedSeqNum = DigestUtils.decodeByteOrderedInteger(message, offset + len - 4, 4); if (messageType != 1) { throw new SaslException("MessageType must equal to 1, but is different"); } if (extractedSeqNum != unwrapSeqNum) { throw new SaslException("Bad sequence number while unwrapping"); } byte[] clearText = null; try { clearText = unwrapCipher.update(message, offset, len - 6); } catch (Exception e) { throw new SaslException("Problem during decrypt.", e); } byte[] hmac = new byte[10]; System.arraycopy(clearText, clearText.length - 10, hmac, 0, 10); byte[] decryptedMessage = null; if (unwrapCipher.getBlockSize() > 0) { int padSize = clearText[clearText.length - 10 - 1]; int decryptedMessageSize = clearText.length - 10; if (padSize < 8) { int i = clearText.length - 10 - 1; while (clearText[i] == padSize) { i--; } decryptedMessageSize = i + 1; } decryptedMessage = new byte[decryptedMessageSize]; System.arraycopy(clearText, 0, decryptedMessage, 0, decryptedMessageSize); } else { decryptedMessage = new byte[clearText.length - 10]; System.arraycopy(clearText, 0, decryptedMessage, 0, clearText.length - 10); } byte[] expectedHmac = DigestUtils.computeHMAC(unwrapHmacKeyIntegrity, extractedSeqNum, hmacMD5, decryptedMessage, 0, decryptedMessage.length); if (Arrays2.equals(expectedHmac, 0, hmac, 0, 10) == false) { return NO_BYTES; } unwrapSeqNum++; return decryptedMessage; }

Target:
private byte[] unwrapConfidentialityProtectedMessage(byte[] message, int offset, int len) throws SaslException { int messageType = decodeByteOrderedInteger(message, offset + len - 6, 2); int extractedSeqNum = decodeByteOrderedInteger(message, offset + len - 4, 4); if (messageType != 1) { throw new SaslException("MessageType must equal to 1, but is different"); } if (extractedSeqNum != unwrapSeqNum) { throw new SaslException("Bad sequence number while unwrapping"); } byte[] clearText = null; try { clearText = unwrapCipher.update(message, offset, len - 6); } catch (Exception e) { throw new SaslException("Problem during decrypt.", e); } byte[] hmac = new byte[10]; System.arraycopy(clearText, clearText.length - 10, hmac, 0, 10); byte[] decryptedMessage = null; if (unwrapCipher.getBlockSize() > 0) { int padSize = clearText[clearText.length - 10 - 1]; int decryptedMessageSize = clearText.length - 10; if (padSize < 8) { int i = clearText.length - 10 - 1; while (clearText[i] == padSize) { i--; } decryptedMessageSize = i + 1; } decryptedMessage = new byte[decryptedMessageSize]; System.arraycopy(clearText, 0, decryptedMessage, 0, decryptedMessageSize); } else { decryptedMessage = new byte[clearText.length - 10]; System.arraycopy(clearText, 0, decryptedMessage, 0, clearText.length - 10); } byte[] expectedHmac = computeHMAC(unwrapHmacKeyIntegrity, extractedSeqNum, hmacMD5, decryptedMessage, 0, decryptedMessage.length); if (Arrays2.equals(expectedHmac, 0, hmac, 0, 10) == false) { return NO_BYTES; } unwrapSeqNum++; return decryptedMessage; }
Source:
public List<JdbcColumnHandle> getColumns(ConnectorSession session, JdbcTableHandle tableHandle) { try (Connection connection = connectionFactory.openConnection()) { try (ResultSet resultSet = getColumns(tableHandle, connection.getMetaData())) { List<JdbcColumnHandle> columns = new ArrayList<>(); while (resultSet.next()) { JdbcTypeHandle typeHandle = new JdbcTypeHandle( resultSet.getInt("DATA_TYPE"), resultSet.getInt("COLUMN_SIZE"), resultSet.getInt("DECIMAL_DIGITS")); Optional<ReadMapping> columnMapping = toPrestoType(session, typeHandle); if (columnMapping.isPresent()) { String columnName = resultSet.getString("COLUMN_NAME"); boolean nullable = resultSet.getBoolean("NULLABLE"); columns.add(new JdbcColumnHandle(connectorId, columnName, typeHandle, columnMapping.get().getType(), nullable)); } } if (columns.isEmpty()) { throw new TableNotFoundException(tableHandle.getSchemaTableName()); } return ImmutableList.copyOf(columns); } } catch (SQLException e) { throw new PrestoException(JDBC_ERROR, e); } }

Target:
public List<JdbcColumnHandle> getColumns(ConnectorSession session, JdbcTableHandle tableHandle) { try (Connection connection = connectionFactory.openConnection()) { try (ResultSet resultSet = getColumns(tableHandle, connection.getMetaData())) { List<JdbcColumnHandle> columns = new ArrayList<>(); while (resultSet.next()) { JdbcTypeHandle typeHandle = new JdbcTypeHandle( resultSet.getInt("DATA_TYPE"), resultSet.getInt("COLUMN_SIZE"), resultSet.getInt("DECIMAL_DIGITS")); Optional<ReadMapping> columnMapping = toPrestoType(session, typeHandle); if (columnMapping.isPresent()) { String columnName = resultSet.getString("COLUMN_NAME"); boolean nullable = columnNullable == resultSet.getInt("NULLABLE"); columns.add(new JdbcColumnHandle(connectorId, columnName, typeHandle, columnMapping.get().getType(), nullable)); } } if (columns.isEmpty()) { throw new TableNotFoundException(tableHandle.getSchemaTableName()); } return ImmutableList.copyOf(columns); } } catch (SQLException e) { throw new PrestoException(JDBC_ERROR, e); } }
Source:
public Promise<Result> call(final Context ctx) { final ActionContext actionContext = buildActionContext(ctx); Promise<CommonProfile> profile = retrieveUserProfile(actionContext); return profile.flatMap(new Function<CommonProfile, Promise<Result>>() { @Override public Promise<Result> apply(CommonProfile profile) throws Throwable { if (profile == null) { return authenticationFailure(actionContext); } else { saveUserProfile(profile, actionContext); return authenticationSuccess(profile, actionContext); } } }).recover(new Function<Throwable, Result>() { @Override public Result apply(Throwable a) throws Throwable { if (a instanceof RequiresHttpAction) { RequiresHttpAction e = (RequiresHttpAction) a; return requireActionToResult(e.getCode(), actionContext); } else { logger.error("Unexpected error", a); return internalServerError(a.getMessage()); } } }); }

Target:
public Promise<Result> call(final Context ctx) { final ActionContext actionContext = ActionContext.build(ctx, configuration); Promise<CommonProfile> profile = retrieveUserProfile(actionContext); return profile.flatMap(new Function<CommonProfile, Promise<Result>>() { @Override public Promise<Result> apply(CommonProfile profile) throws Throwable { if (profile == null) { return authenticationFailure(actionContext); } else { saveUserProfile(profile, actionContext); return authenticationSuccess(profile, actionContext); } } }).recover(new Function<Throwable, Result>() { @Override public Result apply(Throwable a) throws Throwable { if (a instanceof RequiresHttpAction) { RequiresHttpAction e = (RequiresHttpAction) a; return requireActionToResult(e.getCode(), actionContext); } else { logger.error("Unexpected error", a); throw a; } } }); }
Source:
public synchronized void stopBackgroundScanning() { logger.debug("Stopping usb-serial background discovery"); ScheduledFuture<?> currentBackgroundScanningJob = backgroundScanningJob; if (currentBackgroundScanningJob != null && !currentBackgroundScanningJob.isCancelled()) { if (currentBackgroundScanningJob.cancel(true)) { backgroundScanningJob = null; logger.debug("Stopped usb-serial background discovery"); } } }

Target:
public synchronized void stopBackgroundScanning() { logger.debug("Stopping USB-Serial background discovery"); ScheduledFuture<?> currentBackgroundScanningJob = backgroundScanningJob; if (currentBackgroundScanningJob != null && !currentBackgroundScanningJob.isCancelled()) { if (currentBackgroundScanningJob.cancel(true)) { backgroundScanningJob = null; logger.debug("Stopped USB-serial background discovery"); } } }
Source:
public int size() { return items.size(); }

Target:
int size() { return items.size(); }
Source:
private void init() { log.info("Start initializing {}", getClass().getSimpleName()); log.info("Setting data center compatibility checker to run every 7 days"); schedulerUtil.scheduleAFixedDelayJob(this, "onTimer", new Class[]{}, new Object[]{}, 0, 7, TimeUnit.DAYS); log.info("Finished initializing {}", getClass().getSimpleName()); }

Target:
private void init() { log.info("Start initializing {}", getClass().getSimpleName()); schedulerUtil.scheduleAFixedDelayJob(this, "onTimer", new Class[]{}, new Object[]{}, 0, 7, TimeUnit.DAYS); log.info("Finished initializing {}", getClass().getSimpleName()); }
Source:
public void execute(SensorContext context) { FileSystem fs = context.fileSystem(); FilePredicate xmlFilesPredicate = fs.predicates().matchesPathPattern("**/*.xml"); List<InputFile> inputFiles = new ArrayList<>(); fs.inputFiles(xmlFilesPredicate).forEach(inputFiles::add); if (inputFiles.isEmpty()) { return; } ProgressReport progressReport = new ProgressReport("Report about progress of Java XML analyzer", TimeUnit.SECONDS.toMillis(10)); progressReport.start(inputFiles.stream().map(InputFile::toString).collect(Collectors.toList())); boolean successfullyCompleted = false; boolean cancelled = false; try { for (InputFile inputFile : inputFiles) { scanFile(context, inputFile); progressReport.nextFile(); } successfullyCompleted = !cancelled; } finally { if (successfullyCompleted) { progressReport.stop(); } else { progressReport.cancel(); } } }

Target:
public void execute(SensorContext context) { FileSystem fs = context.fileSystem(); FilePredicate xmlFilesPredicate = fs.predicates().matchesPathPattern("**/*.xml"); List<InputFile> inputFiles = new ArrayList<>(); fs.inputFiles(xmlFilesPredicate).forEach(inputFiles::add); if (inputFiles.isEmpty()) { return; } ProgressReport progressReport = new ProgressReport("Report about progress of Java XML analyzer", TimeUnit.SECONDS.toMillis(10)); progressReport.start(inputFiles.stream().map(InputFile::toString).collect(Collectors.toList())); boolean successfullyCompleted = false; boolean cancelled = false; try { for (InputFile inputFile : inputFiles) { if (context.isCancelled()) { cancelled = true; break; } scanFile(context, inputFile); progressReport.nextFile(); } successfullyCompleted = !cancelled; } finally { if (successfullyCompleted) { progressReport.stop(); } else { progressReport.cancel(); } } }
Source:
@Override public Response load(Uri uri, int networkPolicy) throws IOException { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { installCacheIfNeeded(context); } StringBuilder builder = CACHE_HEADER_BUILDER.get(); builder.setLength(0); if (NetworkPolicy.isOfflineOnly(networkPolicy)) { builder.append("only-if-cached").append(',').append("max-age=").append(Integer.MAX_VALUE); } else { if (!NetworkPolicy.shouldReadFromDiskCache(networkPolicy)) { builder.append("no-cache"); } } HttpURLConnection connection = openConnection(uri); connection.setUseCaches(true); if (!builder.toString().isEmpty()) { connection.setRequestProperty("Cache-Control", builder.toString()); } int responseCode = connection.getResponseCode(); if (responseCode >= 300) { connection.disconnect(); throw new ResponseException(responseCode + " " + connection.getResponseMessage(), networkPolicy, responseCode); } long contentLength = connection.getHeaderFieldInt("Content-Length", -1); boolean fromCache = parseResponseSourceHeader(connection.getHeaderField(RESPONSE_SOURCE)); return new Response(connection.getInputStream(), fromCache, contentLength); }

Target:
@Override public Response load(Uri uri, int networkPolicy) throws IOException { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { installCacheIfNeeded(context); } HttpURLConnection connection = openConnection(uri); connection.setUseCaches(true); if (networkPolicy != 0) { String headerValue; if (NetworkPolicy.isOfflineOnly(networkPolicy)) { headerValue = FORCE_CACHE; } else { StringBuilder builder = CACHE_HEADER_BUILDER.get(); builder.setLength(0); if (!NetworkPolicy.shouldReadFromDiskCache(networkPolicy)) { builder.append("no-cache"); } if (!NetworkPolicy.shouldWriteToDiskCache(networkPolicy)) { if (builder.length() > 0) { builder.append(','); } builder.append("no-store"); } headerValue = builder.toString(); } connection.setRequestProperty("Cache-Control", headerValue); } int responseCode = connection.getResponseCode(); if (responseCode >= 300) { connection.disconnect(); throw new ResponseException(responseCode + " " + connection.getResponseMessage(), networkPolicy, responseCode); } long contentLength = connection.getHeaderFieldInt("Content-Length", -1); boolean fromCache = parseResponseSourceHeader(connection.getHeaderField(RESPONSE_SOURCE)); return new Response(connection.getInputStream(), fromCache, contentLength); }
Source:
public void closesTemplateInputStream() throws IOException { final String template = "hello, world!"; final MockInputStream templateStream = new MockInputStream(template); MatcherAssert.assertThat( IOUtils.toString( new RsVelocity( templateStream, Collections.<CharSequence, Object>emptyMap() ).body() ), Matchers.equalTo(template) ); MatcherAssert.assertThat(templateStream.isClosed(), Matchers.is(true)); }

Target:
public void closesTemplateInputStream() throws IOException { final String template = "hello, world!"; final StateAwareInputStream templateStream = new StateAwareInputStream(IOUtils.toInputStream(template)); MatcherAssert.assertThat( IOUtils.toString( new RsVelocity( templateStream, Collections.<CharSequence, Object>emptyMap() ).body() ), Matchers.equalTo(template) ); MatcherAssert.assertThat(templateStream.isClosed(), Matchers.is(true)); }
Source:
private static CryptoModule instantiateCryptoModule(String cryptoModuleClassname) { log.debug("About to instantiate crypto module {}", cryptoModuleClassname); CryptoModule cryptoModule = null; Class cryptoModuleClazz = null; try { cryptoModuleClazz = AccumuloVFSClassLoader.loadClass(cryptoModuleClassname); } catch (ClassNotFoundException e1) { throw new RuntimeException("Could not find configured crypto module " + cryptoModuleClassname); } Class[] interfaces = cryptoModuleClazz.getInterfaces(); boolean implementsCryptoModule = false; for (Class clazz : interfaces) { if (clazz.equals(CryptoModule.class)) { implementsCryptoModule = true; break; } } if (!implementsCryptoModule) { throw new RuntimeException("Configured Accumulo crypto module " + cryptoModuleClassname + " does not implement the CryptoModule interface."); } else { try { cryptoModule = (CryptoModule) cryptoModuleClazz.newInstance(); log.debug("Successfully instantiated crypto module {}", cryptoModuleClassname); } catch (InstantiationException e) { throw new RuntimeException("Got instantiation exception when instantiating crypto module " + cryptoModuleClassname); } catch (IllegalAccessException e) { throw new RuntimeException("Got illegal access exception when trying to instantiate crypto module " + cryptoModuleClassname); } } return cryptoModule; }

Target:
private static CryptoModule instantiateCryptoModule(String cryptoModuleClassname) { log.debug("About to instantiate crypto module {}", cryptoModuleClassname); CryptoModule cryptoModule = null; Class<?> cryptoModuleClazz = null; try { cryptoModuleClazz = AccumuloVFSClassLoader.loadClass(cryptoModuleClassname); } catch (ClassNotFoundException e1) { throw new IllegalArgumentException("Could not find configured crypto module " + cryptoModuleClassname); } Class<?>[] interfaces = cryptoModuleClazz.getInterfaces(); boolean implementsCryptoModule = false; for (Class<?> clazz : interfaces) { if (clazz.equals(CryptoModule.class)) { implementsCryptoModule = true; break; } } if (!implementsCryptoModule) { throw new IllegalArgumentException("Configured Accumulo crypto module " + cryptoModuleClassname + " does not implement the CryptoModule interface."); } else { try { cryptoModule = (CryptoModule) cryptoModuleClazz.newInstance(); log.debug("Successfully instantiated crypto module {}", cryptoModuleClassname); } catch (InstantiationException | IllegalAccessException e) { throw new IllegalArgumentException("Unable to instantiate the crypto module: " + cryptoModuleClassname, e); } } return cryptoModule; }
Source:
public void testStartExport() throws IOException { ExportDocket exportDocket = new ExportDocket(); File file = new File("docket.pdf"); FileOutputStream fileOutputStream = new FileOutputStream(file); File xslFile = new File("src/test/resources/docket.xsl"); try { exportDocket.startExport(docketDataGenerator.createDocketData("processId", "signature", "doctype"), fileOutputStream, xslFile); } catch (IOException e) { throw new IOException(e.getMessage()); } finally { fileOutputStream.close(); } }

Target:
public void testStartExport() throws IOException { ExportDocket exportDocket = new ExportDocket(); File file = new File("docket.pdf"); File xslFile = new File("src/test/resources/docket.xsl"); try (FileOutputStream fileOutputStream = new FileOutputStream(file)) { exportDocket.startExport(docketDataGenerator.createDocketData("processId", "signature", "doctype"), fileOutputStream, xslFile); } catch (IOException e) { throw new IOException(e.getMessage()); } }
Source:
protected void onInit() { super.onInit(); this.jpaExecutor.setBeanFactory(this.getBeanFactory()); if(this.evaluationContext == null) { this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); } }

Target:
protected void onInit() { super.onInit(); this.jpaExecutor.setBeanFactory(this.getBeanFactory()); }
Source:
public Rectangle merge(Rectangle other) { requireNonNull(other, "other is null"); return new Rectangle(min(this.xMin, other.xMin), min(this.yMin, other.yMin), max(this.xMax, other.xMax), max(this.yMax, other.yMax)); }

Target:
public Rectangle merge(Rectangle other) { return new Rectangle(min(this.xMin, other.xMin), min(this.yMin, other.yMin), max(this.xMax, other.xMax), max(this.yMax, other.yMax)); }
Source:
public void testGetCommunicationSummaryStatisticsServiceNameMissingOperation() throws StoreException { CompletionTime ct1 = new CompletionTime(); ct1.setUri("in1"); ct1.setBusinessTransaction("testapp"); ct1.getProperties().add(new Property("prop", "val")); ct1.getProperties().add(new Property(Constants.PROP_SERVICE_NAME, "wildfly")); analytics.storeFragmentCompletionTimes(null, Arrays.asList(ct1)); Criteria criteria = new Criteria() .setStartTime(0) .setEndTime(100000) .setBusinessTransaction("testapp"); Collection<CommunicationSummaryStatistics> communicationSummaryStatisticsList = analytics.getCommunicationSummaryStatistics(null, criteria, false); Assert.assertEquals(1, communicationSummaryStatisticsList.size()); CommunicationSummaryStatistics communicationSummaryStatistics = communicationSummaryStatisticsList.iterator().next(); Assert.assertNotNull("wildfly", communicationSummaryStatistics.getServiceName()); }

Target:
public void testGetCommunicationSummaryStatisticsServiceNameMissingOperation() throws StoreException { CompletionTime ct1 = new CompletionTime(); ct1.setUri("in1"); ct1.setBusinessTransaction("testapp"); ct1.getProperties().add(new Property("prop", "val")); ct1.getProperties().add(new Property(Constants.PROP_SERVICE_NAME, "wildfly")); analytics.storeFragmentCompletionTimes(null, Arrays.asList(ct1)); Criteria criteria = new Criteria() .setStartTime(0) .setEndTime(100000) .setBusinessTransaction("testapp"); Collection<CommunicationSummaryStatistics> communicationSummaryStatisticsList = analytics.getCommunicationSummaryStatistics(null, criteria, false); Assert.assertEquals(1, communicationSummaryStatisticsList.size()); CommunicationSummaryStatistics communicationSummaryStatistics = communicationSummaryStatisticsList.iterator().next(); Assert.assertEquals("wildfly", communicationSummaryStatistics.getServiceName()); }
Source:
public void clear() { long start = System.currentTimeMillis(); try (LockResource r = new LockResource(mLock.writeLock())) { for (Counter counter : mClusterCounters.values()) { counter.dec(counter.getCount()); } mLastClearTime = System.currentTimeMillis(); MetricsSystem.resetAllMetrics(); } LOG.info("Clearing the metrics store and metrics system in ms", System.currentTimeMillis() - start); }

Target:
public void clear() { long start = System.currentTimeMillis(); try (LockResource r = new LockResource(mLock.writeLock())) { for (Counter counter : mClusterCounters.values()) { counter.dec(counter.getCount()); } mLastClearTime = System.currentTimeMillis(); MetricsSystem.resetAllMetrics(); } LOG.info("Cleared the metrics store and metrics system in ms", System.currentTimeMillis() - start); }
Source:
public static List<Rule> compose(Collection<ExternalDependency> dependencies) { return dependencies .stream() .filter( dependency -> dependency.packaging.equals("aar") || dependency.packaging.equals("jar")) .sorted( (o1, o2) -> ComparisonChain.start() .compare(o1.packaging, o2.packaging) .compare(o1.getCacheName(), o2.getCacheName()) .result()) .map( dependency -> { String source = null; if (dependency.hasSourceJar()) { source = dependency.getSourceFileName(); } String ruleType; String prebuiltType; String mavenCoords; switch (dependency.packaging) { case "jar": ruleType = "prebuilt_jar"; prebuiltType = "binary_jar"; mavenCoords = dependency.getMavenCoords(); break; case "aar": ruleType = "android_prebuilt_aar"; prebuiltType = "aar"; mavenCoords = null; break; default: throw new IllegalStateException("Dependency not a valid prebuilt: " + dependency); } ImmutableList.Builder<Rule> rulesBuilder = ImmutableList.builder(); rulesBuilder.add( new Prebuilt() .prebuiltType(prebuiltType) .prebuilt(dependency.getDepFileName()) .mavenCoords(mavenCoords) .source(source) .ruleType(ruleType) .name(dependency.getCacheName())); if (dependency.hasLintJar()) { rulesBuilder.add( new Prebuilt() .prebuiltType("binary_jar") .prebuilt(dependency.getLintFileName()) .ruleType("prebuilt_jar") .name(dependency.getLintCacheName())); } return rulesBuilder.build(); }) .flatMap(Collection::stream) .collect(Collectors.toList()); }

Target:
public static List<Rule> compose(Collection<ExternalDependency> dependencies) { return dependencies .stream() .filter(dependency -> ImmutableList.of(JAR, AAR).contains(dependency.getPackaging())) .sorted( (o1, o2) -> ComparisonChain.start() .compare(o1.getPackaging(), o2.getPackaging()) .compare(o1.getCacheName(), o2.getCacheName()) .result()) .map( dependency -> { String source = null; if (dependency.hasSourceFile()) { source = dependency.getSourceFileName(); } String ruleType; String prebuiltType; switch (dependency.getPackaging()) { case JAR: ruleType = JAVA_PREBUILT_JAR; prebuiltType = BINARY_JAR; break; case AAR: ruleType = ANDROID_PREBUILT_AAR; prebuiltType = AAR; break; default: throw new IllegalStateException("Dependency not a valid prebuilt: " + dependency); } ImmutableList.Builder<Rule> rulesBuilder = ImmutableList.builder(); rulesBuilder.add( new Prebuilt() .prebuiltType(prebuiltType) .prebuilt(dependency.getDependencyFileName()) .mavenCoords(dependency.getMavenCoords()) .source(source) .ruleType(ruleType) .name(dependency.getCacheName())); if (dependency.hasLintFile()) { rulesBuilder.add( new Prebuilt() .prebuiltType(BINARY_JAR) .prebuilt(dependency.getLintFileName()) .ruleType(JAVA_PREBUILT_JAR) .name(dependency.getLintCacheName())); } return rulesBuilder.build(); }) .flatMap(Collection::stream) .collect(Collectors.toList()); }
Source:
private ContinuityCheckResult pollPendingBuffer(PollTask pollTask) { AckingContainer cont = m_pendingContainer.getAndSet(null); if (cont.schema() == null && pollTask.forcePollSchema()) { BBContainer schemaContainer = m_committedBuffers.pollSchema(); if (schemaContainer == null) { try { pollTask.setException(new IOException("No schema for committedSeqNo " + cont.m_commitSeqNo + ", discarding buffer (rows may be lost).")); } catch (RejectedExecutionException reex) { } if (exportLog.isDebugEnabled()) { exportLog.debug("poll task has a pendingContainer:" + m_pendingContainer.get().toString() + " but failed to get schema."); } cont.internalDiscard(); return ContinuityCheckResult.NONE; } else { cont.setSchema(schemaContainer); } } long nextSeqNo = m_firstUnpolledSeqNo; ContinuityCheckResult result = checkBufferContinuity( cont.getStartSeqNo(), cont.getLastSeqNo(), nextSeqNo); if (result == ContinuityCheckResult.OK) { try { pollTask.setFuture(cont); if (exportLog.isDebugEnabled()) { exportLog.debug("Picked up pending container with committedSeqNo " + cont.m_commitSeqNo); } } catch (RejectedExecutionException reex) { if (exportLog.isDebugEnabled()) { exportLog.debug("Pending a rejected " + cont); } setPendingContainer(cont); result = ContinuityCheckResult.NONE; } } else if (result == ContinuityCheckResult.BUFFER_IS_ACKED) { int tuplesDeleted = m_gapTracker.truncate(cont.getLastSeqNo()); m_tuplesPending.addAndGet(-tuplesDeleted); cont.internalDiscard(); } else { assert (result == ContinuityCheckResult.HAS_GAP); initiateMastershipMigration(nextSeqNo, cont); } return result; }

Target:
private ContinuityCheckResult pollPendingBuffer(PollTask pollTask) { AckingContainer cont = m_pendingContainer.getAndSet(null); if (cont.schema() == null && pollTask.forcePollSchema()) { BBContainer schemaContainer = m_committedBuffers.pollSchema(); if (schemaContainer == null) { try { pollTask.setException(new IOException("No schema for committedSeqNo " + cont.m_commitSeqNo + ", discarding buffer (rows may be lost).")); } catch (RejectedExecutionException reex) { } exportLog.error("poll task has a pendingContainer:" + m_pendingContainer.get().toString() + " but failed to get schema."); cont.internalDiscard(); return ContinuityCheckResult.NONE; } else { cont.setSchema(schemaContainer); } } long nextSeqNo = m_firstUnpolledSeqNo; ContinuityCheckResult result = checkBufferContinuity( cont.getStartSeqNo(), cont.getLastSeqNo(), nextSeqNo); if (result == ContinuityCheckResult.OK) { try { pollTask.setFuture(cont); if (exportLog.isDebugEnabled()) { exportLog.debug("Picked up pending container with committedSeqNo " + cont.m_commitSeqNo); } } catch (RejectedExecutionException reex) { if (exportLog.isDebugEnabled()) { exportLog.debug("Pending a rejected " + cont); } setPendingContainer(cont); result = ContinuityCheckResult.NONE; } } else if (result == ContinuityCheckResult.BUFFER_IS_ACKED) { int tuplesDeleted = m_gapTracker.truncate(cont.getLastSeqNo()); m_tuplesPending.addAndGet(-tuplesDeleted); cont.internalDiscard(); } else { assert (result == ContinuityCheckResult.HAS_GAP); initiateMastershipMigration(nextSeqNo, cont); } return result; }
Source:
public TimeInfoMsg(String rawMsg) { super(rawMsg); if (this.payload.length == TIME_INFO_PAYLOAD_LEN) { logger.debug("Year => "+(this.payload[0]+2000)); logger.debug("Month => "+(((this.payload[3]&0xC0)>>4)|((this.payload[4]&0xC0)>>6))); logger.debug("DoM => "+this.payload[1]); logger.debug("Hour => "+(this.payload[2] & 0x3F)); logger.debug("Min => "+(this.payload[3] & 0x3F)); logger.debug("Sec => "+(this.payload[4] & 0x3F)); messageTimeInfo = new GregorianCalendar(this.payload[0]+2000, (((this.payload[3]&0xC0)>>4)|((this.payload[4]&0xC0)>>6))-1, this.payload[1], (this.payload[2] & 0x3F), (this.payload[3] & 0x3F), (this.payload[4] & 0x3F)); } else if (this.payload.length == TIME_INFO_REQUEST_PAYLOAD_LEN) { messageTimeInfo = new GregorianCalendar(0,0,1); logger.debug("Received Time request - setting time to 1/1/0"); } else logger.error("TimeInfoMsg raw packet was of incorrect length to parse! Expect "+TIME_INFO_PAYLOAD_LEN+" got "+payload.length); }

Target:
public TimeInfoMsg(String rawMsg) { super(rawMsg); if (this.payload.length == TIME_INFO_PAYLOAD_LEN) { logger.debug("Year => " + (this.payload[0] + 2000)); logger.debug("Month => " + (((this.payload[3] & 0xC0) >> 4) | ((this.payload[4] & 0xC0) >> 6))); logger.debug("DoM => " + this.payload[1]); logger.debug("Hour => " + (this.payload[2] & 0x3F)); logger.debug("Min => " + (this.payload[3] & 0x3F)); logger.debug("Sec => " + (this.payload[4] & 0x3F)); messageTimeInfo = new GregorianCalendar( this.payload[0] + 2000, (((this.payload[3] & 0xC0) >> 4) | ((this.payload[4] & 0xC0) >> 6)) - 1, this.payload[1], (this.payload[2] & 0x3F), (this.payload[3] & 0x3F), (this.payload[4] & 0x3F)); } else if (this.payload.length == TIME_INFO_REQUEST_PAYLOAD_LEN) { messageTimeInfo = new GregorianCalendar(0, 0, 1); logger.debug("Received Time request - setting time to 1/1/0"); } else { logger.error("TimeInfoMsg raw packet was of incorrect length to parse! Expect " + TIME_INFO_PAYLOAD_LEN + " got " + payload.length); } }