auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void runAutonomous() throws InterruptedException, AutonomousModeOverException { pickupContainer(nudge.get()); setClampHeight(1.0f); singleSideTurn((long) (containerTurnTime.get() * 1000), false); boolean elevatorAtTop = Elevator.atTop.get(); if (!elevatorAtTop) { Elevator.setTop.event(); } float currentClampHeight = Clamp.heightReadout.get(); if (currentClampHeight < AutoLoader.clampHeightThreshold.get()) { Clamp.mode.set(Clamp.MODE_HEIGHT); Clamp.height.set(AutoLoader.clampHeightThreshold.get()); if (elevatorAtTop) { waitUntil(Clamp.atDesiredHeight); } else { waitUntil(BooleanMixing.andBooleans(Clamp.atDesiredHeight, Elevator.atTop)); } } else { if (!elevatorAtTop) { waitUntil(Elevator.atTop); } } Rollers.direction.set(Rollers.REVERSE); Rollers.running.set(true); Rollers.closed.set(true); waitUntil(AutoLoader.crateInPosition); Rollers.running.set(false); Rollers.closed.set(false); turn(autoZoneAngle.get(), true); waitForTime(500); drive(autoZoneDistance.get(), autoZoneSpeed.get()); waitForTime(500); depositContainer(containerHeight.get()); }

Target:
protected void runAutonomous() throws InterruptedException, AutonomousModeOverException { pickupContainer(nudge.get()); setClampHeight(topClampHeight.get()); singleSideTurn((long) (containerTurnTime.get() * 1000), false); collectTote(); turn(autoZoneAngle.get(), true); waitForTime(500); drive(autoZoneDistance.get(), autoZoneSpeed.get()); waitForTime(500); depositContainer(containerHeight.get()); }
Source:
private FalsePositiveTableWriter(final File output) throws IOException { super(output, new TableColumnCollection("filename", "snp", "indel")); }

Target:
private FalsePositiveTableWriter(final File output) throws IOException { super(output, new TableColumnCollection(ID_COLUMN_NAME, SNP_COLUMN_NAME, INDEL_COLUMN_NAME)); }
Source:
public void StoringData() throws ExecutionException, InterruptedException { RiakClient client = new RiakClient(cluster); final String tableName = "time_series"; final Calendar date1 = new GregorianCalendar(TimeZone.getTimeZone("UTC")); date1.add(Calendar.MILLISECOND, -10); final Calendar date2 = new GregorianCalendar(TimeZone.getTimeZone("UTC")); date1.add(Calendar.MILLISECOND, -5); final Calendar date3 = new GregorianCalendar(TimeZone.getTimeZone("UTC")); final List<Row> rows = Arrays.asList(new Row(new Cell(date1), new Cell("bryce"), new Cell(305.37)), new Row(new Cell(date2), new Cell("bryce"), new Cell(300.12)), new Row(new Cell(date3), new Cell("bryce"), new Cell(295.95))); Store store = new Store.Builder(tableName).withRows(rows).build(); RiakFuture<Void, BinaryValue> execFuture = client.executeAsync(store); execFuture.await(); assertTrue(execFuture.isSuccess()); }

Target:
public void StoringData() throws ExecutionException, InterruptedException { RiakClient client = new RiakClient(cluster); Store store = new Store.Builder(tableName).withRows(rows).build(); RiakFuture<Void, String> execFuture = client.executeAsync(store); execFuture.await(); String errorMessage = execFuture.cause() != null? execFuture.cause().getMessage() : ""; assertNull(errorMessage, execFuture.cause()); assertEquals(true, execFuture.isSuccess()); }
Source:
public void testTrace() { long[] time = new long[LOOP_COUNT]; for (int i = 0; i < LOOP_COUNT; i++) { IAnalysisModule module = new LttngKernelAnalysisModule(); module.setId("test"); try (LttngKernelTrace trace = new LttngKernelTrace()) { trace.initTrace(null, testTrace.getPath(), CtfTmfEvent.class); module.setTrace(trace); long start = System.nanoTime(); TmfTestHelper.executeAnalysis(module); long end = System.nanoTime(); File suppDir = new File(TmfTraceManager.getSupplementaryFileDir(trace)); for (File file : suppDir.listFiles()) { file.delete(); } trace.dispose(); time[i] = end - start; } catch (TmfAnalysisException | TmfTraceException e) { fail(e.getMessage()); } } double avg = 0, avgHot = 0; for (int i = 0; i < LOOP_COUNT; i++) { avg += time[i]; if (i > 2) { avgHot += time[i]; } } System.out.println("Cache cold : " + String.format("%.3f", 0.000001 * time[0]) + "ms\t average time : " + String.format("%.3f", 0.000001 * avg / LOOP_COUNT) + " ms\t average (cache hot) time : " + String.format("%.3f", 0.000001 * (avgHot / LOOP_COUNT - 3))); }

Target:
public void testTrace() { long[] time = new long[LOOP_COUNT]; for (int i = 0; i < LOOP_COUNT; i++) { try (IAnalysisModule module = new LttngKernelAnalysisModule(); LttngKernelTrace trace = new LttngKernelTrace()) { module.setId("test"); trace.initTrace(null, testTrace.getPath(), CtfTmfEvent.class); module.setTrace(trace); long start = System.nanoTime(); TmfTestHelper.executeAnalysis(module); long end = System.nanoTime(); File suppDir = new File(TmfTraceManager.getSupplementaryFileDir(trace)); for (File file : suppDir.listFiles()) { file.delete(); } time[i] = end - start; } catch (TmfAnalysisException | TmfTraceException e) { fail(e.getMessage()); } } double avg = 0, avgHot = 0; for (int i = 0; i < LOOP_COUNT; i++) { avg += time[i]; if (i > 2) { avgHot += time[i]; } } System.out.println("Cache cold : " + String.format("%.3f", 0.000001 * time[0]) + "ms\t average time : " + String.format("%.3f", 0.000001 * avg / LOOP_COUNT) + " ms\t average (cache hot) time : " + String.format("%.3f", 0.000001 * (avgHot / LOOP_COUNT - 3))); }
Source:
public void addCondition(Condition condition) { if (condition != null) { condition.setEncounter(this); getConditions().add(condition); } }

Target:
public void addCondition(Condition condition) { condition.setEncounter(this); getConditions().add(condition); }
Source:
public LogReplicationEntry receive(LogReplicationEntry message) { rxMessageCounter++; rxMessageCount.setValue(rxMessageCounter); log.debug("Sink manager received while in {}", message.getMetadata().getMessageMetadataType(), rxState); if (message.getMetadata().getTopologyConfigId() != topologyConfigId) { log.trace("Sink manager with config id ignored msg id {}", topologyConfigId, message.getMetadata().getTopologyConfigId()); return null; } if (message.getMetadata().getMessageMetadataType().equals(MessageType.SNAPSHOT_START)) { log.info("onSnapshotSyncStart :: {}", snapshotSyncPlugin.getClass().getSimpleName()); snapshotSyncPlugin.onSnapshotSyncStart(); processSnapshotStart(message); return null; } if (!receivedValidMessage(message)) { END ACK message and END message again, but the receiver has already transited to if (message.getMetadata().getMessageMetadataType() == SNAPSHOT_END) { LogReplicationEntryMetadata metadata = snapshotSinkBufferManager.makeAckMessage(message); if (metadata.getMessageMetadataType() == SNAPSHOT_END) { log.warn("Sink Manager in state and received message {}. Resending the ACK for SNAPSHOT_END.", rxState, message.getMetadata()); return new LogReplicationEntry(metadata, new byte[0]); } } log.warn("Sink Manager in state and received message {}. Dropping Message.", rxState, message.getMetadata()); return null; } if (rxState.equals(RxState.LOG_ENTRY_SYNC)) { return logEntrySinkBufferManager.processMsgAndBuffer(message); } else { LogReplicationEntry ack = snapshotSinkBufferManager.processMsgAndBuffer(message); if (message.getMetadata().getMessageMetadataType() == SNAPSHOT_END) { snapshotSyncPlugin.onSnapshotSyncEnd(); } return ack; } }

Target:
public LogReplicationEntry receive(LogReplicationEntry message) { rxMessageCounter++; rxMessageCount.setValue(rxMessageCounter); log.debug("Sink manager received while in {}", message.getMetadata().getMessageMetadataType(), rxState); if (message.getMetadata().getTopologyConfigId() != topologyConfigId) { log.trace("Sink manager with config id ignored msg id {}", topologyConfigId, message.getMetadata().getTopologyConfigId()); return null; } if (message.getMetadata().getMessageMetadataType().equals(MessageType.SNAPSHOT_START)) { if (isValidSnapshotStart(message)) { processSnapshotStart(message); log.info("onSnapshotSyncStart :: {}", snapshotSyncPlugin.getClass().getSimpleName()); snapshotSyncPlugin.onSnapshotSyncStart(runtime); } return null; } if (!receivedValidMessage(message)) { END ACK message and END message again, but the receiver has already transited to if (message.getMetadata().getMessageMetadataType() == SNAPSHOT_END) { LogReplicationEntryMetadata metadata = snapshotSinkBufferManager.makeAckMessage(message); if (metadata.getMessageMetadataType() == SNAPSHOT_END) { log.warn("Sink Manager in state and received message {}. Resending the ACK for SNAPSHOT_END.", rxState, message.getMetadata()); return new LogReplicationEntry(metadata); } } log.warn("Sink Manager in state and received message {}. Dropping Message.", rxState, message.getMetadata()); return null; } return processReceivedMessage(message); }
Source:
protected void installScheduler() { if (senderJob != null) { uninstallScheduler(); } if (refreshTime > 0) { senderJob = scheduler.scheduleWithFixedDelay(packetSender, 1, refreshTime, TimeUnit.MILLISECONDS); logger.trace("started scheduler for thing {}", this.thing.getUID()); } else { logger.info("refresh disabled for thing {}", this.thing.getUID()); } }

Target:
protected void installScheduler() { if (senderJob != null) { uninstallScheduler(); } if (refreshTime > 0) { senderJob = scheduler.scheduleAtFixedRate(() -> { logger.trace("runnable packet sender for universe called, state {}/{}", universe.getUniverseId(), getThing().getStatus(), isMuted); if (!isMuted) { sendDmxData(); } else { logger.trace("bridge is muted", getThing().getUID()); } }, 1, refreshTime, TimeUnit.MILLISECONDS); logger.trace("started scheduler for thing {}", this.thing.getUID()); } else { logger.info("refresh disabled for thing {}", this.thing.getUID()); } }
Source:
public boolean isApplicable(Item item) { return item instanceof Job; }

Target:
public boolean isApplicable(Item item) { return item instanceof Job && SCMTriggerItems.asSCMTriggerItem(item) != null && item instanceof ParameterizedJobMixIn.ParameterizedJob; }
Source:
public void testCloseTaskManagerConnectionOnWorkerTerminated() throws Exception { new Context() {{ final ResourceID tmResourceId = ResourceID.generate(); final CompletableFuture<TaskExecutorProcessSpec> requestWorkerFromDriverFuture = new CompletableFuture<>(); final CompletableFuture<Void> disconnectResourceManagerFuture = new CompletableFuture<>(); final TestingTaskExecutorGateway taskExecutorGateway = new TestingTaskExecutorGatewayBuilder() .setDisconnectResourceManagerConsumer((ignore) -> disconnectResourceManagerFuture.complete(null)) .createTestingTaskExecutorGateway(); driverBuilder.setRequestResourceFunction(taskExecutorProcessSpec -> { requestWorkerFromDriverFuture.complete(taskExecutorProcessSpec); return CompletableFuture.completedFuture(tmResourceId); }); runTest(() -> { runInMainThread(() -> getResourceManager().startNewWorker(WORKER_RESOURCE_SPEC)) .thenCompose((ignrore) -> registerTaskExecutor(tmResourceId, taskExecutorGateway)) .thenRun(() -> runInMainThread(() -> getResourceManager().onWorkerTerminated(tmResourceId, new Exception()))); disconnectResourceManagerFuture.get(TIMEOUT_SEC, TimeUnit.SECONDS); }); }}; }

Target:
public void testCloseTaskManagerConnectionOnWorkerTerminated() throws Exception { new Context() {{ final ResourceID tmResourceId = ResourceID.generate(); final CompletableFuture<TaskExecutorProcessSpec> requestWorkerFromDriverFuture = new CompletableFuture<>(); final CompletableFuture<Void> disconnectResourceManagerFuture = new CompletableFuture<>(); final TestingTaskExecutorGateway taskExecutorGateway = new TestingTaskExecutorGatewayBuilder() .setDisconnectResourceManagerConsumer((ignore) -> disconnectResourceManagerFuture.complete(null)) .createTestingTaskExecutorGateway(); driverBuilder.setRequestResourceFunction(taskExecutorProcessSpec -> { requestWorkerFromDriverFuture.complete(taskExecutorProcessSpec); return CompletableFuture.completedFuture(tmResourceId); }); runTest(() -> { runInMainThread(() -> getResourceManager().startNewWorker(WORKER_RESOURCE_SPEC)) .thenCompose((ignore) -> registerTaskExecutor(tmResourceId, taskExecutorGateway)) .thenRun(() -> runInMainThread(() -> getResourceManager().onWorkerTerminated(tmResourceId, "terminate for testing"))); disconnectResourceManagerFuture.get(TIMEOUT_SEC, TimeUnit.SECONDS); }); }}; }
Source:
private String getAddressesString(Collection<MailAddress> addresses) { if (addresses == null) { return "null"; } Iterator<MailAddress> iter = addresses.iterator(); StringBuilder sb = new StringBuilder(); sb.append('['); for (int i = 0; iter.hasNext(); i++) { if (i > 0) { sb.append(", "); } sb.append(iter.next()); } sb.append(']'); return sb.toString(); }

Target:
private String getAddressesString(Collection<MailAddress> addresses) { if (addresses == null) { return "null"; } StringBuilder sb = new StringBuilder(); sb.append('['); Joiner.on(", ").appendTo(sb, addresses); sb.append(']'); return sb.toString(); }
Source:
private Discover findDiscoveryMode(Resource beansResource) { if (beansResource == null) { return Discover.none; } Document document = readXMLResource(beansResource); if (!document.hasAttributes() && !document.hasChildNodes()) { return Discover.all; } try { XPath xPath = XPathFactory.newInstance() .newXPath(); XPathExpression expression = xPath.compile("/beans/@version"); Object versionResult = expression.evaluate(beansResource, XPathConstants.STRING); Version version = Version.valueOf(versionResult.toString()); if (CDIAnnotationReader.CDI_ARCHIVE_VERSION.compareTo(version) <= 0) { try { xPath = XPathFactory.newInstance() .newXPath(); expression = xPath.compile("/beans/@bean-discovery-mode"); Object beanDiscoveryMode = expression.evaluate(beansResource, XPathConstants.STRING); return Discover.valueOf(beanDiscoveryMode.toString()); } catch (NullPointerException | XPathExpressionException e) { return Discover.annotated; } } return Discover.all; } catch (NullPointerException | XPathExpressionException e) { return Discover.all; } }

Target:
private Discover findDiscoveryMode(Resource beansResource) { if (beansResource == null) { return Discover.none; } Document document = readXMLResource(beansResource); if (!document.hasAttributes() && !document.hasChildNodes()) { return Discover.all; } try { Object versionResult = versionExpression.evaluate(beansResource, XPathConstants.STRING); Version version = Version.valueOf(versionResult.toString()); if (CDIAnnotationReader.CDI_ARCHIVE_VERSION.compareTo(version) <= 0) { try { Object beanDiscoveryMode = discoveryModeExpression.evaluate(beansResource, XPathConstants.STRING); return Discover.valueOf(beanDiscoveryMode.toString()); } catch (NullPointerException | XPathExpressionException e) { return Discover.annotated; } } return Discover.all; } catch (NullPointerException | XPathExpressionException e) { return Discover.all; } }
Source:
private void makeRemoteDirectoriesIfNotExist(FTPClient ftpClient, Path path) throws IOException { if (path.getParent() == null) { createRemoteDirectoryIfNotExists(ftpClient, path.toString()); return; } else { makeRemoteDirectoriesIfNotExist(ftpClient, path.getParent()); createRemoteDirectoryIfNotExists(ftpClient, path.getFileName().toString()); } }

Target:
private void makeRemoteDirectoriesIfNotExist(FTPClient ftpClient, Path path) throws IOException { if (path.getParent() == null) { createRemoteDirectoryIfNotExists(ftpClient, path.toString()); } else { makeRemoteDirectoriesIfNotExist(ftpClient, path.getParent()); createRemoteDirectoryIfNotExists(ftpClient, path.getFileName().toString()); } }
Source:
public static EnvInjectPluginConfiguration getInstance() { final Jenkins j = Jenkins.getInstance(); if (j == null) { return null; } ExtensionList<EnvInjectPluginConfiguration> extensionList = j.getExtensionList(EnvInjectPluginConfiguration.class); return extensionList.isEmpty() ? null : extensionList.get(0); }

Target:
public static EnvInjectPluginConfiguration getInstance() { return EnvInjectPluginConfiguration.all().get(EnvInjectPluginConfiguration.class); }
Source:
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { final IServerModule appModule = retrieveServerModuleFromSelectedElement(receiver); if(appModule == null) { return false; } final IServer appServer = appModule.getServer(); return appServer != null && "localhost".equals(appServer.getHost()); }

Target:
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { final IServerModule appModule = retrieveServerModuleFromSelectedElement(receiver); if(appModule == null) { return false; } final IServer appServer = appModule.getServer(); return appServer != null && !WSTUtils.OPENSHIFT_SERVER_TYPE.equals(appServer.getServerType().getId()); }
Source:
public void executeHostScript(final String script, final String engine, final String host, final Callback<String, String> syncCallBack) { rm.executeHostScript(LoginModel.getInstance().getSessionId(), script, engine, host, new AsyncCallback<String>() { public void onFailure(Throwable caught) { String msg = JSONUtils.getJsonErrorMessage(caught); LogModel.getInstance().logImportantMessage("Failed to execute a script " + script + " on host " + host + " : " + msg); if (msg.equals("HTTP 500 Internal Server Error")) { syncCallBack.onFailure("You are not authorized to execute scripts on this host. Please contact the administrator."); } else { syncCallBack.onFailure(msg); } } public void onSuccess(String result) { syncCallBack.onSuccess(parseListScriptResult(result)); } }); }

Target:
public void executeHostScript(final String script, final String engine, final String host, final Callback<String, String> syncCallBack) { rm.executeHostScript(LoginModel.getInstance().getSessionId(), script, engine, host, new AsyncCallback<String>() { public void onFailure(Throwable caught) { reportScriptExecutionFailure(caught, script, host, syncCallBack); } public void onSuccess(String result) { syncCallBack.onSuccess(parseAllScriptResults(result)); } }); }
Source:
public Object call(final String command, final String... args) throws IOException { final List<String> argsList = new ArrayList<String>(); for (final String arg : args) { argsList.add(arg); } return this.call(command, argsList); }

Target:
public Object call(final String command, final String... args) throws IOException { return this.call(command, Arrays.asList(args)); }
Source:
protected void onCommonModelChange() { super.onCommonModelChange(); getModel().getItemsChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { if (hasModel() && handleItemsChangedEvent()) { updateData(); } } }); getModel().getPropertyChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { if (args instanceof PropertyChangedEventArgs) { PropertyChangedEventArgs pcArgs = (PropertyChangedEventArgs) args; if (PropertyChangedEventArgs.Args.PROGRESS.toString().equals(pcArgs.propertyName)) { clearData(); } } } }); }

Target:
protected void onCommonModelChange() { super.onCommonModelChange(); getModel().getItemsChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { if (hasModel() && handleItemsChangedEvent()) { updateData(); } } }); getModel().getPropertyChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { if (args instanceof PropertyChangedEventArgs) { PropertyChangedEventArgs pcArgs = (PropertyChangedEventArgs) args; if (PropertyChangedEventArgs.PROGRESS.equals(pcArgs.propertyName)) { clearData(); } } } }); }
Source:
public String toString() { return "Checkpoint [inputOffsets=" + inputOffsets + "]"; }

Target:
public String toString() { return "Checkpoint [PROTOCOL_VERSION=" + PROTOCOL_VERSION + ", checkpointId=" + checkpointId + ", inputOffsets=" + inputOffsets + ", stateCheckpoint=" + stateCheckpoints + "]"; }
Source:
private void doTestValidModifiedBonds(CreateOrUpdateBond createOrUpdateBond, ValidationResult interfaceIsBondValidationResult, ValidationResult expectedValidationResult, ValidationResult slavesValidationValidationResult) { HostSetupNetworksValidator validator = spy(new HostSetupNetworksValidatorBuilder() .setParams(new ParametersBuilder().addBonds(createOrUpdateBond)) .addExistingInterfaces((List<VdsNetworkInterface>) null) .addExistingAttachments((List<NetworkAttachment>) null) .addNetworks((Collection<Network>) null) .build()); HostInterfaceValidator hostInterfaceValidatorMock = mock(HostInterfaceValidator.class); when(hostInterfaceValidatorMock.interfaceIsBondOrNull()).thenReturn(interfaceIsBondValidationResult); doReturn(hostInterfaceValidatorMock).when(validator).createHostInterfaceValidator(any(VdsNetworkInterface.class)); doReturn(slavesValidationValidationResult).when(validator).validateModifiedBondSlaves(any(CreateOrUpdateBond.class)); if (expectedValidationResult.isValid()) { assertThat(validator.validNewOrModifiedBonds(), isValid()); } else { assertThat(validator.validNewOrModifiedBonds(), failsWith(expectedValidationResult.getMessages().get(0), expectedValidationResult.getVariableReplacements())); } }

Target:
private void doTestValidModifiedBonds(CreateOrUpdateBond createOrUpdateBond, ValidationResult interfaceIsBondValidationResult, ValidationResult expectedValidationResult, ValidationResult slavesValidationValidationResult) { HostSetupNetworksValidator validator = spy(new HostSetupNetworksValidatorBuilder() .setParams(new ParametersBuilder().addBonds(createOrUpdateBond)) .addExistingInterfaces((List<VdsNetworkInterface>) null) .addExistingAttachments((List<NetworkAttachment>) null) .addNetworks((Collection<Network>) null) .build()); HostInterfaceValidator hostInterfaceValidatorMock = mock(HostInterfaceValidator.class); when(hostInterfaceValidatorMock.interfaceIsBondOrNull()).thenReturn(interfaceIsBondValidationResult); doReturn(hostInterfaceValidatorMock).when(validator).createHostInterfaceValidator(any(VdsNetworkInterface.class)); doReturn(slavesValidationValidationResult).when(validator).validateModifiedBondSlaves(any(CreateOrUpdateBond.class)); if (expectedValidationResult.isValid()) { assertThat(validator.validNewOrModifiedBonds(), isValid()); } else { assertThat(validator.validNewOrModifiedBonds(), failsWith(expectedValidationResult.getMessages(), expectedValidationResult.getVariableReplacements())); } }
Source:
public static boolean logException(Throwable t) { if (isAnonymousReportEnabled() && isCrashReportEnabled) { Log.e(TAG, "LOG_EXCEPTION : " + t); Crashlytics.logException(t); return true; } return false; }

Target:
public static boolean logException(Throwable t) { if (isReportingEnabled()) { Crashlytics.logException(t); return true; } return false; }
Source:
private void assertNoZombies() throws InterruptedException, IOException { String exitString = null; String zombieString = null; switch (platform) { case SLIM: case NO_INIT: assumeTrue(true); return; case UBUNTU_NO_BINARY: exitString = " sleep "; zombieString = ".+ Z .+"; break; default: exitString = "sh -xe " + ws.getRemote(); zombieString = ".+Z[s|\\s]\\s*\\[durable.+"; } String psFormat = setPsFormat(); String psString = null; do { Thread.sleep(1000); psString = psOut(psFormat); } while (psString.contains(exitString)); Thread.sleep(1000); Pattern zombiePattern = Pattern.compile(zombieString); Matcher zombieMatcher = zombiePattern.matcher(psOut(psFormat)); if (zombieMatcher.find()) { fail(zombieMatcher.group()); } }

Target:
private void assertNoZombies() throws InterruptedException, IOException { String exitString = null; String zombieString = null; switch (platform) { case SLIM: case NO_INIT: return; case UBUNTU_NO_BINARY: exitString = " sleep "; zombieString = ".+ Z .+"; break; default: exitString = "sh -xe " + ws.getRemote(); zombieString = ".+Z[s|\\s]\\s*\\[durable.+"; } String psFormat = setPsFormat(); String psString = null; do { Thread.sleep(1000); psString = psOut(psFormat); } while (psString.contains(exitString)); Thread.sleep(1000); Pattern zombiePattern = Pattern.compile(zombieString); Matcher zombieMatcher = zombiePattern.matcher(psOut(psFormat)); if (zombieMatcher.find()) { fail(zombieMatcher.group()); } }
Source:
protected void autofill() { if (Strings.isFilled(cleartextPassword)) { cleartextPassword = cleartextPassword.trim(); if (Strings.isFilled(cleartextPassword)) { this.salt = Strings.generateCode(20); this.passwordHash = hashPassword(salt, cleartextPassword); this.generatedPassword = null; this.fingerprint = null; this.lastPasswordChange = LocalDateTime.now(); } } if (Strings.isEmpty(passwordHash) && Strings.isEmpty(generatedPassword)) { forceGenerationOfPassword(Strings.generatePassword()); } if (Strings.isEmpty(apiToken)) { this.apiToken = Strings.generateCode(32); } if (Strings.isEmpty(fingerprint)) { this.fingerprint = Strings.generateCode(12); } }

Target:
protected void autofill() { if (Strings.isEmpty(passwordHash) && Strings.isEmpty(generatedPassword)) { this.generatedPassword = Strings.generatePassword(); } if (Strings.isEmpty(cleartextPassword) && Strings.isFilled(generatedPassword) && checkPassword(username, generatedPassword) != PasswordVerificationResult.VALID) { this.cleartextPassword = generatedPassword; } if (Strings.isFilled(cleartextPassword)) { cleartextPassword = cleartextPassword.trim(); if (Strings.isFilled(cleartextPassword)) { this.salt = Strings.generateCode(20); this.passwordHash = hashPassword(salt, cleartextPassword); this.fingerprint = null; this.lastPasswordChange = LocalDateTime.now(); if (!Strings.areEqual(cleartextPassword, generatedPassword)) { this.generatedPassword = null; } } } if (Strings.isEmpty(apiToken)) { this.apiToken = Strings.generateCode(32); } if (Strings.isEmpty(fingerprint)) { this.fingerprint = Strings.generateCode(12); } }
Source:
protected Map<String, Pair<String, String>> getSharedLocks() { if (!isInternalExecution()) { return Collections.singletonMap(getVmId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.VM, EngineMessage.ACTION_TYPE_FAILED_VM_IS_LOCKED)); } return null; }

Target:
protected Map<String, Pair<String, String>> getSharedLocks() { if (!isInternalExecution() && getVmId() != null) { return Collections.singletonMap(getVmId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.VM, EngineMessage.ACTION_TYPE_FAILED_VM_IS_LOCKED)); } return null; }
Source:
protected boolean set(EntityPlayer container, Boolean value) { container.capabilities.allowFlying = value; if (!value) { container.capabilities.isFlying = value; } container.sendPlayerAbilities(); return true; }

Target:
protected boolean set(EntityPlayer container, Boolean value) { container.capabilities.allowFlying = value; container.sendPlayerAbilities(); return true; }
Source:
public void testCharIsUppercase() throws Exception { assertEquals("true", SRun("char_is_uppercase('M')", null)); assertEquals("false", SRun("char_is_uppercase('m')", null)); try { SRun("char_is_uppercase('magic')", null); fail("Expected char_is_uppercase('magic') to throw an exception."); } catch (ConfigCompileException | CRECastException e) { } try { SRun("char_is_uppercase('1')", null); fail("Expected char_is_uppercase('1') to throw an exception."); } catch (ConfigCompileException | CRECastException e) { } try { SRun("char_is_uppercase('!')", null); fail("Expected char_is_uppercase('!') to throw an exception."); } catch (ConfigCompileException | CRECastException e) { } try { SRun("char_is_uppercase(1)", null); fail("Expected char_is_uppercase(1) to throw an exception."); } catch (ConfigCompileException | CREFormatException | CRECastException e) { } try { SRun("char_is_uppercase(dyn('stuff'))", null); fail("Expected char_is_uppercase(dyn('stuff')) to throw an exception."); } catch (ConfigCompileException | CRECastException e) { } }

Target:
public void testCharIsUppercase() throws Exception { assertEquals("true", SRun("char_is_uppercase('M')", null)); assertEquals("false", SRun("char_is_uppercase('m')", null)); try { SRun("char_is_uppercase('magic')", null); fail("Expected char_is_uppercase('magic') to throw an exception."); } catch (ConfigCompileException e) { } try { SRun("char_is_uppercase('1')", null); fail("Expected char_is_uppercase('1') to throw an exception."); } catch (ConfigCompileException e) { } try { SRun("char_is_uppercase('!')", null); fail("Expected char_is_uppercase('!') to throw an exception."); } catch (ConfigCompileException e) { } try { SRun("char_is_uppercase(1)", null); fail("Expected char_is_uppercase(1) to throw an exception."); } catch (ConfigCompileException e) { } try { SRun("char_is_uppercase(dyn('stuff'))", null); fail("Expected char_is_uppercase(dyn('stuff')) to throw an exception."); } catch (CREFormatException e) { } try { SRun("char_is_uppercase('')", null); fail("Expected char_is_uppercase('') to throw an exception."); } catch (ConfigCompileException e) { } }
Source:
private DeviceAnonymized(UUID id, int deviceIndex, OperatingSystem operatingSystem, String appVersion, Optional<String> firebaseInstanceId) { super(id); this.deviceIndex = deviceIndex; this.operatingSystem = operatingSystem; this.appVersion = Objects.requireNonNull(appVersion); this.firebaseInstanceId = Objects.requireNonNull(firebaseInstanceId).orElse(null); }

Target:
private DeviceAnonymized(UUID id, int deviceIndex, OperatingSystem operatingSystem, String appVersion, Optional<String> firebaseInstanceId) { super(id); this.deviceIndex = deviceIndex; this.operatingSystem = operatingSystem; this.appVersion = Objects.requireNonNull(appVersion); this.firebaseInstanceId = firebaseInstanceId.orElse(null); }
Source:
public void close() { db.activateOnCurrentThread(); db.close(); DBUtil.closeDataStore(); }

Target:
public void close() { activateOnCurrentThread(); db.close(); DBUtil.closeDataStore(); }
Source:
public void testStatementWarnings() throws SQLException { statement.execute("CREATE SCHEMA blackhole.blackhole"); SQLWarning warning = statement.getWarnings(); List<PrestoWarning> expectedWarnings = new TestingWarningCollector(new WarningCollectorConfig(), new TestingWarningCollectorConfig().setPreloadedWarnings(PRELOADED_WARNINGS)).getWarnings().stream() .filter(prestoWarning -> prestoWarning.getWarningCode().getWarningType() == STATEMENT) .collect(toImmutableList()); assertStartsWithExpectedWarnings(warning, fromPrestoWarnings(expectedWarnings)); statement.clearWarnings(); assertNull(statement.getWarnings()); }

Target:
public void testStatementWarnings() throws SQLException { assertFalse(statement.execute("CREATE SCHEMA blackhole.test_schema")); SQLWarning warning = statement.getWarnings(); assertNotNull(warning); TestingWarningCollectorConfig warningCollectorConfig = new TestingWarningCollectorConfig().setPreloadedWarnings(PRELOADED_WARNINGS); TestingWarningCollector warningCollector = new TestingWarningCollector(new WarningCollectorConfig(), warningCollectorConfig); List<PrestoWarning> expectedWarnings = warningCollector.getWarnings(); assertStartsWithExpectedWarnings(warning, fromPrestoWarnings(expectedWarnings)); statement.clearWarnings(); assertNull(statement.getWarnings()); }
Source:
private void setDebugContext(ISelection s) { ICommandControlDMContext context = null; fMultiple = false; if (s instanceof IStructuredSelection) { IStructuredSelection ss = (IStructuredSelection) s; if (ss.size() > 0) { @SuppressWarnings("rawtypes") Iterator i = ss.iterator(); context = getCommandControlContext(i.next()); while (i.hasNext()) if (getCommandControlContext(i.next()) != context) { context = null; fMultiple = true; break; } } } setDebugContext(context); }

Target:
private void setDebugContext(ISelection s) { ICommandControlDMContext context = null; fMultiple = false; if (s instanceof IStructuredSelection) { IStructuredSelection ss = (IStructuredSelection) s; if (ss.size() > 0) { @SuppressWarnings("rawtypes") Iterator i = ss.iterator(); context = getCommandControlContext(i.next()); while (i.hasNext()) { ICommandControlDMContext nextContext = getCommandControlContext(i.next()); if (nextContext == null && context != null || nextContext != null && context == null || nextContext != null && context != null && !nextContext.equals(context)) { context = null; fMultiple = true; break; } } } } setDebugContext(context); }
Source:
private ExtMap processAuthzResult(ExtMap outMap, String operation) { if (outMap.<Integer> get(Base.InvokeKeys.RESULT) != Base.InvokeResult.SUCCESS) { throw new RuntimeException(String.format("Base.InvokeResult code is: %1$s. Invocation of %2$s failed", outMap.<Integer> get(Base.InvokeKeys.RESULT), operation)); } logger.info(String.format("Successful invocation of %1$s", operation)); if (outMap.<Integer> get(Authz.InvokeKeys.STATUS) != Authz.Status.SUCCESS) { throw new RuntimeException(String.format("Authz.Status code is: %1$s", outMap.<Integer> get(Authz.InvokeKeys.STATUS))); } logger.debug("PrincipalRecord: {}", outMap.get(Authz.InvokeKeys.PRINCIPAL_RECORD)); return outMap.get(Authz.InvokeKeys.PRINCIPAL_RECORD); }

Target:
private ExtMap processAuthzResult(ExtMap outMap, String operation) { if (outMap.<Integer> get(Base.InvokeKeys.RESULT) != Base.InvokeResult.SUCCESS) { throw new RuntimeException(String.format("Base.InvokeResult code is: %1$s. Invocation of %2$s failed", outMap.<Integer> get(Base.InvokeKeys.RESULT), operation)); } log.info("Successful invocation of {}", operation); if (outMap.<Integer> get(Authz.InvokeKeys.STATUS) != Authz.Status.SUCCESS) { throw new RuntimeException(String.format("Authz.Status code is: %1$s", outMap.<Integer> get(Authz.InvokeKeys.STATUS))); } log.debug("PrincipalRecord: {}", outMap.get(Authz.InvokeKeys.PRINCIPAL_RECORD)); return outMap.get(Authz.InvokeKeys.PRINCIPAL_RECORD); }
Source:
protected void setSystemProperty(String key, String newValue) { String originValue = System.getProperty(key); originSystemProps.put(key, originValue); System.setProperty(key, newValue); }

Target:
protected void setSystemProperty(String key, String newValue) { originSystemProps.put(key, System.setProperty(key, newValue)); }
Source:
public QueueStats apply(HttpResponse from) { QueueStats rawQueueStats = json.apply(from); if (rawQueueStats.getMessagesStats().getTotal() == 0) { return rawQueueStats; } else { Aged oldestWithHref = rawQueueStats.getMessagesStats().getOldest().get(); Aged oldestWithId = oldestWithHref.toBuilder() .id(ParseMessages.getMessageId(oldestWithHref.getId())) .build(); Aged newestWithHref = rawQueueStats.getMessagesStats().getNewest().get(); Aged newestWithId = newestWithHref.toBuilder() .id(ParseMessages.getMessageId(newestWithHref.getId())) .build(); MessagesStats messagesStatsWithIds = rawQueueStats.getMessagesStats().toBuilder() .oldest(oldestWithId) .newest(newestWithId) .build(); QueueStats queueStatsWithIds = rawQueueStats.toBuilder().messageStats(messagesStatsWithIds).build(); return queueStatsWithIds; } }

Target:
public QueueStats apply(HttpResponse from) { QueueStats rawQueueStats = json.apply(from); if (rawQueueStats.getMessagesStats().getTotal() == 0) { return rawQueueStats; } else { Aged oldestWithHref = rawQueueStats.getMessagesStats().getOldest().get(); Aged oldestWithId = oldestWithHref.toBuilder() .id(TO_MESSAGE_ID.apply(oldestWithHref.getId())) .build(); Aged newestWithHref = rawQueueStats.getMessagesStats().getNewest().get(); Aged newestWithId = newestWithHref.toBuilder() .id(TO_MESSAGE_ID.apply(newestWithHref.getId())) .build(); MessagesStats messagesStatsWithIds = rawQueueStats.getMessagesStats().toBuilder() .oldest(oldestWithId) .newest(newestWithId) .build(); QueueStats queueStatsWithIds = rawQueueStats.toBuilder().messageStats(messagesStatsWithIds).build(); return queueStatsWithIds; } }
Source:
private Receipt generateReceipt(@NonNull List<Distance> distancesThisDay) { if (distancesThisDay.isEmpty()) { throw new IllegalArgumentException("distancesThisDay must not be empty"); } final Distance distance0 = distancesThisDay.get(0); final ReceiptBuilderFactory factory = new ReceiptBuilderFactory(-1); final ArrayList<String> names = new ArrayList<>(); final ArrayList<String> comments = new ArrayList<>(); for (int i = 0; i < distancesThisDay.size(); i++) { final Distance distance = distancesThisDay.get(i); if (!names.contains(distance.getLocation())) { names.add(distance.getLocation()); } if (!TextUtils.isEmpty(distance.getComment()) && !comments.contains(distance.getComment())) { comments.add(distance.getComment()); } } if (names.isEmpty()) { factory.setName(context.getString(R.string.distance)); } else { factory.setName(TextUtils.join("; ", names)); } if (!comments.isEmpty()) { factory.setComment(TextUtils.join("; ", comments)); } factory.setTrip(distance0.getTrip()); factory.setDate(distance0.getDate()); factory.setFile(null); factory.setImgHash(""); factory.setIsReimbursable(true); factory.setTimeZone(distance0.getTimeZone()); factory.setCategory(new CategoryBuilderFactory().setName(context.getString(R.string.distance)).build()); factory.setCurrency(distance0.getTrip().getTripCurrency()); factory.setPrice(new PriceBuilderFactory().setPriceables(distancesThisDay, distance0.getTrip().getTripCurrency()).build()); return factory.build(); }

Target:
private Receipt generateReceipt(@NonNull List<Distance> distancesThisDay) { if (distancesThisDay.isEmpty()) { throw new IllegalArgumentException("distancesThisDay must not be empty"); } final Distance distance0 = distancesThisDay.get(0); final ReceiptBuilderFactory factory = new ReceiptBuilderFactory(-1); final ArrayList<String> names = new ArrayList<>(); final ArrayList<String> comments = new ArrayList<>(); for (int i = 0; i < distancesThisDay.size(); i++) { final Distance distance = distancesThisDay.get(i); if (!names.contains(distance.getLocation())) { names.add(distance.getLocation()); } if (!TextUtils.isEmpty(distance.getComment()) && !comments.contains(distance.getComment())) { comments.add(distance.getComment()); } } if (names.isEmpty()) { factory.setName(context.getString(R.string.distance)); } else { factory.setName(TextUtils.join("; ", names)); } if (!comments.isEmpty()) { factory.setComment(TextUtils.join("; ", comments)); } factory.setTrip(distance0.getTrip()); factory.setDate(distance0.getDate()); factory.setFile(null); factory.setIsReimbursable(true); factory.setTimeZone(distance0.getTimeZone()); factory.setCategory(new CategoryBuilderFactory().setName(context.getString(R.string.distance)).build()); factory.setCurrency(distance0.getTrip().getTripCurrency()); factory.setPrice(new PriceBuilderFactory().setPriceables(distancesThisDay, distance0.getTrip().getTripCurrency()).build()); return factory.build(); }
Source:
public Optional<Argument> build(Type type, Object value, StatementContext ctx) { if (value instanceof Map) { return Optional.of((i, p, cx) -> p.setObject(i, toString((Map<String, ?>) value), Types.OTHER)); } return Optional.empty(); }

Target:
public Optional<Argument> build(Type type, Object value, StatementContext ctx) { if (Map.class.isAssignableFrom(GenericTypes.getErasedType(type))) { return Optional.of((i, p, cx) -> p.setObject(i, value)); } return Optional.empty(); }
Source:
public static String getResponseBody(HttpResponse response) throws IDPTokenManagerException { String responseBody = null; HttpEntity entity = null; String message; try { entity = response.getEntity(); responseBody = getResponseBodyContent(entity); } catch (ParseException e) { message = "Invalid response."; throw new IDPTokenManagerException(message, e); } catch (IOException e) { if (entity != null) { try { entity.consumeContent(); } catch (IOException ex) { message = "HTTP Response failure."; throw new IDPTokenManagerException(message, e); } } } return responseBody; }

Target:
public static String getResponseBody(HttpResponse response) throws IDPTokenManagerException { String responseBody = null; HttpEntity entity = null; try { entity = response.getEntity(); responseBody = getResponseBodyContent(entity); } catch (ParseException e) { throw new IDPTokenManagerException("Invalid response.", e); } catch (IOException e) { if (entity != null) { try { entity.consumeContent(); } catch (IOException ex) { throw new IDPTokenManagerException("HTTP Response failure.", e); } } } return responseBody; }
Source:
public String getValidityInfoForAllowedName(String fieldName, int maxLength, String value) { Assumption.assertTrue("Non-null value expected for " + fieldName, value != null); if (value.isEmpty()) { return getPopulatedErrorMessage(SIZE_CAPPED_NON_EMPTY_STRING_ERROR_MESSAGE, value, fieldName, REASON_EMPTY, maxLength); } if (isUntrimmed(value)) { return WHITESPACE_ONLY_OR_EXTRA_WHITESPACE_ERROR_MESSAGE.replace("${fieldName}", fieldName); } String sanitizedValue = SanitizationHelper.sanitizeForHtml(value); if (value.length() > maxLength) { return getPopulatedErrorMessage(SIZE_CAPPED_NON_EMPTY_STRING_ERROR_MESSAGE, sanitizedValue, fieldName, REASON_TOO_LONG, maxLength); } if (!Character.isLetterOrDigit(value.codePointAt(0))) { boolean isStartWithBraces = value.charAt(0) == '{' && value.contains("}"); if (!isStartWithBraces) { return getPopulatedErrorMessage(INVALID_NAME_ERROR_MESSAGE, sanitizedValue, fieldName, REASON_START_WITH_NON_ALPHANUMERIC_CHAR); } if (!StringHelper.isMatching(value.substring(1), REGEX_NAME)) { return getPopulatedErrorMessage(INVALID_NAME_ERROR_MESSAGE, sanitizedValue, fieldName, REASON_CONTAINS_INVALID_CHAR); } return ""; } if (!StringHelper.isMatching(value, REGEX_NAME)) { return getPopulatedErrorMessage(INVALID_NAME_ERROR_MESSAGE, sanitizedValue, fieldName, REASON_CONTAINS_INVALID_CHAR); } return ""; }

Target:
public String getValidityInfoForAllowedName(String fieldName, int maxLength, String value) { Assumption.assertTrue("Non-null value expected for " + fieldName, value != null); if (value.isEmpty()) { return getPopulatedErrorMessage(SIZE_CAPPED_NON_EMPTY_STRING_ERROR_MESSAGE, value, fieldName, REASON_EMPTY, maxLength); } if (isUntrimmed(value)) { return WHITESPACE_ONLY_OR_EXTRA_WHITESPACE_ERROR_MESSAGE.replace("${fieldName}", fieldName); } String sanitizedValue = SanitizationHelper.sanitizeForHtml(value); if (value.length() > maxLength) { return getPopulatedErrorMessage(SIZE_CAPPED_NON_EMPTY_STRING_ERROR_MESSAGE, sanitizedValue, fieldName, REASON_TOO_LONG, maxLength); } if (!Character.isLetterOrDigit(value.codePointAt(0))) { boolean hasStartingBrace = value.charAt(0) == '{' && value.contains("}"); if (!hasStartingBrace) { return getPopulatedErrorMessage(INVALID_NAME_ERROR_MESSAGE, sanitizedValue, fieldName, REASON_START_WITH_NON_ALPHANUMERIC_CHAR); } if (!StringHelper.isMatching(value.substring(1), REGEX_NAME)) { return getPopulatedErrorMessage(INVALID_NAME_ERROR_MESSAGE, sanitizedValue, fieldName, REASON_CONTAINS_INVALID_CHAR); } return ""; } if (!StringHelper.isMatching(value, REGEX_NAME)) { return getPopulatedErrorMessage(INVALID_NAME_ERROR_MESSAGE, sanitizedValue, fieldName, REASON_CONTAINS_INVALID_CHAR); } return ""; }
Source:
public void processMessage(final ObjectMessage message) { LOGGER.info("Processing public lighting get status request message"); String correlationUid = null; String messageType = null; String organisationIdentification = null; String deviceIdentification = null; GetDataRequest dataRequest = null; try { correlationUid = message.getJMSCorrelationID(); messageType = message.getJMSType(); organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION); deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION); if (message.getObject() != null && message.getObject() instanceof GetDataRequest) { dataRequest = (GetDataRequest) message.getObject(); } } catch (final JMSException e) { LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e); LOGGER.debug("correlationUid: {}", correlationUid); LOGGER.debug("messageType: {}", messageType); LOGGER.debug("organisationIdentification: {}", organisationIdentification); LOGGER.debug("deviceIdentification: {}", deviceIdentification); return; } try { LOGGER.info("Calling application service function: {}", messageType); this.adHocManagementService.getData(organisationIdentification, deviceIdentification, correlationUid, messageType, dataRequest); } catch (final Exception e) { this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, messageType); } }

Target:
public void processMessage(final ObjectMessage message) { LOGGER.info("Processing public lighting get status request message"); String correlationUid = null; String messageType = null; String organisationIdentification = null; String deviceIdentification = null; GetDataRequest dataRequest = null; try { correlationUid = message.getJMSCorrelationID(); messageType = message.getJMSType(); organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION); deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION); if (message.getObject() instanceof GetDataRequest) { dataRequest = (GetDataRequest) message.getObject(); } } catch (final JMSException e) { LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e); LOGGER.debug("correlationUid: {}", correlationUid); LOGGER.debug("messageType: {}", messageType); LOGGER.debug("organisationIdentification: {}", organisationIdentification); LOGGER.debug("deviceIdentification: {}", deviceIdentification); return; } try { LOGGER.info("Calling application service function: {}", messageType); this.adHocManagementService.getData(organisationIdentification, deviceIdentification, correlationUid, messageType, dataRequest); } catch (final Exception e) { this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, messageType); } }
Source:
public boolean supportsEventType(ResolvableType eventType) { if (this.eventTypes == null) { return true; } for (ResolvableType type : this.eventTypes) { if (type.isAssignableFrom(eventType)) { return true; } } if (PayloadApplicationEvent.class.isAssignableFrom(eventType.getRawClass())) { if (eventType.hasUnresolvableGenerics()) { return true; } ResolvableType payloadType = eventType.as(PayloadApplicationEvent.class).getGeneric(); for (ResolvableType type : this.eventTypes) { if (type.isAssignableFrom(payloadType)) { return true; } } } return false; }

Target:
public boolean supportsEventType(ResolvableType eventType) { if (this.eventTypes == null) { return true; } for (ResolvableType type : this.eventTypes) { if (type.isAssignableFrom(eventType)) { return true; } } if (eventType.getRawClass() != null && PayloadApplicationEvent.class.isAssignableFrom(eventType.getRawClass())) { if (eventType.hasUnresolvableGenerics()) { return true; } ResolvableType payloadType = eventType.as(PayloadApplicationEvent.class).getGeneric(); for (ResolvableType type : this.eventTypes) { if (type.isAssignableFrom(payloadType)) { return true; } } } return false; }
Source:
public static <T extends Widget> T serializeAndDeserialize( T instance ) throws Exception { byte[] bytes = serialize( instance ); T result = ( T )deserialize( bytes ); Object adapter = result.getDisplay().getAdapter( IDisplayAdapter.class ); IDisplayAdapter displayAdapter = ( IDisplayAdapter )adapter; displayAdapter.attachThread(); return result; }

Target:
public static <T> T serializeAndDeserialize( T instance ) throws Exception { byte[] bytes = serialize( instance ); return ( T )deserialize( bytes ); }
Source:
public static String getPermissionStringValue(PermissionSet permissionSet) { if (permissionSet != null) { int mask = permissionSet.getMask(); switch (mask) { case READ_META_MASK: return READMETA; case COUNT_MASK: return COUNT; case READ_MASK: return READ; case WRITE_MASK: return WRITE; case WRITEMETA_MASK: return WRITEMETA; default: throw new IllegalArgumentException(format("Unexpected mask '%d'", mask)); } } return null; }

Target:
public static String getPermissionStringValue(PermissionSet permissionSet) { if (permissionSet != null) { int mask = permissionSet.getMask(); switch (mask) { case READ_META_MASK: return READMETA; case COUNT_MASK: return COUNT; case READ_MASK: return READ; case WRITE_MASK: return WRITE; case WRITEMETA_MASK: return WRITEMETA; default: throw new IllegalArgumentException(format(UNEXPECTED_MASK_MESSAGE, mask)); } } return null; }
Source:
public PointSensitivityBuilder rateSensitivity( PricingEnvironment env, OvernightCompoundedRateObservation observation, LocalDate startDate, LocalDate endDate) { throw new UnsupportedOperationException(); }

Target:
public PointSensitivityBuilder rateSensitivity( PricingEnvironment env, OvernightCompoundedRateObservation observation, LocalDate startDate, LocalDate endDate) { throw new UnsupportedOperationException("Rate sensitivity for OvernightIndex not currently supported"); }