auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static Archive<?> createDeploymentWithoutSpringMvcDispatcherOrListener() { WebArchive archive = TestUtil.prepareArchive(deploymentWithoutSpringMvcDispatcherOrListenerSpringIncluded); archive.addAsWebInfResource(AddSpringResteasyAsResourceRootTest.class.getPackage(), "web-no-mvc-no-listener.xml", "web.xml") .addAsWebInfResource(AddSpringResteasyAsResourceRootTest.class.getPackage(), "applicationContext.xml", "applicationContext.xml"); archive.addAsManifestResource(PermissionUtil.createPermissionsXmlAsset( new PropertyPermission("arquillian.*", "read"), new ReflectPermission("suppressAccessChecks"), new RuntimePermission("accessDeclaredMembers"), new RuntimePermission("getClassLoader"), new FilePermission("<<ALL FILES>>", "read"), new LoggingPermission("control", "") ), "permissions.xml"); TestUtilSpring.addSpringLibraries(archive); archive.as(ZipExporter.class).exportTo(new File("target", deploymentWithoutSpringMvcDispatcherOrListenerSpringIncluded + ".war"), true); return TestUtil.finishContainerPrepare(archive, null, TestResource.class); }

Target:
private static Archive<?> createDeploymentWithoutSpringMvcDispatcherOrListener() { WebArchive archive = TestUtil.prepareArchive(deploymentWithoutSpringMvcDispatcherOrListenerSpringIncluded); archive.addAsWebInfResource(AddSpringResteasyAsResourceRootTest.class.getPackage(), "web-no-mvc-no-listener.xml", "web.xml") .addAsWebInfResource(AddSpringResteasyAsResourceRootTest.class.getPackage(), "applicationContext.xml", "applicationContext.xml"); TestUtilSpring.addSpringLibraries(archive); archive.as(ZipExporter.class).exportTo(new File("target", deploymentWithoutSpringMvcDispatcherOrListenerSpringIncluded + ".war"), true); return TestUtil.finishContainerPrepare(archive, null, TestResource.class); }
Source:
public void testSetRoutingData() throws InvalidRoutingDataException, IOException { Map<String, List<String>> routingData = new HashMap<>(); routingData.put(TEST_REALM_1, TEST_SHARDING_KEYS_2); routingData.put(TEST_REALM_2, TEST_SHARDING_KEYS_1); String routingDataString = new ObjectMapper().writeValueAsString(routingData); Map<String, String> badFormatRoutingData = new HashMap<>(); badFormatRoutingData.put(TEST_REALM_1, TEST_REALM_2); badFormatRoutingData.put(TEST_REALM_2, TEST_REALM_1); String badFormatRoutingDataString = new ObjectMapper().writeValueAsString(badFormatRoutingData); put("/namespaces/non-existing-namespace" + MetadataStoreRoutingConstants.MSDS_GET_ALL_ROUTING_DATA_ENDPOINT, null, Entity.entity(routingDataString, MediaType.APPLICATION_JSON_TYPE), Response.Status.NOT_FOUND.getStatusCode()); put(TEST_NAMESPACE_URI_PREFIX + MetadataStoreRoutingConstants.MSDS_GET_ALL_ROUTING_DATA_ENDPOINT, null, Entity.entity("?", MediaType.APPLICATION_JSON_TYPE), Response.Status.BAD_REQUEST.getStatusCode()); put(TEST_NAMESPACE_URI_PREFIX + MetadataStoreRoutingConstants.MSDS_GET_ALL_ROUTING_DATA_ENDPOINT, null, Entity.entity(badFormatRoutingDataString, MediaType.APPLICATION_JSON_TYPE), Response.Status.BAD_REQUEST.getStatusCode()); put(TEST_NAMESPACE_URI_PREFIX + MetadataStoreRoutingConstants.MSDS_GET_ALL_ROUTING_DATA_ENDPOINT, null, Entity.entity(routingDataString, MediaType.APPLICATION_JSON_TYPE), Response.Status.CREATED.getStatusCode()); Assert.assertEquals(getRawRoutingData(), routingData); }

Target:
public void testSetRoutingData() throws InvalidRoutingDataException, IOException { Map<String, List<String>> routingData = new HashMap<>(); routingData.put(TEST_REALM_1, TEST_SHARDING_KEYS_2); routingData.put(TEST_REALM_2, TEST_SHARDING_KEYS_1); String routingDataString = OBJECT_MAPPER.writeValueAsString(routingData); Map<String, String> badFormatRoutingData = new HashMap<>(); badFormatRoutingData.put(TEST_REALM_1, TEST_REALM_2); badFormatRoutingData.put(TEST_REALM_2, TEST_REALM_1); String badFormatRoutingDataString = OBJECT_MAPPER.writeValueAsString(badFormatRoutingData); put("/namespaces/non-existing-namespace" + MetadataStoreRoutingConstants.MSDS_GET_ALL_ROUTING_DATA_ENDPOINT, null, Entity.entity(routingDataString, MediaType.APPLICATION_JSON_TYPE), Response.Status.NOT_FOUND.getStatusCode()); put(TEST_NAMESPACE_URI_PREFIX + MetadataStoreRoutingConstants.MSDS_GET_ALL_ROUTING_DATA_ENDPOINT, null, Entity.entity("?", MediaType.APPLICATION_JSON_TYPE), Response.Status.BAD_REQUEST.getStatusCode()); put(TEST_NAMESPACE_URI_PREFIX + MetadataStoreRoutingConstants.MSDS_GET_ALL_ROUTING_DATA_ENDPOINT, null, Entity.entity(badFormatRoutingDataString, MediaType.APPLICATION_JSON_TYPE), Response.Status.BAD_REQUEST.getStatusCode()); put(TEST_NAMESPACE_URI_PREFIX + MetadataStoreRoutingConstants.MSDS_GET_ALL_ROUTING_DATA_ENDPOINT, null, Entity.entity(routingDataString, MediaType.APPLICATION_JSON_TYPE), Response.Status.CREATED.getStatusCode()); Assert.assertEquals(getRawRoutingData(), routingData); }
Source:
protected static void closeClientConnection() { if (isConnectionActive) { LOG.debug("Request for stopping grill cli received"); client.closeConnection(); isConnectionActive = false; } }

Target:
protected static synchronized void closeClientConnection() { if (isConnectionActive) { LOG.debug("Request for stopping grill cli received"); client.closeConnection(); isConnectionActive = false; } }
Source:
public static void cleanUpLdapFiles() throws Exception { File workingDirLDIF = new File(LDAP_DIRECTORY_LOCATION); if (workingDirLDIF.exists() == false) { workingDirLDIF.mkdirs(); } Files.copy(Paths.get(workingDirLDIF + LDIF_LOCATION + ".bak"), Paths.get(workingDirLDIF + LDIF_LOCATION), StandardCopyOption.REPLACE_EXISTING); }

Target:
public void cleanUpLdapFiles() throws Exception { File workingDirLDIF = new File(LDAP_DIRECTORY_LOCATION); if (workingDirLDIF.exists()) { Files.copy(Paths.get(workingDirLDIF + LDIF_LOCATION + ".bak"), Paths.get(workingDirLDIF + LDIF_LOCATION), StandardCopyOption.REPLACE_EXISTING); } }
Source:
public void getsMultipleSingleSelection() throws Exception { bot.radio("SWT.MULTI").click(); bot.checkBox("Listen").select(); bot.button("Clear").click(); table = bot.tableInGroup("Table"); table.select(new int[] { 5, 10 }); TableCollection selection = table.selection(); assertEquals("Index:5", selection.get(0, 0)); assertEquals("images", selection.get(0, 1)); assertEquals("91571", selection.get(0, 2)); assertEquals("yesterday", selection.get(0, 3)); assertEquals(new TableRow(new String[] { "Index:10", "databases", "2556", "tomorrow" }), selection.get(1)); SWTBotText text = bot.textInGroup("Listeners"); assertEventMatches(text, "Selection [13]: SelectionEvent{Table time=-550222256 data=null item=TableItem {Index:5} detail=0 x=0 y=0 width=0 height=0 stateMask=0x80000 text=null doit=true}"); assertEventMatches(text, "MouseDown [3]: MouseEvent{Table time=-550222259 data=null button=1 stateMask=0x0 x=0 y=0 count=1}"); assertEventMatches(text, "MouseUp [4]: MouseEvent{Table time=-550222255 data=null button=1 stateMask=0x80000 x=0 y=0 count=1}"); assertEventMatches(text, "Selection [13]: SelectionEvent{Table time=-550222256 data=null item=TableItem {Index:10} detail=0 x=0 y=0 width=0 height=0 stateMask=0xc0000 text=null doit=true}"); assertEventMatches(text, "MouseDown [3]: MouseEvent{Table time=-550222259 data=null button=1 stateMask=0x40000 x=0 y=0 count=1}"); assertEventMatches(text, "MouseUp [4]: MouseEvent{Table time=-550222255 data=null button=1 stateMask=0xc0000 x=0 y=0 count=1}"); }

Target:
public void getsMultipleSingleSelection() throws Exception { bot.radio("SWT.MULTI").click(); bot.checkBox("Listen").select(); bot.button("Clear").click(); table = bot.tableInGroup("Table"); table.select(new int[] { 5, 10 }); TableCollection selection = table.selection(); assertEquals("Index:5", selection.get(0, 0)); assertEquals("images", selection.get(0, 1)); assertEquals("91571", selection.get(0, 2)); assertEquals("yesterday", selection.get(0, 3)); assertEquals(new TableRow(new String[] { "Index:10", "databases", "2556", "tomorrow" }), selection.get(1)); SWTBotText text = bot.textInGroup("Listeners"); assertEventMatches(text, "MouseDown [3]: MouseEvent{Table time=-550222259 data=null button=1 stateMask=0x0 x=0 y=0 count=1}"); assertEventMatches(text, "Selection [13]: SelectionEvent{Table time=-550222256 data=null item=TableItem {Index:5} detail=0 x=0 y=0 width=0 height=0 stateMask=0x80000 text=null doit=true}"); assertEventMatches(text, "MouseUp [4]: MouseEvent{Table time=-550222255 data=null button=1 stateMask=0x80000 x=0 y=0 count=1}"); assertEventMatches(text, "MouseDown [3]: MouseEvent{Table time=-550222259 data=null button=1 stateMask=0x40000 x=0 y=0 count=1}"); assertEventMatches(text, "Selection [13]: SelectionEvent{Table time=-550222256 data=null item=TableItem {Index:10} detail=0 x=0 y=0 width=0 height=0 stateMask=0xc0000 text=null doit=true}"); assertEventMatches(text, "MouseUp [4]: MouseEvent{Table time=-550222255 data=null button=1 stateMask=0xc0000 x=0 y=0 count=1}"); }
Source:
private CheckBox createCheckBoxView(Option option, LayoutParams layoutParams) { CheckBox checkBoxView = new CheckBox(getContext()); checkBoxView.setLayoutParams(layoutParams); checkBoxView.setText(option.label); checkBoxView.setTag(option); checkBoxView.setOnCheckedChangeListener(this); checkBoxView.setTypeface(getTypeface()); checkBoxView.setSaveEnabled(true); if (this.field.isInline()) { checkBoxView.setGravity(Gravity.TOP); } return checkBoxView; }

Target:
private CheckBox createCheckBoxView(Option option, LayoutParams layoutParams) { CheckBox checkBoxView = new CheckBox(getContext()); checkBoxView.setLayoutParams(layoutParams); checkBoxView.setText(option.label); checkBoxView.setTag(option); checkBoxView.setOnCheckedChangeListener(this); checkBoxView.setTypeface(getTypeface()); checkBoxView.setSaveEnabled(true); if (field.isInline()) { checkBoxView.setGravity(Gravity.TOP); } return checkBoxView; }
Source:
private void updateStack(AmazonCloudFormation cfn) throws IOException { String stackName = getStackName(); String cfnTemplateUrl = getCfnTemplateUrl(); File cfnTemplateFile = getCfnTemplateFile(); List<Parameter> cfnStackParams = getCfnStackParams(); List<Tag> cfnStackTags = getCfnStackTags(); String cfnStackPolicyUrl = getCfnStackPolicyUrl(); File cfnStackPolicyFile = getCfnStackPolicyFile(); getLogger().info("Update stack: {}", stackName); UpdateStackRequest req = new UpdateStackRequest() .withStackName(stackName) .withParameters(cfnStackParams) .withTags(cfnStackTags); if (Strings.isNullOrEmpty(cfnTemplateUrl) == false) { req.setTemplateURL(cfnTemplateUrl); getLogger().info("Using template url: {}", cfnTemplateUrl); } else { req.setTemplateBody(FileUtils.readFileToString(cfnTemplateFile)); getLogger().info("Using template file: {}", "$cfnTemplateFile.canonicalPath"); } if (isCapabilityIam()) { Capability selectedCapability = (useCapabilityIam == null) ? Capability.CAPABILITY_IAM : useCapabilityIam; getLogger().info("Using policy: " + selectedCapability); req.setCapabilities(Arrays.asList(selectedCapability.toString())); } if (!Strings.isNullOrEmpty(cfnStackPolicyUrl)) { req.setStackPolicyURL(cfnStackPolicyUrl); } else if (cfnStackPolicyFile != null) { req.setStackPolicyBody( FileUtils.readFileToString(cfnStackPolicyFile)); } UpdateStackResult updateStackResult = cfn.updateStack(req); getLogger().info("Update requested: {}", updateStackResult.getStackId()); }

Target:
private void updateStack(AmazonCloudFormation cfn) throws IOException { String stackName = getStackName(); String cfnTemplateUrl = getCfnTemplateUrl(); File cfnTemplateFile = getCfnTemplateFile(); List<Parameter> cfnStackParams = getCfnStackParams(); List<Tag> cfnStackTags = getCfnStackTags(); String cfnStackPolicyUrl = getCfnStackPolicyUrl(); File cfnStackPolicyFile = getCfnStackPolicyFile(); getLogger().info("Update stack: {}", stackName); UpdateStackRequest req = new UpdateStackRequest() .withStackName(stackName) .withParameters(cfnStackParams) .withTags(cfnStackTags); if (Strings.isNullOrEmpty(cfnTemplateUrl) == false) { req.setTemplateURL(cfnTemplateUrl); getLogger().info("Using template url: {}", cfnTemplateUrl); } else { req.setTemplateBody(FileUtils.readFileToString(cfnTemplateFile)); getLogger().info("Using template file: {}", "$cfnTemplateFile.canonicalPath"); } if (isCapabilityIam()) { Capability selectedCapability = (useCapabilityIam == null) ? Capability.CAPABILITY_IAM : useCapabilityIam; getLogger().info("Using policy: " + selectedCapability); req.setCapabilities(Arrays.asList(selectedCapability.toString())); } if (Strings.isNullOrEmpty(cfnStackPolicyUrl) == false) { req.setStackPolicyURL(cfnStackPolicyUrl); } else if (cfnStackPolicyFile != null) { req.setStackPolicyBody( FileUtils.readFileToString(cfnStackPolicyFile)); } UpdateStackResult updateStackResult = cfn.updateStack(req); getLogger().info("Update requested: {}", updateStackResult.getStackId()); }
Source:
Iv2InFlight removeHandle(long ciHandle) { assert(!shouldCheckThreadIdAssertion() || m_expectedThreadId == Thread.currentThread().getId()); final boolean readOnly = getReadBit(ciHandle); ciHandle = unsetReadBit(ciHandle); Iv2InFlight inflight = m_shortCircuitReads.remove(ciHandle); if (inflight != null) { m_acg.reduceBackpressure(inflight.m_messageSize); m_outstandingTxns--; return inflight; } else if (isShortCircuitReadHandle(ciHandle)) { return null; } int partitionId = getPartIdFromHandle(ciHandle); PartitionData partitionStuff = m_partitionStuff.get(partitionId); if (partitionStuff == null) { tmLog.error("Unable to find handle list for removal for partition: " + partitionId + ", client interface handle: " + ciHandle); return null; } final Deque<Iv2InFlight> perPartDeque = readOnly ? partitionStuff.m_reads : partitionStuff.m_writes; Iterator<Iv2InFlight> iter = perPartDeque.iterator(); while (iter.hasNext()) { Iv2InFlight inFlight = iter.next(); if (inFlight.m_ciHandle > ciHandle) { tmLog.error("CI clientData lookup for remove missing handle: " + ciHandle + ". Next expected client data handle is: " + inFlight.m_ciHandle); break; } else if (inFlight.m_ciHandle == ciHandle) { m_acg.reduceBackpressure(inFlight.m_messageSize); m_outstandingTxns--; iter.remove(); return inFlight; } } tmLog.error("Unable to find Client data to remove client interface handle: " + ciHandle); return null; }

Target:
Iv2InFlight removeHandle(long ciHandle) { assert(!shouldCheckThreadIdAssertion() || m_expectedThreadId == Thread.currentThread().getId()); final boolean readOnly = getReadBit(ciHandle); ciHandle = unsetReadBit(ciHandle); Iv2InFlight inflight = m_shortCircuitReads.remove(ciHandle); if (inflight != null) { m_acg.reduceBackpressure(inflight.m_messageSize); m_outstandingTxns--; return inflight; } if (isShortCircuitReadHandle(ciHandle)) { return null; } int partitionId = getPartIdFromHandle(ciHandle); PartitionData partitionStuff = m_partitionStuff.get(partitionId); if (partitionStuff == null) { tmLog.error("Unable to find handle list for removal for partition: " + partitionId + ", client interface handle: " + ciHandle); return null; } final Deque<Iv2InFlight> perPartDeque = readOnly ? partitionStuff.m_reads : partitionStuff.m_writes; Iterator<Iv2InFlight> iter = perPartDeque.iterator(); while (iter.hasNext()) { Iv2InFlight inFlight = iter.next(); if (inFlight.m_ciHandle > ciHandle) { tmLog.error("CI clientData lookup for remove missing handle: " + ciHandle + ". Next expected client data handle is: " + inFlight.m_ciHandle); break; } else if (inFlight.m_ciHandle == ciHandle) { m_acg.reduceBackpressure(inFlight.m_messageSize); m_outstandingTxns--; iter.remove(); return inFlight; } } tmLog.error("Unable to find Client data to remove client interface handle: " + ciHandle); return null; }
Source:
private void showBiometricPrompt() { BiometricPrompt.PromptInfo promptInfo = new BiometricPrompt.PromptInfo.Builder() .setTitle(getString(R.string.biometric_prompt_title)) .setSubtitle(getString(R.string.biometric_prompt_subtitle)) .setNegativeButtonText(getString(android.R.string.cancel)) .setConfirmationRequired(true) .setDeviceCredentialAllowed(false) .build(); BiometricPrompt biometricPrompt = new BiometricPrompt(BiometricActivity.this, executor, new BiometricPrompt.AuthenticationCallback() { @Override public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) { super.onAuthenticationError(errorCode, errString); Log_OC.e(TAG, "onAuthenticationError (" + errorCode + "): " + errString); authError(); } @Override public void onAuthenticationSucceeded( @NonNull BiometricPrompt.AuthenticationResult result) { super.onAuthenticationSucceeded(result); mActivity.finish(); } @Override public void onAuthenticationFailed() { super.onAuthenticationFailed(); Log_OC.e(TAG, "onAuthenticationFailed"); } }); biometricPrompt.authenticate(promptInfo, mCryptoObject); }

Target:
private void showBiometricPrompt() { BiometricPrompt.PromptInfo promptInfo = new BiometricPrompt.PromptInfo.Builder() .setTitle(getString(R.string.biometric_prompt_title)) .setSubtitle(getString(R.string.biometric_prompt_subtitle)) .setNegativeButtonText(getString(android.R.string.cancel)) .setConfirmationRequired(true) .setDeviceCredentialAllowed(false) .build(); BiometricPrompt biometricPrompt = new BiometricPrompt(BiometricActivity.this, executor, new BiometricPrompt.AuthenticationCallback() { @Override public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) { super.onAuthenticationError(errorCode, errString); Timber.e("onAuthenticationError (" + errorCode + "): " + errString); authError(); } @Override public void onAuthenticationSucceeded(@NonNull BiometricPrompt.AuthenticationResult result) { super.onAuthenticationSucceeded(result); mActivity.finish(); } @Override public void onAuthenticationFailed() { super.onAuthenticationFailed(); Timber.e("onAuthenticationFailed"); } }); biometricPrompt.authenticate(promptInfo, mCryptoObject); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } MethodYield other = (MethodYield) obj; return new EqualsBuilder() .append(parametersConstraints.stream().flatMap(MethodYield::pmapToStream).collect(Collectors.toList()), other.parametersConstraints.stream().flatMap(MethodYield::pmapToStream).collect(Collectors.toList())) .isEquals(); }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } MethodYield other = (MethodYield) obj; return new EqualsBuilder() .append(parametersConstraints, other.parametersConstraints) .isEquals(); }
Source:
private void createBranch(final String textForBranch, boolean doCheckout, RevCommit commit, IProgressMonitor monitor) throws CoreException { SubMonitor progress = SubMonitor.convert(monitor, UIText.FetchGerritChangePage_CreatingBranchTaskName, 10); CreateLocalBranchOperation bop = new CreateLocalBranchOperation( repository, textForBranch, commit); bop.execute(progress.newChild(2)); if (doCheckout) { checkout(textForBranch, progress.newChild(8)); } monitor.worked(1); }

Target:
private void createBranch(final String textForBranch, boolean doCheckout, RevCommit commit, IProgressMonitor monitor) throws CoreException { SubMonitor progress = SubMonitor.convert(monitor, UIText.FetchGerritChangePage_CreatingBranchTaskName, doCheckout ? 10 : 2); CreateLocalBranchOperation bop = new CreateLocalBranchOperation( repository, textForBranch, commit); bop.execute(progress.newChild(2)); if (doCheckout) { checkout(textForBranch, progress.newChild(8)); } }
Source:
public boolean equals(final Object other){ if (other == null){ return false; } if (getClass() != other.getClass()){ return false; } final AlarmExpansion sound = (AlarmExpansion) other; return Objects.equal(sound.id, this.id); }

Target:
public boolean equals(final Object other){ if (other == null){ return false; } if (getClass() != other.getClass()){ return false; } final AlarmExpansion expansion = (AlarmExpansion) other; return Objects.equal(expansion.id, this.id) && Objects.equal(expansion.enabled, this.enabled) && Objects.equal(expansion.category, this.category) && Objects.equal(expansion.targetValue, this.targetValue); }
Source:
public void onNetworkUpdate(boolean isOnline) { String state_msg = context.getString((isOnline? R.string.status_connectivity_change_online : R.string.status_connectivity_change_offline )); StatusActivity.addMessage(String.format("%s: %s", context.getString(R.string.status_connectivity_change), state_msg)); if (!this.isOnline && isOnline) { read(); } this.isOnline = isOnline; }

Target:
public void onNetworkUpdate(boolean isOnline) { int message = isOnline ? R.string.status_network_online : R.string.status_network_offline; StatusActivity.addMessage(context.getString(message)); if (!this.isOnline && isOnline) { read(); } this.isOnline = isOnline; }
Source:
private void remove() { if (getWindow() != null) { return; } List<VmNetworkInterface> nicList = new ArrayList<>(1); nicList.add(getSelectedItem()); RemoveVmInterfaceModel model = new RemoveVmInterfaceModel(this, nicList, false); setWindow(model); }

Target:
private void remove() { if (getWindow() != null) { return; } RemoveVmInterfaceModel model = new RemoveVmInterfaceModel(this, Arrays.asList(getSelectedItem()), false); setWindow(model); }
Source:
public void save(PartitionQC qc) throws IOException { PartitionQC managedQc = get(qc.getRun(), qc.getPartition()); if (managedQc == null) { qc.setRun(runService.get(qc.getRun().getId())); qc.setPartition(containerService.getPartition(qc.getPartition().getId())); qc.setType(getType(qc.getType().getId())); partitionQcDao.create(qc); } else { managedQc.setType(getType(qc.getType().getId())); managedQc.setNotes(qc.getNotes()); partitionQcDao.update(managedQc); } }

Target:
public void save(PartitionQC qc) throws IOException { PartitionQC managedQc = get(qc.getRun(), qc.getPartition()); Run managedRun = runService.get(qc.getRun().getId()); authorizationManager.throwIfNotWritable(managedRun); if (managedQc == null) { qc.setRun(managedRun); qc.setPartition(containerService.getPartition(qc.getPartition().getId())); qc.setType(getType(qc.getType().getId())); partitionQcDao.create(qc); } else { managedQc.setType(getType(qc.getType().getId())); managedQc.setNotes(qc.getNotes()); partitionQcDao.update(managedQc); } }
Source:
public static IClasspathEntry newJrtEntry(IPath javaHome, IPath sourceAttachmentPath, IPath sourceAttachmentRootPath, IAccessRule[] accessRules, IClasspathAttribute[] extraAttributes, boolean isExported) { if (accessRules == null || accessRules.length==0) { accessRules = ClasspathEntry.NO_ACCESS_RULES; } if (extraAttributes == null || extraAttributes.length==0) { extraAttributes = ClasspathEntry.NO_EXTRA_ATTRIBUTES; } return new ClasspathEntry( IPackageFragmentRoot.K_BINARY, IClasspathEntry.CPE_JRT_SYSTEM, javaHome, ClasspathEntry.INCLUDE_ALL, ClasspathEntry.EXCLUDE_NONE, sourceAttachmentPath, sourceAttachmentRootPath, null, false, accessRules, true, extraAttributes); }

Target:
public static IClasspathEntry newJrtEntry(IPath javaHome, IPath sourceAttachmentPath, IPath sourceAttachmentRootPath, IAccessRule[] accessRules, IClasspathAttribute[] extraAttributes, boolean isExported) { if (accessRules == null || accessRules.length==0) { accessRules = ClasspathEntry.NO_ACCESS_RULES; } if (extraAttributes == null || extraAttributes.length==0) { extraAttributes = ClasspathEntry.NO_EXTRA_ATTRIBUTES; } return new ClasspathEntry( IPackageFragmentRoot.K_BINARY, IClasspathEntry.CPE_JRT_SYSTEM, javaHome, ClasspathEntry.INCLUDE_ALL, ClasspathEntry.EXCLUDE_NONE, sourceAttachmentPath, sourceAttachmentRootPath, null, isExported, accessRules, true, extraAttributes); }
Source:
boolean doTCPCheckMember(ID suspectMember, int port, boolean retryIfConnectFails) { Socket clientSocket = null; long giveupTime = System.currentTimeMillis() + services.getConfig().getMemberTimeout(); boolean passed = false; int iteration = 0; do { iteration++; if (iteration > 1) { try { Thread.sleep(100); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return false; } } try { logger.debug("Checking member with TCP socket connection {}:{}.", suspectMember, suspectMember.getInetAddress(), port); clientSocket = socketCreator.forAdvancedUse() .connect(new HostAndPort(suspectMember.getHostName(), port), (int) memberTimeout, new ConnectTimeoutTask(services.getTimer(), memberTimeout), false, -1, false); clientSocket.setTcpNoDelay(true); passed = doTCPCheckMember(suspectMember, clientSocket); } catch (IOException e) { } finally { try { if (clientSocket != null) { clientSocket.setSoLinger(true, 0); clientSocket.close(); } } catch (IOException e) { } } } while (retryIfConnectFails && !passed && !this.isShutdown() && System.currentTimeMillis() < giveupTime); return passed; }

Target:
boolean doTCPCheckMember(ID suspectMember, int port, boolean retryIfConnectFails) { Socket clientSocket = null; long giveupTime = System.currentTimeMillis() + services.getConfig().getMemberTimeout(); boolean passed = false; int iteration = 0; do { iteration++; if (iteration > 1) { try { Thread.sleep(100); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return false; } } try { logger.debug("Checking member with TCP socket connection {}:{}.", suspectMember, suspectMember.getInetAddress(), port); clientSocket = socketCreator.forAdvancedUse() .connect(new HostAndPort(suspectMember.getHostName(), port), (int) memberTimeout, new ConnectTimeoutTask(services.getTimer(), memberTimeout), false, -1, false); clientSocket.setTcpNoDelay(true); passed = doTCPCheckMember(suspectMember, clientSocket); } catch (IOException e) { } catch (IllegalStateException e) { if (!isStopping) { logger.trace("Unexpected exception", e); } } finally { try { if (clientSocket != null) { clientSocket.setSoLinger(true, 0); clientSocket.close(); } } catch (IOException e) { } } } while (retryIfConnectFails && !passed && !this.isShutdown() && System.currentTimeMillis() < giveupTime); return passed; }
Source:
private static File getFileFromClassLoaderBeforeLuna(String filename, ClassLoader classLoader) throws IOException { String AssertionFailedErrorMessage = "no file found " + filename; try { Object classpathManager = MethodUtils.invokeExactMethod(classLoader, "getClasspathManager", null); if (classpathManager != null) { Object baseData = MethodUtils.invokeExactMethod(classpathManager, "getBaseData", null); if (baseData != null) { Object bundle = MethodUtils.invokeExactMethod(baseData, "getBundle", null); if (bundle != null) { Object entry = MethodUtils.invokeExactMethod(bundle, "getEntry", String.class); if (entry != null) { URL localURL = FileLocator.toFileURL((URL) entry); return new File(localURL.getFile()); } } } } } catch (NoSuchMethodException e) { AssertionFailedErrorMessage = "got NoSuchMethodException " + e.getMessage(); } catch (IllegalAccessException e) { AssertionFailedErrorMessage = "got IllegalAccessException " + e.getMessage(); } catch (InvocationTargetException e) { AssertionFailedErrorMessage = "got InvocationTargetException " + e.getMessage(); } throw new AssertionFailedError(AssertionFailedErrorMessage); }

Target:
private static File getFileFromClassLoaderBeforeLuna(String filename, ClassLoader classLoader) throws Exception { Object classpathManager = MethodUtils.invokeExactMethod(classLoader, "getClasspathManager", null); Object baseData = MethodUtils.invokeExactMethod(classpathManager, "getBaseData", null); Object bundle = MethodUtils.invokeExactMethod(baseData, "getBundle", null); Object entry = MethodUtils.invokeExactMethod(bundle, "getEntry", String.class); URL localURL = FileLocator.toFileURL((URL) entry); return new File(localURL.getFile()); }
Source:
public void executeSave() { QosParametersBase<NetworkQoS> parameters = new QosParametersBase<NetworkQoS>(); parameters.setQosId(networkQoS.getId()); parameters.setQos(networkQoS); Frontend.getInstance().runAction(VdcActionType.UpdateNetworkQoS, parameters, new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result1) { VdcReturnValueBase retVal = result1.getReturnValue(); boolean succeeded = false; if (retVal != null && retVal.getSucceeded()) { succeeded = true; } postSaveAction(succeeded); } }); }

Target:
public void executeSave() { QosParametersBase<NetworkQoS> parameters = new QosParametersBase<NetworkQoS>(); parameters.setQos(networkQoS); Frontend.getInstance().runAction(VdcActionType.UpdateNetworkQoS, parameters, new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result1) { VdcReturnValueBase retVal = result1.getReturnValue(); boolean succeeded = false; if (retVal != null && retVal.getSucceeded()) { succeeded = true; } postSaveAction(succeeded); } }); }
Source:
private void validateJoinInputStreamPartitions(JobGraph jobGraph) { Multimap<JoinOperatorSpec, InputOperatorSpec> joinOpSpecToInputOpSpecs = OperatorSpecGraphAnalyzer.getJoinedInputOperatorSpecs(jobGraph.getSpecGraph()); List<JoinedStreamsGroup> joinedStreamsGroups = new ArrayList<>(); for (JoinOperatorSpec joinOpSpec : joinOpSpecToInputOpSpecs.keySet()) { Collection<InputOperatorSpec> joinedInputOpSpecs = joinOpSpecToInputOpSpecs.get(joinOpSpec); JoinedStreamsGroup joinedStreamsGroup = getJoinedStreamsGroup(joinOpSpec.getOpId(), joinedInputOpSpecs, jobGraph); joinedStreamsGroups.add(joinedStreamsGroup); } Collections.sort(joinedStreamsGroups, Comparator.comparing(JoinedStreamsGroup::getCategory)); joinedStreamsGroups.forEach(ExecutionPlanner::validateJoinedStreamsGroupPartitions); }

Target:
private void validateJoinInputStreamPartitions(JobGraph jobGraph) { Multimap<JoinOperatorSpec, InputOperatorSpec> joinOpSpecToInputOpSpecs = OperatorSpecGraphAnalyzer.getJoinToInputOperatorSpecs(jobGraph.getSpecGraph()); List<StreamEdgeSet> streamEdgeSets = new ArrayList<>(); for (JoinOperatorSpec joinOpSpec : joinOpSpecToInputOpSpecs.keySet()) { Collection<InputOperatorSpec> joinedInputOpSpecs = joinOpSpecToInputOpSpecs.get(joinOpSpec); StreamEdgeSet streamEdgeSet = getStreamEdgeSet(joinOpSpec.getOpId(), joinedInputOpSpecs, jobGraph); streamEdgeSets.add(streamEdgeSet); } Collections.sort(streamEdgeSets, Comparator.comparingInt(e -> e.getCategory().getSortOrder())); streamEdgeSets.forEach(ExecutionPlanner::validateAndAssignStreamEdgeSetPartitions); }
Source:
public void testAMeetingCannotBeCreatedWithoutOrganizer() { ExcelReader excelReader = new ExcelReader(EXCEL_INPUT_DATA); List<Map<String, String>> meetingData = excelReader.getMapValues("MeetingData"); String subject = meetingData.get(0).get("Subject"); String startTime = meetingData.get(0).get("Start time"); String endTime = meetingData.get(0).get("End time"); String attendee = meetingData.get(0).get("Attendee"); String body = meetingData.get(0).get("Body"); HomeTabletPage homeTabletPage = new HomeTabletPage(); SchedulePage schedulePage = homeTabletPage.clickScheduleBtn(); schedulePage.setSubjectTxtBox(subject) .setStartTimeDate(startTime) .setEndTimeDate(endTime) .setAttendeeTxtBoxPressingEnter(attendee) .setBodyTxtBox(body) .clickCreateBtn(); Assert.assertTrue(schedulePage.isErrorOrganizerLblDisplayed()); }

Target:
public void testAMeetingCannotBeCreatedWithoutOrganizer() { ExcelReader excelReader = new ExcelReader(EXCEL_INPUT_DATA); List<Map<String, String>> meetingData = excelReader.getMapValues("MeetingData"); String subject = meetingData.get(0).get("Subject"); String attendee = meetingData.get(0).get("Attendee"); String body = meetingData.get(0).get("Body"); HomeTabletPage homeTabletPage = new HomeTabletPage(); SchedulePage schedulePage = homeTabletPage.clickScheduleBtn(); schedulePage.setSubjectTxtBox(subject) .setAttendeeTxtBoxPressingEnter(attendee) .setBodyTxtBox(body) .clickCreateBtn(); Assert.assertTrue(schedulePage.isErrorOrganizerLblDisplayed()); }
Source:
private static void checkRegisterNativeAllocation() throws Exception { long maxMem = Runtime.getRuntime().maxMemory(); int size = (int)(maxMem / 32); int allocationCount = 256; int maxExpectedGcDurationMs = 2000; ReferenceQueue<Object> queue = new ReferenceQueue<Object>(); ref = allocPhantom(queue); long total = 0; for (int i = 0; !ref.isEnqueued() && i < allocationCount; ++i) { runtime.registerNativeAllocation(size); total += size; Thread.sleep(MAX_EXPECTED_GC_DURATION_MS / allocationCount); } if (queue.remove(MAX_EXPECTED_GC_DURATION_MS) == null) { throw new RuntimeException("GC failed to complete"); } while (total > 0) { runtime.registerNativeFree(size); total -= size; } }

Target:
private static void checkRegisterNativeAllocation() throws Exception { long maxMem = Runtime.getRuntime().maxMemory(); int size = (int)(maxMem / 32); int allocationCount = 256; ReferenceQueue<Object> queue = new ReferenceQueue<Object>(); ref = allocPhantom(queue); long total = 0; for (int i = 0; !ref.isEnqueued() && i < allocationCount; ++i) { runtime.registerNativeAllocation(size); total += size; Thread.sleep(MAX_EXPECTED_GC_DURATION_MS / allocationCount); } if (queue.remove(MAX_EXPECTED_GC_DURATION_MS) == null) { throw new RuntimeException("GC failed to complete"); } while (total > 0) { runtime.registerNativeFree(size); total -= size; } }
Source:
public @Nonnull String filter(@Nonnull String input) { ContentMappings mappings = ContentMappings.get(); Matcher m = IP_ADDRESS.matcher(input); List<String> searchList = new ArrayList<>(); List<String> replacementList = new ArrayList<>(); while (m.find()) { String ip = m.group(); if (!mappings.getStopWords().contains(ip)) { ContentMapping map = mappings.getMappingOrCreate(ip, InetAddressContentFilter::newMapping); searchList.add(ip); replacementList.add(map.getReplacement()); } } String filtered = input; if (!searchList.isEmpty()) { filtered = StringUtils.replaceEach(input, searchList.toArray(new String[]{}), replacementList.toArray(new String[]{})); } return filtered; }

Target:
public @Nonnull String filter(@Nonnull String input) { ContentMappings mappings = ContentMappings.get(); Matcher m = IP_ADDRESS.matcher(input); List<String> searchList = new ArrayList<>(); List<String> replacementList = new ArrayList<>(); while (m.find()) { String ip = m.group(); if (!mappings.getStopWords().contains(ip)) { ContentMapping map = mappings.getMappingOrCreate(ip, InetAddressContentFilter::newMapping); searchList.add(ip); replacementList.add(map.getReplacement()); } } String filtered = input; if (!searchList.isEmpty()) { filtered = StringUtils.replaceEach(input, searchList.toArray(new String[0]), replacementList.toArray(new String[0])); } return filtered; }
Source:
public Object configure() throws Exception { Class<?> oClass = nodeClass(_root); String id = _root.getAttribute("id"); Object obj = id == null ? null : _configuration.getIdMap().get(id); int index = 0; if (obj == null && oClass != null) { try { obj = construct(oClass, new Args(null, oClass, XmlConfiguration.getNodes(_root, "Arg"))); } catch (NoSuchMethodException x) { throw new IllegalStateException(String.format("No matching constructor %s in %s", oClass, _configuration)); } } else { XmlConfiguration.getNodes(_root, "Arg") .forEach((node) -> LOG.warn("Ignored arg in {}", node, this._configuration._location)); } if (id != null) _configuration.getIdMap().put(id, obj); _configuration.initializeDefaults(obj); configure(obj, _root, index); return obj; }

Target:
public Object configure() throws Exception { Class<?> oClass = nodeClass(_root); String id = _root.getAttribute("id"); Object obj = id == null ? null : _configuration.getIdMap().get(id); AttrOrElementNode aoeNode; if (obj == null && oClass != null) { aoeNode = new AttrOrElementNode(_root, "Arg"); try { obj = construct(oClass, new Args(null, oClass, aoeNode.getNodes("Arg"))); } catch (NoSuchMethodException x) { throw new IllegalStateException(String.format("No matching constructor %s in %s", oClass, _configuration)); } } else { aoeNode = new AttrOrElementNode(obj, _root, "Arg"); aoeNode.getNodes("Arg") .forEach((node) -> LOG.warn("Ignored arg in {}", node, this._configuration._location)); } if (id != null) _configuration.getIdMap().put(id, obj); _configuration.initializeDefaults(obj); configure(obj, _root, aoeNode.getNext()); return obj; }
Source:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException { Schema inputSchema = pipelineConfigurer.getStageConfigurer().getInputSchema(); if (inputSchema != null) { if (inputSchema.getField(config.messageField) != null) { throw new IllegalArgumentException(String.format( "Input schema already contains message field %s. Please set messageField to a different value.", config.messageField)); } if (inputSchema.getField(config.codeField) != null) { throw new IllegalArgumentException(String.format( "Input schema already contains code field %s. Please set codeField to a different value.", config.codeField)); } if (inputSchema.getField(config.stageField) != null) { throw new IllegalArgumentException(String.format( "Input schema already contains stage field %s. Please set stageField to a different value.", config.stageField)); } Schema outputSchema = getOutputSchema(config, inputSchema); pipelineConfigurer.getStageConfigurer().setOutputSchema(outputSchema); } }

Target:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException { Schema inputSchema = pipelineConfigurer.getStageConfigurer().getInputSchema(); if (inputSchema != null) { if (config.messageField != null && inputSchema.getField(config.messageField) != null) { throw new IllegalArgumentException(String.format( "Input schema already contains message field %s. Please set messageField to a different value.", config.messageField)); } if (config.codeField != null && inputSchema.getField(config.codeField) != null) { throw new IllegalArgumentException(String.format( "Input schema already contains code field %s. Please set codeField to a different value.", config.codeField)); } if (config.stageField != null && inputSchema.getField(config.stageField) != null) { throw new IllegalArgumentException(String.format( "Input schema already contains stage field %s. Please set stageField to a different value.", config.stageField)); } Schema outputSchema = getOutputSchema(config, inputSchema); pipelineConfigurer.getStageConfigurer().setOutputSchema(outputSchema); } }
Source:
public void run() { try { _task.acquire(); Integer lineNo = loadCheckpoint(); while (!_cancelRequested) { String text; try { text = _fileReader.readLine(); } catch (IOException e) { throw new RuntimeException("Reading file failed.", e); } if (text != null) { DatastreamEvent event = new DatastreamEvent(); event.payload = ByteBuffer.wrap(text.getBytes()); event.key = ByteBuffer.allocate(0); event.metadata = new HashMap<>(); event.metadata.put("SchemaId", _producer.registerSchema(null)); event.previous_payload = ByteBuffer.allocate(0); LOG.info("sending event " + text); _producer.send(new DatastreamEventRecord(event, 0, lineNo.toString())); LOG.info("Sending event succeeded"); ++lineNo; } else { try { Thread.sleep(POLL_WAIT_MS); } catch (InterruptedException e) { _isStopped = true; LOG.info("Stopped at line " + lineNo); } } } _task.release(); _isStopped = true; LOG.info("Stopped at line " + lineNo); } catch (Throwable e) { LOG.error("File processor is quitting with exception ", e); } }

Target:
public void run() { try { _task.acquire(); Integer lineNo = loadCheckpoint(); while (!_cancelRequested) { String text; try { text = _fileReader.readLine(); } catch (IOException e) { throw new RuntimeException("Reading file failed.", e); } if (text != null) { DatastreamEvent event = new DatastreamEvent(); event.payload = ByteBuffer.wrap(text.getBytes()); event.key = ByteBuffer.allocate(0); event.metadata = new HashMap<>(); event.metadata.put("PayloadSchemaId", _producer.registerSchema(null)); event.previous_payload = ByteBuffer.allocate(0); LOG.info("sending event " + text); _producer.send(new DatastreamEventRecord(event, 0, lineNo.toString())); LOG.info("Sending event succeeded"); ++lineNo; } else { try { Thread.sleep(POLL_WAIT_MS); } catch (InterruptedException e) { _isStopped = true; LOG.info("Stopped at line " + lineNo); } } } _task.release(); _isStopped = true; LOG.info("Stopped at line " + lineNo); } catch (Throwable e) { LOG.error("File processor is quitting with exception ", e); } }
Source:
AbstractIcon getSelectedItem() { return imageList.getSelectedValue(); }

Target:
public @Nullable AbstractIcon getSelectedItem() { return imageList.getSelectedValue(); }
Source:
public Chain getAndAppend(long key, ByteBuffer payLoad) { try { EhcacheEntityResponse response = entity.invoke(EhcacheEntityMessage.getAndAppendOperation(cacheId, key, payLoad), true); if (response != null && response.getType() == EhcacheEntityResponse.Type.GET_RESPONSE) { return ((EhcacheEntityResponse.GetResponse)response).getChain(); } } catch (Exception e) { unwrapException(e, StoreAccessException.class); } return null; }

Target:
public Chain getAndAppend(long key, ByteBuffer payLoad) { EhcacheEntityResponse response; try { response = entity.invoke(EhcacheEntityMessage.getAndAppendOperation(cacheId, key, payLoad), true); } catch (Exception e) { throw new ServerStoreProxyException(e); } if (response != null && response.getType() == EhcacheEntityResponse.Type.GET_RESPONSE) { return ((EhcacheEntityResponse.GetResponse)response).getChain(); } else { throw new ServerStoreProxyException("Response for getAndAppend operation was invalid : " + response != null ? response.getType().toString() : "null message"); } }
Source:
public Number getInternalValue(Number number) { BigDecimal value = new BigDecimal(number.toString()); ChartRange internal = getInternal(); ChartRange external = getExternal(); System.out.println(external.getMinimum()); System.out.println(external.getMaximum()); System.out.println(external.getDelta()); BigDecimal internalValue = value .subtract(external.getMinimum()) .multiply(internal.getDelta()) .divide(external.getDelta(), BIG_DECIMAL_DIVISION_SCALE, BigDecimal.ROUND_DOWN) .add(internal.getMinimum()); return checkNotNull(internalValue); }

Target:
public Number getInternalValue(Number number) { BigDecimal value = new BigDecimal(number.toString()); ChartRange internal = getInternal(); ChartRange external = getExternal(); BigDecimal internalValue = value .subtract(external.getMinimum()) .multiply(internal.getDelta()) .divide(external.getDelta(), BIG_DECIMAL_DIVISION_SCALE, BigDecimal.ROUND_DOWN) .add(internal.getMinimum()); return checkNotNull(internalValue); }
Source:
public void savetofile(String f) { Writer writer = null; JAXBContext jc; try { jc = JAXBContext.newInstance(envelope.class); Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); writer = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(f), "utf-8")); marshaller.marshal(envel, writer); } catch (PropertyException e) { e.printStackTrace(); } catch (JAXBException e) { e.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } finally { try { writer.close(); } catch (Exception ex) { } } }

Target:
public void savetofile(String f) { Writer writer = null; JAXBContext jc; try { jc = JAXBContext.newInstance(envelope.class); Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); writer = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(f), "utf-8")); marshaller.marshal(envel, writer); } catch (PropertyException e) { logger.error("error in xml processing - save file",e); } catch (JAXBException e) { logger.error("error in xml processing - save file",e); } catch (IOException ex) { logger.error("error in xml processing - save file",ex); } finally { try { writer.close(); } catch (Exception ex) { } } }
Source:
public InetSocketAddress resolve(String name, boolean ipv6, boolean local) { int delimiter = name.lastIndexOf(':'); if (delimiter < 0) { throw new IllegalArgumentException(name); } String addrStr = name.substring(0, delimiter); String portStr = name.substring(delimiter + 1); if (addrStr.length() >= 2 && addrStr.charAt(0) == '[' && addrStr.charAt(addrStr.length() - 1) == ']') { addrStr = addrStr.substring(1, addrStr.length() - 1); } int port; if (portStr.equals("*") || portStr.equals("0")) { port = 0; } else { port = Integer.parseInt(portStr); if (port == 0) { throw new IllegalArgumentException(name); } } InetAddress addrNet = null; if (addrStr.equals("*")) { addrStr = ipv6 ? "::" : "0.0.0.0"; } try { InetAddress[] addresses = InetAddress.getAllByName(addrStr); if (ipv6) { addrNet = Arrays.stream(InetAddress.getAllByName(addrStr)).filter(i -> i instanceof Inet6Address).findFirst().orElseGet(() -> addresses[0]); } else { addrNet = Arrays.stream(InetAddress.getAllByName(addrStr)).filter(i -> i instanceof Inet4Address).findFirst().orElseGet(() -> null); } } catch (UnknownHostException e) { throw new ZMQException(e.getMessage(), ZError.EADDRNOTAVAIL, e); } if (addrNet == null) { throw new ZMQException(addrStr + " not found matching IPv4/IPv6 settings", ZError.EADDRNOTAVAIL); } return new InetSocketAddress(addrNet, port); }

Target:
public InetSocketAddress resolve(String name, boolean ipv6, boolean local) { int delimiter = name.lastIndexOf(':'); if (delimiter < 0) { throw new IllegalArgumentException(name); } String addrStr = name.substring(0, delimiter); String portStr = name.substring(delimiter + 1); if (addrStr.length() >= 2 && addrStr.charAt(0) == '[' && addrStr.charAt(addrStr.length() - 1) == ']') { addrStr = addrStr.substring(1, addrStr.length() - 1); } int port; if (portStr.equals("*") || portStr.equals("0")) { port = 0; } else { port = Integer.parseInt(portStr); if (port == 0) { throw new IllegalArgumentException(name); } } InetAddress addrNet = null; if (addrStr.equals("*")) { addrStr = ipv6 ? "::" : "0.0.0.0"; } try { InetAddress[] addresses = InetAddress.getAllByName(addrStr); if (ipv6) { addrNet = Arrays.stream(addresses).filter(i -> i instanceof Inet6Address).findFirst().orElseGet(() -> addresses[0]); } else { addrNet = Arrays.stream(addresses).filter(i -> i instanceof Inet4Address).findFirst().orElseGet(() -> null); } } catch (UnknownHostException e) { throw new ZMQException(e.getMessage(), ZError.EADDRNOTAVAIL, e); } if (addrNet == null) { throw new ZMQException(addrStr + " not found matching IPv4/IPv6 settings", ZError.EADDRNOTAVAIL); } return new InetSocketAddress(addrNet, port); }
Source:
public void modifyJobName() throws IOException, SignatureException, XmlProcessingException { final String bucketName = "test_modify_job_name"; try { Ds3ClientHelpers.wrap(client).ensureBucketExists(bucketName); final Ds3ClientHelpers.Job job = wrap(client).startWriteJob(bucketName, Lists.newArrayList(new Ds3Object("testOne", 2))); client.modifyJobSpectraS3(new ModifyJobSpectraS3Request(job.getJobId()) .withName("newName")); final GetJobSpectraS3Response response = client .getJobSpectraS3(new GetJobSpectraS3Request(job.getJobId())); assertThat(response.getMasterObjectListResult().getName(), is("newName")); } finally { deleteAllContents(client, bucketName); } }

Target:
public void modifyJobName() throws IOException, SignatureException, XmlProcessingException { try { final Ds3ClientHelpers.Job job = HELPERS.startWriteJob(BUCKET_NAME, Lists.newArrayList(new Ds3Object("testOne", 2))); client.modifyJobSpectraS3(new ModifyJobSpectraS3Request(job.getJobId()) .withName("newName")); final GetJobSpectraS3Response response = client .getJobSpectraS3(new GetJobSpectraS3Request(job.getJobId())); assertThat(response.getMasterObjectListResult().getName(), is("newName")); } finally { deleteAllContents(client, BUCKET_NAME); } }