1 17 package org.alfresco.filesys.smb; 18 19 28 29 public final class SMBErrorText 30 { 31 32 39 public final static String ErrorString(int errclass, int errcode) 40 { 41 42 44 String errtext = null; 45 46 switch (errclass) 47 { 48 49 51 case SMBStatus.Success: 52 errtext = "The request was successful"; 53 break; 54 55 57 case SMBStatus.ErrDos: 58 errtext = DOSErrorText(errcode); 59 break; 60 61 63 case SMBStatus.ErrSrv: 64 errtext = ServerErrorText(errcode); 65 break; 66 67 69 case SMBStatus.ErrHrd: 70 errtext = HardwareErrorText(errcode); 71 break; 72 73 75 case SMBStatus.NetErr: 76 errtext = NetworkErrorText(errcode); 77 break; 78 79 81 case SMBStatus.JLANErr: 82 errtext = JLANErrorText(errcode); 83 break; 84 85 87 case SMBStatus.NTErr: 88 errtext = NTErrorText(errcode); 89 break; 90 91 93 case SMBStatus.Win32Err: 94 errtext = Win32ErrorText(errcode); 95 break; 96 97 99 case SMBStatus.DCERPCErr: 100 errtext = DCERPCErrorText(errcode); 101 break; 102 103 105 case SMBStatus.ErrCmd: 106 errtext = "Command was not in the SMB format"; 107 break; 108 } 109 110 if (errtext == null) 111 errtext = "[Unknown error status/class: " + errclass + "," + errcode + "]"; 112 113 115 return errtext; 116 } 117 118 124 125 private static String DOSErrorText(int errcode) 126 { 127 128 130 String errtext = null; 131 132 switch (errcode) 133 { 134 case 1: 135 errtext = "Invalid function. Server did not recognize/perform system call"; 136 break; 137 case 2: 138 errtext = "File not found"; 139 break; 140 case 3: 141 errtext = "Directory invalid"; 142 break; 143 case 4: 144 errtext = "Too many open files"; 145 break; 146 case 5: 147 errtext = "Access denied"; 148 break; 149 case 6: 150 errtext = "Invalid file handle"; 151 break; 152 case 7: 153 errtext = "Memory control blocks destroyed"; 154 break; 155 case 8: 156 errtext = "Insufficient server memory to perform function"; 157 break; 158 case 9: 159 errtext = "Invalid memory block address"; 160 break; 161 case 10: 162 errtext = "Invalid environment"; 163 break; 164 case 11: 165 errtext = "Invalid format"; 166 break; 167 case 12: 168 errtext = "Invalid open mode"; 169 break; 170 case 13: 171 errtext = "Invalid data, in server IOCTL call"; 172 break; 173 case 15: 174 errtext = "Invalid drive specified"; 175 break; 176 case 16: 177 errtext = "Delete directory attempted to delete servers directory"; 178 break; 179 case 17: 180 errtext = "Not same device"; 181 break; 182 case 18: 183 errtext = "No more files"; 184 break; 185 case 32: 186 errtext = "File sharing mode conflict"; 187 break; 188 case 33: 189 errtext = "Lock request conflicts with existing lock"; 190 break; 191 case 66: 192 errtext = "IPC not supported"; 193 break; 194 case 80: 195 errtext = "File already exists"; 196 break; 197 case 110: 198 errtext = "Cannot open the file specified"; 199 break; 200 case 124: 201 errtext = "Unknown information level"; 202 break; 203 case SMBStatus.DOSDirectoryNotEmpty: 204 errtext = "Directory not empty"; 205 break; 206 case 230: 207 errtext = "Named pipe invalid"; 208 break; 209 case 231: 210 errtext = "All instances of pipe are busy"; 211 break; 212 case 232: 213 errtext = "Named pipe close in progress"; 214 break; 215 case 233: 216 errtext = "No process on other end of named pipe"; 217 break; 218 case 234: 219 errtext = "More data to be returned"; 220 break; 221 case 267: 222 errtext = "Invalid directory name in path"; 223 break; 224 case 275: 225 errtext = "Extended attributes did not fit"; 226 break; 227 case 282: 228 errtext = "Extended attributes not supported"; 229 break; 230 case 2142: 231 errtext = "Unknown IPC"; 232 break; 233 } 234 235 237 return errtext; 238 } 239 240 246 private final static String HardwareErrorText(int errcode) 247 { 248 249 251 String errtext = null; 252 253 switch (errcode) 254 { 255 case 19: 256 errtext = "Attempt to write on write protected media"; 257 break; 258 case 20: 259 errtext = "Unknown unit"; 260 break; 261 case 21: 262 errtext = "Drive not ready"; 263 break; 264 case 22: 265 errtext = "Unknown command"; 266 break; 267 case 23: 268 errtext = "Data error (CRC)"; 269 break; 270 case 24: 271 errtext = "Bad request structure length"; 272 break; 273 case 25: 274 errtext = "Seek error"; 275 break; 276 case 26: 277 errtext = "Unknown media type"; 278 break; 279 case 27: 280 errtext = "Sector not found"; 281 break; 282 case 28: 283 errtext = "Printer out of paper"; 284 break; 285 case 29: 286 errtext = "Write fault"; 287 break; 288 case 30: 289 errtext = "Read fault"; 290 break; 291 case 31: 292 errtext = "General failure"; 293 break; 294 case 32: 295 errtext = "Open conflicts with existing open"; 296 break; 297 case 33: 298 errtext = "Lock request conflicted with existing lock"; 299 break; 300 case 34: 301 errtext = "Wrong disk was found in a drive"; 302 break; 303 case 35: 304 errtext = "No FCBs are available to process request"; 305 break; 306 case 36: 307 errtext = "A sharing buffer has been exceeded"; 308 break; 309 } 310 311 313 return errtext; 314 } 315 316 322 private static String JLANErrorText(int errcode) 323 { 324 325 327 String errtext = null; 328 329 switch (errcode) 330 { 331 case SMBStatus.JLANUnsupportedDevice: 332 errtext = "Invalid device type for dialect"; 333 break; 334 case SMBStatus.JLANNoMoreSessions: 335 errtext = "No more sessions available"; 336 break; 337 case SMBStatus.JLANSessionNotActive: 338 errtext = "Session is not active"; 339 break; 340 case SMBStatus.JLANInvalidSMBReceived: 341 errtext = "Invalid SMB response received"; 342 break; 343 case SMBStatus.JLANLargeFilesNotSupported: 344 errtext = "Large files not supported"; 345 break; 346 case SMBStatus.JLANInvalidFileInfo: 347 errtext = "Invalid file information for level"; 348 break; 349 case SMBStatus.JLANDceRpcNotSupported: 350 errtext = "Server does not support DCE/RPC requests"; 351 break; 352 } 353 return errtext; 354 } 355 356 362 private final static String NetworkErrorText(int errcode) 363 { 364 365 367 String errtext = null; 368 369 switch (errcode) 370 { 371 case SMBStatus.NETAccessDenied: 372 errtext = "Access denied"; 373 break; 374 case SMBStatus.NETInvalidHandle: 375 errtext = "Invalid handle"; 376 break; 377 case SMBStatus.NETUnsupported: 378 errtext = "Function not supported"; 379 break; 380 case SMBStatus.NETBadDeviceType: 381 errtext = "Bad device type"; 382 break; 383 case SMBStatus.NETBadNetworkName: 384 errtext = "Bad network name"; 385 break; 386 case SMBStatus.NETAlreadyAssigned: 387 errtext = "Already assigned"; 388 break; 389 case SMBStatus.NETInvalidPassword: 390 errtext = "Invalid password"; 391 break; 392 case SMBStatus.NETInvParameter: 393 errtext = "Incorrect parameter"; 394 break; 395 case SMBStatus.NETContinued: 396 errtext = "Transaction continued ..."; 397 break; 398 case SMBStatus.NETNoMoreItems: 399 errtext = "No more items"; 400 break; 401 case SMBStatus.NETInvalidAddress: 402 errtext = "Invalid address"; 403 break; 404 case SMBStatus.NETServiceDoesNotExist: 405 errtext = "Service does not exist"; 406 break; 407 case SMBStatus.NETBadDevice: 408 errtext = "Bad device"; 409 break; 410 case SMBStatus.NETNoNetOrBadPath: 411 errtext = "No network or bad path"; 412 break; 413 case SMBStatus.NETExtendedError: 414 errtext = "Extended error"; 415 break; 416 case SMBStatus.NETNoNetwork: 417 errtext = "No network"; 418 break; 419 case SMBStatus.NETCancelled: 420 errtext = "Cancelled"; 421 break; 422 case SMBStatus.NETSrvNotRunning: 423 errtext = "Server service is not running"; 424 break; 425 case SMBStatus.NETBufferTooSmall: 426 errtext = "Supplied buffer is too small"; 427 break; 428 case SMBStatus.NETNoTransactions: 429 errtext = "Server is not configured for transactions"; 430 break; 431 case SMBStatus.NETInvQueueName: 432 errtext = "Invalid queue name"; 433 break; 434 case SMBStatus.NETNoSuchPrintJob: 435 errtext = "Specified print job could not be located"; 436 break; 437 case SMBStatus.NETNotResponding: 438 errtext = "Print process is not responding"; 439 break; 440 case SMBStatus.NETSpoolerNotStarted: 441 errtext = "Spooler is not started on the remote server"; 442 break; 443 case SMBStatus.NETCannotPerformOp: 444 errtext = "Operation cannot be performed on the print job in it's current state"; 445 break; 446 case SMBStatus.NETErrLoadLogonScript: 447 errtext = "Error occurred running/loading logon script"; 448 break; 449 case SMBStatus.NETLogonNotValidated: 450 errtext = "Logon was not validated by any server"; 451 break; 452 case SMBStatus.NETLogonSrvOldSoftware: 453 errtext = "Logon server is running old software version, cannot validate logon"; 454 break; 455 case SMBStatus.NETUserNameNotFound: 456 errtext = "User name was not found"; 457 break; 458 case SMBStatus.NETUserLgnWkNotAllowed: 459 errtext = "User is not allowed to logon from this computer"; 460 break; 461 case SMBStatus.NETUserLgnTimeNotAllowed: 462 errtext = "USer is not allowed to logon at this time"; 463 break; 464 case SMBStatus.NETUserPasswordExpired: 465 errtext = "User password has expired"; 466 break; 467 case SMBStatus.NETPasswordCannotChange: 468 errtext = "Password cannot be changed"; 469 break; 470 case SMBStatus.NETPasswordTooShort: 471 errtext = "Password is too short"; 472 break; 473 } 474 475 477 return errtext; 478 } 479 480 486 private final static String ServerErrorText(int errcode) 487 { 488 489 491 String errtext = null; 492 switch (errcode) 493 { 494 case 1: 495 errtext = "Non-specific error"; 496 break; 497 case 2: 498 errtext = "Bad password"; 499 break; 500 case 4: 501 errtext = "Client does not have access rights"; 502 break; 503 case 5: 504 errtext = "Invalid TID"; 505 break; 506 case 6: 507 errtext = "Invalid network name"; 508 break; 509 case 7: 510 errtext = "Invalid device"; 511 break; 512 case 49: 513 errtext = "Print queue full (files)"; 514 break; 515 case 50: 516 errtext = "Print queue full (space)"; 517 break; 518 case 51: 519 errtext = "EOF on print queue dump"; 520 break; 521 case 52: 522 errtext = "Invalid print file FID"; 523 break; 524 case 64: 525 errtext = "Server did not recognize the command received"; 526 break; 527 case 65: 528 errtext = "Internal server error"; 529 break; 530 case 67: 531 errtext = "FID and pathname combination invalid"; 532 break; 533 case 69: 534 errtext = "Invalid access permission"; 535 break; 536 case 71: 537 errtext = "Invalid attribute mode"; 538 break; 539 case 81: 540 errtext = "Server is paused"; 541 break; 542 case 82: 543 errtext = "Not receiving messages"; 544 break; 545 case 83: 546 errtext = "No room to buffer message"; 547 break; 548 case 87: 549 errtext = "Too many remote user names"; 550 break; 551 case 88: 552 errtext = "Operation timed out"; 553 break; 554 case 89: 555 errtext = "No resources available for request"; 556 break; 557 case 90: 558 errtext = "Too many UIDs active on session"; 559 break; 560 case 91: 561 errtext = "Invalid UID"; 562 break; 563 case 250: 564 errtext = "Unable to support RAW, use MPX"; 565 break; 566 case 251: 567 errtext = "Unable to support RAW, use standard read/write"; 568 break; 569 case 252: 570 errtext = "Continue in MPX mode"; 571 break; 572 case 65535: 573 errtext = "Function not supported"; 574 break; 575 } 576 577 579 return errtext; 580 } 581 582 588 private final static String NTErrorText(int errcode) 589 { 590 591 593 String errtext = ""; 594 595 switch (errcode) 596 { 597 case SMBStatus.NTSuccess: 598 errtext = "The request was successful"; 599 break; 600 case SMBStatus.NTAccessDenied: 601 errtext = "Access denied"; 602 break; 603 case SMBStatus.NTObjectNotFound: 604 errtext = "Object not found"; 605 break; 606 case SMBStatus.Win32InvalidHandle: 607 errtext = "Invalid handle"; 608 break; 609 case SMBStatus.Win32BadDeviceType: 610 errtext = "Bad device type"; 611 break; 612 case SMBStatus.Win32BadNetworkName: 613 errtext = "Bad network name"; 614 break; 615 case SMBStatus.Win32AlreadyAssigned: 616 errtext = "Already assigned"; 617 break; 618 case SMBStatus.Win32InvalidPassword: 619 errtext = "Invalid password"; 620 break; 621 case SMBStatus.NTInvalidParameter: 622 errtext = "Invalid parameter"; 623 break; 624 case SMBStatus.Win32MoreData: 625 errtext = "More data available"; 626 break; 627 case SMBStatus.Win32NoMoreItems: 628 errtext = "No more items"; 629 break; 630 case SMBStatus.Win32InvalidAddress: 631 errtext = "Invalid address"; 632 break; 633 case SMBStatus.Win32ServiceDoesNotExist: 634 errtext = "Service does not exist"; 635 break; 636 case SMBStatus.Win32BadDevice: 637 errtext = "Bad device"; 638 break; 639 case SMBStatus.Win32NoNetOrBadPath: 640 errtext = "No network or bad path"; 641 break; 642 case SMBStatus.Win32ExtendedError: 643 errtext = "Extended error"; 644 break; 645 case SMBStatus.Win32NoNetwork: 646 errtext = "No network"; 647 break; 648 case SMBStatus.NTCancelled: 649 errtext = "Cancelled"; 650 break; 651 case SMBStatus.NTBufferOverflow: 652 errtext = "Buffer overflow"; 653 break; 654 case SMBStatus.NTNoSuchFile: 655 errtext = "No such file"; 656 break; 657 case SMBStatus.NTInvalidDeviceRequest: 658 errtext = "Invalid device request"; 659 break; 660 case SMBStatus.NTMoreProcessingRequired: 661 errtext = "More processing required"; 662 break; 663 case SMBStatus.NTInvalidSecDescriptor: 664 errtext = "Invalid security descriptor"; 665 break; 666 case SMBStatus.NTNotSupported: 667 errtext = "Not supported"; 668 break; 669 case SMBStatus.NTBadDeviceType: 670 errtext = "Bad device type"; 671 break; 672 case SMBStatus.NTObjectPathNotFound: 673 errtext = "Object path not found"; 674 break; 675 case SMBStatus.NTLogonFailure: 676 errtext = "Logon failure"; 677 break; 678 case SMBStatus.NTAccountDisabled: 679 errtext = "Account disabled"; 680 break; 681 case SMBStatus.NTNoneMapped: 682 errtext = "None mapped"; 683 break; 684 case SMBStatus.NTInvalidInfoClass: 685 errtext = "Invalid information class"; 686 break; 687 case SMBStatus.NTObjectNameCollision: 688 errtext = "Object name collision"; 689 break; 690 case SMBStatus.NTNotImplemented: 691 errtext = "Not implemented"; 692 break; 693 case SMBStatus.NTFileOffline: 694 errtext = "File is offline"; 695 break; 696 case SMBStatus.NTSharingViolation: 697 errtext = "Sharing violation"; 698 break; 699 case SMBStatus.NTBadNetName: 700 errtext = "Bad network name"; 701 break; 702 case SMBStatus.NTBufferTooSmall: 703 errtext = "Buffer too small"; 704 break; 705 case SMBStatus.NTLockConflict: 706 errtext = "Lock conflict"; 707 break; 708 case SMBStatus.NTLockNotGranted: 709 errtext = "Lock not granted"; 710 break; 711 case SMBStatus.NTRangeNotLocked: 712 errtext = "Range not locked"; 713 break; 714 case SMBStatus.NTDiskFull: 715 errtext = "Disk full"; 716 break; 717 case SMBStatus.NTTooManyOpenFiles: 718 errtext = "Too many open files"; 719 break; 720 case SMBStatus.NTRequestNotAccepted: 721 errtext = "Request not accepted"; 722 break; 723 case SMBStatus.NTNoSuchDomain: 724 errtext = "No such domain"; 725 break; 726 case SMBStatus.NTNoMoreFiles: 727 errtext = "No more files"; 728 break; 729 case SMBStatus.NTObjectNameInvalid: 730 errtext = "Object name invalid"; 731 break; 732 case SMBStatus.NTPipeBusy: 733 errtext = "Pipe is busy"; 734 break; 735 default: 736 errtext = "Unknown NT status 0x" + Integer.toHexString(errcode); 737 break; 738 } 739 return errtext; 740 } 741 742 748 private final static String Win32ErrorText(int errcode) 749 { 750 751 753 String errtext = ""; 754 755 switch (errcode) 756 { 757 case SMBStatus.Win32FileNotFound: 758 errtext = "File not found"; 759 break; 760 case SMBStatus.Win32PathNotFound: 761 errtext = "Path not found"; 762 break; 763 case SMBStatus.Win32AccessDenied: 764 errtext = "Access denied"; 765 break; 766 case SMBStatus.Win32InvalidHandle: 767 errtext = "Invalid handle"; 768 break; 769 case SMBStatus.Win32BadDeviceType: 770 errtext = "Bad device type"; 771 break; 772 case SMBStatus.Win32BadNetworkName: 773 errtext = "Bad network name"; 774 break; 775 case SMBStatus.Win32AlreadyAssigned: 776 errtext = "Already assigned"; 777 break; 778 case SMBStatus.Win32InvalidPassword: 779 errtext = "Invalid password"; 780 break; 781 case SMBStatus.Win32MoreEntries: 782 errtext = "More entries"; 783 break; 784 case SMBStatus.Win32MoreData: 785 errtext = "More data"; 786 break; 787 case SMBStatus.Win32NoMoreItems: 788 errtext = "No more items"; 789 break; 790 case SMBStatus.Win32InvalidAddress: 791 errtext = "Invalid address"; 792 break; 793 case SMBStatus.Win32ServiceDoesNotExist: 794 errtext = "Service does not exist"; 795 break; 796 case SMBStatus.Win32ServiceMarkedForDelete: 797 errtext = "Service marked for delete"; 798 break; 799 case SMBStatus.Win32ServiceExists: 800 errtext = "Service already exists"; 801 break; 802 case SMBStatus.Win32ServiceDuplicateName: 803 errtext = "Duplicate service name"; 804 break; 805 case SMBStatus.Win32BadDevice: 806 errtext = "Bad device"; 807 break; 808 case SMBStatus.Win32NoNetOrBadPath: 809 errtext = "No network or bad path"; 810 break; 811 case SMBStatus.Win32ExtendedError: 812 errtext = "Extended error"; 813 break; 814 case SMBStatus.Win32NoNetwork: 815 errtext = "No network"; 816 break; 817 default: 818 errtext = "Unknown Win32 status 0x" + Integer.toHexString(errcode); 819 break; 820 } 821 return errtext; 822 } 823 824 830 private final static String DCERPCErrorText(int errcode) 831 { 832 833 835 if (errcode == SMBStatus.DCERPC_Fault) 836 return "DCE/RPC Fault"; 837 return "DCE/RPC Error 0x" + Integer.toHexString(errcode); 838 } 839 } | Popular Tags |