auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected Set<Value.Immutable<?>> api$getVanillaValues() { final Set<Value.Immutable<?>> vanillaValues = new HashSet<>(); vanillaValues.add(this.displayName().asImmutable()); vanillaValues.add(this.passengers().asImmutable()); vanillaValues.add(this.onGround().asImmutable()); vanillaValues.add(this.velocity().asImmutable()); vanillaValues.add(this.gravity().asImmutable()); if (this.shadow$getLowestRidingEntity() != null) { this.baseVehicle().map(Value::asImmutable).ifPresent(vanillaValues::add); } return vanillaValues; }

Target:
protected Set<Value.Immutable<?>> api$getVanillaValues() { final Set<Value.Immutable<?>> values = new HashSet<>(); values.add(this.displayName().asImmutable()); values.add(this.passengers().asImmutable()); values.add(this.onGround().asImmutable()); values.add(this.velocity().asImmutable()); values.add(this.gravity().asImmutable()); values.add(this.silent().asImmutable()); this.baseVehicle().map(Value::asImmutable).ifPresent(values::add); this.creator().map(Value::asImmutable).ifPresent(values::add); this.notifier().map(Value::asImmutable).ifPresent(values::add); this.fireTicks().map(Value::asImmutable).ifPresent(values::add); return values; }
Source:
public EachQuorumTokenRingDiagnosticGenerator( @NonNull Metadata metadata, @NonNull KeyspaceMetadata keyspace, @NonNull Map<String, ReplicationFactor> replicationFactorsByDc) { super(metadata, keyspace); Objects.requireNonNull(replicationFactorsByDc, "replicationFactorsByDc cannot be null"); this.requiredReplicasByDc = replicationFactorsByDc.entrySet().stream() .collect( ImmutableMap.toImmutableMap( Entry::getKey, entry -> ConsistencyLevels.requiredReplicas( ConsistencyLevel.EACH_QUORUM, entry.getValue()))); }

Target:
public EachQuorumTokenRingDiagnosticGenerator( @NonNull Metadata metadata, @NonNull KeyspaceMetadata keyspace, @NonNull Map<String, ReplicationFactor> replicationFactorsByDc) { super(metadata, keyspace); Objects.requireNonNull(replicationFactorsByDc, "replicationFactorsByDc cannot be null"); ImmutableMap.Builder<String, Integer> replicationFactorsByDcBuilder = ImmutableMap.builder(); for (String datacenter : replicationFactorsByDc.keySet()) { int requiredReplicasInDc = ConsistencyLevels.requiredReplicas( ConsistencyLevel.EACH_QUORUM, replicationFactorsByDc.get(datacenter)); replicationFactorsByDcBuilder.put(datacenter, requiredReplicasInDc); } this.requiredReplicasByDc = replicationFactorsByDcBuilder.build(); }
Source:
public static LocalDate decryptDate(byte[] ciphertext) { if (ciphertext == null) { return null; } return LocalDate.parse(new String(decryptBytes(ciphertext), StandardCharsets.UTF_8)); }

Target:
public static LocalDate decryptDate(byte[] ciphertext) { if (ciphertext == null) { return null; } return LocalDate.parse(new String(decryptBytes(ciphertext), StandardCharsets.UTF_8), DateTimeFormatter.ISO_LOCAL_DATE); }
Source:
public void shutdownNotificationService() { if (execution != null) { execution.cancel(true); } if (enabled) { notifiers.forEach(NotifierHandler::destroy); } }

Target:
public void shutdownNotificationService() { notifiers.forEach(NotifierHandler::destroy); }
Source:
public void testDecode() { byte[] b = new byte[2048]; new Random().nextBytes(b); ch.writeInbound(wrappedBuffer(b)); assertThat(ch.readInbound(), is(b)); }

Target:
public void testDecode() { byte[] b = new byte[2048]; new Random().nextBytes(b); ch.writeInbound(wrappedBuffer(b)); assertThat((byte[]) ch.readInbound(), is(b)); }
Source:
private Gson buildGson() { return new GsonBuilder() .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ") .registerTypeAdapter(Person.class, new Person.PersonSerializer()).create(); }

Target:
private Gson buildGson() { return new GsonBuilder() .registerTypeAdapter(Person.class, new Person.PersonSerializer()) .create(); }
Source:
public Access checkPermission(Document doc, ACP mergedAcp, NuxeoPrincipal principal, String permission, String[] resolvedPermissions, String[] additionalPrincipals) { Access access = Access.UNKNOWN; if (Boolean.TRUE.equals(ignorePolicy.get())) { return access; } if (resolvedPermissions == null || !Arrays.asList(resolvedPermissions).contains(SecurityConstants.WRITE)) { return access; } String username = principal.getName(); Lock lock = doc.getLock(); if (lock != null && !username.equals(lock.getOwner())) { access = Access.DENY; } return access; }

Target:
public Access checkPermission(Document doc, ACP mergedAcp, NuxeoPrincipal principal, String permission, String[] resolvedPermissions, String[] additionalPrincipals) { Access access = Access.UNKNOWN; if (isIgnorePolicy()) { return access; } if (resolvedPermissions == null || !Arrays.asList(resolvedPermissions).contains(SecurityConstants.WRITE)) { return access; } String username = principal.getName(); Lock lock = doc.getLock(); if (lock != null && !username.equals(lock.getOwner())) { access = Access.DENY; } return access; }
Source:
protected Map<String, Serializable> getEvaluatedInputExpressions(Map<String, SExpression> contractInputs, SExpressionContext context) throws SExpressionTypeUnknownException, SExpressionDependencyMissingException, SExpressionEvaluationException, SInvalidExpressionException { final Map<String, Serializable> inputExpressionsMap = new HashMap<>(contractInputs.size()); for (Map.Entry<String, SExpression> entry : contractInputs.entrySet()) { inputExpressionsMap.put(entry.getKey(), (Serializable) expressionResolverService.evaluate(entry.getValue(), context)); } return inputExpressionsMap; }

Target:
protected Map<String, Serializable> getEvaluatedInputExpressions(Map<String, SExpression> contractInputs, SExpressionContext context) throws SExpressionTypeUnknownException, SExpressionDependencyMissingException, SExpressionEvaluationException, SInvalidExpressionException { List<SExpression> expressions = new ArrayList<>(contractInputs.size()); expressions.addAll(contractInputs.values()); final List<Object> exprResults = expressionResolverService.evaluate(expressions, context); final Map<String, Serializable> inputExpressionsMap = new HashMap<>(contractInputs.size()); for (Map.Entry<String, SExpression> entry : contractInputs.entrySet()) { inputExpressionsMap.put(entry.getKey(), getExpressionResultWithDiscriminant(entry.getValue().getDiscriminant(), expressions, exprResults)); } return inputExpressionsMap; }
Source:
public OptionsPopupView(EventBus eventBus) { super(eventBus); connectAutomaticallyEditor = new EntityModelCheckBoxEditor(Align.RIGHT); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); connectAutomaticallyEditor.setLabel(constants.connectAutomaticallyLabel()); connectAutomaticallyMessage.setText(constants.connectAutomaticallyMessage()); publicKeyEditor.setLabel(constants.consolePublicKey()); publicKeyEditor.addContentWidgetContainerStyleName(style.publickKeyEditor()); publicKeyEditor.addContentWidgetStyleName(style.publickKeyEditor()); ViewIdHandler.idHandler.generateAndSetIds(this); driver.initialize(this); }

Target:
public OptionsPopupView(EventBus eventBus) { super(eventBus); connectAutomaticallyEditor = new EntityModelCheckBoxEditor(Align.RIGHT); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); connectAutomaticallyEditor.setLabel(constants.connectAutomaticallyLabel()); connectAutomaticallyMessage.setText(constants.connectAutomaticallyMessage()); publicKeyLabel.setText(constants.consolePublicKeyLabel()); publicKeyEditor.setLabel(constants.consolePublicKeyMessage()); publicKeyEditor.addContentWidgetContainerStyleName(style.publickKeyEditorTextArea()); publicKeyEditor.addContentWidgetStyleName(style.publickKeyEditorTextArea()); ViewIdHandler.idHandler.generateAndSetIds(this); driver.initialize(this); }
Source:
public void testReadWriteV3() throws Exception { final File file = pathOf("gitgit.index.v3"); final DirCache dc = new DirCache(file, FS.DETECTED); dc.read(); assertEquals(10, dc.getEntryCount()); assertV3TreeEntry(0, "dir1/file1.txt", false, false, dc); assertV3TreeEntry(1, "dir2/file2.txt", true, false, dc); assertV3TreeEntry(2, "dir3/file3.txt", false, false, dc); assertV3TreeEntry(3, "dir3/file3a.txt", true, false, dc); assertV3TreeEntry(4, "dir4/file4.txt", true, false, dc); assertV3TreeEntry(5, "dir4/file4a.txt", false, false, dc); assertV3TreeEntry(6, "file.txt", true, false, dc); assertV3TreeEntry(7, "newdir1/newfile1.txt", false, true, dc); assertV3TreeEntry(8, "newdir1/newfile2.txt", false, true, dc); assertV3TreeEntry(9, "newfile.txt", false, true, dc); final ByteArrayOutputStream bos = new ByteArrayOutputStream(); dc.writeTo(bos); final byte[] indexBytes = bos.toByteArray(); final byte[] expectedBytes = IO.readFully(file); for (int i = 0; i < expectedBytes.length; i++) { assertEquals(expectedBytes[i], indexBytes[i]); } }

Target:
public void testReadWriteV3() throws Exception { final File file = pathOf("gitgit.index.v3.skipWorkTree"); final DirCache dc = new DirCache(file, FS.DETECTED); dc.read(); assertEquals(7, dc.getEntryCount()); assertV3TreeEntry(0, "dir1/file1.txt", false, false, dc); assertV3TreeEntry(1, "dir2/file2.txt", true, false, dc); assertV3TreeEntry(2, "dir3/file3.txt", false, false, dc); assertV3TreeEntry(3, "dir3/file3a.txt", true, false, dc); assertV3TreeEntry(4, "dir4/file4.txt", true, false, dc); assertV3TreeEntry(5, "dir4/file4a.txt", false, false, dc); assertV3TreeEntry(6, "file.txt", true, false, dc); final ByteArrayOutputStream bos = new ByteArrayOutputStream(); dc.writeTo(bos); final byte[] indexBytes = bos.toByteArray(); final byte[] expectedBytes = IO.readFully(file); assertTrue(Arrays.equals(expectedBytes, indexBytes)); }
Source:
protected void applyRow(SnomedSimpleMapRefSetMember member, SimpleMapRefSetRow row, Collection<SnomedSimpleMapRefSetMember> componentsToAttach) { member.setUuid(row.getUuid().toString()); if (row.getEffectiveTime() != null) { member.setEffectiveTime(row.getEffectiveTime()); member.setReleased(true); } else { member.unsetEffectiveTime(); } member.setRefSet(getOrCreateRefSet(row.getRefSetId(), row.getReferencedComponentId())); member.setActive(row.isActive()); member.setModuleId(row.getModuleId()); member.setReferencedComponentId(row.getReferencedComponentId()); member.setMapTargetComponentId(row.getAssociatedComponentId()); if (extended) { member.setMapTargetComponentDescription(((SimpleMapRefSetRow) row).getMapTargetDescription()); } }

Target:
protected void applyRow(SnomedSimpleMapRefSetMember member, SimpleMapRefSetRow row, Collection<SnomedSimpleMapRefSetMember> componentsToAttach) { if (row.getEffectiveTime() != null) { member.setEffectiveTime(row.getEffectiveTime()); member.setReleased(true); } else { member.unsetEffectiveTime(); } member.setRefSet(getOrCreateRefSet(row.getRefSetId(), row.getReferencedComponentId())); member.setActive(row.isActive()); member.setModuleId(row.getModuleId()); member.setReferencedComponentId(row.getReferencedComponentId()); member.setMapTargetComponentId(row.getAssociatedComponentId()); if (hasMapTargetDescription) { member.setMapTargetComponentDescription(((SimpleMapRefSetRow) row).getMapTargetDescription()); } }
Source:
public void visit(BuiltinMap builtinMap) { for (java.util.Map.Entry<Term, Term> entry : builtinMap.getEntries().entrySet()) { entry.getKey().accept(this); entry.getValue().accept(this); } for (KItem pattern : builtinMap.collectionPatterns()) { pattern.accept(this); } for (Variable variable : builtinMap.collectionVariables()) { variable.accept(this); } for (Term term : builtinMap.collectionFunctions()) { term.accept(this); } visit((Collection) builtinMap); }

Target:
public void visit(BuiltinMap builtinMap) { for (java.util.Map.Entry<Term, Term> entry : builtinMap.getEntries().entrySet()) { entry.getKey().accept(this); entry.getValue().accept(this); } for (Term term : builtinMap.baseTerms()) { term.accept(this); } visit((Collection) builtinMap); }
Source:
Mono<Response<Void>> publishTelemetryWithResponse(String digitalTwinId, String payload, PublishTelemetryRequestOptions publishTelemetryRequestOptions, Context context) { return protocolLayer.getDigitalTwins().sendTelemetryWithResponseAsync( digitalTwinId, publishTelemetryRequestOptions.getMessageId(), payload, publishTelemetryRequestOptions.getTimestamp().toString(), context); }

Target:
Mono<Response<Void>> publishTelemetryWithResponse(String digitalTwinId, String payload, PublishTelemetryRequestOptions publishTelemetryRequestOptions, Context context) { Object payloadObject = null; try { payloadObject = mapper.readValue(payload, Object.class); } catch (JsonProcessingException e) { logger.error("Could not parse the payload [%s]: %s", payload, e); return Mono.error(e); } return protocolLayer.getDigitalTwins().sendTelemetryWithResponseAsync( digitalTwinId, publishTelemetryRequestOptions.getMessageId(), payloadObject, publishTelemetryRequestOptions.getTimestamp().toString(), context); }
Source:
@Test public void createZipFileSystemFromExistingTest() throws IOException, JarToBundleConverterException { FileSystem fileSystem = BundleGeneratorUtils.createZipFileSystem(TestConstants.SAMPLE_JAR_FILE, false); Assert.assertNotNull(fileSystem); fileSystem.close(); }

Target:
public void createZipFileSystemFromExistingTest() throws IOException, JarToBundleConverterException { FileSystem fileSystem = BundleGeneratorUtils.createZipFileSystem(TestConstants.SAMPLE_JAR_FILE, false); Assert.assertNotNull(fileSystem); fileSystem.close(); }
Source:
public void test_self_ref_with_parents() throws Exception { FindRequest fr=new FindRequest(); fr.setQuery(query("{'field':'_id','op':'=','rvalue':'img1'}")); fr.setProjection(projection("[{'field':'*','recursive':true},{'field':'vulnerabilities.*.packages.*.fixed_by_images.*'}]")); fr.setEntityVersion(new EntityVersion("containerImage-self","0.0.1")); Response response=mediator.find(fr); System.out.println(response.getEntityData()); }

Target:
public void test_self_ref_with_parents() throws Exception { FindRequest fr=new FindRequest(); fr.setQuery(query("{'field':'_id','op':'=','rvalue':'img1'}")); fr.setProjection(projection("[{'field':'*','recursive':true},{'field':'vulnerabilities.*.packages.*.fixed_by_images.*'}]")); fr.setEntityVersion(new EntityVersion("containerImage-self","0.0.1")); Response response=mediator.find(fr); System.out.println(response.getEntityData()); Assert.assertEquals(1,response.getEntityData().size()); Assert.assertTrue(response.getEntityData().get(0).get("vulnerabilities").get(0).get("packages").get(0).get("fixed_by_images").size()==1); }
Source:
public Builder mergeFrom(io.netty.example.worldclock.WorldClockProtocol.Locations other) { if (other == io.netty.example.worldclock.WorldClockProtocol.Locations.getDefaultInstance()) { return this; } if (locationBuilder_ == null) { if (!other.location_.isEmpty()) { if (location_.isEmpty()) { location_ = other.location_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureLocationIsMutable(); location_.addAll(other.location_); } onChanged(); } } else { if (!other.location_.isEmpty()) { if (locationBuilder_.isEmpty()) { locationBuilder_.dispose(); locationBuilder_ = null; location_ = other.location_; bitField0_ = (bitField0_ & ~0x00000001); locationBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getLocationFieldBuilder() : null; } else { locationBuilder_.addAllMessages(other.location_); } } } this.mergeUnknownFields(other.getUnknownFields()); return this; }

Target:
public Builder mergeFrom(io.netty.example.worldclock.WorldClockProtocol.Locations other) { if (other == io.netty.example.worldclock.WorldClockProtocol.Locations.getDefaultInstance()) return this; if (locationBuilder_ == null) { if (!other.location_.isEmpty()) { if (location_.isEmpty()) { location_ = other.location_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureLocationIsMutable(); location_.addAll(other.location_); } onChanged(); } } else { if (!other.location_.isEmpty()) { if (locationBuilder_.isEmpty()) { locationBuilder_.dispose(); locationBuilder_ = null; location_ = other.location_; bitField0_ = (bitField0_ & ~0x00000001); locationBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getLocationFieldBuilder() : null; } else { locationBuilder_.addAllMessages(other.location_); } } } this.mergeUnknownFields(other.getUnknownFields()); return this; }
Source:
public void enteringVertex(ModelClass object, Vertex vertex) { this.registry.addEntry(object, vertex); sendNewModelEvent(MessageType.ENTERING_VERTEX, object.getClass().getCanonicalName(), getIdentifierOf(object), vertex.getClass().getCanonicalName()); }

Target:
public void enteringVertex(ModelClass object, Vertex vertex) { String vertexName = vertex.getClass().getCanonicalName(); server.register(object, vertexName); sendNewModelEvent(MessageType.ENTERING_VERTEX, object.getClass().getCanonicalName(), getIdentifierOf(object), vertexName); }
Source:
public ParseStatus parseJavadocAsDetailNode(DetailAST javadocCommentAst) { blockCommentLineNumber = javadocCommentAst.getLineNo(); final String javadocComment = JavadocUtils.getJavadocCommentContent(javadocCommentAst); errorListener = new DescriptiveErrorListener(); errorListener.setOffset(javadocCommentAst.getLineNo() - 1); final ParseStatus result = new ParseStatus(); try { final ParseTree parseTree = parseJavadocAsParseTree(javadocComment); final DetailNode tree = convertParseTreeToDetailNode(parseTree); adjustFirstLineToJavadocIndent(tree, javadocCommentAst.getColumnNo() + JAVADOC_START.length()); result.setTree(tree); } catch (ParseCancellationException | IllegalArgumentException ex) { ParseErrorMessage parseErrorMessage = null; if (ex.getCause() instanceof FailedPredicateException || ex.getCause() instanceof NoViableAltException) { final RecognitionException recognitionEx = (RecognitionException) ex.getCause(); if (recognitionEx.getCtx() instanceof JavadocParser.HtmlElementContext || recognitionEx.getCtx() instanceof JavadocParser.HtmlTagContext) { parseErrorMessage = generateMissedHtmlTagErrorMessage(recognitionEx); } } if (parseErrorMessage == null) { parseErrorMessage = errorListener.getErrorMessage(); } if (parseErrorMessage == null) { parseErrorMessage = new ParseErrorMessage(javadocCommentAst.getLineNo(), MSG_KEY_UNRECOGNIZED_ANTLR_ERROR, javadocCommentAst.getColumnNo(), ex.getMessage()); } result.setParseErrorMessage(parseErrorMessage); } return result; }

Target:
public ParseStatus parseJavadocAsDetailNode(DetailAST javadocCommentAst) { blockCommentLineNumber = javadocCommentAst.getLineNo(); final String javadocComment = JavadocUtils.getJavadocCommentContent(javadocCommentAst); errorListener = new DescriptiveErrorListener(); errorListener.setOffset(javadocCommentAst.getLineNo() - 1); final ParseStatus result = new ParseStatus(); try { final ParseTree parseTree = parseJavadocAsParseTree(javadocComment); final DetailNode tree = convertParseTreeToDetailNode(parseTree); adjustFirstLineToJavadocIndent(tree, javadocCommentAst.getColumnNo() + JAVADOC_START.length()); result.setTree(tree); } catch (ParseCancellationException | IllegalArgumentException ex) { ParseErrorMessage parseErrorMessage = null; if (ex.getCause() instanceof FailedPredicateException || ex.getCause() instanceof NoViableAltException) { final RecognitionException recognitionEx = (RecognitionException) ex.getCause(); if (recognitionEx.getCtx() instanceof JavadocParser.HtmlTagContext) { final Token htmlTagNameStart = getMissedHtmlTag(recognitionEx); parseErrorMessage = new ParseErrorMessage( errorListener.offset + htmlTagNameStart.getLine(), MSG_JAVADOC_MISSED_HTML_CLOSE, htmlTagNameStart.getCharPositionInLine(), htmlTagNameStart.getText()); } } if (parseErrorMessage == null) { parseErrorMessage = errorListener.getErrorMessage(); } result.setParseErrorMessage(parseErrorMessage); } return result; }
Source:
public String getUnifiedDiff() { PatchList patchList; try { patchList = getPatchList(); if (patchList.getOldId() == null) { return "[Octopus merge, cannot be formatted as a diff.]"; } } catch (PatchListNotAvailableException e) { log.error("Cannot format patch", e); return ""; } TemporaryBuffer.Heap buf = new TemporaryBuffer.Heap(args.settings.maximumDiffSize); DiffFormatter fmt = new DiffFormatter(buf); Repository git; try { git = args.server.openRepository(change.getProject()); } catch (IOException e) { log.error("Cannot open repository to format patch", e); return ""; } try { fmt.setRepository(git); fmt.setDetectRenames(true); fmt.format(patchList.getOldId(), patchList.getNewId()); return RawParseUtils.decode(buf.toByteArray()); } catch (IOException e) { if (JGitText.get().inMemoryBufferLimitExceeded.equals(e.getMessage())) { return ""; } log.error("Cannot format patch", e); return ""; } finally { fmt.release(); git.close(); } }

Target:
public String getUnifiedDiff() { PatchList patchList; try { patchList = getPatchList(); if (patchList.getOldId() == null) { return "[Octopus merge; cannot be formatted as a diff.]\n"; } } catch (PatchListNotAvailableException e) { log.error("Cannot format patch", e); return ""; } TemporaryBuffer.Heap buf = new TemporaryBuffer.Heap(args.settings.maximumDiffSize); DiffFormatter fmt = new DiffFormatter(buf); Repository git; try { git = args.server.openRepository(change.getProject()); } catch (IOException e) { log.error("Cannot open repository to format patch", e); return ""; } try { fmt.setRepository(git); fmt.setDetectRenames(true); fmt.format(patchList.getOldId(), patchList.getNewId()); return RawParseUtils.decode(buf.toByteArray()); } catch (IOException e) { if (JGitText.get().inMemoryBufferLimitExceeded.equals(e.getMessage())) { return ""; } log.error("Cannot format patch", e); return ""; } finally { fmt.release(); git.close(); } }
Source:
public static List<Pair<EditableDeviceOnVmStatusField, Boolean>> getVmDevicesFieldsToUpdateOnNextRun( Guid vmId, VMStatus vmStatus, Object objectWithEditableDeviceFields) { List<Pair<EditableDeviceOnVmStatusField, Boolean>> fieldList = new ArrayList<>(); List<Pair<EditableDeviceOnVmStatusField , Field>> pairList = BaseHandler.extractAnnotatedFields( EditableDeviceOnVmStatusField.class, objectWithEditableDeviceFields.getClass()); for (Pair<EditableDeviceOnVmStatusField, Field> pair : pairList) { EditableDeviceOnVmStatusField annotation = pair.getFirst(); Field field = pair.getSecond(); field.setAccessible(true); Boolean isEnabled = null; try { isEnabled = (Boolean) field.get(objectWithEditableDeviceFields); } catch (IllegalAccessException | ClassCastException e) { log.warn("VmHandler:: isUpdateValidForVmDevices: Reflection error"); } String device = null; if (annotation.type() != VmDeviceType.UNKNOWN) { device = annotation.type().getName(); } if (isEnabled == null || !VmDeviceUtils.vmDeviceChanged(vmId, annotation.generalType(), device, isEnabled)) { continue; } if (!VmHandler.isUpdateValidForVmDevice(field.getName(), vmStatus)) { fieldList.add(new Pair<>(annotation, isEnabled)); } } return fieldList; }

Target:
public static List<Pair<EditableDeviceOnVmStatusField, Boolean>> getVmDevicesFieldsToUpdateOnNextRun( Guid vmId, VMStatus vmStatus, Object objectWithEditableDeviceFields) { List<Pair<EditableDeviceOnVmStatusField, Boolean>> fieldList = new ArrayList<>(); List<Pair<EditableDeviceOnVmStatusField , Field>> pairList = BaseHandler.extractAnnotatedFields( EditableDeviceOnVmStatusField.class, objectWithEditableDeviceFields.getClass()); for (Pair<EditableDeviceOnVmStatusField, Field> pair : pairList) { EditableDeviceOnVmStatusField annotation = pair.getFirst(); Field field = pair.getSecond(); field.setAccessible(true); Boolean isEnabled = null; try { isEnabled = (Boolean) field.get(objectWithEditableDeviceFields); } catch (IllegalAccessException | ClassCastException e) { log.warn("VmHandler:: isUpdateValidForVmDevices: Reflection error"); log.debug("Original exception was:", e); } String device = null; if (annotation.type() != VmDeviceType.UNKNOWN) { device = annotation.type().getName(); } if (isEnabled == null || !VmDeviceUtils.vmDeviceChanged(vmId, annotation.generalType(), device, isEnabled)) { continue; } if (!VmHandler.isUpdateValidForVmDevice(field.getName(), vmStatus)) { fieldList.add(new Pair<>(annotation, isEnabled)); } } return fieldList; }
Source:
private void rollbackTransaction() { if (!unitOfWork.transactional()) { return; } final Transaction txn = session.getTransaction(); if (txn != null && (txn.getStatus() == ACTIVE || txn.getStatus() == MARKED_ROLLBACK)) { txn.rollback(); } }

Target:
private void rollbackTransaction() { if (!unitOfWork.transactional()) { return; } final Transaction txn = session.getTransaction(); if (txn != null && txn.getStatus().canRollback()) { txn.rollback(); } }
Source:
public MetricServiceExecutorConf getServerMetricConf() { return MetricServiceExecutorConf.newBuilder() .setCustomMetricCodec(ETDolphinMetricMsgCodec.class) .build(); }

Target:
public MetricServiceExecutorConf getServerMetricConf() { return MetricServiceExecutorConf.newBuilder() .setMetricFlushPeriodMs(serverMetricFlushPeriodMs) .build(); }
Source:
private ByteBuffer parsePacketIDBAndNRB(int blockLength) throws IOException { ByteBuffer pcapPacketData; pcapPacketData = ByteBuffer.allocate(blockLength - PcapFileValues.PCAPNG_PACKET_HEADER_SIZE); pcapPacketData.position(PcapFileValues.PCAPNG_PACKET_HEADER_SIZE); pcapPacketData.clear(); SeekableByteChannel fFileChannel; try { fFileChannel = getFileChannel(); fFileChannel.read(pcapPacketData); } catch (BadPcapFileException e1) { } pcapPacketData.flip(); return pcapPacketData; }

Target:
private ByteBuffer parsePacketIDBAndNRB(int blockLength) throws IOException { ByteBuffer pcapPacketData; pcapPacketData = ByteBuffer.allocate(blockLength - PcapFileValues.PCAPNG_PACKET_HEADER_SIZE); pcapPacketData.clear(); SeekableByteChannel fFileChannel; try { fFileChannel = getFileChannel(); fFileChannel.read(pcapPacketData); } catch (BadPcapFileException e1) { } pcapPacketData.flip(); return pcapPacketData; }
Source:
public DataTransactionResult remove(DataHolder dataHolder) { if (supports(dataHolder)) { if (dataHolder instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) dataHolder; player.capabilities.allowFlying = false; } else { ((net.minecraft.entity.Entity) (dataHolder)).isAirBorne = false; } return DataTransactionBuilder.builder().result(DataTransactionResult.Type.SUCCESS).build(); } return DataTransactionBuilder.builder().result(DataTransactionResult.Type.FAILURE).build(); }

Target:
public DataTransactionResult remove(DataHolder dataHolder) { return DataTransactionBuilder.failNoData(); }
Source:
CommonMetrics() { _metrics = MetricsManager.INSTANCE.getRegistry(); setupAllMetrics(); }

Target:
CommonMetrics() { registry = MetricsManager.INSTANCE.getRegistry(); setupAllMetrics(); }
Source:
public void removeService(Object service) { Path path = service.getClass().getAnnotation(Path.class); if (path != null) { services.remove(path.value()); updateMetadata(); } else { log.warn("Service removal fail, class '" + service.getClass().getName() + "' doesn't contain a root Path"); } }

Target:
public void removeService(Object service) { if (service == null) { log.error("Service cannot be null."); return; } Path path = service.getClass().getAnnotation(Path.class); if (path == null) { log.warn("Service removal failed. Microservice class '" + service.getClass().getName() + "' doesn't contain a root Path."); return; } services.remove(path.value()); updateMetadata(); }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { binding = DataBindingUtil.inflate(inflater, R.layout.fragment_view_subjects, container, false); initSubjectsGrid(); initSubjectsSearch(); if (savedInstanceState != null) { searchQuery = savedInstanceState.getString("query"); if (!TextUtils.isEmpty(searchQuery)) { performSearch(searchQuery); } } analyticsRegistry.trackScreenView(Analytics.Screens.ALL_SUBJECTS); return binding.getRoot(); }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { binding = DataBindingUtil.inflate(inflater, R.layout.fragment_view_subjects, container, false); initSubjectsGrid(); initSubjectsSearch(); if (savedInstanceState != null) { searchQuery = savedInstanceState.getString(KEY_SEARCH_QUERY); if (!TextUtils.isEmpty(searchQuery)) { performSearch(searchQuery); } } analyticsRegistry.trackScreenView(Analytics.Screens.ALL_SUBJECTS); return binding.getRoot(); }
Source:
public void adsFandomBtfBlockMobile(String article) { String testedPage = urlBuilder.getUrlForFandomPage(article); AdsFandomObject fandomPage = new AdsFandomObject(driver, testedPage); getJquery(); fandomPage.verifyTopLeaderboard(); fandomPage.verifyTopBoxad(); fandomPage.verifyNoBottomBoxad(); fandomPage.verifyNoBottomLeaderboard(); }

Target:
public void adsFandomBtfBlockMobile(String article) { AdsFandomObject fandomPage = loadPage(article); fandomPage.verifySlot(AdsFandomContent.TOP_LEADERBOARD); fandomPage.verifySlot(AdsFandomContent.TOP_BOXAD); Assertion.assertNull(fandomPage.getSlot(AdsFandomContent.BOTTOM_BOXAD), ASSERT_MESSAGE); Assertion.assertNull(fandomPage.getSlot(AdsFandomContent.BOTTOM_LEADERBOARD), ASSERT_MESSAGE); }
Source:
public Selector parseRawSelector(String selector) { if (!selector.startsWith("@")) { throw new IllegalArgumentException("Invalid selector " + selector); } int argListIndex = selector.indexOf('['); if (argListIndex < 0) { argListIndex = selector.length(); } String typeStr = selector.substring(1, argListIndex); Optional<SelectorType> type = Sponge.getGame().getRegistry().getType(SelectorType.class, typeStr); if (!type.isPresent()) { throw new IllegalArgumentException("No type known as '" + typeStr + "'"); } try { Map<String, String> rawMap; if (argListIndex == selector.length()) { rawMap = ImmutableMap.of(); } else { rawMap = PlayerSelector.getArgumentMap(selector.substring(argListIndex + 1, selector.length() - 1)); } Map<ArgumentType<?>, Argument<?>> arguments = parseArguments(rawMap); return new SpongeSelector(type.get(), ImmutableMap.copyOf(arguments)); } catch (Exception e) { throw new IllegalArgumentException("Invalid selector " + selector, e); } }

Target:
public Selector parseRawSelector(String selector) { if (!selector.startsWith("@")) { throw new IllegalArgumentException("Invalid selector " + selector); } int argListIndex = selector.indexOf('['); if (argListIndex < 0) { argListIndex = selector.length(); } String typeStr = selector.substring(1, argListIndex); if (!idToType.containsKey(typeStr)) { throw new IllegalArgumentException("No type known as '" + typeStr + "'"); } SelectorType type = idToType.get(typeStr); try { Map<String, String> rawMap; if (argListIndex == selector.length()) { rawMap = ImmutableMap.of(); } else { rawMap = PlayerSelector.getArgumentMap(selector.substring(argListIndex + 1, selector.length() - 1)); } Map<ArgumentType<?>, Argument<?>> arguments = parseArguments(rawMap); return new SpongeSelector(type, ImmutableMap.copyOf(arguments)); } catch (Exception e) { throw new IllegalArgumentException("Invalid selector " + selector, e); } }
Source:
public final boolean equals(Object that) { if (this == that) return true; if (that == null || getClass() != that.getClass()) return false; return name.equals(((Label)that).name); }

Target:
public final boolean equals(Object that) { if (this == that) return true; if (that == null || getClass() != that.getClass()) return false; return matches(((Label)that).name); }
Source:
public short readShort() { short v = (short) (bytes[pos] << 8 | (bytes[pos + 1] & 0xff)); pos += 2; return v; }

Target:
public short readShort() throws EOFException { checkPosLength(2); short v = (short) (bytes[pos] << 8 | (bytes[pos + 1] & 0xff)); pos += 2; return v; }
Source:
private List<? extends Reference> getReferences(JSONArray jsonReferences) { List<Reference> result = new LinkedList<>(); for (int i = 0; i < jsonReferences.length(); i++) { try { JSONArray jsonSingleRef = jsonReferences.getJSONArray(i); List<ValueSnak> valueSnaks = new LinkedList<>(); for (int j = 0; j < jsonSingleRef.length(); j++) { try { JSONArray jsonValueSnak = jsonSingleRef.getJSONArray(j); ValueSnak currentValueSnak = this .getValueSnak(jsonValueSnak); valueSnaks.add(currentValueSnak); } catch (JSONException e) { continue; } } Reference singleReference = factory.getReference(valueSnaks); result.add(singleReference); } catch (JSONException e) { continue; } } return result; }

Target:
private List<? extends Reference> getReferences(JSONArray jsonReferences) { List<Reference> result = new ArrayList<>(jsonReferences.length()); for (int i = 0; i < jsonReferences.length(); i++) { try { JSONArray jsonRef = jsonReferences.getJSONArray(i); result.add(this.getReference(jsonRef)); } catch (JSONException e) { JsonConverter.logger .error("Problem when parsing reference. Error was: " + e.toString()); } } return result; }
Source:
public static String exec(String cmd) throws IOException { LOG.debug("Shell cmd: {}", cmd); Process process = new ProcessBuilder(new String[]{ "/bin/bash", "-c", cmd }).start(); try { process.waitFor(); String output = IOUtils.toString(process.getInputStream(), Charsets.UTF_8); String errorOutput = IOUtils.toString(process.getErrorStream(), Charsets.UTF_8); LOG.debug("Shell Output: {}", output); if (errorOutput.length() != 0) { LOG.error("Shell Error Output: {}", errorOutput); throw new IOException(errorOutput); } return output; } catch (InterruptedException | ClosedByInterruptException ie) { throw new IOException(ie); } }

Target:
public static String exec(String cmd) throws IOException { LOG.debug("Shell cmd: {}", cmd); Process process = new ProcessBuilder(new String[]{ "/bin/bash", "-c", cmd }).start(); try { process.waitFor(); String output = IOUtils.toString(process.getInputStream()); String errorOutput = IOUtils.toString(process.getErrorStream()); LOG.debug("Shell Output: {}", output); if (errorOutput.length() != 0) { LOG.error("Shell Error Output: {}", errorOutput); throw new IOException(errorOutput); } return output; } catch (InterruptedException | ClosedByInterruptException ie) { throw new IOException(ie); } }
Source:
private String getLatestConceptMapVersion(TranslationRequest theTranslationRequest) { Pageable page = PageRequest.of(0, 1); List<TermConceptMap> theConceptMapList = myConceptMapDao.findTermConceptMapByUrl(page, theTranslationRequest.getUrl().asStringValue()); if (!theConceptMapList.isEmpty()) { return theConceptMapList.get(0).getVersion(); } return null; }

Target:
private String getLatestConceptMapVersion(TranslationRequest theTranslationRequest) { Pageable page = PageRequest.of(0, 1); List<TermConceptMap> theConceptMapList = myConceptMapDao.getTermConceptMapEntitiesByUrlOrderByVersion(page, theTranslationRequest.getUrl().asStringValue()); if (!theConceptMapList.isEmpty()) { return theConceptMapList.get(0).getVersion(); } return null; }
Source:
public boolean onHttpRequestSend(HttpMessage msg) { try { String url = msg.getRequestHeader().getURI().toString(); String path = msg.getRequestHeader().getURI().getPath(); LOGGER.debug("Callback received for URL : " + url + " path : " + path); if (path.startsWith("/" + TEST_PREFIX)) { String str = Constant.messages.getString("callback.test.msg", url, msg.getRequestHeader().getSenderAddress().toString()); if (View.isInitialised()) { View.getSingleton().getOutputPanel() .appendAsync(str + "\n"); } else { LOGGER.info(str); } return true; } else if (path.startsWith("/favicon.ico")) { return true; } for (Entry<String, CallbackImplementor> callback : callbacks .entrySet()) { if (path.startsWith(callback.getKey())) { callback.getValue().handleCallBack(msg.cloneAll()); return true; } } LOGGER.error("No callback handler for URL : " + url); } catch (URIException e) { LOGGER.error(e.getMessage(), e); } return true; }

Target:
public boolean onHttpRequestSend(HttpMessage msg) { try { String url = msg.getRequestHeader().getURI().toString(); String path = msg.getRequestHeader().getURI().getPath(); LOGGER.debug("Callback received for URL : " + url + " path : " + path + " from " + msg.getRequestHeader().getSenderAddress()); if (path.startsWith("/" + TEST_PREFIX)) { String str = Constant.messages.getString( "callback.test.msg", url, msg.getRequestHeader() .getSenderAddress().toString()); if (View.isInitialised()) { View.getSingleton().getOutputPanel() .appendAsync(str + "\n"); } LOGGER.info(str); return true; } else if (path.startsWith("/favicon.ico")) { return true; } for (Entry<String, CallbackImplementor> callback : callbacks .entrySet()) { if (path.startsWith(callback.getKey())) { callback.getValue().handleCallBack(msg.cloneAll()); return true; } } LOGGER.error("No callback handler for URL : " + url + " from " + msg.getRequestHeader().getSenderAddress()); } catch (URIException e) { LOGGER.error(e.getMessage(), e); } return true; }
Source:
public Builder keyStore(File file) { if (file == null) { return this; } if (!file.exists()) { throw new IllegalArgumentException("Keystore file does not exist: " + file); } this.keyStoreSource = Files.asByteSource(file); return this; }

Target:
public Builder keyStore(File file) { if (file == null || !file.exists()) { throw new IllegalArgumentException("A file with the keystore must be provided."); } this.keyStoreSource = Files.asByteSource(file); return this; }
Source:
private void logRunningAsyncTasks(List<AsyncTask> asyncTasks) { String runningTasks = asyncTasks .stream() .map(AsyncTask::toString) .collect(Collectors.joining(", ")); log.warn("There are running tasks: '{}'", runningTasks); }

Target:
private void logRunningAsyncTasks(List<AsyncTask> asyncTasks) { String runningTasks = asyncTasks .stream() .map(AsyncTask::toString) .collect(Collectors.joining("\n")); log.warn("There are running tasks: '{}'", runningTasks); }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; HostMetricTagsPair that = (HostMetricTagsPair) o; if (!metric.equals(that.metric)) return false; if (!metric.equals(that.metric)) return false; return tags != null ? tags.equals(that.tags) : that.tags == null; }

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; HostMetricTagsPair that = (HostMetricTagsPair) o; if (!metric.equals(that.metric) || !host.equals(that.host)) return false; return tags != null ? tags.equals(that.tags) : that.tags == null; }
Source:
public void testAllBatchesReturned() throws DbException { final Schema schema = new Schema(ImmutableList.of(Type.STRING_TYPE), ImmutableList.of("joined_ints")); final TupleBatchBuffer input = new TupleBatchBuffer(schema); final long expectedResults = 2 * TupleBatch.BATCH_SIZE + 1; final int intsInRow = 10; for (long i = 0; i < (expectedResults / intsInRow) + 1; ++i) { final int remainder = (int) (expectedResults % intsInRow); final int intsToConcatSize; if ((expectedResults - (i * intsInRow)) == remainder) { intsToConcatSize = remainder; } else { intsToConcatSize = intsInRow; } final long[] intsToConcat = new long[intsToConcatSize]; for (int j = 0; j < intsToConcatSize; ++j) { intsToConcat[j] = (i * intsInRow) + j; } input.putString(0, Longs.join(",", intsToConcat)); } Split splitOp = new Split(new TupleSource(input), 0, ","); splitOp.open(TestEnvVars.get()); TupleBatch result; long rowIdx = 0; while (!splitOp.eos()) { result = splitOp.nextReady(); if (result != null) { assertEquals(schema.numColumns(), result.getSchema().numColumns()); assertEquals(Type.STRING_TYPE, result.getSchema().getColumnType(0)); for (int batchIdx = 0; batchIdx < result.numTuples(); ++batchIdx, ++rowIdx) { assertEquals(rowIdx, Long.parseLong(result.getString(0, batchIdx))); } } } assertEquals(expectedResults, rowIdx); splitOp.close(); }

Target:
public void testAllBatchesReturned() throws DbException { final Schema schema = Schema.ofFields("joined_ints", Type.STRING_TYPE); final Schema expectedResultSchema = Schema.appendColumn(schema, Type.STRING_TYPE, "joined_ints_splits"); final TupleBatchBuffer input = new TupleBatchBuffer(schema); final long expectedResults = 2 * TupleBatch.BATCH_SIZE + 1; StringBuilder sb = new StringBuilder(); for (int i = 0; i < expectedResults; ++i) { sb.append(i); if (i < expectedResults - 1) { sb.append(","); } } input.putString(0, sb.toString()); Split splitOp = new Split(new TupleSource(input), 0, ","); splitOp.open(TestEnvVars.get()); long rowIdx = 0; while (!splitOp.eos()) { TupleBatch result = splitOp.nextReady(); if (result != null) { assertEquals(expectedResultSchema, result.getSchema()); for (int batchIdx = 0; batchIdx < result.numTuples(); ++batchIdx, ++rowIdx) { assertEquals(rowIdx, Integer.parseInt(result.getString(1, batchIdx))); } } } assertEquals(expectedResults, rowIdx); splitOp.close(); }
Source:
private void markOperationStart() { logger.trace("{} started for {}", operationType, blobId); operationStartTime = System.currentTimeMillis(); }

Target:
void markOperationStart() { logger.trace("{} started for {}", operationType, blobId); operationStartTime = System.currentTimeMillis(); }
Source:
public Map<String, String> getMeta() { Map<String, String> meta = new HashMap<>(); meta.put(InfrastructureManager.ELASTIC, "false"); return meta; }

Target:
public Map<String, String> getMeta() { return meta; }
Source:
protected void setActionMessageParameters() { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ADD); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__NETWORK_QOS); }

Target:
protected void setActionMessageParameters() { addCanDoActionMessage(VdcBllMessages.VAR__TYPE__NETWORK_QOS); }
Source:
public void parse(File reportFile) throws IOException { try { for (SuiteResult suiteResult : SuiteResult.parse(reportFile, keepLongStdio)) add(suiteResult); } catch (InterruptedException e) { throw new IOException("Failed to read "+reportFile,e); } catch (RuntimeException e) { throw new IOException("Failed to read "+reportFile,e); } catch (DocumentException e) { String reportFileContent = null; try { reportFileContent = Files.toString(reportFile, UTF_8); } catch (Exception ee) { } if (!reportFile.getPath().endsWith(".xml")) { throw new IOException("Failed to parse "+reportFile+"\n"+ "Is this really a JUnit report file? Your configuration may be matching too many files? The file contains:\n\n" + reportFileContent + "\n\n",e); } else { SuiteResult sr = new SuiteResult(reportFile.getName(), "", ""); StringWriter writer = new StringWriter(); e.printStackTrace(new PrintWriter(writer)); String error = "Failed to parse test report file "+reportFile.getAbsolutePath()+"\n The file contains:\n\n" + reportFileContent + "\n\n"+writer.toString(); sr.addCase(new CaseResult(sr,"[failed-to-read]",error)); add(sr); } } }

Target:
public void parse(File reportFile) throws IOException { parse(reportFile, null); }
Source:
protected Position handlePosition(Position position) { String attributesString = Context.getDeviceManager().lookupAttributeString(position.getDeviceId(), "processing.copyAttributes", null, false); Position last = getLastPosition(position.getDeviceId()); if (attributesString != null && last != null) { for (String attribute : attributesString.split(" ")) { if (last.getAttributes().containsKey(attribute) && !position.getAttributes().containsKey(attribute)) { position.getAttributes().put(attribute, last.getAttributes().get(attribute)); } } } return position; }

Target:
protected Position handlePosition(Position position) { String attributesString = Context.getDeviceManager().lookupAttributeString( position.getDeviceId(), "processing.copyAttributes", null, true); Position last = getLastPosition(position.getDeviceId()); if (attributesString != null && last != null) { for (String attribute : attributesString.split(" ")) { if (last.getAttributes().containsKey(attribute) && !position.getAttributes().containsKey(attribute)) { position.getAttributes().put(attribute, last.getAttributes().get(attribute)); } } } return position; }
Source:
protected final SClass getEnclosingClass(final SObjectWithClass rcvr) { SClass lexicalClass = rcvr.getSOMClass().getClassCorrespondingTo(mixinId); if (lexicalClass == null) { lexicalClass = rcvr.getSOMClass().getClassWithMixinCorrespondingTo(mixinId); } assert lexicalClass != null; return lexicalClass; }

Target:
protected final SClass getEnclosingClass(final SObjectWithClass rcvr) { SClass rcvrClass = rcvr.getSOMClass(); SClass lexicalClass = rcvrClass.lookupClass(mixinId); if (lexicalClass == null) { lexicalClass = rcvrClass.lookupClassWithMixinApplied(mixinId); } assert lexicalClass != null; return lexicalClass; }
Source:
public Boolean call() { try { LOG.info("Moving region: from to {}", region.getEncodedName(), sourceServer, targetServer); admin.move(region.getEncodedNameAsBytes(), targetServer); LOG.info("Moved from to {}", region.getEncodedName(), sourceServer, targetServer); } catch (Exception e) { LOG.error("Error Moving Region: {}", region.getEncodedName(), e); } finally { movedRegions.add(region); } return true; }

Target:
public Boolean call() { try { LOG.info("Moving region: from to {}", region.getEncodedName(), sourceServer, targetServer); admin.move(region.getEncodedNameAsBytes(), targetServer); LOG.info("Requested move from to {}", region.getEncodedName(), sourceServer, targetServer); } catch (Exception e) { LOG.error("Error Moving Region: {}", region.getEncodedName(), e); } finally { movedRegions.add(region); } return true; }
Source:
public void open(String inPortName, int rate, int dataBits, int stopBits, int parity) throws IOException { info("connect to port %s %d|%d|%d|%d", inPortName, rate, dataBits, stopBits, parity); this.rate = rate; this.dataBits = dataBits; this.stopBits = stopBits; this.parity = parity; lastPortName = portName; if (this.portName != null) { info("#1 already connected"); Port port = ports.get(portName); if (port.isOpen() && port.isListening() && !portName.equals(inPortName)) { info("already connected to %s - disconnect first to reconnect", portName); return; } } if (ports.containsKey(inPortName)) { info("#2 connect to a pre-existing port"); connectPort(ports.get(inPortName), null); lastPortName = portName; return; } if (inPortName != null && inPortName.toLowerCase().startsWith("tcp://")) { try { info("connecting tcp"); connectTcp(inPortName); return; } catch (Exception e) { error("connect ctp threw"); throw new IOException(e); } } if (Platform.isVirtual()) { connectVirtualUart(inPortName); connect(inPortName); return; } info("#3 we don't have an pre-existing port - so we'll try a hardware port"); Port port = createHardwarePort(inPortName, rate, dataBits, stopBits, parity); if (port == null) { return; } connectPort(port, null); }

Target:
public void open(String inPortName, int rate, int dataBits, int stopBits, int parity) throws IOException { info("connect to port %s %d|%d|%d|%d", inPortName, rate, dataBits, stopBits, parity); this.rate = rate; this.dataBits = dataBits; this.stopBits = stopBits; this.parity = parity; lastPortName = portName; if (this.portName != null) { info("#1 already connected"); Port port = ports.get(portName); if (port.isOpen() && port.isListening() && !portName.equals(inPortName)) { info("already connected to %s - disconnect first to reconnect", portName); return; } } if (ports.containsKey(inPortName)) { info("#2 connect to a pre-existing port"); connectPort(ports.get(inPortName), null); lastPortName = portName; return; } if (inPortName != null && inPortName.toLowerCase().startsWith("tcp://")) { try { info("connecting tcp"); connectTcp(inPortName); return; } catch (Exception e) { error("connect tcp threw"); throw new IOException(e); } } if (Platform.isVirtual()) { connectVirtualUart(inPortName); connect(inPortName); return; } info("#3 we don't have an pre-existing port - so we'll try a hardware port"); Port port = createHardwarePort(inPortName, rate, dataBits, stopBits, parity); if (port == null) { return; } connectPort(port, null); }