auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void startStatementWithinTransaction(Command command) { Transaction transaction = getTransaction(); if (transaction != null) { HashSet<MVMap<?, ?>> currentMaps = null, allMaps = null; if (command != null) { Set<DbObject> dependencies = command.getDependencies(); currentMaps = new HashSet<>(); for (DbObject dependency : dependencies) { if (dependency instanceof MVTable) { addTableToDependencies((MVTable) dependency, currentMaps); } } switch (isolationLevel) { case REPEATABLE_READ: { allMaps = new HashSet<>(); HashSet<MVTable> processed = new HashSet<>(); for (DbObject dependency : dependencies) { if (dependency instanceof MVTable) { addTableToDependencies((MVTable) dependency, dependencies, allMaps, processed); } } break; } case SERIALIZABLE: if (!transaction.hasStatementDependencies()) { allMaps = new HashSet<>(); for (Table table : database.getAllTablesAndViews(false)) { if (table instanceof MVTable) { addTableToDependencies((MVTable) table, allMaps); } } } } } transaction.markStatementStart(isolationLevel, currentMaps, allMaps); } startStatement = -1; if (command != null) { setCurrentCommand(command); } }

Target:
public void startStatementWithinTransaction(Command command) { Transaction transaction = getTransaction(); if (transaction != null) { HashSet<MVMap<?, ?>> currentMaps = null, allMaps = null; if (command != null) { Set<DbObject> dependencies = command.getDependencies(); currentMaps = new HashSet<>(); for (DbObject dependency : dependencies) { if (dependency instanceof MVTable) { addTableToDependencies((MVTable) dependency, currentMaps); } } switch (transaction.getIsolationLevel()) { case REPEATABLE_READ: { allMaps = new HashSet<>(); HashSet<MVTable> processed = new HashSet<>(); for (DbObject dependency : dependencies) { if (dependency instanceof MVTable) { addTableToDependencies((MVTable) dependency, allMaps, processed); } } break; } case SERIALIZABLE: if (!transaction.hasStatementDependencies()) { allMaps = new HashSet<>(); for (Table table : database.getAllTablesAndViews(false)) { if (table instanceof MVTable) { addTableToDependencies((MVTable) table, allMaps); } } } } } transaction.markStatementStart(currentMaps, allMaps); } startStatement = -1; if (command != null) { setCurrentCommand(command); } }
Source:
private static void writeNewOffsets(byte[] arrayBytes, byte[] newArray, boolean useShortNew, boolean useShortPrevious, int newOffsetArrayPosition, int arrayLength, int offsetArrayPosition, int offset, int offsetShift, int length) { int currentPosition = newOffsetArrayPosition; int offsetArrayElementSize = useShortNew ? Bytes.SIZEOF_SHORT : Bytes.SIZEOF_INT; if (useShortNew) { Bytes.putShort(newArray, currentPosition, (short) (0 - Short.MAX_VALUE)); } else { Bytes.putInt(newArray, currentPosition, 0); } currentPosition += offsetArrayElementSize; boolean isFirstNullGroup = true; for (int arrayIndex = 0; arrayIndex < arrayLength - 1; arrayIndex++) { int oldOffset = getOffset(arrayBytes, arrayIndex, useShortPrevious, offsetArrayPosition + offset); if (arrayBytes[offset + oldOffset] == QueryConstants.SEPARATOR_BYTE && isFirstNullGroup) { if (useShortNew) { Bytes.putShort(newArray, currentPosition, (short) (oldOffset - Short.MAX_VALUE)); } else { Bytes.putInt(newArray, currentPosition, oldOffset); } } else { if (useShortNew) { Bytes.putShort(newArray, currentPosition, (short) (oldOffset + offsetShift - Short.MAX_VALUE)); } else { Bytes.putInt(newArray, currentPosition, oldOffset + offsetShift); } isFirstNullGroup = false; } currentPosition += offsetArrayElementSize; } Bytes.putInt(newArray, currentPosition, newOffsetArrayPosition); currentPosition += Bytes.SIZEOF_INT; Bytes.putInt(newArray, currentPosition, useShortNew ? arrayLength : -arrayLength); currentPosition += Bytes.SIZEOF_INT; Bytes.putByte(newArray, currentPosition, arrayBytes[offset + length - 1]); }

Target:
private static void writeNewOffsets(byte[] arrayBytes, byte[] newArray, boolean useShortNew, boolean useShortPrevious, int newOffsetArrayPosition, int arrayLength, int offsetArrayPosition, int offset, int offsetShift, int length) { int currentPosition = newOffsetArrayPosition; int offsetArrayElementSize = useShortNew ? Bytes.SIZEOF_SHORT : Bytes.SIZEOF_INT; if (useShortNew) { Bytes.putShort(newArray, currentPosition, (short) (0 - Short.MAX_VALUE)); } else { Bytes.putInt(newArray, currentPosition, 0); } currentPosition += offsetArrayElementSize; boolean nullsAtBeginning = true; for (int arrayIndex = 0; arrayIndex < arrayLength - 1; arrayIndex++) { int oldOffset = getOffset(arrayBytes, arrayIndex, useShortPrevious, offsetArrayPosition + offset); if (arrayBytes[offset + oldOffset] == QueryConstants.SEPARATOR_BYTE && nullsAtBeginning) { if (useShortNew) { Bytes.putShort(newArray, currentPosition, (short) (oldOffset - Short.MAX_VALUE)); } else { Bytes.putInt(newArray, currentPosition, oldOffset); } } else { if (useShortNew) { Bytes.putShort(newArray, currentPosition, (short) (oldOffset + offsetShift - Short.MAX_VALUE)); } else { Bytes.putInt(newArray, currentPosition, oldOffset + offsetShift); } nullsAtBeginning = false; } currentPosition += offsetArrayElementSize; } Bytes.putInt(newArray, currentPosition, newOffsetArrayPosition); currentPosition += Bytes.SIZEOF_INT; Bytes.putInt(newArray, currentPosition, useShortNew ? arrayLength : -arrayLength); currentPosition += Bytes.SIZEOF_INT; Bytes.putByte(newArray, currentPosition, arrayBytes[offset + length - 1]); }
Source:
protected SLDGenerator(Item item, Item selectedItem, Integer ribbon, SLDConfig config) { this.item = item; this.ribbon = ribbon; if (config instanceof ShorelineConfig) { ShorelineConfig slc = (ShorelineConfig)config; slc.finalize(item, selectedItem); this.config = slc; } else { this.config = config; } }

Target:
protected SLDGenerator(Item item, Item selectedItem, Integer ribbon, SLDConfig config) { this.item = item; this.ribbon = ribbon; if (config instanceof ShorelineConfig) { ShorelineConfig slc = (ShorelineConfig)config; slc.finalize(selectedItem); this.config = slc; } else { this.config = config; } }
Source:
private boolean isMainMethod(ASTAnyTypeBodyDeclaration bodyDeclaration) { if (!DeclarationKind.METHOD.equals(bodyDeclaration.getKind())) { return false; } ASTMethodDeclaration decl = (ASTMethodDeclaration) bodyDeclaration.getDeclarationNode(); return decl.isStatic() && "main".equals(decl.getMethodName()) && decl.getResultType().isVoid() && decl.getFormalParameters().getParameterCount() == 1 && String[].class.equals(decl.getFormalParameters().iterator().next().getType()); }

Target:
private boolean isMainMethod(ASTAnyTypeBodyDeclaration bodyDeclaration) { if (DeclarationKind.METHOD != bodyDeclaration.getKind()) { return false; } ASTMethodDeclaration decl = (ASTMethodDeclaration) bodyDeclaration.getDeclarationNode(); return decl.isStatic() && "main".equals(decl.getMethodName()) && decl.getResultType().isVoid() && decl.getFormalParameters().getParameterCount() == 1 && String[].class.equals(decl.getFormalParameters().iterator().next().getType()); }
Source:
public static boolean valueMatchesInUnaryTests(List<UnaryTest> unaryTests, Object value, DMNContext dmnContext) { FEELEventListenersManager manager = new FEELEventListenersManager(); FEELEventsListenerImpl listener = new FEELEventsListenerImpl(); manager.addListener( listener ); EvaluationContextImpl ctx = new EvaluationContextImpl(Thread.currentThread().getContextClassLoader(), manager); try { ctx.enterFrame(); if ( dmnContext != null ) { for ( Map.Entry<String,Object> entry : dmnContext.getAll().entrySet() ) { ctx.setValue( entry.getKey(), entry.getValue() ); } } for ( UnaryTest t : unaryTests ) { try { Boolean applyT = t.apply( ctx, value ); if ( applyT == null ) { return false; } else if ( applyT ) { return true; } } catch ( Throwable e ) { StringBuilder message = new StringBuilder( ); for( FEELEvent feelEvent : listener.getFeelEvents() ) { message.append( feelEvent.getMessage() ); message.append( "\n" ); } throw new RuntimeException( message.toString(), e ); } } } finally { ctx.exitFrame(); } return false; }

Target:
public static boolean valueMatchesInUnaryTests(List<UnaryTest> unaryTests, Object value, DMNContext dmnContext) { FEELEventListenersManager manager = new FEELEventListenersManager(); FEELEventsListenerImpl listener = new FEELEventsListenerImpl(); manager.addListener( listener ); EvaluationContextImpl ctx = new EvaluationContextImpl(ClassLoaderUtil.findDefaultClassLoader(), manager); try { ctx.enterFrame(); if ( dmnContext != null ) { for ( Map.Entry<String,Object> entry : dmnContext.getAll().entrySet() ) { ctx.setValue( entry.getKey(), entry.getValue() ); } } for ( UnaryTest t : unaryTests ) { try { Boolean applyT = t.apply( ctx, value ); if ( applyT == null ) { return false; } else if ( applyT ) { return true; } } catch ( Throwable e ) { StringBuilder message = new StringBuilder( ); for( FEELEvent feelEvent : listener.getFeelEvents() ) { message.append( feelEvent.getMessage() ); message.append( "\n" ); } throw new RuntimeException( message.toString(), e ); } } } finally { ctx.exitFrame(); } return false; }
Source:
public void processBarrier(CheckpointBarrier receivedBarrier, InputChannelInfo channelInfo) throws IOException { final long barrierId = receivedBarrier.getId(); if (totalNumberOfInputChannels == 1) { resumeConsumption(channelInfo); if (barrierId > currentCheckpointId) { currentCheckpointId = barrierId; markCheckpointStart(receivedBarrier.getTimestamp()); markAlignmentEnd(0); notifyCheckpoint(receivedBarrier); } return; } if (isCheckpointPending()) { if (barrierId == currentCheckpointId) { onBarrier(channelInfo); } else if (barrierId > currentCheckpointId) { LOG.warn("{}: Received checkpoint barrier for checkpoint before completing current checkpoint {}. " + "Skipping current checkpoint.", taskName, barrierId, currentCheckpointId); notifyAbort(currentCheckpointId, new CheckpointException( "Barrier id: " + barrierId, CheckpointFailureReason.CHECKPOINT_DECLINED_SUBSUMED)); releaseBlocksAndResetBarriers(); beginNewAlignment(barrierId, channelInfo, receivedBarrier.getTimestamp()); } else { resumeConsumption(channelInfo); } } else if (barrierId > currentCheckpointId) { beginNewAlignment(barrierId, channelInfo, receivedBarrier.getTimestamp()); } else { resumeConsumption(channelInfo); } if (numBarriersReceived + numClosedChannels == totalNumberOfInputChannels) { if (LOG.isDebugEnabled()) { LOG.debug("{}: Received all barriers, triggering checkpoint at {}.", taskName, receivedBarrier.getId(), receivedBarrier.getTimestamp()); } releaseBlocksAndResetBarriers(); notifyCheckpoint(receivedBarrier); } }

Target:
public void processBarrier(CheckpointBarrier receivedBarrier, InputChannelInfo channelInfo) throws IOException { final long barrierId = receivedBarrier.getId(); if (totalNumberOfInputChannels == 1) { resumeConsumption(channelInfo); if (barrierId > currentCheckpointId) { currentCheckpointId = barrierId; markAlignmentStartAndEnd(receivedBarrier.getTimestamp()); notifyCheckpoint(receivedBarrier); } return; } if (isCheckpointPending()) { if (barrierId == currentCheckpointId) { onBarrier(channelInfo); } else if (barrierId > currentCheckpointId) { LOG.warn("{}: Received checkpoint barrier for checkpoint before completing current checkpoint {}. " + "Skipping current checkpoint.", taskName, barrierId, currentCheckpointId); notifyAbort(currentCheckpointId, new CheckpointException( "Barrier id: " + barrierId, CheckpointFailureReason.CHECKPOINT_DECLINED_SUBSUMED)); releaseBlocksAndResetBarriers(); beginNewAlignment(barrierId, channelInfo, receivedBarrier.getTimestamp()); } else { resumeConsumption(channelInfo); } } else if (barrierId > currentCheckpointId) { beginNewAlignment(barrierId, channelInfo, receivedBarrier.getTimestamp()); } else { resumeConsumption(channelInfo); } if (numBarriersReceived + numClosedChannels == totalNumberOfInputChannels) { if (LOG.isDebugEnabled()) { LOG.debug("{}: Received all barriers, triggering checkpoint at {}.", taskName, receivedBarrier.getId(), receivedBarrier.getTimestamp()); } releaseBlocksAndResetBarriers(); markAlignmentEnd(); notifyCheckpoint(receivedBarrier); } }
Source:
public void onCreate() { super.onCreate(); setUpPicasso(); FirebaseApp.initializeApp(this); Mapbox.getInstance(this, getString(R.string.access_token)); Mapbox.getTelemetry().setDebugLoggingEnabled(true); setUpTileLoadingMeasurement(); if (!BuildConfig.DEBUG) { setUpCrashlytics(); } }

Target:
public void onCreate() { super.onCreate(); setUpPicasso(); if (!BuildConfig.DEBUG) { FirebaseApp.initializeApp(this); setUpCrashlytics(); } Mapbox.getInstance(this, getString(R.string.access_token)); Mapbox.getTelemetry().setDebugLoggingEnabled(true); setUpTileLoadingMeasurement(); }
Source:
public CSVTupleDataLoader(ClientImpl client, String procName, BulkLoaderErrorHandler errHandler) throws IOException, ProcCallException { m_client = client; m_insertProcedure = procName; m_errHandler = errHandler; m_es = CoreUtils.getSingleThreadExecutor(procName + "-" + Thread.currentThread().getName()); List<VoltType> typeList = Lists.newArrayList(); VoltTable procInfo = client.callProcedure("@SystemCatalog", "PROCEDURECOLUMNS").getResults()[0]; while (procInfo.advanceRow()) { if (m_insertProcedure.equalsIgnoreCase(procInfo.getString("PROCEDURE_NAME"))) { String typeStr = (String) procInfo.get("TYPE_NAME", VoltType.STRING); typeList.add(VoltType.typeFromString(typeStr)); } } if (typeList.isEmpty()) { throw new RuntimeException("No matching insert procedure available"); } m_columnTypes = typeList.toArray(new VoltType[0]); int sleptTimes = 0; while (!client.isHashinatorInitialized() && sleptTimes < 120) { try { Thread.sleep(500); sleptTimes++; } catch (InterruptedException ex) } }

Target:
public CSVTupleDataLoader(ClientImpl client, String procName, BulkLoaderErrorHandler errHandler) throws IOException, ProcCallException { this(client, procName, errHandler, null); }
Source:
public void read() throws Exception { AlluxioURI path = new AlluxioURI(mFilePath); FileSystemTestUtils.createByteFile( mFileSystem, mFilePath, WritePType.MUST_CACHE, PAGE_SIZE_BYTES); try (FileInStream stream = mFileSystem.openFile(path)) { assertTrue(BufferUtils.equalIncreasingByteArray( PAGE_SIZE_BYTES, ByteStreams.toByteArray(stream))); } URIStatus status = mFileSystem.getStatus(path); try (ReadableByteChannel channel = mCacheManager.get(new PageId(status.getFileId(), 0))) { assertNotNull(channel); assertTrue(BufferUtils.equalIncreasingByteArray( PAGE_SIZE_BYTES, ByteStreams.toByteArray(Channels.newInputStream(channel)))); } mClusterResource.get().stopWorkers(); try (InputStream stream = mFileSystem.openFile(path)) { assertTrue(BufferUtils.equalIncreasingByteArray( PAGE_SIZE_BYTES, ByteStreams.toByteArray(stream))); } }

Target:
public void read() throws Exception { AlluxioURI path = new AlluxioURI(mFilePath); FileSystemTestUtils.createByteFile( mFileSystem, mFilePath, WritePType.MUST_CACHE, PAGE_SIZE_BYTES); try (FileInStream stream = mFileSystem.openFile(path)) { assertTrue(BufferUtils.equalIncreasingByteArray( PAGE_SIZE_BYTES, ByteStreams.toByteArray(stream))); } mClusterResource.get().stopWorkers(); try (InputStream stream = mFileSystem.openFile(path)) { assertTrue(BufferUtils.equalIncreasingByteArray( PAGE_SIZE_BYTES, ByteStreams.toByteArray(stream))); } }
Source:
private Long parseUploadSize(String maxUploadSizeString) throws SizeFormatValidationException { String sizeUnit = maxUploadSizeString.replaceAll("[^A-Z]", ""); Long size = Long.parseLong(maxUploadSizeString.replaceAll("[^0-9]", "")); int pow; switch (sizeUnit) { case "B": pow = 0; break; case "KB": pow = 1; break; case "MB": pow = 2; break; case "GB": pow = 3; break; default: throw new SizeFormatValidationException(sizeUnit + " is not acceptable upload size unit"); } Long multiplier = new Double(Math.pow(1024,pow)).longValue(); return multiplier*size; }

Target:
private Long parseUploadSize(String maxUploadSizeString) throws SizeFormatValidationException { String sizeUnit = maxUploadSizeString.replaceAll("[^A-Z]", ""); Long size = Long.parseLong(maxUploadSizeString.replaceAll("[^0-9]", "")); int pow; switch (sizeUnit) { case "B": pow = 0; break; case "KB": pow = 1; break; case "MB": pow = 2; break; case "GB": pow = 3; break; default: throw new SizeFormatValidationException(sizeUnit + " is not acceptable upload size unit"); } Long multiplier = Double.valueOf(Math.pow(1024,pow)).longValue(); return multiplier*size; }
Source:
public void removeSessionPersistenceSslId() throws InsufficientRequestException, StingrayRestClientObjectNotFoundException, StingrayRestClientException, StmRollBackException { StingrayRestClient client = new StingrayRestClient(); lb.setSessionPersistence(SessionPersistence.SSL_ID); stmAdapter.updateLoadBalancer(config, lb, lb, null); Assert.assertEquals(SessionPersistence.SOURCE_IP.name(), client.getPool(poolName()).getProperties().getBasic().getPersistence_class()); lb.setSessionPersistence(SessionPersistence.NONE); stmAdapter.updateLoadBalancer(config, lb, lb, null); Assert.assertEquals("", client.getPool(poolName()).getProperties().getBasic().getPersistence_class()); lb.setSessionPersistence(SessionPersistence.SSL_ID); stmAdapter.updateLoadBalancer(config, lb, lb, null); Assert.assertEquals(SessionPersistence.SOURCE_IP.name(), client.getPool(poolName()).getProperties().getBasic().getPersistence_class()); lb.setSessionPersistence(null); stmAdapter.updateLoadBalancer(config, lb, lb, null); Assert.assertEquals("", client.getPool(poolName()).getProperties().getBasic().getPersistence_class()); }

Target:
public void removeSessionPersistenceSslId() throws InsufficientRequestException, StingrayRestClientObjectNotFoundException, StingrayRestClientException, StmRollBackException { StingrayRestClient client = new StingrayRestClient(); lb.setSessionPersistence(SessionPersistence.SSL_ID); stmAdapter.updateLoadBalancer(config, lb, lb, null); Assert.assertEquals(SessionPersistence.SSL_ID.name(), client.getPool(poolName()).getProperties().getBasic().getPersistence_class()); lb.setSessionPersistence(SessionPersistence.NONE); stmAdapter.updateLoadBalancer(config, lb, lb, null); Assert.assertEquals("", client.getPool(poolName()).getProperties().getBasic().getPersistence_class()); lb.setSessionPersistence(SessionPersistence.SSL_ID); stmAdapter.updateLoadBalancer(config, lb, lb, null); Assert.assertEquals(SessionPersistence.SSL_ID.name(), client.getPool(poolName()).getProperties().getBasic().getPersistence_class()); lb.setSessionPersistence(null); stmAdapter.updateLoadBalancer(config, lb, lb, null); Assert.assertEquals("", client.getPool(poolName()).getProperties().getBasic().getPersistence_class()); }
Source:
public int serialize(OutputStream out, Tuple input) throws IOException { JSONObject jsonObject = new JSONObject(); for (int i = 0; i < columnNum; i++) { if (input.isNull(i)) { continue; } String fieldName = simpleNames[i]; Type type = types[i]; switch (type) { case BOOLEAN: jsonObject.put(fieldName, input.getBool(i)); break; case INT1: case INT2: jsonObject.put(fieldName, input.getInt2(i)); break; case INT4: jsonObject.put(fieldName, input.getInt4(i)); break; case INT8: jsonObject.put(fieldName, input.getInt8(i)); break; case FLOAT4: jsonObject.put(fieldName, input.getFloat4(i)); break; case FLOAT8: jsonObject.put(fieldName, input.getFloat8(i)); break; case CHAR: case TEXT: case VARCHAR: case INET4: case TIMESTAMP: case DATE: case TIME: case INTERVAL: jsonObject.put(fieldName, input.getText(i)); break; case BIT: case BINARY: case BLOB: case VARBINARY: jsonObject.put(fieldName, input.getBytes(i)); break; case NULL_TYPE: break; default: throw new NotImplementedException(types[i].name() + " is not supported."); } } String jsonStr = jsonObject.toJSONString(); byte jsonBytes = jsonStr.getBytes(); out.write(jsonBytes); return jsonBytes.length; }

Target:
public int serialize(OutputStream out, Tuple input) throws IOException { JSONObject jsonObject = new JSONObject(); for (int i = 0; i < columnNum; i++) { if (input.isNull(i)) { continue; } String fieldName = simpleNames[i]; Type type = types[i]; switch (type) { case BOOLEAN: jsonObject.put(fieldName, input.getBool(i)); break; case INT1: case INT2: jsonObject.put(fieldName, input.getInt2(i)); break; case INT4: jsonObject.put(fieldName, input.getInt4(i)); break; case INT8: jsonObject.put(fieldName, input.getInt8(i)); break; case FLOAT4: jsonObject.put(fieldName, input.getFloat4(i)); break; case FLOAT8: jsonObject.put(fieldName, input.getFloat8(i)); break; case CHAR: case TEXT: case VARCHAR: case INET4: case TIMESTAMP: case DATE: case TIME: case INTERVAL: jsonObject.put(fieldName, input.getText(i)); break; case BIT: case BINARY: case BLOB: case VARBINARY: jsonObject.put(fieldName, input.getBytes(i)); break; case NULL_TYPE: break; default: throw new NotImplementedException(types[i].name() + " is not supported."); } } String jsonStr = jsonObject.toJSONString(); byte jsonBytes = jsonStr.getBytes(TextDatum.DEFAULT_CHARSET); out.write(jsonBytes); return jsonBytes.length; }
Source:
public int execute() throws HiveException { Context ctx = context.getDriverQueue().getCtx(); HiveTxnManager txnManager = ctx.getHiveTxnManager(); return txnManager.lockTable(context.getDb(), desc); }

Target:
public int execute() throws HiveException { Context ctx = context.getContext(); HiveTxnManager txnManager = ctx.getHiveTxnManager(); return txnManager.lockTable(context.getDb(), desc); }
Source:
protected void setupTicks(boolean isSpout) { final Integer tickTimeSecs = ObjectReader.getInt(topoConf.get(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS), null); if (tickTimeSecs != null) { boolean enableMessageTimeout = (Boolean) topoConf.get(Config.TOPOLOGY_ENABLE_MESSAGE_TIMEOUTS); if ((!Acker.ACKER_COMPONENT_ID.equals(componentId) && Utils.isSystemId(componentId)) || (!enableMessageTimeout && isSpout)) { LOG.info("Timeouts disabled for executor " + componentId + ":" + executorId); } else { StormTimer timerTask = workerData.getUserTimer(); timerTask.scheduleRecurring(tickTimeSecs, tickTimeSecs, () -> { TupleImpl tuple = new TupleImpl(workerTopologyContext, new Values(tickTimeSecs), Constants.SYSTEM_COMPONENT_ID, (int) Constants.SYSTEM_TASK_ID, Constants.SYSTEM_TICK_STREAM_ID); AddressedTuple tickTuple = new AddressedTuple(AddressedTuple.BROADCAST_DEST, tuple); try { receiveQueue.publish(tickTuple); receiveQueue.flush(); } catch (InterruptedException e) { LOG.warn("Thread interrupted when emitting tick tuple. Setting interrupt flag."); Thread.currentThread().interrupt(); return; } } ); } } }

Target:
protected void setupTicks(boolean isSpout) { final Integer tickTimeSecs = ObjectReader.getInt(topoConf.get(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS), null); if (tickTimeSecs != null) { boolean enableMessageTimeout = (Boolean) topoConf.get(Config.TOPOLOGY_ENABLE_MESSAGE_TIMEOUTS); if ((!Acker.ACKER_COMPONENT_ID.equals(componentId) && Utils.isSystemId(componentId)) || (!enableMessageTimeout && isSpout)) { LOG.info("Timeouts disabled for executor {}:{}", componentId, executorId); } else { StormTimer timerTask = workerData.getUserTimer(); timerTask.scheduleRecurring(tickTimeSecs, tickTimeSecs, () -> { TupleImpl tuple = new TupleImpl(workerTopologyContext, new Values(tickTimeSecs), Constants.SYSTEM_COMPONENT_ID, (int) Constants.SYSTEM_TASK_ID, Constants.SYSTEM_TICK_STREAM_ID); AddressedTuple tickTuple = new AddressedTuple(AddressedTuple.BROADCAST_DEST, tuple); try { receiveQueue.publish(tickTuple); receiveQueue.flush(); } catch (InterruptedException e) { LOG.warn("Thread interrupted when emitting tick tuple. Setting interrupt flag."); Thread.currentThread().interrupt(); return; } } ); } } }
Source:
private String processQuery(String luceneQuery) throws DotDataException, DotSecurityException { if (luceneQuery == null) { return null; } if (luceneQuery.contains(Contentlet.STRUCTURE_NAME_KEY + ":")) { luceneQuery = luceneQuery.replace(Contentlet.STRUCTURE_NAME_KEY + ":", "ContentType:"); } String stInodeKey = Contentlet.STRUCTURE_INODE_KEY + ":"; if (luceneQuery.contains(stInodeKey)) { int startIndex = luceneQuery.indexOf(stInodeKey) + stInodeKey.length(); int endIndex = luceneQuery.indexOf(" ", startIndex); String inode = (endIndex < 0) ? luceneQuery.substring(startIndex) : luceneQuery.substring(startIndex, endIndex); ContentType type = APILocator.getContentTypeAPI(APILocator.systemUser()).find(inode); if (type != null && InodeUtils.isSet(type.inode())) { luceneQuery = luceneQuery.replace(Contentlet.STRUCTURE_INODE_KEY + ":", "ContentType:"); luceneQuery = luceneQuery.replace(inode, type.variable()); } } return luceneQuery; }

Target:
private String processQuery(String luceneQuery) throws DotDataException, DotSecurityException { if (luceneQuery == null) { return null; } if (luceneQuery.contains(Contentlet.STRUCTURE_NAME_KEY + ":")) { luceneQuery = luceneQuery.replaceAll(Contentlet.STRUCTURE_NAME_KEY + ":", "ContentType:"); } String stInodeKey = Contentlet.STRUCTURE_INODE_KEY + ":"; if (luceneQuery.contains(stInodeKey)) { int startIndex = luceneQuery.indexOf(stInodeKey) + stInodeKey.length(); int endIndex = luceneQuery.indexOf(' ', startIndex); String inode = (endIndex < 0) ? luceneQuery.substring(startIndex) : luceneQuery.substring(startIndex, endIndex); ContentType type = APILocator.getContentTypeAPI(APILocator.systemUser()).find(inode); if (type != null && InodeUtils.isSet(type.inode())) { luceneQuery = luceneQuery.replace(Contentlet.STRUCTURE_INODE_KEY + ":", "ContentType:"); luceneQuery = luceneQuery.replace(inode, type.variable()); } } return luceneQuery; }
Source:
private void closeErrorDialog() { int counterErrorDialog = 0; while (informationDialog.isFormOpened()) { counterErrorDialog++; if (counterErrorDialog > 5) { Assert.assertEquals( counterErrorDialog, 5, "The unexpected error information dialog is appeared more 5 times"); } informationDialog.waitFormToOpen(); informationDialog.clickOkBtn(); projectWizard.clickSaveButton(); loader.waitOnClosed(); } }

Target:
private void closeErrorDialog() { int counterErrorDialog = 0; while (informationDialog.isFormOpened()) { counterErrorDialog++; if (counterErrorDialog > 5) { fail( "The unexpected error information dialog is appeared more than " + counterErrorDialog + " times"); } informationDialog.waitFormToOpen(); informationDialog.clickOkBtn(); projectWizard.clickSaveButton(); loader.waitOnClosed(); } }
Source:
public void poll() { try { StringFullResponseHolder response = druidLeaderClient.go( druidLeaderClient.makeRequest(HttpMethod.GET, RulesResource.RULES_ENDPOINT) ); if (!response.getStatus().equals(HttpResponseStatus.OK)) { throw new ISE( "Error while polling rules, status[%s] content[%s]", response.getStatus(), response.getContent() ); } Map<String, List<Rule>> newRules = new HashMap<>( (Map<String, List<Rule>>) jsonMapper.readValue( response.getContent(), new TypeReference<Map<String, List<Rule>>>() { } ) ); log.debug("Got [%,d] rules", newRules.size()); rules.set(newRules); } catch (Exception e) { log.error(e, "Exception while polling for rules"); } }

Target:
public void poll() { try { StringFullResponseHolder response = druidLeaderClient.go( druidLeaderClient.makeRequest(HttpMethod.GET, RulesResource.RULES_ENDPOINT) ); if (!response.getStatus().equals(HttpResponseStatus.OK)) { throw new ISE( "Error while polling rules, status[%s] content[%s]", response.getStatus(), response.getContent() ); } rules.set( Collections.unmodifiableMap(jsonMapper.readValue( response.getContent(), new TypeReference<Map<String, List<Rule>>>() { } )) ); } catch (Exception e) { log.error(e, "Exception while polling for rules"); } }
Source:
public void createVolume(OmVolumeArgs args) throws IOException { try { if(isAclEnabled) { if (!ozAdmins.contains(OZONE_ADMINISTRATORS_WILDCARD) && !ozAdmins.contains(ProtobufRpcEngine.Server.getRemoteUser() .getUserName())) { LOG.error("Only admin users are authorized to create " + "Ozone volumes. User :{} is not an.", ProtobufRpcEngine.Server.getRemoteUser().getUserName()); throw new OMException("Only admin users are authorized to create " + "Ozone volumes.", ResultCodes.PERMISSION_DENIED); } } metrics.incNumVolumeCreates(); volumeManager.createVolume(args); AUDIT.logWriteSuccess(buildAuditMessageForSuccess(OMAction.CREATE_VOLUME, (args == null) ? null : args.toAuditMap())); metrics.incNumVolumes(); } catch (Exception ex) { metrics.incNumVolumeCreateFails(); AUDIT.logWriteFailure( buildAuditMessageForFailure(OMAction.CREATE_VOLUME, (args == null) ? null : args.toAuditMap(), ex) ); throw ex; } }

Target:
public void createVolume(OmVolumeArgs args) throws IOException { try { if(isAclEnabled) { if (!ozAdmins.contains(OZONE_ADMINISTRATORS_WILDCARD) && !ozAdmins.contains(ProtobufRpcEngine.Server.getRemoteUser() .getUserName())) { LOG.error("Only admin users are authorized to create " + "Ozone volumes. User :{} is not an admin.", ProtobufRpcEngine.Server.getRemoteUser().getUserName()); throw new OMException("Only admin users are authorized to create " + "Ozone volumes.", ResultCodes.PERMISSION_DENIED); } } metrics.incNumVolumeCreates(); volumeManager.createVolume(args); AUDIT.logWriteSuccess(buildAuditMessageForSuccess(OMAction.CREATE_VOLUME, (args == null) ? null : args.toAuditMap())); metrics.incNumVolumes(); } catch (Exception ex) { metrics.incNumVolumeCreateFails(); AUDIT.logWriteFailure( buildAuditMessageForFailure(OMAction.CREATE_VOLUME, (args == null) ? null : args.toAuditMap(), ex) ); throw ex; } }
Source:
public final List<CredentialsDescriptor> getCredentialsDescriptors() { List<CredentialsDescriptor> result = DescriptorVisibilityFilter.apply(this, ExtensionList.lookup(CredentialsDescriptor.class)); if (!(result instanceof ArrayList)) { result = new ArrayList<>(result); } result.removeIf(d -> !_isApplicable(d)); return result; }

Target:
public final List<CredentialsDescriptor> getCredentialsDescriptors() { return DescriptorVisibilityFilter.apply(this, ExtensionList.lookup(CredentialsDescriptor.class)) .stream() .filter(this::_isApplicable) .collect(Collectors.toList()); }
Source:
private boolean startPacketRecovery(FlexFec03Packet fecPacket, RawPacket recoveredPacket) { if (fecPacket.getLength() < FlexFec03Packet.FIXED_HEADER_SIZE) { logger.error("Given FlexFEC packet is too small"); return false; } if (recoveredPacket.getBuffer().length < RawPacket.FIXED_HEADER_SIZE) { logger.error("Given RawPacket buffer is too small"); return false; } System.arraycopy(fecPacket.getBuffer(), fecPacket.getHeaderLength(), recoveredPacket.getBuffer(), 0, RawPacket.FIXED_HEADER_SIZE); System.arraycopy( fecPacket.getBuffer(), fecPacket.getHeaderLength() + fecPacket.getFlexFecHeaderSize(), recoveredPacket.getBuffer(), RawPacket.FIXED_HEADER_SIZE, fecPacket.getPayloadLength()); return true; }

Target:
private boolean startPacketRecovery(FlexFec03Packet fecPacket, RawPacket recoveredPacket) { if (fecPacket.getLength() < RawPacket.FIXED_HEADER_SIZE) { logger.error("Given FlexFEC packet is too small"); return false; } if (recoveredPacket.getBuffer().length < fecPacket.getLength()) { logger.error("Given RawPacket buffer is too small"); return false; } System.arraycopy(fecPacket.getBuffer(), fecPacket.getFlexFecHeaderOffset(), recoveredPacket.getBuffer(), 0, RawPacket.FIXED_HEADER_SIZE); System.arraycopy( fecPacket.getBuffer(), fecPacket.getFlexFecHeaderOffset() + fecPacket.getFlexFecHeaderSize(), recoveredPacket.getBuffer(), RawPacket.FIXED_HEADER_SIZE, fecPacket.getFlexFecPayloadLength()); return true; }
Source:
public void tearDown() { mHandlerThread.quitSafely(); }

Target:
public void tearDown() throws Exception { try { mHandlerThread.quitSafely(); } finally { super.tearDown(); } }
Source:
public IgniteInternalFuture<?> rebuildIndexesFromHash(GridCacheContext cctx) { assert nonNull(cctx); if (rebuildIsMeaningless(cctx)) return null; boolean empty = true; for (IgniteCacheOffheapManager.CacheDataStore store : cctx.offheap().cacheDataStores()) { if (!store.isEmpty()) { empty = false; break; } } if (empty) return null; if (!busyLock.enterBusy()) { return new GridFinishedFuture<>(new NodeStoppingException("Failed to rebuild indexes from hash " + "(grid is stopping).")); } try { return rebuildIndexesFromHash0(cctx, false); } finally { busyLock.leaveBusy(); } }

Target:
public IgniteInternalFuture<?> rebuildIndexesFromHash(GridCacheContext cctx) { assert nonNull(cctx); if (rebuildIsMeaningless(cctx)) return chainIndexRebuildFuture(null, cctx); boolean empty = true; for (IgniteCacheOffheapManager.CacheDataStore store : cctx.offheap().cacheDataStores()) { if (!store.isEmpty()) { empty = false; break; } } if (empty) return chainIndexRebuildFuture(null, cctx); if (!busyLock.enterBusy()) { return new GridFinishedFuture<>(new NodeStoppingException("Failed to rebuild indexes from hash " + "(grid is stopping).")); } try { return rebuildIndexesFromHash0(cctx); } finally { busyLock.leaveBusy(); } }
Source:
protected void processAuxiliary(boolean finalize) { if (waitingEvents.size() > 0) { Iterator<Map.Entry<T, Future<Slice>>> waitIterator = waitingEvents.entrySet().iterator(); while (waitIterator.hasNext()) { Map.Entry<T, Future<Slice>> waitingEvent = waitIterator.next(); T tuple = waitingEvent.getKey(); Slice tupleKey = getKey(tuple); long tupleTime = getTime(tuple); Future<Slice> future = waitingEvent.getValue(); if (future.isDone() || finalize ) { try { if (future.get() == null && asyncEvents.get(tupleKey) == null) { managedState.put(tupleTime, tupleKey, tupleKey); asyncEvents.put(tupleKey, tupleTime); processUnique(tuple); } else { processDuplicate(tuple); } } catch (InterruptedException | ExecutionException e) { throw new RuntimeException("handle idle time", e); } waitIterator.remove(); } } } else { try { Thread.sleep(sleepMillis); } catch (InterruptedException ie) { throw new RuntimeException(ie); } } }

Target:
protected void processAuxiliary(boolean finalize) { if (waitingEvents.size() > 0) { Iterator<Map.Entry<T, Future<Slice>>> waitIterator = waitingEvents.entrySet().iterator(); while (waitIterator.hasNext()) { Map.Entry<T, Future<Slice>> waitingEvent = waitIterator.next(); T tuple = waitingEvent.getKey(); Slice tupleKey = getKey(tuple); long tupleTime = getTime(tuple); Future<Slice> future = waitingEvent.getValue(); if (future.isDone() || finalize ) { try { if (future.get() == null && asyncEvents.get(tupleKey) == null) { managedState.put(tupleTime, tupleKey, new Slice(new byte[0])); asyncEvents.put(tupleKey, tupleTime); processUnique(tuple); } else { processDuplicate(tuple); } } catch (InterruptedException | ExecutionException e) { throw new RuntimeException("handle idle time", e); } waitIterator.remove(); } if (!finalize) { break; } } } }
Source:
public StreamDescriptor(String streamName, int streamId, String fieldName, OrcType orcType, OrcDataSource orcDataSource, List<StreamDescriptor> nestedStreams, int sequence) { this.streamName = requireNonNull(streamName, "streamName is null"); this.streamId = streamId; this.sequence = sequence; this.fieldName = requireNonNull(fieldName, "fieldName is null"); this.orcType = requireNonNull(orcType, "type is null"); this.orcDataSource = requireNonNull(orcDataSource, "orcDataSource is null"); this.nestedStreams = ImmutableList.copyOf(requireNonNull(nestedStreams, "nestedStreams is null")); }

Target:
public StreamDescriptor(String streamName, int streamId, String fieldName, OrcType orcType, OrcDataSource orcDataSource, List<StreamDescriptor> nestedStreams, int sequence) { this.streamName = requireNonNull(streamName, "streamName is null"); this.streamId = streamId; this.sequence = sequence; this.fieldName = requireNonNull(fieldName, "fieldName is null"); this.orcType = requireNonNull(orcType, "orcType is null"); this.orcDataSource = requireNonNull(orcDataSource, "orcDataSource is null"); this.nestedStreams = ImmutableList.copyOf(requireNonNull(nestedStreams, "nestedStreams is null")); }
Source:
public static double alpha(int indexBitLength) { double alpha; switch (indexBitLength) { case 4: alpha = 0.673; break; case 5: alpha = 0.697; break; case 6: alpha = 0.709; break; default: alpha = (0.7213 / (1 + 1.079 / numberOfBuckets(indexBitLength))); } return alpha; }

Target:
public static double alpha(int indexBitLength) { switch (indexBitLength) { case 4: return 0.673; case 5: return 0.697; case 6: return 0.709; default: return (0.7213 / (1 + 1.079 / numberOfBuckets(indexBitLength))); } }
Source:
void enqueue() throws IOException; } private final List<QueueRequestCallback> pendingBatchEntries; private final BatchRequest batch; private final long maxRequestsPerBatch; private boolean flushing = false; private BatchHelper(HttpRequestInitializer requestInitializer, Storage gcs, long maxRequestsPerBatch) { this.pendingBatchEntries = new LinkedList<>(); this.batch = gcs.batch(requestInitializer); this.batch.getBatchUrl().appendRawPath("/" + Storage.DEFAULT_SERVICE_PATH); this.maxRequestsPerBatch = maxRequestsPerBatch; }

Target:
void enqueue() throws IOException; } private final List<QueueRequestCallback> pendingBatchEntries; private final BatchRequest batch; private final long maxRequestsPerBatch; private boolean flushing = false; private BatchHelper(HttpRequestInitializer requestInitializer, Storage gcs, long maxRequestsPerBatch) { this.pendingBatchEntries = new LinkedList<>(); this.batch = gcs.batch(requestInitializer); if (this.batch.getBatchUrl().getRawPath().endsWith("batch")) { this.batch.getBatchUrl().appendRawPath("/" + Storage.DEFAULT_SERVICE_PATH); } this.maxRequestsPerBatch = maxRequestsPerBatch; }
Source:
private boolean itemIdProvided() { String id = request.getElement().element("pubsub").element("retract") .element("item").attributeValue("id"); if ((id != null) && !id.equals("")) { if (true == GlobalItemIDImpl.isGlobalId(id)) { itemId = GlobalItemIDImpl.fromBuddycloudString(id); } else { itemId = new GlobalItemIDImpl(new JID(this.getServerDomain()), node, id); } return true; } response.setType(IQ.Type.error); Element nodeIdRequired = new DOMElement("item-required", new Namespace( "", JabberPubsub.NS_PUBSUB_ERROR)); Element badRequest = new DOMElement( PacketError.Condition.bad_request.toXMPP(), new Namespace("", JabberPubsub.NS_XMPP_STANZAS)); Element error = new DOMElement("error"); error.addAttribute("type", PacketError.Type.modify.toXMPP()); error.add(badRequest); error.add(nodeIdRequired); response.setChildElement(error); return false; }

Target:
private boolean itemIdProvided() { String id = request.getElement().element("pubsub").element("retract") .element("item").attributeValue("id"); if ((id != null) && !id.isEmpty()) { if (true == GlobalItemIDImpl.isGlobalId(id)) { itemId = GlobalItemIDImpl.fromBuddycloudString(id); } else { itemId = new GlobalItemIDImpl(new JID(this.getServerDomain()), node, id); } return true; } response.setType(IQ.Type.error); Element nodeIdRequired = new DOMElement("item-required", new Namespace( "", JabberPubsub.NS_PUBSUB_ERROR)); Element badRequest = new DOMElement( PacketError.Condition.bad_request.toXMPP(), new Namespace("", JabberPubsub.NS_XMPP_STANZAS)); Element error = new DOMElement("error"); error.addAttribute("type", PacketError.Type.modify.toXMPP()); error.add(badRequest); error.add(nodeIdRequired); response.setChildElement(error); return false; }
Source:
private void loadConfigFromResource() { if (configLoad) return; try { Log.d(TAG, "Load config from assets"); InputStream stream = getInstrumentation().getContext().getAssets() .open("integration_tests.properties"); Properties p = new Properties(); p.load(stream); tenants.put(TenantType.AAD, TenantInfo.parseTenant(TenantType.AAD, p)); tenants.put(TenantType.ADFS30, TenantInfo.parseTenant(TenantType.ADFS30, p)); tenants.put(TenantType.ADFS20FEDERATED, TenantInfo.parseTenant(TenantType.ADFS20FEDERATED, p)); tenants.put(TenantType.ADFS30FEDERATED, TenantInfo.parseTenant(TenantType.ADFS30FEDERATED, p)); } catch (IOException e) { e.printStackTrace(); Log.d(TAG, e.getMessage()); } configLoad = true; }

Target:
private void loadConfigFromResource() { if (configLoad) return; try { Log.d(TAG, "Load config from assets"); InputStream stream = getInstrumentation().getContext().getAssets() .open("integration_tests.properties"); Properties p = new Properties(); p.load(stream); tenants.put(TenantType.AAD, TenantInfo.parseTenant(TenantType.AAD, p)); tenants.put(TenantType.ADFS30, TenantInfo.parseTenant(TenantType.ADFS30, p)); tenants.put(TenantType.ADFS20FEDERATED, TenantInfo.parseTenant(TenantType.ADFS20FEDERATED, p)); tenants.put(TenantType.ADFS30FEDERATED, TenantInfo.parseTenant(TenantType.ADFS30FEDERATED, p)); } catch (IOException e) { e.printStackTrace(); Log.d(TAG, e.getMessage()); Assert.fail("Config is not loaded"); } configLoad = true; }
Source:
private void checkMissingField(final Contentlet contentlet, final Language language, final String fieldName) { if (!contentlet.getMap().containsKey(fieldName)) { throw new DotContentletValidationException( MessageFormat.format( this.languageAPI.getStringKey(language, "missing.field"), fieldName) ); } }

Target:
private void checkMissingField(final Contentlet contentlet, final Language language, final String fieldName) { final String identifier = contentlet.getIdentifier(); if (!contentlet.getMap().containsKey(fieldName)) { throw new DotContentletValidationException( MessageFormat.format( this.languageAPI.getStringKey(language, "missing.field"), fieldName, identifier) ); } }
Source:
public void toExecute(JobExecutionContext context) throws JobExecutionException { JobDataMap map = context.getMergedJobDataMap(); String ownerId = map.getString(JobStatus.TARGET_ID); String ownerKey = map.getString(JobStatus.OWNER_ID); Owner owner = this.ownerCurator.lockAndLoad(ownerId); Principal principal = (Principal) map.get(PinsetterJobListener.PRINCIPAL_KEY); log.info("GRABBED OWNER: {}", owner); if (owner == null) { log.debug("Owner no longer exists: {}", ownerKey); context.setResult("Nothing to do; owner no longer exists: " + ownerKey); return; } String displayName = owner.getDisplayName(); ExporterMetadata metadata = this.exportCurator.getByTypeAndOwner( ExporterMetadata.TYPE_PER_USER, owner); if (metadata == null) { log.debug("No imports exist for owner {}", displayName); context.setResult("Nothing to do; imports no longer exist for owner: " + displayName); return; } log.info("Deleting all pools originating from manifests for owner/org: {}", displayName); List<Pool> pools = this.poolManager.listPoolsByOwner(owner).list(); for (Pool pool : pools) { if (this.poolManager.isManaged(pool)) { this.poolManager.deletePool(pool); } } UpstreamConsumer uc = owner.getUpstreamConsumer(); owner.setUpstreamConsumer(null); this.exportCurator.delete(metadata); this.recordManifestDeletion(owner, principal.getUsername(), uc); context.setResult("Imported pools removed for owner " + displayName); }

Target:
public void toExecute(JobExecutionContext context) throws JobExecutionException { JobDataMap map = context.getMergedJobDataMap(); String ownerId = map.getString(JobStatus.TARGET_ID); String ownerKey = map.getString(JobStatus.OWNER_ID); Owner owner = this.ownerCurator.lockAndLoad(ownerId); Principal principal = (Principal) map.get(PinsetterJobListener.PRINCIPAL_KEY); if (owner == null) { log.debug("Owner no longer exists: {}", ownerKey); context.setResult("Nothing to do; owner no longer exists: " + ownerKey); return; } String displayName = owner.getDisplayName(); ExporterMetadata metadata = this.exportCurator.getByTypeAndOwner( ExporterMetadata.TYPE_PER_USER, owner); if (metadata == null) { log.debug("No imports exist for owner {}", displayName); context.setResult("Nothing to do; imports no longer exist for owner: " + displayName); return; } log.info("Deleting all pools originating from manifests for owner/org: {}", displayName); List<Pool> pools = this.poolManager.listPoolsByOwner(owner).list(); for (Pool pool : pools) { if (this.poolManager.isManaged(pool)) { this.poolManager.deletePool(pool); } } UpstreamConsumer uc = owner.getUpstreamConsumer(); owner.setUpstreamConsumer(null); this.exportCurator.delete(metadata); this.recordManifestDeletion(owner, principal.getUsername(), uc); context.setResult("Imported pools removed for owner " + displayName); }
Source:
public WebSocketBase pongHandler(Handler<Buffer> handler) { synchronized (conn) { checkClosed(); if (frameHandler == null || frameHandler.getClass() != FrameAggregator.class) { frameHandler = new FrameAggregator(); } ((FrameAggregator) frameHandler).pongHandler = handler; return this; } }

Target:
public WebSocketBase pongHandler(Handler<Buffer> handler) { synchronized (conn) { checkClosed(); this.pongHandler = handler; return (S) this; } }
Source:
public void testCustomProperties() throws IOException { DocumentModel file = session.createDocumentModel("/", "myFile", "File"); file = session.createDocument(file); txFeature.nextTransaction(); PageProvider<?> pp = pps.getPageProvider("DOCUMENT_HISTORY_PROVIDER", null, Long.valueOf(20), Long.valueOf(0), new HashMap<>(), file); @SuppressWarnings("unchecked") List<LogEntry> entries = (List<LogEntry>) pp.getCurrentPage(); if (entries.isEmpty()) { fail(); } RenderingContext renderingCtx = RenderingContext.CtxBuilder.fetch(LogEntryCSVWriter.ENTITY_TYPE, "principalName", "docLifeCycle", "docPath", "docType").get(); for (LogEntry entry : entries) { CSVAssert csv = csvAssert(entry, renderingCtx); csv.has("principalName").isEquals("Administrator"); csv.has("docLifeCycle").isEquals("project"); csv.has("docPath").isEquals("/myFile"); csv.has("docType").isEquals("File"); List<String> unwantedProps = List.of("category", "comment", "eventId", "eventDate", "logDate"); for (String property : unwantedProps) { try { csv.has(property); fail(); } catch (AssertionError e) { assertEquals("no field " + property, e.getMessage()); } } } }

Target:
public void testCustomProperties() throws IOException { RenderingContext renderingCtx = RenderingContext.CtxBuilder.fetch(ENTITY_TYPE, "principalName", "docLifeCycle", "docPath", "docType", "docUUID").get(); for (LogEntry entry : getLogEntries()) { CSVAssert csv = csvAssert(entry, renderingCtx); csv.has("principalName").isEquals("Administrator"); csv.has("docLifeCycle").isEquals("project"); csv.has("docPath").isEquals("/myFile"); csv.has("docType").isEquals("File"); csv.has("docUUID").isEquals(file.getId()); List<String> unwantedProps = List.of("category", "comment", "eventId", "eventDate", "logDate"); for (String property : unwantedProps) { try { csv.has(property); fail(); } catch (AssertionError e) { assertEquals("no field " + property, e.getMessage()); } } } }
Source:
protected KafkaDynamicSinkBase( DataType consumedDataType, String topic, Properties properties, Optional<FlinkKafkaPartitioner<RowData>> partitioner, EncodingFormat<SerializationSchema<RowData>> encodingFormat) { this.consumedDataType = Preconditions.checkNotNull(consumedDataType, "Consumed data type must not be null."); this.topic = Preconditions.checkNotNull(topic, "Topic must not be null."); this.properties = Preconditions.checkNotNull(properties, "Properties must not be null."); this.partitioner = Preconditions.checkNotNull(partitioner, "Partitioner must not be null."); this.encodingFormat = Preconditions.checkNotNull(encodingFormat, "Sink format must not be null."); }

Target:
protected KafkaDynamicSinkBase( DataType consumedDataType, String topic, Properties properties, Optional<FlinkKafkaPartitioner<RowData>> partitioner, EncodingFormat<SerializationSchema<RowData>> encodingFormat) { this.consumedDataType = Preconditions.checkNotNull(consumedDataType, "Consumed data type must not be null."); this.topic = Preconditions.checkNotNull(topic, "Topic must not be null."); this.properties = Preconditions.checkNotNull(properties, "Properties must not be null."); this.partitioner = Preconditions.checkNotNull(partitioner, "Partitioner must not be null."); this.encodingFormat = Preconditions.checkNotNull(encodingFormat, "Encoding format must not be null."); }
Source:
public CommandResult runCommand(Integer id, String command) { return null; }

Target:
public CommandResult runCommand(Integer id, String command) { throw new RuntimeException("Not implemented, yet"); }
Source:
public Response reliableRequest(final Request request, final int[] retryCodes, int retries, final long delayMillis) { Response response = null; while (retries > 0) { response = makeRequest(request); if (!shouldRetry(response, retryCodes)) { return response; } try { Thread.sleep(delayMillis); } catch (final InterruptedException e) { } retries--; } last_request = request; last_response = response; return response; }

Target:
public Response reliableRequest(final Request request, final int[] retryCodes, int retries, final long delayMillis) { lastRequest = request; Response response = null; while (retries > 0) { response = makeRequest(request); if (!shouldRetry(response, retryCodes)) { break; } try { Thread.sleep(delayMillis); } catch (final InterruptedException e) { } retries--; } lastResponse = response; return response; }