auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void initializeDefinedElements(CContentAssistInvocationContext context) { int startOffset = getStatementStartOffset(context.getDocument(), context.getParseOffset() - fPrefix.length()); fAvailableElements = new ArrayList<>(); IASTCompletionNode node = null; CContentAssistInvocationContext newContext = new CContentAssistInvocationContext( context.getViewer(), startOffset, context.getEditor(), true, false); try { node = newContext.getCompletionNode(); if (node != null) { IASTTranslationUnit tu = node.getTranslationUnit(); IASTName[] names = node.getNames(); for (IASTName name : names) { IASTCompletionContext astContext = name.getCompletionContext(); if (astContext != null) { IBinding[] bindings = astContext.findBindings(name, true); if (bindings != null) { AccessContext accessibilityContext = new AccessContext(name); for (IBinding binding : bindings) { if (binding instanceof ICPPField || binding instanceof IVariable) { IASTName[] declarations = tu.getDeclarationsInAST(binding); if (declarations != null && declarations.length != 0 && accessibilityContext.isAccessible(binding)) { fAvailableElements.add(binding); } } } } } } } } finally { newContext.dispose(); } }

Target:
private void initializeDefinedElements(CContentAssistInvocationContext context) { int startOffset = getStatementStartOffset(context.getDocument(), context.getParseOffset() - fPrefix.length()); Map<String, IBinding> elementsMap = new HashMap<>(); IASTCompletionNode node = null; CContentAssistInvocationContext newContext = new CContentAssistInvocationContext( context.getViewer(), startOffset, context.getEditor(), true, false); try { node = newContext.getCompletionNode(); if (node != null) { IASTTranslationUnit tu = node.getTranslationUnit(); IASTName[] names = node.getNames(); for (IASTName name : names) { IASTCompletionContext astContext = name.getCompletionContext(); if (astContext != null) { IBinding[] bindings = astContext.findBindings(name, true); if (bindings != null) { AccessContext accessibilityContext = new AccessContext(name); for (IBinding binding : bindings) { if ((binding instanceof ICPPField || binding instanceof IVariable) && accessibilityContext.isAccessible(binding) && !elementsMap.containsKey(binding.getName())) { if (binding instanceof ICPPField) { elementsMap.put(binding.getName(), binding); } else { IASTName[] declarations = tu.getDeclarationsInAST(binding); if (declarations != null && declarations.length != 0) elementsMap.put(binding.getName(), binding); } } } } } } } } finally { fAvailableElements = new ArrayList<>(elementsMap.values()); newContext.dispose(); } }
Source:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); dataSource = createDataSource(); init(); }

Target:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); dataSource = createDataSource(); startLoad(dataSource, getLoaderId(), this); }
Source:
public static IntervalList fromPath(final Path path) { final IntervalList list; try (final BufferedReader reader = IOUtil.openFileForBufferedReading(path)) { list = fromReader(reader); } catch (final IOException e) { throw new SAMException(String.format("Failed to close file %s after reading", path.toUri().toString())); } return list; }

Target:
public static IntervalList fromPath(final Path path) { try (final BufferedReader reader = IOUtil.openFileForBufferedReading(path)) { return fromReader(reader); } catch (final IOException e) { throw new SAMException(String.format("Failed to close file %s after reading", path.toUri().toString())); } }
Source:
public CacheOperationResult<CacheEntry<String,String>> get(final @QueryParam("key") String key) { final Cache<String, String> cache; final CacheOperationResult<CacheEntry<String,String>> cor = new CacheOperationResult<CacheEntry<String,String>>(); Subject subject = SecurityContextAssociation.getSubject(); try { cache = cm.getCache("secured"); Subject.doAs(subject, new PrivilegedAction<Void>() { public Void run() { ArrayList<CacheEntry<String, String>> cacheEntries = new ArrayList<CacheEntry<String, String>>(); if (key == null) { Set<Map.Entry<String, String>> entries = cache.entrySet(); for (Map.Entry<String, String> entry : entries) { cacheEntries.add(new CacheEntry<String, String>(entry.getKey(), entry.getValue())); } } else { String value = cache.get(key); if (value != null) cacheEntries.add(new CacheEntry<String, String>(key, value)); } Collections.sort(cacheEntries); cor.setOutputEntries(cacheEntries); return null; } }); } catch(Exception e) { cor.setFailed(true); cor.setFailureMessage(e.getMessage()); } return cor; }

Target:
public CacheOperationResult<CacheEntry<String,String>> get(final @QueryParam("key") String key) { final CacheOperationResult<CacheEntry<String,String>> cor = new CacheOperationResult<CacheEntry<String,String>>(); Subject subject = SecurityContextAssociation.getSubject(); try { Security.doAs(subject, new PrivilegedAction<Void>() { public Void run() { Cache<String, String> cache; cache = cm.getCache("secured"); ArrayList<CacheEntry<String, String>> cacheEntries = new ArrayList<CacheEntry<String, String>>(); if (key == null) { Set<Map.Entry<String, String>> entries = cache.entrySet(); for (Map.Entry<String, String> entry : entries) { cacheEntries.add(new CacheEntry<String, String>(entry.getKey(), entry.getValue())); } } else { String value = cache.get(key); if (value != null) cacheEntries.add(new CacheEntry<String, String>(key, value)); } Collections.sort(cacheEntries); cor.setOutputEntries(cacheEntries); return null; } }); } catch(Exception e) { cor.setFailed(true); cor.setFailureMessage(e.getMessage()); } return cor; }
Source:
NetworkBroadcastReceiver(Context context) { this.connectivityManager = (ConnectivityManager) context.getSystemService(CONNECTIVITY_SERVICE); }

Target:
NetworkBroadcastReceiver(Context context) { connectivityManager = (ConnectivityManager) context.getSystemService(CONNECTIVITY_SERVICE); }
Source:
public void testAssignServerIp() { assertNodeAvailable(currentServer); currentServer = updateServerStatus(currentServer); List<String> ips = new ArrayList<String>(); ips.add(currentServer.ips().get(0).id()); FirewallPolicy.ServerIp.CreateServerIp toAdd = FirewallPolicy.ServerIp.CreateServerIp.create(ips); FirewallPolicy updateResult = firewallPolicyApi().assignServerIp(currentFirewallPolicy.id(), toAdd); assertNotNull(updateResult); }

Target:
public void testAssignServerIp() { assertNodeAvailable(currentServer); currentServer = updateServerStatus(currentServer); List<String> ips = new ArrayList<String>(); ips.add(currentServer.ips().get(0).id()); FirewallPolicy.ServerIp.CreateServerIp toAdd = FirewallPolicy.ServerIp.CreateServerIp.create(ips); FirewallPolicy updateResult = firewallPolicyApi().assignServerIp(currentFirewallPolicy.id(), toAdd); assertEquals(updateResult.serverIps().get(0).id(), currentServer.ips().get(0).id()); assertNotNull(updateResult); }
Source:
public Object deserialize(Writable blob) throws SerDeException { Object row; Text t; if (blob instanceof BytesWritable) { t = new Text(((BytesWritable) blob).getBytes()); } else { t = (Text) blob; } try { row = structReader.parseStruct(new ByteArrayInputStream((t.getBytes()), 0, t.getLength())); return row; } catch (Exception e) { LOG.warn("Error parsing json text [{}].", e, t); throw new SerDeException(e); } }

Target:
public Object deserialize(Writable blob) throws SerDeException { String st = null; try { if (blob instanceof BytesWritable) { byte[] rowByteArr = ((BytesWritable) blob).getBytes(); st = Text.decode(rowByteArr, 0, rowByteArr.length).trim(); } else { st = blob.toString().trim(); } return structReader.parseStruct(new ByteArrayInputStream((st.getBytes()), 0, st.getBytes().length)); } catch (Exception e) { LOG.warn("Error parsing json text [{}].", e, st); throw new SerDeException(e); } }
Source:
public Program getAssociatedProgram(Artifact artifact) { String extension = getAssociatedExtension(artifact); Program program = ProgramFinder.findProgram(extension.toLowerCase()); if (program == null) { throw new OseeArgumentException("No program associated with the extension [%s] found on your local machine.", extension); } return program; }

Target:
public Program getAssociatedProgram(Artifact artifact) { String extension = getAssociatedExtension(artifact); Program program = ProgramFinder.findProgram(extension); if (program == null) { throw new OseeArgumentException("No program associated with the extension [%s] found on your local machine.", extension); } return program; }
Source:
private int decompressDirectBuf() { if (compressedDirectBufLen == 0) { return 0; } else { compressedDirectBuf.limit(compressedDirectBufLen).position(0); lz4Decompressor.decompress((ByteBuffer) compressedDirectBuf, (ByteBuffer) uncompressedDirectBuf); compressedDirectBufLen = 0; compressedDirectBuf.limit(compressedDirectBuf.capacity()).position(0); int size = uncompressedDirectBuf.position(); uncompressedDirectBuf.position(0); return size; } }

Target:
private int decompressDirectBuf() { if (compressedDirectBufLen == 0) { return 0; } else { compressedDirectBuf.limit(compressedDirectBufLen).position(0); lz4Decompressor.decompress((ByteBuffer) compressedDirectBuf, (ByteBuffer) uncompressedDirectBuf); compressedDirectBufLen = 0; compressedDirectBuf.clear(); int size = uncompressedDirectBuf.position(); uncompressedDirectBuf.position(0); return size; } }
Source:
private void handleSelectorEvents(List<ResponseInfo> responseInfoList) { for (String connId : selector.connected()) { connectionTracker.checkInConnection(connId); } for (String connId : selector.disconnected()) { connectionTracker.removeConnection(connId); RequestMetadata requestMetadata = connectionIdToRequestInFlight.remove(connId); if (requestMetadata != null) { responseInfoList .add(new ResponseInfo(requestMetadata.requestInfo.getRequest(), NetworkClientErrorCode.NetworkError, null)); } } for (NetworkReceive recv : selector.completedReceives()) { String connId = recv.getConnectionId(); connectionTracker.checkInConnection(connId); RequestMetadata requestMetadata = connectionIdToRequestInFlight.remove(connId); if (requestMetadata != null) { responseInfoList.add( new ResponseInfo(requestMetadata.requestInfo.getRequest(), null, recv.getReceivedBytes().getPayload())); } else { logger.trace("Received response for a request that timed out"); } } }

Target:
private void handleSelectorEvents(List<ResponseInfo> responseInfoList) { for (String connId : selector.connected()) { connectionTracker.checkInConnection(connId); } for (String connId : selector.disconnected()) { connectionTracker.removeConnection(connId); RequestMetadata requestMetadata = connectionIdToRequestInFlight.remove(connId); if (requestMetadata != null) { responseInfoList .add(new ResponseInfo(requestMetadata.requestInfo.getRequest(), NetworkClientErrorCode.NetworkError, null)); } } for (NetworkReceive recv : selector.completedReceives()) { String connId = recv.getConnectionId(); connectionTracker.checkInConnection(connId); RequestMetadata requestMetadata = connectionIdToRequestInFlight.remove(connId); responseInfoList .add(new ResponseInfo(requestMetadata.requestInfo.getRequest(), null, recv.getReceivedBytes().getPayload())); } }
Source:
public void testTruncateToLengthAndTrimSpaces() { assertEquals(utf8Slice("a"), truncateToLengthAndTrimSpaces(utf8Slice("a c"), 1)); assertEquals(utf8Slice("a"), truncateToLengthAndTrimSpaces(utf8Slice("a "), 1)); assertEquals(utf8Slice("a"), truncateToLengthAndTrimSpaces(utf8Slice("abc"), 1)); assertEquals(utf8Slice(""), truncateToLengthAndTrimSpaces(utf8Slice("a c"), 0)); assertEquals(utf8Slice("a c"), truncateToLengthAndTrimSpaces(utf8Slice("a c "), 3)); assertEquals(utf8Slice(""), truncateToLengthAndTrimSpaces(utf8Slice(" "), 1)); }

Target:
public void testTruncateToLengthAndTrimSpaces() { assertEquals(utf8Slice("a"), truncateToLengthAndTrimSpaces(utf8Slice("a c"), 1)); assertEquals(utf8Slice("a"), truncateToLengthAndTrimSpaces(utf8Slice("a "), 1)); assertEquals(utf8Slice("a"), truncateToLengthAndTrimSpaces(utf8Slice("abc"), 1)); assertEquals(utf8Slice(""), truncateToLengthAndTrimSpaces(utf8Slice("a c"), 0)); assertEquals(utf8Slice("a c"), truncateToLengthAndTrimSpaces(utf8Slice("a c "), 3)); assertEquals(utf8Slice("a c"), truncateToLengthAndTrimSpaces(utf8Slice("a c "), 4)); assertEquals(utf8Slice("a c"), truncateToLengthAndTrimSpaces(utf8Slice("a c "), 5)); assertEquals(utf8Slice(""), truncateToLengthAndTrimSpaces(utf8Slice(" "), 1)); assertEquals(utf8Slice(""), truncateToLengthAndTrimSpaces(utf8Slice(""), 1)); }
Source:
public void subscribe_to_topic() { final BoundedContext boundedContext = setupBoundedContextForAggregateRepo(); final SubscriptionService subscriptionService = SubscriptionService.newBuilder() .addBoundedContext(boundedContext) .build(); final String type = boundedContext.getStand() .getAvailableTypes() .iterator() .next() .getTypeName(); final Target target = Target.newBuilder() .setType(type) .build(); final Topic topic = Topic.newBuilder() .setTarget(target) .build(); final MemoizeStreamObserver<Subscription> observer = new MemoizeStreamObserver<>(); subscriptionService.subscribe(topic, observer); assertNotNull(observer.streamFlowValue); assertTrue(observer.streamFlowValue.isInitialized()); assertEquals(observer.streamFlowValue.getType(), type); assertNull(observer.throwable); assertTrue(observer.isCompleted); }

Target:
public void subscribe_to_topic() { final BoundedContext boundedContext = setupBoundedContextForAggregateRepo(); final SubscriptionService subscriptionService = SubscriptionService.newBuilder() .addBoundedContext(boundedContext) .build(); final String type = boundedContext.getStand() .getAvailableTypes() .iterator() .next() .getTypeName(); final Target target = getProjectQueryTarget(); assertEquals(type, target.getType()); final Topic topic = Topic.newBuilder() .setTarget(target) .build(); final MemoizeStreamObserver<Subscription> observer = new MemoizeStreamObserver<>(); subscriptionService.subscribe(topic, observer); assertNotNull(observer.streamFlowValue); assertTrue(observer.streamFlowValue.isInitialized()); assertEquals(observer.streamFlowValue.getType(), type); assertNull(observer.throwable); assertTrue(observer.isCompleted); }
Source:
public XBee64BitAddress(String address) { byte[] byteAddress = HexUtils.hexStringToByteArray(address); this.address = new byte[8]; int diff = 8 - byteAddress.length; for (int i = 0; i < diff; i++) this.address[i] = 0; for (int i = diff; i < 8; i++) this.address[i] = byteAddress[i - diff]; }

Target:
public XBee64BitAddress(String address) { if (address == null) throw new NullPointerException("Address cannot be null."); byte[] byteAddress = HexUtils.hexStringToByteArray(address); this.address = new byte[8]; int diff = 8 - byteAddress.length; for (int i = 0; i < diff; i++) this.address[i] = 0; for (int i = diff; i < 8; i++) this.address[i] = byteAddress[i - diff]; }
Source:
private int distToInt(double distance) { if (distance < 0) throw new IllegalArgumentException("Distance cannot be negative: " + distance); if (distance > MAX_DIST) { distance = MAX_DIST; } int integ = Math.round((float) (distance * INT_DIST_FACTOR)); assert integ >= 0 : "distance out of range"; return integ; }

Target:
private int distToInt(double distance) { if (distance < 0) throw new IllegalArgumentException("Distance cannot be negative: " + distance); if (distance > MAX_DIST) { distance = MAX_DIST; } int integ = (int) Math.round(distance * INT_DIST_FACTOR); assert integ >= 0 : "distance out of range"; return integ; }
Source:
public String toString() { return "Add new Resource adapter: " + id; }

Target:
public String toString() { return "AddResourceAdapter " + id; }
Source:
public void testOverwriteRotate() throws Exception { final Calendar cal = Calendar.getInstance(); final String rotatedPath = BASE_LOG_DIR.toString() + "/" + FILENAME + rotateFormatter.format(cal.getTime()); File rotatedFile = new File(rotatedPath); if (rotatedFile.exists()) rotatedFile.delete(); try { FileWriter fwriter = new FileWriter(rotatedFile.getAbsolutePath()); BufferedWriter writer = new BufferedWriter(fwriter); writer.write("Adding data to the file"); writer.close(); } catch (Exception e) { e.printStackTrace(); } testRotate(cal, rotatedFile); }

Target:
public void testOverwriteRotate() throws Exception { final Calendar cal = Calendar.getInstance(); final String rotatedPath = BASE_LOG_DIR.toString() + File.separator + FILENAME + rotateFormatter.format(cal.getTime()); File rotatedFile = new File(rotatedPath); if (rotatedFile.exists()) { rotatedFile.delete(); } FileWriter fwriter = null; BufferedWriter writer = null; try { fwriter = new FileWriter(rotatedFile.getAbsolutePath()); writer = new BufferedWriter(fwriter); writer.write("Adding data to the file"); } finally { writer.close(); } testRotate(cal, rotatedFile); }
Source:
public static void main(String[] argv) throws FileNotFoundException { File file = new File("./dg-spark/src/main/resources/file/input.txt"); InputStream is = new FileInputStream(file); RandomNumberEngine randomNumberEngine = new RandomNumberEngine(); randomNumberEngine.setModelByInputFileStream(is); String masterURL = "spark://sandbox.hortonworks.com:7077"; SparkDistributor sparkDistributor = new SparkDistributor(masterURL); randomNumberEngine.process(sparkDistributor); }

Target:
public static void main(String[] argv) throws IOException { File file = new File("./dg-spark/src/main/resources/file/input.txt"); InputStream is = new FileInputStream(file); try { RandomNumberEngine randomNumberEngine = new RandomNumberEngine(); randomNumberEngine.setModelByInputFileStream(is); String masterURL = "spark://sandbox.hortonworks.com:7077"; ScalaDataConsumer scalaDataConsumer = new ScalaDataConsumer(); SparkDistributor sparkDistributor = new SparkDistributor(masterURL, scalaDataConsumer); randomNumberEngine.process(sparkDistributor); } finally { is.close(); } }
Source:
public void optionsChanged(DebugOptions options) { fgDebugTrace = options.newDebugTrace(GdbPlugin.getUniqueIdentifier()); DEBUG = options.getBooleanOption(DEBUG_FLAG, false); DEBUG_TIMEOUTS = options.getBooleanOption(DEBUG_TIMEOUTS_FLAG, false); }

Target:
public void optionsChanged(DebugOptions options) { fgDebugTrace = options.newDebugTrace(GdbPlugin.getUniqueIdentifier()); DEBUG = options.getBooleanOption(DEBUG_FLAG, false); DEBUG_COMMAND_TIMEOUTS = options.getBooleanOption(DEBUG_TIMEOUTS_FLAG, false); }
Source:
public void testSimpleQueryWithProxyRegion() { server1.invoke(() -> setupReplicatedProxyRegion(DATA_REGION_WITH_PROXY_NAME)); server2.invoke(() -> setupReplicatedRegion(DATA_REGION_WITH_PROXY_NAME)); locator.waitUntilRegionIsReadyOnExactlyThisManyServers(DATA_REGION_WITH_PROXY_NAME_PATH, 2); server1.invoke(() -> prepareDataForRegion(DATA_REGION_WITH_PROXY_NAME_PATH)); String member = getHostingMember(); Random random = new Random(System.nanoTime()); int randomInteger = random.nextInt(COUNT); String query = "query --member=" + member + " --query=\"select ID , status , createTime , pk, floatMinValue from " + DATA_REGION_WITH_PROXY_NAME_PATH + " where ID <= " + randomInteger + "\" --interactive=false"; CommandResult commandResult = gfsh.executeCommand(query); validateSelectResult(commandResult, true, (randomInteger + 1), new String[] {"ID", "status", "createTime", "pk", "floatMinValue"}); }

Target:
public void testSimpleQueryWithProxyRegion() { server1.invoke(() -> setupReplicatedProxyRegion(DATA_REGION_WITH_PROXY_NAME)); server2.invoke(() -> setupReplicatedRegion(DATA_REGION_WITH_PROXY_NAME)); locator.waitUntilRegionIsReadyOnExactlyThisManyServers(DATA_REGION_WITH_PROXY_NAME_PATH, 2); server1.invoke(() -> prepareDataForRegion(DATA_REGION_WITH_PROXY_NAME_PATH)); String member = "server-2"; Random random = new Random(System.nanoTime()); int randomInteger = random.nextInt(COUNT); String queryString = new StringBuilder() .append("\"select ID , status , createTime , pk, floatMinValue from ") .append(DATA_REGION_WITH_PROXY_NAME_PATH).append(" where ID <= ") .append(randomInteger).append("\"").toString(); String command = new CommandStringBuilder(QUERY) .addOption(MEMBER, member) .addOption(QUERY, queryString).getCommandString(); CommandResult commandResult = gfsh.executeAndAssertThat(command).getCommandResult(); validateSelectResult(commandResult, true, (randomInteger + 1), new String[] {"ID", "status", "createTime", "pk", "floatMinValue"}); }
Source:
public void handleEvent(IExitedDMEvent event) { IDMContext context = event.getDMContext(); if (context instanceof IContainerDMContext) { DsfServicesTracker tracker = new DsfServicesTracker(MulticoreVisualizerUIPlugin.getBundleContext(), context.getSessionId()); IProcesses procService = tracker.getService(IProcesses.class); tracker.dispose(); procService.getProcessesBeingDebugged(context, new ImmediateDataRequestMonitor<IDMContext[]>() { @Override protected void handleSuccess() { assert getData() != null; IDMContext[] contexts = getData(); for (IDMContext c : contexts) { if (c instanceof IMIExecutionDMContext) { int tid = ((IMIExecutionDMContext)c).getThreadId(); fVisualizer.getModel().markThreadExited(tid); } } } }); } else if (context instanceof IMIExecutionDMContext) { int tid = ((IMIExecutionDMContext)context).getThreadId(); fVisualizer.getModel().markThreadExited(tid); MulticoreVisualizerCanvas canvas = fVisualizer.getMulticoreVisualizerCanvas(); if (canvas != null) { canvas.requestUpdate(); } } }

Target:
public void handleEvent(IExitedDMEvent event) { IDMContext context = event.getDMContext(); MulticoreVisualizerCanvas canvas = fVisualizer.getMulticoreVisualizerCanvas(); if (context instanceof IContainerDMContext) { DsfServicesTracker tracker = new DsfServicesTracker(MulticoreVisualizerUIPlugin.getBundleContext(), context.getSessionId()); IProcesses procService = tracker.getService(IProcesses.class); tracker.dispose(); procService.getProcessesBeingDebugged(context, new ImmediateDataRequestMonitor<IDMContext[]>() { @Override protected void handleSuccess() { assert getData() != null; IDMContext[] contexts = getData(); for (IDMContext c : contexts) { if (c instanceof IMIExecutionDMContext) { int tid = ((IMIExecutionDMContext)c).getThreadId(); fVisualizer.getModel().markThreadExited(tid); } } } }); if (canvas != null) { canvas.requestUpdate(); } } else if (context instanceof IMIExecutionDMContext) { int tid = ((IMIExecutionDMContext)context).getThreadId(); fVisualizer.getModel().markThreadExited(tid); if (canvas != null) { canvas.requestUpdate(); } } }
Source:
public void sendToStomp(StompFrame command) throws IOException { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(baos); getWireFormat().marshal(command, dos); dos.close(); ByteBuffer byteBuffer = ByteBuffer.wrap(baos.toByteArray()); session.getRemote().sendBytesByFuture(byteBuffer).get(getDefaultSendTimeOut(), TimeUnit.SECONDS); } catch (Exception e) { throw IOExceptionSupport.create(e); } }

Target:
public void sendToStomp(StompFrame command) throws IOException { try { session.getRemote().sendStringByFuture(getWireFormat().marshalToString(command)).get(getDefaultSendTimeOut(), TimeUnit.SECONDS); } catch (Exception e) { throw IOExceptionSupport.create(e); } }
Source:
private static JSITDMNElement.JSIExtensionElements getOrCreateExtensionElements(final JSITDRGElement target) { JSITDMNElement.JSIExtensionElements toReturn = target.getExtensionElements() == null ? new JSITDMNElement.JSIExtensionElements() : target.getExtensionElements(); if (!Objects.isNull(toReturn) && Objects.isNull(toReturn.getAny())) { toReturn.setAny(new ArrayList<>()); } return toReturn; }

Target:
private static JSITDMNElement.JSIExtensionElements getOrCreateExtensionElements(final JSITDRGElement target) { JSITDMNElement.JSIExtensionElements toReturn = Objects.isNull(target.getExtensionElements()) ? new JSITDMNElement.JSIExtensionElements() : target.getExtensionElements(); if (!Objects.isNull(toReturn) && Objects.isNull(toReturn.getAny())) { toReturn.setAny(new ArrayList<>()); } return toReturn; }
Source:
private List<BRLConditionVariableColumn> convertInterpolationVariables(Map<InterpolationVariable, Integer> ivs) { if (ivs.isEmpty()) { BRLConditionVariableColumn variable = new BRLConditionVariableColumn("", DataType.TYPE_BOOLEAN); variable.setHeader(editingCol.getHeader()); variable.setHideColumn(editingCol.isHideColumn()); List<BRLConditionVariableColumn> variables = new ArrayList<BRLConditionVariableColumn>(); variables.add(variable); return variables; } BRLConditionVariableColumn[] variables = new BRLConditionVariableColumn[ivs.size()]; for (Map.Entry<InterpolationVariable, Integer> me : ivs.entrySet()) { InterpolationVariable iv = me.getKey(); int index = me.getValue(); BRLConditionVariableColumn variable = new BRLConditionVariableColumn(iv.getVarName(), iv.getDataType(), iv.getFactType(), iv.getFactField()); variable.setHeader(editingCol.getHeader()); variable.setHideColumn(editingCol.isHideColumn()); variable.setOperator(iv.getOperator()); variables[index] = variable; } List<BRLConditionVariableColumn> variableList = new ArrayList<BRLConditionVariableColumn>(); for (BRLConditionVariableColumn variable : variables) { variableList.add(variable); } return variableList; }

Target:
private List<BRLConditionVariableColumn> convertInterpolationVariables(Map<InterpolationVariable, Integer> ivs) { if (ivs.isEmpty()) { BRLConditionVariableColumn variable = new BRLConditionVariableColumn("", DataType.TYPE_BOOLEAN); variable.setHeader(editingCol.getHeader()); variable.setHideColumn(editingCol.isHideColumn()); List<BRLConditionVariableColumn> variables = new ArrayList<BRLConditionVariableColumn>(); variables.add(variable); return variables; } BRLConditionVariableColumn[] variables = new BRLConditionVariableColumn[ivs.size()]; for (Map.Entry<InterpolationVariable, Integer> me : ivs.entrySet()) { InterpolationVariable iv = me.getKey(); int index = me.getValue(); BRLConditionVariableColumn variable = new BRLConditionVariableColumn(iv.getVarName(), iv.getDataType(), iv.getFactType(), iv.getFactField(), iv.getOperator()); variable.setHeader(editingCol.getHeader()); variable.setHideColumn(editingCol.isHideColumn()); variables[index] = variable; } List<BRLConditionVariableColumn> variableList = new ArrayList<BRLConditionVariableColumn>(); for (BRLConditionVariableColumn variable : variables) { variableList.add(variable); } return variableList; }
Source:
public AuditLogType getAuditLogTypeValue() { addCustomValue(LOGABLE_FIELD_CPU_LIMIT, String.valueOf((int) getParameters().getSlaParameter(VmSlaPolicyParameters.Params.CPU_LIMIT))); if (getSucceeded()) { return AuditLogType.VM_SLA_POLICY; } else { addCustomValue(LOGABLE_FIELD_ERROR_MESSAGE, getReturnValue().getFault().getMessage()); return AuditLogType.FAILED_VM_SLA_POLICY; } }

Target:
public AuditLogType getAuditLogTypeValue() { addCustomValue(LOGABLE_FIELD_CPU_LIMIT, String.valueOf(getParameters().getCpuLimit())); return getSucceeded() ? AuditLogType.VM_SLA_POLICY : AuditLogType.FAILED_VM_SLA_POLICY; }
Source:
public SingularityWebhookAuthenticator(@Named(SingularityAuthModule.WEBHOOK_AUTH_HTTP_CLIENT) AsyncHttpClient asyncHttpClient, SingularityConfiguration configuration, ObjectMapper objectMapper) { this.asyncHttpClient = asyncHttpClient; this.webhookAuthConfiguration = configuration.getWebhookAuthConfiguration(); this.objectMapper = objectMapper; this.permissionsCache = CacheBuilder.<String, SingularityUserPermissionsResponse>newBuilder() .refreshAfterWrite(webhookAuthConfiguration.getCacheValidationMs(), TimeUnit.MILLISECONDS) .build(new CacheLoader<String, SingularityUserPermissionsResponse>() { @Override public SingularityUserPermissionsResponse load(String authHeaderVaule) throws Exception { return verifyUncached(authHeaderVaule); } @Override public ListenableFuture<SingularityUserPermissionsResponse> reload(String authHeaderVaule, SingularityUserPermissionsResponse oldVaule) { return ListenableFutureTask.create(() -> { try { return verifyUncached(authHeaderVaule); } catch (Throwable t) { return oldVaule; } }); } }); }

Target:
public SingularityWebhookAuthenticator(@Named(SingularityAuthModule.WEBHOOK_AUTH_HTTP_CLIENT) AsyncHttpClient asyncHttpClient, SingularityConfiguration configuration, ObjectMapper objectMapper) { this.asyncHttpClient = asyncHttpClient; this.webhookAuthConfiguration = configuration.getWebhookAuthConfiguration(); this.objectMapper = objectMapper; this.permissionsCache = CacheBuilder.<String, SingularityUserPermissionsResponse>newBuilder() .refreshAfterWrite(webhookAuthConfiguration.getCacheValidationMs(), TimeUnit.MILLISECONDS) .build(new CacheLoader<String, SingularityUserPermissionsResponse>() { @Override public SingularityUserPermissionsResponse load(String authHeaderValue) throws Exception { return verifyUncached(authHeaderValue); } @Override public ListenableFuture<SingularityUserPermissionsResponse> reload(String authHeaderVaule, SingularityUserPermissionsResponse oldVaule) { return ListenableFutureTask.create(() -> { try { return verifyUncached(authHeaderVaule); } catch (Throwable t) { LOG.warn("Unable to refresh user information", t); return oldVaule; } }); } }); }
Source:
public int read(ScatteringByteChannel channel) throws IOException { expectIncomplete(); int read = 0; if (sizeBuffer.remaining() > 0) { read += channel.read(sizeBuffer); } if (contentBuffer == null && !sizeBuffer.hasRemaining()) { sizeBuffer.rewind(); int size = sizeBuffer.getInt(); if (size <= 0) { throw new IOException(format("%d is not a valid request size.", size)); } contentBuffer = byteBufferAllocate(size); } if (contentBuffer != null) { read = channel.read(contentBuffer); if (!contentBuffer.hasRemaining()) { contentBuffer.rewind(); complete = true; } } return read; }

Target:
public int read(ScatteringByteChannel channel) throws IOException { int read = 0; if (sizeBuffer.hasRemaining()) { int num = channel.read(sizeBuffer); if (num < 0) { throw new IOException("end-of-stream reached"); } read += num; if (sizeBuffer.hasRemaining()) { return read; } else { sizeBuffer.flip(); size = sizeBuffer.getInt(); contentBuffer = ByteBuffer.allocate(size); } } if (!sizeBuffer.hasRemaining()) { int num = channel.read(contentBuffer); if (num < 0) { throw new IOException("end-of-stream reached"); } read += num; if (!contentBuffer.hasRemaining()) { contentBuffer.flip(); complete = true; } } return read; }
Source:
private void speakArticle() { TextToSpeech tts = getPageActivity().getTTSEngine(); MenuItem speechArticle = mOptionsMenu.findItem(R.id.menu_page_tts); if (tts.isSpeaking()) { stopSpeakArticle(tts); } else { speechArticle.setTitle(R.string.tts_stop_read_aloud); Locale lang = Locale.forLanguageTag(getTitle().getSite().getLanguageCode()); if (tts.isLanguageAvailable(lang) == TextToSpeech.LANG_AVAILABLE) { tts.setLanguage(lang); L.d("Set TTS language to: " + lang.getDisplayLanguage()); } else { FeedbackUtil.showMessage(getActivity(), R.string.tts_lang_not_available); return; } tts.speak(Html.fromHtml(getPage().getDisplayTitle()).toString(), TextToSpeech.QUEUE_ADD, null, null); List<Section> sections = getPage().getSections(); for (Section section : sections) { addToSpeakQueue(Html.fromHtml(section.getHeading() + " " + section.getContent()).toString(), tts); } Bundle params = new Bundle(); params.putString(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, getPage().getDisplayTitle()); tts.speak("", TextToSpeech.QUEUE_ADD, params, getPage().getDisplayTitle()); } }

Target:
private void speakArticle() { TextToSpeech tts = getPageActivity().getTTSEngine(); if (tts.isSpeaking()) { stopSpeakArticle(tts); } else { Locale lang = Locale.forLanguageTag(getTitle().getSite().getLanguageCode()); if (tts.isLanguageAvailable(lang) == TextToSpeech.LANG_AVAILABLE) { tts.setLanguage(lang); L.d("Set TTS language to: " + lang.getDisplayLanguage()); } else { FeedbackUtil.showMessage(getActivity(), R.string.tts_lang_not_available); return; } addToSpeakQueue(Html.fromHtml(getPage().getDisplayTitle()).toString(), tts); List<Section> sections = getPage().getSections(); for (Section section : sections) { addToSpeakQueue(Html.fromHtml(section.getHeading() + " " + section.getContent()).toString(), tts); } HashMap<String, String> params = new HashMap(); params.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, getPage().getDisplayTitle()); speak("", params, tts); invalidateOptionsMenu(); } }
Source:
void onConnectionError(Throwable exception) { logger.warning("Connection exception encountered: " + exception, exception); }

Target:
void onConnectionError(Throwable exception) { logger.warning("Connection exception encountered.", exception); }
Source:
public static void tearDownTestCase() throws Exception { if(dataSource != null) { Connection con = dataSource.getConnection(); if(con != null) { con.rollback(); } } }

Target:
public static void tearDownTestCase() throws Exception { }
Source:
public Http2BlockingChannel(String hostName, int port, SSLConfig sslConfig, Http2ClientConfig http2ClientConfig, Http2ClientMetrics http2ClientMetrics) { NettySslHttp2Factory nettySslHttp2Factory; try { nettySslHttp2Factory = new NettySslHttp2Factory(sslConfig); } catch (GeneralSecurityException | IOException e) { throw new IllegalStateException("Can't create NettySslHttp2Factory: ", e); } this.http2ClientConfig = http2ClientConfig; this.http2ClientMetrics = http2ClientMetrics; this.http2MultiplexedChannelPool = new Http2MultiplexedChannelPool(new InetSocketAddress(hostName, port), nettySslHttp2Factory, Epoll.isAvailable() ? new EpollEventLoopGroup() : new NioEventLoopGroup(), http2ClientConfig, http2ClientMetrics, new Http2BlockingChannelStreamChannelInitializer(http2ClientConfig.http2MaxContentLength)); }

Target:
public Http2BlockingChannel(String hostName, int port, SSLConfig sslConfig, Http2ClientConfig http2ClientConfig, Http2ClientMetrics http2ClientMetrics) { NettySslHttp2Factory nettySslHttp2Factory; try { nettySslHttp2Factory = new NettySslHttp2Factory(sslConfig); } catch (GeneralSecurityException | IOException e) { throw new IllegalStateException("Can't create NettySslHttp2Factory: ", e); } this.http2ClientConfig = http2ClientConfig; this.http2MultiplexedChannelPool = new Http2MultiplexedChannelPool(new InetSocketAddress(hostName, port), nettySslHttp2Factory, Epoll.isAvailable() ? new EpollEventLoopGroup() : new NioEventLoopGroup(), http2ClientConfig, http2ClientMetrics, new Http2BlockingChannelStreamChannelInitializer(http2ClientConfig.http2MaxContentLength)); }
Source:
private void skipIntro(Playable playable) { int skipIntro = 0; if (! (playable instanceof FeedMedia)) { return; } if (playable.getLastPlayedTime() > 0) { return; } if (playable instanceof FeedMedia) { FeedMedia feedMedia = (FeedMedia) playable; FeedPreferences preferences = feedMedia.getItem().getFeed().getPreferences(); skipIntro = preferences.getFeedSkipIntro(); } String skipIntroMesg = ""; Context context = getApplicationContext(); if (skipIntro > 0) { int duration = getDuration(); if (skipIntro * 1000 < duration) { mediaPlayer.seekTo(skipIntro * 1000); skipIntroMesg = context.getString(R.string.pref_feed_skip_intro_toast, skipIntro, context.getString(R.string.time_seconds)); } } if (skipIntroMesg != "") { Toast toast = Toast.makeText(context, skipIntroMesg, Toast.LENGTH_LONG); toast.show(); } }

Target:
private void skipIntro(Playable playable) { if (! (playable instanceof FeedMedia)) { return; } FeedMedia feedMedia = (FeedMedia) playable; FeedPreferences preferences = feedMedia.getItem().getFeed().getPreferences(); int skipIntro = preferences.getFeedSkipIntro(); Context context = getApplicationContext(); if (skipIntro > 0 && playable.getPosition() < skipIntro * 1000) { int duration = getDuration(); if (skipIntro * 1000 < duration) { Log.d(TAG, "skipIntro " + playable.getEpisodeTitle()); mediaPlayer.seekTo(skipIntro * 1000); String skipIntroMesg = context.getString(R.string.pref_feed_skip_intro_toast, skipIntro); Toast toast = Toast.makeText(context, skipIntroMesg, Toast.LENGTH_LONG); toast.show(); } } }
Source:
public void activate(final BundleContext bundleContext, final Map<String, Object> config) { logger.debug("influxdb persistence service activated"); disconnect(); password = (String) config.get("password"); if (StringUtils.isBlank(password)) { isProperlyConfigured = false; logger .error("influxdb:password", "The password is missing. To specify a password configure the password parameter in openhab.cfg."); return; } url = (String) config.get("url"); if (StringUtils.isBlank(url)) { url = DEFAULT_URL; logger.debug("using default url {}", DEFAULT_URL); } user = (String) config.get("user"); if (StringUtils.isBlank(user)) { user = DEFAULT_USER; logger.debug("using default user {}", DEFAULT_USER); } dbName = (String) config.get("db"); if (StringUtils.isBlank(dbName)) { dbName = DEFAULT_DB; logger.debug("using default db name {}", DEFAULT_DB); } isProperlyConfigured = true; connect(); if (!checkConnection()) { logger.error("database connection does not work for now, will retry to use the database."); } }

Target:
public void activate(final BundleContext bundleContext, final Map<String, Object> config) { logger.debug("influxdb persistence service activated"); disconnect(); password = (String) config.get("password"); if (isBlank(password)) { isProperlyConfigured = false; logger .error("influxdb:password", "The password is missing. To specify a password configure the password parameter in openhab.cfg."); return; } url = (String) config.get("url"); if (isBlank(url)) { url = DEFAULT_URL; logger.debug("using default url {}", DEFAULT_URL); } user = (String) config.get("user"); if (isBlank(user)) { user = DEFAULT_USER; logger.debug("using default user {}", DEFAULT_USER); } dbName = (String) config.get("db"); if (isBlank(dbName)) { dbName = DEFAULT_DB; logger.debug("using default db name {}", DEFAULT_DB); } isProperlyConfigured = true; connect(); if (!checkConnection()) { logger.error("database connection does not work for now, will retry to use the database."); } }
Source:
public boolean lock() { if (backoffParameters.hasAcquireQueueLimit() && lock.getQueueLength() >= backoffParameters.maximumQueued) { throw new LockAcquisitionFailedException("Failed to acquire lock for aggregate identifier " + identifier + ": too many queued threads."); } try { if (!lock.tryLock(0, TimeUnit.NANOSECONDS)) { int attempts = backoffParameters.acquireAttempts - 1; do { attempts--; checkForDeadlock(); if(backoffParameters.hasAcquireAttemptLimit() && attempts < 1) { throw new LockAcquisitionFailedException("Failed to acquire lock for aggregate identifier " + identifier); } } while (!lock.tryLock(backoffParameters.spinTime, TimeUnit.MILLISECONDS)); } } catch (InterruptedException e) { throw new LockAcquisitionFailedException("Thread was interrupted", e); } if (isClosed) { lock.unlock(); return false; } return true; }

Target:
public boolean lock() { if (backoffParameters.maximumQueuedThreadsReached(lock.getQueueLength())) { throw new LockAcquisitionFailedException("Failed to acquire lock for aggregate identifier " + identifier + ": too many queued threads."); } try { if (!lock.tryLock(0, TimeUnit.NANOSECONDS)) { int attempts = backoffParameters.acquireAttempts - 1; do { attempts--; checkForDeadlock(); if(backoffParameters.hasAcquireAttemptLimit() && attempts < 1) { throw new LockAcquisitionFailedException( "Failed to acquire lock for aggregate identifier(" + identifier + "), maximum attempts exceeded (" + backoffParameters.maximumQueued + ")" ); } } while (!lock.tryLock(backoffParameters.spinTime, TimeUnit.MILLISECONDS)); } } catch (InterruptedException e) { throw new LockAcquisitionFailedException("Thread was interrupted", e); } if (isClosed) { lock.unlock(); return false; } return true; }
Source:
public void access_to_superclass_should_trigger_completion() { JavaSymbol.TypeJavaSymbol typeSymbol = spy(new JavaSymbol.TypeJavaSymbol(42, "name", new JavaSymbol.PackageJavaSymbol(null, null))); typeSymbol.getSuperclass(); verify(typeSymbol).complete(); }

Target:
public void access_to_superclass_should_trigger_completion() { JavaSymbol.TypeJavaSymbol typeSymbol = spy(new JavaSymbol.TypeJavaSymbol(42, "name", P_PACKAGE_JAVA_SYMBOL)); typeSymbol.getSuperclass(); verify(typeSymbol).complete(); }
Source:
protected void checkFile(@NotNull GoFile file, @NotNull ProblemsHolder problemsHolder) { if (GoTestFinder.getTestTargetPackage(file) != null) return; List<GoFunctionDeclaration> functions = file.getFunctions(); for (GoFunctionDeclaration function : functions) { for (GoImportSpec importSpec : file.getImports()) { if (function.getIdentifier().textMatches(importSpec.getLocalPackageName())) { problemsHolder.registerProblem(function.getIdentifier(), getMessage(importSpec.getLocalPackageName())); } } } }

Target:
protected void checkFile(@NotNull GoFile file, @NotNull ProblemsHolder problemsHolder) { if (GoTestFinder.getTestTargetPackage(file) != null) return; List<GoFunctionDeclaration> functions = file.getFunctions(); String funcName; for (GoFunctionDeclaration function : functions) { funcName = function.getName(); if (funcName == null) continue; for (GoImportSpec importSpec : file.getImports()) { if (funcName.equals(importSpec.getLocalPackageName())) { problemsHolder.registerProblem(function.getIdentifier(), getMessage(importSpec.getLocalPackageName()), new GoRenameQuickFix(function)); } } } }
Source:
private boolean needProjectionNode (AbstractPlanNode root) { if ( false == root.planNodeClassNeedsProjectionNode()) { return false; } if (m_parsedSelect.hasComplexGroupby() || m_parsedSelect.hasComplexAgg()) { return false; } if (root instanceof AbstractReceivePlanNode && m_parsedSelect.hasPartitionColumnInGroupby()) { return false; } return true; }

Target:
private boolean needProjectionNode (AbstractPlanNode root) { if (!root.planNodeClassNeedsProjectionNode()) { return false; } if (m_parsedSelect.hasComplexGroupby() || m_parsedSelect.hasComplexAgg()) { return false; } if (root instanceof AbstractReceivePlanNode && m_parsedSelect.hasPartitionColumnInGroupby()) { return false; } return true; }
Source:
public synchronized void save() throws IOException { InitMilestone currentMilestone = initLevel; if (!configLoaded) { LOGGER.log(Level.SEVERE, "An attempt to save Jenkins'' global configuration before it has been loaded has been " + "made during milestone " + currentMilestone + ". This is indicative of a bug in the caller and may lead to full or partial loss of " + "configuration.", new IllegalStateException("call trace")); throw new IOException("An attempt to save the configuration was made before it was loaded"); } if(BulkChange.contains(this)) { return; } if (currentMilestone == InitMilestone.COMPLETED) { LOGGER.log(FINE, "setting version {0} to {1}", new Object[] {version, VERSION}); version = VERSION; } else { LOGGER.log(FINE, "refusing to set version {0} to {1} during {2}", new Object[] {version, VERSION, currentMilestone}); } getConfigFile().write(this); SaveableListener.fireOnChange(this, getConfigFile()); }

Target:
public synchronized void save() throws IOException { InitMilestone currentMilestone = initLevel; if (!configLoaded) { LOGGER.log(Level.SEVERE, "An attempt to save Jenkins'' global configuration before it has been loaded has been " + "made during milestone " + currentMilestone + ". This is indicative of a bug in the caller and may lead to full or partial loss of " + "configuration.", new IllegalStateException("call trace")); throw new IllegalStateException("An attempt to save the global configuration was made before it was loaded"); } if(BulkChange.contains(this)) { return; } if (currentMilestone == InitMilestone.COMPLETED) { LOGGER.log(FINE, "setting version {0} to {1}", new Object[] {version, VERSION}); version = VERSION; } else { LOGGER.log(FINE, "refusing to set version {0} to {1} during {2}", new Object[] {version, VERSION, currentMilestone}); } getConfigFile().write(this); SaveableListener.fireOnChange(this, getConfigFile()); }
Source:
public static Object awaitLatch(Object payload, CountDownLatch latch) { try { latch.await(); } catch (InterruptedException e) { currentThread().interrupt(); return payload; } return payload; }

Target:
public static Object awaitLatch(Object payload, CountDownLatch latch) { try { latch.await(); } catch (InterruptedException e) { currentThread().interrupt(); } return payload; }
Source:
public LockResponse lock(LockRequest request) { long startTime = System.nanoTime(); LeasableLockResponse leasableResponse = delegate.leasableLock(request); LockResponse lockResponse = leasableResponse.getLockResponse(); Optional<Duration> leasePeriod = leasableResponse.getLeasePeriod(); if (lockResponse.wasSuccessful()) { updateLockLeases(lockResponse.getToken(), startTime, leasePeriod); } return lockResponse; }

Target:
public LockResponse lock(LockRequest request) { LeasableLockResponse leasableResponse = delegate.lockV2(request); LockResponse lockResponse = leasableResponse.getLockResponse(); Lease lease = leasableResponse.getLease(); if (lockResponse.wasSuccessful()) { LeasedLockToken leasedLockToken = LeasedLockToken.of(lockResponse.getToken(), lease); return ImmutableLockResponse.of(Optional.of(leasedLockToken)); } return LockResponse.timedOut(); }
Source:
private void testWriteCredentialReferenceAttribute(String resource, String resourceName, String store, String alias, String secret, boolean assertFailed) { ModelNode operation = new ModelNode(); operation.get(ClientConstants.OP_ADDR).add("subsystem", "elytron").add(resource, resourceName); operation.get(ClientConstants.OP).set(ClientConstants.WRITE_ATTRIBUTE_OPERATION); operation.get(ClientConstants.NAME).set(CREDENTIAL_REFERENCE); ModelNode credentialReference = new ModelNode(); if (store != null) { credentialReference.get(STORE).set(store); } if (alias != null) { credentialReference.get(ALIAS).set(alias); } if (secret != null) { credentialReference.get(CLEAR_TEXT).set(secret); } operation.get(ClientConstants.VALUE).set(credentialReference); ModelNode response = services.executeOperation(operation); if (assertFailed) { assertEquals(FAILED, response.get(OUTCOME).asString()); assertTrue(response.get(FAILURE_DESCRIPTION).asString().contains(CREDENTIAL_REFERENCE)); } else { assertSuccess(response).get(RESULT); } }

Target:
private void testWriteCredentialReferenceAttribute(String resource, String resourceName, String store, String alias, String secret, boolean assertFailed) { ModelNode operation = new ModelNode(); operation.get(ClientConstants.OP_ADDR).add("subsystem", "elytron").add(resource, resourceName); operation.get(ClientConstants.OP).set(ClientConstants.WRITE_ATTRIBUTE_OPERATION); operation.get(ClientConstants.NAME).set(CREDENTIAL_REFERENCE); ModelNode credentialReference = new ModelNode(); if (store != null) { credentialReference.get(STORE).set(store); } if (alias != null) { credentialReference.get(ALIAS).set(alias); } if (secret != null) { credentialReference.get(CLEAR_TEXT).set(secret); } operation.get(ClientConstants.VALUE).set(credentialReference); ModelNode response = services.executeOperation(operation); if (assertFailed) { assertEquals(FAILED, response.get(OUTCOME).asString()); assertTrue(response.get(FAILURE_DESCRIPTION).asString().contains(CREDENTIAL_REFERENCE)); } else { assertSuccess(response); } }
Source:
public int execute() { Task<?> rootTask = work.getRootTask(); if (rootTask != null) { rootTask.setChildTasks(null); } work.setRootTask(this); this.parentTasks = null; if (shouldLoadAuthorizationMetadata()) { LOG.info("Loading authorization data"); try { initiateAuthorizationLoadTask(work.dumpDirectory); } catch (Exception e) { LOG.error("failed", e); setException(e); return ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode(); } } if (work.isIncrementalLoad()) { return executeIncrementalLoad(); } else { return executeBootStrapLoad(); } }

Target:
public int execute() { try { Task<?> rootTask = work.getRootTask(); if (rootTask != null) { rootTask.setChildTasks(null); } work.setRootTask(this); this.parentTasks = null; if (shouldLoadAuthorizationMetadata()) { initiateAuthorizationLoadTask(); } if (work.isIncrementalLoad()) { return executeIncrementalLoad(); } else { return executeBootStrapLoad(); } } catch (RuntimeException e) { LOG.error("replication failed with run time exception", e); throw e; } catch (Exception e) { LOG.error("replication failed", e); setException(e); return ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode(); } }