auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public abstract JsonWriter beginArray() throws IOException; public abstract JsonWriter endArray() throws IOException; public abstract JsonWriter beginObject() throws IOException; public abstract JsonWriter endObject() throws IOException; public abstract JsonWriter name(String name) throws IOException; public abstract JsonWriter value(String value) throws IOException; public abstract JsonWriter nullValue() throws IOException; public abstract JsonWriter value(boolean value) throws IOException; public abstract JsonWriter value(Boolean value) throws IOException; public abstract JsonWriter value(double value) throws IOException; public abstract JsonWriter value(long value) throws IOException; public abstract JsonWriter value(Number value) throws IOException; abstract void promoteNameToValue() throws IOException; public String getPath() { return JsonScope.getPath(stackSize, scopes, pathNames, pathIndices); }

Target:
public abstract JsonWriter beginArray() throws IOException; public abstract JsonWriter endArray() throws IOException; public abstract JsonWriter beginObject() throws IOException; public abstract JsonWriter endObject() throws IOException; public abstract JsonWriter name(String name) throws IOException; public abstract JsonWriter value(String value) throws IOException; public abstract JsonWriter nullValue() throws IOException; public abstract JsonWriter value(boolean value) throws IOException; public abstract JsonWriter value(Boolean value) throws IOException; public abstract JsonWriter value(double value) throws IOException; public abstract JsonWriter value(long value) throws IOException; public abstract JsonWriter value(Number value) throws IOException; abstract void promoteNameToValue() throws IOException; public final String getPath() { return JsonScope.getPath(stackSize, scopes, pathNames, pathIndices); }
Source:
void reserveMemory(long size, int maxSleeps) throws MemoryReservationException { long availableOrReserved = tryReserveMemory(size); if (availableOrReserved >= size) { return; } boolean interrupted = false; try { boolean refprocActive; do { try { refprocActive = JavaGcCleanerWrapper.tryRunPendingCleaners(); } catch (InterruptedException e) { interrupted = true; refprocActive = true; } availableOrReserved = tryReserveMemory(size); if (availableOrReserved >= size) { return; } } while (refprocActive); System.gc(); long sleepTime = 1; int sleeps = 0; while (true) { availableOrReserved = tryReserveMemory(size); if (availableOrReserved >= size) { return; } if (sleeps >= maxSleeps) { break; } try { if (!JavaGcCleanerWrapper.tryRunPendingCleaners()) { if (sleeps >= RETRIGGER_GC_AFTER_SLEEPS) { System.gc(); } Thread.sleep(sleepTime); sleepTime <<= 1; sleeps++; } } catch (InterruptedException e) { interrupted = true; } } throw new MemoryReservationException(String.format( "Could not allocate %d bytes, only %d bytes are remaining, try to upgrade to Java 8u72 or higher", size, availableOrReserved)); } finally { if (interrupted) { Thread.currentThread().interrupt(); } } }

Target:
void reserveMemory(long size, int maxSleeps) throws MemoryReservationException { long availableOrReserved = tryReserveMemory(size); if (availableOrReserved >= size) { return; } boolean interrupted = false; try { boolean refprocActive; do { try { refprocActive = JavaGcCleanerWrapper.tryRunPendingCleaners(); } catch (InterruptedException e) { interrupted = true; refprocActive = true; } availableOrReserved = tryReserveMemory(size); if (availableOrReserved >= size) { return; } } while (refprocActive); System.gc(); long sleepTime = 1; int sleeps = 0; while (true) { availableOrReserved = tryReserveMemory(size); if (availableOrReserved >= size) { return; } if (sleeps >= maxSleeps) { break; } try { if (!JavaGcCleanerWrapper.tryRunPendingCleaners()) { if (sleeps >= RETRIGGER_GC_AFTER_SLEEPS) { System.gc(); } Thread.sleep(sleepTime); sleepTime <<= 1; sleeps++; } } catch (InterruptedException e) { interrupted = true; } } throw new MemoryReservationException(String.format( "Could not allocate %d bytes, only %d bytes are remaining. This usually indicates " + "that you are requesting more memory than you have reserved. " + "However, when running an old JVM version it can also be caused by slow garbage collection. " + "Try to upgrade to Java 8u72 or higher if running on an old Java version.", size, availableOrReserved)); } finally { if (interrupted) { Thread.currentThread().interrupt(); } } }
Source:
public void load() { if (mFutureTask != null) { return; } mFutureTask = new FutureTask<Models> (() -> new Models(mCol).load(loadColumn("models"))); new Thread(mFutureTask).start(); }

Target:
public synchronized void load() { if (mFutureTask != null) { return; } mFutureTask = new FutureTask<Models> (() -> new Models(mCol).load(loadColumn("models"))); new Thread(mFutureTask).start(); }
Source:
public void xlsWithOOPathTest() { KieSession kieSession = getKieSessionFromXls("oopath.xls"); List<String> list = new ArrayList<>(); populateKieSession(kieSession, list); int rulesFired = kieSession.fireAllRules(); assertThat(rulesFired).isEqualTo(2); verifyRuleFireResults(list); verifyQueryResults(kieSession.getQueryResults("listSafeCities")); }

Target:
public void xlsWithOOPathTest() { final KieSession kieSession = getKieSessionFromXls("oopath.xls"); testOOPathWithDTable(kieSession); }
Source:
public boolean isDroneConnected() { return mConnectedToDrone; }

Target:
public boolean isDroneConnected() { return drone.MavClient.isConnected(); }
Source:
public boolean isInMaintenanceStates() { ResourceState state = getResourceState(); return (state == ResourceState.Maintenance || state == ResourceState.ErrorInMaintenance || state == ResourceState.PrepareForMaintenance || state == ResourceState.ErrorInPrepareForMaintenance); }

Target:
public boolean isInMaintenanceStates() { return ResourceState.isMaintenanceState(getResourceState()); }
Source:
private void printBRDALines(SourceFileCoverage sourceFile) throws IOException { for (BranchCoverage branch : sourceFile.getAllBranches()) { bufferedWriter.write(Constants.BRDA_MARKER); bufferedWriter.write(Integer.toString(branch.lineNumber())); bufferedWriter.write(Constants.DELIMITER); bufferedWriter.write(branch.blockNumber().isEmpty() ? "0" : branch.blockNumber()); bufferedWriter.write(Constants.DELIMITER); bufferedWriter.write(branch.branchNumber().isEmpty() ? "0" : branch.branchNumber()); bufferedWriter.write(Constants.DELIMITER); if (branch.wasExecuted()) { bufferedWriter.write(Integer.toString(branch.nrOfExecutions())); } else { bufferedWriter.write(Constants.TAKEN); } bufferedWriter.newLine(); } }

Target:
private void printBRDALines(SourceFileCoverage sourceFile) throws IOException { for (BranchCoverage branch : sourceFile.getAllBranches()) { bufferedWriter.write(Constants.BRDA_MARKER); bufferedWriter.write(Integer.toString(branch.lineNumber())); bufferedWriter.write(Constants.DELIMITER); bufferedWriter.write(branch.blockNumber()); bufferedWriter.write(Constants.DELIMITER); bufferedWriter.write(branch.branchNumber()); bufferedWriter.write(Constants.DELIMITER); if (branch.wasExecuted()) { bufferedWriter.write(Integer.toString(branch.nrOfExecutions())); } else { bufferedWriter.write(Constants.TAKEN); } bufferedWriter.newLine(); } }
Source:
void transportedUnitsAreTransferredToTheFirstNewUnit() { final Unit oldUnit = transport.create(1, player).get(0); seaZone.getUnitCollection().add(oldUnit); final List<Unit> newUnits = transport.create(2, player); final List<Unit> transportedUnits = infantry.create(1, player); seaZone.getUnitCollection().addAll(transportedUnits); transportedUnits.get(0).setTransportedBy(oldUnit); final Change changes = UnitUtils.translateAttributesToOtherUnits(oldUnit, newUnits, seaZone); gameData.performChange(changes); assertThat( "Units can only be transported by one unit at a time. So the transported unit " + "should be transferred to one of the new units. Since the new units is a list, the " + "first one will be selected.", transportedUnits.get(0).getTransportedBy(), is(newUnits.get(0))); }

Target:
void transportedUnitsAreTransferredToTheFirstNewUnit() { final Unit oldTransport = transport.create(1, player).get(0); seaZone.getUnitCollection().add(oldTransport); final Unit newTransport1 = transport.create(1, player).get(0); final Unit newTransport2 = transport.create(1, player).get(0); final List<Unit> transportedUnits = infantry.create(1, player); seaZone.getUnitCollection().addAll(transportedUnits); transportedUnits.get(0).setTransportedBy(oldTransport); final Change changes = UnitUtils.translateAttributesToOtherUnits( oldTransport, List.of(newTransport1, newTransport2), seaZone); gameData.performChange(changes); assertThat( "Units can only be transported by one unit at a time. So the transported unit " + "should be transferred to one of the new units. Since the new units is a list, the " + "first one will be selected and the first one is 'newTransport1'", transportedUnits.get(0).getTransportedBy(), is(newTransport1)); }
Source:
public void processResult(int rc, String path, Object ctx) { LOG.info("sycnOnNewSession with sessionID async return code: {}", _sessionId, rc); callback(rc, path, ctx); }

Target:
public void processResult(int rc, String path, Object ctx) { LOG.debug("sync() call with sessionID async return code: {}", _sessionId, rc); callback(rc, path, ctx); }
Source:
private static String resolveUrlTemplate(String template, String baseUrl, RelyingPartyRegistration relyingParty) { String entityId = relyingParty.getAssertingPartyDetails().getEntityId(); String registrationId = relyingParty.getRegistrationId(); Map<String, String> uriVariables = new HashMap<>(); UriComponents uriComponents = UriComponentsBuilder.fromHttpUrl(baseUrl) .replaceQuery(null) .fragment(null) .build(); String scheme = uriComponents.getScheme(); uriVariables.put("baseScheme", scheme == null ? "" : scheme); String host = uriComponents.getHost(); uriVariables.put("baseHost", host == null ? "" : host); int port = uriComponents.getPort(); uriVariables.put("basePort", port == -1 ? "" : ":" + port); String path = uriComponents.getPath(); if (StringUtils.hasLength(path)) { if (path.charAt(0) != PATH_DELIMITER) { path = PATH_DELIMITER + path; } } uriVariables.put("basePath", path == null ? "" : path); uriVariables.put("baseUrl", uriComponents.toUriString()); uriVariables.put("entityId", StringUtils.hasText(entityId) ? entityId : ""); uriVariables.put("registrationId", StringUtils.hasText(registrationId) ? registrationId : ""); return UriComponentsBuilder.fromUriString(template) .buildAndExpand(uriVariables) .toUriString(); }

Target:
private static String resolveUrlTemplate(String template, String baseUrl, RelyingPartyRegistration relyingParty) { String entityId = relyingParty.getAssertingPartyDetails().getEntityId(); String registrationId = relyingParty.getRegistrationId(); Map<String, String> uriVariables = new HashMap<>(); UriComponents uriComponents = UriComponentsBuilder.fromHttpUrl(baseUrl) .replaceQuery(null) .fragment(null) .build(); String scheme = uriComponents.getScheme(); uriVariables.put("baseScheme", scheme == null ? "" : scheme); String host = uriComponents.getHost(); uriVariables.put("baseHost", host == null ? "" : host); int port = uriComponents.getPort(); uriVariables.put("basePort", port == -1 ? "" : ":" + port); String path = uriComponents.getPath(); if (StringUtils.hasLength(path) && path.charAt(0) != PATH_DELIMITER) { path = PATH_DELIMITER + path; } uriVariables.put("basePath", path == null ? "" : path); uriVariables.put("baseUrl", uriComponents.toUriString()); uriVariables.put("entityId", StringUtils.hasText(entityId) ? entityId : ""); uriVariables.put("registrationId", StringUtils.hasText(registrationId) ? registrationId : ""); return UriComponentsBuilder.fromUriString(template) .buildAndExpand(uriVariables) .toUriString(); }
Source:
protected static IWorkbenchWindow getActiveWindow(MApplication app) { return PlatformUI.getWorkbench().getActiveWorkbenchWindow(); }

Target:
private static IWorkbenchWindow getActiveWindow(MApplication app) { return PlatformUI.getWorkbench().getActiveWorkbenchWindow(); }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } SpatialDimFilter that = (SpatialDimFilter) o; if (bound != null ? !bound.equals(that.bound) : that.bound != null) { return false; } if (dimension != null ? !dimension.equals(that.dimension) : that.dimension != null) { return false; } return Objects.equal(delimiter, that.delimiter); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } SpatialDimFilter that = (SpatialDimFilter) o; if (!bound.equals(that.bound)) { return false; } if (!dimension.equals(that.dimension)) { return false; } return delimiter.equals(that.delimiter); }
Source:
public void testBatchRunOnSpecificPractitioner() { assertLinkCount(2); myEmpiProviderR4.clearEmpiLinks(null); afterEmpiLatch.runWithExpectedCount(1, () -> myEmpiProviderR4.empiBatchPractitionerInstance(myPractitioner.getIdElement(), null)); assertLinkCount(1); }

Target:
public void testBatchRunOnSpecificPractitioner() throws InterruptedException { myEmpiProviderR4.clearEmpiLinks(null); afterEmpiLatch.runWithExpectedCount(1, () -> myEmpiProviderR4.empiBatchPractitionerInstance(myPractitioner.getIdElement(), null)); assertLinkCount(1); }
Source:
private Schema getOutputSchema(Schema inputSchema) { List<Schema.Field> fields = new ArrayList<>(inputSchema.getFields()); for (Map.Entry<String, String> entry : getFeatureListMapping().entrySet()) { fields.add(Schema.Field.of(entry.getValue(), Schema.recordOf( "sparseVector", Schema.Field.of("size", Schema.of(Schema.Type.INT)), Schema.Field.of("indices", Schema.arrayOf(Schema.of(Schema.Type.INT))), Schema.Field.of("vectorValues", Schema.arrayOf(Schema.of(Schema.Type.DOUBLE)))))); } return Schema.recordOf("record", fields); }

Target:
private Schema getOutputSchema(Schema inputSchema) { List<Schema.Field> fields = new ArrayList<>(inputSchema.getFields()); for (Map.Entry<String, String> entry : getFeatureListMapping(outputColumnMapping).entrySet()) { fields.add(Schema.Field.of(entry.getValue(), VectorUtils.SPARSE_SCHEMA)); } return Schema.recordOf("record", fields); }
Source:
@Override public void set(double v) { if (Double.isFinite(v)) { value.getCurrent().max(v); updateLastModTime(); } }

Target:
@Override public void set(double v) { value.getCurrent().max(v); updateLastModTime(); }
Source:
public boolean validateDistributedStripedReplicateRemove(GlusterVolumeType volumeType, List<GlusterBrickEntity> selectedBricks, List<GlusterBrickEntity> brickList, RemoveBrickModel removeBrickModel) { int stripeCount = removeBrickModel.getStripeCount(); int replicaCount = removeBrickModel.getReplicaCount(); if (selectedBricks.size() != stripeCount * replicaCount) { return false; } return true; }

Target:
public boolean validateDistributedStripedReplicateRemove(GlusterVolumeType volumeType, List<GlusterBrickEntity> selectedBricks, List<GlusterBrickEntity> brickList, RemoveBrickModel removeBrickModel) { int stripeCount = removeBrickModel.getStripeCount(); int replicaCount = removeBrickModel.getReplicaCount(); if (selectedBricks.size() % (stripeCount * replicaCount) != 0) { return false; } return true; }
Source:
private void initCoverageTiles(String coverageUrl) { ClientLog.i(LOG_TAG, "initCoverageTiles: " + coverageUrl); mCoverageTilesOverlayLowZoom = new CoverageOverlay(CoverageOverlay.LowResType.LOWER_ZOOM, mRootView.getContext(), coverageUrl, mMap); mCoverageTilesOverlayHighZoom = new CoverageOverlay(CoverageOverlay.LowResType.HIGHER_ZOOM, mRootView.getContext(), coverageUrl, mMap); mCoverageTilesOverlayDefaultZoom = new CoverageOverlay(mRootView.getContext(), coverageUrl, mMap); }

Target:
private void initCoverageTiles(String coverageUrl) { ClientLog.i(LOG_TAG, "initCoverageTiles: " + coverageUrl); mCoverageTilesOverlayLowZoom = new CoverageOverlay(AbstractMapOverlay.TileResType.LOWER_ZOOM, mRootView.getContext(), coverageUrl, mMap); mCoverageTilesOverlayHighZoom = new CoverageOverlay(AbstractMapOverlay.TileResType.HIGHER_ZOOM, mRootView.getContext(), coverageUrl, mMap); mCoverageTilesOverlayOriginalZoom = new CoverageOverlay(AbstractMapOverlay.TileResType.ORIGINAL_ZOOM, mRootView.getContext(), coverageUrl, mMap); }
Source:
if (UserGroupInformation.isSecurityEnabled()) { ZeppelinConfiguration zConf = ZeppelinConfiguration.create(); String keytab = zConf.getString( ZeppelinConfiguration.ConfVars.ZEPPELIN_SERVER_KERBEROS_KEYTAB); String principal = zConf.getString( ZeppelinConfiguration.ConfVars.ZEPPELIN_SERVER_KERBEROS_PRINCIPAL); if (StringUtils.isBlank(keytab) || StringUtils.isBlank(principal)) { throw new RuntimeException("keytab and principal can not be empty, keytab: " + keytab + ", principal: " + principal); } try { UserGroupInformation.loginUserFromKeytab(principal, keytab); } catch (IOException e) { throw new RuntimeException("Fail to login via keytab:" + keytab + ", principla:" + principal); } }

Target:
if (UserGroupInformation.isSecurityEnabled()) { ZeppelinConfiguration zConf = ZeppelinConfiguration.create(); String keytab = zConf.getString( ZeppelinConfiguration.ConfVars.ZEPPELIN_SERVER_KERBEROS_KEYTAB); String principal = zConf.getString( ZeppelinConfiguration.ConfVars.ZEPPELIN_SERVER_KERBEROS_PRINCIPAL); if (StringUtils.isBlank(keytab) || StringUtils.isBlank(principal)) { throw new RuntimeException("keytab and principal can not be empty, keytab: " + keytab + ", principal: " + principal); } try { UserGroupInformation.loginUserFromKeytab(principal, keytab); } catch (IOException e) { throw new RuntimeException("Fail to login via keytab:" + keytab + ", principal:" + principal, e); } }
Source:
public static String encryptWithPasscode(String data, String passcode) { String encKey = null; if (ForceApp.APP != null) { encKey = ForceApp.APP.getEncryptionKeyForPasscode(passcode); } return Encryptor.encrypt(data, encKey); }

Target:
public static String encryptWithPasscode(String data, String passcode) { return Encryptor.encrypt(data, ForceApp.APP.getEncryptionKeyForPasscode(passcode)); }
Source:
public void smokeTest() throws InterruptedException { Game game = launcher.getGame(); Player player = game.getPlayers().get(0); assertThat(game.isInProgress()).isFalse(); game.start(); assertThat(game.isInProgress()).isTrue(); assertThat(player.getScore()).isZero(); game.move(player, Direction.EAST); assertThat(player.getScore()).isEqualTo(10); game.move(player, Direction.WEST); assertThat(player.getScore()).isEqualTo(10); move(game, Direction.EAST, 7); assertThat(player.getScore()).isEqualTo(60); move(game, Direction.NORTH, 6); assertThat(player.getScore()).isEqualTo(120); move(game, Direction.WEST, 2); assertThat(player.getScore()).isEqualTo(120); move(game, Direction.NORTH, 2); Thread.sleep(500L); move(game, Direction.WEST, 10); move(game, Direction.EAST, 10); assertThat(player.isAlive()).isFalse(); game.stop(); assertThat(game.isInProgress()).isFalse(); }

Target:
void smokeTest() throws InterruptedException { Game game = launcher.getGame(); Player player = game.getPlayers().get(0); assertThat(game.isInProgress()).isFalse(); game.start(); assertThat(game.isInProgress()).isTrue(); assertThat(player.getScore()).isZero(); game.move(player, Direction.EAST); assertThat(player.getScore()).isEqualTo(10); game.move(player, Direction.WEST); assertThat(player.getScore()).isEqualTo(10); move(game, Direction.EAST, 7); assertThat(player.getScore()).isEqualTo(60); move(game, Direction.NORTH, 6); assertThat(player.getScore()).isEqualTo(120); move(game, Direction.WEST, 2); assertThat(player.getScore()).isEqualTo(120); move(game, Direction.NORTH, 2); Thread.sleep(500L); move(game, Direction.WEST, 10); move(game, Direction.EAST, 10); assertThat(player.isAlive()).isFalse(); game.stop(); assertThat(game.isInProgress()).isFalse(); }
Source:
private void setListForWhiteSelection(Object treeElement) { List listItemsChecked = new ArrayList(); java.util.Collections.addAll(listItemsChecked, listContentProvider.getElements(treeElement)); checkedStateStore.put(treeElement, listItemsChecked); }

Target:
private void setListForWhiteSelection(Object treeElement) { List listItemsChecked = new ArrayList(Arrays.asList(listContentProvider.getElements(treeElement))); checkedStateStore.put(treeElement, listItemsChecked); }
Source:
public void loadProvider() { switch (myFhirContext.getVersion().getVersion()) { case DSTU3: myResourceProviderFactory.addSupplier(() -> { myMdmProvider = new MdmProviderDstu3(myFhirContext, myMdmControllerSvc, myMdmMatchFinderSvc, myMdmExpungeSvc, myMdmSubmitSvc); return myMdmProvider; }); break; case R4: myResourceProviderFactory.addSupplier(() -> { myMdmProvider = new MdmProviderR4(myFhirContext, myMdmControllerSvc, myMdmMatchFinderSvc, myMdmExpungeSvc, myMdmSubmitSvc); return myMdmProvider; }); break; default: throw new ConfigurationException("MDM not supported for FHIR version " + myFhirContext.getVersion().getVersion()); } }

Target:
public void loadProvider() { switch (myFhirContext.getVersion().getVersion()) { case DSTU3: case R4: myResourceProviderFactory.addSupplier(() -> { myMdmProvider = new MdmProviderDstu3Plus(myFhirContext, myMdmControllerSvc, myMdmMatchFinderSvc, myMdmExpungeSvc, myMdmSubmitSvc); return myMdmProvider; }); break; default: throw new ConfigurationException("MDM not supported for FHIR version " + myFhirContext.getVersion().getVersion()); } }
Source:
private static Map<String, Schema> getOutputSchemas(Schema inputSchema, Conf conf, FailureCollector collector) { Map<String, Schema> outputs = new HashMap<>(); if (inputSchema.getField(conf.field) == null) { collector.addFailure(String.format("Field '%s' must exist in input schema.", conf.field), null) .withConfigProperty(Conf.FIELD); } outputs.put(NULL_PORT, inputSchema); outputs.put(NON_NULL_PORT, conf.modifySchema ? getNonNullSchema(inputSchema, conf.field) : inputSchema); return outputs; }

Target:
private static Map<String, Schema> getOutputSchemas(Schema inputSchema, Conf conf, FailureCollector collector) { Map<String, Schema> outputs = new HashMap<>(); if (inputSchema.getField(conf.field) == null) { collector.addFailure(String.format("Field '%s' must exist in the input schema.", conf.field), null) .withConfigProperty(Conf.FIELD); } outputs.put(NULL_PORT, inputSchema); outputs.put(NON_NULL_PORT, conf.modifySchema ? getNonNullSchema(inputSchema, conf.field, collector) : inputSchema); return outputs; }
Source:
public GroupStructureSynchronizationAlreadyRunningException(Group group) { super(group.toString()); this.group = group; }

Target:
public GroupStructureSynchronizationAlreadyRunningException(Group group) { super("Group structure is already running for the group: " + group.toString()); this.group = group; }
Source:
public ColumnWriteStoreV2( MessageType schema, PageWriteStore pageWriteStore, BloomFilterWriteStore bloomFilterWriteStore, ParquetProperties props) { this.props = props; this.thresholdTolerance = (long)(props.getPageSizeThreshold() * THRESHOLD_TOLERANCE_RATIO); Map<ColumnDescriptor, ColumnWriterV2> mcolumns = new TreeMap<ColumnDescriptor, ColumnWriterV2>(); for (ColumnDescriptor path : schema.getColumns()) { PageWriter pageWriter = pageWriteStore.getPageWriter(path); if (props.isBloomFilterEnabled() && props.getBloomFilterInfo() != null) { BloomFilterWriter bloomFilterWriter = bloomFilterWriteStore.getBloomFilterWriter(path); mcolumns.put(path, new ColumnWriterV2(path, pageWriter, bloomFilterWriter, props)); } else { mcolumns.put(path, new ColumnWriterV2(path, pageWriter, props)); } } this.columns = unmodifiableMap(mcolumns); this.writers = this.columns.values(); this.rowCountForNextSizeCheck = props.getMinRowCountForPageSizeCheck(); }

Target:
public ColumnWriteStoreV2(MessageType schema, PageWriteStore pageWriteStore, BloomFilterWriteStore bloomFilterWriteStore, ParquetProperties props) { super(schema, pageWriteStore, bloomFilterWriteStore, props); }
Source:
static File searchPath(final String path, final String... lookFor) { if (path == null) { return null; } for (final String p : path.split(File.pathSeparator)) { for (String command : lookFor) { final File e = new File(p, command); if (e.isFile()) return e.getAbsoluteFile(); } } return null; }

Target:
static File searchPath(final String path, final String... lookFor) { if (path == null) return null; for (final String p : path.split(File.pathSeparator)) { for (String command : lookFor) { final File e = new File(p, command); if (e.isFile()) return e.getAbsoluteFile(); } } return null; }
Source:
public static double getRangeFactor() { return getConfig().getDouble("Properties.Fire.BlueFire.CooldownFactor"); }

Target:
public static double getRangeFactor() { return getConfig().getDouble("Properties.Fire.BlueFire.RangeFactor"); }
Source:
private void addTable(DescribeGlobalSObjectResult objectMetadata) { String name = objectMetadata.getName(); if (normalizeNames) { name = NameUtil.normalizeName(name); } if (!allowedToAdd(name)) { return; } Table table = metadataFactory.addTable(name); FullyQualifiedName fqn = new FullyQualifiedName("sobject", objectMetadata.getName()); table.setProperty(FQN, fqn.toString()); if (isIncludeExtensionMetadata()) { table.setNameInSource(objectMetadata.getName()); } tableMap.put(objectMetadata.getName(), table); table.setProperty(TABLE_CUSTOM, String.valueOf(objectMetadata.isCustom())); if (isIncludeExtensionMetadata()) { table.setProperty(TABLE_SUPPORTS_CREATE, String.valueOf(objectMetadata.isCreateable())); table.setProperty(TABLE_SUPPORTS_DELETE, String.valueOf(objectMetadata.isDeletable())); table.setProperty(TABLE_SUPPORTS_MERGE, String.valueOf(objectMetadata.isMergeable())); table.setProperty(TABLE_SUPPORTS_QUERY, String.valueOf(objectMetadata.isQueryable())); table.setProperty(TABLE_SUPPORTS_REPLICATE, String.valueOf(objectMetadata.isReplicateable())); table.setProperty(TABLE_SUPPORTS_RETRIEVE, String.valueOf(objectMetadata.isRetrieveable())); table.setProperty(TABLE_SUPPORTS_SEARCH, String.valueOf(objectMetadata.isSearchable())); } }

Target:
private void addTable(DescribeGlobalSObjectResult objectMetadata) { String name = objectMetadata.getName(); if (normalizeNames) { name = NameUtil.normalizeName(name); } if (!allowedToAdd(name)) { return; } Table table = metadataFactory.addTable(name); FullyQualifiedName fqn = new FullyQualifiedName("sobject", objectMetadata.getName()); table.setProperty(FQN, fqn.toString()); tableMap.put(objectMetadata.getName(), table); table.setProperty(TABLE_CUSTOM, String.valueOf(objectMetadata.isCustom())); if (isIncludeExtensionMetadata()) { table.setNameInSource(objectMetadata.getName()); table.setProperty(TABLE_SUPPORTS_CREATE, String.valueOf(objectMetadata.isCreateable())); table.setProperty(TABLE_SUPPORTS_DELETE, String.valueOf(objectMetadata.isDeletable())); table.setProperty(TABLE_SUPPORTS_MERGE, String.valueOf(objectMetadata.isMergeable())); table.setProperty(TABLE_SUPPORTS_QUERY, String.valueOf(objectMetadata.isQueryable())); table.setProperty(TABLE_SUPPORTS_REPLICATE, String.valueOf(objectMetadata.isReplicateable())); table.setProperty(TABLE_SUPPORTS_RETRIEVE, String.valueOf(objectMetadata.isRetrieveable())); table.setProperty(TABLE_SUPPORTS_SEARCH, String.valueOf(objectMetadata.isSearchable())); } }
Source:
private static synchronized void notifyErrorHandler(int errorCode, String errorMessage, String path) { for (SyncSession syncSession : sessions.values()) { if (path == null || path.equals(syncSession.getConfiguration().getPath())) { syncSession.notifySessionError(errorCode, errorMessage); } } }

Target:
private static synchronized void notifyErrorHandler(int errorCode, String errorMessage, String path) { for (SyncSession syncSession : sessions.values()) { if (path == null || path.equals(syncSession.getConfiguration().getPath())) { try { syncSession.notifySessionError(errorCode, errorMessage); } catch (Exception exception) { RealmLog.error(exception); } } } }
Source:
public synchronized void unregisterJob(final String jobName, final String groupName) throws SchedulerException { if (!ifJobExist(jobName, groupName)) { throw new SchedulerException( "can not find job with group name: " + groupName + " in quartz."); } else { this.scheduler.deleteJob(new JobKey(jobName, groupName)); } }

Target:
public synchronized void unregisterJob(final String jobName, final String groupName) throws SchedulerException { checkJobExistence(jobName, groupName); this.scheduler.deleteJob(new JobKey(jobName, groupName)); }
Source:
public void handleConsumeOk(String consumerTag) { super.handleConsumeOk(consumerTag); log.info("Consumer tag is now " + consumerTag); }

Target:
public void handleConsumeOk(String consumerTag) { super.handleConsumeOk(consumerTag); log.debug("Consumer tag is now " + consumerTag); }
Source:
public void onListActionButtonClicked(@NonNull OnboardingPageView view) { onboardingPageView = view; getContext().startActivity(new Intent(getContext(), WikipediaLanguagesActivity.class)); }

Target:
public void onListActionButtonClicked(@NonNull OnboardingPageView view) { onboardingPageView = view; requireContext().startActivity(new Intent(getContext(), WikipediaLanguagesActivity.class)); }
Source:
public Object apply(IncomingMessageEnvelope ime) { Assert.notNull(ime, "ime is null"); KV<Object, Object> keyAndMessageKV = KV.of(ime.getKey(), ime.getMessage()); SamzaSqlRelMsgMetadata metadata = new SamzaSqlRelMsgMetadata(ime.getEventTime(), ime.getArrivalSystemNanoTime(),0L); SamzaSqlInputMessage samzaMsg = SamzaSqlInputMessage.of(keyAndMessageKV, metadata); return samzaMsg; }

Target:
public Object apply(IncomingMessageEnvelope ime) { Assert.notNull(ime, "ime is null"); KV<Object, Object> keyAndMessageKV = KV.of(ime.getKey(), ime.getMessage()); SamzaSqlRelMsgMetadata metadata = new SamzaSqlRelMsgMetadata(ime.getEventTime(), ime.getArrivalTime()); SamzaSqlInputMessage samzaMsg = SamzaSqlInputMessage.of(keyAndMessageKV, metadata); return samzaMsg; }
Source:
public void testAddRemoveDocsToDetachedCollection() { DocumentModel testWorkspace = session.createDocumentModel("/default-domain/workspaces", "testWorkspace", "Workspace"); testWorkspace = session.createDocument(testWorkspace); List<DocumentModel> files = createTestFiles(session, 2); collectionManager.addToNewCollection(COLLECTION_NAME, COLLECTION_DESCRIPTION, files.get(0), session); assertTrue(session.exists(new PathRef(COLLECTION_FOLDER_PATH))); final String newlyCreatedCollectionPath = COLLECTION_FOLDER_PATH + "/" + COLLECTION_NAME; DocumentRef newCollectionRef = new PathRef(newlyCreatedCollectionPath); assertTrue(session.exists(newCollectionRef)); DocumentModel collection = session.getDocument(newCollectionRef); collection.detach(true); collectionManager.addToCollection(collection, files.get(1), session); Collection collectionAdapter = collection.getAdapter(Collection.class); assertEquals(2, collectionAdapter.getCollectedDocumentIds().size()); collectionManager.removeFromCollection(collection, files.get(0), session); collectionManager.removeFromCollection(collection, files.get(1), session); assertEquals(0, collectionAdapter.getCollectedDocumentIds().size()); }

Target:
public void testAddRemoveDocsToDetachedCollection() { List<DocumentModel> files = createTestFiles(session, 2); collectionManager.addToNewCollection(COLLECTION_NAME, COLLECTION_DESCRIPTION, files.get(0), session); assertTrue(session.exists(new PathRef(COLLECTION_FOLDER_PATH))); final String newlyCreatedCollectionPath = COLLECTION_FOLDER_PATH + "/" + COLLECTION_NAME; DocumentRef newCollectionRef = new PathRef(newlyCreatedCollectionPath); assertTrue(session.exists(newCollectionRef)); DocumentModel collection = session.getDocument(newCollectionRef); collection.detach(true); collectionManager.addToCollection(collection, files.get(1), session); Collection collectionAdapter = collection.getAdapter(Collection.class); assertEquals(2, collectionAdapter.getCollectedDocumentIds().size()); collectionManager.removeFromCollection(collection, files.get(0), session); collectionManager.removeFromCollection(collection, files.get(1), session); assertEquals(0, collectionAdapter.getCollectedDocumentIds().size()); }
Source:
public void findUserByNameShouldReturnNullWhenNoUserWasFound() { given(userRepository.findByUserName(NOT_REAL_USER_NAME)).willReturn(NULL_USER_ENTITY); UserDTO result = userService.findUserByName(NOT_REAL_USER_NAME); assertNull(result); }

Target:
public void findUserByNameShouldReturnNullWhenNoUserWasFound() { given(userRepository.findByUserName(NOT_REAL_USER_NAME)).willReturn(NULL_USER_ENTITY); UserDTO result = userService.findUserByName(NOT_REAL_USER_NAME); then(userRepository).should().findByUserName(NOT_REAL_USER_NAME); assertNull(result); }
Source:
public final String dumpConfiguration() { if (this.properties.isEmpty()) return "No configuration settings stored"; @SuppressWarnings("rawtypes") Enumeration e = this.properties.propertyNames(); String response = "TSD Configuration:\n"; response += "File [" + this.config_location + "]\n"; while (e.hasMoreElements()) { String key = (String) e.nextElement(); response += "Key [" + key + "] Value [" + this.properties.getProperty(key) + "]\n"; } return response; }

Target:
public final String dumpConfiguration() { if (this.properties.isEmpty()) return "No configuration settings stored"; StringBuilder response = new StringBuilder("TSD Configuration:\n"); response.append("File [" + this.config_location + "]\n"); for (Map.Entry<String, String> entry : this.properties.entrySet()) { response.append("Key [" + entry.getKey() + "] Value ["). append(entry.getValue() + "]\n"); } return response.toString(); }
Source:
private static long getChunkCacheSize(IEclipsePreferences node) { double maxSizeMb = node.getDouble(CHUNK_CACHE_SIZE_MB, CHUNK_CACHE_SIZE_MB_DEFAULT); double maxSizePercent = node.getDouble(CHUNK_CACHE_SIZE_PERCENT, CHUNK_CACHE_SIZE_PERCENT_DEFAULT); maxSizePercent = Math.max(1.0, Math.min(100.0, maxSizePercent)); maxSizeMb = Math.max(maxSizeMb, 1.0); long m1= (long) (Runtime.getRuntime().maxMemory() / 100.0 * maxSizePercent); return Math.min(m1, (long) (maxSizeMb * 1024.0 * 1024.0)); }

Target:
private static long getChunkCacheSize(IEclipsePreferences node) { double maxSizeMb = node.getDouble(CHUNK_CACHE_SIZE_MB, CHUNK_CACHE_SIZE_MB_DEFAULT); double maxSizePercent = node.getDouble(CHUNK_CACHE_SIZE_PERCENT, CHUNK_CACHE_SIZE_PERCENT_DEFAULT); maxSizePercent = Math.max(1.0, Math.min(50.0, maxSizePercent)); maxSizeMb = Math.max(maxSizeMb, 1.0); long m1= (long) (Runtime.getRuntime().maxMemory() / 100.0 * maxSizePercent); return Math.min(m1, (long) (maxSizeMb * 1024.0 * 1024.0)); }
Source:
@Override public Binding<?> getAtInjectBinding(String key, String className, ClassLoader classLoader, boolean mustHaveInjections) { try { Binding<?> result = GeneratedAdapters.initInjectAdapter(className, classLoader); if (result == null) { classLoader = (classLoader != null) ? classLoader : ClassLoader.getSystemClassLoader(); Class<?> c = classLoader.loadClass(className); if (!c.isInterface()) { result = ReflectiveAtInjectBinding.create(c, mustHaveInjections); } } return result; } catch (ClassNotFoundException e) { throw new RuntimeException("Could not find " + className + " needed for binding " + key, e); } catch (RuntimeException e) { logNotFound("Binding", className, e); throw e; } }

Target:
@Override public Binding<?> getAtInjectBinding(String key, String className, ClassLoader classLoader, boolean mustHaveInjections) { try { Binding<?> result = GeneratedAdapters.initInjectAdapter(className, classLoader); if (result == null) { classLoader = (classLoader != null) ? classLoader : ClassLoader.getSystemClassLoader(); Class<?> c = classLoader.loadClass(className); if (!c.isInterface()) { result = ReflectiveAtInjectBinding.create(c, mustHaveInjections); } } return result; } catch (ClassNotFoundException e) { throw new RuntimeException("Could not find " + className + " needed for binding " + key, e); } }
Source:
boolean isValueNull(ByteBuffer buf, int position) { return buf.get(position + NULL_OFFSET) == 1; }

Target:
boolean isValueNull(ByteBuffer buf, int position) { return buf.get(position + NULL_OFFSET) == NullHandling.IS_NULL_BYTE; }
Source:
public void testGetDocContent_longCheckpoint() throws Exception { config.overrideKey("feed.maxUrls", "5"); adaptor.init(context); Date timestamp = new Date(); Checkpoint startCheckpoint = new Checkpoint("document", timestamp, new Id("{AAAAAAAA-0000-0000-0000-000000000004}")); RecordingResponse response = new RecordingResponse(); adaptor.getDocContent( new MockRequest(new DocId("pseudo/" + startCheckpoint)), response); RecordingDocIdPusher pusher = (RecordingDocIdPusher) context.getDocIdPusher(); Checkpoint expectedCheckpoint = new Checkpoint("document", timestamp, new Id("{AAAAAAAA-0000-0000-0000-000000000008}")); List<Record> golden = ImmutableList.of( new Record.Builder( new DocId("guid/{AAAAAAAA-0000-0000-0000-000000000005}")) .build(), new Record.Builder( new DocId("guid/{AAAAAAAA-0000-0000-0000-000000000006}")) .build(), new Record.Builder( new DocId("guid/{AAAAAAAA-0000-0000-0000-000000000007}")) .build(), new Record.Builder( new DocId("guid/{AAAAAAAA-0000-0000-0000-000000000008}")) .build(), new Record.Builder(new DocId("pseudo/" + expectedCheckpoint)) .setCrawlImmediately(true).build()); assertEquals(golden, pusher.getRecords()); }

Target:
public void testGetDocContent_longCheckpoint() throws Exception { config.overrideKey("feed.maxUrls", "5"); adaptor.init(context); Date timestamp = new Date(); Checkpoint startCheckpoint = new Checkpoint("document", timestamp, new Id("{AAAAAAAA-0000-0000-0000-000000000004}")); RecordingResponse response = new RecordingResponse(); adaptor.getDocContent( new MockRequest(newDocId(startCheckpoint)), response); Checkpoint expectedCheckpoint = new Checkpoint("document", timestamp, new Id("{AAAAAAAA-0000-0000-0000-000000000008}")); assertEquals(ImmutableList.of( new Record.Builder(newDocId("{AAAAAAAA-0000-0000-0000-000000000005}")) .build(), new Record.Builder(newDocId("{AAAAAAAA-0000-0000-0000-000000000006}")) .build(), new Record.Builder(newDocId("{AAAAAAAA-0000-0000-0000-000000000007}")) .build(), new Record.Builder(newDocId("{AAAAAAAA-0000-0000-0000-000000000008}")) .build(), new Record.Builder(newDocId(expectedCheckpoint)) .setCrawlImmediately(true).build()), getContextPusher().getRecords()); }
Source:
public void setUp() throws Exception { clearView(); setVerboseBranchMode(false); repositoryFile = createProjectAndCommitToRepository(); createRemoteRepository(repositoryFile); repoView = TestUtil.showView(RepositoriesView.VIEW_ID); repoView.setFocus(); SWTBotHyperlink link = new SWTFormsBot(repoView.bot().getFinder()) .hyperlink("Add an existing local Git repository"); link.setFocus(); link.pressShortcut(org.eclipse.swt.SWT.CR, org.eclipse.swt.SWT.LF); bot.shell("Add Git Repositories"); bot.text().setText(repositoryFile.getPath().substring(0, repositoryFile.getPath().length() - 4)); bot.button("Search").click(); bot.waitWhile(new ICondition() { @Override public boolean test() throws Exception { return bot.tree().getAllItems().length == 0; } @Override public void init(SWTBot aBot) { } @Override public String getFailureMessage() { return "Tree wasn't populated with repository"; } }); bot.tree().getAllItems()[0].check(); bot.button(IDialogConstants.FINISH_LABEL).click(); }

Target:
public void setUp() throws Exception { deleteAllProjects(); clearView(); repositoryFile = createProjectAndCommitToRepository(); createRemoteRepository(repositoryFile); Activator.getDefault().getRepositoryUtil() .addConfiguredRepository(repositoryFile); refreshAndWait(); assertHasRepo(repositoryFile); }
Source:
private void startProcessMonitor() { this.getTaskExecutor().execute(new Runnable() { @Override public void run() { int result = Integer.MIN_VALUE; try { result = process.waitFor(); if (logger.isInfoEnabled()) { logger.info("tail process terminated with value " + result); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } finally { if (process != null) { process.destroy(); process = null; } } if (isRunning()) { logger.info("Restarting tail process"); runExec(); } } }); }

Target:
private void startProcessMonitor() { this.getTaskExecutor().execute(new Runnable() { @Override public void run() { Process process = OSDelegatingFileTailingMessageProducer.this.process; if (process == null) { if (logger.isDebugEnabled()) { logger.debug("Process destroyed before starting process monitor"); } return; } int result = Integer.MIN_VALUE; try { if (logger.isDebugEnabled()) { logger.debug("Monitoring process " + process); } result = process.waitFor(); if (logger.isInfoEnabled()) { logger.info("tail process terminated with value " + result); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); logger.error("Interrupted - stopping adapter", e); stop(); } finally { destroyProcess(); } if (isRunning()) { if (logger.isInfoEnabled()) { logger.info("Restarting tail process in " + getMissingFileDelay() + " milliseconds"); } getRequiredTaskScheduler().schedule(new Runnable() { @Override public void run() { runExec(); } }, new Date(System.currentTimeMillis() + getMissingFileDelay())); } } }); }
Source:
private InternalCacheEntry localGetCacheEntry(InvocationContext ctx, Object key, boolean isWrite, FlagAffectedCommand command) throws Throwable { if (!isValueAvailableLocally(dm.getReadConsistentHash(), key)) { return null; } InternalCacheEntry ice = dataContainer.get(key); if (ice != null) { if (!ctx.replaceValue(key, ice)) { if (isWrite) entryFactory.wrapEntryForPut(ctx, key, ice, false, command, true); else ctx.putLookedUpEntry(key, ice); } return ice; } return null; }

Target:
private InternalCacheEntry localGetCacheEntry(InvocationContext ctx, Object key, boolean isWrite, FlagAffectedCommand command) throws Throwable { InternalCacheEntry ice = dataContainer.get(key); if (ice != null) { if (!ctx.replaceValue(key, ice)) { if (isWrite) entryFactory.wrapEntryForPut(ctx, key, ice, false, command, true); else ctx.putLookedUpEntry(key, ice); } return ice; } return null; }
Source:
public static byte[] getSha1(InputStream shaFis) throws IOException { MessageDigest sha1; try { sha1 = MessageDigest.getInstance("SHA-1"); int bufSiz = 1024; byte buf[] = new byte[bufSiz]; int bytesRead; while ((bytesRead = shaFis.read(buf)) != -1) { sha1.update(buf, 0, bytesRead); } } catch (NoSuchAlgorithmException e){ throw new IllegalStateException(e); } catch (IOException e) { throw e; } return sha1.digest(); }

Target:
public static byte[] getSha1(InputStream shaFis) throws IOException { MessageDigest sha1; try { sha1 = MessageDigest.getInstance("SHA-1"); int bufSiz = 1024; byte buf[] = new byte[bufSiz]; int bytesRead; while ((bytesRead = shaFis.read(buf)) != -1) { sha1.update(buf, 0, bytesRead); } } catch (NoSuchAlgorithmException e){ throw new IllegalStateException(e); } return sha1.digest(); }
Source:
public String getGID(URL url) throws MalformedURLException { Pattern p = Pattern.compile("^https?://mymangacomics.com/index.php/([a-zA-Z0-9-]*)$"); Matcher m = p.matcher(url.toExternalForm()); if (m.matches()) { return m.group(1); } throw new MalformedURLException("Expected imgur.com URL format: " + "mymangacomics.com/index.php/albumName - got " + url + " instead"); }

Target:
public String getGID(URL url) throws MalformedURLException { Pattern p = Pattern.compile("^https?://mymangacomics.com/index.php/([a-zA-Z0-9-]*)$"); Matcher m = p.matcher(url.toExternalForm()); if (m.matches()) { return m.group(1); } throw new MalformedURLException("Expected mymangacomics.com URL format: " + "mymangacomics.com/index.php/albumName - got " + url + " instead"); }
Source:
protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { try { String pathInfo = req.getPathInfo(); CIServer ciServer = CIServerFactory.getServer(pathInfo, jenkins, req.getParameterMap(), authContext.getCurrentUser(), projectService); Map<String,String[]> parameters = req.getParameterMap(); for (String parameter:parameters.keySet()){ logger.debug("doPost: parameter "+parameter+ " contains values:"); for(String value:parameters.get(parameter)){ logger.debug(" - \""+value+"\""); } } if (req.getParameter("submit").equals("Test Jenkins Settings")) { render(res, ciServer.JENKINS_SETTINGS, ciServer.testSettings()); } else { boolean clearSettings = req.getParameter("clear-settings") != null && "on".equals(req.getParameter("clear-settings")); Map<String, Object> renderLoc = ciServer.postSettings(clearSettings); if (renderLoc != null) { render(res, ciServer.JENKINS_SETTINGS, renderLoc); } else { doGet(req, res); } } } catch (Exception e) { logger.error("Exception in CIServlet.doPost: " + e.getMessage(), e); } }

Target:
protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { try { String pathInfo = req.getPathInfo(); CIServer ciServer = CIServerFactory.getServer(pathInfo, jenkins, req.getParameterMap(), authContext.getCurrentUser(), projectService); if (req.getParameter("submit").equals("Test Jenkins Settings")) { render(res, ciServer.JENKINS_SETTINGS, ciServer.testSettings()); } else { boolean clearSettings = req.getParameter("clear-settings") != null && "on".equals(req.getParameter("clear-settings")); Map<String, Object> renderLoc = ciServer.postSettings(clearSettings); if (renderLoc != null) { render(res, ciServer.JENKINS_SETTINGS, renderLoc); } else { doGet(req, res); } } } catch (Exception e) { logger.error("Exception in CIServlet.doPost: " + e.getMessage(), e); } }
Source:
public void create() { if (cidrlist != null) { throw new InvalidParameterValueException( "Parameter cidrList is deprecated; if you need to open firewall rule for the specific cidr, please refer to createFirewallRule command"); } Ip privateIp = getVmSecondaryIp(); if (privateIp != null) { if (!NetUtils.isValidIp4(privateIp.toString())) { throw new InvalidParameterValueException("Invalid vm ip address"); } } try { PortForwardingRule result = _rulesService.createPortForwardingRule(this, virtualMachineId, privateIp, getOpenFirewall(), isDisplay()); setEntityId(result.getId()); setEntityUuid(result.getUuid()); } catch (NetworkRuleConflictException ex) { s_logger.info("Network rule conflict: " + ex.getMessage()); s_logger.trace("Network Rule Conflict: ", ex); throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage()); } }

Target:
public void create() { if (cidrlist != null) { throw new InvalidParameterValueException( "Parameter cidrList is deprecated; if you need to open firewall rule for the specific cidr, please refer to createFirewallRule command"); } Ip privateIp = getVmSecondaryIp(); if (privateIp != null) { if (!NetUtils.isValidIp4(privateIp.toString())) { throw new InvalidParameterValueException("Invalid vm ip address"); } } try { PortForwardingRule result = _rulesService.createPortForwardingRule(this, virtualMachineId, privateIp, getOpenFirewall(), isDisplay()); setEntityId(result.getId()); setEntityUuid(result.getUuid()); } catch (NetworkRuleConflictException ex) { s_logger.trace("Network Rule Conflict: ", ex); throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage(), ex); } }