auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
boolean checkKeyguardVisibility(ActivityRecord r, boolean shouldBeVisible, boolean isTop) { final boolean isInPinnedStack = r.getStack().getStackId() == PINNED_STACK_ID; final boolean keyguardShowing = mStackSupervisor.mKeyguardController.isKeyguardShowing( mDisplayId != INVALID_DISPLAY ? mDisplayId : DEFAULT_DISPLAY); final boolean keyguardLocked = mStackSupervisor.mKeyguardController.isKeyguardLocked(); boolean showWhenLocked = false; boolean dismissKeyguard = false; if (shouldBeVisible) { if (isTop || keyguardLocked) { showWhenLocked = r.canShowWhenLocked() && !isInPinnedStack; } dismissKeyguard = r.hasDismissKeyguardWindows(); } if (shouldBeVisible) { if (dismissKeyguard && mTopDismissingKeyguardActivity == null) { mTopDismissingKeyguardActivity = r; } if (isTop) { mTopActivityOccludesKeyguard |= showWhenLocked; } final boolean canShowWithKeyguard = canShowWithInsecureKeyguard() && mStackSupervisor.mKeyguardController.canDismissKeyguard(); if (canShowWithKeyguard) { return true; } } if (keyguardShowing) { return shouldBeVisible && mStackSupervisor.mKeyguardController .canShowActivityWhileKeyguardShowing(r, dismissKeyguard); } else if (keyguardLocked) { return shouldBeVisible && mStackSupervisor.mKeyguardController.canShowWhileOccluded( dismissKeyguard, showWhenLocked); } else { return shouldBeVisible; } }

Target:
boolean checkKeyguardVisibility(ActivityRecord r, boolean shouldBeVisible, boolean isTop) { final boolean isInPinnedStack = r.getStack().getStackId() == PINNED_STACK_ID; final boolean keyguardShowing = mStackSupervisor.mKeyguardController.isKeyguardShowing( mDisplayId != INVALID_DISPLAY ? mDisplayId : DEFAULT_DISPLAY); final boolean keyguardLocked = mStackSupervisor.mKeyguardController.isKeyguardLocked(); if (shouldBeVisible) { boolean showWhenLocked = false; if (isTop || keyguardLocked) { showWhenLocked = !isInPinnedStack && r.canShowWhenLocked(); } final boolean dismissKeyguard = r.hasDismissKeyguardWindows(); if (dismissKeyguard && mTopDismissingKeyguardActivity == null) { mTopDismissingKeyguardActivity = r; } if (isTop) { mTopActivityOccludesKeyguard |= showWhenLocked; } final boolean canShowWithKeyguard = canShowWithInsecureKeyguard() && mStackSupervisor.mKeyguardController.canDismissKeyguard(); if (canShowWithKeyguard) { return true; } if (keyguardShowing) { return mStackSupervisor.mKeyguardController .canShowActivityWhileKeyguardShowing(r, dismissKeyguard); } else if (keyguardLocked) { return mStackSupervisor.mKeyguardController.canShowWhileOccluded( dismissKeyguard, showWhenLocked); } } return false; }
Source:
public static Map<String, Object> buildMvelParameters() { Map<String, Object> mvelParameters = new HashMap<String, Object>(); BroadleafRequestContext brc = BroadleafRequestContext.getBroadleafRequestContext(); if (brc != null && brc.getRequest() != null) { TimeDTO timeDto = new TimeDTO(SystemTime.asCalendar()); HttpServletRequest request = brc.getRequest(); RequestDTO requestDto = brc.getRequestDTO(); mvelParameters.put("time", timeDto); mvelParameters.put("request", requestDto); Map<String, Object> blcRuleMap = (Map<String, Object>) request.getAttribute(BLC_RULE_MAP_PARAM); if (blcRuleMap != null) { for (String mapKey : blcRuleMap.keySet()) { mvelParameters.put(mapKey, blcRuleMap.get(mapKey)); } } Map<String, Object> brcRuleMap = brc.getRuleMap(); if (blcRuleMap != null) { for (String mapKey : brcRuleMap.keySet()) { mvelParameters.put(mapKey, brcRuleMap.get(mapKey)); } } } return mvelParameters; }

Target:
public static Map<String, Object> buildMvelParameters() { Map<String, Object> mvelParameters = new HashMap<String, Object>(); BroadleafRequestContext brc = BroadleafRequestContext.getBroadleafRequestContext(); if (brc != null && brc.getRequest() != null) { TimeDTO timeDto = new TimeDTO(SystemTime.asCalendar()); HttpServletRequest request = brc.getRequest(); RequestDTO requestDto = brc.getRequestDTO(); mvelParameters.put("time", timeDto); mvelParameters.put("request", requestDto); Map<String, Object> blcRuleMap = (Map<String, Object>) request.getAttribute(BLC_RULE_MAP_PARAM); if (blcRuleMap != null) { for (String mapKey : blcRuleMap.keySet()) { mvelParameters.put(mapKey, blcRuleMap.get(mapKey)); } } } return mvelParameters; }
Source:
public static PolicyUnit map(SchedulingPolicyUnit model, PolicyUnit template) { PolicyUnit entity = template != null ? template : new PolicyUnit(); if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId())); } if (model.isSetName()) { entity.setName(model.getName()); } if (model.isSetDescription()) { entity.setDescription(model.getDescription()); } if (model.isSetType()) { entity.setPolicyUnitType(PolicyUnitType.valueOf(model.getType().toUpperCase())); } if (model.isSetEnabled()) { entity.setEnabled(model.isEnabled()); } if (model.isSetInternal()) { entity.setInternal(model.isInternal()); } if (model.isSetRegexValidationMap()) { entity.setParameterRegExMap(CustomPropertiesParser.toMap(model.getRegexValidationMap())); } return entity; }

Target:
public static PolicyUnit map(SchedulingPolicyUnit model, PolicyUnit template) { PolicyUnit entity = template != null ? template : new PolicyUnit(); if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId())); } if (model.isSetName()) { entity.setName(model.getName()); } if (model.isSetDescription()) { entity.setDescription(model.getDescription()); } if (model.isSetType()) { PolicyUnitType policyUnitType = null; switch (model.getType().toUpperCase()) { case FILTER: policyUnitType = PolicyUnitType.FILTER; break; case WEIGHT: policyUnitType = PolicyUnitType.WEIGHT; break; case LOAD_BALANCING: policyUnitType = PolicyUnitType.LOAD_BALANCING; break; default: assert (false) : "unknown Policy Unit Type value: " + model.toString(); return null; } entity.setPolicyUnitType(policyUnitType); } if (model.isSetEnabled()) { entity.setEnabled(model.isEnabled()); } if (model.isSetInternal()) { entity.setInternal(model.isInternal()); } if (model.isSetPropertiesMetaData()) { entity.setParameterRegExMap(CustomPropertiesParser.toMap(model.getPropertiesMetaData())); } return entity; }
Source:
public Array<T> getElementsContainingArea(Shape area, QuadTreeSearchDirection searchDirection, boolean entirelyContained) { return null; }

Target:
public Array<T> getElementsContainingArea(Shape area, QuadTreeSearchDirection searchDirection, boolean entirelyContained) { return new Array<>(); }
Source:
private Mono<ResponseEntity<?>> toErrorResponse(int statusCode, ErrorResponse body) { return Mono.just(status(statusCode).body(body)); }

Target:
private Mono<ResponseEntity<?>> toErrorResponse(int statusCode, ErrorResponse body) { return just(status(statusCode).body(body)); }
Source:
private void closeMore(@PluralsRes int msgId, int countNoMedia, int countHasMedia) { try { ((MainActivity) getActivity()).showSnackbarAbovePlayer( getResources().getQuantityString(msgId, countHasMedia, (countHasMedia + countNoMedia), countHasMedia), Snackbar.LENGTH_LONG); } catch (Exception e) { Log.d(TAG, e.toString()); } getActivity().getSupportFragmentManager().popBackStack(); }

Target:
private void closeMore(@PluralsRes int msgId, int countNoMedia, int countHasMedia) { ((MainActivity) getActivity()).showSnackbarAbovePlayer( getResources().getQuantityString(msgId, (countHasMedia + countNoMedia), (countHasMedia + countNoMedia), countHasMedia), Snackbar.LENGTH_LONG); getActivity().getSupportFragmentManager().popBackStack(); }
Source:
public MethodCall(String methodName, Object[] args, Map<String, String> metaData, List<String> classes) { super(); init(methodName, args, classes, metaData); }

Target:
public MethodCall(String methodName, Object[] args, Map<String, String> metaData, List<String> classes) { super(); this.methodName = methodName; this.args = args; this.classes = classes; this.metaData = metaData; }
Source:
public void resetHtml(@NonNull Context context, @NonNull String assetFileName, @NonNull String wikiUrl) { String html = ""; try { html = FileUtil.readFile(WikipediaApp.getInstance().getAssets().open(assetFileName)) .replace("$wikiurl", wikiUrl) .replace("$pageLibThemeClass", Theme.getThemePageLibClass(WikipediaApp.getInstance().getCurrentTheme())) .replace("$pageLibDimImgClass", (WikipediaApp.getInstance().getCurrentTheme().isDark()) ? "pagelib_dim_images" : ""); } catch (IOException e) { e.printStackTrace(); } isDOMReady = false; webView.loadDataWithBaseURL(wikiUrl, html, "text/html", "utf-8", ""); }

Target:
public void resetHtml(@NonNull Context context, @NonNull String assetFileName, @NonNull String wikiUrl) { String html = ""; try { html = FileUtil.readFile(WikipediaApp.getInstance().getAssets().open(assetFileName)) .replace("$wikiurl", wikiUrl) .replace("$pageLibThemeClass", Theme.getThemePageLibClass(WikipediaApp.getInstance().getCurrentTheme())) .replace("$pageLibDimImgClass", WikipediaApp.getInstance().getCurrentTheme().isDark() ? "pagelib_dim_images" : ""); } catch (IOException e) { e.printStackTrace(); } isDOMReady = false; webView.loadDataWithBaseURL(wikiUrl, html, "text/html", "utf-8", ""); }
Source:
public static void addProfileDataToNic(Map<String, Object> struct, VM vm, VmDevice vmDevice, VmNic nic) { VnicProfile vnicProfile = null; Network network = null; if (nic.getVnicProfileId() != null) { vnicProfile = DbFacade.getInstance().getVnicProfileDao().get(nic.getVnicProfileId()); if (vnicProfile != null) { network = DbFacade.getInstance().getNetworkDao().get(vnicProfile.getNetworkId()); addQosForDevice(struct, vnicProfile, vm.getVdsGroupCompatibilityVersion()); } } struct.put(VdsProperties.NETWORK, network == null ? "" : network.getName()); if (vnicProfile != null && vnicProfile.isPortMirroring()) { struct.put(VdsProperties.PORT_MIRRORING, network == null ? Collections.<String> emptyList() : Collections.singletonList(network.getName())); } log.debugFormat("VNIC {0} is using profile {1} on network {2}", nic.getName(), vnicProfile, network.getName()); addCustomPropertiesForDevice(struct, vm, vmDevice, vm.getVdsGroupCompatibilityVersion(), getVnicCustomProperties(vnicProfile)); }

Target:
public static void addProfileDataToNic(Map<String, Object> struct, VM vm, VmDevice vmDevice, VmNic nic) { VnicProfile vnicProfile = null; Network network = null; if (nic.getVnicProfileId() != null) { vnicProfile = DbFacade.getInstance().getVnicProfileDao().get(nic.getVnicProfileId()); if (vnicProfile != null) { network = DbFacade.getInstance().getNetworkDao().get(vnicProfile.getNetworkId()); addQosForDevice(struct, vnicProfile, vm.getVdsGroupCompatibilityVersion()); } } String networkName = network == null ? "" : network.getName(); struct.put(VdsProperties.NETWORK, networkName); if (vnicProfile != null && vnicProfile.isPortMirroring()) { struct.put(VdsProperties.PORT_MIRRORING, network == null ? Collections.<String> emptyList() : Collections.singletonList(network.getName())); } if (vnicProfile != null) { log.debugFormat("VNIC {0} is using profile {1} on network {2}", nic.getName(), vnicProfile, networkName); } addCustomPropertiesForDevice(struct, vm, vmDevice, vm.getVdsGroupCompatibilityVersion(), getVnicCustomProperties(vnicProfile)); }
Source:
public void safeUpdate() { ItemStack stackInInput = inventory.getStackInSlot(1); if (!stackInInput.isEmpty()) { if (FluidHelper.itemStackIsWaterContainer(stackInInput)) { ItemStack drainedItemStack = FluidHelper.fillTankFromItem(stackInInput, myTank, true); inventory.setStackInSlot(1, drainedItemStack); } } boolean isBurnTimeGreaterThanZero = burnTime > 0; if (burnTime > 0) { burnTime -= 1; } if (burnTime < 0) { burnTime = 0; } if (!world.isRemote) { if (burnTime == 0 && canSmelt()) { ItemStack stack = inventory.getStackInSlot(0); currentItemBurnTime = burnTime = getItemBurnTime(stack); if (burnTime > 0) { ItemStack container = stack.getItem().getContainerItem(stack); stack.shrink(1); if (stack.isEmpty()) { inventory.setStackInSlot(0, container); } } } if (isBurning() && canSmelt() && getNetwork() != null) { ++cookTime; if (cookTime > 0) { getNetwork().addSteam(10); myTank.drain(2, true); cookTime = 0; } } else { cookTime = 0; } if (isBurnTimeGreaterThanZero != burnTime > 0) { markForResync(); } } if (wasBurning != isBurning()) { wasBurning = isBurning(); markForResync(); } super.safeUpdate(); }

Target:
public void safeUpdate() { ItemStack stackInInput = inventory.getStackInSlot(1); if (FluidHelper.itemStackIsWaterContainer(stackInInput)) { ItemStack drainedItemStack = FluidHelper.fillTankFromItem(stackInInput, myTank, true); inventory.setStackInSlot(1, drainedItemStack); } boolean isBurnTimeGreaterThanZero = burnTime > 0; if (burnTime > 0) { burnTime -= 1; } if (burnTime < 0) { burnTime = 0; } if (!world.isRemote) { if (burnTime == 0 && canSmelt()) { ItemStack stack = inventory.getStackInSlot(0); currentItemBurnTime = burnTime = getItemBurnTime(stack); if (burnTime > 0) { ItemStack container = stack.getItem().getContainerItem(stack); stack.shrink(1); if (stack.isEmpty()) { inventory.setStackInSlot(0, container); } } } if (isBurning() && canSmelt() && getNetwork() != null) { ++cookTime; if (cookTime > 0) { getNetwork().addSteam(10); myTank.drain(2, true); cookTime = 0; } } else { cookTime = 0; } if (isBurnTimeGreaterThanZero != burnTime > 0) { markForResync(); } } if (wasBurning != isBurning()) { wasBurning = isBurning(); markForResync(); } super.safeUpdate(); }
Source:
private void setupMessageHandlers() { bridge.addListener("requestSection", new CommunicationBridge.JSEventListener() { @Override public void onMessage(String messageType, JSONObject messagePayload) { if (!isAdded()) { return; } try { displayNonLeadSection(messagePayload.getInt("index")); } catch (JSONException e) { } } }); bridge.addListener("ipaSpan", new CommunicationBridge.JSEventListener() { @Override public void onMessage(String messageType, JSONObject messagePayload) { try { String text = messagePayload.getString("contents"); final int textSize = 30; TextView textView = new TextView(getActivity()); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize); textView.setText(Html.fromHtml(text)); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(textView); builder.show(); } catch (JSONException e) { } } }); bridge.addListener("pageLoadComplete", new CommunicationBridge.JSEventListener() { @Override public void onMessage(String messageType, JSONObject messagePayload) { if (!isAdded()) { return; } getActivity().updateProgressBar(false, true, 0); if (bottomContentHandler.getTitle() != title) { bottomContentHandler.setTitle(title); } bottomContentHandler.beginLayout(); } }); }

Target:
private void setupMessageHandlers() { bridge.addListener("requestSection", new CommunicationBridge.JSEventListener() { @Override public void onMessage(String messageType, JSONObject messagePayload) { if (!isAdded()) { return; } try { displayNonLeadSection(messagePayload.getInt("index")); } catch (JSONException e) { } } }); bridge.addListener("ipaSpan", new CommunicationBridge.JSEventListener() { @Override public void onMessage(String messageType, JSONObject messagePayload) { try { String text = messagePayload.getString("contents"); final int textSize = 30; TextView textView = new TextView(getActivity()); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize); textView.setText(Html.fromHtml(text)); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(textView); builder.show(); } catch (JSONException e) { } } }); bridge.addListener("pageLoadComplete", new CommunicationBridge.JSEventListener() { @Override public void onMessage(String messageType, JSONObject messagePayload) { if (!isAdded()) { return; } getActivity().updateProgressBar(false, true, 0); if (!bottomContentHandler.getTitle().equals(title)) { bottomContentHandler.setTitle(title); } bottomContentHandler.beginLayout(); } }); }
Source:
public static void transferStreams(List<InputStream> sources, OutputStream destination) throws IOException { destination = new BufferedOutputStream(destination); try { for (InputStream source2 : sources) { try (InputStream source = new BufferedInputStream(source2)) { byte[] buffer = new byte[8192]; while (true) { int bytesRead = -1; if ((bytesRead = source.read(buffer)) == -1) break; destination.write(buffer, 0, bytesRead); } } } } finally { try { destination.close(); } catch (IOException e) { } } }

Target:
public static void transferStreams(List<InputStream> sources, OutputStream destination) throws IOException { destination = new BufferedOutputStream(destination); try { for (InputStream source : sources) { try (InputStream bufferedSource = new BufferedInputStream(source)) { byte[] buffer = new byte[8192]; while (true) { int bytesRead = -1; if ((bytesRead = bufferedSource.read(buffer)) == -1) break; destination.write(buffer, 0, bytesRead); } } } } finally { try { destination.close(); } catch (IOException e) { } } }
Source:
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) { ArrayList<CloudItem> items = folders.get(currentPath); CloudItem item = items.get(i); CloudListViewHolder holder = (CloudListViewHolder) viewHolder; holder.setId(i); holder.setName(item.getName()); String info = String.format("%s - %d", item.getMimetype(), item.getSize()); holder.setInfo(info); holder.setIcon(item.getThumbnail()); holder.setSelected(selected.contains(i)); holder.setOnClickListener(this); holder.setOnLongClickListener(this); String nextToken = nextTokens.get(currentPath); if (!isLoading && nextToken != null && i >= LOAD_TRIGGER * items.size()) { loadMoreData(); } }

Target:
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) { ArrayList<CloudItem> items = folders.get(currentPath); CloudItem item = items.get(i); CloudListViewHolder holder = (CloudListViewHolder) viewHolder; holder.setId(i); holder.setName(item.getName()); String info = String.format("%s - %d", item.getMimetype(), item.getSize()); holder.setInfo(info); holder.setIcon(item.getThumbnail()); holder.setSelected(selected.contains(i)); holder.setOnClickListener(this); holder.setOnLongClickListener(this); String nextToken = nextTokens.get(currentPath); if (!isLoading) { if (nextToken != null && i >= (LOAD_TRIGGER * items.size())) { loadMoreData(); } } }
Source:
private static byte[] shortToBytesLE(short input) { byte[] output = new byte[2]; output[1] = (byte)(0xff & (input >> 8)); output[0] = (byte)(0xff & (input)); return output; }

Target:
private static byte[] shortToBytesLE(short input) { byte[] output = new byte[2]; output[1] = (byte)(0xff & (input >> 8)); output[0] = (byte)(0xff & input); return output; }
Source:
public AbstractRestResource(T serialDeserial, IRoleCheckingStrategy roleCheckingStrategy) { this.objSerialDeserial = serialDeserial; this.roleCheckingStrategy = roleCheckingStrategy; configureObjSerialDeserial(serialDeserial); loadAnnotatedMethods(); }

Target:
public AbstractRestResource(T serialDeserial, IRoleCheckingStrategy roleCheckingStrategy) { Args.notNull(serialDeserial, "serialDeserial"); this.objSerialDeserial = serialDeserial; this.roleCheckingStrategy = roleCheckingStrategy; configureObjSerialDeserial(serialDeserial); loadAnnotatedMethods(); }
Source:
public boolean supports(@Nonnull HttpServletRequest request) { return "PUT".equalsIgnoreCase(request.getMethod()) && request.getContentType()!=null && request.getContentType().contains(MediaType.APPLICATION_JSON_VALUE) && request.getRequestURI().contains("/-/user/org.couchdb.user:"); }

Target:
public boolean supports(@Nonnull HttpServletRequest request) { if (!super.supports(request)) { return false; } return RequestMethod.PUT.name().equalsIgnoreCase(request.getMethod()) && request.getRequestURI().contains(NpmLayoutProvider.NPM_USER_PATH); }
Source:
private Map<String, Serializable> csvTransformArgumentsAdapter( Map<String, Serializable> arguments) { String columnOrder = "\"columnOrder\":" + (String) mapper.toJson(arguments.get("columnOrder")); String hiddenFields = "\"hiddenFields\":" + (String) mapper.toJson(arguments.get("hiddenFields")); String columnAliasMap = "\"columnAliasMap\":" + (String) mapper.toJson(arguments.get("columnAliasMap")); String csvBody = "{" + columnOrder + "," + columnAliasMap + "," + hiddenFields + "}"; CsvTransform queryTransform = mapper.readValue(csvBody, CsvTransform.class); Set<String> hiddenFieldsSet = queryTransform.getHiddenFields() != null ? queryTransform.getHiddenFields() : Collections.emptySet(); List<String> columnOrderList = queryTransform.getColumnOrder() != null ? queryTransform.getColumnOrder() : Collections.emptyList(); Map<String, String> aliasMap = queryTransform.getColumnAliasMap() != null ? queryTransform.getColumnAliasMap() : Collections.emptyMap(); Map<String, Serializable> args = ImmutableMap.<String, Serializable>builder() .put("hiddenFields", new HashSet<>(hiddenFieldsSet)) .put("columnOrder", new ArrayList<>(columnOrderList)) .put("aliases", new HashMap<>(aliasMap)) .build(); return args; }

Target:
private Map<String, Serializable> csvTransformArgumentsAdapter( Map<String, Serializable> arguments) { String columnOrder = "\"columnOrder\":" + (String) mapper.toJson(arguments.get("columnOrder")); String hiddenFields = "\"hiddenFields\":" + (String) mapper.toJson(arguments.get("hiddenFields")); String columnAliasMap = "\"columnAliasMap\":" + (String) mapper.toJson(arguments.get("columnAliasMap")); String csvBody = String.format("{%s,%s,%s}", columnOrder, columnAliasMap, hiddenFields); CsvTransform queryTransform = mapper.readValue(csvBody, CsvTransform.class); Set<String> hiddenFieldsSet = queryTransform.getHiddenFields() != null ? queryTransform.getHiddenFields() : Collections.emptySet(); List<String> columnOrderList = queryTransform.getColumnOrder() != null ? queryTransform.getColumnOrder() : Collections.emptyList(); Map<String, String> aliasMap = queryTransform.getColumnAliasMap() != null ? queryTransform.getColumnAliasMap() : Collections.emptyMap(); Map<String, Serializable> args = ImmutableMap.<String, Serializable>builder() .put("hiddenFields", (Serializable) hiddenFieldsSet) .put("columnOrder", (Serializable) columnOrderList) .put("aliases", (Serializable) aliasMap) .build(); return args; }
Source:
protected void executeVmCommand() { for (CinderDisk cinderDisk : getParameters().getCinderDisks()) { ImagesContainterParametersBase params = new RestoreFromSnapshotParameters(cinderDisk.getImageId(), getParameters().getVmId(), getParameters().getSnapshot(), getParameters().getRemovedSnapshotId()); params.setParentCommand(getActionType()); params.setStorageDomainId(cinderDisk.getStorageIds().get(0)); params.setParentParameters(getParameters()); if (getParameters().getSnapshot().getType() != Snapshot.SnapshotType.REGULAR) { cinderDisk.setActive(true); getImageDao().update(cinderDisk.getImage()); } restoreCinderDisk(cinderDisk, params); } setSucceeded(true); }

Target:
protected void executeVmCommand() { for (CinderDisk cinderDisk : getParameters().getCinderDisks()) { ImagesContainterParametersBase params = getRestoreFromSnapshotParams(cinderDisk); restoreCinderDisk(cinderDisk, params); if (getParameters().getSnapshot().getType() != Snapshot.SnapshotType.REGULAR) { cinderDisk.setActive(true); getImageDao().update(cinderDisk.getImage()); } } setSucceeded(true); }
Source:
private BoolQueryBuilder buildESQuery(String tenantId, String query) { String[] queryTokens = query.split(Locator.metricTokenSeparatorRegex); String lastToken = queryTokens[queryTokens.length - 1]; BoolQueryBuilder bqb = boolQuery(); QueryBuilder parentQB; if (queryTokens.length == 1) { parentQB = termQuery(ESFieldLabel.parent.name(), ""); } else { String parent = Arrays.stream(queryTokens) .limit(queryTokens.length - 1) .collect(joining(Locator.metricTokenSeparator)); GlobPattern parentGlob = new GlobPattern(parent); if (parentGlob.hasWildcard()) { parentQB = regexpQuery(ESFieldLabel.parent.name(), getRegexToHandleTokens(parentGlob)); } else { parentQB = termQuery(ESFieldLabel.parent.name(), parent); } } bqb.must(termQuery(ESFieldLabel.tenantId.name(), tenantId)) .must(parentQB); if (!lastToken.equals("*")) { QueryBuilder tokenQB; GlobPattern pattern = new GlobPattern(lastToken); if (pattern.hasWildcard()) { tokenQB = regexpQuery(ESFieldLabel.token.name(), pattern.compiled().toString()); } else { tokenQB = termQuery(ESFieldLabel.token.name(), query); } bqb.must(tokenQB); } return bqb; }

Target:
private BoolQueryBuilder buildESQuery(String tenantId, String query) { String[] queryTokens = query.split(Locator.METRIC_TOKEN_SEPARATOR_REGEX); String lastToken = queryTokens[queryTokens.length - 1]; BoolQueryBuilder bqb = boolQuery(); QueryBuilder parentQB; if (queryTokens.length == 1) { parentQB = termQuery(ESFieldLabel.parent.name(), ""); } else { String parent = Arrays.stream(queryTokens) .limit(queryTokens.length - 1) .collect(joining(Locator.METRIC_TOKEN_SEPARATOR)); GlobPattern parentGlob = new GlobPattern(parent); if (parentGlob.hasWildcard()) { parentQB = regexpQuery(ESFieldLabel.parent.name(), getRegexToHandleTokens(parentGlob)); } else { parentQB = termQuery(ESFieldLabel.parent.name(), parent); } } bqb.must(termQuery(ESFieldLabel.tenantId.name(), tenantId)) .must(parentQB); if (!lastToken.equals("*")) { QueryBuilder tokenQB; GlobPattern pattern = new GlobPattern(lastToken); if (pattern.hasWildcard()) { tokenQB = regexpQuery(ESFieldLabel.token.name(), pattern.compiled().toString()); } else { tokenQB = termQuery(ESFieldLabel.token.name(), query); } bqb.must(tokenQB); } return bqb; }
Source:
public Attachment getAttachment(DocumentRevision rev, String attachmentName) { try { Cursor c = datastore.getSQLDatabase().rawQuery(SQL_ATTACHMENTS_SELECT, new String[]{attachmentName, String.valueOf(rev.getSequence())}); if (c.moveToFirst()) { int sequence = c.getInt(0); byte[] key = c.getBlob(2); String type = c.getString(3); int encoding = c.getInt(4); int length = c.getInt(5); int encoded_length = c.getInt(6); int revpos = c.getInt(7); File file = fileFromKey(key); return new SavedAttachment(attachmentName, revpos, sequence, key, type, file); } return null; } catch (SQLException e) { return null; } }

Target:
protected Attachment getAttachment(DocumentRevision rev, String attachmentName) { try { Cursor c = datastore.getSQLDatabase().rawQuery(SQL_ATTACHMENTS_SELECT, new String[]{attachmentName, String.valueOf(rev.getSequence())}); if (c.moveToFirst()) { int sequence = c.getInt(0); byte[] key = c.getBlob(2); String type = c.getString(3); int revpos = c.getInt(7); File file = fileFromKey(key); return new SavedAttachment(attachmentName, revpos, sequence, key, type, file); } return null; } catch (SQLException e) { return null; } }
Source:
protected void onDraw(Canvas canvas) { super.onDraw(canvas); final float radius = Math.min((float) canvas.getWidth(), canvas.getHeight()) / 2 - cropCirclePadding; mRectF.set((float) canvas.getWidth() / 2 - radius, (float) canvas.getHeight() / 2 - radius, (float) canvas.getWidth() / 2 + radius, (float) canvas.getHeight() / 2 + radius); circleSelectionPath.reset(); circleSelectionPath.addOval(mRectF, Path.Direction.CW); canvas.clipPath(circleSelectionPath, Region.Op.DIFFERENCE); canvas.drawRect(0, 0, canvas.getWidth(), canvas.getHeight(), backgroundPaint); canvas.save(); canvas.restore(); canvas.drawCircle((float) canvas.getWidth() / 2, (float) canvas.getHeight() / 2, radius, borderPaint); }

Target:
protected void onDraw(Canvas canvas) { super.onDraw(canvas); final float radius = Math.min((float) canvas.getWidth(), canvas.getHeight()) / 2 - cropCirclePadding; mRectF.set((float) canvas.getWidth() / 2 - radius, (float) canvas.getHeight() / 2 - radius, (float) canvas.getWidth() / 2 + radius, (float) canvas.getHeight() / 2 + radius); circleSelectionPath.reset(); circleSelectionPath.addOval(mRectF, Path.Direction.CW); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { canvas.clipOutPath(circleSelectionPath); } else { canvas.clipPath(circleSelectionPath, Region.Op.XOR); } canvas.drawRect(0, 0, canvas.getWidth(), canvas.getHeight(), backgroundPaint); canvas.save(); canvas.restore(); canvas.drawCircle((float) canvas.getWidth() / 2, (float) canvas.getHeight() / 2, radius, borderPaint); }
Source:
public String apply(@Nullable String value) { if (value == null) { if (nullHandling == NullHandling.RETURNNULL) { return null; } if (nullHandling == NullHandling.EMPTYSTRING) { value = ""; } } return StringUtils.emptyToNullNonDruidDataString(StringUtils.format(format, value)); }

Target:
public String apply(@Nullable String value) { if (value == null) { if (nullHandling == NullHandling.RETURNNULL) { return null; } if (nullHandling == NullHandling.EMPTYSTRING) { value = ""; } } return io.druid.common.config.NullHandling.emptyToNullIfNeeded(StringUtils.format(format, value)); }
Source:
public void testValidateValidSeedLocation() { this.errors = new MapBindingResult(new HashMap<String, String>(), LotDto.class.getName()); final Integer locationId = 6000; this.lotGeneratorInputDto.setGid(1); this.lotGeneratorInputDto.setLocationId(locationId); this.lotGeneratorInputDto.setGenerateStock(false); this.lotGeneratorInputDto.setScaleId(8264); this.lotGeneratorInputDto.setStockId("ABCD"); this.lotGeneratorInputDto.setComments("Comments"); final VariableFilter variableFilter = new VariableFilter(); variableFilter.addPropertyId(TermId.INVENTORY_AMOUNT_PROPERTY.getId()); final Location location = new Location(); final List<Location> locationList = Lists.newArrayList(location); Mockito.when(this.locationDataManager.getLocationByID(locationId)).thenReturn(location); Mockito.when(this.locationDataManager.getAllSeedingLocations(Lists.newArrayList(locationId))).thenReturn(locationList); this.locationValidator.validateSeedLocationId(this.errors, locationId); Assert.assertTrue(this.errors.getAllErrors().size() == 0); }

Target:
public void testValidateValidSeedLocation() { this.errors = new MapBindingResult(new HashMap<String, String>(), LotDto.class.getName()); this.lotGeneratorInputDto.setGid(GID); this.lotGeneratorInputDto.setLocationId(LOCATION_ID); this.lotGeneratorInputDto.setGenerateStock(false); this.lotGeneratorInputDto.setScaleId(SCALE_ID); this.lotGeneratorInputDto.setStockId(STOCK_ID); this.lotGeneratorInputDto.setComments(COMMENTS); final VariableFilter variableFilter = new VariableFilter(); variableFilter.addPropertyId(TermId.INVENTORY_AMOUNT_PROPERTY.getId()); final Location location = new Location(); final List<Location> locationList = Lists.newArrayList(location); Mockito.when(this.locationDataManager.getLocationByID(LOCATION_ID)).thenReturn(location); Mockito.when(this.locationDataManager.getAllSeedingLocations(Lists.newArrayList(LOCATION_ID))).thenReturn(locationList); this.locationValidator.validateSeedLocationId(this.errors, LOCATION_ID); Assert.assertEquals(this.errors.getAllErrors().size(), 0); }
Source:
private void processKeyPressed(BluetoothDevice device) { final HeadsetPhoneState phoneState = mSystemInterface.getHeadsetPhoneState(); if (phoneState.getCallState() == HeadsetHalConstants.CALL_STATE_INCOMING) { mSystemInterface.answerCall(device); } else if (phoneState.getNumActiveCall() > 0) { if (getAudioState() != BluetoothHeadset.STATE_AUDIO_DISCONNECTED) { mHeadsetService.setActiveDevice(mDevice); mNativeInterface.connectAudio(mDevice); } else { mSystemInterface.hangupCall(device, false); } } else { String dialNumber = mPhonebook.getLastDialledNumber(); if (dialNumber == null) { log("processKeyPressed, last dial number null"); return; } mHeadsetService.setActiveDevice(mDevice); Intent intent = new Intent(Intent.ACTION_CALL_PRIVILEGED, Uri.fromParts(SCHEME_TEL, dialNumber, null)); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); updateCallIntent(intent, dialNumber); mHeadsetService.startActivity(intent); } }

Target:
private void processKeyPressed(BluetoothDevice device) { final HeadsetPhoneState phoneState = mSystemInterface.getHeadsetPhoneState(); if (phoneState.getCallState() == HeadsetHalConstants.CALL_STATE_INCOMING) { mSystemInterface.answerCall(device); } else if (phoneState.getNumActiveCall() > 0) { if (getAudioState() != BluetoothHeadset.STATE_AUDIO_DISCONNECTED) { mHeadsetService.setActiveDevice(mDevice); mNativeInterface.connectAudio(mDevice); } else { mSystemInterface.hangupCall(device, false); } } else { String dialNumber = mPhonebook.getLastDialledNumber(); if (dialNumber == null) { log("processKeyPressed, last dial number null"); return; } mHeadsetService.setActiveDevice(mDevice); Intent intent = getDialCallIntent(dialNumber); mHeadsetService.startActivity(intent); } }
Source:
public void onComplete() { int currentNumOfAttempts = numOfAttempts.get(); if (currentNumOfAttempts > 0 && currentNumOfAttempts < maxAttempts) { succeededAfterRetryCounter.increment(); Throwable throwable = Option.of(lastException.get()) .getOrElse(lastRuntimeException.get()); publishRetryEvent( () -> new RetryOnSuccessEvent(getName(), currentNumOfAttempts, throwable)); } else { if (currentNumOfAttempts >= maxAttempts) { failedAfterRetryCounter.increment(); Throwable throwable = Option.of(lastException.get()) .getOrElse(lastRuntimeException.get()); RuntimeException maxRetriesExceeded = new MaxRetriesExceeded( "Max retries reached for retry=" + name ); publishRetryEvent(() -> new RetryOnErrorEvent(name, currentNumOfAttempts, throwable != null && !failAfterMaxAttempts ? throwable : maxRetriesExceeded)); if (failAfterMaxAttempts) { throw maxRetriesExceeded; } } else { succeededWithoutRetryCounter.increment(); } } }

Target:
public void onComplete() { int currentNumOfAttempts = numOfAttempts.get(); if (currentNumOfAttempts > 0 && currentNumOfAttempts < maxAttempts) { succeededAfterRetryCounter.increment(); Throwable throwable = Option.of(lastException.get()) .getOrElse(lastRuntimeException.get()); publishRetryEvent( () -> new RetryOnSuccessEvent(getName(), currentNumOfAttempts, throwable)); } else { if (currentNumOfAttempts >= maxAttempts) { failedAfterRetryCounter.increment(); Throwable throwable = Option.of(lastException.get()) .orElse(Option.of(lastRuntimeException.get())) .filter(p -> !failAfterMaxAttempts) .getOrElse(new MaxRetriesExceeded( "max retries is reached out for the result predicate check" )); publishRetryEvent(() -> new RetryOnErrorEvent(name, currentNumOfAttempts, throwable)); if (failAfterMaxAttempts) { throw MaxRetriesExceededException.createMaxRetriesExceededException(RetryImpl.this); } } else { succeededWithoutRetryCounter.increment(); } } }
Source:
public S3DDFManager(S3DataSourceDescriptor s3dsd, EngineType engineType) throws DDFException { mCredential = (S3DataSourceCredentials)s3dsd.getDataSourceCredentials(); AWSCredentials credentials = new BasicAWSCredentials(mCredential.getAwsKeyID(), mCredential.getAwsScretKey()); mConn = new AmazonS3Client(credentials); }

Target:
public S3DDFManager(S3DataSourceDescriptor s3dsd, EngineType engineType) throws DDFException { this((S3DataSourceCredentials)s3dsd.getDataSourceCredentials(), engineType); }
Source:
private static void handleZoneWithPreviousType( String mgrsPart, MgrsPartType previousType, StringBuilder mgrsBuilder, List<String> mgrsStrings) { LOGGER.trace("Found a ZONE which occurs after a {}", mgrsPart, previousType); switch (previousType) { case ZONE: case HUNDRED_KM: LOGGER.trace("Storing final result coordinate, clearing the builder, and saving this part"); mgrsStrings.add(mgrsBuilder.toString()); mgrsBuilder.delete(0, mgrsBuilder.length()); mgrsBuilder.append(mgrsPart); break; case NUMERIC: LOGGER.trace("Clearing the builder and saving this part"); mgrsBuilder.delete(0, mgrsBuilder.length()); mgrsBuilder.append(mgrsPart); break; case NONE: LOGGER.trace("Saving this part"); mgrsBuilder.append(mgrsPart); break; } }

Target:
private static void handleZoneWithPreviousType( String mgrsPart, MgrsPartType previousType, StringBuilder mgrsBuilder, List<String> mgrsStrings) { LOGGER.trace("Found a ZONE which occurs after a {}", mgrsPart, previousType); switch (previousType) { case ZONE: case HUNDRED_KM: LOGGER.trace( "Storing final result coordinate, clearing the builder, and saving this part [{}]", mgrsPart); mgrsStrings.add(mgrsBuilder.toString()); mgrsBuilder.delete(0, mgrsBuilder.length()); mgrsBuilder.append(mgrsPart); break; case NUMERIC: LOGGER.trace("Clearing the builder and saving this part [{}]", mgrsPart); mgrsBuilder.delete(0, mgrsBuilder.length()); mgrsBuilder.append(mgrsPart); break; case NONE: LOGGER.trace("Saving this part [{}]", mgrsPart); mgrsBuilder.append(mgrsPart); } }
Source:
public void handleReplaceKeysResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception) { LOGGER.info("handleReplaceKeysResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error("Replace Keys Response not ok. Unexpected Exception", exception); result = ResponseMessageResultType.NOT_OK; } this.webServiceResponseMessageSender.send(ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception).withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(), deviceMessageMetadata.getMessageType()); }

Target:
public void handleReplaceKeysResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception) { LOGGER.info("handleReplaceKeysResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error("Replace Keys Response not ok. Unexpected Exception", exception); result = ResponseMessageResultType.NOT_OK; } ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception).withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(); this.webServiceResponseMessageSender.send(responseMessage, deviceMessageMetadata.getMessageType()); }
Source:
public static void sortRevisionInfoByNumber(JsArray<RevisionInfo> list) { final int parent_edit_number = findEditParent(list); Collections.sort(Natives.asList(list), new Comparator<RevisionInfo>() { @Override public int compare(RevisionInfo a, RevisionInfo b) { int a_number = a._number(); int b_number = b._number(); if (a_number == 0) { a_number = parent_edit_number + 1; } if (b_number == 0) { b_number = parent_edit_number + 1; } return a_number - b_number; } }); }

Target:
public static void sortRevisionInfoByNumber(JsArray<RevisionInfo> list) { final int parent_number = findEditParent(list); Collections.sort(Natives.asList(list), new Comparator<RevisionInfo>() { @Override public int compare(RevisionInfo a, RevisionInfo b) { int a_number = a._number(); int b_number = b._number(); if (a_number == 0) { if (b_number == parent_number + 1) { a_number = parent_number; } else { a_number = parent_number + 1; } } if (b_number == 0) { if (a_number == parent_number + 1) { b_number = parent_number; } else { b_number = parent_number + 1; } } return a_number - b_number; } }); }
Source:
public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TocTreeNodeStyle other = (TocTreeNodeStyle) obj; if (this.style != other.style && (this.style == null || !this.style.equals(other.style))) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (obj instanceof TocTreeNodeStyle) { final TocTreeNodeStyle other = (TocTreeNodeStyle) obj; return this.style != null && this.style.equals(other.style); } else { return false; } }
Source:
protected ElasticsearchIndexFieldType<BigDecimal> toIndexFieldType(PropertyMapping mapping) { int resolvedDecimalScale = resolveDecimalScale(); mapping.setScalingFactor( BigInteger.TEN.pow( resolvedDecimalScale ).intValue() ); ToDocumentFieldValueConverter<?, ? extends BigDecimal> dslToIndexConverter = createDslToIndexConverter(); FromDocumentFieldValueConverter<? super BigDecimal, ?> indexToProjectionConverter = createIndexToProjectionConverter(); ElasticsearchBigDecimalFieldCodec codec = new ElasticsearchBigDecimalFieldCodec( resolvedDecimalScale ); return new ElasticsearchIndexFieldType<>( codec, new ElasticsearchStandardFieldPredicateBuilderFactory<>( dslToIndexConverter , createToDocumentRawConverter(), codec ), new ElasticsearchStandardFieldSortBuilderFactory<>( resolvedSortable, dslToIndexConverter, createToDocumentRawConverter(), codec ), new ElasticsearchStandardFieldProjectionBuilderFactory<>( resolvedProjectable, indexToProjectionConverter, createFromDocumentRawConverter(), codec ), mapping ); }

Target:
protected ElasticsearchIndexFieldType<BigDecimal> toIndexFieldType(PropertyMapping mapping) { BigDecimal scalingFactor = BigDecimal.TEN.pow( resolveDecimalScale(), new MathContext( 10, RoundingMode.HALF_UP ) ); mapping.setScalingFactor( scalingFactor.doubleValue() ); ToDocumentFieldValueConverter<?, ? extends BigDecimal> dslToIndexConverter = createDslToIndexConverter(); FromDocumentFieldValueConverter<? super BigDecimal, ?> indexToProjectionConverter = createIndexToProjectionConverter(); ElasticsearchBigDecimalFieldCodec codec = new ElasticsearchBigDecimalFieldCodec( scalingFactor ); return new ElasticsearchIndexFieldType<>( codec, new ElasticsearchStandardFieldPredicateBuilderFactory<>( dslToIndexConverter , createToDocumentRawConverter(), codec ), new ElasticsearchStandardFieldSortBuilderFactory<>( resolvedSortable, dslToIndexConverter, createToDocumentRawConverter(), codec ), new ElasticsearchStandardFieldProjectionBuilderFactory<>( resolvedProjectable, indexToProjectionConverter, createFromDocumentRawConverter(), codec ), mapping ); }
Source:
public void start() { if (!lifecycleLock.canStart()) { throw new ISE("can't start."); } LOG.info("Starting CoordinatorPollingBasicAuthenticatorCacheManager."); try { initUserMaps(); ScheduledExecutors.scheduleWithFixedDelay( exec, new Duration(commonCacheConfig.getPollingPeriod()), new Duration(commonCacheConfig.getPollingPeriod()), () -> { try { long randomDelay = ThreadLocalRandom.current().nextLong(0, commonCacheConfig.getMaxRandomDelay()); LOG.debug("Inserting cachedUserMaps random polling delay of [%s] ms", randomDelay); Thread.sleep(randomDelay); LOG.debug("Scheduled user cache poll is running"); for (String authenticatorPrefix : authenticatorPrefixes) { Map<String, BasicAuthenticatorUser> userMap = fetchUserMapFromCoordinator(authenticatorPrefix, false); if (userMap != null) { cachedUserMaps.put(authenticatorPrefix, userMap); } } LOG.debug("Scheduled user cache poll is done"); } catch (Throwable t) { LOG.makeAlert(t, "Error occured while polling for cachedUserMaps.").emit(); } } ); ScheduledExecutors.scheduleWithFixedDelay( exec, new Duration(commonCacheConfig.getPollingPeriod()), new Duration(commonCacheConfig.getPollingPeriod()), () -> { try { long randomDelay = ThreadLocalRandom.current().nextLong(0, commonCacheConfig.getMaxRandomDelay()); LOG.debug("Inserting cachedConfigs random polling delay of [%s] ms", randomDelay); Thread.sleep(randomDelay); LOG.debug("Scheduled config cache poll is running"); for (String authenticatorPrefix : authenticatorPrefixes) { BasicAuthConfig config = fetchConfigFromCoordinator(authenticatorPrefix); if (config != null) { cachedConfigs.put(authenticatorPrefix, config); } } LOG.debug("Scheduled config cache poll is done"); } catch (Throwable t) { LOG.makeAlert(t, "Error occured while polling for cachedConfigs.").emit(); } } ); lifecycleLock.started(); LOG.info("Started CoordinatorPollingBasicAuthenticatorCacheManager."); } finally { lifecycleLock.exitStart(); } }

Target:
public void start() { if (!lifecycleLock.canStart()) { throw new ISE("can't start."); } LOG.info("Starting CoordinatorPollingBasicAuthenticatorCacheManager."); try { initUserMaps(); ScheduledExecutors.scheduleWithFixedDelay( exec, new Duration(commonCacheConfig.getPollingPeriod()), new Duration(commonCacheConfig.getPollingPeriod()), () -> { try { long randomDelay = ThreadLocalRandom.current().nextLong(0, commonCacheConfig.getMaxRandomDelay()); LOG.debug("Inserting cachedUserMaps random polling delay of [%s] ms", randomDelay); Thread.sleep(randomDelay); LOG.debug("Scheduled user cache poll is running"); for (String authenticatorPrefix : authenticatorPrefixes) { Map<String, BasicAuthenticatorUser> userMap = fetchUserMapFromCoordinator(authenticatorPrefix, false); if (userMap != null) { cachedUserMaps.put(authenticatorPrefix, userMap); } } LOG.debug("Scheduled user cache poll is done"); } catch (Throwable t) { LOG.makeAlert(t, "Error occured while polling for cachedUserMaps.").emit(); } } ); lifecycleLock.started(); LOG.info("Started CoordinatorPollingBasicAuthenticatorCacheManager."); } finally { lifecycleLock.exitStart(); } }
Source:
public void testBigDecimal() { Object convertedObject = basicConverter.convertValue(null, BigDecimal.class); assertNull(convertedObject); convertedObject = basicConverter.convertValue(new BigDecimal(0), BigDecimal.class); assertEquals(BigDecimal.ZERO, convertedObject); assertTrue(convertedObject instanceof BigDecimal); assertEquals(0, BigDecimal.ZERO.compareTo((BigDecimal) convertedObject)); convertedObject = basicConverter.convertValue(BigDecimal.valueOf(0), BigDecimal.class); assertEquals(BigDecimal.ZERO, convertedObject); assertTrue(convertedObject instanceof BigDecimal); assertEquals(0, BigDecimal.ZERO.compareTo((BigDecimal) convertedObject)); convertedObject = basicConverter.convertValue(BigDecimal.valueOf(0.0), BigDecimal.class); assertEquals(BigDecimal.valueOf(0.0), convertedObject); assertTrue(convertedObject instanceof BigDecimal); assertEquals(0, BigDecimal.ZERO.compareTo((BigDecimal) convertedObject)); convertedObject = basicConverter.convertValue(BigDecimal.valueOf(0.000), BigDecimal.class); assertEquals(BigDecimal.valueOf(0.000), convertedObject); assertTrue(convertedObject instanceof BigDecimal); assertEquals(0, BigDecimal.ZERO.compareTo((BigDecimal) convertedObject)); convertedObject = basicConverter.convertValue(BigDecimal.valueOf(10), BigDecimal.class); assertEquals(BigDecimal.TEN, convertedObject); convertedObject = basicConverter.convertValue(BigDecimal.valueOf(12345.67890), BigDecimal.class); assertEquals(BigDecimal.valueOf(12345.67890), convertedObject); }

Target:
public void testBigDecimal() { Object convertedObject = basicConverter.convertValue(null, BigDecimal.class); assertEquals(BigDecimal.ZERO, convertedObject); assertTrue(convertedObject instanceof BigDecimal); assertEquals(0, BigDecimal.ZERO.compareTo((BigDecimal) convertedObject)); convertedObject = basicConverter.convertValue(new BigDecimal(0), BigDecimal.class); assertEquals(BigDecimal.ZERO, convertedObject); assertTrue(convertedObject instanceof BigDecimal); assertEquals(0, BigDecimal.ZERO.compareTo((BigDecimal) convertedObject)); convertedObject = basicConverter.convertValue(BigDecimal.valueOf(0), BigDecimal.class); assertEquals(BigDecimal.ZERO, convertedObject); assertTrue(convertedObject instanceof BigDecimal); assertEquals(0, BigDecimal.ZERO.compareTo((BigDecimal) convertedObject)); convertedObject = basicConverter.convertValue(BigDecimal.valueOf(0.0), BigDecimal.class); assertEquals(BigDecimal.valueOf(0.0), convertedObject); assertTrue(convertedObject instanceof BigDecimal); assertEquals(0, BigDecimal.ZERO.compareTo((BigDecimal) convertedObject)); convertedObject = basicConverter.convertValue(BigDecimal.valueOf(0.000), BigDecimal.class); assertEquals(BigDecimal.valueOf(0.000), convertedObject); assertTrue(convertedObject instanceof BigDecimal); assertEquals(0, BigDecimal.ZERO.compareTo((BigDecimal) convertedObject)); convertedObject = basicConverter.convertValue(BigDecimal.valueOf(10), BigDecimal.class); assertEquals(BigDecimal.TEN, convertedObject); convertedObject = basicConverter.convertValue(BigDecimal.valueOf(12345.67890), BigDecimal.class); assertEquals(BigDecimal.valueOf(12345.67890), convertedObject); }
Source:
public String apply(HttpResponse from) { String id = from.getFirstHeaderOrNull(GlacierHeaders.JOB_ID); if (id == null) throw new HttpException("Did not receive JobId"); return id; }

Target:
public String apply(HttpResponse from) { String id = from.getFirstHeaderOrNull(GlacierHeaders.JOB_ID); if (id == null) { throw new HttpException("Did not receive JobId"); } return id; }