auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String toString() { final StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("EJBClientCluster(name="); stringBuffer.append(name); stringBuffer.append(", max nodes="); stringBuffer.append(maximumConnectedNodes); stringBuffer.append(", connect timeout milis="); stringBuffer.append(connectTimeoutMilliseconds); stringBuffer.append("selector="); stringBuffer.append(clusterNodeSelector); stringBuffer.append(", override config="); stringBuffer.append(overrideConfiguration); stringBuffer.append(")"); return stringBuffer.toString(); }

Target:
public String toString() { final StringBuilder builder = new StringBuilder(); builder.append("EJBClientCluster(name="); builder.append(name); builder.append(", max nodes="); builder.append(maximumConnectedNodes); builder.append(", connect timeout milis="); builder.append(connectTimeoutMilliseconds); builder.append(", selector="); builder.append(clusterNodeSelector); builder.append(", override config="); builder.append(overrideConfiguration); builder.append(")"); return builder.toString(); }
Source:
public void putDirectory(final String rawPath, final boolean recursive, final MantaHttpHeaders headers) throws IOException { if (!recursive) { putDirectory(rawPath, headers); return; } final Integer skipDepth = config.getSkipDirectoryDepth(); final RecursiveDirectoryCreationStrategy directoryCreationStrategy; if (skipDepth != null && 0 < skipDepth) { directoryCreationStrategy = new DepthSkippingDirectoryCreationStrategy(this, skipDepth); } else { directoryCreationStrategy = new PessimisticDirectoryCreationStrategy(this); } putDirectory(rawPath, headers, directoryCreationStrategy); }

Target:
public void putDirectory(final String rawPath, final boolean recursive, final MantaHttpHeaders headers) throws IOException { if (!recursive) { putDirectory(rawPath, headers); return; } final Integer skipDepth = config.getSkipDirectoryDepth(); if (skipDepth != null && 0 < skipDepth) { RecursiveDirectoryCreationStrategy.createWithSkipDepth(this, rawPath, headers, skipDepth); } else { RecursiveDirectoryCreationStrategy.createCompletely(this, rawPath, headers); } }
Source:
private List<String> toFilterList(Resource list) { List<String> result = new ArrayList<>(); Resource current = list; while (current != null && ! current.equals(RDF.nil)){ Statement stmt = current.getProperty(RDF.first); if (stmt == null) { throw new TextIndexException("filter list not well formed"); } RDFNode node = stmt.getObject(); if (! node.isResource()) { throw new TextIndexException("filter is not a resource : " + node); } Resource res = (Resource)node; result.add(res.getLocalName()); stmt = current.getProperty(RDF.rest); if (stmt == null) { throw new TextIndexException("filter list not terminated by rdf:nil"); } node = stmt.getObject(); if (! node.isResource()) { throw new TextIndexException("filter list node is not a resource : " + node); } current = (Resource) node; } return result; }

Target:
private List<String> toFilterList(Resource list) { List<String> result = new ArrayList<>(); Resource current = list; while (current != null && ! current.equals(RDF.nil)){ Statement stmt = current.getProperty(RDF.first); if (stmt == null) { throw new TextIndexException("filter list not well formed"); } RDFNode node = stmt.getObject(); if (! node.isResource()) { throw new TextIndexException("filter is not a resource : " + node); } result.add(node.asResource().getLocalName()); stmt = current.getProperty(RDF.rest); if (stmt == null) { throw new TextIndexException("filter list not terminated by rdf:nil"); } node = stmt.getObject(); if (! node.isResource()) { throw new TextIndexException("filter list node is not a resource : " + node); } current = node.asResource(); } return result; }
Source:
public void visit(LayoutModel<N, P> layoutModel) { super.visit(layoutModel); this.m_currentPoint = pointModel.newPoint(0, 0); buildTree(layoutModel); }

Target:
public void visit(LayoutModel<N, P> layoutModel) { super.visit(layoutModel); buildTree(layoutModel); }
Source:
public RootCauseMetricResource(ExecutorService executor, AggregationLoader aggregationLoader, TimeSeriesLoader timeSeriesLoader, MetricConfigManager metricDAO, DatasetConfigManager datasetDAO, EventManager eventDAO, MergedAnomalyResultManager anomalyDAO, EvaluationManager evaluationDAO) { this.executor = executor; this.aggregationLoader = aggregationLoader; this.timeSeriesLoader = timeSeriesLoader; this.metricDAO = metricDAO; this.datasetDAO = datasetDAO; this.eventDAO = eventDAO; this.anomalyDAO = anomalyDAO; this.evaluationDAO = evaluationDAO; this.loader = new DetectionPipelineLoader(); TimeSeriesLoader timeseriesLoader = new DefaultTimeSeriesLoader(metricDAO, datasetDAO, ThirdEyeCacheRegistry.getInstance().getQueryCache(), ThirdEyeCacheRegistry.getInstance().getTimeSeriesCache()); this.dataProvider = new DefaultDataProvider(metricDAO, datasetDAO, eventDAO, anomalyDAO, evaluationDAO, timeseriesLoader, aggregationLoader, loader, TimeSeriesCacheBuilder.getInstance(), AnomaliesCacheBuilder.getInstance()); }

Target:
public RootCauseMetricResource(ExecutorService executor, AggregationLoader aggregationLoader, TimeSeriesLoader timeSeriesLoader, MetricConfigManager metricDAO, DatasetConfigManager datasetDAO, EventManager eventDAO, MergedAnomalyResultManager anomalyDAO, EvaluationManager evaluationDAO) { this.executor = executor; this.aggregationLoader = aggregationLoader; this.timeSeriesLoader = timeSeriesLoader; this.metricDAO = metricDAO; this.datasetDAO = datasetDAO; TimeSeriesLoader timeseriesLoader = new DefaultTimeSeriesLoader(metricDAO, datasetDAO, ThirdEyeCacheRegistry.getInstance().getQueryCache(), ThirdEyeCacheRegistry.getInstance().getTimeSeriesCache()); this.dataProvider = new DefaultDataProvider(metricDAO, datasetDAO, eventDAO, anomalyDAO, evaluationDAO, timeseriesLoader, aggregationLoader, new DetectionPipelineLoader(), TimeSeriesCacheBuilder.getInstance(), AnomaliesCacheBuilder.getInstance()); }
Source:
public void seekTo(long position, @MediaPlayer2.SeekMode int mode) { mPlayer.setSeekParameters(ExoPlayerUtils.getSeekParameters(mode)); MediaItem2 mediaItem2 = mMediaItemQueue.getCurrentMediaItem(); if (mediaItem2 != null) { if (mediaItem2.getStartPosition() > position || mediaItem2.getEndPosition() < position) { throw new IllegalArgumentException( "Requested seek position is out of range : " + position); } position -= mediaItem2.getStartPosition(); } mPlayer.seekTo(position); }

Target:
public void seekTo(long position, @MediaPlayer2.SeekMode int mode) { mPlayer.setSeekParameters(ExoPlayerUtils.getSeekParameters(mode)); MediaItem2 mediaItem2 = mMediaItemQueue.getCurrentMediaItem(); if (mediaItem2 != null) { Preconditions.checkArgument( mediaItem2.getStartPosition() <= position && mediaItem2.getEndPosition() >= position, "Requested seek position is out of range : " + position); position -= mediaItem2.getStartPosition(); } mPlayer.seekTo(position); }
Source:
void reactOnTopologyChange() { if (null == topologyChangeSubscription) { return; } final ZkSubscriptionClient.Topology topology = topologyChangeSubscription.getData(); final Partition[] assignedPartitions = Stream.of(topology.getPartitions()) .filter(p -> getSessionId().equals(p.getSession())) .toArray(Partition[]::new); addTask(() -> refreshTopologyUnlocked(assignedPartitions)); trackIdleness(topology); if (!streamInitialized) { refreshTopologyUnlocked(assignedPartitions); } }

Target:
void reactOnTopologyChange() { if (null == topologyChangeSubscription) { return; } final ZkSubscriptionClient.Topology topology = topologyChangeSubscription.getData(); final Partition[] assignedPartitions = Stream.of(topology.getPartitions()) .filter(p -> getSessionId().equals(p.getSession())) .toArray(Partition[]::new); addTask(() -> refreshTopologyUnlocked(assignedPartitions)); trackIdleness(topology); }
Source:
public void draw(GC gc, StyledText textWidget, int offset, int length, Color color, int x, int y) { gc.setForeground(color); gc.setBackground(textWidget.getBackground()); List<ICodeMining> minings= new ArrayList<>(fMinings); int nbDraw= 0; int separatorWidth= -1; boolean redrawn= false; int width= 0; for (int i= 0; i < minings.size(); i++) { ICodeMining mining= minings.get(i); if (!mining.isResolved()) { if (!redrawn) { redraw(); redrawn= true; } if (fResolvedMinings != null) { mining= fResolvedMinings[i]; } if (mining == null) { continue; } } else { fResolvedMinings[i]= mining; } if (nbDraw > 0) { gc.drawText(SEPARATOR, x, y); if (separatorWidth == -1) { separatorWidth= gc.stringExtent(SEPARATOR).x; } width+= separatorWidth; x+= separatorWidth; } int miningWidth= mining.draw(gc, textWidget, color, x, y).x; width+= miningWidth; x+= miningWidth; nbDraw++; } if (width != 0) { if (separatorWidth == -1) { separatorWidth= gc.stringExtent(SEPARATOR).x; } width+= separatorWidth; } }

Target:
public void draw(GC gc, StyledText textWidget, int offset, int length, Color color, int x, int y) { gc.setForeground(color); gc.setBackground(textWidget.getBackground()); List<ICodeMining> minings= new ArrayList<>(fMinings); int nbDraw= 0; int separatorWidth= -1; boolean redrawn= false; for (int i= 0; i < minings.size(); i++) { ICodeMining mining= minings.get(i); if (!mining.isResolved()) { if (!redrawn) { redraw(); redrawn= true; } if (fResolvedMinings != null) { mining= fResolvedMinings[i]; } if (mining == null) { continue; } } else { fResolvedMinings[i]= mining; } if (nbDraw > 0) { gc.drawText(SEPARATOR, x, y); if (separatorWidth == -1) { separatorWidth= gc.stringExtent(SEPARATOR).x; } x+= separatorWidth; } x+= mining.draw(gc, textWidget, color, x, y).x; nbDraw++; } }
Source:
public void testBroadcastSerialDataReceiveSubscribedReceive() throws Exception { Mockito.when(receivePacket.getReceiveOptions()).thenReturn(RECEIVE_OPTIONS_BROADCAST); dataReader.addSerialDatatReceiveListener(receiveSerialDataListener); Whitebox.invokeMethod(dataReader, PACKET_RECEIVED_METHOD, receivePacket); PowerMockito.verifyPrivate(dataReader, Mockito.times(1)).invoke(NOTIFY_SERIAL_DATA_RECEIVED_METHOD, XBEE_64BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES, IS_BROADCAST_DATA); Mockito.verify(receiveSerialDataListener, Mockito.times(1)).broadcastSerialDataReceived(XBEE_64BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES); assertEquals(XBEE_64BIT_ADDRESS.toString(), receiveSerialDataListener.getAddress()); assertArrayEquals(RECEIVED_DATA_BYTES, receiveSerialDataListener.getSerialData()); }

Target:
public void testBroadcastSerialDataReceiveSubscribedReceive() throws Exception { Mockito.when(receivePacket.getReceiveOptions()).thenReturn(RECEIVE_OPTIONS_BROADCAST); dataReader.addSerialDatatReceiveListener(receiveSerialDataListener); Whitebox.invokeMethod(dataReader, PACKET_RECEIVED_METHOD, receivePacket); PowerMockito.verifyPrivate(dataReader, Mockito.times(1)).invoke(NOTIFY_SERIAL_DATA_RECEIVED_METHOD, XBEE_64BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES, IS_BROADCAST_DATA); Mockito.verify(receiveSerialDataListener, Mockito.times(1)).broadcastSerialDataReceived(XBEE_64BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES); Mockito.verify(receiveSerialDataListener, Mockito.never()).serialDataReceived(Mockito.anyString(), (byte[])Mockito.any()); assertEquals(XBEE_64BIT_ADDRESS.toString(), receiveSerialDataListener.getAddress()); assertArrayEquals(RECEIVED_DATA_BYTES, receiveSerialDataListener.getSerialData()); }
Source:
public Config[] createGnirsConfig(GnirsParameters gnirsParams, int numExp) { Config[] conf = createCommonConfig(numExp); for (Config step : conf) { step.putItem(ReadModeKey, (gnirsParams.readMode())); step.putItem(InstInstrumentKey, "GNIRS"); step.putItem(SlitWidthKey, gnirsParams.slitWidth().logValue()); if (gnirsParams.altair().isDefined()) { AltairParameters altairParameters = gnirsParams.altair().get(); step.putItem(AOGuideStarTypeKey, altairParameters.wfsMode().displayValue()); step.putItem(AOSystemKey, "Altair"); step.putItem(AOFieldLensKey, altairParameters.fieldLens().displayValue()); } } return conf; }

Target:
public ConfigCreatorResult createGnirsConfig(GnirsParameters gnirsParams, int numExp) { ConfigCreatorResult result = createCommonConfig(numExp); for (Config step : result.getConfig()) { step.putItem(ReadModeKey, (gnirsParams.readMode())); step.putItem(InstInstrumentKey, SPComponentType.INSTRUMENT_GNIRS); step.putItem(SlitWidthKey, gnirsParams.slitWidth()); if (gnirsParams.altair().isDefined()) { AltairParameters altairParameters = gnirsParams.altair().get(); step.putItem(AOGuideStarTypeKey, altairParameters.wfsMode()); step.putItem(AOSystemKey, SPComponentType.AO_ALTAIR); } } return result; }
Source:
public void initialise() { playerCamera = worldRenderer.getActiveCamera(); wireframeStateChange = new SetWireframe(true); renderingDebugConfig = config.getRendering().getDebug(); new WireframeTrigger(renderingDebugConfig, this); requiresCondition(() -> !renderingDebugConfig.isFirstPersonElementsHidden()); renderingDebugConfig.subscribe(RenderingDebugConfig.FIRST_PERSON_ELEMENTS_HIDDEN, this); addDesiredStateChange(new SetViewportToSizeOf(new ResourceUrn("engine:sceneOpaque"), displayResolutionDependentFBOs)); addDesiredStateChange(new SetDepthFunction(GL_ALWAYS)); }

Target:
public void initialise() { playerCamera = worldRenderer.getActiveCamera(); wireframeStateChange = new SetWireframe(true); renderingDebugConfig = config.getRendering().getDebug(); new WireframeTrigger(renderingDebugConfig, this); requiresCondition(() -> !renderingDebugConfig.isFirstPersonElementsHidden()); renderingDebugConfig.subscribe(RenderingDebugConfig.FIRST_PERSON_ELEMENTS_HIDDEN, this); addDesiredStateChange(new SetViewportToSizeOf(READONLY_GBUFFER, displayResolutionDependentFBOs)); sceneOpaqueFbo = displayResolutionDependentFBOs.get(READONLY_GBUFFER); addDesiredStateChange(new SetDepthFunction(GL_ALWAYS)); }
Source:
public void start() throws IOException { myServerSocket = new ServerSocket(); myServerSocket.bind((hostname != null) ? new InetSocketAddress(hostname, myPort) : new InetSocketAddress(myPort)); myThread = new Thread(new Runnable() { @Override public void run() { do { try { f final Socket finalAccept = myServerSocket.accept(); registerConnection(finalAccept); finalAccept.setSoTimeout(SOCKET_READ_TIMEOUT); final InputStream inputStream = finalAccept.getInputStream(); asyncRunner.exec(new Runnable() { @Override public void run() { OutputStream outputStream = null; try { outputStream = finalAccept.getOutputStream(); TempFileManager tempFileManager = tempFileManagerFactory.create(); HTTPSession session = new HTTPSession(tempFileManager, inputStream, outputStream, finalAccept.getInetAddress()); while (!finalAccept.isClosed()) { session.execute(); } } catch (Exception e) { if (!(e instanceof SocketException && "NanoHttpd Shutdown".equals(e.getMessage()))) { e.printStackTrace(); } } finally { safeClose(outputStream); safeClose(inputStream); safeClose(finalAccept); unRegisterConnection(finalAccept); } } }); } catch (IOException e) { } } while (!myServerSocket.isClosed()); } }); myThread.setDaemon(true); myThread.setName("NanoHttpd Main Listener"); myThread.start(); }

Target:
public void start() throws IOException { myServerSocket = new ServerSocket(); myServerSocket.bind((hostname != null) ? new InetSocketAddress(hostname, myPort) : new InetSocketAddress(myPort)); myThread = new Thread(new Runnable() { @Override public void run() { do { try { final Socket finalAccept = myServerSocket.accept(); registerConnection(finalAccept); finalAccept.setSoTimeout(SOCKET_READ_TIMEOUT); final InputStream inputStream = finalAccept.getInputStream(); asyncRunner.exec(new Runnable() { @Override public void run() { OutputStream outputStream = null; try { outputStream = finalAccept.getOutputStream(); TempFileManager tempFileManager = tempFileManagerFactory.create(); HTTPSession session = new HTTPSession(tempFileManager, inputStream, outputStream, finalAccept.getInetAddress()); while (!finalAccept.isClosed()) { session.execute(); } } catch (Exception e) { if (!(e instanceof SocketException && "NanoHttpd Shutdown".equals(e.getMessage()))) { e.printStackTrace(); } } finally { safeClose(outputStream); safeClose(inputStream); safeClose(finalAccept); unRegisterConnection(finalAccept); } } }); } catch (IOException e) { } } while (!myServerSocket.isClosed()); } }); myThread.setDaemon(true); myThread.setName("NanoHttpd Main Listener"); myThread.start(); }
Source:
public static BitSet indexesOf(final Object[] array, final Object objectToFind, int startIndex) { BitSet ret = new BitSet(); if (array == null) { return ret; } while (startIndex < array.length) { startIndex = indexOf(array, objectToFind, startIndex); if (startIndex == INDEX_NOT_FOUND) { break; } ret.set(startIndex); ++startIndex; } return ret; }

Target:
public static BitSet indexesOf(final Object[] array, final Object objectToFind, int startIndex) { BitSet bitSet = new BitSet(); if (array == null) { return bitSet; } while (startIndex < array.length) { startIndex = indexOf(array, objectToFind, startIndex); if (startIndex == INDEX_NOT_FOUND) { break; } bitSet.set(startIndex); ++startIndex; } return bitSet; }
Source:
public void enablePluginInvocation() { canInvokePlugins = true; Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { for (Plugin plugin : getPlugins()) { initPlugin(plugin); } UiPluginsInitializedEvent.fire(PluginManager.this); } }); }

Target:
public void enablePluginInvocation() { canInvokePlugins = true; Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { initAllPlugins(); } }); }
Source:
public boolean interact(Direction side, PlayerEntity player, Hand hand, ItemStack heldItem, float hitX, float hitY, float hitZ) { SawmillTileEntity master = master(); if(master!=null) if(player.isSneaking()&&!master.sawblade.isEmpty()) { if(heldItem.isEmpty()) player.setHeldItem(hand, master.sawblade.copy()); else if(!world.isRemote) player.entityDropItem(master.sawblade.copy(), 0); master.sawblade = ItemStack.EMPTY; this.updateMasterBlock(null, true); return true; } else if(IETags.sawblades.contains(heldItem.getItem())) { ItemStack tempMold = !master.sawblade.isEmpty()?master.sawblade.copy(): ItemStack.EMPTY; master.sawblade = Utils.copyStackWithAmount(heldItem, 1); heldItem.shrink(1); if(heldItem.getCount() <= 0) heldItem = ItemStack.EMPTY; else player.setHeldItem(hand, heldItem); if(!tempMold.isEmpty()) if(heldItem.isEmpty()) player.setHeldItem(hand, tempMold); else if(!world.isRemote) player.entityDropItem(tempMold, 0); this.updateMasterBlock(null, true); return true; } return false; }

Target:
public boolean interact(Direction side, PlayerEntity player, Hand hand, ItemStack heldItem, float hitX, float hitY, float hitZ) { SawmillTileEntity master = master(); if(master!=null) { if(player.isSneaking()&&!master.sawblade.isEmpty()) { if(heldItem.isEmpty()) player.setHeldItem(hand, master.sawblade.copy()); else if(!world.isRemote) player.entityDropItem(master.sawblade.copy(), 0); master.sawblade = ItemStack.EMPTY; this.updateMasterBlock(null, true); return true; } else if(IETags.sawblades.contains(heldItem.getItem())) { ItemStack tempBlade = !master.sawblade.isEmpty()?master.sawblade.copy(): ItemStack.EMPTY; master.sawblade = Utils.copyStackWithAmount(heldItem, 1); heldItem.shrink(1); if(heldItem.getCount() <= 0) heldItem = ItemStack.EMPTY; else player.setHeldItem(hand, heldItem); if(!tempBlade.isEmpty()) { if(heldItem.isEmpty()) player.setHeldItem(hand, tempBlade); else if(!world.isRemote) player.entityDropItem(tempBlade, 0); } this.updateMasterBlock(null, true); return true; } } return false; }
Source:
public void testStressCamera() throws Exception { SurfaceHolder mSurfaceHolder; mSurfaceHolder = MediaFrameworkTest.getSurfaceView().getHolder(); File stressOutFile = new File(WorkDir.getTopDir(), MEDIA_STRESS_OUTPUT); Writer output = new BufferedWriter(new FileWriter(stressOutFile, true)); output.write("Camera start preview stress:\n"); output.write("Total number of loops:" + NUMBER_OF_CAMERA_STRESS_LOOPS + "\n"); Log.v(TAG, "Start preview"); output.write("No of loop: "); final boolean hasRearCamera = mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA); for (int i = 0; i< NUMBER_OF_CAMERA_STRESS_LOOPS; i++) { runOnLooper(new Runnable() { @Override public void run() { if (hasRearCamera) { mCamera = Camera.open(); } else { mCamera = Camera.open(0); } } }); mCamera.setErrorCallback(mCameraErrorCallback); mCamera.setPreviewDisplay(mSurfaceHolder); mCamera.startPreview(); Thread.sleep(WAIT_TIME_CAMERA_TEST); mCamera.stopPreview(); mCamera.release(); output.write(" ," + i); } output.write("\n\n"); output.close(); }

Target:
public void testStressCamera() throws Exception { SurfaceHolder mSurfaceHolder; mSurfaceHolder = MediaFrameworkTest.getSurfaceView().getHolder(); File stressOutFile = new File(WorkDir.getTopDir(), MEDIA_STRESS_OUTPUT); Writer output = new BufferedWriter(new FileWriter(stressOutFile, true)); output.write("Camera start preview stress:\n"); output.write("Total number of loops:" + NUMBER_OF_CAMERA_STRESS_LOOPS + "\n"); Log.v(TAG, "Start preview"); output.write("No of loop: "); for (int i = 0; i< NUMBER_OF_CAMERA_STRESS_LOOPS; i++) { runOnLooper(new Runnable() { @Override public void run() { if (hasRearCamera) { mCamera = Camera.open(); } else if (hasFrontCamera) { mCamera = Camera.open(0); } else { mCamera = null; } } }); if (mCamera == null) { break; } mCamera.setErrorCallback(mCameraErrorCallback); mCamera.setPreviewDisplay(mSurfaceHolder); mCamera.startPreview(); Thread.sleep(WAIT_TIME_CAMERA_TEST); mCamera.stopPreview(); mCamera.release(); output.write(" ," + i); } output.write("\n\n"); output.close(); }
Source:
public void onBuffer(Buffer buffer, int sequenceNumber, int backlog) throws IOException { boolean enqueued = false; try { if (expectedSequenceNumber != sequenceNumber) { onError(new BufferReorderingException(expectedSequenceNumber, sequenceNumber)); return; } final boolean wasEmpty; final CheckpointBarrier notifyReceivedBarrier; final Buffer notifyReceivedBuffer; final BufferReceivedListener listener = inputGate.getBufferReceivedListener(); synchronized (receivedBuffers) { if (isReleased.get()) { return; } wasEmpty = receivedBuffers.isEmpty(); receivedBuffers.add(buffer); enqueued = true; if (listener != null && buffer.isBuffer() && receivedCheckpointId < lastRequestedCheckpointId) { notifyReceivedBuffer = buffer.retainBuffer(); } else { notifyReceivedBuffer = null; } notifyReceivedBarrier = listener != null ? parseCheckpointBarrierOrNull(buffer) : null; } ++expectedSequenceNumber; if (wasEmpty) { notifyChannelNonEmpty(); } if (backlog >= 0) { onSenderBacklog(backlog); } if (notifyReceivedBarrier != null) { receivedCheckpointId = notifyReceivedBarrier.getId(); listener.notifyBarrierReceived(notifyReceivedBarrier, channelInfo); } else if (notifyReceivedBuffer != null) { listener.notifyBufferReceived(notifyReceivedBuffer, channelInfo); } } finally { if (!enqueued) { buffer.recycleBuffer(); } } }

Target:
public void onBuffer(Buffer buffer, int sequenceNumber, int backlog) throws IOException { boolean recycleBuffer = true; try { if (expectedSequenceNumber != sequenceNumber) { onError(new BufferReorderingException(expectedSequenceNumber, sequenceNumber)); return; } final boolean wasEmpty; final CheckpointBarrier notifyReceivedBarrier; final Buffer notifyReceivedBuffer; final BufferReceivedListener listener = inputGate.getBufferReceivedListener(); synchronized (receivedBuffers) { if (isReleased.get()) { return; } wasEmpty = receivedBuffers.isEmpty(); receivedBuffers.add(buffer); if (listener != null && buffer.isBuffer() && receivedCheckpointId < lastRequestedCheckpointId) { notifyReceivedBuffer = buffer.retainBuffer(); } else { notifyReceivedBuffer = null; } notifyReceivedBarrier = listener != null ? parseCheckpointBarrierOrNull(buffer) : null; } recycleBuffer = false; ++expectedSequenceNumber; if (wasEmpty) { notifyChannelNonEmpty(); } if (backlog >= 0) { onSenderBacklog(backlog); } if (notifyReceivedBarrier != null) { receivedCheckpointId = notifyReceivedBarrier.getId(); if (notifyReceivedBarrier.isCheckpoint()) { listener.notifyBarrierReceived(notifyReceivedBarrier, channelInfo); } } else if (notifyReceivedBuffer != null) { listener.notifyBufferReceived(notifyReceivedBuffer, channelInfo); } } finally { if (recycleBuffer) { buffer.recycleBuffer(); } } }
Source:
private static Schema generateSchema() { Schema schema = new Schema("ApiTest", ApiTestSchema.class.getPackage().getName() + ".generated", Namespace.DEFAULT_NAMESPACE, OptionalType.JAVA8); schema.addTableDefinition("SchemaApiTest", new TableDefinition() { { javaTableName("SchemaApiTest"); rowName(); rowComponent("component1", ValueType.STRING); columns(); column("column1", "c", ValueType.VAR_LONG); column("column2", "d", StringValuePersister.class); enableV2Table(); rangeScanAllowed(); } }); schema.addTableDefinition("HashComponentsTest", new TableDefinition() { { javaTableName("HashComponentsTest"); rowName(); hashFirstNRowComponents(2); rowComponent("component1", ValueType.VAR_LONG); rowComponent("component2", ValueType.VAR_STRING); columns(); column("column", "c", ValueType.STRING); rangeScanAllowed(); } }); schema.addTableDefinition("AllValueTypesTest", new TableDefinition() { { javaTableName("AllValueTypesTest"); rowName(); rowComponent("component1", ValueType.STRING); columns(); IntStream.range(0, ValueType.values().length) .forEachOrdered(typeIndex -> column("column" + typeIndex, "c" + typeIndex, ValueType.values()[typeIndex])); } }); return schema; }

Target:
private static Schema generateSchema() { Schema schema = new Schema("ApiTest", ApiTestSchema.class.getPackage().getName() + ".generated", Namespace.DEFAULT_NAMESPACE, OptionalType.JAVA8); schema.addTableDefinition("SchemaApiTest", new TableDefinition() { { javaTableName("SchemaApiTest"); rowName(); rowComponent("component1", ValueType.STRING); columns(); column("column1", "c", ValueType.VAR_LONG); column("column2", "d", StringValuePersister.class); enableV2Table(); rangeScanAllowed(); } }); schema.addTableDefinition("HashComponentsTest", new TableDefinition() { { javaTableName("HashComponentsTest"); rowName(); hashFirstNRowComponents(2); rowComponent("component1", ValueType.VAR_LONG); rowComponent("component2", ValueType.VAR_STRING); columns(); column("column", "c", ValueType.STRING); rangeScanAllowed(); } }); schema.addTableDefinition("AllValueTypesTest", new TableDefinition() { { javaTableName("AllValueTypesTest"); rowName(); Stream.of(ValueType.values()) .filter(type -> type != ValueType.BLOB && type != ValueType.STRING) .forEachOrdered(type -> rowComponent("component" + type.ordinal(), type)); rowComponent("blobComponent", ValueType.BLOB); columns(); Stream.of(ValueType.values()) .forEachOrdered(type -> column("column" + type.ordinal(), "c" + type.ordinal(), type)); } }); return schema; }
Source:
public void cancelJob(InterpreterContext context) throws InterpreterException { LOGGER.info("Canceling job associated of paragraph: " + context.getParagraphId()); JobClient jobClient = this.jobs.get(context.getParagraphId()); if (jobClient == null) { LOGGER.warn("Unable to remove Job from paragraph as no job associated to this paragraph", context.getParagraphId()); return; } try { String savepointDir = context.getLocalProperties().get("savepointDir"); if (StringUtils.isBlank(savepointDir)) { LOGGER.info("Trying to cancel job of paragraph {}", context.getParagraphId()); jobClient.cancel(); } else { LOGGER.info("Trying to stop job of paragraph with save point dir: {}", context.getParagraphId(), savepointDir); String savePointPath = jobClient.stopWithSavepoint(true, savepointDir).get(); z.angularBind(context.getParagraphId() + "_savepointpath", savePointPath); LOGGER.info("Job of paragraph is stopped with save point path: {}", jobClient.getJobID(), context.getParagraphId(), savePointPath); } } catch (Exception e) { String errorMessage = String.format("Fail to cancel job %s that is associated " + "with paragraph %s", jobClient.getJobID(), context.getParagraphId()); LOGGER.warn(errorMessage, e); throw new InterpreterException(errorMessage, e); } finally { FlinkJobProgressPoller jobProgressPoller = jobProgressPollerMap.remove(jobClient.getJobID()); if (jobProgressPoller != null) { jobProgressPoller.cancel(); jobProgressPoller.interrupt(); } this.jobs.remove(context.getParagraphId()); } }

Target:
public void cancelJob(InterpreterContext context) throws InterpreterException { LOGGER.info("Canceling job associated of paragraph: {}", context.getParagraphId()); JobClient jobClient = this.jobs.get(context.getParagraphId()); if (jobClient == null) { LOGGER.warn("Unable to remove Job from paragraph as no job associated to this paragraph", context.getParagraphId()); return; } try { String savepointDir = context.getLocalProperties().get("savepointDir"); if (StringUtils.isBlank(savepointDir)) { LOGGER.info("Trying to cancel job of paragraph {}", context.getParagraphId()); jobClient.cancel(); } else { LOGGER.info("Trying to stop job of paragraph with save point dir: {}", context.getParagraphId(), savepointDir); String savePointPath = jobClient.stopWithSavepoint(true, savepointDir).get(); z.angularBind(context.getParagraphId() + "_savepointpath", savePointPath); LOGGER.info("Job of paragraph is stopped with save point path: {}", jobClient.getJobID(), context.getParagraphId(), savePointPath); } } catch (Exception e) { String errorMessage = String.format("Fail to cancel job %s that is associated " + "with paragraph %s", jobClient.getJobID(), context.getParagraphId()); LOGGER.warn(errorMessage, e); throw new InterpreterException(errorMessage, e); } finally { FlinkJobProgressPoller jobProgressPoller = jobProgressPollerMap.remove(jobClient.getJobID()); if (jobProgressPoller != null) { jobProgressPoller.cancel(); jobProgressPoller.interrupt(); } this.jobs.remove(context.getParagraphId()); } }
Source:
public void insertOrUpdate_cyclicDependenciesFromOtherRealm() { RealmConfiguration config1 = configFactory.createConfiguration("realm1"); RealmConfiguration config2 = configFactory.createConfiguration("realm2"); Realm realm1 = Realm.getInstance(config1); Realm realm2 = Realm.getInstance(config2); realm1.beginTransaction(); Owner owner = realm1.createObject(Owner.class); Dog dog = realm1.createObject(Dog.class); owner.getDogs().add(dog); dog.setOwner(owner); realm1.commitTransaction(); realm2.beginTransaction(); realm2.insertOrUpdate(owner); realm2.commitTransaction(); assertEquals(1, realm1.where(Owner.class).count()); assertEquals(1, realm1.where(Owner.class).findFirst().getDogs().size()); assertEquals(1, realm1.where(Dog.class).count()); assertEquals(realm1.where(Owner.class).count(), realm2.where(Owner.class).count()); assertEquals(realm1.where(Dog.class).count(), realm2.where(Dog.class).count()); assertEquals(1, realm2.where(Owner.class).findFirst().getDogs().size()); realm1.close(); realm2.close(); }

Target:
public void insertOrUpdate_cyclicDependenciesFromOtherRealm() { RealmConfiguration config1 = configFactory.createConfiguration("realm1"); RealmConfiguration config2 = configFactory.createConfiguration("realm2"); Realm realm1 = Realm.getInstance(config1); Realm realm2 = Realm.getInstance(config2); realm1.beginTransaction(); Owner owner = realm1.createObject(Owner.class); owner.setName("Kiba"); Dog dog = realm1.createObject(Dog.class); dog.setName("Akamaru"); owner.getDogs().add(dog); dog.setOwner(owner); realm1.commitTransaction(); realm2.beginTransaction(); realm2.insertOrUpdate(owner); realm2.commitTransaction(); assertEquals(1, realm1.where(Owner.class).count()); assertEquals(1, realm1.where(Owner.class).findFirst().getDogs().size()); assertEquals(1, realm1.where(Dog.class).count()); assertEquals(realm1.where(Owner.class).count(), realm2.where(Owner.class).count()); assertEquals(realm1.where(Dog.class).count(), realm2.where(Dog.class).count()); assertEquals(1, realm2.where(Owner.class).findFirst().getDogs().size()); assertEquals(realm1.where(Owner.class).findFirst().getName(), realm2.where(Owner.class).findFirst().getName()); assertEquals(realm1.where(Owner.class).findFirst().getDogs().first().getName() , realm2.where(Owner.class).findFirst().getDogs().first().getName()); realm1.close(); realm2.close(); }
Source:
public void checkVariantAnnotationVariants() throws AvroRemoteException { final String variantAnnotationSetId = Utils.getVariantAnnotationSetId(client); final SearchVariantAnnotationsRequest req = SearchVariantAnnotationsRequest.newBuilder() .setVariantAnnotationSetId(variantAnnotationSetId) .setReferenceName(TestData.VARIANT_ANNOTATION_REFERENCE_NAME) .setStart(start) .setEnd(end) .build(); final SearchVariantAnnotationsResponse resp = client.variantAnnotations.searchVariantAnnotations(req); for( VariantAnnotation variantAnn : resp.getVariantAnnotations() ){ final String variantId = variantAnn.getVariantId(); Variant v = client.variants.getVariant(variantId); assertThat(v).isNotNull(); assertThat(v.getId()).isEqualTo(variantId); assertThat(v.getStart()).isEqualTo(start); } }

Target:
public void checkVariantAnnotationVariants() throws AvroRemoteException { final String variantAnnotationSetId = Utils.getVariantAnnotationSetByName(client, TestData.VARIANT_ANNOTATION_SET_NAMES.get(0)).getId(); final SearchVariantAnnotationsRequest req = SearchVariantAnnotationsRequest.newBuilder() .setVariantAnnotationSetId(variantAnnotationSetId) .setReferenceName(TestData.VARIANT_ANNOTATION_REFERENCE_NAME) .setStart(start) .setEnd(end) .build(); final SearchVariantAnnotationsResponse resp = client.variantAnnotations.searchVariantAnnotations(req); assertThat(resp.getVariantAnnotations()).isNotEmpty(); for( VariantAnnotation variantAnn : resp.getVariantAnnotations() ){ final String variantId = variantAnn.getVariantId(); Variant v = client.variants.getVariant(variantId); assertThat(v).isNotNull(); assertThat(v.getId()).isEqualTo(variantId); assertThat(v.getStart()).isGreaterThanOrEqualTo(start); } }
Source:
public void removeFromHistory() { ArrayList<String> geocodes = new ArrayList<String>(adapter.getCheckedOrAllCaches().size()); for (Geocache cache : adapter.getCheckedOrAllCaches()) { geocodes.add(cache.getGeocode()); } Bundle b = new Bundle(); b.putStringArray(EXTRA_CACHELIST, geocodes.toArray(new String[geocodes.size()])); getSupportLoaderManager().initLoader(CacheListLoaderType.REMOVE_FROM_HISTORY.ordinal(), b, this); }

Target:
public void removeFromHistory() { final List<Geocache> caches = adapter.getCheckedOrAllCaches(); final String geocodes[] = new String[caches.size()]; for (int i = 0; i < geocodes.length; i++) { geocodes[i] = caches.get(i).getGeocode(); } Bundle b = new Bundle(); b.putStringArray(Intents.EXTRA_CACHELIST, geocodes); getSupportLoaderManager().initLoader(CacheListLoaderType.REMOVE_FROM_HISTORY.ordinal(), b, this); }
Source:
public void setAttached(boolean attached) { attached = attached; }

Target:
public void setAttached(boolean attached) { this.attached = attached; }
Source:
public void testStoreAndQueryEndTimeExclude() { Trace trace1 = new Trace(); trace1.setStartTime(1200); trace1.setId("1"); Consumer c1 = new Consumer(); trace1.getNodes().add(c1); List<Trace> traces = new ArrayList<>(); traces.add(trace1); try { tracePublisher.publish(null, traces); } catch (Exception e1) { fail("Failed to store: " + e1); } Criteria criteria = new Criteria(); criteria.setEndTime(2); Wait.until(() -> traceService.searchFragments(null, criteria).size() == 1); criteria.setEndTime(1); List<Trace> result = traceService.searchFragments(null, criteria); assertEquals(0, result.size()); }

Target:
public void testStoreAndQueryEndTimeExclude() { Trace trace1 = new Trace(); trace1.setStartTime(1200000); trace1.setId("1"); Consumer c1 = new Consumer(); trace1.getNodes().add(c1); List<Trace> traces = new ArrayList<>(); traces.add(trace1); try { tracePublisher.publish(null, traces); } catch (Exception e1) { fail("Failed to store: " + e1); } Criteria criteria = new Criteria(); criteria.setEndTime(1500); Wait.until(() -> traceService.searchFragments(null, criteria).size() == 1); criteria.setEndTime(1100); List<Trace> result = traceService.searchFragments(null, criteria); assertEquals(0, result.size()); }
Source:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mInflater = LayoutInflater.from(getActivity()); setIsLoading(true); final String chapterPlusId = getArguments().getString(Const.EXTRA_PLUS_ID); if (Utils.isOnline(getActivity())) { App.getInstance().getModelCache().getAsync(Const.CACHE_KEY_PERSON + chapterPlusId, true, new ModelCache.CacheListener() { @Override public void onGet(Object item) { updateUIOnlineFrom((Person) item); } @Override public void onNotFound(String key) { App.getInstance().getPlusApi().getPerson(chapterPlusId).enqueue( new Callback<Person>() { @Override public void success(Person person) { putPersonInCache(chapterPlusId, person); updateUIOnlineFrom(person); setIsLoading(false); } @Override public void failure(Throwable error) { super.failure(error); setIsLoading(false); } @Override public void networkFailure(Throwable error) { super.networkFailure(error); setIsLoading(false); } }); } }); } else { App.getInstance().getModelCache().getAsync( Const.CACHE_KEY_PERSON + chapterPlusId, false, new ModelCache.CacheListener() { @Override public void onGet(Object item) { final Person cachedChapter = (Person) item; updateChapterUIFrom(cachedChapter); addOrganizers(cachedChapter, false); } @Override public void onNotFound(String key) { showError(R.string.offline_alert); } }); } }

Target:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mInflater = LayoutInflater.from(getActivity()); setIsLoading(true); final String chapterPlusId = getArguments().getString(Const.EXTRA_PLUS_ID); final boolean online = Utils.isOnline(getActivity()); App.getInstance().getModelCache().getAsync(Const.CACHE_KEY_PERSON + chapterPlusId, online, new ModelCache.CacheListener() { @Override public void onGet(Object item) { updateUIFrom((Person) item, online); } @Override public void onNotFound(String key) { if (online) { App.getInstance().getPlusApi().getPerson(chapterPlusId).enqueue( new Callback<Person>() { @Override public void success(Person person) { putPersonInCache(chapterPlusId, person); updateUIFrom(person, true); } @Override public void failure(Throwable error) { super.failure(error); setIsLoading(false); } @Override public void networkFailure(Throwable error) { super.networkFailure(error); setIsLoading(false); } }); } else { showError(R.string.offline_alert); setIsLoading(false); } } }); }
Source:
private void pushHistoryStateIfNeeded(NavigationEvent event, UI ui) { boolean isRouterLink = NavigationTrigger.ROUTER_LINK .equals(event.getTrigger()); if (event instanceof ErrorNavigationEvent) { if (isRouterLink) { ErrorNavigationEvent errorNavigationEvent = (ErrorNavigationEvent) event; if (errorNavigationEvent.getErrorParameter() != null && errorNavigationEvent.getErrorParameter() .getCaughtException() instanceof NotFoundException) { pushHistoryState(event); } } } else if (isRouterLink) { JsonValue state = event.getState() .orElseThrow(() -> new IllegalStateException( "When the navigation trigger is ROUTER_LINK, event state should not be null.")); ui.getPage().executeJs( "this.scrollPositionHandlerAfterServerNavigation($0);", state); } else if (!event.isForwardTo() && (!ui.getInternals().hasLastHandledLocation() || !event.getLocation().getPathWithQueryParameters() .equals(ui.getInternals() .getLastHandledLocation() .getPathWithQueryParameters()))) { if (shouldPushHistoryState(event)) { pushHistoryState(event); } ui.getInternals().setLastHandledNavigation(event.getLocation()); } }

Target:
private void pushHistoryStateIfNeeded(NavigationEvent event, UI ui) { boolean isRouterLink = NavigationTrigger.ROUTER_LINK .equals(event.getTrigger()); if (event instanceof ErrorNavigationEvent) { if (isRouterLinkNotFoundNavigationError( (ErrorNavigationEvent) event)) { pushHistoryState(event); } } else if (isRouterLink) { JsonValue state = event.getState() .orElseThrow(() -> new IllegalStateException( "When the navigation trigger is ROUTER_LINK, event state should not be null.")); ui.getPage().executeJs( "this.scrollPositionHandlerAfterServerNavigation($0);", state); } else if (!event.isForwardTo() && (!ui.getInternals().hasLastHandledLocation() || !event.getLocation().getPathWithQueryParameters() .equals(ui.getInternals() .getLastHandledLocation() .getPathWithQueryParameters()))) { if (shouldPushHistoryState(event)) { pushHistoryState(event); } ui.getInternals().setLastHandledNavigation(event.getLocation()); } }
Source:
public synchronized SubQuery nextSubQuery() throws DbException, QueryKilledException { Preconditions.checkState(currentSubQuery == null, "must call finishSubQuery before calling nextSubQuery"); if (isDone()) { return null; } if (status == Status.KILLING) { throw new QueryKilledException(); } if (!subQueryQ.isEmpty()) { currentSubQuery = subQueryQ.removeFirst(); currentSubQuery.setSubQueryId(new SubQueryId(queryId, subqueryId)); addDerivedSubQueries(currentSubQuery); QueryConstruct.setQueryExecutionOptions(currentSubQuery.getWorkerPlans(), ftMode, subqueryId == 0 ? profiling : PROFILING_MODE.NONE); currentSubQuery.getMasterPlan().setFTMode(ftMode); ++subqueryId; if (subqueryId >= MyriaConstants.MAXIMUM_NUM_SUBQUERIES) { throw new DbException("Infinite-loop safeguard: quitting after " + MyriaConstants.MAXIMUM_NUM_SUBQUERIES + " subqueries."); } return currentSubQuery; } planQ.getFirst().instantiate(planQ, subQueryQ, new ConstructArgs(server, queryId)); return nextSubQuery(); }

Target:
public synchronized SubQuery nextSubQuery() throws DbException, QueryKilledException { Preconditions.checkState(currentSubQuery == null, "must call finishSubQuery before calling nextSubQuery"); if (isDone()) { return null; } if (status == Status.KILLING) { throw new QueryKilledException(); } if (!subQueryQ.isEmpty()) { currentSubQuery = subQueryQ.removeFirst(); currentSubQuery.setSubQueryId(new SubQueryId(queryId, subqueryId)); addDerivedSubQueries(currentSubQuery); PROFILING_MODE profilingMode = profiling; if (subqueryId != 0) { profilingMode = PROFILING_MODE.NONE; } QueryConstruct.setQueryExecutionOptions(currentSubQuery.getWorkerPlans(), ftMode, profilingMode); currentSubQuery.getMasterPlan().setFTMode(ftMode); ++subqueryId; if (subqueryId >= MyriaConstants.MAXIMUM_NUM_SUBQUERIES) { throw new DbException("Infinite-loop safeguard: quitting after " + MyriaConstants.MAXIMUM_NUM_SUBQUERIES + " subqueries."); } return currentSubQuery; } planQ.getFirst().instantiate(planQ, subQueryQ, new ConstructArgs(server, queryId)); return nextSubQuery(); }
Source:
protected int doWork() { IOUtil.assertFilesAreReadable(metricsFiles); final MetricsFile<?, ?> metricsA = new MetricsFile(); final MetricsFile<?, ?> metricsB = new MetricsFile(); try { metricsA.read(new FileReader(metricsFiles.get(0))); metricsB.read(new FileReader(metricsFiles.get(1))); final boolean areEqual = metricsA.areMetricsEqual(metricsB) && metricsA.areHistogramsEqual(metricsB); final String status = areEqual ? "EQUAL" : "NOT EQUAL"; System.out.println("Files " + metricsFiles.get(0) + " and " + metricsFiles.get(1) + "are " + status); } catch (final Exception e) { throw new PicardException(e.getMessage()); } return 0; }

Target:
protected int doWork() { IOUtil.assertFilesAreReadable(metricsFiles); final MetricsFile<?, ?> metricsA = new MetricsFile(); final MetricsFile<?, ?> metricsB = new MetricsFile(); try { metricsA.read(new FileReader(metricsFiles.get(0))); metricsB.read(new FileReader(metricsFiles.get(1))); final boolean areEqual = metricsA.areMetricsEqual(metricsB) && metricsA.areHistogramsEqual(metricsB); final String status = areEqual ? "EQUAL" : "NOT EQUAL"; log.info("Files " + metricsFiles.get(0) + " and " + metricsFiles.get(1) + "are " + status); } catch (final Exception e) { throw new PicardException(e.getMessage()); } return 0; }
Source:
public void editClientID() throws Exception { final String VALUE = RandomStringUtils.randomAlphanumeric(5); ModelNodeResult defaultValueResult = operations.readAttribute(JMS_BRIDGE_ADDRESS, CLIENT_ID_IDENTIFIER, ReadAttributeOption.NOT_INCLUDE_DEFAULTS); defaultValueResult.assertSuccess(); ModelNode defaultValue = defaultValueResult.value(); try { new ConfigChecker.Builder(client, JMS_BRIDGE_ADDRESS) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.TEXT, CLIENT_ID_IDENTIFIER, VALUE) .verifyFormSaved() .verifyAttribute(CLIENT_ID_IDENTIFIER, VALUE); } finally { operations.writeAttribute(JMS_BRIDGE_ADDRESS, CLIENT_ID_IDENTIFIER, defaultValue); } }

Target:
public void editClientID() throws Exception { final String VALUE = RandomStringUtils.randomAlphanumeric(5); ModelNodeResult origValueResult = operations.readAttribute(JMS_BRIDGE_ADDRESS, CLIENT_ID_IDENTIFIER, ReadAttributeOption.NOT_INCLUDE_DEFAULTS); origValueResult.assertSuccess(); ModelNode origValue = origValueResult.value(); try { new ConfigChecker.Builder(client, JMS_BRIDGE_ADDRESS) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.TEXT, CLIENT_ID_IDENTIFIER, VALUE) .verifyFormSaved() .verifyAttribute(CLIENT_ID_IDENTIFIER, VALUE); } finally { operations.writeAttribute(JMS_BRIDGE_ADDRESS, CLIENT_ID_IDENTIFIER, origValue); } }
Source:
protected final Widget[] findItems(Object element) { Widget result = doFindInputItem(element); if (result != null) { return new Widget[] { result }; } if (usingElementMap() && element != null) { Object widgetOrWidgets = elementMap.get(element); if (widgetOrWidgets==null) { return NO_WIDGETS; } else if (widgetOrWidgets instanceof Widget) { return new Widget[] {(Widget) widgetOrWidgets}; } else { return (Widget[])widgetOrWidgets; } } result = doFindItem(element); return result == null ? NO_WIDGETS : new Widget[] { result }; }

Target:
protected final Widget[] findItems(Object element) { Widget result = doFindInputItem(element); if (result != null || element == null) { return new Widget[] { result }; } if (usingElementMap()) { Object widgetOrWidgets = elementMap.get(element); if (widgetOrWidgets==null) { return NO_WIDGETS; } else if (widgetOrWidgets instanceof Widget) { return new Widget[] {(Widget) widgetOrWidgets}; } else { return (Widget[])widgetOrWidgets; } } result = doFindItem(element); return result == null ? NO_WIDGETS : new Widget[] { result }; }
Source:
public void buildVmGraphicsDevices() { boolean graphicsOverridden = vm.isRunOnce() && vm.getGraphicsInfos() != null && !vm.getGraphicsInfos().isEmpty(); boolean isHeadlessMode = vm.getDefaultDisplayType() == DisplayType.none; Map<GraphicsType, GraphicsInfo> infos = vm.getGraphicsInfos(); Map<String, Object> specParamsFromVm = null; if (infos != null) { specParamsFromVm = new HashMap<>(); addVmGraphicsOptions(infos, specParamsFromVm); } if (graphicsOverridden || isHeadlessMode) { buildVmGraphicsDevicesOverridden(infos, specParamsFromVm); } else { buildVmGraphicsDevicesFromDb(specParamsFromVm); } }

Target:
public void buildVmGraphicsDevices() { boolean graphicsOverridden = vm.isRunOnce() && vm.getGraphicsInfos() != null && !vm.getGraphicsInfos().isEmpty(); boolean isHeadlessMode = vm.getDefaultDisplayType() == DisplayType.none; if (isHeadlessMode) { return; } Map<GraphicsType, GraphicsInfo> infos = vm.getGraphicsInfos(); Map<String, Object> specParamsFromVm = null; if (infos != null) { specParamsFromVm = new HashMap<>(); addVmGraphicsOptions(infos, specParamsFromVm); } if (graphicsOverridden) { buildVmGraphicsDevicesOverridden(infos, specParamsFromVm); } else { buildVmGraphicsDevicesFromDb(specParamsFromVm); } }