auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
SimpleStateRequestHandler( KeyedStateBackend keyedStateBackend, TypeSerializer keySerializer) { this.keySerializer = keySerializer; this.valueSerializer = PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO .createSerializer(new ExecutionConfig()); this.keyedStateBackend = keyedStateBackend; baos = new ByteArrayOutputStreamWithPos(); baosWrapper = new DataOutputViewStreamWrapper(baos); bais = new ByteArrayInputStreamWithPos(); baisWrapper = new DataInputViewStreamWrapper(bais); stateDescriptorCache = new HashMap<>(); }

Target:
SimpleStateRequestHandler( KeyedStateBackend keyedStateBackend, TypeSerializer keySerializer) { this.keyedStateBackend = keyedStateBackend; this.keySerializer = keySerializer; this.valueSerializer = PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO .createSerializer(new ExecutionConfig()); bais = new ByteArrayInputStreamWithPos(); baisWrapper = new DataInputViewStreamWrapper(bais); stateDescriptorCache = new HashMap<>(); }
Source:
public StickyMulticastStrategy(Optional<Integer> maxTasks, Optional<Integer> imbalanceThreshold) { _maxTasks = maxTasks; _imbalanceThreshold = imbalanceThreshold.orElse(DEFAULT_IMBALANCE_THRESHOLD); }

Target:
public StickyMulticastStrategy(Optional<Integer> maxTasks, Optional<Integer> imbalanceThreshold) { _maxTasks = maxTasks; _imbalanceThreshold = imbalanceThreshold.orElse(DEFAULT_IMBALANCE_THRESHOLD); if (_imbalanceThreshold < 1) { throw new IllegalArgumentException("Imbalance threshold must be larger or equal than 1"); } }
Source:
private Optional<String> unlock(String name) { LOGGER.debug("Attempting to unlock {0}", name); NamedLock lock = locksByName.get(name); if (lock == null) { return Optional.of(name); } try { lock.unlock(); } catch (IllegalMonitorStateException e) { LOGGER.warn(JcrI18n.warnAnotherThreadAttemptingToUnlock, Thread.currentThread().getName(), lock); } if (lock.isLocked()) { LOGGER.debug("Failed to unlock {0} ", lock); return Optional.of(name); } else { LOGGER.debug("{0} unlocked", lock); return Optional.empty(); } }

Target:
private Optional<String> unlock(String name) { LOGGER.debug("Attempting to unlock {0}", name); AtomicBoolean unlocked = new AtomicBoolean(false); locksByName.computeIfPresent(name, (key,lock)-> { if (!lock.isHeldByCurrentThread()) { LOGGER.debug("The thread '{0}' is attempting to unlock '{1}' which is held by another thread", Thread.currentThread().getName(), key); return lock; } while (lock.getHoldCount() > 0) { lock.unlock(); } unlocked.set(true); if (lock.hasQueuedThreads()) { LOGGER.debug("Lock '{0}' is not currently locked but will be", name); return lock; } return null; }); return unlocked.get() ? Optional.empty() : Optional.of(name); }
Source:
public ImageScaleMenu(final DivaMainImageDisplay imageDisplay) { super(_I18N.getString("scale")); final HashMap<Float, JRadioButtonMenuItem> scaleToButton = new HashMap<>(); final ButtonGroup group = new ButtonGroup(); final ActionListener listener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final float scale = Float.parseFloat(e.getActionCommand()); imageDisplay.setScale(scale); imageDisplay.updateImage(); } }; for (ScaleMenuOptions o : ScaleMenuOptions.values()) { final JMenu menu = new JMenu(o.i18name); for (int i=1; i <= ImageDisplayMenuBar.MAX_SCALE; ++i) { final float scale = o.createScaleForIndex(i); final JRadioButtonMenuItem b = new JRadioButtonMenuItem(o.createLabelForIndex(i)); b.setActionCommand(Float.toString(scale)); b.addActionListener(listener); group.add(b); menu.add(b); scaleToButton.put(scale, b); } add(menu); } final JMenuItem menuItem = new JMenuItem(_I18N.getString("fitImageInWindow")); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { imageDisplay.scaleToFit(); imageDisplay.updateImage(); } }); add(menuItem); imageDisplay.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent ce) { ImageChangeEvent e = (ImageChangeEvent) ce; if (e.isNewScale()) { final JRadioButtonMenuItem b = scaleToButton.get(imageDisplay.getScale()); if (b != null) b.setSelected(true); } } }); }

Target:
public ImageScaleMenu(final DivaMainImageDisplay imageDisplay) { super(_I18N.getString("scale")); scaleToButton = new HashMap<>(); final ButtonGroup group = new ButtonGroup(); for (ScaleMenuOptions o : ScaleMenuOptions.values()) { final JMenu menu = new JMenu(o.i18nName); for (int i=o.lowerBound; i <= o.upperBound; ++i) { final float scale = o.createScaleForIndex(i); final Pair<Integer, Integer> rational = o.createRationalScaleForIndex(i); final JRadioButtonMenuItem b = new JRadioButtonMenuItem(o.createLabelForIndex(i)); b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { imageDisplay.setScale(scale); imageDisplay.updateImage(); } }); group.add(b); menu.add(b); scaleToButton.put(rational, b); } add(menu); } final JMenuItem menuItem = new JMenuItem(_I18N.getString("fitImageInWindow")); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { imageDisplay.scaleToFit(); imageDisplay.updateImage(); } }); add(menuItem); imageDisplay.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent ce) { final ImageChangeEvent e = (ImageChangeEvent) ce; if (e.isNewScale()) enableButtonForScale(imageDisplay.getScale()); } }); enableButtonForScale(imageDisplay.getScale()); }
Source:
public void handleCreated(Event event) { curator.insert(new BasicDBObject(event.getNewEntity().toMap())); }

Target:
public void handleCreated(Event event) { curator.insert((BasicDBObject) event.getNewEntity()); }
Source:
public static TopicDraft getDefaultTopicDraft() { return new TopicDraft(getDefaultUser(), "topic title", "Discussion"); }

Target:
public static TopicDraft getDefaultTopicDraft() { TopicDraft draft = new TopicDraft(getDefaultUser(), RandomStringUtils.random(5), RandomStringUtils.random(15)); draft.setPollTitle(RandomStringUtils.random(5)); draft.setPollItemsValue(RandomStringUtils.random(5) + "\n" + RandomStringUtils.random(5)); return draft; }
Source:
public void onChildScrollingPreferenceChanged() { final int position = viewHolder.profileSectionTabs.getSelectedTabPosition(); @AppBarLayout.LayoutParams.ScrollFlags final int scrollFlags; Fragment fragment =(((StaticFragmentPagerAdapter) viewHolder.profileSectionPager.getAdapter()).getFragment(position)); if(fragment != null) { if (position >= 0 && ((ScrollingPreferenceChild) fragment).prefersScrollingHeader()) { scrollFlags = AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL; } else { scrollFlags = 0; } final AppBarLayout.LayoutParams p = (AppBarLayout.LayoutParams) viewHolder.profileHeader.getLayoutParams(); p.setScrollFlags(scrollFlags); viewHolder.profileHeader.setLayoutParams(p); } }

Target:
public void onChildScrollingPreferenceChanged() { final int position = viewHolder.profileSectionTabs.getSelectedTabPosition(); @AppBarLayout.LayoutParams.ScrollFlags final int scrollFlags; final Fragment fragment = (((StaticFragmentPagerAdapter) viewHolder.profileSectionPager.getAdapter()).getFragment(position)); if (fragment != null) { if (position >= 0 && ((ScrollingPreferenceChild) fragment).prefersScrollingHeader()) { scrollFlags = AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL; } else { scrollFlags = 0; } final AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) viewHolder.profileHeader.getLayoutParams(); params.setScrollFlags(scrollFlags); viewHolder.profileHeader.setLayoutParams(params); } }
Source:
private void understandSchema(String schema) throws JSONException { JSONObject j1 = new JSONObject(schema); JSONArray fields = j1.getJSONArray(FIELDS); for (int k = 0; k < fields.length(); k++) { JSONObject allEvents = new JSONObject(fields.get(k).toString()); Object name = allEvents.get(NAME); if (name != null) { if (name.toString().equalsIgnoreCase(EVENT)) { JSONArray allTypeDetails = allEvents.getJSONArray(TYPE); for (int i = 0; i < allTypeDetails.length(); i++) { JSONObject actual = (JSONObject) allTypeDetails.get(i); JSONArray types = actual.getJSONArray(FIELDS); Map<String, String> typeDetails = new HashMap<String, String>(); for (int j = 0; j < types.length(); j++) { typeDetails.put(types.getJSONObject(j).getString(NAME), types.getJSONObject(j) .getString(TYPE)); } fieldTypes.put(Hadoop2RecordType.valueOf(actual.get(NAME).toString()), typeDetails); } } } } }

Target:
private void understandSchema(String schema) throws JSONException { JSONObject j1 = new JSONObject(schema); JSONArray fields = j1.getJSONArray(FIELDS); String fieldName; String fieldTypeValue; Object recName; for (int k = 0; k < fields.length(); k++) { if (fields.get(k) == null) { continue; } JSONObject allEvents = new JSONObject(fields.get(k).toString()); Object name = allEvents.get(NAME); if (name != null) { if (name.toString().equalsIgnoreCase(EVENT)) { JSONArray allTypeDetails = allEvents.getJSONArray(TYPE); for (int i = 0; i < allTypeDetails.length(); i++) { JSONObject actual = (JSONObject) allTypeDetails.get(i); JSONArray types = actual.getJSONArray(FIELDS); Map<String, String> typeDetails = new HashMap<String, String>(); for (int j = 0; j < types.length(); j++) { if (types.getJSONObject(j) == null ) { continue; } fieldName = types.getJSONObject(j).getString(NAME); fieldTypeValue = types.getJSONObject(j).getString(TYPE); if ((fieldName != null) && (fieldTypeValue != null)) { typeDetails.put(fieldName, fieldTypeValue); } } recName = actual.get(NAME); if (recName != null) { fieldTypes.put(Hadoop2RecordType.valueOf(recName.toString()), typeDetails); } } } } } }
Source:
public int compare(CucumberFeature a, CucumberFeature b) { if (a.equals(b)) { return 0; } return a.getUri().compareTo(b.getUri()); }

Target:
public int compare(CucumberFeature a, CucumberFeature b) { return a.getUri().compareTo(b.getUri()); }
Source:
public void saveNewSanStorage() { StorageModel storageModel = (StorageModel) getWindow(); final SanStorageModel sanStorageModel = (SanStorageModel) storageModel.getCurrentStorageItem(); List<String> unkownStatusLuns = new ArrayList(); List<LUNs> usedStatusLuns = new ArrayList(); for (LunModel lunModel : sanStorageModel.getAddedLuns()) { if (lunModel.getStatus() == LunStatus.Used) { usedStatusLuns.add((LUNs) lunModel.getEntity()); } else if (lunModel.getStatus() == LunStatus.Unknown) { unkownStatusLuns.add(lunModel.getLunId()); } } if (!unkownStatusLuns.isEmpty()) { Guid hostId = sanStorageModel.getContainer().getHost().getSelectedItem().getId(); Object target = getWidgetModel() != null ? getWidgetModel() : sanStorageModel.getContainer(); Frontend.getInstance() .runQuery(VdcQueryType.GetDeviceList, new GetDeviceListQueryParameters(hostId, sanStorageModel.getType(), true, unkownStatusLuns), new AsyncQuery(target, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { VdcQueryReturnValue response = (VdcQueryReturnValue) returnValue; if (response.getSucceeded()) { List<LUNs> checkedLuns = (ArrayList<LUNs>) response.getReturnValue(); postGetLunsMessages(sanStorageModel.getUsedLunsMessages(checkedLuns)); } else { sanStorageModel.setGetLUNsFailure( ConstantsManager.getInstance() .getConstants() .couldNotRetrieveLUNsLunsFailure()); } } }, true)); } else { postGetLunsMessages(sanStorageModel.getUsedLunsMessages(usedStatusLuns)); } }

Target:
public void saveNewSanStorage() { StorageModel storageModel = (StorageModel) getWindow(); final SanStorageModel sanStorageModel = (SanStorageModel) storageModel.getCurrentStorageItem(); List<String> unkownStatusLuns = new ArrayList<>(); List<LUNs> usedStatusLuns = new ArrayList<>(); for (LunModel lunModel : sanStorageModel.getAddedLuns()) { if (lunModel.getStatus() == LunStatus.Used) { usedStatusLuns.add((LUNs) lunModel.getEntity()); } else if (lunModel.getStatus() == LunStatus.Unknown) { unkownStatusLuns.add(lunModel.getLunId()); } } if (!unkownStatusLuns.isEmpty()) { Guid hostId = sanStorageModel.getContainer().getHost().getSelectedItem().getId(); Model target = getWidgetModel() != null ? getWidgetModel() : sanStorageModel.getContainer(); Frontend.getInstance() .runQuery(VdcQueryType.GetDeviceList, new GetDeviceListQueryParameters(hostId, sanStorageModel.getType(), true, unkownStatusLuns), new AsyncQuery(target, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { VdcQueryReturnValue response = (VdcQueryReturnValue) returnValue; if (response.getSucceeded()) { List<LUNs> checkedLuns = (ArrayList<LUNs>) response.getReturnValue(); postGetLunsMessages(sanStorageModel.getUsedLunsMessages(checkedLuns)); } else { sanStorageModel.setGetLUNsFailure( ConstantsManager.getInstance() .getConstants() .couldNotRetrieveLUNsLunsFailure()); } } }, true)); } else { postGetLunsMessages(sanStorageModel.getUsedLunsMessages(usedStatusLuns)); } }
Source:
public static Envelope deserializeEnvelope(Slice shape) { if (shape == null) { return null; } BasicSliceInput input = shape.getInput(); Envelope overallEnvelope = null; if (input.available() > 0) { byte code = input.readByte(); boolean isGeometryCollection = code == GeometryTypeName.GEOMETRY_COLLECTION.ordinal(); while (input.available() > 0) { int length = isGeometryCollection ? input.readInt() : input.available(); ByteBuffer buffer = input.readSlice(length).toByteBuffer().order(LITTLE_ENDIAN); int type = buffer.getInt(); Envelope envelope = null; if (type == POINT_TYPE) { double x = buffer.getDouble(); double y = buffer.getDouble(); if (!isEsriNaN(x)) { Verify.verify(!isEsriNaN(y)); envelope = new Envelope(x, y, x, y); } } else { double xMin = buffer.getDouble(); double yMin = buffer.getDouble(); double xMax = buffer.getDouble(); double yMax = buffer.getDouble(); if (!isEsriNaN(xMin)) { Verify.verify(!isEsriNaN(xMax)); Verify.verify(!isEsriNaN(yMin)); Verify.verify(!isEsriNaN(yMax)); envelope = new Envelope(xMin, yMin, xMax, yMax); } } if (envelope != null) { if (overallEnvelope == null) { overallEnvelope = envelope; } else { overallEnvelope.merge(envelope); } } } } return overallEnvelope; }

Target:
public static Envelope deserializeEnvelope(Slice shape) { if (shape == null) { return null; } BasicSliceInput input = shape.getInput(); Envelope overallEnvelope = null; if (input.available() > 0) { byte code = input.readByte(); boolean isGeometryCollection = (code == GeometryTypeName.GEOMETRY_COLLECTION.code()); while (input.available() > 0) { int length = isGeometryCollection ? input.readInt() : input.available(); ByteBuffer buffer = input.readSlice(length).toByteBuffer().order(LITTLE_ENDIAN); int type = buffer.getInt(); Envelope envelope = null; if (type == POINT_TYPE) { double x = buffer.getDouble(); double y = buffer.getDouble(); if (!isEsriNaN(x)) { Verify.verify(!isEsriNaN(y)); envelope = new Envelope(x, y, x, y); } } else { double xMin = buffer.getDouble(); double yMin = buffer.getDouble(); double xMax = buffer.getDouble(); double yMax = buffer.getDouble(); if (!isEsriNaN(xMin)) { Verify.verify(!isEsriNaN(xMax)); Verify.verify(!isEsriNaN(yMin)); Verify.verify(!isEsriNaN(yMax)); envelope = new Envelope(xMin, yMin, xMax, yMax); } } if (envelope != null) { if (overallEnvelope == null) { overallEnvelope = envelope; } else { overallEnvelope.merge(envelope); } } } } return overallEnvelope; }
Source:
public static ColumnStatisticMetadata deserialize(String value) { int separatorIndex = value.indexOf(':'); verify(separatorIndex >= 0, "separator not found: %s", value); String statisticTypeString = value.substring(0, separatorIndex); String columnNameString = value.substring(separatorIndex + 1); return new ColumnStatisticMetadata(columnNameString, ColumnStatisticType.valueOf(statisticTypeString)); }

Target:
static ColumnStatisticMetadata deserialize(String value) { int separatorIndex = value.indexOf(':'); checkArgument(separatorIndex >= 0, "separator not found: %s", value); String statisticType = value.substring(0, separatorIndex); String column = value.substring(separatorIndex + 1); return new ColumnStatisticMetadata(column, ColumnStatisticType.valueOf(statisticType)); }
Source:
public HttpRequest filter(HttpRequest request) throws HttpException { utils.logRequest(signatureLog, request, ">>"); Credentials creds = this.creds.get(); Authorization auth = cache.getUnchecked(creds); URI endpoint = request.getEndpoint(); if (!endpoint.getHost().equals("localhost")) { endpoint = URI.create(auth.apiUrl() + endpoint.getPath() + (endpoint.getQuery() == null ? "" : "?" + endpoint.getQuery())); } request = request.toBuilder() .endpoint(endpoint) .replaceHeader("Authorization", auth.authorizationToken()) .build(); utils.logRequest(signatureLog, request, "<<"); return request; }

Target:
public HttpRequest filter(HttpRequest request) throws HttpException { Credentials creds = this.creds.get(); Authorization auth = this.auth.get(); URI endpoint = request.getEndpoint(); endpoint = URI.create(auth.apiUrl() + (endpoint.getPort() == -1 ? "" : ":" + endpoint.getPort()) + endpoint.getPath() + (endpoint.getQuery() == null ? "" : "?" + endpoint.getQuery())); request = request.toBuilder() .endpoint(endpoint) .replaceHeader(HttpHeaders.AUTHORIZATION, auth.authorizationToken()) .build(); return request; }
Source:
public static void validateJson(String expectedJson, String actualJson, JSONCompareMode jsonCompareMode) { try { JSONAssert.assertEquals(expectedJson, actualJson, new JsonKeywordsComparator(jsonCompareMode)); } catch (JSONException e) { throw new RuntimeException(e); } }

Target:
public static void validateJson(String expectedJson, String actualJson, JSONCompareMode jsonCompareMode) { try { JSONAssert.assertEquals(expectedJson, actualJson, new JsonKeywordsComparator(jsonCompareMode)); } catch (JSONException e) { throw new AssertionError(e); } }
Source:
void reallocate(PooledByteBuf<T> buf, int newCapacity, boolean freeOldMemory) { checkPositiveOrZero(newCapacity, "newCapacity"); if (newCapacity > buf.maxCapacity()) { throw new IllegalArgumentException("newCapacity: " + newCapacity); } int oldCapacity = buf.length; if (oldCapacity == newCapacity) { return; } PoolChunk<T> oldChunk = buf.chunk; ByteBuffer oldNioBuffer = buf.tmpNioBuf; long oldHandle = buf.handle; T oldMemory = buf.memory; int oldOffset = buf.offset; int oldMaxLength = buf.maxLength; int readerIndex = buf.readerIndex(); int writerIndex = buf.writerIndex(); allocate(parent.threadCache(), buf, newCapacity); if (newCapacity > oldCapacity) { memoryCopy( oldMemory, oldOffset, buf.memory, buf.offset, oldCapacity); } else if (newCapacity < oldCapacity) { if (readerIndex < newCapacity) { if (writerIndex > newCapacity) { writerIndex = newCapacity; } memoryCopy( oldMemory, oldOffset + readerIndex, buf.memory, buf.offset + readerIndex, writerIndex - readerIndex); } else { readerIndex = writerIndex = newCapacity; } } buf.setIndex(readerIndex, writerIndex); if (freeOldMemory) { free(oldChunk, oldNioBuffer, oldHandle, oldMaxLength, buf.cache); } }

Target:
void reallocate(PooledByteBuf<T> buf, int newCapacity, boolean freeOldMemory) { if (newCapacity < 0 || newCapacity > buf.maxCapacity()) { throw new IllegalArgumentException("newCapacity: " + newCapacity); } int oldCapacity = buf.length; if (oldCapacity == newCapacity) { return; } PoolChunk<T> oldChunk = buf.chunk; ByteBuffer oldNioBuffer = buf.tmpNioBuf; long oldHandle = buf.handle; T oldMemory = buf.memory; int oldOffset = buf.offset; int oldMaxLength = buf.maxLength; int readerIndex = buf.readerIndex(); int writerIndex = buf.writerIndex(); allocate(parent.threadCache(), buf, newCapacity); if (newCapacity > oldCapacity) { memoryCopy( oldMemory, oldOffset, buf.memory, buf.offset, oldCapacity); } else if (newCapacity < oldCapacity) { if (readerIndex < newCapacity) { if (writerIndex > newCapacity) { writerIndex = newCapacity; } memoryCopy( oldMemory, oldOffset + readerIndex, buf.memory, buf.offset + readerIndex, writerIndex - readerIndex); } else { readerIndex = writerIndex = newCapacity; } } buf.setIndex(readerIndex, writerIndex); if (freeOldMemory) { free(oldChunk, oldNioBuffer, oldHandle, oldMaxLength, buf.cache); } }
Source:
public void writeExternal(DataOutputStream out) throws IOException { ExtUtil.write(out, nodesetRef); ExtUtil.write(out, new ExtWrapTagged(nodesetExpr)); ExtUtil.write(out, contextRef); ExtUtil.write(out, labelRef); ExtUtil.write(out, new ExtWrapTagged(labelExpr)); ExtUtil.write(out, new ExtWrapNullable(valueRef)); ExtUtil.write(out, new ExtWrapNullable(valueExpr == null ? null : new ExtWrapTagged(valueExpr))); ExtUtil.write(out, new ExtWrapNullable(copyRef)); ExtUtil.writeBool(out, labelIsItext); ExtUtil.writeBool(out, copyMode); ExtUtil.write(out, sortRef); ExtUtil.write(out, new ExtWrapTagged(sortExpr)); }

Target:
public void writeExternal(DataOutputStream out) throws IOException { ExtUtil.write(out, nodesetRef); ExtUtil.write(out, new ExtWrapTagged(nodesetExpr)); ExtUtil.write(out, contextRef); ExtUtil.write(out, labelRef); ExtUtil.write(out, new ExtWrapTagged(labelExpr)); ExtUtil.write(out, new ExtWrapNullable(valueRef)); ExtUtil.write(out, new ExtWrapNullable(valueExpr == null ? null : new ExtWrapTagged(valueExpr))); ExtUtil.write(out, new ExtWrapNullable(copyRef)); ExtUtil.writeBool(out, labelIsItext); ExtUtil.writeBool(out, copyMode); ExtUtil.write(out, new ExtWrapNullable(sortRef)); ExtUtil.write(out, new ExtWrapNullable(sortExpr == null ? null : new ExtWrapTagged(sortExpr))); }
Source:
private List<String> getTrashedResourcesId(List<String> resourceIds, List<String> archivedResources) { List<String> trashedResources = null; Iterator<String> it = resourceIds.iterator(); String id = null; while (it.hasNext()) { id = (String) it.next(); if (null == archivedResources || !archivedResources.contains(id)) { ResourceInterface resourceInterface = null; try { resourceInterface = this.getTrashedResourceManager().loadTrashedResource(id); if (null != resourceInterface) { if (null == trashedResources) { trashedResources = new ArrayList<String>(); } trashedResources.add(id); } } catch (Throwable t) { logger.error("Errore in verifica risorsa " + id, t); throw new RuntimeException("Errore in verifica risorsa cestinata, id " + id, t); } } } return trashedResources; }

Target:
private List<String> getTrashedResourcesId(List<String> resourceIds, List<String> archivedResources) { List<String> trashedResources = null; Iterator<String> it = resourceIds.iterator(); String id = null; while (it.hasNext()) { id = (String) it.next(); if (null == archivedResources || !archivedResources.contains(id)) { ResourceInterface resourceInterface = null; try { resourceInterface = this.getTrashedResourceManager().loadTrashedResource(id); if (null != resourceInterface) { if (null == trashedResources) { trashedResources = new ArrayList<>(); } trashedResources.add(id); } } catch (Throwable t) { logger.error("Error checking resource " + id, t); throw new RuntimeException("Error checking resource " + id, t); } } } return trashedResources; }
Source:
private void addMetadataHeaderLine(final VCFHeaderLine line) { if ( line instanceof VCFInfoHeaderLine ) { final VCFInfoHeaderLine infoLine = (VCFInfoHeaderLine)line; addMetaDataMapBinding(mInfoMetaData, infoLine); } else if ( line instanceof VCFFormatHeaderLine ) { final VCFFormatHeaderLine formatLine = (VCFFormatHeaderLine)line; addMetaDataMapBinding(mFormatMetaData, formatLine); if ( hasFormatLine(VCFConstants.GENOTYPE_LIKELIHOODS_KEY) && ! hasFormatLine(VCFConstants.GENOTYPE_PL_KEY) ) { if ( GeneralUtils.DEBUG_MODE_ENABLED ) { System.err.println("Found " + VCFConstants.GENOTYPE_LIKELIHOODS_KEY + " format, but no " + VCFConstants.GENOTYPE_PL_KEY + " field. We now only manage PL fields internally" + " automatically adding a corresponding PL field to your VCF header"); } addMetaDataLine(new VCFFormatHeaderLine(VCFConstants.GENOTYPE_PL_KEY, VCFHeaderLineCount.G, VCFHeaderLineType.Integer, "Normalized, Phred-scaled likelihoods for genotypes as defined in the VCF specification")); } } else if ( line instanceof VCFFilterHeaderLine ) { final VCFFilterHeaderLine filterLine = (VCFFilterHeaderLine)line; mFilterMetaData.put(filterLine.getID(), filterLine); } else if ( line instanceof VCFContigHeaderLine ) { contigMetaData.add((VCFContigHeaderLine)line); } else { mOtherMetaData.put(line.getKey(), line); } }

Target:
private void addMetadataHeaderLine(final VCFHeaderLine line) { if ( line instanceof VCFInfoHeaderLine ) { final VCFInfoHeaderLine infoLine = (VCFInfoHeaderLine)line; addMetaDataMapBinding(mInfoMetaData, infoLine.getID(), infoLine); } else if ( line instanceof VCFFormatHeaderLine ) { final VCFFormatHeaderLine formatLine = (VCFFormatHeaderLine)line; addMetaDataMapBinding(mFormatMetaData, formatLine.getID(), formatLine); if ( hasFormatLine(VCFConstants.GENOTYPE_LIKELIHOODS_KEY) && ! hasFormatLine(VCFConstants.GENOTYPE_PL_KEY) ) { if ( GeneralUtils.DEBUG_MODE_ENABLED ) { System.err.println("Found " + VCFConstants.GENOTYPE_LIKELIHOODS_KEY + " format, but no " + VCFConstants.GENOTYPE_PL_KEY + " field. We now only manage PL fields internally" + " automatically adding a corresponding PL field to your VCF header"); } addMetadataHeaderLine(new VCFFormatHeaderLine(VCFConstants.GENOTYPE_PL_KEY, VCFHeaderLineCount.G, VCFHeaderLineType.Integer, "Normalized, Phred-scaled likelihoods for genotypes as defined in the VCF specification")); } } else if ( line instanceof VCFFilterHeaderLine ) { final VCFFilterHeaderLine filterLine = (VCFFilterHeaderLine)line; addMetaDataMapBinding(mFilterMetaData, filterLine.getID(), filterLine); } else if ( line instanceof VCFContigHeaderLine ) { addContigMetaDataLine((VCFContigHeaderLine) line); } else { addMetaDataMapBinding(mOtherMetaData, line.getKey(), line); } }
Source:
public DynamicBooleanProperty(String propName, boolean defaultValue) { super(propName, Boolean.valueOf(defaultValue)); this.primitiveValue = chooseValue(); this.prop.addCallback(new Runnable() { @Override public void run() { primitiveValue = chooseValue(); } }); }

Target:
public DynamicBooleanProperty(String propName, boolean defaultValue) { super(propName, Boolean.valueOf(defaultValue)); }
Source:
static List<Interval> sortAndAddSkipIntervalFromLatest( DateTime latest, Period skipOffset, @Nullable List<Interval> skipIntervals ) { final List<Interval> nonNullSkipIntervals = skipIntervals == null ? new ArrayList<>() : new ArrayList<>(skipIntervals.size()); if (skipIntervals != null) { final List<Interval> sortedSkipIntervals = new ArrayList<>(skipIntervals); sortedSkipIntervals.sort(Comparators.intervalsByStartThenEnd()); final List<Interval> overlapIntervals = new ArrayList<>(); final Interval skipFromLatest = new Interval(skipOffset, latest); for (Interval interval : sortedSkipIntervals) { if (interval.overlaps(skipFromLatest)) { overlapIntervals.add(interval); } else { nonNullSkipIntervals.add(interval); } } if (!overlapIntervals.isEmpty()) { overlapIntervals.add(skipFromLatest); nonNullSkipIntervals.add(JodaUtils.umbrellaInterval(overlapIntervals)); } else { nonNullSkipIntervals.add(skipFromLatest); } } else { final Interval skipFromLatest = new Interval(skipOffset, latest); nonNullSkipIntervals.add(skipFromLatest); } return nonNullSkipIntervals; }

Target:
static List<Interval> sortAndAddSkipIntervalFromLatest( DateTime latest, Period skipOffset, @Nullable List<Interval> skipIntervals ) { final List<Interval> nonNullSkipIntervals = skipIntervals == null ? new ArrayList<>(1) : new ArrayList<>(skipIntervals.size()); if (skipIntervals != null) { final List<Interval> sortedSkipIntervals = new ArrayList<>(skipIntervals); sortedSkipIntervals.sort(Comparators.intervalsByStartThenEnd()); final List<Interval> overlapIntervals = new ArrayList<>(); final Interval skipFromLatest = new Interval(skipOffset, latest); for (Interval interval : sortedSkipIntervals) { if (interval.overlaps(skipFromLatest)) { overlapIntervals.add(interval); } else { nonNullSkipIntervals.add(interval); } } if (!overlapIntervals.isEmpty()) { overlapIntervals.add(skipFromLatest); nonNullSkipIntervals.add(JodaUtils.umbrellaInterval(overlapIntervals)); } else { nonNullSkipIntervals.add(skipFromLatest); } } else { final Interval skipFromLatest = new Interval(skipOffset, latest); nonNullSkipIntervals.add(skipFromLatest); } return nonNullSkipIntervals; }
Source:
DockerRegistryToken getToken(Item context) { if (credentialsId == null) { return null; } List<DomainRequirement> requirements = Collections.emptyList(); try { requirements = Collections.<DomainRequirement>singletonList(new HostnameRequirement(getEffectiveUrl().getHost())); } catch (IOException e) { } Authentication runAuth = context instanceof Queue.Task ? Tasks.getAuthenticationOf((Queue.Task) context) : ACL.SYSTEM; List<IdCredentials> candidates = new ArrayList(); candidates.addAll(CredentialsProvider.lookupCredentials(IdCredentials.class, context, runAuth, requirements)); if (runAuth != ACL.SYSTEM && context.getACL().hasPermission(runAuth, CredentialsProvider.USE_ITEM)) { candidates.addAll(CredentialsProvider.lookupCredentials(IdCredentials.class, context, ACL.SYSTEM, requirements)); } return AuthenticationTokens.convert(DockerRegistryToken.class, firstOrNull(candidates, allOf(AuthenticationTokens.matcher(DockerRegistryToken.class), withId(credentialsId)))); }

Target:
public @CheckForNull DockerRegistryToken getToken(Item context) { if (credentialsId == null) { return null; } List<DomainRequirement> requirements = Collections.emptyList(); try { requirements = Collections.<DomainRequirement>singletonList(new HostnameRequirement(getEffectiveUrl().getHost())); } catch (IOException e) { } return AuthenticationTokens.convert(DockerRegistryToken.class, firstOrNull(CredentialsProvider.lookupCredentials( IdCredentials.class, context, Jenkins.getAuthentication(), requirements), allOf(AuthenticationTokens.matcher(DockerRegistryToken.class), withId(credentialsId)))); }
Source:
OperationController() throws IOException { try { ConnectionManagerFactory connectionManagerFactory = Utils .getObj(routerConfig.routerConnectionManagerFactory, networkMetrics, networkConfig, sslConfig, routerConfig.routerMaxConnectionsPerPortPlainText, routerConfig.routerMaxConnectionsPerPortSsl, time); connectionManager = connectionManagerFactory.getConnectionManager(); } catch (Exception e) { throw new IOException("Could not create connection manager using the given connection manager " + "factory"); } putManager = new PutManager(routerConfig.routerMaxPutChunkSizeBytes, connectionManager, routerConfig, clusterMap); getManager = new GetManager(connectionManager, clusterMap); deleteManager = new DeleteManager(connectionManager, clusterMap); requestResponseHandlerThread = Utils.newThread("RequestResponseHandlerThread", this, true); requestResponseHandlerThread.start(); }

Target:
OperationController() throws IOException { RouterNetworkComponents networkComponents = routerNetworkComponentsFactory.getRouterNetworkComponents(); selector = networkComponents.getSelector(); connectionManager = networkComponents.getConnectionManager(); putManager = new PutManager(routerConfig.routerMaxPutChunkSizeBytes, connectionManager, routerConfig, clusterMap); getManager = new GetManager(connectionManager, clusterMap); deleteManager = new DeleteManager(connectionManager, clusterMap); requestResponseHandlerThread = Utils.newThread("RequestResponseHandlerThread", this, true); requestResponseHandlerThread.start(); }
Source:
private void setupListHeaderView() { View headerView = getLayoutInflater().inflate(R.layout.activity_claim_header, getListView(), false); nameField = (EditText)headerView.findViewById(R.id.et_name); nameField.setText(claim.getName()); descriptionField = (EditText)headerView.findViewById(R.id.et_description); descriptionField.setText(claim.getDescription()); startDateField = (DateEditText)headerView.findViewById(R.id.et_start_date); startDateField.setDate(claim.getStartDate()); startDateField.setOnDateChangedListener(new DateEditText.OnDateChangedListener() { @Override public void onDateChanged(DateEditText view, Date date) { endDateField.setMinDate(date); } }); endDateField = (DateEditText)headerView.findViewById(R.id.et_end_date); endDateField.setDate(claim.getEndDate()); endDateField.setOnDateChangedListener(new DateEditText.OnDateChangedListener() { @Override public void onDateChanged(DateEditText view, Date date) { startDateField.setMaxDate(date); } }); userField = (TextView)headerView.findViewById(R.id.tv_user); userField.append(claim.getUser().getName()); approverField = (TextView)headerView.findViewById(R.id.tv_approver); try{ approverField.append(claim.getApprover().getName()); } catch(NullPointerException e){ } comments = (EditText)headerView.findViewById(R.id.et_comments); comments.setText(claim.getComments()); getListView().addHeaderView(headerView); }

Target:
private void setupListHeaderView() { View headerView = getLayoutInflater().inflate(R.layout.activity_claim_header, getListView(), false); nameField = (EditText)headerView.findViewById(R.id.et_name); nameField.setText(claim.getName()); descriptionField = (EditText)headerView.findViewById(R.id.et_description); descriptionField.setText(claim.getDescription()); startDateField = (DateEditText)headerView.findViewById(R.id.et_start_date); startDateField.setDate(claim.getStartDate()); startDateField.setOnDateChangedListener(new DateEditText.OnDateChangedListener() { @Override public void onDateChanged(DateEditText view, Date date) { endDateField.setMinDate(date); } }); endDateField = (DateEditText)headerView.findViewById(R.id.et_end_date); endDateField.setDate(claim.getEndDate()); endDateField.setOnDateChangedListener(new DateEditText.OnDateChangedListener() { @Override public void onDateChanged(DateEditText view, Date date) { startDateField.setMaxDate(date); } }); userField = (TextView)headerView.findViewById(R.id.tv_user); userField.append(claim.getUser().getName()); approverField = (TextView)headerView.findViewById(R.id.tv_approver); approverField.append(claim.getApprover().getName()); comments = (EditText)headerView.findViewById(R.id.et_comments); comments.setText(claim.getComments()); getListView().addHeaderView(headerView); }
Source:
private File prepareSiteTest(String testPath, String latestDir) throws Exception { File testDir = prepareSiteTest(testPath); File testTargetDir = this.buildFile(testDir, "target", "pit-reports"); DirectoriesOnlyWalker walker = new DirectoriesOnlyWalker(); for(File f : walker.locateDirectories(testTargetDir)) { f.setLastModified(0L); } buildFile(testTargetDir, latestDir).setLastModified(System.currentTimeMillis()); return testDir; }

Target:
private File prepareSiteTest(String testPath, String latestDir) throws Exception { File testDir = prepareSiteTest(testPath); File testTargetDir = this.buildFilePath(testDir, "target", "pit-reports"); DirectoriesOnlyWalker walker = new DirectoriesOnlyWalker(); for(File f : walker.locateDirectories(testTargetDir)) { f.setLastModified(0L); } assertThat(buildFilePath(testTargetDir, latestDir).setLastModified(System.currentTimeMillis())).isTrue(); return testDir; }
Source:
public FilterDTO update(final FilterDTO dto) throws EntityRetrievalException { FilterEntity entity = new FilterEntity(); entity.setFilter(dto.getFilter()); entity.setLastModifiedUser(Util.getAuditId()); entity.setFilterType(new FilterTypeEntity()); entity.getFilterType().setId(dto.getFilterType().getId()); entity.getFilterType().setName(dto.getFilterType().getName()); entity.setUser(getUserEntityById(dto.getUser().getId())); entity.setDeleted(false); entity.setLastModifiedUser(Util.getAuditId()); entityManager.merge(entity); entityManager.flush(); return new FilterDTO(entity); }

Target:
public FilterDTO update(final FilterDTO dto) throws EntityRetrievalException { FilterEntity entity = getEntityById(dto.getId()); entity.setFilter(dto.getFilter()); entity.setLastModifiedUser(Util.getAuditId()); entity.setFilterType(new FilterTypeEntity()); entity.getFilterType().setId(dto.getFilterType().getId()); entity.getFilterType().setName(dto.getFilterType().getName()); entity.setUserId(dto.getUser().getId()); entity.setDeleted(false); entity.setLastModifiedUser(Util.getAuditId()); entityManager.merge(entity); entityManager.flush(); return new FilterDTO(entity); }
Source:
protected SSHClient connect(String serverName) { SSHClient client = new SSHClient(); Integer timeout = Config.<Integer> GetValue(ConfigValues.ConnectToServerTimeoutInSeconds) * 1000; client.setHardTimeout(timeout); client.setSoftTimeout(timeout); client.setHost(serverName, SSH_PORT); try { client.connect(); return client; } catch (Exception e) { log.debug(String.format("Could not connect to server %1$s: %2$s", serverName, e.getMessage())); throw new RuntimeException(e); } }

Target:
protected EngineSSHClient connect(String serverName) { EngineSSHClient client = new EngineSSHClient(); Integer timeout = Config.<Integer> GetValue(ConfigValues.ConnectToServerTimeoutInSeconds) * 1000; client.setHardTimeout(timeout); client.setSoftTimeout(timeout); client.setHost(serverName, SSH_PORT); try { client.connect(); return client; } catch (Exception e) { log.debug(String.format("Could not connect to server %1$s: %2$s", serverName, e.getMessage())); throw new RuntimeException(e); } }
Source:
private EditPart getEditPart(final String semanticElement) { modelSetFixture.getPageManager().openPage(diagram); View diagramView = DiagramUtils.findShape(diagram, semanticElement); if (diagramView == null) { diagramView = DiagramUtils.findEdge(diagram, semanticElement); } if (diagramView == null) { Iterator<?> iterator = diagram.eAllContents(); while (null == diagramView && iterator.hasNext()) { Object object = iterator.next(); if (object instanceof View) { diagramView = DiagramUtils.findShape((View) object, semanticElement); if (diagramView == null) { diagramView = DiagramUtils.findEdge((View) object, semanticElement); } } } } assertNotNull(diagramView); IGraphicalEditPart semanticEP = DiagramUtils.findEditPartforView(modelSetFixture.getEditor(), diagramView, IGraphicalEditPart.class); assertNotNull(semanticEP); return semanticEP; }

Target:
private EditPart getEditPart(final String semanticElement) { modelSetFixture.getPageManager().openPage(diagram); View diagramView = DiagramUtils.findShape(diagram, semanticElement); if (null == diagramView) { diagramView = DiagramUtils.findEdge(diagram, semanticElement); } if (null == diagramView) { Iterator<?> iterator = diagram.eAllContents(); while (null == diagramView && iterator.hasNext()) { Object object = iterator.next(); if (object instanceof View) { diagramView = DiagramUtils.findShape((View) object, semanticElement); if (null == diagramView) { diagramView = DiagramUtils.findEdge((View) object, semanticElement); } } } } assertNotNull(diagramView); IGraphicalEditPart semanticEP = DiagramUtils.findEditPartforView(modelSetFixture.getEditor(), diagramView, IGraphicalEditPart.class); assertNotNull(semanticEP); return semanticEP; }
Source:
private NodeIterator getNodeIterator(SessionProvider sProvider, Node node, String nodeType, StringBuilder strQuery) throws Exception { try { StringBuilder pathQuery = new StringBuilder(Utils.JCR_ROOT).append(node.getPath()).append(" strQuery = pathQuery; QueryManager qm = node.getSession().getWorkspace().getQueryManager(); Query query = qm.createQuery(pathQuery.toString(), Query.XPATH); QueryResult result = query.execute(); return result.getNodes(); } catch (Exception e) { log.error(String.format("\n Get not by query %s is failed.", strQuery), e); return null; } }

Target:
private NodeIterator getNodeIterator(SessionProvider sProvider, Node node, String nodeType, StringBuilder strQuery) throws Exception { try { StringBuilder pathQuery = new StringBuilder(Utils.JCR_ROOT).append(node.getPath()).append(" strQuery = pathQuery; QueryManager qm = node.getSession().getWorkspace().getQueryManager(); Query query = qm.createQuery(pathQuery.toString(), Query.XPATH); QueryResult result = query.execute(); return result.getNodes(); } catch (Exception e) { log.error(String.format("\n Get node iterator by query %s is failed.", strQuery), e); return null; } }
Source:
public static FeatureCollection<?, ?> transformIfNecessary( Layer layer, Rectangle paintArea, double mapScale, FeatureType schema, FeatureCollection<?, ?> features) throws IOException { List<LiteFeatureTypeStyle> featureTypeStyles = VectorMapRenderUtils.getFeatureStyles(layer, paintArea, mapScale, schema); if (!featureTypeStyles.isEmpty() && featureTypeStyles.get(0).transformation != null) { Expression transform = featureTypeStyles.get(0).transformation; return (FeatureCollection<?, ?>) transform.evaluate(features); } else { return features; } }

Target:
public static FeatureCollection<?, ?> transformIfNecessary( Layer layer, Rectangle paintArea, double mapScale, FeatureType schema, FeatureCollection<?, ?> features) throws IOException { List<LiteFeatureTypeStyle> featureTypeStyles = VectorMapRenderUtils.getFeatureStyles(layer, paintArea, mapScale, schema); if (!featureTypeStyles.isEmpty()) { for (LiteFeatureTypeStyle featureTypeStyle : featureTypeStyles) { try { if (featureTypeStyle.transformation != null) { Expression transform = featureTypeStyle.transformation; features = (FeatureCollection<?, ?>) transform.evaluate(features); } } catch (Exception ex) { if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.log(Level.WARNING, "Error while appliying transformation", ex); } } } } return features; }
Source:
public CompiledScript getCompiledScript(String packageAndClassName) throws ScriptException { CompiledScript compiledScript = compiledScripts.get(packageAndClassName); if (compiledScript == null) { String source = sources.get(packageAndClassName); final String lang; if (isJavascriptSource(source)) lang = "javascript"; else throw new IllegalStateException("Unkown language for " + source); final Compilable jsEngine = (Compilable) new ScriptEngineManager().getEngineByName(lang); compiledScript = jsEngine.compile(source); compiledScripts.put(packageAndClassName, compiledScript); } return compiledScript; }

Target:
public CompiledScript getCompiledScript(String packageAndClassName) throws ScriptException { CompiledScript compiledScript = compiledScripts.get(packageAndClassName); if (compiledScript == null) { String source = sources.get(packageAndClassName); final String lang; if (isJavascriptSource(source)) lang = "javascript"; else if (isRubySource(source)) lang = "ruby"; else throw new IllegalStateException("Unknown language for " + source); final Compilable jsEngine = (Compilable) new ScriptEngineManager().getEngineByName(lang); compiledScript = jsEngine.compile(source); compiledScripts.put(packageAndClassName, compiledScript); } return compiledScript; }
Source:
public AmbariServiceNodeDiscoverer(String apiRootUrl, String username, String password) { this.apiRootUrl = apiRootUrl; this.username = username; this.password = password; setupClient(); }

Target:
public AmbariServiceNodeDiscoverer(String apiRootUrl, String username, String password) { this.apiRootUrl = apiRootUrl; this.username = username; this.password = password; }
Source:
private void copyKeyAndLink() { List<BibEntry> entries = stateManager.getSelectedEntries(); StringBuilder keyAndLink = new StringBuilder(); List<BibEntry> entriesWithKey = entries.stream() .filter(BibEntry::hasCiteKey) .collect(Collectors.toList()); if (entriesWithKey.isEmpty()) { dialogService.notify(Localization.lang("None of the selected entries have citation keys.")); return; } for (BibEntry entry : entriesWithKey) { String key = entry.getCiteKeyOptional().get(); String url = entry.getField(StandardField.URL).orElse(""); keyAndLink.append(url.isEmpty() ? key : String.format("<a href=\"%s\">%s</a>", url, key)); keyAndLink.append(OS.NEWLINE); } clipBoardManager.setContent(keyAndLink.toString()); if (entriesWithKey.size() == entries.size()) { dialogService.notify(Localization.lang("Copied '%0' to clipboard.", JabRefDialogService.shortenDialogMessage(keyAndLink.toString()))); } else { dialogService.notify(Localization.lang("Warning: %0 out of %1 entries have undefined citation key.", Long.toString(entries.size() - entriesWithKey.size()), Integer.toString(entries.size()))); } }

Target:
private void copyKeyAndLink() { List<BibEntry> entries = stateManager.getSelectedEntries(); StringBuilder keyAndLink = new StringBuilder(); StringBuilder fallbackString = new StringBuilder(); List<BibEntry> entriesWithKey = entries.stream() .filter(BibEntry::hasCitationKey) .collect(Collectors.toList()); if (entriesWithKey.isEmpty()) { dialogService.notify(Localization.lang("None of the selected entries have citation keys.")); return; } for (BibEntry entry : entriesWithKey) { String key = entry.getCitationKey().get(); String url = entry.getField(StandardField.URL).orElse(""); keyAndLink.append(url.isEmpty() ? key : String.format("<a href=\"%s\">%s</a>", url, key)); keyAndLink.append(OS.NEWLINE); fallbackString.append(url.isEmpty() ? key : String.format("%s - %s", key, url)); fallbackString.append(OS.NEWLINE); } clipBoardManager.setHtmlContent(keyAndLink.toString(), fallbackString.toString()); if (entriesWithKey.size() == entries.size()) { dialogService.notify(Localization.lang("Copied '%0' to clipboard.", JabRefDialogService.shortenDialogMessage(keyAndLink.toString()))); } else { dialogService.notify(Localization.lang("Warning: %0 out of %1 entries have undefined citation key.", Long.toString(entries.size() - entriesWithKey.size()), Integer.toString(entries.size()))); } }
Source:
@Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { if (requestCode == REQUEST_READ_CONTACTS) { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { loadContacts(); } else { Toast.makeText(getApplicationContext(), "Read contacts permission denied", Toast.LENGTH_LONG).show(); finish(); } } else { super.onRequestPermissionsResult(requestCode, permissions, grantResults); } }

Target:
@Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { if (requestCode == REQUEST_READ_CONTACTS) { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { loadContacts(); } else { Toast.makeText(this, "Read contacts permission denied", Toast.LENGTH_LONG).show(); finish(); } } else { super.onRequestPermissionsResult(requestCode, permissions, grantResults); } }
Source:
private void initLegacyStep() { if (steps == null) { steps = new ArrayList<>(); } if (step == null) { step = new Step(); Response response = new Response(); response.setAssertions(Collections.singletonList(Response.DEFAULT_ASSERTION)); step.setResponse(response); steps.add(step); } }

Target:
private void initLegacyStep() { if (steps == null) { steps = new ArrayList<>(); } if (step == null) { step = new Step(); step.setResponse(Response.DEFAULT_RESPONSE); steps.add(step); } }
Source:
protected boolean copyDatabaseCreationScript() { String creationScriptContents = DatastoreMixins.getDatabaseCreationScriptAsString(entity); if (creationScriptContents==null) return false; creationScriptContents = processTemplateContents(creationScriptContents); Reader creationContents = new StringReader(creationScriptContents); getMachine().copyTo(creationContents, getRunDir() + "/creation-script.sql"); return true; }

Target:
protected boolean copyDatabaseCreationScript() { String creationScriptContents = DatastoreMixins.getDatabaseCreationScriptAsString(entity); if (creationScriptContents==null) return false; File templateFile; try { templateFile = File.createTempFile("mysql", null); templateFile.deleteOnExit(); BufferedWriter writer = new BufferedWriter(new FileWriter(templateFile)); writer.write (creationScriptContents); } catch (IOException e) { throw Exceptions.propagate(e); } copyTemplate(templateFile.getAbsoluteFile(), getRunDir() + "/creation-script.sql"); templateFile.delete(); return true; }