auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static boolean wiredMbusMatches(final MbusChannelElementsDto mbusChannelElements, final ChannelElementValuesDto channelElementValues) { final boolean hasValidMbusAttributes = channelElementValues.isMbusSlaveDeviceConfigured() && mbusChannelElements.getPrimaryAddress().equals(mbusChannelElements.getPrimaryAddress()); final boolean validateMbusDeviceInfoMatch = !(failMatchOnMbusIdentificationNumber(mbusChannelElements, channelElementValues) || failMatchOnMbusManufacturerIdentification(mbusChannelElements, channelElementValues) || failMatchOnMbusVersion(mbusChannelElements, channelElementValues) || failMatchOnMbusDeviceTypeIdentification(mbusChannelElements, channelElementValues)); return hasValidMbusAttributes && validateMbusDeviceInfoMatch; }

Target:
private static boolean wiredMbusMatches(final MbusChannelElementsDto mbusChannelElements, final ChannelElementValuesDto channelElementValues) { return hasValidMbusAttributes(mbusChannelElements, channelElementValues) && validateMbusDeviceInfoMatch(mbusChannelElements, channelElementValues); }
Source:
protected void init(final InputStream input, final OutputStream output, final OutputStream messages) { origOut = output; rawIn = input; rawOut = output; msgOut = messages; if (timeout > 0) { final Thread caller = Thread.currentThread(); timer = new InterruptTimer(caller.getName() + "-Timer"); timeoutIn = new TimeoutInputStream(rawIn, timer); TimeoutOutputStream o = new TimeoutOutputStream(rawOut, timer); timeoutIn.setTimeout(timeout * 1000); o.setTimeout(timeout * 1000); rawIn = timeoutIn; rawOut = o; } if (maxPackSizeLimit >= 0) { rawIn = new LimitedInputStream(rawIn, maxPackSizeLimit) { @Override protected void limitExceeded() throws TooLargePackException { throw new TooLargePackException(limit); } }; } pckIn = new PacketLineIn(rawIn); pckOut = new PacketLineOut(rawOut); pckOut.setFlushOnEnd(false); enabledCapabilities = new HashSet<String>(); commands = new ArrayList<ReceiveCommand>(); }

Target:
protected void init(final InputStream input, final OutputStream output, final OutputStream messages) { origOut = output; rawIn = input; rawOut = output; msgOut = messages; if (timeout > 0) { final Thread caller = Thread.currentThread(); timer = new InterruptTimer(caller.getName() + "-Timer"); timeoutIn = new TimeoutInputStream(rawIn, timer); TimeoutOutputStream o = new TimeoutOutputStream(rawOut, timer); timeoutIn.setTimeout(timeout * 1000); o.setTimeout(timeout * 1000); rawIn = timeoutIn; rawOut = o; } if (maxPackSizeLimit >= 0) rawIn = new LimitedInputStream(rawIn, maxPackSizeLimit) { @Override protected void limitExceeded() throws TooLargePackException { throw new TooLargePackException(limit); } }; pckIn = new PacketLineIn(rawIn); pckOut = new PacketLineOut(rawOut); pckOut.setFlushOnEnd(false); enabledCapabilities = new HashSet<String>(); commands = new ArrayList<ReceiveCommand>(); }
Source:
public Optional<QualityGateDto> getDefault(DbSession dbSession, OrganizationDto organization) { QualityGateDto defaultQualityGate = dbClient.qualityGateDao().selectByOrganizationAndUuid(dbSession, organization, organization.getDefaultQualityGateUuid()); return Optional.ofNullable(defaultQualityGate); }

Target:
public QualityGateDto getDefault(DbSession dbSession, OrganizationDto organization) { QGateWithOrgDto qgate = dbClient.qualityGateDao().selectByOrganizationAndUuid(dbSession, organization, organization.getDefaultQualityGateUuid()); checkState(qgate != null, "Default quality gate [%s] is missing on organization [%s]", organization.getDefaultQualityGateUuid(), organization.getUuid()); return qgate; }
Source:
protected void executeCommand() { VDSGroup vdsGroup = getVdsGroup(); if (vdsGroup.supportsVirtService()) { setSucceeded(initVirtResources()); } if (vdsGroup.supportsGlusterService()) { setSucceeded(initGlusterHost()); } }

Target:
protected void executeCommand() { VDSGroup vdsGroup = getVdsGroup(); setSucceeded(true); if (vdsGroup.supportsVirtService()) { setSucceeded(initVirtResources()); } if (getSucceeded() && vdsGroup.supportsGlusterService()) { setSucceeded(initGlusterHost()); } }
Source:
public static Interval between(Timestamp start, Timestamp end) { final long secondsBetween = end.getSeconds() - start.getSeconds(); final int nanosBetween = end.getNanos() - start.getNanos(); final Duration duration = Duration.newBuilder() .setSeconds(abs(secondsBetween)) .setNanos(abs(nanosBetween)) .build(); final Interval.Builder interval = Interval.newBuilder() .setStart(start) .setEnd(end) .setDuration(duration); return interval.build(); }

Target:
public static Interval between(Timestamp start, Timestamp end) { checkArgument(isLaterThan(end, start), "The end must be after the start of the interval."); final Interval.Builder interval = Interval.newBuilder() .setStart(start) .setEnd(end); return interval.build(); }
Source:
public void createMandatoryConstructorSignaturePredicate() { mandatoryConstructorSignature = createConstructorSignaturePredicate(VdcActionParametersBase.class, CommandContext.class); }

Target:
public static void createMandatoryConstructorSignaturePredicate() { mandatoryConstructorSignature = createConstructorSignaturePredicate(VdcActionParametersBase.class, CommandContext.class); }
Source:
private Stream<? extends SlotExecutionVertexAssignment> allocateLogicalSlotsFromSharedSlot( SharedSlotProfileRetriever sharedSlotProfileRetriever, ExecutionSlotSharingGroup executionSlotSharingGroup, Collection<ExecutionVertexID> executions) { SharedSlot sharedSlot = getOrAllocateSharedSlot(executionSlotSharingGroup, sharedSlotProfileRetriever); return executions.stream().map(sharedSlot::createAssignment); }

Target:
private Stream<SlotExecutionVertexAssignment> allocateLogicalSlotsFromSharedSlot( SharedSlotProfileRetriever sharedSlotProfileRetriever, ExecutionSlotSharingGroup executionSlotSharingGroup, Collection<ExecutionVertexID> executions) { SharedSlot sharedSlot = getOrAllocateSharedSlot(executionSlotSharingGroup, sharedSlotProfileRetriever); return executions .stream() .map(execution -> new SlotExecutionVertexAssignment(execution, sharedSlot.allocateLogicalSlot(execution))); }
Source:
void givenAChargeCapturedNotification_chargeNotificationProcessorInvokedWithNotificationAndCharge() { final String payload = notificationPayloadForTransaction( payId, EPDQ_PAYMENT_REQUESTED); setUpGatewayAccountToReturnGatewayAccountEntity(Optional.of(gatewayAccountEntity)); setUpChargeServiceToReturnCharge(Optional.of(charge)); final boolean result = notificationService.handleNotificationFor(payload, FORWARDED_IP_ADDRESSES); assertTrue(result); verifyNoInteractions(mockRefundNotificationProcessor); verify(mockChargeNotificationProcessor).invoke(payId, charge, CAPTURED, null); }

Target:
void givenAChargeCapturedNotification_chargeNotificationProcessorInvokedWithNotificationAndCharge() { final String payload = notificationPayloadForTransaction( payId, EPDQ_PAYMENT_REQUESTED); setUpGatewayAccountToReturnGatewayAccountEntity(Optional.of(gatewayAccountEntity)); setUpChargeServiceToReturnCharge(Optional.of(charge)); assertTrue(notificationService.handleNotificationFor(payload, FORWARDED_IP_ADDRESSES)); verifyNoInteractions(mockRefundNotificationProcessor); verify(mockChargeNotificationProcessor).invoke(payId, charge, CAPTURED, null); }
Source:
public InitialOffset getInitialOffset() { return initialOffset; }

Target:
public String getInitialOffset() { return initialOffset.name(); }
Source:
public void slowLogShouldBeLoggedWhenLockResponseIsSlowButShouldNotBeLoggedAtDebug() { long lockDurationMillis = SLOW_LOG_TRIGGER_MILLIS + 5; lockServiceImplLogger.setEnabledLevels(Level.DEBUG); lockService.logSlowLockAcquisition("test_lockId", LockClient.ANONYMOUS, lockDurationMillis); assertThat(lockServiceImplLogger.isDebugEnabled(), is(true)); assertThat(lockServiceImplLogger.getLoggingEvents().size(), is(0)); assertThat(testSlowLogger.getLoggingEvents().size(), is(1)); assertThat(Iterables.getOnlyElement(testSlowLogger.getLoggingEvents()), is(info("Blocked for ms to acquire lock {}.", lockDurationMillis, "test_lockId", "unsuccessfully"))); }

Target:
public void slowLogShouldBeLoggedWhenLockResponseIsSlowButShouldNotBeLoggedAtDebug() { long lockDurationMillis = SLOW_LOG_TRIGGER_MILLIS + 5; lockServiceWithSlowLogEnabled.logSlowLockAcquisition(TEST_LOCKID, LockClient.ANONYMOUS, lockDurationMillis); assertThat(testLockServiceImplLogger.isDebugEnabled(), is(true)); assertThat(testLockServiceImplLogger.getLoggingEvents().size(), is(0)); assertThat(testSlowLogger.getLoggingEvents().size(), is(1)); assertThat(Iterables.getOnlyElement(testSlowLogger.getLoggingEvents()), is(info("Blocked for ms to acquire lock {}.", lockDurationMillis, TEST_LOCKID, "unsuccessfully"))); }
Source:
public StreamBlockQueue(String path, String nonce) throws java.io.IOException { m_persistentDeque = new PersistentBinaryDeque( nonce, new VoltFile(path), exportLog); m_path = path; m_nonce = nonce; m_reader = m_persistentDeque.openForRead(m_nonce); if (exportLog.isDebugEnabled()) { exportLog.debug(m_nonce + " At SBQ creation, PBD size is " + (m_reader.sizeInBytes() - (8 * m_reader.getNumObjects()))); } if (!m_compress) { exportLog.info(m_nonce + " has compression disabled in " + path); } }

Target:
public StreamBlockQueue(String path, String nonce) throws java.io.IOException { m_persistentDeque = new PersistentBinaryDeque( nonce, new VoltFile(path), exportLog); m_path = path; m_nonce = nonce; m_reader = m_persistentDeque.openForRead(m_nonce); if (exportLog.isDebugEnabled()) { exportLog.debug(m_nonce + " At SBQ creation, PBD size is " + (m_reader.sizeInBytes() - (8 * m_reader.getNumObjects()))); } }
Source:
protected boolean canDoAction() { StorageServerConnectionExtension conn = getParameters().getStorageServerConnectionExtension(); return validate(StorageServerConnectionExtensionValidator.isConnectionExtensionExists(conn.getId())) && validate(StorageServerConnectionExtensionValidator.isConnectionDoesNotExistForHostAndTarget(conn.getHostId(), conn.getIqn())); }

Target:
protected boolean canDoAction() { StorageServerConnectionExtension conn = getParameters().getStorageServerConnectionExtension(); return validate(getConnectionExtensionValidator().isConnectionExtensionExists(conn.getId())) && validate(getConnectionExtensionValidator().isConnectionDoesNotExistForHostAndTarget(conn)); }
Source:
private String getLogMessage(String methodName, Uri uri) { String format = "%s.%s %s"; String path = uri == null ? null : uri.getPath(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { return String.format(format, CardContentProvider.class.getSimpleName(), methodName, path); } else { return String.format(format + " (%s)", CardContentProvider.class.getSimpleName(), methodName, path, getCallingPackage()); } }

Target:
private String getLogMessage(String methodName, Uri uri) { String format = "%s.%s %s"; String path = uri == null ? null : uri.getPath(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { return String.format(format, getClass().getSimpleName(), methodName, path); } else { return String.format(format + " (%s)", getClass().getSimpleName(), methodName, path, getCallingPackage()); } }
Source:
protected TmfXmlStateValue(ITmfXmlModelFactory modelFactory, Element node, IXmlStateSystemContainer container, List<ITmfXmlStateAttribute> attributes, String eventField) { fPath = attributes; fContainer = container; fEventField = eventField; if (!node.getNodeName().equals(TmfXmlStrings.STATE_VALUE)) { throw new IllegalArgumentException("TmfXmlStateValue constructor: Element is not a stateValue"); } fIncrement = Boolean.valueOf(node.getAttribute(TmfXmlStrings.INCREMENT)); fStateValue = initializeStateValue(modelFactory, node); switch (node.getAttribute(TmfXmlStrings.FORCED_TYPE)) { case TmfXmlStrings.TYPE_STRING: fForcedType = ITmfStateValue.Type.STRING; break; case TmfXmlStrings.TYPE_INT: fForcedType = ITmfStateValue.Type.INTEGER; break; case TmfXmlStrings.TYPE_LONG: fForcedType = ITmfStateValue.Type.LONG; break; default: fForcedType = ITmfStateValue.Type.NULL; } String stack = node.getAttribute(TmfXmlStrings.ATTRIBUTE_STACK); switch (stack) { case TmfXmlStrings.STACK_PUSH: fStackType = ValueTypeStack.PUSH; break; case TmfXmlStrings.STACK_POP: fStackType = ValueTypeStack.POP; break; case TmfXmlStrings.STACK_PEEK: fStackType = ValueTypeStack.PEEK; break; default: fStackType = ValueTypeStack.NULL; } }

Target:
protected TmfXmlStateValue(ITmfXmlModelFactory modelFactory, Element node, IXmlStateSystemContainer container, List<ITmfXmlStateAttribute> attributes, String eventField) { fPath = attributes; fContainer = container; fEventField = eventField; if (!node.getNodeName().equals(TmfXmlStrings.STATE_VALUE)) { throw new IllegalArgumentException("TmfXmlStateValue constructor: Element is not a stateValue"); } fIncrement = Boolean.parseBoolean(node.getAttribute(TmfXmlStrings.INCREMENT)); fStateValue = initializeStateValue(modelFactory, node); switch (node.getAttribute(TmfXmlStrings.FORCED_TYPE)) { case TmfXmlStrings.TYPE_STRING: fForcedType = ITmfStateValue.Type.STRING; break; case TmfXmlStrings.TYPE_INT: fForcedType = ITmfStateValue.Type.INTEGER; break; case TmfXmlStrings.TYPE_LONG: fForcedType = ITmfStateValue.Type.LONG; break; default: fForcedType = ITmfStateValue.Type.NULL; } String stack = node.getAttribute(TmfXmlStrings.ATTRIBUTE_STACK); fStackType = ValueTypeStack.getTypeFromString(stack); }
Source:
public void executeVmCommand() { addAuditLogForPartialVMs(); drMappingHelper.mapVnicProfiles(vmFromConfiguration.getInterfaces(), getParameters().getExternalVnicProfileMappings()); super.executeVmCommand(); if (getSucceeded()) { if (isImagesAlreadyOnTarget()) { getImages().stream().forEach(diskImage -> { initQcowVersionForDisks(diskImage.getId()); }); unregisteredOVFDataDao.removeEntity(ovfEntityData.getEntityId(), null); unregisteredDisksDao.removeUnregisteredDiskRelatedToVM(ovfEntityData.getEntityId(), null); auditLogDirector.log(this, AuditLogType.VM_IMPORT_FROM_CONFIGURATION_EXECUTED_SUCCESSFULLY); } else if (!vmDisksToAttach.isEmpty()) { auditLogDirector.log(this, attemptToAttachDisksToImportedVm(vmDisksToAttach)); } } setActionReturnValue(getVm().getId()); }

Target:
public void executeVmCommand() { addAuditLogForPartialVMs(); super.executeVmCommand(); if (getSucceeded()) { if (isImagesAlreadyOnTarget()) { getImages().stream().forEach(diskImage -> { initQcowVersionForDisks(diskImage.getId()); }); unregisteredOVFDataDao.removeEntity(ovfEntityData.getEntityId(), null); unregisteredDisksDao.removeUnregisteredDiskRelatedToVM(ovfEntityData.getEntityId(), null); auditLogDirector.log(this, AuditLogType.VM_IMPORT_FROM_CONFIGURATION_EXECUTED_SUCCESSFULLY); } else if (!vmDisksToAttach.isEmpty()) { auditLogDirector.log(this, attemptToAttachDisksToImportedVm(vmDisksToAttach)); } } setActionReturnValue(getVm().getId()); }
Source:
private void init() { View rgbView = inflate(getContext(), R.layout.color_picker_layout_rgbview, null); addView(rgbView); seekBarRed = rgbView.findViewById(R.id.color_picker_color_rgb_seekbar_red); seekBarGreen = rgbView.findViewById(R.id.color_picker_color_rgb_seekbar_green); seekBarBlue = rgbView.findViewById(R.id.color_picker_color_rgb_seekbar_blue); seekBarAlpha = rgbView.findViewById(R.id.color_picker_color_rgb_seekbar_alpha); textViewRed = rgbView.findViewById(R.id.color_picker_rgb_red_value); textViewGreen = rgbView.findViewById(R.id.color_picker_rgb_green_value); textViewBlue = rgbView.findViewById(R.id.color_picker_rgb_blue_value); textViewAlpha = rgbView.findViewById(R.id.color_picker_rgb_alpha_value); editTextHex = rgbView.findViewById(R.id.color_picker_color_rgb_hex); resetTextColor(); setSelectedColor(Color.BLACK); }

Target:
private void init() { View rgbView = inflate(getContext(), R.layout.color_picker_layout_rgbview, null); addView(rgbView); seekBarRed = (SeekBar) rgbView.findViewById(R.id.color_picker_color_rgb_seekbar_red); seekBarGreen = (SeekBar) rgbView.findViewById(R.id.color_picker_color_rgb_seekbar_green); seekBarBlue = (SeekBar) rgbView.findViewById(R.id.color_picker_color_rgb_seekbar_blue); seekBarAlpha = (SeekBar) rgbView.findViewById(R.id.color_picker_color_rgb_seekbar_alpha); textViewRed = (TextView) rgbView.findViewById(R.id.color_picker_rgb_red_value); textViewGreen = (TextView) rgbView.findViewById(R.id.color_picker_rgb_green_value); textViewBlue = (TextView) rgbView.findViewById(R.id.color_picker_rgb_blue_value); textViewAlpha = (TextView) rgbView.findViewById(R.id.color_picker_rgb_alpha_value); editTextHex = (EditText) rgbView.findViewById(R.id.color_picker_color_rgb_hex); resetTextColor(); setSelectedColor(Color.BLACK); }
Source:
public String toString() { boolean readwrite = getReads() > 0 || getWrites() > 0; StringBuilder sb = new StringBuilder(); sb.append(' ').append(getName()).append(": "); sb.append("(model: ").append(getModel()); sb.append(" - S/N: ").append(getSerial()).append(") "); sb.append("size: ").append(getSize() > 0 ? FormatUtil.formatBytesDecimal(getSize()) : "?").append(", "); sb.append("reads: ").append(readwrite ? getReads() : "?"); sb.append(" (").append(readwrite ? FormatUtil.formatBytes(getReadBytes()) : "?").append("), "); sb.append("writes: ").append(readwrite ? getWrites() : "?"); sb.append(" (").append(readwrite ? FormatUtil.formatBytes(getWriteBytes()) : "?").append("), "); sb.append("xfer: ").append(readwrite ? getTransferTime() : "?").append("\n"); return sb.toString(); }

Target:
public String toString() { boolean readwrite = getReads() > 0 || getWrites() > 0; StringBuilder sb = new StringBuilder(); sb.append(getName()).append(": "); sb.append("(model: ").append(getModel()); sb.append(" - S/N: ").append(getSerial()).append(") "); sb.append("size: ").append(getSize() > 0 ? FormatUtil.formatBytesDecimal(getSize()) : "?").append(", "); sb.append("reads: ").append(readwrite ? getReads() : "?"); sb.append(" (").append(readwrite ? FormatUtil.formatBytes(getReadBytes()) : "?").append("), "); sb.append("writes: ").append(readwrite ? getWrites() : "?"); sb.append(" (").append(readwrite ? FormatUtil.formatBytes(getWriteBytes()) : "?").append("), "); sb.append("xfer: ").append(readwrite ? getTransferTime() : "?"); return sb.toString(); }
Source:
private static void logMsg(String uniqname, String originalUrl, HttpServletRequest request, String baseString) { String remoteUser = request.getRemoteUser(); String loggingApiWithSessionInfo; if (uniqname != null) { loggingApiWithSessionInfo = String.format(baseString, uniqname, originalUrl); } else if (request.getRemoteUser() != null) { loggingApiWithSessionInfo = String.format(baseString, request.getRemoteUser(), originalUrl); } else { loggingApiWithSessionInfo = String.format(baseString, request.getSession().getAttribute("testUser"), originalUrl); } M_log.info(loggingApiWithSessionInfo); }

Target:
private static void logMsg(String uniqname, String originalUrl, HttpServletRequest request, String baseString) { String remoteUser = request.getRemoteUser(); String testUser = (String) request.getSession().getAttribute("testUser"); String user; if (uniqname != null) { user = uniqname; } else if (remoteUser != null) { user = remoteUser; } else { user = testUser; } M_log.info(String.format(baseString, user, originalUrl)); }
Source:
public OAuth2Authentication loadAuthentication(String accessToken) throws AuthenticationException, InvalidTokenException { MultiValueMap<String, String> formData = new LinkedMultiValueMap<String, String>(); formData.add(tokenName, accessToken); HttpHeaders headers = new HttpHeaders(); headers.set("Authorization", getAuthorizationHeader(clientId, clientSecret)); Map<String, Object> map = postForMap(checkTokenEndpointUrl, formData, headers); if (map == null) { if (logger.isDebugEnabled()) { logger.debug("check_token returned empty: " + accessToken); } throw new InvalidTokenException(accessToken); } if (map.containsKey("error")) { if (logger.isDebugEnabled()) { logger.debug("check_token returned error: " + map.get("error")); } throw new InvalidTokenException(accessToken); } if (map.containsKey("active") && !"true".equals(String.valueOf(map.get("active")))) { logger.debug("check_token returned active attribute: " + map.get("active")); throw new InvalidTokenException(accessToken); } return tokenConverter.extractAuthentication(map); }

Target:
public OAuth2Authentication loadAuthentication(String accessToken) throws AuthenticationException, InvalidTokenException { MultiValueMap<String, String> formData = new LinkedMultiValueMap<String, String>(); formData.add(tokenName, accessToken); HttpHeaders headers = new HttpHeaders(); headers.set("Authorization", getAuthorizationHeader(clientId, clientSecret)); Map<String, Object> map = postForMap(checkTokenEndpointUrl, formData, headers); if (CollectionUtils.isEmpty(map)) { if (logger.isDebugEnabled()) { logger.debug("check_token returned empty"); } throw new InvalidTokenException(accessToken); } if (map.containsKey("error")) { if (logger.isDebugEnabled()) { logger.debug("check_token returned error: " + map.get("error")); } throw new InvalidTokenException(accessToken); } if (map.containsKey("active") && !"true".equals(String.valueOf(map.get("active")))) { logger.debug("check_token returned active attribute: " + map.get("active")); throw new InvalidTokenException(accessToken); } return tokenConverter.extractAuthentication(map); }
Source:
private void handleError(Throwable throwable) { Timber.e(throwable, "Error occurred while loading queried depictions"); try { view.initErrorView(); view.showSnackbar(); } catch (Exception e) { e.printStackTrace(); } }

Target:
private void handleError(Throwable throwable) { Timber.e(throwable, "Error occurred while loading queried depictions"); view.initErrorView(); view.showSnackbar(); }
Source:
private void trySetHostNum(JSONObject rMeta) { try { mHostNum.setHostNum(rMeta.getString("hostNum")); } catch (Exception e) { Timber.e(e, "Failed to set hostNum"); } }

Target:
private void trySetHostNum(JSONObject rMeta) { try { if (rMeta.has("hostNum")) { mHostNum.setHostNum(rMeta.getInt("hostNum")); } } catch (Exception e) { Timber.w(e, "Failed to set hostNum"); } }
Source:
protected final void init(InputStream myIn, OutputStream myOut) { final int timeout = transport.getTimeout(); if (timeout > 0) { final Thread caller = Thread.currentThread(); if (myTimer != null) { myTimer.terminate(); myTimer = null; } myTimer = new InterruptTimer(caller.getName() + "-Timer"); timeoutIn = new TimeoutInputStream(myIn, myTimer); timeoutOut = new TimeoutOutputStream(myOut, myTimer); timeoutIn.setTimeout(timeout * 1000); timeoutOut.setTimeout(timeout * 1000); myIn = timeoutIn; myOut = timeoutOut; } in = myIn; out = myOut; pckIn = new PacketLineIn(in); pckOut = new PacketLineOut(out); outNeedsEnd = true; }

Target:
protected final void init(InputStream myIn, OutputStream myOut) { final int timeout = transport.getTimeout(); if (timeout > 0) { final Thread caller = Thread.currentThread(); if (myTimer == null) { myTimer = new InterruptTimer(caller.getName() + "-Timer"); } timeoutIn = new TimeoutInputStream(myIn, myTimer); timeoutOut = new TimeoutOutputStream(myOut, myTimer); timeoutIn.setTimeout(timeout * 1000); timeoutOut.setTimeout(timeout * 1000); myIn = timeoutIn; myOut = timeoutOut; } in = myIn; out = myOut; pckIn = new PacketLineIn(in); pckOut = new PacketLineOut(out); outNeedsEnd = true; }
Source:
default public boolean isRememberChoice() { return false; }

Target:
default boolean isRememberChoice() { return false; }
Source:
public String getEventType() { VirtualMachine vm = _entityMgr.findById(VirtualMachine.class, getId()); if (vm.getType() == VirtualMachine.Type.ConsoleProxy) { return EventTypes.EVENT_PROXY_DIAGNOSTICS; } else if (vm.getType() == VirtualMachine.Type.SecondaryStorageVm){ return EventTypes.EVENT_SSVM_DIAGNOSTICS; } else { return EventTypes.EVENT_ROUTER_DIAGNOSTICS; } }

Target:
public String getEventType() { VirtualMachine.Type vmType = _entityMgr.findById(VirtualMachine.class, getId()).getType(); String eventType = ""; switch (vmType) { case ConsoleProxy: eventType = EventTypes.EVENT_PROXY_DIAGNOSTICS; break; case SecondaryStorageVm: eventType = EventTypes.EVENT_SSVM_DIAGNOSTICS; break; case DomainRouter: eventType = EventTypes.EVENT_ROUTER_DIAGNOSTICS; break; } return eventType; }
Source:
private Method findClosestMatch(Object[] args, Class<? extends Throwable> cause) { Method result = null; boolean shouldUseRecoverMethodName = !this.recoverMethodName.equals(""); if (shouldUseRecoverMethodName) { for (Method method : this.methods.keySet()) { if (method.getName().equals(this.recoverMethodName)) { SimpleMetadata meta = this.methods.get(method); if (meta.type.isAssignableFrom(cause) && compareParameters(args, meta.getArgCount(), method.getParameterTypes())) { result = method; break; } } } } else { int min = Integer.MAX_VALUE; for (Method method : this.methods.keySet()) { SimpleMetadata meta = this.methods.get(method); Class<? extends Throwable> type = meta.getType(); if (type == null) { type = Throwable.class; } if (type.isAssignableFrom(cause)) { int distance = calculateDistance(cause, type); if (distance < min) { min = distance; result = method; } else if (distance == min) { boolean parametersMatch = compareParameters(args, meta.getArgCount(), method.getParameterTypes()); if (parametersMatch) { result = method; } } } } } return result; }

Target:
private Method findClosestMatch(Object[] args, Class<? extends Throwable> cause) { Method result = null; if (StringUtils.isEmpty(recoverMethodName)) { int min = Integer.MAX_VALUE; for (Map.Entry<Method, SimpleMetadata> entry : this.methods.entrySet()) { Method method = entry.getKey(); SimpleMetadata meta = entry.getValue(); Class<? extends Throwable> type = meta.getType(); if (type == null) { type = Throwable.class; } if (type.isAssignableFrom(cause)) { int distance = calculateDistance(cause, type); if (distance < min) { min = distance; result = method; } else if (distance == min) { boolean parametersMatch = compareParameters(args, meta.getArgCount(), method.getParameterTypes()); if (parametersMatch) { result = method; } } } } } else { for (Map.Entry<Method, SimpleMetadata> entry : this.methods.entrySet()) { Method method = entry.getKey(); if (method.getName().equals(this.recoverMethodName)) { SimpleMetadata meta = entry.getValue(); if (meta.type.isAssignableFrom(cause) && compareParameters(args, meta.getArgCount(), method.getParameterTypes())) { result = method; break; } } } } return result; }
Source:
public CacheKey( ItemStack input ) { Preconditions.checkNotNull( input ); Preconditions.checkNotNull( input.getItem() ); this.item = input.getItem(); this.damage = input.getItemDamage(); }

Target:
CacheKey( ItemStack input ) { Preconditions.checkNotNull( input ); Preconditions.checkNotNull( input.getItem() ); this.item = input.getItem(); this.damage = input.getItemDamage(); }
Source:
private void initFields() { when(labelField.getWidget()).thenReturn(mock(Label.class)); when(labelField.isRequired()).thenReturn(true); when(labelField.isContentValid()).thenReturn(true); when(textBoxField.getWidget()).thenReturn(mock(TextBox.class)); when(textBoxField.isRequired()).thenReturn(true); when(textBoxField.isContentValid()).thenReturn(true); when(valueLabelField.getWidget()).thenReturn(mock(ValueLabel.class)); when(valueLabelField.isRequired()).thenReturn(true); when(valueLabelField.isContentValid()).thenReturn(true); fieldCollection = new ArrayList<>(); fieldCollection.add(labelField); fieldCollection.add(textBoxField); fieldCollection.add(valueLabelField); }

Target:
private void initFields() { when(labelField.getWidget()).thenReturn(mock(Label.class)); when(labelField.isRequired()).thenReturn(true); when(labelField.isContentValid()).thenReturn(true); when(textBoxField.getWidget()).thenReturn(mock(TextBox.class)); when(textBoxField.isRequired()).thenReturn(true); when(textBoxField.isContentValid()).thenReturn(true); when(valueLabelField.getWidget()).thenReturn(mock(ValueLabel.class)); when(valueLabelField.isRequired()).thenReturn(true); when(valueLabelField.isContentValid()).thenReturn(true); fieldCollection = Arrays.asList(labelField, textBoxField, valueLabelField); }
Source:
public Collection<LockState<OBJECT, CONTEXT>> getLockStates() { return new ArrayList<RWOLockManager.LockState<OBJECT, CONTEXT>>(objectToLockStateMap.values()); }

Target:
public synchronized List<LockState<OBJECT, CONTEXT>> getLockStates() { return new ArrayList<RWOLockManager.LockState<OBJECT, CONTEXT>>(objectToLockStateMap.values()); }
Source:
public void rewriteAddFilterWithMultipleFilters() { assertPlan( "SELECT sum(totalprice) FILTER(WHERE totalprice > 0), sum(custkey) FILTER(WHERE custkey > 0) FROM orders", anyTree( aggregation( ImmutableMap.of("sum_3", functionCall("sum", ImmutableList.of("sum_15")), "sum", functionCall("sum", ImmutableList.of("sum_14"))), exchange( aggregation( ImmutableMap.of("sum_14", functionCall("sum", ImmutableList.of("totalprice")), "sum_15", functionCall("sum", ImmutableList.of("custkey"))), project( filter( "(\"totalprice\" > 0E0 OR \"custkey\" > BIGINT '0')", tableScan( "orders", ImmutableMap.of("totalprice", "totalprice", "custkey", "custkey"))))))))); }

Target:
public void rewriteAddFilterWithMultipleFilters() { assertPlan( "SELECT sum(totalprice) FILTER(WHERE totalprice > 0), sum(custkey) FILTER(WHERE custkey > 0) FROM orders", anyTree( filter( "(\"totalprice\" > 0E0 OR \"custkey\" > BIGINT '0')", tableScan( "orders", ImmutableMap.of("totalprice", "totalprice", "custkey", "custkey"))))); }
Source:
public void endWithFailure() { TransactionSupport.executeInNewTransaction(() -> { if (!getParameters().isLeaveLocked()) { DiskImage diskImage = getDestinationDiskImage(); if (diskImage != null) { imageDao.updateStatus(diskImage.getImage().getId(), ImageStatus.OK); } unLockImage(); } return null; }); }

Target:
public void endWithFailure() { setSucceeded(true); TransactionSupport.executeInNewTransaction(() -> { if (!getParameters().isLeaveLocked()) { DiskImage diskImage = getDestinationDiskImage(); if (diskImage != null) { imageDao.updateStatus(diskImage.getImage().getId(), ImageStatus.OK); } } return null; }); }
Source:
public void toggleProfilesVisibility(boolean visible) { if (profilesTab.isVisible() != visible) { profilesTab.setVisible(visible); } }

Target:
public void toggleProfilesVisibility(boolean visible) { profilesTab.setVisible(visible); }
Source:
public ShapelessResearchRecipe(@Nonnull ItemStack result, TriPredicate<InventoryCrafting, EntityPlayer, World> matcher, Object... recipe) { super(new ResourceLocation(Constants.EI_MODID, "shapeless_research"), result, recipe); this.matcher = matcher; }

Target:
public ShapelessResearchRecipe(@Nonnull ItemStack result, TriPredicate<InventoryCrafting, EntityPlayer, World> matcher, Object... recipe) { super(new ResourceLocation(Constants.API_MODID, "shapeless_research"), result, recipe); this.matcher = matcher; }
Source:
public void testFormat() { ChatComponent cc = ChatComponent.fromFormat("\u00A7k\u00A7eHello! \u00A7r\u00A7cNice to meet you! :)"); cc.setHoverEvent(HoverEvent.text("Hey there!")); cc.setClickEvent(ClickEvent.of(ClickAction.SUGGEST_COMMAND, "/yolo")); System.out.println(cc); }

Target:
public void testFormat() { ChatComponent cc = ChatComponent.fromFormat("\u00A7k\u00A7eHello! \u00A7r\u00A7cNice to meet you! :)"); assertEquals("{\"text\":\"Hello! \",\"extra\":[{\"text\":\"Nice to meet you! :)\",\"obfuscated\":false,\"color\":\"red\"}],\"obfuscated\":true,\"color\":\"yellow\"}", cc.toString()); }
Source:
protected org.ovirt.engine.core.common.businessentities.network.VnicProfile getVnicProfile(String id) { return getEntity(org.ovirt.engine.core.common.businessentities.network.VnicProfile.class, VdcQueryType.GetVnicProfileById, new IdQueryParameters(asGuidOr404(id)), "VnicProfiles"); }

Target:
protected org.ovirt.engine.core.common.businessentities.network.VnicProfile getVnicProfile(String id) { return getEntity(org.ovirt.engine.core.common.businessentities.network.VnicProfile.class, VdcQueryType.GetVnicProfileById, new IdQueryParameters(guid), "VnicProfiles"); }
Source:
private Set<I> dispatchAll(List<Event> events, Set<I> targets) { if (events.isEmpty()) { return ImmutableSet.of(); } Set<I> actualTargets = new HashSet<>(); @Nullable Set<I> targetsForDispatch = targets.isEmpty() ? null : targets; for (Event event : events) { Set<I> targetsOfThisDispatch = dispatchOperation.perform(event, targetsForDispatch); actualTargets.addAll(targetsOfThisDispatch); } if (!actualTargets.isEmpty()) { recordAffectedShards(actualTargets); } return actualTargets; }

Target:
private Set<I> dispatchAll(List<Event> events, Set<I> targets) { if (events.isEmpty()) { return noTargets(); } Set<I> actualTargets = new HashSet<>(); @Nullable Set<I> targetsForDispatch = targets.isEmpty() ? null : targets; for (Event event : events) { Set<I> targetsOfThisDispatch = dispatchOperation.perform(event, targetsForDispatch); actualTargets.addAll(targetsOfThisDispatch); } if (!actualTargets.isEmpty()) { recordAffectedShards(actualTargets); } return actualTargets; }
Source:
public void processSample() throws Exception { LanguageDetectorModel model = LanguageDetectorMETest.trainModel(); LanguageDetectorME langdetector = new LanguageDetectorME(model); final AtomicInteger correctCount = new AtomicInteger(); final AtomicInteger incorrectCount = new AtomicInteger(); LanguageDetectorEvaluator evaluator = new LanguageDetectorEvaluator(langdetector, new LanguageDetectorEvaluationMonitor() { @Override public void correctlyClassified(LanguageDetectorSample reference, LanguageDetectorSample prediction) { correctCount.incrementAndGet(); } @Override public void missclassified(LanguageDetectorSample reference, LanguageDetectorSample prediction) { incorrectCount.incrementAndGet(); } }); evaluator.evaluateSample(new LanguageDetectorSample(new Language("pob"), "escreve e faz palestras pelo mundo inteiro sobre anjos")); evaluator.evaluateSample(new LanguageDetectorSample(new Language("fra"), "escreve e faz palestras pelo mundo inteiro sobre anjos")); evaluator.evaluateSample(new LanguageDetectorSample(new Language("fra"), "escreve e faz palestras pelo mundo inteiro sobre anjos")); Assert.assertEquals(1, correctCount.get()); Assert.assertEquals(2, incorrectCount.get()); Assert.assertEquals(3, evaluator.getDocumentCount()); Assert.assertEquals(0.33, evaluator.getAccuracy(), 0.01); }

Target:
public void processSample() throws Exception { LanguageDetectorModel model = LanguageDetectorMETest.trainModel(); LanguageDetectorME langdetector = new LanguageDetectorME(model); final AtomicInteger correctCount = new AtomicInteger(); final AtomicInteger incorrectCount = new AtomicInteger(); LanguageDetectorEvaluator evaluator = new LanguageDetectorEvaluator(langdetector, new LanguageDetectorEvaluationMonitor() { @Override public void correctlyClassified(LanguageSample reference, LanguageSample prediction) { correctCount.incrementAndGet(); } @Override public void missclassified(LanguageSample reference, LanguageSample prediction) { incorrectCount.incrementAndGet(); } }); evaluator.evaluateSample(new LanguageSample(new Language("pob"), "escreve e faz palestras pelo mundo inteiro sobre anjos")); evaluator.evaluateSample(new LanguageSample(new Language("fra"), "escreve e faz palestras pelo mundo inteiro sobre anjos")); evaluator.evaluateSample(new LanguageSample(new Language("fra"), "escreve e faz palestras pelo mundo inteiro sobre anjos")); Assert.assertEquals(1, correctCount.get()); Assert.assertEquals(2, incorrectCount.get()); Assert.assertEquals(3, evaluator.getDocumentCount()); Assert.assertEquals(0.33, evaluator.getAccuracy(), 0.01); }
Source:
public BasicAuthenticatorCredentials( @JsonProperty("salt") byte[] salt, @JsonProperty("hash") byte[] hash, @JsonProperty("iterations") int iterations ) { this.salt = salt; this.hash = hash; this.iterations = iterations; }

Target:
public BasicAuthenticatorCredentials( @JsonProperty("salt") byte[] salt, @JsonProperty("hash") byte[] hash, @JsonProperty("iterations") int iterations ) { Preconditions.checkNotNull(salt); Preconditions.checkNotNull(hash); this.salt = salt; this.hash = hash; this.iterations = iterations; }
Source:
public static void clear() { nativeClearLoggers(); }

Target:
public static void clear() { synchronized (LoggerAdapter.class) { nativeClearLoggers(); LoggerAdapter.clear(); } }
Source:
public void setUp() { Project project = new Project(InstrumentationRegistry.getTargetContext(), projectName); ProjectManager.getInstance().setCurrentProject(project); fileGenerator = new DSTFileGenerator(); dstFile = new File(Constants.CACHE_DIR + "/" + projectName + ".dst"); }

Target:
public void setUp() { Project project = new Project(InstrumentationRegistry.getTargetContext(), projectName); ProjectManager.getInstance().setCurrentProject(project); fileGenerator = new DSTFileGenerator(); }
Source:
protected void configureHttpResponsHeaderFilter(ServletContextHandler context) { String headerConfig = config.getString(WorkerConfig.RESPONSE_HTTP_HEADERS_CONFIG); log.debug("headerConfig : " + headerConfig); String[] configs = StringUtil.csvSplit(headerConfig); Arrays.stream(configs) .forEach(WorkerConfig::validateHttpResponseHeaderConfig); FilterHolder headerFilterHolder = new FilterHolder(HeaderFilter.class); headerFilterHolder.setInitParameter("headerConfig", headerConfig); context.addFilter(headerFilterHolder, "/*", EnumSet.of(DispatcherType.REQUEST)); }

Target:
protected void configureHttpResponsHeaderFilter(ServletContextHandler context) { String headerConfig = config.getString(WorkerConfig.RESPONSE_HTTP_HEADERS_CONFIG); FilterHolder headerFilterHolder = new FilterHolder(HeaderFilter.class); headerFilterHolder.setInitParameter("headerConfig", headerConfig); context.addFilter(headerFilterHolder, "/*", EnumSet.of(DispatcherType.REQUEST)); }
Source:
public BoundFilter(final BoundDimFilter boundDimFilter) { super( boundDimFilter.getDimension(), new Predicate<String>() { @Override public boolean apply(String input) { if (input == null) { return false; } Comparator<String> comparator; if (boundDimFilter.isAlphaNumeric()) { comparator = new AlphaNumericTopNMetricSpec(null).getComparator(null, null); } else { comparator = new LexicographicTopNMetricSpec(null).getComparator(null, null); } int lowerComparing = comparator.compare(input, boundDimFilter.getLower()); int upperComparing = comparator.compare(input, boundDimFilter.getUpper()); boolean lowerIsNull = boundDimFilter.getLower() == null; boolean upperIsNull = boundDimFilter.getUpper() == null; if (boundDimFilter.isLowerStrict() && boundDimFilter.isUpperStrict()) { return (lowerIsNull || (lowerComparing > 0)) && (upperIsNull || upperComparing < 0); } else if (boundDimFilter.isLowerStrict()) { return (lowerIsNull || lowerComparing > 0) && (upperIsNull || upperComparing <= 0); } else if (boundDimFilter.isUpperStrict()) { return (lowerIsNull || lowerComparing >= 0) && (upperIsNull || upperComparing < 0); } return (lowerIsNull || upperComparing <= 0) && (upperIsNull || lowerComparing >= 0); } } ); }

Target:
public BoundFilter(final BoundDimFilter boundDimFilter) { super( boundDimFilter.getDimension(), new Predicate<String>() { @Override public boolean apply(String input) { if (input == null) { return false; } Comparator<String> comparator; if (boundDimFilter.isAlphaNumeric()) { comparator = new AlphaNumericTopNMetricSpec(null).getComparator(null, null); } else { comparator = new LexicographicTopNMetricSpec(null).getComparator(null, null); } int lowerComparing = 1; int upperComparing = 1; if (boundDimFilter.getLower() != null) { lowerComparing = comparator.compare(input, boundDimFilter.getLower()); } if (boundDimFilter.getUpper() != null) { upperComparing = comparator.compare(boundDimFilter.getUpper(), input); } if (boundDimFilter.isLowerStrict() && boundDimFilter.isUpperStrict()) { return ((lowerComparing > 0)) && ( upperComparing > 0); } else if (boundDimFilter.isLowerStrict()) { return (lowerComparing > 0) && (upperComparing >= 0); } else if (boundDimFilter.isUpperStrict()) { return (lowerComparing >= 0) && (upperComparing > 0); } return (lowerComparing >= 0) && (upperComparing >= 0); } } ); }
Source:
public String getTopCommitComment() { loader.waitOnClosed(); return seleniumWebDriverHelper .waitVisibility(revertPanel, ELEMENT_TIMEOUT_SEC) .getText() .split("\n")[4]; }

Target:
public String getTopCommitComment() { loader.waitOnClosed(); int numberOfTopCommitCell = 4; return getRevertCommitTableContent().split("\n")[numberOfTopCommitCell]; }
Source:
private Session newSession(IProgressMonitor monitor) throws RemoteConnectionException { SubMonitor progress = SubMonitor.convert(monitor, 10); try { Session session = fJSchService.createSession(getHostname(), getPort(), getUsername()); session.setUserInfo(new JSchUserInfo()); if (isPasswordAuth()) { session.setConfig("PreferredAuthentications", "password,keyboard-interactive,gssapi-with-mic,publickey"); session.setPassword(getPassword()); } else { session.setConfig("PreferredAuthentications", "publickey,gssapi-with-mic,password,keyboard-interactive"); session.setPassword(getPassword()); } if (getProxyCommand().isEmpty() && getProxyConnectionName().isEmpty()) { fJSchService.connect(session, getTimeout() * 1000, progress.newChild(10)); } else { if (getProxyCommand().isEmpty()) { session.setProxy(JSchConnectionProxyFactory.createForwardProxy(getProxyConnection(), progress.newChild(10))); fJSchService.connect(session, getTimeout() * 1000, progress.newChild(10)); } else { session.setProxy(JSchConnectionProxyFactory.createCommandProxy(getProxyConnection(), getProxyCommand(), progress.newChild(10))); session.connect(getTimeout() * 1000); } } if (!progress.isCanceled()) { fSessions.add(session); return session; } return null; } catch (JSchException e) { throw new RemoteConnectionException(e.getMessage()); } }

Target:
private Session newSession(IProgressMonitor monitor) throws RemoteConnectionException { SubMonitor progress = SubMonitor.convert(monitor, 10); try { Session session = fJSchService.createSession(getHostname(), getPort(), getUsername()); session.setUserInfo(new JSchUserInfo()); if (isPasswordAuth()) { session.setConfig("PreferredAuthentications", "password,keyboard-interactive,gssapi-with-mic,publickey"); } else { session.setConfig("PreferredAuthentications", "publickey,gssapi-with-mic,password,keyboard-interactive"); } String password = getPassword(); if (!password.isEmpty()) { session.setPassword(password); } if (getProxyCommand().isEmpty() && getProxyConnectionName().isEmpty()) { fJSchService.connect(session, getTimeout() * 1000, progress.newChild(10)); } else { if (getProxyCommand().isEmpty()) { session.setProxy(JSchConnectionProxyFactory.createForwardProxy(getProxyConnection(), progress.newChild(10))); fJSchService.connect(session, getTimeout() * 1000, progress.newChild(10)); } else { session.setProxy(JSchConnectionProxyFactory.createCommandProxy(getProxyConnection(), getProxyCommand(), progress.newChild(10))); session.connect(getTimeout() * 1000); } } if (!progress.isCanceled()) { fSessions.add(session); return session; } return null; } catch (JSchException e) { throw new RemoteConnectionException(e.getMessage()); } }
Source:
static <T, F extends Future<T>> Supplier<F> decorateFuture( RateLimiter rateLimiter, int permits, Supplier<? extends F> supplier ) { return () -> { waitForPermission(rateLimiter, permits); try { F result = supplier.get(); drainIfNeeded(rateLimiter, CallsResult.success(result)); return result; } catch (Exception exception) { drainIfNeeded(rateLimiter, CallsResult.failure(exception)); throw exception; } }; }

Target:
static <T, F extends Future<T>> Supplier<F> decorateFuture( RateLimiter rateLimiter, int permits, Supplier<? extends F> supplier ) { return () -> { waitForPermission(rateLimiter, permits); try { F result = supplier.get(); rateLimiter.onResult(result); return result; } catch (Exception exception) { rateLimiter.onError(exception); throw exception; } }; }
Source:
public static CoordinateReferenceSystem crs( CRS crs ) { if ( crs.getHref().equals( CoordinateReferenceSystem.WGS84.href ) ) { return CoordinateReferenceSystem.WGS84; } else if ( crs.getHref().equals( CoordinateReferenceSystem.Cartesian.href ) ) { return CoordinateReferenceSystem.Cartesian; } else { throw new UnsupportedOperationException( "Unknown CRS: " + crs ); } }

Target:
public static CoordinateReferenceSystem crs( CRS crs ) { return CoordinateReferenceSystem.get( crs ); }
Source:
public boolean beginUpdatingLogsUsed(InMemoryMap memTable, DfsLogger more, boolean mincFinish) { boolean releaseLock = true; logLock.lock(); try { synchronized (this) { if (isCloseComplete()) { throw new IllegalStateException("Can not update logs of closed tablet " + extent); } boolean addToOther; if (memTable == getTabletMemory().getMinCMemTable()) addToOther = true; else if (memTable == getTabletMemory().getMemTable()) addToOther = false; else throw new IllegalArgumentException("passed in memtable that is not in use"); if (mincFinish) { if (addToOther) throw new IllegalStateException("Adding to other logs for mincFinish"); if (otherLogs.size() != 0) throw new IllegalStateException( "Expect other logs to be 0 when min finish, but its " + otherLogs); if (currentLogs.size() == 0) return !releaseLock; } int numAdded = 0; int numContained = 0; if (addToOther) { if (otherLogs.add(more)) numAdded++; if (currentLogs.contains(more)) numContained++; } else { if (currentLogs.add(more)) numAdded++; if (otherLogs.contains(more)) numContained++; } if (numAdded > 0) { rebuildReferencedLogs(); } if (numAdded > 0 && numContained == 0) { releaseLock = false; } return !releaseLock; } } finally { if (releaseLock) logLock.unlock(); } }

Target:
public boolean beginUpdatingLogsUsed(InMemoryMap memTable, DfsLogger more, boolean mincFinish) { boolean releaseLock = true; logLock.lock(); try { synchronized (this) { if (isCloseComplete()) { throw new IllegalStateException("Can not update logs of closed tablet " + extent); } boolean addToOther; if (memTable == getTabletMemory().getMinCMemTable()) addToOther = true; else if (memTable == getTabletMemory().getMemTable()) addToOther = false; else throw new IllegalArgumentException("passed in memtable that is not in use"); if (mincFinish) { if (addToOther) throw new IllegalStateException("Adding to other logs for mincFinish"); if (otherLogs.size() != 0) throw new IllegalStateException( "Expect other logs to be 0 when min finish, but its " + otherLogs); if (currentLogs.size() == 0) return !releaseLock; } boolean added; boolean contained; if (addToOther) { added = otherLogs.add(more); contained = currentLogs.contains(more); } else { added = currentLogs.add(more); contained = otherLogs.contains(more); } if (added) { rebuildReferencedLogs(); } if (added && !contained) { releaseLock = false; } return !releaseLock; } } finally { if (releaseLock) logLock.unlock(); } }
Source:
public void testMd5Hash() throws Exception { String fingerprint1 = "1b:d3:aa:c3:67:4b:b5:55:a9:ff:19:0c:16:7e:d1:de"; String goodfingerprint1 = "MD5:1b:d3:aa:c3:67:4b:b5:55:a9:ff:19:0c:16:7e:d1:de"; assertEquals(goodfingerprint1, OpenSSHUtils.fixupKeyFingerprintHash(fingerprint1)); assertEquals(goodfingerprint1, OpenSSHUtils.fixupKeyFingerprintHash(goodfingerprint1)); }

Target:
public void testMd5Hash() throws Exception { String fingerprint1 = "1b:d3:aa:c3:67:4b:b5:55:a9:ff:19:0c:16:7e:d1:de"; String goodfingerprint1 = "MD5:" + fingerprint1; assertEquals(goodfingerprint1, OpenSSHUtils.fixupKeyFingerprintHash(fingerprint1)); assertEquals(goodfingerprint1, OpenSSHUtils.fixupKeyFingerprintHash(goodfingerprint1)); }