auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean isValidRadioField(FieldForm fieldForm, ActionRequest req){ boolean isValid = true; final int EVEN_NUMBER = 2; String dataType = fieldForm.getDataType(); String values = fieldForm.getValues(); String temp = values.replaceAll("\r\n","|"); String[] tempVals = StringUtil.split(temp.trim(), "|"); if (tempVals.length % EVEN_NUMBER == 1){ SessionMessages.add(req, "error", "message.structure.missingdatavalue"); return false; } else if(dataType.equals(DataTypes.BOOL.toString())){ for(int i=1;i<tempVals.length;i+= 2){ if(!DbConnectionFactory.isDBBoolean(tempVals[i])){ String message = "message.structure.invaliddataboolean"; SessionMessages.add(req, "error", message); return false; } } } else if(dataType.equals(DataTypes.FLOAT.toString())){ try { for(int i=1;i<tempVals.length;i+= 2){ Float.parseFloat(tempVals[i]); } }catch (NumberFormatException e) { String message = "message.structure.invaliddata"; SessionMessages.add(req, "error", message); return false; } } else if(dataType.equals(DataTypes.INTEGER.toString())){ try { for(int i=1;i<tempVals.length;i+= 2) { Integer.parseInt(tempVals[i]); } }catch (NumberFormatException e) { String message = "message.structure.invaliddata"; SessionMessages.add(req, "error", message); return false; } } return isValid; }

Target:
private boolean isValidRadioField(FieldForm fieldForm, ActionRequest req){ boolean isValid = true; final int EVEN_NUMBER = 2; final int ADD_NUMBER = 2; String dataType = fieldForm.getDataType(); String values = fieldForm.getValues(); String temp = values.replaceAll("\r\n","|"); String[] tempVals = StringUtil.split(temp.trim(), "|"); if (tempVals.length % EVEN_NUMBER == 1){ SessionMessages.add(req, ERROR, MISSING_DATA_VALUE_MESSAGE); isValid = false; } else if(dataType.equals(DataTypes.BOOL.toString())){ for(int i=1;i<tempVals.length;i+= ADD_NUMBER){ if(!DbConnectionFactory.isDBBoolean(tempVals[i])){ SessionMessages.add(req, ERROR, INVALIDATE_DATA_BOOLEAN_MESSAGE); isValid = false; } } } else if(dataType.equals(DataTypes.FLOAT.toString())){ try { for(int i=1;i<tempVals.length;i+= ADD_NUMBER){ Float.parseFloat(tempVals[i]); } }catch (NumberFormatException e) { SessionMessages.add(req, ERROR, INVALIDATE_DATA_MESSAGE); isValid = false; } } else if(dataType.equals(DataTypes.INTEGER.toString())){ try { for(int i=1;i<tempVals.length;i+= ADD_NUMBER) { Integer.parseInt(tempVals[i]); } }catch (NumberFormatException e) { SessionMessages.add(req, ERROR, INVALIDATE_DATA_MESSAGE); isValid = false; } } return isValid; }
Source:
public BuildResult build() { try { checkHitPolicy(); makeRuleSet(); makeImports(); makeDeclare(); makeTable(); } catch (final UnsupportedOperationException e) { return new BuildResult(workbook, new XLSConversionResult(e.getMessage())); } catch (final Exception e) { e.printStackTrace(); return new BuildResult(workbook, new XLSConversionResult(e.toString() + " : " + e.getMessage())); } return new BuildResult(workbook, new XLSConversionResult()); }

Target:
public BuildResult build() { try { checkHitPolicy(); makeRuleSet(); makeImports(); makeDeclare(); makeTable(); } catch (final UnsupportedOperationException e) { return new BuildResult(workbook, new XLSConversionResult(e.getMessage())); } catch (final Exception e) { return new BuildResult(workbook, new XLSConversionResult(e.toString() + " : " + e.getMessage())); } return new BuildResult(workbook, new XLSConversionResult()); }
Source:
public SetupNetworksBondModel(boolean doesBondHaveVmNetworkAttached) { setBond(new SortedListModel<>(new LexoNumericComparator())); setBondingOptions(new ListModel<Map.Entry<String, EntityModel<String>>>()); Map.Entry<String, EntityModel<String>> defaultItem = null; RefObject<Map.Entry<String, EntityModel<String>>> tempRef_defaultItem = new RefObject<>(defaultItem); ArrayList<Map.Entry<String, EntityModel<String>>> list = AsyncDataProvider.getInstance().getBondingOptionListDependingOnNetwork(tempRef_defaultItem, doesBondHaveVmNetworkAttached); defaultItem = tempRef_defaultItem.argvalue; getBondingOptions().setItems(list); getBondingOptions().setSelectedItem(defaultItem); setCustomBondEditor(new EntityModel<String>()); getCustomBondEditor().getEntityChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { final String customBondValue = ((EntityModel<String>) sender).getEntity(); Map.Entry<String, EntityModel<String>> selectedItem = getBondingOptions().getSelectedItem(); if (selectedItem.getKey().equals(CUSTOM_BONDING_MODE)) { selectedItem.getValue().setEntity(customBondValue); } } }); getBondingOptions().getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { ListModel<Map.Entry<String, EntityModel<String>>> list = (ListModel<Map.Entry<String, EntityModel<String>>>) sender; updateBondOptions(list); } }); }

Target:
public SetupNetworksBondModel(boolean doesBondHaveVmNetworkAttached) { setBond(new SortedListModel<>(new LexoNumericComparator())); setBondingOptions(new ListModel<Map.Entry<String, EntityModel<String>>>()); Map.Entry<String, EntityModel<String>> defaultItem = null; RefObject<Map.Entry<String, EntityModel<String>>> tempRef_defaultItem = new RefObject<>(defaultItem); ArrayList<Map.Entry<String, EntityModel<String>>> list = AsyncDataProvider.getInstance().getBondingOptionListDependingOnNetwork(tempRef_defaultItem, doesBondHaveVmNetworkAttached); defaultItem = tempRef_defaultItem.argvalue; getBondingOptions().setItems(list); getBondingOptions().setSelectedItem(defaultItem); setCustomBondEditor(new EntityModel<String>()); getCustomBondEditor().getEntityChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { final String customBondValue = ((EntityModel<String>) sender).getEntity(); Map.Entry<String, EntityModel<String>> selectedItem = getBondingOptions().getSelectedItem(); if (selectedItem.getKey().equals(CUSTOM_BONDING_MODE)) { selectedItem.getValue().setEntity(customBondValue); } } }); onBondingOptionsSelectionChange(); getBondingOptions().getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { ListModel<Map.Entry<String, EntityModel<String>>> list = (ListModel<Map.Entry<String, EntityModel<String>>>) sender; onBondingOptionsSelectionChange(); } }); }
Source:
private static Object toThriftValue(Field field, Object value) { try { switch (field.getType()) { case TType.BOOL: return Boolean.valueOf(((Integer)value) != 0); case TType.BYTE : return ((Integer)value).byteValue(); case TType.I16 : return Short.valueOf(((Integer)value).shortValue()); case TType.STRING: return toStringType(value); case TType.STRUCT: return toThrift(field.gettStructDescriptor(), (Tuple)value); case TType.MAP: return toThriftMap(field, (Map<String, Object>)value); case TType.SET: return toThriftSet(field.getSetElemField(), (DataBag) value); case TType.LIST: return toThriftList(field.getListElemField(), (DataBag)value); case TType.ENUM: return toThriftEnum(field, value); default: return value; } } catch (Exception e) { ThriftToPig.LOG.warn("Exception while convering Tuple to Thrift. " + " from " + value.getClass() + " to " + field.getName() + (field.getFieldIdEnum() == null ? "" : "(field id : " + field.getFieldIdEnum().getClass() + ")"), e); } return null; }

Target:
private static Object toThriftValue(Field field, Object value) { try { switch (field.getType()) { case TType.BOOL: return Boolean.valueOf(((Integer)value) != 0); case TType.BYTE : return ((Integer)value).byteValue(); case TType.I16 : return Short.valueOf(((Integer)value).shortValue()); case TType.STRING: return toStringType(value); case TType.STRUCT: return toThrift(field.gettStructDescriptor(), (Tuple)value); case TType.MAP: return toThriftMap(field, (Map<String, Object>)value); case TType.SET: return toThriftSet(field.getSetElemField(), (DataBag) value); case TType.LIST: return toThriftList(field.getListElemField(), (DataBag)value); case TType.ENUM: return toThriftEnum(field, (String) value); default: return value; } } catch (Exception e) { LOG.warn(String.format( "Failed to set field '%s' of type '%s' with value '%s' of type '%s'", field.getName(), ThriftUtils.getFieldValueType(field).getName(), value, value.getClass().getName()), e); } return null; }
Source:
public void testCreateFileHeader_Modify() throws Exception { ObjectId adId = blob("a\nd\n"); ObjectId abcdId = blob("a\nb\nc\nd\n"); String diffHeader = makeDiffHeader(PATH_A, PATH_A, adId, abcdId); DiffEntry ad = DiffEntry.delete(PATH_A, adId); DiffEntry abcd = DiffEntry.add(PATH_A, abcdId); DiffEntry mod = DiffEntry.pair(ChangeType.MODIFY, ad, abcd, 50); FileHeader fh = df.createFileHeader(mod); assertEquals(diffHeader, RawParseUtils.decode(fh.getBuffer())); assertEquals(1, fh.getHunks().size()); HunkHeader hh = fh.getHunks().get(0); assertEquals(1, hh.toEditList().size()); EditList el = hh.toEditList(); assertEquals(1, el.size()); Edit e = el.get(0); assertEquals(1, e.getBeginA()); assertEquals(1, e.getEndA()); assertEquals(1, e.getBeginB()); assertEquals(3, e.getEndB()); assertEquals(Edit.Type.INSERT, e.getType()); }

Target:
public void testCreateFileHeader_Modify() throws Exception { ObjectId adId = blob("a\nd\n"); ObjectId abcdId = blob("a\nb\nc\nd\n"); String diffHeader = makeDiffHeader(PATH_A, PATH_A, adId, abcdId); DiffEntry ad = DiffEntry.delete(PATH_A, adId); DiffEntry abcd = DiffEntry.add(PATH_A, abcdId); DiffEntry mod = DiffEntry.pair(ChangeType.MODIFY, ad, abcd, 0); FileHeader fh = df.createFileHeader(mod); assertEquals(diffHeader, RawParseUtils.decode(fh.getBuffer())); assertEquals(0, fh.getStartOffset()); assertEquals(fh.getBuffer().length, fh.getEndOffset()); assertEquals(1, fh.getHunks().size()); HunkHeader hh = fh.getHunks().get(0); assertEquals(1, hh.toEditList().size()); EditList el = hh.toEditList(); assertEquals(1, el.size()); Edit e = el.get(0); assertEquals(1, e.getBeginA()); assertEquals(1, e.getEndA()); assertEquals(1, e.getBeginB()); assertEquals(3, e.getEndB()); assertEquals(Edit.Type.INSERT, e.getType()); }
Source:
protected ConnectionFactory createConnectionFactory() throws URISyntaxException { ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(getBrokerURL()); factory.setTrustedPackages(Arrays.asList("java.lang,javax.security,java.util,org.apache.activemq,org.fusesource.hawtbuf,com.thoughtworks.xstream.mapper".split(","))); return factory; }

Target:
protected ConnectionFactory createConnectionFactory() throws URISyntaxException { ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(getBrokerURL()); factory.setTrustedPackages(Arrays.asList("java.lang".split(","))); return factory; }
Source:
public void processEnvironmentLevelData(final AdvancingSource source, final Workbook workbook, final AdvancingNursery nurseryInfo, final Study study) { final Map<Integer, String> measurementVariablesValues = new HashMap<Integer, String>(); for (final MeasurementVariable mv : workbook.getConditions()) { if (StringUtils.isNotBlank(mv.getValue())) { if(mv.getTermId() == TermId.SEASON_VAR.getId() && StringUtils.isNumeric(mv.getValue()) && !mv.getPossibleValues().isEmpty()){ String seasonVarValue = this.getSeasonVarValue(mv.getValue(), mv.getPossibleValues()); measurementVariablesValues.put(mv.getTermId(), seasonVarValue); } else { measurementVariablesValues.put(mv.getTermId(), mv.getValue()); } } } source.setSeason(this.getValueOfPrioritySeasonVariable(measurementVariablesValues)); }

Target:
public void processEnvironmentLevelData(final AdvancingSource source, final Workbook workbook, final AdvancingNursery nurseryInfo, final Study study) { final Map<Integer, String> measurementVariablesValues = new HashMap<Integer, String>(); for (final MeasurementVariable mv : workbook.getConditions()) { this.addValueToMeasurementVariablesValues(mv.getValue(), mv.getPossibleValues(), mv.getTermId(), measurementVariablesValues); } source.setSeason(this.getValueOfPrioritySeasonVariable(measurementVariablesValues)); }
Source:
void quit() { ServiceManager.getInstance().stopModelUpdate(); columns.saveSession(); DataManager.getInstance().saveLocalConfig(); DataManager.getInstance().saveSessionConfig(); browserComponent.onAppQuit(); Platform.exit(); System.exit(0); }

Target:
public void quit() { ServiceManager.getInstance().stopModelUpdate(); columns.saveSession(); DataManager.getInstance().saveLocalConfig(); DataManager.getInstance().saveSessionConfig(); browserComponent.onAppQuit(); Platform.exit(); System.exit(0); }
Source:
public void generate() throws IOException { CompilationUnit compilationUnit = sourceRoot.parse(pkg, visitorClassName + ".java", javaParser).get(); Optional<ClassOrInterfaceDeclaration> visitorClassOptional = compilationUnit.getClassByName(visitorClassName); if (!visitorClassOptional.isPresent()) { visitorClassOptional = compilationUnit.getInterfaceByName(visitorClassName); } ClassOrInterfaceDeclaration visitorClass = visitorClassOptional.get(); for (BaseNodeMetaModel node : javaParserMetaModel.getNodeMetaModels()) { if (!node.isAbstract()) { List<PropertyMetaModel> allPropertyMetaModels = collectAllPropertyMetaModels(node); Optional<MethodDeclaration> visitMethod = visitorClass.getMethods().stream() .filter(m -> m.getNameAsString().equals("visit")) .filter(m -> m.getParameter(0).getType().toString().equals(node.getTypeName())) .findFirst(); if (visitMethod.isPresent()) { generateVisitMethodBody(node, visitMethod.get(), allPropertyMetaModels, compilationUnit); } else if (createMissingVisitMethods) { MethodDeclaration methodDeclaration = visitorClass.addMethod("visit") .addParameter(node.getTypeNameGenericsed(), "n") .addParameter(argumentType, "arg") .setType(returnType); generateVisitMethodBody(node, methodDeclaration, allPropertyMetaModels, compilationUnit); } } } }

Target:
public void generate() throws IOException { CompilationUnit compilationUnit = sourceRoot.parse(pkg, visitorClassName + ".java", javaParser).get(); Optional<ClassOrInterfaceDeclaration> visitorClassOptional = compilationUnit.getClassByName(visitorClassName); if (!visitorClassOptional.isPresent()) { visitorClassOptional = compilationUnit.getInterfaceByName(visitorClassName); } ClassOrInterfaceDeclaration visitorClass = visitorClassOptional.get(); javaParserMetaModel.getNodeMetaModels().stream() .filter((baseNodeMetaModel) -> !baseNodeMetaModel.isAbstract()) .forEach(node -> generateVisitMethodForNode(node, visitorClass, compilationUnit)); }
Source:
private void removeDetachedServers(List<VDS> existingServers, List<GlusterServerInfo> fetchedServers) { for (final VDS server : existingServers) { if (isRemovableStatus(server.getStatus()) && serverDetached(server, fetchedServers)) { log.debugFormat("Server {0} has been removed directly using the gluster CLI. Removing it from engine as well.", server.getName()); logUtil.logServerMessage(server, AuditLogType.GLUSTER_SERVER_REMOVED_FROM_CLI); try { removeServerFromDb(server); runVdsCommand(VDSCommandType.RemoveVds, new RemoveVdsVDSCommandParameters(server.getId())); } catch (Exception e) { log.errorFormat("Error while removing server {0} from database!", server.getName(), e); } } } }

Target:
private void removeDetachedServers(List<VDS> existingServers, List<GlusterServerInfo> fetchedServers) { for (VDS server : existingServers) { if (isRemovableStatus(server.getStatus()) && serverDetached(server, fetchedServers)) { log.debugFormat("Server {0} has been removed directly using the gluster CLI. Removing it from engine as well.", server.getName()); logUtil.logServerMessage(server, AuditLogType.GLUSTER_SERVER_REMOVED_FROM_CLI); try { removeServerFromDb(server); runVdsCommand(VDSCommandType.RemoveVds, new RemoveVdsVDSCommandParameters(server.getId())); } catch (Exception e) { log.errorFormat("Error while removing server {0} from database!", server.getName(), e); } } } }
Source:
public void verify() throws Exception { if(duplicatedAttribute != null) { throw new AttributeDefinitionException(this, duplicatedAttribute.getName()); } else if (attributeTypes.isEmpty()) { throw new AttributeDefinitionException(this, null); } int totalPositional = 0; for(AttributeType a : attributeTypes.values()) { if(a.isPositional()) totalPositional++; } for(int i = 0; i < totalPositional; i++) { if(!attributeTypes.containsKey(Integer.toString(i))) { throw new AttributeDefinitionException(this, i); } } }

Target:
public void verify()
Source:
public void onMapReady(@NonNull final MapboxMap mapboxMap) { mapboxMap.setStyle(Style.LIGHT, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { initCoordinates(); LineString lineString = LineString.fromLngLats(routeCoordinates); FeatureCollection featureCollection = FeatureCollection.fromFeature(Feature.fromGeometry(lineString)); Source geoJsonSource = new GeoJsonSource("line-source", featureCollection, new GeoJsonOptions().withLineMetrics(true)); mapboxMap.getStyle().addSource(geoJsonSource); LineLayer lineLayer = new LineLayer("linelayer", "line-source"); lineLayer.setProperties( lineCap(Property.LINE_CAP_ROUND), lineJoin(Property.LINE_JOIN_ROUND), lineWidth(14f), lineGradient(interpolate( linear(), lineProgress(), stop(0f, rgb(6, 1, 255)), stop(0.1f, rgb(59, 118, 227)), stop(0.3f, rgb(7, 238, 251)), stop(0.5f, rgb(0, 255, 42)), stop(0.7f, rgb(255, 252, 0)), stop(1f, rgb(255, 30, 0)) ))); mapboxMap.getStyle().addLayer(lineLayer); } }); }

Target:
public void onMapReady(@NonNull final MapboxMap mapboxMap) { mapboxMap.setStyle(Style.LIGHT, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { initCoordinates(); LineString lineString = LineString.fromLngLats(routeCoordinates); FeatureCollection featureCollection = FeatureCollection.fromFeature(Feature.fromGeometry(lineString)); style.addSource(new GeoJsonSource("line-source", featureCollection, new GeoJsonOptions().withLineMetrics(true))); style.addLayer(new LineLayer("linelayer", "line-source").withProperties( lineCap(Property.LINE_CAP_ROUND), lineJoin(Property.LINE_JOIN_ROUND), lineWidth(14f), lineGradient(interpolate( linear(), lineProgress(), stop(0f, rgb(6, 1, 255)), stop(0.1f, rgb(59, 118, 227)), stop(0.3f, rgb(7, 238, 251)), stop(0.5f, rgb(0, 255, 42)), stop(0.7f, rgb(255, 252, 0)), stop(1f, rgb(255, 30, 0)) )))); } }); }
Source:
public Value loadEmbeddedService( Value request ) throws FaultException { try { Value channel = Value.create(); if( request.getChildren( "filepath" ).size() > 0 ) { String filePath = request.getFirstChild( "filepath" ).strValue(); String typeStr = request.getFirstChild( "type" ).strValue(); EmbeddedServiceType type = jolie.lang.Constants.stringToEmbeddedServiceType( typeStr ); EmbeddedServiceLoader.ExternalEmbeddedServiceConfiguration configuration = new EmbeddedServiceLoader.ExternalEmbeddedServiceConfiguration( type, filePath ); EmbeddedServiceLoader loader = EmbeddedServiceLoader.create( interpreter(), configuration, channel ); loader.load(); } else { String code = request.getFirstChild( "code" ).strValue(); EmbeddedServiceType type = EmbeddedServiceType.JOLIE; EmbeddedServiceLoader.ExternalEmbeddedNativeCodeConfiguration configuration = new EmbeddedServiceLoader.ExternalEmbeddedNativeCodeConfiguration( type, code ); EmbeddedServiceLoader loader = EmbeddedServiceLoader.create( interpreter(), configuration, channel ); loader.load(); } return channel; } catch( EmbeddedServiceLoaderCreationException e ) { throw new FaultException( "RuntimeException", e ); } catch( EmbeddedServiceLoadingException e ) { throw new FaultException( "RuntimeException", e ); } }

Target:
public Value loadEmbeddedService( Value request ) throws FaultException { try { Value channel = Value.create(); if( request.hasChildren( "filepath" ) ) { String filePath = request.getFirstChild( "filepath" ).strValue(); String typeStr = request.getFirstChild( "type" ).strValue(); EmbeddedServiceType type = jolie.lang.Constants.stringToEmbeddedServiceType( typeStr ); EmbeddedServiceLoader.ExternalEmbeddedServiceConfiguration configuration = new EmbeddedServiceLoader.ExternalEmbeddedServiceConfiguration( type, filePath ); EmbeddedServiceLoader loader = EmbeddedServiceLoader.create( interpreter(), configuration, channel ); loader.load(); } else { String code = request.getFirstChild( "code" ).strValue(); EmbeddedServiceType type = EmbeddedServiceType.JOLIE; EmbeddedServiceLoader.ExternalEmbeddedNativeCodeConfiguration configuration = new EmbeddedServiceLoader.ExternalEmbeddedNativeCodeConfiguration( type, code ); EmbeddedServiceLoader loader = EmbeddedServiceLoader.create( interpreter(), configuration, channel ); loader.load(); } return channel; } catch( EmbeddedServiceLoaderCreationException e ) { throw new FaultException( "RuntimeException", e ); } catch( EmbeddedServiceLoadingException e ) { throw new FaultException( "RuntimeException", e ); } }
Source:
public String getClientIPFromForwardedForHeader(String forwardedForHeader){ ArrayList<String> forwardingIPs; String ip = null; Boolean containsIP = false; if (forwardedForHeader.contains(",")) { forwardingIPs = new ArrayList<String>(Arrays.asList(forwardedForHeader.replace(" ", "").split(","))); Collections.reverse(forwardingIPs); for (String forwardingIP : forwardingIPs){ for (IPRange range : trustedProxies) { if (range.contains(forwardingIP)) { containsIP = true; break; } } if (!containsIP || (containsIP && forwardingIPs.get(forwardingIP.size() -1).equals(forwardingIP))) { ip = forwardingIP; break; } } } else { ip = forwardedForHeader; } return ip; }

Target:
public String getClientIPFromForwardedForHeader(String forwardedForHeader){ ArrayList<String> forwardingIPs; String ip = null; Boolean containsIP = false; if (forwardedForHeader.contains(",")) { forwardingIPs = new ArrayList<String>(Arrays.asList(forwardedForHeader.replace(" ", "").split(","))); Collections.reverse(forwardingIPs); for (String forwardingIP : forwardingIPs){ for (IPRange range : trustedProxies) { if (range.contains(forwardingIP)) { containsIP = true; break; } } if (!containsIP || (containsIP && forwardingIPs.get(forwardingIPs.size() - 1).equals(forwardingIP))) { ip = forwardingIP; break; } } } else { ip = forwardedForHeader; } return ip; }
Source:
private boolean sameCommit(RevCommit a, RevCommit b) { return a == b; }

Target:
private static boolean sameCommit(RevCommit a, RevCommit b) { return a == b; }
Source:
private static InputStream readUriResource(URI uri, ResourceSet resourceSet, Map<?, ?> response) throws IOException { Map<Object, Object> options = resourceSet.getLoadOptions(); URIConverter uriConverter = getUriConverter(resourceSet); Map<Object, Object> loadMap = new HashMap<>(options); loadMap.put(URIConverter.OPTION_RESPONSE, response); InputStream inputStream = uriConverter.createInputStream(uri, loadMap); ByteArrayOutputStream out = new ByteArrayOutputStream(); try { IOUtils.copy(inputStream, out); } finally { inputStream.close(); } inputStream = new ByteArrayInputStream(out.toByteArray()); return inputStream; }

Target:
private static byte[] readUriResource(URI uri, ResourceSet resourceSet, Map<?, ?> response) throws IOException { Map<Object, Object> options = resourceSet.getLoadOptions(); URIConverter uriConverter = getUriConverter(resourceSet); Map<Object, Object> loadMap = new HashMap<>(options); loadMap.put(URIConverter.OPTION_RESPONSE, response); ByteArrayOutputStream out = new ByteArrayOutputStream(); try (InputStream inputStream = uriConverter.createInputStream(uri, loadMap)) { IOUtils.copy(inputStream, out); } return out.toByteArray(); }
Source:
TimeDraw getTimeDraw(long timeDelta) { TimeDraw timeDraw; if (fTimeProvider != null) { TimeFormat tf = fTimeProvider.getTimeFormat(); if (tf == TimeFormat.CALENDAR) { if (timeDelta >= YEAR_IN_NS) { timeDraw = TIMEDRAW_ABS_YEAR; } else if (timeDelta >= MONTH_IN_NS) { timeDraw = TIMEDRAW_ABS_MONTH; } else if (timeDelta >= DAY_IN_NS) { timeDraw = TIMEDRAW_ABS_DAY; } else if (timeDelta >= HOUR_IN_NS) { timeDraw = TIMEDRAW_ABS_HRS; } else if (timeDelta >= MIN_IN_NS) { timeDraw = TIMEDRAW_ABS_MIN; } else if (timeDelta >= SEC_IN_NS) { timeDraw = TIMEDRAW_ABS_SEC; } else if (timeDelta >= MILLISEC_IN_NS) { timeDraw = TIMEDRAW_ABS_MILLISEC; } else if (timeDelta >= MICROSEC_IN_NS) { timeDraw = TIMEDRAW_ABS_MICROSEC; } else { timeDraw = TIMEDRAW_ABS_NANOSEC; } return timeDraw; } else if (tf == TimeFormat.NUMBER) { return TIMEDRAW_NUMBER; } else if (tf == TimeFormat.CYCLES) { return TIMEDRAW_CYCLES; } } if (timeDelta >= SEC_IN_NS) { timeDraw = TIMEDRAW_SEC; } else if (timeDelta >= MILLISEC_IN_NS) { timeDraw = TIMEDRAW_MILLISEC; } else if (timeDelta >= MICROSEC_IN_NS) { timeDraw = TIMEDRAW_MICROSEC; } else { timeDraw = TIMEDRAW_NANOSEC; } return timeDraw; }

Target:
TimeDraw getTimeDraw(long timeDelta) { TimeDraw timeDraw; if (fTimeProvider != null) { switch (fTimeProvider.getTimeFormat()) { case CALENDAR: if (timeDelta >= YEAR_IN_NS) { timeDraw = TIMEDRAW_ABS_YEAR; } else if (timeDelta >= MONTH_IN_NS) { timeDraw = TIMEDRAW_ABS_MONTH; } else if (timeDelta >= DAY_IN_NS) { timeDraw = TIMEDRAW_ABS_DAY; } else if (timeDelta >= HOUR_IN_NS) { timeDraw = TIMEDRAW_ABS_HRS; } else if (timeDelta >= MIN_IN_NS) { timeDraw = TIMEDRAW_ABS_MIN; } else if (timeDelta >= SEC_IN_NS) { timeDraw = TIMEDRAW_ABS_SEC; } else if (timeDelta >= MILLISEC_IN_NS) { timeDraw = TIMEDRAW_ABS_MILLISEC; } else if (timeDelta >= MICROSEC_IN_NS) { timeDraw = TIMEDRAW_ABS_MICROSEC; } else { timeDraw = TIMEDRAW_ABS_NANOSEC; } return timeDraw; case NUMBER: return TIMEDRAW_NUMBER; case CYCLES: return TIMEDRAW_CYCLES; case RELATIVE: default: } } if (timeDelta >= SEC_IN_NS) { timeDraw = TIMEDRAW_SEC; } else if (timeDelta >= MILLISEC_IN_NS) { timeDraw = TIMEDRAW_MILLISEC; } else if (timeDelta >= MICROSEC_IN_NS) { timeDraw = TIMEDRAW_MICROSEC; } else { timeDraw = TIMEDRAW_NANOSEC; } return timeDraw; }
Source:
private boolean getAndRecordLeaderPingResult(@Nullable Future<Boolean> pingFuture) throws InterruptedException { if (pingFuture == null) { eventRecorder.recordLeaderPingTimeout(); return false; } try { boolean isLeader = pingFuture.get(); if (!isLeader) { eventRecorder.recordLeaderPingReturnedFalse(); } return isLeader; } catch (ExecutionException e) { eventRecorder.recordLeaderPingFailure(e.getCause()); return false; } }

Target:
boolean getAndRecordLeaderPingResult(@Nullable Future<Boolean> pingFuture) throws InterruptedException { if (pingFuture == null) { eventRecorder.recordLeaderPingTimeout(); return false; } try { boolean isLeader = pingFuture.get(); if (!isLeader) { eventRecorder.recordLeaderPingReturnedFalse(); } return isLeader; } catch (ExecutionException e) { eventRecorder.recordLeaderPingFailure(e.getCause()); return false; } }
Source:
public void testStepDefaultTools() throws Exception { String name = ToolInstallations.configureDefaultGradle(new TemporaryFolder()).getName(); WorkflowJob p1 = j.jenkins.createProject(WorkflowJob.class, "FakeProject"); p1.setDefinition(new CpsFlowDefinition("node {\n" + build_gradle + "withGradle(gradle:" + name + "){\n" + "sh 'gradle'\n" + "}\n" + "}", false)); WorkflowRun r = p1.scheduleBuild2(0).get(); j.assertBuildStatusSuccess(r); }

Target:
public void testStepDefaultTools() throws Exception { String name = ToolInstallations.configureDefaultGradle(folder).getName(); WorkflowJob p1 = j.jenkins.createProject(WorkflowJob.class, "FakeProject"); p1.setDefinition(new CpsFlowDefinition("node {\n" + build_gradle + "withGradle(gradleName:'" + name + "'){\n" + "sh 'gradle'\n" + "}\n" + "}", false)); WorkflowRun r = p1.scheduleBuild2(0).get(); j.assertBuildStatusSuccess(r); }
Source:
private void createAndStartBlobStoreIfAbsent(PartitionId partitionId) { partitionToStore.computeIfAbsent(partitionId, value -> { CloudBlobStore store = null; try { store = new CloudBlobStore(properties, partitionId, cloudDestination, clusterMap, vcrMetrics); store.start(); } catch (StoreException ex) { logger.error("Can't start CloudStore for partition {}" + partitionId, ex); } return store; }); }

Target:
private CloudBlobStore createAndStartBlobStoreIfAbsent(PartitionId partitionId) { try { lock.writeLock().lock(); if (partitionToStore.containsKey(partitionId)) { return partitionToStore.get(partitionId); } CloudBlobStore store = new CloudBlobStore(properties, partitionId, cloudDestination, clusterMap, vcrMetrics); partitionToStore.put(partitionId, store); store.start(); logger.info("Cloudblobstore started for partition {}", partitionId); return store; } finally { lock.writeLock().unlock(); } }
Source:
public synchronized boolean next(LongWritable key, Text value) throws IOException { while (true) { int bytes = readLine(value); if (bytes <= 0) { if (!selectClient.isRequestComplete()) { throw new RuntimeException("S3 Select request was incomplete as End Event was not received."); } return false; } if (++recordsFromS3 > processedRecords) { position += bytes; processedRecords++; key.set(processedRecords); return true; } } }

Target:
public synchronized boolean next(LongWritable key, Text value) throws IOException { while (true) { int bytes = readLine(value); if (bytes <= 0) { if (!selectClient.isRequestComplete()) { throw new IOException("S3 Select request was incomplete as End Event was not received"); } return false; } recordsFromS3++; if (recordsFromS3 > processedRecords) { position += bytes; processedRecords++; key.set(processedRecords); return true; } } }
Source:
public int getSleepTimer(IPlayer player) { return getInternal(player).getSleepTimer(); }

Target:
public static int getSleepTimer(IPlayer player) { return getInternal(player).getSleepTimer(); }
Source:
public void filter(Filter filter) throws NoTestsRemainException { synchronized (childrenLock) { List<T> filteredChildren = new ArrayList<T>(getFilteredChildren()); for (Iterator<T> iter = filteredChildren.iterator(); iter.hasNext(); ) { T each = iter.next(); if (shouldRun(filter, each)) { try { filter.apply(each); } catch (NoTestsRemainException e) { iter.remove(); } } else { iter.remove(); } } this.filteredChildren = Collections.unmodifiableCollection(filteredChildren); if (this.filteredChildren.isEmpty()) { throw new NoTestsRemainException(); } } }

Target:
public void filter(Filter filter) throws NoTestsRemainException { synchronized (childrenLock) { List<T> children = new ArrayList<T>(getFilteredChildren()); for (Iterator<T> iter = children.iterator(); iter.hasNext(); ) { T each = iter.next(); if (shouldRun(filter, each)) { try { filter.apply(each); } catch (NoTestsRemainException e) { iter.remove(); } } else { iter.remove(); } } filteredChildren = Collections.unmodifiableCollection(children); if (filteredChildren.isEmpty()) { throw new NoTestsRemainException(); } } }
Source:
default List<MCTag<T>> getAllTags() { return getTagCollection().getIDTagMap() .keySet() .stream() .map(itemITag -> new MCTag<>(itemITag, this)) .collect(Collectors.toList()); }

Target:
default List<MCTag<T>> getAllTags() { return getTagCollection().getIDTagMap() .keySet() .stream() .map(tagLocation -> new MCTag<>(tagLocation, this)) .collect(Collectors.toList()); }
Source:
public static final void setDarkThemePreferred(boolean preferred){ if (!GTK3) return; gdk_flush(); g_object_set(OS.gtk_settings_get_default(), gtk_application_prefer_dark_theme, preferred, 0); g_object_notify(OS.gtk_settings_get_default(), gtk_application_prefer_dark_theme); }

Target:
public static final void setDarkThemePreferred(boolean preferred){ if (!GTK3) return; gdk_flush(); g_object_set(gtk_settings_get_default(), gtk_application_prefer_dark_theme, preferred, 0); g_object_notify(gtk_settings_get_default(), gtk_application_prefer_dark_theme); }
Source:
public void canFetchCommentsCount() throws Exception { final Pull pull = Mockito.mock(Pull.class); Mockito.doReturn( Json.createObjectBuilder() .add("comments", 5) .build() ).when(pull).json(); MatcherAssert.assertThat( new Pull.Smart(pull).comments(), Matchers.notNullValue() ); }

Target:
public void canFetchCommentsCount() throws Exception { final int number = 1; final Pull pull = Mockito.mock(Pull.class); Mockito.doReturn( Json.createObjectBuilder() .add("comments", number) .build() ).when(pull).json(); MatcherAssert.assertThat( new Pull.Smart(pull).comments(), Matchers.is(number) ); }
Source:
public void hash_value_null() { assertEquals("", hasher.hash(" ")); }

Target:
public void hash_value_null() { assertEquals("", hasher.hash(null)); }
Source:
public static boolean isOfType(int type, int... types) { boolean result = false; for (int t : types) { if (type == t) { result = true; break; } } return result; }

Target:
public static boolean isOfType(int type, int... types) { return Arrays.stream(types).anyMatch(tokenType -> tokenType == type); }
Source:
@Override public void active(boolean active) { guard(); try { ctx.state().changeGlobalState(active ? ACTIVE : INACTIVE, true, serverNodes(), false, false).get(); } catch (IgniteCheckedException e) { throw U.convertException(e); } finally { unguard(); } }

Target:
@Override public void active(boolean active) { guard(); try { ctx.state().changeGlobalState(active ? ACTIVE : INACTIVE, true, serverNodes(), false).get(); } catch (IgniteCheckedException e) { throw U.convertException(e); } finally { unguard(); } }
Source:
private static HttpPipeline createPipeline(String host, String expectedUrl) { return HttpPipeline.builder() .httpClient(new MockHttpClient() { @Override public Mono<HttpResponse> send(HttpRequest request) { return Mono.empty(); } }) .addPolicy(new HostPolicy(host)) .addPolicy((context, next) -> { assertEquals(expectedUrl, context.httpRequest().url().toString()); return next.process(); }) .build(); }

Target:
private static HttpPipeline createPipeline(String host, String expectedUrl) { return HttpPipeline.builder() .httpClient(new MockHttpClient()) .policies(new HostPolicy(host), (context, next) -> { assertEquals(expectedUrl, context.httpRequest().url().toString()); return next.process(); }) .build(); }
Source:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_landing); View migrationView = findViewById(R.id.migration); View downloadsView = findViewById(R.id.downloads); migrationView.setOnClickListener(view -> { Intent intent = new Intent(getApplicationContext(), MigrationActivity.class); startActivity(intent); }); downloadsView.setOnClickListener(view -> { Intent intent = new Intent(getApplicationContext(), MainActivity.class); startActivity(intent); }); }

Target:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_landing); findViewById(R.id.migration).setOnClickListener(view -> navigateTo(MigrationActivity.class)); findViewById(R.id.downloads).setOnClickListener(view -> navigateTo(MainActivity.class)); }
Source:
public SWTBotRootMenu contextMenu(final Control control) throws WidgetNotFoundException { ContextMenuHelper.notifyMenuDetect(control, widget); WaitForObjectCondition<Menu> waitForMenu = Conditions.waitForPopupMenu(control); new SWTBot().waitUntil(waitForMenu); return new SWTBotRootMenu(waitForMenu.get(0)); }

Target:
protected SWTBotRootMenu contextMenu(final Control control) throws WidgetNotFoundException { ContextMenuHelper.notifyMenuDetect(control, widget); WaitForObjectCondition<Menu> waitForMenu = Conditions.waitForPopupMenu(control); new SWTBot().waitUntil(waitForMenu); return new SWTBotRootMenu(waitForMenu.get(0)); }
Source:
public void storeKeyStore() throws IOException{ assertActivatedKeyStore(); OutputStream fos = getResource().out(); char[] passwd = securityManager.getMasterPassword(); try { ks.store(fos, passwd); } catch (Exception e) { throw new IOException(e); } finally { securityManager.disposePassword(passwd); } fos.close(); }

Target:
public void storeKeyStore() throws IOException{ assertActivatedKeyStore(); try (OutputStream fos = getResource().out()) { char[] passwd = securityManager.getMasterPassword(); try { ks.store(fos, passwd); } catch (Exception e) { throw new IOException(e); } finally { securityManager.disposePassword(passwd); } } }
Source:
public void close() throws Exception { try { int i = 0; while (i < CHECK_TIMEOUT / CHECK_INTERVAL) { try { i++; FileUtils.deleteDirectory(new File(baseDirectory)); } catch (Throwable t) { if (i == CHECK_TIMEOUT / CHECK_INTERVAL) { LOG.error("Clean the temporary directory of Python UDF worker failed.", t); break; } } Thread.sleep(CHECK_INTERVAL); } } finally { if (shutdownHook != null) { ShutdownHookUtil.removeShutdownHook( shutdownHook, ProcessPythonEnvironmentManager.class.getSimpleName(), LOG); shutdownHook = null; } LOG.info("Python environment manager is closing. Now print the content of boot log:\n" + getBootLog()); } }

Target:
public void close() throws Exception { try { int retries = 0; while (true) { try { FileUtils.deleteDirectory(new File(baseDirectory)); break; } catch (Throwable t) { retries++; if (retries <= CHECK_TIMEOUT / CHECK_INTERVAL) { LOG.warn( String.format( "Failed to delete the working directory %s of the Python UDF worker. Retrying...", baseDirectory), t); } else { LOG.warn( String.format( "Failed to delete the working directory %s of the Python UDF worker.", baseDirectory), t); break; } } } } finally { if (shutdownHook != null) { ShutdownHookUtil.removeShutdownHook( shutdownHook, ProcessPythonEnvironmentManager.class.getSimpleName(), LOG); shutdownHook = null; } } }
Source:
public boolean performFinish() { if (!vElement.isPresent()) { return performFinishNewPage(); } final IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); activePage.addPartListener(new AddToTemplatePartListener(activePage)); if (choosePage.get().createNewTemplate()) { if (!performFinishNewPage()) { return false; } } else { final IFile resource = (IFile) ResourcesPlugin.getWorkspace().getRoot() .findMember(selectPage.get().getTemplateName()); getShell().getDisplay().asyncExec(new Runnable() { @Override public void run() { final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); try { IDE.openEditor(page, resource, true); } catch (final PartInitException e) { } } }); } return true; }

Target:
public boolean performFinish() { if (!vElement.isPresent()) { return performFinishNewPage(); } final IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); activePage.addPartListener(new AddToTemplatePartListener(activePage)); if (choosePage.get().createNewTemplate()) { if (!performFinishNewPage()) { return false; } } else { final IFile resource = (IFile) ResourcesPlugin.getWorkspace().getRoot() .findMember(selectPage.get().getTemplateName()); getShell().getDisplay().asyncExec(new Runnable() { @Override public void run() { final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); try { IDE.openEditor(page, resource, true); } catch (final PartInitException e) { ErrorDialog.openError( getShell(), Messages.EMFFormsTemplateWizard_OpenEditorFailTitle, Messages.EMFFormsTemplateWizard_OpenEditorFailMessage, new Status( IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e)); } } }); } return true; }
Source:
public void doPatchProcessing(Context context, Request currentRequest, InProgressSubmission source, Operation op, SubmissionStepConfig stepConf) throws Exception { PatchOperation<MetadataValueRest> patchOperation = new PatchOperationFactory() .instanceOf(DESCRIBE_STEP_METADATA_OPERATION_ENTRY, op.getOp()); DCInputSet inputConfig = inputReader.getInputsByFormName(stepConf.getId()); String[] split = patchOperation.getAbsolutePath(op.getPath()).split("/"); if (inputConfig.isFieldPresent(split[0])) { patchOperation.perform(context, currentRequest, source, op); } else { throw new UnprocessableEntityException("The attribute " + split[0] + " does not present in section " + inputConfig.getFormName()); } }

Target:
public void doPatchProcessing(Context context, Request currentRequest, InProgressSubmission source, Operation op, SubmissionStepConfig stepConf) throws Exception { String[] pathParts = op.getPath().substring(1).split("/"); DCInputSet inputConfig = inputReader.getInputsByFormName(stepConf.getId()); if ("remove".equals(op.getOp()) && pathParts.length < 3) { String[] path = op.getPath().substring(1).split("/", 3); String configId = path[1]; List<String> fieldsName = getInputFieldsName(inputConfig, configId); for (String fieldName : fieldsName) { String fieldPath = op.getPath() + "/" + fieldName; Operation fieldRemoveOp = new RemoveOperation(fieldPath); PatchOperation<MetadataValueRest> patchOperation = new PatchOperationFactory() .instanceOf(DESCRIBE_STEP_METADATA_OPERATION_ENTRY, fieldRemoveOp.getOp()); patchOperation.perform(context, currentRequest, source, fieldRemoveOp); } } else { PatchOperation<MetadataValueRest> patchOperation = new PatchOperationFactory() .instanceOf(DESCRIBE_STEP_METADATA_OPERATION_ENTRY, op.getOp()); String[] split = patchOperation.getAbsolutePath(op.getPath()).split("/"); if (inputConfig.isFieldPresent(split[0])) { patchOperation.perform(context, currentRequest, source, op); } else { throw new UnprocessableEntityException("The field " + split[0] + " is not present in section " + inputConfig.getFormName()); } } }
Source:
public RestletProducer(RestletEndpoint endpoint) throws Exception { super(endpoint); this.throwException = endpoint.isThrowExceptionOnFailure(); client = new Client(endpoint.getProtocol()); client.setContext(new Context()); client.getContext().getParameters().add("socketTimeout", String.valueOf(endpoint.getSocketTimeout())); client.getContext().getParameters().add("socketConnectTimeoutMs", String.valueOf(endpoint.getSocketTimeout())); RestletComponent component = (RestletComponent)endpoint.getComponent(); client.getContext().getParameters().add("maxConnectionsPerHost", String.valueOf(component.getMaxConnectionsPerHost())); client.getContext().getParameters().add("maxTotalConnections", String.valueOf(component.getMaxTotalConnections())); }

Target:
public RestletProducer(RestletEndpoint endpoint) throws Exception { super(endpoint); this.throwException = endpoint.isThrowExceptionOnFailure(); client = new Client(endpoint.getProtocol()); client.setContext(new Context()); client.getContext().getParameters().add("socketTimeout", String.valueOf(endpoint.getSocketTimeout())); client.getContext().getParameters().add("socketConnectTimeoutMs", String.valueOf(endpoint.getSocketTimeout())); RestletComponent component = (RestletComponent)endpoint.getComponent(); if(component.getMaxConnectionsPerHost() != null && component.getMaxConnectionsPerHost() > 0) { client.getContext().getParameters().add("maxConnectionsPerHost", String.valueOf(component.getMaxConnectionsPerHost())); } if(component.getMaxTotalConnections() != null && component.getMaxTotalConnections() > 0) { client.getContext().getParameters().add("maxTotalConnections", String.valueOf(component.getMaxTotalConnections())); } }
Source:
TopoSortGenerator(Generator s) throws MissingObjectException, IncorrectObjectTypeException, IOException { FIFORevQueue tempQueue = new FIFORevQueue(); outputType = s.outputType() | SORT_TOPO; s.shareFreeList(tempQueue); for (;;) { final RevCommit c = s.next(); if (c == null) break; if ((c.flags & RevWalk.TEMP_MARK) != 0) { continue; } for (RevCommit p : c.parents) { p.inDegree++; } c.flags |= RevWalk.TEMP_MARK; tempQueue.add(c); } pending = new FIFORevQueue(); tempQueue.shareFreeList(pending); for (;;) { RevCommit c = tempQueue.next(); if (c == null) { break; } c.flags &= ~RevWalk.TEMP_MARK; pending.add(c); } }

Target:
TopoSortGenerator(Generator s) throws MissingObjectException, IncorrectObjectTypeException, IOException { FIFORevQueue tempQueue = new FIFORevQueue(); outputType = s.outputType() | SORT_TOPO; s.shareFreeList(tempQueue); for (;;) { RevCommit c = s.next(); if (c == null) { break; } if ((c.flags & RevWalk.TEMP_MARK) != 0) { continue; } for (RevCommit p : c.parents) { p.inDegree++; } c.flags |= RevWalk.TEMP_MARK; tempQueue.add(c); } pending = new FIFORevQueue(); tempQueue.shareFreeList(pending); for (;;) { RevCommit c = tempQueue.next(); if (c == null) { break; } c.flags &= ~RevWalk.TEMP_MARK; pending.add(c); } }
Source:
public Result getElementRevision(String id, String revisionString) { UserSession session = getAuthenticatedSession(DEVELOPER); Long revision = BridgeUtils.getLongOrDefault(revisionString, 0L); AppConfigElement element = service.getElementRevision(session.getStudyIdentifier(), id, revision); return okResult(element); }

Target:
public Result getElementRevision(String id, String revisionString) { UserSession session = getAuthenticatedSession(DEVELOPER); Long revision = BridgeUtils.getLongOrDefault(revisionString, null); if (revision == null) { throw new BadRequestException("Revision is not a valid revision number"); } AppConfigElement element = service.getElementRevision(session.getStudyIdentifier(), id, revision); return okResult(element); }
Source:
private void RemoveVdsFromCollection() { VDSReturnValue returnValue = Backend.getInstance().getResourceManager() .RunVdsCommand(VDSCommandType.RemoveVds, new RemoveVdsVDSCommandParameters(getVdsId())); if (!returnValue.getSucceeded()) { errorType = AuditLogType.USER_FAILED_REMOVE_VDS; } }

Target:
private void RemoveVdsFromCollection() { VDSReturnValue returnValue = Backend.getInstance().getResourceManager() .RunVdsCommand(VDSCommandType.RemoveVds, new RemoveVdsVDSCommandParameters(getVdsId())); }
Source:
public String getStoragePoolId() { return storagePoolId; }

Target:
public @Nullable String getStoragePoolId() { return storagePoolId; }
Source:
private static PartitionReceiver createOffsetReceiver(EventHubClient ehClient, OffsetFilter filter, EventHubConfig eventHubConfig, String partitionId) throws EventHubException { return ehClient.createEpochReceiverSync( eventHubConfig.getConsumerGroupName(), partitionId, EventPosition.fromOffset(filter.getOffset(), false), 1); }

Target:
private static PartitionReceiver createOffsetReceiver(EventHubClient ehClient, OffsetFilter filter, EventHubConfig eventHubConfig, String partitionId) throws EventHubException { final ReceiverOptions options = new ReceiverOptions(); options.setReceiverRuntimeMetricEnabled(true); return ehClient.createEpochReceiverSync( eventHubConfig.getConsumerGroupName(), partitionId, EventPosition.fromOffset(filter.getOffset(), false), 1, options); }
Source:
private boolean isSequenceElementChange(Notification notification) { boolean isSequenceElement = isSequenceElement(notification.getNotifier()); Object value = getValue(notification); if (value != null) { boolean valueIsSequenceElt = false; if (value instanceof EObject) { valueIsSequenceElt = isSequenceElement(value); } else if (value instanceof Collection<?>) { Collection<?> values = (Collection<?>) value; for (Object val : values) { if (isSequenceElement(val)) { valueIsSequenceElt = true; break; } } } isSequenceElement = isSequenceElement && valueIsSequenceElt; } return isSequenceElement; }

Target:
private boolean isSequenceElementChange(Notification notification) { boolean isSequenceElement = isSequenceElement(notification.getNotifier()); if (isSequenceElement) { Object value = getValue(notification); if (value != null) { boolean valueIsSequenceElt = false; if (value instanceof EObject) { valueIsSequenceElt = isSequenceElement(value); } else if (value instanceof Collection<?>) { Collection<?> values = (Collection<?>) value; for (Object val : values) { if (isSequenceElement(val)) { valueIsSequenceElt = true; break; } } } isSequenceElement = isSequenceElement && valueIsSequenceElt; } } return isSequenceElement; }
Source:
void notifyError(Throwable error) { Objects.requireNonNull(error); final String stackTrace = Stream.of(error.getStackTrace()).map(StackTraceElement::toString) .collect(Collectors.joining("\n")); logger.error("Error occurred. '{}'\nStacktrace: {}", error.toString(), stackTrace); errorContextProcessor.onNext(error); }

Target:
void notifyError(Throwable error) { Objects.requireNonNull(error); logger.error("Error occurred. {}", error.toString()); errorContextProcessor.onNext(error); }