auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testNonBlockingJobSubmission() throws Exception { dispatcher = createAndStartDispatcher(heartbeatServices, haServices, new ExpectedJobIdJobManagerRunnerFactory(TEST_JOB_ID, createdJobManagerRunnerLatch)); jobMasterLeaderElectionService.isLeader(UUID.randomUUID()); DispatcherGateway dispatcherGateway = dispatcher.getSelfGateway(DispatcherGateway.class); final BlockingJobVertex blockingJobVertex = new BlockingJobVertex("testVertex"); blockingJobVertex.setInvokableClass(NoOpInvokable.class); JobGraph blockingJobGraph = new JobGraph(TEST_JOB_ID, "blockingTestJob", blockingJobVertex); dispatcherGateway.submitJob(blockingJobGraph, TIMEOUT).get(); CompletableFuture<JobStatus> jobStatusFuture = dispatcherGateway.requestJobStatus(blockingJobGraph.getJobID(), TIMEOUT); Assert.assertEquals(JobStatus.INITIALIZING, jobStatusFuture.get()); MultipleJobsDetails multiDetails = dispatcherGateway.requestMultipleJobDetails(TIMEOUT).get(); Assert.assertEquals(1, multiDetails.getJobs().size()); Assert.assertEquals(blockingJobGraph.getJobID(), multiDetails.getJobs().iterator().next().getJobId()); blockingJobVertex.unblock(); CommonTestUtils.waitUntilJobManagerIsInitialized(() -> dispatcherGateway.requestJobStatus(blockingJobGraph.getJobID(), TIMEOUT).get()); dispatcherGateway.cancelJob(blockingJobGraph.getJobID(), TIMEOUT).get(); }

Target:
public void testNonBlockingJobSubmission() throws Exception { dispatcher = createAndStartDispatcher(heartbeatServices, haServices, new ExpectedJobIdJobManagerRunnerFactory(TEST_JOB_ID, createdJobManagerRunnerLatch)); jobMasterLeaderElectionService.isLeader(UUID.randomUUID()); DispatcherGateway dispatcherGateway = dispatcher.getSelfGateway(DispatcherGateway.class); Tuple2<JobGraph, BlockingJobVertex> blockingJobGraph = getBlockingJobGraphAndVertex(); JobID jobID = blockingJobGraph.f0.getJobID(); dispatcherGateway.submitJob(blockingJobGraph.f0, TIMEOUT).get(); assertThat(dispatcherGateway.requestJobStatus(jobID, TIMEOUT).get(), is(JobStatus.INITIALIZING)); MultipleJobsDetails multiDetails = dispatcherGateway.requestMultipleJobDetails(TIMEOUT).get(); assertEquals(1, multiDetails.getJobs().size()); assertEquals(jobID, multiDetails.getJobs().iterator().next().getJobId()); blockingJobGraph.f1.unblock(); CommonTestUtils.waitUntilCondition(() -> dispatcherGateway.requestJobStatus(jobGraph.getJobID(), TIMEOUT).get() == JobStatus.RUNNING, Deadline.fromNow(Duration.of(10, ChronoUnit.SECONDS)), 5L); }
Source:
public String toCheckUrl() { String checkUrl = super.toCheckUrl(); try { JellyContext jelly = Functions.getCurrentJellyContext(); Object it = jelly.findVariable("it"); if (it instanceof CredentialsStore) { ModelObject context = ((CredentialsStore) it).getContext(); for (CredentialsSelectHelper.ContextResolver r : ExtensionList .lookup(CredentialsSelectHelper.ContextResolver.class)) { String token = r.getToken(context); if (token != null) { if (checkUrl.endsWith(".toString()")) { checkUrl = StringUtils.removeEnd(checkUrl, ".toString()"); } else { checkUrl = checkUrl + "+qs(this).addThis()"; } return checkUrl + ".append('$provider=" + r.getClass().getName() + "')" + ".append('$token=" + Functions.jsStringEscape( URLEncoder.encode(token, "UTF-8")) + "')" + ".toString()"; } } } } catch (AssertionError e) { } catch (UnsupportedEncodingException e) { } return checkUrl; }

Target:
public String toCheckUrl() { String checkUrl = super.toCheckUrl(); if (checkUrl == null) { return null; } try { JellyContext jelly = Functions.getCurrentJellyContext(); Object it = jelly.findVariable("it"); if (it instanceof CredentialsStore) { ModelObject context = ((CredentialsStore) it).getContext(); for (CredentialsSelectHelper.ContextResolver r : ExtensionList .lookup(CredentialsSelectHelper.ContextResolver.class)) { String token = r.getToken(context); if (token != null) { if (checkUrl.endsWith(".toString()")) { checkUrl = StringUtils.removeEnd(checkUrl, ".toString()"); } else { checkUrl = checkUrl + "+qs(this).addThis()"; } return checkUrl + ".append('$provider=" + Functions.jsStringEscape(URLEncoder.encode(r.getClass().getName(), "UTF-8")) + "')" + ".append('$token=" + Functions.jsStringEscape(URLEncoder.encode(token, "UTF-8")) + "')" + ".toString()"; } } } } catch (AssertionError e) { } catch (UnsupportedEncodingException e) { } return checkUrl; }
Source:
public Collection<Map.Entry<Window.SessionWindow<K>, V>> getSessionEntries(K key, long timestamp, long gap) { List<Map.Entry<Window.SessionWindow<K>, V>> results = new ArrayList<>(); TreeSet<Window.SessionWindow<K>> sessionWindows = keyToWindows.get(key); if (sessionWindows != null) { for (Window.SessionWindow<K> window : sessionWindows) { if (timestamp > window.getBeginTimestamp()) { if (window.getBeginTimestamp() + window.getDurationMillis() + gap > timestamp) { results.add(new AbstractMap.SimpleEntry<>(window, map.get(window).get(key))); } } else if (timestamp < window.getBeginTimestamp()) { if (window.getBeginTimestamp() - gap <= timestamp) { results.add(new AbstractMap.SimpleEntry<>(window, map.get(window).get(key))); } } else { results.add(new AbstractMap.SimpleEntry<>(window, map.get(window).get(key))); } } } return results; }

Target:
public Collection<Map.Entry<Window.SessionWindow<K>, V>> getSessionEntries(K key, long timestamp, long gap) { List<Map.Entry<Window.SessionWindow<K>, V>> results = new ArrayList<>(); TreeSet<Window.SessionWindow<K>> sessionWindows = keyToWindows.get(key); if (sessionWindows != null) { Window.SessionWindow<K> refWindow = new Window.SessionWindow<>(key, timestamp, 1); Window.SessionWindow<K> floor = sessionWindows.floor(refWindow); if (floor != null) { if (floor.getBeginTimestamp() + floor.getDurationMillis() + gap > timestamp) { results.add(new AbstractMap.SimpleEntry<>(floor, map.get(floor).get(key))); } } Window.SessionWindow<K> higher = sessionWindows.higher(refWindow); if (higher != null) { if (higher.getBeginTimestamp() - gap <= timestamp) { results.add(new AbstractMap.SimpleEntry<>(higher, map.get(higher).get(key))); } } } return results; }
Source:
public final Container getNextContainer(final SAMRecord samRecord, final long containerByteOffset) { Container container = null; if (samRecord.getHeader() == null) { samRecord.setHeader(samFileHeader); } final int nextRecordIndex = samRecord.getReferenceIndex(); final int updatedReferenceContextID = sliceFactory.shouldEmitSlice( currentReferenceContextID, nextRecordIndex, sliceSAMRecords.size()); if (updatedReferenceContextID == ReferenceContext.UNINITIALIZED_REFERENCE_ID) { sliceFactory.createNewSliceEntry(currentReferenceContextID, sliceSAMRecords); sliceSAMRecords.clear(); if (shouldEmitContainer( currentReferenceContextID, nextRecordIndex, sliceFactory.getNumberOfSliceEntries())) { container = makeContainer(containerByteOffset); } currentReferenceContextID = nextRecordIndex; } else { currentReferenceContextID = updatedReferenceContextID; } sliceSAMRecords.add(samRecord); return container; }

Target:
public final Container getNextContainer(final SAMRecord samRecord, final long containerByteOffset) { Container container = null; if (samRecord.getHeader() == null) { samRecord.setHeaderStrict(samFileHeader); } final int nextRecordIndex = samRecord.getReferenceIndex(); final int updatedReferenceContextID = sliceFactory.getUpdatedReferenceContext( currentReferenceContextID, nextRecordIndex, sliceSAMRecords.size()); if (shouldEmitSlice(updatedReferenceContextID)) { sliceFactory.createNewSliceEntry(currentReferenceContextID, sliceSAMRecords); sliceSAMRecords.clear(); if (shouldEmitContainer( currentReferenceContextID, nextRecordIndex, sliceFactory.getNumberOfSliceEntries())) { container = makeContainer(containerByteOffset); } currentReferenceContextID = nextRecordIndex; } else { currentReferenceContextID = updatedReferenceContextID; } sliceSAMRecords.add(samRecord); return container; }
Source:
private AuthorizationManager<HttpServletRequest> createAuthorizationManager() { Assert.state(this.unmappedMatchers == null, () -> "An incomplete mapping was found for " + this.unmappedMatchers + ". Try completing it with something like requestUrls().<something>.hasRole('USER')"); return postProcess(this.managerBuilder.build()); }

Target:
private AuthorizationManager<HttpServletRequest> createAuthorizationManager() { Assert.state(this.unmappedMatchers == null, () -> "An incomplete mapping was found for " + this.unmappedMatchers + ". Try completing it with something like requestUrls().<something>.hasRole('USER')"); Assert.state(this.mappingCount > 0, "At least one mapping is required (for example, authorizeHttpRequests().anyRequest().authenticated())"); return postProcess(this.managerBuilder.build()); }
Source:
void handleBody(InputStream payload, MessageMetadata messageMetadata, MessageInfo messageInfo) throws IOException, MessageFormatException { if (!successfullyDeserialized) { BlobData blobData = MessageFormatRecord.deserializeBlob(payload); ByteBuffer encryptionKey = messageMetadata == null ? null : messageMetadata.getEncryptionKey(); ByteBuf chunkBuffer = blobData.getAndRelease(); try { boolean launchedJob = maybeLaunchCryptoJob(chunkBuffer, null, encryptionKey, chunkBlobId); if (!launchedJob) { chunkBuffer = filterChunkToRange(chunkBuffer); chunkIndexToBuf.put(chunkIndex, chunkBuffer.retainedDuplicate()); numChunksRetrieved++; } successfullyDeserialized = true; } finally { chunkBuffer.release(); } } else { } }

Target:
void handleBody(InputStream payload, MessageMetadata messageMetadata, MessageInfo messageInfo) throws IOException, MessageFormatException { if (!successfullyDeserialized) { BlobData blobData = MessageFormatRecord.deserializeBlob(payload); ByteBuffer encryptionKey = messageMetadata == null ? null : messageMetadata.getEncryptionKey(); ByteBuf chunkBuf = blobData.getAndRelease(); try { boolean launchedJob = maybeLaunchCryptoJob(chunkBuf, null, encryptionKey, chunkBlobId); if (!launchedJob) { chunkBuf = filterChunkToRange(chunkBuf); chunkIndexToBuf.put(chunkIndex, chunkBuf.retainedDuplicate()); numChunksRetrieved++; } successfullyDeserialized = true; } finally { chunkBuf.release(); } } else { } }
Source:
public String currencyDefaultPlural() { return "Dollars"; }

Target:
public String currencyDefaultPlural() { return ess.getSettings().getCurrencyPlural(); }
Source:
public boolean equals(Object o){ if(o instanceof SpatialRuleContainer){ if(this.represents(((SpatialRuleContainer) o).getRules())) return true; } return false; }

Target:
public boolean equals(Object o) { if (o instanceof SpatialRuleContainer) { if (this.rules.equals(((SpatialRuleContainer) o).getRules())) return true; } return false; }
Source:
public Layer beforeLayer(WMSMapContent mapContent, Layer layer) { Geometry wktGeom = getClipGeometry(mapContent.getRequest()); if (wktGeom == null) return layer; Geometry bboxGeom = JTS.toGeometry(mapContent.getRequest().getBbox()); if (wktGeom.covers(bboxGeom)) return layer; try { if (layer instanceof FeatureLayer) { FeatureLayer fl = (FeatureLayer) layer; ClippedFeatureSource clippedFS = new ClippedFeatureSource(layer.getFeatureSource(), wktGeom); FeatureLayer clippedLayer = new FeatureLayer(clippedFS, fl.getStyle(), fl.getTitle()); BeanUtilsBean2.getInstance().copyProperties(clippedLayer, fl); fl.getUserData().putAll(layer.getUserData()); return clippedLayer; } else if (layer instanceof GridReaderLayer) { GridReaderLayer gr = (GridReaderLayer) layer; CroppedGridCoverage2DReader croppedGridReader = new CroppedGridCoverage2DReader(gr.getReader(), wktGeom); GridReaderLayer croppedGridLayer = new GridReaderLayer(croppedGridReader, layer.getStyle()); BeanUtilsBean2.getInstance().copyProperties(croppedGridLayer, gr); croppedGridLayer.getUserData().putAll(layer.getUserData()); return croppedGridLayer; } } catch (Exception e) { LOGGER.severe("Error occurred while clipping layer " + layer.getTitle()); LOGGER.log(Level.SEVERE, e.getMessage(), e); return layer; } return layer; }

Target:
public Layer beforeLayer(WMSMapContent mapContent, Layer layer) { Geometry wktGeom = mapContent.getRequest().getClip(); if (wktGeom == null) return layer; Geometry bboxGeom = JTS.toGeometry(mapContent.getRequest().getBbox()); if (wktGeom.covers(bboxGeom)) return layer; try { if (layer instanceof FeatureLayer) { FeatureLayer fl = (FeatureLayer) layer; ClippedFeatureSource clippedFS = new ClippedFeatureSource(layer.getFeatureSource(), wktGeom); FeatureLayer clippedLayer = new FeatureLayer(clippedFS, fl.getStyle(), fl.getTitle()); BeanUtilsBean2.getInstance().copyProperties(clippedLayer, fl); fl.getUserData().putAll(layer.getUserData()); return clippedLayer; } else if (layer instanceof GridReaderLayer) { GridReaderLayer gr = (GridReaderLayer) layer; CroppedGridCoverage2DReader croppedGridReader = new CroppedGridCoverage2DReader(gr.getReader(), wktGeom); GridReaderLayer croppedGridLayer = new GridReaderLayer(croppedGridReader, layer.getStyle()); BeanUtilsBean2.getInstance().copyProperties(croppedGridLayer, gr); croppedGridLayer.getUserData().putAll(layer.getUserData()); return croppedGridLayer; } } catch (Exception e) { LOGGER.severe("Error occurred while clipping layer " + layer.getTitle()); LOGGER.log(Level.SEVERE, e.getMessage(), e); return layer; } return layer; }
Source:
private void setDarkReviewScreen(boolean enabled) { if (invokeSource == SUGGESTED_EDITS_ADD_CAPTION || invokeSource == FEED_CARD_SUGGESTED_EDITS_TRANSLATE_IMAGE_CAPTION || invokeSource == SUGGESTED_EDITS_TRANSLATE_CAPTION || invokeSource == FEED_CARD_SUGGESTED_EDITS_IMAGE_CAPTION) { int whiteRes = getResources().getColor(android.R.color.white); toolbarContainer.setBackgroundResource(enabled ? android.R.color.black : ResourceUtil.getThemedAttributeId(getContext(), R.attr.main_toolbar_color)); saveButton.setColorFilter(enabled ? whiteRes : ResourceUtil.getThemedColor(getContext(), R.attr.themed_icon_color), PorterDuff.Mode.SRC_IN); cancelButton.setColorFilter(enabled ? whiteRes : ResourceUtil.getThemedColor(getContext(), R.attr.main_toolbar_icon_color), PorterDuff.Mode.SRC_IN); headerText.setTextColor(enabled ? whiteRes : ResourceUtil.getThemedColor(getContext(), R.attr.main_toolbar_title_color)); ((DescriptionEditActivity) activity).updateStatusBarColor(enabled ? ContextCompat.getColor(activity, android.R.color.black) : ResourceUtil.getThemedColor(getContext(), R.attr.main_status_bar_color)); DeviceUtil.updateStatusBarTheme(activity, null, enabled); ((DescriptionEditActivity) activity).updateNavigationBarColor(enabled ? ContextCompat.getColor(activity, android.R.color.black) : ResourceUtil.getThemedColor(getContext(), R.attr.paper_color)); } }

Target:
private void setDarkReviewScreen(boolean enabled) { if (action == ADD_CAPTION || action == TRANSLATE_CAPTION) { int whiteRes = getResources().getColor(android.R.color.white); toolbarContainer.setBackgroundResource(enabled ? android.R.color.black : ResourceUtil.getThemedAttributeId(getContext(), R.attr.main_toolbar_color)); saveButton.setColorFilter(enabled ? whiteRes : ResourceUtil.getThemedColor(getContext(), R.attr.themed_icon_color), PorterDuff.Mode.SRC_IN); cancelButton.setColorFilter(enabled ? whiteRes : ResourceUtil.getThemedColor(getContext(), R.attr.main_toolbar_icon_color), PorterDuff.Mode.SRC_IN); headerText.setTextColor(enabled ? whiteRes : ResourceUtil.getThemedColor(getContext(), R.attr.main_toolbar_title_color)); ((DescriptionEditActivity) activity).updateStatusBarColor(enabled ? Color.BLACK : ResourceUtil.getThemedColor(getContext(), R.attr.main_status_bar_color)); DeviceUtil.updateStatusBarTheme(activity, null, enabled); ((DescriptionEditActivity) activity).updateNavigationBarColor(enabled ? Color.BLACK : ResourceUtil.getThemedColor(getContext(), R.attr.paper_color)); } }
Source:
private File createExtractionMarkerFile() { try { final File extractionIsProcessing = Paths.get(destinationDir.getPath(), "extractionIsProcessing.tmp").toFile(); extractionIsProcessing.createNewFile(); extractionIsProcessing.deleteOnExit(); return extractionIsProcessing; } catch (IOException e) { throw new RuntimeException(e); } }

Target:
private File createExtractionMarkerFile() { try { final File extractionIsProcessing = markerFile(); extractionIsProcessing.createNewFile(); extractionIsProcessing.deleteOnExit(); return extractionIsProcessing; } catch (IOException e) { throw new RuntimeException(e); } }
Source:
private LogoutResponse() { RealmLog.debug("Logout response: "); setError(null); }

Target:
private LogoutResponse() { RealmLog.debug("Logout response - Success"); setError(null); }
Source:
public void testConstructorWithStruct() { OffsetCommitResponseData data = new OffsetCommitResponseData() .setTopics(Arrays.asList( new OffsetCommitResponseTopic().setPartitions( Collections.singletonList(new OffsetCommitResponsePartition() .setPartitionIndex(partitionOne) .setErrorCode(errorOne.code()))), new OffsetCommitResponseTopic().setPartitions( Collections.singletonList(new OffsetCommitResponsePartition() .setPartitionIndex(partitionTwo) .setErrorCode(errorTwo.code())) ) )); for (short version = 0; version <= ApiKeys.OFFSET_COMMIT.latestVersion(); version++) { OffsetCommitResponse response = new OffsetCommitResponse(data.toStruct(version), version); assertEquals(expectedErrorCounts, response.errorCounts()); if (version >= 3) { assertEquals(throttleTimeMs, response.throttleTimeMs()); } else { assertEquals(DEFAULT_THROTTLE_TIME, response.throttleTimeMs()); } assertEquals(version >= 4, response.shouldClientThrottle(version)); } }

Target:
public void testConstructorWithStruct() { OffsetCommitResponseData data = new OffsetCommitResponseData() .setTopics(Arrays.asList( new OffsetCommitResponseTopic().setPartitions( Collections.singletonList(new OffsetCommitResponsePartition() .setPartitionIndex(partitionOne) .setErrorCode(errorOne.code()))), new OffsetCommitResponseTopic().setPartitions( Collections.singletonList(new OffsetCommitResponsePartition() .setPartitionIndex(partitionTwo) .setErrorCode(errorTwo.code()))) )) .setThrottleTimeMs(throttleTimeMs); for (short version = 0; version <= ApiKeys.OFFSET_COMMIT.latestVersion(); version++) { OffsetCommitResponse response = new OffsetCommitResponse(data.toStruct(version), version); assertEquals(expectedErrorCounts, response.errorCounts()); if (version >= 3) { assertEquals(throttleTimeMs, response.throttleTimeMs()); } else { assertEquals(DEFAULT_THROTTLE_TIME, response.throttleTimeMs()); } assertEquals(version >= 4, response.shouldClientThrottle(version)); } }
Source:
protected AbstractElement() { this.name = "/"; this.parent = null; this.id = (long) -1; }

Target:
protected AbstractElement() { this.name = "/"; this.parent = null; this.id = -1L; }
Source:
public String evaluate(String referer) { String families = {"wikibooks","wikinews","wikimedia","wikipedia","wikiquote","wikisource","wikiversity","wikivoyage","wiktionary"}; HashSet<String> familySet = new HashSet<String>(Arrays.asList(families)); if (referer == null || referer.equals("-")) return null; PageviewDefinition pageviewDefInst = PageviewDefinition.getInstance(); referer = referer.replaceFirst("http[s]?://", ""); String project = pageviewDefInst.getProjectFromHost(referer); if (pageviewDefInst.isWikimediaHost(project + ".org")) { return project; } else { return null; } }

Target:
public String evaluate(String referer) { if (referer == null || referer.equals("-")) return null; referer = referer.replaceFirst("http[s]?://", ""); String project = Webrequest.getProjectFromHost(referer); if (Webrequest.isWikimediaHost(project + ".org")) { return project; } else { return null; } }
Source:
public final void cleanExpiredUsersSessions() { Date now = new Date(); Iterator<Entry<String, SessionInfo>> iterator = sessionInfoMap.entrySet().iterator(); while (iterator.hasNext()) { ConcurrentMap<String, Object> sessionMap = iterator.next().getValue().contentOfSession; Date hardLimit = sessionMap.containsKey(HARD_LIMIT_PARAMETER_NAME) ? (Date) sessionMap.get(HARD_LIMIT_PARAMETER_NAME) : null; Date softLimit = (Date) sessionMap.get(SOFT_LIMIT_PARAMETER_NAME); if (hardLimit != null) { if (hardLimit.before(now)) { iterator.remove(); } } if (softLimit != null) { if (softLimit.before(now)) { iterator.remove(); } } } }

Target:
public final void cleanExpiredUsersSessions() { Date now = new Date(); Iterator<Entry<String, SessionInfo>> iterator = sessionInfoMap.entrySet().iterator(); while (iterator.hasNext()) { ConcurrentMap<String, Object> sessionMap = iterator.next().getValue().contentOfSession; Date hardLimit = (Date) sessionMap.get(HARD_LIMIT_PARAMETER_NAME); Date softLimit = (Date) sessionMap.get(SOFT_LIMIT_PARAMETER_NAME); if (hardLimit != null) { if (hardLimit.before(now)) { iterator.remove(); } } if (softLimit != null) { if (softLimit.before(now)) { iterator.remove(); } } } }
Source:
private void startConnect() throws IOException { if(!isFirstConnect){ try { Thread.sleep(r.nextInt(1000)); } catch (InterruptedException e) { LOG.warn("Unexpected exception", e); } } state = States.CONNECTING; InetSocketAddress addr; if (rwServerAddress != null) { addr = rwServerAddress; rwServerAddress = null; } else { addr = hostProvider.next(1000); } String hostPort = addr.getHostString() + ":" + addr.getPort(); MDC.put("myid", hostPort); setName(getName().replaceAll("\\(.*\\)", "(" + hostPort + ")")); if (clientConfig.isSaslClientEnabled()) { try { if (zooKeeperSaslClient != null) { zooKeeperSaslClient.shutdown(); } zooKeeperSaslClient = new ZooKeeperSaslClient(getServerPrincipal(addr), clientConfig); saslLoginFailed = false; } catch (LoginException e) { LOG.warn("SASL configuration failed: " + e + " Will continue connection to Zookeeper server without " + "SASL authentication, if Zookeeper server allows it."); eventThread.queueEvent(new WatchedEvent( Watcher.Event.EventType.None, Watcher.Event.KeeperState.AuthFailed, null)); saslLoginFailed = true; } } logStartConnect(addr); clientCnxnSocket.connect(addr); }

Target:
private void startConnect() throws IOException { saslLoginFailed = false; if(!isFirstConnect){ try { Thread.sleep(r.nextInt(1000)); } catch (InterruptedException e) { LOG.warn("Unexpected exception", e); } } state = States.CONNECTING; InetSocketAddress addr; if (rwServerAddress != null) { addr = rwServerAddress; rwServerAddress = null; } else { addr = hostProvider.next(1000); } String hostPort = addr.getHostString() + ":" + addr.getPort(); MDC.put("myid", hostPort); setName(getName().replaceAll("\\(.*\\)", "(" + hostPort + ")")); if (clientConfig.isSaslClientEnabled()) { try { if (zooKeeperSaslClient != null) { zooKeeperSaslClient.shutdown(); } zooKeeperSaslClient = new ZooKeeperSaslClient(getServerPrincipal(addr), clientConfig); } catch (LoginException e) { LOG.warn("SASL configuration failed: " + e + " Will continue connection to Zookeeper server without " + "SASL authentication, if Zookeeper server allows it."); eventThread.queueEvent(new WatchedEvent( Watcher.Event.EventType.None, Watcher.Event.KeeperState.AuthFailed, null)); saslLoginFailed = true; } } logStartConnect(addr); clientCnxnSocket.connect(addr); }
Source:
public DiskProfileValidator(DiskProfile diskProfile) { this(diskProfile.getId()); this.diskProfile = diskProfile; }

Target:
public DiskProfileValidator(DiskProfile diskProfile) { this(diskProfile != null ? diskProfile.getId() : null); this.diskProfile = diskProfile; }
Source:
public static org.ovirt.engine.core.common.job.Step map(Step step, org.ovirt.engine.core.common.job.Step entity) { org.ovirt.engine.core.common.job.Step target = entity != null ? entity : new org.ovirt.engine.core.common.job.Step(); target.setId(GuidUtils.asGuid(step.getId())); if (step.isSetParentStep()) { target.setParentStepId(GuidUtils.asGuid(step.getParentStep().getId())); } target.setJobId(GuidUtils.asGuid(step.getJob().getId())); if (step.isSetType()) { target.setStepType(map(step.getType())); } if (step.isSetDescription()) { target.setDescription(step.getDescription()); } if (step.isSetNumber()) { target.setStepNumber(step.getNumber()); } if (step.isSetStatus()) { target.setStatus(mapStepStatus(step.getStatus())); } target.setProgress(step.getProgress()); target.setStartTime(step.isSetStartTime() ? step.getStartTime().toGregorianCalendar().getTime() : new Date(Calendar.getInstance().getTimeInMillis())); target.setEndTime(step.isSetEndTime() ? step.getEndTime().toGregorianCalendar().getTime() : new Date(Calendar.getInstance().getTimeInMillis())); target.setExternal(step.isSetExternal() ? step.isExternal() : true); return target; }

Target:
public static org.ovirt.engine.core.common.job.Step map(Step step, org.ovirt.engine.core.common.job.Step entity) { org.ovirt.engine.core.common.job.Step target = entity != null ? entity : new org.ovirt.engine.core.common.job.Step(); target.setId(GuidUtils.asGuid(step.getId())); if (step.isSetParentStep()) { target.setParentStepId(GuidUtils.asGuid(step.getParentStep().getId())); } target.setJobId(GuidUtils.asGuid(step.getJob().getId())); if (step.isSetType()) { target.setStepType(map(step.getType())); } if (step.isSetDescription()) { target.setDescription(step.getDescription()); } if (step.isSetNumber()) { target.setStepNumber(step.getNumber()); } if (step.isSetStatus()) { target.setStatus(mapStepStatus(step.getStatus())); } if (step.isSetProgress()) { target.setProgress(step.getProgress()); } target.setStartTime(step.isSetStartTime() ? step.getStartTime().toGregorianCalendar().getTime() : new Date(Calendar.getInstance().getTimeInMillis())); target.setEndTime(step.isSetEndTime() ? step.getEndTime().toGregorianCalendar().getTime() : new Date(Calendar.getInstance().getTimeInMillis())); target.setExternal(step.isSetExternal() ? step.isExternal() : true); return target; }
Source:
public void testCreateSinkTableWithoutPK() { TableSchema illegalSchema = TableSchema.builder() .field("region", DataTypes.STRING()) .field("view_count", DataTypes.BIGINT()) .build(); ObjectIdentifier objectIdentifier = ObjectIdentifier.of( "default", "default", "sinkTable"); CatalogTable catalogTable = new CatalogTableImpl(illegalSchema, getFullSinkOptions(), "sinkTable"); thrown.expect(ValidationException.class); thrown.expect(containsCause(new ValidationException("PK constraints must be defined in the 'upsert-kafka' connector."))); FactoryUtil.createTableSink(null, objectIdentifier, catalogTable, new Configuration(), Thread.currentThread().getContextClassLoader(), false); }

Target:
public void testCreateSinkTableWithoutPK() { thrown.expect(ValidationException.class); thrown.expect(containsCause(new ValidationException("'upsert-kafka' tables require to define a PRIMARY KEY constraint. " + "The PRIMARY KEY specifies which columns should be read from or write to the Kafka message key. " + "The PRIMARY KEY also defines records in the 'upsert-kafka' table should update or delete on which keys."))); TableSchema illegalSchema = TableSchema.builder() .field("region", DataTypes.STRING()) .field("view_count", DataTypes.BIGINT()) .build(); createActualSink(illegalSchema, getFullSinkOptions()); }
Source:
protected void upgradeSystemTables() throws StandardException { sdd.createKeyColumnUseViewInSysIBM(tc); SpliceLogUtils.info(LOG, "Catalog upgraded: updated syscolumns view in SYSIBM schema"); }

Target:
protected void upgradeSystemTables() throws StandardException { sdd.createKeyColumnUseViewInSysIBM(tc); SpliceLogUtils.info(LOG, "Catalog upgraded: added syskeycoluse view in SYSIBM schema"); }
Source:
protected void perform() { log.infoFormat("Sending reboot command for VM {0}.", getVm().getName()); final VDSReturnValue returnValue = runVdsCommand(VDSCommandType.RebootVm, new VdsAndVmIDVDSParametersBase(getVdsId(), getVmId())); setActionReturnValue(returnValue.getReturnValue()); setSucceeded(returnValue.getSucceeded()); }

Target:
protected void perform() { final VDSReturnValue returnValue = runVdsCommand(VDSCommandType.RebootVm, new VdsAndVmIDVDSParametersBase(getVdsId(), getVmId())); setActionReturnValue(returnValue.getReturnValue()); setSucceeded(returnValue.getSucceeded()); }
Source:
private Optional<CoordinationUtils> getCoordinationUtils(Config config) { boolean isAppModeBatch = new ApplicationConfig(appDesc.getConfig()).getAppMode() == ApplicationConfig.ApplicationMode.BATCH; if (!isAppModeBatch) { return Optional.empty(); } JobCoordinatorConfig jcConfig = new JobCoordinatorConfig(config); CoordinationUtils coordinationUtils = jcConfig.getCoordinationUtilsFactory().getCoordinationUtils(CoordinationConstants.APPLICATION_RUNNER_PATH_SUFFIX, PROCESSOR_ID, config); if (coordinationUtils != null) { return Optional.of(coordinationUtils); } return Optional.empty(); }

Target:
private Optional<CoordinationUtils> getCoordinationUtils(Config config) { if (!isAppModeBatch) { return Optional.empty(); } JobCoordinatorConfig jcConfig = new JobCoordinatorConfig(config); CoordinationUtils coordinationUtils = jcConfig.getCoordinationUtilsFactory().getCoordinationUtils(CoordinationConstants.APPLICATION_RUNNER_PATH_SUFFIX, PROCESSOR_ID, config); return Optional.ofNullable(coordinationUtils); }
Source:
public void logout() { if (mFacebookAuthHelper != null) mFacebookAuthHelper.logout(); if (mGoogleAuthHelper != null) mGoogleAuthHelper.logout(); if (mTwitterAuthHelper != null) mTwitterAuthHelper.logout(); if (mPasswordAuthHelper != null) mPasswordAuthHelper.logout(); mRef.unauth(); }

Target:
public void logout() { if (mTwitterAuthProvider != null) mTwitterAuthProvider.logout(); if (mFacebookAuthProvider != null) mFacebookAuthProvider.logout(); if (mGoogleAuthProvider != null) mGoogleAuthProvider.logout(); if (mPasswordAuthProvider != null) mPasswordAuthProvider.logout(); mRef.unauth(); }
Source:
Set<ReportField> reportContent() { Set<ReportField> reportContent = new HashSet<ReportField>(); if (customReportContent != null) { if (ACRA.DEV_LOGGING) ACRA.log.d(LOG_TAG, "Using custom Report Fields"); reportContent.addAll(Arrays.asList(customReportContent)); } else if (mailTo == null || DEFAULT_STRING_VALUE.equals(mailTo)) { if (ACRA.DEV_LOGGING) ACRA.log.d(LOG_TAG, "Using default Report Fields"); reportContent.addAll(Arrays.asList(DEFAULT_REPORT_FIELDS)); } else { if (ACRA.DEV_LOGGING) ACRA.log.d(LOG_TAG, "Using default Mail Report Fields"); reportContent.addAll(Arrays.asList(DEFAULT_MAIL_REPORT_FIELDS)); } if (!reportContentChanges.isEmpty()) { for (Map.Entry<ReportField, Boolean> entry : reportContentChanges.entrySet()) { if (entry.getValue()) { reportContent.add(entry.getKey()); } else { reportContent.remove(entry.getKey()); } } } return reportContent; }

Target:
Set<ReportField> reportContent() { Set<ReportField> reportContent = new HashSet<ReportField>(); if (customReportContent != null) { if (ACRA.DEV_LOGGING) ACRA.log.d(LOG_TAG, "Using custom Report Fields"); reportContent.addAll(Arrays.asList(customReportContent)); } else if (mailTo == null || DEFAULT_STRING_VALUE.equals(mailTo)) { if (ACRA.DEV_LOGGING) ACRA.log.d(LOG_TAG, "Using default Report Fields"); reportContent.addAll(Arrays.asList(DEFAULT_REPORT_FIELDS)); } else { if (ACRA.DEV_LOGGING) ACRA.log.d(LOG_TAG, "Using default Mail Report Fields"); reportContent.addAll(Arrays.asList(DEFAULT_MAIL_REPORT_FIELDS)); } for (Map.Entry<ReportField, Boolean> entry : reportContentChanges.entrySet()) { if (entry.getValue()) { reportContent.add(entry.getKey()); } else { reportContent.remove(entry.getKey()); } } return reportContent; }
Source:
public boolean handleFault(SOAPMessageContext context) { if (!shouldExecute(context)) { return true; } final Span span = tracingPlugin.getTracer().scopeManager().activeSpan(); Tags.ERROR.set(span, Boolean.TRUE); try { final SOAPFault fault = context.getMessage().getSOAPBody().getFault(); span.setTag("soap.fault.reason", fault.getFaultString()); span.setTag("soap.fault.code", fault.getFaultCode()); } catch (SOAPException e) { logger.warn("Exception while trying to access SOAP fault (this exception was suppressed)", e); } return true; }

Target:
public boolean handleFault(SOAPMessageContext context) { if (!shouldExecute(context)) { return true; } final Span activeSpan = tracingPlugin.getTracer().scopeManager().activeSpan(); if (activeSpan != null) { Tags.ERROR.set(activeSpan, Boolean.TRUE); try { final SOAPFault fault = context.getMessage().getSOAPBody().getFault(); activeSpan.setTag("soap.fault.reason", fault.getFaultString()); activeSpan.setTag("soap.fault.code", fault.getFaultCode()); } catch (SOAPException e) { logger.warn("Exception while trying to access SOAP fault (this exception was suppressed)", e); } } return true; }
Source:
public static void assertEmpty(String multimapName, Multimap<?, ?> actualMultimap) { try { assertObjectNotNull(multimapName, actualMultimap); if (!actualMultimap.isEmpty()) { Assert.fail(multimapName + MSG_SHOULD_BE_EMPTY_ACTUAL_SIZE + actualMultimap.size() + '>'); } } catch (AssertionError e) { throw mangledException(e); } }

Target:
public static void assertEmpty(String multimapName, Multimap<?, ?> actualMultimap) { try { assertObjectNotNull(multimapName, actualMultimap); if (!actualMultimap.isEmpty()) { fail(multimapName + MSG_SHOULD_BE_EMPTY_ACTUAL_SIZE + actualMultimap.size() + '>'); } } catch (AssertionError e) { throw mangledException(e); } }
Source:
public List<UserModel> searchForUser(Map<String, String> attributes, RealmModel realm, int firstResult, int maxResults) { String search = Optional.ofNullable(attributes.get(UserModel.USERNAME)) .orElseGet(()-> attributes.get(UserModel.SEARCH)); if (search == null) return Collections.EMPTY_LIST; return searchForUser(search, realm, firstResult, maxResults, username -> { if (Boolean.valueOf(attributes.getOrDefault(UserModel.EXACT, Boolean.FALSE.toString()))) { return username.equals(search); } else { return username.contains(search); } }); }

Target:
public List<UserModel> searchForUser(Map<String, String> attributes, RealmModel realm, int firstResult, int maxResults) { String search = Optional.ofNullable(attributes.get(UserModel.USERNAME)) .orElseGet(()-> attributes.get(UserModel.SEARCH)); if (search == null) return Collections.EMPTY_LIST; Predicate<String> p = Boolean.valueOf(attributes.getOrDefault(UserModel.EXACT, Boolean.FALSE.toString())) ? username -> username.equals(search) : username -> username.contains(search); return searchForUser(search, realm, firstResult, maxResults, p); }
Source:
private void sortBySize(boolean sortAscending){ final Integer val; if (sortAscending){ val = 1; } else { val = -1; } Collections.sort(mFiles, new Comparator<OCFile>() { public int compare(OCFile o1, OCFile o2) { if (o1.isFolder() && o2.isFolder()) { return val * Long.compare(getFolderSize(new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, o1))), getFolderSize(new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, o2)))); } else if (o1.isFolder()) { return -1; } else if (o2.isFolder()) { return 1; } else if (o1.getFileLength() == 0 || o2.getFileLength() == 0){ return 0; } else { return val * Long.compare(o1.getFileLength(), o2.getFileLength()); } } }); }

Target:
private void sortBySize(boolean sortAscending) { final Integer val; if (sortAscending) { val = 1; } else { val = -1; } Collections.sort(mFiles, new Comparator<OCFile>() { @Override public int compare(OCFile o1, OCFile o2) { if (o1.isFolder() && o2.isFolder()) { return val * Long.compare( getFolderSize(new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, o1))), getFolderSize(new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, o2)))); } else if (o1.isFolder()) { return -1; } else if (o2.isFolder()) { return 1; } else if (o1.getFileLength() == 0 || o2.getFileLength() == 0) { return 0; } else { return val * Long.compare(o1.getFileLength(), o2.getFileLength()); } } }); }
Source:
public int getInt(int col) { return intValues[col]; }

Target:
public int getInt(int col) { return tableId; }
Source:
public String toString() { return com.google.common.base.Objects.toStringHelper(this) .add("id", m_id) .add("applicationName", m_applicationName) .toString(); }

Target:
public String toString() { return MoreObjects.toStringHelper(this) .add("m_id", m_id) .add("m_applicationName", m_applicationName) .add("location", location) .toString(); }
Source:
public static IType findTypeInCompilationUnit(ICompilationUnit cu, String typeQualifiedName) throws JavaModelException { IType[] types= cu.getAllTypes(); for (IType type : types) { String currName= type.getTypeQualifiedName('.'); if (typeQualifiedName.equals(currName)) { return type; } } return null; }

Target:
public static IType findTypeInCompilationUnit(ICompilationUnit cu, String typeQualifiedName) throws JavaModelException { IType[] types= cu.getAllTypes(); for (int i= 0; i < types.length; i++) { String currName= types[i].getTypeQualifiedName('.'); if (typeQualifiedName.equals(currName)) { return types[i]; } } return null; }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SourceProcessingDetailsImpl that = (SourceProcessingDetailsImpl) o; if (this.warnings == null) return that.warnings == null; if (that.warnings == null) return false; ListIterator<String> thisWarningsIterator = this.warnings.listIterator(); ListIterator<String> thatWarningsIterator = that.warnings.listIterator(); while (thisWarningsIterator.hasNext() && thatWarningsIterator.hasNext()) { String thisNextWarning = thisWarningsIterator.next(); String thatNextWarning = thatWarningsIterator.next(); if (!Objects.equals(thisNextWarning, thatNextWarning)) return false; } return !thisWarningsIterator.hasNext() && !thatWarningsIterator.hasNext(); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } SourceProcessingDetailsImpl that = (SourceProcessingDetailsImpl) o; return this.warnings.size() == that.warnings.size() && this.warnings.containsAll(that.warnings); }
Source:
public Person readPerson(final String memberId) { final CgdCardCounter counter = CgdCardCounter.findCounterForYear(CgdCard.yearFor(memberId)); if (!StringUtils.isNumeric(memberId)) { return null; } final int serialNumber = CgdCard.serialNumberFor(memberId); return counter == null ? null : counter.getCgdCardSet().stream().filter(c -> c.getSerialNumber() == serialNumber) .map(c -> c.getUser().getPerson()).findAny().orElse(null); }

Target:
public Person readPerson(final String memberId) { if (!StringUtils.isNumeric(memberId)) { return null; } final CgdCardCounter counter = CgdCardCounter.findCounterForYear(CgdCard.yearFor(memberId)); final int serialNumber = CgdCard.serialNumberFor(memberId); return counter == null ? null : counter.getCgdCardSet().stream().filter(c -> c.getSerialNumber() == serialNumber) .map(c -> c.getUser().getPerson()).findAny().orElse(null); }
Source:
private ErrorHandler createErrorHandlerFromString(String errorHandlerClassName, ClassLoaderService classLoaderService) { if ( StringHelper.isEmpty( errorHandlerClassName ) || "log".equals( errorHandlerClassName.trim() ) ) { return new LogErrorHandler(); } else { Class<?> errorHandlerClass = classLoaderService.classForName( errorHandlerClassName ); return ClassLoaderHelper.instanceFromClass( ErrorHandler.class, errorHandlerClass, "Error Handler" ); } }

Target:
private ErrorHandler createErrorHandlerFromString(String errorHandlerClassName, ClassLoaderService classLoaderService) { if ( StringHelper.isEmpty( errorHandlerClassName ) || ErrorHandler.LOG.equals( errorHandlerClassName.trim() ) ) { return new LogErrorHandler(); } else { Class<?> errorHandlerClass = classLoaderService.classForName( errorHandlerClassName ); return ClassLoaderHelper.instanceFromClass( ErrorHandler.class, errorHandlerClass, "Error Handler" ); } }
Source:
public MakeBucketArgs build() throws IllegalArgumentException { if (this.bucket == null) { throw new IllegalArgumentException("null value is not allowed for Bucket"); } return new MakeBucketArgs(this); }

Target:
public MakeBucketArgs build() throws IllegalArgumentException { return new MakeBucketArgs(this); }
Source:
private Tuple2<String, Map<String, Object>> runAndTakeSavepoint() throws Exception { return withCluster(new Configuration(), miniCluster -> { JobClient jobClient = submitJobInitially(env(startAligned, 0)); waitForAllTaskRunning(miniCluster, jobClient.getJobID(), Deadline.fromNow(Duration.of(30, ChronoUnit.SECONDS))); Thread.sleep(FIRST_RUN_BACKPRESSURE_MS); Future<Map<String, Object>> accFuture = jobClient.getAccumulators(); Future<String> savepointFuture = jobClient.stopWithSavepoint(false, tempFolder().toURI().toString()); return new Tuple2<>(savepointFuture.get(), accFuture.get()); }); }

Target:
private Tuple2<String, Map<String, Object>> runAndTakeSavepoint() throws Exception { JobClient jobClient = submitJobInitially(env(startAligned, 0)); waitForAllTaskRunning(() -> miniCluster.getMiniCluster().getExecutionGraph(jobClient.getJobID()).get()); Thread.sleep(FIRST_RUN_BACKPRESSURE_MS); Future<Map<String, Object>> accFuture = jobClient.getAccumulators(); Future<String> savepointFuture = jobClient.stopWithSavepoint(false, tempFolder().toURI().toString()); return new Tuple2<>(savepointFuture.get(), accFuture.get()); }
Source:
public void validate(Map<String, List<String>> messageHeaders, AlgorithmProvider algorithmProvider, PublicKeyProvider publicKeyProvider, SecurityProvider securityProvider, String method, String uri) { Signature signature = extractSignatureFromHeader(messageHeaders.get("Signature").get(0)); String providedAlgorithm = algorithmProvider.getAlgorithmName(signature.getKeyId()); Objects.requireNonNull(providedAlgorithm, "provided algorithm is null"); String signatureAlgorithm = signature.getAlgorithm().toString(); if (!providedAlgorithm.equals(signatureAlgorithm)) { throw new DifferentAlgorithmsException("signature algorithm from header and provided are different"); } Key key = publicKeyProvider.getKey(signature.getKeyId()); Objects.requireNonNull(key, "provided public key is null"); java.security.Provider provider = securityProvider.getProvider(signature.getKeyId()); Objects.requireNonNull(provider, "provided security provider is null"); runVerifier(messageHeaders, key, signature, provider, method, uri); }

Target:
public void validate(Map<String, List<String>> messageHeaders, AlgorithmProvider algorithmProvider, PublicKeyProvider publicKeyProvider, SecurityProvider securityProvider, String method, String uri) { Signature signature = extractSignatureFromHeader(messageHeaders.get("Signature").get(0)); String providedAlgorithm = algorithmProvider.getAlgorithmName(signature.getKeyId()); String signatureAlgorithm = signature.getAlgorithm().toString(); if (!providedAlgorithm.equals(signatureAlgorithm)) { throw new DifferentAlgorithmsException("signature algorithm from header and provided are different"); } Key key = publicKeyProvider.getKey(signature.getKeyId()); java.security.Provider provider = securityProvider.getProvider(signature.getKeyId()); runVerifier(messageHeaders, key, signature, provider, method, uri); }
Source:
public static String autoConvert(long size , SizeUnit inUnit) { for(int i = (int)(inUnit.getUnitWeight()); i <= SizeUnit.GB.getUnitWeight();i++ ) { if(size > Math.pow(1024, i)) { if(i == 0 ) { break; } return ((String.valueOf(convert(size, inUnit, SizeUnit.getUnit(i-1)))).concat(" ")).concat(SizeUnit.getUnit(i-1).toString()); } } return String.valueOf(size).concat(" ").concat(SizeUnit.BYTES.toString()); }

Target:
public static String autoConvert(long size , SizeUnit inUnit) { weightToUnit = new HashMap<SizeConverter.SizeUnit, Long>(); for(long i = (SizeUnit.values())[SizeUnit.values().length - 1].getUnitWeight(); i >= inUnit.getUnitWeight() ; i-- ) { if(size/Math.pow(CONVERT_FACTOR, i-1) >= 1) { return ((String.valueOf(convert(size, inUnit, SizeUnit.getUnit(inUnit.getUnitWeight() + i-1)))).concat(" ")).concat(SizeUnit.getUnit(inUnit.getUnitWeight() + i -1).toString()); } } return String.valueOf(size).concat(" ").concat(SizeUnit.BYTES.toString()); }
Source:
public void createProfileDuplicateDisplayName() { createEnabledTestUser(); Map<String, String> profileDTO = getProfileDTO(); profileDTO.put("displayName", "MONSTERKILLER9001"); SessionData login = login(testUser.getUsername(), testUserCleartextPassword); given(). filter(sessionFilter). header(login.getCsrfHeader()). when(). content(profileDTO). contentType(ContentType.JSON). post("/users/current/profile"). then(). statusCode(HttpStatus.SC_CONFLICT); }

Target:
public void createProfileDuplicateDisplayName() { createEnabledTestUser(); Map<String, String> profileDTO = getProfileDTO(); profileDTO.put("displayName", user.getProfile().getDisplayName().toUpperCase()); SessionData login = login(testUser.getUsername(), testUserCleartextPassword); given(). filter(sessionFilter). header(login.getCsrfHeader()). when(). content(profileDTO). contentType(ContentType.JSON). post("/users/current/profile"). then(). statusCode(HttpStatus.SC_CONFLICT). body("message", equalTo("DisplayName already in use")); }
Source:
protected void configure() { super.configure(); bind(new TypeLiteral<ComputeServiceAdapter<Server, HardwareFlavour, org.apache.jclouds.oneandone.rest.domain.Image, Location>>() { }).to(OneandoneComputeServiceAdapter.class); bind(TemplateBuilderImpl.class).to(ArbitraryCpuRamTemplateBuilderImpl.class); bind(new TypeLiteral<Function<Server, NodeMetadata>>() { }).to(ServerToNodeMetadata.class); bind(new TypeLiteral<Function<org.apache.jclouds.oneandone.rest.domain.Image, Image>>() { }).to(ImageToImage.class); bind(new TypeLiteral<Function<Hdd, Volume>>() { }).to(HddToVolume.class); bind(new TypeLiteral<Function<HardwareFlavour, Hardware>>() { }).to(HardwareFlavourToHardware.class); }

Target:
protected void configure() { super.configure(); install(new LocationsFromComputeServiceAdapterModule<Server, HardwareFlavour, SingleServerAppliance, DataCenter>() { }); bind(new TypeLiteral<ComputeServiceAdapter<Server, HardwareFlavour, SingleServerAppliance, DataCenter>>() { }).to(OneandoneComputeServiceAdapter.class); bind(TemplateBuilderImpl.class).to(ArbitraryCpuRamTemplateBuilderImpl.class); bind(NodeAndTemplateOptionsToStatement.class).to(NodeAndTemplateOptionsToStatementWithoutPublicKey.class); bind(new TypeLiteral<Function<Server, NodeMetadata>>() { }).to(ServerToNodeMetadata.class); bind(new TypeLiteral<Function<SingleServerAppliance, Image>>() { }).to(SingleServerApplianceToImage.class); bind(new TypeLiteral<Function<Hdd, Volume>>() { }).to(HddToVolume.class); bind(new TypeLiteral<Function<HardwareFlavour, Hardware>>() { }).to(HardwareFlavourToHardware.class); bind(new TypeLiteral<Function<DataCenter, Location>>() { }).to(DataCenterToLocation.class); }
Source:
public void createSuiteContext(@Observes(precedence = 100) EventContext<SuiteEvent> context) { SuiteContext suiteContext = this.suiteContextInstance.get(); try { suiteContext.activate(); context.proceed(); } finally { suiteContext.deactivate(); suiteContext.destroy(); } }

Target:
public void createSuiteContext(@Observes(precedence = 100) EventContext<SuiteEvent> context) { SuiteContext suiteContext = this.suiteContextInstance.get(); try { suiteContext.activate(); context.proceed(); } finally { suiteContext.deactivate(); if (AfterSuite.class.isAssignableFrom(context.getEvent().getClass())) { suiteContext.destroy(); } } }
Source:
private PackWriter newPackWriter() { PackConfig pc = packConfig; if (pc == null) { pc = db != null ? new PackConfig(db) : new PackConfig(); } if (reader != null) { return new PackWriter(pc, reader); } final ObjectReader or = db.newObjectReader(); return new PackWriter(pc, or) { @Override public void close() { super.close(); or.close(); } }; }

Target:
private PackWriter newPackWriter() { PackConfig pc = packConfig; if (pc == null) { pc = db != null ? new PackConfig(db) : new PackConfig(); } return new PackWriter(pc, reader != null ? reader : db.newObjectReader()); }