auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void launch(SlaveComputer computer, TaskListener listener) throws IOException, InterruptedException { PrintStream logger = listener.getLogger(); final JCloudsSlave slave = (JCloudsSlave) computer.getNode(); final String[] addresses = getConnectionAddresses(slave.getNodeMetaData(), logger); String host = addresses[0]; if ("0.0.0.0".equals(host)) { logger.println("Invalid host 0.0.0.0, your host is most likely waiting for an ip address."); throw new IOException("goto sleep"); } LOGGER.info("Launching host: " + host); if (slave.getSlaveType() == JCloudsCloud.SlaveType.SSH) { JCloudsCloud cloud = JCloudsCloud.getByName(slave.getCloudName()); int sshLaunchDelay = cloud.getSshLaunchDelay(); if (sshLaunchDelay > 0) { try { LOGGER.info(String.format("Delaying launch for %s milliseconds", sshLaunchDelay)); Thread.sleep(sshLaunchDelay); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } } SSHLauncher launcher = new SSHLauncher(host, 22, slave.getCredentialsId(), slave.getJvmOptions(), null, "", "", Integer.valueOf(0), null, null); launcher.launch(computer, listener); } else if (slave.getSlaveType() == JCloudsCloud.SlaveType.JNLP) { JNLPLauncher launcher = new JNLPLauncher(); launcher.launch(computer, listener); } else { throw new IOException(MessageFormat.format("Unknown slave type: {0}", slave.getSlaveType())); } }

Target:
public void launch(SlaveComputer computer, TaskListener listener) throws IOException, InterruptedException { PrintStream logger = listener.getLogger(); final JCloudsSlave slave = (JCloudsSlave) computer.getNode(); final String[] addresses = getConnectionAddresses(slave.getNodeMetaData(), logger); String host = addresses[0]; if ("0.0.0.0".equals(host)) { logger.println("Invalid host 0.0.0.0, your host is most likely waiting for an ip address."); throw new IOException("goto sleep"); } LOGGER.info("Launching host: " + host); if (slave.getSlaveType() == JCloudsCloud.SlaveType.SSH) { JCloudsCloud cloud = JCloudsCloud.getByName(slave.getCloudName()); int sshLaunchDelay = cloud.getSshLaunchDelay(); if (sshLaunchDelay > 0) { LOGGER.info(String.format("Delaying launch for %s milliseconds", sshLaunchDelay)); Thread.sleep(sshLaunchDelay); } SSHLauncher launcher = new SSHLauncher(host, 22, slave.getCredentialsId(), slave.getJvmOptions(), null, "", "", Integer.valueOf(0), null, null); launcher.launch(computer, listener); } else if (slave.getSlaveType() == JCloudsCloud.SlaveType.JNLP) { JNLPLauncher launcher = new JNLPLauncher(); launcher.launch(computer, listener); } else { throw new IOException(MessageFormat.format("Unknown slave type: {0}", slave.getSlaveType())); } }
Source:
public List<CommunicationDetails> getById(String tenantId, String id) { List<CommunicationDetails> ret = new ArrayList<>(); if (multipleConsumers.containsKey(id)) { ret.addAll(multipleConsumers.get(id)); } CommunicationDetails singleConsumer = this.singleConsumer.get(id); if (singleConsumer != null) { ret.add(singleConsumer); } return ret; }

Target:
public List<CommunicationDetails> getById(String tenantId, String id) { throw new UnsupportedOperationException(); }
Source:
private Repository createMockRepository() { return new Repository() { @Override public String[] getDescriptorKeys() { return new String[0]; } @Override public boolean isStandardDescriptor(String s) { return false; } @Override public boolean isSingleValueDescriptor(String s) { return false; } @Override public Value getDescriptorValue(String s) { return null; } @Override public Value[] getDescriptorValues(String s) { return new Value[0]; } @Override public String getDescriptor(String s) { return null; } @Override public Session login(Credentials credentials, String s) throws LoginException, NoSuchWorkspaceException, RepositoryException { return new MockRepositorySession(); } @Override public Session login(Credentials credentials) throws LoginException, RepositoryException { return null; } @Override public Session login(String s) throws LoginException, NoSuchWorkspaceException, RepositoryException { return null; } @Override public Session login() throws LoginException, RepositoryException { return null; } }; }

Target:
private Repository createMockRepository() throws RepositoryException { Repository myRepository = Mockito.mock(Repository.class); when(myRepository.login(anyObject(), anyString())).thenAnswer(inv -> createNewMockSession()); return myRepository; }
Source:
public String getStateTypeName(ITimeGraphEntry entry) { return "Thread"; }

Target:
public String getStateTypeName(ITimeGraphEntry entry) { return Messages.CallStackPresentationProvider_Thread; }
Source:
public void onOpenReply(String jobId, RCDeviceListener.RCConnectivityStatus connectivityStatus, RCClient.ErrorCodes status, String text) { RCLogger.i(TAG, "onOpenReply(): id: " + jobId + ", connectivityStatus: " + connectivityStatus + ", status: " + status + ", text: " + text); cachedConnectivityStatus = connectivityStatus; if (status != RCClient.ErrorCodes.SUCCESS) { if (isServiceAttached) { listener.onInitialized(this, connectivityStatus, status.ordinal(), text); } else { RCLogger.w(TAG, "RCDeviceListener event suppressed since Restcomm Client Service not attached: onInitialized(): " + RCClient.errorText(status)); } return; } boolean registerForPushAvailable = false; if (mStorageManagerPreferences != null) { if (allPushRegisterDataAvailable()) { new FcmConfigurationHandler(mStorageManagerPreferences, this).registerForPush(); registerForPushAvailable = true; } } if (!registerForPushAvailable) { if (isServiceAttached) { listener.onInitialized(this, connectivityStatus, RCClient.ErrorCodes.ERROR_MESSAGE_PUSH_PARAMETERS_MISSING.ordinal(), RCClient.errorText(RCClient.ErrorCodes.ERROR_MESSAGE_PUSH_PARAMETERS_MISSING)); } else { RCLogger.w(TAG, "RCDeviceListener event suppressed since Restcomm Client Service not attached: onInitialized(): " + RCClient.errorText(RCClient.ErrorCodes.ERROR_MESSAGE_PUSH_PARAMETERS_MISSING)); } release(); } }

Target:
public void onOpenReply(String jobId, RCDeviceListener.RCConnectivityStatus connectivityStatus, RCClient.ErrorCodes status, String text) { RCLogger.i(TAG, "onOpenReply(): id: " + jobId + ", connectivityStatus: " + connectivityStatus + ", status: " + status + ", text: " + text); cachedConnectivityStatus = connectivityStatus; if (status != RCClient.ErrorCodes.SUCCESS) { if (isServiceAttached) { listener.onInitialized(this, connectivityStatus, status.ordinal(), text); } else { RCLogger.w(TAG, "RCDeviceListener event suppressed since Restcomm Client Service not attached: onInitialized(): " + RCClient.errorText(status)); } return; } boolean registerForPushAvailable = false; if (storageManagerPreferences != null) { if (allPushRegisterDataAvailable()) { new FcmConfigurationHandler(storageManagerPreferences, this).registerForPush(); registerForPushAvailable = true; } } if (!registerForPushAvailable) { if (isServiceAttached) { listener.onInitialized(this, connectivityStatus, RCClient.ErrorCodes.ERROR_DEVICE_PUSH_PARAMETERS_MISSING.ordinal(), RCClient.errorText(RCClient.ErrorCodes.ERROR_DEVICE_PUSH_PARAMETERS_MISSING)); } else { RCLogger.w(TAG, "RCDeviceListener event suppressed since Restcomm Client Service not attached: onInitialized(): " + RCClient.errorText(RCClient.ErrorCodes.ERROR_DEVICE_PUSH_PARAMETERS_MISSING)); } release(); } }
Source:
private Map<String, List<VDS>> getFailedLuns(Map<String, List<Pair<VDS, Integer>>> lunToVds) { Map<String, List<VDS>> failedVds = new HashMap<>(); for (Map.Entry<String, List<Pair<VDS, Integer>>> entry : lunToVds.entrySet()) { List<VDS> vdsList = new ArrayList<>(); Integer size = -1; boolean failed = false; for (Pair<VDS, Integer> vdsSizePair : entry.getValue()) { vdsList.add(vdsSizePair.getFirst()); if (size == -1) { size = vdsSizePair.getSecond(); } else { if (!size.equals(vdsSizePair.getSecond())) { failed = true; } } } if (failed) { failedVds.put(entry.getKey(), vdsList); } } return failedVds; }

Target:
private Map<String, List<VDS>> getFailedLuns(Map<String, List<Pair<VDS, Integer>>> lunToVds) { Map<String, List<VDS>> failedVds = new HashMap<>(); for (Map.Entry<String, List<Pair<VDS, Integer>>> entry : lunToVds.entrySet()) { List<VDS> vdsList = new ArrayList<>(); Integer size = -1; boolean failed = false; for (Pair<VDS, Integer> vdsSizePair : entry.getValue()) { vdsList.add(vdsSizePair.getFirst()); if (size == -1) { size = vdsSizePair.getSecond(); } else if (!size.equals(vdsSizePair.getSecond())) { failed = true; } } if (failed) { failedVds.put(entry.getKey(), vdsList); } } return failedVds; }
Source:
public void handle(HttpExchange exchange) throws IOException { LOG.debug("'{}'", exchange.getRequestURI()); final String path = exchange.getRequestURI().getPath(); try { try { if (path.equals("/")) { String addr = new Interpolator(cfg).interpolate(config.remoteServer()); LOG.debug("Redirecting to '{}'", addr); writeRedirectResponse(exchange, addr); } else { String parts[] = path.substring(1).split("/"); String controller = parts[0]; List<String> p = new ArrayList<>(); for (int i = 1; i < parts.length; i++) { p.add(parts[i]); } Object response = resources.get().invoke(controller, p); exchange.getResponseHeaders().set("Access-Control-Allow-Origin", config.accessControlAllowOrigin()); writeJsonResponse(exchange, 200, response); } } catch (NotFoundException e) { StaticResource resource = provider.getResource(path).get(); if (resource.isValid()) { writeFileResponse(exchange, 200, resource.getData(), resource.getMimeType()); } else { LOG.debug("'{}' Not Found", path); writeFileResponse(exchange, 404, "not found".getBytes(), null); } } } catch (Exception e) { LOG.error("Error processing request '" + path + "'", e); writeErrorResponse(exchange, e); } }

Target:
public void handle(HttpExchange exchange) throws IOException { LOG.debug("'{}'", exchange.getRequestURI()); exchange.getResponseHeaders().set("Server", "KaryonAdmin"); exchange.getResponseHeaders().set("Access-Control-Allow-Origin", config.accessControlAllowOrigin()); final String path = exchange.getRequestURI().getPath(); try { try { if (path.equals("/")) { String addr = new Interpolator(cfg).interpolate(config.remoteServer()); LOG.debug("Redirecting to '{}'", addr); writeRedirectResponse(exchange, addr); } else { String parts[] = path.substring(1).split("/"); String controller = parts[0]; List<String> p = new ArrayList<>(); for (int i = 1; i < parts.length; i++) { p.add(parts[i]); } Object response = resources.get().invoke(controller, p); exchange.getResponseHeaders().set("Access-Control-Allow-Origin", config.accessControlAllowOrigin()); writeJsonResponse(exchange, 200, response); } } catch (NotFoundException e) { Optional<StaticResource> resource = provider.getResource(path).get(); if (resource.isPresent()) { writeFileResponse(exchange, 200, resource.get().getData(), resource.get().getMimeType()); } else { fallback.handle(exchange); } } } catch (Exception e) { LOG.error("Error processing request '" + path + "'", e); writeErrorResponse(exchange, e); } }
Source:
protected Constraint frontLoad(ConstraintFactory constraintFactory) { return constraintFactory.from(ExaminationConstraintConfiguration.class) .join(Exam.class, filtering((config, exam) -> exam.isTopicFrontLoadLarge() && exam.isPeriodFrontLoadLast())) .penalize("Front load", HardSoftScore.ONE_SOFT, (config, exam) -> config.getFrontLoadPenalty()); }

Target:
protected Constraint frontLoad(ConstraintFactory constraintFactory) { return constraintFactory.from(Exam.class) .filter(exam -> exam.isTopicFrontLoadLarge() && exam.isPeriodFrontLoadLast()) .penalizeConfigurable("frontLoad"); }
Source:
public void setUp() throws Exception { config = new Configuration("some-api-key"); config.setDelivery(new Delivery() { @Override public void deliver(SessionTrackingPayload payload, Configuration config) throws DeliveryFailureException { } @Override public void deliver(Report report, Configuration config) throws DeliveryFailureException { } }); client = new Client(InstrumentationRegistry.getContext(), config); client.disableExceptionHandler(); observer = new BugsnagTestObserver(); client.addObserver(observer); }

Target:
public void setUp() throws Exception { config = new Configuration("some-api-key"); config.setDelivery(BugsnagTestUtils.generateDelivery()); client = new Client(InstrumentationRegistry.getContext(), config); client.disableExceptionHandler(); observer = new BugsnagTestObserver(); client.addObserver(observer); }
Source:
public WUCreateResponseWrapper WUCreate(WUCreateRequestWrapper params) throws Exception { if (platformVersion.major==6) { return new WUCreateResponseWrapper(this.version6WorkunitsServiceSoapProxy.WUCreate(params.getRawVersion6())); } else if (platformVersion.major==7) { return new WUCreateResponseWrapper(this.version7WorkunitsServiceSoapProxy.WUCreate(params.getRaw())); } else { throw new NotImplementedException("Can only handle cluster versions 6 and 7, not version " + String.valueOf(platformVersion.major)); } }

Target:
public WUCreateResponseWrapper WUCreate(WUCreateRequestWrapper params) throws Exception { if (useVersion1_62()) { return new WUCreateResponseWrapper(this.getVersion1_62WorkunitsServiceSoapProxy().WUCreate()); } else if (useVersion1_69()) { return new WUCreateResponseWrapper(this.getVersion1_69WorkunitsServiceSoapProxy().WUCreate(params.getRawVersion1_69())); } else if (useVersion1_58()) { return new WUCreateResponseWrapper(this.getVersion1_58WorkunitsServiceSoapProxy().WUCreate()); } else if (useVersion1_73()) { return new WUCreateResponseWrapper(this.getVersion1_73WorkunitsServiceSoapProxy().WUCreate(params.getRaw())); } else { throw new UnsupportedOperationException("Can only handle cluster versions 6 and 7, not version " + String.valueOf(platformVersion.major)); } }
Source:
public static boolean isApgInstalled(Context context) { Intent intent = new Intent("org.openintents.openpgp.IOpenPgpService"); intent.setPackage(PACKAGE_NAME_APG); List<ResolveInfo> resInfo = context.getPackageManager().queryIntentServices(intent, 0); return !resInfo.isEmpty(); }

Target:
public static boolean isApgInstalled(Context context) { Intent intent = new Intent("org.openintents.openpgp.IOpenPgpService"); intent.setPackage(PACKAGE_NAME_APG); List<ResolveInfo> resInfo = context.getPackageManager().queryIntentServices(intent, 0); return resInfo != null && !resInfo.isEmpty(); }
Source:
public DocumentMovedEvent(DocumentReference documentReference) { this(documentReference, null); }

Target:
public DocumentMovedEvent(DocumentReference documentReference) { super(documentReference); }
Source:
public RouterConfig(JsonNode node, String source, boolean logUnusedParams) { NodeAdapter adapter = new NodeAdapter(node, source); this.rawJson = node; this.requestLogFile = adapter.asText("requestLogFile", null); this.streetRoutingTimeoutSeconds = adapter.asDouble( "streetRoutingTimeout", DEFAULT_STREET_ROUTING_TIMEOUT ); this.transitConfig = new TransitRoutingConfig(adapter.path("transit")); this.routingRequestDefaults = mapRoutingRequest(adapter.path("routingDefaults")); this.updaterConfig = new UpdaterConfig(adapter.asRawNode("updaters")); if(logUnusedParams) { adapter.logAllUnusedParameters(LOG); } }

Target:
public RouterConfig(JsonNode node, String source, boolean logUnusedParams) { NodeAdapter adapter = new NodeAdapter(node, source); this.rawJson = node; this.requestLogFile = adapter.asText("requestLogFile", null); this.streetRoutingTimeoutSeconds = adapter.asDouble( "streetRoutingTimeout", DEFAULT_STREET_ROUTING_TIMEOUT ); this.transitConfig = new TransitRoutingConfig(adapter.path("transit")); this.routingRequestDefaults = mapRoutingRequest(adapter.path("routingDefaults")); this.updaterConfig = new UpdaterConfig(adapter.path("updaters")); if(logUnusedParams) { adapter.logAllUnusedParameters(LOG); } }
Source:
private String getFilter(String databaseName, String tableName, List<ColumnProto> partitionColumns , String json) throws TajoException { Expr[] exprs = null; if (json != null && !json.isEmpty()) { Expr algebra = JsonHelper.fromJson(json, Expr.class); exprs = AlgebraicUtil.toConjunctiveNormalFormArray(algebra); } PartitionFilterAlgebraVisitor visitor = new PartitionFilterAlgebraVisitor(); visitor.setIsHiveCatalog(true); Expr[] filters = AlgebraicUtil.getAccumulatedFiltersByExpr(databaseName + "." + tableName, partitionColumns, exprs); StringBuffer sb = new StringBuffer(); Column target; int addedFilter = 0; String result; for (int i = 0; i < partitionColumns.size(); i++) { target = new Column(partitionColumns.get(i)); if (!(filters[i] instanceof IsNullPredicate)) { visitor.setColumn(target); visitor.visit(null, new Stack<Expr>(), filters[i]); result = visitor.getResult(); if (result.length() > 0) { if (addedFilter > 0) { sb.append(" AND "); } sb.append(" ( ").append(result).append(" ) "); addedFilter++; } } } return sb.toString(); }

Target:
private String getFilter(String databaseName, String tableName, List<ColumnProto> partitionColumns , String json) throws TajoException { Expr[] exprs = null; if (json != null && !json.isEmpty()) { Expr algebra = JsonHelper.fromJson(json, Expr.class); exprs = AlgebraicUtil.toConjunctiveNormalFormArray(algebra); } PartitionFilterAlgebraVisitor visitor = new PartitionFilterAlgebraVisitor(); visitor.setIsHiveCatalog(true); Expr[] filters = AlgebraicUtil.getRearrangedCNFExpressions(databaseName + "." + tableName, partitionColumns, exprs); StringBuffer sb = new StringBuffer(); Column target; String result; for (int i = 0; i < partitionColumns.size(); i++) { target = new Column(partitionColumns.get(i)); if (!(filters[i] instanceof IsNullPredicate)) { visitor.setColumn(target); visitor.visit(null, new Stack<Expr>(), filters[i]); result = visitor.getResult(); if (result.length() > 0) { if (sb.length() > 0) { sb.append(" AND "); } sb.append(" ( ").append(result).append(" ) "); } else { throw new TajoInternalError("Filter does not exist : " + filters[i].toJson()); } } } return sb.toString(); }
Source:
public ModelAndView showSearchResults( PortletRequest request, @RequestParam(value = "query") String query, @RequestParam(value = "queryId") String queryId) { final Map<String, Object> model = new HashMap<>(); model.put("query", query); if (isRestSearch(request)) { return new ModelAndView("/jsp/Search/searchRest", model); } ConcurrentMap<String, List<Tuple<SearchResult, String>>> results = new ConcurrentHashMap<>(); final PortalSearchResults portalSearchResults = this.getPortalSearchResults(request, queryId); if (portalSearchResults != null) { results = portalSearchResults.getResults(); } results.forEach( (key, value) -> { value.sort(Comparator.comparingInt(tuple -> tuple.first.getRank())); }); model.put("results", results); model.put("defaultTabKey", this.defaultTabKey); model.put("tabKeys", this.tabKeys); final boolean isMobile = isMobile(request); String viewName = isMobile ? "/jsp/Search/mobileSearch" : "/jsp/Search/search"; return new ModelAndView(viewName, model); }

Target:
public ModelAndView showSearchResults( PortletRequest request, @RequestParam(value = "query") String query, @RequestParam(value = "queryId") String queryId) { final Map<String, Object> model = new HashMap<>(); model.put("query", query); if (isRestSearch(request)) { return new ModelAndView("/jsp/Search/searchRest", model); } ConcurrentMap<String, List<Tuple<SearchResult, String>>> results = new ConcurrentHashMap<>(); final PortalSearchResults portalSearchResults = this.getPortalSearchResults(request, queryId); if (portalSearchResults != null) { results = portalSearchResults.getResults(); } results.forEach( (key, value) -> { value.sort(Comparator.comparingInt(tuple -> tuple.first.getRank())); }); logger.debug("Search results for query '{}' are: {}", query, results); model.put("results", results); model.put("defaultTabKey", this.defaultTabKey); model.put("tabKeys", this.tabKeys); final boolean isMobile = isMobile(request); String viewName = isMobile ? "/jsp/Search/mobileSearch" : "/jsp/Search/search"; return new ModelAndView(viewName, model); }
Source:
public String getPresentableText(HaxeMethodContext context) { StringBuilder result = new StringBuilder(getName()); if (hasConstructor()) { result .append("(") .append(getPresentableParameterList(constructorParameters)) .append((")")); } else if (isAbstract) { result .append(":") .append(getResultType().toString()); } return result.toString(); }

Target:
public String getPresentableText(HaxeMethodContext context) { StringBuilder result = new StringBuilder(getName()); if (hasConstructor()) { result .append("(") .append(getPresentableParameterList((HaxeEnumValueDeclaration)getBasePsi())) .append((")")); } if (hasReturnType) { result .append(":") .append(getResultType().toString()); } return result.toString(); }
Source:
public String call() { StringWriter bos = new StringWriter(); PrintWriter pw = new PrintWriter(bos); try { Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { pw.println("-----------"); NetworkInterface ni = networkInterfaces.nextElement(); pw.println(" * Name " + ni.getDisplayName()); byte[] hardwareAddress = ni.getHardwareAddress(); if (hardwareAddress == null || hardwareAddress.length == 0) continue; pw.println(" ** Hardware Address - " + Util.toHexString(hardwareAddress)); pw.println(" ** Index - " + ni.getIndex()); pw.println(" ** Inet Address - " + ni.getInetAddresses()); pw.println(" ** MTU - " + ni.getMTU()); pw.println(" ** Is Up - " + ni.isUp()); pw.println(" ** Is Virtual - " + ni.isVirtual()); pw.println(" ** Is Loopback - " + ni.isLoopback()); pw.println(" ** Is Point to Point - " + ni.isPointToPoint()); pw.println(" ** Supports multicast - " + ni.supportsMulticast()); if (ni.getParent() != null) { pw.println(" ** Child of - " + ni.getParent().getDisplayName()); } } } catch (SocketException e) { e.printStackTrace(pw); } finally { pw.flush(); } return bos.toString(); }

Target:
public String call() { StringBuilder bos = new StringBuilder(); try { Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { bos.append("-----------\n"); NetworkInterface ni = networkInterfaces.nextElement(); bos.append(" * Name ").append(ni.getDisplayName()).append("\n"); byte[] hardwareAddress = ni.getHardwareAddress(); if (hardwareAddress != null && hardwareAddress.length != 0) bos.append(" ** Hardware Address - ").append(Util.toHexString(hardwareAddress)).append("\n"); bos.append(" ** Index - ").append(ni.getIndex()).append("\n"); Enumeration<InetAddress> inetAddresses = ni.getInetAddresses(); while (inetAddresses.hasMoreElements()) { InetAddress inetAddress = inetAddresses.nextElement(); bos.append(" ** InetAddress - ").append(inetAddress).append("\n"); } bos.append(" ** MTU - ").append(ni.getMTU()).append("\n"); bos.append(" ** Is Up - ").append(ni.isUp()).append("\n"); bos.append(" ** Is Virtual - ").append(ni.isVirtual()).append("\n"); bos.append(" ** Is Loopback - ").append(ni.isLoopback()).append("\n"); bos.append(" ** Is Point to Point - ").append(ni.isPointToPoint()).append("\n"); bos.append(" ** Supports multicast - ").append(ni.supportsMulticast()).append("\n"); if (ni.getParent() != null) { bos.append(" ** Child of - ").append(ni.getParent().getDisplayName()).append("\n"); } } } catch (SocketException e) { bos.append(e.getMessage()); } return bos.toString(); }
Source:
private Optional<File> getReport(Configuration settings, FileSystem fs, String reportPathPropertyKey, String msg) { Optional<String> reportPathProp = settings.get(reportPathPropertyKey); if (reportPathProp.isPresent()) { if (!settings.hasKey(REPORT_PATHS_PROPERTY)) { addAnalysisWarning("Property '%s' is deprecated. '%s' should be used instead (JaCoCo XML format).", reportPathPropertyKey, JACOCO_XML_PROPERTY); } String reportPathProperty = reportPathProp.get(); File report = fs.resolvePath(reportPathProperty); if (!report.isFile()) { LOG.info(msg, reportPathProperty); } else { return Optional.of(report); } } return Optional.empty(); }

Target:
private static Optional<File> getReport(Configuration settings, FileSystem fs, String reportPathPropertyKey, String msg) { Optional<String> reportPathProp = settings.get(reportPathPropertyKey); if (reportPathProp.isPresent()) { String reportPathProperty = reportPathProp.get(); File report = fs.resolvePath(reportPathProperty); if (!report.isFile()) { LOG.info(msg, reportPathProperty); } else { return Optional.of(report); } } return Optional.empty(); }
Source:
private void convertTypeAlias() { Map<String, FileModule> fileMap = modulePrePass.getFileMap(); for (String typeName : typesToRename.keySet()) { String filename = typesToFilename.get(typeName); FileModule module = fileMap.get(filename); if (module == null) { modulePrePass.AddFileMap(filename); } module.importedNamespacesToSymbols.put(typeName, typesToRename.get(typeName)); } }

Target:
private void convertTypeAlias() { Map<String, FileModule> fileMap = modulePrepass.getFileMap(); for (Entry<String, String> entry : typesToRename.entrySet()) { String oldTypeName = entry.getKey(); String newTypeName = entry.getValue(); String filename = typesToFilename.get(oldTypeName); FileModule module = fileMap.get(filename); module.importedNamespacesToSymbols.put(oldTypeName, newTypeName); } }
Source:
private boolean checkType(TypeDefinition instanceType, String givenType) { givenType += "Type"; return instanceType.getName().getLocalPart().equals(givenType); }

Target:
private boolean checkType(TypeDefinition instanceType, String givenType) { QName qNameOfGivenType = QName.valueOf(givenType); if (instanceType.getName().equals(qNameOfGivenType)) return true; if (instanceType.getDisplayName().equals(givenType)) return true; for (XmlElement element : instanceType.getConstraint(XmlElements.class).getElements()) { if (element.getName().equals(qNameOfGivenType)) return true; } return false; }
Source:
public static void addDiskToVm(BaseDisk disk, Guid vmId) { DbFacade.getInstance().getBaseDiskDao().save(disk); VmDeviceUtils.addManagedDevice(new VmDeviceId(disk.getId(), vmId), VmDeviceType.DISK, VmDeviceType.DISK, null, true, false, ""); }

Target:
public static void addDiskToVm(BaseDisk disk, Guid vmId) { DbFacade.getInstance().getBaseDiskDao().save(disk); VmDeviceUtils.addManagedDevice(new VmDeviceId(disk.getId(), vmId), VmDeviceType.DISK, VmDeviceType.DISK, null, true, false); }
Source:
private boolean isValidPosition(Vector3i position) { if (position == null) { return false; } Block targetBlock = worldProvider.getBlock(position); Block belowBlock = worldProvider.getBlock(new Vector3i(position).addY(-1)); return (targetBlock == airBlock && !belowBlock.isPenetrable()); }

Target:
private boolean isValidPosition(Vector3i position) { if (position == null) { return false; } Block targetBlock = worldProvider.getBlock(position); position.addY(-1); Block belowBlock = worldProvider.getBlock(position); position.addY(1); return (targetBlock == airBlock && !belowBlock.isPenetrable()); }
Source:
public void versioningTest() { given() .accept("application/vnd.api+json") .get("/table") .then() .statusCode(HttpStatus.SC_OK) .body("data", hasSize(greaterThan(30))); given() .header("ApiVersion", "") .accept("application/vnd.api+json") .get("/table") .then() .statusCode(HttpStatus.SC_OK) .body("data", hasSize(greaterThan(30))); given() .header("ApiVersion", "1.0") .accept("application/vnd.api+json") .get("/table") .then() .statusCode(HttpStatus.SC_OK) .body("data", hasSize(1)) .body("data.attributes.name", hasItem("book")) .body("data.attributes.dbConnectionName", hasItem("")); given() .header("ApiVersion", "2.0") .accept("application/vnd.api+json") .get("/table") .then() .statusCode(HttpStatus.SC_INTERNAL_SERVER_ERROR); }

Target:
public void versioningTest() { given() .accept("application/vnd.api+json") .get("/table") .then() .statusCode(HttpStatus.SC_OK) .body("data", hasSize(greaterThan(30))); given() .header("ApiVersion", "") .accept("application/vnd.api+json") .get("/table") .then() .statusCode(HttpStatus.SC_OK) .body("data", hasSize(greaterThan(30))); given() .header("ApiVersion", "1.0") .accept("application/vnd.api+json") .get("/table") .then() .statusCode(HttpStatus.SC_OK) .body("data", hasSize(1)) .body("data.attributes.name", hasItem("book")) .body("data.attributes.dbConnectionName", hasItem("")); given() .header("ApiVersion", "2.0") .accept("application/vnd.api+json") .get("/table") .then() .statusCode(HttpStatus.SC_BAD_REQUEST) .body("errors.detail", hasItem("API version 2.0 not found")); }
Source:
public void validate(IValidator validatorManager, IProject rootProject, Collection<IRegion> dirtyRegions, IValidationContext helper, IReporter reporter, EditorValidationContext validationContext, IProjectValidationContext projectContext, IFile file) { init(rootProject, null, projectContext, validatorManager, reporter); setAsYouTypeValidation(true); asYouTypeTimestamp++; this.document = validationContext.getDocument(); if(dirtyRegions.size() == 1) { IRegion region = dirtyRegions.iterator().next(); try { String s = document.get(region.getOffset(), region.getLength()); if(s.indexOf(PageContextFactory.EL_START_1) < 0 && s.indexOf(PageContextFactory.EL_START_2) < 0) { return; } } catch (BadLocationException e) { e.printStackTrace(); } } ELContext elContext = PageContextFactory.createPageContext(this.document, false); if(elContext!=null) { elContext.setDirty(true); for (IRegion region : dirtyRegions) { Collection<ELReference> regionReferences = elContext.getELReferences(region); for (ELReference elReference : regionReferences) { validateEL(elReference, true, elContext); } disableProblemAnnotations(region, reporter); } if(reporter instanceof ITypedReporter) { ((ITypedReporter)reporter).addTypeForRegion(getProblemType()); } } }

Target:
public void validate(IValidator validatorManager, IProject rootProject, Collection<IRegion> dirtyRegions, IValidationContext helper, IReporter reporter, EditorValidationContext validationContext, IProjectValidationContext projectContext, IFile file) { init(rootProject, null, projectContext, validatorManager, reporter); setAsYouTypeValidation(true); asYouTypeTimestamp++; this.document = validationContext.getDocument(); if(dirtyRegions.size() == 1) { IRegion region = dirtyRegions.iterator().next(); try { String s = document.get(region.getOffset(), region.getLength()); if(s.indexOf(PageContextFactory.EL_START_1) < 0 && s.indexOf(PageContextFactory.EL_START_2) < 0) { return; } } catch (BadLocationException e) { WebKbPlugin.getDefault().logError(e); } } ELContext elContext = PageContextFactory.createPageContext(this.document, false); if(elContext!=null) { elContext.setDirty(true); for (IRegion region : dirtyRegions) { Collection<ELReference> regionReferences = elContext.getELReferences(region); for (ELReference elReference : regionReferences) { validateEL(elReference, true, elContext); } disableProblemAnnotations(region, reporter); } if(reporter instanceof ITypedReporter) { ((ITypedReporter)reporter).addTypeForRegion(getProblemType()); } } }
Source:
public void checkAttributeSyntax(PerunSessionImpl perunSession, Member member, Group group, Attribute attribute) throws WrongAttributeValueException { String membershipExpTime = (String) attribute.getValue(); if(membershipExpTime == null) return; Date testDate; try { testDate = BeansUtils.getDateFormatterWithoutTime().parse(membershipExpTime); } catch (ParseException ex) { throw new WrongAttributeValueException(attribute, "Date parsing failed", ex); } if (!BeansUtils.getDateFormatterWithoutTime().format(testDate).equals(membershipExpTime)) { throw new WrongAttributeValueException(attribute, "Wrong format yyyy-MM-dd expected."); } }

Target:
public void checkAttributeSyntax(PerunSessionImpl perunSession, Member member, Group group, Attribute attribute) throws WrongAttributeValueException { String membershipExpTime = attribute.valueAsString(); if(membershipExpTime == null) return; Date testDate; try { testDate = BeansUtils.getDateFormatterWithoutTime().parse(membershipExpTime); } catch (ParseException ex) { throw new WrongAttributeValueException(attribute, "Date parsing failed", ex); } if (!BeansUtils.getDateFormatterWithoutTime().format(testDate).equals(membershipExpTime)) { throw new WrongAttributeValueException(attribute, "Wrong format yyyy-MM-dd expected."); } }
Source:
protected void executeQueryCommand() { Map<Map.Entry<ConfigurationValues, String>, Object> configValuesMap = new HashMap<Map.Entry<ConfigurationValues, String>, Object>(); for (ConfigurationValues configValue : ConfigurationValues.values()) { if (!shouldReturnValue(configValue) || !EnumCompat.IsDefined(ConfigValues.class, configValue.toString())) { continue; } for (String version : versions) { Map.Entry<ConfigurationValues, String> key = new KeyValuePairCompat<ConfigurationValues, String>(configValue, version); Object value = Config.<Object> GetValue(ConfigValues.valueOf(configValue.toString()), version); configValuesMap.put(key, value); } } getQueryReturnValue().setReturnValue(configValuesMap); }

Target:
protected void executeQueryCommand() { Map<KeyValuePairCompat<ConfigurationValues, String>, Object> configValuesMap = new HashMap<KeyValuePairCompat<ConfigurationValues, String>, Object>(); for (ConfigurationValues configValue : ConfigurationValues.values()) { if (!shouldReturnValue(configValue) || !EnumCompat.IsDefined(ConfigValues.class, configValue.toString())) { continue; } List<String> versions = new ArrayList<String>(); versions.add(Config.DefaultConfigurationVersion); for (Version version : Version.ALL) { versions.add(version.toString()); } for (String version : versions) { KeyValuePairCompat<ConfigurationValues, String> key = new KeyValuePairCompat<ConfigurationValues, String>(configValue, version); Object value = Config.<Object> GetValue(ConfigValues.valueOf(configValue.toString()), version); configValuesMap.put(key, value); } } getQueryReturnValue().setReturnValue(configValuesMap); }
Source:
public static void deleteStructure(Structure structure) throws DotDataException { WorkFlowFactory wff = FactoryLocator.getWorkFlowFactory(); wff.deleteSchemeForStruct(structure.getInode()); InodeFactory.deleteInode(structure); try { systemEventsAPI.push(SystemEventType.DELETE_BASE_CONTENT_TYPE, new Payload(structure, Visibility.PERMISSION, String.valueOf(PermissionAPI.PERMISSION_READ))); } catch (DotDataException e) { throw new RuntimeException( e ); } }

Target:
public static void deleteStructure(Structure structure) throws DotDataException { WorkFlowFactory wff = FactoryLocator.getWorkFlowFactory(); wff.deleteSchemeForStruct(structure.getInode()); InodeFactory.deleteInode(structure); try { String actionUrl = contentTypeUtil.getActionUrl(structure); ContentTypePayloadDataWrapper contentTypePayloadDataWrapper = new ContentTypePayloadDataWrapper(actionUrl, structure); systemEventsAPI.push(SystemEventType.DELETE_BASE_CONTENT_TYPE, new Payload(contentTypePayloadDataWrapper, Visibility.PERMISSION, String.valueOf(PermissionAPI.PERMISSION_READ))); } catch (DotDataException e) { throw new BaseRuntimeInternationalizationException( e ); } }
Source:
protected Map<DropStrategy, List<Command>> findStrategies(Request request) { Map<DropStrategy, List<Command>> matchingStrategies = new LinkedHashMap<DropStrategy, List<Command>>(); for (DropStrategy strategy : DropStrategyManager.instance.getActiveStrategies()) { ArrayList<Command> selectedCommands = new ArrayList<Command>(); if(strategy instanceof TransactionalCommandsDropStrategy){ List<Command> cs = ((TransactionalCommandsDropStrategy)strategy).getCommands(request, getHost()); for(Command command : cs){ if (command != null && command.canExecute()) { selectedCommands.add(command); } } } else{ Command command = strategy.getCommand(request, getHost()); if (command != null && command.canExecute()) { selectedCommands.add(command); } } if(selectedCommands.size()>0){ matchingStrategies.put(strategy, selectedCommands); } } Command command = defaultDropStrategy.getCommand(request, getHost()); if (command != null && command.canExecute()) { ArrayList<Command> selectedCommands = new ArrayList<Command>(); selectedCommands.add(defaultDropStrategy.getCommand(request, getHost())); matchingStrategies.put(defaultDropStrategy, selectedCommands); } return matchingStrategies; }

Target:
protected Map<DropStrategy, List<Command>> findStrategies(Request request) { Map<DropStrategy, List<Command>> matchingStrategies = new LinkedHashMap<DropStrategy, List<Command>>(); for (DropStrategy strategy : DropStrategyManager.instance.getActiveStrategies()) { ArrayList<Command> selectedCommands = new ArrayList<Command>(); if(strategy instanceof TransactionalCommandsDropStrategy){ List<Command> cs = ((TransactionalCommandsDropStrategy)strategy).getCommands(request, getHost()); for(Command command : cs){ if (command != null && command.canExecute()) { selectedCommands.add(command); } } } else{ Command command = strategy.getCommand(request, getHost()); if (command != null && command.canExecute()) { selectedCommands.add(command); } } if(selectedCommands.size()>0){ matchingStrategies.put(strategy, selectedCommands); } } Command command = defaultDropStrategy.getCommand(request, getHost()); if (command != null && command.canExecute()) { ArrayList<Command> selectedCommands = new ArrayList<Command>(); selectedCommands.add(command); matchingStrategies.put(defaultDropStrategy, selectedCommands); } return matchingStrategies; }
Source:
public void trade() { for(Entry<String, ArrayList<Order>> buyList : buyOrders.entrySet()) { for ( Entry<String, ArrayList<Order>> sellList : sellOrders.entrySet()) { if (buyList.getKey() == sellList.getKey()) { ArrayList<Order> buySorted = buyOrderSort(buyList.getValue()); ArrayList<Order> sellSorted = sellOrderSort(sellList.getValue()); int buyNum = 0; int sellNum = 0; double price = 0.0; int sellVolume = 0; ArrayList<Double> values = findMarketPrice(buySorted, sellSorted); buyNum = values.get(0).intValue(); sellNum = values.get(1).intValue(); price = values.get(2); sellVolume = values.get(3).intValue(); if (buyNum != -1 && sellNum != -1 && price != -1.0){ PriceSetter set = new PriceSetter(); set.registerObserver(m.getMarketHistory()); m.getMarketHistory().setSubject(set); set.setNewPrice(m, (String)buyList.getKey(), price); for (int i = 0; i <= buyNum; i++) { Order order = buySorted.get(i); if (buyOrder.getSize() <= sellVolume) { buyOrders.get(order.getStockSymbol()).remove(order); sellVolume -= order.getSize(); } else { order.setSize(o1.getSize() - sellVolume); } try { order.getTrader().tradePerformed(order, price); } catch (StockMarketExpection e) { e.printStackTrace(); } } for (int i = 0; i <= sellNum; i++) { Order order = sellSorted.get(i); sellOrders.get(order.getStockSymbol()).remove(order); try { order.getTrader().tradePerformed(order, price); } catch (StockMarketExpection e) { e.printStackTrace(); } } } } } } }

Target:
public void trade() { for(Entry<String, ArrayList<Order>> buyList : buyOrders.entrySet()) { for ( Entry<String, ArrayList<Order>> sellList : sellOrders.entrySet()) { if (buyList.getKey() == sellList.getKey()) { ArrayList<Order> buySorted = buyOrderSort(buyList.getValue()); ArrayList<Order> sellSorted = sellOrderSort(sellList.getValue()); int buyNum = 0; int sellNum = 0; double price = 0.0; int sellVolume = 0; ArrayList<Double> values = findMarketPrice(buySorted, sellSorted); buyNum = values.get(0).intValue(); sellNum = values.get(1).intValue(); price = values.get(2); sellVolume = values.get(3).intValue(); if (buyNum != -1 && sellNum != -1 && price != -1.0){ PriceSetter set = new PriceSetter(); set.registerObserver(m.getMarketHistory()); m.getMarketHistory().setSubject(set); set.setNewPrice(m, (String)buyList.getKey(), price); performBuyOrderTrade(buySorted, buyNum, price, sellVolume); performSellOrderTrade(sellSorted, sellNum, price); } } } } }
Source:
private void storeCache() { if (progress.isShowing()) { showToast(res.getString(R.string.err_detail_still_working)); return; } if (Settings.getChooseList()) { new StoredList.UserInterface(this).promptForListSelection(R.string.list_title, new Action1<Integer>() { @Override public void call(final Integer selectedListId) { if (cache.isOffline()) { DataStore.addToList(Collections.singletonList(cache), selectedListId); new StoreCacheHandler(CacheDetailActivity.this, progress).sendEmptyMessage(CancellableHandler.DONE); } else { storeCache(selectedListId, new StoreCacheHandler(CacheDetailActivity.this, progress)); } } }, true, cache.getLists()); } else { if (cache.isOffline()) { DataStore.addToList(Collections.singletonList(cache), StoredList.TEMPORARY_LIST.id); new StoreCacheHandler(CacheDetailActivity.this, progress).sendEmptyMessage(CancellableHandler.DONE); } else { storeCache(StoredList.TEMPORARY_LIST.id, new StoreCacheHandler(this, progress)); } } }

Target:
private void storeCache() { if (progress.isShowing()) { showToast(res.getString(R.string.err_detail_still_working)); return; } if (Settings.getChooseList()) { new StoredList.UserInterface(this).promptForListSelection(R.string.list_title, new Action1<Integer>() { @Override public void call(final Integer selectedListId) { storeCacheInList(selectedListId, new StoreCacheHandler(CacheDetailActivity.this, progress)); } }, true, cache.getLists()); } else { storeCacheInList(StoredList.TEMPORARY_LIST.id, new StoreCacheHandler(this, progress)); } }
Source:
public void writeExternal( ObjectOutput out ) throws IOException { super.writeExternal(out); out.writeObject(specificName); out.writeInt(dynamicResultSets); out.writeInt(parameterCount); out.writeShort(parameterStyle); out.writeShort(sqlOptions); out.writeObject(returnType); out.writeBoolean(calledOnNullInput); out.writeInt(1); if (parameterCount != 0) { ArrayUtil.writeArrayItems(out, parameterNames); ArrayUtil.writeArrayItems(out, parameterTypes); ArrayUtil.writeIntArray(out, parameterModes); } out.writeObject(language); out.writeObject(compiledPyCode); }

Target:
public void writeExternal( ObjectOutput out ) throws IOException { super.writeExternal(out); out.writeObject(specificName); out.writeInt(dynamicResultSets); out.writeInt(parameterCount); out.writeShort(parameterStyle); out.writeShort(sqlOptions); out.writeObject(returnType); out.writeBoolean(calledOnNullInput); out.writeInt(expansionNum); if (parameterCount != 0) { ArrayUtil.writeArrayItems(out, parameterNames); ArrayUtil.writeArrayItems(out, parameterTypes); ArrayUtil.writeIntArray(out, parameterModes); } if(expansionNum==1){ out.writeObject(language); out.writeObject(compiledPyCode); } }
Source:
public void addQc(Library library, LibraryQC qc) throws IOException { Library managed = libraryDao.get(library.getId()); authorizationManager.throwIfNotWritable(managed); qc.setQcCreator(authorizationManager.getCurrentUsername()); if ("QuBit".equals(qc.getQcType().getName())) { managed.setInitialConcentration(qc.getResults()); } libraryQcDao.save(qc); libraryDao.save(library); }

Target:
public void addQc(Library library, LibraryQC qc) throws IOException { Library managed = libraryDao.get(library.getId()); authorizationManager.throwIfNotWritable(managed); qc.setQcCreator(authorizationManager.getCurrentUsername()); libraryQcDao.save(qc); libraryDao.save(library); }
Source:
public static Backup map(VmBackup entity, Backup template) { Backup model = template == null ? new Backup() : template; model.setId(entity.getId().toString()); if (entity.getFromCheckpointId() != null) { model.setFromCheckpointId(entity.getFromCheckpointId().toString()); } if (entity.getToCheckpointId() != null) { model.setToCheckpointId(entity.getToCheckpointId().toString()); } if (entity.getPhase() != null) { model.setPhase(map(entity.getPhase())); } if (entity.getDisks() != null) { model.setDisks(new Disks()); entity.getDisks().stream().map(id -> { Disk disk = new Disk(); disk.setId(id.toString()); return disk; }).forEach(model.getDisks().getDisks()::add); } if (entity.getCreationDate() != null) { model.setCreationDate(DateMapper.map(entity.getCreationDate(), null)); } if (entity.getVmId() != null) { Vm vm = new Vm(); vm.setId(entity.getVmId().toString()); model.setVm(vm); } return model; }

Target:
public static Backup map(VmBackup entity, Backup template) { Backup model = template == null ? new Backup() : template; model.setId(entity.getId().toString()); if (entity.getFromCheckpointId() != null) { model.setFromCheckpointId(entity.getFromCheckpointId().toString()); } if (entity.getToCheckpointId() != null) { model.setToCheckpointId(entity.getToCheckpointId().toString()); } if (entity.getPhase() != null) { model.setPhase(map(entity.getPhase())); } if (entity.getCreationDate() != null) { model.setCreationDate(DateMapper.map(entity.getCreationDate(), null)); } if (entity.getVmId() != null) { Vm vm = new Vm(); vm.setId(entity.getVmId().toString()); model.setVm(vm); } return model; }
Source:
public void store(String tenantId, List<Span> spans, Function<Span, String> cacheKeyEntrySupplier) throws CacheException { if (cacheContainer != null) { spansCache.startBatch(); } for (Span span : spans) { if (log.isLoggable(Level.FINEST)) { log.finest("Store span [id=" + span.getId() + "]: " + span); } spansCache.put(cacheKeyEntrySupplier.apply(span), span, 1, TimeUnit.MINUTES); if (span.getParentId() != null && !span.serverSpan()) { Set<Span> children = childrenCache.get(span.getParentId()); if (children == null) { children = new HashSet<>(); childrenCache.put(span.getParentId(), children); } children.add(span); } } if (cacheContainer != null) { spansCache.endBatch(true); } }

Target:
public void store(String tenantId, List<Span> spans, Function<Span, String> cacheKeyEntrySupplier) throws CacheException { if (cacheContainer != null) { spansCache.startBatch(); childrenCache.startBatch(); traceCache.startBatch(); } for (Span span : spans) { log.debugf("Store span [%s]" + span); spansCache.put(cacheKeyEntrySupplier.apply(span), span, 1, TimeUnit.MINUTES); if (span.getTraceId() != null) { Set<Span> trace = traceCache.get(span.getTraceId()); if (trace == null) { trace = new HashSet<>(); } trace.add(span); traceCache.put(span.getTraceId(), trace); } if (span.getParentId() != null && !span.serverSpan()) { Set<Span> children = childrenCache.get(span.getParentId()); if (children == null) { children = new HashSet<>(); } children.add(span); childrenCache.put(span.getParentId(), children); } } EmbeddedCacheManager embeddedCacheManager; if (cacheContainer != null) { spansCache.endBatch(true); childrenCache.endBatch(true); traceCache.endBatch(true); } }
Source:
public Result beginTransaction(HttpServletRequest request, HttpServletResponse response) throws IOException, FileUploadException { Logger logger = newLogger().endpoint(this); Transaction transaction = null; try { String encryptionPassword = request.getParameter(ENCRYPTION_PASSWORD_KEY); if (StringUtils.isEmpty(encryptionPassword)) { logger.responseStatus(BAD_REQUEST_400) .warn("encryption password required but none provided"); response.setStatus(BAD_REQUEST_400); return new Result("encryption password required but none provided", true, null); } logger.info("creating new publishing transaction"); transaction = getTransactionService().create(encryptionPassword); logger.transactionID(transaction.id()).info("transaction created successfully"); response.setStatus(OK_200); return new Result("New transaction created.", false, transaction); } catch (IOException e) { response.setStatus(INTERNAL_SERVER_ERROR_500); logger.error(e, "unexpected error while attempting to create transaction"); return new Result("beingTransaction encountered unexpected error", true, transaction); } }

Target:
public Result beginTransaction(HttpServletRequest request, HttpServletResponse response) throws IOException, FileUploadException { LogBuilder log = logBuilder().endpoint(this); Transaction transaction = null; try { String encryptionPassword = request.getParameter(ENCRYPTION_PASSWORD_KEY); if (StringUtils.isEmpty(encryptionPassword)) { log.responseStatus(BAD_REQUEST_400) .warn("bad request: encryption password required but none provided"); response.setStatus(BAD_REQUEST_400); return new Result("encryption password required but none provided", true, null); } log.info("creating new publishing transaction"); transaction = getTransactionsService().create(encryptionPassword); log.transactionID(transaction.id()).info("transaction created successfully"); response.setStatus(OK_200); return new Result("New transaction created.", false, transaction); } catch (IOException e) { response.setStatus(INTERNAL_SERVER_ERROR_500); log.error(e, "unexpected error while attempting to create transaction"); return new Result("beingTransaction encountered unexpected error", true, transaction); } }